@llui/agent 0.0.51 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/agentConnect.d.ts.map +1 -1
- package/dist/client/agentConnect.js +45 -31
- package/dist/client/agentConnect.js.map +1 -1
- package/dist/client/effect-handler.d.ts +0 -21
- package/dist/client/effect-handler.d.ts.map +1 -1
- package/dist/client/effect-handler.js +0 -26
- package/dist/client/effect-handler.js.map +1 -1
- package/dist/client/effects.d.ts +0 -23
- package/dist/client/effects.d.ts.map +1 -1
- package/dist/client/effects.js.map +1 -1
- package/dist/client/factory.d.ts +0 -9
- package/dist/client/factory.d.ts.map +1 -1
- package/dist/client/factory.js +0 -2
- package/dist/client/factory.js.map +1 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/ws-client.d.ts +0 -9
- package/dist/client/ws-client.d.ts.map +1 -1
- package/dist/client/ws-client.js +0 -32
- package/dist/client/ws-client.js.map +1 -1
- package/dist/mcp/tools.d.ts +19 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +176 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/protocol.d.ts +1 -50
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/dist/server/cloudflare/durable-object.d.ts +14 -44
- package/dist/server/cloudflare/durable-object.d.ts.map +1 -1
- package/dist/server/cloudflare/durable-object.js +21 -49
- package/dist/server/cloudflare/durable-object.js.map +1 -1
- package/dist/server/cloudflare/index.d.ts +3 -10
- package/dist/server/cloudflare/index.d.ts.map +1 -1
- package/dist/server/cloudflare/index.js +3 -10
- package/dist/server/cloudflare/index.js.map +1 -1
- package/dist/server/core.d.ts +1 -11
- package/dist/server/core.d.ts.map +1 -1
- package/dist/server/core.js +0 -1
- package/dist/server/core.js.map +1 -1
- package/dist/server/factory.d.ts.map +1 -1
- package/dist/server/factory.js +14 -1
- package/dist/server/factory.js.map +1 -1
- package/dist/server/lap/router.d.ts.map +1 -1
- package/dist/server/lap/router.js +0 -3
- package/dist/server/lap/router.js.map +1 -1
- package/dist/server/mcp/router.d.ts +26 -0
- package/dist/server/mcp/router.d.ts.map +1 -0
- package/dist/server/mcp/router.js +81 -0
- package/dist/server/mcp/router.js.map +1 -0
- package/dist/server/mcp/server.d.ts +26 -0
- package/dist/server/mcp/server.d.ts.map +1 -0
- package/dist/server/mcp/server.js +116 -0
- package/dist/server/mcp/server.js.map +1 -0
- package/dist/server/mcp/session-map.d.ts +18 -0
- package/dist/server/mcp/session-map.d.ts.map +1 -0
- package/dist/server/mcp/session-map.js +13 -0
- package/dist/server/mcp/session-map.js.map +1 -0
- package/dist/server/options.d.ts +13 -0
- package/dist/server/options.d.ts.map +1 -1
- package/dist/server/options.js.map +1 -1
- package/dist/server/ws/pairing-registry.d.ts +0 -101
- package/dist/server/ws/pairing-registry.d.ts.map +1 -1
- package/dist/server/ws/pairing-registry.js +0 -160
- package/dist/server/ws/pairing-registry.js.map +1 -1
- package/package.json +8 -2
- package/styles/agent-panel.css +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;GAQG;AAEH,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAoB1B,MAAM,CAAC,MAAM,6BAA6B,GAA0B;IAClE,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,+EAA+E;IAC5F,MAAM,EAAE,KAAK;CACd,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAiC;IACtE;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,WAAW,EACT,kZ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AAS;QACf,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,uGAAuG;QACzG,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,UAAU;KACpB;CACF,CAAA","sourcesContent":["import { z } from 'zod'\n\n/**\n * Shared MCP tool catalogue for the LLui agent. Consumed by both:\n * - `@llui/agent` server-side MCP router (routes to LAP handlers internally)\n * - `llui-agent` bridge (forwards to remote LAP over HTTP)\n *\n * `connect_session` is intentionally absent — the two surfaces have\n * different signatures (bridge needs `url` + `token`; server only needs\n * `token`). Each defines its own.\n */\n\nconst empty = z.object({})\n\nexport interface McpForwardedToolDescriptor {\n kind: 'forward'\n name: string\n description: string\n schema: z.ZodObject<z.ZodRawShape>\n /** LAP endpoint path relative to the base path, e.g. '/observe'. */\n lapPath: string\n}\n\nexport interface McpMetaToolDescriptor {\n kind: 'meta'\n name: string\n description: string\n schema: z.ZodObject<z.ZodRawShape>\n}\n\nexport type McpToolDescriptor = McpForwardedToolDescriptor | McpMetaToolDescriptor\n\nexport const DISCONNECT_SESSION_DESCRIPTOR: McpMetaToolDescriptor = {\n kind: 'meta',\n name: 'disconnect_session',\n description: 'Clear the session binding. Subsequent tool calls will fail until reconnected.',\n schema: empty,\n}\n\nexport const FORWARDED_TOOL_DESCRIPTORS: McpForwardedToolDescriptor[] = [\n {\n kind: 'forward',\n name: 'observe',\n description:\n 'Unified snapshot — returns {state, actions, description, context} in one call. Use this as the default \"what can I see, what can I do\" read; prefer it over describe_app + get_state + list_actions. Typical flow: observe → send_message → (repeat). The response includes the static app description (name, version, msgSchema, docs) on every call so first-time callers do not need a separate describe_app.',\n schema: empty,\n lapPath: '/observe',\n },\n {\n kind: 'forward',\n name: 'describe_app',\n description:\n \"Return the bound app's name, version, state/message schemas, annotations, and static docs. Legacy — prefer `observe`, which includes this as `description`.\",\n schema: empty,\n lapPath: '/describe',\n },\n {\n kind: 'forward',\n name: 'get_state',\n description:\n 'Return the current app state. Optional `path` (JSON-pointer) to narrow the slice. Legacy for full-state reads — prefer `observe`. Still useful for scoped reads via JSON pointer.',\n schema: z.object({\n path: z.string().optional().describe('Optional JSON-pointer, e.g. \"/user/name\"'),\n }),\n lapPath: '/state',\n },\n {\n kind: 'forward',\n name: 'query_state',\n description:\n 'Read a single slice of state via JSON-pointer path. Returns `{found: true, value}` on hit or `{found: false, detail}` on miss (missing key, walking through null, etc.). Cheaper than `observe` when checking one field. Path syntax: `\"\"` (whole state), `\"/auth/user\"`, `\"/items/0/id\"`, `\"/key~1with~1slash\"` (escaped `/`), `\"/key~0tilde\"` (escaped `~`).',\n schema: z.object({\n path: z.string().describe('JSON-pointer (RFC 6901) — `/auth/user` or `\"\"` for whole state'),\n }),\n lapPath: '/query-state',\n },\n {\n kind: 'forward',\n name: 'describe_recent_actions',\n description:\n 'Return the most recent log entries for this session (newest first). Each `dispatched` entry includes a `stateDiff` showing what changed. Useful for self-correction over multi-step flows — read your own past dispatches without re-querying full state. Filter by `kind` (e.g. `\"dispatched\"`) to skip read-only entries.',\n schema: z.object({\n n: z.number().int().positive().optional().describe('How many entries to return (default 10)'),\n kind: z\n .string()\n .optional()\n .describe('Filter to a specific kind (e.g. \"dispatched\", \"read\", \"error\")'),\n }),\n lapPath: '/recent-actions',\n },\n {\n kind: 'forward',\n name: 'would_dispatch',\n description:\n 'Predict what dispatching `msg` would do without committing it. Runs the reducer in isolation against current state and returns `{stateDiff, effects}`. Effects are listed but NOT executed — the cloud is not hit, analytics do not fire. Use this to weigh a candidate action before sending: \"if I dispatch X, will it change Y?\" Pure-reducer assumption: if the reducer branches on Date.now() / localStorage / random, prediction drifts from real dispatch by exactly that impurity.',\n schema: z.object({\n msg: z\n .object({ type: z.string() })\n .passthrough()\n .describe('The candidate message; must have a `type` string'),\n }),\n lapPath: '/would-dispatch',\n },\n {\n kind: 'forward',\n name: 'list_actions',\n description:\n 'Return the currently-affordable actions: visible UI bindings plus agent-affordable registry entries, filtered by annotation gates. Legacy — prefer `observe`, which includes this as `actions`.',\n schema: empty,\n lapPath: '/actions',\n },\n {\n kind: 'forward',\n name: 'send_message',\n description:\n 'Dispatch a message to the app. Blocks by default until the message queue goes idle (drain semantics — captures http/delay/debounce round-trips that feed back as messages). Returns {status, stateDiff, actions, drain} on dispatched, {status: \"pending-confirmation\", confirmId} when the variant is @requiresConfirm, or {status: \"rejected\", reason} on validation failures. By default the response carries `stateDiff` (a JSON-Patch-shaped delta) and not the full post-state — apply the diff to the snapshot you got from `connect`/`observe`. Pass `includeState: true` if you want the full snapshot back (rare; expensive on bandwidth and context for large states). `drain.timedOut: true` means the 5s cap was hit while messages were still arriving — follow up with `observe` to resync. `actions` in the response reflects the new state, so you normally do not need a separate `observe` after a send.',\n schema: z.object({\n msg: z\n .object({ type: z.string() })\n .passthrough()\n .describe('The message to dispatch; must have a `type` string'),\n reason: z\n .string()\n .optional()\n .describe('User-facing rationale (required for confirm-gated variants)'),\n waitFor: z\n .enum(['drained', 'idle', 'none'])\n .optional()\n .describe(\n '\"drained\" (default) waits for the message queue to go idle; \"idle\" flushes the update cycle only (no async effects); \"none\" is fire-and-forget.',\n ),\n drainQuietMs: z\n .number()\n .optional()\n .describe(\n 'Quiescence window for waitFor:\"drained\". Drain completes when no commit fires for this many ms. Default 100.',\n ),\n timeoutMs: z\n .number()\n .optional()\n .describe(\n 'Hard cap on total wait. Default 5000. For waitFor:\"drained\", this bounds how long the drain loop runs; for pending-confirmation, how long to wait for user approval.',\n ),\n includeState: z\n .boolean()\n .optional()\n .describe(\n 'Include the full post-drain `stateAfter` snapshot in the response. Default false — `stateDiff` is what callers normally need, and resending the full state on every dispatch wastes bandwidth and context. Set true only when you need a fresh snapshot back (e.g., after a long-running effect that may have produced changes the diff misses).',\n ),\n }),\n lapPath: '/message',\n },\n {\n kind: 'forward',\n name: 'get_confirm_result',\n description:\n 'Poll a pending-confirmation by confirmId. Returns confirmed / rejected / still-pending.',\n schema: z.object({\n confirmId: z.string(),\n timeoutMs: z.number().optional(),\n }),\n lapPath: '/confirm-result',\n },\n {\n kind: 'forward',\n name: 'wait_for_change',\n description:\n 'Long-poll for a state change. Returns changed / timeout. Specialized — use for external state pushes (WebSocket messages, timers) that arrive while Claude is idle. For the normal send-then-read loop, `send_message` with `waitFor:\"drained\"` already waits for effect round-trips.',\n schema: z.object({\n path: z\n .string()\n .optional()\n .describe('Optional JSON-pointer to narrow which state changes trigger resolution'),\n timeoutMs: z.number().optional(),\n }),\n lapPath: '/wait',\n },\n {\n kind: 'forward',\n name: 'narrate',\n description:\n 'Push a one-line prose update into the in-app activity feed without dispatching a Msg. Use BEFORE long-running actions (\"Looking at your cart now…\", \"Calling the pricing API — should take ~2s\"), to surface inferred reasoning (\"I notice you have an unsaved draft in `notes` — assuming you want to keep it\"), or to acknowledge user input before acting on it. Keep narration single-line and present-tense; the user reads it in the activity panel inline with your dispatched actions. The text shows up as a `narrate`-kind entry — distinct from `dispatched` and `read`. Returns { ok: true } once the host runtime has the entry.',\n schema: z.object({\n text: z.string().describe('The narration prose, ideally one sentence. Required.'),\n intent: z\n .string()\n .optional()\n .describe(\n 'Short label shown next to the narration (e.g. \"Thinking\", \"Notice\", \"Plan\"). Defaults to \"Agent narrated\".',\n ),\n }),\n lapPath: '/narrate',\n },\n {\n kind: 'forward',\n name: 'query_dom',\n description: 'Read elements tagged with data-agent=\"<name>\" in the rendered UI.',\n schema: z.object({\n name: z.string(),\n multiple: z.boolean().optional(),\n }),\n lapPath: '/query-dom',\n },\n {\n kind: 'forward',\n name: 'describe_visible_content',\n description: 'Return a structured outline of the currently-visible data-agent-tagged subtrees.',\n schema: empty,\n lapPath: '/describe-visible',\n },\n {\n kind: 'forward',\n name: 'describe_context',\n description:\n 'Return the current per-state narrative docs (agentContext) — what the user is trying to do right now.',\n schema: empty,\n lapPath: '/context',\n },\n]\n"]}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -275,25 +275,6 @@ export type LapConfirmResultResponse = {
|
|
|
275
275
|
} | {
|
|
276
276
|
status: 'still-pending';
|
|
277
277
|
};
|
|
278
|
-
/**
|
|
279
|
-
* Long-poll for the user's next chat-composer submission. Returns
|
|
280
|
-
* `{ status: 'submitted', text, at }` on receipt of a
|
|
281
|
-
* `user-input-submitted` WS frame from the paired runtime, or
|
|
282
|
-
* `{ status: 'timeout' }` after `timeoutMs`. Each submission is
|
|
283
|
-
* delivered to exactly one waiter (FIFO); arrivals while no waiter
|
|
284
|
-
* is parked are buffered up to a small bound so a quick "type before
|
|
285
|
-
* Claude reaches the tool call" doesn't lose the message.
|
|
286
|
-
*/
|
|
287
|
-
export type LapWaitForUserInputRequest = {
|
|
288
|
-
timeoutMs?: number;
|
|
289
|
-
};
|
|
290
|
-
export type LapWaitForUserInputResponse = {
|
|
291
|
-
status: 'submitted';
|
|
292
|
-
text: string;
|
|
293
|
-
at: number;
|
|
294
|
-
} | {
|
|
295
|
-
status: 'timeout';
|
|
296
|
-
};
|
|
297
278
|
/**
|
|
298
279
|
* Push narration prose into the activity feed without dispatching a
|
|
299
280
|
* Msg. The agent uses this for "I'm thinking…" / "About to do X
|
|
@@ -440,10 +421,6 @@ export type LapEndpointMap = {
|
|
|
440
421
|
req: LapWaitRequest;
|
|
441
422
|
res: LapWaitResponse;
|
|
442
423
|
};
|
|
443
|
-
'/lap/v1/wait-for-user-input': {
|
|
444
|
-
req: LapWaitForUserInputRequest;
|
|
445
|
-
res: LapWaitForUserInputResponse;
|
|
446
|
-
};
|
|
447
424
|
'/lap/v1/narrate': {
|
|
448
425
|
req: LapNarrateRequest;
|
|
449
426
|
res: LapNarrateResponse;
|
|
@@ -469,14 +446,6 @@ export type LapPath = keyof LapEndpointMap;
|
|
|
469
446
|
export type LapRequest<P extends LapPath> = LapEndpointMap[P]['req'];
|
|
470
447
|
export type LapResponse<P extends LapPath> = LapEndpointMap[P]['res'];
|
|
471
448
|
export type LogKind = 'proposed' | 'dispatched' | 'confirmed' | 'rejected' | 'blocked' | 'read' | 'error'
|
|
472
|
-
/**
|
|
473
|
-
* The user typed a message into the in-app chat composer (the agentChat
|
|
474
|
-
* namespace) and submitted it. The agent's `wait_for_user_input` tool
|
|
475
|
-
* picks up the same submission. Surfacing it in the activity log is
|
|
476
|
-
* what makes the agent panel a real conversational surface — agent
|
|
477
|
-
* actions and user replies share one chronological timeline.
|
|
478
|
-
*/
|
|
479
|
-
| 'user-input'
|
|
480
449
|
/**
|
|
481
450
|
* The agent emitted prose into the activity feed via `/lap/v1/narrate`
|
|
482
451
|
* — narration like "thinking about your request…", "I'm about to add
|
|
@@ -539,25 +508,7 @@ export type LogAppendFrame = {
|
|
|
539
508
|
t: 'log-append';
|
|
540
509
|
entry: LogEntry;
|
|
541
510
|
};
|
|
542
|
-
|
|
543
|
-
* Inverted input channel. The user submits a message through the in-app
|
|
544
|
-
* chat composer (`agentChat`); the runtime forwards the text on this
|
|
545
|
-
* frame to the pairing server, which routes it to the parked
|
|
546
|
-
* `wait_for_user_input` LAP call (if any).
|
|
547
|
-
*
|
|
548
|
-
* The runtime ALSO appends a synthetic `LogEntry { kind: 'user-input' }`
|
|
549
|
-
* to the local activity log so the panel renders it inline with agent
|
|
550
|
-
* actions — the conversation reads as a single timeline. The frame and
|
|
551
|
-
* the log entry are independent: the frame travels server-side and
|
|
552
|
-
* delivers Claude's reply trigger; the log entry stays browser-side
|
|
553
|
-
* for visibility.
|
|
554
|
-
*/
|
|
555
|
-
export type UserInputSubmittedFrame = {
|
|
556
|
-
t: 'user-input-submitted';
|
|
557
|
-
text: string;
|
|
558
|
-
at: number;
|
|
559
|
-
};
|
|
560
|
-
export type ClientFrame = HelloFrame | RpcReplyFrame | RpcErrorFrame | ConfirmResolvedFrame | StateUpdateFrame | LogAppendFrame | UserInputSubmittedFrame;
|
|
511
|
+
export type ClientFrame = HelloFrame | RpcReplyFrame | RpcErrorFrame | ConfirmResolvedFrame | StateUpdateFrame | LogAppendFrame;
|
|
561
512
|
export type RpcFrame = {
|
|
562
513
|
t: 'rpc';
|
|
563
514
|
id: string;
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 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E,MAAM,CAAA;CAAE,CAAA;AAEtE,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAC3C,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAA;AAElD,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,CAAA;AAI3D,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,gBAAgB,GAChB,aAAa,GACb,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,aAAa,CAAA;AAEjB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,KAAK,EAAE,UAAU,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AASD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,aAAa,CAAA"}
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AACjE,iEAAiE;AAynBjE,qEAAqE;AACrE,EAAE;AACF,qEAAqE;AACrE,4DAA4D;AAC5D,mEAAmE;AACnE,qCAAqC;AAErC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,GAEf,MAAM,aAAa,CAAA","sourcesContent":["// ── LAP — LLui Agent Protocol ────────────────────────────────────\n// JSON over HTTPS between the llui-agent bridge (MCP side) and the\n// @llui/agent server library mounted in the developer's backend.\n// See docs/superpowers/specs/2026-04-19-llui-agent-design.md §7.\n\nexport type LapErrorCode =\n | 'auth-failed'\n | 'revoked'\n | 'paused'\n | 'rate-limited'\n | 'invalid'\n | 'schema-error'\n | 'timeout'\n | 'internal'\n\nexport type LapError = {\n error: {\n code: LapErrorCode\n detail?: string\n retryAfterMs?: number\n }\n}\n\n/**\n * Who can dispatch a Msg variant.\n *\n * - `'shared'` (default) — both UI bindings and the agent can dispatch.\n * - `'human-only'` — UI-only. Agent calls to `/message` for these variants\n * are rejected with `LapMessageRejectReason: 'human-only'`. Use for\n * internal UI events (focus/blur, scroll, hover) the LLM has no business\n * triggering.\n * - `'agent-only'` — no UI binding exists. Reserved for LLM-driven flows\n * like batch operations or \"explain this state\" introspection variants.\n * Lint warns if a view references one via `send({ type: 'X' })`.\n *\n * JSDoc sugar: `@humanOnly` → `'human-only'`, `@agentOnly` → `'agent-only'`.\n * Absence of either tag → `'shared'`. The two tags are mutually exclusive\n * (enforced by `llui/agent-exclusive-annotations` ESLint rule).\n */\nexport type DispatchMode = 'shared' | 'human-only' | 'agent-only'\n\nexport type MessageAnnotations = {\n intent: string | null\n alwaysAffordable: boolean\n requiresConfirm: boolean\n dispatchMode: DispatchMode\n /**\n * Concrete copy-paste example dispatches authored as `@example`\n * JSDoc tags. Multiple tags on one variant become multiple\n * entries (mix typical / edge cases without nesting strings).\n */\n examples: string[]\n /**\n * Non-blocking caution authored as `@warning`. Distinct from\n * `requiresConfirm` (runtime user gate); this informs the LLM at\n * affordance time so it can decide whether the dispatch's\n * downstream is acceptable.\n */\n warning: string | null\n /**\n * Effect kinds this variant emits when dispatched, declared via\n * `@emits(\"kind1\", \"kind2\")`. Lets the agent reason about side\n * effects (cloud writes, analytics, persistent state changes)\n * before dispatching, and chunk multi-step flows accordingly\n * (\"don't dispatch X 100 times — each one fires cloud/save\").\n * Empty when the variant doesn't emit effects or the author hasn't\n * annotated it yet.\n */\n emits: string[]\n /**\n * Boolean predicate authored as `@routeGated(\"expr\")` JSDoc, with\n * `state` bound at evaluation time. The variant only surfaces in\n * `list_actions` when the predicate returns true. Compile-time\n * alternative to `agentAffordances(state) => Msg[]` for the common\n * case of \"this Msg is reachable when state.X looks like Y.\" Null\n * when the variant has no `@routeGated` tag (default affordance\n * behavior applies).\n */\n routeGate?: string | null\n}\n\nexport type MessageSchemaEntry = {\n payloadSchema: object\n annotations: MessageAnnotations\n}\n\nexport type LapDescribeResponse = {\n name: string\n version: string\n stateSchema: object\n messages: Record<string, MessageSchemaEntry>\n docs: AgentDocs | null\n conventions: {\n dispatchModel: 'TEA'\n confirmationModel: 'runtime-mediated'\n readSurfaces: readonly (\n | 'state'\n | 'query_dom'\n | 'describe_visible_content'\n | 'describe_context'\n )[]\n }\n schemaHash: string\n}\n\nexport type LapStateRequest = { path?: string }\nexport type LapStateResponse = { state: unknown }\n\nexport type LapActionsResponse = {\n actions: Array<{\n variant: string\n /**\n * Human-readable phrase from `@intent(\"…\")`, or `null` when the\n * variant has no `@intent` annotation. Callers that surface\n * affordances to an LLM should treat `null` as \"this action is\n * undocumented\" — neither synthesise a label from the variant name\n * nor invent one. Pre-`@intent` variants would previously surface\n * as `intent: \"<variant>\"` here, which made unannotated actions\n * indistinguishable from properly-labelled ones; emitting `null`\n * keeps the gap visible.\n */\n intent: string | null\n requiresConfirm: boolean\n /**\n * `'shared'` — both UI and agent can dispatch. `'agent-only'` — no UI\n * binding exists; the agent is the sole dispatcher. `'human-only'`\n * variants never appear here (filtered before serialization).\n */\n dispatchMode: 'shared' | 'agent-only'\n /**\n * Where this affordance came from:\n * - `'binding'` — a tagged event handler is currently\n * mounted in the rendered DOM.\n * - `'always-affordable'` — the app's `agentAffordances(state)`\n * hook listed it as available right now.\n * - `'schema'` — neither of the above; the variant\n * is in the Msg union and annotated `@agentOnly`. The\n * `payloadHint` carries a synthesized example from the\n * compiler-derived field types — copy-paste-ready for\n * `send_message`. Bulk-edit operations land here.\n */\n source: 'binding' | 'always-affordable' | 'schema'\n selectorHint: string | null\n payloadHint: object | null\n /** Cautionary text from `@warning` JSDoc, or null. */\n warning: string | null\n /** Concrete examples from `@example` JSDoc, in source order. */\n examples: string[]\n /**\n * Effect kinds this variant emits, from `@emits(\"k1\", \"k2\")`.\n * Empty when not annotated.\n */\n emits: string[]\n /**\n * Per-field guidance lifted from `@should(\"…\")` JSDoc on payload\n * fields. Path is dot/bracket notation rooted at the payload (e.g.\n * `\"cells[].meta\"`). Surfaces hints that would otherwise be buried\n * inside the schema tree, so callers can read them alongside\n * `examples` without diving into `description.messages.variants`.\n */\n fieldHints: Array<{ path: string; hint: string }>\n }>\n}\n\nexport type LapMessageRequest = {\n msg: { type: string; [k: string]: unknown }\n reason?: string\n /**\n * Backpressure contract for how long `/message` waits before returning:\n * - `drained` (default): dispatch, then loop until the message queue is\n * idle for `drainQuietMs` ms or the 5s hard cap trips. Captures any\n * effect round-trips (http/delay/debounce) that feed back as messages.\n * - `idle`: dispatch + flush + one microtask yield. Captures the\n * synchronous update cycle but not async effects.\n * - `none`: dispatch and return without flushing. For high-throughput\n * fire-and-forget dispatch.\n */\n waitFor?: 'drained' | 'idle' | 'none'\n /**\n * Quiescence window when `waitFor === 'drained'`. Drain completes when\n * no new update cycle fires for this many ms. Default 100ms — long\n * enough for a localhost HTTP round-trip, short enough to be\n * imperceptible. Ignored for `idle` / `none`.\n */\n drainQuietMs?: number\n /**\n * Hard cap on total wait time. When `waitFor === 'drained'`, this is\n * the upper bound on how long the drain loop can run; if reached, the\n * response carries `drain.timedOut: true` with partial results. For\n * `pending-confirmation` messages, this is how long to wait for\n * the user's confirm/reject. Default 5_000ms.\n */\n timeoutMs?: number\n /**\n * Include the full post-drain `stateAfter` snapshot in the response.\n * Default `false` — the response carries `stateDiff` only and the\n * caller applies it to the prior snapshot (from connect/observe). For\n * apps with non-trivial state, the diff is orders of magnitude\n * smaller than the full state, and resending the snapshot on every\n * dispatch wastes bandwidth and (for LLM callers) context budget.\n *\n * Set `true` when the caller doesn't track state incrementally and\n * wants the snapshot back. The legacy `confirmed` and `wait` paths\n * always carry `stateAfter` because their flow is asynchronous and\n * a diff would be ambiguous.\n */\n includeState?: boolean\n}\n\nexport type LapMessageRejectReason =\n | 'human-only'\n | 'user-cancelled'\n | 'timeout'\n | 'invalid'\n | 'schema-error'\n | 'revoked'\n | 'paused'\n\n/**\n * Drain metadata attached to `dispatched` / `confirmed` responses.\n * `effectsObserved` counts update-cycle commits (not individual effects) —\n * it's a proxy for \"how much activity happened during the drain window.\"\n * `errors` surfaces sync throws from `onEffect` and unhandled rejections\n * from effect handlers that fired during the drain window, so the LLM\n * can see when an HTTP handler crashed silently.\n *\n * `warnings` surfaces non-blocking observations from the schema\n * validator — typically `untyped-field` flags raised in strict mode\n * when the agent provided a value for an `'unknown'`-typed field. The\n * dispatch landed (we accepted the value) but the validator couldn't\n * structurally check it, so the agent learns of the gap and can\n * tighten the next try if needed. Lenient mode never emits warnings;\n * the field is omitted in that case.\n */\nexport type LapDrainMeta = {\n effectsObserved: number\n durationMs: number\n timedOut: boolean\n errors: Array<{ kind: 'error' | 'unhandledrejection'; message: string; stack?: string }>\n warnings?: Array<{ path: string; code: string; message: string }>\n}\n\nexport type LapMessageResponse =\n | {\n status: 'dispatched'\n /**\n * Full post-drain state snapshot. Present only when the caller\n * passed `includeState: true` in the request — by default,\n * `stateDiff` is the only state-shaped field on the response\n * because callers can apply the diff to the prior snapshot from\n * `connect` / `observe`. See `LapMessageRequest.includeState`.\n */\n stateAfter?: unknown\n /**\n * Structural diff from pre-dispatch state to post-drain state,\n * in JSON-Patch shape (RFC 6902 subset: `add`, `remove`,\n * `replace`). Empty when the dispatch produced no observable\n * state change. The default state surface for callers — apply\n * incrementally to the snapshot from `connect`/`observe`.\n */\n stateDiff: import('./state-diff.js').StateDiff\n actions: LapActionsResponse['actions']\n drain: LapDrainMeta\n }\n | { status: 'pending-confirmation'; confirmId: string }\n | {\n /**\n * The user approved a `pending-confirmation` message. `stateAfter`\n * is the state snapshot captured when the approve was resolved;\n * effects produced by the approved dispatch may still be in\n * flight. The LLM should follow up with an `observe` call to\n * pick up a drained view and fresh actions — by design the\n * confirm path doesn't carry drain semantics because approval\n * can arrive arbitrarily later than the original request.\n */\n status: 'confirmed'\n stateAfter: unknown\n }\n | { status: 'rejected'; reason: LapMessageRejectReason; detail?: string }\n\nexport type LapConfirmResultRequest = { confirmId: string; timeoutMs?: number }\nexport type LapConfirmResultResponse =\n | { status: 'confirmed'; stateAfter: unknown }\n | { status: 'rejected'; reason: 'user-cancelled' | 'timeout' }\n | { status: 'still-pending' }\n\n/**\n * Long-poll for the user's next chat-composer submission. Returns\n * `{ status: 'submitted', text, at }` on receipt of a\n * `user-input-submitted` WS frame from the paired runtime, or\n * `{ status: 'timeout' }` after `timeoutMs`. Each submission is\n * delivered to exactly one waiter (FIFO); arrivals while no waiter\n * is parked are buffered up to a small bound so a quick \"type before\n * Claude reaches the tool call\" doesn't lose the message.\n */\nexport type LapWaitForUserInputRequest = { timeoutMs?: number }\nexport type LapWaitForUserInputResponse =\n | { status: 'submitted'; text: string; at: number }\n | { status: 'timeout' }\n\n/**\n * Push narration prose into the activity feed without dispatching a\n * Msg. The agent uses this for \"I'm thinking…\" / \"About to do X\n * because…\" / \"I noticed Y, going to investigate\" — running commentary\n * the user can read inline with agent actions.\n *\n * The server synthesizes a `LogEntry { kind: 'narrate', detail: text }`,\n * appends it to the per-tid recent-log buffer (visible to subsequent\n * `describe_recent_actions` calls), AND pushes a `log-push` frame to\n * the paired browser so the in-app activity feed renders it in real\n * time. No client roundtrip — the agent gets `{ ok: true }` synchronously\n * once the server has accepted the narration.\n */\nexport type LapNarrateRequest = {\n text: string\n /**\n * Optional one-line label for the entry's `intent` field, e.g.\n * \"Thinking\" / \"Notice\" / \"Plan\". Defaults to \"Agent narrated\"\n * when omitted.\n */\n intent?: string\n}\nexport type LapNarrateResponse = { ok: true }\n\nexport type LapWaitRequest = { path?: string; timeoutMs?: number }\nexport type LapWaitResponse =\n | { status: 'changed'; stateAfter: unknown }\n | { status: 'timeout'; stateAfter: unknown }\n\nexport type LapQueryDomRequest = { name: string; multiple?: boolean }\nexport type LapQueryDomResponse = {\n elements: Array<{ text: string; attrs: Record<string, string>; path: number[] }>\n}\n\nexport type OutlineNode =\n | { kind: 'heading'; level: number; text: string }\n | { kind: 'text'; text: string }\n | { kind: 'list'; items: OutlineNode[] }\n | { kind: 'item'; text: string; children?: OutlineNode[] }\n | { kind: 'button'; text: string; disabled: boolean; actionVariant: string | null }\n | { kind: 'input'; label: string | null; value: string | null; type: string }\n | { kind: 'link'; text: string; href: string }\n\nexport type LapDescribeVisibleResponse = {\n outline: OutlineNode[]\n /**\n * Where the outline came from:\n * - `'data-agent'`: the app has `data-agent`-tagged zones and the\n * walker scoped the outline to them. The author chose what to\n * surface; trust the result.\n * - `'fallback'`: no `data-agent` tags exist; the walker fell back\n * to a depth- and count-limited semantic walk of the entire\n * root element. Useful for first-pass dogfood targets that\n * haven't tagged their views.\n * - `'truncated'`: same as `'fallback'` but the cap (200 nodes)\n * was hit before the walk finished. The visible content beyond\n * that point is not represented; reach for `query_dom` or state\n * reads if you need more.\n */\n source: 'data-agent' | 'fallback' | 'truncated'\n}\n\n// ── App + context documentation ──────────────────────────────────\n// Static app-level docs (authored once on the component record) and\n// dynamic per-state context docs (pure function of state, served by\n// `/lap/v1/context`). See spec §5.4.\n\nexport type AgentDocs = {\n purpose: string\n overview?: string\n cautions?: string[]\n /**\n * Free-form idiomatic-usage examples authored by the app: typical\n * sequences of dispatches the LLM should know about, like \"to\n * delete a saved matrix: dispatch Confirm/Ask first, then on\n * approve dispatch Cloud/Delete.\" Each entry is one example;\n * order is up to the author.\n */\n examples?: string[]\n}\n\nexport type AgentContext = {\n summary: string\n hints?: string[]\n cautions?: string[]\n}\n\nexport type LapContextResponse = { context: AgentContext }\n\n// ── Unified observe ──────────────────────────────────────────────\n// Single-call bootstrap. Replaces the get_state + list_actions +\n// describe_app trio for the common \"what can I see, what can I do\"\n// question. Returns the dynamic state + actions slice alongside the\n// static description (name/version/messages/docs) and any\n// state-derived context so one round-trip gives the LLM everything it\n// needs to decide its next action.\n\nexport type LapObserveResponse = {\n state: unknown\n actions: LapActionsResponse['actions']\n description: LapDescribeResponse\n context: AgentContext | null\n}\n\n// LAP endpoint catalog — a compile-time map binding each path to its\n// request/response shape. Useful for the bridge's dispatcher and for\n// typed test helpers.\nexport type LapEndpointMap = {\n '/lap/v1/describe': { req: null; res: LapDescribeResponse }\n '/lap/v1/state': { req: LapStateRequest; res: LapStateResponse }\n '/lap/v1/actions': { req: null; res: LapActionsResponse }\n '/lap/v1/message': { req: LapMessageRequest; res: LapMessageResponse }\n '/lap/v1/confirm-result': { req: LapConfirmResultRequest; res: LapConfirmResultResponse }\n '/lap/v1/wait': { req: LapWaitRequest; res: LapWaitResponse }\n '/lap/v1/wait-for-user-input': {\n req: LapWaitForUserInputRequest\n res: LapWaitForUserInputResponse\n }\n '/lap/v1/narrate': { req: LapNarrateRequest; res: LapNarrateResponse }\n '/lap/v1/query-dom': { req: LapQueryDomRequest; res: LapQueryDomResponse }\n '/lap/v1/describe-visible': { req: null; res: LapDescribeVisibleResponse }\n '/lap/v1/context': { req: null; res: LapContextResponse }\n '/lap/v1/observe': { req: null; res: LapObserveResponse }\n}\n\nexport type LapPath = keyof LapEndpointMap\nexport type LapRequest<P extends LapPath> = LapEndpointMap[P]['req']\nexport type LapResponse<P extends LapPath> = LapEndpointMap[P]['res']\n\n// ── Relay WS frames ──────────────────────────────────────────────\n// Bidirectional framing between the LLui runtime in the browser and\n// the @llui/agent server over /agent/ws. See spec §10.5.\n\nexport type LogKind =\n | 'proposed'\n | 'dispatched'\n | 'confirmed'\n | 'rejected'\n | 'blocked'\n | 'read'\n | 'error'\n /**\n * The user typed a message into the in-app chat composer (the agentChat\n * namespace) and submitted it. The agent's `wait_for_user_input` tool\n * picks up the same submission. Surfacing it in the activity log is\n * what makes the agent panel a real conversational surface — agent\n * actions and user replies share one chronological timeline.\n */\n | 'user-input'\n /**\n * The agent emitted prose into the activity feed via `/lap/v1/narrate`\n * — narration like \"thinking about your request…\", \"I'm about to add\n * an alternative because…\", or any out-of-band commentary that\n * doesn't fit a `dispatched` / `read` lifecycle. Lets the agent talk\n * to the user inside the app without inventing a fake `@agentOnly`\n * Msg type.\n */\n | 'narrate'\n\nexport type LogEntry = {\n id: string\n at: number\n kind: LogKind\n variant?: string\n intent?: string\n detail?: string\n /**\n * Structural diff from pre-dispatch state to post-drain state, in\n * JSON-Patch shape. Populated only for `kind: 'dispatched'` entries\n * — read entries (get_state / list_actions / observe / …) don't\n * mutate state, and an empty diff would just be noise. Lets the\n * agent reconstruct what each past action did without re-fetching\n * state snapshots.\n */\n stateDiff?: import('./state-diff.js').StateDiff\n}\n\nexport type HelloFrame = {\n t: 'hello'\n appName: string\n appVersion: string\n msgSchema: Record<string, MessageSchemaEntry>\n stateSchema: object\n affordancesSample: object[]\n docs: AgentDocs | null\n schemaHash: string\n}\n\nexport type RpcReplyFrame = { t: 'rpc-reply'; id: string; result: unknown }\nexport type RpcErrorFrame = { t: 'rpc-error'; id: string; code: string; detail?: string }\nexport type ConfirmResolvedFrame = {\n t: 'confirm-resolved'\n confirmId: string\n outcome: 'confirmed' | 'user-cancelled'\n stateAfter?: unknown\n}\nexport type StateUpdateFrame = { t: 'state-update'; path: string; stateAfter: unknown }\nexport type LogAppendFrame = { t: 'log-append'; entry: LogEntry }\n/**\n * Inverted input channel. The user submits a message through the in-app\n * chat composer (`agentChat`); the runtime forwards the text on this\n * frame to the pairing server, which routes it to the parked\n * `wait_for_user_input` LAP call (if any).\n *\n * The runtime ALSO appends a synthetic `LogEntry { kind: 'user-input' }`\n * to the local activity log so the panel renders it inline with agent\n * actions — the conversation reads as a single timeline. The frame and\n * the log entry are independent: the frame travels server-side and\n * delivers Claude's reply trigger; the log entry stays browser-side\n * for visibility.\n */\nexport type UserInputSubmittedFrame = {\n t: 'user-input-submitted'\n text: string\n at: number\n}\n\nexport type ClientFrame =\n | HelloFrame\n | RpcReplyFrame\n | RpcErrorFrame\n | ConfirmResolvedFrame\n | StateUpdateFrame\n | LogAppendFrame\n | UserInputSubmittedFrame\n\nexport type RpcFrame = { t: 'rpc'; id: string; tool: string; args: unknown }\nexport type RevokedFrame = { t: 'revoked' }\nexport type ActiveFrame = { t: 'active' }\n/**\n * Server-pushed log entry. Used today by the `narrate` LAP method:\n * the agent calls `/lap/v1/narrate { text }`, the server synthesizes\n * a `LogEntry { kind: 'narrate' }` and pushes it down to the paired\n * runtime so the in-app activity feed renders the narration in real\n * time. Distinct from the browser-emitted `log-append` frame:\n * `log-append` is browser → server (rpc-derived audit), `log-push`\n * is server → browser (server-originated entries, no echo).\n */\nexport type LogPushFrame = { t: 'log-push'; entry: LogEntry }\n\nexport type ServerFrame = RpcFrame | RevokedFrame | ActiveFrame | LogPushFrame\n\n// ── Tokens + pairing ─────────────────────────────────────────────\n\ndeclare const TokenBrand: unique symbol\nexport type AgentToken = string & { readonly [TokenBrand]: 'AgentToken' }\n\nexport type TokenStatus =\n | 'awaiting-ws'\n | 'awaiting-claude'\n | 'active'\n | 'pending-resume'\n | 'revoked'\n\nexport type TokenRecord = {\n tid: string\n /**\n * SHA-256 hex of the bearer token. The plaintext token is never\n * stored — incoming requests hash their `Authorization: Bearer …`\n * value and look up by this field. Hash-only storage keeps a leaked\n * store from being a live-token leak. Mirrors the standard session-\n * cookie / API-key pattern.\n */\n tokenHash: string\n uid: string | null\n status: TokenStatus\n createdAt: number\n /**\n * Hard-expiry in milliseconds since epoch. The mint endpoint sets\n * this to `now + hardExpiryMs`; the verify path rejects requests\n * presenting tokens whose record has `expiresAt <= now`. Pre-0.0.35\n * the equivalent value lived inside the JWT payload as `exp` (in\n * seconds); the new opaque-token flow keeps it server-side so the\n * record is the single source of truth.\n */\n expiresAt: number\n lastSeenAt: number\n pendingResumeUntil: number | null\n origin: string\n label: string | null\n}\n\nexport type AgentSession = {\n tid: string\n label: string\n status: 'active' | 'pending-resume' | 'revoked'\n createdAt: number\n lastSeenAt: number\n}\n\n// HTTP envelopes for the mint/resume/revoke/sessions endpoints (non-LAP).\n\nexport type MintRequest = Record<string, never>\nexport type MintResponse = {\n token: AgentToken\n tid: string\n wsUrl: string\n lapUrl: string\n expiresAt: number\n}\n\nexport type ResumeListRequest = { tids: string[] }\nexport type ResumeListResponse = { sessions: AgentSession[] }\n\nexport type ResumeClaimRequest = { tid: string }\nexport type ResumeClaimResponse = { token: AgentToken; wsUrl: string }\n\nexport type RevokeRequest = { tid: string }\nexport type RevokeResponse = { status: 'revoked' }\n\nexport type SessionsResponse = { sessions: AgentSession[] }\n\n// ── Audit ────────────────────────────────────────────────────────\n\nexport type AuditEvent =\n | 'mint'\n | 'claim'\n | 'resume'\n | 'revoke'\n | 'lap-call'\n | 'msg-dispatched'\n | 'msg-blocked'\n | 'confirm-proposed'\n | 'confirm-approved'\n | 'confirm-rejected'\n | 'rate-limited'\n | 'auth-failed'\n\nexport type AuditEntry = {\n at: number\n tid: string | null\n uid: string | null\n event: AuditEvent\n detail: object\n}\n\n// ── Codec exports ─────────────────────────────────────────────────\n//\n// Re-exported here so consumers can `import { ..., type AgentCodec }\n// from '@llui/agent/protocol'`. The implementation lives in\n// `./codecs.ts` to keep the protocol type surface together but the\n// runtime registry/walkers separate.\n\nexport {\n WIRE_TAG,\n WIRE_VALUE,\n CodecRegistry,\n isoDateCodec,\n epochMillisCodec,\n makeDefaultCodecs,\n encodeForWire,\n decodeFromWire,\n type AgentCodec,\n} from './codecs.js'\n"]}
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AACjE,iEAAiE;AA4kBjE,qEAAqE;AACrE,EAAE;AACF,qEAAqE;AACrE,4DAA4D;AAC5D,mEAAmE;AACnE,qCAAqC;AAErC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,GAEf,MAAM,aAAa,CAAA","sourcesContent":["// ── LAP — LLui Agent Protocol ────────────────────────────────────\n// JSON over HTTPS between the llui-agent bridge (MCP side) and the\n// @llui/agent server library mounted in the developer's backend.\n// See docs/superpowers/specs/2026-04-19-llui-agent-design.md §7.\n\nexport type LapErrorCode =\n | 'auth-failed'\n | 'revoked'\n | 'paused'\n | 'rate-limited'\n | 'invalid'\n | 'schema-error'\n | 'timeout'\n | 'internal'\n\nexport type LapError = {\n error: {\n code: LapErrorCode\n detail?: string\n retryAfterMs?: number\n }\n}\n\n/**\n * Who can dispatch a Msg variant.\n *\n * - `'shared'` (default) — both UI bindings and the agent can dispatch.\n * - `'human-only'` — UI-only. Agent calls to `/message` for these variants\n * are rejected with `LapMessageRejectReason: 'human-only'`. Use for\n * internal UI events (focus/blur, scroll, hover) the LLM has no business\n * triggering.\n * - `'agent-only'` — no UI binding exists. Reserved for LLM-driven flows\n * like batch operations or \"explain this state\" introspection variants.\n * Lint warns if a view references one via `send({ type: 'X' })`.\n *\n * JSDoc sugar: `@humanOnly` → `'human-only'`, `@agentOnly` → `'agent-only'`.\n * Absence of either tag → `'shared'`. The two tags are mutually exclusive\n * (enforced by `llui/agent-exclusive-annotations` ESLint rule).\n */\nexport type DispatchMode = 'shared' | 'human-only' | 'agent-only'\n\nexport type MessageAnnotations = {\n intent: string | null\n alwaysAffordable: boolean\n requiresConfirm: boolean\n dispatchMode: DispatchMode\n /**\n * Concrete copy-paste example dispatches authored as `@example`\n * JSDoc tags. Multiple tags on one variant become multiple\n * entries (mix typical / edge cases without nesting strings).\n */\n examples: string[]\n /**\n * Non-blocking caution authored as `@warning`. Distinct from\n * `requiresConfirm` (runtime user gate); this informs the LLM at\n * affordance time so it can decide whether the dispatch's\n * downstream is acceptable.\n */\n warning: string | null\n /**\n * Effect kinds this variant emits when dispatched, declared via\n * `@emits(\"kind1\", \"kind2\")`. Lets the agent reason about side\n * effects (cloud writes, analytics, persistent state changes)\n * before dispatching, and chunk multi-step flows accordingly\n * (\"don't dispatch X 100 times — each one fires cloud/save\").\n * Empty when the variant doesn't emit effects or the author hasn't\n * annotated it yet.\n */\n emits: string[]\n /**\n * Boolean predicate authored as `@routeGated(\"expr\")` JSDoc, with\n * `state` bound at evaluation time. The variant only surfaces in\n * `list_actions` when the predicate returns true. Compile-time\n * alternative to `agentAffordances(state) => Msg[]` for the common\n * case of \"this Msg is reachable when state.X looks like Y.\" Null\n * when the variant has no `@routeGated` tag (default affordance\n * behavior applies).\n */\n routeGate?: string | null\n}\n\nexport type MessageSchemaEntry = {\n payloadSchema: object\n annotations: MessageAnnotations\n}\n\nexport type LapDescribeResponse = {\n name: string\n version: string\n stateSchema: object\n messages: Record<string, MessageSchemaEntry>\n docs: AgentDocs | null\n conventions: {\n dispatchModel: 'TEA'\n confirmationModel: 'runtime-mediated'\n readSurfaces: readonly (\n | 'state'\n | 'query_dom'\n | 'describe_visible_content'\n | 'describe_context'\n )[]\n }\n schemaHash: string\n}\n\nexport type LapStateRequest = { path?: string }\nexport type LapStateResponse = { state: unknown }\n\nexport type LapActionsResponse = {\n actions: Array<{\n variant: string\n /**\n * Human-readable phrase from `@intent(\"…\")`, or `null` when the\n * variant has no `@intent` annotation. Callers that surface\n * affordances to an LLM should treat `null` as \"this action is\n * undocumented\" — neither synthesise a label from the variant name\n * nor invent one. Pre-`@intent` variants would previously surface\n * as `intent: \"<variant>\"` here, which made unannotated actions\n * indistinguishable from properly-labelled ones; emitting `null`\n * keeps the gap visible.\n */\n intent: string | null\n requiresConfirm: boolean\n /**\n * `'shared'` — both UI and agent can dispatch. `'agent-only'` — no UI\n * binding exists; the agent is the sole dispatcher. `'human-only'`\n * variants never appear here (filtered before serialization).\n */\n dispatchMode: 'shared' | 'agent-only'\n /**\n * Where this affordance came from:\n * - `'binding'` — a tagged event handler is currently\n * mounted in the rendered DOM.\n * - `'always-affordable'` — the app's `agentAffordances(state)`\n * hook listed it as available right now.\n * - `'schema'` — neither of the above; the variant\n * is in the Msg union and annotated `@agentOnly`. The\n * `payloadHint` carries a synthesized example from the\n * compiler-derived field types — copy-paste-ready for\n * `send_message`. Bulk-edit operations land here.\n */\n source: 'binding' | 'always-affordable' | 'schema'\n selectorHint: string | null\n payloadHint: object | null\n /** Cautionary text from `@warning` JSDoc, or null. */\n warning: string | null\n /** Concrete examples from `@example` JSDoc, in source order. */\n examples: string[]\n /**\n * Effect kinds this variant emits, from `@emits(\"k1\", \"k2\")`.\n * Empty when not annotated.\n */\n emits: string[]\n /**\n * Per-field guidance lifted from `@should(\"…\")` JSDoc on payload\n * fields. Path is dot/bracket notation rooted at the payload (e.g.\n * `\"cells[].meta\"`). Surfaces hints that would otherwise be buried\n * inside the schema tree, so callers can read them alongside\n * `examples` without diving into `description.messages.variants`.\n */\n fieldHints: Array<{ path: string; hint: string }>\n }>\n}\n\nexport type LapMessageRequest = {\n msg: { type: string; [k: string]: unknown }\n reason?: string\n /**\n * Backpressure contract for how long `/message` waits before returning:\n * - `drained` (default): dispatch, then loop until the message queue is\n * idle for `drainQuietMs` ms or the 5s hard cap trips. Captures any\n * effect round-trips (http/delay/debounce) that feed back as messages.\n * - `idle`: dispatch + flush + one microtask yield. Captures the\n * synchronous update cycle but not async effects.\n * - `none`: dispatch and return without flushing. For high-throughput\n * fire-and-forget dispatch.\n */\n waitFor?: 'drained' | 'idle' | 'none'\n /**\n * Quiescence window when `waitFor === 'drained'`. Drain completes when\n * no new update cycle fires for this many ms. Default 100ms — long\n * enough for a localhost HTTP round-trip, short enough to be\n * imperceptible. Ignored for `idle` / `none`.\n */\n drainQuietMs?: number\n /**\n * Hard cap on total wait time. When `waitFor === 'drained'`, this is\n * the upper bound on how long the drain loop can run; if reached, the\n * response carries `drain.timedOut: true` with partial results. For\n * `pending-confirmation` messages, this is how long to wait for\n * the user's confirm/reject. Default 5_000ms.\n */\n timeoutMs?: number\n /**\n * Include the full post-drain `stateAfter` snapshot in the response.\n * Default `false` — the response carries `stateDiff` only and the\n * caller applies it to the prior snapshot (from connect/observe). For\n * apps with non-trivial state, the diff is orders of magnitude\n * smaller than the full state, and resending the snapshot on every\n * dispatch wastes bandwidth and (for LLM callers) context budget.\n *\n * Set `true` when the caller doesn't track state incrementally and\n * wants the snapshot back. The legacy `confirmed` and `wait` paths\n * always carry `stateAfter` because their flow is asynchronous and\n * a diff would be ambiguous.\n */\n includeState?: boolean\n}\n\nexport type LapMessageRejectReason =\n | 'human-only'\n | 'user-cancelled'\n | 'timeout'\n | 'invalid'\n | 'schema-error'\n | 'revoked'\n | 'paused'\n\n/**\n * Drain metadata attached to `dispatched` / `confirmed` responses.\n * `effectsObserved` counts update-cycle commits (not individual effects) —\n * it's a proxy for \"how much activity happened during the drain window.\"\n * `errors` surfaces sync throws from `onEffect` and unhandled rejections\n * from effect handlers that fired during the drain window, so the LLM\n * can see when an HTTP handler crashed silently.\n *\n * `warnings` surfaces non-blocking observations from the schema\n * validator — typically `untyped-field` flags raised in strict mode\n * when the agent provided a value for an `'unknown'`-typed field. The\n * dispatch landed (we accepted the value) but the validator couldn't\n * structurally check it, so the agent learns of the gap and can\n * tighten the next try if needed. Lenient mode never emits warnings;\n * the field is omitted in that case.\n */\nexport type LapDrainMeta = {\n effectsObserved: number\n durationMs: number\n timedOut: boolean\n errors: Array<{ kind: 'error' | 'unhandledrejection'; message: string; stack?: string }>\n warnings?: Array<{ path: string; code: string; message: string }>\n}\n\nexport type LapMessageResponse =\n | {\n status: 'dispatched'\n /**\n * Full post-drain state snapshot. Present only when the caller\n * passed `includeState: true` in the request — by default,\n * `stateDiff` is the only state-shaped field on the response\n * because callers can apply the diff to the prior snapshot from\n * `connect` / `observe`. See `LapMessageRequest.includeState`.\n */\n stateAfter?: unknown\n /**\n * Structural diff from pre-dispatch state to post-drain state,\n * in JSON-Patch shape (RFC 6902 subset: `add`, `remove`,\n * `replace`). Empty when the dispatch produced no observable\n * state change. The default state surface for callers — apply\n * incrementally to the snapshot from `connect`/`observe`.\n */\n stateDiff: import('./state-diff.js').StateDiff\n actions: LapActionsResponse['actions']\n drain: LapDrainMeta\n }\n | { status: 'pending-confirmation'; confirmId: string }\n | {\n /**\n * The user approved a `pending-confirmation` message. `stateAfter`\n * is the state snapshot captured when the approve was resolved;\n * effects produced by the approved dispatch may still be in\n * flight. The LLM should follow up with an `observe` call to\n * pick up a drained view and fresh actions — by design the\n * confirm path doesn't carry drain semantics because approval\n * can arrive arbitrarily later than the original request.\n */\n status: 'confirmed'\n stateAfter: unknown\n }\n | { status: 'rejected'; reason: LapMessageRejectReason; detail?: string }\n\nexport type LapConfirmResultRequest = { confirmId: string; timeoutMs?: number }\nexport type LapConfirmResultResponse =\n | { status: 'confirmed'; stateAfter: unknown }\n | { status: 'rejected'; reason: 'user-cancelled' | 'timeout' }\n | { status: 'still-pending' }\n\n/**\n * Push narration prose into the activity feed without dispatching a\n * Msg. The agent uses this for \"I'm thinking…\" / \"About to do X\n * because…\" / \"I noticed Y, going to investigate\" — running commentary\n * the user can read inline with agent actions.\n *\n * The server synthesizes a `LogEntry { kind: 'narrate', detail: text }`,\n * appends it to the per-tid recent-log buffer (visible to subsequent\n * `describe_recent_actions` calls), AND pushes a `log-push` frame to\n * the paired browser so the in-app activity feed renders it in real\n * time. No client roundtrip — the agent gets `{ ok: true }` synchronously\n * once the server has accepted the narration.\n */\nexport type LapNarrateRequest = {\n text: string\n /**\n * Optional one-line label for the entry's `intent` field, e.g.\n * \"Thinking\" / \"Notice\" / \"Plan\". Defaults to \"Agent narrated\"\n * when omitted.\n */\n intent?: string\n}\nexport type LapNarrateResponse = { ok: true }\n\nexport type LapWaitRequest = { path?: string; timeoutMs?: number }\nexport type LapWaitResponse =\n | { status: 'changed'; stateAfter: unknown }\n | { status: 'timeout'; stateAfter: unknown }\n\nexport type LapQueryDomRequest = { name: string; multiple?: boolean }\nexport type LapQueryDomResponse = {\n elements: Array<{ text: string; attrs: Record<string, string>; path: number[] }>\n}\n\nexport type OutlineNode =\n | { kind: 'heading'; level: number; text: string }\n | { kind: 'text'; text: string }\n | { kind: 'list'; items: OutlineNode[] }\n | { kind: 'item'; text: string; children?: OutlineNode[] }\n | { kind: 'button'; text: string; disabled: boolean; actionVariant: string | null }\n | { kind: 'input'; label: string | null; value: string | null; type: string }\n | { kind: 'link'; text: string; href: string }\n\nexport type LapDescribeVisibleResponse = {\n outline: OutlineNode[]\n /**\n * Where the outline came from:\n * - `'data-agent'`: the app has `data-agent`-tagged zones and the\n * walker scoped the outline to them. The author chose what to\n * surface; trust the result.\n * - `'fallback'`: no `data-agent` tags exist; the walker fell back\n * to a depth- and count-limited semantic walk of the entire\n * root element. Useful for first-pass dogfood targets that\n * haven't tagged their views.\n * - `'truncated'`: same as `'fallback'` but the cap (200 nodes)\n * was hit before the walk finished. The visible content beyond\n * that point is not represented; reach for `query_dom` or state\n * reads if you need more.\n */\n source: 'data-agent' | 'fallback' | 'truncated'\n}\n\n// ── App + context documentation ──────────────────────────────────\n// Static app-level docs (authored once on the component record) and\n// dynamic per-state context docs (pure function of state, served by\n// `/lap/v1/context`). See spec §5.4.\n\nexport type AgentDocs = {\n purpose: string\n overview?: string\n cautions?: string[]\n /**\n * Free-form idiomatic-usage examples authored by the app: typical\n * sequences of dispatches the LLM should know about, like \"to\n * delete a saved matrix: dispatch Confirm/Ask first, then on\n * approve dispatch Cloud/Delete.\" Each entry is one example;\n * order is up to the author.\n */\n examples?: string[]\n}\n\nexport type AgentContext = {\n summary: string\n hints?: string[]\n cautions?: string[]\n}\n\nexport type LapContextResponse = { context: AgentContext }\n\n// ── Unified observe ──────────────────────────────────────────────\n// Single-call bootstrap. Replaces the get_state + list_actions +\n// describe_app trio for the common \"what can I see, what can I do\"\n// question. Returns the dynamic state + actions slice alongside the\n// static description (name/version/messages/docs) and any\n// state-derived context so one round-trip gives the LLM everything it\n// needs to decide its next action.\n\nexport type LapObserveResponse = {\n state: unknown\n actions: LapActionsResponse['actions']\n description: LapDescribeResponse\n context: AgentContext | null\n}\n\n// LAP endpoint catalog — a compile-time map binding each path to its\n// request/response shape. Useful for the bridge's dispatcher and for\n// typed test helpers.\nexport type LapEndpointMap = {\n '/lap/v1/describe': { req: null; res: LapDescribeResponse }\n '/lap/v1/state': { req: LapStateRequest; res: LapStateResponse }\n '/lap/v1/actions': { req: null; res: LapActionsResponse }\n '/lap/v1/message': { req: LapMessageRequest; res: LapMessageResponse }\n '/lap/v1/confirm-result': { req: LapConfirmResultRequest; res: LapConfirmResultResponse }\n '/lap/v1/wait': { req: LapWaitRequest; res: LapWaitResponse }\n '/lap/v1/narrate': { req: LapNarrateRequest; res: LapNarrateResponse }\n '/lap/v1/query-dom': { req: LapQueryDomRequest; res: LapQueryDomResponse }\n '/lap/v1/describe-visible': { req: null; res: LapDescribeVisibleResponse }\n '/lap/v1/context': { req: null; res: LapContextResponse }\n '/lap/v1/observe': { req: null; res: LapObserveResponse }\n}\n\nexport type LapPath = keyof LapEndpointMap\nexport type LapRequest<P extends LapPath> = LapEndpointMap[P]['req']\nexport type LapResponse<P extends LapPath> = LapEndpointMap[P]['res']\n\n// ── Relay WS frames ──────────────────────────────────────────────\n// Bidirectional framing between the LLui runtime in the browser and\n// the @llui/agent server over /agent/ws. See spec §10.5.\n\nexport type LogKind =\n | 'proposed'\n | 'dispatched'\n | 'confirmed'\n | 'rejected'\n | 'blocked'\n | 'read'\n | 'error'\n /**\n * The agent emitted prose into the activity feed via `/lap/v1/narrate`\n * — narration like \"thinking about your request…\", \"I'm about to add\n * an alternative because…\", or any out-of-band commentary that\n * doesn't fit a `dispatched` / `read` lifecycle. Lets the agent talk\n * to the user inside the app without inventing a fake `@agentOnly`\n * Msg type.\n */\n | 'narrate'\n\nexport type LogEntry = {\n id: string\n at: number\n kind: LogKind\n variant?: string\n intent?: string\n detail?: string\n /**\n * Structural diff from pre-dispatch state to post-drain state, in\n * JSON-Patch shape. Populated only for `kind: 'dispatched'` entries\n * — read entries (get_state / list_actions / observe / …) don't\n * mutate state, and an empty diff would just be noise. Lets the\n * agent reconstruct what each past action did without re-fetching\n * state snapshots.\n */\n stateDiff?: import('./state-diff.js').StateDiff\n}\n\nexport type HelloFrame = {\n t: 'hello'\n appName: string\n appVersion: string\n msgSchema: Record<string, MessageSchemaEntry>\n stateSchema: object\n affordancesSample: object[]\n docs: AgentDocs | null\n schemaHash: string\n}\n\nexport type RpcReplyFrame = { t: 'rpc-reply'; id: string; result: unknown }\nexport type RpcErrorFrame = { t: 'rpc-error'; id: string; code: string; detail?: string }\nexport type ConfirmResolvedFrame = {\n t: 'confirm-resolved'\n confirmId: string\n outcome: 'confirmed' | 'user-cancelled'\n stateAfter?: unknown\n}\nexport type StateUpdateFrame = { t: 'state-update'; path: string; stateAfter: unknown }\nexport type LogAppendFrame = { t: 'log-append'; entry: LogEntry }\n\nexport type ClientFrame =\n | HelloFrame\n | RpcReplyFrame\n | RpcErrorFrame\n | ConfirmResolvedFrame\n | StateUpdateFrame\n | LogAppendFrame\n\nexport type RpcFrame = { t: 'rpc'; id: string; tool: string; args: unknown }\nexport type RevokedFrame = { t: 'revoked' }\nexport type ActiveFrame = { t: 'active' }\n/**\n * Server-pushed log entry. Used today by the `narrate` LAP method:\n * the agent calls `/lap/v1/narrate { text }`, the server synthesizes\n * a `LogEntry { kind: 'narrate' }` and pushes it down to the paired\n * runtime so the in-app activity feed renders the narration in real\n * time. Distinct from the browser-emitted `log-append` frame:\n * `log-append` is browser → server (rpc-derived audit), `log-push`\n * is server → browser (server-originated entries, no echo).\n */\nexport type LogPushFrame = { t: 'log-push'; entry: LogEntry }\n\nexport type ServerFrame = RpcFrame | RevokedFrame | ActiveFrame | LogPushFrame\n\n// ── Tokens + pairing ─────────────────────────────────────────────\n\ndeclare const TokenBrand: unique symbol\nexport type AgentToken = string & { readonly [TokenBrand]: 'AgentToken' }\n\nexport type TokenStatus =\n | 'awaiting-ws'\n | 'awaiting-claude'\n | 'active'\n | 'pending-resume'\n | 'revoked'\n\nexport type TokenRecord = {\n tid: string\n /**\n * SHA-256 hex of the bearer token. The plaintext token is never\n * stored — incoming requests hash their `Authorization: Bearer …`\n * value and look up by this field. Hash-only storage keeps a leaked\n * store from being a live-token leak. Mirrors the standard session-\n * cookie / API-key pattern.\n */\n tokenHash: string\n uid: string | null\n status: TokenStatus\n createdAt: number\n /**\n * Hard-expiry in milliseconds since epoch. The mint endpoint sets\n * this to `now + hardExpiryMs`; the verify path rejects requests\n * presenting tokens whose record has `expiresAt <= now`. Pre-0.0.35\n * the equivalent value lived inside the JWT payload as `exp` (in\n * seconds); the new opaque-token flow keeps it server-side so the\n * record is the single source of truth.\n */\n expiresAt: number\n lastSeenAt: number\n pendingResumeUntil: number | null\n origin: string\n label: string | null\n}\n\nexport type AgentSession = {\n tid: string\n label: string\n status: 'active' | 'pending-resume' | 'revoked'\n createdAt: number\n lastSeenAt: number\n}\n\n// HTTP envelopes for the mint/resume/revoke/sessions endpoints (non-LAP).\n\nexport type MintRequest = Record<string, never>\nexport type MintResponse = {\n token: AgentToken\n tid: string\n wsUrl: string\n lapUrl: string\n expiresAt: number\n}\n\nexport type ResumeListRequest = { tids: string[] }\nexport type ResumeListResponse = { sessions: AgentSession[] }\n\nexport type ResumeClaimRequest = { tid: string }\nexport type ResumeClaimResponse = { token: AgentToken; wsUrl: string }\n\nexport type RevokeRequest = { tid: string }\nexport type RevokeResponse = { status: 'revoked' }\n\nexport type SessionsResponse = { sessions: AgentSession[] }\n\n// ── Audit ────────────────────────────────────────────────────────\n\nexport type AuditEvent =\n | 'mint'\n | 'claim'\n | 'resume'\n | 'revoke'\n | 'lap-call'\n | 'msg-dispatched'\n | 'msg-blocked'\n | 'confirm-proposed'\n | 'confirm-approved'\n | 'confirm-rejected'\n | 'rate-limited'\n | 'auth-failed'\n\nexport type AuditEntry = {\n at: number\n tid: string | null\n uid: string | null\n event: AuditEvent\n detail: object\n}\n\n// ── Codec exports ─────────────────────────────────────────────────\n//\n// Re-exported here so consumers can `import { ..., type AgentCodec }\n// from '@llui/agent/protocol'`. The implementation lives in\n// `./codecs.ts` to keep the protocol type surface together but the\n// runtime registry/walkers separate.\n\nexport {\n WIRE_TAG,\n WIRE_VALUE,\n CodecRegistry,\n isoDateCodec,\n epochMillisCodec,\n makeDefaultCodecs,\n encodeForWire,\n decodeFromWire,\n type AgentCodec,\n} from './codecs.js'\n"]}
|
|
@@ -46,48 +46,16 @@
|
|
|
46
46
|
* See `./worker.ts` for `routeToAgentDO` and the full wiring.
|
|
47
47
|
*/
|
|
48
48
|
import type { CoreOptions, AgentCoreHandle } from '../core.js';
|
|
49
|
-
import type {
|
|
50
|
-
export type DurableObjectOptions = Omit<CoreOptions, 'registry'
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
put<T>(key: string, value: T): Promise<void>;
|
|
60
|
-
delete(key: string): Promise<boolean>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Build a `UserInputStorage` adapter backed by the DO's `state.storage`.
|
|
64
|
-
* Pass the result to `AgentPairingDurableObject`'s constructor opts to
|
|
65
|
-
* make buffered chat-composer submissions survive DO eviction (process
|
|
66
|
-
* restarts, deploys, idle eviction). Without this adapter the in-memory
|
|
67
|
-
* buffer is lost on eviction; with it, the next request restores any
|
|
68
|
-
* buffered messages from before the eviction.
|
|
69
|
-
*
|
|
70
|
-
* Parked `waitForUserInput` waiters can't be persisted (they're JS
|
|
71
|
-
* Promise resolvers); the LAP client retries naturally on its own
|
|
72
|
-
* timeout, and the retry sees the restored buffer.
|
|
73
|
-
*
|
|
74
|
-
* Usage:
|
|
75
|
-
*
|
|
76
|
-
* ```ts
|
|
77
|
-
* export class AgentDO {
|
|
78
|
-
* private agent: AgentPairingDurableObject
|
|
79
|
-
* constructor(state: DurableObjectState) {
|
|
80
|
-
* this.agent = new AgentPairingDurableObject({
|
|
81
|
-
* userInputStorage: makeDurableObjectUserInputStorage(state.storage),
|
|
82
|
-
* })
|
|
83
|
-
* }
|
|
84
|
-
* fetch(req: Request) {
|
|
85
|
-
* return this.agent.fetch(req)
|
|
86
|
-
* }
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare function makeDurableObjectUserInputStorage(storage: DurableObjectStorageLike): UserInputStorage;
|
|
49
|
+
import type { McpRouterOptions } from '../mcp/router.js';
|
|
50
|
+
export type DurableObjectOptions = Omit<CoreOptions, 'registry'> & {
|
|
51
|
+
/**
|
|
52
|
+
* Enable the server-side MCP endpoint at `/agent/mcp` (or a custom
|
|
53
|
+
* path). Pass `true` for all defaults, or an `McpRouterOptions`
|
|
54
|
+
* object to customise path, server name, and connect_session
|
|
55
|
+
* description.
|
|
56
|
+
*/
|
|
57
|
+
mcp?: boolean | McpRouterOptions;
|
|
58
|
+
};
|
|
91
59
|
/**
|
|
92
60
|
* Agent server instance scoped to a single Durable Object. All
|
|
93
61
|
* pairing state lives in the DO's in-process memory — which is safe
|
|
@@ -95,11 +63,13 @@ export declare function makeDurableObjectUserInputStorage(storage: DurableObject
|
|
|
95
63
|
* one-shot Worker isolate.
|
|
96
64
|
*
|
|
97
65
|
* Users instantiate one of these inside their DO class's constructor
|
|
98
|
-
* and delegate `fetch` to `agent.fetch(req)`. LAP HTTP routes
|
|
99
|
-
* WebSocket upgrades
|
|
66
|
+
* and delegate `fetch` to `agent.fetch(req)`. LAP HTTP routes,
|
|
67
|
+
* WebSocket upgrades, and the optional MCP endpoint all flow through
|
|
68
|
+
* this single entry.
|
|
100
69
|
*/
|
|
101
70
|
export declare class AgentPairingDurableObject {
|
|
102
71
|
readonly agent: AgentCoreHandle;
|
|
72
|
+
private readonly mcpRouter;
|
|
103
73
|
constructor(opts: DurableObjectOptions);
|
|
104
74
|
fetch(req: Request): Promise<Response>;
|
|
105
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-object.d.ts","sourceRoot":"","sources":["../../../src/server/cloudflare/durable-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAG9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"durable-object.d.ts","sourceRoot":"","sources":["../../../src/server/cloudflare/durable-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAG9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG;IACjE;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAA;CACjC,CAAA;AAED;;;;;;;;;;GAUG;AACH,qBAAa,yBAAyB;IACpC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqD;gBAEnE,IAAI,EAAE,oBAAoB;IAehC,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAsB7C"}
|
|
@@ -1,51 +1,6 @@
|
|
|
1
1
|
import { createLluiAgentCore } from '../core.js';
|
|
2
2
|
import { handleCloudflareUpgrade } from '../web/upgrade.js';
|
|
3
|
-
|
|
4
|
-
* Build a `UserInputStorage` adapter backed by the DO's `state.storage`.
|
|
5
|
-
* Pass the result to `AgentPairingDurableObject`'s constructor opts to
|
|
6
|
-
* make buffered chat-composer submissions survive DO eviction (process
|
|
7
|
-
* restarts, deploys, idle eviction). Without this adapter the in-memory
|
|
8
|
-
* buffer is lost on eviction; with it, the next request restores any
|
|
9
|
-
* buffered messages from before the eviction.
|
|
10
|
-
*
|
|
11
|
-
* Parked `waitForUserInput` waiters can't be persisted (they're JS
|
|
12
|
-
* Promise resolvers); the LAP client retries naturally on its own
|
|
13
|
-
* timeout, and the retry sees the restored buffer.
|
|
14
|
-
*
|
|
15
|
-
* Usage:
|
|
16
|
-
*
|
|
17
|
-
* ```ts
|
|
18
|
-
* export class AgentDO {
|
|
19
|
-
* private agent: AgentPairingDurableObject
|
|
20
|
-
* constructor(state: DurableObjectState) {
|
|
21
|
-
* this.agent = new AgentPairingDurableObject({
|
|
22
|
-
* userInputStorage: makeDurableObjectUserInputStorage(state.storage),
|
|
23
|
-
* })
|
|
24
|
-
* }
|
|
25
|
-
* fetch(req: Request) {
|
|
26
|
-
* return this.agent.fetch(req)
|
|
27
|
-
* }
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export function makeDurableObjectUserInputStorage(storage) {
|
|
32
|
-
// One key per tid keeps the operations O(1) and avoids cross-tid
|
|
33
|
-
// contention. Prefix is to namespace from any other agent storage
|
|
34
|
-
// a future feature might add.
|
|
35
|
-
const key = (tid) => `__llui_agent_user_input_buf__:${tid}`;
|
|
36
|
-
return {
|
|
37
|
-
async read(tid) {
|
|
38
|
-
const stored = await storage.get(key(tid));
|
|
39
|
-
return stored ?? [];
|
|
40
|
-
},
|
|
41
|
-
async write(tid, buffer) {
|
|
42
|
-
await storage.put(key(tid), buffer);
|
|
43
|
-
},
|
|
44
|
-
async clear(tid) {
|
|
45
|
-
await storage.delete(key(tid));
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
3
|
+
import { createMcpRouter } from '../mcp/router.js';
|
|
49
4
|
/**
|
|
50
5
|
* Agent server instance scoped to a single Durable Object. All
|
|
51
6
|
* pairing state lives in the DO's in-process memory — which is safe
|
|
@@ -53,16 +8,33 @@ export function makeDurableObjectUserInputStorage(storage) {
|
|
|
53
8
|
* one-shot Worker isolate.
|
|
54
9
|
*
|
|
55
10
|
* Users instantiate one of these inside their DO class's constructor
|
|
56
|
-
* and delegate `fetch` to `agent.fetch(req)`. LAP HTTP routes
|
|
57
|
-
* WebSocket upgrades
|
|
11
|
+
* and delegate `fetch` to `agent.fetch(req)`. LAP HTTP routes,
|
|
12
|
+
* WebSocket upgrades, and the optional MCP endpoint all flow through
|
|
13
|
+
* this single entry.
|
|
58
14
|
*/
|
|
59
15
|
export class AgentPairingDurableObject {
|
|
60
16
|
agent;
|
|
17
|
+
mcpRouter;
|
|
61
18
|
constructor(opts) {
|
|
62
|
-
|
|
19
|
+
const { mcp, ...coreOpts } = opts;
|
|
20
|
+
this.agent = createLluiAgentCore(coreOpts);
|
|
21
|
+
if (mcp) {
|
|
22
|
+
const mcpOpts = mcp === true ? {} : mcp;
|
|
23
|
+
const lapBasePath = coreOpts.lapBasePath ?? '/agent/lap/v1';
|
|
24
|
+
this.mcpRouter = createMcpRouter({ coreRouter: this.agent.router, tokenStore: this.agent.tokenStore, lapBasePath }, mcpOpts);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
this.mcpRouter = null;
|
|
28
|
+
}
|
|
63
29
|
}
|
|
64
30
|
async fetch(req) {
|
|
65
31
|
const url = new URL(req.url);
|
|
32
|
+
// MCP endpoint takes priority when enabled.
|
|
33
|
+
if (this.mcpRouter) {
|
|
34
|
+
const mcpRes = await this.mcpRouter(req);
|
|
35
|
+
if (mcpRes)
|
|
36
|
+
return mcpRes;
|
|
37
|
+
}
|
|
66
38
|
// LAP routes (/agent/lap/v1/*, /agent/*). `router` returns null
|
|
67
39
|
// for non-matching paths so we can fall through to the upgrade.
|
|
68
40
|
const lapRes = await this.agent.router(req);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-object.js","sourceRoot":"","sources":["../../../src/server/cloudflare/durable-object.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,mBAAmB,EAAE,MAAM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,CAAC,CAAA;YACxC,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAA;QAC3B,CAAC;QAED,gEAAgE;QAChE,gEAAgE;QAChE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC3C,IAAI,MAAM;YAAE,OAAO,MAAM,CAAA;QAEzB,iEAAiE;QACjE,sBAAsB;QACtB,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;YACjC,OAAO,uBAAuB,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;QACjD,CAAC;QAED,OAAO,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACnD,CAAC;CACF","sourcesContent":["/**\n * Durable Object helper for hosting the agent pairing + LAP surface\n * on Cloudflare Workers. One DO instance owns one `tid` — its\n * in-memory `PairingRegistry` survives across Worker isolate\n * invocations because the DO IS persistent.\n *\n * This file exports a class designed to be composed into a real\n * Durable Object in the user's Worker project. We intentionally\n * don't subclass `DurableObject` from `@cloudflare/workers-types` —\n * that dependency belongs to the user's project, not ours. Users\n * wrap an instance of `AgentPairingDurableObject` in their own DO\n * class and forward `fetch` to it.\n *\n * Usage in a Worker project:\n *\n * ```ts\n * // worker.ts\n * import { AgentPairingDurableObject } from '@llui/agent/server/cloudflare'\n *\n * export class AgentDO {\n * private agent: AgentPairingDurableObject\n * constructor(_state: DurableObjectState, env: Env) {\n * // Tokens are opaque (see token.ts) — no signing key needed.\n * this.agent = new AgentPairingDurableObject({})\n * }\n * fetch(req: Request): Promise<Response> {\n * return this.agent.fetch(req)\n * }\n * }\n *\n * export default {\n * async fetch(req: Request, env: Env): Promise<Response> {\n * // routeToAgentDO now takes a `resolveTid` callback — typically\n * // a fetch to the root DO's token-resolution endpoint, or a\n * // const stub when you don't shard by tid.\n * return routeToAgentDO(req, env.AGENT_DO, async (token) => {\n * const stub = env.AGENT_DO.get(env.AGENT_DO.idFromName('__root'))\n * const r = await stub.fetch(`http://internal/__resolve?token=${encodeURIComponent(token)}`)\n * const body = (await r.json()) as { tid: string | null }\n * return body.tid\n * })\n * },\n * }\n * ```\n *\n * See `./worker.ts` for `routeToAgentDO` and the full wiring.\n */\nimport type { CoreOptions, AgentCoreHandle } from '../core.js'\nimport { createLluiAgentCore } from '../core.js'\nimport { handleCloudflareUpgrade } from '../web/upgrade.js'\nimport type { McpRouterOptions } from '../mcp/router.js'\nimport { createMcpRouter } from '../mcp/router.js'\n\nexport type DurableObjectOptions = Omit<CoreOptions, 'registry'> & {\n /**\n * Enable the server-side MCP endpoint at `/agent/mcp` (or a custom\n * path). Pass `true` for all defaults, or an `McpRouterOptions`\n * object to customise path, server name, and connect_session\n * description.\n */\n mcp?: boolean | McpRouterOptions\n}\n\n/**\n * Agent server instance scoped to a single Durable Object. All\n * pairing state lives in the DO's in-process memory — which is safe\n * here because the DO is a persistent addressable entity, not a\n * one-shot Worker isolate.\n *\n * Users instantiate one of these inside their DO class's constructor\n * and delegate `fetch` to `agent.fetch(req)`. LAP HTTP routes,\n * WebSocket upgrades, and the optional MCP endpoint all flow through\n * this single entry.\n */\nexport class AgentPairingDurableObject {\n readonly agent: AgentCoreHandle\n private readonly mcpRouter: ((req: Request) => Promise<Response | null>) | null\n\n constructor(opts: DurableObjectOptions) {\n const { mcp, ...coreOpts } = opts\n this.agent = createLluiAgentCore(coreOpts)\n if (mcp) {\n const mcpOpts = mcp === true ? {} : mcp\n const lapBasePath = coreOpts.lapBasePath ?? '/agent/lap/v1'\n this.mcpRouter = createMcpRouter(\n { coreRouter: this.agent.router, tokenStore: this.agent.tokenStore, lapBasePath },\n mcpOpts,\n )\n } else {\n this.mcpRouter = null\n }\n }\n\n async fetch(req: Request): Promise<Response> {\n const url = new URL(req.url)\n\n // MCP endpoint takes priority when enabled.\n if (this.mcpRouter) {\n const mcpRes = await this.mcpRouter(req)\n if (mcpRes) return mcpRes\n }\n\n // LAP routes (/agent/lap/v1/*, /agent/*). `router` returns null\n // for non-matching paths so we can fall through to the upgrade.\n const lapRes = await this.agent.router(req)\n if (lapRes) return lapRes\n\n // WebSocket upgrade — uses `WebSocketPair`, which only exists in\n // Cloudflare Workers.\n if (url.pathname === '/agent/ws') {\n return handleCloudflareUpgrade(req, this.agent)\n }\n\n return new Response('Not Found', { status: 404 })\n }\n}\n"]}
|
|
@@ -11,20 +11,13 @@
|
|
|
11
11
|
* import {
|
|
12
12
|
* AgentPairingDurableObject,
|
|
13
13
|
* routeToAgentDO,
|
|
14
|
-
* makeDurableObjectUserInputStorage,
|
|
15
14
|
* } from '@llui/agent/server/cloudflare'
|
|
16
15
|
*
|
|
17
16
|
* export class AgentDO {
|
|
18
17
|
* private agent: AgentPairingDurableObject
|
|
19
|
-
* constructor(
|
|
18
|
+
* constructor(_state: DurableObjectState, _env: Env) {
|
|
20
19
|
* // Tokens are opaque (see token.ts) — no signing key needed.
|
|
21
|
-
*
|
|
22
|
-
* // buffer survive DO eviction (deploys, idle eviction, runtime
|
|
23
|
-
* // restarts) — buffered messages from before the eviction are
|
|
24
|
-
* // restored on the next request.
|
|
25
|
-
* this.agent = new AgentPairingDurableObject({
|
|
26
|
-
* userInputStorage: makeDurableObjectUserInputStorage(state.storage),
|
|
27
|
-
* })
|
|
20
|
+
* this.agent = new AgentPairingDurableObject({})
|
|
28
21
|
* }
|
|
29
22
|
* fetch(req: Request) {
|
|
30
23
|
* return this.agent.fetch(req)
|
|
@@ -54,7 +47,7 @@
|
|
|
54
47
|
* new_classes = ["AgentDO"]
|
|
55
48
|
* ```
|
|
56
49
|
*/
|
|
57
|
-
export { AgentPairingDurableObject, type DurableObjectOptions
|
|
50
|
+
export { AgentPairingDurableObject, type DurableObjectOptions } from './durable-object.js';
|
|
58
51
|
export { routeToAgentDO, type MinimalDurableObjectNamespace, type MinimalDurableObjectId, type MinimalDurableObjectStub, } from './worker.js';
|
|
59
52
|
export { createWHATWGPairingConnection, handleCloudflareUpgrade, extractToken, } from '../web/index.js';
|
|
60
53
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/cloudflare/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,yBAAyB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EACL,cAAc,EACd,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,YAAY,GACb,MAAM,iBAAiB,CAAA"}
|
|
@@ -11,20 +11,13 @@
|
|
|
11
11
|
* import {
|
|
12
12
|
* AgentPairingDurableObject,
|
|
13
13
|
* routeToAgentDO,
|
|
14
|
-
* makeDurableObjectUserInputStorage,
|
|
15
14
|
* } from '@llui/agent/server/cloudflare'
|
|
16
15
|
*
|
|
17
16
|
* export class AgentDO {
|
|
18
17
|
* private agent: AgentPairingDurableObject
|
|
19
|
-
* constructor(
|
|
18
|
+
* constructor(_state: DurableObjectState, _env: Env) {
|
|
20
19
|
* // Tokens are opaque (see token.ts) — no signing key needed.
|
|
21
|
-
*
|
|
22
|
-
* // buffer survive DO eviction (deploys, idle eviction, runtime
|
|
23
|
-
* // restarts) — buffered messages from before the eviction are
|
|
24
|
-
* // restored on the next request.
|
|
25
|
-
* this.agent = new AgentPairingDurableObject({
|
|
26
|
-
* userInputStorage: makeDurableObjectUserInputStorage(state.storage),
|
|
27
|
-
* })
|
|
20
|
+
* this.agent = new AgentPairingDurableObject({})
|
|
28
21
|
* }
|
|
29
22
|
* fetch(req: Request) {
|
|
30
23
|
* return this.agent.fetch(req)
|
|
@@ -54,7 +47,7 @@
|
|
|
54
47
|
* new_classes = ["AgentDO"]
|
|
55
48
|
* ```
|
|
56
49
|
*/
|
|
57
|
-
export { AgentPairingDurableObject
|
|
50
|
+
export { AgentPairingDurableObject } from './durable-object.js';
|
|
58
51
|
export { routeToAgentDO, } from './worker.js';
|
|
59
52
|
export { createWHATWGPairingConnection, handleCloudflareUpgrade, extractToken, } from '../web/index.js';
|
|
60
53
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/cloudflare/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,yBAAyB,EAA6B,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EACL,cAAc,GAIf,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,YAAY,GACb,MAAM,iBAAiB,CAAA","sourcesContent":["/**\n * Cloudflare Workers + Durable Object adapter. Use this sub-path\n * from a Cloudflare Workers project where the agent pairing state\n * lives inside a Durable Object.\n *\n * See the full deployment recipe at\n * https://llui.dev/api/agent#cloudflare-deployment — the short\n * version:\n *\n * ```ts\n * import {\n * AgentPairingDurableObject,\n * routeToAgentDO,\n * } from '@llui/agent/server/cloudflare'\n *\n * export class AgentDO {\n * private agent: AgentPairingDurableObject\n * constructor(_state: DurableObjectState, _env: Env) {\n * // Tokens are opaque (see token.ts) — no signing key needed.\n * this.agent = new AgentPairingDurableObject({})\n * }\n * fetch(req: Request) {\n * return this.agent.fetch(req)\n * }\n * }\n *\n * export default {\n * async fetch(req: Request, env: Env) {\n * return routeToAgentDO(req, env.AGENT_DO, async (token) => {\n * const stub = env.AGENT_DO.get(env.AGENT_DO.idFromName('__root'))\n * const r = await stub.fetch(`http://internal/__resolve?token=${encodeURIComponent(token)}`)\n * const body = (await r.json()) as { tid: string | null }\n * return body.tid\n * })\n * },\n * }\n * ```\n *\n * `wrangler.toml`:\n * ```toml\n * [[durable_objects.bindings]]\n * name = \"AGENT_DO\"\n * class_name = \"AgentDO\"\n *\n * [[migrations]]\n * tag = \"v1\"\n * new_classes = [\"AgentDO\"]\n * ```\n */\nexport { AgentPairingDurableObject, type DurableObjectOptions } from './durable-object.js'\nexport {\n routeToAgentDO,\n type MinimalDurableObjectNamespace,\n type MinimalDurableObjectId,\n type MinimalDurableObjectStub,\n} from './worker.js'\nexport {\n createWHATWGPairingConnection,\n handleCloudflareUpgrade,\n extractToken,\n} from '../web/index.js'\n"]}
|