aec-agent 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-core.d.ts +123 -3
- package/dist/agent-core.d.ts.map +1 -1
- package/dist/agent-core.js +219 -23
- package/dist/agent-core.js.map +1 -1
- package/dist/components/artifact-hub/artifact-hub.d.ts +11 -1
- package/dist/components/artifact-hub/artifact-hub.d.ts.map +1 -1
- package/dist/components/artifact-hub/artifact-hub.js +21 -1
- package/dist/components/artifact-hub/artifact-hub.js.map +1 -1
- package/dist/components/channel-platform-hub/adapter-kit.d.ts +51 -0
- package/dist/components/channel-platform-hub/adapter-kit.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/adapter-kit.js +153 -0
- package/dist/components/channel-platform-hub/adapter-kit.js.map +1 -0
- package/dist/components/channel-platform-hub/channel-platform-hub.d.ts +34 -0
- package/dist/components/channel-platform-hub/channel-platform-hub.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/channel-platform-hub.js +52 -0
- package/dist/components/channel-platform-hub/channel-platform-hub.js.map +1 -0
- package/dist/components/channel-platform-hub/discord/discord-adapter.d.ts +57 -0
- package/dist/components/channel-platform-hub/discord/discord-adapter.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/discord/discord-adapter.js +412 -0
- package/dist/components/channel-platform-hub/discord/discord-adapter.js.map +1 -0
- package/dist/components/channel-platform-hub/slack/slack-adapter.d.ts +56 -0
- package/dist/components/channel-platform-hub/slack/slack-adapter.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/slack/slack-adapter.js +349 -0
- package/dist/components/channel-platform-hub/slack/slack-adapter.js.map +1 -0
- package/dist/components/channel-platform-hub/slack/slack-mrkdwn.d.ts +3 -0
- package/dist/components/channel-platform-hub/slack/slack-mrkdwn.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/slack/slack-mrkdwn.js +70 -0
- package/dist/components/channel-platform-hub/slack/slack-mrkdwn.js.map +1 -0
- package/dist/components/channel-platform-hub/teams/teams-adapter.d.ts +51 -0
- package/dist/components/channel-platform-hub/teams/teams-adapter.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/teams/teams-adapter.js +333 -0
- package/dist/components/channel-platform-hub/teams/teams-adapter.js.map +1 -0
- package/dist/components/channel-platform-hub/telegram/telegram-adapter.d.ts +46 -0
- package/dist/components/channel-platform-hub/telegram/telegram-adapter.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/telegram/telegram-adapter.js +304 -0
- package/dist/components/channel-platform-hub/telegram/telegram-adapter.js.map +1 -0
- package/dist/components/channel-platform-hub/telegram/telegram-markdown.d.ts +3 -0
- package/dist/components/channel-platform-hub/telegram/telegram-markdown.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/telegram/telegram-markdown.js +87 -0
- package/dist/components/channel-platform-hub/telegram/telegram-markdown.js.map +1 -0
- package/dist/components/channel-platform-hub/types.d.ts +290 -0
- package/dist/components/channel-platform-hub/types.d.ts.map +1 -0
- package/dist/components/channel-platform-hub/types.js +23 -0
- package/dist/components/channel-platform-hub/types.js.map +1 -0
- package/dist/components/event-handler/event-dispatcher.d.ts +28 -3
- package/dist/components/event-handler/event-dispatcher.d.ts.map +1 -1
- package/dist/components/event-handler/event-dispatcher.js +77 -13
- package/dist/components/event-handler/event-dispatcher.js.map +1 -1
- package/dist/components/event-handler/events.d.ts +316 -15
- package/dist/components/event-handler/events.d.ts.map +1 -1
- package/dist/components/event-handler/events.js +94 -2
- package/dist/components/event-handler/events.js.map +1 -1
- package/dist/components/event-handler/types.d.ts +26 -0
- package/dist/components/event-handler/types.d.ts.map +1 -1
- package/dist/components/group-hub/group-hub.d.ts +117 -0
- package/dist/components/group-hub/group-hub.d.ts.map +1 -0
- package/dist/components/group-hub/group-hub.js +334 -0
- package/dist/components/group-hub/group-hub.js.map +1 -0
- package/dist/components/group-hub/group-turns.d.ts +109 -0
- package/dist/components/group-hub/group-turns.d.ts.map +1 -0
- package/dist/components/group-hub/group-turns.js +834 -0
- package/dist/components/group-hub/group-turns.js.map +1 -0
- package/dist/components/group-hub/member-prompt.d.ts +28 -0
- package/dist/components/group-hub/member-prompt.d.ts.map +1 -0
- package/dist/components/group-hub/member-prompt.js +111 -0
- package/dist/components/group-hub/member-prompt.js.map +1 -0
- package/dist/components/group-hub/recipients.d.ts +10 -0
- package/dist/components/group-hub/recipients.d.ts.map +1 -0
- package/dist/components/group-hub/recipients.js +83 -0
- package/dist/components/group-hub/recipients.js.map +1 -0
- package/dist/components/group-hub/thread.d.ts +57 -0
- package/dist/components/group-hub/thread.d.ts.map +1 -0
- package/dist/components/group-hub/thread.js +126 -0
- package/dist/components/group-hub/thread.js.map +1 -0
- package/dist/components/group-hub/types.d.ts +277 -0
- package/dist/components/group-hub/types.d.ts.map +1 -0
- package/dist/components/group-hub/types.js +51 -0
- package/dist/components/group-hub/types.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/anthropic-provider.d.ts.map +1 -1
- package/dist/components/llm-provider-hub/providers/anthropic-provider.js +22 -2
- package/dist/components/llm-provider-hub/providers/anthropic-provider.js.map +1 -1
- package/dist/components/llm-provider-hub/providers/bedrock-provider.d.ts.map +1 -1
- package/dist/components/llm-provider-hub/providers/bedrock-provider.js +15 -3
- package/dist/components/llm-provider-hub/providers/bedrock-provider.js.map +1 -1
- package/dist/components/llm-provider-hub/providers/model-info-mappers.d.ts.map +1 -1
- package/dist/components/llm-provider-hub/providers/model-info-mappers.js +27 -0
- package/dist/components/llm-provider-hub/providers/model-info-mappers.js.map +1 -1
- package/dist/components/llm-provider-hub/providers/openai-compatible-provider.d.ts.map +1 -1
- package/dist/components/llm-provider-hub/providers/openai-compatible-provider.js +10 -3
- package/dist/components/llm-provider-hub/providers/openai-compatible-provider.js.map +1 -1
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.d.ts +1 -0
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.d.ts.map +1 -1
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.js +35 -3
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.js.map +1 -1
- package/dist/components/llm-provider-hub/types.d.ts +20 -0
- package/dist/components/llm-provider-hub/types.d.ts.map +1 -1
- package/dist/components/llm-provider-hub/types.js +5 -0
- package/dist/components/llm-provider-hub/types.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.d.ts +87 -8
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.js +465 -62
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.d.ts +14 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.js +25 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.d.ts +14 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.js +14 -22
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.d.ts +41 -3
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.js +152 -44
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.d.ts +15 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.js +35 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.d.ts +10 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.js +39 -6
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.types.d.ts +2 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.types.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/context-usage.d.ts +47 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/context-usage.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/context-usage.js +61 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/context-usage.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.d.ts +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.js +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.d.ts +131 -8
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.js +17 -1
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent.d.ts +101 -15
- package/dist/components/multi-agent-orchestration/agent/agent.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/agent.js +415 -44
- package/dist/components/multi-agent-orchestration/agent/agent.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.d.ts +245 -1
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.js +1583 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-prompts.d.ts +76 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-prompts.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-prompts.js +236 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-prompts.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/text.d.ts +15 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/text.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/text.js +80 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/text.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-stream.d.ts +13 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-stream.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-stream.js +41 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-stream.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-view.d.ts +69 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-view.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-view.js +210 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/turn-view.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/types.d.ts +76 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/types.js +7 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/built-in-commands.d.ts +37 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/built-in-commands.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/built-in-commands.js +544 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/built-in-commands.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/command-manager.d.ts +75 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/command-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/command-manager.js +299 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/command-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/parse.d.ts +17 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/parse.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/parse.js +19 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/parse.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/types.d.ts +197 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/types.js +3 -0
- package/dist/components/multi-agent-orchestration/agent/command-manager/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.d.ts +37 -1
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.js +54 -2
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.d.ts +118 -14
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.js +239 -50
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation.d.ts +34 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation.js +74 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/turn-gate.d.ts +49 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/turn-gate.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/turn-gate.js +171 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/turn-gate.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/clock.d.ts +43 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/clock.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/clock.js +116 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/clock.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/internal-events.d.ts +17 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/internal-events.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/internal-events.js +93 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/internal-events.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/job-manager.d.ts +208 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/job-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/job-manager.js +1207 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/job-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/rules.d.ts +129 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/rules.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/rules.js +598 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/rules.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/schedule.d.ts +15 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/schedule.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/schedule.js +113 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/schedule.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/timers.d.ts +8 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/timers.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/timers.js +33 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/timers.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/types.d.ts +495 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/types.js +50 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/webhook.d.ts +37 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/webhook.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/webhook.js +157 -0
- package/dist/components/multi-agent-orchestration/agent/job-manager/webhook.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/dreaming.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/dreaming.js +17 -3
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/dreaming.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.d.ts +7 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.js +189 -30
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.d.ts +17 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.js +51 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.d.ts +5 -0
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.js +16 -0
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/secret-manager/secret-manager.d.ts +41 -0
- package/dist/components/multi-agent-orchestration/agent/secret-manager/secret-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/secret-manager/secret-manager.js +98 -0
- package/dist/components/multi-agent-orchestration/agent/secret-manager/secret-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/secret-manager/types.d.ts +37 -0
- package/dist/components/multi-agent-orchestration/agent/secret-manager/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/secret-manager/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-manager.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-manager.js +1 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-manager.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/brief.d.ts +21 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/brief.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/brief.js +113 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/brief.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/child-loop.d.ts +52 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/child-loop.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/child-loop.js +63 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/child-loop.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/semaphore.d.ts +18 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/semaphore.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/semaphore.js +56 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/semaphore.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/subagent-manager.d.ts +128 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/subagent-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/subagent-manager.js +661 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/subagent-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/types.d.ts +307 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/types.js +60 -0
- package/dist/components/multi-agent-orchestration/agent/subagent-manager/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.d.ts +14 -3
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.js +18 -5
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.js.map +1 -1
- package/dist/components/multi-agent-orchestration/agent/types.d.ts +84 -1
- package/dist/components/multi-agent-orchestration/agent/types.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.d.ts +11 -4
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.d.ts.map +1 -1
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.js +72 -4
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.js.map +1 -1
- package/dist/components/persistence-hub/default-stores/memory-channel-store.d.ts +11 -0
- package/dist/components/persistence-hub/default-stores/memory-channel-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-channel-store.js +33 -0
- package/dist/components/persistence-hub/default-stores/memory-channel-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-group-store.d.ts +21 -0
- package/dist/components/persistence-hub/default-stores/memory-group-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-group-store.js +62 -0
- package/dist/components/persistence-hub/default-stores/memory-group-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-job-store.d.ts +31 -0
- package/dist/components/persistence-hub/default-stores/memory-job-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-job-store.js +234 -0
- package/dist/components/persistence-hub/default-stores/memory-job-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-secret-store.d.ts +12 -0
- package/dist/components/persistence-hub/default-stores/memory-secret-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-secret-store.js +38 -0
- package/dist/components/persistence-hub/default-stores/memory-secret-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-session-store.d.ts.map +1 -1
- package/dist/components/persistence-hub/default-stores/memory-session-store.js +7 -0
- package/dist/components/persistence-hub/default-stores/memory-session-store.js.map +1 -1
- package/dist/components/persistence-hub/default-stores/memory-subagent-run-store.d.ts +10 -0
- package/dist/components/persistence-hub/default-stores/memory-subagent-run-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-subagent-run-store.js +30 -0
- package/dist/components/persistence-hub/default-stores/memory-subagent-run-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-subagent-type-store.d.ts +9 -0
- package/dist/components/persistence-hub/default-stores/memory-subagent-type-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-subagent-type-store.js +17 -0
- package/dist/components/persistence-hub/default-stores/memory-subagent-type-store.js.map +1 -0
- package/dist/components/persistence-hub/persistence-hub.d.ts +41 -0
- package/dist/components/persistence-hub/persistence-hub.d.ts.map +1 -1
- package/dist/components/persistence-hub/persistence-hub.js +41 -0
- package/dist/components/persistence-hub/persistence-hub.js.map +1 -1
- package/dist/components/persistence-hub/types/channel-store.d.ts +12 -0
- package/dist/components/persistence-hub/types/channel-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/channel-store.js +2 -0
- package/dist/components/persistence-hub/types/channel-store.js.map +1 -0
- package/dist/components/persistence-hub/types/group-store.d.ts +27 -0
- package/dist/components/persistence-hub/types/group-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/group-store.js +2 -0
- package/dist/components/persistence-hub/types/group-store.js.map +1 -0
- package/dist/components/persistence-hub/types/job-store.d.ts +112 -0
- package/dist/components/persistence-hub/types/job-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/job-store.js +2 -0
- package/dist/components/persistence-hub/types/job-store.js.map +1 -0
- package/dist/components/persistence-hub/types/secret-store.d.ts +18 -0
- package/dist/components/persistence-hub/types/secret-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/secret-store.js +2 -0
- package/dist/components/persistence-hub/types/secret-store.js.map +1 -0
- package/dist/components/persistence-hub/types/session-store.d.ts +5 -0
- package/dist/components/persistence-hub/types/session-store.d.ts.map +1 -1
- package/dist/components/persistence-hub/types/subagent-run-store.d.ts +11 -0
- package/dist/components/persistence-hub/types/subagent-run-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/subagent-run-store.js +2 -0
- package/dist/components/persistence-hub/types/subagent-run-store.js.map +1 -0
- package/dist/components/persistence-hub/types/subagent-type-store.d.ts +9 -0
- package/dist/components/persistence-hub/types/subagent-type-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/subagent-type-store.js +2 -0
- package/dist/components/persistence-hub/types/subagent-type-store.js.map +1 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox.d.ts +4 -1
- package/dist/components/sandbox-hub/docker/docker-sandbox.d.ts.map +1 -1
- package/dist/components/sandbox-hub/docker/docker-sandbox.js +398 -1
- package/dist/components/sandbox-hub/docker/docker-sandbox.js.map +1 -1
- package/dist/components/sandbox-hub/docker/sandbox-helper.d.ts.map +1 -1
- package/dist/components/sandbox-hub/docker/sandbox-helper.js +386 -5
- package/dist/components/sandbox-hub/docker/sandbox-helper.js.map +1 -1
- package/dist/components/sandbox-hub/host/host-sandbox.d.ts +16 -0
- package/dist/components/sandbox-hub/host/host-sandbox.d.ts.map +1 -1
- package/dist/components/sandbox-hub/host/host-sandbox.js +283 -2
- package/dist/components/sandbox-hub/host/host-sandbox.js.map +1 -1
- package/dist/components/sandbox-hub/sandbox-hub.d.ts +9 -0
- package/dist/components/sandbox-hub/sandbox-hub.d.ts.map +1 -1
- package/dist/components/sandbox-hub/sandbox-hub.js +18 -0
- package/dist/components/sandbox-hub/sandbox-hub.js.map +1 -1
- package/dist/components/sandbox-hub/traced-sandbox.d.ts.map +1 -1
- package/dist/components/sandbox-hub/traced-sandbox.js +32 -0
- package/dist/components/sandbox-hub/traced-sandbox.js.map +1 -1
- package/dist/components/sandbox-hub/types/sandbox.d.ts +106 -1
- package/dist/components/sandbox-hub/types/sandbox.d.ts.map +1 -1
- package/dist/components/sandbox-hub/types/sandbox.js +0 -13
- package/dist/components/sandbox-hub/types/sandbox.js.map +1 -1
- package/dist/components/secret-hub/envelope.d.ts +48 -0
- package/dist/components/secret-hub/envelope.d.ts.map +1 -0
- package/dist/components/secret-hub/envelope.js +157 -0
- package/dist/components/secret-hub/envelope.js.map +1 -0
- package/dist/components/secret-hub/rules.d.ts +33 -0
- package/dist/components/secret-hub/rules.d.ts.map +1 -0
- package/dist/components/secret-hub/rules.js +142 -0
- package/dist/components/secret-hub/rules.js.map +1 -0
- package/dist/components/secret-hub/secret-hub-provider.d.ts +61 -0
- package/dist/components/secret-hub/secret-hub-provider.d.ts.map +1 -0
- package/dist/components/secret-hub/secret-hub-provider.js +73 -0
- package/dist/components/secret-hub/secret-hub-provider.js.map +1 -0
- package/dist/components/secret-hub/secret-hub.d.ts +102 -0
- package/dist/components/secret-hub/secret-hub.d.ts.map +1 -0
- package/dist/components/secret-hub/secret-hub.js +267 -0
- package/dist/components/secret-hub/secret-hub.js.map +1 -0
- package/dist/components/secret-hub/types.d.ts +77 -0
- package/dist/components/secret-hub/types.d.ts.map +1 -0
- package/dist/components/secret-hub/types.js +23 -0
- package/dist/components/secret-hub/types.js.map +1 -0
- package/dist/components/skill-hub/built-in-skills/essential-skills.d.ts +1 -1
- package/dist/components/skill-hub/built-in-skills/essential-skills.d.ts.map +1 -1
- package/dist/components/skill-hub/built-in-skills/essential-skills.js +7 -2
- package/dist/components/skill-hub/built-in-skills/essential-skills.js.map +1 -1
- package/dist/components/skill-hub/built-in-skills/watch-and-notify.d.ts +3 -0
- package/dist/components/skill-hub/built-in-skills/watch-and-notify.d.ts.map +1 -0
- package/dist/components/skill-hub/built-in-skills/watch-and-notify.js +94 -0
- package/dist/components/skill-hub/built-in-skills/watch-and-notify.js.map +1 -0
- package/dist/components/skill-hub/skill-hub.d.ts +9 -1
- package/dist/components/skill-hub/skill-hub.d.ts.map +1 -1
- package/dist/components/skill-hub/skill-hub.js +11 -1
- package/dist/components/skill-hub/skill-hub.js.map +1 -1
- package/dist/components/subagent-hub/built-in-types.d.ts +3 -0
- package/dist/components/subagent-hub/built-in-types.d.ts.map +1 -0
- package/dist/components/subagent-hub/built-in-types.js +24 -0
- package/dist/components/subagent-hub/built-in-types.js.map +1 -0
- package/dist/components/subagent-hub/subagent-hub.d.ts +41 -0
- package/dist/components/subagent-hub/subagent-hub.d.ts.map +1 -0
- package/dist/components/subagent-hub/subagent-hub.js +158 -0
- package/dist/components/subagent-hub/subagent-hub.js.map +1 -0
- package/dist/components/subagent-hub/types.d.ts +40 -0
- package/dist/components/subagent-hub/types.d.ts.map +1 -0
- package/dist/components/subagent-hub/types.js +8 -0
- package/dist/components/subagent-hub/types.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.d.ts +4 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.js +4 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.js.map +1 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/save-artifact-tool.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/save-artifact-tool.js +4 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/save-artifact-tool.js.map +1 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/update-artifact-tool.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/update-artifact-tool.js +4 -1
- package/dist/components/tool-hub/built-in-tools/artifacts/update-artifact-tool.js.map +1 -1
- package/dist/components/tool-hub/built-in-tools/jobs/create-job-tools.d.ts +10 -0
- package/dist/components/tool-hub/built-in-tools/jobs/create-job-tools.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/jobs/create-job-tools.js +13 -0
- package/dist/components/tool-hub/built-in-tools/jobs/create-job-tools.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/jobs/job-tool-helpers.d.ts +60 -0
- package/dist/components/tool-hub/built-in-tools/jobs/job-tool-helpers.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/jobs/job-tool-helpers.js +240 -0
- package/dist/components/tool-hub/built-in-tools/jobs/job-tool-helpers.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/jobs/list-jobs-tool.d.ts +14 -0
- package/dist/components/tool-hub/built-in-tools/jobs/list-jobs-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/jobs/list-jobs-tool.js +36 -0
- package/dist/components/tool-hub/built-in-tools/jobs/list-jobs-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/jobs/manage-job-tool.d.ts +32 -0
- package/dist/components/tool-hub/built-in-tools/jobs/manage-job-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/jobs/manage-job-tool.js +458 -0
- package/dist/components/tool-hub/built-in-tools/jobs/manage-job-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/create-preview-tools.d.ts +9 -0
- package/dist/components/tool-hub/built-in-tools/preview/create-preview-tools.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/create-preview-tools.js +20 -0
- package/dist/components/tool-hub/built-in-tools/preview/create-preview-tools.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/list-apps-tool.d.ts +12 -0
- package/dist/components/tool-hub/built-in-tools/preview/list-apps-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/list-apps-tool.js +57 -0
- package/dist/components/tool-hub/built-in-tools/preview/list-apps-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/open-in-app-tool.d.ts +15 -0
- package/dist/components/tool-hub/built-in-tools/preview/open-in-app-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/open-in-app-tool.js +80 -0
- package/dist/components/tool-hub/built-in-tools/preview/open-in-app-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-helpers.d.ts +53 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-helpers.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-helpers.js +100 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-helpers.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-tool.d.ts +14 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-tool.js +63 -0
- package/dist/components/tool-hub/built-in-tools/preview/preview-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/service-tools.d.ts +33 -0
- package/dist/components/tool-hub/built-in-tools/preview/service-tools.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/preview/service-tools.js +180 -0
- package/dist/components/tool-hub/built-in-tools/preview/service-tools.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/create-secret-tools.d.ts +6 -0
- package/dist/components/tool-hub/built-in-tools/secrets/create-secret-tools.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/create-secret-tools.js +9 -0
- package/dist/components/tool-hub/built-in-tools/secrets/create-secret-tools.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/list-secrets-tool.d.ts +12 -0
- package/dist/components/tool-hub/built-in-tools/secrets/list-secrets-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/list-secrets-tool.js +30 -0
- package/dist/components/tool-hub/built-in-tools/secrets/list-secrets-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/manage-secret-tool.d.ts +22 -0
- package/dist/components/tool-hub/built-in-tools/secrets/manage-secret-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/manage-secret-tool.js +113 -0
- package/dist/components/tool-hub/built-in-tools/secrets/manage-secret-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/secret-tool-helpers.d.ts +9 -0
- package/dist/components/tool-hub/built-in-tools/secrets/secret-tool-helpers.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/secrets/secret-tool-helpers.js +29 -0
- package/dist/components/tool-hub/built-in-tools/secrets/secret-tool-helpers.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/subagents/spawn-subagent-tool.d.ts +27 -0
- package/dist/components/tool-hub/built-in-tools/subagents/spawn-subagent-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/subagents/spawn-subagent-tool.js +112 -0
- package/dist/components/tool-hub/built-in-tools/subagents/spawn-subagent-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/http-request-tool.d.ts +43 -0
- package/dist/components/tool-hub/built-in-tools/web/http-request-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/http-request-tool.js +234 -0
- package/dist/components/tool-hub/built-in-tools/web/http-request-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/web-extract-tool.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/web/web-extract-tool.js +2 -0
- package/dist/components/tool-hub/built-in-tools/web/web-extract-tool.js.map +1 -1
- package/dist/components/tool-hub/built-in-tools/web/web-search-tool.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/web/web-search-tool.js +2 -0
- package/dist/components/tool-hub/built-in-tools/web/web-search-tool.js.map +1 -1
- package/dist/components/tool-hub/built-in-tools/workspace/run-code-tool.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/workspace/run-code-tool.js +9 -1
- package/dist/components/tool-hub/built-in-tools/workspace/run-code-tool.js.map +1 -1
- package/dist/components/tool-hub/built-in-tools/workspace/terminal-tool.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/workspace/terminal-tool.js +9 -2
- package/dist/components/tool-hub/built-in-tools/workspace/terminal-tool.js.map +1 -1
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.d.ts +17 -0
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.d.ts.map +1 -1
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.js +29 -0
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.js.map +1 -1
- package/dist/components/tool-hub/tool-links.d.ts +9 -0
- package/dist/components/tool-hub/tool-links.d.ts.map +1 -0
- package/dist/components/tool-hub/tool-links.js +11 -0
- package/dist/components/tool-hub/tool-links.js.map +1 -0
- package/dist/components/tool-hub/types.d.ts +101 -1
- package/dist/components/tool-hub/types.d.ts.map +1 -1
- package/dist/index.d.ts +109 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -1
- package/dist/kernel/errors/channel-error.d.ts +24 -0
- package/dist/kernel/errors/channel-error.d.ts.map +1 -0
- package/dist/kernel/errors/channel-error.js +15 -0
- package/dist/kernel/errors/channel-error.js.map +1 -0
- package/dist/kernel/errors/command-error.d.ts +12 -0
- package/dist/kernel/errors/command-error.d.ts.map +1 -0
- package/dist/kernel/errors/command-error.js +11 -0
- package/dist/kernel/errors/command-error.js.map +1 -0
- package/dist/kernel/errors/group-error.d.ts +15 -0
- package/dist/kernel/errors/group-error.d.ts.map +1 -0
- package/dist/kernel/errors/group-error.js +10 -0
- package/dist/kernel/errors/group-error.js.map +1 -0
- package/dist/kernel/errors/job-error.d.ts +23 -0
- package/dist/kernel/errors/job-error.d.ts.map +1 -0
- package/dist/kernel/errors/job-error.js +15 -0
- package/dist/kernel/errors/job-error.js.map +1 -0
- package/dist/kernel/errors/secret-error.d.ts +19 -0
- package/dist/kernel/errors/secret-error.d.ts.map +1 -0
- package/dist/kernel/errors/secret-error.js +10 -0
- package/dist/kernel/errors/secret-error.js.map +1 -0
- package/dist/kernel/errors/session-error.d.ts +5 -1
- package/dist/kernel/errors/session-error.d.ts.map +1 -1
- package/dist/kernel/errors/session-error.js.map +1 -1
- package/dist/kernel/errors/subagent-error.d.ts +19 -0
- package/dist/kernel/errors/subagent-error.d.ts.map +1 -0
- package/dist/kernel/errors/subagent-error.js +10 -0
- package/dist/kernel/errors/subagent-error.js.map +1 -0
- package/dist/kernel/interfaces/kernel.d.ts +15 -0
- package/dist/kernel/interfaces/kernel.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +80 -1
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/testing/fake-channel.d.ts +60 -0
- package/dist/testing/fake-channel.d.ts.map +1 -0
- package/dist/testing/fake-channel.js +135 -0
- package/dist/testing/fake-channel.js.map +1 -0
- package/dist/testing/in-memory-sandbox.d.ts +4 -1
- package/dist/testing/in-memory-sandbox.d.ts.map +1 -1
- package/dist/testing/in-memory-sandbox.js +63 -3
- package/dist/testing/in-memory-sandbox.js.map +1 -1
- package/dist/testing/mock-session-store.d.ts.map +1 -1
- package/dist/testing/mock-session-store.js +7 -0
- package/dist/testing/mock-session-store.js.map +1 -1
- package/package.json +2 -1
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.d.ts +0 -38
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.d.ts.map +0 -1
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.js +0 -155
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.js.map +0 -1
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/types.d.ts +0 -27
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/types.d.ts.map +0 -1
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/types.js.map +0 -1
- /package/dist/components/multi-agent-orchestration/agent/{scheduled-job-manager → secret-manager}/types.js +0 -0
|
@@ -0,0 +1,834 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { GroupError } from "../../kernel/errors/group-error.js";
|
|
3
|
+
import { SDKEventType } from "../event-handler/events.js";
|
|
4
|
+
import { safeError } from "../multi-agent-orchestration/agent/subagent-manager/brief.js";
|
|
5
|
+
import { buildMemberPrompt } from "./member-prompt.js";
|
|
6
|
+
import { resolveRecipients } from "./recipients.js";
|
|
7
|
+
import { GROUP_TEXT_LIMITS, resolveGroupLimits, } from "./types.js";
|
|
8
|
+
const ZERO_USAGE = { inputTokens: 0, outputTokens: 0 };
|
|
9
|
+
const SPAWN_TOOL = "spawn_subagent";
|
|
10
|
+
/**
|
|
11
|
+
* Group turns (A-109, A-112, A-115) — runs one user message through a group:
|
|
12
|
+
* - one member answers alone; or several answer side by side as one round and the lead
|
|
13
|
+
* sums up; or the lead answers and hands parts to members through spawn_subagent (A-105,
|
|
14
|
+
* under a spawn scope: the members see the thread, work in their own member sessions,
|
|
15
|
+
* stream into the thread, and need no extra approval), then sums up;
|
|
16
|
+
* - guard rails: members per round, a token budget and a deadline for the whole turn, a
|
|
17
|
+
* deadline per member; hand-off depth is A-105's (a member cannot delegate further);
|
|
18
|
+
* - stop the whole turn or one member; one member failing does not fail the round, and the
|
|
19
|
+
* summary says what is missing; retry one member's answer.
|
|
20
|
+
* One group turn runs per group session at a time.
|
|
21
|
+
*/
|
|
22
|
+
export class GroupTurns {
|
|
23
|
+
deps;
|
|
24
|
+
active = new Map();
|
|
25
|
+
/** Lead session → its spawn scope while it leads a turn. */
|
|
26
|
+
scopes = new Map();
|
|
27
|
+
/** `${groupSessionId}\0${agentId}` → the member's session id. */
|
|
28
|
+
memberSessions = new Map();
|
|
29
|
+
/** Hand-off answers by child run id, until the run's end settles them. */
|
|
30
|
+
handoffWriters = new Map();
|
|
31
|
+
unsubscribes = [];
|
|
32
|
+
constructor(deps) {
|
|
33
|
+
this.deps = deps;
|
|
34
|
+
const bus = deps.eventBus;
|
|
35
|
+
// The turn's budget counts every model response in its member sessions.
|
|
36
|
+
this.unsubscribes.push(bus.on(SDKEventType.ModelResponded, (e) => {
|
|
37
|
+
if (!e.payload.usage)
|
|
38
|
+
return;
|
|
39
|
+
for (const turn of this.active.values()) {
|
|
40
|
+
if (!turn.memberSessions.has(e.sessionId))
|
|
41
|
+
continue;
|
|
42
|
+
turn.usage = addUsage(turn.usage, e.payload.usage);
|
|
43
|
+
const used = turn.usage.inputTokens + turn.usage.outputTokens;
|
|
44
|
+
if (used > turn.limits.maxTokensPerTurn) {
|
|
45
|
+
this.limit(turn, `Stopped: this turn used its ${turn.limits.maxTokensPerTurn.toLocaleString("en-US")} tokens (maxTokensPerTurn).`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
/** SubagentScopes: a lead session's spawn scope while it leads a group turn. */
|
|
51
|
+
get(sessionId) {
|
|
52
|
+
return this.scopes.get(sessionId);
|
|
53
|
+
}
|
|
54
|
+
isBusy(sessionId) {
|
|
55
|
+
return this.active.has(sessionId);
|
|
56
|
+
}
|
|
57
|
+
/** The running turns, for "busy" marks: group session → who is doing what. */
|
|
58
|
+
running() {
|
|
59
|
+
return [...this.active.values()].map((t) => ({ groupId: t.group.id, sessionId: t.sessionId, turnId: t.id, presence: [...t.presence.values()] }));
|
|
60
|
+
}
|
|
61
|
+
/** What each member of a running turn is doing now (empty when idle). */
|
|
62
|
+
presenceOf(sessionId) {
|
|
63
|
+
return [...(this.active.get(sessionId)?.presence.values() ?? [])];
|
|
64
|
+
}
|
|
65
|
+
/** Run one user message through the group. Throws GroupError before anything runs. */
|
|
66
|
+
async send(group, session, request, options = {}) {
|
|
67
|
+
const text = typeof request.text === "string" ? request.text.trim() : "";
|
|
68
|
+
if (!text)
|
|
69
|
+
throw new GroupError("the message is empty", "invalid_argument");
|
|
70
|
+
if (text.length > GROUP_TEXT_LIMITS.message) {
|
|
71
|
+
throw new GroupError(`the message is ${text.length} characters; keep it under ${GROUP_TEXT_LIMITS.message}`, "invalid_argument");
|
|
72
|
+
}
|
|
73
|
+
const host = this.requireReady(group);
|
|
74
|
+
const turn = this.begin(group, session.id, options.signal);
|
|
75
|
+
try {
|
|
76
|
+
const members = group.members.filter((id) => host.get(id)).map((id) => ({ id, name: host.get(id).profile.name }));
|
|
77
|
+
const { addressed, plan } = resolveRecipients({ text, to: request.to, members, leadId: group.leadId, replyMode: group.replyMode, muted: group.muted });
|
|
78
|
+
const user = await this.deps.thread.append({ sessionId: session.id, groupId: group.id, kind: "user", text, to: addressed });
|
|
79
|
+
turn.added.push(user.id);
|
|
80
|
+
await this.titleFrom(session, text);
|
|
81
|
+
this.deps.eventBus.emit({ type: SDKEventType.GroupTurnStarted, sessionId: session.id, payload: { groupId: group.id, turnId: turn.id, plan: plan.kind } });
|
|
82
|
+
await this.runPlan(turn, plan);
|
|
83
|
+
return await this.end(turn, plan);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
await this.end(turn, { kind: "none", reason: "failed" }).catch(() => undefined);
|
|
87
|
+
throw err;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** Run a member's answer again, in place. Throws GroupError before anything runs. */
|
|
91
|
+
async retry(group, session, message, options = {}) {
|
|
92
|
+
if (message.kind !== "agent" || !message.agentId)
|
|
93
|
+
throw new GroupError("only a member's answer can be retried", "invalid_argument");
|
|
94
|
+
if (message.status === "running")
|
|
95
|
+
throw new GroupError("that answer is still being written", "busy");
|
|
96
|
+
const host = this.requireReady(group);
|
|
97
|
+
if (!host.get(message.agentId) || !group.members.includes(message.agentId)) {
|
|
98
|
+
throw new GroupError(`"${message.agentId}" is not a running member of this group`, "unknown_agent");
|
|
99
|
+
}
|
|
100
|
+
const turn = this.begin(group, session.id, options.signal);
|
|
101
|
+
const plan = { kind: "single", agentId: message.agentId };
|
|
102
|
+
try {
|
|
103
|
+
this.deps.eventBus.emit({ type: SDKEventType.GroupTurnStarted, sessionId: session.id, payload: { groupId: group.id, turnId: turn.id, plan: plan.kind } });
|
|
104
|
+
await this.memberTurn(turn, message.agentId, {
|
|
105
|
+
role: message.summary ? "summary" : "retry",
|
|
106
|
+
retry: message,
|
|
107
|
+
...(message.roundId ? { roundId: message.roundId } : {}),
|
|
108
|
+
});
|
|
109
|
+
return await this.end(turn, plan);
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
await this.end(turn, plan).catch(() => undefined);
|
|
113
|
+
throw err;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Stop the session's running turn, or (with `agentId`) one member of it. False when nothing ran. */
|
|
117
|
+
stop(sessionId, agentId) {
|
|
118
|
+
const turn = this.active.get(sessionId);
|
|
119
|
+
if (!turn)
|
|
120
|
+
return false;
|
|
121
|
+
if (!agentId) {
|
|
122
|
+
turn.reason ??= "stopped";
|
|
123
|
+
turn.controller.abort();
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
const direct = turn.direct.get(agentId);
|
|
127
|
+
if (direct) {
|
|
128
|
+
direct.reason ??= "cancelled";
|
|
129
|
+
direct.controller.abort();
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
const child = turn.spawned.get(agentId);
|
|
133
|
+
if (child)
|
|
134
|
+
return this.deps.getAgents()?.get(child.leadId)?.subagents.stop(child.runId) ?? false;
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
/** Resolves once the session's running turn (if any) has ended. */
|
|
138
|
+
async idle(sessionId) {
|
|
139
|
+
await this.active.get(sessionId)?.done;
|
|
140
|
+
}
|
|
141
|
+
/** Stop every running turn and stop listening. */
|
|
142
|
+
dispose() {
|
|
143
|
+
for (const turn of this.active.values()) {
|
|
144
|
+
turn.reason ??= "stopped";
|
|
145
|
+
turn.controller.abort();
|
|
146
|
+
}
|
|
147
|
+
for (const off of this.unsubscribes)
|
|
148
|
+
off();
|
|
149
|
+
this.unsubscribes = [];
|
|
150
|
+
}
|
|
151
|
+
/** Forget a deleted group session (its member sessions are deleted by the hub). */
|
|
152
|
+
forgetSession(sessionId) {
|
|
153
|
+
for (const key of [...this.memberSessions.keys()])
|
|
154
|
+
if (key.startsWith(`${sessionId}\0`))
|
|
155
|
+
this.memberSessions.delete(key);
|
|
156
|
+
}
|
|
157
|
+
/** The member's private session in a group session, created on first use. */
|
|
158
|
+
memberSession(group, groupSessionId, agentId) {
|
|
159
|
+
const key = `${groupSessionId}\0${agentId}`;
|
|
160
|
+
let found = this.memberSessions.get(key);
|
|
161
|
+
if (!found) {
|
|
162
|
+
found = (async () => {
|
|
163
|
+
const sessions = this.deps.getSessions();
|
|
164
|
+
const existing = await sessions.list({ metadata: { source: "group-member", groupSessionId, agentId } });
|
|
165
|
+
if (existing[0])
|
|
166
|
+
return existing[0].id;
|
|
167
|
+
const metadata = { agentId, source: "group-member", groupId: group.id, groupSessionId, title: `Group: ${group.name}` };
|
|
168
|
+
return (await sessions.create({ ...metadata })).id;
|
|
169
|
+
})();
|
|
170
|
+
this.memberSessions.set(key, found);
|
|
171
|
+
found.catch(() => this.memberSessions.delete(key));
|
|
172
|
+
}
|
|
173
|
+
return found;
|
|
174
|
+
}
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
// A turn's life
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
requireReady(group) {
|
|
179
|
+
const host = this.deps.getAgents();
|
|
180
|
+
if (!host)
|
|
181
|
+
throw new GroupError("no agents are running in this host", "unknown_agent");
|
|
182
|
+
const running = group.members.filter((id) => host.get(id));
|
|
183
|
+
if (running.length < 2)
|
|
184
|
+
throw new GroupError("the group needs at least 2 running members", "invalid_argument");
|
|
185
|
+
if (!host.get(group.leadId))
|
|
186
|
+
throw new GroupError(`the lead "${group.leadId}" is not running`, "unknown_agent");
|
|
187
|
+
return host;
|
|
188
|
+
}
|
|
189
|
+
begin(group, sessionId, signal) {
|
|
190
|
+
if (this.active.has(sessionId))
|
|
191
|
+
throw new GroupError("a group turn is already running in this session; wait for it or stop it", "busy");
|
|
192
|
+
const limits = resolveGroupLimits(group.limits);
|
|
193
|
+
const turn = {
|
|
194
|
+
id: randomUUID(),
|
|
195
|
+
group,
|
|
196
|
+
sessionId,
|
|
197
|
+
limits,
|
|
198
|
+
controller: new AbortController(),
|
|
199
|
+
direct: new Map(),
|
|
200
|
+
spawned: new Map(),
|
|
201
|
+
memberSessions: new Set(),
|
|
202
|
+
usage: { ...ZERO_USAGE },
|
|
203
|
+
added: [],
|
|
204
|
+
presence: new Map(),
|
|
205
|
+
settling: new Set(),
|
|
206
|
+
cleanup: () => undefined,
|
|
207
|
+
done: Promise.resolve(),
|
|
208
|
+
finished: () => undefined,
|
|
209
|
+
};
|
|
210
|
+
turn.done = new Promise((resolve) => (turn.finished = resolve));
|
|
211
|
+
this.active.set(sessionId, turn);
|
|
212
|
+
const onAbort = () => {
|
|
213
|
+
turn.reason ??= "stopped";
|
|
214
|
+
turn.controller.abort();
|
|
215
|
+
};
|
|
216
|
+
if (signal?.aborted)
|
|
217
|
+
onAbort();
|
|
218
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
219
|
+
const timer = setTimeout(() => this.limit(turn, `Stopped: this turn ran for ${Math.round(limits.maxElapsedMsPerTurn / 60_000)} minutes (maxElapsedMsPerTurn).`), limits.maxElapsedMsPerTurn);
|
|
220
|
+
turn.controller.signal.addEventListener("abort", () => clearTimeout(timer), { once: true });
|
|
221
|
+
turn.cleanup = () => {
|
|
222
|
+
clearTimeout(timer);
|
|
223
|
+
signal?.removeEventListener("abort", onAbort);
|
|
224
|
+
};
|
|
225
|
+
return turn;
|
|
226
|
+
}
|
|
227
|
+
/** A guard rail ended the turn: stop everyone, note why once. */
|
|
228
|
+
limit(turn, note) {
|
|
229
|
+
if (turn.reason)
|
|
230
|
+
return;
|
|
231
|
+
turn.reason = "limited";
|
|
232
|
+
turn.limitNote = note;
|
|
233
|
+
turn.controller.abort();
|
|
234
|
+
}
|
|
235
|
+
async end(turn, plan) {
|
|
236
|
+
turn.cleanup();
|
|
237
|
+
for (const agentId of [...turn.presence.keys()])
|
|
238
|
+
this.setPresence(turn, agentId, "idle");
|
|
239
|
+
try {
|
|
240
|
+
await Promise.all([...turn.settling]);
|
|
241
|
+
if (turn.limitNote)
|
|
242
|
+
turn.added.push((await this.deps.thread.note(turn.group.id, turn.sessionId, turn.limitNote)).id);
|
|
243
|
+
await this.deps.thread.settle(turn.sessionId);
|
|
244
|
+
}
|
|
245
|
+
finally {
|
|
246
|
+
this.active.delete(turn.sessionId);
|
|
247
|
+
turn.finished();
|
|
248
|
+
}
|
|
249
|
+
const status = turn.reason === "stopped" ? "stopped" : turn.reason === "limited" ? "limited" : plan.kind === "none" ? "no_reply" : "completed";
|
|
250
|
+
this.deps.eventBus.emit({
|
|
251
|
+
type: SDKEventType.GroupTurnFinished,
|
|
252
|
+
sessionId: turn.sessionId,
|
|
253
|
+
payload: { groupId: turn.group.id, turnId: turn.id, status, usage: { ...turn.usage } },
|
|
254
|
+
});
|
|
255
|
+
const byId = new Map((await this.deps.thread.list(turn.sessionId)).map((m) => [m.id, m]));
|
|
256
|
+
return {
|
|
257
|
+
turnId: turn.id,
|
|
258
|
+
status,
|
|
259
|
+
plan,
|
|
260
|
+
messages: turn.added.map((id) => byId.get(id)).filter((m) => !!m),
|
|
261
|
+
usage: { ...turn.usage },
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
async runPlan(turn, plan) {
|
|
265
|
+
switch (plan.kind) {
|
|
266
|
+
case "none":
|
|
267
|
+
turn.added.push((await this.deps.thread.note(turn.group.id, turn.sessionId, plan.reason)).id);
|
|
268
|
+
return;
|
|
269
|
+
case "single":
|
|
270
|
+
await this.memberTurn(turn, plan.agentId, { role: "member" });
|
|
271
|
+
return;
|
|
272
|
+
case "round":
|
|
273
|
+
await this.round(turn, plan.agentIds, plan.summarize);
|
|
274
|
+
return;
|
|
275
|
+
case "lead":
|
|
276
|
+
await this.leadTurn(turn, plan.helpers);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/** Several members side by side; then the lead sums up. */
|
|
281
|
+
async round(turn, agentIds, summarize) {
|
|
282
|
+
const max = turn.limits.maxMembersPerRound;
|
|
283
|
+
const ids = agentIds.slice(0, max);
|
|
284
|
+
if (agentIds.length > max) {
|
|
285
|
+
const left = agentIds.slice(max).map((id) => this.nameOf(id)).join(", ");
|
|
286
|
+
turn.added.push((await this.deps.thread.note(turn.group.id, turn.sessionId, `${left} left out: at most ${max} members answer in one round.`)).id);
|
|
287
|
+
}
|
|
288
|
+
const roundId = randomUUID();
|
|
289
|
+
const prepared = [];
|
|
290
|
+
for (const id of ids)
|
|
291
|
+
prepared.push(await this.prepareMember(turn, id, { role: "member", roundId }));
|
|
292
|
+
const answers = await Promise.all(prepared.map((p) => (p ? this.runMember(turn, p) : null)));
|
|
293
|
+
if (!summarize || ids.length < 2 || turn.controller.signal.aborted)
|
|
294
|
+
return;
|
|
295
|
+
const missing = answers
|
|
296
|
+
.map((m, i) => ({ agentId: ids[i], message: m }))
|
|
297
|
+
.filter((a) => !a.message || (a.message.status !== "completed" && a.message.status !== "partial"))
|
|
298
|
+
.map((a) => ({ agentId: a.agentId, reason: a.message?.error ?? a.message?.status?.replace("_", " ") ?? "no answer" }));
|
|
299
|
+
await this.memberTurn(turn, turn.group.leadId, { role: "summary", missing });
|
|
300
|
+
}
|
|
301
|
+
// ---------------------------------------------------------------------------
|
|
302
|
+
// One member's turn
|
|
303
|
+
// ---------------------------------------------------------------------------
|
|
304
|
+
/** One member answers in its own session; returns its answer (null when it could not run). */
|
|
305
|
+
async memberTurn(turn, agentId, options) {
|
|
306
|
+
const prepared = await this.prepareMember(turn, agentId, options);
|
|
307
|
+
return prepared ? this.runMember(turn, prepared) : null;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* What a member is told, and its answer opened in the thread ("running"). A round opens
|
|
311
|
+
* every answer first, in plan order, so the thread's order does not depend on who starts first.
|
|
312
|
+
*/
|
|
313
|
+
async prepareMember(turn, agentId, options) {
|
|
314
|
+
const agent = this.deps.getAgents()?.get(agentId);
|
|
315
|
+
if (!agent || turn.controller.signal.aborted)
|
|
316
|
+
return null;
|
|
317
|
+
const { group, sessionId: groupSessionId } = turn;
|
|
318
|
+
const memberSession = await this.memberSession(group, groupSessionId, agentId);
|
|
319
|
+
turn.memberSessions.add(memberSession);
|
|
320
|
+
const { messages, cursor } = await this.deps.thread.unseen(groupSessionId, agentId);
|
|
321
|
+
const prompt = buildMemberPrompt({
|
|
322
|
+
group,
|
|
323
|
+
names: this.names(group),
|
|
324
|
+
self: agentId,
|
|
325
|
+
role: options.role,
|
|
326
|
+
messages,
|
|
327
|
+
view: group.memberView,
|
|
328
|
+
...(options.missing?.length ? { missing: options.missing } : {}),
|
|
329
|
+
...(options.retry ? { retryOf: { status: options.retry.status ?? "failed" } } : {}),
|
|
330
|
+
});
|
|
331
|
+
await this.deps.thread.markSeen(groupSessionId, { [agentId]: cursor });
|
|
332
|
+
const writer = new AnswerWriter(this.deps.thread, {
|
|
333
|
+
sessionId: groupSessionId,
|
|
334
|
+
groupId: group.id,
|
|
335
|
+
agentId,
|
|
336
|
+
...(options.roundId ? { roundId: options.roundId } : {}),
|
|
337
|
+
...(options.role === "summary" ? { summary: true } : {}),
|
|
338
|
+
});
|
|
339
|
+
turn.added.push((await writer.open(options.retry)).id);
|
|
340
|
+
return { agentId, agent, memberSession, prompt, writer, options };
|
|
341
|
+
}
|
|
342
|
+
async runMember(turn, prepared) {
|
|
343
|
+
const { agentId, agent, memberSession, prompt, writer, options } = prepared;
|
|
344
|
+
const { group, sessionId: groupSessionId } = turn;
|
|
345
|
+
const own = { controller: new AbortController(), reason: undefined };
|
|
346
|
+
turn.direct.set(agentId, own);
|
|
347
|
+
const onTurnAbort = () => own.controller.abort();
|
|
348
|
+
if (turn.controller.signal.aborted)
|
|
349
|
+
onTurnAbort();
|
|
350
|
+
turn.controller.signal.addEventListener("abort", onTurnAbort, { once: true });
|
|
351
|
+
const timer = setTimeout(() => {
|
|
352
|
+
own.reason ??= "timeout";
|
|
353
|
+
own.controller.abort();
|
|
354
|
+
}, turn.limits.memberTimeoutMs);
|
|
355
|
+
this.setPresence(turn, agentId, "thinking", undefined, options.roundId);
|
|
356
|
+
let result;
|
|
357
|
+
let failure;
|
|
358
|
+
try {
|
|
359
|
+
const traceAttributes = this.traceAttributes(turn, agentId, options.role, options.roundId);
|
|
360
|
+
const context = {
|
|
361
|
+
groupId: group.id,
|
|
362
|
+
groupSessionId,
|
|
363
|
+
agentId,
|
|
364
|
+
sessionId: memberSession,
|
|
365
|
+
role: options.role,
|
|
366
|
+
...(options.roundId ? { roundId: options.roundId } : {}),
|
|
367
|
+
prompt,
|
|
368
|
+
signal: own.controller.signal,
|
|
369
|
+
traceAttributes,
|
|
370
|
+
execute: (signal) => this.stream(turn, agent, memberSession, prompt, signal, traceAttributes, (chunk) => writer.chunk(chunk, (state, tool) => this.setPresence(turn, agentId, state, tool, options.roundId))),
|
|
371
|
+
};
|
|
372
|
+
result = await (this.deps.getRunner() ?? defaultRunner)(context);
|
|
373
|
+
}
|
|
374
|
+
catch (err) {
|
|
375
|
+
failure = err;
|
|
376
|
+
}
|
|
377
|
+
finally {
|
|
378
|
+
clearTimeout(timer);
|
|
379
|
+
turn.controller.signal.removeEventListener("abort", onTurnAbort);
|
|
380
|
+
turn.direct.delete(agentId);
|
|
381
|
+
this.setPresence(turn, agentId, "idle", undefined, options.roundId);
|
|
382
|
+
}
|
|
383
|
+
const status = statusOf(result, failure, own.reason, turn.reason, writer);
|
|
384
|
+
return writer.finish(status, result?.usage, errorFor(status, failure, writer.streamError, turn.limits.memberTimeoutMs));
|
|
385
|
+
}
|
|
386
|
+
/** The lead answers and may hand parts to `helpers`; their answers stream in as one round. */
|
|
387
|
+
async leadTurn(turn, helpers) {
|
|
388
|
+
const { group, sessionId: groupSessionId } = turn;
|
|
389
|
+
const leadId = group.leadId;
|
|
390
|
+
const lead = this.deps.getAgents()?.get(leadId);
|
|
391
|
+
if (!lead)
|
|
392
|
+
return;
|
|
393
|
+
const leadSession = await this.memberSession(group, groupSessionId, leadId);
|
|
394
|
+
turn.memberSessions.add(leadSession);
|
|
395
|
+
const roundId = randomUUID();
|
|
396
|
+
const { messages, cursor } = await this.deps.thread.unseen(groupSessionId, leadId);
|
|
397
|
+
const prompt = buildMemberPrompt({ group, names: this.names(group), self: leadId, role: "lead", messages, view: group.memberView, helpers });
|
|
398
|
+
await this.deps.thread.markSeen(groupSessionId, { [leadId]: cursor });
|
|
399
|
+
// The lead's text goes into segments: what it says before handing off, then (after the
|
|
400
|
+
// hand-offs) its summary. A segment is opened by its first text or tool call.
|
|
401
|
+
let segment = null;
|
|
402
|
+
let handedOff = false;
|
|
403
|
+
/** The lead's stream ended on an error chunk (its turn limit, a provider error). */
|
|
404
|
+
let leadError;
|
|
405
|
+
const segments = [];
|
|
406
|
+
const openSegment = async () => {
|
|
407
|
+
if (segment)
|
|
408
|
+
return segment;
|
|
409
|
+
segment = new AnswerWriter(this.deps.thread, { sessionId: groupSessionId, groupId: group.id, agentId: leadId, ...(handedOff ? { summary: true } : {}) });
|
|
410
|
+
segments.push(segment);
|
|
411
|
+
turn.added.push((await segment.open()).id);
|
|
412
|
+
return segment;
|
|
413
|
+
};
|
|
414
|
+
const closeSegment = async () => {
|
|
415
|
+
const open = segment;
|
|
416
|
+
segment = null;
|
|
417
|
+
if (open && !open.finished)
|
|
418
|
+
await open.finish("completed");
|
|
419
|
+
};
|
|
420
|
+
const presence = (state, tool) => this.setPresence(turn, leadId, state, tool);
|
|
421
|
+
const scope = {
|
|
422
|
+
allow: helpers.map((agentId) => ({ agentId, access: hasOwnSandbox(this.deps.getAgents()?.get(agentId)?.profile) ? "write" : "read-only" })),
|
|
423
|
+
limits: {
|
|
424
|
+
maxConcurrent: Math.max(1, Math.min(helpers.length, turn.limits.maxMembersPerRound)),
|
|
425
|
+
maxRunsPerTurn: turn.limits.maxMembersPerRound,
|
|
426
|
+
maxTokensPerTurn: turn.limits.maxTokensPerTurn,
|
|
427
|
+
maxElapsedMsPerTurn: turn.limits.maxElapsedMsPerTurn,
|
|
428
|
+
childTimeoutMs: turn.limits.memberTimeoutMs,
|
|
429
|
+
},
|
|
430
|
+
preApproved: true,
|
|
431
|
+
grantSpawnTool: true,
|
|
432
|
+
indexIntro: "These are the other members of your group chat. They see the group thread, so a short, specific task is enough; " +
|
|
433
|
+
"each answer is shown in the thread and comes back to you.",
|
|
434
|
+
childSession: async (agentId) => {
|
|
435
|
+
const id = await this.memberSession(group, groupSessionId, agentId);
|
|
436
|
+
turn.memberSessions.add(id);
|
|
437
|
+
return id;
|
|
438
|
+
},
|
|
439
|
+
brief: async (request, target) => {
|
|
440
|
+
handedOff = true;
|
|
441
|
+
await closeSegment();
|
|
442
|
+
const row = await this.deps.thread.append({
|
|
443
|
+
sessionId: groupSessionId,
|
|
444
|
+
groupId: group.id,
|
|
445
|
+
kind: "handoff",
|
|
446
|
+
agentId: leadId,
|
|
447
|
+
toAgentId: target.agentId,
|
|
448
|
+
text: request.task,
|
|
449
|
+
status: "running",
|
|
450
|
+
subagentRunId: target.runId,
|
|
451
|
+
});
|
|
452
|
+
turn.added.push(row.id);
|
|
453
|
+
turn.spawned.set(target.agentId, { runId: target.runId, leadId });
|
|
454
|
+
const seen = await this.deps.thread.unseen(groupSessionId, target.agentId);
|
|
455
|
+
await this.deps.thread.markSeen(groupSessionId, { [target.agentId]: seen.cursor });
|
|
456
|
+
const ask = request.context ? `${request.task}\n\n${JSON.stringify(request.context, null, 2)}` : request.task;
|
|
457
|
+
return buildMemberPrompt({ group, names: this.names(group), self: target.agentId, role: "handoff", messages: seen.messages, view: group.memberView, ask });
|
|
458
|
+
},
|
|
459
|
+
runner: (child) => this.handoffTurn(turn, child, roundId),
|
|
460
|
+
};
|
|
461
|
+
// Hand-off rows and answers take the child run's final status (A-105 decides it).
|
|
462
|
+
const onFinished = (e) => {
|
|
463
|
+
if (e.sessionId !== leadSession)
|
|
464
|
+
return;
|
|
465
|
+
const settling = this.settleHandoff(turn, e.payload.runId, e.payload.status, e.payload.error).catch((err) => {
|
|
466
|
+
console.warn(`[group] could not record the end of hand-off ${e.payload.runId}:`, errorMessage(err));
|
|
467
|
+
});
|
|
468
|
+
turn.settling.add(settling);
|
|
469
|
+
void settling.finally(() => turn.settling.delete(settling));
|
|
470
|
+
};
|
|
471
|
+
const offs = [
|
|
472
|
+
this.deps.eventBus.on(SDKEventType.SubagentCompleted, onFinished),
|
|
473
|
+
this.deps.eventBus.on(SDKEventType.SubagentFailed, onFinished),
|
|
474
|
+
this.deps.eventBus.on(SDKEventType.SubagentCancelled, onFinished),
|
|
475
|
+
];
|
|
476
|
+
this.scopes.set(leadSession, scope);
|
|
477
|
+
const own = { controller: new AbortController(), reason: undefined };
|
|
478
|
+
turn.direct.set(leadId, own);
|
|
479
|
+
const onTurnAbort = () => own.controller.abort();
|
|
480
|
+
if (turn.controller.signal.aborted)
|
|
481
|
+
onTurnAbort();
|
|
482
|
+
turn.controller.signal.addEventListener("abort", onTurnAbort, { once: true });
|
|
483
|
+
presence("thinking");
|
|
484
|
+
let result;
|
|
485
|
+
let failure;
|
|
486
|
+
try {
|
|
487
|
+
const traceAttributes = this.traceAttributes(turn, leadId, "lead");
|
|
488
|
+
result = await (this.deps.getRunner() ?? defaultRunner)({
|
|
489
|
+
groupId: group.id,
|
|
490
|
+
groupSessionId,
|
|
491
|
+
agentId: leadId,
|
|
492
|
+
sessionId: leadSession,
|
|
493
|
+
role: "lead",
|
|
494
|
+
prompt,
|
|
495
|
+
signal: own.controller.signal,
|
|
496
|
+
traceAttributes,
|
|
497
|
+
execute: (signal) => this.stream(turn, lead, leadSession, prompt, signal, traceAttributes, async (chunk) => {
|
|
498
|
+
if (chunk.type === "tool_call" && chunk.toolCall?.name === SPAWN_TOOL) {
|
|
499
|
+
await closeSegment();
|
|
500
|
+
presence("tool", SPAWN_TOOL);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (chunk.type === "error") {
|
|
504
|
+
leadError = chunk.error ?? "the model's reply failed";
|
|
505
|
+
if (segment)
|
|
506
|
+
segment.streamError = leadError;
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (chunk.type === "tool_result" && segments.every((s) => !s.hasTool(chunk.toolResult?.toolCallId)))
|
|
510
|
+
return;
|
|
511
|
+
// An empty text chunk (some providers send content: "") opens no segment.
|
|
512
|
+
if (chunk.type === "text" && !chunk.content)
|
|
513
|
+
return;
|
|
514
|
+
if (chunk.type === "text" || chunk.type === "tool_call" || chunk.type === "tool_result")
|
|
515
|
+
await (await openSegment()).chunk(chunk, presence);
|
|
516
|
+
}),
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
catch (err) {
|
|
520
|
+
failure = err;
|
|
521
|
+
}
|
|
522
|
+
finally {
|
|
523
|
+
this.scopes.delete(leadSession);
|
|
524
|
+
for (const off of offs)
|
|
525
|
+
off();
|
|
526
|
+
turn.controller.signal.removeEventListener("abort", onTurnAbort);
|
|
527
|
+
turn.direct.delete(leadId);
|
|
528
|
+
presence("idle");
|
|
529
|
+
}
|
|
530
|
+
const last = segment;
|
|
531
|
+
const status = statusOf(result, failure, own.reason, turn.reason, last ?? (leadError ? { streamError: leadError, hasText: false } : null));
|
|
532
|
+
if (last && !last.finished)
|
|
533
|
+
await last.finish(status, result?.usage, errorFor(status, failure, last.streamError, turn.limits.memberTimeoutMs));
|
|
534
|
+
else if (!segments.length && status !== "completed") {
|
|
535
|
+
// The lead never wrote anything: still show that it did not answer.
|
|
536
|
+
const empty = new AnswerWriter(this.deps.thread, { sessionId: groupSessionId, groupId: group.id, agentId: leadId });
|
|
537
|
+
turn.added.push((await empty.open()).id);
|
|
538
|
+
await empty.finish(status, result?.usage, errorFor(status, failure, undefined, turn.limits.memberTimeoutMs));
|
|
539
|
+
}
|
|
540
|
+
// The lead learned every hand-off result in its own turn.
|
|
541
|
+
await this.deps.thread.markSeen(groupSessionId, { [leadId]: await this.deps.thread.lastSeq(groupSessionId) });
|
|
542
|
+
}
|
|
543
|
+
/** A member's turn for a hand-off: its answer streams into the thread as part of the round. */
|
|
544
|
+
async handoffTurn(turn, child, roundId) {
|
|
545
|
+
const agent = this.deps.getAgents()?.get(child.agentId);
|
|
546
|
+
if (!agent)
|
|
547
|
+
throw new Error(`"${child.agentId}" is not running`);
|
|
548
|
+
const writer = new AnswerWriter(this.deps.thread, {
|
|
549
|
+
sessionId: turn.sessionId,
|
|
550
|
+
groupId: turn.group.id,
|
|
551
|
+
agentId: child.agentId,
|
|
552
|
+
roundId,
|
|
553
|
+
subagentRunId: child.parent.subagentRunId,
|
|
554
|
+
});
|
|
555
|
+
turn.added.push((await writer.open()).id);
|
|
556
|
+
this.handoffWriters.set(child.parent.subagentRunId, writer);
|
|
557
|
+
this.setPresence(turn, child.agentId, "thinking", undefined, roundId);
|
|
558
|
+
try {
|
|
559
|
+
const result = await (this.deps.getRunner() ?? defaultRunner)({
|
|
560
|
+
groupId: turn.group.id,
|
|
561
|
+
groupSessionId: turn.sessionId,
|
|
562
|
+
agentId: child.agentId,
|
|
563
|
+
sessionId: child.sessionId,
|
|
564
|
+
role: "handoff",
|
|
565
|
+
roundId,
|
|
566
|
+
prompt: child.prompt,
|
|
567
|
+
signal: child.signal,
|
|
568
|
+
traceAttributes: { ...child.traceAttributes, ...this.traceAttributes(turn, child.agentId, "handoff", roundId) },
|
|
569
|
+
execute: (signal) => this.stream(turn, agent, child.sessionId, child.prompt, signal, child.traceAttributes, (chunk) => writer.chunk(chunk, (state, tool) => this.setPresence(turn, child.agentId, state, tool, roundId))),
|
|
570
|
+
});
|
|
571
|
+
// The answer's text is the report; its final status comes with the run's end (settleHandoff).
|
|
572
|
+
return {
|
|
573
|
+
output: writer.text || result.output,
|
|
574
|
+
usage: result.usage,
|
|
575
|
+
...(result.aborted ? { aborted: true } : {}),
|
|
576
|
+
...(result.stopReason ? { stopReason: result.stopReason } : writer.streamError ? { stopReason: writer.hasText ? "max_tokens" : "error" } : {}),
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
finally {
|
|
580
|
+
this.setPresence(turn, child.agentId, "idle", undefined, roundId);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/** A hand-off's child run ended: its row and its answer take the run's status. */
|
|
584
|
+
async settleHandoff(turn, runId, status, error) {
|
|
585
|
+
for (const [agentId, child] of turn.spawned)
|
|
586
|
+
if (child.runId === runId)
|
|
587
|
+
turn.spawned.delete(agentId);
|
|
588
|
+
const thread = await this.deps.thread.list(turn.sessionId);
|
|
589
|
+
const row = thread.find((m) => m.kind === "handoff" && m.subagentRunId === runId);
|
|
590
|
+
if (row)
|
|
591
|
+
await this.deps.thread.update({ ...row, status, ...(error ? { error } : {}) });
|
|
592
|
+
const writer = this.handoffWriters.get(runId);
|
|
593
|
+
this.handoffWriters.delete(runId);
|
|
594
|
+
if (writer && !writer.finished)
|
|
595
|
+
await writer.finish(status, undefined, error);
|
|
596
|
+
else if (!writer) {
|
|
597
|
+
const answer = thread.find((m) => m.kind === "agent" && m.subagentRunId === runId);
|
|
598
|
+
if (answer && answer.status !== status)
|
|
599
|
+
await this.deps.thread.update({ ...answer, status, ...(error ? { error } : {}) });
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
/** Runs a member's streamed turn, handing each chunk to `onChunk`. */
|
|
603
|
+
async stream(turn, agent, sessionId, prompt, signal, traceAttributes, onChunk) {
|
|
604
|
+
turn.memberSessions.add(sessionId);
|
|
605
|
+
let usage = { ...ZERO_USAGE };
|
|
606
|
+
let aborted = false;
|
|
607
|
+
let stopReason;
|
|
608
|
+
for await (const chunk of agent.chatStream(prompt, undefined, { signal, sessionId, traceAttributes })) {
|
|
609
|
+
if (chunk.type === "done") {
|
|
610
|
+
if (chunk.usage)
|
|
611
|
+
usage = { ...chunk.usage };
|
|
612
|
+
aborted = chunk.aborted === true;
|
|
613
|
+
if (chunk.stopReason === "max_tokens" || chunk.stopReason === "error")
|
|
614
|
+
stopReason = chunk.stopReason;
|
|
615
|
+
}
|
|
616
|
+
await onChunk(chunk);
|
|
617
|
+
}
|
|
618
|
+
return { output: "", usage, ...(aborted ? { aborted: true } : {}), ...(stopReason ? { stopReason } : {}) };
|
|
619
|
+
}
|
|
620
|
+
// ---------------------------------------------------------------------------
|
|
621
|
+
// Helpers
|
|
622
|
+
// ---------------------------------------------------------------------------
|
|
623
|
+
setPresence(turn, agentId, state, tool, roundId) {
|
|
624
|
+
const prev = turn.presence.get(agentId);
|
|
625
|
+
if (prev && prev.state === state && prev.tool === tool)
|
|
626
|
+
return;
|
|
627
|
+
if (!prev && state === "idle")
|
|
628
|
+
return;
|
|
629
|
+
const payload = { groupId: turn.group.id, agentId, state, ...(tool ? { tool } : {}), ...(roundId ? { roundId } : {}) };
|
|
630
|
+
if (state === "idle")
|
|
631
|
+
turn.presence.delete(agentId);
|
|
632
|
+
else
|
|
633
|
+
turn.presence.set(agentId, payload);
|
|
634
|
+
this.deps.thread.presence(turn.sessionId, payload);
|
|
635
|
+
}
|
|
636
|
+
traceAttributes(turn, agentId, role, roundId) {
|
|
637
|
+
return {
|
|
638
|
+
source: "group",
|
|
639
|
+
groupId: turn.group.id,
|
|
640
|
+
groupSessionId: turn.sessionId,
|
|
641
|
+
groupTurnId: turn.id,
|
|
642
|
+
groupRole: role,
|
|
643
|
+
memberId: agentId,
|
|
644
|
+
...(roundId ? { groupRoundId: roundId } : {}),
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
names(group) {
|
|
648
|
+
const host = this.deps.getAgents();
|
|
649
|
+
return new Map(group.members.map((id) => [id, host?.get(id)?.profile.name ?? id]));
|
|
650
|
+
}
|
|
651
|
+
nameOf(agentId) {
|
|
652
|
+
return this.deps.getAgents()?.get(agentId)?.profile.name ?? agentId;
|
|
653
|
+
}
|
|
654
|
+
/** A new session takes its first message as its title. */
|
|
655
|
+
async titleFrom(session, text) {
|
|
656
|
+
if (typeof session.metadata["title"] === "string" && session.metadata["title"])
|
|
657
|
+
return;
|
|
658
|
+
const line = text.split("\n").map((l) => l.trim()).find(Boolean) ?? "";
|
|
659
|
+
const title = line.length > 80 ? `${line.slice(0, 80)}…` : line;
|
|
660
|
+
await this.deps.thread.updateMetadata(session.id, (meta) => (meta.title ? meta : { ...meta, title }));
|
|
661
|
+
session.metadata["title"] = title;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Writes one member answer into the thread: opens it ("running"), adds streamed text (as
|
|
666
|
+
* deltas) and tool steps, then stores how it ended.
|
|
667
|
+
*/
|
|
668
|
+
class AnswerWriter {
|
|
669
|
+
thread;
|
|
670
|
+
base;
|
|
671
|
+
message = null;
|
|
672
|
+
toolStarts = new Map();
|
|
673
|
+
/** A tool step came after the last text: the next text starts a new paragraph. */
|
|
674
|
+
gap = false;
|
|
675
|
+
writing = false;
|
|
676
|
+
finished = false;
|
|
677
|
+
streamError;
|
|
678
|
+
constructor(thread, base) {
|
|
679
|
+
this.thread = thread;
|
|
680
|
+
this.base = base;
|
|
681
|
+
}
|
|
682
|
+
get text() {
|
|
683
|
+
return this.message?.text ?? "";
|
|
684
|
+
}
|
|
685
|
+
get hasText() {
|
|
686
|
+
return this.text.trim() !== "";
|
|
687
|
+
}
|
|
688
|
+
hasTool(toolCallId) {
|
|
689
|
+
return !!toolCallId && !!this.message?.tools?.some((t) => t.id === toolCallId);
|
|
690
|
+
}
|
|
691
|
+
/** Append the answer (or reset `existing` for a retry). */
|
|
692
|
+
async open(existing) {
|
|
693
|
+
if (existing) {
|
|
694
|
+
const { error: _e, usage: _u, tools: _t, ...rest } = existing;
|
|
695
|
+
this.message = await this.thread.update({ ...rest, text: "", status: "running" });
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
this.message = await this.thread.append({ ...this.base, kind: "agent", text: "", status: "running" });
|
|
699
|
+
}
|
|
700
|
+
return this.message;
|
|
701
|
+
}
|
|
702
|
+
async chunk(chunk, presence) {
|
|
703
|
+
const message = this.message;
|
|
704
|
+
if (!message || this.finished)
|
|
705
|
+
return;
|
|
706
|
+
switch (chunk.type) {
|
|
707
|
+
case "text": {
|
|
708
|
+
if (!chunk.content)
|
|
709
|
+
return;
|
|
710
|
+
const piece = this.gap && message.text ? `\n\n${chunk.content}` : chunk.content;
|
|
711
|
+
this.gap = false;
|
|
712
|
+
message.text += piece;
|
|
713
|
+
this.thread.delta(message, piece);
|
|
714
|
+
if (!this.writing) {
|
|
715
|
+
this.writing = true;
|
|
716
|
+
presence("writing");
|
|
717
|
+
}
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
case "tool_call":
|
|
721
|
+
if (chunk.toolCall)
|
|
722
|
+
await this.toolCall(chunk.toolCall);
|
|
723
|
+
this.writing = false;
|
|
724
|
+
if (chunk.toolCall)
|
|
725
|
+
presence("tool", chunk.toolCall.name);
|
|
726
|
+
return;
|
|
727
|
+
case "tool_result":
|
|
728
|
+
if (chunk.toolResult)
|
|
729
|
+
await this.toolResult(chunk.toolResult);
|
|
730
|
+
presence("thinking");
|
|
731
|
+
return;
|
|
732
|
+
case "error":
|
|
733
|
+
this.streamError = chunk.error;
|
|
734
|
+
return;
|
|
735
|
+
default:
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
async finish(status, usage, error) {
|
|
740
|
+
const message = this.message;
|
|
741
|
+
if (!message || this.finished)
|
|
742
|
+
return message;
|
|
743
|
+
this.finished = true;
|
|
744
|
+
const tools = message.tools?.map((t) => (t.status === "running" ? { ...t, status: "error" } : t));
|
|
745
|
+
const { error: _old, ...rest } = message;
|
|
746
|
+
this.message = await this.thread.update({
|
|
747
|
+
...rest,
|
|
748
|
+
status,
|
|
749
|
+
...(tools ? { tools } : {}),
|
|
750
|
+
...(usage && usage.inputTokens + usage.outputTokens > 0 ? { usage } : {}),
|
|
751
|
+
...(error ? { error } : {}),
|
|
752
|
+
});
|
|
753
|
+
return this.message;
|
|
754
|
+
}
|
|
755
|
+
async toolCall(call) {
|
|
756
|
+
const message = this.message;
|
|
757
|
+
this.gap = true;
|
|
758
|
+
this.toolStarts.set(call.id, Date.now());
|
|
759
|
+
const step = { id: call.id, name: call.name, status: "running", arguments: call.arguments };
|
|
760
|
+
message.tools = [...(message.tools ?? []), step];
|
|
761
|
+
this.message = await this.thread.update(message);
|
|
762
|
+
}
|
|
763
|
+
async toolResult(result) {
|
|
764
|
+
const message = this.message;
|
|
765
|
+
const started = this.toolStarts.get(result.toolCallId);
|
|
766
|
+
message.tools = (message.tools ?? []).map((t) => t.id === result.toolCallId
|
|
767
|
+
? {
|
|
768
|
+
...t,
|
|
769
|
+
status: result.isError ? "error" : "done",
|
|
770
|
+
resultPreview: result.content.slice(0, 300),
|
|
771
|
+
...(started ? { durationMs: Date.now() - started } : {}),
|
|
772
|
+
}
|
|
773
|
+
: t);
|
|
774
|
+
this.message = await this.thread.update(message);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
const defaultRunner = (context) => context.execute(context.signal);
|
|
778
|
+
/**
|
|
779
|
+
* How a member's own turn ended. A turn that ended on its own keeps its outcome even when a
|
|
780
|
+
* stop came in as it finished. The stream's error chunk (the turn limit) is a partial
|
|
781
|
+
* answer when some text was written, a failure otherwise.
|
|
782
|
+
*/
|
|
783
|
+
function statusOf(result, failure, memberStop, turnStop, writer) {
|
|
784
|
+
const endedOnItsOwn = failure === undefined && result !== undefined && !result.aborted;
|
|
785
|
+
if (!endedOnItsOwn) {
|
|
786
|
+
if (memberStop === "timeout")
|
|
787
|
+
return "timed_out";
|
|
788
|
+
if (turnStop === "limited")
|
|
789
|
+
return "budget_exhausted";
|
|
790
|
+
if (memberStop === "cancelled" || turnStop === "stopped" || result?.aborted)
|
|
791
|
+
return "cancelled";
|
|
792
|
+
return "failed";
|
|
793
|
+
}
|
|
794
|
+
if (result.stopReason === "error")
|
|
795
|
+
return "failed";
|
|
796
|
+
if (result.stopReason === "max_tokens")
|
|
797
|
+
return "partial";
|
|
798
|
+
if (writer?.streamError)
|
|
799
|
+
return writer.hasText ? "partial" : "failed";
|
|
800
|
+
return "completed";
|
|
801
|
+
}
|
|
802
|
+
function errorFor(status, failure, streamError, memberTimeoutMs) {
|
|
803
|
+
switch (status) {
|
|
804
|
+
case "completed":
|
|
805
|
+
return undefined;
|
|
806
|
+
case "failed":
|
|
807
|
+
return safeError(failure !== undefined ? errorMessage(failure) : (streamError ?? "the model stopped the reply (refusal or content filter)"));
|
|
808
|
+
case "partial":
|
|
809
|
+
return "the reply hit the output token limit";
|
|
810
|
+
case "timed_out":
|
|
811
|
+
return `did not finish within ${Math.round(memberTimeoutMs / 1000)}s`;
|
|
812
|
+
case "budget_exhausted":
|
|
813
|
+
return "the turn's budget ran out";
|
|
814
|
+
case "cancelled":
|
|
815
|
+
return "stopped";
|
|
816
|
+
default:
|
|
817
|
+
return undefined;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function addUsage(a, b) {
|
|
821
|
+
return {
|
|
822
|
+
inputTokens: a.inputTokens + b.inputTokens,
|
|
823
|
+
outputTokens: a.outputTokens + b.outputTokens,
|
|
824
|
+
...(a.cacheReadTokens || b.cacheReadTokens ? { cacheReadTokens: (a.cacheReadTokens ?? 0) + (b.cacheReadTokens ?? 0) } : {}),
|
|
825
|
+
...(a.cacheWriteTokens || b.cacheWriteTokens ? { cacheWriteTokens: (a.cacheWriteTokens ?? 0) + (b.cacheWriteTokens ?? 0) } : {}),
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function hasOwnSandbox(profile) {
|
|
829
|
+
return !!profile && typeof profile.sandbox === "object" && profile.sandbox !== null && "own" in profile.sandbox;
|
|
830
|
+
}
|
|
831
|
+
function errorMessage(err) {
|
|
832
|
+
return err instanceof Error ? err.message : String(err);
|
|
833
|
+
}
|
|
834
|
+
//# sourceMappingURL=group-turns.js.map
|