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,661 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { SubagentError } from "../../../../kernel/errors/subagent-error.js";
|
|
3
|
+
import { SDKEventType } from "../../../event-handler/events.js";
|
|
4
|
+
import { Semaphore } from "./semaphore.js";
|
|
5
|
+
import { runTypeTurn } from "./child-loop.js";
|
|
6
|
+
import { buildBrief, childToolScope, describeResult, safeError, sanitizeChildOutput, validateRequest } from "./brief.js";
|
|
7
|
+
import { isSubagentSession, resolveSubagentConfig, } from "./types.js";
|
|
8
|
+
const ZERO_USAGE = { inputTokens: 0, outputTokens: 0 };
|
|
9
|
+
/**
|
|
10
|
+
* SubagentManager (A-105) — owns everything about subagents for one agent:
|
|
11
|
+
*
|
|
12
|
+
* - as a PARENT: spawn() validates the brief and target, takes a slot of the turn's
|
|
13
|
+
* semaphore, creates the child's session, runs the child turn through the host's runner
|
|
14
|
+
* (or the child's chat()), enforces the turn's shared budget and the child's deadline,
|
|
15
|
+
* and records the run (PersistenceHub.subagentRuns) and its lifecycle events;
|
|
16
|
+
* Design revision: the target is a subagent TYPE (a short-lived loop inside this agent,
|
|
17
|
+
* child-loop.ts, in a side-branch session of this agent) or an existing AGENT;
|
|
18
|
+
* - as a CHILD (subagentSide): knows which of its sessions are child runs, routes their
|
|
19
|
+
* approvals to the parent's channel to the user, refuses their questions, scopes their
|
|
20
|
+
* tools (read-only by default) and holds the single writer slot.
|
|
21
|
+
*
|
|
22
|
+
* It hears the child's model responses, tool calls and max-iterations events on the bus to
|
|
23
|
+
* account tokens and tool calls while the child runs.
|
|
24
|
+
*/
|
|
25
|
+
export class SubagentManager {
|
|
26
|
+
deps;
|
|
27
|
+
budgets = new Map();
|
|
28
|
+
active = new Map();
|
|
29
|
+
byChildSession = new Map();
|
|
30
|
+
unsubscribes = [];
|
|
31
|
+
disposed = false;
|
|
32
|
+
// Child side: this agent's sessions that are someone's child runs.
|
|
33
|
+
bindings = new Map();
|
|
34
|
+
writerRunId;
|
|
35
|
+
/** The child-side half, used by the parent's SubagentManager through SubagentTarget.subagentSide. */
|
|
36
|
+
subagentSide = {
|
|
37
|
+
bind: (sessionId, binding) => {
|
|
38
|
+
this.bindings.set(sessionId, binding);
|
|
39
|
+
},
|
|
40
|
+
unbind: (sessionId) => {
|
|
41
|
+
this.bindings.delete(sessionId);
|
|
42
|
+
},
|
|
43
|
+
tryAcquireWriter: (runId) => {
|
|
44
|
+
if (this.writerRunId && this.writerRunId !== runId)
|
|
45
|
+
return false;
|
|
46
|
+
this.writerRunId = runId;
|
|
47
|
+
return true;
|
|
48
|
+
},
|
|
49
|
+
releaseWriter: (runId) => {
|
|
50
|
+
if (this.writerRunId === runId)
|
|
51
|
+
this.writerRunId = undefined;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
constructor(deps) {
|
|
55
|
+
this.deps = deps;
|
|
56
|
+
const bus = deps.eventBus;
|
|
57
|
+
this.unsubscribes.push(bus.on(SDKEventType.ModelResponded, (e) => {
|
|
58
|
+
const run = this.byChildSession.get(e.sessionId);
|
|
59
|
+
if (run && e.payload.usage)
|
|
60
|
+
this.addUsage(run, e.payload.usage);
|
|
61
|
+
}), bus.on(SDKEventType.ToolDispatched, (e) => {
|
|
62
|
+
const run = this.byChildSession.get(e.sessionId);
|
|
63
|
+
if (!run)
|
|
64
|
+
return;
|
|
65
|
+
run.run.toolCalls++;
|
|
66
|
+
run.budget.toolCalls++;
|
|
67
|
+
this.enforceBudget(run.budget);
|
|
68
|
+
}), bus.on(SDKEventType.MaxIterationsReached, (e) => {
|
|
69
|
+
const run = this.byChildSession.get(e.sessionId);
|
|
70
|
+
if (run)
|
|
71
|
+
run.maxIterations = true;
|
|
72
|
+
}),
|
|
73
|
+
// A parent turn ended: its children are done (spawn waits for them), so its budget goes.
|
|
74
|
+
bus.on(SDKEventType.RunCompleted, (e) => {
|
|
75
|
+
if (e.payload.agentId === deps.agentId)
|
|
76
|
+
this.dropIdleBudgets(e.sessionId);
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// Parent side
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
get running() {
|
|
83
|
+
return this.active.size;
|
|
84
|
+
}
|
|
85
|
+
async targets(sessionId) {
|
|
86
|
+
const config = this.configFor(sessionId ? this.deps.getScope?.(sessionId) : undefined);
|
|
87
|
+
const out = [];
|
|
88
|
+
const hub = this.deps.getHub();
|
|
89
|
+
if (hub) {
|
|
90
|
+
for (const name of config.types) {
|
|
91
|
+
const type = await hub.get(name).catch(() => undefined);
|
|
92
|
+
if (type)
|
|
93
|
+
out.push({ kind: "type", agentId: type.name, name: type.name, access: type.access, description: type.description });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const host = this.deps.getHost();
|
|
97
|
+
if (host) {
|
|
98
|
+
for (const target of config.allow) {
|
|
99
|
+
const agent = host.get(target.agentId);
|
|
100
|
+
if (!agent || agent.profile.id === this.deps.agentId)
|
|
101
|
+
continue;
|
|
102
|
+
out.push({ kind: "agent", agentId: agent.profile.id, name: agent.profile.name, access: target.access, description: firstLine(agent.profile.systemPrompt) });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
async list(parentSessionId) {
|
|
108
|
+
const runs = await this.deps.getStore().listByParentSession(parentSessionId);
|
|
109
|
+
return runs.filter((r) => r.parentAgentId === this.deps.agentId).map((r) => this.live(r));
|
|
110
|
+
}
|
|
111
|
+
async get(runId) {
|
|
112
|
+
const run = await this.deps.getStore().get(runId);
|
|
113
|
+
return run && run.parentAgentId === this.deps.agentId ? this.live(run) : null;
|
|
114
|
+
}
|
|
115
|
+
stop(runId) {
|
|
116
|
+
const run = this.active.get(runId);
|
|
117
|
+
if (!run)
|
|
118
|
+
return false;
|
|
119
|
+
this.abort(run, "cancelled");
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
async spawn(request, context) {
|
|
123
|
+
if (this.disposed)
|
|
124
|
+
throw new SubagentError("this agent is shutting down", "not_found");
|
|
125
|
+
// A-106: a scoped session (a group lead) delegates by its scope, not the profile's config.
|
|
126
|
+
const scope = this.deps.getScope?.(context.sessionId);
|
|
127
|
+
const config = this.configFor(scope);
|
|
128
|
+
await this.refuseNested(context.sessionId);
|
|
129
|
+
const brief = validateRequest(request);
|
|
130
|
+
const target = await this.resolveTarget(brief.agentId, config, context.sessionId);
|
|
131
|
+
const { access } = target;
|
|
132
|
+
// A type works in this agent's sandbox; an agent in its own.
|
|
133
|
+
const writerSide = target.kind === "type" ? this.subagentSide : target.agent.subagentSide;
|
|
134
|
+
const run = {
|
|
135
|
+
id: randomUUID(),
|
|
136
|
+
kind: target.kind,
|
|
137
|
+
parentAgentId: this.deps.agentId,
|
|
138
|
+
parentSessionId: context.sessionId,
|
|
139
|
+
parentRunId: context.runId ?? `session:${context.sessionId}`,
|
|
140
|
+
...(context.toolCallId ? { parentToolCallId: context.toolCallId } : {}),
|
|
141
|
+
childAgentId: target.kind === "type" ? this.deps.agentId : target.agent.profile.id,
|
|
142
|
+
childAgentName: target.name,
|
|
143
|
+
access,
|
|
144
|
+
task: brief.task,
|
|
145
|
+
status: "running",
|
|
146
|
+
usage: { ...ZERO_USAGE },
|
|
147
|
+
toolCalls: 0,
|
|
148
|
+
startedAt: new Date().toISOString(),
|
|
149
|
+
};
|
|
150
|
+
// One writer per sandbox: refused now, before anything is queued or recorded.
|
|
151
|
+
if (access === "write" && !writerSide.tryAcquireWriter(run.id)) {
|
|
152
|
+
throw new SubagentError(target.kind === "type"
|
|
153
|
+
? "a write-capable subagent is already working in your sandbox; wait for it, or delegate read-only work"
|
|
154
|
+
: `"${target.name}" is already running a write-capable task; wait for it, or delegate read-only work`, "write_unavailable");
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
const budget = this.budgetFor(run.parentRunId, context.sessionId, config);
|
|
158
|
+
const refused = this.budgetRefusal(budget, config);
|
|
159
|
+
if (refused)
|
|
160
|
+
return await this.finishUnstarted(run, "budget_exhausted", refused);
|
|
161
|
+
budget.launched++;
|
|
162
|
+
budget.touchedAt = Date.now();
|
|
163
|
+
const slot = await budget.semaphore.acquire(context.signal);
|
|
164
|
+
if (!slot)
|
|
165
|
+
return await this.finishUnstarted(run, "cancelled", "the parent turn was stopped before the subagent started");
|
|
166
|
+
try {
|
|
167
|
+
const late = this.budgetRefusal(budget, config, true);
|
|
168
|
+
if (late)
|
|
169
|
+
return await this.finishUnstarted(run, "budget_exhausted", late);
|
|
170
|
+
return await this.runChild(run, target, brief, context, budget, config, scope);
|
|
171
|
+
}
|
|
172
|
+
finally {
|
|
173
|
+
slot.release();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
if (access === "write")
|
|
178
|
+
writerSide.releaseWriter(run.id);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/** A-106: the session's grants — spawn_subagent for a scoped session that asks for it. */
|
|
182
|
+
grantedTools(sessionId) {
|
|
183
|
+
return this.deps.getScope?.(sessionId)?.grantSpawnTool ? ["spawn_subagent"] : [];
|
|
184
|
+
}
|
|
185
|
+
/** A-106: spawn_subagent runs without asking in a scoped session that the user set up for it. */
|
|
186
|
+
preApproved(sessionId, toolName) {
|
|
187
|
+
return toolName === "spawn_subagent" && this.deps.getScope?.(sessionId)?.preApproved === true;
|
|
188
|
+
}
|
|
189
|
+
/** The profile's config, or (A-106) the scope's targets and limits over it. */
|
|
190
|
+
configFor(scope) {
|
|
191
|
+
const own = this.deps.getProfile().subagents;
|
|
192
|
+
if (!scope)
|
|
193
|
+
return resolveSubagentConfig(own);
|
|
194
|
+
return resolveSubagentConfig({ ...own, ...scope.limits, allow: scope.allow, types: [] });
|
|
195
|
+
}
|
|
196
|
+
/** Stop every running child and stop listening. Runs in progress record themselves as cancelled. */
|
|
197
|
+
dispose() {
|
|
198
|
+
this.disposed = true;
|
|
199
|
+
for (const run of this.active.values())
|
|
200
|
+
this.abort(run, "cancelled");
|
|
201
|
+
for (const off of this.unsubscribes)
|
|
202
|
+
off();
|
|
203
|
+
this.unsubscribes = [];
|
|
204
|
+
}
|
|
205
|
+
async runChild(run, target, brief, context, budget, config, scope) {
|
|
206
|
+
const parent = { runId: run.parentRunId, agentId: this.deps.agentId, sessionId: context.sessionId, subagentRunId: run.id };
|
|
207
|
+
const metadata = {
|
|
208
|
+
agentId: run.childAgentId,
|
|
209
|
+
source: "subagent",
|
|
210
|
+
kind: target.kind,
|
|
211
|
+
parentRunId: parent.runId,
|
|
212
|
+
parentSessionId: parent.sessionId,
|
|
213
|
+
parentAgentId: parent.agentId,
|
|
214
|
+
subagentRunId: run.id,
|
|
215
|
+
title: `${target.name}: ${firstLine(brief.task, 60)}`,
|
|
216
|
+
};
|
|
217
|
+
// A-106: a scope may name the child's session (a group member's own session in the group).
|
|
218
|
+
let session;
|
|
219
|
+
try {
|
|
220
|
+
session =
|
|
221
|
+
scope?.childSession && target.kind === "agent"
|
|
222
|
+
? { id: await scope.childSession(target.agent.profile.id) }
|
|
223
|
+
: await this.deps.getSessions().create({ ...metadata });
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
return this.finishUnstarted(run, "failed", `could not create the subagent's session: ${errorMessage(err)}`);
|
|
227
|
+
}
|
|
228
|
+
run.childSessionId = session.id;
|
|
229
|
+
const active = { run, controller: new AbortController(), budget, maxIterations: false };
|
|
230
|
+
this.active.set(run.id, active);
|
|
231
|
+
this.byChildSession.set(session.id, active);
|
|
232
|
+
budget.active.add(active);
|
|
233
|
+
budget.firstStartAt ??= Date.now();
|
|
234
|
+
budget.touchedAt = Date.now();
|
|
235
|
+
// The child's channel to the user: approvals go to the parent's session.
|
|
236
|
+
const interaction = this.childInteraction(context.interaction ?? this.deps.interactionFor(context.sessionId), target.name, run.childAgentId, parent);
|
|
237
|
+
// An agent child learns which of its sessions is a child run (approvals, tool scope); a
|
|
238
|
+
// type's loop is built with both, so nothing needs binding.
|
|
239
|
+
if (target.kind === "agent")
|
|
240
|
+
target.agent.subagentSide.bind(session.id, { parent, access: run.access, interaction });
|
|
241
|
+
await this.save(run);
|
|
242
|
+
this.deps.eventBus.emit({
|
|
243
|
+
type: SDKEventType.SubagentSpawned,
|
|
244
|
+
sessionId: context.sessionId,
|
|
245
|
+
payload: {
|
|
246
|
+
agentId: this.deps.agentId,
|
|
247
|
+
runId: run.id,
|
|
248
|
+
parentRunId: run.parentRunId,
|
|
249
|
+
...(run.parentToolCallId ? { parentToolCallId: run.parentToolCallId } : {}),
|
|
250
|
+
childAgentId: run.childAgentId,
|
|
251
|
+
childSessionId: session.id,
|
|
252
|
+
access: run.access,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
// The parent turn's stop, the child's deadline (never past the turn's elapsed budget)
|
|
256
|
+
// and stop(runId) all abort the child's signal.
|
|
257
|
+
const onParentAbort = () => this.abort(active, "cancelled");
|
|
258
|
+
if (context.signal?.aborted)
|
|
259
|
+
onParentAbort();
|
|
260
|
+
context.signal?.addEventListener("abort", onParentAbort, { once: true });
|
|
261
|
+
const remaining = budget.firstStartAt + config.maxElapsedMsPerTurn - Date.now();
|
|
262
|
+
const deadlineMs = Math.max(0, Math.min(config.childTimeoutMs, remaining));
|
|
263
|
+
const reasonAtDeadline = config.childTimeoutMs <= remaining ? "timeout" : "budget";
|
|
264
|
+
const timer = setTimeout(() => this.abort(active, reasonAtDeadline), deadlineMs);
|
|
265
|
+
let result;
|
|
266
|
+
let failure;
|
|
267
|
+
try {
|
|
268
|
+
const prompt = scope?.brief
|
|
269
|
+
? await scope.brief(brief, { agentId: run.childAgentId, name: target.name, runId: run.id })
|
|
270
|
+
: buildBrief(brief, this.deps.getProfile().name, run.access);
|
|
271
|
+
const traceAttributes = {
|
|
272
|
+
source: "subagent",
|
|
273
|
+
subagentKind: target.kind,
|
|
274
|
+
...(target.kind === "type" ? { subagentType: target.name } : {}),
|
|
275
|
+
parentAgentId: parent.agentId,
|
|
276
|
+
parentSessionId: parent.sessionId,
|
|
277
|
+
parentRunId: parent.runId,
|
|
278
|
+
subagentRunId: run.id,
|
|
279
|
+
...(run.parentToolCallId ? { parentToolCallId: run.parentToolCallId } : {}),
|
|
280
|
+
};
|
|
281
|
+
const sessionId = session.id;
|
|
282
|
+
const turn = {
|
|
283
|
+
kind: target.kind,
|
|
284
|
+
agentId: run.childAgentId,
|
|
285
|
+
childAgentName: target.name,
|
|
286
|
+
sessionId,
|
|
287
|
+
prompt,
|
|
288
|
+
task: brief.task,
|
|
289
|
+
signal: active.controller.signal,
|
|
290
|
+
parent,
|
|
291
|
+
traceAttributes,
|
|
292
|
+
execute: (signal) => target.kind === "type"
|
|
293
|
+
? runTypeTurn(this.deps.childLoop, this.deps.getProfile(), target.type, { sessionId, parentSessionId: parent.sessionId, prompt, signal, traceAttributes, interaction })
|
|
294
|
+
: chatTurn(target.agent, { sessionId, prompt, signal, traceAttributes }),
|
|
295
|
+
};
|
|
296
|
+
result = await (scope?.runner ?? this.deps.getRunner() ?? this.defaultRunner)(turn);
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
failure = err;
|
|
300
|
+
}
|
|
301
|
+
finally {
|
|
302
|
+
clearTimeout(timer);
|
|
303
|
+
context.signal?.removeEventListener("abort", onParentAbort);
|
|
304
|
+
if (target.kind === "agent")
|
|
305
|
+
target.agent.subagentSide.unbind(session.id);
|
|
306
|
+
this.active.delete(run.id);
|
|
307
|
+
this.byChildSession.delete(session.id);
|
|
308
|
+
budget.active.delete(active);
|
|
309
|
+
budget.touchedAt = Date.now();
|
|
310
|
+
}
|
|
311
|
+
// Tokens: the result's total wins when the events missed some (a streamed turn reports none).
|
|
312
|
+
if (result) {
|
|
313
|
+
const reported = result.usage.inputTokens + result.usage.outputTokens;
|
|
314
|
+
const counted = run.usage.inputTokens + run.usage.outputTokens;
|
|
315
|
+
if (reported > counted) {
|
|
316
|
+
budget.tokens += reported - counted;
|
|
317
|
+
run.usage = { ...result.usage };
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
const status = this.statusOf(active, context, result, failure);
|
|
321
|
+
let output = status === "completed" ? (result?.output ?? "") : "";
|
|
322
|
+
if (status !== "completed" && status !== "cancelled")
|
|
323
|
+
output = await this.lastReport(session.id);
|
|
324
|
+
const error = status === "completed"
|
|
325
|
+
? undefined
|
|
326
|
+
: status === "failed"
|
|
327
|
+
? safeError(failure !== undefined ? `the subagent's run failed: ${errorMessage(failure)}` : "the model stopped the subagent's reply (refusal or content filter)")
|
|
328
|
+
: status === "partial"
|
|
329
|
+
? active.maxIterations
|
|
330
|
+
? "the subagent reached its turn limit (maxIterations)"
|
|
331
|
+
: "the subagent's reply hit the output token limit"
|
|
332
|
+
: status === "timed_out"
|
|
333
|
+
? `the subagent did not finish within ${Math.round(config.childTimeoutMs / 1000)}s`
|
|
334
|
+
: status === "budget_exhausted"
|
|
335
|
+
? "the subagent budget of this turn ran out"
|
|
336
|
+
: "the subagent was stopped";
|
|
337
|
+
return this.finish(run, status, output, error);
|
|
338
|
+
}
|
|
339
|
+
/** Default runner (no host runner): the turn itself — the child agent's chat(), or the type's loop. */
|
|
340
|
+
defaultRunner = (turn) => turn.execute(turn.signal);
|
|
341
|
+
statusOf(active, context, result, failure) {
|
|
342
|
+
// A turn that ended on its own keeps its outcome, even when a stop came in as it finished
|
|
343
|
+
// (its last response crossed the budget, the deadline fired during the final save).
|
|
344
|
+
const endedOnItsOwn = failure === undefined && result !== undefined && !result.aborted;
|
|
345
|
+
if (!endedOnItsOwn) {
|
|
346
|
+
if (active.reason === "budget")
|
|
347
|
+
return "budget_exhausted";
|
|
348
|
+
if (active.reason === "timeout")
|
|
349
|
+
return "timed_out";
|
|
350
|
+
if (active.reason === "cancelled" || context.signal?.aborted)
|
|
351
|
+
return "cancelled";
|
|
352
|
+
}
|
|
353
|
+
if (failure !== undefined || !result)
|
|
354
|
+
return "failed";
|
|
355
|
+
if (result.aborted)
|
|
356
|
+
return "cancelled";
|
|
357
|
+
if (result.stopReason === "error")
|
|
358
|
+
return "failed";
|
|
359
|
+
if (result.stopReason === "max_tokens" || active.maxIterations)
|
|
360
|
+
return "partial";
|
|
361
|
+
return "completed";
|
|
362
|
+
}
|
|
363
|
+
/** The child's last non-empty reply in its session — what a partial run hands back. */
|
|
364
|
+
async lastReport(sessionId) {
|
|
365
|
+
let messages;
|
|
366
|
+
try {
|
|
367
|
+
messages = await this.deps.getMessages().get(sessionId);
|
|
368
|
+
}
|
|
369
|
+
catch {
|
|
370
|
+
return "";
|
|
371
|
+
}
|
|
372
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
373
|
+
const m = messages[i];
|
|
374
|
+
if (m.role === "assistant" && !m.toolResults?.length && m.content.trim())
|
|
375
|
+
return m.content;
|
|
376
|
+
}
|
|
377
|
+
return "";
|
|
378
|
+
}
|
|
379
|
+
async finish(run, status, output, error) {
|
|
380
|
+
const finishedAt = new Date();
|
|
381
|
+
const result = {
|
|
382
|
+
...run,
|
|
383
|
+
status,
|
|
384
|
+
...(output.trim() ? { output: sanitizeChildOutput(output) } : {}),
|
|
385
|
+
...(error ? { error } : {}),
|
|
386
|
+
finishedAt: finishedAt.toISOString(),
|
|
387
|
+
durationMs: Math.max(0, finishedAt.getTime() - Date.parse(run.startedAt)),
|
|
388
|
+
};
|
|
389
|
+
await this.save(result);
|
|
390
|
+
const type = status === "completed" || status === "partial"
|
|
391
|
+
? SDKEventType.SubagentCompleted
|
|
392
|
+
: status === "cancelled"
|
|
393
|
+
? SDKEventType.SubagentCancelled
|
|
394
|
+
: SDKEventType.SubagentFailed;
|
|
395
|
+
this.deps.eventBus.emit({
|
|
396
|
+
type,
|
|
397
|
+
sessionId: result.parentSessionId,
|
|
398
|
+
payload: {
|
|
399
|
+
agentId: this.deps.agentId,
|
|
400
|
+
runId: result.id,
|
|
401
|
+
parentRunId: result.parentRunId,
|
|
402
|
+
...(result.parentToolCallId ? { parentToolCallId: result.parentToolCallId } : {}),
|
|
403
|
+
childAgentId: result.childAgentId,
|
|
404
|
+
...(result.childSessionId ? { childSessionId: result.childSessionId } : {}),
|
|
405
|
+
status,
|
|
406
|
+
usage: result.usage,
|
|
407
|
+
toolCalls: result.toolCalls,
|
|
408
|
+
durationMs: result.durationMs ?? 0,
|
|
409
|
+
...(result.error ? { error: result.error } : {}),
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
return result;
|
|
413
|
+
}
|
|
414
|
+
/** A run that ended before its child turn started. */
|
|
415
|
+
finishUnstarted(run, status, error) {
|
|
416
|
+
return this.finish(run, status, "", safeError(error));
|
|
417
|
+
}
|
|
418
|
+
async save(run) {
|
|
419
|
+
try {
|
|
420
|
+
await this.deps.getStore().save(run);
|
|
421
|
+
}
|
|
422
|
+
catch (err) {
|
|
423
|
+
console.warn(`[subagent] could not save run ${run.id}:`, errorMessage(err));
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/** A stored record, with the live token and tool-call counts while it runs here. */
|
|
427
|
+
live(run) {
|
|
428
|
+
const active = this.active.get(run.id);
|
|
429
|
+
return active ? { ...run, usage: { ...active.run.usage }, toolCalls: active.run.toolCalls } : run;
|
|
430
|
+
}
|
|
431
|
+
/** V1 nesting depth is 1: a session that is itself a child run cannot delegate. */
|
|
432
|
+
async refuseNested(sessionId) {
|
|
433
|
+
let nested = this.bindings.has(sessionId);
|
|
434
|
+
if (!nested) {
|
|
435
|
+
try {
|
|
436
|
+
nested = isSubagentSession(await this.deps.getSessions().get(sessionId));
|
|
437
|
+
}
|
|
438
|
+
catch {
|
|
439
|
+
nested = false;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (nested) {
|
|
443
|
+
throw new SubagentError("you are running as a subagent and cannot delegate further — do the work yourself", "depth_exceeded");
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* The target `ref` names: an enabled subagent type (by name) first, then an allowed running
|
|
448
|
+
* agent (by id or name). Throws SubagentError for anything that can't run.
|
|
449
|
+
*/
|
|
450
|
+
async resolveTarget(ref, config, sessionId) {
|
|
451
|
+
const self = this.deps.getProfile();
|
|
452
|
+
if (ref === self.id || ref.toLowerCase() === self.name.toLowerCase()) {
|
|
453
|
+
throw new SubagentError("an agent cannot delegate to itself", "depth_exceeded");
|
|
454
|
+
}
|
|
455
|
+
const hub = this.deps.getHub();
|
|
456
|
+
const host = this.deps.getHost();
|
|
457
|
+
if ((!config.types.length || !hub) && (!config.allow.length || !host)) {
|
|
458
|
+
throw new SubagentError("you have no subagents configured — do the work yourself", "not_allowed");
|
|
459
|
+
}
|
|
460
|
+
const lower = ref.toLowerCase();
|
|
461
|
+
if (hub && config.types.some((t) => t === ref || t === lower)) {
|
|
462
|
+
const type = await hub.get(config.types.includes(ref) ? ref : lower);
|
|
463
|
+
if (!type)
|
|
464
|
+
throw new SubagentError(`the subagent type "${ref}" no longer exists`, "not_found");
|
|
465
|
+
return { kind: "type", type, access: type.access, name: type.name };
|
|
466
|
+
}
|
|
467
|
+
let match;
|
|
468
|
+
let configuredButStopped = false;
|
|
469
|
+
for (const target of host ? config.allow : []) {
|
|
470
|
+
const agent = host.get(target.agentId);
|
|
471
|
+
const named = target.agentId === ref || agent?.profile.name.toLowerCase() === lower;
|
|
472
|
+
if (!named)
|
|
473
|
+
continue;
|
|
474
|
+
if (!agent) {
|
|
475
|
+
configuredButStopped = true;
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
match = { agent, access: target.access };
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
if (!match) {
|
|
482
|
+
const allowed = (await this.targets(sessionId)).map((t) => (t.kind === "type" ? `"${t.name}"` : `"${t.name}" (${t.agentId})`)).join(", ");
|
|
483
|
+
if (configuredButStopped)
|
|
484
|
+
throw new SubagentError(`the agent "${ref}" is not running`, "not_found");
|
|
485
|
+
throw new SubagentError(`"${ref}" is not one of your subagents${allowed ? ` — you may delegate to: ${allowed}` : ""}`, "not_allowed");
|
|
486
|
+
}
|
|
487
|
+
if (match.access === "write" && !hasOwnSandbox(match.agent.profile)) {
|
|
488
|
+
throw new SubagentError(`"${match.agent.profile.name}" is set up for write access but has no sandbox of its own — a writing subagent must not share a workspace`, "write_unavailable");
|
|
489
|
+
}
|
|
490
|
+
return { kind: "agent", agent: match.agent, access: match.access, name: match.agent.profile.name };
|
|
491
|
+
}
|
|
492
|
+
/** The child's channel to the user: approvals go to the parent's (shown in the parent's chat), questions are refused. */
|
|
493
|
+
childInteraction(parentHandler, childName, childAgentId, parent) {
|
|
494
|
+
return {
|
|
495
|
+
askUser: async () => {
|
|
496
|
+
throw new Error("you are running as a subagent and cannot ask the user — make a reasonable assumption and state it in your report");
|
|
497
|
+
},
|
|
498
|
+
requestApproval: async (request) => {
|
|
499
|
+
if (!parentHandler) {
|
|
500
|
+
return { approved: false, reason: "no interactive user is available to approve a subagent's action" };
|
|
501
|
+
}
|
|
502
|
+
return parentHandler.requestApproval({
|
|
503
|
+
...request,
|
|
504
|
+
sessionId: parent.sessionId,
|
|
505
|
+
agentId: parent.agentId,
|
|
506
|
+
subagent: { agentId: childAgentId, agentName: childName, sessionId: request.sessionId, runId: parent.subagentRunId },
|
|
507
|
+
});
|
|
508
|
+
},
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
// ---------------------------------------------------------------------------
|
|
512
|
+
// Budgets
|
|
513
|
+
// ---------------------------------------------------------------------------
|
|
514
|
+
budgetFor(key, parentSessionId, config) {
|
|
515
|
+
this.pruneBudgets(config);
|
|
516
|
+
let budget = this.budgets.get(key);
|
|
517
|
+
if (!budget) {
|
|
518
|
+
budget = {
|
|
519
|
+
parentSessionId,
|
|
520
|
+
maxTokens: config.maxTokensPerTurn,
|
|
521
|
+
maxToolCalls: config.maxToolCallsPerTurn,
|
|
522
|
+
semaphore: new Semaphore(config.maxConcurrent),
|
|
523
|
+
launched: 0,
|
|
524
|
+
tokens: 0,
|
|
525
|
+
toolCalls: 0,
|
|
526
|
+
active: new Set(),
|
|
527
|
+
touchedAt: Date.now(),
|
|
528
|
+
};
|
|
529
|
+
this.budgets.set(key, budget);
|
|
530
|
+
}
|
|
531
|
+
return budget;
|
|
532
|
+
}
|
|
533
|
+
/** Why no further child may start in this turn, or undefined. `started`: the run already counts in `launched`. */
|
|
534
|
+
budgetRefusal(budget, config, started = false) {
|
|
535
|
+
if (!started && budget.launched >= config.maxRunsPerTurn) {
|
|
536
|
+
return `this turn already started ${config.maxRunsPerTurn} subagents (maxRunsPerTurn)`;
|
|
537
|
+
}
|
|
538
|
+
if (budget.tokens >= config.maxTokensPerTurn)
|
|
539
|
+
return `the subagents of this turn used their ${config.maxTokensPerTurn} tokens (maxTokensPerTurn)`;
|
|
540
|
+
if (budget.toolCalls >= config.maxToolCallsPerTurn) {
|
|
541
|
+
return `the subagents of this turn made their ${config.maxToolCallsPerTurn} tool calls (maxToolCallsPerTurn)`;
|
|
542
|
+
}
|
|
543
|
+
if (budget.firstStartAt !== undefined && Date.now() - budget.firstStartAt >= config.maxElapsedMsPerTurn) {
|
|
544
|
+
return `the subagents of this turn used their ${Math.round(config.maxElapsedMsPerTurn / 1000)}s (maxElapsedMsPerTurn)`;
|
|
545
|
+
}
|
|
546
|
+
return undefined;
|
|
547
|
+
}
|
|
548
|
+
addUsage(run, usage) {
|
|
549
|
+
run.run.usage = {
|
|
550
|
+
inputTokens: run.run.usage.inputTokens + usage.inputTokens,
|
|
551
|
+
outputTokens: run.run.usage.outputTokens + usage.outputTokens,
|
|
552
|
+
...(usage.cacheReadTokens || run.run.usage.cacheReadTokens
|
|
553
|
+
? { cacheReadTokens: (run.run.usage.cacheReadTokens ?? 0) + (usage.cacheReadTokens ?? 0) }
|
|
554
|
+
: {}),
|
|
555
|
+
...(usage.cacheWriteTokens || run.run.usage.cacheWriteTokens
|
|
556
|
+
? { cacheWriteTokens: (run.run.usage.cacheWriteTokens ?? 0) + (usage.cacheWriteTokens ?? 0) }
|
|
557
|
+
: {}),
|
|
558
|
+
};
|
|
559
|
+
run.budget.tokens += usage.inputTokens + usage.outputTokens;
|
|
560
|
+
this.enforceBudget(run.budget);
|
|
561
|
+
}
|
|
562
|
+
/** Over the turn's token or tool-call budget: stop every running child of the turn. */
|
|
563
|
+
enforceBudget(budget) {
|
|
564
|
+
if (budget.tokens <= budget.maxTokens && budget.toolCalls <= budget.maxToolCalls)
|
|
565
|
+
return;
|
|
566
|
+
for (const run of budget.active)
|
|
567
|
+
this.abort(run, "budget");
|
|
568
|
+
}
|
|
569
|
+
abort(run, reason) {
|
|
570
|
+
run.reason ??= reason;
|
|
571
|
+
run.controller.abort();
|
|
572
|
+
}
|
|
573
|
+
dropIdleBudgets(sessionId) {
|
|
574
|
+
for (const [key, budget] of this.budgets) {
|
|
575
|
+
if (budget.parentSessionId === sessionId && budget.active.size === 0 && budget.semaphore.busy === 0)
|
|
576
|
+
this.budgets.delete(key);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
/** Budgets of turns that never reported their end (a tool job's call) go once idle long enough. */
|
|
580
|
+
pruneBudgets(config) {
|
|
581
|
+
const cutoff = Date.now() - 2 * config.maxElapsedMsPerTurn;
|
|
582
|
+
for (const [key, budget] of this.budgets) {
|
|
583
|
+
if (budget.active.size === 0 && budget.semaphore.busy === 0 && budget.touchedAt < cutoff)
|
|
584
|
+
this.budgets.delete(key);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
// ---------------------------------------------------------------------------
|
|
588
|
+
// Child side — hooks the agent loop and context manager call for this agent's sessions
|
|
589
|
+
// ---------------------------------------------------------------------------
|
|
590
|
+
/** A child session's channel to the user (the parent's, for approvals only); undefined for other sessions. */
|
|
591
|
+
interactionFor(sessionId) {
|
|
592
|
+
const binding = this.bindings.get(sessionId);
|
|
593
|
+
if (!binding)
|
|
594
|
+
return undefined;
|
|
595
|
+
return (binding.interaction ?? {
|
|
596
|
+
askUser: async () => {
|
|
597
|
+
throw new Error("you are running as a subagent and cannot ask the user");
|
|
598
|
+
},
|
|
599
|
+
requestApproval: async () => ({ approved: false, reason: "no interactive user is available to approve a subagent's action" }),
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* A-135: the parent session of a child run's session, whose approval mode the child uses
|
|
604
|
+
* (its approvals are asked there); undefined for other sessions.
|
|
605
|
+
*/
|
|
606
|
+
parentSessionOf(sessionId) {
|
|
607
|
+
return this.bindings.get(sessionId)?.parent.sessionId;
|
|
608
|
+
}
|
|
609
|
+
/** A child session's tool scope (read-only by default); undefined for other sessions. */
|
|
610
|
+
toolScope(sessionId) {
|
|
611
|
+
const binding = this.bindings.get(sessionId);
|
|
612
|
+
return binding ? childToolScope(binding.access) : undefined;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* <available_subagents> for the system prompt: the subagent types and agents this one may
|
|
616
|
+
* delegate to. None in a child run's session, or when the agent lacks spawn_subagent.
|
|
617
|
+
*/
|
|
618
|
+
async buildIndex(session) {
|
|
619
|
+
const scope = this.deps.getScope?.(session.id);
|
|
620
|
+
if (this.bindings.has(session.id) || isSubagentSession(session) || (!this.deps.hasSpawnTool() && !scope?.grantSpawnTool))
|
|
621
|
+
return null;
|
|
622
|
+
const targets = await this.targets(session.id);
|
|
623
|
+
if (!targets.length)
|
|
624
|
+
return null;
|
|
625
|
+
const lines = targets.map((t) => t.kind === "type"
|
|
626
|
+
? `- ${t.name} (subagent type, ${t.access}): ${t.description}`
|
|
627
|
+
: `- ${t.name} (agent, id: ${t.agentId}, ${t.access})${t.description ? `: ${t.description}` : ""}`);
|
|
628
|
+
return ("<available_subagents>\n" +
|
|
629
|
+
"Subagents you can delegate a bounded task to with spawn_subagent (name the subagent type, or the agent's id). " +
|
|
630
|
+
(scope?.indexIntro ??
|
|
631
|
+
"Each starts fresh: give it everything it needs in the task. A subagent type is a specialist that runs with your " +
|
|
632
|
+
"tools and workspace; an agent is a separate agent with its own tools, memory and workspace.") +
|
|
633
|
+
" " +
|
|
634
|
+
"Delegate only independent work that benefits from a separate specialist or context — call spawn_subagent several times " +
|
|
635
|
+
"in one response for independent tasks (they run in parallel), and one after another when a task needs an earlier result.\n" +
|
|
636
|
+
`${lines.join("\n")}\n</available_subagents>`);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
/** spawn_subagent's text for a finished run. Re-exported for the tool. */
|
|
640
|
+
export { describeResult };
|
|
641
|
+
/** One turn of an existing agent in its child session. */
|
|
642
|
+
async function chatTurn(agent, turn) {
|
|
643
|
+
const result = await agent.chat(turn.prompt, undefined, { signal: turn.signal, sessionId: turn.sessionId, traceAttributes: turn.traceAttributes });
|
|
644
|
+
return {
|
|
645
|
+
output: result.message.content,
|
|
646
|
+
usage: result.usage,
|
|
647
|
+
...(result.aborted ? { aborted: true } : {}),
|
|
648
|
+
...(result.stopReason ? { stopReason: result.stopReason } : {}),
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
function hasOwnSandbox(profile) {
|
|
652
|
+
return typeof profile.sandbox === "object" && profile.sandbox !== null && "own" in profile.sandbox;
|
|
653
|
+
}
|
|
654
|
+
function firstLine(text, max = 160) {
|
|
655
|
+
const line = (text ?? "").split("\n").map((l) => l.trim()).find(Boolean) ?? "";
|
|
656
|
+
return line.length > max ? `${line.slice(0, max)}…` : line;
|
|
657
|
+
}
|
|
658
|
+
function errorMessage(err) {
|
|
659
|
+
return err instanceof Error ? err.message : String(err);
|
|
660
|
+
}
|
|
661
|
+
//# sourceMappingURL=subagent-manager.js.map
|