@llui/agent 0.0.39 → 0.0.41

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ws-client.js","sourceRoot":"","sources":["../../src/client/ws-client.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAuB,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAA0B,MAAM,yBAAyB,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAwB,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,iBAAiB,EAAwB,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAA;AACtE,OAAO,EACL,4BAA4B,GAE7B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,qBAAqB,EAA4B,MAAM,2BAA2B,CAAA;AAC3F,OAAO,EAAE,aAAa,EAAoB,MAAM,kBAAkB,CAAA;AAiDlE;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,EAAU,EACV,GAAa,EACb,KAAmB,EACnB,OAAqB,EAAE;IAEvB,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IACF,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,IAAI,KAAkB,CAAA;QACtB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,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aAAa;QAAE,OAAO,kBAAkB,CAAA;IACrD,IAAI,IAAI,KAAK,cAAc;QAAE,OAAO,wBAAwB,CAAA;IAC5D,IAAI,IAAI,KAAK,kBAAkB;QAAE,OAAO,sBAAsB,CAAA;IAC9D,IAAI,IAAI,KAAK,0BAA0B;QAAE,OAAO,sBAAsB,CAAA;IACtE,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,IAAgC,CAAA;QAC1C,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,CAAA;IACvD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import type {\n ClientFrame,\n ServerFrame,\n HelloFrame,\n LogEntry,\n LogKind,\n MessageAnnotations,\n} from '../protocol.js'\nimport { handleGetState, type GetStateHost } from './rpc/get-state.js'\nimport { handleQueryState, type QueryStateHost } from './rpc/query-state.js'\nimport { handleWouldDispatch, type WouldDispatchHost } from './rpc/would-dispatch.js'\nimport { handleSendMessage, type SendMessageHost } from './rpc/send-message.js'\nimport { handleListActions, type ListActionsHost } from './rpc/list-actions.js'\nimport { handleQueryDom, type QueryDomHost } from './rpc/query-dom.js'\nimport {\n handleDescribeVisibleContent,\n type DescribeVisibleHost,\n} from './rpc/describe-visible-content.js'\nimport { handleDescribeContext, type DescribeContextHost } from './rpc/describe-context.js'\nimport { handleObserve, type ObserveHost } from './rpc/observe.js'\n\nexport interface WsLike {\n send(data: string): void\n close(): void\n addEventListener(event: 'message', h: (e: { data: string | ArrayBuffer }) => void): void\n addEventListener(event: 'open' | 'close', h: () => void): void\n}\n\nexport type RpcHosts = GetStateHost &\n QueryStateHost &\n SendMessageHost &\n ListActionsHost &\n QueryDomHost &\n DescribeVisibleHost &\n DescribeContextHost &\n ObserveHost &\n WouldDispatchHost\n\nexport type HelloBuilder = () => HelloFrame\n\nexport type WsClient = {\n /** Resolve a pending confirmation; emits confirm-resolved frame to the server. */\n resolveConfirm(\n confirmId: string,\n outcome: 'confirmed' | 'user-cancelled',\n stateAfter?: unknown,\n ): void\n /** Emit a state-update frame so the server can resolve waitForChange promises. */\n emitStateUpdate(path: string, stateAfter: unknown): void\n /** Emit a log-append frame so the server can mirror client-observed actions to the audit sink. */\n emitLogAppend(entry: LogEntry): void\n /** Close the socket cleanly. */\n close(): void\n}\n\nexport type WsClientOpts = {\n /** Called once when the server sends an `{t: 'active'}` frame. Idempotent. */\n onActivated?: () => void\n /**\n * Called with every LogEntry emitted by the ws-client (one per rpc\n * dispatched or errored). Used by the factory to mirror the entries\n * into the app's local `agent.log` slice so the UI can show activity.\n * The ws-client still sends the outbound `log-append` frame to the\n * server regardless.\n */\n onLogEntry?: (entry: LogEntry) => void\n}\n\n/**\n * Wires up a WebSocket to serve rpc requests from the server. See spec §9.4.\n */\nexport function attachWsClient(\n ws: WsLike,\n rpc: RpcHosts,\n hello: HelloBuilder,\n opts: WsClientOpts = {},\n): WsClient {\n let activated = false\n ws.addEventListener('open', () => {\n ws.send(JSON.stringify(hello()))\n })\n ws.addEventListener('message', async (ev) => {\n let frame: ServerFrame\n try {\n const raw = typeof ev.data === 'string' ? ev.data : new TextDecoder().decode(ev.data)\n frame = JSON.parse(raw) as ServerFrame\n } catch {\n return\n }\n if (frame.t === 'revoked') {\n ws.close()\n return\n }\n if (frame.t === 'active') {\n if (!activated) {\n activated = true\n opts.onActivated?.()\n }\n return\n }\n if (frame.t !== 'rpc') return\n let result: unknown\n let rpcErr: { code?: string; detail?: string } | null = null\n try {\n result = await dispatch(frame.tool, frame.args, rpc)\n const reply: ClientFrame = { t: 'rpc-reply', id: frame.id, result }\n ws.send(JSON.stringify(reply))\n } catch (e: unknown) {\n rpcErr = e as { code?: string; detail?: string }\n // When a plain JS exception bubbles up (TypeError, RangeError, etc.),\n // rpcErr has no .code/.detail. Enrich the detail with the actual\n // message + stack so the server/Claude can see the real cause.\n const detail =\n rpcErr.detail ??\n (e instanceof Error\n ? `${e.name}: ${e.message}${e.stack ? '\\n' + e.stack.split('\\n').slice(0, 5).join('\\n') : ''}`\n : undefined)\n const errFrame: ClientFrame = {\n t: 'rpc-error',\n id: frame.id,\n code: rpcErr.code ?? 'internal',\n detail,\n }\n ws.send(JSON.stringify(errFrame))\n // Also log to the browser console so operators see the real cause even\n // when the server/Claude just show \"internal\".\n console.error(`[llui-agent] rpc handler threw for ${frame.tool}:`, e)\n }\n const kind = getLogKindForTool(frame.tool, result, rpcErr)\n const logEntry: LogEntry = {\n id: frame.id,\n at: Date.now(),\n kind,\n variant: extractVariant(frame.tool, frame.args),\n intent: buildIntent(frame.tool, frame.args, rpc.getMsgAnnotations()),\n }\n // For successful send_message dispatches, the stateDiff is part\n // of the response. Lifting it into the log entry means the agent\n // can read its own past actions with full \"what changed\" detail\n // without re-querying state — essential for self-correcting\n // behavior over multi-step flows.\n if (frame.tool === 'send_message' && rpcErr === null && isDispatchedResult(result)) {\n logEntry.stateDiff = result.stateDiff\n }\n opts.onLogEntry?.(logEntry)\n ws.send(JSON.stringify({ t: 'log-append', entry: logEntry } satisfies ClientFrame))\n })\n\n return {\n resolveConfirm(confirmId, outcome, stateAfter) {\n const frame: ClientFrame = {\n t: 'confirm-resolved',\n confirmId,\n outcome,\n stateAfter,\n }\n ws.send(JSON.stringify(frame))\n },\n emitStateUpdate(path, stateAfter) {\n const frame: ClientFrame = { t: 'state-update', path, stateAfter }\n ws.send(JSON.stringify(frame))\n },\n emitLogAppend(entry) {\n const frame: ClientFrame = { t: 'log-append', entry }\n ws.send(JSON.stringify(frame))\n },\n close() {\n ws.close()\n },\n }\n}\n\nasync function dispatch(tool: string, args: unknown, rpc: RpcHosts): Promise<unknown> {\n switch (tool) {\n case 'get_state':\n return handleGetState(rpc, (args ?? {}) as { path?: string })\n case 'query_state':\n return handleQueryState(rpc, (args ?? {}) as { path: string })\n case 'list_actions':\n return handleListActions(rpc)\n case 'send_message':\n return handleSendMessage(rpc, args as never)\n case 'query_dom':\n return handleQueryDom(rpc, args as never)\n case 'describe_visible_content':\n return handleDescribeVisibleContent(rpc)\n case 'describe_context':\n return handleDescribeContext(rpc)\n case 'observe':\n return handleObserve(rpc)\n case 'would_dispatch':\n return handleWouldDispatch(rpc, args as never)\n default:\n throw { code: 'invalid', detail: `unknown tool: ${tool}` }\n }\n}\n\nconst READ_TOOLS = new Set([\n 'get_state',\n 'query_state',\n 'list_actions',\n 'describe_context',\n 'query_dom',\n 'describe_visible_content',\n 'observe',\n 'would_dispatch',\n])\n\nfunction getLogKindForTool(\n tool: string,\n result: unknown,\n err: { code?: string; detail?: string } | null,\n): LogKind {\n if (err !== null) return 'error'\n if (tool === 'send_message') {\n const r = result as { status?: string } | null\n const status = r?.status\n if (status === 'dispatched' || status === 'confirmed') return 'dispatched'\n if (status === 'pending-confirmation') return 'proposed'\n if (status === 'rejected') return 'blocked'\n return 'dispatched'\n }\n if (READ_TOOLS.has(tool)) return 'read'\n return 'read'\n}\n\n/**\n * Type guard for the `dispatched` shape of `LapMessageResponse`.\n * Used to lift the stateDiff into the log entry without polluting\n * the type chain with cross-cutting imports.\n */\nfunction isDispatchedResult(\n result: unknown,\n): result is { status: 'dispatched'; stateDiff: import('../state-diff.js').StateDiff } {\n return (\n result !== null &&\n typeof result === 'object' &&\n (result as { status?: unknown }).status === 'dispatched' &&\n Array.isArray((result as { stateDiff?: unknown }).stateDiff)\n )\n}\n\nfunction extractVariant(tool: string, args: unknown): string | undefined {\n if (tool === 'send_message') {\n const a = args as { msg?: { type?: string } } | null\n const t = a?.msg?.type\n return typeof t === 'string' ? t : undefined\n }\n return undefined\n}\n\n// Human-readable label for each rpc. For send_message, prefer the @intent\n// annotation authored on the Msg union; fall back to the raw variant name.\n// For read tools, return a short fixed label so the activity feed doesn't\n// show opaque tool ids like \"describe_visible_content\".\nfunction buildIntent(\n tool: string,\n args: unknown,\n annotations: Record<string, MessageAnnotations> | null,\n): string {\n if (tool === 'send_message') {\n const a = args as { msg?: { type?: string } } | null\n const variant = typeof a?.msg?.type === 'string' ? a.msg.type : undefined\n const annotated = variant ? annotations?.[variant]?.intent : null\n if (annotated) return annotated\n return variant ?? 'Send message'\n }\n if (tool === 'get_state') return 'Read app state'\n if (tool === 'query_state') return 'Read state slice'\n if (tool === 'list_actions') return 'List available actions'\n if (tool === 'describe_context') return 'Read current context'\n if (tool === 'describe_visible_content') return 'Read visible content'\n if (tool === 'query_dom') {\n const a = args as { name?: string } | null\n return a?.name ? `Query DOM: ${a.name}` : 'Query DOM'\n }\n return tool\n}\n"]}
1
+ {"version":3,"file":"ws-client.js","sourceRoot":"","sources":["../../src/client/ws-client.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAuB,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAA0B,MAAM,yBAAyB,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAwB,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,iBAAiB,EAAwB,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAA;AACtE,OAAO,EACL,4BAA4B,GAE7B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,qBAAqB,GAGtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,aAAa,EAAoB,MAAM,kBAAkB,CAAA;AA0DlE;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,EAAU,EACV,GAAa,EACb,KAAmB,EACnB,OAAqB,EAAE;IAEvB,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IACF,EAAE,CAAC,gBAAgB,CAAC,SAAS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ent":["import type {\n ClientFrame,\n ServerFrame,\n HelloFrame,\n LogEntry,\n LogKind,\n MessageAnnotations,\n} from '../protocol.js'\nimport { handleGetState, type GetStateHost } from './rpc/get-state.js'\nimport { handleQueryState, type QueryStateHost } from './rpc/query-state.js'\nimport { handleWouldDispatch, type WouldDispatchHost } from './rpc/would-dispatch.js'\nimport { handleSendMessage, type SendMessageHost } from './rpc/send-message.js'\nimport { handleListActions, type ListActionsHost } from './rpc/list-actions.js'\nimport { handleQueryDom, type QueryDomHost } from './rpc/query-dom.js'\nimport {\n handleDescribeVisibleContent,\n type DescribeVisibleHost,\n} from './rpc/describe-visible-content.js'\nimport {\n handleDescribeContext,\n type DescribeContextHost,\n type LastDispatchOutcome,\n} from './rpc/describe-context.js'\nimport { handleObserve, type ObserveHost } from './rpc/observe.js'\n\nexport interface WsLike {\n send(data: string): void\n close(): void\n addEventListener(event: 'message', h: (e: { data: string | ArrayBuffer }) => void): void\n addEventListener(event: 'open' | 'close', h: () => void): void\n}\n\nexport type RpcHosts = GetStateHost &\n QueryStateHost &\n SendMessageHost &\n ListActionsHost &\n QueryDomHost &\n DescribeVisibleHost &\n DescribeContextHost &\n ObserveHost &\n WouldDispatchHost\n\nexport type HelloBuilder = () => HelloFrame\n\nexport type WsClient = {\n /** Resolve a pending confirmation; emits confirm-resolved frame to the server. */\n resolveConfirm(\n confirmId: string,\n outcome: 'confirmed' | 'user-cancelled',\n stateAfter?: unknown,\n ): void\n /** Emit a state-update frame so the server can resolve waitForChange promises. */\n emitStateUpdate(path: string, stateAfter: unknown): void\n /** Emit a log-append frame so the server can mirror client-observed actions to the audit sink. */\n emitLogAppend(entry: LogEntry): void\n /** Close the socket cleanly. */\n close(): void\n}\n\nexport type WsClientOpts = {\n /** Called once when the server sends an `{t: 'active'}` frame. Idempotent. */\n onActivated?: () => void\n /**\n * Called with every LogEntry emitted by the ws-client (one per rpc\n * dispatched or errored). Used by the factory to mirror the entries\n * into the app's local `agent.log` slice so the UI can show activity.\n * The ws-client still sends the outbound `log-append` frame to the\n * server regardless.\n */\n onLogEntry?: (entry: LogEntry) => void\n /**\n * Called with the outcome of every `send_message` rpc — `dispatched`\n * (with optional errors / warnings), `rejected` (with errors), or\n * `reducer-threw`. The factory uses this to maintain a \"last\n * outcome\" snapshot that `describe_context` injects as a synthetic\n * hint, so apps don't have to maintain their own\n * `lastDispatchError` state field.\n */\n onDispatchOutcome?: (outcome: LastDispatchOutcome | null) => void\n}\n\n/**\n * Wires up a WebSocket to serve rpc requests from the server. See spec §9.4.\n */\nexport function attachWsClient(\n ws: WsLike,\n rpc: RpcHosts,\n hello: HelloBuilder,\n opts: WsClientOpts = {},\n): WsClient {\n let activated = false\n ws.addEventListener('open', () => {\n ws.send(JSON.stringify(hello()))\n })\n ws.addEventListener('message', async (ev) => {\n let frame: ServerFrame\n try {\n const raw = typeof ev.data === 'string' ? ev.data : new TextDecoder().decode(ev.data)\n frame = JSON.parse(raw) as ServerFrame\n } catch {\n return\n }\n if (frame.t === 'revoked') {\n ws.close()\n return\n }\n if (frame.t === 'active') {\n if (!activated) {\n activated = true\n opts.onActivated?.()\n }\n return\n }\n if (frame.t !== 'rpc') return\n let result: unknown\n let rpcErr: { code?: string; detail?: string } | null = null\n try {\n result = await dispatch(frame.tool, frame.args, rpc)\n const reply: ClientFrame = { t: 'rpc-reply', id: frame.id, result }\n ws.send(JSON.stringify(reply))\n } catch (e: unknown) {\n rpcErr = e as { code?: string; detail?: string }\n // When a plain JS exception bubbles up (TypeError, RangeError, etc.),\n // rpcErr has no .code/.detail. Enrich the detail with the actual\n // message + stack so the server/Claude can see the real cause.\n const detail =\n rpcErr.detail ??\n (e instanceof Error\n ? `${e.name}: ${e.message}${e.stack ? '\\n' + e.stack.split('\\n').slice(0, 5).join('\\n') : ''}`\n : undefined)\n const errFrame: ClientFrame = {\n t: 'rpc-error',\n id: frame.id,\n code: rpcErr.code ?? 'internal',\n detail,\n }\n ws.send(JSON.stringify(errFrame))\n // Also log to the browser console so operators see the real cause even\n // when the server/Claude just show \"internal\".\n console.error(`[llui-agent] rpc handler threw for ${frame.tool}:`, e)\n }\n const kind = getLogKindForTool(frame.tool, result, rpcErr)\n const logEntry: LogEntry = {\n id: frame.id,\n at: Date.now(),\n kind,\n variant: extractVariant(frame.tool, frame.args),\n intent: buildIntent(frame.tool, frame.args, rpc.getMsgAnnotations()),\n }\n // For successful send_message dispatches, the stateDiff is part\n // of the response. Lifting it into the log entry means the agent\n // can read its own past actions with full \"what changed\" detail\n // without re-querying state — essential for self-correcting\n // behavior over multi-step flows.\n if (frame.tool === 'send_message' && rpcErr === null && isDispatchedResult(result)) {\n logEntry.stateDiff = result.stateDiff\n }\n if (frame.tool === 'send_message') {\n // Capture the outcome so `describe_context` can surface it as a\n // synthetic \"Last dispatch …\" hint. Apps used to roll their\n // own `lastDispatchError` field; the framework owns it now.\n const outcome = extractDispatchOutcome(frame.args, result, rpcErr)\n if (outcome !== null) opts.onDispatchOutcome?.(outcome)\n }\n opts.onLogEntry?.(logEntry)\n ws.send(JSON.stringify({ t: 'log-append', entry: logEntry } satisfies ClientFrame))\n })\n\n return {\n resolveConfirm(confirmId, outcome, stateAfter) {\n const frame: ClientFrame = {\n t: 'confirm-resolved',\n confirmId,\n outcome,\n stateAfter,\n }\n ws.send(JSON.stringify(frame))\n },\n emitStateUpdate(path, stateAfter) {\n const frame: ClientFrame = { t: 'state-update', path, stateAfter }\n ws.send(JSON.stringify(frame))\n },\n emitLogAppend(entry) {\n const frame: ClientFrame = { t: 'log-append', entry }\n ws.send(JSON.stringify(frame))\n },\n close() {\n ws.close()\n },\n }\n}\n\nasync function dispatch(tool: string, args: unknown, rpc: RpcHosts): Promise<unknown> {\n switch (tool) {\n case 'get_state':\n return handleGetState(rpc, (args ?? {}) as { path?: string })\n case 'query_state':\n return handleQueryState(rpc, (args ?? {}) as { path: string })\n case 'list_actions':\n return handleListActions(rpc)\n case 'send_message':\n return handleSendMessage(rpc, args as never)\n case 'query_dom':\n return handleQueryDom(rpc, args as never)\n case 'describe_visible_content':\n return handleDescribeVisibleContent(rpc)\n case 'describe_context':\n return handleDescribeContext(rpc)\n case 'observe':\n return handleObserve(rpc)\n case 'would_dispatch':\n return handleWouldDispatch(rpc, args as never)\n default:\n throw { code: 'invalid', detail: `unknown tool: ${tool}` }\n }\n}\n\nconst READ_TOOLS = new Set([\n 'get_state',\n 'query_state',\n 'list_actions',\n 'describe_context',\n 'query_dom',\n 'describe_visible_content',\n 'observe',\n 'would_dispatch',\n])\n\nfunction getLogKindForTool(\n tool: string,\n result: unknown,\n err: { code?: string; detail?: string } | null,\n): LogKind {\n if (err !== null) return 'error'\n if (tool === 'send_message') {\n const r = result as { status?: string } | null\n const status = r?.status\n if (status === 'dispatched' || status === 'confirmed') return 'dispatched'\n if (status === 'pending-confirmation') return 'proposed'\n if (status === 'rejected') return 'blocked'\n return 'dispatched'\n }\n if (READ_TOOLS.has(tool)) return 'read'\n return 'read'\n}\n\n/**\n * Type guard for the `dispatched` shape of `LapMessageResponse`.\n * Used to lift the stateDiff into the log entry without polluting\n * the type chain with cross-cutting imports.\n */\nfunction isDispatchedResult(\n result: unknown,\n): result is { status: 'dispatched'; stateDiff: import('../state-diff.js').StateDiff } {\n return (\n result !== null &&\n typeof result === 'object' &&\n (result as { status?: unknown }).status === 'dispatched' &&\n Array.isArray((result as { stateDiff?: unknown }).stateDiff)\n )\n}\n\n/**\n * Build a `LastDispatchOutcome` snapshot from the send_message rpc's\n * result/error pair. Returns null when the args don't carry a variant\n * name (malformed dispatch — would never have been logged anyway).\n *\n * Status mapping:\n * - { status: 'dispatched' } → 'dispatched' (with errors/warnings)\n * - { status: 'rejected' } → 'rejected'\n * - rpcErr (rpc handler threw, including reducer-throw on the predict path) → 'reducer-threw'\n *\n * The outcome is consumed by `describe_context` to prepend a synthetic\n * \"Last dispatch …\" hint. Clean dispatched outcomes (no errors, no\n * warnings) still get tracked — `formatLastOutcomeHint` decides whether\n * to surface them.\n */\nfunction extractDispatchOutcome(\n args: unknown,\n result: unknown,\n rpcErr: { code?: string; detail?: string } | null,\n): LastDispatchOutcome | null {\n const variant = extractVariant('send_message', args)\n if (variant === undefined) return null\n\n const at = Date.now()\n\n if (rpcErr !== null) {\n // The rpc handler itself threw — most often this is a reducer\n // throw that bubbled past the catch in send-message.ts (e.g.\n // would_dispatch's reducer threw in a non-send-message tool that\n // shares the path). Treat as `reducer-threw` so the agent reads\n // \"state may be partially advanced; observe before retrying.\"\n return {\n variant,\n status: 'reducer-threw',\n errors: [{ message: rpcErr.detail ?? rpcErr.code ?? 'rpc handler threw' }],\n at,\n }\n }\n if (result === null || typeof result !== 'object') return null\n const r = result as {\n status?: string\n drain?: {\n errors?: ReadonlyArray<{ message: string }>\n warnings?: ReadonlyArray<{ path: string; message: string }>\n }\n detail?: string\n }\n if (r.status === 'dispatched') {\n const errors = r.drain?.errors ?? []\n const warnings = r.drain?.warnings ?? []\n const out: LastDispatchOutcome = { variant, status: 'dispatched', at }\n if (errors.length > 0) out.errors = errors\n if (warnings.length > 0) out.warnings = warnings\n return out\n }\n if (r.status === 'rejected') {\n const detail = r.detail ?? 'rejected'\n return {\n variant,\n status: 'rejected',\n errors: [{ message: detail }],\n at,\n }\n }\n // Other statuses (`pending-confirmation`, etc.) — don't update the\n // last-outcome cache. The dispatch hasn't really concluded yet.\n return null\n}\n\nfunction extractVariant(tool: string, args: unknown): string | undefined {\n if (tool === 'send_message') {\n const a = args as { msg?: { type?: string } } | null\n const t = a?.msg?.type\n return typeof t === 'string' ? t : undefined\n }\n return undefined\n}\n\n// Human-readable label for each rpc. For send_message, prefer the @intent\n// annotation authored on the Msg union; fall back to the raw variant name.\n// For read tools, return a short fixed label so the activity feed doesn't\n// show opaque tool ids like \"describe_visible_content\".\nfunction buildIntent(\n tool: string,\n args: unknown,\n annotations: Record<string, MessageAnnotations> | null,\n): string {\n if (tool === 'send_message') {\n const a = args as { msg?: { type?: string } } | null\n const variant = typeof a?.msg?.type === 'string' ? a.msg.type : undefined\n const annotated = variant ? annotations?.[variant]?.intent : null\n if (annotated) return annotated\n return variant ?? 'Send message'\n }\n if (tool === 'get_state') return 'Read app state'\n if (tool === 'query_state') return 'Read state slice'\n if (tool === 'list_actions') return 'List available actions'\n if (tool === 'describe_context') return 'Read current context'\n if (tool === 'describe_visible_content') return 'Read visible content'\n if (tool === 'query_dom') {\n const a = args as { name?: string } | null\n return a?.name ? `Query DOM: ${a.name}` : 'Query DOM'\n }\n return tool\n}\n"]}
@@ -51,6 +51,16 @@ export type MessageAnnotations = {
51
51
  * annotated it yet.
52
52
  */
53
53
  emits: string[];
54
+ /**
55
+ * Boolean predicate authored as `@routeGated("expr")` JSDoc, with
56
+ * `state` bound at evaluation time. The variant only surfaces in
57
+ * `list_actions` when the predicate returns true. Compile-time
58
+ * alternative to `agentAffordances(state) => Msg[]` for the common
59
+ * case of "this Msg is reachable when state.X looks like Y." Null
60
+ * when the variant has no `@routeGated` tag (default affordance
61
+ * behavior applies).
62
+ */
63
+ routeGate?: string | null;
54
64
  };
55
65
  export type MessageSchemaEntry = {
56
66
  payloadSchema: object;
@@ -188,6 +198,14 @@ export type LapMessageRejectReason = 'human-only' | 'user-cancelled' | 'timeout'
188
198
  * `errors` surfaces sync throws from `onEffect` and unhandled rejections
189
199
  * from effect handlers that fired during the drain window, so the LLM
190
200
  * can see when an HTTP handler crashed silently.
201
+ *
202
+ * `warnings` surfaces non-blocking observations from the schema
203
+ * validator — typically `untyped-field` flags raised in strict mode
204
+ * when the agent provided a value for an `'unknown'`-typed field. The
205
+ * dispatch landed (we accepted the value) but the validator couldn't
206
+ * structurally check it, so the agent learns of the gap and can
207
+ * tighten the next try if needed. Lenient mode never emits warnings;
208
+ * the field is omitted in that case.
191
209
  */
192
210
  export type LapDrainMeta = {
193
211
  effectsObserved: number;
@@ -198,6 +216,11 @@ export type LapDrainMeta = {
198
216
  message: string;
199
217
  stack?: string;
200
218
  }>;
219
+ warnings?: Array<{
220
+ path: string;
221
+ code: string;
222
+ message: string;
223
+ }>;
201
224
  };
202
225
  export type LapMessageResponse = {
203
226
  status: 'dispatched';
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,SAAS,GACT,QAAQ,GACR,cAAc,GACd,SAAS,GACT,cAAc,GACd,SAAS,GACT,UAAU,CAAA;AAEd,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE;QACL,IAAI,EAAE,YAAY,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;CACF,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAA;AAEjE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,gBAAgB,EAAE,OAAO,CAAA;IACzB,eAAe,EAAE,OAAO,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC5C,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;IACtB,WAAW,EAAE;QACX,aAAa,EA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ACV,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AACjE,iEAAiE;AA6gBjE,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\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 */\nexport type LapDrainMeta = {\n effectsObserved: number\n durationMs: number\n timedOut: boolean\n errors: Array<{ kind: 'error' | 'unhandledrejection'; message: string; stack?: 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\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/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\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\nexport type ServerFrame = RpcFrame | RevokedFrame | ActiveFrame\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;AAgiBjE,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\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/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\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\nexport type ServerFrame = RpcFrame | RevokedFrame | ActiveFrame\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llui/agent",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -40,12 +40,12 @@
40
40
  "ws": "^8.18.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "@llui/dom": "^0.0.33"
43
+ "@llui/dom": "^0.0.34"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^22.0.0",
47
47
  "@types/ws": "^8.5.13",
48
- "@llui/dom": "0.0.33"
48
+ "@llui/dom": "0.0.34"
49
49
  },
50
50
  "description": "LLui Agent — LAP server + browser client runtime for driving LLui apps from LLM clients",
51
51
  "keywords": [