@clinebot/core 0.0.37 → 0.0.38
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 +11 -1
- package/dist/ClineCore.d.ts +18 -214
- package/dist/account/cline-account-service.d.ts +0 -1
- package/dist/account/index.d.ts +0 -1
- package/dist/account/rpc.d.ts +0 -1
- package/dist/account/types.d.ts +0 -1
- package/dist/auth/bounded-ttl-cache.d.ts +0 -1
- package/dist/auth/client.d.ts +0 -1
- package/dist/auth/cline.d.ts +0 -5
- package/dist/auth/codex.d.ts +0 -1
- package/dist/auth/oca.d.ts +0 -1
- package/dist/auth/server.d.ts +0 -1
- package/dist/auth/types.d.ts +0 -1
- package/dist/auth/utils.d.ts +0 -1
- package/dist/cline-core/automation.d.ts +34 -0
- package/dist/cline-core/runtime-services.d.ts +5 -0
- package/dist/cline-core/start-input.d.ts +10 -0
- package/dist/cline-core/telemetry.d.ts +10 -0
- package/dist/cline-core/types.d.ts +221 -0
- package/dist/cron/{cron-event-ingress.d.ts → events/cron-event-ingress.d.ts} +1 -2
- package/dist/cron/{cron-report-writer.d.ts → reports/cron-report-writer.d.ts} +1 -2
- package/dist/cron/{cron-materializer.d.ts → runner/cron-materializer.d.ts} +1 -2
- package/dist/cron/{cron-runner.d.ts → runner/cron-runner.d.ts} +6 -4
- package/dist/cron/{resource-limiter.d.ts → runner/resource-limiter.d.ts} +0 -1
- package/dist/cron/schedule/scheduler.d.ts +12 -0
- package/dist/cron/{cron-service.d.ts → service/cron-service.d.ts} +4 -5
- package/dist/cron/{schedule-command-service.d.ts → service/schedule-command-service.d.ts} +0 -1
- package/dist/cron/{schedule-service.d.ts → service/schedule-service.d.ts} +20 -22
- package/dist/cron/{cron-reconciler.d.ts → specs/cron-reconciler.d.ts} +1 -2
- package/dist/cron/{cron-spec-parser.d.ts → specs/cron-spec-parser.d.ts} +0 -1
- package/dist/cron/{cron-watcher.d.ts → specs/cron-watcher.d.ts} +0 -1
- package/dist/cron/{cron-schema.d.ts → store/cron-schema.d.ts} +0 -1
- package/dist/cron/{sqlite-cron-store.d.ts → store/sqlite-cron-store.d.ts} +12 -2
- package/dist/extensions/config/index.d.ts +4 -7
- package/dist/extensions/config/runtime-commands.d.ts +0 -1
- package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
- package/dist/extensions/config/unified-config-file-watcher.d.ts +0 -1
- package/dist/extensions/config/user-instruction-config-loader.d.ts +0 -1
- package/dist/extensions/config/user-instruction-plugin.d.ts +25 -0
- package/dist/extensions/config/user-instruction-service.d.ts +23 -0
- package/dist/extensions/context/agentic-compaction.d.ts +0 -1
- package/dist/extensions/context/basic-compaction.d.ts +0 -1
- package/dist/extensions/context/compaction-shared.d.ts +0 -1
- package/dist/extensions/context/compaction.d.ts +0 -1
- package/dist/extensions/index.d.ts +0 -1
- package/dist/extensions/mcp/client.d.ts +0 -1
- package/dist/extensions/mcp/config-loader.d.ts +0 -1
- package/dist/extensions/mcp/index.d.ts +0 -1
- package/dist/extensions/mcp/manager.d.ts +0 -1
- package/dist/extensions/mcp/name-transform.d.ts +0 -1
- package/dist/extensions/mcp/policies.d.ts +0 -1
- package/dist/extensions/mcp/tools.d.ts +2 -3
- package/dist/extensions/mcp/types.d.ts +3 -4
- package/dist/extensions/plugin/plugin-config-loader.d.ts +0 -1
- package/dist/extensions/plugin/plugin-load-report.d.ts +0 -1
- package/dist/extensions/plugin/plugin-loader.d.ts +0 -1
- package/dist/extensions/plugin/plugin-module-import.d.ts +0 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts +0 -1
- package/dist/extensions/plugin/plugin-targeting.d.ts +0 -1
- package/dist/extensions/plugin-sandbox-bootstrap.js +1 -446
- package/dist/extensions/tools/constants.d.ts +0 -1
- package/dist/extensions/tools/definitions.d.ts +13 -14
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts +0 -1
- package/dist/extensions/tools/executors/apply-patch.d.ts +0 -1
- package/dist/extensions/tools/executors/bash.d.ts +0 -1
- package/dist/extensions/tools/executors/editor.d.ts +0 -1
- package/dist/extensions/tools/executors/file-read.d.ts +0 -1
- package/dist/extensions/tools/executors/index.d.ts +0 -1
- package/dist/extensions/tools/executors/search.d.ts +0 -1
- package/dist/extensions/tools/executors/web-fetch.d.ts +0 -1
- package/dist/extensions/tools/helpers.d.ts +0 -1
- package/dist/extensions/tools/index.d.ts +2 -3
- package/dist/extensions/tools/model-tool-routing.d.ts +0 -1
- package/dist/extensions/tools/presets.d.ts +4 -5
- package/dist/extensions/tools/runtime.d.ts +0 -1
- package/dist/extensions/tools/schemas.d.ts +0 -1
- package/dist/extensions/tools/team/delegated-agent.d.ts +3 -4
- package/dist/extensions/tools/team/index.d.ts +0 -1
- package/dist/extensions/tools/team/multi-agent.d.ts +1 -2
- package/dist/extensions/tools/team/projections.d.ts +0 -1
- package/dist/extensions/tools/team/runtime.d.ts +0 -1
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts +4 -5
- package/dist/extensions/tools/team/subagent-prompts.d.ts +0 -1
- package/dist/extensions/tools/team/team-tools.d.ts +7 -8
- package/dist/extensions/tools/types.d.ts +11 -12
- package/dist/hooks/checkpoint-hooks.d.ts +9 -2
- package/dist/hooks/hook-extension.d.ts +2 -0
- package/dist/{extensions/config/hooks-config-loader.d.ts → hooks/hook-file-config.d.ts} +1 -2
- package/dist/hooks/hook-file-hooks.d.ts +2 -2
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/subprocess-runner.d.ts +0 -1
- package/dist/hooks/subprocess.d.ts +0 -1
- package/dist/hub/{connect.d.ts → client/connect.d.ts} +1 -2
- package/dist/hub/{client.d.ts → client/index.d.ts} +41 -4
- package/dist/hub/{session-client.d.ts → client/session-client.d.ts} +41 -13
- package/dist/hub/{ui-client.d.ts → client/ui-client.d.ts} +1 -1
- package/dist/hub/daemon/entry.d.ts +1 -0
- package/dist/hub/daemon/entry.js +720 -0
- package/dist/hub/{daemon.d.ts → daemon/index.d.ts} +6 -3
- package/dist/hub/{runtime-handlers.d.ts → daemon/runtime-handlers.d.ts} +3 -2
- package/dist/hub/{start-shared-server.d.ts → daemon/start-shared-server.d.ts} +1 -2
- package/dist/hub/{defaults.d.ts → discovery/defaults.d.ts} +0 -1
- package/dist/hub/{discovery.d.ts → discovery/index.d.ts} +2 -1
- package/dist/hub/{workspace.d.ts → discovery/workspace.d.ts} +1 -2
- package/dist/hub/index.d.ts +28 -11
- package/dist/hub/index.js +484 -1061
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +73 -0
- package/dist/{transports/remote.d.ts → hub/runtime-host/remote-runtime-host.d.ts} +1 -2
- package/dist/hub/{browser-websocket.d.ts → server/browser-websocket.d.ts} +1 -2
- package/dist/hub/{transport.d.ts → server/command-transport.d.ts} +0 -1
- package/dist/hub/server/handlers/approval-handlers.d.ts +17 -0
- package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
- package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
- package/dist/hub/server/handlers/context.d.ts +56 -0
- package/dist/hub/server/handlers/run-handlers.d.ts +5 -0
- package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
- package/dist/hub/server/handlers/session-handlers.d.ts +20 -0
- package/dist/hub/server/hub-client-contributions.d.ts +19 -0
- package/dist/hub/server/hub-notifications.d.ts +7 -0
- package/dist/hub/server/hub-schedule-events.d.ts +2 -0
- package/dist/hub/server/hub-server-logging.d.ts +2 -0
- package/dist/hub/server/hub-server-options.d.ts +55 -0
- package/dist/hub/server/hub-server-transport.d.ts +34 -0
- package/dist/hub/server/hub-session-records.d.ts +8 -0
- package/dist/hub/server/hub-websocket-server.d.ts +6 -0
- package/dist/hub/server/index.d.ts +4 -0
- package/dist/hub/{native-transport.d.ts → server/native-transport.d.ts} +1 -2
- package/dist/index.d.ts +51 -41
- package/dist/index.js +214 -872
- package/dist/runtime/capabilities/index.d.ts +2 -0
- package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
- package/dist/runtime/capabilities/runtime-capabilities.d.ts +6 -0
- package/dist/runtime/config/agent-message-codec.d.ts +6 -0
- package/dist/runtime/{agent-runtime-config-builder.d.ts → config/agent-runtime-config-builder.d.ts} +12 -21
- package/dist/runtime/host/history.d.ts +18 -0
- package/dist/runtime/{host.d.ts → host/host.d.ts} +3 -4
- package/dist/runtime/host/local/agent-event-bridge.d.ts +29 -0
- package/dist/runtime/host/local/session-record.d.ts +6 -0
- package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
- package/dist/runtime/host/local/spawn-tool.d.ts +15 -0
- package/dist/runtime/host/local/user-files.d.ts +1 -0
- package/dist/runtime/host/local-runtime-host.d.ts +118 -0
- package/dist/{transports → runtime/host}/runtime-host-support.d.ts +3 -5
- package/dist/runtime/{runtime-host.d.ts → host/runtime-host.d.ts} +66 -31
- package/dist/runtime/{runtime-builder.d.ts → orchestration/runtime-builder.d.ts} +0 -1
- package/dist/runtime/{runtime-event-adapter.d.ts → orchestration/runtime-event-adapter.d.ts} +0 -1
- package/dist/runtime/{runtime-oauth-token-manager.d.ts → orchestration/runtime-oauth-token-manager.d.ts} +1 -2
- package/dist/runtime/{session-runtime-orchestrator.d.ts → orchestration/session-runtime-orchestrator.d.ts} +20 -63
- package/dist/runtime/{session-runtime.d.ts → orchestration/session-runtime.d.ts} +14 -12
- package/dist/runtime/{user-input-builder.d.ts → orchestration/user-input-builder.d.ts} +2 -11
- package/dist/runtime/{loop-detection.d.ts → safety/loop-detection.d.ts} +0 -1
- package/dist/runtime/{mistake-tracker.d.ts → safety/mistake-tracker.d.ts} +0 -1
- package/dist/runtime/{rules.d.ts → safety/rules.d.ts} +1 -2
- package/dist/runtime/{subprocess-sandbox.d.ts → tools/subprocess-sandbox.d.ts} +15 -1
- package/dist/runtime/{tool-approval.d.ts → tools/tool-approval.d.ts} +0 -1
- package/dist/runtime/turn-queue/pending-prompt-service.d.ts +64 -0
- package/dist/services/agent-events.d.ts +1 -2
- package/dist/services/config.d.ts +0 -1
- package/dist/services/global-settings.d.ts +27 -5
- package/dist/{llms → services/llms}/cline-recommended-models.d.ts +1 -2
- package/dist/{llms → services/llms}/configured-provider-registry.d.ts +0 -1
- package/dist/services/llms/handler-factory.d.ts +3 -0
- package/dist/{llms → services/llms}/provider-defaults.d.ts +2 -1
- package/dist/{llms → services/llms}/provider-settings.d.ts +5 -3
- package/dist/{llms → services/llms}/runtime-config.d.ts +0 -1
- package/dist/{llms → services/llms}/runtime-registry.d.ts +0 -1
- package/dist/{llms → services/llms}/runtime-types.d.ts +0 -1
- package/dist/services/local-runtime-bootstrap.d.ts +7 -9
- package/dist/services/plugin-tools.d.ts +0 -1
- package/dist/services/providers/local-provider-registry.d.ts +9 -10
- package/dist/services/providers/local-provider-service.d.ts +36 -3
- package/dist/services/providers/model-source.d.ts +3 -0
- package/dist/services/session-artifacts.d.ts +0 -1
- package/dist/services/session-data.d.ts +2 -3
- package/dist/services/session-telemetry.d.ts +0 -1
- package/dist/services/storage/file-team-store.d.ts +0 -1
- package/dist/services/storage/provider-settings-legacy-migration.d.ts +0 -1
- package/dist/services/storage/provider-settings-manager.d.ts +3 -4
- package/dist/services/storage/sqlite-session-store.d.ts +0 -1
- package/dist/services/storage/sqlite-team-store.d.ts +0 -1
- package/dist/services/storage/team-store.d.ts +0 -1
- package/dist/services/telemetry/ITelemetryAdapter.d.ts +0 -1
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +0 -1
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts +32 -1
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts +0 -1
- package/dist/services/telemetry/TelemetryService.d.ts +0 -1
- package/dist/services/telemetry/core-events.d.ts +46 -3
- package/dist/services/telemetry/distinct-id.d.ts +0 -1
- package/dist/services/telemetry/index.d.ts +1 -2
- package/dist/services/telemetry/index.js +1 -0
- package/dist/services/usage.d.ts +10 -2
- package/dist/services/workspace/file-indexer.d.ts +0 -1
- package/dist/services/workspace/index.d.ts +0 -1
- package/dist/services/workspace/mention-enricher.d.ts +0 -1
- package/dist/{session → services/workspace}/workspace-manager.d.ts +0 -1
- package/dist/services/{workspace-manifest.d.ts → workspace/workspace-manifest.d.ts} +20 -5
- package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
- package/dist/session/checkpoint-restore.d.ts +20 -0
- package/dist/session/{session-graph.d.ts → models/session-graph.d.ts} +2 -3
- package/dist/session/{session-manifest.d.ts → models/session-manifest.d.ts} +0 -1
- package/dist/session/{session-row.d.ts → models/session-row.d.ts} +2 -3
- package/dist/session/{file-session-service.d.ts → services/file-session-service.d.ts} +1 -2
- package/dist/session/{message-builder.d.ts → services/message-builder.d.ts} +7 -16
- package/dist/session/{persistence-service.d.ts → services/persistence-service.d.ts} +10 -11
- package/dist/session/{session-service.d.ts → services/session-service.d.ts} +4 -5
- package/dist/session/session-snapshot.d.ts +57 -0
- package/dist/session/session-versioning-service.d.ts +48 -0
- package/dist/session/{conversation-store.d.ts → stores/conversation-store.d.ts} +0 -1
- package/dist/session/{session-manifest-store.d.ts → stores/session-manifest-store.d.ts} +3 -4
- package/dist/session/{team-persistence-store.d.ts → stores/team-persistence-store.d.ts} +2 -3
- package/dist/session/team/index.d.ts +2 -0
- package/dist/session/{subagent-session-manager.d.ts → team/team-child-session-manager.d.ts} +7 -8
- package/dist/session/{session-team-coordination.d.ts → team/team-session-coordinator.d.ts} +3 -4
- package/dist/settings/index.d.ts +2 -0
- package/dist/settings/settings-service.d.ts +6 -0
- package/dist/settings/types.d.ts +42 -0
- package/dist/types/chat-schema.d.ts +24 -7
- package/dist/types/common.d.ts +0 -1
- package/dist/types/config.d.ts +2 -3
- package/dist/types/events.d.ts +8 -1
- package/dist/types/provider-settings.d.ts +2 -3
- package/dist/types/session.d.ts +22 -6
- package/dist/types/sessions.d.ts +0 -1
- package/dist/types/storage.d.ts +0 -1
- package/dist/types.d.ts +17 -14
- package/dist/version.d.ts +0 -1
- package/package.json +16 -12
- package/dist/ClineCore.d.ts.map +0 -1
- package/dist/account/cline-account-service.d.ts.map +0 -1
- package/dist/account/index.d.ts.map +0 -1
- package/dist/account/rpc.d.ts.map +0 -1
- package/dist/account/types.d.ts.map +0 -1
- package/dist/auth/bounded-ttl-cache.d.ts.map +0 -1
- package/dist/auth/client.d.ts.map +0 -1
- package/dist/auth/cline.d.ts.map +0 -1
- package/dist/auth/codex.d.ts.map +0 -1
- package/dist/auth/oca.d.ts.map +0 -1
- package/dist/auth/server.d.ts.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/utils.d.ts.map +0 -1
- package/dist/cron/cron-event-ingress.d.ts.map +0 -1
- package/dist/cron/cron-materializer.d.ts.map +0 -1
- package/dist/cron/cron-reconciler.d.ts.map +0 -1
- package/dist/cron/cron-report-writer.d.ts.map +0 -1
- package/dist/cron/cron-runner.d.ts.map +0 -1
- package/dist/cron/cron-schema.d.ts.map +0 -1
- package/dist/cron/cron-service.d.ts.map +0 -1
- package/dist/cron/cron-spec-parser.d.ts.map +0 -1
- package/dist/cron/cron-watcher.d.ts.map +0 -1
- package/dist/cron/resource-limiter.d.ts.map +0 -1
- package/dist/cron/schedule-command-service.d.ts.map +0 -1
- package/dist/cron/schedule-service.d.ts.map +0 -1
- package/dist/cron/scheduler.d.ts +0 -68
- package/dist/cron/scheduler.d.ts.map +0 -1
- package/dist/cron/sqlite-cron-store.d.ts.map +0 -1
- package/dist/cron/sqlite-schedule-store.d.ts +0 -52
- package/dist/cron/sqlite-schedule-store.d.ts.map +0 -1
- package/dist/extensions/config/agent-config-loader.d.ts +0 -20
- package/dist/extensions/config/agent-config-loader.d.ts.map +0 -1
- package/dist/extensions/config/agent-config-parser.d.ts +0 -29
- package/dist/extensions/config/agent-config-parser.d.ts.map +0 -1
- package/dist/extensions/config/hooks-config-loader.d.ts.map +0 -1
- package/dist/extensions/config/index.d.ts.map +0 -1
- package/dist/extensions/config/runtime-commands.d.ts.map +0 -1
- package/dist/extensions/config/unified-config-file-watcher.d.ts.map +0 -1
- package/dist/extensions/config/user-instruction-config-loader.d.ts.map +0 -1
- package/dist/extensions/context/agentic-compaction.d.ts.map +0 -1
- package/dist/extensions/context/basic-compaction.d.ts.map +0 -1
- package/dist/extensions/context/compaction-shared.d.ts.map +0 -1
- package/dist/extensions/context/compaction.d.ts.map +0 -1
- package/dist/extensions/index.d.ts.map +0 -1
- package/dist/extensions/mcp/client.d.ts.map +0 -1
- package/dist/extensions/mcp/config-loader.d.ts.map +0 -1
- package/dist/extensions/mcp/index.d.ts.map +0 -1
- package/dist/extensions/mcp/manager.d.ts.map +0 -1
- package/dist/extensions/mcp/name-transform.d.ts.map +0 -1
- package/dist/extensions/mcp/policies.d.ts.map +0 -1
- package/dist/extensions/mcp/tools.d.ts.map +0 -1
- package/dist/extensions/mcp/types.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-config-loader.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-load-report.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-loader.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-module-import.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-targeting.d.ts.map +0 -1
- package/dist/extensions/tools/constants.d.ts.map +0 -1
- package/dist/extensions/tools/definitions.d.ts.map +0 -1
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts.map +0 -1
- package/dist/extensions/tools/executors/apply-patch.d.ts.map +0 -1
- package/dist/extensions/tools/executors/bash.d.ts.map +0 -1
- package/dist/extensions/tools/executors/editor.d.ts.map +0 -1
- package/dist/extensions/tools/executors/file-read.d.ts.map +0 -1
- package/dist/extensions/tools/executors/index.d.ts.map +0 -1
- package/dist/extensions/tools/executors/search.d.ts.map +0 -1
- package/dist/extensions/tools/executors/web-fetch.d.ts.map +0 -1
- package/dist/extensions/tools/helpers.d.ts.map +0 -1
- package/dist/extensions/tools/index.d.ts.map +0 -1
- package/dist/extensions/tools/model-tool-routing.d.ts.map +0 -1
- package/dist/extensions/tools/presets.d.ts.map +0 -1
- package/dist/extensions/tools/runtime.d.ts.map +0 -1
- package/dist/extensions/tools/schemas.d.ts.map +0 -1
- package/dist/extensions/tools/team/delegated-agent.d.ts.map +0 -1
- package/dist/extensions/tools/team/index.d.ts.map +0 -1
- package/dist/extensions/tools/team/multi-agent.d.ts.map +0 -1
- package/dist/extensions/tools/team/projections.d.ts.map +0 -1
- package/dist/extensions/tools/team/runtime.d.ts.map +0 -1
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts.map +0 -1
- package/dist/extensions/tools/team/subagent-prompts.d.ts.map +0 -1
- package/dist/extensions/tools/team/team-tools.d.ts.map +0 -1
- package/dist/extensions/tools/types.d.ts.map +0 -1
- package/dist/hooks/checkpoint-hooks.d.ts.map +0 -1
- package/dist/hooks/hook-bridge.d.ts +0 -118
- package/dist/hooks/hook-bridge.d.ts.map +0 -1
- package/dist/hooks/hook-file-hooks.d.ts.map +0 -1
- package/dist/hooks/hook-registry.d.ts +0 -16
- package/dist/hooks/hook-registry.d.ts.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/subprocess-runner.d.ts.map +0 -1
- package/dist/hooks/subprocess.d.ts.map +0 -1
- package/dist/hub/browser-websocket.d.ts.map +0 -1
- package/dist/hub/client.d.ts.map +0 -1
- package/dist/hub/connect.d.ts.map +0 -1
- package/dist/hub/daemon-entry.d.ts +0 -2
- package/dist/hub/daemon-entry.d.ts.map +0 -1
- package/dist/hub/daemon-entry.js +0 -1305
- package/dist/hub/daemon.d.ts.map +0 -1
- package/dist/hub/defaults.d.ts.map +0 -1
- package/dist/hub/discovery.d.ts.map +0 -1
- package/dist/hub/index.d.ts.map +0 -1
- package/dist/hub/native-transport.d.ts.map +0 -1
- package/dist/hub/runtime-handlers.d.ts.map +0 -1
- package/dist/hub/server.d.ts +0 -104
- package/dist/hub/server.d.ts.map +0 -1
- package/dist/hub/session-client.d.ts.map +0 -1
- package/dist/hub/start-shared-server.d.ts.map +0 -1
- package/dist/hub/transport.d.ts.map +0 -1
- package/dist/hub/ui-client.d.ts.map +0 -1
- package/dist/hub/workspace.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/llms/cline-recommended-models.d.ts.map +0 -1
- package/dist/llms/configured-provider-registry.d.ts.map +0 -1
- package/dist/llms/handler-factory.d.ts +0 -16
- package/dist/llms/handler-factory.d.ts.map +0 -1
- package/dist/llms/provider-defaults.d.ts.map +0 -1
- package/dist/llms/provider-settings.d.ts.map +0 -1
- package/dist/llms/runtime-config.d.ts.map +0 -1
- package/dist/llms/runtime-registry.d.ts.map +0 -1
- package/dist/llms/runtime-types.d.ts.map +0 -1
- package/dist/runtime/agent-config-adapter.d.ts +0 -148
- package/dist/runtime/agent-config-adapter.d.ts.map +0 -1
- package/dist/runtime/agent-runtime-config-builder.d.ts.map +0 -1
- package/dist/runtime/history.d.ts +0 -10
- package/dist/runtime/history.d.ts.map +0 -1
- package/dist/runtime/host.d.ts.map +0 -1
- package/dist/runtime/loop-detection.d.ts.map +0 -1
- package/dist/runtime/mistake-tracker.d.ts.map +0 -1
- package/dist/runtime/rules.d.ts.map +0 -1
- package/dist/runtime/runtime-builder.d.ts.map +0 -1
- package/dist/runtime/runtime-event-adapter.d.ts.map +0 -1
- package/dist/runtime/runtime-host.d.ts.map +0 -1
- package/dist/runtime/runtime-oauth-token-manager.d.ts.map +0 -1
- package/dist/runtime/session-runtime-orchestrator.d.ts.map +0 -1
- package/dist/runtime/session-runtime.d.ts.map +0 -1
- package/dist/runtime/subprocess-sandbox.d.ts.map +0 -1
- package/dist/runtime/tool-approval.d.ts.map +0 -1
- package/dist/runtime/user-input-builder.d.ts.map +0 -1
- package/dist/services/agent-events.d.ts.map +0 -1
- package/dist/services/config.d.ts.map +0 -1
- package/dist/services/global-settings.d.ts.map +0 -1
- package/dist/services/index.js +0 -28
- package/dist/services/local-runtime-bootstrap.d.ts.map +0 -1
- package/dist/services/plugin-tools.d.ts.map +0 -1
- package/dist/services/providers/local-provider-registry.d.ts.map +0 -1
- package/dist/services/providers/local-provider-service.d.ts.map +0 -1
- package/dist/services/session-artifacts.d.ts.map +0 -1
- package/dist/services/session-data.d.ts.map +0 -1
- package/dist/services/session-telemetry.d.ts.map +0 -1
- package/dist/services/storage/file-team-store.d.ts.map +0 -1
- package/dist/services/storage/provider-settings-legacy-migration.d.ts.map +0 -1
- package/dist/services/storage/provider-settings-manager.d.ts.map +0 -1
- package/dist/services/storage/sqlite-session-store.d.ts.map +0 -1
- package/dist/services/storage/sqlite-team-store.d.ts.map +0 -1
- package/dist/services/storage/team-store.d.ts.map +0 -1
- package/dist/services/telemetry/ITelemetryAdapter.d.ts.map +0 -1
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts.map +0 -1
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts.map +0 -1
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts.map +0 -1
- package/dist/services/telemetry/TelemetryService.d.ts.map +0 -1
- package/dist/services/telemetry/core-events.d.ts.map +0 -1
- package/dist/services/telemetry/distinct-id.d.ts.map +0 -1
- package/dist/services/telemetry/index.d.ts.map +0 -1
- package/dist/services/usage.d.ts.map +0 -1
- package/dist/services/workspace/file-indexer.d.ts.map +0 -1
- package/dist/services/workspace/index.d.ts.map +0 -1
- package/dist/services/workspace/mention-enricher.d.ts.map +0 -1
- package/dist/services/workspace-manifest.d.ts.map +0 -1
- package/dist/session/conversation-store.d.ts.map +0 -1
- package/dist/session/file-session-service.d.ts.map +0 -1
- package/dist/session/message-builder.d.ts.map +0 -1
- package/dist/session/persistence-service.d.ts.map +0 -1
- package/dist/session/session-graph.d.ts.map +0 -1
- package/dist/session/session-manifest-store.d.ts.map +0 -1
- package/dist/session/session-manifest.d.ts.map +0 -1
- package/dist/session/session-row.d.ts.map +0 -1
- package/dist/session/session-service.d.ts.map +0 -1
- package/dist/session/session-team-coordination.d.ts.map +0 -1
- package/dist/session/subagent-session-manager.d.ts.map +0 -1
- package/dist/session/team-persistence-store.d.ts.map +0 -1
- package/dist/session/workspace-manager.d.ts.map +0 -1
- package/dist/transports/hub.d.ts +0 -58
- package/dist/transports/hub.d.ts.map +0 -1
- package/dist/transports/local.d.ts +0 -119
- package/dist/transports/local.d.ts.map +0 -1
- package/dist/transports/remote.d.ts.map +0 -1
- package/dist/transports/runtime-host-support.d.ts.map +0 -1
- package/dist/types/chat-schema.d.ts.map +0 -1
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/provider-settings.d.ts.map +0 -1
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/sessions.d.ts.map +0 -1
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/src/ClineCore.ts +0 -1026
- package/src/account/cline-account-service.ts +0 -338
- package/src/account/index.ts +0 -24
- package/src/account/rpc.ts +0 -185
- package/src/account/types.ts +0 -108
- package/src/auth/bounded-ttl-cache.ts +0 -53
- package/src/auth/client.ts +0 -46
- package/src/auth/cline.ts +0 -724
- package/src/auth/codex.ts +0 -491
- package/src/auth/oca.ts +0 -588
- package/src/auth/server.ts +0 -265
- package/src/auth/types.ts +0 -110
- package/src/auth/utils.ts +0 -247
- package/src/cron/cron-event-ingress.ts +0 -357
- package/src/cron/cron-materializer.ts +0 -97
- package/src/cron/cron-reconciler.ts +0 -241
- package/src/cron/cron-report-writer.ts +0 -153
- package/src/cron/cron-runner.ts +0 -495
- package/src/cron/cron-schema.ts +0 -127
- package/src/cron/cron-service.ts +0 -163
- package/src/cron/cron-spec-parser.ts +0 -489
- package/src/cron/cron-watcher.ts +0 -102
- package/src/cron/index.ts +0 -15
- package/src/cron/resource-limiter.ts +0 -46
- package/src/cron/schedule-command-service.ts +0 -193
- package/src/cron/schedule-service.ts +0 -703
- package/src/cron/scheduler.ts +0 -772
- package/src/cron/sqlite-cron-store.ts +0 -1286
- package/src/cron/sqlite-schedule-store.ts +0 -708
- package/src/extensions/config/agent-config-loader.ts +0 -114
- package/src/extensions/config/agent-config-parser.ts +0 -198
- package/src/extensions/config/hooks-config-loader.ts +0 -117
- package/src/extensions/config/index.ts +0 -77
- package/src/extensions/config/runtime-commands.ts +0 -82
- package/src/extensions/config/unified-config-file-watcher.ts +0 -496
- package/src/extensions/config/user-instruction-config-loader.ts +0 -549
- package/src/extensions/context/agentic-compaction.ts +0 -131
- package/src/extensions/context/basic-compaction.ts +0 -300
- package/src/extensions/context/compaction-shared.ts +0 -459
- package/src/extensions/context/compaction.ts +0 -226
- package/src/extensions/index.ts +0 -18
- package/src/extensions/mcp/client.ts +0 -420
- package/src/extensions/mcp/config-loader.ts +0 -219
- package/src/extensions/mcp/index.ts +0 -42
- package/src/extensions/mcp/manager.ts +0 -260
- package/src/extensions/mcp/name-transform.ts +0 -33
- package/src/extensions/mcp/policies.ts +0 -47
- package/src/extensions/mcp/tools.ts +0 -47
- package/src/extensions/mcp/types.ts +0 -116
- package/src/extensions/plugin/plugin-config-loader.ts +0 -140
- package/src/extensions/plugin/plugin-load-report.ts +0 -20
- package/src/extensions/plugin/plugin-loader.ts +0 -220
- package/src/extensions/plugin/plugin-module-import.ts +0 -276
- package/src/extensions/plugin/plugin-sandbox-bootstrap.ts +0 -662
- package/src/extensions/plugin/plugin-sandbox.ts +0 -586
- package/src/extensions/plugin/plugin-targeting.ts +0 -32
- package/src/extensions/tools/constants.ts +0 -37
- package/src/extensions/tools/definitions.ts +0 -738
- package/src/extensions/tools/executors/apply-patch-parser.ts +0 -520
- package/src/extensions/tools/executors/apply-patch.ts +0 -348
- package/src/extensions/tools/executors/bash.ts +0 -207
- package/src/extensions/tools/executors/editor.ts +0 -220
- package/src/extensions/tools/executors/file-read.ts +0 -135
- package/src/extensions/tools/executors/index.ts +0 -87
- package/src/extensions/tools/executors/search.ts +0 -470
- package/src/extensions/tools/executors/web-fetch.ts +0 -259
- package/src/extensions/tools/helpers.ts +0 -154
- package/src/extensions/tools/index.ts +0 -183
- package/src/extensions/tools/model-tool-routing.ts +0 -134
- package/src/extensions/tools/presets.ts +0 -190
- package/src/extensions/tools/runtime.ts +0 -261
- package/src/extensions/tools/schemas.ts +0 -343
- package/src/extensions/tools/team/delegated-agent.ts +0 -136
- package/src/extensions/tools/team/index.ts +0 -5
- package/src/extensions/tools/team/multi-agent.ts +0 -1845
- package/src/extensions/tools/team/projections.ts +0 -283
- package/src/extensions/tools/team/runtime.ts +0 -54
- package/src/extensions/tools/team/spawn-agent-tool.ts +0 -201
- package/src/extensions/tools/team/subagent-prompts.ts +0 -41
- package/src/extensions/tools/team/team-tools.ts +0 -902
- package/src/extensions/tools/types.ts +0 -354
- package/src/hooks/checkpoint-hooks.ts +0 -238
- package/src/hooks/hook-bridge.ts +0 -489
- package/src/hooks/hook-file-hooks.ts +0 -934
- package/src/hooks/hook-registry.ts +0 -257
- package/src/hooks/index.ts +0 -18
- package/src/hooks/subprocess-runner.ts +0 -196
- package/src/hooks/subprocess.ts +0 -469
- package/src/hub/browser-websocket.ts +0 -159
- package/src/hub/client.ts +0 -633
- package/src/hub/connect.ts +0 -156
- package/src/hub/daemon-entry.ts +0 -122
- package/src/hub/daemon.ts +0 -284
- package/src/hub/defaults.ts +0 -70
- package/src/hub/discovery.ts +0 -247
- package/src/hub/index.ts +0 -14
- package/src/hub/native-transport.ts +0 -31
- package/src/hub/runtime-handlers.ts +0 -141
- package/src/hub/server.ts +0 -2317
- package/src/hub/session-client.ts +0 -502
- package/src/hub/start-shared-server.ts +0 -61
- package/src/hub/transport.ts +0 -14
- package/src/hub/ui-client.ts +0 -126
- package/src/hub/workspace.ts +0 -19
- package/src/index.ts +0 -688
- package/src/llms/cline-recommended-models.ts +0 -167
- package/src/llms/configured-provider-registry.ts +0 -193
- package/src/llms/handler-factory.ts +0 -56
- package/src/llms/provider-defaults.ts +0 -653
- package/src/llms/provider-settings.ts +0 -310
- package/src/llms/runtime-config.ts +0 -43
- package/src/llms/runtime-registry.ts +0 -172
- package/src/llms/runtime-types.ts +0 -121
- package/src/runtime/agent-config-adapter.ts +0 -636
- package/src/runtime/agent-runtime-config-builder.ts +0 -205
- package/src/runtime/error-feedback.ts +0 -142
- package/src/runtime/history.ts +0 -374
- package/src/runtime/host.ts +0 -222
- package/src/runtime/index.ts +0 -23
- package/src/runtime/loop-detection.ts +0 -162
- package/src/runtime/mistake-tracker.ts +0 -221
- package/src/runtime/rules.ts +0 -49
- package/src/runtime/runtime-builder.ts +0 -814
- package/src/runtime/runtime-event-adapter.ts +0 -412
- package/src/runtime/runtime-host.ts +0 -250
- package/src/runtime/runtime-oauth-token-manager.ts +0 -268
- package/src/runtime/session-runtime-orchestrator.ts +0 -1253
- package/src/runtime/session-runtime.ts +0 -69
- package/src/runtime/subprocess-sandbox.ts +0 -255
- package/src/runtime/tool-approval.ts +0 -102
- package/src/runtime/user-input-builder.ts +0 -167
- package/src/services/agent-events.ts +0 -256
- package/src/services/config.ts +0 -5
- package/src/services/global-settings.ts +0 -122
- package/src/services/local-runtime-bootstrap.ts +0 -424
- package/src/services/plugin-tools.ts +0 -86
- package/src/services/providers/local-provider-registry.ts +0 -456
- package/src/services/providers/local-provider-service.ts +0 -772
- package/src/services/session-artifacts.ts +0 -138
- package/src/services/session-data.ts +0 -398
- package/src/services/session-telemetry.ts +0 -89
- package/src/services/storage/artifact-store.ts +0 -1
- package/src/services/storage/file-team-store.ts +0 -250
- package/src/services/storage/index.ts +0 -11
- package/src/services/storage/provider-settings-legacy-migration.ts +0 -789
- package/src/services/storage/provider-settings-manager.ts +0 -167
- package/src/services/storage/session-store.ts +0 -1
- package/src/services/storage/sqlite-session-store.ts +0 -270
- package/src/services/storage/sqlite-team-store.ts +0 -537
- package/src/services/storage/team-store.ts +0 -36
- package/src/services/telemetry/ITelemetryAdapter.ts +0 -94
- package/src/services/telemetry/OpenTelemetryAdapter.ts +0 -348
- package/src/services/telemetry/OpenTelemetryProvider.ts +0 -415
- package/src/services/telemetry/TelemetryLoggerSink.ts +0 -121
- package/src/services/telemetry/TelemetryService.ts +0 -139
- package/src/services/telemetry/core-events.ts +0 -400
- package/src/services/telemetry/distinct-id.ts +0 -58
- package/src/services/telemetry/index.ts +0 -20
- package/src/services/usage.ts +0 -32
- package/src/services/workspace/file-indexer.ts +0 -351
- package/src/services/workspace/index.ts +0 -7
- package/src/services/workspace/mention-enricher.ts +0 -122
- package/src/services/workspace-manifest.ts +0 -72
- package/src/session/conversation-store.ts +0 -77
- package/src/session/file-session-service.ts +0 -282
- package/src/session/index.ts +0 -32
- package/src/session/message-builder.ts +0 -941
- package/src/session/persistence-service.ts +0 -559
- package/src/session/session-graph.ts +0 -92
- package/src/session/session-manifest-store.ts +0 -158
- package/src/session/session-manifest.ts +0 -29
- package/src/session/session-row.ts +0 -199
- package/src/session/session-service.ts +0 -324
- package/src/session/session-team-coordination.ts +0 -240
- package/src/session/subagent-session-manager.ts +0 -397
- package/src/session/team-persistence-store.ts +0 -176
- package/src/session/workspace-manager.ts +0 -100
- package/src/transports/hub.ts +0 -1081
- package/src/transports/local.ts +0 -1826
- package/src/transports/remote.ts +0 -27
- package/src/transports/runtime-host-support.ts +0 -140
- package/src/types/chat-schema.ts +0 -81
- package/src/types/common.ts +0 -26
- package/src/types/config.ts +0 -220
- package/src/types/events.ts +0 -80
- package/src/types/index.ts +0 -26
- package/src/types/provider-settings.ts +0 -54
- package/src/types/session.ts +0 -111
- package/src/types/sessions.ts +0 -37
- package/src/types/storage.ts +0 -56
- package/src/types.ts +0 -167
- package/src/version.ts +0 -3
|
@@ -1,738 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default Tool Definitions
|
|
3
|
-
*
|
|
4
|
-
* Factory functions for creating the default tools.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
createTool,
|
|
9
|
-
type Tool,
|
|
10
|
-
validateWithZod,
|
|
11
|
-
zodToJsonSchema,
|
|
12
|
-
} from "@clinebot/shared";
|
|
13
|
-
import {
|
|
14
|
-
formatError,
|
|
15
|
-
formatReadFileQuery,
|
|
16
|
-
formatRunCommandQuery,
|
|
17
|
-
getEditorSizeError,
|
|
18
|
-
getReadFileRangeError,
|
|
19
|
-
normalizeReadFileRequests,
|
|
20
|
-
normalizeRunCommandsInput,
|
|
21
|
-
withTimeout,
|
|
22
|
-
} from "./helpers";
|
|
23
|
-
import {
|
|
24
|
-
type ApplyPatchInput,
|
|
25
|
-
ApplyPatchInputSchema,
|
|
26
|
-
ApplyPatchInputUnionSchema,
|
|
27
|
-
type AskQuestionInput,
|
|
28
|
-
AskQuestionInputSchema,
|
|
29
|
-
type EditFileInput,
|
|
30
|
-
EditFileInputSchema,
|
|
31
|
-
type FetchWebContentInput,
|
|
32
|
-
FetchWebContentInputSchema,
|
|
33
|
-
type ReadFilesInput,
|
|
34
|
-
ReadFilesInputSchema,
|
|
35
|
-
type RunCommandsInput,
|
|
36
|
-
RunCommandsInputSchema,
|
|
37
|
-
RunCommandsInputUnionSchema,
|
|
38
|
-
type SearchCodebaseInput,
|
|
39
|
-
SearchCodebaseInputSchema,
|
|
40
|
-
SearchCodebaseUnionInputSchema,
|
|
41
|
-
type SkillsInput,
|
|
42
|
-
SkillsInputSchema,
|
|
43
|
-
type StructuredCommandInput,
|
|
44
|
-
StructuredCommandsInputUnionSchema,
|
|
45
|
-
type SubmitInput,
|
|
46
|
-
SubmitInputSchema,
|
|
47
|
-
} from "./schemas";
|
|
48
|
-
import type {
|
|
49
|
-
ApplyPatchExecutor,
|
|
50
|
-
AskQuestionExecutor,
|
|
51
|
-
BashExecutor,
|
|
52
|
-
CreateDefaultToolsOptions,
|
|
53
|
-
DefaultToolsConfig,
|
|
54
|
-
EditorExecutor,
|
|
55
|
-
FileReadExecutor,
|
|
56
|
-
SearchExecutor,
|
|
57
|
-
SkillsExecutorWithMetadata,
|
|
58
|
-
ToolOperationResult,
|
|
59
|
-
VerifySubmitExecutor,
|
|
60
|
-
WebFetchExecutor,
|
|
61
|
-
} from "./types";
|
|
62
|
-
|
|
63
|
-
// =============================================================================
|
|
64
|
-
// Helper Functions
|
|
65
|
-
// =============================================================================
|
|
66
|
-
|
|
67
|
-
// =============================================================================
|
|
68
|
-
// Tool Factory Functions
|
|
69
|
-
// =============================================================================
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Create the read_files tool
|
|
73
|
-
*
|
|
74
|
-
* Reads the content of one or more files from the filesystem.
|
|
75
|
-
*/
|
|
76
|
-
export function createReadFilesTool(
|
|
77
|
-
executor: FileReadExecutor,
|
|
78
|
-
config: Pick<DefaultToolsConfig, "fileReadTimeoutMs"> = {},
|
|
79
|
-
): Tool<ReadFilesInput, ToolOperationResult[]> {
|
|
80
|
-
const timeoutMs = config.fileReadTimeoutMs ?? 10000;
|
|
81
|
-
|
|
82
|
-
return createTool<ReadFilesInput, ToolOperationResult[]>({
|
|
83
|
-
name: "read_files",
|
|
84
|
-
description:
|
|
85
|
-
"Read the full content of text or image files at the provided absolute paths, or return only an inclusive one-based line range when start_line/end_line are provided. " +
|
|
86
|
-
"Returns file contents or error messages for each path.",
|
|
87
|
-
inputSchema: zodToJsonSchema(ReadFilesInputSchema),
|
|
88
|
-
timeoutMs: timeoutMs * 2, // Account for multiple files
|
|
89
|
-
retryable: true,
|
|
90
|
-
maxRetries: 1,
|
|
91
|
-
execute: async (input, context) => {
|
|
92
|
-
const requests = normalizeReadFileRequests(input);
|
|
93
|
-
|
|
94
|
-
return Promise.all(
|
|
95
|
-
requests.map(async (request): Promise<ToolOperationResult> => {
|
|
96
|
-
const rangeError = getReadFileRangeError(request);
|
|
97
|
-
if (rangeError) {
|
|
98
|
-
return {
|
|
99
|
-
query: formatReadFileQuery(request),
|
|
100
|
-
result: "",
|
|
101
|
-
error: `Invalid file range: ${rangeError}`,
|
|
102
|
-
success: false,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
const content = await withTimeout(
|
|
108
|
-
executor(request, context),
|
|
109
|
-
timeoutMs,
|
|
110
|
-
`File read timed out after ${timeoutMs}ms`,
|
|
111
|
-
);
|
|
112
|
-
return {
|
|
113
|
-
query: formatReadFileQuery(request),
|
|
114
|
-
result: content,
|
|
115
|
-
success: true,
|
|
116
|
-
};
|
|
117
|
-
} catch (error) {
|
|
118
|
-
const msg = formatError(error);
|
|
119
|
-
return {
|
|
120
|
-
query: formatReadFileQuery(request),
|
|
121
|
-
result: "",
|
|
122
|
-
error: `Error reading file: ${msg}`,
|
|
123
|
-
success: false,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
);
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Create the search_codebase tool
|
|
134
|
-
*
|
|
135
|
-
* Performs regex pattern searches across the codebase.
|
|
136
|
-
*/
|
|
137
|
-
export function createSearchTool(
|
|
138
|
-
executor: SearchExecutor,
|
|
139
|
-
config: Pick<DefaultToolsConfig, "cwd" | "searchTimeoutMs"> = {},
|
|
140
|
-
): Tool<SearchCodebaseInput, ToolOperationResult[]> {
|
|
141
|
-
const timeoutMs = config.searchTimeoutMs ?? 30000;
|
|
142
|
-
const cwd = config.cwd ?? process.cwd();
|
|
143
|
-
|
|
144
|
-
return createTool<SearchCodebaseInput, ToolOperationResult[]>({
|
|
145
|
-
name: "search_codebase",
|
|
146
|
-
description:
|
|
147
|
-
"Perform regex pattern searches across the codebase. " +
|
|
148
|
-
"Supports multiple parallel searches. " +
|
|
149
|
-
"Use for finding code patterns, function definitions, class names, imports, etc.",
|
|
150
|
-
inputSchema: zodToJsonSchema(SearchCodebaseInputSchema),
|
|
151
|
-
timeoutMs: timeoutMs * 2,
|
|
152
|
-
retryable: true,
|
|
153
|
-
maxRetries: 1,
|
|
154
|
-
execute: async (input, context) => {
|
|
155
|
-
// Validate input with Zod schema
|
|
156
|
-
const validate = validateWithZod(SearchCodebaseUnionInputSchema, input);
|
|
157
|
-
const queries = Array.isArray(validate)
|
|
158
|
-
? validate
|
|
159
|
-
: typeof validate === "object"
|
|
160
|
-
? Array.isArray(validate.queries)
|
|
161
|
-
? validate.queries
|
|
162
|
-
: [validate.queries]
|
|
163
|
-
: [validate];
|
|
164
|
-
|
|
165
|
-
return Promise.all(
|
|
166
|
-
queries.map(async (query): Promise<ToolOperationResult> => {
|
|
167
|
-
try {
|
|
168
|
-
const results = await withTimeout(
|
|
169
|
-
executor(query, cwd, context),
|
|
170
|
-
timeoutMs,
|
|
171
|
-
`Search timed out after ${timeoutMs}ms`,
|
|
172
|
-
);
|
|
173
|
-
// Check if results contain matches
|
|
174
|
-
const hasResults =
|
|
175
|
-
results.length > 0 && !results.includes("No results found");
|
|
176
|
-
return {
|
|
177
|
-
query,
|
|
178
|
-
result: results,
|
|
179
|
-
success: hasResults,
|
|
180
|
-
};
|
|
181
|
-
} catch (error) {
|
|
182
|
-
const msg = formatError(error);
|
|
183
|
-
return {
|
|
184
|
-
query,
|
|
185
|
-
result: "",
|
|
186
|
-
error: `Search failed: ${msg}`,
|
|
187
|
-
success: false,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
}),
|
|
191
|
-
);
|
|
192
|
-
},
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Create the run_commands tool
|
|
198
|
-
*
|
|
199
|
-
* Executes shell commands in the project directory.
|
|
200
|
-
*/
|
|
201
|
-
export function createBashTool(
|
|
202
|
-
executor: BashExecutor,
|
|
203
|
-
config: Pick<DefaultToolsConfig, "cwd" | "bashTimeoutMs"> = {},
|
|
204
|
-
): Tool<RunCommandsInput, ToolOperationResult[]> {
|
|
205
|
-
const timeoutMs = config.bashTimeoutMs ?? 30000;
|
|
206
|
-
const cwd = config.cwd ?? process.cwd();
|
|
207
|
-
|
|
208
|
-
return createTool<RunCommandsInput, ToolOperationResult[]>({
|
|
209
|
-
name: "run_commands",
|
|
210
|
-
description:
|
|
211
|
-
"Run shell commands from the root of the workspace. " +
|
|
212
|
-
"Use for listing files, checking git status, running builds, executing tests, etc. " +
|
|
213
|
-
"Commands should be properly shell-escaped.",
|
|
214
|
-
inputSchema: zodToJsonSchema(RunCommandsInputSchema),
|
|
215
|
-
timeoutMs: timeoutMs * 2,
|
|
216
|
-
retryable: false, // Shell commands often have side effects
|
|
217
|
-
maxRetries: 0,
|
|
218
|
-
execute: async (input, context) => {
|
|
219
|
-
const validate = validateWithZod(RunCommandsInputUnionSchema, input);
|
|
220
|
-
let commands: string[];
|
|
221
|
-
if (typeof validate === "string") {
|
|
222
|
-
commands = [validate];
|
|
223
|
-
} else if (Array.isArray(validate)) {
|
|
224
|
-
commands = validate;
|
|
225
|
-
} else if ("commands" in validate) {
|
|
226
|
-
commands = Array.isArray(validate.commands)
|
|
227
|
-
? validate.commands
|
|
228
|
-
: [validate.commands];
|
|
229
|
-
} else if ("command" in validate) {
|
|
230
|
-
commands = [validate.command];
|
|
231
|
-
} else {
|
|
232
|
-
commands = [validate.cmd];
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return Promise.all(
|
|
236
|
-
commands.map(async (command: string): Promise<ToolOperationResult> => {
|
|
237
|
-
try {
|
|
238
|
-
const output = await withTimeout(
|
|
239
|
-
executor(command, cwd, context),
|
|
240
|
-
timeoutMs,
|
|
241
|
-
`Command timed out after ${timeoutMs}ms`,
|
|
242
|
-
);
|
|
243
|
-
return {
|
|
244
|
-
query: command,
|
|
245
|
-
result: output,
|
|
246
|
-
success: true,
|
|
247
|
-
};
|
|
248
|
-
} catch (error) {
|
|
249
|
-
const msg = formatError(error);
|
|
250
|
-
return {
|
|
251
|
-
query: command,
|
|
252
|
-
result: "",
|
|
253
|
-
error: `Command failed: ${msg}`,
|
|
254
|
-
success: false,
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
}),
|
|
258
|
-
);
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Create the run_commands tool
|
|
265
|
-
*
|
|
266
|
-
* Executes shell commands in the project directory.
|
|
267
|
-
*/
|
|
268
|
-
export function createWindowsShellTool(
|
|
269
|
-
executor: BashExecutor,
|
|
270
|
-
config: Pick<DefaultToolsConfig, "cwd" | "bashTimeoutMs"> = {},
|
|
271
|
-
): Tool<StructuredCommandInput, ToolOperationResult[]> {
|
|
272
|
-
const timeoutMs = config.bashTimeoutMs ?? 30000;
|
|
273
|
-
const cwd = config.cwd ?? process.cwd();
|
|
274
|
-
|
|
275
|
-
return createTool<StructuredCommandInput, ToolOperationResult[]>({
|
|
276
|
-
name: "run_commands",
|
|
277
|
-
description:
|
|
278
|
-
"Run shell commands from the root of the workspacein Windows environment. " +
|
|
279
|
-
"Use for listing files, checking git status, running builds, executing tests, etc. " +
|
|
280
|
-
"Prefer structured { command, args } entries for portability; plain string commands should be properly shell-escaped.",
|
|
281
|
-
inputSchema: zodToJsonSchema(StructuredCommandsInputUnionSchema),
|
|
282
|
-
timeoutMs: timeoutMs * 2,
|
|
283
|
-
retryable: false, // Shell commands often have side effects
|
|
284
|
-
maxRetries: 0,
|
|
285
|
-
execute: async (input, context) => {
|
|
286
|
-
const commands = normalizeRunCommandsInput(input);
|
|
287
|
-
|
|
288
|
-
return Promise.all(
|
|
289
|
-
commands.map(async (command): Promise<ToolOperationResult> => {
|
|
290
|
-
try {
|
|
291
|
-
const output = await withTimeout(
|
|
292
|
-
executor(command, cwd, context),
|
|
293
|
-
timeoutMs,
|
|
294
|
-
`Command timed out after ${timeoutMs}ms`,
|
|
295
|
-
);
|
|
296
|
-
return {
|
|
297
|
-
query: formatRunCommandQuery(command),
|
|
298
|
-
result: output,
|
|
299
|
-
success: true,
|
|
300
|
-
};
|
|
301
|
-
} catch (error) {
|
|
302
|
-
const msg = formatError(error);
|
|
303
|
-
return {
|
|
304
|
-
query: formatRunCommandQuery(command),
|
|
305
|
-
result: "",
|
|
306
|
-
error: `Command failed: ${msg}`,
|
|
307
|
-
success: false,
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
}),
|
|
311
|
-
);
|
|
312
|
-
},
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Create the fetch_web_content tool
|
|
318
|
-
*
|
|
319
|
-
* Fetches content from URLs and analyzes them using provided prompts.
|
|
320
|
-
*/
|
|
321
|
-
export function createWebFetchTool(
|
|
322
|
-
executor: WebFetchExecutor,
|
|
323
|
-
config: Pick<DefaultToolsConfig, "webFetchTimeoutMs"> = {},
|
|
324
|
-
): Tool<FetchWebContentInput, ToolOperationResult[]> {
|
|
325
|
-
const timeoutMs = config.webFetchTimeoutMs ?? 30000;
|
|
326
|
-
|
|
327
|
-
return createTool<FetchWebContentInput, ToolOperationResult[]>({
|
|
328
|
-
name: "fetch_web_content",
|
|
329
|
-
description:
|
|
330
|
-
"Fetch content from URLs and analyze them using the provided prompts. " +
|
|
331
|
-
"Use for retrieving documentation, API references, or any web content. " +
|
|
332
|
-
"Each request includes a URL and a prompt describing what information to extract.",
|
|
333
|
-
inputSchema: zodToJsonSchema(FetchWebContentInputSchema),
|
|
334
|
-
timeoutMs: timeoutMs * 2,
|
|
335
|
-
retryable: true,
|
|
336
|
-
maxRetries: 2,
|
|
337
|
-
execute: async (input, context) => {
|
|
338
|
-
// Validate input with Zod schema
|
|
339
|
-
const validatedInput = validateWithZod(FetchWebContentInputSchema, input);
|
|
340
|
-
|
|
341
|
-
return Promise.all(
|
|
342
|
-
validatedInput.requests.map(
|
|
343
|
-
async (request): Promise<ToolOperationResult> => {
|
|
344
|
-
try {
|
|
345
|
-
const content = await withTimeout(
|
|
346
|
-
executor(request.url, request.prompt, context),
|
|
347
|
-
timeoutMs,
|
|
348
|
-
`Web fetch timed out after ${timeoutMs}ms`,
|
|
349
|
-
);
|
|
350
|
-
return {
|
|
351
|
-
query: request.url,
|
|
352
|
-
result: content,
|
|
353
|
-
success: true,
|
|
354
|
-
};
|
|
355
|
-
} catch (error) {
|
|
356
|
-
const msg = formatError(error);
|
|
357
|
-
return {
|
|
358
|
-
query: request.url,
|
|
359
|
-
result: "",
|
|
360
|
-
error: `Error fetching web content: ${msg}`,
|
|
361
|
-
success: false,
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
),
|
|
366
|
-
);
|
|
367
|
-
},
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const APPLY_PATCH_TOOL_DESC = `Use \`apply_patch\` to edit files with the canonical freeform patch grammar. Pass the patch text directly as the \`input\` string. Prefer the exact format below:
|
|
372
|
-
|
|
373
|
-
*** Begin Patch
|
|
374
|
-
*** Update File: path/to/file.ts
|
|
375
|
-
@@ optional section marker
|
|
376
|
-
[context before]
|
|
377
|
-
-[old line]
|
|
378
|
-
+[new line]
|
|
379
|
-
[context after]
|
|
380
|
-
*** End Patch
|
|
381
|
-
|
|
382
|
-
Supported actions:
|
|
383
|
-
- \`*** Add File: <path>\`
|
|
384
|
-
- \`*** Update File: <path>\`
|
|
385
|
-
- \`*** Delete File: <path>\`
|
|
386
|
-
- optional \`*** Move to: <new path>\` immediately after an Update File header
|
|
387
|
-
|
|
388
|
-
Rules:
|
|
389
|
-
- In an Add File section, every file-content line must start with \`+\`.
|
|
390
|
-
- In an Update section, use context lines plus \`-\` and \`+\` lines to describe the change.
|
|
391
|
-
- Use \`@@\` markers when extra context is needed to disambiguate repeated code blocks.
|
|
392
|
-
- Do not use line numbers; this format is context-based.
|
|
393
|
-
- Prefer sending the patch body directly. Legacy shell wrappers such as \`%%bash\` and \`apply_patch <<"EOF"\` are accepted for compatibility but are not preferred.
|
|
394
|
-
|
|
395
|
-
Example:
|
|
396
|
-
|
|
397
|
-
*** Begin Patch
|
|
398
|
-
*** Update File: src/page.tsx
|
|
399
|
-
@@
|
|
400
|
-
return (
|
|
401
|
-
<div>
|
|
402
|
-
<button onClick={() => console.log("clicked")}>Click me</button>
|
|
403
|
-
+ <button onClick={() => console.log("cancel clicked")}>Cancel</button>
|
|
404
|
-
</div>
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
*** End Patch`;
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Create the apply_patch tool
|
|
411
|
-
*
|
|
412
|
-
* Applies the canonical apply_patch format to one or more files.
|
|
413
|
-
*/
|
|
414
|
-
export function createApplyPatchTool(
|
|
415
|
-
executor: ApplyPatchExecutor,
|
|
416
|
-
config: Pick<DefaultToolsConfig, "cwd" | "applyPatchTimeoutMs"> = {},
|
|
417
|
-
): Tool<ApplyPatchInput, ToolOperationResult> {
|
|
418
|
-
const timeoutMs = config.applyPatchTimeoutMs ?? 30000;
|
|
419
|
-
const cwd = config.cwd ?? process.cwd();
|
|
420
|
-
|
|
421
|
-
return createTool<ApplyPatchInput, ToolOperationResult>({
|
|
422
|
-
name: "apply_patch",
|
|
423
|
-
description: APPLY_PATCH_TOOL_DESC,
|
|
424
|
-
inputSchema: zodToJsonSchema(ApplyPatchInputSchema),
|
|
425
|
-
timeoutMs,
|
|
426
|
-
retryable: false,
|
|
427
|
-
maxRetries: 0,
|
|
428
|
-
execute: async (input, context) => {
|
|
429
|
-
const validate = validateWithZod(ApplyPatchInputUnionSchema, input);
|
|
430
|
-
const patchInput =
|
|
431
|
-
typeof validate === "string" ? validate : validate.input;
|
|
432
|
-
|
|
433
|
-
try {
|
|
434
|
-
const result = await withTimeout(
|
|
435
|
-
executor({ input: patchInput }, cwd, context),
|
|
436
|
-
timeoutMs,
|
|
437
|
-
`apply_patch timed out after ${timeoutMs}ms`,
|
|
438
|
-
);
|
|
439
|
-
|
|
440
|
-
return {
|
|
441
|
-
query: "apply_patch",
|
|
442
|
-
result,
|
|
443
|
-
success: true,
|
|
444
|
-
};
|
|
445
|
-
} catch (error) {
|
|
446
|
-
const msg = formatError(error);
|
|
447
|
-
return {
|
|
448
|
-
query: "apply_patch",
|
|
449
|
-
result: "",
|
|
450
|
-
error: `apply_patch failed: ${msg}`,
|
|
451
|
-
success: false,
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Create the editor tool
|
|
460
|
-
*
|
|
461
|
-
* Supports controlled filesystem edits with create, replace, and insert commands.
|
|
462
|
-
*/
|
|
463
|
-
export function createEditorTool(
|
|
464
|
-
executor: EditorExecutor,
|
|
465
|
-
config: Pick<DefaultToolsConfig, "cwd" | "editorTimeoutMs"> = {},
|
|
466
|
-
): Tool<EditFileInput, ToolOperationResult> {
|
|
467
|
-
const timeoutMs = config.editorTimeoutMs ?? 30000;
|
|
468
|
-
const cwd = config.cwd ?? process.cwd();
|
|
469
|
-
|
|
470
|
-
return createTool<EditFileInput, ToolOperationResult>({
|
|
471
|
-
name: "editor",
|
|
472
|
-
description:
|
|
473
|
-
"An editor for controlled filesystem edits on the text file at the provided path. " +
|
|
474
|
-
"Provide `insert_line` to insert `new_text` at a specific line number. " +
|
|
475
|
-
"Otherwise, the tool replaces `old_text` with `new_text`, or creates the file with `new_text` if file does not exist. " +
|
|
476
|
-
"Use this tools for making small, precise edits to existing files or creating new files over shell commands.",
|
|
477
|
-
|
|
478
|
-
inputSchema: zodToJsonSchema(EditFileInputSchema),
|
|
479
|
-
timeoutMs,
|
|
480
|
-
retryable: false, // Editing operations are stateful and should not auto-retry
|
|
481
|
-
maxRetries: 0,
|
|
482
|
-
execute: async (input, context) => {
|
|
483
|
-
const validatedInput = validateWithZod(EditFileInputSchema, input);
|
|
484
|
-
const operation = validatedInput.insert_line == null ? "edit" : "insert";
|
|
485
|
-
const sizeError = getEditorSizeError(validatedInput);
|
|
486
|
-
|
|
487
|
-
if (sizeError) {
|
|
488
|
-
return {
|
|
489
|
-
query: `${operation}:${validatedInput.path}`,
|
|
490
|
-
result: "",
|
|
491
|
-
error: sizeError,
|
|
492
|
-
success: false,
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
try {
|
|
497
|
-
const result = await withTimeout(
|
|
498
|
-
executor(validatedInput, cwd, context),
|
|
499
|
-
timeoutMs,
|
|
500
|
-
`Editor operation timed out after ${timeoutMs}ms`,
|
|
501
|
-
);
|
|
502
|
-
|
|
503
|
-
return {
|
|
504
|
-
query: `${operation}:${validatedInput.path}`,
|
|
505
|
-
result,
|
|
506
|
-
success: true,
|
|
507
|
-
};
|
|
508
|
-
} catch (error) {
|
|
509
|
-
const msg = formatError(error);
|
|
510
|
-
return {
|
|
511
|
-
query: `${operation}:${validatedInput.path}`,
|
|
512
|
-
result: "",
|
|
513
|
-
error: `Editor operation failed: ${msg}`,
|
|
514
|
-
success: false,
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Create the skills tool
|
|
523
|
-
*
|
|
524
|
-
* Invokes a configured skill by name and optional arguments.
|
|
525
|
-
*/
|
|
526
|
-
export function createSkillsTool(
|
|
527
|
-
executor: SkillsExecutorWithMetadata,
|
|
528
|
-
config: Pick<DefaultToolsConfig, "skillsTimeoutMs"> = {},
|
|
529
|
-
): Tool<SkillsInput, string> {
|
|
530
|
-
const timeoutMs = config.skillsTimeoutMs ?? 15000;
|
|
531
|
-
|
|
532
|
-
const baseDescription =
|
|
533
|
-
"Execute a skill within the main conversation. " +
|
|
534
|
-
"When users ask you to perform tasks, check if any available skills match. " +
|
|
535
|
-
"When users reference a slash command, invoke it with this tool. " +
|
|
536
|
-
'Input: `skill` (required) and optional `args`. Example: `skill: "pdf"`, `skill: "commit", args: "-m \\"Fix bug\\""`, `skill: "review-pr", args: "123"`, `skill: "ms-office-suite:pdf"`. ' +
|
|
537
|
-
"When a skill matches the user's request, invoking this tool is a blocking requirement before any other response. " +
|
|
538
|
-
"Never mention a skill without invoking this tool.";
|
|
539
|
-
|
|
540
|
-
const tool = createTool<SkillsInput, string>({
|
|
541
|
-
name: "skills",
|
|
542
|
-
description: baseDescription,
|
|
543
|
-
inputSchema: zodToJsonSchema(SkillsInputSchema),
|
|
544
|
-
timeoutMs,
|
|
545
|
-
retryable: false,
|
|
546
|
-
maxRetries: 0,
|
|
547
|
-
execute: async (input, context) => {
|
|
548
|
-
const validatedInput = validateWithZod(SkillsInputSchema, input);
|
|
549
|
-
return withTimeout(
|
|
550
|
-
executor(
|
|
551
|
-
validatedInput.skill,
|
|
552
|
-
validatedInput.args || undefined,
|
|
553
|
-
context,
|
|
554
|
-
),
|
|
555
|
-
timeoutMs,
|
|
556
|
-
`Skills operation timed out after ${timeoutMs}ms`,
|
|
557
|
-
);
|
|
558
|
-
},
|
|
559
|
-
});
|
|
560
|
-
|
|
561
|
-
Object.defineProperty(tool, "description", {
|
|
562
|
-
get() {
|
|
563
|
-
const skills = executor.configuredSkills
|
|
564
|
-
?.filter((s) => !s.disabled)
|
|
565
|
-
.map((s) => s.name);
|
|
566
|
-
if (skills && skills.length > 0) {
|
|
567
|
-
return `${baseDescription} Available skills: ${skills.join(", ")}.`;
|
|
568
|
-
}
|
|
569
|
-
return baseDescription;
|
|
570
|
-
},
|
|
571
|
-
enumerable: true,
|
|
572
|
-
configurable: true,
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
return tool;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* Create the ask_question tool
|
|
580
|
-
*
|
|
581
|
-
* Asks the user a single clarifying question with 2-5 selectable options.
|
|
582
|
-
*/
|
|
583
|
-
export function createAskQuestionTool(
|
|
584
|
-
executor: AskQuestionExecutor,
|
|
585
|
-
): Tool<AskQuestionInput, string> {
|
|
586
|
-
return {
|
|
587
|
-
name: "ask_question",
|
|
588
|
-
description:
|
|
589
|
-
"Ask user a question for clarifying or gathering information needed to complete the task. " +
|
|
590
|
-
"For example, ask the user clarifying questions about a key implementation decision. " +
|
|
591
|
-
"You should only ask one question. " +
|
|
592
|
-
"Provide an array of 2-5 options for the user to choose from. " +
|
|
593
|
-
"Never include an option to toggle to Act mode.",
|
|
594
|
-
inputSchema: zodToJsonSchema(AskQuestionInputSchema),
|
|
595
|
-
retryable: false,
|
|
596
|
-
maxRetries: 0,
|
|
597
|
-
execute: async (input, context) => {
|
|
598
|
-
const validatedInput = validateWithZod(AskQuestionInputSchema, input);
|
|
599
|
-
return executor(validatedInput.question, validatedInput.options, context);
|
|
600
|
-
},
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
export function createSubmitAndExitTool(
|
|
605
|
-
executor: VerifySubmitExecutor,
|
|
606
|
-
config: Pick<DefaultToolsConfig, "submitTimeoutMs"> = {},
|
|
607
|
-
): Tool<SubmitInput, string> {
|
|
608
|
-
const timeoutMs = config.submitTimeoutMs ?? 15000;
|
|
609
|
-
|
|
610
|
-
return createTool<SubmitInput, string>({
|
|
611
|
-
name: "submit_and_exit",
|
|
612
|
-
description:
|
|
613
|
-
"Submit the final answer and exit the conversation. " +
|
|
614
|
-
"For example, submit a summary of the investigation and confirm the issue is resolved. " +
|
|
615
|
-
"You should only submit once all necessary steps are completed. " +
|
|
616
|
-
"Provide a summary of the investigation and confirm the issue is resolved.",
|
|
617
|
-
inputSchema: zodToJsonSchema(SubmitInputSchema),
|
|
618
|
-
timeoutMs,
|
|
619
|
-
retryable: false,
|
|
620
|
-
maxRetries: 0,
|
|
621
|
-
execute: async (input, context) => {
|
|
622
|
-
const validatedInput = validateWithZod(SubmitInputSchema, input);
|
|
623
|
-
return withTimeout(
|
|
624
|
-
executor(validatedInput.summary, validatedInput.verified, context),
|
|
625
|
-
timeoutMs,
|
|
626
|
-
`submit_and_exit timed out after ${timeoutMs}ms`,
|
|
627
|
-
);
|
|
628
|
-
},
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
// =============================================================================
|
|
633
|
-
// Default Tools Factory
|
|
634
|
-
// =============================================================================
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* Create a set of default tools for an agent
|
|
638
|
-
*
|
|
639
|
-
* This function creates the default tools based on the provided configuration
|
|
640
|
-
* and executors. Only tools that are enabled AND have an executor provided
|
|
641
|
-
* will be included in the returned array.
|
|
642
|
-
*
|
|
643
|
-
* @example
|
|
644
|
-
* ```typescript
|
|
645
|
-
* import { Agent, createDefaultTools } from "@clinebot/core"
|
|
646
|
-
* import * as fs from "fs/promises"
|
|
647
|
-
* import { exec } from "child_process"
|
|
648
|
-
*
|
|
649
|
-
* const tools = createDefaultTools({
|
|
650
|
-
* executors: {
|
|
651
|
-
* readFile: async ({ path }) => fs.readFile(path, "utf-8"),
|
|
652
|
-
* bash: async (cmd, cwd) => {
|
|
653
|
-
* return new Promise((resolve, reject) => {
|
|
654
|
-
* exec(cmd, { cwd }, (err, stdout, stderr) => {
|
|
655
|
-
* if (err) reject(new Error(stderr || err.message))
|
|
656
|
-
* else resolve(stdout)
|
|
657
|
-
* })
|
|
658
|
-
* })
|
|
659
|
-
* },
|
|
660
|
-
* },
|
|
661
|
-
* enableReadFiles: true,
|
|
662
|
-
* enableBash: true,
|
|
663
|
-
* enableSearch: false, // Disabled
|
|
664
|
-
* enableWebFetch: false, // Disabled
|
|
665
|
-
* cwd: "/path/to/project",
|
|
666
|
-
* })
|
|
667
|
-
*
|
|
668
|
-
* const agent = new Agent({
|
|
669
|
-
* // ... provider config
|
|
670
|
-
* tools,
|
|
671
|
-
* })
|
|
672
|
-
* ```
|
|
673
|
-
*/
|
|
674
|
-
export function createDefaultTools(options: CreateDefaultToolsOptions): Tool[] {
|
|
675
|
-
const {
|
|
676
|
-
executors,
|
|
677
|
-
enableReadFiles = true,
|
|
678
|
-
enableSearch = true,
|
|
679
|
-
enableBash = true,
|
|
680
|
-
enableWebFetch = true,
|
|
681
|
-
enableApplyPatch = false,
|
|
682
|
-
enableEditor = true,
|
|
683
|
-
enableSkills = true,
|
|
684
|
-
enableAskQuestion = true,
|
|
685
|
-
enableSubmitAndExit = false,
|
|
686
|
-
...config
|
|
687
|
-
} = options;
|
|
688
|
-
|
|
689
|
-
const tools: Tool<any>[] = [];
|
|
690
|
-
|
|
691
|
-
// Add read_files tool if enabled and executor provided
|
|
692
|
-
if (enableReadFiles && executors.readFile) {
|
|
693
|
-
tools.push(createReadFilesTool(executors.readFile, config));
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
// Add search_codebase tool if enabled and executor provided
|
|
697
|
-
if (enableSearch && executors.search) {
|
|
698
|
-
tools.push(createSearchTool(executors.search, config));
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
// Add run_commands tool if enabled and executor provided
|
|
702
|
-
if (enableBash && executors.bash) {
|
|
703
|
-
if (process.platform === "win32") {
|
|
704
|
-
tools.push(createWindowsShellTool(executors.bash, config));
|
|
705
|
-
} else {
|
|
706
|
-
tools.push(createBashTool(executors.bash, config));
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
// Add fetch_web_content tool if enabled and executor provided
|
|
711
|
-
if (enableWebFetch && executors.webFetch) {
|
|
712
|
-
tools.push(createWebFetchTool(executors.webFetch, config));
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
// Add editor tool if enabled and executor provided,
|
|
716
|
-
// else check if apply_patch tool is enabled and executor provided
|
|
717
|
-
// NOTE: Do not enable two similar tools at the same time.
|
|
718
|
-
if (enableEditor && executors.editor) {
|
|
719
|
-
tools.push(createEditorTool(executors.editor, config));
|
|
720
|
-
} else if (enableApplyPatch && executors.applyPatch) {
|
|
721
|
-
tools.push(createApplyPatchTool(executors.applyPatch, config));
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
// Add skills tool if enabled and executor provided
|
|
725
|
-
if (enableSkills && executors.skills) {
|
|
726
|
-
tools.push(createSkillsTool(executors.skills, config));
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
// Add ask_question tool if enabled and executor provided
|
|
730
|
-
if (enableAskQuestion && executors.askQuestion) {
|
|
731
|
-
tools.push(createAskQuestionTool(executors.askQuestion));
|
|
732
|
-
} else if (enableSubmitAndExit && executors.submit) {
|
|
733
|
-
// Add submit_and_exit tool if enabled and executor provided
|
|
734
|
-
tools.push(createSubmitAndExitTool(executors.submit, config));
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
return tools;
|
|
738
|
-
}
|