@evalops/maestro 0.10.17 → 0.10.20
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 +56 -1
- package/dist/agent/action-approval.d.ts +12 -2
- package/dist/agent/action-approval.d.ts.map +1 -1
- package/dist/agent/action-approval.js +19 -32
- package/dist/agent/action-approval.js.map +1 -1
- package/dist/agent/agent.d.ts +1 -0
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +26 -0
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/compaction.d.ts +2 -0
- package/dist/agent/compaction.d.ts.map +1 -1
- package/dist/agent/compaction.js +4 -2
- package/dist/agent/compaction.js.map +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/modes.d.ts +56 -4
- package/dist/agent/modes.d.ts.map +1 -1
- package/dist/agent/modes.js +163 -2
- package/dist/agent/modes.js.map +1 -1
- package/dist/agent/prompt-recovery.d.ts.map +1 -1
- package/dist/agent/prompt-recovery.js +1 -3
- package/dist/agent/prompt-recovery.js.map +1 -1
- package/dist/agent/providers/anthropic.d.ts.map +1 -1
- package/dist/agent/providers/anthropic.js +9 -1
- package/dist/agent/providers/anthropic.js.map +1 -1
- package/dist/agent/providers/codex-app-server.d.ts +12 -0
- package/dist/agent/providers/codex-app-server.d.ts.map +1 -0
- package/dist/agent/providers/codex-app-server.js +788 -0
- package/dist/agent/providers/codex-app-server.js.map +1 -0
- package/dist/agent/providers/google-gemini-cli.js +14 -3
- package/dist/agent/providers/google.js +22 -3
- package/dist/agent/providers/scripted.d.ts +11 -0
- package/dist/agent/providers/scripted.d.ts.map +1 -0
- package/dist/agent/providers/scripted.js +399 -0
- package/dist/agent/providers/scripted.js.map +1 -0
- package/dist/agent/providers/vertex.js +14 -3
- package/dist/agent/scenario-source.d.ts +19 -0
- package/dist/agent/scenario-source.d.ts.map +1 -0
- package/dist/agent/scenario-source.js +112 -0
- package/dist/agent/scenario-source.js.map +1 -0
- package/dist/agent/subagent-specs.d.ts +1 -1
- package/dist/agent/subagent-specs.js +1 -1
- package/dist/agent/subagent-specs.js.map +1 -1
- package/dist/agent/swarm/executor.d.ts +25 -0
- package/dist/agent/swarm/executor.d.ts.map +1 -1
- package/dist/agent/swarm/executor.js +795 -20
- package/dist/agent/swarm/executor.js.map +1 -1
- package/dist/agent/swarm/runtime-events.d.ts +11 -0
- package/dist/agent/swarm/runtime-events.d.ts.map +1 -0
- package/dist/agent/swarm/runtime-events.js +26 -0
- package/dist/agent/swarm/runtime-events.js.map +1 -0
- package/dist/agent/swarm/types.d.ts +78 -0
- package/dist/agent/swarm/types.d.ts.map +1 -1
- package/dist/agent/swarm/types.js.map +1 -1
- package/dist/agent/tracing.d.ts +1 -1
- package/dist/agent/tracing.d.ts.map +1 -1
- package/dist/agent/tracing.js +17 -9
- package/dist/agent/tracing.js.map +1 -1
- package/dist/agent/transport/create-provider-stream.d.ts.map +1 -1
- package/dist/agent/transport/create-provider-stream.js +14 -0
- package/dist/agent/transport/create-provider-stream.js.map +1 -1
- package/dist/agent/transport/stable-stringify.d.ts +2 -0
- package/dist/agent/transport/stable-stringify.d.ts.map +1 -0
- package/dist/agent/transport/stable-stringify.js +14 -0
- package/dist/agent/transport/stable-stringify.js.map +1 -0
- package/dist/agent/transport/tool-execution-bridge.d.ts.map +1 -1
- package/dist/agent/transport/tool-execution-bridge.js +2 -15
- package/dist/agent/transport/tool-execution-bridge.js.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts +5 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.js +184 -36
- package/dist/agent/transport/tool-safety-pipeline.js.map +1 -1
- package/dist/agent/transport.d.ts +8 -0
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/transport.js +1613 -68
- package/dist/agent/transport.js.map +1 -1
- package/dist/agent/types.d.ts +170 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/api/enterprise-routes.d.ts.map +1 -1
- package/dist/api/enterprise-routes.js +34 -3
- package/dist/api/enterprise-routes.js.map +1 -1
- package/dist/app-server/in-process-client.d.ts +32 -0
- package/dist/app-server/in-process-client.d.ts.map +1 -0
- package/dist/app-server/in-process-client.js +73 -0
- package/dist/app-server/in-process-client.js.map +1 -0
- package/dist/app-server/session-api.d.ts +36 -0
- package/dist/app-server/session-api.d.ts.map +1 -0
- package/dist/app-server/session-api.js +713 -0
- package/dist/app-server/session-api.js.map +1 -0
- package/dist/approvals/platform-action-approval.d.ts +3 -1
- package/dist/approvals/platform-action-approval.d.ts.map +1 -1
- package/dist/approvals/platform-action-approval.js +16 -9
- package/dist/approvals/platform-action-approval.js.map +1 -1
- package/dist/approvals/service-client.d.ts.map +1 -1
- package/dist/approvals/service-client.js +7 -7
- package/dist/approvals/service-client.js.map +1 -1
- package/dist/audit/logger.d.ts +4 -4
- package/dist/bootstrap/agent-creation-setup.d.ts +4 -0
- package/dist/bootstrap/agent-creation-setup.d.ts.map +1 -1
- package/dist/bootstrap/agent-creation-setup.js +3 -1
- package/dist/bootstrap/agent-creation-setup.js.map +1 -1
- package/dist/bootstrap/auth-setup.js +1 -1
- package/dist/bootstrap/auth-setup.js.map +1 -1
- package/dist/bootstrap/event-subscriptions-setup.d.ts +6 -0
- package/dist/bootstrap/event-subscriptions-setup.d.ts.map +1 -1
- package/dist/bootstrap/event-subscriptions-setup.js +26 -2
- package/dist/bootstrap/event-subscriptions-setup.js.map +1 -1
- package/dist/bootstrap/model-resolution-setup.d.ts.map +1 -1
- package/dist/bootstrap/model-resolution-setup.js +4 -1
- package/dist/bootstrap/model-resolution-setup.js.map +1 -1
- package/dist/bootstrap/tools-setup.d.ts +2 -1
- package/dist/bootstrap/tools-setup.d.ts.map +1 -1
- package/dist/bootstrap/tools-setup.js +5 -1
- package/dist/bootstrap/tools-setup.js.map +1 -1
- package/dist/cli/args.d.ts +9 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +130 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/a2a.d.ts +9 -0
- package/dist/cli/commands/a2a.d.ts.map +1 -0
- package/dist/cli/commands/a2a.js +1714 -0
- package/dist/cli/commands/a2a.js.map +1 -0
- package/dist/cli/commands/agents.d.ts +16 -2
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +223 -35
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/codex.d.ts +1 -1
- package/dist/cli/commands/codex.d.ts.map +1 -1
- package/dist/cli/commands/codex.js +145 -39
- package/dist/cli/commands/codex.js.map +1 -1
- package/dist/cli/commands/context.d.ts +10 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +176 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/hosted-runner.d.ts +1 -0
- package/dist/cli/commands/hosted-runner.d.ts.map +1 -1
- package/dist/cli/commands/hosted-runner.js +9 -1
- package/dist/cli/commands/hosted-runner.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +6 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/modes.d.ts +8 -0
- package/dist/cli/commands/modes.d.ts.map +1 -0
- package/dist/cli/commands/modes.js +151 -0
- package/dist/cli/commands/modes.js.map +1 -0
- package/dist/cli/commands/operating-plane.d.ts +14 -0
- package/dist/cli/commands/operating-plane.d.ts.map +1 -0
- package/dist/cli/commands/operating-plane.js +160 -0
- package/dist/cli/commands/operating-plane.js.map +1 -0
- package/dist/cli/commands/run.d.ts +87 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +356 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/scenario.d.ts +7 -0
- package/dist/cli/commands/scenario.d.ts.map +1 -0
- package/dist/cli/commands/scenario.js +195 -0
- package/dist/cli/commands/scenario.js.map +1 -0
- package/dist/cli/commands/skill.d.ts +7 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +286 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/headless-protocol.d.ts +55 -1
- package/dist/cli/headless-protocol.d.ts.map +1 -1
- package/dist/cli/headless-protocol.js +446 -7
- package/dist/cli/headless-protocol.js.map +1 -1
- package/dist/cli/headless-runtime-selection.d.ts +38 -0
- package/dist/cli/headless-runtime-selection.d.ts.map +1 -0
- package/dist/cli/headless-runtime-selection.js +48 -0
- package/dist/cli/headless-runtime-selection.js.map +1 -0
- package/dist/cli/headless.d.ts +5 -1
- package/dist/cli/headless.d.ts.map +1 -1
- package/dist/cli/headless.js +11 -1
- package/dist/cli/headless.js.map +1 -1
- package/dist/cli/help.d.ts +3 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +136 -30
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/system-prompt.d.ts +22 -4
- package/dist/cli/system-prompt.d.ts.map +1 -1
- package/dist/cli/system-prompt.js +224 -127
- package/dist/cli/system-prompt.js.map +1 -1
- package/dist/cli-tui/commands/a2a-handlers.d.ts +7 -0
- package/dist/cli-tui/commands/a2a-handlers.d.ts.map +1 -0
- package/dist/cli-tui/commands/a2a-handlers.js +160 -0
- package/dist/cli-tui/commands/a2a-handlers.js.map +1 -0
- package/dist/cli-tui/commands/command-catalog.d.ts.map +1 -1
- package/dist/cli-tui/commands/command-catalog.js +15 -0
- package/dist/cli-tui/commands/command-catalog.js.map +1 -1
- package/dist/cli-tui/commands/command-registry-adapter.js +10 -1
- package/dist/cli-tui/commands/command-registry-adapter.js.map +1 -1
- package/dist/cli-tui/commands/handlers/mode-handler.d.ts.map +1 -1
- package/dist/cli-tui/commands/handlers/mode-handler.js +22 -10
- package/dist/cli-tui/commands/handlers/mode-handler.js.map +1 -1
- package/dist/cli-tui/commands/mcp-handlers.d.ts.map +1 -1
- package/dist/cli-tui/commands/mcp-handlers.js +6 -5
- package/dist/cli-tui/commands/mcp-handlers.js.map +1 -1
- package/dist/cli-tui/commands/types.d.ts +1 -0
- package/dist/cli-tui/commands/types.d.ts.map +1 -1
- package/dist/cli-tui/commands/types.js.map +1 -1
- package/dist/cli-tui/commands/utility-handlers.d.ts +4 -0
- package/dist/cli-tui/commands/utility-handlers.d.ts.map +1 -1
- package/dist/cli-tui/commands/utility-handlers.js +45 -6
- package/dist/cli-tui/commands/utility-handlers.js.map +1 -1
- package/dist/cli-tui/run/run-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/run-shell-command.js +14 -5
- package/dist/cli-tui/run/run-shell-command.js.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.js +14 -5
- package/dist/cli-tui/run/streaming-shell-command.js.map +1 -1
- package/dist/cli-tui/selectors/model-selector.d.ts +1 -0
- package/dist/cli-tui/selectors/model-selector.d.ts.map +1 -1
- package/dist/cli-tui/selectors/model-selector.js +6 -2
- package/dist/cli-tui/selectors/model-selector.js.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.js +5 -0
- package/dist/cli-tui/tui-renderer/command-registry-options.js.map +1 -1
- package/dist/cli-tui/utils/commands/review-prompt.d.ts +1 -1
- package/dist/cli-tui/utils/commands/review-prompt.d.ts.map +1 -1
- package/dist/cli-tui/utils/commands/review-prompt.js +8 -3
- package/dist/cli-tui/utils/commands/review-prompt.js.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.d.ts +1 -0
- package/dist/cli-tui/utils/runtime-badges.d.ts.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.js +7 -0
- package/dist/cli-tui/utils/runtime-badges.js.map +1 -1
- package/dist/cli-tui/utils/text-formatting.d.ts +1 -0
- package/dist/cli-tui/utils/text-formatting.d.ts.map +1 -1
- package/dist/cli-tui/utils/text-formatting.js +5 -0
- package/dist/cli-tui/utils/text-formatting.js.map +1 -1
- package/dist/cli.js +49209 -26165
- package/dist/cli.js.map +1 -1
- package/dist/codex/app-server-client.d.ts +139 -0
- package/dist/codex/app-server-client.d.ts.map +1 -0
- package/dist/codex/app-server-client.js +352 -0
- package/dist/codex/app-server-client.js.map +1 -0
- package/dist/codex/compatibility.d.ts +48 -0
- package/dist/codex/compatibility.d.ts.map +1 -0
- package/dist/codex/compatibility.js +344 -0
- package/dist/codex/compatibility.js.map +1 -0
- package/dist/codex/subagent-dispatch-table.d.ts +66 -0
- package/dist/codex/subagent-dispatch-table.d.ts.map +1 -0
- package/dist/codex/subagent-dispatch-table.js +127 -0
- package/dist/codex/subagent-dispatch-table.js.map +1 -0
- package/dist/codex/subagent-workgraph.d.ts +56 -0
- package/dist/codex/subagent-workgraph.d.ts.map +1 -0
- package/dist/codex/subagent-workgraph.js +89 -0
- package/dist/codex/subagent-workgraph.js.map +1 -0
- package/dist/config/constants.d.ts +3 -1
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +9 -0
- package/dist/config/constants.js.map +1 -1
- package/dist/config/feature-flags.d.ts +10 -1
- package/dist/config/feature-flags.d.ts.map +1 -1
- package/dist/config/feature-flags.js +17 -6
- package/dist/config/feature-flags.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/toml-config.d.ts +32 -0
- package/dist/config/toml-config.d.ts.map +1 -1
- package/dist/config/toml-config.js +152 -43
- package/dist/config/toml-config.js.map +1 -1
- package/dist/connectors/service-client.d.ts.map +1 -1
- package/dist/connectors/service-client.js +4 -7
- package/dist/connectors/service-client.js.map +1 -1
- package/dist/context/manifest-types.d.ts +59 -0
- package/dist/context/manifest-types.d.ts.map +1 -0
- package/dist/context/manifest-types.js +2 -0
- package/dist/context/manifest-types.js.map +1 -0
- package/dist/context/manifest.d.ts +16 -0
- package/dist/context/manifest.d.ts.map +1 -0
- package/dist/context/manifest.js +503 -0
- package/dist/context/manifest.js.map +1 -0
- package/dist/db/schema.d.ts +10 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js.map +1 -1
- package/dist/evalops/agent-bootstrap.d.ts +1 -0
- package/dist/evalops/agent-bootstrap.d.ts.map +1 -1
- package/dist/evalops/agent-bootstrap.js +41 -1
- package/dist/evalops/agent-bootstrap.js.map +1 -1
- package/dist/evalops/env-aliases.d.ts +13 -0
- package/dist/evalops/env-aliases.d.ts.map +1 -0
- package/dist/evalops/env-aliases.js +60 -0
- package/dist/evalops/env-aliases.js.map +1 -0
- package/dist/evalops/managed-context.d.ts.map +1 -1
- package/dist/evalops/managed-context.js +28 -62
- package/dist/evalops/managed-context.js.map +1 -1
- package/dist/guardian/config.d.ts.map +1 -1
- package/dist/guardian/config.js +1 -0
- package/dist/guardian/config.js.map +1 -1
- package/dist/guardian/runner.d.ts +2 -0
- package/dist/guardian/runner.d.ts.map +1 -1
- package/dist/guardian/runner.js +105 -2
- package/dist/guardian/runner.js.map +1 -1
- package/dist/guardian/types.d.ts +1 -0
- package/dist/guardian/types.d.ts.map +1 -1
- package/dist/guardian/types.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +267 -55
- package/dist/main.js.map +1 -1
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +89 -7
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/manager.d.ts +5 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +159 -4
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/platform-plugin.d.ts.map +1 -1
- package/dist/mcp/platform-plugin.js +9 -26
- package/dist/mcp/platform-plugin.js.map +1 -1
- package/dist/mcp/schema.d.ts +15 -0
- package/dist/mcp/schema.d.ts.map +1 -1
- package/dist/mcp/schema.js +24 -0
- package/dist/mcp/schema.js.map +1 -1
- package/dist/mcp/tool-bridge.d.ts +39 -10
- package/dist/mcp/tool-bridge.d.ts.map +1 -1
- package/dist/mcp/tool-bridge.js +101 -24
- package/dist/mcp/tool-bridge.js.map +1 -1
- package/dist/mcp/types.d.ts +27 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js.map +1 -1
- package/dist/mcp/workspace-trust.d.ts +10 -0
- package/dist/mcp/workspace-trust.d.ts.map +1 -0
- package/dist/mcp/workspace-trust.js +295 -0
- package/dist/mcp/workspace-trust.js.map +1 -0
- package/dist/memory/service-client.d.ts +1 -0
- package/dist/memory/service-client.d.ts.map +1 -1
- package/dist/memory/service-client.js +194 -9
- package/dist/memory/service-client.js.map +1 -1
- package/dist/models/builtin.d.ts.map +1 -1
- package/dist/models/builtin.js +66 -25
- package/dist/models/builtin.js.map +1 -1
- package/dist/models/config-loader.d.ts +10 -10
- package/dist/models/config-loader.d.ts.map +1 -1
- package/dist/models/config-loader.js +2 -0
- package/dist/models/config-loader.js.map +1 -1
- package/dist/models/registry.d.ts +1 -0
- package/dist/models/registry.d.ts.map +1 -1
- package/dist/models/registry.js +1 -0
- package/dist/models/registry.js.map +1 -1
- package/dist/oauth/device-identity.d.ts.map +1 -1
- package/dist/oauth/device-identity.js +1 -3
- package/dist/oauth/device-identity.js.map +1 -1
- package/dist/oauth/evalops.d.ts.map +1 -1
- package/dist/oauth/evalops.js +2 -5
- package/dist/oauth/evalops.js.map +1 -1
- package/dist/opentelemetry.d.ts.map +1 -1
- package/dist/opentelemetry.js +12 -12
- package/dist/opentelemetry.js.map +1 -1
- package/dist/package-version.d.ts +2 -0
- package/dist/package-version.d.ts.map +1 -0
- package/dist/package-version.js +11 -0
- package/dist/package-version.js.map +1 -0
- package/dist/packages/constants.d.ts +3 -0
- package/dist/packages/constants.d.ts.map +1 -0
- package/dist/packages/constants.js +3 -0
- package/dist/packages/constants.js.map +1 -0
- package/dist/packages/inspection.d.ts.map +1 -1
- package/dist/packages/inspection.js +2 -1
- package/dist/packages/inspection.js.map +1 -1
- package/dist/packages/search.d.ts.map +1 -1
- package/dist/packages/search.js +1 -1
- package/dist/packages/search.js.map +1 -1
- package/dist/platform/a2a-capability-market.d.ts +21 -0
- package/dist/platform/a2a-capability-market.d.ts.map +1 -0
- package/dist/platform/a2a-capability-market.js +176 -0
- package/dist/platform/a2a-capability-market.js.map +1 -0
- package/dist/platform/a2a-client.d.ts +217 -0
- package/dist/platform/a2a-client.d.ts.map +1 -0
- package/dist/platform/a2a-client.js +589 -0
- package/dist/platform/a2a-client.js.map +1 -0
- package/dist/platform/a2a-fleet.d.ts +41 -0
- package/dist/platform/a2a-fleet.d.ts.map +1 -0
- package/dist/platform/a2a-fleet.js +109 -0
- package/dist/platform/a2a-fleet.js.map +1 -0
- package/dist/platform/a2a-maestro-peer.d.ts +20 -0
- package/dist/platform/a2a-maestro-peer.d.ts.map +1 -0
- package/dist/platform/a2a-maestro-peer.js +176 -0
- package/dist/platform/a2a-maestro-peer.js.map +1 -0
- package/dist/platform/a2a-peer-pairing.d.ts +107 -0
- package/dist/platform/a2a-peer-pairing.d.ts.map +1 -0
- package/dist/platform/a2a-peer-pairing.js +489 -0
- package/dist/platform/a2a-peer-pairing.js.map +1 -0
- package/dist/platform/a2a-peer-registry.d.ts +68 -0
- package/dist/platform/a2a-peer-registry.d.ts.map +1 -0
- package/dist/platform/a2a-peer-registry.js +320 -0
- package/dist/platform/a2a-peer-registry.js.map +1 -0
- package/dist/platform/a2a-task-ledger.d.ts +86 -0
- package/dist/platform/a2a-task-ledger.d.ts.map +1 -0
- package/dist/platform/a2a-task-ledger.js +546 -0
- package/dist/platform/a2a-task-ledger.js.map +1 -0
- package/dist/platform/a2a-work-graph.d.ts +43 -0
- package/dist/platform/a2a-work-graph.d.ts.map +1 -0
- package/dist/platform/a2a-work-graph.js +267 -0
- package/dist/platform/a2a-work-graph.js.map +1 -0
- package/dist/platform/agent-registry-client.d.ts +327 -0
- package/dist/platform/agent-registry-client.d.ts.map +1 -0
- package/dist/platform/agent-registry-client.js +803 -0
- package/dist/platform/agent-registry-client.js.map +1 -0
- package/dist/platform/agent-runtime-client.d.ts +135 -1
- package/dist/platform/agent-runtime-client.d.ts.map +1 -1
- package/dist/platform/agent-runtime-client.js +467 -10
- package/dist/platform/agent-runtime-client.js.map +1 -1
- package/dist/platform/cerebro-facts-client.d.ts.map +1 -1
- package/dist/platform/cerebro-facts-client.js +4 -7
- package/dist/platform/cerebro-facts-client.js.map +1 -1
- package/dist/platform/client.d.ts +2 -0
- package/dist/platform/client.d.ts.map +1 -1
- package/dist/platform/client.js +7 -14
- package/dist/platform/client.js.map +1 -1
- package/dist/platform/core-services.d.ts +68 -0
- package/dist/platform/core-services.d.ts.map +1 -1
- package/dist/platform/core-services.js +68 -0
- package/dist/platform/core-services.js.map +1 -1
- package/dist/platform/fermata-eval-client.d.ts +195 -0
- package/dist/platform/fermata-eval-client.d.ts.map +1 -0
- package/dist/platform/fermata-eval-client.js +146 -0
- package/dist/platform/fermata-eval-client.js.map +1 -0
- package/dist/platform/fermata-scenario-suite.d.ts +99 -0
- package/dist/platform/fermata-scenario-suite.d.ts.map +1 -0
- package/dist/platform/fermata-scenario-suite.js +459 -0
- package/dist/platform/fermata-scenario-suite.js.map +1 -0
- package/dist/platform/maestro-timeline-client.d.ts.map +1 -1
- package/dist/platform/maestro-timeline-client.js +5 -11
- package/dist/platform/maestro-timeline-client.js.map +1 -1
- package/dist/platform/operating-plane-client.d.ts +156 -0
- package/dist/platform/operating-plane-client.d.ts.map +1 -0
- package/dist/platform/operating-plane-client.js +131 -0
- package/dist/platform/operating-plane-client.js.map +1 -0
- package/dist/platform/operating-plane-summary.d.ts +47 -0
- package/dist/platform/operating-plane-summary.d.ts.map +1 -0
- package/dist/platform/operating-plane-summary.js +209 -0
- package/dist/platform/operating-plane-summary.js.map +1 -0
- package/dist/platform/tool-execution-client.d.ts.map +1 -1
- package/dist/platform/tool-execution-client.js +4 -11
- package/dist/platform/tool-execution-client.js.map +1 -1
- package/dist/prompts/service-client.d.ts.map +1 -1
- package/dist/prompts/service-client.js +3 -5
- package/dist/prompts/service-client.js.map +1 -1
- package/dist/prompts/system-prompt.d.ts +3 -0
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +13 -3
- package/dist/prompts/system-prompt.js.map +1 -1
- package/dist/prompts/types.d.ts +2 -0
- package/dist/prompts/types.d.ts.map +1 -1
- package/dist/prompts/types.js.map +1 -1
- package/dist/providers/api-keys.d.ts +1 -1
- package/dist/providers/api-keys.d.ts.map +1 -1
- package/dist/providers/api-keys.js +2 -1
- package/dist/providers/api-keys.js.map +1 -1
- package/dist/providers/auth.d.ts.map +1 -1
- package/dist/providers/auth.js +48 -25
- package/dist/providers/auth.js.map +1 -1
- package/dist/remote-runner/attach-client.d.ts.map +1 -1
- package/dist/remote-runner/attach-client.js +1 -0
- package/dist/remote-runner/attach-client.js.map +1 -1
- package/dist/remote-runner/client.d.ts.map +1 -1
- package/dist/remote-runner/client.js +4 -7
- package/dist/remote-runner/client.js.map +1 -1
- package/dist/rpc/rpc-types.d.ts.map +1 -1
- package/dist/rpc/rpc-types.js +1 -0
- package/dist/rpc/rpc-types.js.map +1 -1
- package/dist/safety/action-firewall.d.ts.map +1 -1
- package/dist/safety/action-firewall.js +69 -6
- package/dist/safety/action-firewall.js.map +1 -1
- package/dist/safety/attack-patterns.d.ts.map +1 -1
- package/dist/safety/attack-patterns.js +31 -14
- package/dist/safety/attack-patterns.js.map +1 -1
- package/dist/safety/bash-parser.d.ts.map +1 -1
- package/dist/safety/bash-parser.js +4 -3
- package/dist/safety/bash-parser.js.map +1 -1
- package/dist/safety/execpolicy.d.ts +15 -3
- package/dist/safety/execpolicy.d.ts.map +1 -1
- package/dist/safety/execpolicy.js +248 -37
- package/dist/safety/execpolicy.js.map +1 -1
- package/dist/safety/governance-service-client.d.ts.map +1 -1
- package/dist/safety/governance-service-client.js +4 -7
- package/dist/safety/governance-service-client.js.map +1 -1
- package/dist/safety/guarded-files.d.ts +34 -0
- package/dist/safety/guarded-files.d.ts.map +1 -0
- package/dist/safety/guarded-files.js +372 -0
- package/dist/safety/guarded-files.js.map +1 -0
- package/dist/safety/loop-detector.d.ts.map +1 -1
- package/dist/safety/loop-detector.js +6 -1
- package/dist/safety/loop-detector.js.map +1 -1
- package/dist/safety/permission-profile.d.ts +47 -0
- package/dist/safety/permission-profile.d.ts.map +1 -0
- package/dist/safety/permission-profile.js +349 -0
- package/dist/safety/permission-profile.js.map +1 -0
- package/dist/safety/safety-middleware.d.ts +5 -1
- package/dist/safety/safety-middleware.d.ts.map +1 -1
- package/dist/safety/safety-middleware.js +3 -2
- package/dist/safety/safety-middleware.js.map +1 -1
- package/dist/safety/suspicious-patterns.d.ts.map +1 -1
- package/dist/safety/suspicious-patterns.js +12 -7
- package/dist/safety/suspicious-patterns.js.map +1 -1
- package/dist/safety/tool-categorization.js +1 -1
- package/dist/safety/tool-categorization.js.map +1 -1
- package/dist/safety/validators/path-policy-validator.d.ts.map +1 -1
- package/dist/safety/validators/path-policy-validator.js +7 -0
- package/dist/safety/validators/path-policy-validator.js.map +1 -1
- package/dist/sandbox/index.d.ts +6 -1
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +30 -4
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/native-sandbox.d.ts +3 -0
- package/dist/sandbox/native-sandbox.d.ts.map +1 -1
- package/dist/sandbox/native-sandbox.js +139 -18
- package/dist/sandbox/native-sandbox.js.map +1 -1
- package/dist/sentry.d.ts +17 -0
- package/dist/sentry.d.ts.map +1 -0
- package/dist/sentry.js +91 -0
- package/dist/sentry.js.map +1 -0
- package/dist/server/agent-runtime-ledger.d.ts +141 -0
- package/dist/server/agent-runtime-ledger.d.ts.map +1 -0
- package/dist/server/agent-runtime-ledger.js +334 -0
- package/dist/server/agent-runtime-ledger.js.map +1 -0
- package/dist/server/agent-trajectory-inspection.d.ts +104 -0
- package/dist/server/agent-trajectory-inspection.d.ts.map +1 -0
- package/dist/server/agent-trajectory-inspection.js +168 -0
- package/dist/server/agent-trajectory-inspection.js.map +1 -0
- package/dist/server/agent-trajectory-replay.d.ts +56 -0
- package/dist/server/agent-trajectory-replay.d.ts.map +1 -0
- package/dist/server/agent-trajectory-replay.js +214 -0
- package/dist/server/agent-trajectory-replay.js.map +1 -0
- package/dist/server/agent-trajectory-scenarios.d.ts +109 -0
- package/dist/server/agent-trajectory-scenarios.d.ts.map +1 -0
- package/dist/server/agent-trajectory-scenarios.js +822 -0
- package/dist/server/agent-trajectory-scenarios.js.map +1 -0
- package/dist/server/agent-trajectory-scorers.d.ts +61 -0
- package/dist/server/agent-trajectory-scorers.d.ts.map +1 -0
- package/dist/server/agent-trajectory-scorers.js +162 -0
- package/dist/server/agent-trajectory-scorers.js.map +1 -0
- package/dist/server/agent-trajectory-validation.d.ts +7 -0
- package/dist/server/agent-trajectory-validation.d.ts.map +1 -0
- package/dist/server/agent-trajectory-validation.js +101 -0
- package/dist/server/agent-trajectory-validation.js.map +1 -0
- package/dist/server/agent-trajectory.d.ts +50 -0
- package/dist/server/agent-trajectory.d.ts.map +1 -0
- package/dist/server/agent-trajectory.js +159 -0
- package/dist/server/agent-trajectory.js.map +1 -0
- package/dist/server/app-context.d.ts +18 -0
- package/dist/server/app-context.d.ts.map +1 -1
- package/dist/server/app-context.js.map +1 -1
- package/dist/server/handlers/headless-sessions.d.ts.map +1 -1
- package/dist/server/handlers/headless-sessions.js +64 -27
- package/dist/server/handlers/headless-sessions.js.map +1 -1
- package/dist/server/handlers/health.d.ts +6 -0
- package/dist/server/handlers/health.d.ts.map +1 -1
- package/dist/server/handlers/health.js +6 -0
- package/dist/server/handlers/health.js.map +1 -1
- package/dist/server/handlers/hosted-runner-drain.d.ts +69 -1
- package/dist/server/handlers/hosted-runner-drain.d.ts.map +1 -1
- package/dist/server/handlers/hosted-runner-drain.js +309 -18
- package/dist/server/handlers/hosted-runner-drain.js.map +1 -1
- package/dist/server/handlers/hosted-runner-identity.d.ts +16 -0
- package/dist/server/handlers/hosted-runner-identity.d.ts.map +1 -1
- package/dist/server/handlers/hosted-runner-identity.js +43 -0
- package/dist/server/handlers/hosted-runner-identity.js.map +1 -1
- package/dist/server/handlers/mode.d.ts.map +1 -1
- package/dist/server/handlers/mode.js +3 -1
- package/dist/server/handlers/mode.js.map +1 -1
- package/dist/server/handlers/pending-requests.d.ts.map +1 -1
- package/dist/server/handlers/pending-requests.js +336 -51
- package/dist/server/handlers/pending-requests.js.map +1 -1
- package/dist/server/handlers/platform-a2a-push.d.ts +6 -0
- package/dist/server/handlers/platform-a2a-push.d.ts.map +1 -0
- package/dist/server/handlers/platform-a2a-push.js +136 -0
- package/dist/server/handlers/platform-a2a-push.js.map +1 -0
- package/dist/server/handlers/sessions.d.ts.map +1 -1
- package/dist/server/handlers/sessions.js +21 -1
- package/dist/server/handlers/sessions.js.map +1 -1
- package/dist/server/headless-runtime-service.d.ts +9 -2
- package/dist/server/headless-runtime-service.d.ts.map +1 -1
- package/dist/server/headless-runtime-service.js +39 -0
- package/dist/server/headless-runtime-service.js.map +1 -1
- package/dist/server/hosted-agent-runtime-progress.d.ts +144 -0
- package/dist/server/hosted-agent-runtime-progress.d.ts.map +1 -0
- package/dist/server/hosted-agent-runtime-progress.js +1650 -0
- package/dist/server/hosted-agent-runtime-progress.js.map +1 -0
- package/dist/server/hosted-runner-lease.d.ts +41 -0
- package/dist/server/hosted-runner-lease.d.ts.map +1 -0
- package/dist/server/hosted-runner-lease.js +140 -0
- package/dist/server/hosted-runner-lease.js.map +1 -0
- package/dist/server/hosted-session-manager.d.ts +16 -8
- package/dist/server/hosted-session-manager.d.ts.map +1 -1
- package/dist/server/hosted-session-manager.js +98 -76
- package/dist/server/hosted-session-manager.js.map +1 -1
- package/dist/server/junit-xml.d.ts +2 -0
- package/dist/server/junit-xml.d.ts.map +1 -0
- package/dist/server/junit-xml.js +9 -0
- package/dist/server/junit-xml.js.map +1 -0
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +6 -0
- package/dist/server/routes.js.map +1 -1
- package/dist/server/scenario-recorder.d.ts +56 -0
- package/dist/server/scenario-recorder.d.ts.map +1 -0
- package/dist/server/scenario-recorder.js +109 -0
- package/dist/server/scenario-recorder.js.map +1 -0
- package/dist/server/scripted-scenario-runner.d.ts +46 -0
- package/dist/server/scripted-scenario-runner.d.ts.map +1 -0
- package/dist/server/scripted-scenario-runner.js +190 -0
- package/dist/server/scripted-scenario-runner.js.map +1 -0
- package/dist/server/server-middlewares.d.ts +6 -2
- package/dist/server/server-middlewares.d.ts.map +1 -1
- package/dist/server/server-middlewares.js +8 -2
- package/dist/server/server-middlewares.js.map +1 -1
- package/dist/server/server-request-manager.d.ts +9 -1
- package/dist/server/server-request-manager.d.ts.map +1 -1
- package/dist/server/server-request-manager.js +49 -4
- package/dist/server/server-request-manager.js.map +1 -1
- package/dist/services/intelligent-router/service.d.ts +2 -0
- package/dist/services/intelligent-router/service.d.ts.map +1 -1
- package/dist/services/intelligent-router/service.js +4 -0
- package/dist/services/intelligent-router/service.js.map +1 -1
- package/dist/services/service-authority.d.ts +25 -0
- package/dist/services/service-authority.d.ts.map +1 -0
- package/dist/services/service-authority.js +143 -0
- package/dist/services/service-authority.js.map +1 -0
- package/dist/services/workspace-config/service.d.ts +2 -0
- package/dist/services/workspace-config/service.d.ts.map +1 -1
- package/dist/services/workspace-config/service.js +4 -0
- package/dist/services/workspace-config/service.js.map +1 -1
- package/dist/session/manager.d.ts +8 -2
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +19 -4
- package/dist/session/manager.js.map +1 -1
- package/dist/session/session-branch.d.ts.map +1 -1
- package/dist/session/session-branch.js +5 -1
- package/dist/session/session-branch.js.map +1 -1
- package/dist/session/session-catalog.d.ts +7 -2
- package/dist/session/session-catalog.d.ts.map +1 -1
- package/dist/session/session-catalog.js +13 -2
- package/dist/session/session-catalog.js.map +1 -1
- package/dist/session/session-context.d.ts +6 -2
- package/dist/session/session-context.d.ts.map +1 -1
- package/dist/session/session-context.js +44 -4
- package/dist/session/session-context.js.map +1 -1
- package/dist/session/session-graph-projection.d.ts +32 -0
- package/dist/session/session-graph-projection.d.ts.map +1 -0
- package/dist/session/session-graph-projection.js +133 -0
- package/dist/session/session-graph-projection.js.map +1 -0
- package/dist/session/types.d.ts +18 -0
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/types.js +8 -0
- package/dist/session/types.js.map +1 -1
- package/dist/session/wire-format.generated.d.ts +3 -0
- package/dist/session/wire-format.generated.d.ts.map +1 -1
- package/dist/session/wire-format.generated.js +20 -0
- package/dist/session/wire-format.generated.js.map +1 -1
- package/dist/skills/eval-harness.d.ts +38 -0
- package/dist/skills/eval-harness.d.ts.map +1 -0
- package/dist/skills/eval-harness.js +112 -0
- package/dist/skills/eval-harness.js.map +1 -0
- package/dist/skills/index.d.ts +5 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +5 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/linter.d.ts +36 -0
- package/dist/skills/linter.d.ts.map +1 -0
- package/dist/skills/linter.js +398 -0
- package/dist/skills/linter.js.map +1 -0
- package/dist/skills/loader.d.ts +36 -6
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +169 -86
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/package-contract.d.ts +45 -0
- package/dist/skills/package-contract.d.ts.map +1 -0
- package/dist/skills/package-contract.js +153 -0
- package/dist/skills/package-contract.js.map +1 -0
- package/dist/skills/runtime-activation.d.ts +68 -0
- package/dist/skills/runtime-activation.d.ts.map +1 -0
- package/dist/skills/runtime-activation.js +228 -0
- package/dist/skills/runtime-activation.js.map +1 -0
- package/dist/skills/service-client.d.ts.map +1 -1
- package/dist/skills/service-client.js +3 -4
- package/dist/skills/service-client.js.map +1 -1
- package/dist/skills/tool.d.ts.map +1 -1
- package/dist/skills/tool.js +2 -0
- package/dist/skills/tool.js.map +1 -1
- package/dist/skills/types.d.ts +14 -0
- package/dist/skills/types.d.ts.map +1 -1
- package/dist/skills/types.js.map +1 -1
- package/dist/telemetry/agent-operating-plane-context.d.ts +24 -0
- package/dist/telemetry/agent-operating-plane-context.d.ts.map +1 -0
- package/dist/telemetry/agent-operating-plane-context.js +54 -0
- package/dist/telemetry/agent-operating-plane-context.js.map +1 -0
- package/dist/telemetry/beacon.d.ts +24 -0
- package/dist/telemetry/beacon.d.ts.map +1 -0
- package/dist/telemetry/beacon.js +115 -0
- package/dist/telemetry/beacon.js.map +1 -0
- package/dist/telemetry/cli-command-aggregator.d.ts +36 -0
- package/dist/telemetry/cli-command-aggregator.d.ts.map +1 -0
- package/dist/telemetry/cli-command-aggregator.js +251 -0
- package/dist/telemetry/cli-command-aggregator.js.map +1 -0
- package/dist/telemetry/cli-startup.d.ts +21 -0
- package/dist/telemetry/cli-startup.d.ts.map +1 -0
- package/dist/telemetry/cli-startup.js +83 -0
- package/dist/telemetry/cli-startup.js.map +1 -0
- package/dist/telemetry/disablement.d.ts +13 -0
- package/dist/telemetry/disablement.d.ts.map +1 -0
- package/dist/telemetry/disablement.js +19 -0
- package/dist/telemetry/disablement.js.map +1 -0
- package/dist/telemetry/index.d.ts +6 -2
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +6 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/maestro-event-bus.d.ts +52 -0
- package/dist/telemetry/maestro-event-bus.d.ts.map +1 -1
- package/dist/telemetry/maestro-event-bus.js +179 -3
- package/dist/telemetry/maestro-event-bus.js.map +1 -1
- package/dist/telemetry/maestro-event-catalog.d.ts +3 -1
- package/dist/telemetry/maestro-event-catalog.d.ts.map +1 -1
- package/dist/telemetry/maestro-event-catalog.js +2 -0
- package/dist/telemetry/maestro-event-catalog.js.map +1 -1
- package/dist/telemetry/maestro-platform-replay-fixture.d.ts.map +1 -1
- package/dist/telemetry/maestro-platform-replay-fixture.js +74 -9
- package/dist/telemetry/maestro-platform-replay-fixture.js.map +1 -1
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts +1 -1
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts.map +1 -1
- package/dist/telemetry/maestro-publisher-conformance-fixture.js +46 -11
- package/dist/telemetry/maestro-publisher-conformance-fixture.js.map +1 -1
- package/dist/telemetry/mcp-beacon.d.ts +20 -0
- package/dist/telemetry/mcp-beacon.d.ts.map +1 -0
- package/dist/telemetry/mcp-beacon.js +54 -0
- package/dist/telemetry/mcp-beacon.js.map +1 -0
- package/dist/telemetry/metadata-normalization.d.ts +7 -0
- package/dist/telemetry/metadata-normalization.d.ts.map +1 -0
- package/dist/telemetry/metadata-normalization.js +189 -0
- package/dist/telemetry/metadata-normalization.js.map +1 -0
- package/dist/telemetry/meter-service-client.d.ts.map +1 -1
- package/dist/telemetry/meter-service-client.js +5 -10
- package/dist/telemetry/meter-service-client.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +123 -0
- package/dist/telemetry/metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics.js +184 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/telemetry/turn-tracker.d.ts +1 -0
- package/dist/telemetry/turn-tracker.d.ts.map +1 -1
- package/dist/telemetry/turn-tracker.js +22 -1
- package/dist/telemetry/turn-tracker.js.map +1 -1
- package/dist/telemetry/wide-events.d.ts +31 -1
- package/dist/telemetry/wide-events.d.ts.map +1 -1
- package/dist/telemetry/wide-events.js +229 -1
- package/dist/telemetry/wide-events.js.map +1 -1
- package/dist/telemetry.d.ts +39 -3
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +160 -3
- package/dist/telemetry.js.map +1 -1
- package/dist/testing/test-verification-hook.d.ts.map +1 -1
- package/dist/testing/test-verification-hook.js +34 -21
- package/dist/testing/test-verification-hook.js.map +1 -1
- package/dist/tools/apply-patch-parser.d.ts +26 -0
- package/dist/tools/apply-patch-parser.d.ts.map +1 -0
- package/dist/tools/apply-patch-parser.js +146 -0
- package/dist/tools/apply-patch-parser.js.map +1 -0
- package/dist/tools/apply-patch.d.ts +42 -0
- package/dist/tools/apply-patch.d.ts.map +1 -0
- package/dist/tools/apply-patch.js +648 -0
- package/dist/tools/apply-patch.js.map +1 -0
- package/dist/tools/ask-user.d.ts +1 -0
- package/dist/tools/ask-user.d.ts.map +1 -1
- package/dist/tools/background/tool-handler.d.ts +1 -0
- package/dist/tools/background/tool-handler.d.ts.map +1 -1
- package/dist/tools/bash.d.ts +1 -0
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/codesearch.d.ts +1 -0
- package/dist/tools/codesearch.d.ts.map +1 -1
- package/dist/tools/conductor-client.d.ts +1 -0
- package/dist/tools/conductor-client.d.ts.map +1 -1
- package/dist/tools/conductor-client.js +63 -0
- package/dist/tools/conductor-client.js.map +1 -1
- package/dist/tools/diff.d.ts +1 -0
- package/dist/tools/diff.d.ts.map +1 -1
- package/dist/tools/edit.d.ts +1 -0
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/extract-document.d.ts +1 -0
- package/dist/tools/extract-document.d.ts.map +1 -1
- package/dist/tools/find.d.ts +10 -0
- package/dist/tools/find.d.ts.map +1 -1
- package/dist/tools/find.js +236 -27
- package/dist/tools/find.js.map +1 -1
- package/dist/tools/gh.d.ts +3 -0
- package/dist/tools/gh.d.ts.map +1 -1
- package/dist/tools/index.d.ts +50 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list.d.ts +1 -0
- package/dist/tools/list.d.ts.map +1 -1
- package/dist/tools/notebook.d.ts +1 -0
- package/dist/tools/notebook.d.ts.map +1 -1
- package/dist/tools/oracle.d.ts +1 -0
- package/dist/tools/oracle.d.ts.map +1 -1
- package/dist/tools/oracle.js +17 -32
- package/dist/tools/oracle.js.map +1 -1
- package/dist/tools/parallel-execution.d.ts +13 -2
- package/dist/tools/parallel-execution.d.ts.map +1 -1
- package/dist/tools/parallel-execution.js +178 -7
- package/dist/tools/parallel-execution.js.map +1 -1
- package/dist/tools/parallel-ripgrep.d.ts +1 -0
- package/dist/tools/parallel-ripgrep.d.ts.map +1 -1
- package/dist/tools/pipeline.d.ts +4 -0
- package/dist/tools/pipeline.d.ts.map +1 -1
- package/dist/tools/read.d.ts +1 -0
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/search.d.ts +1 -0
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/status.d.ts +1 -0
- package/dist/tools/status.d.ts.map +1 -1
- package/dist/tools/todo.d.ts +1 -0
- package/dist/tools/todo.d.ts.map +1 -1
- package/dist/tools/tool-dsl.d.ts +5 -1
- package/dist/tools/tool-dsl.d.ts.map +1 -1
- package/dist/tools/tool-dsl.js +1 -0
- package/dist/tools/tool-dsl.js.map +1 -1
- package/dist/tools/tool-result-cache.d.ts.map +1 -1
- package/dist/tools/tool-result-cache.js +1 -0
- package/dist/tools/tool-result-cache.js.map +1 -1
- package/dist/tools/typebox-tool.d.ts.map +1 -1
- package/dist/tools/typebox-tool.js +3 -0
- package/dist/tools/typebox-tool.js.map +1 -1
- package/dist/tools/webfetch.d.ts +1 -0
- package/dist/tools/webfetch.d.ts.map +1 -1
- package/dist/tools/websearch.d.ts +1 -0
- package/dist/tools/websearch.d.ts.map +1 -1
- package/dist/tools/write.d.ts +1 -0
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/utils/abort-error.d.ts +2 -0
- package/dist/utils/abort-error.d.ts.map +1 -0
- package/dist/utils/abort-error.js +7 -0
- package/dist/utils/abort-error.js.map +1 -0
- package/dist/utils/downstream.d.ts.map +1 -1
- package/dist/utils/downstream.js +4 -0
- package/dist/utils/downstream.js.map +1 -1
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +14 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/path-containment.d.ts +2 -0
- package/dist/utils/path-containment.d.ts.map +1 -0
- package/dist/utils/path-containment.js +14 -0
- package/dist/utils/path-containment.js.map +1 -0
- package/dist/utils/prompt-safe-text.d.ts +7 -0
- package/dist/utils/prompt-safe-text.d.ts.map +1 -0
- package/dist/utils/prompt-safe-text.js +44 -0
- package/dist/utils/prompt-safe-text.js.map +1 -0
- package/dist/version.json +2 -2
- package/dist/web-server.d.ts.map +1 -1
- package/dist/web-server.js +32 -7
- package/dist/web-server.js.map +1 -1
- package/dist/workspace/root-resolver.d.ts +4 -1
- package/dist/workspace/root-resolver.d.ts.map +1 -1
- package/dist/workspace/root-resolver.js +16 -6
- package/dist/workspace/root-resolver.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/advisor-effort.d.ts +8 -0
- package/node_modules/@evalops/contracts/dist/advisor-effort.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/advisor-effort.js +35 -0
- package/node_modules/@evalops/contracts/dist/advisor-effort.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/delegation-prompt.d.ts +10 -0
- package/node_modules/@evalops/contracts/dist/delegation-prompt.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/delegation-prompt.js +48 -0
- package/node_modules/@evalops/contracts/dist/delegation-prompt.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/guarded-files-settings.d.ts +20 -0
- package/node_modules/@evalops/contracts/dist/guarded-files-settings.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/guarded-files-settings.js +147 -0
- package/node_modules/@evalops/contracts/dist/guarded-files-settings.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/headless-protocol-generated.d.ts +2 -0
- package/node_modules/@evalops/contracts/dist/headless-protocol-generated.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-generated.js +1 -0
- package/node_modules/@evalops/contracts/dist/headless-protocol-generated.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts +280 -5
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js +36 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.d.ts +15 -1
- package/node_modules/@evalops/contracts/dist/index.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.js +6 -0
- package/node_modules/@evalops/contracts/dist/index.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/maestro-app-server.d.ts +593 -0
- package/node_modules/@evalops/contracts/dist/maestro-app-server.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/maestro-app-server.js +218 -0
- package/node_modules/@evalops/contracts/dist/maestro-app-server.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts +91 -0
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js +92 -61
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts +3 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/runtime-constraints.d.ts +28 -0
- package/node_modules/@evalops/contracts/dist/runtime-constraints.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-constraints.js +71 -0
- package/node_modules/@evalops/contracts/dist/runtime-constraints.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts +7 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js +2 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/scenario.d.ts +191 -0
- package/node_modules/@evalops/contracts/dist/scenario.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/scenario.js +4 -0
- package/node_modules/@evalops/contracts/dist/scenario.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/schemas.d.ts +17 -3
- package/node_modules/@evalops/contracts/dist/schemas.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/schemas.js +16 -0
- package/node_modules/@evalops/contracts/dist/schemas.js.map +1 -1
- package/node_modules/@evalops/contracts/package.json +1 -1
- package/node_modules/@evalops/tui/package.json +1 -1
- package/package.json +41 -7
- package/skills/incident-triage/SKILL.md +40 -0
- package/skills/incident-triage/mcp.json +14 -0
- package/skills/incident-triage/reference/triage.md +20 -0
- package/skills/incident-triage/toolbox/incident-timeline +22 -0
- package/skills/incident-triage/toolbox/incident-timeline.cmd +16 -0
- package/skills/pr-review/SKILL.md +40 -0
- package/skills/pr-review/mcp.json +14 -0
- package/skills/pr-review/reference/rubric.md +20 -0
- package/skills/pr-review/toolbox/review-summary +20 -0
- package/skills/pr-review/toolbox/review-summary.cmd +14 -0
- package/skills/release-verification/SKILL.md +40 -0
- package/skills/release-verification/mcp.json +15 -0
- package/skills/release-verification/reference/checklist.md +21 -0
- package/skills/release-verification/toolbox/release-readiness +18 -0
- package/skills/release-verification/toolbox/release-readiness.cmd +12 -0
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
*
|
|
27
27
|
* @module tools/parallel-execution
|
|
28
28
|
*/
|
|
29
|
+
import { isAbsolute, resolve } from "node:path";
|
|
29
30
|
/**
|
|
30
31
|
* Set of known read-only tool names.
|
|
31
32
|
*
|
|
@@ -74,6 +75,7 @@ export const READ_ONLY_TOOLS = new Set([
|
|
|
74
75
|
* operations on the same resources.
|
|
75
76
|
*/
|
|
76
77
|
export const WRITE_TOOLS = new Set([
|
|
78
|
+
"apply_patch",
|
|
77
79
|
"write",
|
|
78
80
|
"Write",
|
|
79
81
|
"edit",
|
|
@@ -92,7 +94,7 @@ export const WRITE_TOOLS = new Set([
|
|
|
92
94
|
* @param annotations - Optional tool annotations
|
|
93
95
|
* @returns true if the tool is read-only
|
|
94
96
|
*/
|
|
95
|
-
export function isReadOnlyTool(toolName, annotations) {
|
|
97
|
+
export function isReadOnlyTool(toolName, annotations, _source) {
|
|
96
98
|
// Check explicit annotation first
|
|
97
99
|
if (annotations?.readOnlyHint === true) {
|
|
98
100
|
return true;
|
|
@@ -103,6 +105,15 @@ export function isReadOnlyTool(toolName, annotations) {
|
|
|
103
105
|
// Fall back to known tool lists
|
|
104
106
|
return READ_ONLY_TOOLS.has(toolName);
|
|
105
107
|
}
|
|
108
|
+
export function isParallelSafeTool(toolName, annotations, source) {
|
|
109
|
+
if (isReadOnlyTool(toolName, annotations, source)) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if (annotations?.destructiveHint === true) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return source?.type === "mcp" && source.supportsParallelToolCalls === true;
|
|
116
|
+
}
|
|
106
117
|
/**
|
|
107
118
|
* Check if a tool is a write/mutating operation.
|
|
108
119
|
*
|
|
@@ -136,12 +147,18 @@ export function getOptimalConcurrency(toolCalls, tools, config) {
|
|
|
136
147
|
return baseConcurrency;
|
|
137
148
|
}
|
|
138
149
|
// Build a map of tool names to annotations
|
|
139
|
-
const
|
|
150
|
+
const toolMetadata = new Map();
|
|
140
151
|
for (const tool of tools) {
|
|
141
|
-
|
|
152
|
+
toolMetadata.set(tool.name, {
|
|
153
|
+
annotations: tool.annotations,
|
|
154
|
+
source: tool.source,
|
|
155
|
+
});
|
|
142
156
|
}
|
|
143
157
|
// Check if all tools are read-only
|
|
144
|
-
const allReadOnly = toolCalls.every((call) =>
|
|
158
|
+
const allReadOnly = toolCalls.every((call) => {
|
|
159
|
+
const metadata = toolMetadata.get(call.name);
|
|
160
|
+
return isReadOnlyTool(call.name, metadata?.annotations, metadata?.source);
|
|
161
|
+
});
|
|
145
162
|
if (allReadOnly) {
|
|
146
163
|
// Safe to use higher concurrency
|
|
147
164
|
return Math.min(maxReadOnlyConcurrency, toolCalls.length);
|
|
@@ -160,14 +177,18 @@ export function getOptimalConcurrency(toolCalls, tools, config) {
|
|
|
160
177
|
* @returns Object with readOnly and write arrays
|
|
161
178
|
*/
|
|
162
179
|
export function partitionToolCalls(toolCalls, tools) {
|
|
163
|
-
const
|
|
180
|
+
const toolMetadata = new Map();
|
|
164
181
|
for (const tool of tools) {
|
|
165
|
-
|
|
182
|
+
toolMetadata.set(tool.name, {
|
|
183
|
+
annotations: tool.annotations,
|
|
184
|
+
source: tool.source,
|
|
185
|
+
});
|
|
166
186
|
}
|
|
167
187
|
const readOnly = [];
|
|
168
188
|
const write = [];
|
|
169
189
|
for (const call of toolCalls) {
|
|
170
|
-
|
|
190
|
+
const metadata = toolMetadata.get(call.name);
|
|
191
|
+
if (isReadOnlyTool(call.name, metadata?.annotations, metadata?.source)) {
|
|
171
192
|
readOnly.push(call);
|
|
172
193
|
}
|
|
173
194
|
else {
|
|
@@ -176,6 +197,156 @@ export function partitionToolCalls(toolCalls, tools) {
|
|
|
176
197
|
}
|
|
177
198
|
return { readOnly, write };
|
|
178
199
|
}
|
|
200
|
+
const PATH_SCOPED_MUTATION_TOOLS = new Set([
|
|
201
|
+
"apply_patch",
|
|
202
|
+
"write",
|
|
203
|
+
"Write",
|
|
204
|
+
"edit",
|
|
205
|
+
"Edit",
|
|
206
|
+
"MultiEdit",
|
|
207
|
+
"notebook_edit",
|
|
208
|
+
"NotebookEdit",
|
|
209
|
+
]);
|
|
210
|
+
const PATH_ARGUMENT_KEYS = new Set([
|
|
211
|
+
"file",
|
|
212
|
+
"file_path",
|
|
213
|
+
"filePath",
|
|
214
|
+
"files",
|
|
215
|
+
"path",
|
|
216
|
+
"paths",
|
|
217
|
+
"target",
|
|
218
|
+
"targets",
|
|
219
|
+
"target_path",
|
|
220
|
+
"targetPath",
|
|
221
|
+
"notebook_path",
|
|
222
|
+
"notebookPath",
|
|
223
|
+
"output_path",
|
|
224
|
+
"outputPath",
|
|
225
|
+
]);
|
|
226
|
+
const PATH_ARGUMENT_CONTAINER_KEYS = new Set([
|
|
227
|
+
"edits",
|
|
228
|
+
"operations",
|
|
229
|
+
"patches",
|
|
230
|
+
]);
|
|
231
|
+
const PATCH_ARGUMENT_KEYS = new Set(["patch", "patch_text", "patchText"]);
|
|
232
|
+
function normalizeMutationPath(value, cwd = process.cwd()) {
|
|
233
|
+
const input = value.trim().replace(/\\/g, "/");
|
|
234
|
+
if (!input || /[*?[\]{}]/u.test(input)) {
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
const basePath = cwd.replace(/\\/g, "/");
|
|
238
|
+
let normalized = (isAbsolute(input) ? resolve(input) : resolve(basePath, input))
|
|
239
|
+
.replace(/\\/g, "/")
|
|
240
|
+
.replace(/\/+/g, "/");
|
|
241
|
+
normalized = normalized.toLowerCase();
|
|
242
|
+
if (normalized.length > 1) {
|
|
243
|
+
normalized = normalized.replace(/\/$/u, "");
|
|
244
|
+
}
|
|
245
|
+
return normalized || undefined;
|
|
246
|
+
}
|
|
247
|
+
function collectPathArgumentValues(value, paths, cwd, matchedKeys, stringIsPath) {
|
|
248
|
+
if (typeof value === "string") {
|
|
249
|
+
if (stringIsPath) {
|
|
250
|
+
const path = normalizeMutationPath(value, cwd);
|
|
251
|
+
if (path) {
|
|
252
|
+
paths.push(path);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (Array.isArray(value)) {
|
|
258
|
+
for (const entry of value) {
|
|
259
|
+
collectPathArgumentValues(entry, paths, cwd, matchedKeys, stringIsPath);
|
|
260
|
+
}
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (value && typeof value === "object") {
|
|
264
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
265
|
+
if (PATH_ARGUMENT_KEYS.has(key)) {
|
|
266
|
+
matchedKeys.add(key);
|
|
267
|
+
collectPathArgumentValues(nested, paths, cwd, matchedKeys, true);
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (PATCH_ARGUMENT_KEYS.has(key)) {
|
|
271
|
+
matchedKeys.add(key);
|
|
272
|
+
collectPatchHeaderPaths(nested, paths, cwd, matchedKeys);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (PATH_ARGUMENT_CONTAINER_KEYS.has(key)) {
|
|
276
|
+
matchedKeys.add(key);
|
|
277
|
+
collectPathArgumentValues(nested, paths, cwd, matchedKeys, false);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function collectPatchHeaderPaths(value, paths, cwd, matchedKeys) {
|
|
283
|
+
if (typeof value === "string") {
|
|
284
|
+
for (const match of value.matchAll(/^\*\*\* (?:Update File|Add File|Delete File|Move to):\s+(.+)$/gmu)) {
|
|
285
|
+
const rawPath = match[1]?.trim();
|
|
286
|
+
if (!rawPath)
|
|
287
|
+
continue;
|
|
288
|
+
const path = normalizeMutationPath(rawPath, cwd);
|
|
289
|
+
if (path) {
|
|
290
|
+
paths.push(path);
|
|
291
|
+
matchedKeys.add("patch");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (Array.isArray(value)) {
|
|
297
|
+
for (const entry of value) {
|
|
298
|
+
collectPatchHeaderPaths(entry, paths, cwd, matchedKeys);
|
|
299
|
+
}
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (value && typeof value === "object") {
|
|
303
|
+
collectPathArgumentValues(value, paths, cwd, matchedKeys, false);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
export function getPathScopedMutation(toolCall, tool, cwd = process.cwd()) {
|
|
307
|
+
const annotations = tool?.annotations;
|
|
308
|
+
const source = annotations?.pathScopedMutationHint === true ? "annotation" : "known_tool";
|
|
309
|
+
const isPathScopedTool = annotations?.pathScopedMutationHint === true ||
|
|
310
|
+
PATH_SCOPED_MUTATION_TOOLS.has(tool?.name ?? toolCall.name);
|
|
311
|
+
if (!isPathScopedTool || annotations?.readOnlyHint === true) {
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
const args = toolCall.arguments &&
|
|
315
|
+
typeof toolCall.arguments === "object" &&
|
|
316
|
+
!Array.isArray(toolCall.arguments)
|
|
317
|
+
? toolCall.arguments
|
|
318
|
+
: undefined;
|
|
319
|
+
if (!args) {
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
const paths = [];
|
|
323
|
+
const matchedKeys = new Set();
|
|
324
|
+
for (const [key, value] of Object.entries(args)) {
|
|
325
|
+
if (PATH_ARGUMENT_KEYS.has(key)) {
|
|
326
|
+
matchedKeys.add(key);
|
|
327
|
+
collectPathArgumentValues(value, paths, cwd, matchedKeys, true);
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
if (PATCH_ARGUMENT_KEYS.has(key)) {
|
|
331
|
+
matchedKeys.add(key);
|
|
332
|
+
collectPatchHeaderPaths(value, paths, cwd, matchedKeys);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (PATH_ARGUMENT_CONTAINER_KEYS.has(key)) {
|
|
336
|
+
matchedKeys.add(key);
|
|
337
|
+
collectPathArgumentValues(value, paths, cwd, matchedKeys, false);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
const uniquePaths = [...new Set(paths)];
|
|
341
|
+
return uniquePaths.length > 0
|
|
342
|
+
? { paths: uniquePaths, source, argumentKeys: [...matchedKeys].sort() }
|
|
343
|
+
: undefined;
|
|
344
|
+
}
|
|
345
|
+
export function pathScopesOverlap(left, right) {
|
|
346
|
+
return left.paths.some((leftPath) => right.paths.some((rightPath) => leftPath === rightPath ||
|
|
347
|
+
leftPath.startsWith(`${rightPath}/`) ||
|
|
348
|
+
rightPath.startsWith(`${leftPath}/`)));
|
|
349
|
+
}
|
|
179
350
|
/**
|
|
180
351
|
* Add read-only annotation to a tool definition.
|
|
181
352
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel-execution.js","sourceRoot":"","sources":["../../src/tools/parallel-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IACtC,eAAe;IACf,MAAM;IACN,MAAM;IACN,oBAAoB;IACpB,IAAI;IACJ,MAAM;IACN,eAAe;IACf,MAAM;IACN,MAAM;IACN,iBAAiB;IACjB,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,6BAA6B;IAC7B,MAAM;IACN,cAAc;IACd,QAAQ;IACR,sBAAsB;IACtB,kBAAkB;IAClB,0BAA0B;IAC1B,uBAAuB;IACvB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,4BAA4B;IAC5B,0BAA0B;IAC1B,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,6BAA6B;IAC7B,KAAK;CACL,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAClC,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,WAAW;IACX,eAAe;IACf,cAAc;IACd,MAAM;IACN,MAAM;IACN,kBAAkB;CAClB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC7B,QAAgB,EAChB,WAA6B;IAE7B,kCAAkC;IAClC,IAAI,WAAW,EAAE,YAAY,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,WAAW,EAAE,YAAY,KAAK,KAAK,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,gCAAgC;IAChC,OAA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A8C;IAC9C,OAAO,eAAe,CAAC;AACxB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CACjC,SAAc,EACd,KAAkB;IAElB,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuC,CAAC;IACvE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,MAAM,KAAK,GAAQ,EAAE,CAAC;IAEtB,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC9B,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC/D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACP,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;IACF,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAsB,IAAO;IACxD,OAAO;QACN,GAAG,IAAI;QACP,WAAW,EAAE;YACZ,GAAG,IAAI,CAAC,WAAW;YACnB,YAAY,EAAE,IAAI;SAClB;KACD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAsB,IAAO;IAC3D,OAAO;QACN,GAAG,IAAI;QACP,WAAW,EAAE;YACZ,GAAG,IAAI,CAAC,WAAW;YACnB,eAAe,EAAE,IAAI;SACrB;KACD,CAAC;AACH,CAAC","sourcesContent":["/**\n * Parallel Execution - Optimized concurrent tool execution for read-only operations\n *\n * This module provides utilities for safely increasing concurrency when executing\n * read-only tools. Read-only tools can run in parallel without risk of conflicts,\n * enabling significant latency improvements for batch operations.\n *\n * ## Read-Only Tools\n *\n * Tools are considered read-only if they:\n * - Do not modify files or system state\n * - Are idempotent (same input = same output)\n * - Have no side effects on external systems\n *\n * Examples: read, list, find, search, diff, status\n *\n * ## Usage\n *\n * ```typescript\n * import { isReadOnlyTool, getOptimalConcurrency } from './parallel-execution.js';\n *\n * const tools = [readTool, listTool, findTool];\n * const allReadOnly = tools.every(t => isReadOnlyTool(t.name));\n * const concurrency = getOptimalConcurrency(tools, baseConcurrency);\n * ```\n *\n * @module tools/parallel-execution\n */\n\nimport type { AgentTool, ToolAnnotations } from \"../agent/types.js\";\n\n/**\n * Set of known read-only tool names.\n *\n * These tools are safe to execute in parallel because they:\n * - Only read data, never modify it\n * - Have no side effects\n * - Are idempotent\n */\nexport const READ_ONLY_TOOLS = new Set([\n\t// File reading\n\t\"Read\",\n\t\"read\",\n\t// Directory listing\n\t\"LS\",\n\t\"list\",\n\t// File finding\n\t\"Glob\",\n\t\"find\",\n\t// Content search\n\t\"Grep\",\n\t\"search\",\n\t\"parallel_ripgrep\",\n\t// Git operations (read-only)\n\t\"diff\",\n\t// System info\n\t\"status\",\n\t// Document extraction\n\t\"extract_document\",\n\t// VS Code read operations\n\t\"vscode_get_definition\",\n\t\"vscode_find_references\",\n\t\"vscode_get_diagnostics\",\n\t\"vscode_read_file_range\",\n\t// JetBrains read operations\n\t\"jetbrains_get_definition\",\n\t\"jetbrains_find_references\",\n\t\"jetbrains_get_diagnostics\",\n\t\"jetbrains_read_file_range\",\n\t// LSP operations (read-only)\n\t\"LSP\",\n]);\n\n/**\n * Set of known write/mutating tool names.\n *\n * These tools modify state and should not run concurrently with\n * operations on the same resources.\n */\nexport const WRITE_TOOLS = new Set([\n\t\"write\",\n\t\"Write\",\n\t\"edit\",\n\t\"Edit\",\n\t\"MultiEdit\",\n\t\"notebook_edit\",\n\t\"NotebookEdit\",\n\t\"bash\",\n\t\"Bash\",\n\t\"background_tasks\",\n]);\n\n/**\n * Check if a tool is read-only based on its name or annotations.\n *\n * @param toolName - Name of the tool\n * @param annotations - Optional tool annotations\n * @returns true if the tool is read-only\n */\nexport function isReadOnlyTool(\n\ttoolName: string,\n\tannotations?: ToolAnnotations,\n): boolean {\n\t// Check explicit annotation first\n\tif (annotations?.readOnlyHint === true) {\n\t\treturn true;\n\t}\n\tif (annotations?.readOnlyHint === false) {\n\t\treturn false;\n\t}\n\n\t// Fall back to known tool lists\n\treturn READ_ONLY_TOOLS.has(toolName);\n}\n\n/**\n * Check if a tool is a write/mutating operation.\n *\n * @param toolName - Name of the tool\n * @param annotations - Optional tool annotations\n * @returns true if the tool modifies state\n */\nexport function isWriteTool(\n\ttoolName: string,\n\tannotations?: ToolAnnotations,\n): boolean {\n\t// Check explicit annotation\n\tif (annotations?.destructiveHint === true) {\n\t\treturn true;\n\t}\n\n\treturn WRITE_TOOLS.has(toolName);\n}\n\n/**\n * Configuration for parallel execution optimization.\n */\nexport interface ParallelExecutionConfig {\n\t/** Base concurrency limit (default: 2) */\n\tbaseConcurrency?: number;\n\t/** Maximum concurrency for read-only batches (default: 8) */\n\tmaxReadOnlyConcurrency?: number;\n\t/** Whether to enable parallel optimization (default: true) */\n\tenabled?: boolean;\n}\n\n/**\n * Get the optimal concurrency level for a batch of tool calls.\n *\n * When all tools in a batch are read-only, we can safely increase\n * concurrency to improve latency. Write operations force serialization.\n *\n * @param toolCalls - Array of tool calls to analyze\n * @param tools - Tool definitions (for annotation lookup)\n * @param config - Parallel execution configuration\n * @returns Optimal concurrency level for this batch\n */\nexport function getOptimalConcurrency(\n\ttoolCalls: Array<{ name: string }>,\n\ttools: AgentTool[],\n\tconfig?: ParallelExecutionConfig,\n): number {\n\tconst baseConcurrency = config?.baseConcurrency ?? 2;\n\tconst maxReadOnlyConcurrency = config?.maxReadOnlyConcurrency ?? 8;\n\tconst enabled = config?.enabled ?? true;\n\n\tif (!enabled || toolCalls.length === 0) {\n\t\treturn baseConcurrency;\n\t}\n\n\t// Build a map of tool names to annotations\n\tconst toolAnnotations = new Map<string, ToolAnnotations | undefined>();\n\tfor (const tool of tools) {\n\t\ttoolAnnotations.set(tool.name, tool.annotations);\n\t}\n\n\t// Check if all tools are read-only\n\tconst allReadOnly = toolCalls.every((call) =>\n\t\tisReadOnlyTool(call.name, toolAnnotations.get(call.name)),\n\t);\n\n\tif (allReadOnly) {\n\t\t// Safe to use higher concurrency\n\t\treturn Math.min(maxReadOnlyConcurrency, toolCalls.length);\n\t}\n\n\t// Has write operations - use base concurrency\n\treturn baseConcurrency;\n}\n\n/**\n * Partition tool calls into read-only and write batches.\n *\n * This enables executing all read-only operations in parallel first,\n * then executing write operations with appropriate ordering.\n *\n * @param toolCalls - Array of tool calls\n * @param tools - Tool definitions\n * @returns Object with readOnly and write arrays\n */\nexport function partitionToolCalls<T extends { name: string }>(\n\ttoolCalls: T[],\n\ttools: AgentTool[],\n): { readOnly: T[]; write: T[] } {\n\tconst toolAnnotations = new Map<string, ToolAnnotations | undefined>();\n\tfor (const tool of tools) {\n\t\ttoolAnnotations.set(tool.name, tool.annotations);\n\t}\n\n\tconst readOnly: T[] = [];\n\tconst write: T[] = [];\n\n\tfor (const call of toolCalls) {\n\t\tif (isReadOnlyTool(call.name, toolAnnotations.get(call.name))) {\n\t\t\treadOnly.push(call);\n\t\t} else {\n\t\t\twrite.push(call);\n\t\t}\n\t}\n\n\treturn { readOnly, write };\n}\n\n/**\n * Add read-only annotation to a tool definition.\n *\n * Use this to mark custom tools as read-only for parallel execution.\n *\n * @param tool - Tool definition to annotate\n * @returns Tool with readOnlyHint annotation\n */\nexport function markReadOnly<T extends AgentTool>(tool: T): T {\n\treturn {\n\t\t...tool,\n\t\tannotations: {\n\t\t\t...tool.annotations,\n\t\t\treadOnlyHint: true,\n\t\t},\n\t};\n}\n\n/**\n * Add write/destructive annotation to a tool definition.\n *\n * @param tool - Tool definition to annotate\n * @returns Tool with destructiveHint annotation\n */\nexport function markDestructive<T extends AgentTool>(tool: T): T {\n\treturn {\n\t\t...tool,\n\t\tannotations: {\n\t\t\t...tool.annotations,\n\t\t\tdestructiveHint: true,\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parallel-execution.js","sourceRoot":"","sources":["../../src/tools/parallel-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOhD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IACtC,eAAe;IACf,MAAM;IACN,MAAM;IACN,oBAAoB;IACpB,IAAI;IACJ,MAAM;IACN,eAAe;IACf,MAAM;IACN,MAAM;IACN,iBAAiB;IACjB,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,6BAA6B;IAC7B,MAAM;IACN,cAAc;IACd,QAAQ;IACR,sBAAsB;IACtB,kBAAkB;IAClB,0BAA0B;IAC1B,uBAAuB;IACvB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,4BAA4B;IAC5B,0BAA0B;IAC1B,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,6BAA6B;IAC7B,KAAK;CACL,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAClC,aAAa;IACb,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,WAAW;IACX,eAAe;IACf,cAAc;IACd,MAAM;IACN,MAAM;IACN,kBAAkB;CAClB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC7B,QAAgB,EAChB,WAA6B,EAC7B,OAA4B;IAE5B,kCAAkC;IAClC,IAAI,WAAW,EAAE,YAAY,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,WAAW,EAAE,YAAY,KAAK,KAAK,EAAE,CAAC;QACzC,OAA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AU,CAAC,GAAG,SAAS,GAAG,CAAC;QACpC,SAAS,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,CAAC,CACrC,CACD,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAsB,IAAO;IACxD,OAAO;QACN,GAAG,IAAI;QACP,WAAW,EAAE;YACZ,GAAG,IAAI,CAAC,WAAW;YACnB,YAAY,EAAE,IAAI;SAClB;KACD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAsB,IAAO;IAC3D,OAAO;QACN,GAAG,IAAI;QACP,WAAW,EAAE;YACZ,GAAG,IAAI,CAAC,WAAW;YACnB,eAAe,EAAE,IAAI;SACrB;KACD,CAAC;AACH,CAAC","sourcesContent":["/**\n * Parallel Execution - Optimized concurrent tool execution for read-only operations\n *\n * This module provides utilities for safely increasing concurrency when executing\n * read-only tools. Read-only tools can run in parallel without risk of conflicts,\n * enabling significant latency improvements for batch operations.\n *\n * ## Read-Only Tools\n *\n * Tools are considered read-only if they:\n * - Do not modify files or system state\n * - Are idempotent (same input = same output)\n * - Have no side effects on external systems\n *\n * Examples: read, list, find, search, diff, status\n *\n * ## Usage\n *\n * ```typescript\n * import { isReadOnlyTool, getOptimalConcurrency } from './parallel-execution.js';\n *\n * const tools = [readTool, listTool, findTool];\n * const allReadOnly = tools.every(t => isReadOnlyTool(t.name));\n * const concurrency = getOptimalConcurrency(tools, baseConcurrency);\n * ```\n *\n * @module tools/parallel-execution\n */\n\nimport { isAbsolute, resolve } from \"node:path\";\nimport type {\n\tAgentTool,\n\tToolAnnotations,\n\tToolSourceMetadata,\n} from \"../agent/types.js\";\n\n/**\n * Set of known read-only tool names.\n *\n * These tools are safe to execute in parallel because they:\n * - Only read data, never modify it\n * - Have no side effects\n * - Are idempotent\n */\nexport const READ_ONLY_TOOLS = new Set([\n\t// File reading\n\t\"Read\",\n\t\"read\",\n\t// Directory listing\n\t\"LS\",\n\t\"list\",\n\t// File finding\n\t\"Glob\",\n\t\"find\",\n\t// Content search\n\t\"Grep\",\n\t\"search\",\n\t\"parallel_ripgrep\",\n\t// Git operations (read-only)\n\t\"diff\",\n\t// System info\n\t\"status\",\n\t// Document extraction\n\t\"extract_document\",\n\t// VS Code read operations\n\t\"vscode_get_definition\",\n\t\"vscode_find_references\",\n\t\"vscode_get_diagnostics\",\n\t\"vscode_read_file_range\",\n\t// JetBrains read operations\n\t\"jetbrains_get_definition\",\n\t\"jetbrains_find_references\",\n\t\"jetbrains_get_diagnostics\",\n\t\"jetbrains_read_file_range\",\n\t// LSP operations (read-only)\n\t\"LSP\",\n]);\n\n/**\n * Set of known write/mutating tool names.\n *\n * These tools modify state and should not run concurrently with\n * operations on the same resources.\n */\nexport const WRITE_TOOLS = new Set([\n\t\"apply_patch\",\n\t\"write\",\n\t\"Write\",\n\t\"edit\",\n\t\"Edit\",\n\t\"MultiEdit\",\n\t\"notebook_edit\",\n\t\"NotebookEdit\",\n\t\"bash\",\n\t\"Bash\",\n\t\"background_tasks\",\n]);\n\n/**\n * Check if a tool is read-only based on its name or annotations.\n *\n * @param toolName - Name of the tool\n * @param annotations - Optional tool annotations\n * @returns true if the tool is read-only\n */\nexport function isReadOnlyTool(\n\ttoolName: string,\n\tannotations?: ToolAnnotations,\n\t_source?: ToolSourceMetadata,\n): boolean {\n\t// Check explicit annotation first\n\tif (annotations?.readOnlyHint === true) {\n\t\treturn true;\n\t}\n\tif (annotations?.readOnlyHint === false) {\n\t\treturn false;\n\t}\n\n\t// Fall back to known tool lists\n\treturn READ_ONLY_TOOLS.has(toolName);\n}\n\nexport function isParallelSafeTool(\n\ttoolName: string,\n\tannotations?: ToolAnnotations,\n\tsource?: ToolSourceMetadata,\n): boolean {\n\tif (isReadOnlyTool(toolName, annotations, source)) {\n\t\treturn true;\n\t}\n\tif (annotations?.destructiveHint === true) {\n\t\treturn false;\n\t}\n\treturn source?.type === \"mcp\" && source.supportsParallelToolCalls === true;\n}\n\n/**\n * Check if a tool is a write/mutating operation.\n *\n * @param toolName - Name of the tool\n * @param annotations - Optional tool annotations\n * @returns true if the tool modifies state\n */\nexport function isWriteTool(\n\ttoolName: string,\n\tannotations?: ToolAnnotations,\n): boolean {\n\t// Check explicit annotation\n\tif (annotations?.destructiveHint === true) {\n\t\treturn true;\n\t}\n\n\treturn WRITE_TOOLS.has(toolName);\n}\n\n/**\n * Configuration for parallel execution optimization.\n */\nexport interface ParallelExecutionConfig {\n\t/** Base concurrency limit (default: 2) */\n\tbaseConcurrency?: number;\n\t/** Maximum concurrency for read-only batches (default: 8) */\n\tmaxReadOnlyConcurrency?: number;\n\t/** Whether to enable parallel optimization (default: true) */\n\tenabled?: boolean;\n}\n\n/**\n * Get the optimal concurrency level for a batch of tool calls.\n *\n * When all tools in a batch are read-only, we can safely increase\n * concurrency to improve latency. Write operations force serialization.\n *\n * @param toolCalls - Array of tool calls to analyze\n * @param tools - Tool definitions (for annotation lookup)\n * @param config - Parallel execution configuration\n * @returns Optimal concurrency level for this batch\n */\nexport function getOptimalConcurrency(\n\ttoolCalls: Array<{ name: string }>,\n\ttools: AgentTool[],\n\tconfig?: ParallelExecutionConfig,\n): number {\n\tconst baseConcurrency = config?.baseConcurrency ?? 2;\n\tconst maxReadOnlyConcurrency = config?.maxReadOnlyConcurrency ?? 8;\n\tconst enabled = config?.enabled ?? true;\n\n\tif (!enabled || toolCalls.length === 0) {\n\t\treturn baseConcurrency;\n\t}\n\n\t// Build a map of tool names to annotations\n\tconst toolMetadata = new Map<\n\t\tstring,\n\t\t{ annotations?: ToolAnnotations; source?: ToolSourceMetadata }\n\t>();\n\tfor (const tool of tools) {\n\t\ttoolMetadata.set(tool.name, {\n\t\t\tannotations: tool.annotations,\n\t\t\tsource: tool.source,\n\t\t});\n\t}\n\n\t// Check if all tools are read-only\n\tconst allReadOnly = toolCalls.every((call) => {\n\t\tconst metadata = toolMetadata.get(call.name);\n\t\treturn isReadOnlyTool(call.name, metadata?.annotations, metadata?.source);\n\t});\n\n\tif (allReadOnly) {\n\t\t// Safe to use higher concurrency\n\t\treturn Math.min(maxReadOnlyConcurrency, toolCalls.length);\n\t}\n\n\t// Has write operations - use base concurrency\n\treturn baseConcurrency;\n}\n\n/**\n * Partition tool calls into read-only and write batches.\n *\n * This enables executing all read-only operations in parallel first,\n * then executing write operations with appropriate ordering.\n *\n * @param toolCalls - Array of tool calls\n * @param tools - Tool definitions\n * @returns Object with readOnly and write arrays\n */\nexport function partitionToolCalls<T extends { name: string }>(\n\ttoolCalls: T[],\n\ttools: AgentTool[],\n): { readOnly: T[]; write: T[] } {\n\tconst toolMetadata = new Map<\n\t\tstring,\n\t\t{ annotations?: ToolAnnotations; source?: ToolSourceMetadata }\n\t>();\n\tfor (const tool of tools) {\n\t\ttoolMetadata.set(tool.name, {\n\t\t\tannotations: tool.annotations,\n\t\t\tsource: tool.source,\n\t\t});\n\t}\n\n\tconst readOnly: T[] = [];\n\tconst write: T[] = [];\n\n\tfor (const call of toolCalls) {\n\t\tconst metadata = toolMetadata.get(call.name);\n\t\tif (isReadOnlyTool(call.name, metadata?.annotations, metadata?.source)) {\n\t\t\treadOnly.push(call);\n\t\t} else {\n\t\t\twrite.push(call);\n\t\t}\n\t}\n\n\treturn { readOnly, write };\n}\n\nexport interface PathScopedMutation {\n\tpaths: string[];\n\tsource: \"annotation\" | \"known_tool\";\n\targumentKeys?: string[];\n}\n\nconst PATH_SCOPED_MUTATION_TOOLS = new Set([\n\t\"apply_patch\",\n\t\"write\",\n\t\"Write\",\n\t\"edit\",\n\t\"Edit\",\n\t\"MultiEdit\",\n\t\"notebook_edit\",\n\t\"NotebookEdit\",\n]);\n\nconst PATH_ARGUMENT_KEYS = new Set([\n\t\"file\",\n\t\"file_path\",\n\t\"filePath\",\n\t\"files\",\n\t\"path\",\n\t\"paths\",\n\t\"target\",\n\t\"targets\",\n\t\"target_path\",\n\t\"targetPath\",\n\t\"notebook_path\",\n\t\"notebookPath\",\n\t\"output_path\",\n\t\"outputPath\",\n]);\n\nconst PATH_ARGUMENT_CONTAINER_KEYS = new Set([\n\t\"edits\",\n\t\"operations\",\n\t\"patches\",\n]);\n\nconst PATCH_ARGUMENT_KEYS = new Set([\"patch\", \"patch_text\", \"patchText\"]);\n\nfunction normalizeMutationPath(\n\tvalue: string,\n\tcwd = process.cwd(),\n): string | undefined {\n\tconst input = value.trim().replace(/\\\\/g, \"/\");\n\tif (!input || /[*?[\\]{}]/u.test(input)) {\n\t\treturn undefined;\n\t}\n\tconst basePath = cwd.replace(/\\\\/g, \"/\");\n\tlet normalized = (\n\t\tisAbsolute(input) ? resolve(input) : resolve(basePath, input)\n\t)\n\t\t.replace(/\\\\/g, \"/\")\n\t\t.replace(/\\/+/g, \"/\");\n\tnormalized = normalized.toLowerCase();\n\tif (normalized.length > 1) {\n\t\tnormalized = normalized.replace(/\\/$/u, \"\");\n\t}\n\treturn normalized || undefined;\n}\n\nfunction collectPathArgumentValues(\n\tvalue: unknown,\n\tpaths: string[],\n\tcwd: string,\n\tmatchedKeys: Set<string>,\n\tstringIsPath: boolean,\n): void {\n\tif (typeof value === \"string\") {\n\t\tif (stringIsPath) {\n\t\t\tconst path = normalizeMutationPath(value, cwd);\n\t\t\tif (path) {\n\t\t\t\tpaths.push(path);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const entry of value) {\n\t\t\tcollectPathArgumentValues(entry, paths, cwd, matchedKeys, stringIsPath);\n\t\t}\n\t\treturn;\n\t}\n\tif (value && typeof value === \"object\") {\n\t\tfor (const [key, nested] of Object.entries(\n\t\t\tvalue as Record<string, unknown>,\n\t\t)) {\n\t\t\tif (PATH_ARGUMENT_KEYS.has(key)) {\n\t\t\t\tmatchedKeys.add(key);\n\t\t\t\tcollectPathArgumentValues(nested, paths, cwd, matchedKeys, true);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (PATCH_ARGUMENT_KEYS.has(key)) {\n\t\t\t\tmatchedKeys.add(key);\n\t\t\t\tcollectPatchHeaderPaths(nested, paths, cwd, matchedKeys);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (PATH_ARGUMENT_CONTAINER_KEYS.has(key)) {\n\t\t\t\tmatchedKeys.add(key);\n\t\t\t\tcollectPathArgumentValues(nested, paths, cwd, matchedKeys, false);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction collectPatchHeaderPaths(\n\tvalue: unknown,\n\tpaths: string[],\n\tcwd: string,\n\tmatchedKeys: Set<string>,\n): void {\n\tif (typeof value === \"string\") {\n\t\tfor (const match of value.matchAll(\n\t\t\t/^\\*\\*\\* (?:Update File|Add File|Delete File|Move to):\\s+(.+)$/gmu,\n\t\t)) {\n\t\t\tconst rawPath = match[1]?.trim();\n\t\t\tif (!rawPath) continue;\n\t\t\tconst path = normalizeMutationPath(rawPath, cwd);\n\t\t\tif (path) {\n\t\t\t\tpaths.push(path);\n\t\t\t\tmatchedKeys.add(\"patch\");\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const entry of value) {\n\t\t\tcollectPatchHeaderPaths(entry, paths, cwd, matchedKeys);\n\t\t}\n\t\treturn;\n\t}\n\tif (value && typeof value === \"object\") {\n\t\tcollectPathArgumentValues(value, paths, cwd, matchedKeys, false);\n\t}\n}\n\nexport function getPathScopedMutation(\n\ttoolCall: { name: string; arguments?: unknown },\n\ttool?: AgentTool,\n\tcwd = process.cwd(),\n): PathScopedMutation | undefined {\n\tconst annotations = tool?.annotations;\n\tconst source =\n\t\tannotations?.pathScopedMutationHint === true ? \"annotation\" : \"known_tool\";\n\tconst isPathScopedTool =\n\t\tannotations?.pathScopedMutationHint === true ||\n\t\tPATH_SCOPED_MUTATION_TOOLS.has(tool?.name ?? toolCall.name);\n\tif (!isPathScopedTool || annotations?.readOnlyHint === true) {\n\t\treturn undefined;\n\t}\n\tconst args =\n\t\ttoolCall.arguments &&\n\t\ttypeof toolCall.arguments === \"object\" &&\n\t\t!Array.isArray(toolCall.arguments)\n\t\t\t? (toolCall.arguments as Record<string, unknown>)\n\t\t\t: undefined;\n\tif (!args) {\n\t\treturn undefined;\n\t}\n\tconst paths: string[] = [];\n\tconst matchedKeys = new Set<string>();\n\tfor (const [key, value] of Object.entries(args)) {\n\t\tif (PATH_ARGUMENT_KEYS.has(key)) {\n\t\t\tmatchedKeys.add(key);\n\t\t\tcollectPathArgumentValues(value, paths, cwd, matchedKeys, true);\n\t\t\tcontinue;\n\t\t}\n\t\tif (PATCH_ARGUMENT_KEYS.has(key)) {\n\t\t\tmatchedKeys.add(key);\n\t\t\tcollectPatchHeaderPaths(value, paths, cwd, matchedKeys);\n\t\t\tcontinue;\n\t\t}\n\t\tif (PATH_ARGUMENT_CONTAINER_KEYS.has(key)) {\n\t\t\tmatchedKeys.add(key);\n\t\t\tcollectPathArgumentValues(value, paths, cwd, matchedKeys, false);\n\t\t}\n\t}\n\tconst uniquePaths = [...new Set(paths)];\n\treturn uniquePaths.length > 0\n\t\t? { paths: uniquePaths, source, argumentKeys: [...matchedKeys].sort() }\n\t\t: undefined;\n}\n\nexport function pathScopesOverlap(\n\tleft: PathScopedMutation,\n\tright: PathScopedMutation,\n): boolean {\n\treturn left.paths.some((leftPath) =>\n\t\tright.paths.some(\n\t\t\t(rightPath) =>\n\t\t\t\tleftPath === rightPath ||\n\t\t\t\tleftPath.startsWith(`${rightPath}/`) ||\n\t\t\t\trightPath.startsWith(`${leftPath}/`),\n\t\t),\n\t);\n}\n\n/**\n * Add read-only annotation to a tool definition.\n *\n * Use this to mark custom tools as read-only for parallel execution.\n *\n * @param tool - Tool definition to annotate\n * @returns Tool with readOnlyHint annotation\n */\nexport function markReadOnly<T extends AgentTool>(tool: T): T {\n\treturn {\n\t\t...tool,\n\t\tannotations: {\n\t\t\t...tool.annotations,\n\t\t\treadOnlyHint: true,\n\t\t},\n\t};\n}\n\n/**\n * Add write/destructive annotation to a tool definition.\n *\n * @param tool - Tool definition to annotate\n * @returns Tool with destructiveHint annotation\n */\nexport function markDestructive<T extends AgentTool>(tool: T): T {\n\treturn {\n\t\t...tool,\n\t\tannotations: {\n\t\t\t...tool.annotations,\n\t\t\tdestructiveHint: true,\n\t\t},\n\t};\n}\n"]}
|
|
@@ -75,6 +75,7 @@ export declare const parallelRipgrepTool: Readonly<{
|
|
|
75
75
|
headLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
76
76
|
}>;
|
|
77
77
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
78
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
78
79
|
toolType: string | undefined;
|
|
79
80
|
inputExamples: unknown[] | undefined;
|
|
80
81
|
allowedCallers: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel-ripgrep.d.ts","sourceRoot":"","sources":["../../src/tools/parallel-ripgrep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA4GH;;;GAGG;AACH,KAAK,WAAW,GAAG;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,KAAK,sBAAsB,GAAG;IAC7B,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AA+HF,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"parallel-ripgrep.d.ts","sourceRoot":"","sources":["../../src/tools/parallel-ripgrep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA4GH;;;GAGG;AACH,KAAK,WAAW,GAAG;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,KAAK,sBAAsB,GAAG;IAC7B,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AA+HF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4N9B,CAAC"}
|
package/dist/tools/pipeline.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export declare const pipelineSearchContactsTool: Readonly<{
|
|
|
60
60
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
61
61
|
}>;
|
|
62
62
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
63
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
63
64
|
toolType: string | undefined;
|
|
64
65
|
inputExamples: unknown[] | undefined;
|
|
65
66
|
allowedCallers: string[] | undefined;
|
|
@@ -85,6 +86,7 @@ export declare const pipelineSearchDealsTool: Readonly<{
|
|
|
85
86
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
86
87
|
}>;
|
|
87
88
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
89
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
88
90
|
toolType: string | undefined;
|
|
89
91
|
inputExamples: unknown[] | undefined;
|
|
90
92
|
allowedCallers: string[] | undefined;
|
|
@@ -113,6 +115,7 @@ export declare const pipelineCreateSignalTool: Readonly<{
|
|
|
113
115
|
data: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
114
116
|
}>;
|
|
115
117
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
118
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
116
119
|
toolType: string | undefined;
|
|
117
120
|
inputExamples: unknown[] | undefined;
|
|
118
121
|
allowedCallers: string[] | undefined;
|
|
@@ -143,6 +146,7 @@ export declare const pipelineLogActivityTool: Readonly<{
|
|
|
143
146
|
occurredAt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
144
147
|
}>;
|
|
145
148
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
149
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
146
150
|
toolType: string | undefined;
|
|
147
151
|
inputExamples: unknown[] | undefined;
|
|
148
152
|
allowedCallers: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/tools/pipeline.ts"],"names":[],"mappings":"AAwCA,MAAM,WAAW,gBAAgB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC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IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IAC1C,KAAK,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmErC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;EAkElC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDnC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDlC,CAAC"}
|
package/dist/tools/read.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export declare const readTool: Readonly<{
|
|
|
70
70
|
encoding: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"utf-8">, import("@sinclair/typebox").TLiteral<"utf-16le">, import("@sinclair/typebox").TLiteral<"latin1">, import("@sinclair/typebox").TLiteral<"ascii">]>>;
|
|
71
71
|
}>;
|
|
72
72
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
73
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
73
74
|
toolType: string | undefined;
|
|
74
75
|
inputExamples: unknown[] | undefined;
|
|
75
76
|
allowedCallers: string[] | undefined;
|
package/dist/tools/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAoOH;;;GAGG;AACH,KAAK,eAAe,GAAG;IACtB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAoOH;;;GAGG;AACH,KAAK,eAAe,GAAG;IACtB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2ZnB,CAAC"}
|
package/dist/tools/search.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare const searchTool: Readonly<{
|
|
|
90
90
|
headLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
91
91
|
}>;
|
|
92
92
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
93
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
93
94
|
toolType: string | undefined;
|
|
94
95
|
inputExamples: unknown[] | undefined;
|
|
95
96
|
allowedCallers: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAIH,OAAO,EACN,KAAK,YAAY,EAMjB,MAAM,oBAAoB,CAAC;AAkI5B,KAAK,iBAAiB,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAIH,OAAO,EACN,KAAK,YAAY,EAMjB,MAAM,oBAAoB,CAAC;AAkI5B,KAAK,iBAAiB,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsUrB,CAAC"}
|
package/dist/tools/status.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const statusTool: Readonly<{
|
|
|
9
9
|
paths: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>]>>;
|
|
10
10
|
}>;
|
|
11
11
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
12
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
12
13
|
toolType: string | undefined;
|
|
13
14
|
inputExamples: unknown[] | undefined;
|
|
14
15
|
allowedCallers: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,WAAW,CAAC;AA0EjE,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,WAAW,CAAC;AA0EjE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;iBAEX,MAAM;iBAAW,YAAY;;iBAA7B,MAAM;iBAAW,YAAY;;EAyDvC,CAAC"}
|
package/dist/tools/todo.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export declare const todoTool: Readonly<{
|
|
|
122
122
|
includeSummary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
123
123
|
}>;
|
|
124
124
|
annotations: import("../agent/types.js").ToolAnnotations | undefined;
|
|
125
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
125
126
|
toolType: string | undefined;
|
|
126
127
|
inputExamples: unknown[] | undefined;
|
|
127
128
|
allowedCallers: string[] | undefined;
|
package/dist/tools/todo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todo.d.ts","sourceRoot":"","sources":["../../src/tools/todo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAiBH,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAIrD,QAAA,MAAM,aAAa;;;;CAIT,CAAC;AAEX,KAAK,SAAS,GAAG,MAAM,OAAO,aAAa,CAAC;AAqK5C,KAAK,cAAc,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;IAChD,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,EAAE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inclair/typebox";
|
|
67
|
-
import type { AgentToolResult, AgentToolUpdateCallback, ToolAnnotations } from "../agent/types.js";
|
|
67
|
+
import type { AgentToolResult, AgentToolUpdateCallback, ToolAnnotations, ToolSourceMetadata } from "../agent/types.js";
|
|
68
68
|
import type { Sandbox } from "../sandbox/types.js";
|
|
69
69
|
export declare class ToolResponseBuilder<Details> {
|
|
70
70
|
private _content;
|
|
@@ -89,6 +89,7 @@ export interface CreateToolOptions<Schema extends TSchema, Details> {
|
|
|
89
89
|
description: string;
|
|
90
90
|
schema: Schema;
|
|
91
91
|
annotations?: ToolAnnotations;
|
|
92
|
+
source?: ToolSourceMetadata;
|
|
92
93
|
toolType?: string;
|
|
93
94
|
inputExamples?: unknown[];
|
|
94
95
|
allowedCallers?: string[];
|
|
@@ -112,6 +113,7 @@ export declare function createTool<Schema extends TSchema, Details = undefined>(
|
|
|
112
113
|
description: string;
|
|
113
114
|
parameters: Schema;
|
|
114
115
|
annotations: ToolAnnotations | undefined;
|
|
116
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
115
117
|
toolType: string | undefined;
|
|
116
118
|
inputExamples: unknown[] | undefined;
|
|
117
119
|
allowedCallers: string[] | undefined;
|
|
@@ -142,6 +144,7 @@ export declare function createTextTool<Schema extends TSchema, Details = undefin
|
|
|
142
144
|
description: string;
|
|
143
145
|
parameters: Schema;
|
|
144
146
|
annotations: ToolAnnotations | undefined;
|
|
147
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
145
148
|
toolType: string | undefined;
|
|
146
149
|
inputExamples: unknown[] | undefined;
|
|
147
150
|
allowedCallers: string[] | undefined;
|
|
@@ -165,6 +168,7 @@ export declare function createJsonTool<Schema extends TSchema, Details = undefin
|
|
|
165
168
|
description: string;
|
|
166
169
|
parameters: Schema;
|
|
167
170
|
annotations: ToolAnnotations | undefined;
|
|
171
|
+
source: import("../agent/types.js").McpToolSourceMetadata | undefined;
|
|
168
172
|
toolType: string | undefined;
|
|
169
173
|
inputExamples: unknown[] | undefined;
|
|
170
174
|
allowedCallers: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-dsl.d.ts","sourceRoot":"","sources":["../../src/tools/tool-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EACX,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAmCnD,qBAAa,mBAAmB,CAAC,OAAO;IACvC,OAAO,CAAC,QAAQ,CAGP;IACT,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAS;IAEzB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK3B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAK7C,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAK9B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM5B,KAAK,IAAI,eAAe,CAAC,OAAO,CAAC;CAOjC;AAED,MAAM,WAAW,cAAc,CAAC,OAAO;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,OAAO,EAAE,OAAO;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CA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createTool(options) {
|
|
|
140
140
|
description: options.description,
|
|
141
141
|
parameters: options.schema,
|
|
142
142
|
annotations: options.annotations,
|
|
143
|
+
source: options.source,
|
|
143
144
|
toolType: options.toolType,
|
|
144
145
|
inputExamples: options.inputExamples,
|
|
145
146
|
allowedCallers: options.allowedCallers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-dsl.js","sourceRoot":"","sources":["../../src/tools/tool-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAGH,OAAO,EAAE,GAAG,EAA2C,MAAM,KAAK,CAAC;AACnE,OAAO,gBAAwC,MAAM,aAAa,CAAC;AAOnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,oFAAoF;AACpF,MAAM,UAAU,GAAG,oBAAoB,CAAgB,gBAAgB,CAAC,CAAC;AAEzE,wDAAwD;AACxD,IAAI,GAAG,GAAe,IAAI,CAAC;AAC3B,IAAI,CAAC;IACJ,GAAG,GAAG,IAAI,GAAG,CAAC;QACb,6DAA6D;QAC7D,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,IAAI,EAAE,iCAAiC;KACpD,CAAC,CAAC;IACH,UAAU,CAAC,GAAG,CAAC,CAAC;AACjB,CAAC;AAAC,MAAM,CAAC;IACR,qDAAqD;IACrD,GAAG,GAAG,IAAI,CAAC;AACZ,CAAC;AAED,+EAA+E;AAC/E,MAAM,cAAc,GAAG,IAAI,OAAO,EAA6B,CAAC;AAEhE,SAAS,qBAAqB,CAAC,MAAe;IAC7C,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAEtB,IAAI,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,QAAQ,GAAG,GAAG,CAAC,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OAAO,CAAC,CAAC;YAClD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAoBD,MAAM,UAAU,cAAc,CAC7B,OAA+C;IAE/C,OAAO,UAAU,CAAkB;QAClC,GAAG,OAAO;QACV,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;YAC9B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAClD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO,MAAM,CAAC;YACf,CAAC;YACD,IAAI,MAAM,YAAY,mBAAmB,EAAE,CAAC;gBAC3C,OAAO,MAAM,CAAC;YACf,CAAC;YACD,IAAI,iBAAiB,CAAU,MAAM,CAAC,EAAE,CAAC;gBACxC,OAAO,MAAM,CAAC;YACf,CAAC;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CACzB,KAAc;IAEd,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,KAAK,CAAC,OAAO,CAAE,KAAkC,CAAC,OAAO,CAAC,CAC1D,CAAC;AACH,CAAC","sourcesContent":["/**\n * Tool DSL - Domain-Specific Language for Creating Agent Tools\n *\n * This module provides a fluent, type-safe API for defining tools that can be\n * executed by the Composer agent. It handles schema validation, response building,\n * retry logic, and sandbox integration.\n *\n * ## Architecture\n *\n * ```\n * ┌─────────────────────────────────────────────────────────────────┐\n * │ Tool Creation Flow │\n * ├─────────────────────────────────────────────────────────────────┤\n * │ createTool(options) │\n * │ │ │\n * │ ▼ │\n * │ ┌─────────────┐ ┌──────────────┐ ┌─────────────────┐ │\n * │ │ Schema │───▶│ Validator │───▶│ execute() │ │\n * │ │ (TypeBox) │ │ (AJV) │ │ function │ │\n * │ └─────────────┘ └──────────────┘ └─────────────────┘ │\n * │ │ │\n * │ ▼ │\n * │ ┌─────────────────────────────────────┐ │\n * │ │ ToolResponseBuilder │ │\n * │ │ - text(), image(), error() │ │\n * │ │ - detail() for structured data │ │\n * │ └─────────────────────────────────────┘ │\n * └─────────────────────────────────────────────────────────────────┘\n * ```\n *\n * ## Tool Types\n *\n * | Factory | Return Type | Use Case |\n * |---------------|------------------|-----------------------------------|\n * | createTool | AgentToolResult | Full control over response |\n * | createTextTool| string → text | Simple text responses |\n * | createJsonTool| object → JSON | Structured data responses |\n *\n * ## Example\n *\n * ```typescript\n * import { createTool, Type } from './tool-dsl';\n *\n * const greetTool = createTool({\n * name: 'greet',\n * description: 'Greet a user by name',\n * schema: Type.Object({\n * name: Type.String({ description: 'Name to greet' }),\n * }),\n * run: async ({ name }, { respond }) => {\n * return respond.text(`Hello, ${name}!`);\n * },\n * });\n * ```\n *\n * ## Features\n *\n * - **Type-safe schemas**: Uses TypeBox for compile-time type inference\n * - **AJV validation**: Runtime validation with format support\n * - **Retry logic**: Built-in exponential backoff for transient failures\n * - **Sandbox support**: Tools can run in isolated environments\n * - **Context interpolation**: Environment variables and paths\n *\n * @module tools/tool-dsl\n */\n\nimport type { Static, TSchema } from \"@sinclair/typebox\";\nimport { Ajv, type ErrorObject, type ValidateFunction } from \"ajv\";\nimport addFormatsModule, { type FormatsPlugin } from \"ajv-formats\";\nimport type {\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tToolAnnotations,\n} from \"../agent/types.js\";\nimport type { Sandbox } from \"../sandbox/types.js\";\nimport { resolveDefaultExport } from \"../utils/module-interop.js\";\n\n// ESM/CJS interop: ajv-formats default may be nested under .default in some loaders\nconst addFormats = resolveDefaultExport<FormatsPlugin>(addFormatsModule);\n\n// Create a singleton AJV instance for schema validation\nlet ajv: Ajv | null = null;\ntry {\n\tajv = new Ajv({\n\t\t// Avoid unbounded error collection on large/invalid payloads\n\t\tallErrors: false,\n\t\tstrict: false,\n\t\tuseDefaults: true, // Apply schema defaults to input\n\t});\n\taddFormats(ajv);\n} catch {\n\t// AJV initialization failed (likely CSP restriction)\n\tajv = null;\n}\n\n// Cache compiled validators per schema to avoid recompiling on every execute()\nconst validatorCache = new WeakMap<TSchema, ValidateFunction>();\n\nfunction getOrCompileValidator(schema: TSchema): ValidateFunction | null {\n\tif (!ajv) return null;\n\n\tlet validate = validatorCache.get(schema);\n\tif (!validate) {\n\t\tvalidate = ajv.compile(schema);\n\t\tvalidatorCache.set(schema, validate);\n\t}\n\treturn validate;\n}\n\nexport class ToolResponseBuilder<Details> {\n\tprivate _content: (\n\t\t| { type: \"text\"; text: string }\n\t\t| { type: \"image\"; data: string; mimeType: string }\n\t)[] = [];\n\tprivate _details?: Details;\n\tprivate _isError = false;\n\n\ttext(content: string): this {\n\t\tthis._content.push({ type: \"text\", text: content });\n\t\treturn this;\n\t}\n\n\timage(base64: string, mimeType: string): this {\n\t\tthis._content.push({ type: \"image\", data: base64, mimeType });\n\t\treturn this;\n\t}\n\n\tdetail(details: Details): this {\n\t\tthis._details = details;\n\t\treturn this;\n\t}\n\n\terror(message: string): this {\n\t\tthis.text(message);\n\t\tthis._isError = true;\n\t\treturn this;\n\t}\n\n\tbuild(): AgentToolResult<Details> {\n\t\treturn {\n\t\t\tcontent: this._content,\n\t\t\tdetails: this._details,\n\t\t\tisError: this._isError,\n\t\t};\n\t}\n}\n\nexport interface ToolRunContext<Details> {\n\ttoolCallId: string;\n\tsignal?: AbortSignal;\n\trespond: ToolResponseBuilder<Details>;\n\tsandbox?: Sandbox;\n\tonUpdate?: AgentToolUpdateCallback<Details>;\n}\n\nexport interface CreateToolOptions<Schema extends TSchema, Details> {\n\tname: string;\n\tlabel?: string;\n\tdescription: string;\n\tschema: Schema;\n\tannotations?: ToolAnnotations;\n\ttoolType?: string;\n\tinputExamples?: unknown[];\n\tallowedCallers?: string[];\n\tdeferApiDefinition?: boolean;\n\trun: (\n\t\tparams: import(\"@sinclair/typebox\").Static<Schema>,\n\t\tcontext: ToolRunContext<Details>,\n\t) =>\n\t\t| undefined\n\t\t| ToolResponseBuilder<Details>\n\t\t| AgentToolResult<Details>\n\t\t| Promise<\n\t\t\t\tundefined | ToolResponseBuilder<Details> | AgentToolResult<Details>\n\t\t >;\n\tmaxRetries?: number;\n\tretryDelayMs?: number;\n\tshouldRetry?: (error: unknown) => boolean;\n\tgetToolUseSummary?: (params: Static<Schema>) => string | null;\n\tgetDisplayName?: (params: Static<Schema>) => string | null;\n\tgetActivityDescription?: (params: Static<Schema>) => string | null;\n}\n\ntype StaticSchema<Schema extends TSchema> = Static<Schema>;\n\nexport class ToolError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly code?: string,\n\t\tpublic readonly details?: unknown,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"ToolError\";\n\t}\n}\n\nexport function createTool<Schema extends TSchema, Details = undefined>(\n\toptions: CreateToolOptions<Schema, Details>,\n) {\n\treturn Object.freeze({\n\t\tname: options.name,\n\t\tlabel: options.label ?? options.name,\n\t\tdescription: options.description,\n\t\tparameters: options.schema,\n\t\tannotations: options.annotations,\n\t\ttoolType: options.toolType,\n\t\tinputExamples: options.inputExamples,\n\t\tallowedCallers: options.allowedCallers,\n\t\tdeferApiDefinition: options.deferApiDefinition,\n\t\tmaxRetries: options.maxRetries,\n\t\tretryDelayMs: options.retryDelayMs,\n\t\tshouldRetry: options.shouldRetry,\n\t\tgetToolUseSummary: options.getToolUseSummary\n\t\t\t? (params: Record<string, unknown>) =>\n\t\t\t\t\toptions.getToolUseSummary?.(params as StaticSchema<Schema>) ?? null\n\t\t\t: undefined,\n\t\tgetDisplayName: options.getDisplayName\n\t\t\t? (params: Record<string, unknown>) =>\n\t\t\t\t\toptions.getDisplayName?.(params as StaticSchema<Schema>) ?? null\n\t\t\t: undefined,\n\t\tgetActivityDescription: options.getActivityDescription\n\t\t\t? (params: Record<string, unknown>) =>\n\t\t\t\t\toptions.getActivityDescription?.(params as StaticSchema<Schema>) ??\n\t\t\t\t\tnull\n\t\t\t: undefined,\n\t\texecute: async (\n\t\t\ttoolCallId: string,\n\t\t\tparams: Record<string, unknown>,\n\t\t\tsignal?: AbortSignal,\n\t\t\tcontext?: { sandbox?: Sandbox },\n\t\t\tonUpdate?: AgentToolUpdateCallback<Details>,\n\t\t) => {\n\t\t\t// Validate params against schema using cached validator\n\t\t\tif (options.schema) {\n\t\t\t\tconst validate = getOrCompileValidator(options.schema);\n\t\t\t\tif (validate && !validate(params)) {\n\t\t\t\t\tconst errors =\n\t\t\t\t\t\t(validate.errors ?? [])\n\t\t\t\t\t\t\t.map((err) => {\n\t\t\t\t\t\t\t\tconst path =\n\t\t\t\t\t\t\t\t\terr.instancePath && err.instancePath.length > 1\n\t\t\t\t\t\t\t\t\t\t? err.instancePath.substring(1)\n\t\t\t\t\t\t\t\t\t\t: (err.params as { missingProperty?: string })\n\t\t\t\t\t\t\t\t\t\t\t\t.missingProperty || \"root\";\n\t\t\t\t\t\t\t\treturn ` - ${path}: ${err.message ?? \"invalid value\"}`;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.join(\"\\n\") || \"Unknown validation error\";\n\t\t\t\t\tthrow new ToolError(\n\t\t\t\t\t\t`Validation failed for tool \"${options.name}\":\\n${errors}`,\n\t\t\t\t\t\t\"VALIDATION_ERROR\",\n\t\t\t\t\t\t{ params },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst maxRetries = options.maxRetries ?? 0;\n\t\t\tconst retryDelayMs = options.retryDelayMs ?? 1000;\n\t\t\tconst shouldRetry = options.shouldRetry ?? (() => true);\n\t\t\tconst typedParams = params as StaticSchema<Schema>;\n\n\t\t\tlet lastError: unknown;\n\t\t\tfor (let attempt = 0; attempt <= maxRetries; attempt++) {\n\t\t\t\tif (attempt > 0) {\n\t\t\t\t\t// Exponential backoff: delay * 2^(attempt-1)\n\t\t\t\t\tconst delay = retryDelayMs * 2 ** (attempt - 1);\n\t\t\t\t\tif (signal) {\n\t\t\t\t\t\tconst activeSignal = signal;\n\t\t\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\t\t\tif (activeSignal.aborted) {\n\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\t\t\t\t\tactiveSignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t}, delay);\n\t\t\t\t\t\t\tfunction onAbort() {\n\t\t\t\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\t\t\t\tactiveSignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactiveSignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, delay));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tconst builder = new ToolResponseBuilder<Details>();\n\t\t\t\t\tconst result = await options.run(typedParams, {\n\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\trespond: builder,\n\t\t\t\t\t\tsandbox: context?.sandbox,\n\t\t\t\t\t\tonUpdate,\n\t\t\t\t\t});\n\t\t\t\t\tif (result instanceof ToolResponseBuilder) {\n\t\t\t\t\t\treturn result.build();\n\t\t\t\t\t}\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t\treturn builder.build();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlastError = error;\n\t\t\t\t\tif (attempt < maxRetries && shouldRetry(error)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow lastError;\n\t\t},\n\t});\n}\n\nimport { getHomeDir } from \"../utils/path-expansion.js\";\nimport { expandUserPath as expandUserPathBase } from \"../utils/path-validation.js\";\n\n// Re-export shared path expansion utility to keep tool-dsl API stable\nexport const expandUserPath = expandUserPathBase;\n\n/**\n * Interpolate environment variables and context in a string.\n * Supports: ${env.VAR}, ${cwd}, ${home}\n */\nexport function interpolateContext(value: string): string {\n\treturn value\n\t\t.replace(/\\$\\{env\\.([^}]+)\\}/g, (_, varName) => process.env[varName] ?? \"\")\n\t\t.replace(/\\$\\{cwd\\}/g, process.cwd())\n\t\t.replace(/\\$\\{home\\}/g, getHomeDir());\n}\n\nexport interface CreateTextToolOptions<Schema extends TSchema, Details>\n\textends Omit<CreateToolOptions<Schema, Details>, \"run\"> {\n\trun: (\n\t\tparams: import(\"@sinclair/typebox\").Static<Schema>,\n\t\tcontext: ToolRunContext<Details>,\n\t) =>\n\t\t| string\n\t\t| undefined\n\t\t| ToolResponseBuilder<Details>\n\t\t| AgentToolResult<Details>\n\t\t| Promise<\n\t\t\t\t| string\n\t\t\t\t| undefined\n\t\t\t\t| ToolResponseBuilder<Details>\n\t\t\t\t| AgentToolResult<Details>\n\t\t >;\n}\n\nexport function createTextTool<Schema extends TSchema, Details = undefined>(\n\toptions: CreateTextToolOptions<Schema, Details>,\n) {\n\treturn createTool<Schema, Details>({\n\t\t...options,\n\t\trun: async (params, context) => {\n\t\t\tconst result = await options.run(params, context);\n\t\t\tif (typeof result === \"string\") {\n\t\t\t\treturn context.respond.text(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t},\n\t});\n}\n\nexport interface CreateJsonToolOptions<Schema extends TSchema, Details>\n\textends Omit<CreateToolOptions<Schema, Details>, \"run\"> {\n\trun: (\n\t\tparams: import(\"@sinclair/typebox\").Static<Schema>,\n\t\tcontext: ToolRunContext<Details>,\n\t) =>\n\t\t| unknown\n\t\t| undefined\n\t\t| ToolResponseBuilder<Details>\n\t\t| AgentToolResult<Details>\n\t\t| Promise<\n\t\t\t\t| unknown\n\t\t\t\t| undefined\n\t\t\t\t| ToolResponseBuilder<Details>\n\t\t\t\t| AgentToolResult<Details>\n\t\t >;\n}\n\nexport function createJsonTool<Schema extends TSchema, Details = undefined>(\n\toptions: CreateJsonToolOptions<Schema, Details>,\n) {\n\treturn createTool<Schema, Details>({\n\t\t...options,\n\t\trun: async (params, context) => {\n\t\t\tconst result = await options.run(params, context);\n\t\t\tif (result === undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tif (result instanceof ToolResponseBuilder) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tif (isAgentToolResult<Details>(result)) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\treturn context.respond.text(JSON.stringify(result, null, 2));\n\t\t},\n\t});\n}\n\nfunction isAgentToolResult<Details>(\n\tvalue: unknown,\n): value is AgentToolResult<Details> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"content\" in value &&\n\t\tArray.isArray((value as AgentToolResult<Details>).content)\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-dsl.js","sourceRoot":"","sources":["../../src/tools/tool-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAGH,OAAO,EAAE,GAAG,EAA2C,MAAM,KAAK,CAAC;AACnE,OAAO,gBAAwC,MAAM,aAAa,CAAC;AAQnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,oFAAoF;AACpF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CAAC;YACD,IAAI,MAAM,YAAY,mBAAmB,EAAE,CAAC;gBAC3C,OAAO,MAAM,CAAC;YACf,CAAC;YACD,IAAI,iBAAiB,CAAU,MAAM,CAAC,EAAE,CAAC;gBACxC,OAAO,MAAM,CAAC;YACf,CAAC;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CACzB,KAAc;IAEd,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,KAAK,CAAC,OAAO,CAAE,KAAkC,CAAC,OAAO,CAAC,CAC1D,CAAC;AACH,CAAC","sourcesContent":["/**\n * Tool DSL - Domain-Specific Language for Creating Agent Tools\n *\n * This module provides a fluent, type-safe API for defining tools that can be\n * executed by the Composer agent. It handles schema validation, response building,\n * retry logic, and sandbox integration.\n *\n * ## Architecture\n *\n * ```\n * ┌─────────────────────────────────────────────────────────────────┐\n * │ Tool Creation Flow │\n * ├─────────────────────────────────────────────────────────────────┤\n * │ createTool(options) │\n * │ │ │\n * │ ▼ │\n * │ ┌─────────────┐ ┌──────────────┐ ┌─────────────────┐ │\n * │ │ Schema │───▶│ Validator │───▶│ execute() │ │\n * │ │ (TypeBox) │ │ (AJV) │ │ function │ │\n * │ └─────────────┘ └──────────────┘ └─────────────────┘ │\n * │ │ │\n * │ ▼ │\n * │ ┌─────────────────────────────────────┐ │\n * │ │ ToolResponseBuilder │ │\n * │ │ - text(), image(), error() │ │\n * │ │ - detail() for structured data │ │\n * │ └─────────────────────────────────────┘ │\n * └─────────────────────────────────────────────────────────────────┘\n * ```\n *\n * ## Tool Types\n *\n * | Factory | Return Type | Use Case |\n * |---------------|------------------|-----------------------------------|\n * | createTool | AgentToolResult | Full control over response |\n * | createTextTool| string → text | Simple text responses |\n * | createJsonTool| object → JSON | Structured data responses |\n *\n * ## Example\n *\n * ```typescript\n * import { createTool, Type } from './tool-dsl';\n *\n * const greetTool = createTool({\n * name: 'greet',\n * description: 'Greet a user by name',\n * schema: Type.Object({\n * name: Type.String({ description: 'Name to greet' }),\n * }),\n * run: async ({ name }, { respond }) => {\n * return respond.text(`Hello, ${name}!`);\n * },\n * });\n * ```\n *\n * ## Features\n *\n * - **Type-safe schemas**: Uses TypeBox for compile-time type inference\n * - **AJV validation**: Runtime validation with format support\n * - **Retry logic**: Built-in exponential backoff for transient failures\n * - **Sandbox support**: Tools can run in isolated environments\n * - **Context interpolation**: Environment variables and paths\n *\n * @module tools/tool-dsl\n */\n\nimport type { Static, TSchema } from \"@sinclair/typebox\";\nimport { Ajv, type ErrorObject, type ValidateFunction } from \"ajv\";\nimport addFormatsModule, { type FormatsPlugin } from \"ajv-formats\";\nimport type {\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tToolAnnotations,\n\tToolSourceMetadata,\n} from \"../agent/types.js\";\nimport type { Sandbox } from \"../sandbox/types.js\";\nimport { resolveDefaultExport } from \"../utils/module-interop.js\";\n\n// ESM/CJS interop: ajv-formats default may be nested under .default in some loaders\nconst addFormats = resolveDefaultExport<FormatsPlugin>(addFormatsModule);\n\n// Create a singleton AJV instance for schema validation\nlet ajv: Ajv | null = null;\ntry {\n\tajv = new Ajv({\n\t\t// Avoid unbounded error collection on large/invalid payloads\n\t\tallErrors: false,\n\t\tstrict: false,\n\t\tuseDefaults: true, // Apply schema defaults to input\n\t});\n\taddFormats(ajv);\n} catch {\n\t// AJV initialization failed (likely CSP restriction)\n\tajv = null;\n}\n\n// Cache compiled validators per schema to avoid recompiling on every execute()\nconst validatorCache = new WeakMap<TSchema, ValidateFunction>();\n\nfunction getOrCompileValidator(schema: TSchema): ValidateFunction | null {\n\tif (!ajv) return null;\n\n\tlet validate = validatorCache.get(schema);\n\tif (!validate) {\n\t\tvalidate = ajv.compile(schema);\n\t\tvalidatorCache.set(schema, validate);\n\t}\n\treturn validate;\n}\n\nexport class ToolResponseBuilder<Details> {\n\tprivate _content: (\n\t\t| { type: \"text\"; text: string }\n\t\t| { type: \"image\"; data: string; mimeType: string }\n\t)[] = [];\n\tprivate _details?: Details;\n\tprivate _isError = false;\n\n\ttext(content: string): this {\n\t\tthis._content.push({ type: \"text\", text: content });\n\t\treturn this;\n\t}\n\n\timage(base64: string, mimeType: string): this {\n\t\tthis._content.push({ type: \"image\", data: base64, mimeType });\n\t\treturn this;\n\t}\n\n\tdetail(details: Details): this {\n\t\tthis._details = details;\n\t\treturn this;\n\t}\n\n\terror(message: string): this {\n\t\tthis.text(message);\n\t\tthis._isError = true;\n\t\treturn this;\n\t}\n\n\tbuild(): AgentToolResult<Details> {\n\t\treturn {\n\t\t\tcontent: this._content,\n\t\t\tdetails: this._details,\n\t\t\tisError: this._isError,\n\t\t};\n\t}\n}\n\nexport interface ToolRunContext<Details> {\n\ttoolCallId: string;\n\tsignal?: AbortSignal;\n\trespond: ToolResponseBuilder<Details>;\n\tsandbox?: Sandbox;\n\tonUpdate?: AgentToolUpdateCallback<Details>;\n}\n\nexport interface CreateToolOptions<Schema extends TSchema, Details> {\n\tname: string;\n\tlabel?: string;\n\tdescription: string;\n\tschema: Schema;\n\tannotations?: ToolAnnotations;\n\tsource?: ToolSourceMetadata;\n\ttoolType?: string;\n\tinputExamples?: unknown[];\n\tallowedCallers?: string[];\n\tdeferApiDefinition?: boolean;\n\trun: (\n\t\tparams: import(\"@sinclair/typebox\").Static<Schema>,\n\t\tcontext: ToolRunContext<Details>,\n\t) =>\n\t\t| undefined\n\t\t| ToolResponseBuilder<Details>\n\t\t| AgentToolResult<Details>\n\t\t| Promise<\n\t\t\t\tundefined | ToolResponseBuilder<Details> | AgentToolResult<Details>\n\t\t >;\n\tmaxRetries?: number;\n\tretryDelayMs?: number;\n\tshouldRetry?: (error: unknown) => boolean;\n\tgetToolUseSummary?: (params: Static<Schema>) => string | null;\n\tgetDisplayName?: (params: Static<Schema>) => string | null;\n\tgetActivityDescription?: (params: Static<Schema>) => string | null;\n}\n\ntype StaticSchema<Schema extends TSchema> = Static<Schema>;\n\nexport class ToolError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly code?: string,\n\t\tpublic readonly details?: unknown,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"ToolError\";\n\t}\n}\n\nexport function createTool<Schema extends TSchema, Details = undefined>(\n\toptions: CreateToolOptions<Schema, Details>,\n) {\n\treturn Object.freeze({\n\t\tname: options.name,\n\t\tlabel: options.label ?? options.name,\n\t\tdescription: options.description,\n\t\tparameters: options.schema,\n\t\tannotations: options.annotations,\n\t\tsource: options.source,\n\t\ttoolType: options.toolType,\n\t\tinputExamples: options.inputExamples,\n\t\tallowedCallers: options.allowedCallers,\n\t\tdeferApiDefinition: options.deferApiDefinition,\n\t\tmaxRetries: options.maxRetries,\n\t\tretryDelayMs: options.retryDelayMs,\n\t\tshouldRetry: options.shouldRetry,\n\t\tgetToolUseSummary: options.getToolUseSummary\n\t\t\t? (params: Record<string, unknown>) =>\n\t\t\t\t\toptions.getToolUseSummary?.(params as StaticSchema<Schema>) ?? null\n\t\t\t: undefined,\n\t\tgetDisplayName: options.getDisplayName\n\t\t\t? (params: Record<string, unknown>) =>\n\t\t\t\t\toptions.getDisplayName?.(params as StaticSchema<Schema>) ?? null\n\t\t\t: undefined,\n\t\tgetActivityDescription: options.getActivityDescription\n\t\t\t? (params: Record<string, unknown>) =>\n\t\t\t\t\toptions.getActivityDescription?.(params as StaticSchema<Schema>) ??\n\t\t\t\t\tnull\n\t\t\t: undefined,\n\t\texecute: async (\n\t\t\ttoolCallId: string,\n\t\t\tparams: Record<string, unknown>,\n\t\t\tsignal?: AbortSignal,\n\t\t\tcontext?: { sandbox?: Sandbox },\n\t\t\tonUpdate?: AgentToolUpdateCallback<Details>,\n\t\t) => {\n\t\t\t// Validate params against schema using cached validator\n\t\t\tif (options.schema) {\n\t\t\t\tconst validate = getOrCompileValidator(options.schema);\n\t\t\t\tif (validate && !validate(params)) {\n\t\t\t\t\tconst errors =\n\t\t\t\t\t\t(validate.errors ?? [])\n\t\t\t\t\t\t\t.map((err) => {\n\t\t\t\t\t\t\t\tconst path =\n\t\t\t\t\t\t\t\t\terr.instancePath && err.instancePath.length > 1\n\t\t\t\t\t\t\t\t\t\t? err.instancePath.substring(1)\n\t\t\t\t\t\t\t\t\t\t: (err.params as { missingProperty?: string })\n\t\t\t\t\t\t\t\t\t\t\t\t.missingProperty || \"root\";\n\t\t\t\t\t\t\t\treturn ` - ${path}: ${err.message ?? \"invalid value\"}`;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.join(\"\\n\") || \"Unknown validation error\";\n\t\t\t\t\tthrow new ToolError(\n\t\t\t\t\t\t`Validation failed for tool \"${options.name}\":\\n${errors}`,\n\t\t\t\t\t\t\"VALIDATION_ERROR\",\n\t\t\t\t\t\t{ params },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst maxRetries = options.maxRetries ?? 0;\n\t\t\tconst retryDelayMs = options.retryDelayMs ?? 1000;\n\t\t\tconst shouldRetry = options.shouldRetry ?? (() => true);\n\t\t\tconst typedParams = params as StaticSchema<Schema>;\n\n\t\t\tlet lastError: unknown;\n\t\t\tfor (let attempt = 0; attempt <= maxRetries; attempt++) {\n\t\t\t\tif (attempt > 0) {\n\t\t\t\t\t// Exponential backoff: delay * 2^(attempt-1)\n\t\t\t\t\tconst delay = retryDelayMs * 2 ** (attempt - 1);\n\t\t\t\t\tif (signal) {\n\t\t\t\t\t\tconst activeSignal = signal;\n\t\t\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\t\t\tif (activeSignal.aborted) {\n\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\t\t\t\t\tactiveSignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t}, delay);\n\t\t\t\t\t\t\tfunction onAbort() {\n\t\t\t\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\t\t\t\tactiveSignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactiveSignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, delay));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tconst builder = new ToolResponseBuilder<Details>();\n\t\t\t\t\tconst result = await options.run(typedParams, {\n\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\trespond: builder,\n\t\t\t\t\t\tsandbox: context?.sandbox,\n\t\t\t\t\t\tonUpdate,\n\t\t\t\t\t});\n\t\t\t\t\tif (result instanceof ToolResponseBuilder) {\n\t\t\t\t\t\treturn result.build();\n\t\t\t\t\t}\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t\treturn builder.build();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlastError = error;\n\t\t\t\t\tif (attempt < maxRetries && shouldRetry(error)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow lastError;\n\t\t},\n\t});\n}\n\nimport { getHomeDir } from \"../utils/path-expansion.js\";\nimport { expandUserPath as expandUserPathBase } from \"../utils/path-validation.js\";\n\n// Re-export shared path expansion utility to keep tool-dsl API stable\nexport const expandUserPath = expandUserPathBase;\n\n/**\n * Interpolate environment variables and context in a string.\n * Supports: ${env.VAR}, ${cwd}, ${home}\n */\nexport function interpolateContext(value: string): string {\n\treturn value\n\t\t.replace(/\\$\\{env\\.([^}]+)\\}/g, (_, varName) => process.env[varName] ?? \"\")\n\t\t.replace(/\\$\\{cwd\\}/g, process.cwd())\n\t\t.replace(/\\$\\{home\\}/g, getHomeDir());\n}\n\nexport interface CreateTextToolOptions<Schema extends TSchema, Details>\n\textends Omit<CreateToolOptions<Schema, Details>, \"run\"> {\n\trun: (\n\t\tparams: import(\"@sinclair/typebox\").Static<Schema>,\n\t\tcontext: ToolRunContext<Details>,\n\t) =>\n\t\t| string\n\t\t| undefined\n\t\t| ToolResponseBuilder<Details>\n\t\t| AgentToolResult<Details>\n\t\t| Promise<\n\t\t\t\t| string\n\t\t\t\t| undefined\n\t\t\t\t| ToolResponseBuilder<Details>\n\t\t\t\t| AgentToolResult<Details>\n\t\t >;\n}\n\nexport function createTextTool<Schema extends TSchema, Details = undefined>(\n\toptions: CreateTextToolOptions<Schema, Details>,\n) {\n\treturn createTool<Schema, Details>({\n\t\t...options,\n\t\trun: async (params, context) => {\n\t\t\tconst result = await options.run(params, context);\n\t\t\tif (typeof result === \"string\") {\n\t\t\t\treturn context.respond.text(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t},\n\t});\n}\n\nexport interface CreateJsonToolOptions<Schema extends TSchema, Details>\n\textends Omit<CreateToolOptions<Schema, Details>, \"run\"> {\n\trun: (\n\t\tparams: import(\"@sinclair/typebox\").Static<Schema>,\n\t\tcontext: ToolRunContext<Details>,\n\t) =>\n\t\t| unknown\n\t\t| undefined\n\t\t| ToolResponseBuilder<Details>\n\t\t| AgentToolResult<Details>\n\t\t| Promise<\n\t\t\t\t| unknown\n\t\t\t\t| undefined\n\t\t\t\t| ToolResponseBuilder<Details>\n\t\t\t\t| AgentToolResult<Details>\n\t\t >;\n}\n\nexport function createJsonTool<Schema extends TSchema, Details = undefined>(\n\toptions: CreateJsonToolOptions<Schema, Details>,\n) {\n\treturn createTool<Schema, Details>({\n\t\t...options,\n\t\trun: async (params, context) => {\n\t\t\tconst result = await options.run(params, context);\n\t\t\tif (result === undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tif (result instanceof ToolResponseBuilder) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tif (isAgentToolResult<Details>(result)) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\treturn context.respond.text(JSON.stringify(result, null, 2));\n\t\t},\n\t});\n}\n\nfunction isAgentToolResult<Details>(\n\tvalue: unknown,\n): value is AgentToolResult<Details> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"content\" in value &&\n\t\tArray.isArray((value as AgentToolResult<Details>).content)\n\t);\n}\n"]}
|