aec-agent 1.0.3 → 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/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,171 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
/**
|
|
3
|
+
* Decides when an agent's turns may run (A-97).
|
|
4
|
+
*
|
|
5
|
+
* - Turns in different sessions run in parallel.
|
|
6
|
+
* - Turns in the same session run one at a time, in arrival order: a session's
|
|
7
|
+
* history is appended in order, so two turns at once would interleave.
|
|
8
|
+
* - An optional per-agent cap (`maxConcurrent`, 0 = no cap) bounds how many
|
|
9
|
+
* turns run at once across all sessions, for cost and rate-limit control.
|
|
10
|
+
* - A turn waiting for its slot can be cancelled with its AbortSignal.
|
|
11
|
+
* - dispose() aborts every running turn, waits for them to end, and refuses new ones.
|
|
12
|
+
*/
|
|
13
|
+
export class TurnGate {
|
|
14
|
+
getMaxConcurrent;
|
|
15
|
+
/** Per session: the tail of its queue — resolves when the last queued turn has ended. */
|
|
16
|
+
sessionTails = new Map();
|
|
17
|
+
/** Turns waiting for a free slot under the agent cap, oldest first. */
|
|
18
|
+
capWaiters = [];
|
|
19
|
+
running = 0;
|
|
20
|
+
active = new Set();
|
|
21
|
+
disposed = false;
|
|
22
|
+
/** The sessions whose turn is running in the current async context — catches a turn that would wait for itself. */
|
|
23
|
+
context = new AsyncLocalStorage();
|
|
24
|
+
constructor(getMaxConcurrent) {
|
|
25
|
+
this.getMaxConcurrent = getMaxConcurrent;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Wait for this session's turn (and a slot under the agent cap). Resolves with
|
|
29
|
+
* the turn's handle, or with null when `signal` aborted while waiting.
|
|
30
|
+
* Throws when the gate is disposed, or when called from inside a running turn
|
|
31
|
+
* of the same session (that turn would wait for itself forever).
|
|
32
|
+
*/
|
|
33
|
+
async acquire(sessionId, signal) {
|
|
34
|
+
if (this.disposed)
|
|
35
|
+
throw new Error("The agent is disposed");
|
|
36
|
+
if (this.context.getStore()?.has(sessionId)) {
|
|
37
|
+
throw new Error(`A turn in session ${sessionId} is already running in this call chain — ` +
|
|
38
|
+
"a nested chat on the same session would wait for itself. Use another session.");
|
|
39
|
+
}
|
|
40
|
+
// Join the session's queue: the turn starts once every earlier turn of the session has ended.
|
|
41
|
+
// A free session starts at once, even when `signal` is already aborted — the loop then ends
|
|
42
|
+
// the turn at its first safe point exactly as it did before turns could wait (A-65).
|
|
43
|
+
const previous = this.sessionTails.get(sessionId);
|
|
44
|
+
let leaveQueue;
|
|
45
|
+
const ours = new Promise((resolve) => (leaveQueue = resolve));
|
|
46
|
+
const tail = previous ? previous.then(() => ours) : ours;
|
|
47
|
+
this.sessionTails.set(sessionId, tail);
|
|
48
|
+
const releaseSession = () => {
|
|
49
|
+
leaveQueue();
|
|
50
|
+
// The queue is empty once nobody joined behind us; drop it so idle sessions cost nothing.
|
|
51
|
+
if (this.sessionTails.get(sessionId) === tail)
|
|
52
|
+
this.sessionTails.delete(sessionId);
|
|
53
|
+
};
|
|
54
|
+
const waitedForSession = previous ? await waitOrAbort(previous, signal) : true;
|
|
55
|
+
if (!waitedForSession || this.disposed) {
|
|
56
|
+
releaseSession();
|
|
57
|
+
if (this.disposed)
|
|
58
|
+
throw new Error("The agent is disposed");
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
// A turn started from inside another turn (a tool chatting in another session) skips the
|
|
62
|
+
// agent cap: the outer turn holds a slot while it waits for this one, so with a full cap
|
|
63
|
+
// the two would wait for each other forever. It can take the agent one turn over its cap.
|
|
64
|
+
const nested = (this.context.getStore()?.size ?? 0) > 0;
|
|
65
|
+
const gotSlot = await this.takeSlot(signal, nested);
|
|
66
|
+
if (!gotSlot || this.disposed) {
|
|
67
|
+
if (gotSlot)
|
|
68
|
+
this.freeSlot();
|
|
69
|
+
releaseSession();
|
|
70
|
+
if (this.disposed)
|
|
71
|
+
throw new Error("The agent is disposed");
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const controller = new AbortController();
|
|
75
|
+
let release;
|
|
76
|
+
const ended = new Promise((resolve) => (release = resolve));
|
|
77
|
+
const turn = { controller, ended };
|
|
78
|
+
this.active.add(turn);
|
|
79
|
+
let released = false;
|
|
80
|
+
const inner = new Set(this.context.getStore() ?? []);
|
|
81
|
+
inner.add(sessionId);
|
|
82
|
+
return {
|
|
83
|
+
signal: signal ? AbortSignal.any([signal, controller.signal]) : controller.signal,
|
|
84
|
+
run: (fn) => this.context.run(inner, fn),
|
|
85
|
+
release: () => {
|
|
86
|
+
if (released)
|
|
87
|
+
return;
|
|
88
|
+
released = true;
|
|
89
|
+
this.active.delete(turn);
|
|
90
|
+
this.freeSlot();
|
|
91
|
+
releaseSession();
|
|
92
|
+
release();
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** How many turns are running now (across all sessions). */
|
|
97
|
+
get runningTurns() {
|
|
98
|
+
return this.running;
|
|
99
|
+
}
|
|
100
|
+
/** Abort every running turn and wait for them to end. Later acquire() calls throw. */
|
|
101
|
+
async dispose() {
|
|
102
|
+
this.disposed = true;
|
|
103
|
+
const turns = [...this.active];
|
|
104
|
+
for (const turn of turns)
|
|
105
|
+
turn.controller.abort();
|
|
106
|
+
// Wake every turn waiting for a slot (without handing it one); each sees `disposed` and gives up.
|
|
107
|
+
for (const waiter of this.capWaiters.splice(0))
|
|
108
|
+
waiter.wake();
|
|
109
|
+
await Promise.all(turns.map((t) => t.ended));
|
|
110
|
+
}
|
|
111
|
+
async takeSlot(signal, nested) {
|
|
112
|
+
const max = this.getMaxConcurrent();
|
|
113
|
+
if (nested || max <= 0 || this.running < max) {
|
|
114
|
+
this.running++;
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
let wake;
|
|
118
|
+
const woken = new Promise((resolve) => (wake = resolve));
|
|
119
|
+
const waiter = { wake, handed: false };
|
|
120
|
+
this.capWaiters.push(waiter);
|
|
121
|
+
const ok = await waitOrAbort(woken, signal);
|
|
122
|
+
if (!ok) {
|
|
123
|
+
const i = this.capWaiters.indexOf(waiter);
|
|
124
|
+
if (i >= 0)
|
|
125
|
+
this.capWaiters.splice(i, 1);
|
|
126
|
+
else if (waiter.handed)
|
|
127
|
+
this.handOn(); // we were handed a slot right as we aborted: pass it on
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
// handOn() gave us a finished turn's slot (`running` was not decremented for us) —
|
|
131
|
+
// or dispose() woke us without one.
|
|
132
|
+
return waiter.handed;
|
|
133
|
+
}
|
|
134
|
+
freeSlot() {
|
|
135
|
+
if (this.capWaiters.length > 0 && !this.disposed) {
|
|
136
|
+
this.handOn();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
this.running--;
|
|
140
|
+
}
|
|
141
|
+
/** Give the slot a finished turn frees to the oldest waiter — or free it when nobody waits. */
|
|
142
|
+
handOn() {
|
|
143
|
+
const next = this.capWaiters.shift();
|
|
144
|
+
if (next) {
|
|
145
|
+
next.handed = true;
|
|
146
|
+
next.wake();
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.running--;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** Resolves true when `promise` settles, false when `signal` aborts first. */
|
|
154
|
+
function waitOrAbort(promise, signal) {
|
|
155
|
+
if (!signal)
|
|
156
|
+
return promise.then(() => true, () => true);
|
|
157
|
+
if (signal.aborted)
|
|
158
|
+
return Promise.resolve(false);
|
|
159
|
+
return new Promise((resolve) => {
|
|
160
|
+
const onAbort = () => resolve(false);
|
|
161
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
162
|
+
promise.then(() => {
|
|
163
|
+
signal.removeEventListener("abort", onAbort);
|
|
164
|
+
resolve(true);
|
|
165
|
+
}, () => {
|
|
166
|
+
signal.removeEventListener("abort", onAbort);
|
|
167
|
+
resolve(true);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=turn-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-gate.js","sourceRoot":"","sources":["../../../../../src/components/multi-agent-orchestration/agent/conversation-manager/turn-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,QAAQ;IAWC,gBAAgB;IAVpC,yFAAyF;IACjF,YAAY,GAAG,IAAI,GAAG,EAAyB,CAAC;IACxD,uEAAuE;IAC/D,UAAU,GAAgB,EAAE,CAAC;IAC7B,OAAO,GAAG,CAAC,CAAC;IACZ,MAAM,GAAG,IAAI,GAAG,EAAc,CAAC;IAC/B,QAAQ,GAAG,KAAK,CAAC;IACzB,mHAAmH;IAClG,OAAO,GAAG,IAAI,iBAAiB,EAAuB,CAAC;IAExE,YAAoB,gBAA8B;gCAA9B,gBAAgB;IAAiB,CAAC;IAEtD;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,MAAoB;QACnD,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC5D,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CACb,qBAAqB,SAAS,2CAA2C;gBACvE,+EAA+E,CAClF,CAAC;QACJ,CAAC;QAED,8FAA8F;QAC9F,4FAA4F;QAC5F,qFAAqF;QACrF,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,UAAuB,CAAC;QAC5B,MAAM,IAAI,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;QACpE,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE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AO,CAAC,CAAC;YAC7C,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,EACD,GAAG,EAAE;YACH,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7C,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { JobStore } from "../../../persistence-hub/types/job-store.js";
|
|
2
|
+
import { type Job, type JobSchedule } from "./types.js";
|
|
3
|
+
/** Why a tick fired. */
|
|
4
|
+
export type TickCause = "schedule" | "catch-up";
|
|
5
|
+
export interface JobClockDeps {
|
|
6
|
+
agentId: string;
|
|
7
|
+
/** Resolved on every call so a later persistence swap (AgentCore.usePersistence) is picked up. */
|
|
8
|
+
getStore: () => JobStore;
|
|
9
|
+
/** A schedule job is due: `scheduledAt` is the slot (ISO) it is for. */
|
|
10
|
+
onTick: (job: Job, scheduledAt: string, cause: TickCause) => Promise<void>;
|
|
11
|
+
/** Clock — injectable for tests. */
|
|
12
|
+
now?: () => number;
|
|
13
|
+
}
|
|
14
|
+
export declare class JobClock {
|
|
15
|
+
private deps;
|
|
16
|
+
private timers;
|
|
17
|
+
private started;
|
|
18
|
+
private disposed;
|
|
19
|
+
private readonly now;
|
|
20
|
+
constructor(deps: JobClockDeps);
|
|
21
|
+
/**
|
|
22
|
+
* Load this agent's schedule jobs and arm their timers. Jobs missed while down
|
|
23
|
+
* run once. Idempotent.
|
|
24
|
+
*/
|
|
25
|
+
start(): Promise<void>;
|
|
26
|
+
/** Stop every timer. No tick fires after this. */
|
|
27
|
+
dispose(): void;
|
|
28
|
+
/** Re-arm (or disarm) a job after it was created, edited or deleted (null). */
|
|
29
|
+
sync(jobId: string, job: Job | null): void;
|
|
30
|
+
/** The next run time of `schedule` from now, or null when it never fires again. */
|
|
31
|
+
firstRun(schedule: JobSchedule): string | null;
|
|
32
|
+
private arm;
|
|
33
|
+
private disarm;
|
|
34
|
+
private onTimer;
|
|
35
|
+
/**
|
|
36
|
+
* The next run time after a timer-driven fire at `now`. "every" keeps its
|
|
37
|
+
* cadence from the scheduled time, but never schedules into the past (no
|
|
38
|
+
* burst of runs after a pause).
|
|
39
|
+
*/
|
|
40
|
+
private nextAfterFire;
|
|
41
|
+
private store;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../../../src/components/multi-agent-orchestration/agent/job-manager/clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAG5E,OAAO,EAAkB,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAyBxE,wBAAwB;AACxB,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,QAAQ,EAAE,MAAM,QAAQ,CAAC;IACzB,wEAAwE;IACxE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,qBAAa,QAAQ;IAMP,OAAO,CAAC,IAAI;IALxB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IAEnC,YAAoB,IAAI,EAAE,YAAY,EAErC;IAED;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB3B;IAED,kDAAkD;IAClD,OAAO,IAAI,IAAI,CAId;IAED,+EAA+E;IAC/E,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,CAIzC;IAED,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAG7C;IAED,OAAO,CAAC,GAAG;IAWX,OAAO,CAAC,MAAM;YAKA,OAAO;IAyBrB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { computeNextRun } from "./schedule.js";
|
|
2
|
+
import { armTimer } from "./timers.js";
|
|
3
|
+
import { isScheduleWhen } from "./types.js";
|
|
4
|
+
export class JobClock {
|
|
5
|
+
deps;
|
|
6
|
+
timers = new Map();
|
|
7
|
+
started = false;
|
|
8
|
+
disposed = false;
|
|
9
|
+
now;
|
|
10
|
+
constructor(deps) {
|
|
11
|
+
this.deps = deps;
|
|
12
|
+
this.now = deps.now ?? Date.now;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Load this agent's schedule jobs and arm their timers. Jobs missed while down
|
|
16
|
+
* run once. Idempotent.
|
|
17
|
+
*/
|
|
18
|
+
async start() {
|
|
19
|
+
if (this.started || this.disposed)
|
|
20
|
+
return;
|
|
21
|
+
this.started = true;
|
|
22
|
+
for (const job of await this.store().listByAgent(this.deps.agentId)) {
|
|
23
|
+
if (!job.enabled || !isScheduleWhen(job.when))
|
|
24
|
+
continue;
|
|
25
|
+
if (job.nextRunAt === null) {
|
|
26
|
+
// Enabled but never computed (or an "at" job that had already run) — recompute from now.
|
|
27
|
+
const next = computeNextRun(job.when, new Date(this.now()));
|
|
28
|
+
await this.store().updateJobState(job.id, { nextRunAt: next ? next.toISOString() : null, ...(next ? {} : { enabled: false }) });
|
|
29
|
+
if (next)
|
|
30
|
+
this.arm(job.id, next.getTime(), "schedule");
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const due = Date.parse(job.nextRunAt);
|
|
34
|
+
// Missed while the host was down: one catch-up run now.
|
|
35
|
+
this.arm(job.id, due, due <= this.now() ? "catch-up" : "schedule");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Stop every timer. No tick fires after this. */
|
|
39
|
+
dispose() {
|
|
40
|
+
this.disposed = true;
|
|
41
|
+
for (const timer of this.timers.values())
|
|
42
|
+
timer.cancel();
|
|
43
|
+
this.timers.clear();
|
|
44
|
+
}
|
|
45
|
+
/** Re-arm (or disarm) a job after it was created, edited or deleted (null). */
|
|
46
|
+
sync(jobId, job) {
|
|
47
|
+
this.disarm(jobId);
|
|
48
|
+
if (!this.started || this.disposed || !job || !job.enabled || !isScheduleWhen(job.when) || !job.nextRunAt)
|
|
49
|
+
return;
|
|
50
|
+
this.arm(job.id, Date.parse(job.nextRunAt), "schedule");
|
|
51
|
+
}
|
|
52
|
+
/** The next run time of `schedule` from now, or null when it never fires again. */
|
|
53
|
+
firstRun(schedule) {
|
|
54
|
+
const next = computeNextRun(schedule, new Date(this.now()));
|
|
55
|
+
return next ? next.toISOString() : null;
|
|
56
|
+
}
|
|
57
|
+
arm(jobId, at, cause) {
|
|
58
|
+
this.disarm(jobId);
|
|
59
|
+
this.timers.set(jobId, armTimer(at, () => {
|
|
60
|
+
this.timers.delete(jobId);
|
|
61
|
+
void this.onTimer(jobId, cause);
|
|
62
|
+
}, this.now));
|
|
63
|
+
}
|
|
64
|
+
disarm(jobId) {
|
|
65
|
+
this.timers.get(jobId)?.cancel();
|
|
66
|
+
this.timers.delete(jobId);
|
|
67
|
+
}
|
|
68
|
+
async onTimer(jobId, cause) {
|
|
69
|
+
if (this.disposed)
|
|
70
|
+
return;
|
|
71
|
+
try {
|
|
72
|
+
const job = await this.store().get(jobId);
|
|
73
|
+
if (!job || job.agentId !== this.deps.agentId || !job.enabled || !isScheduleWhen(job.when) || !job.nextRunAt)
|
|
74
|
+
return;
|
|
75
|
+
const scheduledAt = job.nextRunAt;
|
|
76
|
+
// The next run time is saved and armed first, so a crash mid-run does not repeat this one.
|
|
77
|
+
const nextRunAt = this.nextAfterFire(job.when, scheduledAt, this.now());
|
|
78
|
+
// A one-off job is done once it has fired.
|
|
79
|
+
const oneOff = job.when.kind === "at";
|
|
80
|
+
const updated = await this.store().updateJobState(job.id, { nextRunAt, ...(oneOff ? { enabled: false } : {}) });
|
|
81
|
+
if (!updated)
|
|
82
|
+
return;
|
|
83
|
+
if (nextRunAt && !oneOff && !this.disposed)
|
|
84
|
+
this.arm(job.id, Date.parse(nextRunAt), "schedule");
|
|
85
|
+
await this.deps.onTick(updated, scheduledAt, cause);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
// A failed tick must never surface as an unhandled rejection. Re-arm from the stored
|
|
89
|
+
// record if we can, so one store hiccup doesn't silently stop the job for good.
|
|
90
|
+
console.error(`[jobs] agent=${this.deps.agentId} job=${jobId} tick failed:`, err);
|
|
91
|
+
const job = await this.store().get(jobId).catch(() => null);
|
|
92
|
+
if (job?.enabled && isScheduleWhen(job.when) && !this.disposed && !this.timers.has(jobId)) {
|
|
93
|
+
this.arm(jobId, Math.max(this.now() + 60_000, job.nextRunAt ? Date.parse(job.nextRunAt) : 0), "schedule");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The next run time after a timer-driven fire at `now`. "every" keeps its
|
|
99
|
+
* cadence from the scheduled time, but never schedules into the past (no
|
|
100
|
+
* burst of runs after a pause).
|
|
101
|
+
*/
|
|
102
|
+
nextAfterFire(schedule, scheduledAt, now) {
|
|
103
|
+
if (schedule.kind === "every") {
|
|
104
|
+
let next = Date.parse(scheduledAt) + schedule.ms;
|
|
105
|
+
if (next <= now)
|
|
106
|
+
next = now + schedule.ms;
|
|
107
|
+
return new Date(next).toISOString();
|
|
108
|
+
}
|
|
109
|
+
const next = computeNextRun(schedule, new Date(now));
|
|
110
|
+
return next ? next.toISOString() : null;
|
|
111
|
+
}
|
|
112
|
+
store() {
|
|
113
|
+
return this.deps.getStore();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../../../../src/components/multi-agent-orchestration/agent/job-manager/clock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAA8B,MAAM,YAAY,CAAC;AAsCxE,MAAM,OAAO,QAAQ;IAMC,IAAI;IALhB,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IACrC,OAAO,GAAG,KAAK,CAAC;IAChB,QAAQ,GAAG,KAAK,CAAC;IACR,GAAG,CAAe;IAEnC,YAAoB,IAAkB;oBAAlB,IAAI;QACtB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,KAAK,MAAM,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACpE,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,SAAS;YACxD,IAAI,GAAG,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;gBAC3B,yFAAyF;gBACzF,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,G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"../../../../kernel/types.js";
|
|
2
|
+
import type { JobStore } from "../../../persistence-hub/types/job-store.js";
|
|
3
|
+
import type { WebhookEnvelope } from "./webhook.js";
|
|
4
|
+
import type { JobEvent } from "./types.js";
|
|
5
|
+
/** Bus kinds the JobManager listens to. */
|
|
6
|
+
export declare const INTERNAL_BUS_EVENT_TYPES: readonly ["job:run-finished", "channel:error"];
|
|
7
|
+
/** The job-event envelope of one of the agent's bus events, or undefined when it is not one of its own. */
|
|
8
|
+
export declare function internalEnvelope(agentId: string, event: Event): (WebhookEnvelope & {
|
|
9
|
+
time: string;
|
|
10
|
+
}) | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The current state check before a run of internal events: a "job.failed" whose
|
|
13
|
+
* job has succeeded since is resolved, so it is not investigated. Returns the
|
|
14
|
+
* reason to suppress, or undefined to go on.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolvedSince(events: JobEvent[], jobs: JobStore): Promise<string | undefined>;
|
|
17
|
+
//# sourceMappingURL=internal-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-events.d.ts","sourceRoot":"","sources":["../../../../../src/components/multi-agent-orchestration/agent/job-manager/internal-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAGzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAyB3C,2CAA2C;AAC3C,eAAO,MAAM,wBAAwB,gDAAqE,CAAC;AAK3G,2GAA2G;AAC3G,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CAyChH;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAYnG"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { SDKEventType } from "../../../event-handler/events.js";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// The agent's own SDK events as trigger events (A-70). The TriggerManager
|
|
4
|
+
// subscribes to these bus kinds only — the scheduler and channels never know a
|
|
5
|
+
// trigger exists. Each maps to a dotted trigger type, with the id that makes a
|
|
6
|
+
// redelivery of the same thing a duplicate (a job run is investigated once).
|
|
7
|
+
//
|
|
8
|
+
// Update (A-126): the JobManager subscribes, for "event" jobs. A job run ending is
|
|
9
|
+
// its own job:run-finished event (scheduled-job:* is gone), so:
|
|
10
|
+
//
|
|
11
|
+
// bus event job event type subject id
|
|
12
|
+
// job:run-finished (succeeded) job.completed job id run id
|
|
13
|
+
// job:run-finished (failed / blocked) job.failed job id run id
|
|
14
|
+
// job:run-finished (stopped) job.stopped job id run id
|
|
15
|
+
// channel:error channel.error channel id bus event id
|
|
16
|
+
//
|
|
17
|
+
// A suppressed run did no work and is not an event. The loop guard (an event caused
|
|
18
|
+
// by an event job's run is one level deeper) keeps an event job from setting itself off.
|
|
19
|
+
//
|
|
20
|
+
// The bus is in-process: an event emitted while no JobManager listens (the
|
|
21
|
+
// host was down) is not seen. Durable capture of such events needs an outbox
|
|
22
|
+
// written with them, which this source does not claim to be.
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/** Bus kinds the JobManager listens to. */
|
|
25
|
+
export const INTERNAL_BUS_EVENT_TYPES = [SDKEventType.JobRunFinished, SDKEventType.ChannelFailed];
|
|
26
|
+
/** Most characters of a job's reply carried in an event's data. */
|
|
27
|
+
const MAX_OUTPUT_CHARS = 4_000;
|
|
28
|
+
/** The job-event envelope of one of the agent's bus events, or undefined when it is not one of its own. */
|
|
29
|
+
export function internalEnvelope(agentId, event) {
|
|
30
|
+
const time = new Date(event.timestamp).toISOString();
|
|
31
|
+
if (event.type === SDKEventType.JobRunFinished) {
|
|
32
|
+
const p = event.payload;
|
|
33
|
+
if (p.agentId !== agentId)
|
|
34
|
+
return undefined;
|
|
35
|
+
const type = p.status === "succeeded" ? "job.completed" : p.status === "failed" || p.status === "blocked" ? "job.failed" : p.status === "stopped" ? "job.stopped" : undefined;
|
|
36
|
+
if (!type)
|
|
37
|
+
return undefined;
|
|
38
|
+
return {
|
|
39
|
+
source: "aec:jobs",
|
|
40
|
+
sourceEventId: p.runId,
|
|
41
|
+
type,
|
|
42
|
+
subject: p.jobId,
|
|
43
|
+
time,
|
|
44
|
+
data: {
|
|
45
|
+
jobId: p.jobId,
|
|
46
|
+
jobName: p.jobName,
|
|
47
|
+
runId: p.runId,
|
|
48
|
+
cause: p.cause,
|
|
49
|
+
status: p.status,
|
|
50
|
+
...(p.error ? { error: p.error } : {}),
|
|
51
|
+
...(p.reason ? { reason: p.reason } : {}),
|
|
52
|
+
...(typeof p.output === "string" ? { output: p.output.slice(0, MAX_OUTPUT_CHARS) } : {}),
|
|
53
|
+
...(p.silent ? { silent: true } : {}),
|
|
54
|
+
sessionId: event.sessionId || undefined,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (event.type === SDKEventType.ChannelFailed) {
|
|
59
|
+
const p = event.payload;
|
|
60
|
+
if (p.agentId !== agentId)
|
|
61
|
+
return undefined;
|
|
62
|
+
return {
|
|
63
|
+
source: "aec:channels",
|
|
64
|
+
sourceEventId: event.id,
|
|
65
|
+
type: "channel.error",
|
|
66
|
+
subject: p.channelId,
|
|
67
|
+
time,
|
|
68
|
+
data: { channelId: p.channelId, platform: p.platform, chatId: p.chatId, error: p.error, jobId: p.jobId },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The current state check before a run of internal events: a "job.failed" whose
|
|
75
|
+
* job has succeeded since is resolved, so it is not investigated. Returns the
|
|
76
|
+
* reason to suppress, or undefined to go on.
|
|
77
|
+
*/
|
|
78
|
+
export async function resolvedSince(events, jobs) {
|
|
79
|
+
const failures = events.filter((e) => e.source === "aec:jobs" && e.type === "job.failed");
|
|
80
|
+
if (failures.length === 0 || failures.length !== events.length)
|
|
81
|
+
return undefined;
|
|
82
|
+
const latest = failures[failures.length - 1];
|
|
83
|
+
const jobId = latest.data?.jobId;
|
|
84
|
+
if (typeof jobId !== "string")
|
|
85
|
+
return undefined;
|
|
86
|
+
const runs = await jobs.listRuns(jobId, 10);
|
|
87
|
+
const run = runs.find((r) => r.status === "succeeded" && r.startedAt !== undefined);
|
|
88
|
+
if (run && run.startedAt > latest.time) {
|
|
89
|
+
return `the job has succeeded since (run ${run.id})`;
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=internal-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-events.js","sourceRoot":"","sources":["../../../../../src/components/multi-agent-orchestration/agent/job-manager/internal-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAMhE,8EAA8E;AAC9E,0EAA0E;AAC1E,+EAA+E;AAC/E,+EAA+E;AAC/E,6EAA6E;AAC7E,EAAE;AACF,mFAAmF;AACnF,gEAAgE;AAChE,EAAE;AACF,6EAA6E;AAC7E,iFAAiF;AACjF,iFAAiF;AACjF,iFAAiF;AACjF,uFAAuF;AACvF,EAAE;AACF,oFAAoF;AACpF,yFAAyF;AACzF,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,6DAA6D;AAC7D,8EAA8E;AAE9E,2CAA2C;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,YAAY,CAAC,cAAc,EAAE,YAAY,CAAC,aAAa,CAAU,CAAC;AAE3G,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