@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# @adonis-agora/agent
|
|
2
2
|
|
|
3
|
+
## 0.63.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#314](https://github.com/DavideCarvalho/adonis-agora-agent/pull/314) [`ab09bbd`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/ab09bbdc9093fc07442b69a46d0560e582e2c89b) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Fixes to generative UI, the React AG-UI client and `AuthActorResolver`:
|
|
8
|
+
|
|
9
|
+
- **GenUI text:** a `fallbackText` that returns an empty string renders nothing: a bare `Stack`, or a `Card` without a title, sent a JSON block of its props (`{}`) to text channels. In a tree, a layout's children still render.
|
|
10
|
+
- **GenUI tools:** outside tree mode, layout components (`children: true`, like `Stack` and `Card`) get no `ui__show_*` tool, and the generic show tool (`showTool`) no longer offers them. They could only push an empty container. **Behavior change:** compose layouts with `mode: 'tree'`.
|
|
11
|
+
- **`Chart` text:** the fallback draws every series instead of only the first. A bar chart gets one bar per series at each point, all on one scale. A line chart gets a sparkline per series (first → last, min/max) and the points as a table.
|
|
12
|
+
- **React over AG-UI (`agUiBackend()` / `agUiChatStream`):**
|
|
13
|
+
- Files the composer uploaded are now sent with the turn, as media parts by `file` handle (`{ type: 'file', provider: 'agora', value: <mediaId> }`). Before, they were dropped.
|
|
14
|
+
- Regenerate now sends `forwardedProps.regenerate`, so the answer is regenerated. Before, the question was posted again as a new turn.
|
|
15
|
+
- Question sets (`agora.elicitation`) render as the normal question block.
|
|
16
|
+
- Per-step usage, cost and model (`agora.step-usage`) reach `step-finish`.
|
|
17
|
+
- A tool call keeps its kind (`read`/`action`).
|
|
18
|
+
- An interrupt the stream already carried as an approval or a question set no longer also renders as `AgUiInterrupt`.
|
|
19
|
+
- After an approval or a question set the chat shows, the rest of the run streams into the same message. The AG-UI run ends on the interrupt, but the stream now ends without `done`, and the transport re-attaches to the parked run on `GET <path>/chat/:runId/stream?after=`. Before, a decision made through the native `tool-call` routes ran the rest of the run with nothing listening.
|
|
20
|
+
- The re-attach cursor is the run's own sequence number (from the producer's SSE `id:`). The re-framed frames no longer carry an `id:` that counts them, which matched nothing on the native route. A producer that writes no `id:` is not re-attached to.
|
|
21
|
+
- A text decision on a proposal (`agora.action-proposal-decision`) produces the same transient `data-proposal-decision` part as a native text decision.
|
|
22
|
+
- `ChatStreamRequest.files` describes the send's staged uploads, and `content(body, files)` receives them.
|
|
23
|
+
- **AG-UI producer (`agUiAdapter()`):**
|
|
24
|
+
- Accepts a `file` handle with `provider: 'agora'` that names an upload it staged. The upload is resolved for the caller, as the native `attachments` refs are (`403` when it is not theirs).
|
|
25
|
+
- Reads `forwardedProps.regenerate`.
|
|
26
|
+
- `TOOL_CALL_START` carries `metadata['agora.toolKind']`, `agora.elicitation` carries the call `id`, and `agora.step-usage` carries the step's `model`.
|
|
27
|
+
- Each event of the run carries an SSE `id:`: the run's own sequence number, as on the native stream, so `chat/:runId/stream?after=<id>` continues where the AG-UI run ended. `agUiSse(event, id?)` writes it, and `agUiEvents` keeps it in a new `cursor` option.
|
|
28
|
+
- **`AuthActorResolver`:** the agent routes run no auth middleware, so `ctx.auth.user` was never set and every request was refused with `401`. When no guard has tried the request yet, the resolver now calls `ctx.auth.check()` itself; with the new `guards` option it calls `checkUsing(guards)` instead. Neither throws for an anonymous request, and the resolver still answers `401` when there is no user. `resolve()` is now async.
|
|
29
|
+
|
|
30
|
+
- [#313](https://github.com/DavideCarvalho/adonis-agora-agent/pull/313) [`6479996`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/6479996ab621edce7726275b5db9878c951b7d9f) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Text channels: `@adonis-agora/agent/channels`'s `channels.handle(adapter, { actor, thread, onThreadCreated?, pageContext?, store?, … })` is a webhook route handler that verifies the request (`401` otherwise), parses it, dedupes by the provider's message id, answers `200` at once and runs the turn in the background (`handler.drain()` awaits it). The turn is sent with text-only capabilities; text decisions are answered with their reply; the reply (prose and component `fallbackText`, in order) is converted to the channel's markdown (`toChannelMarkdown`: WhatsApp, Telegram MarkdownV2, none) and split at its length limit on paragraph/line/sentence boundaries (`splitMessage`). Media (images, voice notes, video, documents) is downloaded through the adapter within the attachment store's limits, staged with the new `AgentService.stageAttachment(actor, file)` and attached to the turn; what cannot be attached is answered with `texts.mediaRefused`. A question set (`ask`, intakes) is sent as text one question at a time with numbered options, and the next messages answer it (`parseChannelAnswer`; `skip` keeps the defaults; unanswered after `questionTimeoutMs` it is skipped). A proposal the turn left pending is sent with Confirm/Cancel buttons whose press decides it (`via` = the adapter's name), or with a text instruction in the configured `actionProposalText` vocabulary; an approved proposal's outcome is relayed after the turn (`outcomeTimeoutMs`), and `actionProposalWorker: { onSettled: channels.onSettled }` relays outcomes that settle later through the adapter registered under the turn's recorded `pageContext.channel` — each outcome once. In blocking mode the handler sends what it has and says the approval must happen in the app. Built-in adapters: `evolutionApi({ url, instance, apiKey, webhookToken })` (Evolution API v2 `messages.upsert`; `sendText`, opt-in `sendButtons` with a text fallback; media from inline base64, `mediaUrl` or `getBase64FromMediaMessage`), `whatsappCloud({ phoneNumberId, accessToken, appSecret, verifyToken })` (`X-Hub-Signature-256`, `hub.challenge`, interactive reply buttons, Graph media download) and `telegram({ botToken, secretToken })` (secret-token header, MarkdownV2 with a plain-text retry, inline keyboards, `answerCallbackQuery`, `getFile`); any `ChannelAdapter` works. The channel's state (`ChannelStore`: message ids, questions in progress, relayed outcomes) defaults to `lucidChannelStore()` — the new `agent_channel_state` table, created by `createAgentTables`, the published migration or on first use — when the agent store is Lucid, else memory; `redisChannelStore(redis)` and custom stores plug in. `AgentService` also gains `actionApprovalMode()`, `actionProposalVocabulary()`, `attachmentLimits()` and `lucidDatabase()`.
|
|
31
|
+
|
|
32
|
+
## 0.62.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- [#303](https://github.com/DavideCarvalho/adonis-agora-agent/pull/303) [`ee0a5c6`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/ee0a5c66f424f22deb4e1d904c64cb5e6701ae07) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Expose registered agents to personal agents (ChatGPT, Meta AI, a user's own assistant) over A2A 1.0 HTTP+JSON, following PACT (https://openpactprotocol.org). Register `@adonis-agora/agent/a2a_provider` and add `config/a2a.ts` (`defineA2aConfig`, from `@adonis-agora/agent/a2a`).
|
|
37
|
+
|
|
38
|
+
- Per agent: an Agent Card, a synchronous `message:send`, and the task routes as PACT fixes them. Served as server middleware ahead of the router, so authentication happens before the body is read.
|
|
39
|
+
- `authKitPersonalAgents()` authenticates with `@adonis-agora/authkit-server` 0.76+ personal agents: the agent's signed JWT and, when the user delegated, the delegation token. A delegated turn runs as the user's account, with each delegated scope as a `scope:<id>` role.
|
|
40
|
+
- Conversations: `contextId` is bound to one agent and one (personal agent, user), and to the account once a delegated turn ran in it. A repeated `messageId` returns the stored reply. Conversation state lives in two tables created on first use (`store: 'lucid'`), or in memory.
|
|
41
|
+
- `action` calls that park for approval are approved when the delegation grants one of the tool's roles, and rejected otherwise (`actions: 'reject'` rejects all of them). Independent proposals (`actionApprovalMode: 'independent'`) are decided the same way once the run ends, and the turn waits for an approved one to execute before answering; the reply carries what it did as a data part (`{ action: { tool, status, summary, result } }`). Question sets are skipped.
|
|
42
|
+
- Step-up: a personal agent is offered the tools behind scopes it was not delegated but cannot run them. Calling one, or `request_permission`, makes the reply a `TASK_STATE_AUTH_REQUIRED` step-up with a consent link. `RolesPolicy` gains an optional `canOffer` (what the model is offered), separate from `can` (what runs).
|
|
43
|
+
- Replies under delegation carry a signed receipt listing the tools that ran under a delegated scope.
|
|
44
|
+
- `actor` maps the caller to the app's own actor (e.g. a profile instead of the account); turns carry `pageContext.channel = 'a2a'`.
|
|
45
|
+
- `service` plugs in an app's own runtime (an `A2aTurnService` adapter) instead of the agent provider's `AgentService`.
|
|
46
|
+
|
|
47
|
+
**Security:** the agent provider now wraps the configured authorizer with `personalAgentGate`. An actor with the `personal_agent` role reaches only tools that declare one of its roles; tools with no `roles` are out of its reach. Its memory and skill scopes resolve to none, so it never reads or writes what the assistant remembers about the user. Nothing changes for any other actor.
|
|
48
|
+
- A `config/a2a.ts` that exports `undefined` (the surface flagged off) mounts nothing and logs nothing.
|
|
49
|
+
|
|
50
|
+
- [#306](https://github.com/DavideCarvalho/adonis-agora-agent/pull/306) [`2796edd`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/2796edd4b9f998b84cbc12cea779c21cfbe22c77) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Proposal and presentation hooks, and AG-UI fidelity:
|
|
51
|
+
|
|
52
|
+
- **Text decisions are English by default** (`yes`, `confirm`, `approve`, `ok`, `no`, `cancel`, `reject`, `deny`, `always in this conversation`), and so are the replies. **Behavior change:** Portuguese commands (`sim`, `confirmar`, `cancelar`, …) and replies were the default; pass `actionProposalText: ptBrActionProposalText` to keep them. The new `actionProposalText: { vocabulary, replies }` config replaces the word lists and the reply texts for any other language. A command naming an `#ID` that is not a proposal of the thread (`sim #abc`) is now an ordinary message for the model instead of a `404`.
|
|
53
|
+
- **`actionProposalWorker.onSettled(proposal)`**: called when a proposal's execution settles, so another channel (a WhatsApp bridge) gets the outcome pushed instead of polling. A throwing listener is logged and does not fail the worker.
|
|
54
|
+
- **`onPresentationError(error, { toolName, toolCallId?, runId?, threadId? })`**: now wired for turns and proposal executions. Default: a warning on the app logger (was `console.warn`).
|
|
55
|
+
- **No genui catalog + `uiCapabilities`**: `ctx.emitUi` no longer throws. A component the client declares is drawn; any other one degrades to its `fallbackText` (or is left out when it has none).
|
|
56
|
+
- **AG-UI**: `agora.ui` carries `fallbackText` and `componentVersions`; `agora.approval-requested` carries the proposal `target` (and `confirmation`); a proposal's interrupt has `metadata['agora.target']` and resuming it decides the proposal through the proposal service (it used to hit the parked-call approve and fail with `400`).
|
|
57
|
+
- **AG-UI event rename**: the proposal-decision custom event is now `agora.action-proposal-decision`, like every other `agora.*` event. The old `aviary.action-proposal-decision` is no longer sent — move listeners to the new name.
|
|
58
|
+
- `AgentService.chat` lost an unreachable proposal-decision branch (`chat` never decides by text; `send` does).
|
|
59
|
+
|
|
60
|
+
- [#300](https://github.com/DavideCarvalho/adonis-agora-agent/pull/300) [`6db8d70`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/6db8d70189bb36ba6c4e4f77b585050da8f712d2) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Support result presentation on functional tools and `@AiTool` classes through the existing journaled UI stream. Add the inferred object form of `defineTool`, preserve raw domain results, and report presentation failures separately so successful actions are not retried because rendering failed. Export Agora-owned optional React static HTML, paginated PNG and PDF renderers and Playwright capture adapter.
|
|
61
|
+
|
|
62
|
+
Remove cross-ecosystem peers: Agora owns its GenUI contracts, React adapters, AG-UI codec, and resumable upload client. All entries build and publish independently of Aviary; compatible wire protocols remain supported.
|
|
63
|
+
|
|
64
|
+
- [#307](https://github.com/DavideCarvalho/adonis-agora-agent/pull/307) [`f3b8aa4`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/f3b8aa496d0b84f52811defd38b1f42ebcd5bf86) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Requires `@adonis-agora/durable` 0.43.3 or later (peer `>=0.43.3 <1.0.0`). Earlier versions could run one durable run twice at once in a process — a resume landing while the run was still executing — so a tool step could run twice after a very fast approval. 0.43.3 serializes a run's executions per process; the OpenCode durable engine relies on it instead of guarding its steps itself.
|
|
65
|
+
|
|
66
|
+
- [#304](https://github.com/DavideCarvalho/adonis-agora-agent/pull/304) [`5d263b0`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/5d263b0742d8f726c9a40561d2559d2032d16092) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - MCP server and OAuth, with `@adonis-agora/authkit-server`'s `mcp: true`:
|
|
67
|
+
|
|
68
|
+
- The MCP server registers its URL with AuthKit at boot, so `claude mcp add <url>` logs users in with no URL in AuthKit's config.
|
|
69
|
+
- `authKitAuth()` only accepts a token issued **for this server** (its RFC 8707 audience must be the endpoint's URL), as the MCP authorization spec requires. A token for another resource, or with no audience, is refused with `401`. **Behavior change:** clients that do not send `resource` need `authKitAuth({ audience: 'any' })`.
|
|
70
|
+
- `McpAuth.verify(token, context?)` gets `{ resource }`; `anyOf()` passes it on.
|
|
71
|
+
- Tool calls over MCP carry a `toolCallId` and an `idempotencyKey` per `tools/call` (tools that need one to write, ran refused before) and `pageContext.channel = 'mcp'`.
|
|
72
|
+
- `middleware` in `config/mcp.ts`: route middleware for the MCP endpoint (a rate limiter, say); it runs before the bearer check.
|
|
73
|
+
- `stateless: true` in `config/mcp.ts`: every `POST` gets its own transport (no in-memory sessions), for more than one instance behind a load balancer; `GET`/`DELETE` answer `405`.
|
|
74
|
+
- `actions` in `config/mcp.ts` (`'refuse'` by default, or `'execute'`): the provider never passed it to the server, so action tools could not be exposed through `config/mcp.ts`.
|
|
75
|
+
- `instructions` in `config/mcp.ts`: sent to the client in the `initialize` result.
|
|
76
|
+
- `endpoints` in `config/mcp.ts`: more MCP servers in the same app, each a protected resource of its own (path, registry, auth, sessions, RFC 9728 metadata, OAuth registration), inheriting the top-level settings.
|
|
77
|
+
- `tools/list` carries MCP `annotations` (`readOnlyHint` from the tool's kind by default); `describeTool` sets the `title` and the annotations per tool.
|
|
78
|
+
- In stateless mode, `GET`/`DELETE` authenticate first (`401` with the login challenge), then answer `405`.
|
|
79
|
+
- The RFC 9728 metadata route is named (`mcp.oauth_protected_resource`; `metadataRouteName` per endpoint).
|
|
80
|
+
- Generative-UI tools (`ui__show_*`, `ui__render` — any tool whose result is shown elsewhere) are no longer exposed over MCP: there is no screen there, and the model got nothing back.
|
|
81
|
+
|
|
82
|
+
- [#307](https://github.com/DavideCarvalho/adonis-agora-agent/pull/307) [`f3b8aa4`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/f3b8aa496d0b84f52811defd38b1f42ebcd5bf86) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Engines: `defineConfig({ engine })` runs turns on something other than the library's loop — the routes, stream protocol, store, approvals, questions and queue stay the library's. `model` is optional under an engine, and `durable: true` is refused at boot unless the engine is durable itself. `@adonis-agora/agent/opencode`'s `openCode({ host })` runs turns on OpenCode 2 sessions, and `@adonis-agora/agent/opencode/durable`'s `openCodeDurable({ host })` checkpoints each step as the `agora.agent.opencode.run` workflow (decisions are durable signals; a parked turn survives restarts and catches up on what OpenCode asked meanwhile). OpenCode's events become the native frames and store rows (steps with usage, text, reasoning, nested code-mode calls, permissions as approval cards, forms as elicitations, cancel as `session.interrupt`); the agent's prompt and persona, `approvalPolicy`, skills, memory and regenerate reach the session; the app's tools are served to it over an internal MCP endpoint (`POST <path>/opencode/mcp`: signed per-actor tokens, calls only from a session running a turn of that actor, actions only against an approval the turn granted, `remember` at the actor's scope, `ctx.emitUi` into the turn). `AgentRunInput.hostContext` (and `ChatParams.hostContext`) carries the host's own JSON about a send through the queue (new nullable `host_context` column, healed on boot; never on the wire view) and the durable journal to the engine's host hooks: `onAsk`, `onUi`, `beforeSettle` and `onSettled`. `AgentRunner.runIdFor` lets a runner name its runs; `ToolCallRequest.parentId` records a call made inside another.
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- [#306](https://github.com/DavideCarvalho/adonis-agora-agent/pull/306) [`2796edd`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/2796edd4b9f998b84cbc12cea779c21cfbe22c77) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Fixes from a docs audit:
|
|
87
|
+
|
|
88
|
+
- `@AiTool` / `static tool` classes keep their `replacementKey` (it only worked with `defineTool`).
|
|
89
|
+
- `POST <path>/chat` answers malformed `uiCapabilities` with `400 invalid_ui_capabilities` instead of a `500`.
|
|
90
|
+
- A refused proposal decision over AG-UI (text or resume) answers its status (`403`/`404`) instead of a `500`.
|
|
91
|
+
- `UiCapabilities` / `validateUiCapabilities` have one definition; both the root and `/genui` entries still export them.
|
|
92
|
+
- Corrected stale comments (`genui` needs no extra peer, the default authorizer and actor resolver are not fail-closed, the migrations `configure` publishes) and removed a committed `.orig` file.
|
|
93
|
+
|
|
3
94
|
## 0.61.0
|
|
4
95
|
|
|
5
96
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -17,6 +17,13 @@ The package is two things layered on top of each other:
|
|
|
17
17
|
`read` tools auto-execute, `action` tools gate on human approval (HITL), and `agent` tools delegate
|
|
18
18
|
to another named agent.
|
|
19
19
|
|
|
20
|
+
## Component registries and server rendering
|
|
21
|
+
|
|
22
|
+
Tools support a `present` hook in both functional and decorated class forms. Register custom components per app, share React renderers between web screens and static exports, and generate paginated PNG/PDF tables and charts for your own delivery adapters.
|
|
23
|
+
|
|
24
|
+
See the [component rendering guide](./docs/authoring/component-rendering.mdx) for complete examples, schemas, text fallbacks, and capture configuration.
|
|
25
|
+
|
|
26
|
+
|
|
20
27
|
## Install
|
|
21
28
|
|
|
22
29
|
```sh
|
|
@@ -43,7 +50,7 @@ else is an **optional peer**, imported lazily only when configured:
|
|
|
43
50
|
| `@adonis-agora/telescope` (`^0.4.0`) | the Telescope watcher extension (`@adonis-agora/agent/telescope`) |
|
|
44
51
|
| `@qdrant/js-client-rest` (`^1.11.0`) | `retrievers.qdrant({...})` |
|
|
45
52
|
| `node-sql-parser` (`^5.3.0`) | the governed `dataTool` (`@adonis-agora/agent/data`) |
|
|
46
|
-
| `react` (`^18` / `^19`)
|
|
53
|
+
| `react` (`^18` / `^19`), `@ai-sdk/react` and `ai` | `AgentProvider` / `useAgentChat` (`@adonis-agora/agent/react`) |
|
|
47
54
|
|
|
48
55
|
## Configure
|
|
49
56
|
|
|
@@ -83,7 +90,7 @@ message queue, approvals, attachments, threads), with the session cookie and shi
|
|
|
83
90
|
already wired:
|
|
84
91
|
|
|
85
92
|
```tsx
|
|
86
|
-
// npm i @
|
|
93
|
+
// npm i @ai-sdk/react ai
|
|
87
94
|
import { AgentProvider, useAgentChat } from '@adonis-agora/agent/react'
|
|
88
95
|
|
|
89
96
|
export default function ChatPage() {
|
|
@@ -109,9 +116,8 @@ function Chat() {
|
|
|
109
116
|
}
|
|
110
117
|
```
|
|
111
118
|
|
|
112
|
-
The hooks
|
|
113
|
-
|
|
114
|
-
so one React client serves both. Without React, the framework-free stream client:
|
|
119
|
+
The hooks ship inside Agora. Its protocol remains compatible with Aviary, but installation and
|
|
120
|
+
releases are independent. Without React, use the framework-free stream client:
|
|
115
121
|
|
|
116
122
|
```ts
|
|
117
123
|
import { createAgentChatClient } from '@adonis-agora/agent/client'
|
|
@@ -204,8 +210,7 @@ blocked tool result is withheld and the turn goes on; a blocked answer or tool c
|
|
|
204
210
|
`OutputRejectedError`. `guardrails.wrapTool(name, handler)` restores placeholders into a tool's
|
|
205
211
|
arguments and runs the `tool_args` rules on them. The output processor declares `incremental`, so the
|
|
206
212
|
answer keeps streaming. The detectors (`detectPii` with Luhn/CPF/CNPJ/IBAN checks, `detectSecrets`,
|
|
207
|
-
`scoreInjection`, `scoreToolText`) and `scan` work on their own.
|
|
208
|
-
`@dudousxd/nestjs-agent-core/guardrails`, which also carries the raw OpenAI/Anthropic stream guard.
|
|
213
|
+
`scoreInjection`, `scoreToolText`) and `scan` work on their own. The guardrail implementation ships locally in Agora; it does not require an Aviary core package.
|
|
209
214
|
|
|
210
215
|
### Framework-agnostic core (no AdonisJS)
|
|
211
216
|
|
package/dist/configure.d.ts
CHANGED
|
@@ -13,11 +13,13 @@ import type Configure from '@adonisjs/core/commands/configure';
|
|
|
13
13
|
* runtime scan when the barrel is absent);
|
|
14
14
|
* 4. publishes `config/agent.ts`;
|
|
15
15
|
* 5. publishes `config/mcp.ts` (the MCP endpoint config; the MCP provider is separate);
|
|
16
|
-
* 6. publishes the Lucid
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* 6. publishes the Lucid migrations for the agent tables — the base tables plus the two forward-only
|
|
17
|
+
* action-proposal upgrades (run `node ace migration:run`; delete them if you only use the
|
|
18
|
+
* in-memory store). They delegate to `createAgentTables`, so they are idempotent and safe to run
|
|
19
|
+
* against a database the library already auto-created;
|
|
20
|
+
* 7. publishes the Postgres migrations for the RAG chunk table (pgvector; delete it unless you use
|
|
21
|
+
* `retrievers.pgvector({...})`) and the document-tree tables (delete it unless you use
|
|
22
|
+
* `PgDocumentTreeStore`).
|
|
21
23
|
*/
|
|
22
24
|
export declare function configure(command: Configure): Promise<void>;
|
|
23
25
|
//# sourceMappingURL=configure.d.ts.map
|
package/dist/configure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mCAAmC,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mCAAmC,CAAC;AAG/D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,iBAyBjD"}
|
package/dist/configure.js
CHANGED
|
@@ -13,11 +13,13 @@ import { stubsRoot } from './stubs/main.js';
|
|
|
13
13
|
* runtime scan when the barrel is absent);
|
|
14
14
|
* 4. publishes `config/agent.ts`;
|
|
15
15
|
* 5. publishes `config/mcp.ts` (the MCP endpoint config; the MCP provider is separate);
|
|
16
|
-
* 6. publishes the Lucid
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* 6. publishes the Lucid migrations for the agent tables — the base tables plus the two forward-only
|
|
17
|
+
* action-proposal upgrades (run `node ace migration:run`; delete them if you only use the
|
|
18
|
+
* in-memory store). They delegate to `createAgentTables`, so they are idempotent and safe to run
|
|
19
|
+
* against a database the library already auto-created;
|
|
20
|
+
* 7. publishes the Postgres migrations for the RAG chunk table (pgvector; delete it unless you use
|
|
21
|
+
* `retrievers.pgvector({...})`) and the document-tree tables (delete it unless you use
|
|
22
|
+
* `PgDocumentTreeStore`).
|
|
21
23
|
*/
|
|
22
24
|
export async function configure(command) {
|
|
23
25
|
const codemods = await command.createCodemods();
|
package/dist/configure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAkB;IAChD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;IAEhD,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,WAAW,CAAC,oCAAoC,CAAC,CAAC;QACzD,MAAM,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;QAC7D,mGAAmG;QACnG,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACjE,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAC/D,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,8CAA8C,EAAE,EAAE,CAAC,CAAC;IAC5F,MAAM,QAAQ,CAAC,aAAa,CAC1B,SAAS,EACT,wDAAwD,EACxD,EAAE,CACH,CAAC;IACF,MAAM,QAAQ,CAAC,aAAa,CAC1B,SAAS,EACT,sDAAsD,EACtD,EAAE,CACH,CAAC;IACF,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,kDAAkD,EAAE,EAAE,CAAC,CAAC;IAChG,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,iDAAiD,EAAE,EAAE,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ApplicationService } from '@adonisjs/core/types';
|
|
2
|
+
export default class A2aProvider {
|
|
3
|
+
#private;
|
|
4
|
+
protected app: ApplicationService;
|
|
5
|
+
constructor(app: ApplicationService);
|
|
6
|
+
boot(): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Register `request_permission` in every process — a queue or durable worker that replays a turn
|
|
9
|
+
* which called it needs the tool as much as the web process that started it.
|
|
10
|
+
*/
|
|
11
|
+
ready(): Promise<void>;
|
|
12
|
+
shutdown(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=a2a_provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a2a_provider.d.ts","sourceRoot":"","sources":["../../providers/a2a_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAyC/D,MAAM,CAAC,OAAO,OAAO,WAAW;;IAClB,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAA7C,YAAsB,GAAG,EAAE,kBAAkB,EAAI;IAE3C,IAAI,kBA2BT;IAED;;;OAGG;IACG,KAAK,kBASV;IAEK,QAAQ,kBAEb;CAiEF"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { resolveA2aAuth } from '../src/a2a/auth.js';
|
|
2
|
+
import { createA2aHandler } from '../src/a2a/handler.js';
|
|
3
|
+
import { registerRequestPermissionTool } from '../src/a2a/permission-tool.js';
|
|
4
|
+
import { setA2aHandler } from '../src/a2a/runtime.js';
|
|
5
|
+
import { ensureA2aTables, InMemoryA2aStore, LucidA2aStore, } from '../src/a2a/store.js';
|
|
6
|
+
import { AgentService } from '../src/agent-service.js';
|
|
7
|
+
import { ToolRegistry } from '../src/tool-registry.js';
|
|
8
|
+
/**
|
|
9
|
+
* Exposes registered agents to personal agents over A2A 1.0 (HTTP+JSON) — the transport of PACT.
|
|
10
|
+
* Reads `config/a2a.ts` and answers, for each configured agent:
|
|
11
|
+
*
|
|
12
|
+
* - `GET /{path}/{agent}/.well-known/agent-card.json` — the Agent Card (public).
|
|
13
|
+
* - `POST /{path}/{agent}/message:send` — a synchronous turn (identity, and delegation when sent).
|
|
14
|
+
* - `GET /{path}/{agent}/tasks`, `GET …/tasks/{id}`, `POST …/tasks/{id}:cancel` — as PACT §2.2 fixes.
|
|
15
|
+
*
|
|
16
|
+
* Mounted as SERVER middleware, ahead of the router: A2A requests never reach the bodyparser,
|
|
17
|
+
* session or CSRF (see `src/a2a/server_middleware.ts`). Everything is resolved on the first A2A
|
|
18
|
+
* request, so this provider can sit anywhere in `adonisrc.ts`.
|
|
19
|
+
*/
|
|
20
|
+
function normalizePath(path) {
|
|
21
|
+
return (path ?? 'a2a').replace(/^\/+|\/+$/g, '');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The A2A config, or `undefined` when the surface is off. A `config/a2a.ts` whose default export
|
|
25
|
+
* is `undefined` (feature-flagged off) reaches the config store as its module namespace
|
|
26
|
+
* (`{ default: undefined }`), not as `undefined`.
|
|
27
|
+
*/
|
|
28
|
+
function a2aConfigOf(app) {
|
|
29
|
+
const config = app.config.get('a2a', undefined);
|
|
30
|
+
return config && typeof config === 'object' && config.agents && config.auth ? config : undefined;
|
|
31
|
+
}
|
|
32
|
+
export default class A2aProvider {
|
|
33
|
+
app;
|
|
34
|
+
constructor(app) {
|
|
35
|
+
this.app = app;
|
|
36
|
+
}
|
|
37
|
+
async boot() {
|
|
38
|
+
const config = a2aConfigOf(this.app);
|
|
39
|
+
if (!config)
|
|
40
|
+
return;
|
|
41
|
+
const server = await this.app.container.make('server');
|
|
42
|
+
server.use([() => import('../src/a2a/server_middleware.js')]);
|
|
43
|
+
// Only A2A traffic ever touches the A2A runtime: a broken auth driver or database must not
|
|
44
|
+
// turn every route of the app into a 500.
|
|
45
|
+
const prefix = `/${normalizePath(config.path)}/`;
|
|
46
|
+
const isA2a = (url) => url.startsWith(prefix) ||
|
|
47
|
+
(config.rootCard !== undefined && url === '/.well-known/agent-card.json');
|
|
48
|
+
// Built on the first A2A request: the agent provider binds `AgentService` in its own boot, and
|
|
49
|
+
// the auth driver may need a fully booted app. A failed build is retried on the next one.
|
|
50
|
+
let built = null;
|
|
51
|
+
setA2aHandler(async (ctx) => {
|
|
52
|
+
if (!isA2a((ctx.request.url() ?? '').split('?')[0] ?? ''))
|
|
53
|
+
return false;
|
|
54
|
+
if (built === null) {
|
|
55
|
+
built = this.#build(config);
|
|
56
|
+
built.catch(() => {
|
|
57
|
+
built = null;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return (await built)(ctx);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Register `request_permission` in every process — a queue or durable worker that replays a turn
|
|
65
|
+
* which called it needs the tool as much as the web process that started it.
|
|
66
|
+
*/
|
|
67
|
+
async ready() {
|
|
68
|
+
const config = a2aConfigOf(this.app);
|
|
69
|
+
if (!config)
|
|
70
|
+
return;
|
|
71
|
+
try {
|
|
72
|
+
await this.#registerPermissionTool(config);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const logger = await this.app.container.make('logger');
|
|
76
|
+
logger.warn({ err: error }, 'a2a: could not register request_permission yet');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async shutdown() {
|
|
80
|
+
setA2aHandler(null);
|
|
81
|
+
}
|
|
82
|
+
#permissionToolRegistered = false;
|
|
83
|
+
async #registerPermissionTool(config) {
|
|
84
|
+
// With its own runtime the app registers `request_permission` where ITS tools live
|
|
85
|
+
// (`registerRequestPermissionTool`) — the shared registry may be another surface's.
|
|
86
|
+
if (this.#permissionToolRegistered || config.service !== undefined)
|
|
87
|
+
return;
|
|
88
|
+
const auth = await resolveA2aAuth(config.auth, { app: this.app });
|
|
89
|
+
const scopes = await auth.delegableScopes();
|
|
90
|
+
if (Object.keys(scopes).length > 0) {
|
|
91
|
+
registerRequestPermissionTool(await this.app.container.make(ToolRegistry), scopes);
|
|
92
|
+
}
|
|
93
|
+
this.#permissionToolRegistered = true;
|
|
94
|
+
}
|
|
95
|
+
async #build(config) {
|
|
96
|
+
const registry = await this.app.container.make(ToolRegistry);
|
|
97
|
+
const service = config.service === undefined
|
|
98
|
+
? await this.app.container.make(AgentService)
|
|
99
|
+
: typeof config.service === 'function'
|
|
100
|
+
? await config.service({ app: this.app })
|
|
101
|
+
: config.service;
|
|
102
|
+
const auth = await resolveA2aAuth(config.auth, { app: this.app });
|
|
103
|
+
await this.#registerPermissionTool(config);
|
|
104
|
+
const brands = new Map(Object.entries(config.agents).map(([id, agent]) => [
|
|
105
|
+
id,
|
|
106
|
+
{ id, agentName: agent.agent ?? id, card: agent.card },
|
|
107
|
+
]));
|
|
108
|
+
return createA2aHandler({
|
|
109
|
+
path: normalizePath(config.path),
|
|
110
|
+
...(config.baseUrl !== undefined ? { baseUrl: config.baseUrl } : {}),
|
|
111
|
+
brands,
|
|
112
|
+
...(config.rootCard !== undefined ? { rootCardBrand: config.rootCard } : {}),
|
|
113
|
+
auth,
|
|
114
|
+
store: await this.#store(config),
|
|
115
|
+
service,
|
|
116
|
+
registry,
|
|
117
|
+
actions: config.actions ?? 'approve-delegated',
|
|
118
|
+
timeoutMs: config.timeoutMs ?? 120_000,
|
|
119
|
+
maxBodyBytes: config.maxBodyBytes ?? 1024 * 1024,
|
|
120
|
+
...(config.roles !== undefined ? { roles: config.roles } : {}),
|
|
121
|
+
...(config.actor !== undefined ? { actor: config.actor } : {}),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async #store(config) {
|
|
125
|
+
const store = config.store ?? 'lucid';
|
|
126
|
+
if (typeof store === 'object')
|
|
127
|
+
return store;
|
|
128
|
+
if (store === 'memory')
|
|
129
|
+
return new InMemoryA2aStore();
|
|
130
|
+
const db = (await this.app.container.make('lucid.db'));
|
|
131
|
+
const connection = db.connection(config.connection);
|
|
132
|
+
await ensureA2aTables(connection);
|
|
133
|
+
return new LucidA2aStore(connection);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=a2a_provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a2a_provider.js","sourceRoot":"","sources":["../../providers/a2a_provider.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_provider.d.ts","sourceRoot":"","sources":["../../providers/agent_provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent_provider.d.ts","sourceRoot":"","sources":["../../providers/agent_provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAoM/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;;IAWpB,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAA7C,YAAsB,GAAG,EAAE,kBAAkB,EAAI;IAEjD,QAAQ,SAcP;IAEK,IAAI,kBA+PT;IAED;;;;;;;;;;;;;;OAcG;IACG,KAAK,kBAiBV;IAEK,QAAQ,kBAcb;CAooDF"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { pathToFileURL } from 'node:url';
|
|
2
|
+
import { personalAgentGate, personalAgentScopes } from '../src/a2a/gate.js';
|
|
2
3
|
import { assertIndependentActionRuntime } from '../src/action-proposal-runtime.js';
|
|
3
4
|
import { ActionProposalService, ActionProposalServiceError, } from '../src/action-proposal-service.js';
|
|
4
5
|
import { validateActionProposalListQuery } from '../src/action-proposal-transitions.js';
|
|
6
|
+
import { DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, } from '../src/attachment-limits.js';
|
|
7
|
+
import { assertRunnable, engineOnlyModel } from '../src/engine.js';
|
|
5
8
|
import { ActionProposalExecutor, ActionProposalWorker, AgentDepsFactory, AgentGenui, AgentRegistry, AgentService, AgentSseEncoder, ALL_AGENTS, AnonymousActorResolver, AttachmentInventoryError, AttachmentRefusedError, ChatQueueError, ChatQueueService, DefaultToolAuthorizer, discoverTools, evaluateGovernanceGate, evaluateOwnership, governanceQueries as governanceQueriesFactories, HumanReplyMismatchError, InlineAgentRunner, InProcessTokenStreamSink, isQuotaProvider, LedgerQuotaProvider, lucidStoreConnection, ModelNotAllowedError, memoryForgetVerdict, offerMemories, offerSkills, PersonaNotFoundError, parseStreamCursor, pricingStores, QuotaBlockedError, REQUESTER_APPROVER, RegenerateNeedsThreadError, RunNotActiveError, registerDelegateTools, registerFunctionalTool, registerToolsFromBarrel, resolveActorResolver, resolvePersonaAlias, ToolRegistry, toApprovalPolicy, toModelCatalog, UnknownAgentError, withActorLabel, withActorLabels, } from '../src/index.js';
|
|
6
9
|
import { McpToolImporter } from '../src/mcp-client/index.js';
|
|
7
10
|
import { setTelescopeGovernanceQueries } from '../src/telescope/governance-registry.js';
|
|
@@ -77,18 +80,6 @@ function attachmentRefs(claimed) {
|
|
|
77
80
|
}
|
|
78
81
|
return refs;
|
|
79
82
|
}
|
|
80
|
-
/** Default per-file size cap when the attachment store declares none (20 MiB). */
|
|
81
|
-
const DEFAULT_MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
82
|
-
/** Default allowlist: what multimodal model providers commonly accept as native image/file parts. */
|
|
83
|
-
const DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES = [
|
|
84
|
-
'image/png',
|
|
85
|
-
'image/jpeg',
|
|
86
|
-
'image/gif',
|
|
87
|
-
'image/webp',
|
|
88
|
-
'application/pdf',
|
|
89
|
-
'text/plain',
|
|
90
|
-
'text/csv',
|
|
91
|
-
];
|
|
92
83
|
/**
|
|
93
84
|
* Wires `@adonis-agora/agent` into the AdonisJS application from `config/agent.ts`:
|
|
94
85
|
*
|
|
@@ -122,6 +113,8 @@ export default class AgentProvider {
|
|
|
122
113
|
#mcpTools = null;
|
|
123
114
|
/** Whatever was built at boot that may own a schema: the store, the pricing store, the read-model. */
|
|
124
115
|
#schemaOwners = [];
|
|
116
|
+
/** The engine running the turns instead of the loop (`engine` in the config), when there is one. */
|
|
117
|
+
#engine;
|
|
125
118
|
constructor(app) {
|
|
126
119
|
this.app = app;
|
|
127
120
|
}
|
|
@@ -195,7 +188,14 @@ export default class AgentProvider {
|
|
|
195
188
|
this.app.container.bindValue(AgentGenui, new AgentGenui(setup.catalog, setup.resolveCatalog));
|
|
196
189
|
}
|
|
197
190
|
// ── Runtime graph ──
|
|
198
|
-
|
|
191
|
+
// An engine (`engine` in the config) runs the turns instead of the loop: `model` is optional
|
|
192
|
+
// then, and `durable: true` (the LOOP's durable runner) is refused unless the engine is durable.
|
|
193
|
+
const engine = typeof config.engine === 'function' ? await config.engine() : config.engine;
|
|
194
|
+
assertRunnable({ model: config.model, engine, durable: config.durable });
|
|
195
|
+
this.#engine = engine;
|
|
196
|
+
const model = config.model === undefined && engine !== undefined
|
|
197
|
+
? engineOnlyModel(engine)
|
|
198
|
+
: await this.#resolveModel(config);
|
|
199
199
|
const store = await this.#resolveStore(config);
|
|
200
200
|
const sink = await this.#resolveSink(config);
|
|
201
201
|
// One budget: `{ limits }` over the usage ledger, or a `QuotaProvider` of your own — reported by
|
|
@@ -230,7 +230,9 @@ export default class AgentProvider {
|
|
|
230
230
|
this.#sink = sink;
|
|
231
231
|
this.#actorDirectory = actorDirectory;
|
|
232
232
|
this.#schemaOwners = [store, pricingStore, governance, sink];
|
|
233
|
+
const onPresentationError = config.onPresentationError ?? (await this.#logPresentationErrors());
|
|
233
234
|
const factory = new AgentDepsFactory({
|
|
235
|
+
...(onPresentationError !== undefined ? { onPresentationError } : {}),
|
|
234
236
|
model,
|
|
235
237
|
store,
|
|
236
238
|
sink,
|
|
@@ -253,8 +255,13 @@ export default class AgentProvider {
|
|
|
253
255
|
? { toolTransientRetry: config.toolTransientRetry }
|
|
254
256
|
: {}),
|
|
255
257
|
...(config.historyWindow !== undefined ? { historyWindow: config.historyWindow } : {}),
|
|
256
|
-
|
|
257
|
-
...(config.
|
|
258
|
+
// Personal agents (A2A) resolve no memory or skill scope — see `personalAgentScopes`.
|
|
259
|
+
...(config.skills !== undefined
|
|
260
|
+
? { skills: { ...config.skills, scopes: personalAgentScopes(config.skills.scopes) } }
|
|
261
|
+
: {}),
|
|
262
|
+
...(config.memory !== undefined
|
|
263
|
+
? { memory: { ...config.memory, scopes: personalAgentScopes(config.memory.scopes) } }
|
|
264
|
+
: {}),
|
|
258
265
|
...(config.inputProcessors !== undefined ? { inputProcessors: config.inputProcessors } : {}),
|
|
259
266
|
...(config.outputProcessors !== undefined
|
|
260
267
|
? { outputProcessors: config.outputProcessors }
|
|
@@ -292,6 +299,7 @@ export default class AgentProvider {
|
|
|
292
299
|
return {
|
|
293
300
|
registry: deps.registry,
|
|
294
301
|
rolesPolicy: deps.rolesPolicy,
|
|
302
|
+
...(onPresentationError !== undefined ? { onPresentationError } : {}),
|
|
295
303
|
...(resolveUiCatalog !== undefined ? { resolveUiCatalog } : {}),
|
|
296
304
|
...(persona !== undefined ? { persona } : {}),
|
|
297
305
|
...(allowedTools !== undefined ? { allowedTools } : {}),
|
|
@@ -308,17 +316,29 @@ export default class AgentProvider {
|
|
|
308
316
|
}
|
|
309
317
|
if (this.#actionProposalWorker)
|
|
310
318
|
this.app.container.bindValue(ActionProposalWorker, this.#actionProposalWorker);
|
|
311
|
-
const runner =
|
|
312
|
-
?
|
|
313
|
-
|
|
314
|
-
|
|
319
|
+
const runner = engine !== undefined
|
|
320
|
+
? await engine.createRunner({
|
|
321
|
+
factory,
|
|
322
|
+
store,
|
|
323
|
+
sink,
|
|
324
|
+
registry,
|
|
325
|
+
queue,
|
|
326
|
+
make: (binding) => this.app.container.make(binding),
|
|
327
|
+
...this.#appKey(),
|
|
328
|
+
})
|
|
329
|
+
: config.durable === true
|
|
330
|
+
? ((await this.#resolveDurableRunner(factory, store, queue, sink)) ??
|
|
331
|
+
new InlineAgentRunner(factory, store, queue))
|
|
332
|
+
: new InlineAgentRunner(factory, store, queue);
|
|
315
333
|
const service = new AgentService(runner, store, factory, {
|
|
316
334
|
queue,
|
|
317
335
|
...(config.backgroundActorResolver !== undefined
|
|
318
336
|
? { backgroundActorResolver: config.backgroundActorResolver }
|
|
319
337
|
: {}),
|
|
320
338
|
...(config.actionApprovalMode === 'independent'
|
|
321
|
-
? {
|
|
339
|
+
? {
|
|
340
|
+
actionProposals: new ActionProposalService(store, factory.forAgent().approvalPolicy, config.actionProposalText),
|
|
341
|
+
}
|
|
322
342
|
: {}),
|
|
323
343
|
// No `models` → the catalog the model provider carries (`aiSdkModels`), else none.
|
|
324
344
|
...(config.models !== undefined
|
|
@@ -368,6 +388,8 @@ export default class AgentProvider {
|
|
|
368
388
|
this.#actionProposalWorker?.start();
|
|
369
389
|
}
|
|
370
390
|
async shutdown() {
|
|
391
|
+
await this.#engine?.shutdown?.();
|
|
392
|
+
this.#engine = undefined;
|
|
371
393
|
await this.#actionProposalWorker?.stop();
|
|
372
394
|
this.#actionProposalWorker = null;
|
|
373
395
|
// The Lucid store shares the app's `db` (it owns no connection to close); the in-process sink
|
|
@@ -399,6 +421,14 @@ export default class AgentProvider {
|
|
|
399
421
|
await importer.start();
|
|
400
422
|
}
|
|
401
423
|
// ── resolution helpers ────────────────────────────────────────────────────
|
|
424
|
+
/** The app's `APP_KEY` (a `Secret` in `config/app.ts`), for an engine that signs something. */
|
|
425
|
+
#appKey() {
|
|
426
|
+
const raw = this.app.config.get('app.appKey', undefined);
|
|
427
|
+
const released = typeof raw?.release === 'function'
|
|
428
|
+
? raw.release()
|
|
429
|
+
: raw;
|
|
430
|
+
return typeof released === 'string' && released.length > 0 ? { appKey: released } : {};
|
|
431
|
+
}
|
|
402
432
|
async #resolveModel(config) {
|
|
403
433
|
const model = config.model;
|
|
404
434
|
if (typeof model === 'function') {
|
|
@@ -493,7 +523,9 @@ export default class AgentProvider {
|
|
|
493
523
|
return typeof staging === 'function' ? staging({ app: this.app, agentStore }) : staging;
|
|
494
524
|
}
|
|
495
525
|
#resolveAuthorizer(config, defaultRoles) {
|
|
496
|
-
|
|
526
|
+
// Whatever the app configured, personal agents (A2A) reach only tools that name them — see
|
|
527
|
+
// `personalAgentGate`. A no-op for every other actor.
|
|
528
|
+
return personalAgentGate(config.authorizer ??
|
|
497
529
|
config.rolesPolicy ??
|
|
498
530
|
new DefaultToolAuthorizer(defaultRoles, { emptyRoles: config.emptyRoles ?? 'allow' }));
|
|
499
531
|
}
|
|
@@ -586,6 +618,17 @@ export default class AgentProvider {
|
|
|
586
618
|
if (mode === null) {
|
|
587
619
|
return ctx.response.badRequest({ message: "mode must be 'auto', 'queue' or 'interrupt'" });
|
|
588
620
|
}
|
|
621
|
+
let uiCapabilities;
|
|
622
|
+
try {
|
|
623
|
+
if (body.uiCapabilities !== undefined)
|
|
624
|
+
uiCapabilities = validateUiCapabilities(body.uiCapabilities);
|
|
625
|
+
}
|
|
626
|
+
catch {
|
|
627
|
+
return ctx.response.badRequest({
|
|
628
|
+
message: 'uiCapabilities must be valid UI capabilities',
|
|
629
|
+
code: 'invalid_ui_capabilities',
|
|
630
|
+
});
|
|
631
|
+
}
|
|
589
632
|
let started;
|
|
590
633
|
try {
|
|
591
634
|
started = await service.send({
|
|
@@ -602,9 +645,7 @@ export default class AgentProvider {
|
|
|
602
645
|
? { personaId: body.persona }
|
|
603
646
|
: {}),
|
|
604
647
|
...(body.pageContext !== undefined ? { pageContext: body.pageContext } : {}),
|
|
605
|
-
...(
|
|
606
|
-
? { uiCapabilities: validateUiCapabilities(body.uiCapabilities) }
|
|
607
|
-
: {}),
|
|
648
|
+
...(uiCapabilities !== undefined ? { uiCapabilities } : {}),
|
|
608
649
|
...(refs.length > 0 ? { attachments: refs } : {}),
|
|
609
650
|
});
|
|
610
651
|
}
|
|
@@ -683,7 +724,9 @@ export default class AgentProvider {
|
|
|
683
724
|
// 3b. Protocol adapters (`adapters` in the config): other wire protocols over the same runs —
|
|
684
725
|
// e.g. `agUiAdapter()` mounts `POST <path>/ag-ui`. Each gets the checks these routes use, so an
|
|
685
726
|
// adapter cannot be more permissive than the native routes by forgetting one.
|
|
686
|
-
|
|
727
|
+
// An engine's own routes (the MCP endpoint OpenCode reaches the app's tools through) mount the
|
|
728
|
+
// same way, after the configured adapters.
|
|
729
|
+
for (const adapter of [...(config.adapters ?? []), ...(this.#engine?.adapters?.() ?? [])]) {
|
|
687
730
|
await adapter.mount({
|
|
688
731
|
service,
|
|
689
732
|
defaultAgentName,
|
|
@@ -1771,6 +1814,15 @@ export default class AgentProvider {
|
|
|
1771
1814
|
const owner = await service.threadOwner(threadId);
|
|
1772
1815
|
return this.#assertOwner(ctx, actor, owner, 'thread', governanceAuthorize);
|
|
1773
1816
|
}
|
|
1817
|
+
/** The default `onPresentationError`: a warning on the app's logger (none bound → `undefined`). */
|
|
1818
|
+
async #logPresentationErrors() {
|
|
1819
|
+
if (!this.app.container.hasBinding('logger'))
|
|
1820
|
+
return undefined;
|
|
1821
|
+
const logger = await this.app.container.make('logger');
|
|
1822
|
+
return (error, details) => {
|
|
1823
|
+
logger.warn({ err: error, ...details }, 'Tool presentation failed after successful execution');
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1774
1826
|
#conflictOnMismatch(ctx, error) {
|
|
1775
1827
|
// The run the decision was for has ended: nothing is waiting for it (`409 run_not_active`).
|
|
1776
1828
|
if (error instanceof RunNotActiveError) {
|
|
@@ -1787,6 +1839,10 @@ export default class AgentProvider {
|
|
|
1787
1839
|
* `POST <path>/chat` does. `false` for an error that is none of those (the caller rethrows).
|
|
1788
1840
|
*/
|
|
1789
1841
|
#refuseSend(ctx, error) {
|
|
1842
|
+
if (error instanceof ActionProposalServiceError) {
|
|
1843
|
+
ctx.response.status(error.status).json({ message: error.message });
|
|
1844
|
+
return true;
|
|
1845
|
+
}
|
|
1790
1846
|
if (error instanceof AttachmentRefusedError) {
|
|
1791
1847
|
ctx.response.status(error.status).json({ message: error.message });
|
|
1792
1848
|
return true;
|