WeeAgent
Wire it to your data
The AppBridge
The host app connects the agent to its records and navigation via an AppBridge. This is the only glue you write.
1import {
2 WeeAgentProvider, WeeAgentDock, GhostCursor,
3 moveCursorTo, hideCursor, type AppBridge,
4} from "@/weeagent";
5
6const bridge: AppBridge = {
7 listRecords: () => myRecords, // [{ id, title, ... }]
8 getRecord: (ref) => myRecords.find(
9 (r) => r.id === ref || r.title === ref),
10 openRecord: async (id) => {
11 navigateTo(id); // your navigation
12 const el = document.querySelector(`[data-rec="${id}"]`);
13 if (el) {
14 const b = el.getBoundingClientRect();
15 await moveCursorTo(b.left + 40, b.top + b.height / 2);
16 }
17 hideCursor();
18 },
19 updateRecord: (id, patch) => applyPatch(id, patch), // optional
20};Mount the provider, dock and cursor
1<WeeAgentProvider bridge={bridge} userName={user.firstName}>
2 <GhostCursor /> {/* mount once, at the root */}
3 <YourApp />
4 <WeeAgentDock title="Copilot" suggestions={["Open X", "Update Y"]} />
5</WeeAgentProvider>The ghost cursor
- Add
data-rec="<id>"to the rows/cards the agent should be able to click. - Inside
openRecord, combine your navigation withmoveCursorTo(x, y), thenhideCursor(). - Mount
<GhostCursor />exactly once, at the root.
Models
Pick the model from the dock header. Edit the catalog in src/weeagent/lib/models.ts to fit your budget.