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,206 @@
|
|
|
1
|
+
import { extractTitle, htmlToText, mainContent, truncate } from "./html-to-text.js";
|
|
2
|
+
import { assertPublicHttpUrl, BlockedUrlError } from "./network-guard.js";
|
|
3
|
+
const TEXT_CONTENT_TYPES = [
|
|
4
|
+
"text/html", "application/xhtml+xml", "text/plain", "text/markdown", "text/csv",
|
|
5
|
+
"application/json", "application/ld+json", "text/xml", "application/xml", "application/rss+xml",
|
|
6
|
+
"application/atom+xml",
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* web_extract — read-only. Fetches public web pages and returns their readable text.
|
|
10
|
+
* Every URL and every redirect hop passes the SSRF guard (http/https only, no private,
|
|
11
|
+
* loopback, link-local or metadata addresses); bodies are size-capped and time-boxed.
|
|
12
|
+
*/
|
|
13
|
+
export class WebExtractTool {
|
|
14
|
+
name = "tool:web-extract";
|
|
15
|
+
version = "1.0.0";
|
|
16
|
+
definition;
|
|
17
|
+
opts;
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
const maxCharsLimit = Math.max(1_000, Math.floor(options.maxCharsLimit ?? 50_000));
|
|
20
|
+
this.opts = {
|
|
21
|
+
maxUrls: Math.max(1, Math.floor(options.maxUrls ?? 5)),
|
|
22
|
+
timeoutMs: options.timeoutMs ?? 15_000,
|
|
23
|
+
maxBytes: options.maxBytes ?? 2_000_000,
|
|
24
|
+
defaultMaxChars: Math.min(maxCharsLimit, options.defaultMaxChars ?? 20_000),
|
|
25
|
+
maxCharsLimit,
|
|
26
|
+
maxRedirects: options.maxRedirects ?? 5,
|
|
27
|
+
userAgent: options.userAgent ?? "AECAgent/1.0 (+web_extract)",
|
|
28
|
+
allowPrivateNetwork: options.allowPrivateNetwork ?? false,
|
|
29
|
+
fetch: options.fetch ?? fetch,
|
|
30
|
+
lookup: options.lookup,
|
|
31
|
+
};
|
|
32
|
+
this.definition = {
|
|
33
|
+
name: "web_extract",
|
|
34
|
+
description: "Fetch one or more public web pages (http/https) and return their readable text content. " +
|
|
35
|
+
"Use after web_search to read the most relevant results, or for a url the user gave you. " +
|
|
36
|
+
"Supports HTML, plain text, JSON and XML; not PDFs or binaries. Long pages are truncated.",
|
|
37
|
+
parameters: {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {
|
|
40
|
+
urls: {
|
|
41
|
+
type: "array",
|
|
42
|
+
items: { type: "string" },
|
|
43
|
+
description: `Absolute http(s) urls to read (1-${this.opts.maxUrls})`,
|
|
44
|
+
},
|
|
45
|
+
max_chars: {
|
|
46
|
+
type: "number",
|
|
47
|
+
description: `Max characters of text returned per page (default ${this.opts.defaultMaxChars}, max ${this.opts.maxCharsLimit})`,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: ["urls"],
|
|
51
|
+
},
|
|
52
|
+
risk: "read-only",
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async execute(args, _context) {
|
|
56
|
+
const rawUrls = args["urls"];
|
|
57
|
+
const urls = Array.isArray(rawUrls)
|
|
58
|
+
? [...new Set(rawUrls.filter((u) => typeof u === "string").map((u) => u.trim()).filter(Boolean))]
|
|
59
|
+
: [];
|
|
60
|
+
if (urls.length === 0) {
|
|
61
|
+
return { content: 'web_extract: "urls" must be a non-empty array of url strings', isError: true, retryable: false };
|
|
62
|
+
}
|
|
63
|
+
if (urls.length > this.opts.maxUrls) {
|
|
64
|
+
return {
|
|
65
|
+
content: `web_extract: at most ${this.opts.maxUrls} urls per call (got ${urls.length})`,
|
|
66
|
+
isError: true,
|
|
67
|
+
retryable: false,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const requested = typeof args["max_chars"] === "number" && Number.isFinite(args["max_chars"])
|
|
71
|
+
? Math.floor(args["max_chars"])
|
|
72
|
+
: this.opts.defaultMaxChars;
|
|
73
|
+
const maxChars = Math.min(this.opts.maxCharsLimit, Math.max(100, requested));
|
|
74
|
+
const pages = await Promise.all(urls.map((url) => this.extractOne(url, maxChars)));
|
|
75
|
+
const sections = pages.map((p) => {
|
|
76
|
+
if (!p.ok)
|
|
77
|
+
return `## ${p.url}\nError: ${p.error}`;
|
|
78
|
+
const header = [`## ${p.finalUrl ?? p.url}`];
|
|
79
|
+
if (p.finalUrl && p.finalUrl !== p.url)
|
|
80
|
+
header.push(`(redirected from ${p.url})`);
|
|
81
|
+
if (p.title)
|
|
82
|
+
header.push(`Title: ${p.title}`);
|
|
83
|
+
return `${header.join("\n")}\n\n${p.text || "(no readable text)"}`;
|
|
84
|
+
});
|
|
85
|
+
const failed = pages.filter((p) => !p.ok);
|
|
86
|
+
const allFailed = failed.length === pages.length;
|
|
87
|
+
return {
|
|
88
|
+
content: sections.join("\n\n---\n\n"),
|
|
89
|
+
isError: allFailed || undefined,
|
|
90
|
+
// Blocked URLs fail the same way every time — retrying cannot help.
|
|
91
|
+
retryable: allFailed && failed.every((p) => p.blocked) ? false : undefined,
|
|
92
|
+
metadata: {
|
|
93
|
+
pages: pages.map(({ url, ok, finalUrl, title, truncated, error }) => ({
|
|
94
|
+
url, ok, finalUrl, title, truncated, error,
|
|
95
|
+
})),
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async extractOne(rawUrl, maxChars) {
|
|
100
|
+
const signal = AbortSignal.timeout(this.opts.timeoutMs);
|
|
101
|
+
try {
|
|
102
|
+
let current = rawUrl;
|
|
103
|
+
let response;
|
|
104
|
+
for (let hop = 0; hop <= this.opts.maxRedirects; hop++) {
|
|
105
|
+
const url = await assertPublicHttpUrl(current, {
|
|
106
|
+
lookup: this.opts.lookup,
|
|
107
|
+
allowPrivateNetwork: this.opts.allowPrivateNetwork,
|
|
108
|
+
});
|
|
109
|
+
response = await this.opts.fetch(url, {
|
|
110
|
+
redirect: "manual",
|
|
111
|
+
signal,
|
|
112
|
+
headers: {
|
|
113
|
+
"User-Agent": this.opts.userAgent,
|
|
114
|
+
Accept: "text/html,application/xhtml+xml,text/plain,application/json;q=0.9,*/*;q=0.5",
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
const location = response.headers.get("location");
|
|
118
|
+
if (response.status >= 300 && response.status < 400 && location) {
|
|
119
|
+
await response.body?.cancel().catch(() => { });
|
|
120
|
+
current = new URL(location, url).toString();
|
|
121
|
+
response = undefined;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
current = url.toString();
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (!response) {
|
|
128
|
+
return { url: rawUrl, ok: false, error: `too many redirects (max ${this.opts.maxRedirects})` };
|
|
129
|
+
}
|
|
130
|
+
if (!response.ok) {
|
|
131
|
+
await response.body?.cancel().catch(() => { });
|
|
132
|
+
return { url: rawUrl, ok: false, finalUrl: current, error: `HTTP ${response.status}` };
|
|
133
|
+
}
|
|
134
|
+
const contentType = (response.headers.get("content-type") ?? "").toLowerCase();
|
|
135
|
+
const mime = contentType.split(";")[0].trim();
|
|
136
|
+
if (mime && !TEXT_CONTENT_TYPES.includes(mime) && !mime.startsWith("text/")) {
|
|
137
|
+
await response.body?.cancel().catch(() => { });
|
|
138
|
+
return { url: rawUrl, ok: false, finalUrl: current, error: `unsupported content type "${mime}"` };
|
|
139
|
+
}
|
|
140
|
+
const body = await readCapped(response, this.opts.maxBytes, charsetOf(contentType));
|
|
141
|
+
const isHtml = mime === "text/html" || mime === "application/xhtml+xml" || (!mime && /<html[\s>]/i.test(body.slice(0, 2_000)));
|
|
142
|
+
const text = isHtml ? htmlToText(mainContent(body)) : body.trim();
|
|
143
|
+
const cut = truncate(text, maxChars);
|
|
144
|
+
return {
|
|
145
|
+
url: rawUrl,
|
|
146
|
+
ok: true,
|
|
147
|
+
finalUrl: current,
|
|
148
|
+
title: isHtml ? extractTitle(body) : undefined,
|
|
149
|
+
text: cut.text,
|
|
150
|
+
truncated: cut.truncated,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error instanceof BlockedUrlError) {
|
|
155
|
+
return { url: rawUrl, ok: false, blocked: true, error: `blocked: ${error.message}` };
|
|
156
|
+
}
|
|
157
|
+
const message = error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError")
|
|
158
|
+
? `timed out after ${this.opts.timeoutMs} ms`
|
|
159
|
+
: error instanceof Error
|
|
160
|
+
? error.message
|
|
161
|
+
: String(error);
|
|
162
|
+
return { url: rawUrl, ok: false, error: message };
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function charsetOf(contentType) {
|
|
167
|
+
const charset = /charset=["']?([\w-]+)/i.exec(contentType)?.[1]?.toLowerCase();
|
|
168
|
+
if (!charset)
|
|
169
|
+
return "utf-8";
|
|
170
|
+
try {
|
|
171
|
+
new TextDecoder(charset);
|
|
172
|
+
return charset;
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return "utf-8";
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/** Read at most `maxBytes` of the body, then stop the download. */
|
|
179
|
+
async function readCapped(response, maxBytes, charset) {
|
|
180
|
+
const decoder = new TextDecoder(charset);
|
|
181
|
+
if (!response.body)
|
|
182
|
+
return "";
|
|
183
|
+
const reader = response.body.getReader();
|
|
184
|
+
let received = 0;
|
|
185
|
+
let out = "";
|
|
186
|
+
try {
|
|
187
|
+
while (true) {
|
|
188
|
+
const { done, value } = await reader.read();
|
|
189
|
+
if (done)
|
|
190
|
+
break;
|
|
191
|
+
const remaining = maxBytes - received;
|
|
192
|
+
const chunk = value.byteLength > remaining ? value.subarray(0, remaining) : value;
|
|
193
|
+
received += chunk.byteLength;
|
|
194
|
+
out += decoder.decode(chunk, { stream: true });
|
|
195
|
+
if (received >= maxBytes) {
|
|
196
|
+
await reader.cancel().catch(() => { });
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
reader.releaseLock();
|
|
203
|
+
}
|
|
204
|
+
return out + decoder.decode();
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=web-extract-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-extract-tool.js","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/web/web-extract-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAiB,MAAM,oBAAoB,CAAC;AAuBzF,MAAM,kBAAkB,GAAG;IACzB,WAAW,EAAE,uBAAuB,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU;IAC/E,kBAAkB,EAAE,qBAAqB,EAAE,UAAU,EAAE,iBAAiB,EAAE,qBAAqB;IAC/F,sBAAsB;CACvB,CAAC;AAaF;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAChB,IAAI,GAAG,kBAAkB,CAAC;IAC1B,OAAO,GAAG,OAAO,CAAC;IAClB,UAAU,CAAiB;IAE5B,IAAI,CAGV;IAEF,YAAY,OAAO,GAA0B,EAAE;QAC7C,MAAM,aAAa,GAAG,IAAI,CAA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QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,CAAC;QACH,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,IAAI;gBAAE,MAAM;YAChB,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;YACtC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAClF,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC;YAC7B,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/C,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;gBACzB,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;gBACtC,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ToolContext, ToolDefinition, ToolHandler, ToolOutput } from "../../types.js";
|
|
2
|
+
import type { WebSearchProvider } from "./types.js";
|
|
3
|
+
export interface WebSearchToolOptions {
|
|
4
|
+
/** Search backend. Defaults to DuckDuckGo (free, no API key). */
|
|
5
|
+
provider?: WebSearchProvider;
|
|
6
|
+
/** Result count when the model does not ask for one. Default 5. */
|
|
7
|
+
defaultMaxResults?: number;
|
|
8
|
+
/** Hard ceiling on results per call. Default 10. */
|
|
9
|
+
maxResultsLimit?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* web_search — read-only. Returns a shortlist (title, url, snippet) for fresh external
|
|
13
|
+
* facts and documentation; the agent then opens only the relevant links with web_extract.
|
|
14
|
+
*/
|
|
15
|
+
export declare class WebSearchTool implements ToolHandler {
|
|
16
|
+
readonly name = "tool:web-search";
|
|
17
|
+
readonly version = "1.0.0";
|
|
18
|
+
readonly definition: ToolDefinition;
|
|
19
|
+
private provider;
|
|
20
|
+
private defaultMaxResults;
|
|
21
|
+
private maxResultsLimit;
|
|
22
|
+
constructor(options?: WebSearchToolOptions);
|
|
23
|
+
execute(args: Record<string, unknown>, _context: ToolContext): Promise<ToolOutput>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=web-search-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-search-tool.d.ts","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/web/web-search-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID;;;GAGG;AACH,qBAAa,aAAc,YAAW,WAAW;IAC/C,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IAEpC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,eAAe,CAAS;IAEhC,YAAY,OAAO,GAAE,oBAAyB,EA8B7C;IAEK,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA4CvF;CACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DuckDuckGoSearchProvider } from "./duckduckgo-search-provider.js";
|
|
2
|
+
const MAX_QUERY_CHARS = 500;
|
|
3
|
+
/**
|
|
4
|
+
* web_search — read-only. Returns a shortlist (title, url, snippet) for fresh external
|
|
5
|
+
* facts and documentation; the agent then opens only the relevant links with web_extract.
|
|
6
|
+
*/
|
|
7
|
+
export class WebSearchTool {
|
|
8
|
+
name = "tool:web-search";
|
|
9
|
+
version = "1.0.0";
|
|
10
|
+
definition;
|
|
11
|
+
provider;
|
|
12
|
+
defaultMaxResults;
|
|
13
|
+
maxResultsLimit;
|
|
14
|
+
constructor(options = {}) {
|
|
15
|
+
this.provider = options.provider ?? new DuckDuckGoSearchProvider();
|
|
16
|
+
this.maxResultsLimit = Math.max(1, Math.floor(options.maxResultsLimit ?? 10));
|
|
17
|
+
this.defaultMaxResults = Math.min(this.maxResultsLimit, Math.max(1, Math.floor(options.defaultMaxResults ?? 5)));
|
|
18
|
+
this.definition = {
|
|
19
|
+
name: "web_search",
|
|
20
|
+
description: "Search the public web for current information, news, standards or documentation. " +
|
|
21
|
+
"Returns a short list of results (title, url, snippet) — not full pages. " +
|
|
22
|
+
"Use web_extract on the most relevant urls to read them. Cite the urls you rely on.",
|
|
23
|
+
parameters: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
query: { type: "string", description: "Search query, as you would type it into a search engine" },
|
|
27
|
+
max_results: {
|
|
28
|
+
type: "number",
|
|
29
|
+
description: `Number of results to return (1-${this.maxResultsLimit}, default ${this.defaultMaxResults})`,
|
|
30
|
+
},
|
|
31
|
+
region: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: 'Optional region code to localise results, e.g. "us-en", "uk-en", "vn-vi"',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: ["query"],
|
|
37
|
+
},
|
|
38
|
+
risk: "read-only",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async execute(args, _context) {
|
|
42
|
+
const query = typeof args["query"] === "string" ? args["query"].trim() : "";
|
|
43
|
+
if (!query) {
|
|
44
|
+
return { content: "web_search: \"query\" must be a non-empty string", isError: true, retryable: false };
|
|
45
|
+
}
|
|
46
|
+
if (query.length > MAX_QUERY_CHARS) {
|
|
47
|
+
return {
|
|
48
|
+
content: `web_search: query is too long (max ${MAX_QUERY_CHARS} characters)`,
|
|
49
|
+
isError: true,
|
|
50
|
+
retryable: false,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const requested = typeof args["max_results"] === "number" && Number.isFinite(args["max_results"])
|
|
54
|
+
? Math.floor(args["max_results"])
|
|
55
|
+
: this.defaultMaxResults;
|
|
56
|
+
const maxResults = Math.min(this.maxResultsLimit, Math.max(1, requested));
|
|
57
|
+
const region = typeof args["region"] === "string" && args["region"].trim() ? args["region"].trim() : undefined;
|
|
58
|
+
let results;
|
|
59
|
+
try {
|
|
60
|
+
results = await this.provider.search({ query, maxResults, region });
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
return {
|
|
64
|
+
content: `web_search failed (${this.provider.name}): ${error instanceof Error ? error.message : String(error)}`,
|
|
65
|
+
isError: true,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
results = results.slice(0, maxResults);
|
|
69
|
+
if (results.length === 0) {
|
|
70
|
+
return {
|
|
71
|
+
content: `No results for "${query}". Try a broader or differently worded query.`,
|
|
72
|
+
metadata: { provider: this.provider.name, query, resultCount: 0 },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const lines = results.map((r, i) => `${i + 1}. ${r.title}\n ${r.url}${r.snippet ? `\n ${r.snippet}` : ""}`);
|
|
76
|
+
return {
|
|
77
|
+
content: `Search results for "${query}" (${this.provider.name}):\n\n${lines.join("\n\n")}`,
|
|
78
|
+
metadata: { provider: this.provider.name, query, resultCount: results.length, results },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=web-search-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-search-tool.js","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/web/web-search-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAY3E,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;GAGG;AACH,MAAM,OAAO,aAAa;IACf,IAAI,GAAG,iBAAiB,CAAC;IACzB,OAAO,GAAG,OAAO,CAAC;IAClB,UAAU,CAAiB;IAE5B,QAAQ,CAAoB;IAC5B,iBAAiB,CAAS;IAC1B,eAAe,CAAS;IAEhC,YAAY,OAAO,GAAyB,EAAE;QAC5C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,wBAAwB,EAAE,CAAC;QACnE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAC/B,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,IAAI,CAAC,CAAC,CAAC,CACxD,CAAC;QACF,IAAI,CAAC,UAAU,GAAG;YAChB,IAAI,EAAE,YAAY;YAClB,WAAW,EACT,mFAAmF;gBACnF,0EAA0E;gBAC1E,oFAAoF;YACtF,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAA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CAAC,CAAC,CAAC,EAAE,EAAE,CACrF,CAAC;QACF,OAAO;YACL,OAAO,EAAE,uBAAuB,KAAK,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,SAAS,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC1F,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE;SACxF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolHandler } from "../../types.js";
|
|
2
|
+
import type { WorkspaceToolOptions } from "./types.js";
|
|
3
|
+
/** Tool names of the workspace tools, for agent allowlists. */
|
|
4
|
+
export declare const WORKSPACE_TOOL_NAMES: readonly ["read_file", "write_file", "edit_file", "list_files", "search_files", "terminal", "run_code"];
|
|
5
|
+
/** All workspace tools with the same options — register them with `core.useTool()`. */
|
|
6
|
+
export declare function createWorkspaceTools(options?: WorkspaceToolOptions): ToolHandler[];
|
|
7
|
+
//# sourceMappingURL=create-workspace-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-workspace-tools.d.ts","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/workspace/create-workspace-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,YAC/B,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,CACpF,CAAC;AAEX,uFAAuF;AACvF,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,oBAAyB,GAAG,WAAW,EAAE,CAUtF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EditFileTool } from "./edit-file-tool.js";
|
|
2
|
+
import { ListFilesTool } from "./list-files-tool.js";
|
|
3
|
+
import { ReadFileTool } from "./read-file-tool.js";
|
|
4
|
+
import { RunCodeTool } from "./run-code-tool.js";
|
|
5
|
+
import { SearchFilesTool } from "./search-files-tool.js";
|
|
6
|
+
import { TerminalTool } from "./terminal-tool.js";
|
|
7
|
+
import { WriteFileTool } from "./write-file-tool.js";
|
|
8
|
+
/** Tool names of the workspace tools, for agent allowlists. */
|
|
9
|
+
export const WORKSPACE_TOOL_NAMES = [
|
|
10
|
+
"read_file", "write_file", "edit_file", "list_files", "search_files", "terminal", "run_code",
|
|
11
|
+
];
|
|
12
|
+
/** All workspace tools with the same options — register them with `core.useTool()`. */
|
|
13
|
+
export function createWorkspaceTools(options = {}) {
|
|
14
|
+
return [
|
|
15
|
+
new ReadFileTool(options),
|
|
16
|
+
new WriteFileTool(options),
|
|
17
|
+
new EditFileTool(options),
|
|
18
|
+
new ListFilesTool(options),
|
|
19
|
+
new SearchFilesTool(options),
|
|
20
|
+
new TerminalTool(options),
|
|
21
|
+
new RunCodeTool(options),
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=create-workspace-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-workspace-tools.js","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/workspace/create-workspace-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU;CACpF,CAAC;AAEX,uFAAuF;AACvF,MAAM,UAAU,oBAAoB,CAAC,OAAO,GAAyB,EAAE;IACrE,OAAO;QACL,IAAI,YAAY,CAAC,OAAO,CAAC;QACzB,IAAI,aAAa,CAAC,OAAO,CAAC;QAC1B,IAAI,YAAY,CAAC,OAAO,CAAC;QACzB,IAAI,aAAa,CAAC,OAAO,CAAC;QAC1B,IAAI,eAAe,CAAC,OAAO,CAAC;QAC5B,IAAI,YAAY,CAAC,OAAO,CAAC;QACzB,IAAI,WAAW,CAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToolContext, ToolDefinition, ToolHandler, ToolOutput } from "../../types.js";
|
|
2
|
+
import type { WorkspaceToolOptions } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* edit_file — exact-text patch. Replaces `old_text` with `new_text`; refuses ambiguous
|
|
5
|
+
* matches unless replace_all. The write is conditional on the file being unchanged since
|
|
6
|
+
* it was read (sha256), then verified by read-back.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EditFileTool implements ToolHandler {
|
|
9
|
+
readonly name = "tool:edit-file";
|
|
10
|
+
readonly version = "1.0.0";
|
|
11
|
+
readonly definition: ToolDefinition;
|
|
12
|
+
constructor(_options?: WorkspaceToolOptions);
|
|
13
|
+
execute(args: Record<string, unknown>, context: ToolContext): Promise<ToolOutput>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=edit-file-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-file-tool.d.ts","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/workspace/edit-file-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAOvD;;;;GAIG;AACH,qBAAa,YAAa,YAAW,WAAW;IAC9C,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IAEpC,YAAY,QAAQ,GAAE,oBAAyB,EAoB9C;IAEK,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAmDtF;CACF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { argError, boolArg, formatBytes, stringArg, withSandbox } from "./workspace-helpers.js";
|
|
2
|
+
import { verifyWrite } from "./write-file-tool.js";
|
|
3
|
+
const CONTEXT_LINES = 3;
|
|
4
|
+
const MAX_SNIPPET_LINES = 20;
|
|
5
|
+
/**
|
|
6
|
+
* edit_file — exact-text patch. Replaces `old_text` with `new_text`; refuses ambiguous
|
|
7
|
+
* matches unless replace_all. The write is conditional on the file being unchanged since
|
|
8
|
+
* it was read (sha256), then verified by read-back.
|
|
9
|
+
*/
|
|
10
|
+
export class EditFileTool {
|
|
11
|
+
name = "tool:edit-file";
|
|
12
|
+
version = "1.0.0";
|
|
13
|
+
definition;
|
|
14
|
+
constructor(_options = {}) {
|
|
15
|
+
this.definition = {
|
|
16
|
+
name: "edit_file",
|
|
17
|
+
description: "Change part of a file in your workspace by replacing an exact piece of text. old_text must match the file " +
|
|
18
|
+
"exactly (including whitespace, without read_file's line-number prefix) and be unique — include enough " +
|
|
19
|
+
"surrounding lines, or set replace_all to change every occurrence. The edit is verified by reading the file back.",
|
|
20
|
+
parameters: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
path: { type: "string", description: "File to edit" },
|
|
24
|
+
old_text: { type: "string", description: "Exact text currently in the file" },
|
|
25
|
+
new_text: { type: "string", description: "Text to put in its place (may be empty to delete)" },
|
|
26
|
+
replace_all: { type: "boolean", description: "Replace every occurrence instead of requiring a unique match (default false)" },
|
|
27
|
+
},
|
|
28
|
+
required: ["path", "old_text", "new_text"],
|
|
29
|
+
},
|
|
30
|
+
risk: "draft",
|
|
31
|
+
sandboxOperation: "fs.write",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async execute(args, context) {
|
|
35
|
+
const path = stringArg(args, "path")?.trim();
|
|
36
|
+
const oldText = stringArg(args, "old_text");
|
|
37
|
+
const newText = stringArg(args, "new_text");
|
|
38
|
+
const replaceAll = boolArg(args, "replace_all") === true;
|
|
39
|
+
if (!path)
|
|
40
|
+
return argError("edit_file", '"path" must be a non-empty string');
|
|
41
|
+
if (!oldText)
|
|
42
|
+
return argError("edit_file", '"old_text" must be a non-empty string (use write_file to create a file)');
|
|
43
|
+
if (newText === undefined)
|
|
44
|
+
return argError("edit_file", '"new_text" must be a string');
|
|
45
|
+
if (oldText === newText)
|
|
46
|
+
return argError("edit_file", "old_text and new_text are identical — nothing to change");
|
|
47
|
+
return withSandbox("edit_file", context, async (env) => {
|
|
48
|
+
const current = await env.readFile(path);
|
|
49
|
+
if (current.truncated) {
|
|
50
|
+
return argError("edit_file", `${current.path} is too large to edit safely (${formatBytes(current.size)}, limit ${formatBytes(env.limits.maxReadBytes)})`);
|
|
51
|
+
}
|
|
52
|
+
const text = current.content;
|
|
53
|
+
const positions = occurrences(text, oldText);
|
|
54
|
+
if (positions.length === 0) {
|
|
55
|
+
return argError("edit_file", `old_text was not found in ${current.path}. Read the file again and copy the text exactly ` +
|
|
56
|
+
"(whitespace and indentation matter; leave out read_file's line-number prefix).");
|
|
57
|
+
}
|
|
58
|
+
if (positions.length > 1 && !replaceAll) {
|
|
59
|
+
const lines = positions.map((p) => lineAt(text, p)).join(", ");
|
|
60
|
+
return argError("edit_file", `old_text matches ${positions.length} places in ${current.path} (lines ${lines}). ` +
|
|
61
|
+
"Include more surrounding text to make it unique, or set replace_all to change all of them.");
|
|
62
|
+
}
|
|
63
|
+
const updated = replaceAll ? text.split(oldText).join(newText) : text.replace(oldText, () => newText);
|
|
64
|
+
// Conditional write: fails with "conflict" if the file changed after we read it.
|
|
65
|
+
const written = await env.writeFile(current.path, updated, { expectedSha256: current.sha256 });
|
|
66
|
+
const failure = await verifyWrite(env, written);
|
|
67
|
+
if (failure)
|
|
68
|
+
return failure;
|
|
69
|
+
const firstLine = lineAt(text, positions[0]);
|
|
70
|
+
return {
|
|
71
|
+
content: `Edited ${written.path}: replaced ${positions.length} occurrence${positions.length === 1 ? "" : "s"} ` +
|
|
72
|
+
`(line${positions.length === 1 ? "" : "s"} ${positions.map((p) => lineAt(text, p)).join(", ")}) — verified by read-back.\n` +
|
|
73
|
+
snippet(updated, firstLine, newText),
|
|
74
|
+
metadata: { path: written.path, replacements: positions.length, sha256: written.sha256, verified: true },
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function occurrences(text, needle) {
|
|
80
|
+
const found = [];
|
|
81
|
+
for (let i = text.indexOf(needle); i !== -1; i = text.indexOf(needle, i + needle.length))
|
|
82
|
+
found.push(i);
|
|
83
|
+
return found;
|
|
84
|
+
}
|
|
85
|
+
function lineAt(text, index) {
|
|
86
|
+
let line = 1;
|
|
87
|
+
for (let i = 0; i < index; i++)
|
|
88
|
+
if (text.charCodeAt(i) === 10)
|
|
89
|
+
line++;
|
|
90
|
+
return line;
|
|
91
|
+
}
|
|
92
|
+
/** The edited region with a little context, numbered like read_file. */
|
|
93
|
+
function snippet(text, firstLine, newText) {
|
|
94
|
+
const lines = text.split("\n");
|
|
95
|
+
const start = Math.max(1, firstLine - CONTEXT_LINES);
|
|
96
|
+
const end = Math.min(lines.length, firstLine + newText.split("\n").length - 1 + CONTEXT_LINES, start + MAX_SNIPPET_LINES - 1);
|
|
97
|
+
const width = String(end).length;
|
|
98
|
+
return lines
|
|
99
|
+
.slice(start - 1, end)
|
|
100
|
+
.map((line, i) => `${String(start + i).padStart(width)}\t${line}`)
|
|
101
|
+
.join("\n");
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=edit-file-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-file-tool.js","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/workspace/edit-file-tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACd,IAAI,GAAG,gBAAgB,CAAC;IACxB,OAAO,GAAG,OAAO,CAAC;IAClB,UAAU,CAAiB;IAEpC,YAAY,QAAQ,GAAyB,EAAE;QAC7C,IAAI,CAAC,UAAU,GAAG;YAChB,IAAI,EAAE,WAAW;YACjB,WAAW,EACT,4GAA4G;gBAC5G,wGAAwG;gBACxG,kHAAkH;YACpH,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;oBACrD,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE;oBAC7E,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mDAAmD,EAAE;oBAC9F,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,8EAA8E,EAAE;i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CAAC;IACtE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wEAAwE;AACxE,SAAS,OAAO,CAAC,IAAY,EAAE,SAAiB,EAAE,OAAe;IAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,aAAa,EAAE,KAAK,GAAG,iBAAiB,GAAG,CAAC,CAAC,CAAC;IAC9H,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,OAAO,KAAK;SACT,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC;SACrB,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;SACjE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolContext, ToolDefinition, ToolHandler, ToolOutput } from "../../types.js";
|
|
2
|
+
import type { WorkspaceToolOptions } from "./types.js";
|
|
3
|
+
/** list_files — read-only directory listing (optionally recursive), bounded. */
|
|
4
|
+
export declare class ListFilesTool implements ToolHandler {
|
|
5
|
+
readonly name = "tool:list-files";
|
|
6
|
+
readonly version = "1.0.0";
|
|
7
|
+
readonly definition: ToolDefinition;
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options?: WorkspaceToolOptions);
|
|
10
|
+
execute(args: Record<string, unknown>, context: ToolContext): Promise<ToolOutput>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=list-files-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-files-tool.d.ts","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/workspace/list-files-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAgC,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGrF,gFAAgF;AAChF,qBAAa,aAAc,YAAW,WAAW;IAC/C,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,OAAO,CAAC,OAAO,CAA+B;IAE9C,YAAY,OAAO,GAAE,oBAAyB,EAmB7C;IAEK,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAsBtF;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { resolveLogicalPath } from "../../../sandbox-hub/logical-path.js";
|
|
2
|
+
import { boolArg, formatBytes, numberArg, resolveOptions, stringArg, withSandbox } from "./workspace-helpers.js";
|
|
3
|
+
/** list_files — read-only directory listing (optionally recursive), bounded. */
|
|
4
|
+
export class ListFilesTool {
|
|
5
|
+
name = "tool:list-files";
|
|
6
|
+
version = "1.0.0";
|
|
7
|
+
definition;
|
|
8
|
+
options;
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
this.options = resolveOptions(options);
|
|
11
|
+
this.definition = {
|
|
12
|
+
name: "list_files",
|
|
13
|
+
description: "List the files and folders in a folder of your workspace (default: your working directory). " +
|
|
14
|
+
'Use recursive to see a whole tree. "/workspace/shared" holds files shared with other agents.',
|
|
15
|
+
parameters: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
path: { type: "string", description: "Folder to list (default: your working directory)" },
|
|
19
|
+
recursive: { type: "boolean", description: "Include sub-folders (default false)" },
|
|
20
|
+
include_hidden: { type: "boolean", description: "Include dot-files (default false)" },
|
|
21
|
+
max_entries: { type: "number", description: `Most entries to return (default and max ${this.options.maxListEntries})` },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
risk: "read-only",
|
|
25
|
+
sandboxOperation: "fs.read",
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async execute(args, context) {
|
|
29
|
+
const path = stringArg(args, "path")?.trim() || ".";
|
|
30
|
+
const recursive = boolArg(args, "recursive") === true;
|
|
31
|
+
const requested = numberArg(args, "max_entries");
|
|
32
|
+
const maxEntries = Math.min(this.options.maxListEntries, requested && requested > 0 ? Math.floor(requested) : this.options.maxListEntries);
|
|
33
|
+
return withSandbox("list_files", context, async (env) => {
|
|
34
|
+
const result = await env.list(path, { recursive, includeHidden: boolArg(args, "include_hidden") === true, maxEntries });
|
|
35
|
+
const base = resolveLogicalPath(path, env.workingDir, env.roots, env.id);
|
|
36
|
+
const lines = result.entries.map((entry) => {
|
|
37
|
+
const shown = entry.path.startsWith(`${base}/`) ? entry.path.slice(base.length + 1) : entry.path;
|
|
38
|
+
if (entry.type === "directory")
|
|
39
|
+
return `${shown}/`;
|
|
40
|
+
if (entry.type === "file")
|
|
41
|
+
return `${shown} (${formatBytes(entry.size)})`;
|
|
42
|
+
return `${shown} [${entry.type}]`;
|
|
43
|
+
});
|
|
44
|
+
const header = `${base}${recursive ? " (recursive)" : ""} — ${result.entries.length} entr${result.entries.length === 1 ? "y" : "ies"}`;
|
|
45
|
+
const footer = result.truncated ? `\n[truncated at ${maxEntries} entries — list a sub-folder or turn off recursive]` : "";
|
|
46
|
+
return {
|
|
47
|
+
content: `${header}\n${lines.join("\n") || "(empty folder)"}${footer}`,
|
|
48
|
+
metadata: { path: base, count: result.entries.length, truncated: result.truncated },
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=list-files-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-files-tool.js","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/workspace/list-files-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEjH,gFAAgF;AAChF,MAAM,OAAO,aAAa;IACf,IAAI,GAAG,iBAAiB,CAAC;IACzB,OAAO,GAAG,OAAO,CAAC;IAClB,UAAU,CAAiB;IAC5B,OAAO,CAA+B;IAE9C,YAAY,OAAO,GAAyB,EAAE;QAC5C,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG;YAChB,IAAI,EAAE,YAAY;YAClB,WAAW,EACT,8FAA8F;gBAC9F,8FAA8F;YAChG,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kDAAkD,EAAE;oBACzF,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,qCAAqC,EAAE;oBAClF,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,mCAAmC,EAAE;oBACrF,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,EAAE;iBACxH;aACF;YACD,IAAI,EAAE,WAAW;YACjB,gBAAgB,EAAE,SAAS;SAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CA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AAW;oBAAE,OAAO,GAAG,KAAK,GAAG,CAAC;gBACnD,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;oBAAE,OAAO,GAAG,KAAK,MAAM,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;gBAC3E,OAAO,GAAG,KAAK,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC;YACrC,CAAC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,QAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YACvI,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,UAAU,qDAAqD,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1H,OAAO;gBACL,OAAO,EAAE,GAAG,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,gBAAgB,GAAG,MAAM,EAAE;gBACtE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE;aACpF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToolContext, ToolDefinition, ToolHandler, ToolOutput } from "../../types.js";
|
|
2
|
+
import type { WorkspaceToolOptions } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* read_file — read-only. Returns a text file from the agent's workspace with line numbers,
|
|
5
|
+
* bounded to maxReadBytes; large files are read in line ranges.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ReadFileTool implements ToolHandler {
|
|
8
|
+
readonly name = "tool:read-file";
|
|
9
|
+
readonly version = "1.0.0";
|
|
10
|
+
readonly definition: ToolDefinition;
|
|
11
|
+
private options;
|
|
12
|
+
constructor(options?: WorkspaceToolOptions);
|
|
13
|
+
execute(args: Record<string, unknown>, context: ToolContext): Promise<ToolOutput>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=read-file-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file-tool.d.ts","sourceRoot":"","sources":["../../../../../src/components/tool-hub/built-in-tools/workspace/read-file-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAgC,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGrF;;;GAGG;AACH,qBAAa,YAAa,YAAW,WAAW;IAC9C,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,OAAO,CAAC,OAAO,CAA+B;IAE9C,YAAY,OAAO,GAAE,oBAAyB,EAoB7C;IAEK,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAwCtF;CACF"}
|