@llui/agent 0.0.29 → 0.0.31

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.
Files changed (114) hide show
  1. package/dist/client/factory.d.ts.map +1 -1
  2. package/dist/client/factory.js +59 -0
  3. package/dist/client/factory.js.map +1 -1
  4. package/dist/client/rpc/observe.d.ts +20 -0
  5. package/dist/client/rpc/observe.d.ts.map +1 -0
  6. package/dist/client/rpc/observe.js +9 -0
  7. package/dist/client/rpc/observe.js.map +1 -0
  8. package/dist/client/rpc/send-message.d.ts +32 -3
  9. package/dist/client/rpc/send-message.d.ts.map +1 -1
  10. package/dist/client/rpc/send-message.js +94 -4
  11. package/dist/client/rpc/send-message.js.map +1 -1
  12. package/dist/client/ws-client.d.ts +2 -1
  13. package/dist/client/ws-client.d.ts.map +1 -1
  14. package/dist/client/ws-client.js +4 -0
  15. package/dist/client/ws-client.js.map +1 -1
  16. package/dist/protocol.d.ts +64 -1
  17. package/dist/protocol.d.ts.map +1 -1
  18. package/dist/protocol.js.map +1 -1
  19. package/dist/server/cloudflare/durable-object.d.ts +58 -0
  20. package/dist/server/cloudflare/durable-object.d.ts.map +1 -0
  21. package/dist/server/cloudflare/durable-object.js +33 -0
  22. package/dist/server/cloudflare/durable-object.js.map +1 -0
  23. package/dist/server/cloudflare/index.d.ts +49 -0
  24. package/dist/server/cloudflare/index.d.ts.map +1 -0
  25. package/dist/server/cloudflare/index.js +49 -0
  26. package/dist/server/cloudflare/index.js.map +1 -0
  27. package/dist/server/cloudflare/worker.d.ts +40 -0
  28. package/dist/server/cloudflare/worker.d.ts.map +1 -0
  29. package/dist/server/cloudflare/worker.js +55 -0
  30. package/dist/server/cloudflare/worker.js.map +1 -0
  31. package/dist/server/core-entry.d.ts +27 -0
  32. package/dist/server/core-entry.d.ts.map +1 -0
  33. package/dist/server/core-entry.js +19 -0
  34. package/dist/server/core-entry.js.map +1 -0
  35. package/dist/server/core.d.ts +78 -0
  36. package/dist/server/core.d.ts.map +1 -0
  37. package/dist/server/core.js +84 -0
  38. package/dist/server/core.js.map +1 -0
  39. package/dist/server/factory.d.ts +5 -3
  40. package/dist/server/factory.d.ts.map +1 -1
  41. package/dist/server/factory.js +18 -58
  42. package/dist/server/factory.js.map +1 -1
  43. package/dist/server/http/mint.d.ts.map +1 -1
  44. package/dist/server/http/mint.js +2 -3
  45. package/dist/server/http/mint.js.map +1 -1
  46. package/dist/server/http/resume.js +1 -1
  47. package/dist/server/http/resume.js.map +1 -1
  48. package/dist/server/identity.d.ts +5 -1
  49. package/dist/server/identity.d.ts.map +1 -1
  50. package/dist/server/identity.js +49 -11
  51. package/dist/server/identity.js.map +1 -1
  52. package/dist/server/index.d.ts +16 -1
  53. package/dist/server/index.d.ts.map +1 -1
  54. package/dist/server/index.js +13 -1
  55. package/dist/server/index.js.map +1 -1
  56. package/dist/server/lap/confirm-result.d.ts +2 -2
  57. package/dist/server/lap/confirm-result.d.ts.map +1 -1
  58. package/dist/server/lap/confirm-result.js +1 -1
  59. package/dist/server/lap/confirm-result.js.map +1 -1
  60. package/dist/server/lap/describe.d.ts +4 -4
  61. package/dist/server/lap/describe.d.ts.map +1 -1
  62. package/dist/server/lap/describe.js +4 -4
  63. package/dist/server/lap/describe.js.map +1 -1
  64. package/dist/server/lap/forward.d.ts +2 -2
  65. package/dist/server/lap/forward.d.ts.map +1 -1
  66. package/dist/server/lap/forward.js +1 -1
  67. package/dist/server/lap/forward.js.map +1 -1
  68. package/dist/server/lap/message.d.ts +2 -2
  69. package/dist/server/lap/message.d.ts.map +1 -1
  70. package/dist/server/lap/message.js +7 -3
  71. package/dist/server/lap/message.js.map +1 -1
  72. package/dist/server/lap/observe.d.ts +27 -0
  73. package/dist/server/lap/observe.d.ts.map +1 -0
  74. package/dist/server/lap/observe.js +77 -0
  75. package/dist/server/lap/observe.js.map +1 -0
  76. package/dist/server/lap/router.d.ts.map +1 -1
  77. package/dist/server/lap/router.js +3 -0
  78. package/dist/server/lap/router.js.map +1 -1
  79. package/dist/server/lap/wait.d.ts +2 -2
  80. package/dist/server/lap/wait.d.ts.map +1 -1
  81. package/dist/server/lap/wait.js +1 -1
  82. package/dist/server/lap/wait.js.map +1 -1
  83. package/dist/server/options.d.ts +25 -1
  84. package/dist/server/options.d.ts.map +1 -1
  85. package/dist/server/options.js.map +1 -1
  86. package/dist/server/token.d.ts +7 -3
  87. package/dist/server/token.d.ts.map +1 -1
  88. package/dist/server/token.js +66 -26
  89. package/dist/server/token.js.map +1 -1
  90. package/dist/server/web/adapter.d.ts +16 -0
  91. package/dist/server/web/adapter.d.ts.map +1 -0
  92. package/dist/server/web/adapter.js +45 -0
  93. package/dist/server/web/adapter.js.map +1 -0
  94. package/dist/server/web/index.d.ts +12 -0
  95. package/dist/server/web/index.d.ts.map +1 -0
  96. package/dist/server/web/index.js +12 -0
  97. package/dist/server/web/index.js.map +1 -0
  98. package/dist/server/web/upgrade.d.ts +41 -0
  99. package/dist/server/web/upgrade.d.ts.map +1 -0
  100. package/dist/server/web/upgrade.js +96 -0
  101. package/dist/server/web/upgrade.js.map +1 -0
  102. package/dist/server/ws/pairing-registry.d.ts +84 -21
  103. package/dist/server/ws/pairing-registry.d.ts.map +1 -1
  104. package/dist/server/ws/pairing-registry.js +89 -151
  105. package/dist/server/ws/pairing-registry.js.map +1 -1
  106. package/dist/server/ws/rpc.d.ts +39 -0
  107. package/dist/server/ws/rpc.d.ts.map +1 -0
  108. package/dist/server/ws/rpc.js +126 -0
  109. package/dist/server/ws/rpc.js.map +1 -0
  110. package/dist/server/ws/upgrade.d.ts +3 -3
  111. package/dist/server/ws/upgrade.d.ts.map +1 -1
  112. package/dist/server/ws/upgrade.js +2 -2
  113. package/dist/server/ws/upgrade.js.map +1 -1
  114. package/package.json +14 -2
