@caupulican/pi-adaptative 0.80.85 → 0.80.88
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/CHANGELOG.md +160 -1
- package/dist/core/agent-session.d.ts +394 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1862 -46
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts +4 -0
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -0
- package/dist/core/autonomy/approval-gate.js +27 -0
- package/dist/core/autonomy/approval-gate.js.map +1 -0
- package/dist/core/autonomy/bounded-completion.d.ts +27 -0
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -0
- package/dist/core/autonomy/bounded-completion.js +44 -0
- package/dist/core/autonomy/bounded-completion.js.map +1 -0
- package/dist/core/autonomy/contracts.d.ts +129 -0
- package/dist/core/autonomy/contracts.d.ts.map +1 -0
- package/dist/core/autonomy/contracts.js +2 -0
- package/dist/core/autonomy/contracts.js.map +1 -0
- package/dist/core/autonomy/gates.d.ts +15 -0
- package/dist/core/autonomy/gates.d.ts.map +1 -0
- package/dist/core/autonomy/gates.js +205 -0
- package/dist/core/autonomy/gates.js.map +1 -0
- package/dist/core/autonomy/lane-tracker.d.ts +48 -0
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -0
- package/dist/core/autonomy/lane-tracker.js +125 -0
- package/dist/core/autonomy/lane-tracker.js.map +1 -0
- package/dist/core/autonomy/path-scope.d.ts +9 -0
- package/dist/core/autonomy/path-scope.d.ts.map +1 -0
- package/dist/core/autonomy/path-scope.js +122 -0
- package/dist/core/autonomy/path-scope.js.map +1 -0
- package/dist/core/autonomy/risk-assessment.d.ts +3 -0
- package/dist/core/autonomy/risk-assessment.d.ts.map +1 -0
- package/dist/core/autonomy/risk-assessment.js +122 -0
- package/dist/core/autonomy/risk-assessment.js.map +1 -0
- package/dist/core/autonomy/session-lane-record.d.ts +10 -0
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -0
- package/dist/core/autonomy/session-lane-record.js +36 -0
- package/dist/core/autonomy/session-lane-record.js.map +1 -0
- package/dist/core/autonomy/status.d.ts +40 -0
- package/dist/core/autonomy/status.d.ts.map +1 -0
- package/dist/core/autonomy/status.js +107 -0
- package/dist/core/autonomy/status.js.map +1 -0
- package/dist/core/autonomy/subagent-prompt.d.ts +21 -0
- package/dist/core/autonomy/subagent-prompt.d.ts.map +1 -0
- package/dist/core/autonomy/subagent-prompt.js +28 -0
- package/dist/core/autonomy/subagent-prompt.js.map +1 -0
- package/dist/core/autonomy/telemetry-events.d.ts +18 -0
- package/dist/core/autonomy/telemetry-events.d.ts.map +1 -0
- package/dist/core/autonomy/telemetry-events.js +60 -0
- package/dist/core/autonomy/telemetry-events.js.map +1 -0
- package/dist/core/context/artifact-retrieval.d.ts +49 -0
- package/dist/core/context/artifact-retrieval.d.ts.map +1 -0
- package/dist/core/context/artifact-retrieval.js +49 -0
- package/dist/core/context/artifact-retrieval.js.map +1 -0
- package/dist/core/context/context-artifacts.d.ts +94 -0
- package/dist/core/context/context-artifacts.d.ts.map +1 -0
- package/dist/core/context/context-artifacts.js +307 -0
- package/dist/core/context/context-artifacts.js.map +1 -0
- package/dist/core/context/context-audit.d.ts +66 -0
- package/dist/core/context/context-audit.d.ts.map +1 -0
- package/dist/core/context/context-audit.js +173 -0
- package/dist/core/context/context-audit.js.map +1 -0
- package/dist/core/context/context-item.d.ts +117 -0
- package/dist/core/context/context-item.d.ts.map +1 -0
- package/dist/core/context/context-item.js +36 -0
- package/dist/core/context/context-item.js.map +1 -0
- package/dist/core/context/context-prompt-enforcement.d.ts +73 -0
- package/dist/core/context/context-prompt-enforcement.d.ts.map +1 -0
- package/dist/core/context/context-prompt-enforcement.js +153 -0
- package/dist/core/context/context-prompt-enforcement.js.map +1 -0
- package/dist/core/context/context-prompt-policy.d.ts +90 -0
- package/dist/core/context/context-prompt-policy.d.ts.map +1 -0
- package/dist/core/context/context-prompt-policy.js +73 -0
- package/dist/core/context/context-prompt-policy.js.map +1 -0
- package/dist/core/context/context-retention.d.ts +36 -0
- package/dist/core/context/context-retention.d.ts.map +1 -0
- package/dist/core/context/context-retention.js +108 -0
- package/dist/core/context/context-retention.js.map +1 -0
- package/dist/core/context/context-store.d.ts +37 -0
- package/dist/core/context/context-store.d.ts.map +1 -0
- package/dist/core/context/context-store.js +45 -0
- package/dist/core/context/context-store.js.map +1 -0
- package/dist/core/context/memory-diagnostics.d.ts +50 -0
- package/dist/core/context/memory-diagnostics.d.ts.map +1 -0
- package/dist/core/context/memory-diagnostics.js +43 -0
- package/dist/core/context/memory-diagnostics.js.map +1 -0
- package/dist/core/context/memory-index-store.d.ts +28 -0
- package/dist/core/context/memory-index-store.d.ts.map +1 -0
- package/dist/core/context/memory-index-store.js +38 -0
- package/dist/core/context/memory-index-store.js.map +1 -0
- package/dist/core/context/memory-prompt-block.d.ts +34 -0
- package/dist/core/context/memory-prompt-block.d.ts.map +1 -0
- package/dist/core/context/memory-prompt-block.js +58 -0
- package/dist/core/context/memory-prompt-block.js.map +1 -0
- package/dist/core/context/memory-provider-contract.d.ts +114 -0
- package/dist/core/context/memory-provider-contract.d.ts.map +1 -0
- package/dist/core/context/memory-provider-contract.js +121 -0
- package/dist/core/context/memory-provider-contract.js.map +1 -0
- package/dist/core/context/memory-retrieval.d.ts +27 -0
- package/dist/core/context/memory-retrieval.d.ts.map +1 -0
- package/dist/core/context/memory-retrieval.js +91 -0
- package/dist/core/context/memory-retrieval.js.map +1 -0
- package/dist/core/context/okf-memory-provider.d.ts +26 -0
- package/dist/core/context/okf-memory-provider.d.ts.map +1 -0
- package/dist/core/context/okf-memory-provider.js +154 -0
- package/dist/core/context/okf-memory-provider.js.map +1 -0
- package/dist/core/context/okf-memory.d.ts +42 -0
- package/dist/core/context/okf-memory.d.ts.map +1 -0
- package/dist/core/context/okf-memory.js +175 -0
- package/dist/core/context/okf-memory.js.map +1 -0
- package/dist/core/context/policy-engine.d.ts +66 -0
- package/dist/core/context/policy-engine.d.ts.map +1 -0
- package/dist/core/context/policy-engine.js +171 -0
- package/dist/core/context/policy-engine.js.map +1 -0
- package/dist/core/context/policy-types.d.ts +102 -0
- package/dist/core/context/policy-types.d.ts.map +1 -0
- package/dist/core/context/policy-types.js +7 -0
- package/dist/core/context/policy-types.js.map +1 -0
- package/dist/core/context/sqlite-runtime-index.d.ts +19 -0
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -0
- package/dist/core/context/sqlite-runtime-index.js +344 -0
- package/dist/core/context/sqlite-runtime-index.js.map +1 -0
- package/dist/core/context/storage-authority.d.ts +20 -0
- package/dist/core/context/storage-authority.d.ts.map +1 -0
- package/dist/core/context/storage-authority.js +51 -0
- package/dist/core/context/storage-authority.js.map +1 -0
- package/dist/core/context/tool-output-packer.d.ts +75 -0
- package/dist/core/context/tool-output-packer.d.ts.map +1 -0
- package/dist/core/context/tool-output-packer.js +77 -0
- package/dist/core/context/tool-output-packer.js.map +1 -0
- package/dist/core/cost/session-usage.d.ts +20 -0
- package/dist/core/cost/session-usage.d.ts.map +1 -0
- package/dist/core/cost/session-usage.js +164 -0
- package/dist/core/cost/session-usage.js.map +1 -0
- package/dist/core/delegation/session-worker-result.d.ts +10 -0
- package/dist/core/delegation/session-worker-result.d.ts.map +1 -0
- package/dist/core/delegation/session-worker-result.js +36 -0
- package/dist/core/delegation/session-worker-result.js.map +1 -0
- package/dist/core/delegation/worker-result.d.ts +9 -0
- package/dist/core/delegation/worker-result.d.ts.map +1 -0
- package/dist/core/delegation/worker-result.js +152 -0
- package/dist/core/delegation/worker-result.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +58 -0
- package/dist/core/delegation/worker-runner.d.ts.map +1 -0
- package/dist/core/delegation/worker-runner.js +188 -0
- package/dist/core/delegation/worker-runner.js.map +1 -0
- package/dist/core/extensions/builtin.d.ts +5 -1
- package/dist/core/extensions/builtin.d.ts.map +1 -1
- package/dist/core/extensions/builtin.js +23 -1
- package/dist/core/extensions/builtin.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +5 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +13 -0
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/goals/goal-continuation-controller.d.ts +22 -0
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-continuation-controller.js +88 -0
- package/dist/core/goals/goal-continuation-controller.js.map +1 -0
- package/dist/core/goals/goal-continuation-defaults.d.ts +10 -0
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -0
- package/dist/core/goals/goal-continuation-defaults.js +10 -0
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -0
- package/dist/core/goals/goal-continuation-prompt.d.ts +18 -0
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -0
- package/dist/core/goals/goal-continuation-prompt.js +141 -0
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +19 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.js +23 -0
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -0
- package/dist/core/goals/goal-state.d.ts +87 -0
- package/dist/core/goals/goal-state.d.ts.map +1 -0
- package/dist/core/goals/goal-state.js +259 -0
- package/dist/core/goals/goal-state.js.map +1 -0
- package/dist/core/goals/goal-tool-core.d.ts +66 -0
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -0
- package/dist/core/goals/goal-tool-core.js +146 -0
- package/dist/core/goals/goal-tool-core.js.map +1 -0
- package/dist/core/goals/session-goal-state.d.ts +10 -0
- package/dist/core/goals/session-goal-state.d.ts.map +1 -0
- package/dist/core/goals/session-goal-state.js +35 -0
- package/dist/core/goals/session-goal-state.js.map +1 -0
- package/dist/core/learning/learning-audit.d.ts +45 -0
- package/dist/core/learning/learning-audit.d.ts.map +1 -0
- package/dist/core/learning/learning-audit.js +139 -0
- package/dist/core/learning/learning-audit.js.map +1 -0
- package/dist/core/learning/learning-gate.d.ts +29 -0
- package/dist/core/learning/learning-gate.d.ts.map +1 -0
- package/dist/core/learning/learning-gate.js +150 -0
- package/dist/core/learning/learning-gate.js.map +1 -0
- package/dist/core/learning/session-learning-decision.d.ts +10 -0
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -0
- package/dist/core/learning/session-learning-decision.js +36 -0
- package/dist/core/learning/session-learning-decision.js.map +1 -0
- package/dist/core/model-capability.d.ts +41 -0
- package/dist/core/model-capability.d.ts.map +1 -0
- package/dist/core/model-capability.js +101 -0
- package/dist/core/model-capability.js.map +1 -0
- package/dist/core/model-router/config-diagnostics.d.ts.map +1 -1
- package/dist/core/model-router/config-diagnostics.js +1 -0
- package/dist/core/model-router/config-diagnostics.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts +2 -0
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/intent-classifier.js +154 -9
- package/dist/core/model-router/intent-classifier.js.map +1 -1
- package/dist/core/model-router/route-judge.d.ts +54 -0
- package/dist/core/model-router/route-judge.d.ts.map +1 -0
- package/dist/core/model-router/route-judge.js +128 -0
- package/dist/core/model-router/route-judge.js.map +1 -0
- package/dist/core/model-router/status.d.ts +4 -1
- package/dist/core/model-router/status.d.ts.map +1 -1
- package/dist/core/model-router/status.js +30 -6
- package/dist/core/model-router/status.js.map +1 -1
- package/dist/core/model-router/tool-escalation.d.ts +4 -6
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js +1 -1
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +40 -0
- package/dist/core/models/fitness-store.d.ts.map +1 -0
- package/dist/core/models/fitness-store.js +61 -0
- package/dist/core/models/fitness-store.js.map +1 -0
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +1 -1
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +2 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +12 -4
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/research/automata-provider.d.ts +5 -0
- package/dist/core/research/automata-provider.d.ts.map +1 -0
- package/dist/core/research/automata-provider.js +15 -0
- package/dist/core/research/automata-provider.js.map +1 -0
- package/dist/core/research/evidence-bundle.d.ts +10 -0
- package/dist/core/research/evidence-bundle.d.ts.map +1 -0
- package/dist/core/research/evidence-bundle.js +116 -0
- package/dist/core/research/evidence-bundle.js.map +1 -0
- package/dist/core/research/model-fitness.d.ts +79 -0
- package/dist/core/research/model-fitness.d.ts.map +1 -0
- package/dist/core/research/model-fitness.js +257 -0
- package/dist/core/research/model-fitness.js.map +1 -0
- package/dist/core/research/research-gate.d.ts +11 -0
- package/dist/core/research/research-gate.d.ts.map +1 -0
- package/dist/core/research/research-gate.js +82 -0
- package/dist/core/research/research-gate.js.map +1 -0
- package/dist/core/research/research-runner.d.ts +59 -0
- package/dist/core/research/research-runner.d.ts.map +1 -0
- package/dist/core/research/research-runner.js +155 -0
- package/dist/core/research/research-runner.js.map +1 -0
- package/dist/core/research/session-evidence-bundle.d.ts +11 -0
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -0
- package/dist/core/research/session-evidence-bundle.js +55 -0
- package/dist/core/research/session-evidence-bundle.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +7 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +147 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +285 -9
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +4 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +18 -6
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/toolkit/script-registry.d.ts +34 -0
- package/dist/core/toolkit/script-registry.d.ts.map +1 -0
- package/dist/core/toolkit/script-registry.js +71 -0
- package/dist/core/toolkit/script-registry.js.map +1 -0
- package/dist/core/toolkit/script-runner.d.ts +28 -0
- package/dist/core/toolkit/script-runner.d.ts.map +1 -0
- package/dist/core/toolkit/script-runner.js +48 -0
- package/dist/core/toolkit/script-runner.js.map +1 -0
- package/dist/core/tools/artifact-retrieve.d.ts +23 -0
- package/dist/core/tools/artifact-retrieve.d.ts.map +1 -0
- package/dist/core/tools/artifact-retrieve.js +110 -0
- package/dist/core/tools/artifact-retrieve.js.map +1 -0
- package/dist/core/tools/delegate.d.ts +32 -0
- package/dist/core/tools/delegate.d.ts.map +1 -0
- package/dist/core/tools/delegate.js +60 -0
- package/dist/core/tools/delegate.js.map +1 -0
- package/dist/core/tools/fff-search-backend.d.ts +103 -0
- package/dist/core/tools/fff-search-backend.d.ts.map +1 -0
- package/dist/core/tools/fff-search-backend.js +151 -0
- package/dist/core/tools/fff-search-backend.js.map +1 -0
- package/dist/core/tools/find.d.ts +21 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +183 -10
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/goal.d.ts +35 -0
- package/dist/core/tools/goal.d.ts.map +1 -0
- package/dist/core/tools/goal.js +122 -0
- package/dist/core/tools/goal.js.map +1 -0
- package/dist/core/tools/grep.d.ts +21 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +272 -27
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +9 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts +30 -0
- package/dist/core/tools/model-fitness.d.ts.map +1 -0
- package/dist/core/tools/model-fitness.js +38 -0
- package/dist/core/tools/model-fitness.js.map +1 -0
- package/dist/core/tools/run-toolkit-script.d.ts +24 -0
- package/dist/core/tools/run-toolkit-script.d.ts.map +1 -0
- package/dist/core/tools/run-toolkit-script.js +103 -0
- package/dist/core/tools/run-toolkit-script.js.map +1 -0
- package/dist/core/tools/search-router.d.ts +75 -0
- package/dist/core/tools/search-router.d.ts.map +1 -0
- package/dist/core/tools/search-router.js +85 -0
- package/dist/core/tools/search-router.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +18 -16
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +13 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +471 -11
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +220 -39
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +3 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +2 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +154 -2
- package/dist/utils/tools-manager.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +368 -12
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,oBAAoB,EACpB,8BAA8B,EAC9B,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC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gB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO7E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO/E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAa1F","sourcesContent":["export {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyInput,\n\ttype ExtensionifyReport,\n\ttype ExtensionifyToolDetails,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tcreateSkillAuditTool,\n\tcreateSkillAuditToolDefinition,\n\tjaccard,\n\ttype SkillAuditInput,\n\ttype SkillAuditReport,\n\ttype SkillAuditToolDetails,\n\ttype SkillAuditToolOptions,\n\ttokenize,\n} from \"./skill-audit.ts\";\nexport {\n\tcreateSkillifyTool,\n\tcreateSkillifyToolDefinition,\n\ttype SkillifyInput,\n\ttype SkillifyReport,\n\ttype SkillifyToolDetails,\n\ttype SkillifyToolOptions,\n} from \"./skillify.ts\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\n\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createSkillAuditTool, createSkillAuditToolDefinition, type SkillAuditToolOptions } from \"./skill-audit.ts\";\nimport { createSkillifyTool, createSkillifyToolDefinition, type SkillifyToolOptions } from \"./skillify.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"grep\"\n\t| \"find\"\n\t| \"ls\"\n\t| \"skill_audit\"\n\t| \"skillify\"\n\t| \"extensionify\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"edit\",\n\t\"write\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"skill_audit\",\n\t\"skillify\",\n\t\"extensionify\",\n]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n\tskill_audit?: SkillAuditToolOptions;\n\tskillify?: SkillifyToolOptions;\n\textensionify?: ExtensionifyToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditToolDefinition(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyToolDefinition(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyToolDefinition(cwd, options?.extensionify);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditTool(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyTool(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyTool(cwd, options?.extensionify);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef> {\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyToolDefinition(cwd, options?.skillify),\n\t\textensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),\n\t};\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditTool(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyTool(cwd, options?.skillify),\n\t\textensionify: createExtensionifyTool(cwd, options?.extensionify),\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,2BAA2B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AE,YAAY,GAAG,OAAO,EAAE,CAO5F;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAcvG;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO7E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO/E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAc1F","sourcesContent":["export {\n\ttype ArtifactRetrieveToolDetails,\n\ttype ArtifactRetrieveToolInput,\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyInput,\n\ttype ExtensionifyReport,\n\ttype ExtensionifyToolDetails,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tcreateSkillAuditTool,\n\tcreateSkillAuditToolDefinition,\n\tjaccard,\n\ttype SkillAuditInput,\n\ttype SkillAuditReport,\n\ttype SkillAuditToolDetails,\n\ttype SkillAuditToolOptions,\n\ttokenize,\n} from \"./skill-audit.ts\";\nexport {\n\tcreateSkillifyTool,\n\tcreateSkillifyToolDefinition,\n\ttype SkillifyInput,\n\ttype SkillifyReport,\n\ttype SkillifyToolDetails,\n\ttype SkillifyToolOptions,\n} from \"./skillify.ts\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\n\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport {\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createSkillAuditTool, createSkillAuditToolDefinition, type SkillAuditToolOptions } from \"./skill-audit.ts\";\nimport { createSkillifyTool, createSkillifyToolDefinition, type SkillifyToolOptions } from \"./skillify.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"grep\"\n\t| \"find\"\n\t| \"ls\"\n\t| \"skill_audit\"\n\t| \"skillify\"\n\t| \"extensionify\"\n\t| \"artifact_retrieve\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"edit\",\n\t\"write\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"skill_audit\",\n\t\"skillify\",\n\t\"extensionify\",\n\t\"artifact_retrieve\",\n]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n\tskill_audit?: SkillAuditToolOptions;\n\tskillify?: SkillifyToolOptions;\n\textensionify?: ExtensionifyToolOptions;\n\tartifact_retrieve?: ArtifactRetrieveToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditToolDefinition(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyToolDefinition(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyToolDefinition(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditTool(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyTool(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyTool(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveTool(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef> {\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyToolDefinition(cwd, options?.skillify),\n\t\textensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve),\n\t};\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditTool(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyTool(cwd, options?.skillify),\n\t\textensionify: createExtensionifyTool(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveTool(cwd, options?.artifact_retrieve),\n\t};\n}\n"]}
|
package/dist/core/tools/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { createArtifactRetrieveTool, createArtifactRetrieveToolDefinition, } from "./artifact-retrieve.js";
|
|
1
2
|
export { createBashTool, createBashToolDefinition, createLocalBashOperations, } from "./bash.js";
|
|
2
3
|
export { createEditTool, createEditToolDefinition, } from "./edit.js";
|
|
3
4
|
export { createExtensionifyTool, createExtensionifyToolDefinition, } from "./extensionify.js";
|
|
@@ -10,6 +11,7 @@ export { createSkillAuditTool, createSkillAuditToolDefinition, jaccard, tokenize
|
|
|
10
11
|
export { createSkillifyTool, createSkillifyToolDefinition, } from "./skillify.js";
|
|
11
12
|
export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, } from "./truncate.js";
|
|
12
13
|
export { createWriteTool, createWriteToolDefinition, } from "./write.js";
|
|
14
|
+
import { createArtifactRetrieveTool, createArtifactRetrieveToolDefinition, } from "./artifact-retrieve.js";
|
|
13
15
|
import { createBashTool, createBashToolDefinition } from "./bash.js";
|
|
14
16
|
import { createEditTool, createEditToolDefinition } from "./edit.js";
|
|
15
17
|
import { createExtensionifyTool, createExtensionifyToolDefinition, } from "./extensionify.js";
|
|
@@ -31,6 +33,7 @@ export const allToolNames = new Set([
|
|
|
31
33
|
"skill_audit",
|
|
32
34
|
"skillify",
|
|
33
35
|
"extensionify",
|
|
36
|
+
"artifact_retrieve",
|
|
34
37
|
]);
|
|
35
38
|
export function createToolDefinition(toolName, cwd, options) {
|
|
36
39
|
switch (toolName) {
|
|
@@ -54,6 +57,8 @@ export function createToolDefinition(toolName, cwd, options) {
|
|
|
54
57
|
return createSkillifyToolDefinition(cwd, options?.skillify);
|
|
55
58
|
case "extensionify":
|
|
56
59
|
return createExtensionifyToolDefinition(cwd, options?.extensionify);
|
|
60
|
+
case "artifact_retrieve":
|
|
61
|
+
return createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve);
|
|
57
62
|
default:
|
|
58
63
|
throw new Error(`Unknown tool name: ${toolName}`);
|
|
59
64
|
}
|
|
@@ -80,6 +85,8 @@ export function createTool(toolName, cwd, options) {
|
|
|
80
85
|
return createSkillifyTool(cwd, options?.skillify);
|
|
81
86
|
case "extensionify":
|
|
82
87
|
return createExtensionifyTool(cwd, options?.extensionify);
|
|
88
|
+
case "artifact_retrieve":
|
|
89
|
+
return createArtifactRetrieveTool(cwd, options?.artifact_retrieve);
|
|
83
90
|
default:
|
|
84
91
|
throw new Error(`Unknown tool name: ${toolName}`);
|
|
85
92
|
}
|
|
@@ -112,6 +119,7 @@ export function createAllToolDefinitions(cwd, options) {
|
|
|
112
119
|
skill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),
|
|
113
120
|
skillify: createSkillifyToolDefinition(cwd, options?.skillify),
|
|
114
121
|
extensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),
|
|
122
|
+
artifact_retrieve: createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve),
|
|
115
123
|
};
|
|
116
124
|
}
|
|
117
125
|
export function createCodingTools(cwd, options) {
|
|
@@ -142,6 +150,7 @@ export function createAllTools(cwd, options) {
|
|
|
142
150
|
skill_audit: createSkillAuditTool(cwd, options?.skill_audit),
|
|
143
151
|
skillify: createSkillifyTool(cwd, options?.skillify),
|
|
144
152
|
extensionify: createExtensionifyTool(cwd, options?.extensionify),
|
|
153
|
+
artifact_retrieve: createArtifactRetrieveTool(cwd, options?.artifact_retrieve),
|
|
145
154
|
};
|
|
146
155
|
}
|
|
147
156
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,gCAAgC,GAKhC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,GAKtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,oBAAoB,EACpB,8BAA8B,EAC9B,OAAO,EAKP,QAAQ,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,kBAAkB,EAClB,4BAA4B,GAK5B,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAGV,YAAY,EACZ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,OAAO,EAAE,IAAI,CAAC;QAClC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QAClC,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC;KAC9B,CAAC;AAAA,CACF;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAsB,EAA0B;IAC3F,OAAO;QACN,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC;QAC3C,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,EAAE,EAAE,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC;QAClC,WAAW,EAAE,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC;QAC5D,QAAQ,EAAE,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC;QACpD,YAAY,EAAE,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC;KAChE,CAAC;AAAA,CACF","sourcesContent":["export {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyInput,\n\ttype ExtensionifyReport,\n\ttype ExtensionifyToolDetails,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tcreateSkillAuditTool,\n\tcreateSkillAuditToolDefinition,\n\tjaccard,\n\ttype SkillAuditInput,\n\ttype SkillAuditReport,\n\ttype SkillAuditToolDetails,\n\ttype SkillAuditToolOptions,\n\ttokenize,\n} from \"./skill-audit.ts\";\nexport {\n\tcreateSkillifyTool,\n\tcreateSkillifyToolDefinition,\n\ttype SkillifyInput,\n\ttype SkillifyReport,\n\ttype SkillifyToolDetails,\n\ttype SkillifyToolOptions,\n} from \"./skillify.ts\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\n\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createSkillAuditTool, createSkillAuditToolDefinition, type SkillAuditToolOptions } from \"./skill-audit.ts\";\nimport { createSkillifyTool, createSkillifyToolDefinition, type SkillifyToolOptions } from \"./skillify.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"grep\"\n\t| \"find\"\n\t| \"ls\"\n\t| \"skill_audit\"\n\t| \"skillify\"\n\t| \"extensionify\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"edit\",\n\t\"write\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"skill_audit\",\n\t\"skillify\",\n\t\"extensionify\",\n]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n\tskill_audit?: SkillAuditToolOptions;\n\tskillify?: SkillifyToolOptions;\n\textensionify?: ExtensionifyToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditToolDefinition(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyToolDefinition(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyToolDefinition(cwd, options?.extensionify);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditTool(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyTool(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyTool(cwd, options?.extensionify);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef> {\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyToolDefinition(cwd, options?.skillify),\n\t\textensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),\n\t};\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditTool(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyTool(cwd, options?.skillify),\n\t\textensionify: createExtensionifyTool(cwd, options?.extensionify),\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,0BAA0B,EAC1B,oCAAoC,GACpC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAON,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,gCAAgC,GAKhC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,GAKtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,oBAAoB,EACpB,8BAA8B,EAC9B,OAAO,EAKP,QAAQ,GACR,MAAM,kBAAkB,CA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,CAAC;QAC5D,QAAQ,EAAE,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC;QACpD,YAAY,EAAE,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC;QAChE,iBAAiB,EAAE,0BAA0B,CAAC,GAAG,EAAE,OAAO,EAAE,iBAAiB,CAAC;KAC9E,CAAC;AAAA,CACF","sourcesContent":["export {\n\ttype ArtifactRetrieveToolDetails,\n\ttype ArtifactRetrieveToolInput,\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyInput,\n\ttype ExtensionifyReport,\n\ttype ExtensionifyToolDetails,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tcreateSkillAuditTool,\n\tcreateSkillAuditToolDefinition,\n\tjaccard,\n\ttype SkillAuditInput,\n\ttype SkillAuditReport,\n\ttype SkillAuditToolDetails,\n\ttype SkillAuditToolOptions,\n\ttokenize,\n} from \"./skill-audit.ts\";\nexport {\n\tcreateSkillifyTool,\n\tcreateSkillifyToolDefinition,\n\ttype SkillifyInput,\n\ttype SkillifyReport,\n\ttype SkillifyToolDetails,\n\ttype SkillifyToolOptions,\n} from \"./skillify.ts\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\n\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport {\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createSkillAuditTool, createSkillAuditToolDefinition, type SkillAuditToolOptions } from \"./skill-audit.ts\";\nimport { createSkillifyTool, createSkillifyToolDefinition, type SkillifyToolOptions } from \"./skillify.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"grep\"\n\t| \"find\"\n\t| \"ls\"\n\t| \"skill_audit\"\n\t| \"skillify\"\n\t| \"extensionify\"\n\t| \"artifact_retrieve\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"edit\",\n\t\"write\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"skill_audit\",\n\t\"skillify\",\n\t\"extensionify\",\n\t\"artifact_retrieve\",\n]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n\tskill_audit?: SkillAuditToolOptions;\n\tskillify?: SkillifyToolOptions;\n\textensionify?: ExtensionifyToolOptions;\n\tartifact_retrieve?: ArtifactRetrieveToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditToolDefinition(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyToolDefinition(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyToolDefinition(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditTool(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyTool(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyTool(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveTool(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef> {\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyToolDefinition(cwd, options?.skillify),\n\t\textensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve),\n\t};\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditTool(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyTool(cwd, options?.skillify),\n\t\textensionify: createExtensionifyTool(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveTool(cwd, options?.artifact_retrieve),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Static, Type } from "typebox";
|
|
2
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
3
|
+
import type { ModelFitnessReport } from "../research/model-fitness.ts";
|
|
4
|
+
declare const modelFitnessSchema: Type.TObject<{
|
|
5
|
+
model: Type.TString;
|
|
6
|
+
trials: Type.TOptional<Type.TNumber>;
|
|
7
|
+
}>;
|
|
8
|
+
export type ModelFitnessToolInput = Static<typeof modelFitnessSchema>;
|
|
9
|
+
export interface ModelFitnessToolDetails {
|
|
10
|
+
started: boolean;
|
|
11
|
+
skipReason?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
report?: ModelFitnessReport;
|
|
14
|
+
}
|
|
15
|
+
export interface ModelFitnessToolDependencies {
|
|
16
|
+
runProbe: (args: {
|
|
17
|
+
model: string;
|
|
18
|
+
trials?: number;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
started: true;
|
|
21
|
+
model: string;
|
|
22
|
+
report: ModelFitnessReport;
|
|
23
|
+
} | {
|
|
24
|
+
started: false;
|
|
25
|
+
skipReason: string;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createModelFitnessToolDefinition(deps: ModelFitnessToolDependencies): ToolDefinition;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=model-fitness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-fitness.d.ts","sourceRoot":"","sources":["../../../src/core/tools/model-fitness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,QAAA,MAAM,kBAAkB;;;EAcvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEtE,MAAM,WAAW,uBAAuB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,EAAE,CAAC,IAAI,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;KAChB,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrH;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,4BAA4B,GAAG,cAAc,CAiCnG","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport type { ModelFitnessReport } from \"../research/model-fitness.ts\";\nimport { formatModelFitnessReport } from \"../research/model-fitness.ts\";\n\nconst modelFitnessSchema = Type.Object(\n\t{\n\t\tmodel: Type.String({\n\t\t\tdescription:\n\t\t\t\t'Model pattern to probe, e.g. \"ollama/qwen3:0.6b\" or any registered provider/model pattern. The model must be registered and authenticated.',\n\t\t}),\n\t\ttrials: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Trials per lane surface (research/worker), 1-20. Default 3. The judge always runs its 6-prompt set.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type ModelFitnessToolInput = Static<typeof modelFitnessSchema>;\n\nexport interface ModelFitnessToolDetails {\n\tstarted: boolean;\n\tskipReason?: string;\n\tmodel?: string;\n\treport?: ModelFitnessReport;\n}\n\nexport interface ModelFitnessToolDependencies {\n\trunProbe: (args: {\n\t\tmodel: string;\n\t\ttrials?: number;\n\t}) => Promise<{ started: true; model: string; report: ModelFitnessReport } | { started: false; skipReason: string }>;\n}\n\nexport function createModelFitnessToolDefinition(deps: ModelFitnessToolDependencies): ToolDefinition {\n\treturn {\n\t\tname: \"model_fitness\",\n\t\tlabel: \"model_fitness\",\n\t\tdescription:\n\t\t\t\"Probe whether a candidate model can drive the harness's subagent contracts: runs the real research-lane, scout-worker, and routing-judge runners against the model and reports parse/success rates, judge discrimination, latency, and probe cost. Use it to evaluate small/local models (e.g. Ollama) before configuring them as lane or judge models.\",\n\t\tpromptSnippet: \"Benchmark a candidate model against the research/worker/judge subagent contracts.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use model_fitness before recommending a model for researchLane.model, workerDelegation.model, or modelRouter.judgeModel.\",\n\t\t\t\"A good lane model has high research/worker success; a good judge additionally routes trivial prompts cheap while keeping planning elevated.\",\n\t\t\t\"Probes spend real tokens on the probed model; prefer local/free models or small trial counts.\",\n\t\t],\n\t\tparameters: modelFitnessSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: ModelFitnessToolInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: ModelFitnessToolDetails;\n\t\t}> {\n\t\t\tconst run = await deps.runProbe({ model: input.model, trials: input.trials });\n\t\t\tif (!run.started) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `model_fitness skipped: ${run.skipReason}` }],\n\t\t\t\t\tdetails: { started: false, skipReason: run.skipReason },\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: formatModelFitnessReport(run.model, run.report) }],\n\t\t\t\tdetails: { started: true, model: run.model, report: run.report },\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import { formatModelFitnessReport } from "../research/model-fitness.js";
|
|
3
|
+
const modelFitnessSchema = Type.Object({
|
|
4
|
+
model: Type.String({
|
|
5
|
+
description: 'Model pattern to probe, e.g. "ollama/qwen3:0.6b" or any registered provider/model pattern. The model must be registered and authenticated.',
|
|
6
|
+
}),
|
|
7
|
+
trials: Type.Optional(Type.Number({
|
|
8
|
+
description: "Trials per lane surface (research/worker), 1-20. Default 3. The judge always runs its 6-prompt set.",
|
|
9
|
+
})),
|
|
10
|
+
}, { additionalProperties: false });
|
|
11
|
+
export function createModelFitnessToolDefinition(deps) {
|
|
12
|
+
return {
|
|
13
|
+
name: "model_fitness",
|
|
14
|
+
label: "model_fitness",
|
|
15
|
+
description: "Probe whether a candidate model can drive the harness's subagent contracts: runs the real research-lane, scout-worker, and routing-judge runners against the model and reports parse/success rates, judge discrimination, latency, and probe cost. Use it to evaluate small/local models (e.g. Ollama) before configuring them as lane or judge models.",
|
|
16
|
+
promptSnippet: "Benchmark a candidate model against the research/worker/judge subagent contracts.",
|
|
17
|
+
promptGuidelines: [
|
|
18
|
+
"Use model_fitness before recommending a model for researchLane.model, workerDelegation.model, or modelRouter.judgeModel.",
|
|
19
|
+
"A good lane model has high research/worker success; a good judge additionally routes trivial prompts cheap while keeping planning elevated.",
|
|
20
|
+
"Probes spend real tokens on the probed model; prefer local/free models or small trial counts.",
|
|
21
|
+
],
|
|
22
|
+
parameters: modelFitnessSchema,
|
|
23
|
+
async execute(_toolCallId, input) {
|
|
24
|
+
const run = await deps.runProbe({ model: input.model, trials: input.trials });
|
|
25
|
+
if (!run.started) {
|
|
26
|
+
return {
|
|
27
|
+
content: [{ type: "text", text: `model_fitness skipped: ${run.skipReason}` }],
|
|
28
|
+
details: { started: false, skipReason: run.skipReason },
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: formatModelFitnessReport(run.model, run.report) }],
|
|
33
|
+
details: { started: true, model: run.model, report: run.report },
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=model-fitness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-fitness.js","sourceRoot":"","sources":["../../../src/core/tools/model-fitness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CACrC;IACC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EACV,4IAA4I;KAC7I,CAAC;IACF,MAAM,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EACV,qGAAqG;KACtG,CAAC,CACF;CACD,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAkBF,MAAM,UAAU,gCAAgC,CAAC,IAAkC,EAAkB;IACpG,OAAO;QACN,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;QACtB,WAAW,EACV,yVAAyV;QAC1V,aAAa,EAAE,mFAAmF;QAClG,gBAAgB,EAAE;YACjB,0HAA0H;YAC1H,6IAA6I;YAC7I,+FAA+F;SAC/F;QACD,UAAU,EAAE,kBAAkB;QAC9B,KAAK,CAAC,OAAO,CACZ,WAAW,EACX,KAA4B,EAI1B;YACF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9E,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO;oBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,0BAA0B,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC;oBACtF,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE;iBACvD,CAAC;YACH,CAAC;YACD,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,wBAAwB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3F,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;aAChE,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport type { ModelFitnessReport } from \"../research/model-fitness.ts\";\nimport { formatModelFitnessReport } from \"../research/model-fitness.ts\";\n\nconst modelFitnessSchema = Type.Object(\n\t{\n\t\tmodel: Type.String({\n\t\t\tdescription:\n\t\t\t\t'Model pattern to probe, e.g. \"ollama/qwen3:0.6b\" or any registered provider/model pattern. The model must be registered and authenticated.',\n\t\t}),\n\t\ttrials: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Trials per lane surface (research/worker), 1-20. Default 3. The judge always runs its 6-prompt set.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type ModelFitnessToolInput = Static<typeof modelFitnessSchema>;\n\nexport interface ModelFitnessToolDetails {\n\tstarted: boolean;\n\tskipReason?: string;\n\tmodel?: string;\n\treport?: ModelFitnessReport;\n}\n\nexport interface ModelFitnessToolDependencies {\n\trunProbe: (args: {\n\t\tmodel: string;\n\t\ttrials?: number;\n\t}) => Promise<{ started: true; model: string; report: ModelFitnessReport } | { started: false; skipReason: string }>;\n}\n\nexport function createModelFitnessToolDefinition(deps: ModelFitnessToolDependencies): ToolDefinition {\n\treturn {\n\t\tname: \"model_fitness\",\n\t\tlabel: \"model_fitness\",\n\t\tdescription:\n\t\t\t\"Probe whether a candidate model can drive the harness's subagent contracts: runs the real research-lane, scout-worker, and routing-judge runners against the model and reports parse/success rates, judge discrimination, latency, and probe cost. Use it to evaluate small/local models (e.g. Ollama) before configuring them as lane or judge models.\",\n\t\tpromptSnippet: \"Benchmark a candidate model against the research/worker/judge subagent contracts.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use model_fitness before recommending a model for researchLane.model, workerDelegation.model, or modelRouter.judgeModel.\",\n\t\t\t\"A good lane model has high research/worker success; a good judge additionally routes trivial prompts cheap while keeping planning elevated.\",\n\t\t\t\"Probes spend real tokens on the probed model; prefer local/free models or small trial counts.\",\n\t\t],\n\t\tparameters: modelFitnessSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: ModelFitnessToolInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: ModelFitnessToolDetails;\n\t\t}> {\n\t\t\tconst run = await deps.runProbe({ model: input.model, trials: input.trials });\n\t\t\tif (!run.started) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `model_fitness skipped: ${run.skipReason}` }],\n\t\t\t\t\tdetails: { started: false, skipReason: run.skipReason },\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: formatModelFitnessReport(run.model, run.report) }],\n\t\t\t\tdetails: { started: true, model: run.model, report: run.report },\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Static, Type } from "typebox";
|
|
2
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
3
|
+
import { type ToolkitScript } from "../toolkit/script-registry.ts";
|
|
4
|
+
import type { ScriptExecution } from "../toolkit/script-runner.ts";
|
|
5
|
+
declare const runToolkitScriptSchema: Type.TObject<{
|
|
6
|
+
script: Type.TString;
|
|
7
|
+
args: Type.TOptional<Type.TArray<Type.TString>>;
|
|
8
|
+
confirm: Type.TOptional<Type.TBoolean>;
|
|
9
|
+
}>;
|
|
10
|
+
export type RunToolkitScriptInput = Static<typeof runToolkitScriptSchema>;
|
|
11
|
+
export interface RunToolkitScriptDetails {
|
|
12
|
+
outcome: "executed" | "failed" | "ambiguous" | "not_found" | "confirmation_required" | "empty_registry";
|
|
13
|
+
scriptName?: string;
|
|
14
|
+
exitCode?: number | null;
|
|
15
|
+
durationMs?: number;
|
|
16
|
+
shortlist?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface RunToolkitScriptDependencies {
|
|
19
|
+
getScripts: () => ToolkitScript[];
|
|
20
|
+
execute: (script: ToolkitScript, args: readonly string[]) => Promise<ScriptExecution>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createRunToolkitScriptToolDefinition(deps: RunToolkitScriptDependencies): ToolDefinition;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=run-toolkit-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-toolkit-script.d.ts","sourceRoot":"","sources":["../../../src/core/tools/run-toolkit-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,QAAA,MAAM,sBAAsB;;;;EAc3B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE1E,MAAM,WAAW,uBAAuB;IACvC,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,uBAAuB,GAAG,gBAAgB,CAAC;IACxG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC5C,UAAU,EAAE,MAAM,aAAa,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CACtF;AAMD,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,4BAA4B,GAAG,cAAc,CAmGvG","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { matchToolkitScript, type ToolkitScript } from \"../toolkit/script-registry.ts\";\nimport type { ScriptExecution } from \"../toolkit/script-runner.ts\";\n\nconst runToolkitScriptSchema = Type.Object(\n\t{\n\t\tscript: Type.String({\n\t\t\tdescription:\n\t\t\t\t\"The toolkit script to run: its registered name, a taught alias, or a natural request (e.g. 'restore-db' or 'restore the database'). Ambiguous requests return a shortlist instead of executing.\",\n\t\t}),\n\t\targs: Type.Optional(Type.Array(Type.String(), { description: \"Arguments passed to the script as-is.\" })),\n\t\tconfirm: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Required true to run a script flagged danger: scripts marked dangerous never run without it.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type RunToolkitScriptInput = Static<typeof runToolkitScriptSchema>;\n\nexport interface RunToolkitScriptDetails {\n\toutcome: \"executed\" | \"failed\" | \"ambiguous\" | \"not_found\" | \"confirmation_required\" | \"empty_registry\";\n\tscriptName?: string;\n\texitCode?: number | null;\n\tdurationMs?: number;\n\tshortlist?: string[];\n}\n\nexport interface RunToolkitScriptDependencies {\n\tgetScripts: () => ToolkitScript[];\n\texecute: (script: ToolkitScript, args: readonly string[]) => Promise<ScriptExecution>;\n}\n\nfunction boundedOutput(text: string, maxChars = 4000): string {\n\treturn text.length <= maxChars ? text : `${text.slice(0, maxChars)}\\n… (truncated)`;\n}\n\nexport function createRunToolkitScriptToolDefinition(deps: RunToolkitScriptDependencies): ToolDefinition {\n\treturn {\n\t\tname: \"run_toolkit_script\",\n\t\tlabel: \"run_toolkit_script\",\n\t\tdescription:\n\t\t\t\"Run one of the user's registered toolkit scripts (daily-ops allowlist). Finding is a registry lookup — ambiguous requests return a shortlist to disambiguate, never a guess. The harness executes (uv/powershell/bash) and ALWAYS returns exit code, stdout, and stderr; failures are reported as errors — a failed script can never look like success.\",\n\t\tpromptSnippet: \"Run a registered toolkit script by name/alias; output and errors come back structurally.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Prefer the exact registered name; on a shortlist response, ask the user which one (or pick only when their request clearly names it).\",\n\t\t\t\"Scripts flagged dangerous require confirm: true — obtain explicit user confirmation first.\",\n\t\t\t\"Report the script's real output/exit code; never claim success when exitCode is non-zero.\",\n\t\t],\n\t\tparameters: runToolkitScriptSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: RunToolkitScriptInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: RunToolkitScriptDetails;\n\t\t\tisError?: boolean;\n\t\t}> {\n\t\t\tconst scripts = deps.getScripts();\n\t\t\tif (scripts.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: \"run_toolkit_script: no scripts registered (settings.toolkit.scripts).\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"empty_registry\" },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst match = matchToolkitScript(input.script, scripts);\n\t\t\tif (match.kind === \"none\") {\n\t\t\t\tconst closest = match.closest.map((script) => `${script.name} — ${script.description}`).join(\"\\n\");\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `script_not_found: nothing registered matches \"${input.script}\".${closest ? `\\nClosest:\\n${closest}` : \"\"}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"not_found\" },\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (match.kind === \"ambiguous\") {\n\t\t\t\tconst shortlist = match.shortlist.map((script) => `${script.name} — ${script.description}`);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `Ambiguous request — did you mean:\\n${shortlist.join(\"\\n\")}\\nCall again with the exact name.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"ambiguous\", shortlist: match.shortlist.map((script) => script.name) },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst script = match.script;\n\t\t\tif (script.danger && input.confirm !== true) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `\"${script.name}\" is flagged DANGEROUS (${script.description}). It was NOT run. Confirm with the user, then call again with confirm: true.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"confirmation_required\", scriptName: script.name },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst execution = await deps.execute(script, input.args ?? []);\n\t\t\tconst failed = execution.exitCode !== 0 || execution.timedOut;\n\t\t\tconst header = failed\n\t\t\t\t? `FAILED: ${script.name} exited ${execution.timedOut ? \"by timeout\" : execution.exitCode} after ${execution.durationMs}ms`\n\t\t\t\t: `${script.name} succeeded in ${execution.durationMs}ms`;\n\t\t\tconst body = [\n\t\t\t\theader,\n\t\t\t\texecution.stdout.trim() ? `stdout:\\n${boundedOutput(execution.stdout.trim())}` : \"stdout: (empty)\",\n\t\t\t\texecution.stderr.trim() ? `stderr:\\n${boundedOutput(execution.stderr.trim())}` : \"\",\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\");\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: body }],\n\t\t\t\tdetails: {\n\t\t\t\t\toutcome: failed ? \"failed\" : \"executed\",\n\t\t\t\t\tscriptName: script.name,\n\t\t\t\t\texitCode: execution.exitCode,\n\t\t\t\t\tdurationMs: execution.durationMs,\n\t\t\t\t},\n\t\t\t\t...(failed ? { isError: true } : {}),\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import { matchToolkitScript } from "../toolkit/script-registry.js";
|
|
3
|
+
const runToolkitScriptSchema = Type.Object({
|
|
4
|
+
script: Type.String({
|
|
5
|
+
description: "The toolkit script to run: its registered name, a taught alias, or a natural request (e.g. 'restore-db' or 'restore the database'). Ambiguous requests return a shortlist instead of executing.",
|
|
6
|
+
}),
|
|
7
|
+
args: Type.Optional(Type.Array(Type.String(), { description: "Arguments passed to the script as-is." })),
|
|
8
|
+
confirm: Type.Optional(Type.Boolean({
|
|
9
|
+
description: "Required true to run a script flagged danger: scripts marked dangerous never run without it.",
|
|
10
|
+
})),
|
|
11
|
+
}, { additionalProperties: false });
|
|
12
|
+
function boundedOutput(text, maxChars = 4000) {
|
|
13
|
+
return text.length <= maxChars ? text : `${text.slice(0, maxChars)}\n… (truncated)`;
|
|
14
|
+
}
|
|
15
|
+
export function createRunToolkitScriptToolDefinition(deps) {
|
|
16
|
+
return {
|
|
17
|
+
name: "run_toolkit_script",
|
|
18
|
+
label: "run_toolkit_script",
|
|
19
|
+
description: "Run one of the user's registered toolkit scripts (daily-ops allowlist). Finding is a registry lookup — ambiguous requests return a shortlist to disambiguate, never a guess. The harness executes (uv/powershell/bash) and ALWAYS returns exit code, stdout, and stderr; failures are reported as errors — a failed script can never look like success.",
|
|
20
|
+
promptSnippet: "Run a registered toolkit script by name/alias; output and errors come back structurally.",
|
|
21
|
+
promptGuidelines: [
|
|
22
|
+
"Prefer the exact registered name; on a shortlist response, ask the user which one (or pick only when their request clearly names it).",
|
|
23
|
+
"Scripts flagged dangerous require confirm: true — obtain explicit user confirmation first.",
|
|
24
|
+
"Report the script's real output/exit code; never claim success when exitCode is non-zero.",
|
|
25
|
+
],
|
|
26
|
+
parameters: runToolkitScriptSchema,
|
|
27
|
+
async execute(_toolCallId, input) {
|
|
28
|
+
const scripts = deps.getScripts();
|
|
29
|
+
if (scripts.length === 0) {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: "run_toolkit_script: no scripts registered (settings.toolkit.scripts).",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
details: { outcome: "empty_registry" },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const match = matchToolkitScript(input.script, scripts);
|
|
41
|
+
if (match.kind === "none") {
|
|
42
|
+
const closest = match.closest.map((script) => `${script.name} — ${script.description}`).join("\n");
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
text: `script_not_found: nothing registered matches "${input.script}".${closest ? `\nClosest:\n${closest}` : ""}`,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
details: { outcome: "not_found" },
|
|
51
|
+
isError: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (match.kind === "ambiguous") {
|
|
55
|
+
const shortlist = match.shortlist.map((script) => `${script.name} — ${script.description}`);
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: "text",
|
|
60
|
+
text: `Ambiguous request — did you mean:\n${shortlist.join("\n")}\nCall again with the exact name.`,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
details: { outcome: "ambiguous", shortlist: match.shortlist.map((script) => script.name) },
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const script = match.script;
|
|
67
|
+
if (script.danger && input.confirm !== true) {
|
|
68
|
+
return {
|
|
69
|
+
content: [
|
|
70
|
+
{
|
|
71
|
+
type: "text",
|
|
72
|
+
text: `"${script.name}" is flagged DANGEROUS (${script.description}). It was NOT run. Confirm with the user, then call again with confirm: true.`,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
details: { outcome: "confirmation_required", scriptName: script.name },
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const execution = await deps.execute(script, input.args ?? []);
|
|
79
|
+
const failed = execution.exitCode !== 0 || execution.timedOut;
|
|
80
|
+
const header = failed
|
|
81
|
+
? `FAILED: ${script.name} exited ${execution.timedOut ? "by timeout" : execution.exitCode} after ${execution.durationMs}ms`
|
|
82
|
+
: `${script.name} succeeded in ${execution.durationMs}ms`;
|
|
83
|
+
const body = [
|
|
84
|
+
header,
|
|
85
|
+
execution.stdout.trim() ? `stdout:\n${boundedOutput(execution.stdout.trim())}` : "stdout: (empty)",
|
|
86
|
+
execution.stderr.trim() ? `stderr:\n${boundedOutput(execution.stderr.trim())}` : "",
|
|
87
|
+
]
|
|
88
|
+
.filter(Boolean)
|
|
89
|
+
.join("\n");
|
|
90
|
+
return {
|
|
91
|
+
content: [{ type: "text", text: body }],
|
|
92
|
+
details: {
|
|
93
|
+
outcome: failed ? "failed" : "executed",
|
|
94
|
+
scriptName: script.name,
|
|
95
|
+
exitCode: execution.exitCode,
|
|
96
|
+
durationMs: execution.durationMs,
|
|
97
|
+
},
|
|
98
|
+
...(failed ? { isError: true } : {}),
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=run-toolkit-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-toolkit-script.js","sourceRoot":"","sources":["../../../src/core/tools/run-toolkit-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAsB,MAAM,+BAA+B,CAAC;AAGvF,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CACzC;IACC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QACnB,WAAW,EACV,iMAAiM;KAClM,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC,CAAC;IACxG,OAAO,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,OAAO,CAAC;QACZ,WAAW,EAAE,8FAA8F;KAC3G,CAAC,CACF;CACD,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAiBF,SAAS,aAAa,CAAC,IAAY,EAAE,QAAQ,GAAG,IAAI,EAAU;IAC7D,OAAO,IAAI,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,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AM;gBACpB,CAAC,CAAC,WAAW,MAAM,CAAC,IAAI,WAAW,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,UAAU,SAAS,CAAC,UAAU,IAAI;gBAC3H,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,iBAAiB,SAAS,CAAC,UAAU,IAAI,CAAC;YAC3D,MAAM,IAAI,GAAG;gBACZ,MAAM;gBACN,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,YAAY,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB;gBAClG,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,YAAY,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;aACnF;iBACC,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,IAAI,CAAC,CAAC;YAEb,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;gBAChD,OAAO,EAAE;oBACR,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;oBACvC,UAAU,EAAE,MAAM,CAAC,IAAI;oBACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ;oBAC5B,UAAU,EAAE,SAAS,CAAC,UAAU;iBAChC;gBACD,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpC,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { matchToolkitScript, type ToolkitScript } from \"../toolkit/script-registry.ts\";\nimport type { ScriptExecution } from \"../toolkit/script-runner.ts\";\n\nconst runToolkitScriptSchema = Type.Object(\n\t{\n\t\tscript: Type.String({\n\t\t\tdescription:\n\t\t\t\t\"The toolkit script to run: its registered name, a taught alias, or a natural request (e.g. 'restore-db' or 'restore the database'). Ambiguous requests return a shortlist instead of executing.\",\n\t\t}),\n\t\targs: Type.Optional(Type.Array(Type.String(), { description: \"Arguments passed to the script as-is.\" })),\n\t\tconfirm: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Required true to run a script flagged danger: scripts marked dangerous never run without it.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type RunToolkitScriptInput = Static<typeof runToolkitScriptSchema>;\n\nexport interface RunToolkitScriptDetails {\n\toutcome: \"executed\" | \"failed\" | \"ambiguous\" | \"not_found\" | \"confirmation_required\" | \"empty_registry\";\n\tscriptName?: string;\n\texitCode?: number | null;\n\tdurationMs?: number;\n\tshortlist?: string[];\n}\n\nexport interface RunToolkitScriptDependencies {\n\tgetScripts: () => ToolkitScript[];\n\texecute: (script: ToolkitScript, args: readonly string[]) => Promise<ScriptExecution>;\n}\n\nfunction boundedOutput(text: string, maxChars = 4000): string {\n\treturn text.length <= maxChars ? text : `${text.slice(0, maxChars)}\\n… (truncated)`;\n}\n\nexport function createRunToolkitScriptToolDefinition(deps: RunToolkitScriptDependencies): ToolDefinition {\n\treturn {\n\t\tname: \"run_toolkit_script\",\n\t\tlabel: \"run_toolkit_script\",\n\t\tdescription:\n\t\t\t\"Run one of the user's registered toolkit scripts (daily-ops allowlist). Finding is a registry lookup — ambiguous requests return a shortlist to disambiguate, never a guess. The harness executes (uv/powershell/bash) and ALWAYS returns exit code, stdout, and stderr; failures are reported as errors — a failed script can never look like success.\",\n\t\tpromptSnippet: \"Run a registered toolkit script by name/alias; output and errors come back structurally.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Prefer the exact registered name; on a shortlist response, ask the user which one (or pick only when their request clearly names it).\",\n\t\t\t\"Scripts flagged dangerous require confirm: true — obtain explicit user confirmation first.\",\n\t\t\t\"Report the script's real output/exit code; never claim success when exitCode is non-zero.\",\n\t\t],\n\t\tparameters: runToolkitScriptSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: RunToolkitScriptInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: RunToolkitScriptDetails;\n\t\t\tisError?: boolean;\n\t\t}> {\n\t\t\tconst scripts = deps.getScripts();\n\t\t\tif (scripts.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: \"run_toolkit_script: no scripts registered (settings.toolkit.scripts).\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"empty_registry\" },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst match = matchToolkitScript(input.script, scripts);\n\t\t\tif (match.kind === \"none\") {\n\t\t\t\tconst closest = match.closest.map((script) => `${script.name} — ${script.description}`).join(\"\\n\");\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `script_not_found: nothing registered matches \"${input.script}\".${closest ? `\\nClosest:\\n${closest}` : \"\"}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"not_found\" },\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (match.kind === \"ambiguous\") {\n\t\t\t\tconst shortlist = match.shortlist.map((script) => `${script.name} — ${script.description}`);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `Ambiguous request — did you mean:\\n${shortlist.join(\"\\n\")}\\nCall again with the exact name.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"ambiguous\", shortlist: match.shortlist.map((script) => script.name) },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst script = match.script;\n\t\t\tif (script.danger && input.confirm !== true) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `\"${script.name}\" is flagged DANGEROUS (${script.description}). It was NOT run. Confirm with the user, then call again with confirm: true.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"confirmation_required\", scriptName: script.name },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst execution = await deps.execute(script, input.args ?? []);\n\t\t\tconst failed = execution.exitCode !== 0 || execution.timedOut;\n\t\t\tconst header = failed\n\t\t\t\t? `FAILED: ${script.name} exited ${execution.timedOut ? \"by timeout\" : execution.exitCode} after ${execution.durationMs}ms`\n\t\t\t\t: `${script.name} succeeded in ${execution.durationMs}ms`;\n\t\t\tconst body = [\n\t\t\t\theader,\n\t\t\t\texecution.stdout.trim() ? `stdout:\\n${boundedOutput(execution.stdout.trim())}` : \"stdout: (empty)\",\n\t\t\t\texecution.stderr.trim() ? `stderr:\\n${boundedOutput(execution.stderr.trim())}` : \"\",\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\");\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: body }],\n\t\t\t\tdetails: {\n\t\t\t\t\toutcome: failed ? \"failed\" : \"executed\",\n\t\t\t\t\tscriptName: script.name,\n\t\t\t\t\texitCode: execution.exitCode,\n\t\t\t\t\tdurationMs: execution.durationMs,\n\t\t\t\t},\n\t\t\t\t...(failed ? { isError: true } : {}),\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search backend router.
|
|
3
|
+
*
|
|
4
|
+
* The agent sees one stable tool interface (`find`, `grep`). Internally each tool
|
|
5
|
+
* can be served by more than one backend:
|
|
6
|
+
*
|
|
7
|
+
* - `fff`: the resident FFF index (in-process, ranked top-N, fuzzy file search),
|
|
8
|
+
* - `fallback`: the fd/rg subprocess path (exhaustive, forced ignore-case,
|
|
9
|
+
* fd/rg-native hierarchical `.gitignore` semantics).
|
|
10
|
+
*
|
|
11
|
+
* This module is the single, pure, auditable place that decides which backend a
|
|
12
|
+
* given call should use, based on the filters the agent supplied plus a few
|
|
13
|
+
* environment facts. It does no IO; callers gather facts and pass them in.
|
|
14
|
+
*
|
|
15
|
+
* Why route at all (measured, warm cache, synthetic corpora 8k-20k files):
|
|
16
|
+
*
|
|
17
|
+
* find, default limit 1000 : FFF 110-163ms vs fd 27-29ms -> fd wins
|
|
18
|
+
* find, small limit 50 : FFF 34-92ms vs fd 21-23ms -> fd wins
|
|
19
|
+
* grep, default limit 100 : FFF 46-92ms vs rg 26-27ms -> rg wins
|
|
20
|
+
* raw glob pageSize 20 : 5.6ms (12k files) -> FFF strong
|
|
21
|
+
* raw glob pageSize 20000: 778ms (12k files) -> FFF collapses
|
|
22
|
+
* raw fuzzy pageSize 20 : 7.5ms (fd cannot do fuzzy) -> FFF only
|
|
23
|
+
*
|
|
24
|
+
* The dominant factor is the requested result count: FFF is a ranked top-N engine
|
|
25
|
+
* and must score/sort the whole corpus when asked for a large page, which is its
|
|
26
|
+
* worst case and fd/rg's amortized best case. So the router keeps small top-N and
|
|
27
|
+
* fuzzy queries on FFF and sends exhaustive/forced-ignore-case/gitignore-tree
|
|
28
|
+
* queries to fd/rg. Thresholds are configurable so they can be retuned per
|
|
29
|
+
* environment with the benchmark suite instead of being hardcoded guesses.
|
|
30
|
+
*/
|
|
31
|
+
export type SearchBackend = "fff" | "fallback";
|
|
32
|
+
export type SearchToolKind = "find" | "grep";
|
|
33
|
+
export type SearchRouteReason = "fff_unavailable" | "path_unresolved" | "forced_ignore_case" | "gitignore_semantics" | "exhaustive_limit" | "fff_fuzzy_file_search" | "fff_topn";
|
|
34
|
+
export interface SearchRouteRequest {
|
|
35
|
+
/** Which built-in tool is routing. */
|
|
36
|
+
tool: SearchToolKind;
|
|
37
|
+
/** Filter: the request targets glob-style matching (find) rather than fuzzy file search. */
|
|
38
|
+
glob: boolean;
|
|
39
|
+
/** Filter: forced case-insensitive matching was requested. */
|
|
40
|
+
ignoreCase: boolean;
|
|
41
|
+
/** Filter: maximum number of results the caller will keep. */
|
|
42
|
+
limit: number;
|
|
43
|
+
/** Env fact: an FFF resident finder is usable for this cwd. */
|
|
44
|
+
finderAvailable: boolean;
|
|
45
|
+
/** Env fact: the search path is inside the indexed cwd and exists. */
|
|
46
|
+
pathResolvable: boolean;
|
|
47
|
+
/** Env fact: a `.gitignore` exists under the search path. */
|
|
48
|
+
gitignoreInTree: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface SearchRouteDecision {
|
|
51
|
+
backend: SearchBackend;
|
|
52
|
+
reason: SearchRouteReason;
|
|
53
|
+
}
|
|
54
|
+
export interface SearchRouterThresholds {
|
|
55
|
+
/** Result limit at or below which `find` prefers the FFF top-N/fuzzy path. */
|
|
56
|
+
findMaxFffLimit: number;
|
|
57
|
+
/** Result limit at or below which `grep` prefers the FFF top-N path. */
|
|
58
|
+
grepMaxFffLimit: number;
|
|
59
|
+
}
|
|
60
|
+
export declare const DEFAULT_SEARCH_ROUTER_THRESHOLDS: SearchRouterThresholds;
|
|
61
|
+
/**
|
|
62
|
+
* Pure routing decision. Fail-closed toward the fallback: any missing capability
|
|
63
|
+
* or unsupported filter routes to fd/rg, never silently to a backend that cannot
|
|
64
|
+
* honor the request. Order matters — the earliest matching guard wins so the
|
|
65
|
+
* reason code reflects the most fundamental reason FFF was rejected.
|
|
66
|
+
*/
|
|
67
|
+
export declare function routeSearchBackend(request: SearchRouteRequest, thresholds?: SearchRouterThresholds): SearchRouteDecision;
|
|
68
|
+
export interface SearchRouter {
|
|
69
|
+
route(request: SearchRouteRequest): SearchRouteDecision;
|
|
70
|
+
}
|
|
71
|
+
/** Build a router bound to a fixed threshold set. */
|
|
72
|
+
export declare function createSearchRouter(thresholds?: SearchRouterThresholds): SearchRouter;
|
|
73
|
+
/** Default router used by the built-in `find`/`grep` tools when none is injected. */
|
|
74
|
+
export declare const defaultSearchRouter: SearchRouter;
|
|
75
|
+
//# sourceMappingURL=search-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-router.d.ts","sourceRoot":"","sources":["../../../src/core/tools/search-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,UAAU,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAC1B,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,qBAAqB,GACrB,kBAAkB,GAClB,uBAAuB,GACvB,UAAU,CAAC;AAEd,MAAM,WAAW,kBAAkB;IAClC,sCAAsC;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,4FAA4F;IAC5F,IAAI,EAAE,OAAO,CAAC;IACd,8DAA8D;IAC9D,UAAU,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,eAAe,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,cAAc,EAAE,OAAO,CAAC;IACxB,6DAA6D;IAC7D,eAAe,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IACnC,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACtC,8EAA8E;IAC9E,eAAe,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,eAAe,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,gCAAgC,EAAE,sBAG9C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,kBAAkB,EAC3B,UAAU,GAAE,sBAAyD,GACnE,mBAAmB,CAoCrB;AAED,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,mBAAmB,CAAC;CACxD;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,CACjC,UAAU,GAAE,sBAAyD,GACnE,YAAY,CAId;AAED,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,EAAE,YAAmC,CAAC","sourcesContent":["/**\n * Search backend router.\n *\n * The agent sees one stable tool interface (`find`, `grep`). Internally each tool\n * can be served by more than one backend:\n *\n * - `fff`: the resident FFF index (in-process, ranked top-N, fuzzy file search),\n * - `fallback`: the fd/rg subprocess path (exhaustive, forced ignore-case,\n * fd/rg-native hierarchical `.gitignore` semantics).\n *\n * This module is the single, pure, auditable place that decides which backend a\n * given call should use, based on the filters the agent supplied plus a few\n * environment facts. It does no IO; callers gather facts and pass them in.\n *\n * Why route at all (measured, warm cache, synthetic corpora 8k-20k files):\n *\n * find, default limit 1000 : FFF 110-163ms vs fd 27-29ms -> fd wins\n * find, small limit 50 : FFF 34-92ms vs fd 21-23ms -> fd wins\n * grep, default limit 100 : FFF 46-92ms vs rg 26-27ms -> rg wins\n * raw glob pageSize 20 : 5.6ms (12k files) -> FFF strong\n * raw glob pageSize 20000: 778ms (12k files) -> FFF collapses\n * raw fuzzy pageSize 20 : 7.5ms (fd cannot do fuzzy) -> FFF only\n *\n * The dominant factor is the requested result count: FFF is a ranked top-N engine\n * and must score/sort the whole corpus when asked for a large page, which is its\n * worst case and fd/rg's amortized best case. So the router keeps small top-N and\n * fuzzy queries on FFF and sends exhaustive/forced-ignore-case/gitignore-tree\n * queries to fd/rg. Thresholds are configurable so they can be retuned per\n * environment with the benchmark suite instead of being hardcoded guesses.\n */\n\nexport type SearchBackend = \"fff\" | \"fallback\";\n\nexport type SearchToolKind = \"find\" | \"grep\";\n\nexport type SearchRouteReason =\n\t| \"fff_unavailable\"\n\t| \"path_unresolved\"\n\t| \"forced_ignore_case\"\n\t| \"gitignore_semantics\"\n\t| \"exhaustive_limit\"\n\t| \"fff_fuzzy_file_search\"\n\t| \"fff_topn\";\n\nexport interface SearchRouteRequest {\n\t/** Which built-in tool is routing. */\n\ttool: SearchToolKind;\n\t/** Filter: the request targets glob-style matching (find) rather than fuzzy file search. */\n\tglob: boolean;\n\t/** Filter: forced case-insensitive matching was requested. */\n\tignoreCase: boolean;\n\t/** Filter: maximum number of results the caller will keep. */\n\tlimit: number;\n\t/** Env fact: an FFF resident finder is usable for this cwd. */\n\tfinderAvailable: boolean;\n\t/** Env fact: the search path is inside the indexed cwd and exists. */\n\tpathResolvable: boolean;\n\t/** Env fact: a `.gitignore` exists under the search path. */\n\tgitignoreInTree: boolean;\n}\n\nexport interface SearchRouteDecision {\n\tbackend: SearchBackend;\n\treason: SearchRouteReason;\n}\n\nexport interface SearchRouterThresholds {\n\t/** Result limit at or below which `find` prefers the FFF top-N/fuzzy path. */\n\tfindMaxFffLimit: number;\n\t/** Result limit at or below which `grep` prefers the FFF top-N path. */\n\tgrepMaxFffLimit: number;\n}\n\nexport const DEFAULT_SEARCH_ROUTER_THRESHOLDS: SearchRouterThresholds = {\n\tfindMaxFffLimit: 20,\n\tgrepMaxFffLimit: 20,\n};\n\n/**\n * Pure routing decision. Fail-closed toward the fallback: any missing capability\n * or unsupported filter routes to fd/rg, never silently to a backend that cannot\n * honor the request. Order matters — the earliest matching guard wins so the\n * reason code reflects the most fundamental reason FFF was rejected.\n */\nexport function routeSearchBackend(\n\trequest: SearchRouteRequest,\n\tthresholds: SearchRouterThresholds = DEFAULT_SEARCH_ROUTER_THRESHOLDS,\n): SearchRouteDecision {\n\tif (!request.pathResolvable) {\n\t\treturn { backend: \"fallback\", reason: \"path_unresolved\" };\n\t}\n\tif (request.ignoreCase) {\n\t\t// FFF exposes smart-case/case-sensitive modes but no forced ignore-case\n\t\t// equivalent to `fd --ignore-case` / `rg --ignore-case`.\n\t\treturn { backend: \"fallback\", reason: \"forced_ignore_case\" };\n\t}\n\n\tconst maxFff = request.tool === \"find\" ? thresholds.findMaxFffLimit : thresholds.grepMaxFffLimit;\n\n\tif (request.tool === \"find\" && !request.glob) {\n\t\t// Fuzzy ranked file search: the fd fallback cannot honor this filter at all,\n\t\t// so FFF is the only backend that satisfies it. Still bounded so a pathological\n\t\t// huge pull degrades to a normal exhaustive listing instead of scoring the\n\t\t// entire corpus.\n\t\tif (request.limit > maxFff) return { backend: \"fallback\", reason: \"exhaustive_limit\" };\n\t\tif (request.gitignoreInTree) return { backend: \"fallback\", reason: \"gitignore_semantics\" };\n\t\tif (!request.finderAvailable) return { backend: \"fallback\", reason: \"fff_unavailable\" };\n\t\treturn { backend: \"fff\", reason: \"fff_fuzzy_file_search\" };\n\t}\n\n\tif (request.limit > maxFff) {\n\t\treturn { backend: \"fallback\", reason: \"exhaustive_limit\" };\n\t}\n\tif (request.gitignoreInTree) {\n\t\t// FFF's `.gitignore` handling diverges from fd/rg's hierarchical, per-subtree\n\t\t// semantics (see regression #3303), so defer to fd/rg when one is present.\n\t\treturn { backend: \"fallback\", reason: \"gitignore_semantics\" };\n\t}\n\tif (!request.finderAvailable) {\n\t\treturn { backend: \"fallback\", reason: \"fff_unavailable\" };\n\t}\n\n\treturn { backend: \"fff\", reason: \"fff_topn\" };\n}\n\nexport interface SearchRouter {\n\troute(request: SearchRouteRequest): SearchRouteDecision;\n}\n\n/** Build a router bound to a fixed threshold set. */\nexport function createSearchRouter(\n\tthresholds: SearchRouterThresholds = DEFAULT_SEARCH_ROUTER_THRESHOLDS,\n): SearchRouter {\n\treturn {\n\t\troute: (request) => routeSearchBackend(request, thresholds),\n\t};\n}\n\n/** Default router used by the built-in `find`/`grep` tools when none is injected. */\nexport const defaultSearchRouter: SearchRouter = createSearchRouter();\n"]}
|