aec-agent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/agent-core.d.ts +81 -0
- package/dist/agent-core.d.ts.map +1 -0
- package/dist/agent-core.js +168 -0
- package/dist/agent-core.js.map +1 -0
- package/dist/components/artifact-hub/agent-artifact-view.d.ts +31 -0
- package/dist/components/artifact-hub/agent-artifact-view.d.ts.map +1 -0
- package/dist/components/artifact-hub/agent-artifact-view.js +264 -0
- package/dist/components/artifact-hub/agent-artifact-view.js.map +1 -0
- package/dist/components/artifact-hub/artifact-hub.d.ts +25 -0
- package/dist/components/artifact-hub/artifact-hub.d.ts.map +1 -0
- package/dist/components/artifact-hub/artifact-hub.js +39 -0
- package/dist/components/artifact-hub/artifact-hub.js.map +1 -0
- package/dist/components/artifact-hub/types/artifact.d.ts +158 -0
- package/dist/components/artifact-hub/types/artifact.d.ts.map +1 -0
- package/dist/components/artifact-hub/types/artifact.js +14 -0
- package/dist/components/artifact-hub/types/artifact.js.map +1 -0
- package/dist/components/event-handler/event-dispatcher.d.ts +17 -0
- package/dist/components/event-handler/event-dispatcher.d.ts.map +1 -0
- package/dist/components/event-handler/event-dispatcher.js +47 -0
- package/dist/components/event-handler/event-dispatcher.js.map +1 -0
- package/dist/components/event-handler/events.d.ts +154 -0
- package/dist/components/event-handler/events.d.ts.map +1 -0
- package/dist/components/event-handler/events.js +28 -0
- package/dist/components/event-handler/events.js.map +1 -0
- package/dist/components/event-handler/types.d.ts +10 -0
- package/dist/components/event-handler/types.d.ts.map +1 -0
- package/dist/components/event-handler/types.js +2 -0
- package/dist/components/event-handler/types.js.map +1 -0
- package/dist/components/llm-provider-hub/llm-provider-hub.d.ts +14 -0
- package/dist/components/llm-provider-hub/llm-provider-hub.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/llm-provider-hub.js +34 -0
- package/dist/components/llm-provider-hub/llm-provider-hub.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/anthropic-provider.d.ts +22 -0
- package/dist/components/llm-provider-hub/providers/anthropic-provider.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/providers/anthropic-provider.js +249 -0
- package/dist/components/llm-provider-hub/providers/anthropic-provider.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/bedrock-provider.d.ts +28 -0
- package/dist/components/llm-provider-hub/providers/bedrock-provider.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/providers/bedrock-provider.js +345 -0
- package/dist/components/llm-provider-hub/providers/bedrock-provider.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/model-info-mappers.d.ts +6 -0
- package/dist/components/llm-provider-hub/providers/model-info-mappers.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/providers/model-info-mappers.js +267 -0
- package/dist/components/llm-provider-hub/providers/model-info-mappers.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/openai-compatible-provider.d.ts +24 -0
- package/dist/components/llm-provider-hub/providers/openai-compatible-provider.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/providers/openai-compatible-provider.js +243 -0
- package/dist/components/llm-provider-hub/providers/openai-compatible-provider.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.d.ts +29 -0
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.js +299 -0
- package/dist/components/llm-provider-hub/providers/openai-subscription-provider.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/registry.d.ts +6 -0
- package/dist/components/llm-provider-hub/providers/registry.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/providers/registry.js +33 -0
- package/dist/components/llm-provider-hub/providers/registry.js.map +1 -0
- package/dist/components/llm-provider-hub/providers/types.d.ts +29 -0
- package/dist/components/llm-provider-hub/providers/types.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/providers/types.js +2 -0
- package/dist/components/llm-provider-hub/providers/types.js.map +1 -0
- package/dist/components/llm-provider-hub/types.d.ts +84 -0
- package/dist/components/llm-provider-hub/types.d.ts.map +1 -0
- package/dist/components/llm-provider-hub/types.js +6 -0
- package/dist/components/llm-provider-hub/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.d.ts +85 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.js +500 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/agent-loop.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/abort.d.ts +29 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/abort.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/abort.js +98 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/abort.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.d.ts +16 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.js +116 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.types.d.ts +41 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.types.js +2 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/compactor.types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.d.ts +69 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.js +147 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/counter.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.d.ts +55 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.js +406 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/harness-executor.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.d.ts +19 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.js +28 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/run-trace.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.d.ts +17 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.js +55 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.types.d.ts +3 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.types.js +2 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/summarizer.types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/tool-pairing.d.ts +20 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/tool-pairing.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/tool-pairing.js +56 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/components/tool-pairing.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/llm-input.d.ts +23 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/llm-input.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/llm-input.js +127 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/llm-input.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.d.ts +9 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.js +40 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/functions/memory-recall.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.d.ts +135 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.js +31 -0
- package/dist/components/multi-agent-orchestration/agent/agent-loop/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent.d.ts +93 -0
- package/dist/components/multi-agent-orchestration/agent/agent.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/agent.js +223 -0
- package/dist/components/multi-agent-orchestration/agent/agent.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/artifact-manager/artifact-manager.d.ts +18 -0
- package/dist/components/multi-agent-orchestration/agent/artifact-manager/artifact-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/artifact-manager/artifact-manager.js +20 -0
- package/dist/components/multi-agent-orchestration/agent/artifact-manager/artifact-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.d.ts +6 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.js +6 -0
- package/dist/components/multi-agent-orchestration/agent/channel-manager/channel-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.d.ts +22 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.js +52 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/context-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/types.d.ts +13 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/types.js +2 -0
- package/dist/components/multi-agent-orchestration/agent/context-manager/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.d.ts +25 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.js +74 -0
- package/dist/components/multi-agent-orchestration/agent/conversation-manager/conversation-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/consolidation-scheduler.d.ts +57 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/consolidation-scheduler.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/consolidation-scheduler.js +185 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/consolidation-scheduler.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/dreaming.d.ts +38 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/dreaming.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/dreaming.js +89 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/dreaming.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/indexing.d.ts +30 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/indexing.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/indexing.js +91 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/indexing.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/learning.d.ts +3 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/learning.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/learning.js +3 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/learning.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.d.ts +22 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.js +196 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/memory.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/retrieval.d.ts +17 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/retrieval.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/retrieval.js +114 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/components/retrieval.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.d.ts +89 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.js +178 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/memory-system.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/config.d.ts +29 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/config.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/config.js +2 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/config.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/pipeline.d.ts +33 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/pipeline.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/pipeline.js +2 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/pipeline.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/record.d.ts +27 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/record.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/record.js +5 -0
- package/dist/components/multi-agent-orchestration/agent/memory-system/types/record.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.d.ts +39 -0
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.js +70 -0
- package/dist/components/multi-agent-orchestration/agent/model-manager/model-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/sandbox-manager/sandbox-manager.d.ts +43 -0
- package/dist/components/multi-agent-orchestration/agent/sandbox-manager/sandbox-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/sandbox-manager/sandbox-manager.js +126 -0
- package/dist/components/multi-agent-orchestration/agent/sandbox-manager/sandbox-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.d.ts +38 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.js +155 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/scheduled-job-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/types.d.ts +27 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/types.js +2 -0
- package/dist/components/multi-agent-orchestration/agent/scheduled-job-manager/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-index.d.ts +6 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-index.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-index.js +43 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-index.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-manager.d.ts +56 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-manager.js +107 -0
- package/dist/components/multi-agent-orchestration/agent/skill-manager/skill-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.d.ts +20 -0
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.js +28 -0
- package/dist/components/multi-agent-orchestration/agent/tool-manager/tool-manager.js.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/types.d.ts +44 -0
- package/dist/components/multi-agent-orchestration/agent/types.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/agent/types.js +2 -0
- package/dist/components/multi-agent-orchestration/agent/types.js.map +1 -0
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.d.ts +23 -0
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.d.ts.map +1 -0
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.js +42 -0
- package/dist/components/multi-agent-orchestration/multi-agent-orchestration.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-agent-store.d.ts +10 -0
- package/dist/components/persistence-hub/default-stores/memory-agent-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-agent-store.js +16 -0
- package/dist/components/persistence-hub/default-stores/memory-agent-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-artifact-store.d.ts +16 -0
- package/dist/components/persistence-hub/default-stores/memory-artifact-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-artifact-store.js +70 -0
- package/dist/components/persistence-hub/default-stores/memory-artifact-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-memory-store.d.ts +12 -0
- package/dist/components/persistence-hub/default-stores/memory-memory-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-memory-store.js +51 -0
- package/dist/components/persistence-hub/default-stores/memory-memory-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-message-store.d.ts +12 -0
- package/dist/components/persistence-hub/default-stores/memory-message-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-message-store.js +33 -0
- package/dist/components/persistence-hub/default-stores/memory-message-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-provider-store.d.ts +9 -0
- package/dist/components/persistence-hub/default-stores/memory-provider-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-provider-store.js +16 -0
- package/dist/components/persistence-hub/default-stores/memory-provider-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-session-store.d.ts +12 -0
- package/dist/components/persistence-hub/default-stores/memory-session-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-session-store.js +42 -0
- package/dist/components/persistence-hub/default-stores/memory-session-store.js.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-skill-store.d.ts +9 -0
- package/dist/components/persistence-hub/default-stores/memory-skill-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/default-stores/memory-skill-store.js +20 -0
- package/dist/components/persistence-hub/default-stores/memory-skill-store.js.map +1 -0
- package/dist/components/persistence-hub/persistence-hub.d.ts +34 -0
- package/dist/components/persistence-hub/persistence-hub.d.ts.map +1 -0
- package/dist/components/persistence-hub/persistence-hub.js +37 -0
- package/dist/components/persistence-hub/persistence-hub.js.map +1 -0
- package/dist/components/persistence-hub/types/agent-store.d.ts +8 -0
- package/dist/components/persistence-hub/types/agent-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/agent-store.js +2 -0
- package/dist/components/persistence-hub/types/agent-store.js.map +1 -0
- package/dist/components/persistence-hub/types/artifact-store.d.ts +33 -0
- package/dist/components/persistence-hub/types/artifact-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/artifact-store.js +2 -0
- package/dist/components/persistence-hub/types/artifact-store.js.map +1 -0
- package/dist/components/persistence-hub/types/memory-store.d.ts +23 -0
- package/dist/components/persistence-hub/types/memory-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/memory-store.js +2 -0
- package/dist/components/persistence-hub/types/memory-store.js.map +1 -0
- package/dist/components/persistence-hub/types/message-store.d.ts +27 -0
- package/dist/components/persistence-hub/types/message-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/message-store.js +2 -0
- package/dist/components/persistence-hub/types/message-store.js.map +1 -0
- package/dist/components/persistence-hub/types/provider-store.d.ts +28 -0
- package/dist/components/persistence-hub/types/provider-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/provider-store.js +5 -0
- package/dist/components/persistence-hub/types/provider-store.js.map +1 -0
- package/dist/components/persistence-hub/types/session-store.d.ts +15 -0
- package/dist/components/persistence-hub/types/session-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/session-store.js +2 -0
- package/dist/components/persistence-hub/types/session-store.js.map +1 -0
- package/dist/components/persistence-hub/types/skill-store.d.ts +22 -0
- package/dist/components/persistence-hub/types/skill-store.d.ts.map +1 -0
- package/dist/components/persistence-hub/types/skill-store.js +2 -0
- package/dist/components/persistence-hub/types/skill-store.js.map +1 -0
- package/dist/components/sandbox-hub/approval-policy.d.ts +12 -0
- package/dist/components/sandbox-hub/approval-policy.d.ts.map +1 -0
- package/dist/components/sandbox-hub/approval-policy.js +11 -0
- package/dist/components/sandbox-hub/approval-policy.js.map +1 -0
- package/dist/components/sandbox-hub/docker/aec-sandbox-image.d.ts +3 -0
- package/dist/components/sandbox-hub/docker/aec-sandbox-image.d.ts.map +1 -0
- package/dist/components/sandbox-hub/docker/aec-sandbox-image.js +31 -0
- package/dist/components/sandbox-hub/docker/aec-sandbox-image.js.map +1 -0
- package/dist/components/sandbox-hub/docker/docker-cli.d.ts +32 -0
- package/dist/components/sandbox-hub/docker/docker-cli.d.ts.map +1 -0
- package/dist/components/sandbox-hub/docker/docker-cli.js +83 -0
- package/dist/components/sandbox-hub/docker/docker-cli.js.map +1 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox-provider.d.ts +70 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox-provider.d.ts.map +1 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox-provider.js +166 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox-provider.js.map +1 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox.d.ts +51 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox.d.ts.map +1 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox.js +584 -0
- package/dist/components/sandbox-hub/docker/docker-sandbox.js.map +1 -0
- package/dist/components/sandbox-hub/docker/sandbox-helper.d.ts +4 -0
- package/dist/components/sandbox-hub/docker/sandbox-helper.d.ts.map +1 -0
- package/dist/components/sandbox-hub/docker/sandbox-helper.js +442 -0
- package/dist/components/sandbox-hub/docker/sandbox-helper.js.map +1 -0
- package/dist/components/sandbox-hub/docker/types.d.ts +26 -0
- package/dist/components/sandbox-hub/docker/types.d.ts.map +1 -0
- package/dist/components/sandbox-hub/docker/types.js +2 -0
- package/dist/components/sandbox-hub/docker/types.js.map +1 -0
- package/dist/components/sandbox-hub/host/host-sandbox-provider.d.ts +34 -0
- package/dist/components/sandbox-hub/host/host-sandbox-provider.d.ts.map +1 -0
- package/dist/components/sandbox-hub/host/host-sandbox-provider.js +81 -0
- package/dist/components/sandbox-hub/host/host-sandbox-provider.js.map +1 -0
- package/dist/components/sandbox-hub/host/host-sandbox.d.ts +22 -0
- package/dist/components/sandbox-hub/host/host-sandbox.d.ts.map +1 -0
- package/dist/components/sandbox-hub/host/host-sandbox.js +508 -0
- package/dist/components/sandbox-hub/host/host-sandbox.js.map +1 -0
- package/dist/components/sandbox-hub/logical-path.d.ts +28 -0
- package/dist/components/sandbox-hub/logical-path.d.ts.map +1 -0
- package/dist/components/sandbox-hub/logical-path.js +73 -0
- package/dist/components/sandbox-hub/logical-path.js.map +1 -0
- package/dist/components/sandbox-hub/sandbox-hub.d.ts +69 -0
- package/dist/components/sandbox-hub/sandbox-hub.d.ts.map +1 -0
- package/dist/components/sandbox-hub/sandbox-hub.js +216 -0
- package/dist/components/sandbox-hub/sandbox-hub.js.map +1 -0
- package/dist/components/sandbox-hub/traced-sandbox.d.ts +15 -0
- package/dist/components/sandbox-hub/traced-sandbox.d.ts.map +1 -0
- package/dist/components/sandbox-hub/traced-sandbox.js +69 -0
- package/dist/components/sandbox-hub/traced-sandbox.js.map +1 -0
- package/dist/components/sandbox-hub/types/policy.d.ts +40 -0
- package/dist/components/sandbox-hub/types/policy.d.ts.map +1 -0
- package/dist/components/sandbox-hub/types/policy.js +2 -0
- package/dist/components/sandbox-hub/types/policy.js.map +1 -0
- package/dist/components/sandbox-hub/types/provider.d.ts +40 -0
- package/dist/components/sandbox-hub/types/provider.d.ts.map +1 -0
- package/dist/components/sandbox-hub/types/provider.js +2 -0
- package/dist/components/sandbox-hub/types/provider.js.map +1 -0
- package/dist/components/sandbox-hub/types/sandbox.d.ts +185 -0
- package/dist/components/sandbox-hub/types/sandbox.d.ts.map +1 -0
- package/dist/components/sandbox-hub/types/sandbox.js +15 -0
- package/dist/components/sandbox-hub/types/sandbox.js.map +1 -0
- package/dist/components/skill-hub/built-in-skills/essential-skills.d.ts +5 -0
- package/dist/components/skill-hub/built-in-skills/essential-skills.d.ts.map +1 -0
- package/dist/components/skill-hub/built-in-skills/essential-skills.js +10 -0
- package/dist/components/skill-hub/built-in-skills/essential-skills.js.map +1 -0
- package/dist/components/skill-hub/built-in-skills/plan.d.ts +3 -0
- package/dist/components/skill-hub/built-in-skills/plan.d.ts.map +1 -0
- package/dist/components/skill-hub/built-in-skills/plan.js +33 -0
- package/dist/components/skill-hub/built-in-skills/plan.js.map +1 -0
- package/dist/components/skill-hub/built-in-skills/skill-creator.d.ts +3 -0
- package/dist/components/skill-hub/built-in-skills/skill-creator.d.ts.map +1 -0
- package/dist/components/skill-hub/built-in-skills/skill-creator.js +186 -0
- package/dist/components/skill-hub/built-in-skills/skill-creator.js.map +1 -0
- package/dist/components/skill-hub/built-in-skills/web-research.d.ts +3 -0
- package/dist/components/skill-hub/built-in-skills/web-research.d.ts.map +1 -0
- package/dist/components/skill-hub/built-in-skills/web-research.js +35 -0
- package/dist/components/skill-hub/built-in-skills/web-research.js.map +1 -0
- package/dist/components/skill-hub/skill-format.d.ts +40 -0
- package/dist/components/skill-hub/skill-format.d.ts.map +1 -0
- package/dist/components/skill-hub/skill-format.js +378 -0
- package/dist/components/skill-hub/skill-format.js.map +1 -0
- package/dist/components/skill-hub/skill-hub.d.ts +45 -0
- package/dist/components/skill-hub/skill-hub.d.ts.map +1 -0
- package/dist/components/skill-hub/skill-hub.js +173 -0
- package/dist/components/skill-hub/skill-hub.js.map +1 -0
- package/dist/components/skill-hub/types/agent-skills.d.ts +20 -0
- package/dist/components/skill-hub/types/agent-skills.d.ts.map +1 -0
- package/dist/components/skill-hub/types/agent-skills.js +2 -0
- package/dist/components/skill-hub/types/agent-skills.js.map +1 -0
- package/dist/components/skill-hub/types/skill.d.ts +55 -0
- package/dist/components/skill-hub/types/skill.d.ts.map +1 -0
- package/dist/components/skill-hub/types/skill.js +11 -0
- package/dist/components/skill-hub/types/skill.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.d.ts +52 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.js +143 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/artifact-helpers.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/create-artifact-tools.d.ts +7 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/create-artifact-tools.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/create-artifact-tools.js +18 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/create-artifact-tools.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/list-artifacts-tool.d.ts +16 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/list-artifacts-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/list-artifacts-tool.js +69 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/list-artifacts-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/read-artifact-tool.d.ts +16 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/read-artifact-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/read-artifact-tool.js +79 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/read-artifact-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/save-artifact-tool.d.ts +16 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/save-artifact-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/save-artifact-tool.js +105 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/save-artifact-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/types.d.ts +11 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/types.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/types.js +8 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/types.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/update-artifact-tool.d.ts +17 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/update-artifact-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/update-artifact-tool.js +100 -0
- package/dist/components/tool-hub/built-in-tools/artifacts/update-artifact-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/interaction/clarify-tool.d.ts +16 -0
- package/dist/components/tool-hub/built-in-tools/interaction/clarify-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/interaction/clarify-tool.js +94 -0
- package/dist/components/tool-hub/built-in-tools/interaction/clarify-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-manage-tool.d.ts +22 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-manage-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-manage-tool.js +226 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-manage-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-view-tool.d.ts +18 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-view-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-view-tool.js +86 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-view-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-workspace.d.ts +26 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-workspace.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-workspace.js +93 -0
- package/dist/components/tool-hub/built-in-tools/skills/skill-workspace.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/duckduckgo-search-provider.d.ts +28 -0
- package/dist/components/tool-hub/built-in-tools/web/duckduckgo-search-provider.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/duckduckgo-search-provider.js +116 -0
- package/dist/components/tool-hub/built-in-tools/web/duckduckgo-search-provider.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/html-to-text.d.ts +14 -0
- package/dist/components/tool-hub/built-in-tools/web/html-to-text.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/html-to-text.js +158 -0
- package/dist/components/tool-hub/built-in-tools/web/html-to-text.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/network-guard.d.ts +21 -0
- package/dist/components/tool-hub/built-in-tools/web/network-guard.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/network-guard.js +106 -0
- package/dist/components/tool-hub/built-in-tools/web/network-guard.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/types.d.ts +23 -0
- package/dist/components/tool-hub/built-in-tools/web/types.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/types.js +5 -0
- package/dist/components/tool-hub/built-in-tools/web/types.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/web-extract-tool.d.ts +37 -0
- package/dist/components/tool-hub/built-in-tools/web/web-extract-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/web-extract-tool.js +206 -0
- package/dist/components/tool-hub/built-in-tools/web/web-extract-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/web-search-tool.d.ts +25 -0
- package/dist/components/tool-hub/built-in-tools/web/web-search-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/web/web-search-tool.js +82 -0
- package/dist/components/tool-hub/built-in-tools/web/web-search-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/create-workspace-tools.d.ts +7 -0
- package/dist/components/tool-hub/built-in-tools/workspace/create-workspace-tools.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/create-workspace-tools.js +24 -0
- package/dist/components/tool-hub/built-in-tools/workspace/create-workspace-tools.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/edit-file-tool.d.ts +15 -0
- package/dist/components/tool-hub/built-in-tools/workspace/edit-file-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/edit-file-tool.js +103 -0
- package/dist/components/tool-hub/built-in-tools/workspace/edit-file-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/list-files-tool.d.ts +12 -0
- package/dist/components/tool-hub/built-in-tools/workspace/list-files-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/list-files-tool.js +53 -0
- package/dist/components/tool-hub/built-in-tools/workspace/list-files-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/read-file-tool.d.ts +15 -0
- package/dist/components/tool-hub/built-in-tools/workspace/read-file-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/read-file-tool.js +71 -0
- package/dist/components/tool-hub/built-in-tools/workspace/read-file-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/run-code-tool.d.ts +16 -0
- package/dist/components/tool-hub/built-in-tools/workspace/run-code-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/run-code-tool.js +72 -0
- package/dist/components/tool-hub/built-in-tools/workspace/run-code-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/search-files-tool.d.ts +12 -0
- package/dist/components/tool-hub/built-in-tools/workspace/search-files-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/search-files-tool.js +64 -0
- package/dist/components/tool-hub/built-in-tools/workspace/search-files-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/terminal-tool.d.ts +19 -0
- package/dist/components/tool-hub/built-in-tools/workspace/terminal-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/terminal-tool.js +111 -0
- package/dist/components/tool-hub/built-in-tools/workspace/terminal-tool.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/types.d.ts +16 -0
- package/dist/components/tool-hub/built-in-tools/workspace/types.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/types.js +8 -0
- package/dist/components/tool-hub/built-in-tools/workspace/types.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.d.ts +29 -0
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.js +128 -0
- package/dist/components/tool-hub/built-in-tools/workspace/workspace-helpers.js.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/write-file-tool.d.ts +17 -0
- package/dist/components/tool-hub/built-in-tools/workspace/write-file-tool.d.ts.map +1 -0
- package/dist/components/tool-hub/built-in-tools/workspace/write-file-tool.js +61 -0
- package/dist/components/tool-hub/built-in-tools/workspace/write-file-tool.js.map +1 -0
- package/dist/components/tool-hub/policies/default-tool-policy.d.ts +17 -0
- package/dist/components/tool-hub/policies/default-tool-policy.d.ts.map +1 -0
- package/dist/components/tool-hub/policies/default-tool-policy.js +99 -0
- package/dist/components/tool-hub/policies/default-tool-policy.js.map +1 -0
- package/dist/components/tool-hub/tool-hub.d.ts +28 -0
- package/dist/components/tool-hub/tool-hub.d.ts.map +1 -0
- package/dist/components/tool-hub/tool-hub.js +49 -0
- package/dist/components/tool-hub/tool-hub.js.map +1 -0
- package/dist/components/tool-hub/types.d.ts +138 -0
- package/dist/components/tool-hub/types.d.ts.map +1 -0
- package/dist/components/tool-hub/types.js +2 -0
- package/dist/components/tool-hub/types.js.map +1 -0
- package/dist/components/trace-service/console-trace-sink.d.ts +9 -0
- package/dist/components/trace-service/console-trace-sink.d.ts.map +1 -0
- package/dist/components/trace-service/console-trace-sink.js +35 -0
- package/dist/components/trace-service/console-trace-sink.js.map +1 -0
- package/dist/components/trace-service/trace-service.d.ts +25 -0
- package/dist/components/trace-service/trace-service.d.ts.map +1 -0
- package/dist/components/trace-service/trace-service.js +288 -0
- package/dist/components/trace-service/trace-service.js.map +1 -0
- package/dist/components/trace-service/types/sink.d.ts +7 -0
- package/dist/components/trace-service/types/sink.d.ts.map +1 -0
- package/dist/components/trace-service/types/sink.js +5 -0
- package/dist/components/trace-service/types/sink.js.map +1 -0
- package/dist/components/trace-service/types/span.d.ts +31 -0
- package/dist/components/trace-service/types/span.d.ts.map +1 -0
- package/dist/components/trace-service/types/span.js +5 -0
- package/dist/components/trace-service/types/span.js.map +1 -0
- package/dist/create-agent.d.ts +5 -0
- package/dist/create-agent.d.ts.map +1 -0
- package/dist/create-agent.js +57 -0
- package/dist/create-agent.js.map +1 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel/errors/artifact-error.d.ts +23 -0
- package/dist/kernel/errors/artifact-error.d.ts.map +1 -0
- package/dist/kernel/errors/artifact-error.js +22 -0
- package/dist/kernel/errors/artifact-error.js.map +1 -0
- package/dist/kernel/errors/model-error.d.ts +7 -0
- package/dist/kernel/errors/model-error.d.ts.map +1 -0
- package/dist/kernel/errors/model-error.js +10 -0
- package/dist/kernel/errors/model-error.js.map +1 -0
- package/dist/kernel/errors/policy-error.d.ts +8 -0
- package/dist/kernel/errors/policy-error.d.ts.map +1 -0
- package/dist/kernel/errors/policy-error.js +12 -0
- package/dist/kernel/errors/policy-error.js.map +1 -0
- package/dist/kernel/errors/sandbox-error.d.ts +35 -0
- package/dist/kernel/errors/sandbox-error.d.ts.map +1 -0
- package/dist/kernel/errors/sandbox-error.js +26 -0
- package/dist/kernel/errors/sandbox-error.js.map +1 -0
- package/dist/kernel/errors/sdk-error.d.ts +9 -0
- package/dist/kernel/errors/sdk-error.d.ts.map +1 -0
- package/dist/kernel/errors/sdk-error.js +13 -0
- package/dist/kernel/errors/sdk-error.js.map +1 -0
- package/dist/kernel/errors/session-error.d.ts +7 -0
- package/dist/kernel/errors/session-error.d.ts.map +1 -0
- package/dist/kernel/errors/session-error.js +10 -0
- package/dist/kernel/errors/session-error.js.map +1 -0
- package/dist/kernel/errors/skill-error.d.ts +14 -0
- package/dist/kernel/errors/skill-error.d.ts.map +1 -0
- package/dist/kernel/errors/skill-error.js +12 -0
- package/dist/kernel/errors/skill-error.js.map +1 -0
- package/dist/kernel/errors/tool-error.d.ts +8 -0
- package/dist/kernel/errors/tool-error.d.ts.map +1 -0
- package/dist/kernel/errors/tool-error.js +12 -0
- package/dist/kernel/errors/tool-error.js.map +1 -0
- package/dist/kernel/interfaces/kernel.d.ts +23 -0
- package/dist/kernel/interfaces/kernel.d.ts.map +1 -0
- package/dist/kernel/interfaces/kernel.js +2 -0
- package/dist/kernel/interfaces/kernel.js.map +1 -0
- package/dist/kernel/interfaces/plugin.d.ts +7 -0
- package/dist/kernel/interfaces/plugin.d.ts.map +1 -0
- package/dist/kernel/interfaces/plugin.js +5 -0
- package/dist/kernel/interfaces/plugin.js.map +1 -0
- package/dist/kernel/types.d.ts +103 -0
- package/dist/kernel/types.d.ts.map +1 -0
- package/dist/kernel/types.js +2 -0
- package/dist/kernel/types.js.map +1 -0
- package/dist/testing/in-memory-sandbox.d.ts +66 -0
- package/dist/testing/in-memory-sandbox.d.ts.map +1 -0
- package/dist/testing/in-memory-sandbox.js +507 -0
- package/dist/testing/in-memory-sandbox.js.map +1 -0
- package/dist/testing/mock-llm-model-provider.d.ts +14 -0
- package/dist/testing/mock-llm-model-provider.d.ts.map +1 -0
- package/dist/testing/mock-llm-model-provider.js +30 -0
- package/dist/testing/mock-llm-model-provider.js.map +1 -0
- package/dist/testing/mock-session-store.d.ts +17 -0
- package/dist/testing/mock-session-store.d.ts.map +1 -0
- package/dist/testing/mock-session-store.js +49 -0
- package/dist/testing/mock-session-store.js.map +1 -0
- package/dist/testing/mock-tools.d.ts +38 -0
- package/dist/testing/mock-tools.d.ts.map +1 -0
- package/dist/testing/mock-tools.js +130 -0
- package/dist/testing/mock-tools.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { resolveLoopConfig, SDKEventType } from "./types.js";
|
|
2
|
+
import { HarnessExecutor } from "./components/harness-executor.js";
|
|
3
|
+
import { Summarizer } from "./components/summarizer.js";
|
|
4
|
+
import { Compactor } from "./components/compactor.js";
|
|
5
|
+
import { repairToolPairs } from "./components/tool-pairing.js";
|
|
6
|
+
import { Counter } from "./components/counter.js";
|
|
7
|
+
import { abortable, raceAbort } from "./components/abort.js";
|
|
8
|
+
import { RunTrace } from "./components/run-trace.js";
|
|
9
|
+
import { recallMemories } from "./functions/memory-recall.js";
|
|
10
|
+
import { describeLlmInput, withRecalledMemories, } from "./functions/llm-input.js";
|
|
11
|
+
const TOKEN_BUDGET = 100_000;
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// AgentLoop — OTAR cycle (Observe → Think → Act → Reflect)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
export class AgentLoop {
|
|
16
|
+
deps;
|
|
17
|
+
/**
|
|
18
|
+
* HarnessExecutor — unified dispatch engine for the agent loop
|
|
19
|
+
*
|
|
20
|
+
* Owns all execution logic: policy enforcement, retries, parallel dispatch,
|
|
21
|
+
* and routing between tools and skills.
|
|
22
|
+
*
|
|
23
|
+
* AgentLoop
|
|
24
|
+
* │
|
|
25
|
+
* ▼
|
|
26
|
+
* HarnessExecutor
|
|
27
|
+
* ├── ToolPolicy ──→ allowlist / schema / auth hook
|
|
28
|
+
* ├── ToolManager ──→ get() ──→ ToolHandler.execute()
|
|
29
|
+
* ├── SkillManager ──→ getTool() ──→ skill_view (loads a skill's instructions)
|
|
30
|
+
* └── EventBus ──→ emit lifecycle events
|
|
31
|
+
*
|
|
32
|
+
* ToolManager and SkillManager are registries (get/list only).
|
|
33
|
+
* HarnessExecutor is the single owner of dispatch and error recovery.
|
|
34
|
+
*/
|
|
35
|
+
executor;
|
|
36
|
+
compactor;
|
|
37
|
+
summarizer;
|
|
38
|
+
counter;
|
|
39
|
+
constructor(deps) {
|
|
40
|
+
this.deps = deps;
|
|
41
|
+
this.executor = new HarnessExecutor(deps);
|
|
42
|
+
this.summarizer = new Summarizer(deps);
|
|
43
|
+
this.compactor = new Compactor(deps.profile.compactor);
|
|
44
|
+
this.counter = new Counter(deps.modelManager);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* run() — blocking call, returns final message
|
|
48
|
+
* @param userMessage
|
|
49
|
+
* @param sessionId
|
|
50
|
+
* @param modelOverrides
|
|
51
|
+
* @param runOptions
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
async run(userMessage, sessionId, modelOverrides, runOptions) {
|
|
55
|
+
const { modelManager, contextManager, conversationManager } = this.deps;
|
|
56
|
+
// A-65: aborting this stops the run at the next safe point (below) —
|
|
57
|
+
// same contract as stream()'s `signal`.
|
|
58
|
+
const run = await this.beginRun(userMessage, sessionId, runOptions);
|
|
59
|
+
const { signal, totalUsage, emit } = run;
|
|
60
|
+
const aborted = (iterations) => ({
|
|
61
|
+
message: { role: "assistant", content: "" },
|
|
62
|
+
usage: totalUsage,
|
|
63
|
+
iterations,
|
|
64
|
+
aborted: true,
|
|
65
|
+
});
|
|
66
|
+
let iteration = 0;
|
|
67
|
+
while (iteration < run.maxIterations) {
|
|
68
|
+
// --- Safe point A (A-65): see stream()'s matching comment below. ---
|
|
69
|
+
if (signal?.aborted) {
|
|
70
|
+
this.closeAbortedRun(run, iteration, null);
|
|
71
|
+
return aborted(iteration);
|
|
72
|
+
}
|
|
73
|
+
iteration++;
|
|
74
|
+
const iterSpan = this.startIteration(run, iteration);
|
|
75
|
+
// --- OBSERVE: prepare context through middleware pipeline ---
|
|
76
|
+
const input = await this.assembleModelInput(run, iteration, modelOverrides);
|
|
77
|
+
// --- Safe point B (A-65): after context assembly/compaction, before
|
|
78
|
+
// the model is asked for anything. ---
|
|
79
|
+
if (signal?.aborted) {
|
|
80
|
+
this.closeAbortedRun(run, iteration, iterSpan);
|
|
81
|
+
return aborted(iteration);
|
|
82
|
+
}
|
|
83
|
+
// --- THINK: send to model ---
|
|
84
|
+
const modelSpan = this.startModelCall(run, iteration, input);
|
|
85
|
+
// Feed the (possibly compacted) messages to the LLM. `options` itself
|
|
86
|
+
// stays signal-free (it feeds describeLlmInput and the trace spans
|
|
87
|
+
// above) — the signal is merged in only at this call site.
|
|
88
|
+
const chatOutcome = await raceAbort(modelManager.chat(input.llmMessages, signal ? { ...input.options, signal } : input.options), signal);
|
|
89
|
+
if (chatOutcome.aborted) {
|
|
90
|
+
modelSpan?.end({ aborted: true });
|
|
91
|
+
this.closeAbortedRun(run, iteration, iterSpan);
|
|
92
|
+
return aborted(iteration);
|
|
93
|
+
}
|
|
94
|
+
const rawResponse = chatOutcome.value;
|
|
95
|
+
// Run afterModel middlewares
|
|
96
|
+
const response = await contextManager.processResponse(rawResponse, {
|
|
97
|
+
session: run.session,
|
|
98
|
+
tokenBudget: TOKEN_BUDGET,
|
|
99
|
+
usage: totalUsage,
|
|
100
|
+
});
|
|
101
|
+
modelSpan?.end({
|
|
102
|
+
stopReason: response.stopReason,
|
|
103
|
+
inputTokens: response.usage.inputTokens,
|
|
104
|
+
outputTokens: response.usage.outputTokens,
|
|
105
|
+
hasToolCalls: !!response.message.toolCalls?.length,
|
|
106
|
+
responsePreview: response.message.content,
|
|
107
|
+
toolCalls: response.message.toolCalls?.map((tc) => ({
|
|
108
|
+
name: tc.name,
|
|
109
|
+
arguments: tc.arguments,
|
|
110
|
+
})),
|
|
111
|
+
});
|
|
112
|
+
this.recordUsage(run, input.llmMessages, response.usage);
|
|
113
|
+
emit(SDKEventType.ModelResponded, {
|
|
114
|
+
stopReason: response.stopReason,
|
|
115
|
+
usage: response.usage,
|
|
116
|
+
hasToolCalls: !!response.message.toolCalls?.length,
|
|
117
|
+
});
|
|
118
|
+
await conversationManager.addMessage(response.message);
|
|
119
|
+
// --- End turn: return final answer ---
|
|
120
|
+
if (response.stopReason === "end_turn") {
|
|
121
|
+
this.completeRun(run, iteration, iterSpan);
|
|
122
|
+
return {
|
|
123
|
+
message: response.message,
|
|
124
|
+
usage: totalUsage,
|
|
125
|
+
iterations: iteration,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// --- ACT: execute tool/skill calls ---
|
|
129
|
+
if (response.stopReason === "tool_use" &&
|
|
130
|
+
response.message.toolCalls?.length) {
|
|
131
|
+
await this.executeToolCalls(run, response.message.toolCalls);
|
|
132
|
+
}
|
|
133
|
+
// --- REFLECT: loop back, model sees tool results and decides next step ---
|
|
134
|
+
iterSpan?.end();
|
|
135
|
+
}
|
|
136
|
+
// Safety valve
|
|
137
|
+
this.closeMaxIterationsRun(run);
|
|
138
|
+
const fallback = {
|
|
139
|
+
role: "assistant",
|
|
140
|
+
content: "Reached maximum reasoning steps. Please refine your request.",
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
message: fallback,
|
|
144
|
+
usage: totalUsage,
|
|
145
|
+
iterations: run.maxIterations,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* stream() — yields chunks in real-time, handles tool calls between streams
|
|
150
|
+
* @param userMessage
|
|
151
|
+
* @param sessionId
|
|
152
|
+
* @param modelOverrides
|
|
153
|
+
* @param runOptions
|
|
154
|
+
* @returns
|
|
155
|
+
*/
|
|
156
|
+
async *stream(userMessage, sessionId, modelOverrides, runOptions) {
|
|
157
|
+
const { conversationManager } = this.deps;
|
|
158
|
+
const run = await this.beginRun(userMessage, sessionId, runOptions);
|
|
159
|
+
const { signal, totalUsage, emit } = run;
|
|
160
|
+
let iteration = 0;
|
|
161
|
+
while (iteration < run.maxIterations) {
|
|
162
|
+
// --- Safe point A (A-65): before the next iteration starts. Covers an
|
|
163
|
+
// already-aborted signal and abort during the previous iteration's
|
|
164
|
+
// tool execution (the loop re-enters here before iteration++). ---
|
|
165
|
+
if (signal?.aborted) {
|
|
166
|
+
this.closeAbortedRun(run, iteration, null);
|
|
167
|
+
yield { type: "done", usage: totalUsage, aborted: true };
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
iteration++;
|
|
171
|
+
const iterSpan = this.startIteration(run, iteration);
|
|
172
|
+
// --- Context assembly ---
|
|
173
|
+
const input = await this.assembleModelInput(run, iteration, modelOverrides);
|
|
174
|
+
// --- Safe point B (A-65): after context assembly/compaction, before
|
|
175
|
+
// the model is asked for anything. ---
|
|
176
|
+
if (signal?.aborted) {
|
|
177
|
+
this.closeAbortedRun(run, iteration, iterSpan);
|
|
178
|
+
yield { type: "done", usage: totalUsage, aborted: true };
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// --- Model call span ---
|
|
182
|
+
const modelSpan = this.startModelCall(run, iteration, input);
|
|
183
|
+
// Stream model output, collecting the full message
|
|
184
|
+
const streamed = yield* this.streamModelResponse(run, input);
|
|
185
|
+
// Aborted mid-stream (A-65): this check must come before the normal
|
|
186
|
+
// responseMessage persistence below. Persist the partial text ONLY
|
|
187
|
+
// when non-empty, and never include collectedToolCalls — they were
|
|
188
|
+
// never dispatched and would dangle without a matching tool result.
|
|
189
|
+
if (signal?.aborted) {
|
|
190
|
+
modelSpan?.end({ aborted: true, responsePreview: streamed.content });
|
|
191
|
+
if (streamed.content) {
|
|
192
|
+
await conversationManager.addMessage({
|
|
193
|
+
role: "assistant",
|
|
194
|
+
content: streamed.content,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
this.closeAbortedRun(run, iteration, iterSpan);
|
|
198
|
+
yield { type: "done", usage: totalUsage, aborted: true };
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const { content, toolCalls, stopReason, usage } = streamed;
|
|
202
|
+
modelSpan?.end({
|
|
203
|
+
stopReason,
|
|
204
|
+
hasToolCalls: !!toolCalls.length,
|
|
205
|
+
responsePreview: content,
|
|
206
|
+
toolCalls: toolCalls.length
|
|
207
|
+
? toolCalls.map((tc) => ({
|
|
208
|
+
name: tc.name,
|
|
209
|
+
arguments: tc.arguments,
|
|
210
|
+
}))
|
|
211
|
+
: undefined,
|
|
212
|
+
...(usage && {
|
|
213
|
+
inputTokens: usage.inputTokens,
|
|
214
|
+
outputTokens: usage.outputTokens,
|
|
215
|
+
}),
|
|
216
|
+
});
|
|
217
|
+
const responseMessage = {
|
|
218
|
+
role: "assistant",
|
|
219
|
+
content,
|
|
220
|
+
toolCalls: toolCalls.length ? toolCalls : undefined,
|
|
221
|
+
};
|
|
222
|
+
emit(SDKEventType.ModelResponded, {
|
|
223
|
+
stopReason,
|
|
224
|
+
hasToolCalls: !!toolCalls.length,
|
|
225
|
+
});
|
|
226
|
+
await conversationManager.addMessage(responseMessage);
|
|
227
|
+
if (stopReason === "end_turn" || stopReason === "error") {
|
|
228
|
+
this.completeRun(run, iteration, iterSpan);
|
|
229
|
+
yield { type: "done", usage: totalUsage };
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (stopReason === "tool_use" && toolCalls.length) {
|
|
233
|
+
const results = await this.executeToolCalls(run, toolCalls);
|
|
234
|
+
// Yield tool results as stream chunks so the consumer can display them
|
|
235
|
+
for (const result of results) {
|
|
236
|
+
yield { type: "tool_result", toolResult: result };
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
iterSpan?.end();
|
|
240
|
+
}
|
|
241
|
+
this.closeMaxIterationsRun(run);
|
|
242
|
+
yield { type: "error", error: "Reached maximum reasoning steps." };
|
|
243
|
+
}
|
|
244
|
+
//#region Steps shared by run() and stream()
|
|
245
|
+
/**
|
|
246
|
+
* Start a run: open the trace, record the user's message, restore token
|
|
247
|
+
* usage and counter calibration from the session, and recall memories.
|
|
248
|
+
*/
|
|
249
|
+
async beginRun(userMessage, sessionId, runOptions) {
|
|
250
|
+
const { conversationManager, eventBus, traceService } = this.deps;
|
|
251
|
+
// A-65: aborting this stops the run at the next safe point (below).
|
|
252
|
+
const signal = runOptions?.signal;
|
|
253
|
+
const session = conversationManager.getSession();
|
|
254
|
+
if (!session)
|
|
255
|
+
throw new Error("No active session");
|
|
256
|
+
const emit = this.executor.createEmitter(eventBus, sessionId);
|
|
257
|
+
// --- Trace: create a context and root "run" span ---
|
|
258
|
+
const trace = new RunTrace(traceService);
|
|
259
|
+
const runSpan = trace.span("agent-run", "run", {
|
|
260
|
+
agentId: this.deps.profile.id,
|
|
261
|
+
sessionId,
|
|
262
|
+
});
|
|
263
|
+
await conversationManager.addMessage({
|
|
264
|
+
role: "user",
|
|
265
|
+
content: userMessage,
|
|
266
|
+
});
|
|
267
|
+
emit(SDKEventType.UserMessage, { role: "user", content: userMessage });
|
|
268
|
+
const totalUsage = {
|
|
269
|
+
inputTokens: session.currentTokenUsage?.inputTokens || 0,
|
|
270
|
+
outputTokens: session.currentTokenUsage?.outputTokens || 0,
|
|
271
|
+
};
|
|
272
|
+
// Restore learned chars-per-token ratio from previous turns
|
|
273
|
+
if (session.counterCalibration) {
|
|
274
|
+
this.counter.seed(session.counterCalibration.charsPerToken, session.counterCalibration.samples);
|
|
275
|
+
}
|
|
276
|
+
// --- Memory recall: once per run, keyed on the user's message ---
|
|
277
|
+
const recalled = await recallMemories({
|
|
278
|
+
memorySystem: this.deps.memorySystem,
|
|
279
|
+
counter: this.counter,
|
|
280
|
+
agentId: this.deps.profile.id,
|
|
281
|
+
}, userMessage, sessionId, trace);
|
|
282
|
+
// Resolved once per run — a runtime updateLoopConfig() takes effect on the next turn.
|
|
283
|
+
const { maxIterations } = resolveLoopConfig(this.deps.profile.loopConfig);
|
|
284
|
+
return {
|
|
285
|
+
session,
|
|
286
|
+
emit,
|
|
287
|
+
signal,
|
|
288
|
+
trace,
|
|
289
|
+
runSpan,
|
|
290
|
+
totalUsage,
|
|
291
|
+
recalled,
|
|
292
|
+
maxIterations,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/** Emit the Iteration event and open the iteration span. */
|
|
296
|
+
startIteration(run, iteration) {
|
|
297
|
+
run.emit(SDKEventType.Iteration, {
|
|
298
|
+
iteration,
|
|
299
|
+
maxIterations: run.maxIterations,
|
|
300
|
+
});
|
|
301
|
+
// --- Trace: iteration span ---
|
|
302
|
+
return run.trace.span(`iteration-${iteration}`, "iteration", {
|
|
303
|
+
iteration,
|
|
304
|
+
maxIterations: run.maxIterations,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* OBSERVE: prepare the context through the middleware pipeline, compact it
|
|
309
|
+
* if needed, add recalled memories, and pick the tools — the exact input
|
|
310
|
+
* for this iteration's model call.
|
|
311
|
+
*/
|
|
312
|
+
async assembleModelInput(run, iteration, modelOverrides) {
|
|
313
|
+
const { toolManager, contextManager, conversationManager, modelManager } = this.deps;
|
|
314
|
+
const { session, totalUsage, recalled, trace } = run;
|
|
315
|
+
const ctxSpan = trace.span("context-assembly", "context-assembly");
|
|
316
|
+
// Use LLM working set (compacted if available) instead of full history
|
|
317
|
+
const messages = await contextManager.prepareMessages(conversationManager.getLlmMessages(), { session, tokenBudget: TOKEN_BUDGET, usage: totalUsage });
|
|
318
|
+
// --- Compaction: check if context needs shrinking ---
|
|
319
|
+
const compactSpan = trace.span("compaction", "compaction", {
|
|
320
|
+
messageCountBefore: messages.length,
|
|
321
|
+
inputTokens: totalUsage.inputTokens,
|
|
322
|
+
outputTokens: totalUsage.outputTokens,
|
|
323
|
+
});
|
|
324
|
+
const compactResult = await this.compactor.compactIfNeeded(messages, totalUsage, this.counter.countTokens, this.summarizer.summarize);
|
|
325
|
+
// Persist compacted messages so subsequent turns don't re-compact
|
|
326
|
+
if (compactResult.compacted) {
|
|
327
|
+
await conversationManager.setCompactedMessages(compactResult.messages);
|
|
328
|
+
}
|
|
329
|
+
compactSpan?.end({
|
|
330
|
+
triggered: compactResult.compacted,
|
|
331
|
+
messageCountAfter: compactResult.messages.length,
|
|
332
|
+
summarySourceLength: compactResult.summarySource.length,
|
|
333
|
+
tailTokens: compactResult.tailTokens,
|
|
334
|
+
});
|
|
335
|
+
// Build the exact model input ONCE — the same array is fed to the LLM
|
|
336
|
+
// and described in the context-assembly span below.
|
|
337
|
+
// repairToolPairs: drop tool calls/results that lost their partner (e.g. a
|
|
338
|
+
// history compacted before this fix) so the provider does not reject the request.
|
|
339
|
+
const llmMessages = repairToolPairs(withRecalledMemories(compactResult.messages, recalled));
|
|
340
|
+
// The agent's tools, plus skill_view when it has skills (the index is in the system prompt).
|
|
341
|
+
const toolDefs = [
|
|
342
|
+
...toolManager.list().map((t) => t.definition),
|
|
343
|
+
...(await this.deps.skillManager.toolDefinitions()),
|
|
344
|
+
];
|
|
345
|
+
const options = { tools: toolDefs, ...modelOverrides };
|
|
346
|
+
// Computed once per iteration, only when a sink is listening — tracing
|
|
347
|
+
// must never run (or throw) when there's no traceCtx to attach it to.
|
|
348
|
+
const llmInput = trace.ctx
|
|
349
|
+
? describeLlmInput({
|
|
350
|
+
iteration,
|
|
351
|
+
prepared: messages,
|
|
352
|
+
compactResult,
|
|
353
|
+
llmMessages,
|
|
354
|
+
recalled,
|
|
355
|
+
options,
|
|
356
|
+
}, { modelManager, counter: this.counter })
|
|
357
|
+
: null;
|
|
358
|
+
if (llmInput) {
|
|
359
|
+
ctxSpan?.end({ ...llmInput });
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
ctxSpan?.end();
|
|
363
|
+
}
|
|
364
|
+
return { llmMessages, toolDefs, options, llmInput };
|
|
365
|
+
}
|
|
366
|
+
/** Emit ModelRequested and open the model-call span. */
|
|
367
|
+
startModelCall(run, iteration, input) {
|
|
368
|
+
const { toolDefs, llmMessages, llmInput } = input;
|
|
369
|
+
run.emit(SDKEventType.ModelRequested, {
|
|
370
|
+
iteration,
|
|
371
|
+
toolCount: toolDefs.length,
|
|
372
|
+
});
|
|
373
|
+
return run.trace.span("model-call", "model-call", {
|
|
374
|
+
iteration,
|
|
375
|
+
toolCount: toolDefs.length,
|
|
376
|
+
toolNames: llmInput?.toolNames ?? toolDefs.map((t) => t.name),
|
|
377
|
+
inputMessageCount: llmMessages.length,
|
|
378
|
+
provider: llmInput?.provider,
|
|
379
|
+
model: llmInput?.options.model,
|
|
380
|
+
options: llmInput?.options,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Stream one model response: yields each chunk to the consumer (except
|
|
385
|
+
* `done`) and returns the collected text, tool calls and stop reason.
|
|
386
|
+
*/
|
|
387
|
+
async *streamModelResponse(run, input) {
|
|
388
|
+
const { signal } = run;
|
|
389
|
+
const { llmMessages, options } = input;
|
|
390
|
+
let fullContent = "";
|
|
391
|
+
const collectedToolCalls = [];
|
|
392
|
+
let stopReason = "end_turn";
|
|
393
|
+
let streamUsage;
|
|
394
|
+
// --- Safe point C (A-65): mid-stream. abortable() stops iterating the
|
|
395
|
+
// provider's stream as soon as `signal` aborts, without waiting on the
|
|
396
|
+
// provider's in-flight next() to settle; the leading `if` below drops
|
|
397
|
+
// any chunk that may have been produced right as the abort happened,
|
|
398
|
+
// so no provider error chunk produced by the cancellation is ever
|
|
399
|
+
// yielded. Feed the (possibly compacted) messages to the LLM. `options`
|
|
400
|
+
// itself stays signal-free (it feeds describeLlmInput and the trace
|
|
401
|
+
// spans above) — the signal is merged in only at this call site. ---
|
|
402
|
+
for await (const chunk of abortable(this.deps.modelManager.stream(llmMessages, signal ? { ...options, signal } : options), signal)) {
|
|
403
|
+
if (signal?.aborted)
|
|
404
|
+
break;
|
|
405
|
+
if (chunk.type === "done") {
|
|
406
|
+
stopReason = collectedToolCalls.length ? "tool_use" : "end_turn";
|
|
407
|
+
if (chunk.usage) {
|
|
408
|
+
streamUsage = chunk.usage;
|
|
409
|
+
this.recordUsage(run, llmMessages, chunk.usage);
|
|
410
|
+
}
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
yield chunk;
|
|
414
|
+
if (chunk.type === "text" && chunk.content) {
|
|
415
|
+
fullContent += chunk.content;
|
|
416
|
+
}
|
|
417
|
+
if (chunk.type === "tool_call" && chunk.toolCall) {
|
|
418
|
+
collectedToolCalls.push(chunk.toolCall);
|
|
419
|
+
}
|
|
420
|
+
if (chunk.type === "error") {
|
|
421
|
+
stopReason = "error";
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
content: fullContent,
|
|
426
|
+
toolCalls: collectedToolCalls,
|
|
427
|
+
stopReason,
|
|
428
|
+
usage: streamUsage,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
/** Add a model response's usage to the run total and save it on the session. */
|
|
432
|
+
recordUsage(run, llmMessages, usage) {
|
|
433
|
+
this.executor.accumulateUsage(run.totalUsage, usage);
|
|
434
|
+
// Calibrate against llmMessages (what was actually sent), not the
|
|
435
|
+
// pre-compaction/pre-memory `messages` array — otherwise the
|
|
436
|
+
// chars-per-token ratio (and every downstream token estimate) is
|
|
437
|
+
// skewed by content the model never saw.
|
|
438
|
+
this.counter.calibrate(llmMessages, usage);
|
|
439
|
+
// Save the latest response's raw usage — this IS the current context window size
|
|
440
|
+
// (inputTokens = full conversation sent, outputTokens = what the model just added)
|
|
441
|
+
run.session.currentTokenUsage = { ...usage };
|
|
442
|
+
run.session.counterCalibration = this.counter.getCalibration();
|
|
443
|
+
}
|
|
444
|
+
/** ACT: execute the model's tool/skill calls and append the results as a single message. */
|
|
445
|
+
async executeToolCalls(run, toolCalls) {
|
|
446
|
+
const toolCtx = this.executor.buildToolContext(run.session.id, run.emit, run.signal);
|
|
447
|
+
const results = await this.executor.executeAll(toolCalls, toolCtx, run.emit, run.trace.service, run.trace.ctx ?? undefined);
|
|
448
|
+
// Append all results as a single message
|
|
449
|
+
await this.deps.conversationManager.addMessage({
|
|
450
|
+
role: "assistant",
|
|
451
|
+
content: "",
|
|
452
|
+
toolResults: results,
|
|
453
|
+
});
|
|
454
|
+
return results;
|
|
455
|
+
}
|
|
456
|
+
/** The model ended its turn: close the spans and emit RunCompleted. */
|
|
457
|
+
completeRun(run, iterations, iterSpan) {
|
|
458
|
+
iterSpan?.end();
|
|
459
|
+
run.runSpan?.end({ iterations, totalUsage: run.totalUsage });
|
|
460
|
+
run.trace.close();
|
|
461
|
+
run.emit(SDKEventType.RunCompleted, {
|
|
462
|
+
iterations,
|
|
463
|
+
totalUsage: run.totalUsage,
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
/** The loop ran out of iterations: close the run span and emit MaxIterationsReached. */
|
|
467
|
+
closeMaxIterationsRun(run) {
|
|
468
|
+
const { maxIterations, totalUsage } = run;
|
|
469
|
+
run.runSpan?.end({
|
|
470
|
+
iterations: maxIterations,
|
|
471
|
+
totalUsage,
|
|
472
|
+
maxIterationsReached: true,
|
|
473
|
+
});
|
|
474
|
+
run.trace.close();
|
|
475
|
+
run.emit(SDKEventType.MaxIterationsReached, {
|
|
476
|
+
iterations: maxIterations,
|
|
477
|
+
totalUsage,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Ends a run early because RunOptions.signal was aborted (A-65): closes the
|
|
482
|
+
* current iteration/run trace spans marked `aborted: true`, removes the
|
|
483
|
+
* trace context, and emits RunCompleted with `aborted: true` — the
|
|
484
|
+
* consolidation scheduler keys on RunCompleted, so an aborted turn still
|
|
485
|
+
* counts as a turn end. The caller yields/returns the done+aborted chunk
|
|
486
|
+
* (stream()) or the aborted RunResult (run()) right after calling this.
|
|
487
|
+
*/
|
|
488
|
+
closeAbortedRun(run, iterations, iterSpan) {
|
|
489
|
+
const { totalUsage } = run;
|
|
490
|
+
iterSpan?.end({ aborted: true });
|
|
491
|
+
run.runSpan?.end({ iterations, totalUsage, aborted: true });
|
|
492
|
+
run.trace.close();
|
|
493
|
+
run.emit(SDKEventType.RunCompleted, {
|
|
494
|
+
iterations,
|
|
495
|
+
totalUsage,
|
|
496
|
+
aborted: true,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
//# sourceMappingURL=agent-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-loop.js","sourceRoot":"","sources":["../../../../../src/components/multi-agent-orchestration/agent/agent-loop/agent-loop.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,MAAM,YAAY,GAAG,OAAO,CAAC;AA8B7B,8EAA8E;AAC9E,2DAA2D;AAC3D,8EAA8E;AAE9E,MAAM,OAAO,SAAS;IA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,UAAU,EAAE,CAAC,CAAC;QAC7D,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;YAClC,UAAU;YACV,UAAU,EAAE,GAAG,CAAC,UAAU;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,wFAAwF;IAChF,qBAAqB,CAAC,GAAa;QACzC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;QAC1C,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC;YACf,UAAU,EAAE,aAAa;YACzB,UAAU;YACV,oBAAoB,EAAE,IAAI;SAC3B,CAAC,CAAC;QACH,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE;YAC1C,UAAU,EAAE,aAAa;YACzB,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACK,eAAe,CACrB,GAAa,EACb,UAAkB,EAClB,QAA2B;QAE3B,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;QAC3B,QAAQ,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACjC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;YAClC,UAAU;YACV,UAAU;YACV,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACL,CAAC;CAEF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps an async-iterable so it stops as soon as `signal` aborts, without
|
|
3
|
+
* waiting for the source's current `next()` to settle. Without a signal, the
|
|
4
|
+
* source is returned unchanged.
|
|
5
|
+
*
|
|
6
|
+
* On abort (or when the consumer stops iterating early, e.g. a `break`), the
|
|
7
|
+
* source iterator's `return()` is called but NOT awaited — an async generator
|
|
8
|
+
* stuck at an internal `await` does not honour `return()` until that await
|
|
9
|
+
* settles, so awaiting it here would defeat the whole point of aborting
|
|
10
|
+
* promptly. Any rejection from `return()` or from the losing `next()` promise
|
|
11
|
+
* is swallowed so a provider that rejects after abort never causes an
|
|
12
|
+
* unhandled rejection.
|
|
13
|
+
*/
|
|
14
|
+
export declare function abortable<T>(source: AsyncIterable<T>, signal?: AbortSignal): AsyncIterable<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Races `work` against `signal`. Resolves to `{ aborted: false, value }` when
|
|
17
|
+
* `work` settles first, or `{ aborted: true }` when `signal` aborts first (or
|
|
18
|
+
* is already aborted). The losing promise's rejection is swallowed so it
|
|
19
|
+
* never surfaces as an unhandled rejection — its result is simply ignored.
|
|
20
|
+
*/
|
|
21
|
+
export declare function raceAbort<T>(work: Promise<T>, signal?: AbortSignal): Promise<{
|
|
22
|
+
aborted: true;
|
|
23
|
+
} | {
|
|
24
|
+
aborted: false;
|
|
25
|
+
value: T;
|
|
26
|
+
}>;
|
|
27
|
+
/** Like setTimeout(ms), but resolves early when `signal` aborts. */
|
|
28
|
+
export declare function abortableDelay(ms: number, signal?: AbortSignal): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../../../../src/components/multi-agent-orchestration/agent/agent-loop/components/abort.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,aAAa,CAAC,CAAC,CAAC,CAwClB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAkB3D;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB9E"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// abort.ts — internal cancellation helpers for the agent loop (A-65)
|
|
3
|
+
//
|
|
4
|
+
// Not exported from core/src/index.ts — these are implementation details of
|
|
5
|
+
// AgentLoop/HarnessExecutor, wired through RunOptions.signal.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
/**
|
|
8
|
+
* Wraps an async-iterable so it stops as soon as `signal` aborts, without
|
|
9
|
+
* waiting for the source's current `next()` to settle. Without a signal, the
|
|
10
|
+
* source is returned unchanged.
|
|
11
|
+
*
|
|
12
|
+
* On abort (or when the consumer stops iterating early, e.g. a `break`), the
|
|
13
|
+
* source iterator's `return()` is called but NOT awaited — an async generator
|
|
14
|
+
* stuck at an internal `await` does not honour `return()` until that await
|
|
15
|
+
* settles, so awaiting it here would defeat the whole point of aborting
|
|
16
|
+
* promptly. Any rejection from `return()` or from the losing `next()` promise
|
|
17
|
+
* is swallowed so a provider that rejects after abort never causes an
|
|
18
|
+
* unhandled rejection.
|
|
19
|
+
*/
|
|
20
|
+
export function abortable(source, signal) {
|
|
21
|
+
if (!signal)
|
|
22
|
+
return source;
|
|
23
|
+
async function* generator() {
|
|
24
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
25
|
+
while (true) {
|
|
26
|
+
if (signal.aborted) {
|
|
27
|
+
void iterator.return?.()?.catch(() => { });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let abortListener;
|
|
31
|
+
const abortPromise = new Promise((resolve) => {
|
|
32
|
+
abortListener = () => resolve({ aborted: true });
|
|
33
|
+
signal.addEventListener("abort", abortListener, { once: true });
|
|
34
|
+
});
|
|
35
|
+
const nextPromise = iterator.next();
|
|
36
|
+
// Never let the losing side of the race become an unhandled rejection.
|
|
37
|
+
nextPromise.catch(() => { });
|
|
38
|
+
const outcome = await Promise.race([
|
|
39
|
+
nextPromise.then((result) => ({ aborted: false, result })),
|
|
40
|
+
abortPromise,
|
|
41
|
+
]);
|
|
42
|
+
signal.removeEventListener("abort", abortListener);
|
|
43
|
+
if (outcome.aborted) {
|
|
44
|
+
void iterator.return?.()?.catch(() => { });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (outcome.result.done)
|
|
48
|
+
return;
|
|
49
|
+
yield outcome.result.value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return generator();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Races `work` against `signal`. Resolves to `{ aborted: false, value }` when
|
|
56
|
+
* `work` settles first, or `{ aborted: true }` when `signal` aborts first (or
|
|
57
|
+
* is already aborted). The losing promise's rejection is swallowed so it
|
|
58
|
+
* never surfaces as an unhandled rejection — its result is simply ignored.
|
|
59
|
+
*/
|
|
60
|
+
export async function raceAbort(work, signal) {
|
|
61
|
+
if (!signal)
|
|
62
|
+
return { aborted: false, value: await work };
|
|
63
|
+
work.catch(() => { });
|
|
64
|
+
if (signal.aborted)
|
|
65
|
+
return { aborted: true };
|
|
66
|
+
let abortListener;
|
|
67
|
+
const abortPromise = new Promise((resolve) => {
|
|
68
|
+
abortListener = () => resolve({ aborted: true });
|
|
69
|
+
signal.addEventListener("abort", abortListener, { once: true });
|
|
70
|
+
});
|
|
71
|
+
const outcome = await Promise.race([
|
|
72
|
+
work.then((value) => ({ aborted: false, value })),
|
|
73
|
+
abortPromise,
|
|
74
|
+
]);
|
|
75
|
+
signal.removeEventListener("abort", abortListener);
|
|
76
|
+
return outcome;
|
|
77
|
+
}
|
|
78
|
+
/** Like setTimeout(ms), but resolves early when `signal` aborts. */
|
|
79
|
+
export function abortableDelay(ms, signal) {
|
|
80
|
+
if (ms <= 0)
|
|
81
|
+
return Promise.resolve();
|
|
82
|
+
if (!signal)
|
|
83
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
84
|
+
if (signal.aborted)
|
|
85
|
+
return Promise.resolve();
|
|
86
|
+
return new Promise((resolve) => {
|
|
87
|
+
const timer = setTimeout(() => {
|
|
88
|
+
signal.removeEventListener("abort", onAbort);
|
|
89
|
+
resolve();
|
|
90
|
+
}, ms);
|
|
91
|
+
const onAbort = () => {
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
resolve();
|
|
94
|
+
};
|
|
95
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=abort.js.map
|