@adonis-agora/agent 0.61.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -0
- package/README.md +12 -7
- package/dist/configure.d.ts +7 -5
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +7 -5
- package/dist/configure.js.map +1 -1
- package/dist/providers/a2a_provider.d.ts +14 -0
- package/dist/providers/a2a_provider.d.ts.map +1 -0
- package/dist/providers/a2a_provider.js +136 -0
- package/dist/providers/a2a_provider.js.map +1 -0
- package/dist/providers/agent_provider.d.ts.map +1 -1
- package/dist/providers/agent_provider.js +81 -25
- package/dist/providers/agent_provider.js.map +1 -1
- package/dist/providers/mcp_provider.d.ts +3 -0
- package/dist/providers/mcp_provider.d.ts.map +1 -1
- package/dist/providers/mcp_provider.js +147 -62
- package/dist/providers/mcp_provider.js.map +1 -1
- package/dist/src/a2a/auth.d.ts +67 -0
- package/dist/src/a2a/auth.d.ts.map +1 -0
- package/dist/src/a2a/auth.js +47 -0
- package/dist/src/a2a/auth.js.map +1 -0
- package/dist/src/a2a/define_config.d.ts +74 -0
- package/dist/src/a2a/define_config.d.ts.map +1 -0
- package/dist/src/a2a/define_config.js +5 -0
- package/dist/src/a2a/define_config.js.map +1 -0
- package/dist/src/a2a/gate.d.ts +23 -0
- package/dist/src/a2a/gate.d.ts.map +1 -0
- package/dist/src/a2a/gate.js +56 -0
- package/dist/src/a2a/gate.js.map +1 -0
- package/dist/src/a2a/handler.d.ts +65 -0
- package/dist/src/a2a/handler.d.ts.map +1 -0
- package/dist/src/a2a/handler.js +322 -0
- package/dist/src/a2a/handler.js.map +1 -0
- package/dist/src/a2a/index.d.ts +15 -0
- package/dist/src/a2a/index.d.ts.map +1 -0
- package/dist/src/a2a/index.js +9 -0
- package/dist/src/a2a/index.js.map +1 -0
- package/dist/src/a2a/permission-tool.d.ts +17 -0
- package/dist/src/a2a/permission-tool.d.ts.map +1 -0
- package/dist/src/a2a/permission-tool.js +70 -0
- package/dist/src/a2a/permission-tool.js.map +1 -0
- package/dist/src/a2a/protocol.d.ts +100 -0
- package/dist/src/a2a/protocol.d.ts.map +1 -0
- package/dist/src/a2a/protocol.js +106 -0
- package/dist/src/a2a/protocol.js.map +1 -0
- package/dist/src/a2a/runtime.d.ts +6 -0
- package/dist/src/a2a/runtime.d.ts.map +1 -0
- package/dist/src/a2a/runtime.js +13 -0
- package/dist/src/a2a/runtime.js.map +1 -0
- package/dist/src/a2a/server_middleware.d.ts +13 -0
- package/dist/src/a2a/server_middleware.d.ts.map +1 -0
- package/dist/src/a2a/server_middleware.js +18 -0
- package/dist/src/a2a/server_middleware.js.map +1 -0
- package/dist/src/a2a/store.d.ts +79 -0
- package/dist/src/a2a/store.d.ts.map +1 -0
- package/dist/src/a2a/store.js +151 -0
- package/dist/src/a2a/store.js.map +1 -0
- package/dist/src/a2a/turn.d.ts +80 -0
- package/dist/src/a2a/turn.d.ts.map +1 -0
- package/dist/src/a2a/turn.js +211 -0
- package/dist/src/a2a/turn.js.map +1 -0
- package/dist/src/action-proposal-executor.d.ts +3 -0
- package/dist/src/action-proposal-executor.d.ts.map +1 -1
- package/dist/src/action-proposal-executor.js +10 -0
- package/dist/src/action-proposal-executor.js.map +1 -1
- package/dist/src/action-proposal-service.d.ts +7 -2
- package/dist/src/action-proposal-service.d.ts.map +1 -1
- package/dist/src/action-proposal-service.js +21 -16
- package/dist/src/action-proposal-service.js.map +1 -1
- package/dist/src/action-proposal-text.d.ts +42 -3
- package/dist/src/action-proposal-text.d.ts.map +1 -1
- package/dist/src/action-proposal-text.js +80 -12
- package/dist/src/action-proposal-text.js.map +1 -1
- package/dist/src/action-proposal-worker.d.ts +2 -1
- package/dist/src/action-proposal-worker.d.ts.map +1 -1
- package/dist/src/action-proposal-worker.js +9 -2
- package/dist/src/action-proposal-worker.js.map +1 -1
- package/dist/src/actor-resolver.d.ts +12 -4
- package/dist/src/actor-resolver.d.ts.map +1 -1
- package/dist/src/actor-resolver.js +24 -7
- package/dist/src/actor-resolver.js.map +1 -1
- package/dist/src/ag-ui/adapter.d.ts.map +1 -1
- package/dist/src/ag-ui/adapter.js +115 -17
- package/dist/src/ag-ui/adapter.js.map +1 -1
- package/dist/src/ag-ui/core/encoder.d.ts +106 -0
- package/dist/src/ag-ui/core/encoder.d.ts.map +1 -0
- package/dist/src/ag-ui/core/encoder.js +534 -0
- package/dist/src/ag-ui/core/encoder.js.map +1 -0
- package/dist/src/ag-ui/core/index.d.ts +12 -0
- package/dist/src/ag-ui/core/index.d.ts.map +1 -0
- package/dist/src/ag-ui/core/index.js +12 -0
- package/dist/src/ag-ui/core/index.js.map +1 -0
- package/dist/src/ag-ui/core/input.d.ts +92 -0
- package/dist/src/ag-ui/core/input.d.ts.map +1 -0
- package/dist/src/ag-ui/core/input.js +246 -0
- package/dist/src/ag-ui/core/input.js.map +1 -0
- package/dist/src/ag-ui/core/interrupt-id.d.ts +31 -0
- package/dist/src/ag-ui/core/interrupt-id.d.ts.map +1 -0
- package/dist/src/ag-ui/core/interrupt-id.js +48 -0
- package/dist/src/ag-ui/core/interrupt-id.js.map +1 -0
- package/dist/src/ag-ui/{proposal-decision.d.ts → core/proposal-decision.d.ts} +1 -1
- package/dist/src/ag-ui/core/proposal-decision.d.ts.map +1 -0
- package/dist/src/ag-ui/{proposal-decision.js → core/proposal-decision.js} +3 -6
- package/dist/src/ag-ui/core/proposal-decision.js.map +1 -0
- package/dist/src/ag-ui/core/stream.d.ts +49 -0
- package/dist/src/ag-ui/core/stream.d.ts.map +1 -0
- package/dist/src/ag-ui/core/stream.js +90 -0
- package/dist/src/ag-ui/core/stream.js.map +1 -0
- package/dist/src/ag-ui/core/types.d.ts +249 -0
- package/dist/src/ag-ui/core/types.d.ts.map +1 -0
- package/dist/src/ag-ui/core/types.js +35 -0
- package/dist/src/ag-ui/core/types.js.map +1 -0
- package/dist/src/ag-ui/encoder.d.ts +3 -4
- package/dist/src/ag-ui/encoder.d.ts.map +1 -1
- package/dist/src/ag-ui/encoder.js +10 -11
- package/dist/src/ag-ui/encoder.js.map +1 -1
- package/dist/src/ag-ui/frames.d.ts +8 -5
- package/dist/src/ag-ui/frames.d.ts.map +1 -1
- package/dist/src/ag-ui/frames.js +21 -7
- package/dist/src/ag-ui/frames.js.map +1 -1
- package/dist/src/ag-ui/index.d.ts +3 -5
- package/dist/src/ag-ui/index.d.ts.map +1 -1
- package/dist/src/ag-ui/index.js +3 -5
- package/dist/src/ag-ui/index.js.map +1 -1
- package/dist/src/ag-ui/stream.d.ts +3 -4
- package/dist/src/ag-ui/stream.d.ts.map +1 -1
- package/dist/src/ag-ui/stream.js +4 -5
- package/dist/src/ag-ui/stream.js.map +1 -1
- package/dist/src/agent-deps-factory.d.ts +3 -0
- package/dist/src/agent-deps-factory.d.ts.map +1 -1
- package/dist/src/agent-deps-factory.js +3 -0
- package/dist/src/agent-deps-factory.js.map +1 -1
- package/dist/src/agent-deps.d.ts +3 -0
- package/dist/src/agent-deps.d.ts.map +1 -1
- package/dist/src/agent-deps.js.map +1 -1
- package/dist/src/agent-loop.d.ts +4 -3
- package/dist/src/agent-loop.d.ts.map +1 -1
- package/dist/src/agent-loop.js +50 -25
- package/dist/src/agent-loop.js.map +1 -1
- package/dist/src/agent-service.d.ts +46 -4
- package/dist/src/agent-service.d.ts.map +1 -1
- package/dist/src/agent-service.js +87 -11
- package/dist/src/agent-service.js.map +1 -1
- package/dist/src/ai-sdk/ai-sdk-model.js +4 -1
- package/dist/src/ai-sdk/ai-sdk-model.js.map +1 -1
- package/dist/src/ai-tool-ref.d.ts +4 -0
- package/dist/src/ai-tool-ref.d.ts.map +1 -1
- package/dist/src/ai-tool-ref.js +10 -14
- package/dist/src/ai-tool-ref.js.map +1 -1
- package/dist/src/attachment-limits.d.ts +10 -0
- package/dist/src/attachment-limits.d.ts.map +1 -0
- package/dist/src/attachment-limits.js +13 -0
- package/dist/src/attachment-limits.js.map +1 -0
- package/dist/src/channels/adapters/evolution_api.d.ts +49 -0
- package/dist/src/channels/adapters/evolution_api.d.ts.map +1 -0
- package/dist/src/channels/adapters/evolution_api.js +241 -0
- package/dist/src/channels/adapters/evolution_api.js.map +1 -0
- package/dist/src/channels/adapters/telegram.d.ts +34 -0
- package/dist/src/channels/adapters/telegram.d.ts.map +1 -0
- package/dist/src/channels/adapters/telegram.js +196 -0
- package/dist/src/channels/adapters/telegram.js.map +1 -0
- package/dist/src/channels/adapters/whatsapp_cloud.d.ts +31 -0
- package/dist/src/channels/adapters/whatsapp_cloud.d.ts.map +1 -0
- package/dist/src/channels/adapters/whatsapp_cloud.js +177 -0
- package/dist/src/channels/adapters/whatsapp_cloud.js.map +1 -0
- package/dist/src/channels/handler.d.ts +167 -0
- package/dist/src/channels/handler.d.ts.map +1 -0
- package/dist/src/channels/handler.js +569 -0
- package/dist/src/channels/handler.js.map +1 -0
- package/dist/src/channels/http.d.ts +45 -0
- package/dist/src/channels/http.d.ts.map +1 -0
- package/dist/src/channels/http.js +147 -0
- package/dist/src/channels/http.js.map +1 -0
- package/dist/src/channels/index.d.ts +16 -0
- package/dist/src/channels/index.d.ts.map +1 -0
- package/dist/src/channels/index.js +15 -0
- package/dist/src/channels/index.js.map +1 -0
- package/dist/src/channels/markdown.d.ts +12 -0
- package/dist/src/channels/markdown.d.ts.map +1 -0
- package/dist/src/channels/markdown.js +120 -0
- package/dist/src/channels/markdown.js.map +1 -0
- package/dist/src/channels/questions.d.ts +43 -0
- package/dist/src/channels/questions.d.ts.map +1 -0
- package/dist/src/channels/questions.js +90 -0
- package/dist/src/channels/questions.js.map +1 -0
- package/dist/src/channels/split.d.ts +8 -0
- package/dist/src/channels/split.d.ts.map +1 -0
- package/dist/src/channels/split.js +45 -0
- package/dist/src/channels/split.js.map +1 -0
- package/dist/src/channels/store.d.ts +78 -0
- package/dist/src/channels/store.d.ts.map +1 -0
- package/dist/src/channels/store.js +151 -0
- package/dist/src/channels/store.js.map +1 -0
- package/dist/src/channels/types.d.ts +138 -0
- package/dist/src/channels/types.d.ts.map +1 -0
- package/dist/src/channels/types.js +7 -0
- package/dist/src/channels/types.js.map +1 -0
- package/dist/src/chat-queue-service.d.ts.map +1 -1
- package/dist/src/chat-queue-service.js +2 -0
- package/dist/src/chat-queue-service.js.map +1 -1
- package/dist/src/define_config.d.ts +61 -12
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/engine.d.ts +77 -0
- package/dist/src/engine.d.ts.map +1 -0
- package/dist/src/engine.js +27 -0
- package/dist/src/engine.js.map +1 -0
- package/dist/src/genui/builtins.d.ts +73 -3
- package/dist/src/genui/builtins.d.ts.map +1 -1
- package/dist/src/genui/builtins.js +357 -3
- package/dist/src/genui/builtins.js.map +1 -1
- package/dist/src/genui/capabilities.d.ts +24 -0
- package/dist/src/genui/capabilities.d.ts.map +1 -0
- package/dist/src/genui/capabilities.js +81 -0
- package/dist/src/genui/capabilities.js.map +1 -0
- package/dist/src/genui/catalog.d.ts +86 -0
- package/dist/src/genui/catalog.d.ts.map +1 -0
- package/dist/src/genui/catalog.js +96 -0
- package/dist/src/genui/catalog.js.map +1 -0
- package/dist/src/genui/factory.d.ts +7 -14
- package/dist/src/genui/factory.d.ts.map +1 -1
- package/dist/src/genui/factory.js.map +1 -1
- package/dist/src/genui/index.d.ts +4 -12
- package/dist/src/genui/index.d.ts.map +1 -1
- package/dist/src/genui/index.js +5 -18
- package/dist/src/genui/index.js.map +1 -1
- package/dist/src/genui/public.d.ts +9 -0
- package/dist/src/genui/public.d.ts.map +1 -0
- package/dist/src/genui/public.js +9 -0
- package/dist/src/genui/public.js.map +1 -0
- package/dist/src/genui/registry.d.ts +65 -0
- package/dist/src/genui/registry.d.ts.map +1 -0
- package/dist/src/genui/registry.js +151 -0
- package/dist/src/genui/registry.js.map +1 -0
- package/dist/src/genui/schema.d.ts +71 -0
- package/dist/src/genui/schema.d.ts.map +1 -0
- package/dist/src/genui/schema.js +304 -0
- package/dist/src/genui/schema.js.map +1 -0
- package/dist/src/genui/text.d.ts +36 -0
- package/dist/src/genui/text.d.ts.map +1 -0
- package/dist/src/genui/text.js +157 -0
- package/dist/src/genui/text.js.map +1 -0
- package/dist/src/genui/tools.d.ts +92 -0
- package/dist/src/genui/tools.d.ts.map +1 -0
- package/dist/src/genui/tools.js +291 -0
- package/dist/src/genui/tools.js.map +1 -0
- package/dist/src/genui/tree.d.ts +56 -0
- package/dist/src/genui/tree.d.ts.map +1 -0
- package/dist/src/genui/tree.js +188 -0
- package/dist/src/genui/tree.js.map +1 -0
- package/dist/src/index.d.ts +6 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/auth.d.ts +17 -1
- package/dist/src/mcp/auth.d.ts.map +1 -1
- package/dist/src/mcp/auth.js +14 -3
- package/dist/src/mcp/auth.js.map +1 -1
- package/dist/src/mcp/define_config.d.ts +81 -2
- package/dist/src/mcp/define_config.d.ts.map +1 -1
- package/dist/src/mcp/define_config.js.map +1 -1
- package/dist/src/mcp/index.d.ts +1 -1
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/oauth-resource.d.ts +9 -0
- package/dist/src/mcp/oauth-resource.d.ts.map +1 -0
- package/dist/src/mcp/oauth-resource.js +16 -0
- package/dist/src/mcp/oauth-resource.js.map +1 -0
- package/dist/src/mcp/server.d.ts +5 -0
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +48 -16
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/negotiated-tool-ui.d.ts.map +1 -1
- package/dist/src/negotiated-tool-ui.js +12 -8
- package/dist/src/negotiated-tool-ui.js.map +1 -1
- package/dist/src/opencode/client.d.ts +202 -0
- package/dist/src/opencode/client.d.ts.map +1 -0
- package/dist/src/opencode/client.js +2 -0
- package/dist/src/opencode/client.js.map +1 -0
- package/dist/src/opencode/durable/index.d.ts +33 -0
- package/dist/src/opencode/durable/index.d.ts.map +1 -0
- package/dist/src/opencode/durable/index.js +38 -0
- package/dist/src/opencode/durable/index.js.map +1 -0
- package/dist/src/opencode/durable/runner.d.ts +36 -0
- package/dist/src/opencode/durable/runner.d.ts.map +1 -0
- package/dist/src/opencode/durable/runner.js +88 -0
- package/dist/src/opencode/durable/runner.js.map +1 -0
- package/dist/src/opencode/durable/workflow.d.ts +40 -0
- package/dist/src/opencode/durable/workflow.d.ts.map +1 -0
- package/dist/src/opencode/durable/workflow.js +106 -0
- package/dist/src/opencode/durable/workflow.js.map +1 -0
- package/dist/src/opencode/engine.d.ts +48 -0
- package/dist/src/opencode/engine.d.ts.map +1 -0
- package/dist/src/opencode/engine.js +98 -0
- package/dist/src/opencode/engine.js.map +1 -0
- package/dist/src/opencode/event-hub.d.ts +23 -0
- package/dist/src/opencode/event-hub.d.ts.map +1 -0
- package/dist/src/opencode/event-hub.js +99 -0
- package/dist/src/opencode/event-hub.js.map +1 -0
- package/dist/src/opencode/forms.d.ts +19 -0
- package/dist/src/opencode/forms.d.ts.map +1 -0
- package/dist/src/opencode/forms.js +82 -0
- package/dist/src/opencode/forms.js.map +1 -0
- package/dist/src/opencode/host.d.ts +179 -0
- package/dist/src/opencode/host.d.ts.map +1 -0
- package/dist/src/opencode/host.js +34 -0
- package/dist/src/opencode/host.js.map +1 -0
- package/dist/src/opencode/index.d.ts +15 -0
- package/dist/src/opencode/index.d.ts.map +1 -0
- package/dist/src/opencode/index.js +9 -0
- package/dist/src/opencode/index.js.map +1 -0
- package/dist/src/opencode/log.d.ts +9 -0
- package/dist/src/opencode/log.d.ts.map +1 -0
- package/dist/src/opencode/log.js +15 -0
- package/dist/src/opencode/log.js.map +1 -0
- package/dist/src/opencode/mcp.d.ts +60 -0
- package/dist/src/opencode/mcp.d.ts.map +1 -0
- package/dist/src/opencode/mcp.js +258 -0
- package/dist/src/opencode/mcp.js.map +1 -0
- package/dist/src/opencode/runner.d.ts +40 -0
- package/dist/src/opencode/runner.d.ts.map +1 -0
- package/dist/src/opencode/runner.js +125 -0
- package/dist/src/opencode/runner.js.map +1 -0
- package/dist/src/opencode/turn.d.ts +167 -0
- package/dist/src/opencode/turn.d.ts.map +1 -0
- package/dist/src/opencode/turn.js +761 -0
- package/dist/src/opencode/turn.js.map +1 -0
- package/dist/src/opencode/turns.d.ts +247 -0
- package/dist/src/opencode/turns.d.ts.map +1 -0
- package/dist/src/opencode/turns.js +867 -0
- package/dist/src/opencode/turns.js.map +1 -0
- package/dist/src/personas.d.ts.map +1 -1
- package/dist/src/personas.js +4 -1
- package/dist/src/personas.js.map +1 -1
- package/dist/src/react/ag-ui.d.ts +4 -2
- package/dist/src/react/ag-ui.d.ts.map +1 -1
- package/dist/src/react/ag-ui.js +2 -2
- package/dist/src/react/ag-ui.js.map +1 -1
- package/dist/src/react/client.d.ts +1 -1
- package/dist/src/react/client.d.ts.map +1 -1
- package/dist/src/react/client.js +1 -1
- package/dist/src/react/client.js.map +1 -1
- package/dist/src/react/core/ag-ui-backend.d.ts +109 -0
- package/dist/src/react/core/ag-ui-backend.d.ts.map +1 -0
- package/dist/src/react/core/ag-ui-backend.js +574 -0
- package/dist/src/react/core/ag-ui-backend.js.map +1 -0
- package/dist/src/react/core/agent-chat-transport.d.ts +187 -0
- package/dist/src/react/core/agent-chat-transport.d.ts.map +1 -0
- package/dist/src/react/core/agent-chat-transport.js +817 -0
- package/dist/src/react/core/agent-chat-transport.js.map +1 -0
- package/dist/src/react/core/approvals/countdown.d.ts +22 -0
- package/dist/src/react/core/approvals/countdown.d.ts.map +1 -0
- package/dist/src/react/core/approvals/countdown.js +39 -0
- package/dist/src/react/core/approvals/countdown.js.map +1 -0
- package/dist/src/react/core/approvals/proposals.d.ts +15 -0
- package/dist/src/react/core/approvals/proposals.d.ts.map +1 -0
- package/dist/src/react/core/approvals/proposals.js +82 -0
- package/dist/src/react/core/approvals/proposals.js.map +1 -0
- package/dist/src/react/core/approvals/use-action-proposals.d.ts +10 -0
- package/dist/src/react/core/approvals/use-action-proposals.d.ts.map +1 -0
- package/dist/src/react/core/approvals/use-action-proposals.js +86 -0
- package/dist/src/react/core/approvals/use-action-proposals.js.map +1 -0
- package/dist/src/react/core/attachments/files.d.ts +39 -0
- package/dist/src/react/core/attachments/files.d.ts.map +1 -0
- package/dist/src/react/core/attachments/files.js +89 -0
- package/dist/src/react/core/attachments/files.js.map +1 -0
- package/dist/src/react/core/attachments/use-attachments.d.ts +106 -0
- package/dist/src/react/core/attachments/use-attachments.d.ts.map +1 -0
- package/dist/src/react/core/attachments/use-attachments.js +217 -0
- package/dist/src/react/core/attachments/use-attachments.js.map +1 -0
- package/dist/src/react/core/backend.d.ts +245 -0
- package/dist/src/react/core/backend.d.ts.map +1 -0
- package/dist/src/react/core/backend.js +21 -0
- package/dist/src/react/core/backend.js.map +1 -0
- package/dist/src/react/core/background-runs.d.ts +32 -0
- package/dist/src/react/core/background-runs.d.ts.map +1 -0
- package/dist/src/react/core/background-runs.js +47 -0
- package/dist/src/react/core/background-runs.js.map +1 -0
- package/dist/src/react/core/catalog/use-agents.d.ts +31 -0
- package/dist/src/react/core/catalog/use-agents.d.ts.map +1 -0
- package/dist/src/react/core/catalog/use-agents.js +28 -0
- package/dist/src/react/core/catalog/use-agents.js.map +1 -0
- package/dist/src/react/core/catalog/use-models.d.ts +41 -0
- package/dist/src/react/core/catalog/use-models.d.ts.map +1 -0
- package/dist/src/react/core/catalog/use-models.js +35 -0
- package/dist/src/react/core/catalog/use-models.js.map +1 -0
- package/dist/src/react/core/catalog/use-resource.d.ts +12 -0
- package/dist/src/react/core/catalog/use-resource.d.ts.map +1 -0
- package/dist/src/react/core/catalog/use-resource.js +41 -0
- package/dist/src/react/core/catalog/use-resource.js.map +1 -0
- package/dist/src/react/core/client-wire.d.ts +14 -0
- package/dist/src/react/core/client-wire.d.ts.map +1 -0
- package/dist/src/react/core/client-wire.js +2 -0
- package/dist/src/react/core/client-wire.js.map +1 -0
- package/dist/src/react/core/client.d.ts +222 -0
- package/dist/src/react/core/client.d.ts.map +1 -0
- package/dist/src/react/core/client.js +435 -0
- package/dist/src/react/core/client.js.map +1 -0
- package/dist/src/react/core/components/ambient-ui.d.ts +22 -0
- package/dist/src/react/core/components/ambient-ui.d.ts.map +1 -0
- package/dist/src/react/core/components/ambient-ui.js +30 -0
- package/dist/src/react/core/components/ambient-ui.js.map +1 -0
- package/dist/src/react/core/components/chat-input.d.ts +44 -0
- package/dist/src/react/core/components/chat-input.d.ts.map +1 -0
- package/dist/src/react/core/components/chat-input.js +69 -0
- package/dist/src/react/core/components/chat-input.js.map +1 -0
- package/dist/src/react/core/components/index.d.ts +7 -0
- package/dist/src/react/core/components/index.d.ts.map +1 -0
- package/dist/src/react/core/components/index.js +7 -0
- package/dist/src/react/core/components/index.js.map +1 -0
- package/dist/src/react/core/components/message-item.d.ts +101 -0
- package/dist/src/react/core/components/message-item.d.ts.map +1 -0
- package/dist/src/react/core/components/message-item.js +118 -0
- package/dist/src/react/core/components/message-item.js.map +1 -0
- package/dist/src/react/core/components/message-list.d.ts +85 -0
- package/dist/src/react/core/components/message-list.d.ts.map +1 -0
- package/dist/src/react/core/components/message-list.js +45 -0
- package/dist/src/react/core/components/message-list.js.map +1 -0
- package/dist/src/react/core/components/speech-languages.d.ts +22 -0
- package/dist/src/react/core/components/speech-languages.d.ts.map +1 -0
- package/dist/src/react/core/components/speech-languages.js +38 -0
- package/dist/src/react/core/components/speech-languages.js.map +1 -0
- package/dist/src/react/core/components/use-speech-recognition.d.ts +19 -0
- package/dist/src/react/core/components/use-speech-recognition.d.ts.map +1 -0
- package/dist/src/react/core/components/use-speech-recognition.js +92 -0
- package/dist/src/react/core/components/use-speech-recognition.js.map +1 -0
- package/dist/src/react/core/composer/index.d.ts +4 -0
- package/dist/src/react/core/composer/index.d.ts.map +1 -0
- package/dist/src/react/core/composer/index.js +4 -0
- package/dist/src/react/core/composer/index.js.map +1 -0
- package/dist/src/react/core/composer/model.d.ts +83 -0
- package/dist/src/react/core/composer/model.d.ts.map +1 -0
- package/dist/src/react/core/composer/model.js +53 -0
- package/dist/src/react/core/composer/model.js.map +1 -0
- package/dist/src/react/core/composer/skills-source.d.ts +29 -0
- package/dist/src/react/core/composer/skills-source.d.ts.map +1 -0
- package/dist/src/react/core/composer/skills-source.js +61 -0
- package/dist/src/react/core/composer/skills-source.js.map +1 -0
- package/dist/src/react/core/composer/use-composer-autocomplete.d.ts +78 -0
- package/dist/src/react/core/composer/use-composer-autocomplete.d.ts.map +1 -0
- package/dist/src/react/core/composer/use-composer-autocomplete.js +244 -0
- package/dist/src/react/core/composer/use-composer-autocomplete.js.map +1 -0
- package/dist/src/react/core/config/use-agent-config.d.ts +21 -0
- package/dist/src/react/core/config/use-agent-config.d.ts.map +1 -0
- package/dist/src/react/core/config/use-agent-config.js +57 -0
- package/dist/src/react/core/config/use-agent-config.js.map +1 -0
- package/dist/src/react/core/elicitation/answers.d.ts +22 -0
- package/dist/src/react/core/elicitation/answers.d.ts.map +1 -0
- package/dist/src/react/core/elicitation/answers.js +65 -0
- package/dist/src/react/core/elicitation/answers.js.map +1 -0
- package/dist/src/react/core/feedback/use-message-feedback.d.ts +32 -0
- package/dist/src/react/core/feedback/use-message-feedback.d.ts.map +1 -0
- package/dist/src/react/core/feedback/use-message-feedback.js +106 -0
- package/dist/src/react/core/feedback/use-message-feedback.js.map +1 -0
- package/dist/src/react/core/genui/generative-ui.d.ts +76 -0
- package/dist/src/react/core/genui/generative-ui.d.ts.map +1 -0
- package/dist/src/react/core/genui/generative-ui.js +210 -0
- package/dist/src/react/core/genui/generative-ui.js.map +1 -0
- package/dist/src/react/core/genui/index.d.ts +5 -0
- package/dist/src/react/core/genui/index.d.ts.map +1 -0
- package/dist/src/react/core/genui/index.js +5 -0
- package/dist/src/react/core/genui/index.js.map +1 -0
- package/dist/src/react/core/genui/json-render.d.ts +54 -0
- package/dist/src/react/core/genui/json-render.d.ts.map +1 -0
- package/dist/src/react/core/genui/json-render.js +64 -0
- package/dist/src/react/core/genui/json-render.js.map +1 -0
- package/dist/src/react/core/genui/playwright.d.ts +12 -0
- package/dist/src/react/core/genui/playwright.d.ts.map +1 -0
- package/dist/src/react/core/genui/playwright.js +141 -0
- package/dist/src/react/core/genui/playwright.js.map +1 -0
- package/dist/src/react/core/genui/react-registry.d.ts +22 -0
- package/dist/src/react/core/genui/react-registry.d.ts.map +1 -0
- package/dist/src/react/core/genui/react-registry.js +72 -0
- package/dist/src/react/core/genui/react-registry.js.map +1 -0
- package/dist/src/react/core/genui/server.d.ts +32 -0
- package/dist/src/react/core/genui/server.d.ts.map +1 -0
- package/dist/src/react/core/genui/server.js +66 -0
- package/dist/src/react/core/genui/server.js.map +1 -0
- package/dist/src/react/core/genui/types.d.ts +98 -0
- package/dist/src/react/core/genui/types.d.ts.map +1 -0
- package/dist/src/react/core/genui/types.js +3 -0
- package/dist/src/react/core/genui/types.js.map +1 -0
- package/dist/src/react/core/genui/use-generative-ui.d.ts +42 -0
- package/dist/src/react/core/genui/use-generative-ui.d.ts.map +1 -0
- package/dist/src/react/core/genui/use-generative-ui.js +186 -0
- package/dist/src/react/core/genui/use-generative-ui.js.map +1 -0
- package/dist/src/react/core/http-error.d.ts +33 -0
- package/dist/src/react/core/http-error.d.ts.map +1 -0
- package/dist/src/react/core/http-error.js +47 -0
- package/dist/src/react/core/http-error.js.map +1 -0
- package/dist/src/react/core/index.d.ts +35 -0
- package/dist/src/react/core/index.d.ts.map +1 -0
- package/dist/src/react/core/index.js +34 -0
- package/dist/src/react/core/index.js.map +1 -0
- package/dist/src/react/core/markdown/agent-markdown.d.ts +39 -0
- package/dist/src/react/core/markdown/agent-markdown.d.ts.map +1 -0
- package/dist/src/react/core/markdown/agent-markdown.js +22 -0
- package/dist/src/react/core/markdown/agent-markdown.js.map +1 -0
- package/dist/src/react/core/markdown/index.d.ts +2 -0
- package/dist/src/react/core/markdown/index.d.ts.map +1 -0
- package/dist/src/react/core/markdown/index.js +2 -0
- package/dist/src/react/core/markdown/index.js.map +1 -0
- package/dist/src/react/core/media/index.d.ts +64 -0
- package/dist/src/react/core/media/index.d.ts.map +1 -0
- package/dist/src/react/core/media/index.js +135 -0
- package/dist/src/react/core/media/index.js.map +1 -0
- package/dist/src/react/core/media/tus.d.ts +13 -0
- package/dist/src/react/core/media/tus.d.ts.map +1 -0
- package/dist/src/react/core/media/tus.js +59 -0
- package/dist/src/react/core/media/tus.js.map +1 -0
- package/dist/src/react/core/presentation/phrasing.d.ts +25 -0
- package/dist/src/react/core/presentation/phrasing.d.ts.map +1 -0
- package/dist/src/react/core/presentation/phrasing.js +58 -0
- package/dist/src/react/core/presentation/phrasing.js.map +1 -0
- package/dist/src/react/core/presentation/result-view.d.ts +43 -0
- package/dist/src/react/core/presentation/result-view.d.ts.map +1 -0
- package/dist/src/react/core/presentation/result-view.js +90 -0
- package/dist/src/react/core/presentation/result-view.js.map +1 -0
- package/dist/src/react/core/presentation/tool-activity.d.ts +106 -0
- package/dist/src/react/core/presentation/tool-activity.d.ts.map +1 -0
- package/dist/src/react/core/presentation/tool-activity.js +165 -0
- package/dist/src/react/core/presentation/tool-activity.js.map +1 -0
- package/dist/src/react/core/presentation/use-tool-catalog.d.ts +39 -0
- package/dist/src/react/core/presentation/use-tool-catalog.d.ts.map +1 -0
- package/dist/src/react/core/presentation/use-tool-catalog.js +77 -0
- package/dist/src/react/core/presentation/use-tool-catalog.js.map +1 -0
- package/dist/src/react/core/provider.d.ts +68 -0
- package/dist/src/react/core/provider.d.ts.map +1 -0
- package/dist/src/react/core/provider.js +61 -0
- package/dist/src/react/core/provider.js.map +1 -0
- package/dist/src/react/core/queue/model.d.ts +73 -0
- package/dist/src/react/core/queue/model.d.ts.map +1 -0
- package/dist/src/react/core/queue/model.js +2 -0
- package/dist/src/react/core/queue/model.js.map +1 -0
- package/dist/src/react/core/quota/use-quota.d.ts +35 -0
- package/dist/src/react/core/quota/use-quota.d.ts.map +1 -0
- package/dist/src/react/core/quota/use-quota.js +47 -0
- package/dist/src/react/core/quota/use-quota.js.map +1 -0
- package/dist/src/react/core/reasoning/timing.d.ts +38 -0
- package/dist/src/react/core/reasoning/timing.d.ts.map +1 -0
- package/dist/src/react/core/reasoning/timing.js +73 -0
- package/dist/src/react/core/reasoning/timing.js.map +1 -0
- package/dist/src/react/core/run-errors.d.ts +37 -0
- package/dist/src/react/core/run-errors.d.ts.map +1 -0
- package/dist/src/react/core/run-errors.js +37 -0
- package/dist/src/react/core/run-errors.js.map +1 -0
- package/dist/src/react/core/stored-message-to-ui-message.d.ts +4 -0
- package/dist/src/react/core/stored-message-to-ui-message.d.ts.map +1 -0
- package/dist/src/react/core/stored-message-to-ui-message.js +216 -0
- package/dist/src/react/core/stored-message-to-ui-message.js.map +1 -0
- package/dist/src/react/core/stored-thread-to-ui-messages.d.ts +82 -0
- package/dist/src/react/core/stored-thread-to-ui-messages.d.ts.map +1 -0
- package/dist/src/react/core/stored-thread-to-ui-messages.js +116 -0
- package/dist/src/react/core/stored-thread-to-ui-messages.js.map +1 -0
- package/dist/src/react/core/threads/threads-events.d.ts +22 -0
- package/dist/src/react/core/threads/threads-events.d.ts.map +1 -0
- package/dist/src/react/core/threads/threads-events.js +21 -0
- package/dist/src/react/core/threads/threads-events.js.map +1 -0
- package/dist/src/react/core/threads/use-threads.d.ts +31 -0
- package/dist/src/react/core/threads/use-threads.d.ts.map +1 -0
- package/dist/src/react/core/threads/use-threads.js +81 -0
- package/dist/src/react/core/threads/use-threads.js.map +1 -0
- package/dist/src/react/core/transcript/index.d.ts +4 -0
- package/dist/src/react/core/transcript/index.d.ts.map +1 -0
- package/dist/src/react/core/transcript/index.js +4 -0
- package/dist/src/react/core/transcript/index.js.map +1 -0
- package/dist/src/react/core/transcript/model.d.ts +399 -0
- package/dist/src/react/core/transcript/model.d.ts.map +1 -0
- package/dist/src/react/core/transcript/model.js +725 -0
- package/dist/src/react/core/transcript/model.js.map +1 -0
- package/dist/src/react/core/transcript/use-chat-transcript.d.ts +254 -0
- package/dist/src/react/core/transcript/use-chat-transcript.d.ts.map +1 -0
- package/dist/src/react/core/transcript/use-chat-transcript.js +572 -0
- package/dist/src/react/core/transcript/use-chat-transcript.js.map +1 -0
- package/dist/src/react/core/transcript/use-stick-to-bottom.d.ts +33 -0
- package/dist/src/react/core/transcript/use-stick-to-bottom.d.ts.map +1 -0
- package/dist/src/react/core/transcript/use-stick-to-bottom.js +48 -0
- package/dist/src/react/core/transcript/use-stick-to-bottom.js.map +1 -0
- package/dist/src/react/core/use-agent-chat.d.ts +341 -0
- package/dist/src/react/core/use-agent-chat.d.ts.map +1 -0
- package/dist/src/react/core/use-agent-chat.js +1118 -0
- package/dist/src/react/core/use-agent-chat.js.map +1 -0
- package/dist/src/react/genui/index.d.ts +1 -7
- package/dist/src/react/genui/index.d.ts.map +1 -1
- package/dist/src/react/genui/index.js +1 -7
- package/dist/src/react/genui/index.js.map +1 -1
- package/dist/src/react/genui/json-render.d.ts +1 -5
- package/dist/src/react/genui/json-render.d.ts.map +1 -1
- package/dist/src/react/genui/json-render.js +1 -5
- package/dist/src/react/genui/json-render.js.map +1 -1
- package/dist/src/react/genui/server.d.ts +2 -0
- package/dist/src/react/genui/server.d.ts.map +1 -0
- package/dist/src/react/genui/server.js +2 -0
- package/dist/src/react/genui/server.js.map +1 -0
- package/dist/src/react/genui/server_playwright.d.ts +2 -0
- package/dist/src/react/genui/server_playwright.d.ts.map +1 -0
- package/dist/src/react/genui/server_playwright.js +2 -0
- package/dist/src/react/genui/server_playwright.js.map +1 -0
- package/dist/src/react/index.d.ts +5 -7
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/index.js +5 -7
- package/dist/src/react/index.js.map +1 -1
- package/dist/src/react/markdown.d.ts +1 -6
- package/dist/src/react/markdown.d.ts.map +1 -1
- package/dist/src/react/markdown.js +1 -6
- package/dist/src/react/markdown.js.map +1 -1
- package/dist/src/react/media.d.ts +1 -17
- package/dist/src/react/media.d.ts.map +1 -1
- package/dist/src/react/media.js +1 -17
- package/dist/src/react/media.js.map +1 -1
- package/dist/src/refusal.d.ts +3 -0
- package/dist/src/refusal.d.ts.map +1 -0
- package/dist/src/refusal.js +3 -0
- package/dist/src/refusal.js.map +1 -0
- package/dist/src/spi/agent-runner.d.ts +6 -0
- package/dist/src/spi/agent-runner.d.ts.map +1 -1
- package/dist/src/spi/chat-queue.d.ts +4 -1
- package/dist/src/spi/chat-queue.d.ts.map +1 -1
- package/dist/src/spi/chat-queue.js.map +1 -1
- package/dist/src/spi/protocol-adapter.d.ts +3 -3
- package/dist/src/spi/roles-policy.d.ts +7 -0
- package/dist/src/spi/roles-policy.d.ts.map +1 -1
- package/dist/src/spi/tool.d.ts +18 -3
- package/dist/src/spi/tool.d.ts.map +1 -1
- package/dist/src/stores/lucid-schema.d.ts +24 -6
- package/dist/src/stores/lucid-schema.d.ts.map +1 -1
- package/dist/src/stores/lucid-schema.js +49 -6
- package/dist/src/stores/lucid-schema.js.map +1 -1
- package/dist/src/stores/lucid.d.ts +2 -0
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +7 -0
- package/dist/src/stores/lucid.js.map +1 -1
- package/dist/src/testing/chat-queue-store-contract.d.ts.map +1 -1
- package/dist/src/testing/chat-queue-store-contract.js +4 -0
- package/dist/src/testing/chat-queue-store-contract.js.map +1 -1
- package/dist/src/testing/in-memory-store.d.ts.map +1 -1
- package/dist/src/testing/in-memory-store.js +1 -0
- package/dist/src/testing/in-memory-store.js.map +1 -1
- package/dist/src/tool-discovery.d.ts +1 -1
- package/dist/src/tool-discovery.d.ts.map +1 -1
- package/dist/src/tool-discovery.js +5 -1
- package/dist/src/tool-discovery.js.map +1 -1
- package/dist/src/tool-registry.d.ts +3 -0
- package/dist/src/tool-registry.d.ts.map +1 -1
- package/dist/src/tool-registry.js +15 -3
- package/dist/src/tool-registry.js.map +1 -1
- package/dist/src/tool-result-presentation.d.ts +12 -0
- package/dist/src/tool-result-presentation.d.ts.map +1 -0
- package/dist/src/tool-result-presentation.js +44 -0
- package/dist/src/tool-result-presentation.js.map +1 -0
- package/dist/src/types.d.ts +20 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/ui-capabilities.d.ts +1 -8
- package/dist/src/ui-capabilities.d.ts.map +1 -1
- package/dist/src/ui-capabilities.js +3 -24
- package/dist/src/ui-capabilities.js.map +1 -1
- package/package.json +128 -22
- package/skills/agent-governance/SKILL.md +12 -4
- package/skills/agent-personas-agents/SKILL.md +2 -1
- package/skills/agent-setup/SKILL.md +73 -14
- package/skills/agent-testing/SKILL.md +22 -0
- package/skills/agent-tools/SKILL.md +57 -9
- package/dist/src/ag-ui/proposal-decision.d.ts.map +0 -1
- package/dist/src/ag-ui/proposal-decision.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { AgUiEncoder } from './encoder.js';
|
|
2
|
+
/** The run's own sequence number of each source frame tagged by {@link withFrameSeq}. */
|
|
3
|
+
const frameSeqs = new WeakMap();
|
|
4
|
+
/**
|
|
5
|
+
* Tag a source frame with the run's own sequence number through it — the SSE `id:` of the last
|
|
6
|
+
* event the native stream writes for it — for {@link AgUiStreamOptions.cursor}.
|
|
7
|
+
*/
|
|
8
|
+
export function withFrameSeq(frame, seq) {
|
|
9
|
+
frameSeqs.set(frame, seq);
|
|
10
|
+
return frame;
|
|
11
|
+
}
|
|
12
|
+
/** The run's own sequence number of a frame tagged by {@link withFrameSeq}, if any. */
|
|
13
|
+
export function frameSeq(frame) {
|
|
14
|
+
return frameSeqs.get(frame);
|
|
15
|
+
}
|
|
16
|
+
const DEFAULT_QUIET_MS = 750;
|
|
17
|
+
const GRACE_MS = 50;
|
|
18
|
+
/**
|
|
19
|
+
* One AG-UI run over a library run's stream.
|
|
20
|
+
*
|
|
21
|
+
* AG-UI has no mid-run channel from the consumer: a run that needs an approval or an answer does not
|
|
22
|
+
* wait with the connection open — it ENDS, saying what it waits for, and a later run carries the
|
|
23
|
+
* answers. The library run underneath does wait (parked, durably when the runner is durable). So this
|
|
24
|
+
* stops reading when the run is waiting on someone and nothing else is moving, closes the AG-UI run
|
|
25
|
+
* with the interrupt outcome, and leaves the library run parked for the resume to pick up.
|
|
26
|
+
*/
|
|
27
|
+
export async function* agUiEvents(frames, options) {
|
|
28
|
+
const encoder = new AgUiEncoder(options);
|
|
29
|
+
const quietMs = options.quietMs ?? DEFAULT_QUIET_MS;
|
|
30
|
+
yield* encoder.start();
|
|
31
|
+
yield* options.preamble ?? [];
|
|
32
|
+
const iterator = frames[Symbol.asyncIterator]();
|
|
33
|
+
let upcoming;
|
|
34
|
+
let ended = false;
|
|
35
|
+
try {
|
|
36
|
+
for (;;) {
|
|
37
|
+
upcoming ??= iterator.next();
|
|
38
|
+
// Frames buffered before this reader attached are replayed without a pause between them, so
|
|
39
|
+
// "is it waiting?" is only asked of a stream that has caught up with what it already holds.
|
|
40
|
+
const caughtUp = encoder.consumed >= (options.skip ?? 0);
|
|
41
|
+
let next;
|
|
42
|
+
if (caughtUp && encoder.waiting) {
|
|
43
|
+
// Nothing else in flight: only a frame already on its way (a sink that reads in batches)
|
|
44
|
+
// can still arrive, so a short grace is enough. Otherwise wait out the quiet window.
|
|
45
|
+
next = await raceQuiet(upcoming, encoder.busy ? quietMs : Math.min(quietMs, GRACE_MS));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
next = await upcoming;
|
|
49
|
+
}
|
|
50
|
+
if (next === 'quiet')
|
|
51
|
+
break;
|
|
52
|
+
upcoming = undefined;
|
|
53
|
+
if (next.done === true) {
|
|
54
|
+
ended = true;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
if (options.cursor !== undefined) {
|
|
58
|
+
options.cursor.seq = frameSeq(next.value) ?? options.cursor.seq;
|
|
59
|
+
}
|
|
60
|
+
yield* encoder.encode(next.value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
// Stop following the library stream; the run it carries is left exactly as it is.
|
|
65
|
+
void iterator.return?.();
|
|
66
|
+
}
|
|
67
|
+
yield* encoder.finish(ended);
|
|
68
|
+
}
|
|
69
|
+
function raceQuiet(upcoming, ms) {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
const timer = setTimeout(() => resolve('quiet'), ms);
|
|
72
|
+
upcoming.then((result) => {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
resolve(result);
|
|
75
|
+
}, (error) => {
|
|
76
|
+
clearTimeout(timer);
|
|
77
|
+
reject(error);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* One AG-UI event as an SSE frame: a single `data:` line, LF-terminated, as the binding pins. With a
|
|
83
|
+
* positive `id`, an SSE `id:` line first — the run's sequence number ({@link AgUiStreamOptions.cursor}),
|
|
84
|
+
* which AG-UI clients ignore and this package's React client re-attaches with.
|
|
85
|
+
*/
|
|
86
|
+
export function agUiSse(event, id) {
|
|
87
|
+
const head = id !== undefined && id > 0 ? `id: ${id}\n` : '';
|
|
88
|
+
return `${head}data: ${JSON.stringify(event)}\n\n`;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../../src/ag-ui/core/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,cAAc,CAAC;AA4BpE,yFAAyF;AACzF,MAAM,SAAS,GAAG,IAAI,OAAO,EAAkB,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAA4B,KAAQ,EAAE,GAAW;IAC3E,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC1B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,QAAQ,CAAC,KAAsB;IAC7C,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,gBA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IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { ActionProposalTarget } from '../../action-proposal-receipt.js';
|
|
2
|
+
import type { AgentStreamEvent } from '../../stream-events.js';
|
|
3
|
+
/**
|
|
4
|
+
* The slice of AG-UI 1.0 (https://docs.ag-ui.com/spec/1.0) this producer writes and reads. Typed by
|
|
5
|
+
* hand rather than imported: the agent package takes no dependency on an AG-UI SDK, and the wire
|
|
6
|
+
* shape is pinned by the protocol's own JSON Schema, which the tests validate every emitted event
|
|
7
|
+
* against (`src/ag-ui/fixtures/schema-1.0.json`).
|
|
8
|
+
*
|
|
9
|
+
* Optional members are OMITTED when there is nothing to say, never `null` — the protocol's
|
|
10
|
+
* "absent means absent" rule.
|
|
11
|
+
*/
|
|
12
|
+
/** The protocol version this producer declares on `RUN_STARTED`. */
|
|
13
|
+
export declare const AG_UI_PROTOCOL_VERSION = "1.0";
|
|
14
|
+
export type AgUiMetadata = Record<string, unknown>;
|
|
15
|
+
/** One provider-and-model's token usage, in the protocol's single accounting. */
|
|
16
|
+
export interface AgUiTokenUsage {
|
|
17
|
+
provider?: string;
|
|
18
|
+
model?: string;
|
|
19
|
+
/** Every prompt token, cached or not. */
|
|
20
|
+
inputTokens?: number;
|
|
21
|
+
/** Every generated token, reasoning included. */
|
|
22
|
+
outputTokens?: number;
|
|
23
|
+
totalTokens?: number;
|
|
24
|
+
/** Part of `outputTokens`. */
|
|
25
|
+
reasoningTokens?: number;
|
|
26
|
+
/** Cache reads — part of `inputTokens`. */
|
|
27
|
+
cachedInputTokens?: number;
|
|
28
|
+
/** Cache writes — part of `inputTokens`, disjoint from the reads. */
|
|
29
|
+
cacheWriteInputTokens?: number;
|
|
30
|
+
}
|
|
31
|
+
/** What an interrupted run is waiting for; a resume entry answers it by `id`. */
|
|
32
|
+
export interface AgUiInterrupt {
|
|
33
|
+
id: string;
|
|
34
|
+
/** Open string. This producer writes `tool_approval` and `input_required`. */
|
|
35
|
+
reason: string;
|
|
36
|
+
message?: string;
|
|
37
|
+
toolCallId?: string;
|
|
38
|
+
responseSchema?: Record<string, unknown>;
|
|
39
|
+
expiresAt?: string;
|
|
40
|
+
metadata?: AgUiMetadata;
|
|
41
|
+
}
|
|
42
|
+
export type AgUiRunOutcome = {
|
|
43
|
+
type: 'success';
|
|
44
|
+
pendingToolCallIds?: string[];
|
|
45
|
+
} | {
|
|
46
|
+
type: 'interrupt';
|
|
47
|
+
interrupts: AgUiInterrupt[];
|
|
48
|
+
} | {
|
|
49
|
+
type: 'cancelled';
|
|
50
|
+
};
|
|
51
|
+
interface Base {
|
|
52
|
+
metadata?: AgUiMetadata;
|
|
53
|
+
}
|
|
54
|
+
export type AgUiEvent = (Base & {
|
|
55
|
+
type: 'RUN_STARTED';
|
|
56
|
+
threadId: string;
|
|
57
|
+
runId: string;
|
|
58
|
+
protocolVersion?: string;
|
|
59
|
+
}) | (Base & {
|
|
60
|
+
type: 'RUN_FINISHED';
|
|
61
|
+
threadId: string;
|
|
62
|
+
runId: string;
|
|
63
|
+
outcome?: AgUiRunOutcome;
|
|
64
|
+
usage?: AgUiTokenUsage[];
|
|
65
|
+
}) | (Base & {
|
|
66
|
+
type: 'RUN_ERROR';
|
|
67
|
+
message: string;
|
|
68
|
+
code?: string;
|
|
69
|
+
usage?: AgUiTokenUsage[];
|
|
70
|
+
}) | (Base & {
|
|
71
|
+
type: 'STEP_STARTED';
|
|
72
|
+
stepName: string;
|
|
73
|
+
}) | (Base & {
|
|
74
|
+
type: 'STEP_FINISHED';
|
|
75
|
+
stepName: string;
|
|
76
|
+
}) | (Base & {
|
|
77
|
+
type: 'TEXT_MESSAGE_START';
|
|
78
|
+
messageId: string;
|
|
79
|
+
role: 'assistant';
|
|
80
|
+
}) | (Base & {
|
|
81
|
+
type: 'TEXT_MESSAGE_CONTENT';
|
|
82
|
+
messageId: string;
|
|
83
|
+
delta: string;
|
|
84
|
+
}) | (Base & {
|
|
85
|
+
type: 'TEXT_MESSAGE_END';
|
|
86
|
+
messageId: string;
|
|
87
|
+
}) | (Base & {
|
|
88
|
+
type: 'REASONING_START';
|
|
89
|
+
messageId: string;
|
|
90
|
+
}) | (Base & {
|
|
91
|
+
type: 'REASONING_MESSAGE_START';
|
|
92
|
+
messageId: string;
|
|
93
|
+
role: 'reasoning';
|
|
94
|
+
}) | (Base & {
|
|
95
|
+
type: 'REASONING_MESSAGE_CONTENT';
|
|
96
|
+
messageId: string;
|
|
97
|
+
delta: string;
|
|
98
|
+
}) | (Base & {
|
|
99
|
+
type: 'REASONING_MESSAGE_END';
|
|
100
|
+
messageId: string;
|
|
101
|
+
}) | (Base & {
|
|
102
|
+
type: 'REASONING_END';
|
|
103
|
+
messageId: string;
|
|
104
|
+
}) | (Base & {
|
|
105
|
+
type: 'TOOL_CALL_START';
|
|
106
|
+
toolCallId: string;
|
|
107
|
+
toolCallName: string;
|
|
108
|
+
parentMessageId?: string;
|
|
109
|
+
}) | (Base & {
|
|
110
|
+
type: 'TOOL_CALL_ARGS';
|
|
111
|
+
toolCallId: string;
|
|
112
|
+
delta: string;
|
|
113
|
+
}) | (Base & {
|
|
114
|
+
type: 'TOOL_CALL_END';
|
|
115
|
+
toolCallId: string;
|
|
116
|
+
}) | (Base & {
|
|
117
|
+
type: 'TOOL_CALL_RESULT';
|
|
118
|
+
messageId: string;
|
|
119
|
+
toolCallId: string;
|
|
120
|
+
content: string;
|
|
121
|
+
role: 'tool';
|
|
122
|
+
}) | (Base & {
|
|
123
|
+
type: 'CUSTOM';
|
|
124
|
+
name: string;
|
|
125
|
+
value: unknown;
|
|
126
|
+
});
|
|
127
|
+
/** Where a media part's bytes are. Closed set: an unknown `type` is malformed input. */
|
|
128
|
+
export type AgUiPartSource = {
|
|
129
|
+
type: 'data';
|
|
130
|
+
value: string;
|
|
131
|
+
mimeType: string;
|
|
132
|
+
} | {
|
|
133
|
+
type: 'url';
|
|
134
|
+
value: string;
|
|
135
|
+
mimeType?: string;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'file';
|
|
138
|
+
value: string;
|
|
139
|
+
provider?: string;
|
|
140
|
+
mimeType?: string;
|
|
141
|
+
};
|
|
142
|
+
export type AgUiContentPart = {
|
|
143
|
+
type: 'text';
|
|
144
|
+
text: string;
|
|
145
|
+
id?: string;
|
|
146
|
+
metadata?: unknown;
|
|
147
|
+
} | {
|
|
148
|
+
type: 'image' | 'audio' | 'video' | 'document';
|
|
149
|
+
source: AgUiPartSource;
|
|
150
|
+
id?: string;
|
|
151
|
+
metadata?: unknown;
|
|
152
|
+
};
|
|
153
|
+
export interface AgUiMessage {
|
|
154
|
+
id: string;
|
|
155
|
+
role: string;
|
|
156
|
+
content?: string | AgUiContentPart[];
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
}
|
|
159
|
+
export interface AgUiResumeEntry {
|
|
160
|
+
interruptId: string;
|
|
161
|
+
status: 'resolved' | 'cancelled';
|
|
162
|
+
payload?: unknown;
|
|
163
|
+
metadata?: AgUiMetadata;
|
|
164
|
+
}
|
|
165
|
+
export interface AgUiContext {
|
|
166
|
+
description: string;
|
|
167
|
+
value: string;
|
|
168
|
+
}
|
|
169
|
+
/** `RunAgentInput`: the one message that travels from the application to the agent. */
|
|
170
|
+
export interface AgUiRunInput {
|
|
171
|
+
threadId: string;
|
|
172
|
+
runId: string;
|
|
173
|
+
protocolVersion?: string;
|
|
174
|
+
parentRunId?: string;
|
|
175
|
+
state?: unknown;
|
|
176
|
+
messages: AgUiMessage[];
|
|
177
|
+
tools?: unknown[];
|
|
178
|
+
context?: AgUiContext[];
|
|
179
|
+
forwardedProps?: unknown;
|
|
180
|
+
resume?: AgUiResumeEntry[];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The names of the `CUSTOM` events this producer writes for what AG-UI does not model. Prefixed, as
|
|
184
|
+
* the protocol asks of invented names; a consumer that does not know one ignores it.
|
|
185
|
+
*/
|
|
186
|
+
export declare const AG_UI_CUSTOM: {
|
|
187
|
+
/** `{ runId, threadId }` — the library's own ids for the run behind this stream (cancel, re-attach). */
|
|
188
|
+
readonly run: 'agora.run';
|
|
189
|
+
/** A generative-UI component (`AgentUiComponent`); a repeat `id` replaces. */
|
|
190
|
+
readonly ui: 'agora.ui';
|
|
191
|
+
readonly title: 'agora.title';
|
|
192
|
+
readonly queue: 'agora.queue';
|
|
193
|
+
/** The approval request as the native protocol carries it, for a consumer that renders it live. */
|
|
194
|
+
readonly approvalRequested: 'agora.approval-requested';
|
|
195
|
+
readonly approvalSettled: 'agora.approval-settled';
|
|
196
|
+
/** `{ id, runId, request }` — the whole question set of an elicitation (`ElicitationRequest`). */
|
|
197
|
+
readonly elicitation: 'agora.elicitation';
|
|
198
|
+
/** `{ usage, costUsd, reasoningMs, model }` of one model step, right after its `STEP_FINISHED`. */
|
|
199
|
+
readonly stepUsage: 'agora.step-usage';
|
|
200
|
+
/** `{ message }` — input material this producer could not use and dropped. */
|
|
201
|
+
readonly warning: 'agora.warning';
|
|
202
|
+
/** `{ threadId, proposalDecision }` — a message decided an independent proposal instead of a run. */
|
|
203
|
+
readonly actionProposalDecision: 'agora.action-proposal-decision';
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* What the encoder reads: one frame of a run's stream, in the shared vocabulary
|
|
207
|
+
* ({@link AgentStreamEvent}) — plus the terminal failure, which the NestJS sink throws and the
|
|
208
|
+
* Adonis sink writes as a frame, and three optional facts a sink may know about a parked call:
|
|
209
|
+
* - `runId` — the run that is PARKED, when it is not the one whose stream this is (a delegated
|
|
210
|
+
* sub-agent forwards its frames into its ancestor's stream). Absent → the stream's own run.
|
|
211
|
+
* - `toolName`, `input` — the call being approved. Absent → read off the call's announcement.
|
|
212
|
+
* - `target` — the independent proposal the approval decides (`actionApprovalMode: 'independent'`).
|
|
213
|
+
* Absent → an ordinary parked approval.
|
|
214
|
+
*
|
|
215
|
+
* Framework-free on purpose: both servers project their own sink onto this and share one encoder.
|
|
216
|
+
*/
|
|
217
|
+
export type AgUiSourceFrame = Exclude<AgentStreamEvent, {
|
|
218
|
+
kind: 'approval-requested';
|
|
219
|
+
} | {
|
|
220
|
+
kind: 'elicitation';
|
|
221
|
+
} | {
|
|
222
|
+
kind: 'ui';
|
|
223
|
+
}> | (Extract<AgentStreamEvent, {
|
|
224
|
+
kind: 'approval-requested';
|
|
225
|
+
}> & {
|
|
226
|
+
runId?: string;
|
|
227
|
+
toolName?: string;
|
|
228
|
+
input?: unknown;
|
|
229
|
+
target?: ActionProposalTarget;
|
|
230
|
+
}) | (Extract<AgentStreamEvent, {
|
|
231
|
+
kind: 'elicitation';
|
|
232
|
+
}> & {
|
|
233
|
+
runId?: string;
|
|
234
|
+
})
|
|
235
|
+
/** A component with no `id` is numbered by its position in the stream (`ui:<n>`). */
|
|
236
|
+
| (Omit<Extract<AgentStreamEvent, {
|
|
237
|
+
kind: 'ui';
|
|
238
|
+
}>, 'id' | 'props'> & {
|
|
239
|
+
id?: string;
|
|
240
|
+
props: unknown;
|
|
241
|
+
})
|
|
242
|
+
/** The run failed: the AG-UI run ends with `RUN_ERROR`, and nothing follows it. */
|
|
243
|
+
| {
|
|
244
|
+
kind: 'error';
|
|
245
|
+
code: string;
|
|
246
|
+
message: string;
|
|
247
|
+
};
|
|
248
|
+
export {};
|
|
249
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ag-ui/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;GAQG;AAEH,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA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AAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AACJ,mFAAmF;GACjF;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slice of AG-UI 1.0 (https://docs.ag-ui.com/spec/1.0) this producer writes and reads. Typed by
|
|
3
|
+
* hand rather than imported: the agent package takes no dependency on an AG-UI SDK, and the wire
|
|
4
|
+
* shape is pinned by the protocol's own JSON Schema, which the tests validate every emitted event
|
|
5
|
+
* against (`src/ag-ui/fixtures/schema-1.0.json`).
|
|
6
|
+
*
|
|
7
|
+
* Optional members are OMITTED when there is nothing to say, never `null` — the protocol's
|
|
8
|
+
* "absent means absent" rule.
|
|
9
|
+
*/
|
|
10
|
+
/** The protocol version this producer declares on `RUN_STARTED`. */
|
|
11
|
+
export const AG_UI_PROTOCOL_VERSION = '1.0';
|
|
12
|
+
/**
|
|
13
|
+
* The names of the `CUSTOM` events this producer writes for what AG-UI does not model. Prefixed, as
|
|
14
|
+
* the protocol asks of invented names; a consumer that does not know one ignores it.
|
|
15
|
+
*/
|
|
16
|
+
export const AG_UI_CUSTOM = {
|
|
17
|
+
/** `{ runId, threadId }` — the library's own ids for the run behind this stream (cancel, re-attach). */
|
|
18
|
+
run: 'agora.run',
|
|
19
|
+
/** A generative-UI component (`AgentUiComponent`); a repeat `id` replaces. */
|
|
20
|
+
ui: 'agora.ui',
|
|
21
|
+
title: 'agora.title',
|
|
22
|
+
queue: 'agora.queue',
|
|
23
|
+
/** The approval request as the native protocol carries it, for a consumer that renders it live. */
|
|
24
|
+
approvalRequested: 'agora.approval-requested',
|
|
25
|
+
approvalSettled: 'agora.approval-settled',
|
|
26
|
+
/** `{ id, runId, request }` — the whole question set of an elicitation (`ElicitationRequest`). */
|
|
27
|
+
elicitation: 'agora.elicitation',
|
|
28
|
+
/** `{ usage, costUsd, reasoningMs, model }` of one model step, right after its `STEP_FINISHED`. */
|
|
29
|
+
stepUsage: 'agora.step-usage',
|
|
30
|
+
/** `{ message }` — input material this producer could not use and dropped. */
|
|
31
|
+
warning: 'agora.warning',
|
|
32
|
+
/** `{ threadId, proposalDecision }` — a message decided an independent proposal instead of a run. */
|
|
33
|
+
actionProposalDecision: 'agora.action-proposal-decision',
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ag-ui/core/types.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,oEAAoE;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AA+H5C;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,wGAAwG;IACxG,GAAG,EAAE,WAAW;IAChB,8EAA8E;IAC9E,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,aAAa;IACpB,KAAK,EAAE,aAAa;IACpB,mGAAmG;IACnG,iBAAiB,EAAE,0BAA0B;IAC7C,eAAe,EAAE,wBAAwB;IACzC,kGAAkG;IAClG,WAAW,EAAE,mBAAmB;IAChC,mGAAmG;IACnG,SAAS,EAAE,kBAAkB;IAC7B,8EAA8E;IAC9E,OAAO,EAAE,eAAe;IACxB,qGAAqG;IACrG,sBAAsB,EAAE,gCAAgC;CAChD,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { type AgUiEncoderOptions, type AgUiEvent } from '@dudousxd/nestjs-agent-core/ag-ui';
|
|
2
1
|
import type { StreamFrame } from '../spi/token-stream-sink.js';
|
|
2
|
+
import { type AgUiEncoderOptions, type AgUiEvent } from './core/index.js';
|
|
3
3
|
export type { AgUiEncoderOptions };
|
|
4
4
|
/**
|
|
5
|
-
* The
|
|
6
|
-
* servers), reading this package's {@link StreamFrame}s. A pure state machine: the same frames
|
|
5
|
+
* The local AG-UI encoder, reading this package's {@link StreamFrame}s. A pure state machine: the same frames
|
|
7
6
|
* always give the same events.
|
|
8
7
|
*/
|
|
9
8
|
export declare class AgUiEncoder {
|
|
10
|
-
private readonly
|
|
9
|
+
private readonly core;
|
|
11
10
|
constructor(options: AgUiEncoderOptions);
|
|
12
11
|
/** How many frames of the library stream this encoder has consumed. */
|
|
13
12
|
get consumed(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IAEnC,YAAY,OAAO,EAAE,kBAAkB,EAEtC;IAED,uEAAuE;IACvE,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,0FAA0F;IAC1F,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,wFAAwF;IACxF,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,KAAK,IAAI,SAAS,EAAE,CAEnB;IAED,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAAE,CAEtC;IAED,MAAM,CAAC,KAAK,UAAQ,GAAG,SAAS,EAAE,CAEjC;CACF"}
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { AgUiEncoder as
|
|
1
|
+
import { AgUiEncoder as CoreEncoder, } from './core/index.js';
|
|
2
2
|
import { toAgUiFrame } from './frames.js';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
5
|
-
* servers), reading this package's {@link StreamFrame}s. A pure state machine: the same frames
|
|
4
|
+
* The local AG-UI encoder, reading this package's {@link StreamFrame}s. A pure state machine: the same frames
|
|
6
5
|
* always give the same events.
|
|
7
6
|
*/
|
|
8
7
|
export class AgUiEncoder {
|
|
9
|
-
|
|
8
|
+
core;
|
|
10
9
|
constructor(options) {
|
|
11
|
-
this.
|
|
10
|
+
this.core = new CoreEncoder(options);
|
|
12
11
|
}
|
|
13
12
|
/** How many frames of the library stream this encoder has consumed. */
|
|
14
13
|
get consumed() {
|
|
15
|
-
return this.
|
|
14
|
+
return this.core.consumed;
|
|
16
15
|
}
|
|
17
16
|
/** The run is waiting on at least one approval or question set nobody has settled yet. */
|
|
18
17
|
get waiting() {
|
|
19
|
-
return this.
|
|
18
|
+
return this.core.waiting;
|
|
20
19
|
}
|
|
21
20
|
/** A tool call is announced and neither answered nor parked: more frames are coming. */
|
|
22
21
|
get busy() {
|
|
23
|
-
return this.
|
|
22
|
+
return this.core.busy;
|
|
24
23
|
}
|
|
25
24
|
start() {
|
|
26
|
-
return this.
|
|
25
|
+
return this.core.start();
|
|
27
26
|
}
|
|
28
27
|
encode(frame) {
|
|
29
|
-
return this.
|
|
28
|
+
return this.core.encode(toAgUiFrame(frame));
|
|
30
29
|
}
|
|
31
30
|
finish(ended = false) {
|
|
32
|
-
return this.
|
|
31
|
+
return this.core.finish(ended);
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
//# sourceMappingURL=encoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../../src/ag-ui/encoder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../../src/ag-ui/encoder.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,WAAW,IAAI,WAAW,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C;;;GAGG;AACH,MAAM,OAAO,WAAW;IACL,IAAI,CAAc;IAEnC,YAAY,OAA2B;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,uEAAuE;IACvE,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED,0FAA0F;IAC1F,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,wFAAwF;IACxF,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAkB;QACvB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,KAAK,GAAG,KAAK;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import type { AgUiSourceFrame } from '@dudousxd/nestjs-agent-core/ag-ui';
|
|
2
1
|
import type { StreamFrame } from '../spi/token-stream-sink.js';
|
|
2
|
+
import { type AgUiSourceFrame } from './core/index.js';
|
|
3
3
|
/**
|
|
4
|
-
* One frame of this package's sink as the frame the
|
|
5
|
-
*
|
|
6
|
-
* shared vocabulary leaves optional — the PARKED run, the tool and its arguments — so an interrupt
|
|
4
|
+
* One frame of this package's sink as the frame the local AG-UI encoder reads. The typed `approval` / `elicitation` frames carry what the
|
|
5
|
+
* stream vocabulary leaves optional — the PARKED run, the tool and its arguments — so an interrupt
|
|
7
6
|
* addresses a delegated sub-agent's own run.
|
|
8
7
|
*/
|
|
9
8
|
export declare function toAgUiFrame(frame: StreamFrame): AgUiSourceFrame;
|
|
10
9
|
/**
|
|
11
|
-
* A library run's stream as the
|
|
10
|
+
* A library run's stream as the local encoder's frames. A hand-rolled iterator rather than a
|
|
12
11
|
* generator: the AG-UI driver lets go of a parked stream while a read is still pending, and a
|
|
13
12
|
* generator would queue that `return()` behind the read that never comes — the sink's subscription
|
|
14
13
|
* has to be released at once.
|
|
14
|
+
*
|
|
15
|
+
* Each frame is tagged ({@link withFrameSeq}) with the run's own sequence number through it — the
|
|
16
|
+
* SSE `id:` the native stream (`chat/:runId/stream`) gives its last event — so the AG-UI route can
|
|
17
|
+
* number its events the way a native re-attach (`?after=`) counts.
|
|
15
18
|
*/
|
|
16
19
|
export declare function agUiFrames(frames: AsyncIterable<StreamFrame>): AsyncIterable<AgUiSourceFrame>;
|
|
17
20
|
//# sourceMappingURL=frames.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/frames.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/frames.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,KAAK,eAAe,EAAgB,MAAM,iBAAiB,CAAC;AAErE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe,CA0C/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,eAAe,CAAC,CAqB7F"}
|
package/dist/src/ag-ui/frames.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { frameToEvents } from '../sse.js';
|
|
2
|
+
import { withFrameSeq } from './core/index.js';
|
|
1
3
|
/**
|
|
2
|
-
* One frame of this package's sink as the frame the
|
|
3
|
-
*
|
|
4
|
-
* shared vocabulary leaves optional — the PARKED run, the tool and its arguments — so an interrupt
|
|
4
|
+
* One frame of this package's sink as the frame the local AG-UI encoder reads. The typed `approval` / `elicitation` frames carry what the
|
|
5
|
+
* stream vocabulary leaves optional — the PARKED run, the tool and its arguments — so an interrupt
|
|
5
6
|
* addresses a delegated sub-agent's own run.
|
|
6
7
|
*/
|
|
7
8
|
export function toAgUiFrame(frame) {
|
|
@@ -15,6 +16,10 @@ export function toAgUiFrame(frame) {
|
|
|
15
16
|
props: frame.data,
|
|
16
17
|
...(frame.id !== undefined ? { id: frame.id } : {}),
|
|
17
18
|
...(frame.version !== undefined ? { version: frame.version } : {}),
|
|
19
|
+
...(frame.fallbackText !== undefined ? { fallbackText: frame.fallbackText } : {}),
|
|
20
|
+
...(frame.componentVersions !== undefined
|
|
21
|
+
? { componentVersions: frame.componentVersions }
|
|
22
|
+
: {}),
|
|
18
23
|
...(frame.toolCallId !== undefined ? { toolCallId: frame.toolCallId } : {}),
|
|
19
24
|
};
|
|
20
25
|
case 'approval':
|
|
@@ -25,6 +30,7 @@ export function toAgUiFrame(frame) {
|
|
|
25
30
|
toolName: frame.toolName,
|
|
26
31
|
input: frame.input ?? null,
|
|
27
32
|
approver: frame.approver ?? 'requester',
|
|
33
|
+
...(frame.target !== undefined ? { target: frame.target } : {}),
|
|
28
34
|
...(frame.confirmation !== undefined ? { confirmation: frame.confirmation } : {}),
|
|
29
35
|
...(frame.expiresAt !== undefined ? { expiresAt: frame.expiresAt } : {}),
|
|
30
36
|
};
|
|
@@ -43,21 +49,29 @@ export function toAgUiFrame(frame) {
|
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
|
-
* A library run's stream as the
|
|
52
|
+
* A library run's stream as the local encoder's frames. A hand-rolled iterator rather than a
|
|
47
53
|
* generator: the AG-UI driver lets go of a parked stream while a read is still pending, and a
|
|
48
54
|
* generator would queue that `return()` behind the read that never comes — the sink's subscription
|
|
49
55
|
* has to be released at once.
|
|
56
|
+
*
|
|
57
|
+
* Each frame is tagged ({@link withFrameSeq}) with the run's own sequence number through it — the
|
|
58
|
+
* SSE `id:` the native stream (`chat/:runId/stream`) gives its last event — so the AG-UI route can
|
|
59
|
+
* number its events the way a native re-attach (`?after=`) counts.
|
|
50
60
|
*/
|
|
51
61
|
export function agUiFrames(frames) {
|
|
52
62
|
return {
|
|
53
63
|
[Symbol.asyncIterator]() {
|
|
54
64
|
const inner = frames[Symbol.asyncIterator]();
|
|
65
|
+
let position = 0;
|
|
66
|
+
let seq = 0;
|
|
55
67
|
return {
|
|
56
68
|
next: async () => {
|
|
57
69
|
const result = await inner.next();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
if (result.done === true)
|
|
71
|
+
return { done: true, value: undefined };
|
|
72
|
+
seq += frameToEvents(result.value, position).length;
|
|
73
|
+
position += 1;
|
|
74
|
+
return { done: false, value: withFrameSeq(toAgUiFrame(result.value), seq) };
|
|
61
75
|
},
|
|
62
76
|
return: async () => {
|
|
63
77
|
await inner.return?.();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../src/ag-ui/frames.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../src/ag-ui/frames.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAwB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAErE;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAkB;IAC5C,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,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AI,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC;oBACpD,QAAQ,IAAI,CAAC,CAAC;oBACd,OAAO,EAAE,IAAI,EAAE,KAAc,EAAE,KAAK,EAAE,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;gBACvF,CAAC;gBACD,MAAM,EAAE,KAAK,IAAI,EAAE;oBACjB,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;oBACvB,OAAO,EAAE,IAAI,EAAE,IAAa,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;gBACnD,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* AG-UI 1.0 (https://docs.ag-ui.com/spec/1.0), producer side: the route adapter, and the pieces it is
|
|
3
3
|
* built from — for a host that mounts its own route instead of the provider's.
|
|
4
4
|
*
|
|
5
|
-
* The encoder,
|
|
6
|
-
*
|
|
7
|
-
* package's `StreamFrame`s. Install `@dudousxd/nestjs-agent-core` (an optional peer, 0.35 or later)
|
|
8
|
-
* to use this entry.
|
|
5
|
+
* The encoder, input readers and interrupt-id codec are owned by this package.
|
|
6
|
+
* `AgUiEncoder` and `agUiEvents` adapt this package's `StreamFrame`s to AG-UI.
|
|
9
7
|
*/
|
|
10
|
-
export { AG_UI_CUSTOM, AG_UI_PROTOCOL_VERSION, type AgUiContentPart, type AgUiContext, type AgUiEvent, type AgUiInterrupt, type AgUiMessage, type AgUiMetadata, type AgUiPartSource, type AgUiResumeEntry, type AgUiRunInput, type AgUiRunOutcome, type AgUiSourceFrame, type AgUiTokenUsage, decodeInterruptId, encodeInterruptId, type ForwardedOptions, type InlineMedia, type InterruptAddress, parseRunInput, planResume, type ResumeDecision, type ResumePlan, readAnswersPayload, readApprovalPayload, readContext, readForwardedProps, readUserTurn, type UserTurn, } from '@dudousxd/nestjs-agent-core/ag-ui';
|
|
11
8
|
export { type AgUiAdapterOptions, agUiAdapter } from './adapter.js';
|
|
9
|
+
export { AG_UI_CUSTOM, AG_UI_PROTOCOL_VERSION, AG_UI_STAGED_MEDIA_PROVIDER, type AgUiContentPart, type AgUiContext, type AgUiCursor, type AgUiEvent, type AgUiInterrupt, type AgUiMessage, type AgUiMetadata, type AgUiPartSource, type AgUiResumeEntry, type AgUiRunInput, type AgUiRunOutcome, type AgUiSourceFrame, type AgUiTokenUsage, decodeInterruptId, encodeInterruptId, type ForwardedOptions, type InlineMedia, type InterruptAddress, parseRunInput, planResume, type ResumeDecision, type ResumePlan, readAnswersPayload, readApprovalPayload, readContext, readForwardedProps, readUserTurn, type UserTurn, } from './core/index.js';
|
|
12
10
|
export { AgUiEncoder, type AgUiEncoderOptions } from './encoder.js';
|
|
13
11
|
export { agUiFrames, toAgUiFrame } from './frames.js';
|
|
14
12
|
export { type AgUiStreamOptions, agUiEvents, agUiSse } from './stream.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,aAAa,EACb,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,KAAK,QAAQ,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,iBAAiB,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/src/ag-ui/index.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* AG-UI 1.0 (https://docs.ag-ui.com/spec/1.0), producer side: the route adapter, and the pieces it is
|
|
3
3
|
* built from — for a host that mounts its own route instead of the provider's.
|
|
4
4
|
*
|
|
5
|
-
* The encoder,
|
|
6
|
-
*
|
|
7
|
-
* package's `StreamFrame`s. Install `@dudousxd/nestjs-agent-core` (an optional peer, 0.35 or later)
|
|
8
|
-
* to use this entry.
|
|
5
|
+
* The encoder, input readers and interrupt-id codec are owned by this package.
|
|
6
|
+
* `AgUiEncoder` and `agUiEvents` adapt this package's `StreamFrame`s to AG-UI.
|
|
9
7
|
*/
|
|
10
|
-
export { AG_UI_CUSTOM, AG_UI_PROTOCOL_VERSION, decodeInterruptId, encodeInterruptId, parseRunInput, planResume, readAnswersPayload, readApprovalPayload, readContext, readForwardedProps, readUserTurn, } from '@dudousxd/nestjs-agent-core/ag-ui';
|
|
11
8
|
export { agUiAdapter } from './adapter.js';
|
|
9
|
+
export { AG_UI_CUSTOM, AG_UI_PROTOCOL_VERSION, AG_UI_STAGED_MEDIA_PROVIDER, decodeInterruptId, encodeInterruptId, parseRunInput, planResume, readAnswersPayload, readApprovalPayload, readContext, readForwardedProps, readUserTurn, } from './core/index.js';
|
|
12
10
|
export { AgUiEncoder } from './encoder.js';
|
|
13
11
|
export { agUiFrames, toAgUiFrame } from './frames.js';
|
|
14
12
|
export { agUiEvents, agUiSse } from './stream.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ag-ui/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ag-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA2B,WAAW,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAc3B,iBAAiB,EACjB,iBAAiB,EAIjB,aAAa,EACb,UAAU,EAGV,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,YAAY,GAEb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAA2B,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAA0B,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|