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
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { measureContext } from "./functions/context-usage.js";
|
|
1
2
|
import { resolveLoopConfig, SDKEventType } from "./types.js";
|
|
2
3
|
import { HarnessExecutor } from "./components/harness-executor.js";
|
|
3
4
|
import { Summarizer } from "./components/summarizer.js";
|
|
4
|
-
import { Compactor } from "./components/compactor.js";
|
|
5
|
+
import { Compactor, sessionCompactorConfig } from "./components/compactor.js";
|
|
5
6
|
import { repairToolPairs } from "./components/tool-pairing.js";
|
|
6
7
|
import { Counter } from "./components/counter.js";
|
|
7
8
|
import { abortable, raceAbort } from "./components/abort.js";
|
|
@@ -9,6 +10,23 @@ import { RunTrace } from "./components/run-trace.js";
|
|
|
9
10
|
import { recallMemories } from "./functions/memory-recall.js";
|
|
10
11
|
import { describeLlmInput, withRecalledMemories, } from "./functions/llm-input.js";
|
|
11
12
|
const TOKEN_BUDGET = 100_000;
|
|
13
|
+
// A-88: how many model responses in a row may be cut off at the output token limit
|
|
14
|
+
// while writing tool call arguments before the run stops (the model keeps retrying
|
|
15
|
+
// the same oversized call otherwise).
|
|
16
|
+
const MAX_CONSECUTIVE_TRUNCATIONS = 2;
|
|
17
|
+
/**
|
|
18
|
+
* The size of a session's context window as the latest model response reported it
|
|
19
|
+
* (input and output only): the session's currentTokenUsage, which recordUsage replaces
|
|
20
|
+
* after every call. Zero before the first response.
|
|
21
|
+
*/
|
|
22
|
+
function latestContextUsage(session) {
|
|
23
|
+
return {
|
|
24
|
+
inputTokens: session.currentTokenUsage?.inputTokens ?? 0,
|
|
25
|
+
outputTokens: session.currentTokenUsage?.outputTokens ?? 0,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** The model-call span's `error` when a response stopped with "error" and gave no error text. */
|
|
29
|
+
const MODEL_ERROR_STOP = "the model stopped with stopReason error";
|
|
12
30
|
// ---------------------------------------------------------------------------
|
|
13
31
|
// AgentLoop — OTAR cycle (Observe → Think → Act → Reflect)
|
|
14
32
|
// ---------------------------------------------------------------------------
|
|
@@ -35,27 +53,37 @@ export class AgentLoop {
|
|
|
35
53
|
executor;
|
|
36
54
|
compactor;
|
|
37
55
|
summarizer;
|
|
38
|
-
counter;
|
|
39
56
|
constructor(deps) {
|
|
40
57
|
this.deps = deps;
|
|
41
58
|
this.executor = new HarnessExecutor(deps);
|
|
42
59
|
this.summarizer = new Summarizer(deps);
|
|
43
60
|
this.compactor = new Compactor(deps.profile.compactor);
|
|
44
|
-
this.counter = new Counter(deps.modelManager);
|
|
45
61
|
}
|
|
46
62
|
/**
|
|
47
63
|
* run() — blocking call, returns final message
|
|
48
64
|
* @param userMessage
|
|
49
|
-
* @param
|
|
65
|
+
* @param conversation the session to run in (A-97) — the caller holds that session's turn slot
|
|
50
66
|
* @param modelOverrides
|
|
51
67
|
* @param runOptions
|
|
52
68
|
* @returns
|
|
53
69
|
*/
|
|
54
|
-
async run(userMessage,
|
|
55
|
-
const { modelManager, contextManager, conversationManager } = this.deps;
|
|
70
|
+
async run(userMessage, conversation, modelOverrides, runOptions) {
|
|
56
71
|
// A-65: aborting this stops the run at the next safe point (below) —
|
|
57
72
|
// same contract as stream()'s `signal`.
|
|
58
|
-
const run = await this.beginRun(userMessage,
|
|
73
|
+
const run = await this.beginRun(userMessage, conversation, runOptions);
|
|
74
|
+
try {
|
|
75
|
+
return await this.runLoop(run, modelOverrides);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
// A failed run (a model, context, store or tool port threw) ends every open span
|
|
79
|
+
// with the error and removes its trace context; no RunCompleted follows (as Go).
|
|
80
|
+
run.trace.fail(err);
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** The iteration loop of run(), after beginRun. */
|
|
85
|
+
async runLoop(run, modelOverrides) {
|
|
86
|
+
const { modelManager, contextManager } = this.deps;
|
|
59
87
|
const { signal, totalUsage, emit } = run;
|
|
60
88
|
const aborted = (iterations) => ({
|
|
61
89
|
message: { role: "assistant", content: "" },
|
|
@@ -100,6 +128,8 @@ export class AgentLoop {
|
|
|
100
128
|
});
|
|
101
129
|
modelSpan?.end({
|
|
102
130
|
stopReason: response.stopReason,
|
|
131
|
+
// A refusal or filter stop ends the span with status "error", not "ok".
|
|
132
|
+
...(response.stopReason === "error" && { error: MODEL_ERROR_STOP }),
|
|
103
133
|
inputTokens: response.usage.inputTokens,
|
|
104
134
|
outputTokens: response.usage.outputTokens,
|
|
105
135
|
hasToolCalls: !!response.message.toolCalls?.length,
|
|
@@ -109,13 +139,18 @@ export class AgentLoop {
|
|
|
109
139
|
arguments: tc.arguments,
|
|
110
140
|
})),
|
|
111
141
|
});
|
|
112
|
-
this.recordUsage(run, input
|
|
142
|
+
this.recordUsage(run, input, response.usage);
|
|
113
143
|
emit(SDKEventType.ModelResponded, {
|
|
114
144
|
stopReason: response.stopReason,
|
|
115
145
|
usage: response.usage,
|
|
116
146
|
hasToolCalls: !!response.message.toolCalls?.length,
|
|
117
147
|
});
|
|
118
|
-
|
|
148
|
+
this.emitContextUsage(run, iteration, input, response.message, response.usage);
|
|
149
|
+
// The response's usage is saved with the message it produced (none reported: no usage).
|
|
150
|
+
if (response.usage && (response.usage.inputTokens > 0 || response.usage.outputTokens > 0)) {
|
|
151
|
+
response.message.usage = { ...response.usage };
|
|
152
|
+
}
|
|
153
|
+
await run.conversation.addMessage(response.message);
|
|
119
154
|
// --- End turn: return final answer ---
|
|
120
155
|
if (response.stopReason === "end_turn") {
|
|
121
156
|
this.completeRun(run, iteration, iterSpan);
|
|
@@ -125,10 +160,49 @@ export class AgentLoop {
|
|
|
125
160
|
iterations: iteration,
|
|
126
161
|
};
|
|
127
162
|
}
|
|
163
|
+
// The provider reported a stop it does not map to a normal finish (e.g. a refusal or a
|
|
164
|
+
// guardrail/content filter): end the turn like stream() does, instead of asking the
|
|
165
|
+
// model again until maxIterations.
|
|
166
|
+
if (response.stopReason === "error") {
|
|
167
|
+
this.completeRun(run, iteration, iterSpan, "error");
|
|
168
|
+
return {
|
|
169
|
+
message: response.message,
|
|
170
|
+
usage: totalUsage,
|
|
171
|
+
iterations: iteration,
|
|
172
|
+
stopReason: "error",
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// A-88: the reply was cut off at the output token limit and has no tool calls:
|
|
176
|
+
// the turn ends here, no auto-continue.
|
|
177
|
+
if (response.stopReason === "max_tokens" &&
|
|
178
|
+
!response.message.toolCalls?.length) {
|
|
179
|
+
this.completeRun(run, iteration, iterSpan, "max_tokens");
|
|
180
|
+
return {
|
|
181
|
+
message: response.message,
|
|
182
|
+
usage: totalUsage,
|
|
183
|
+
iterations: iteration,
|
|
184
|
+
stopReason: "max_tokens",
|
|
185
|
+
};
|
|
186
|
+
}
|
|
128
187
|
// --- ACT: execute tool/skill calls ---
|
|
129
|
-
if (response.stopReason === "tool_use"
|
|
188
|
+
if ((response.stopReason === "tool_use" ||
|
|
189
|
+
response.stopReason === "max_tokens") &&
|
|
130
190
|
response.message.toolCalls?.length) {
|
|
131
|
-
await this.
|
|
191
|
+
const { truncationLimitReached } = await this.actOnToolCalls(run, input, response.stopReason, response.message.toolCalls);
|
|
192
|
+
// A-88: cut off mid tool call too many times in a row — stop. Like the
|
|
193
|
+
// max-iterations fallback, this message is returned but not saved.
|
|
194
|
+
if (truncationLimitReached) {
|
|
195
|
+
this.completeRun(run, iteration, iterSpan, "max_tokens");
|
|
196
|
+
return {
|
|
197
|
+
message: {
|
|
198
|
+
role: "assistant",
|
|
199
|
+
content: this.truncationLimitMessage(input),
|
|
200
|
+
},
|
|
201
|
+
usage: totalUsage,
|
|
202
|
+
iterations: iteration,
|
|
203
|
+
stopReason: "max_tokens",
|
|
204
|
+
};
|
|
205
|
+
}
|
|
132
206
|
}
|
|
133
207
|
// --- REFLECT: loop back, model sees tool results and decides next step ---
|
|
134
208
|
iterSpan?.end();
|
|
@@ -148,14 +222,53 @@ export class AgentLoop {
|
|
|
148
222
|
/**
|
|
149
223
|
* stream() — yields chunks in real-time, handles tool calls between streams
|
|
150
224
|
* @param userMessage
|
|
151
|
-
* @param
|
|
225
|
+
* @param conversation the session to run in (A-97) — the caller holds that session's turn slot
|
|
152
226
|
* @param modelOverrides
|
|
153
227
|
* @param runOptions
|
|
154
228
|
* @returns
|
|
155
229
|
*/
|
|
156
|
-
async *stream(userMessage,
|
|
157
|
-
const
|
|
158
|
-
|
|
230
|
+
async *stream(userMessage, conversation, modelOverrides, runOptions) {
|
|
231
|
+
const run = await this.beginRun(userMessage, conversation, runOptions);
|
|
232
|
+
try {
|
|
233
|
+
yield* this.streamLoop(run, modelOverrides);
|
|
234
|
+
}
|
|
235
|
+
catch (err) {
|
|
236
|
+
// A failed run ends every open span with the error and removes its trace
|
|
237
|
+
// context; no RunCompleted follows (as Go).
|
|
238
|
+
run.trace.fail(err);
|
|
239
|
+
throw err;
|
|
240
|
+
}
|
|
241
|
+
finally {
|
|
242
|
+
// The consumer stopped iterating (a break, a return, a closed HTTP response)
|
|
243
|
+
// before a terminal path ran: the run is closed as if it was aborted, so no span
|
|
244
|
+
// or trace context outlives it (as Go's Stream deferred cleanup). Never yields.
|
|
245
|
+
if (!run.trace.closed)
|
|
246
|
+
await this.closeStoppedStream(run);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Close a stream whose consumer stopped iterating: save the text the consumer
|
|
251
|
+
* received when there is some (never the tool calls collected from an unfinished
|
|
252
|
+
* response — they were not run and would dangle without a result), then close the
|
|
253
|
+
* run as aborted. A failed write is logged, not thrown: no consumer is left to
|
|
254
|
+
* receive it. The log carries the agent and session ids and the error text only,
|
|
255
|
+
* never message content.
|
|
256
|
+
*/
|
|
257
|
+
async closeStoppedStream(run) {
|
|
258
|
+
const partial = run.partial;
|
|
259
|
+
run.partial = "";
|
|
260
|
+
if (partial) {
|
|
261
|
+
try {
|
|
262
|
+
await run.conversation.addMessage({ role: "assistant", content: partial });
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
console.warn(`[agent-loop] saving the partial reply of a stopped stream failed for agent ${this.deps.profile.id} session ${run.session.id}:`, err instanceof Error ? err.message : String(err));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
this.closeAbortedRun(run, run.iteration, null);
|
|
269
|
+
}
|
|
270
|
+
/** The iteration loop of stream(), after beginRun. */
|
|
271
|
+
async *streamLoop(run, modelOverrides) {
|
|
159
272
|
const { signal, totalUsage, emit } = run;
|
|
160
273
|
let iteration = 0;
|
|
161
274
|
while (iteration < run.maxIterations) {
|
|
@@ -188,8 +301,9 @@ export class AgentLoop {
|
|
|
188
301
|
// never dispatched and would dangle without a matching tool result.
|
|
189
302
|
if (signal?.aborted) {
|
|
190
303
|
modelSpan?.end({ aborted: true, responsePreview: streamed.content });
|
|
304
|
+
run.partial = "";
|
|
191
305
|
if (streamed.content) {
|
|
192
|
-
await
|
|
306
|
+
await run.conversation.addMessage({
|
|
193
307
|
role: "assistant",
|
|
194
308
|
content: streamed.content,
|
|
195
309
|
});
|
|
@@ -201,6 +315,8 @@ export class AgentLoop {
|
|
|
201
315
|
const { content, toolCalls, stopReason, usage } = streamed;
|
|
202
316
|
modelSpan?.end({
|
|
203
317
|
stopReason,
|
|
318
|
+
// An error chunk (or a refusal/filter stop) ends the span with status "error", not "ok".
|
|
319
|
+
...(stopReason === "error" && { error: streamed.error ?? MODEL_ERROR_STOP }),
|
|
204
320
|
hasToolCalls: !!toolCalls.length,
|
|
205
321
|
responsePreview: content,
|
|
206
322
|
toolCalls: toolCalls.length
|
|
@@ -218,23 +334,50 @@ export class AgentLoop {
|
|
|
218
334
|
role: "assistant",
|
|
219
335
|
content,
|
|
220
336
|
toolCalls: toolCalls.length ? toolCalls : undefined,
|
|
337
|
+
// saved with the message it produced
|
|
338
|
+
...(usage && { usage: { ...usage } }),
|
|
221
339
|
};
|
|
340
|
+
// The usage rides along when the provider reported one, as in run() (the
|
|
341
|
+
// SubagentManager counts a child's tokens from it).
|
|
222
342
|
emit(SDKEventType.ModelResponded, {
|
|
223
343
|
stopReason,
|
|
344
|
+
...(usage && { usage: { ...usage } }),
|
|
224
345
|
hasToolCalls: !!toolCalls.length,
|
|
225
346
|
});
|
|
226
|
-
|
|
347
|
+
this.emitContextUsage(run, iteration, input, responseMessage, usage);
|
|
348
|
+
// Saved below: a stop from here on must not save the text again.
|
|
349
|
+
run.partial = "";
|
|
350
|
+
await run.conversation.addMessage(responseMessage);
|
|
227
351
|
if (stopReason === "end_turn" || stopReason === "error") {
|
|
228
|
-
this.completeRun(run, iteration, iterSpan);
|
|
229
|
-
yield {
|
|
352
|
+
this.completeRun(run, iteration, iterSpan, stopReason === "error" ? "error" : undefined);
|
|
353
|
+
yield {
|
|
354
|
+
type: "done",
|
|
355
|
+
usage: totalUsage,
|
|
356
|
+
...(stopReason === "error" && { stopReason }),
|
|
357
|
+
};
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
// A-88: the reply was cut off at the output token limit and has no tool calls:
|
|
361
|
+
// the turn ends here, no auto-continue.
|
|
362
|
+
if (stopReason === "max_tokens" && !toolCalls.length) {
|
|
363
|
+
this.completeRun(run, iteration, iterSpan, "max_tokens");
|
|
364
|
+
yield { type: "done", usage: totalUsage, stopReason: "max_tokens" };
|
|
230
365
|
return;
|
|
231
366
|
}
|
|
232
|
-
if (stopReason === "tool_use"
|
|
233
|
-
|
|
367
|
+
if ((stopReason === "tool_use" || stopReason === "max_tokens") &&
|
|
368
|
+
toolCalls.length) {
|
|
369
|
+
const { results, truncationLimitReached } = await this.actOnToolCalls(run, input, stopReason, toolCalls);
|
|
234
370
|
// Yield tool results as stream chunks so the consumer can display them
|
|
235
371
|
for (const result of results) {
|
|
236
372
|
yield { type: "tool_result", toolResult: result };
|
|
237
373
|
}
|
|
374
|
+
// A-88: cut off mid tool call too many times in a row — stop with an
|
|
375
|
+
// error (same convention as the max-iterations path: no done after it).
|
|
376
|
+
if (truncationLimitReached) {
|
|
377
|
+
this.completeRun(run, iteration, iterSpan, "max_tokens");
|
|
378
|
+
yield { type: "error", error: this.truncationLimitMessage(input) };
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
238
381
|
}
|
|
239
382
|
iterSpan?.end();
|
|
240
383
|
}
|
|
@@ -242,47 +385,94 @@ export class AgentLoop {
|
|
|
242
385
|
yield { type: "error", error: "Reached maximum reasoning steps." };
|
|
243
386
|
}
|
|
244
387
|
//#region Steps shared by run() and stream()
|
|
388
|
+
/**
|
|
389
|
+
* A-103: run one tool call outside a turn — a tool job's stored call. It goes through the
|
|
390
|
+
* same steps as a call the model makes (tool policy, approval gate, retries, sandbox and
|
|
391
|
+
* dispatch tracing, tool events), under its own "tool-job" run span. Nothing is written to
|
|
392
|
+
* the session here: the caller (the JobManager) records the call and its result.
|
|
393
|
+
*/
|
|
394
|
+
async executeToolCall(call, options) {
|
|
395
|
+
const { sessionId, signal } = options;
|
|
396
|
+
const emit = this.executor.createEmitter(this.deps.eventBus, sessionId);
|
|
397
|
+
const trace = new RunTrace(this.deps.traceService);
|
|
398
|
+
const runSpan = trace.span("tool-job", "run", { agentId: this.deps.profile.id, sessionId, toolName: call.name });
|
|
399
|
+
try {
|
|
400
|
+
const toolCtx = this.executor.buildToolContext(sessionId, emit, signal, crypto.randomUUID());
|
|
401
|
+
const result = await this.executor.executeScheduled(call, toolCtx, emit, trace.service, trace.ctx ?? undefined);
|
|
402
|
+
runSpan?.end({ isError: result.isError ?? false });
|
|
403
|
+
return result;
|
|
404
|
+
}
|
|
405
|
+
catch (err) {
|
|
406
|
+
runSpan?.end({ error: err instanceof Error ? err.message : String(err) });
|
|
407
|
+
throw err;
|
|
408
|
+
}
|
|
409
|
+
finally {
|
|
410
|
+
trace.close();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
245
413
|
/**
|
|
246
414
|
* Start a run: open the trace, record the user's message, restore token
|
|
247
415
|
* usage and counter calibration from the session, and recall memories.
|
|
248
416
|
*/
|
|
249
|
-
async beginRun(userMessage,
|
|
250
|
-
const {
|
|
417
|
+
async beginRun(userMessage, conversation, runOptions) {
|
|
418
|
+
const { eventBus, traceService } = this.deps;
|
|
251
419
|
// A-65: aborting this stops the run at the next safe point (below).
|
|
252
420
|
const signal = runOptions?.signal;
|
|
253
|
-
const session =
|
|
254
|
-
|
|
255
|
-
throw new Error("No active session");
|
|
421
|
+
const session = conversation.getSession();
|
|
422
|
+
const sessionId = session.id;
|
|
256
423
|
const emit = this.executor.createEmitter(eventBus, sessionId);
|
|
424
|
+
const runId = crypto.randomUUID();
|
|
257
425
|
// --- Trace: create a context and root "run" span ---
|
|
426
|
+
// A-105: a child run adds its parent turn (RunOptions.traceAttributes); agentId and
|
|
427
|
+
// sessionId always name this run's own agent and session.
|
|
258
428
|
const trace = new RunTrace(traceService);
|
|
259
429
|
const runSpan = trace.span("agent-run", "run", {
|
|
430
|
+
...runOptions?.traceAttributes,
|
|
260
431
|
agentId: this.deps.profile.id,
|
|
261
432
|
sessionId,
|
|
433
|
+
runId,
|
|
262
434
|
});
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
435
|
+
try {
|
|
436
|
+
await conversation.addMessage({
|
|
437
|
+
role: "user",
|
|
438
|
+
content: userMessage,
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
catch (err) {
|
|
442
|
+
// The user message write failed: the run span ends with the error and the trace
|
|
443
|
+
// context is removed, so a run that never started leaks nothing. (Memory recall
|
|
444
|
+
// below never throws.)
|
|
445
|
+
trace.fail(err);
|
|
446
|
+
throw err;
|
|
447
|
+
}
|
|
267
448
|
emit(SDKEventType.UserMessage, { role: "user", content: userMessage });
|
|
268
449
|
const totalUsage = {
|
|
269
450
|
inputTokens: session.currentTokenUsage?.inputTokens || 0,
|
|
270
451
|
outputTokens: session.currentTokenUsage?.outputTokens || 0,
|
|
271
452
|
};
|
|
272
453
|
// Restore learned chars-per-token ratio from previous turns
|
|
454
|
+
const counter = new Counter(this.deps.modelManager);
|
|
273
455
|
if (session.counterCalibration) {
|
|
274
|
-
|
|
456
|
+
counter.seed(session.counterCalibration.charsPerToken, session.counterCalibration.samples);
|
|
275
457
|
}
|
|
276
458
|
// --- Memory recall: once per run, keyed on the user's message ---
|
|
277
459
|
const recalled = await recallMemories({
|
|
278
460
|
memorySystem: this.deps.memorySystem,
|
|
279
|
-
counter
|
|
461
|
+
counter,
|
|
280
462
|
agentId: this.deps.profile.id,
|
|
281
463
|
}, userMessage, sessionId, trace);
|
|
282
464
|
// Resolved once per run — a runtime updateLoopConfig() takes effect on the next turn.
|
|
283
465
|
const { maxIterations } = resolveLoopConfig(this.deps.profile.loopConfig);
|
|
466
|
+
// A session may plan around a larger (or smaller) context window than the agent's.
|
|
467
|
+
const compactorConfig = sessionCompactorConfig(this.deps.profile.compactor, session);
|
|
468
|
+
const compactor = compactorConfig === this.deps.profile.compactor
|
|
469
|
+
? this.compactor
|
|
470
|
+
: new Compactor(compactorConfig);
|
|
284
471
|
return {
|
|
472
|
+
conversation,
|
|
285
473
|
session,
|
|
474
|
+
runId,
|
|
475
|
+
counter,
|
|
286
476
|
emit,
|
|
287
477
|
signal,
|
|
288
478
|
trace,
|
|
@@ -290,10 +480,16 @@ export class AgentLoop {
|
|
|
290
480
|
totalUsage,
|
|
291
481
|
recalled,
|
|
292
482
|
maxIterations,
|
|
483
|
+
iteration: 0,
|
|
484
|
+
partial: "",
|
|
485
|
+
truncatedResponses: 0,
|
|
486
|
+
compactor,
|
|
487
|
+
compactorConfig,
|
|
293
488
|
};
|
|
294
489
|
}
|
|
295
490
|
/** Emit the Iteration event and open the iteration span. */
|
|
296
491
|
startIteration(run, iteration) {
|
|
492
|
+
run.iteration = iteration;
|
|
297
493
|
run.emit(SDKEventType.Iteration, {
|
|
298
494
|
iteration,
|
|
299
495
|
maxIterations: run.maxIterations,
|
|
@@ -310,21 +506,26 @@ export class AgentLoop {
|
|
|
310
506
|
* for this iteration's model call.
|
|
311
507
|
*/
|
|
312
508
|
async assembleModelInput(run, iteration, modelOverrides) {
|
|
313
|
-
const {
|
|
314
|
-
const { session, totalUsage, recalled, trace } = run;
|
|
509
|
+
const { modelManager } = this.deps;
|
|
510
|
+
const { conversation, session, totalUsage, recalled, trace, counter, compactor } = run;
|
|
315
511
|
const ctxSpan = trace.span("context-assembly", "context-assembly");
|
|
316
512
|
// Use LLM working set (compacted if available) instead of full history
|
|
317
|
-
|
|
513
|
+
// A-104: with the system message's labelled sections when the ContextManager gives them.
|
|
514
|
+
const { messages, sections } = await this.prepareContext(conversation.getLlmMessages(), { session, tokenBudget: TOKEN_BUDGET, usage: totalUsage });
|
|
318
515
|
// --- Compaction: check if context needs shrinking ---
|
|
516
|
+
// The compactor is fed the context window size the latest response reported
|
|
517
|
+
// (as Go's contextUsage), not the run total, which grows past the window with
|
|
518
|
+
// every call of a run.
|
|
519
|
+
const contextUsage = latestContextUsage(session);
|
|
319
520
|
const compactSpan = trace.span("compaction", "compaction", {
|
|
320
521
|
messageCountBefore: messages.length,
|
|
321
|
-
inputTokens:
|
|
322
|
-
outputTokens:
|
|
522
|
+
inputTokens: contextUsage.inputTokens,
|
|
523
|
+
outputTokens: contextUsage.outputTokens,
|
|
323
524
|
});
|
|
324
|
-
const compactResult = await
|
|
525
|
+
const compactResult = await compactor.compactIfNeeded(messages, contextUsage, counter.countTokens, this.summarizer.traced(trace));
|
|
325
526
|
// Persist compacted messages so subsequent turns don't re-compact
|
|
326
527
|
if (compactResult.compacted) {
|
|
327
|
-
await
|
|
528
|
+
await conversation.setCompactedMessages(compactResult.messages);
|
|
328
529
|
}
|
|
329
530
|
compactSpan?.end({
|
|
330
531
|
triggered: compactResult.compacted,
|
|
@@ -337,11 +538,7 @@ export class AgentLoop {
|
|
|
337
538
|
// repairToolPairs: drop tool calls/results that lost their partner (e.g. a
|
|
338
539
|
// history compacted before this fix) so the provider does not reject the request.
|
|
339
540
|
const llmMessages = repairToolPairs(withRecalledMemories(compactResult.messages, recalled));
|
|
340
|
-
|
|
341
|
-
const toolDefs = [
|
|
342
|
-
...toolManager.list().map((t) => t.definition),
|
|
343
|
-
...(await this.deps.skillManager.toolDefinitions()),
|
|
344
|
-
];
|
|
541
|
+
const toolDefs = await this.toolDefinitions(session);
|
|
345
542
|
const options = { tools: toolDefs, ...modelOverrides };
|
|
346
543
|
// Computed once per iteration, only when a sink is listening — tracing
|
|
347
544
|
// must never run (or throw) when there's no traceCtx to attach it to.
|
|
@@ -353,7 +550,7 @@ export class AgentLoop {
|
|
|
353
550
|
llmMessages,
|
|
354
551
|
recalled,
|
|
355
552
|
options,
|
|
356
|
-
}, { modelManager, counter
|
|
553
|
+
}, { modelManager, counter })
|
|
357
554
|
: null;
|
|
358
555
|
if (llmInput) {
|
|
359
556
|
ctxSpan?.end({ ...llmInput });
|
|
@@ -361,7 +558,140 @@ export class AgentLoop {
|
|
|
361
558
|
else {
|
|
362
559
|
ctxSpan?.end();
|
|
363
560
|
}
|
|
364
|
-
return { llmMessages, toolDefs, options, llmInput };
|
|
561
|
+
return { llmMessages, toolDefs, options, llmInput, sections };
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* The agent's tools, plus skill_view when it has skills (the index is in the system prompt).
|
|
565
|
+
* A-105: a subagent's session sees only the tools its scope allows.
|
|
566
|
+
*/
|
|
567
|
+
async toolDefinitions(session) {
|
|
568
|
+
const inScope = this.deps.toolScope?.(session.id);
|
|
569
|
+
// A-136: in plan mode the model is offered only read-only tools (the executor refuses the rest).
|
|
570
|
+
const planning = (await this.deps.getApprovalMode?.(session.id)) === "plan";
|
|
571
|
+
return [
|
|
572
|
+
...this.deps.toolManager
|
|
573
|
+
.list(session.id)
|
|
574
|
+
.map((t) => t.definition)
|
|
575
|
+
.filter((d) => (!inScope || inScope(d)) && (!planning || d.risk === "read-only")),
|
|
576
|
+
...(await this.deps.skillManager.toolDefinitions()),
|
|
577
|
+
];
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* A-104: the prepared messages and the system message's labelled sections. A context
|
|
581
|
+
* manager without prepare() (a host's own) gives no sections: its whole system
|
|
582
|
+
* message then counts as system_prompt.
|
|
583
|
+
*/
|
|
584
|
+
async prepareContext(messages, context) {
|
|
585
|
+
const { contextManager } = this.deps;
|
|
586
|
+
if (typeof contextManager.prepare === "function")
|
|
587
|
+
return contextManager.prepare(messages, context);
|
|
588
|
+
return { messages: await contextManager.prepareMessages(messages, context), sections: [] };
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* A-104: emit what fills the session's context window, right after ModelResponded.
|
|
592
|
+
* `usage` is the provider's reported usage of this response (absent or zero = the
|
|
593
|
+
* total is estimated).
|
|
594
|
+
*/
|
|
595
|
+
emitContextUsage(run, iteration, input, response, usage) {
|
|
596
|
+
let measured;
|
|
597
|
+
try {
|
|
598
|
+
measured = measureContext({
|
|
599
|
+
sessionId: run.session.id,
|
|
600
|
+
model: this.resolvedModel(input.options),
|
|
601
|
+
iteration,
|
|
602
|
+
sections: input.sections,
|
|
603
|
+
messages: input.llmMessages,
|
|
604
|
+
recalled: run.recalled?.content,
|
|
605
|
+
tools: input.toolDefs,
|
|
606
|
+
response,
|
|
607
|
+
reported: usage,
|
|
608
|
+
compactor: run.compactorConfig,
|
|
609
|
+
countTokens: run.counter.countTokens,
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
catch {
|
|
613
|
+
return; // like tracing, measuring must never break the loop
|
|
614
|
+
}
|
|
615
|
+
run.emit(SDKEventType.ContextUsage, measured);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* A-104: the model a call with these options goes to (the ModelManager's defaults
|
|
619
|
+
* merged in). Never throws — like tracing, measuring must never break the loop.
|
|
620
|
+
*/
|
|
621
|
+
resolvedModel(options) {
|
|
622
|
+
try {
|
|
623
|
+
return this.deps.modelManager.resolveOptions?.(options)?.model ?? options.model;
|
|
624
|
+
}
|
|
625
|
+
catch {
|
|
626
|
+
return options.model;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* A-104: measure what fills a session's context window now, without a model call or
|
|
631
|
+
* any write: the same assembly as a model call (system message, working set, tools),
|
|
632
|
+
* without compaction or memory recall (recalled memories depend on the next message,
|
|
633
|
+
* so they count 0). `usedTokens` is the session's last reported usage when it has one.
|
|
634
|
+
* The caller loads the conversation; it needs no turn slot.
|
|
635
|
+
*/
|
|
636
|
+
async measureContext(conversation) {
|
|
637
|
+
const session = conversation.getSession();
|
|
638
|
+
const counter = new Counter(this.deps.modelManager);
|
|
639
|
+
if (session.counterCalibration) {
|
|
640
|
+
counter.seed(session.counterCalibration.charsPerToken, session.counterCalibration.samples);
|
|
641
|
+
}
|
|
642
|
+
const { messages, sections } = await this.prepareContext(conversation.getLlmMessages(), {
|
|
643
|
+
session,
|
|
644
|
+
tokenBudget: TOKEN_BUDGET,
|
|
645
|
+
usage: session.currentTokenUsage ?? { inputTokens: 0, outputTokens: 0 },
|
|
646
|
+
});
|
|
647
|
+
return measureContext({
|
|
648
|
+
sessionId: session.id,
|
|
649
|
+
model: this.resolvedModel(session.llmModel ? { model: session.llmModel } : {}),
|
|
650
|
+
sections,
|
|
651
|
+
messages: repairToolPairs(messages),
|
|
652
|
+
tools: await this.toolDefinitions(session),
|
|
653
|
+
reported: session.currentTokenUsage,
|
|
654
|
+
compactor: sessionCompactorConfig(this.deps.profile.compactor, session),
|
|
655
|
+
countTokens: counter.countTokens,
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* A-136: compact the session's working set now (/compact), whatever its size, with the
|
|
660
|
+
* user's focus added to the summary request. The caller holds the session's turn slot.
|
|
661
|
+
* The session's reported context size is dropped once compacted (it described the old
|
|
662
|
+
* working set), so the next turn does not compact again before a response reports anew.
|
|
663
|
+
*/
|
|
664
|
+
async compactNow(conversation, focus) {
|
|
665
|
+
const session = conversation.getSession();
|
|
666
|
+
const before = await this.measureContext(conversation);
|
|
667
|
+
const messages = conversation.getLlmMessages();
|
|
668
|
+
const counter = new Counter(this.deps.modelManager);
|
|
669
|
+
if (session.counterCalibration) {
|
|
670
|
+
counter.seed(session.counterCalibration.charsPerToken, session.counterCalibration.samples);
|
|
671
|
+
}
|
|
672
|
+
const compactor = new Compactor(sessionCompactorConfig(this.deps.profile.compactor, session));
|
|
673
|
+
const result = await compactor.compactNow(messages, counter.countTokens, this.summarizer.summarize, focus || undefined);
|
|
674
|
+
if (!result.compacted) {
|
|
675
|
+
return {
|
|
676
|
+
compacted: false,
|
|
677
|
+
beforeTokens: before.usedTokens,
|
|
678
|
+
afterTokens: before.usedTokens,
|
|
679
|
+
messagesBefore: messages.length,
|
|
680
|
+
messagesAfter: messages.length,
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
await conversation.setCompactedMessages(result.messages);
|
|
684
|
+
await conversation.updateSession((s) => {
|
|
685
|
+
delete s.currentTokenUsage;
|
|
686
|
+
});
|
|
687
|
+
const after = await this.measureContext(conversation);
|
|
688
|
+
return {
|
|
689
|
+
compacted: true,
|
|
690
|
+
beforeTokens: before.usedTokens,
|
|
691
|
+
afterTokens: after.usedTokens,
|
|
692
|
+
messagesBefore: messages.length,
|
|
693
|
+
messagesAfter: result.messages.length,
|
|
694
|
+
};
|
|
365
695
|
}
|
|
366
696
|
/** Emit ModelRequested and open the model-call span. */
|
|
367
697
|
startModelCall(run, iteration, input) {
|
|
@@ -387,10 +717,11 @@ export class AgentLoop {
|
|
|
387
717
|
async *streamModelResponse(run, input) {
|
|
388
718
|
const { signal } = run;
|
|
389
719
|
const { llmMessages, options } = input;
|
|
390
|
-
|
|
720
|
+
run.partial = "";
|
|
391
721
|
const collectedToolCalls = [];
|
|
392
722
|
let stopReason = "end_turn";
|
|
393
723
|
let streamUsage;
|
|
724
|
+
let streamError;
|
|
394
725
|
// --- Safe point C (A-65): mid-stream. abortable() stops iterating the
|
|
395
726
|
// provider's stream as soon as `signal` aborts, without waiting on the
|
|
396
727
|
// provider's in-flight next() to settle; the leading `if` below drops
|
|
@@ -403,60 +734,129 @@ export class AgentLoop {
|
|
|
403
734
|
if (signal?.aborted)
|
|
404
735
|
break;
|
|
405
736
|
if (chunk.type === "done") {
|
|
406
|
-
|
|
737
|
+
// A-88: the provider's reported "max_tokens" wins. Otherwise collected tool calls mean
|
|
738
|
+
// "tool_use" (also covers an older provider that reports nothing, or a reported
|
|
739
|
+
// end_turn/error); a reported "error" stays "error"; anything else ends the turn.
|
|
740
|
+
stopReason =
|
|
741
|
+
chunk.stopReason === "max_tokens"
|
|
742
|
+
? "max_tokens"
|
|
743
|
+
: collectedToolCalls.length
|
|
744
|
+
? "tool_use"
|
|
745
|
+
: chunk.stopReason === "error"
|
|
746
|
+
? "error"
|
|
747
|
+
: "end_turn";
|
|
407
748
|
if (chunk.usage) {
|
|
408
749
|
streamUsage = chunk.usage;
|
|
409
|
-
this.recordUsage(run,
|
|
750
|
+
this.recordUsage(run, input, chunk.usage);
|
|
751
|
+
// The response's usage reaches the consumer as a usage chunk (shown with
|
|
752
|
+
// the response's message, which saves it too).
|
|
753
|
+
yield { type: "usage", usage: { ...chunk.usage } };
|
|
410
754
|
}
|
|
411
755
|
continue;
|
|
412
756
|
}
|
|
413
|
-
yield
|
|
757
|
+
// Appended before the yield: what the consumer received is what a stop saves.
|
|
414
758
|
if (chunk.type === "text" && chunk.content) {
|
|
415
|
-
|
|
759
|
+
run.partial += chunk.content;
|
|
416
760
|
}
|
|
761
|
+
yield chunk;
|
|
417
762
|
if (chunk.type === "tool_call" && chunk.toolCall) {
|
|
418
763
|
collectedToolCalls.push(chunk.toolCall);
|
|
419
764
|
}
|
|
420
765
|
if (chunk.type === "error") {
|
|
421
766
|
stopReason = "error";
|
|
767
|
+
if (chunk.error)
|
|
768
|
+
streamError = chunk.error;
|
|
422
769
|
}
|
|
423
770
|
}
|
|
424
771
|
return {
|
|
425
|
-
content:
|
|
772
|
+
content: run.partial,
|
|
426
773
|
toolCalls: collectedToolCalls,
|
|
427
774
|
stopReason,
|
|
428
775
|
usage: streamUsage,
|
|
776
|
+
...(streamError !== undefined && { error: streamError }),
|
|
429
777
|
};
|
|
430
778
|
}
|
|
431
779
|
/** Add a model response's usage to the run total and save it on the session. */
|
|
432
|
-
recordUsage(run,
|
|
780
|
+
recordUsage(run, input, usage) {
|
|
433
781
|
this.executor.accumulateUsage(run.totalUsage, usage);
|
|
434
782
|
// Calibrate against llmMessages (what was actually sent), not the
|
|
435
783
|
// pre-compaction/pre-memory `messages` array — otherwise the
|
|
436
784
|
// chars-per-token ratio (and every downstream token estimate) is
|
|
437
785
|
// skewed by content the model never saw.
|
|
438
|
-
|
|
786
|
+
// A-104 audit: the tool definitions were sent too and are in the input tokens.
|
|
787
|
+
run.counter.calibrate(input.llmMessages, usage, input.toolDefs);
|
|
439
788
|
// Save the latest response's raw usage — this IS the current context window size
|
|
440
789
|
// (inputTokens = full conversation sent, outputTokens = what the model just added)
|
|
441
790
|
run.session.currentTokenUsage = { ...usage };
|
|
442
|
-
run.session.counterCalibration =
|
|
791
|
+
run.session.counterCalibration = run.counter.getCalibration();
|
|
443
792
|
}
|
|
444
|
-
/**
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
793
|
+
/**
|
|
794
|
+
* ACT: execute the model's tool/skill calls and append the results as a single message.
|
|
795
|
+
* `outputTruncation` (A-88) is set when the response stopped at max_tokens: the cut-off calls
|
|
796
|
+
* are answered with an output-token-limit tool error instead of being run.
|
|
797
|
+
*/
|
|
798
|
+
async executeToolCalls(run, toolCalls, outputTruncation) {
|
|
799
|
+
const toolCtx = this.executor.buildToolContext(run.session.id, run.emit, run.signal, run.runId);
|
|
800
|
+
const results = await this.executor.executeAll(toolCalls, toolCtx, run.emit, run.trace.service, run.trace.ctx ?? undefined, outputTruncation);
|
|
448
801
|
// Append all results as a single message
|
|
449
|
-
await
|
|
802
|
+
await run.conversation.addMessage({
|
|
450
803
|
role: "assistant",
|
|
451
804
|
content: "",
|
|
452
805
|
toolResults: results,
|
|
453
806
|
});
|
|
454
807
|
return results;
|
|
455
808
|
}
|
|
809
|
+
/**
|
|
810
|
+
* ACT, the single entry point for run() and stream() (A-88). Executes the response's calls.
|
|
811
|
+
* When the response stopped at max_tokens, a call counts as cut off if it has an argumentsError
|
|
812
|
+
* OR it is the LAST call of the response (the block the model was writing when the limit hit;
|
|
813
|
+
* non-streaming Anthropic/Bedrock hand over pre-parsed inputs, so they never carry an
|
|
814
|
+
* argumentsError). Cut-off calls are never run: each gets an output-token-limit tool error
|
|
815
|
+
* that names maxTokens when it is configured. Earlier calls run normally. Every call gets a
|
|
816
|
+
* saved result, so the conversation never has a tool call without one — even when the
|
|
817
|
+
* consecutive-truncation guard trips (`truncationLimitReached`).
|
|
818
|
+
*/
|
|
819
|
+
async actOnToolCalls(run, input, stopReason, toolCalls) {
|
|
820
|
+
let outputTruncation;
|
|
821
|
+
if (stopReason === "max_tokens") {
|
|
822
|
+
const truncatedCalls = new Set(toolCalls.filter((tc) => !!tc.argumentsError));
|
|
823
|
+
const last = toolCalls[toolCalls.length - 1];
|
|
824
|
+
if (last)
|
|
825
|
+
truncatedCalls.add(last);
|
|
826
|
+
outputTruncation = {
|
|
827
|
+
maxTokens: this.deps.modelManager.resolveOptions(input.options)?.maxTokens,
|
|
828
|
+
truncatedCalls,
|
|
829
|
+
};
|
|
830
|
+
run.truncatedResponses++;
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
run.truncatedResponses = 0;
|
|
834
|
+
}
|
|
835
|
+
const results = await this.executeToolCalls(run, toolCalls, outputTruncation);
|
|
836
|
+
return {
|
|
837
|
+
results,
|
|
838
|
+
truncationLimitReached: run.truncatedResponses >= MAX_CONSECUTIVE_TRUNCATIONS,
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
/** The text that ends a run stopped by the consecutive-truncation guard (A-88). */
|
|
842
|
+
truncationLimitMessage(input) {
|
|
843
|
+
const maxTokens = this.deps.modelManager.resolveOptions(input.options)?.maxTokens;
|
|
844
|
+
const limit = typeof maxTokens === "number" ? ` (maxTokens=${maxTokens})` : "";
|
|
845
|
+
return (`The model's output was cut off at the output token limit${limit} on ` +
|
|
846
|
+
`${MAX_CONSECUTIVE_TRUNCATIONS} consecutive responses while writing tool call arguments. ` +
|
|
847
|
+
"Raise maxTokens or ask for the work in smaller steps.");
|
|
848
|
+
}
|
|
456
849
|
/** The model ended its turn: close the spans and emit RunCompleted. */
|
|
457
|
-
|
|
850
|
+
// A-88: `stopReason` is "max_tokens" when the turn ended because the output token limit was
|
|
851
|
+
// hit; it is added to the run span only, RunCompleted is emitted unchanged.
|
|
852
|
+
// It is "error" when the provider reported a stop that is not a normal finish (refusal, filter).
|
|
853
|
+
completeRun(run, iterations, iterSpan, stopReason) {
|
|
458
854
|
iterSpan?.end();
|
|
459
|
-
run.runSpan?.end({
|
|
855
|
+
run.runSpan?.end({
|
|
856
|
+
iterations,
|
|
857
|
+
totalUsage: run.totalUsage,
|
|
858
|
+
...(stopReason && { stopReason }),
|
|
859
|
+
});
|
|
460
860
|
run.trace.close();
|
|
461
861
|
run.emit(SDKEventType.RunCompleted, {
|
|
462
862
|
iterations,
|
|
@@ -489,6 +889,9 @@ export class AgentLoop {
|
|
|
489
889
|
const { totalUsage } = run;
|
|
490
890
|
iterSpan?.end({ aborted: true });
|
|
491
891
|
run.runSpan?.end({ iterations, totalUsage, aborted: true });
|
|
892
|
+
// Whatever else is still open (a model call or memory recall the consumer stopped
|
|
893
|
+
// reading in) ends marked aborted too, so no span outlives the run (as Go).
|
|
894
|
+
run.trace.endOpen({ aborted: true });
|
|
492
895
|
run.trace.close();
|
|
493
896
|
run.emit(SDKEventType.RunCompleted, {
|
|
494
897
|
iterations,
|