@@ -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,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AC3C,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AACjE,iEAAiE","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\nexport type MessageAnnotations = {\n intent: string | null\n alwaysAffordable: boolean\n requiresConfirm: boolean\n humanOnly: boolean\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 intent: string\n requiresConfirm: boolean\n source: 'binding' | 'always-affordable'\n selectorHint: string | null\n payloadHint: object | null\n }>\n}\n\nexport type LapMessageRequest = {\n msg: { type: string; [k: string]: unknown }\n reason?: string\n waitFor?: 'idle' | 'none'\n timeoutMs?: number\n}\n\nexport type LapMessageRejectReason =\n | 'humanOnly'\n | 'user-cancelled'\n | 'timeout'\n | 'invalid'\n | 'schema-error'\n | 'revoked'\n | 'paused'\n\nexport type LapMessageResponse =\n | { status: 'dispatched'; stateAfter: unknown }\n | { status: 'pending-confirmation'; confirmId: string }\n | { status: 'confirmed'; stateAfter: unknown }\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 = { outline: OutlineNode[] }\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\nexport type AgentContext = {\n summary: string\n hints?: string[]\n cautions?: string[]\n}\n\nexport type LapContextResponse = { context: AgentContext }\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}\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\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 TokenPayload = {\n tid: string\n iat: number\n exp: number\n scope: 'agent'\n}\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 uid: string | null\n status: TokenStatus\n createdAt: 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"]}
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AACjE,iEAAiE","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\nexport type MessageAnnotations = {\n intent: string | null\n alwaysAffordable: boolean\n requiresConfirm: boolean\n humanOnly: boolean\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 intent: string\n requiresConfirm: boolean\n source: 'binding' | 'always-affordable'\n selectorHint: string | null\n payloadHint: object | null\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\nexport type LapMessageRejectReason =\n | 'humanOnly'\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 stateAfter: unknown\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 = { outline: OutlineNode[] }\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\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\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 TokenPayload = {\n tid: string\n iat: number\n exp: number\n scope: 'agent'\n}\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 uid: string | null\n status: TokenStatus\n createdAt: 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"]}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Durable Object helper for hosting the agent pairing + LAP surface
3
+ * on Cloudflare Workers. One DO instance owns one `tid` — its
4
+ * in-memory `PairingRegistry` survives across Worker isolate
5
+ * invocations because the DO IS persistent.
6
+ *
7
+ * This file exports a class designed to be composed into a real
8
+ * Durable Object in the user's Worker project. We intentionally
9
+ * don't subclass `DurableObject` from `@cloudflare/workers-types` —
10
+ * that dependency belongs to the user's project, not ours. Users
11
+ * wrap an instance of `AgentPairingDurableObject` in their own DO
12
+ * class and forward `fetch` to it.
13
+ *
14
+ * Usage in a Worker project:
15
+ *
16
+ * ```ts
17
+ * // worker.ts
18
+ * import { AgentPairingDurableObject } from '@llui/agent/server/cloudflare'
19
+ *
20
+ * export class AgentDO {
21
+ * private agent: AgentPairingDurableObject
22
+ * constructor(_state: DurableObjectState, env: Env) {
23
+ * this.agent = new AgentPairingDurableObject({
24
+ * signingKey: env.AGENT_SIGNING_KEY,
25
+ * })
26
+ * }
27
+ * fetch(req: Request): Promise<Response> {
28
+ * return this.agent.fetch(req)
29
+ * }
30
+ * }
31
+ *
32
+ * export default {
33
+ * async fetch(req: Request, env: Env): Promise<Response> {
34
+ * return routeToAgentDO(req, env.AGENT_DO, env.AGENT_SIGNING_KEY)
35
+ * },
36
+ * }
37
+ * ```
38
+ *
39
+ * See `./worker.ts` for `routeToAgentDO` and the full wiring.
40
+ */
41
+ import type { CoreOptions, AgentCoreHandle } from '../core.js';
42
+ export type DurableObjectOptions = Omit<CoreOptions, 'registry'>;
43
+ /**
44
+ * Agent server instance scoped to a single Durable Object. All
45
+ * pairing state lives in the DO's in-process memory — which is safe
46
+ * here because the DO is a persistent addressable entity, not a
47
+ * one-shot Worker isolate.
48
+ *
49
+ * Users instantiate one of these inside their DO class's constructor
50
+ * and delegate `fetch` to `agent.fetch(req)`. LAP HTTP routes and
51
+ * WebSocket upgrades both flow through this single entry.
52
+ */
53
+ export declare class AgentPairingDurableObject {
54
+ readonly agent: AgentCoreHandle;
55
+ constructor(opts: DurableObjectOptions);
56
+ fetch(req: Request): Promise<Response>;
57
+ }
58
+ //# sourceMappingURL=durable-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-object.d.ts","sourceRoot":"","sources":["../../../src/server/cloudflare/durable-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAI9D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;AAEhE;;;;;;;;;GASG;AACH,qBAAa,yBAAyB;IACpC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;gBAEnB,IAAI,EAAE,oBAAoB;IAIhC,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAgB7C"}
@@ -0,0 +1,33 @@
1
+ import { createLluiAgentCore } from '../core.js';
2
+ import { handleCloudflareUpgrade } from '../web/upgrade.js';
3
+ /**
4
+ * Agent server instance scoped to a single Durable Object. All
5
+ * pairing state lives in the DO's in-process memory — which is safe
6
+ * here because the DO is a persistent addressable entity, not a
7
+ * one-shot Worker isolate.
8
+ *
9
+ * Users instantiate one of these inside their DO class's constructor
10
+ * and delegate `fetch` to `agent.fetch(req)`. LAP HTTP routes and
11
+ * WebSocket upgrades both flow through this single entry.
12
+ */
13
+ export class AgentPairingDurableObject {
14
+ agent;
15
+ constructor(opts) {
16
+ this.agent = createLluiAgentCore(opts);
17
+ }
18
+ async fetch(req) {
19
+ const url = new URL(req.url);
20
+ // LAP routes (/agent/lap/v1/*, /agent/*). `router` returns null
21
+ // for non-matching paths so we can fall through to the upgrade.
22
+ const lapRes = await this.agent.router(req);
23
+ if (lapRes)
24
+ return lapRes;
25
+ // WebSocket upgrade — uses `WebSocketPair`, which only exists in
26
+ // Cloudflare Workers.
27
+ if (url.pathname === '/agent/ws') {
28
+ return handleCloudflareUpgrade(req, this.agent);
29
+ }
30
+ return new Response('Not Found', { status: 404 });
31
+ }
32
+ }
33
+ //# sourceMappingURL=durable-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-object.js","sourceRoot":"","sources":["../../../src/server/cloudflare/durable-object.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAI3D;;;;;;;;;GASG;AACH,MAAM,OAAO,yBAAyB;IAC3B,KAAK,CAAiB;IAE/B,YAAY,IAA0B;QACpC,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAY;QACtB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAE5B,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 * this.agent = new AgentPairingDurableObject({\n * signingKey: env.AGENT_SIGNING_KEY,\n * })\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 * return routeToAgentDO(req, env.AGENT_DO, env.AGENT_SIGNING_KEY)\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'\n\nexport type DurableObjectOptions = Omit<CoreOptions, 'registry'>\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 and\n * WebSocket upgrades both flow through this single entry.\n */\nexport class AgentPairingDurableObject {\n readonly agent: AgentCoreHandle\n\n constructor(opts: DurableObjectOptions) {\n this.agent = createLluiAgentCore(opts)\n }\n\n async fetch(req: Request): Promise<Response> {\n const url = new URL(req.url)\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"]}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Cloudflare Workers + Durable Object adapter. Use this sub-path
3
+ * from a Cloudflare Workers project where the agent pairing state
4
+ * lives inside a Durable Object.
5
+ *
6
+ * See the full deployment recipe at
7
+ * https://llui.dev/api/agent#cloudflare-deployment — the short
8
+ * version:
9
+ *
10
+ * ```ts
11
+ * import {
12
+ * AgentPairingDurableObject,
13
+ * routeToAgentDO,
14
+ * } from '@llui/agent/server/cloudflare'
15
+ *
16
+ * export class AgentDO {
17
+ * private agent: AgentPairingDurableObject
18
+ * constructor(_state: DurableObjectState, env: Env) {
19
+ * this.agent = new AgentPairingDurableObject({
20
+ * signingKey: env.AGENT_SIGNING_KEY,
21
+ * })
22
+ * }
23
+ * fetch(req: Request) {
24
+ * return this.agent.fetch(req)
25
+ * }
26
+ * }
27
+ *
28
+ * export default {
29
+ * async fetch(req: Request, env: Env) {
30
+ * return routeToAgentDO(req, env.AGENT_DO, env.AGENT_SIGNING_KEY)
31
+ * },
32
+ * }
33
+ * ```
34
+ *
35
+ * `wrangler.toml`:
36
+ * ```toml
37
+ * [[durable_objects.bindings]]
38
+ * name = "AGENT_DO"
39
+ * class_name = "AgentDO"
40
+ *
41
+ * [[migrations]]
42
+ * tag = "v1"
43
+ * new_classes = ["AgentDO"]
44
+ * ```
45
+ */
46
+ export { AgentPairingDurableObject, type DurableObjectOptions } from './durable-object.js';
47
+ export { routeToAgentDO, type MinimalDurableObjectNamespace, type MinimalDurableObjectId, type MinimalDurableObjectStub, } from './worker.js';
48
+ export { createWHATWGPairingConnection, handleCloudflareUpgrade, extractToken, } from '../web/index.js';
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;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"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Cloudflare Workers + Durable Object adapter. Use this sub-path
3
+ * from a Cloudflare Workers project where the agent pairing state
4
+ * lives inside a Durable Object.
5
+ *
6
+ * See the full deployment recipe at
7
+ * https://llui.dev/api/agent#cloudflare-deployment — the short
8
+ * version:
9
+ *
10
+ * ```ts
11
+ * import {
12
+ * AgentPairingDurableObject,
13
+ * routeToAgentDO,
14
+ * } from '@llui/agent/server/cloudflare'
15
+ *
16
+ * export class AgentDO {
17
+ * private agent: AgentPairingDurableObject
18
+ * constructor(_state: DurableObjectState, env: Env) {
19
+ * this.agent = new AgentPairingDurableObject({
20
+ * signingKey: env.AGENT_SIGNING_KEY,
21
+ * })
22
+ * }
23
+ * fetch(req: Request) {
24
+ * return this.agent.fetch(req)
25
+ * }
26
+ * }
27
+ *
28
+ * export default {
29
+ * async fetch(req: Request, env: Env) {
30
+ * return routeToAgentDO(req, env.AGENT_DO, env.AGENT_SIGNING_KEY)
31
+ * },
32
+ * }
33
+ * ```
34
+ *
35
+ * `wrangler.toml`:
36
+ * ```toml
37
+ * [[durable_objects.bindings]]
38
+ * name = "AGENT_DO"
39
+ * class_name = "AgentDO"
40
+ *
41
+ * [[migrations]]
42
+ * tag = "v1"
43
+ * new_classes = ["AgentDO"]
44
+ * ```
45
+ */
46
+ export { AgentPairingDurableObject } from './durable-object.js';
47
+ export { routeToAgentDO, } from './worker.js';
48
+ export { createWHATWGPairingConnection, handleCloudflareUpgrade, extractToken, } from '../web/index.js';
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;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 * this.agent = new AgentPairingDurableObject({\n * signingKey: env.AGENT_SIGNING_KEY,\n * })\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, env.AGENT_SIGNING_KEY)\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"]}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Minimal DurableObjectNamespace surface we need — `idFromName` +
3
+ * `get` returning a `Stub` with `fetch(req)`. Kept structural so we
4
+ * don't depend on `@cloudflare/workers-types` (the user's project has
5
+ * them; we shouldn't duplicate).
6
+ */
7
+ export interface MinimalDurableObjectNamespace {
8
+ idFromName(name: string): MinimalDurableObjectId;
9
+ get(id: MinimalDurableObjectId): MinimalDurableObjectStub;
10
+ }
11
+ export interface MinimalDurableObjectId {
12
+ readonly name?: string;
13
+ }
14
+ export interface MinimalDurableObjectStub {
15
+ fetch(req: Request): Promise<Response>;
16
+ }
17
+ /**
18
+ * Route an incoming Worker `fetch` request to the Durable Object
19
+ * that owns its `tid`.
20
+ *
21
+ * The token travels in three places depending on the route:
22
+ * - LAP HTTP calls: `Authorization: Bearer <token>` header
23
+ * - Mint / resume HTTP calls: no token (identity resolver runs
24
+ * inside the DO via the LAP router; we route by origin or a
25
+ * special `/agent/mint` path — see below)
26
+ * - WebSocket upgrade: `?token=<token>` in the URL
27
+ *
28
+ * Requests that don't carry a tid (mint, resume-list, sessions) are
29
+ * routed to a "root" DO named `__root`, which handles identity /
30
+ * token store operations centrally. LAP and WS calls route to the
31
+ * per-tid DO so the pairing state stays local.
32
+ *
33
+ * This is the recommended entry for Cloudflare Workers deployments;
34
+ * users who need custom routing can write their own and call the
35
+ * underlying primitives (`verifyToken`, `namespace.get`, etc).
36
+ */
37
+ export declare function routeToAgentDO(req: Request, namespace: MinimalDurableObjectNamespace, signingKey: string | Uint8Array, opts?: {
38
+ rootName?: string;
39
+ }): Promise<Response>;
40
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/server/cloudflare/worker.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC5C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB,CAAA;IAChD,GAAG,CAAC,EAAE,EAAE,sBAAsB,GAAG,wBAAwB,CAAA;CAC1D;AACD,MAAM,WAAW,sBAAsB;IAErC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AACD,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,6BAA6B,EACxC,UAAU,EAAE,MAAM,GAAG,UAAU,EAC/B,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,QAAQ,CAAC,CA4BnB"}
@@ -0,0 +1,55 @@
1
+ import { verifyToken } from '../token.js';
2
+ /**
3
+ * Route an incoming Worker `fetch` request to the Durable Object
4
+ * that owns its `tid`.
5
+ *
6
+ * The token travels in three places depending on the route:
7
+ * - LAP HTTP calls: `Authorization: Bearer <token>` header
8
+ * - Mint / resume HTTP calls: no token (identity resolver runs
9
+ * inside the DO via the LAP router; we route by origin or a
10
+ * special `/agent/mint` path — see below)
11
+ * - WebSocket upgrade: `?token=<token>` in the URL
12
+ *
13
+ * Requests that don't carry a tid (mint, resume-list, sessions) are
14
+ * routed to a "root" DO named `__root`, which handles identity /
15
+ * token store operations centrally. LAP and WS calls route to the
16
+ * per-tid DO so the pairing state stays local.
17
+ *
18
+ * This is the recommended entry for Cloudflare Workers deployments;
19
+ * users who need custom routing can write their own and call the
20
+ * underlying primitives (`verifyToken`, `namespace.get`, etc).
21
+ */
22
+ export async function routeToAgentDO(req, namespace, signingKey, opts = {}) {
23
+ const rootName = opts.rootName ?? '__root';
24
+ const url = new URL(req.url);
25
+ const path = url.pathname;
26
+ // Non-LAP / non-WS management endpoints (mint, resume, sessions,
27
+ // revoke) — there's no per-tid routing; use the root DO which owns
28
+ // the shared token store + identity resolver.
29
+ if (path === '/agent/mint' ||
30
+ path === '/agent/revoke' ||
31
+ path === '/agent/resume/list' ||
32
+ path === '/agent/resume/claim' ||
33
+ path === '/agent/sessions') {
34
+ const stub = namespace.get(namespace.idFromName(rootName));
35
+ return stub.fetch(req);
36
+ }
37
+ // Token-bearing routes (LAP + WS upgrade) — route by tid.
38
+ const token = extractTokenFromRequest(req);
39
+ if (!token)
40
+ return new Response('Unauthorized', { status: 401 });
41
+ const verified = await verifyToken(token, signingKey);
42
+ if (verified.kind !== 'ok')
43
+ return new Response('Unauthorized', { status: 401 });
44
+ const stub = namespace.get(namespace.idFromName(verified.payload.tid));
45
+ return stub.fetch(req);
46
+ }
47
+ function extractTokenFromRequest(req) {
48
+ const auth = req.headers.get('authorization');
49
+ if (auth?.startsWith('Bearer '))
50
+ return auth.slice('Bearer '.length);
51
+ const url = new URL(req.url);
52
+ const q = url.searchParams.get('token');
53
+ return q;
54
+ }
55
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/server/cloudflare/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAoBzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAY,EACZ,SAAwC,EACxC,UAA+B,EAC/B,OAA8B,EAAE;IAEhC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAA;IAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,IAAI,GA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G,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACvC,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["import { verifyToken } from '../token.js'\n\n/**\n * Minimal DurableObjectNamespace surface we need — `idFromName` +\n * `get` returning a `Stub` with `fetch(req)`. Kept structural so we\n * don't depend on `@cloudflare/workers-types` (the user's project has\n * them; we shouldn't duplicate).\n */\nexport interface MinimalDurableObjectNamespace {\n idFromName(name: string): MinimalDurableObjectId\n get(id: MinimalDurableObjectId): MinimalDurableObjectStub\n}\nexport interface MinimalDurableObjectId {\n // Opaque, but DO ids are passed back into `namespace.get()`.\n readonly name?: string\n}\nexport interface MinimalDurableObjectStub {\n fetch(req: Request): Promise<Response>\n}\n\n/**\n * Route an incoming Worker `fetch` request to the Durable Object\n * that owns its `tid`.\n *\n * The token travels in three places depending on the route:\n * - LAP HTTP calls: `Authorization: Bearer <token>` header\n * - Mint / resume HTTP calls: no token (identity resolver runs\n * inside the DO via the LAP router; we route by origin or a\n * special `/agent/mint` path — see below)\n * - WebSocket upgrade: `?token=<token>` in the URL\n *\n * Requests that don't carry a tid (mint, resume-list, sessions) are\n * routed to a \"root\" DO named `__root`, which handles identity /\n * token store operations centrally. LAP and WS calls route to the\n * per-tid DO so the pairing state stays local.\n *\n * This is the recommended entry for Cloudflare Workers deployments;\n * users who need custom routing can write their own and call the\n * underlying primitives (`verifyToken`, `namespace.get`, etc).\n */\nexport async function routeToAgentDO(\n req: Request,\n namespace: MinimalDurableObjectNamespace,\n signingKey: string | Uint8Array,\n opts: { rootName?: string } = {},\n): Promise<Response> {\n const rootName = opts.rootName ?? '__root'\n const url = new URL(req.url)\n const path = url.pathname\n\n // Non-LAP / non-WS management endpoints (mint, resume, sessions,\n // revoke) — there's no per-tid routing; use the root DO which owns\n // the shared token store + identity resolver.\n if (\n path === '/agent/mint' ||\n path === '/agent/revoke' ||\n path === '/agent/resume/list' ||\n path === '/agent/resume/claim' ||\n path === '/agent/sessions'\n ) {\n const stub = namespace.get(namespace.idFromName(rootName))\n return stub.fetch(req)\n }\n\n // Token-bearing routes (LAP + WS upgrade) — route by tid.\n const token = extractTokenFromRequest(req)\n if (!token) return new Response('Unauthorized', { status: 401 })\n\n const verified = await verifyToken(token, signingKey)\n if (verified.kind !== 'ok') return new Response('Unauthorized', { status: 401 })\n\n const stub = namespace.get(namespace.idFromName(verified.payload.tid))\n return stub.fetch(req)\n}\n\nfunction extractTokenFromRequest(req: Request): string | null {\n const auth = req.headers.get('authorization')\n if (auth?.startsWith('Bearer ')) return auth.slice('Bearer '.length)\n const url = new URL(req.url)\n const q = url.searchParams.get('token')\n return q\n}\n"]}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Runtime-neutral entry point. Import from `@llui/agent/server/core`
3
+ * when targeting runtimes without the Node `ws` library (Cloudflare
4
+ * Workers, Deno, Bun, Deno Deploy). Pair with
5
+ * `@llui/agent/server/web` for WebSocket upgrade helpers.
6
+ *
7
+ * Node/standard server processes should keep using the default
8
+ * `@llui/agent/server` entry, which includes this plus the `ws`-based
9
+ * upgrade handler.
10
+ */
11
+ export { createLluiAgentCore } from './core.js';
12
+ export type { CoreOptions, AgentCoreHandle, AcceptResult } from './core.js';
13
+ export { InMemoryPairingRegistry } from './ws/pairing-registry.js';
14
+ export type { PairingConnection, PairingRegistry, FrameSubscriber } from './ws/pairing-registry.js';
15
+ export { rpc, waitForConfirm, waitForChange } from './ws/rpc.js';
16
+ export type { RpcOptions, RpcError } from './ws/rpc.js';
17
+ export { InMemoryTokenStore } from './token-store.js';
18
+ export type { TokenStore } from './token-store.js';
19
+ export { defaultIdentityResolver, signCookieValue } from './identity.js';
20
+ export type { IdentityResolver } from './identity.js';
21
+ export { consoleAuditSink } from './audit.js';
22
+ export type { AuditSink } from './audit.js';
23
+ export { defaultRateLimiter } from './rate-limit.js';
24
+ export type { RateLimiter } from './rate-limit.js';
25
+ export { signToken, verifyToken } from './token.js';
26
+ export type { TokenPayload, VerifyResult } from './token.js';
27
+ //# sourceMappingURL=core-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-entry.d.ts","sourceRoot":"","sources":["../../src/server/core-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC/C,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACnG,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACxE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACnD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Runtime-neutral entry point. Import from `@llui/agent/server/core`
3
+ * when targeting runtimes without the Node `ws` library (Cloudflare
4
+ * Workers, Deno, Bun, Deno Deploy). Pair with
5
+ * `@llui/agent/server/web` for WebSocket upgrade helpers.
6
+ *
7
+ * Node/standard server processes should keep using the default
8
+ * `@llui/agent/server` entry, which includes this plus the `ws`-based
9
+ * upgrade handler.
10
+ */
11
+ export { createLluiAgentCore } from './core.js';
12
+ export { InMemoryPairingRegistry } from './ws/pairing-registry.js';
13
+ export { rpc, waitForConfirm, waitForChange } from './ws/rpc.js';
14
+ export { InMemoryTokenStore } from './token-store.js';
15
+ export { defaultIdentityResolver, signCookieValue } from './identity.js';
16
+ export { consoleAuditSink } from './audit.js';
17
+ export { defaultRateLimiter } from './rate-limit.js';
18
+ export { signToken, verifyToken } from './token.js';
19
+ //# sourceMappingURL=core-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-entry.js","sourceRoot":"","sources":["../../src/server/core-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAElE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA","sourcesContent":["/**\n * Runtime-neutral entry point. Import from `@llui/agent/server/core`\n * when targeting runtimes without the Node `ws` library (Cloudflare\n * Workers, Deno, Bun, Deno Deploy). Pair with\n * `@llui/agent/server/web` for WebSocket upgrade helpers.\n *\n * Node/standard server processes should keep using the default\n * `@llui/agent/server` entry, which includes this plus the `ws`-based\n * upgrade handler.\n */\nexport { createLluiAgentCore } from './core.js'\nexport type { CoreOptions, AgentCoreHandle, AcceptResult } from './core.js'\nexport { InMemoryPairingRegistry } from './ws/pairing-registry.js'\nexport type { PairingConnection, PairingRegistry, FrameSubscriber } from './ws/pairing-registry.js'\nexport { rpc, waitForConfirm, waitForChange } from './ws/rpc.js'\nexport type { RpcOptions, RpcError } from './ws/rpc.js'\nexport { InMemoryTokenStore } from './token-store.js'\nexport type { TokenStore } from './token-store.js'\nexport { defaultIdentityResolver, signCookieValue } from './identity.js'\nexport type { IdentityResolver } from './identity.js'\nexport { consoleAuditSink } from './audit.js'\nexport type { AuditSink } from './audit.js'\nexport { defaultRateLimiter } from './rate-limit.js'\nexport type { RateLimiter } from './rate-limit.js'\nexport { signToken, verifyToken } from './token.js'\nexport type { TokenPayload, VerifyResult } from './token.js'\n"]}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Runtime-neutral core of the LLui agent server. Exports everything
3
+ * that works on any runtime with `crypto.subtle` + `Request`/`Response`
4
+ * + long-lived connection primitives — in practice: Node, Bun, Deno,
5
+ * Deno Deploy, Cloudflare Workers + Durable Objects.
6
+ *
7
+ * Intentionally does NOT import the `ws` library or any `node:*`
8
+ * modules. Node-specific wiring lives in `./factory.ts`
9
+ * (`createLluiAgentServer`); web runtimes use `./web/` adapters on
10
+ * top of this core.
11
+ */
12
+ import type { ServerOptions } from './options.js';
13
+ import type { TokenStore } from './token-store.js';
14
+ import type { IdentityResolver } from './identity.js';
15
+ import type { AuditSink } from './audit.js';
16
+ import type { RateLimiter } from './rate-limit.js';
17
+ import type { PairingConnection, PairingRegistry } from './ws/pairing-registry.js';
18
+ /**
19
+ * Options accepted by `createLluiAgentCore`. Strict subset of
20
+ * `ServerOptions` — everything needed to build the router, registry,
21
+ * and accept-connection primitive. The Node factory adds WebSocket
22
+ * upgrade wiring on top.
23
+ */
24
+ export type CoreOptions = {
25
+ signingKey: ServerOptions['signingKey'];
26
+ tokenStore?: TokenStore;
27
+ identityResolver?: IdentityResolver;
28
+ auditSink?: AuditSink;
29
+ rateLimiter?: RateLimiter;
30
+ lapBasePath?: string;
31
+ /**
32
+ * Override the default `InMemoryPairingRegistry`. Web runtimes that
33
+ * need a different pairing implementation (e.g. a Cloudflare
34
+ * Durable Object that persists across isolates) pass it here.
35
+ */
36
+ registry?: PairingRegistry;
37
+ };
38
+ export type AcceptResult = {
39
+ ok: true;
40
+ tid: string;
41
+ } | {
42
+ ok: false;
43
+ status: number;
44
+ code: 'auth-failed' | 'revoked';
45
+ };
46
+ /**
47
+ * Handle returned by `createLluiAgentCore`. Purely runtime-neutral —
48
+ * `router` is a Fetch-style handler, `acceptConnection` is the
49
+ * primitive that runtime-specific WebSocket adapters call after
50
+ * accepting a socket in their native way.
51
+ */
52
+ export type AgentCoreHandle = {
53
+ router: (req: Request) => Promise<Response | null>;
54
+ registry: PairingRegistry;
55
+ tokenStore: TokenStore;
56
+ auditSink: AuditSink;
57
+ /**
58
+ * Validate an agent token and register a `PairingConnection` with
59
+ * the registry. Use this after accepting a WebSocket upgrade via
60
+ * your runtime's native API (e.g. `WebSocketPair` on Cloudflare,
61
+ * `Deno.upgradeWebSocket` on Deno, `server.upgrade` on Bun).
62
+ *
63
+ * On success: marks the token `awaiting-claude`, writes an audit
64
+ * entry, and returns `{ok: true, tid}`. On failure: returns an
65
+ * appropriate HTTP status for the caller to encode into the
66
+ * upgrade response (401 for auth failure, 403 for revoked).
67
+ */
68
+ acceptConnection: (token: string, conn: PairingConnection) => Promise<AcceptResult>;
69
+ };
70
+ /**
71
+ * Compose the runtime-neutral agent server. The returned handle has
72
+ * everything the LAP HTTP routes and the WebSocket acceptance
73
+ * plumbing need; runtime adapters wire the native upgrade API on
74
+ * top (see `@llui/agent/server` for Node, `@llui/agent/server/web`
75
+ * for WHATWG runtimes).
76
+ */
77
+ export declare function createLluiAgentCore(opts: CoreOptions): AgentCoreHandle;
78
+ //# sourceMappingURL=core.d.ts.map
@@ -0,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