@octopi-agent/engine 0.65.0 → 0.86.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/NOTICE +7 -7
- package/README.md +64 -26
- package/dist/config-schema/agent.d.ts +89 -1
- package/dist/config-schema/agent.js +69 -0
- package/dist/config-schema/context.d.ts +23 -4
- package/dist/config-schema/context.js +28 -1
- package/dist/config-schema/engine.d.ts +285 -9
- package/dist/config-schema/engine.js +35 -3
- package/dist/config-schema/governance.d.ts +95 -0
- package/dist/config-schema/governance.js +91 -0
- package/dist/config-schema/models.d.ts +1 -1
- package/dist/config-schema/observability.d.ts +6 -0
- package/dist/config-schema/observability.js +16 -0
- package/dist/config-schema/run.d.ts +10 -0
- package/dist/config-schema/run.js +18 -0
- package/dist/config-schema/shared.d.ts +10 -0
- package/dist/config-schema/shared.js +10 -0
- package/dist/config-schema/substrate.d.ts +87 -1
- package/dist/config-schema/substrate.js +114 -0
- package/dist/config-schema/subsystems.d.ts +1 -1
- package/dist/config-schema/subsystems.js +2 -1
- package/dist/config.d.ts +249 -7
- package/dist/config.js +113 -3
- package/dist/harness/activation/compiler.js +3 -0
- package/dist/harness/activation/runtime.d.ts +7 -0
- package/dist/harness/activation/runtime.js +60 -2
- package/dist/harness/activation/sources/agent-signal.d.ts +11 -0
- package/dist/harness/activation/sources/agent-signal.js +33 -0
- package/dist/harness/activation/types.d.ts +6 -1
- package/dist/harness/agent/builder.d.ts +48 -4
- package/dist/harness/agent/builder.js +206 -55
- package/dist/harness/agent/config-bridge.d.ts +33 -25
- package/dist/harness/agent/config-bridge.js +83 -280
- package/dist/harness/agent/index.d.ts +3 -1
- package/dist/harness/agent/index.js +2 -1
- package/dist/harness/agent/tool-purpose.d.ts +38 -0
- package/dist/harness/agent/tool-purpose.js +118 -0
- package/dist/harness/agent/wire-agent-builder.d.ts +133 -0
- package/dist/harness/agent/wire-agent-builder.js +363 -0
- package/dist/harness/collaboration/autonomous-subsystem/runtime.d.ts +4 -1
- package/dist/harness/collaboration/autonomous-subsystem/runtime.js +14 -8
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.d.ts +12 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.js +19 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.d.ts +6 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.js +24 -7
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.d.ts +5 -2
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +11 -3
- package/dist/harness/collaboration/autonomous-subsystem/think/index.d.ts +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/index.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.d.ts +7 -4
- package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.js +8 -9
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.d.ts +36 -10
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.js +60 -7
- package/dist/harness/collaboration/delegation/child-run.d.ts +144 -0
- package/dist/harness/collaboration/delegation/child-run.js +241 -0
- package/dist/harness/collaboration/delegation/index.d.ts +26 -0
- package/dist/harness/collaboration/delegation/index.js +25 -0
- package/dist/harness/collaboration/delegation/notifier.d.ts +46 -0
- package/dist/harness/collaboration/delegation/notifier.js +84 -0
- package/dist/harness/collaboration/delegation/registry-types.d.ts +200 -0
- package/dist/harness/collaboration/delegation/registry-types.js +61 -0
- package/dist/harness/collaboration/delegation/registry.d.ts +110 -0
- package/dist/harness/collaboration/delegation/registry.js +220 -0
- package/dist/harness/collaboration/delegation/service.d.ts +249 -0
- package/dist/harness/collaboration/delegation/service.js +499 -0
- package/dist/harness/collaboration/delegation/store.d.ts +155 -0
- package/dist/harness/collaboration/delegation/store.js +271 -0
- package/dist/harness/collaboration/delegation/transport.d.ts +73 -0
- package/dist/harness/collaboration/delegation/transport.js +61 -0
- package/dist/harness/collaboration/delegation/types.d.ts +231 -0
- package/dist/harness/collaboration/delegation/types.js +70 -0
- package/dist/harness/collaboration/delegation/wiring.d.ts +111 -0
- package/dist/harness/collaboration/delegation/wiring.js +145 -0
- package/dist/harness/collaboration/orchestration/index.d.ts +11 -13
- package/dist/harness/collaboration/orchestration/index.js +11 -11
- package/dist/harness/context/assembler.d.ts +2 -2
- package/dist/harness/context/assembler.js +12 -7
- package/dist/harness/context/capabilities/compact/engine.js +80 -38
- package/dist/harness/context/capabilities/compact/types.d.ts +12 -1
- package/dist/harness/context/capabilities/summary/gate.js +2 -2
- package/dist/harness/context/capabilities/summary/policies.js +5 -5
- package/dist/harness/context/capabilities/summary/registry.js +39 -24
- package/dist/harness/context/constitution/default-agents.md +230 -228
- package/dist/harness/context/default-context-engine.d.ts +101 -23
- package/dist/harness/context/default-context-engine.js +483 -172
- package/dist/harness/context/hybrid-compressor.d.ts +3 -3
- package/dist/harness/context/hybrid-compressor.js +18 -23
- package/dist/harness/context/index.d.ts +5 -1
- package/dist/harness/context/index.js +2 -0
- package/dist/harness/context/layer-health.js +3 -2
- package/dist/harness/context/layer-snapshot.d.ts +4 -0
- package/dist/harness/context/layer-snapshot.js +30 -18
- package/dist/harness/context/layer-types.d.ts +49 -1
- package/dist/harness/context/layer-types.js +72 -4
- package/dist/harness/context/layers.d.ts +32 -15
- package/dist/harness/context/layers.js +87 -71
- package/dist/harness/context/llm-summarizer.d.ts +15 -1
- package/dist/harness/context/llm-summarizer.js +107 -56
- package/dist/harness/context/message-selector.js +6 -2
- package/dist/harness/context/root-instructions.d.ts +72 -0
- package/dist/harness/context/root-instructions.js +227 -0
- package/dist/harness/context/runtime-datetime.d.ts +34 -7
- package/dist/harness/context/runtime-datetime.js +66 -10
- package/dist/harness/context/smart-router.d.ts +1 -1
- package/dist/harness/context/smart-router.js +1 -1
- package/dist/harness/context/system-prompt-assembler.d.ts +33 -0
- package/dist/harness/context/system-prompt-assembler.js +78 -7
- package/dist/harness/context/token-constants.d.ts +2 -2
- package/dist/harness/context/token-constants.js +2 -2
- package/dist/harness/context/token-estimate-fns.d.ts +1 -3
- package/dist/harness/context/token-estimate-fns.js +2 -4
- package/dist/harness/context/token-estimator.d.ts +1 -1
- package/dist/harness/context/token-estimator.js +14 -6
- package/dist/harness/context/tool-result-aging.d.ts +140 -0
- package/dist/harness/context/tool-result-aging.js +331 -0
- package/dist/harness/context/tool-result-body.d.ts +10 -0
- package/dist/harness/context/tool-result-body.js +27 -0
- package/dist/harness/context/turn-envelope.d.ts +123 -0
- package/dist/harness/context/turn-envelope.js +188 -0
- package/dist/harness/context/types.d.ts +35 -47
- package/dist/harness/extension/execution-environment/effect-policy.d.ts +248 -0
- package/dist/harness/extension/execution-environment/effect-policy.js +334 -0
- package/dist/harness/extension/execution-environment/index.d.ts +18 -2
- package/dist/harness/extension/execution-environment/index.js +11 -2
- package/dist/harness/extension/execution-environment/memory-undo.d.ts +101 -0
- package/dist/harness/extension/execution-environment/memory-undo.js +192 -0
- package/dist/harness/extension/execution-environment/process-isolation.d.ts +84 -0
- package/dist/harness/extension/execution-environment/process-isolation.js +315 -0
- package/dist/harness/extension/execution-environment/resource-limits.d.ts +36 -0
- package/dist/harness/extension/execution-environment/resource-limits.js +84 -0
- package/dist/harness/extension/execution-environment/sandbox.d.ts +125 -4
- package/dist/harness/extension/execution-environment/sandbox.js +493 -51
- package/dist/harness/extension/execution-environment/shell-journal.d.ts +100 -0
- package/dist/harness/extension/execution-environment/shell-journal.js +299 -0
- package/dist/harness/extension/execution-environment/tool-capabilities.d.ts +45 -0
- package/dist/harness/extension/execution-environment/tool-capabilities.js +126 -0
- package/dist/harness/extension/execution-environment/types.d.ts +67 -39
- package/dist/harness/extension/execution-environment/types.js +2 -2
- package/dist/harness/extension/execution-environment/undo-log.d.ts +203 -0
- package/dist/harness/extension/execution-environment/undo-log.js +627 -0
- package/dist/harness/extension/execution-environment/undo-merge.d.ts +40 -0
- package/dist/harness/extension/execution-environment/undo-merge.js +167 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/index.d.ts +4 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/index.js +3 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/invoke.d.ts +56 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/invoke.js +281 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.d.ts +98 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.js +250 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/stream.d.ts +124 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/stream.js +372 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/types.d.ts +118 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/types.js +8 -0
- package/dist/harness/extension/plugin-ecosystem/index.d.ts +1 -0
- package/dist/harness/extension/plugin-ecosystem/index.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/mcp/bridge.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/api.d.ts +1 -6
- package/dist/harness/extension/plugin-ecosystem/plugins/api.js +3 -8
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.d.ts +0 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.js +0 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.d.ts +2 -10
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.js +2 -9
- package/dist/harness/extension/plugin-ecosystem/plugins/index.d.ts +1 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/index.js +1 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.d.ts +2 -4
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.js +4 -21
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.d.ts +3 -9
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.js +4 -8
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.d.ts +1 -4
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.js +1 -3
- package/dist/harness/extension/plugin-ecosystem/skills/manager.d.ts +1 -1
- package/dist/harness/extension/plugin-ecosystem/skills/manager.js +1 -1
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.d.ts +45 -0
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.js +136 -0
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.d.ts +18 -3
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +278 -82
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.d.ts +31 -0
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.js +291 -0
- package/dist/harness/extension/plugin-ecosystem/tools/document-tools.js +10 -2
- package/dist/harness/extension/plugin-ecosystem/tools/env-info.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/tools/eol.d.ts +35 -0
- package/dist/harness/extension/plugin-ecosystem/tools/eol.js +43 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-edit.js +40 -9
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.d.ts +33 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.js +376 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.d.ts +12 -2
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.js +239 -61
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.d.ts +27 -0
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.js +554 -0
- package/dist/harness/extension/plugin-ecosystem/tools/http.d.ts +10 -6
- package/dist/harness/extension/plugin-ecosystem/tools/http.js +41 -47
- package/dist/harness/extension/plugin-ecosystem/tools/index.d.ts +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/index.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/knowledge.js +4 -0
- package/dist/harness/extension/plugin-ecosystem/tools/memory.d.ts +11 -1
- package/dist/harness/extension/plugin-ecosystem/tools/memory.js +39 -1
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.d.ts +13 -0
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.js +391 -0
- package/dist/harness/extension/plugin-ecosystem/tools/platform.d.ts +51 -2
- package/dist/harness/extension/plugin-ecosystem/tools/platform.js +151 -12
- package/dist/harness/extension/plugin-ecosystem/tools/session-history.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.d.ts +10 -1
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.js +35 -19
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.d.ts +8 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.js +5 -0
- package/dist/harness/extension/plugin-ecosystem/tools/web-search.js +1 -0
- package/dist/harness/governance/credentials/index.d.ts +1 -1
- package/dist/harness/governance/credentials/store.d.ts +16 -4
- package/dist/harness/governance/credentials/store.js +33 -6
- package/dist/harness/governance/credentials/types.d.ts +11 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.d.ts +105 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.js +184 -0
- package/dist/harness/governance/human-in-the-loop/index.d.ts +5 -5
- package/dist/harness/governance/human-in-the-loop/index.js +3 -3
- package/dist/harness/governance/human-in-the-loop/types.d.ts +7 -62
- package/dist/harness/governance/human-in-the-loop/types.js +6 -2
- package/dist/harness/governance/security/capability-enforcer.d.ts +9 -1
- package/dist/harness/governance/security/capability-enforcer.js +31 -8
- package/dist/harness/governance/security/degradation.js +5 -7
- package/dist/harness/governance/security/risk-evaluator.d.ts +1 -1
- package/dist/harness/governance/security/risk-evaluator.js +4 -82
- package/dist/harness/governance/security/temp-path.d.ts +41 -0
- package/dist/harness/governance/security/temp-path.js +117 -0
- package/dist/harness/governance/session-acl/index.d.ts +1 -0
- package/dist/harness/governance/session-acl/index.js +1 -0
- package/dist/harness/governance/session-acl/rights.d.ts +12 -0
- package/dist/harness/governance/session-acl/rights.js +89 -7
- package/dist/harness/governance/session-acl/seed-roles.js +9 -1
- package/dist/harness/governance/session-acl/service.js +21 -29
- package/dist/harness/governance/session-acl/tool-rights.d.ts +81 -0
- package/dist/harness/governance/session-acl/tool-rights.js +238 -0
- package/dist/harness/governance/session-acl/types.d.ts +22 -0
- package/dist/harness/index.d.ts +18 -15
- package/dist/harness/index.js +11 -7
- package/dist/harness/knowledge/file-index-store.js +11 -11
- package/dist/harness/knowledge/grounding.d.ts +2 -1
- package/dist/harness/knowledge/grounding.js +6 -3
- package/dist/harness/knowledge/index.d.ts +2 -2
- package/dist/harness/knowledge/index.js +1 -1
- package/dist/harness/knowledge/ingest.js +4 -1
- package/dist/harness/knowledge/job-control-state.js +4 -4
- package/dist/harness/knowledge/job-control.js +11 -11
- package/dist/harness/knowledge/membership-store.js +11 -11
- package/dist/harness/knowledge/network-guard.d.ts +61 -4
- package/dist/harness/knowledge/network-guard.js +390 -113
- package/dist/harness/knowledge/query-service.js +8 -8
- package/dist/harness/knowledge/retriever.js +1 -1
- package/dist/harness/knowledge/source-store.d.ts +17 -2
- package/dist/harness/knowledge/source-store.js +6 -5
- package/dist/harness/knowledge/writer-service.d.ts +2 -0
- package/dist/harness/knowledge/writer-service.js +14 -13
- package/dist/harness/memory/backfill-trigger.d.ts +2 -2
- package/dist/harness/memory/backfill-trigger.js +4 -4
- package/dist/harness/memory/cognition-decay.d.ts +36 -0
- package/dist/harness/memory/cognition-decay.js +55 -0
- package/dist/harness/memory/cognition-gates.d.ts +60 -0
- package/dist/harness/memory/cognition-gates.js +191 -0
- package/dist/harness/memory/cognition-trigger.d.ts +30 -0
- package/dist/harness/memory/cognition-trigger.js +41 -0
- package/dist/harness/memory/cognition-types.d.ts +1 -1
- package/dist/harness/memory/cognition.d.ts +40 -8
- package/dist/harness/memory/cognition.js +432 -79
- package/dist/harness/memory/conceptualizer.d.ts +66 -0
- package/dist/harness/memory/conceptualizer.js +246 -0
- package/dist/harness/memory/index.d.ts +17 -2
- package/dist/harness/memory/index.js +12 -1
- package/dist/harness/memory/sqlite/agent-db.d.ts +9 -0
- package/dist/harness/memory/sqlite/agent-db.js +120 -15
- package/dist/harness/memory/sqlite/cognition-store.d.ts +55 -16
- package/dist/harness/memory/sqlite/cognition-store.js +591 -144
- package/dist/harness/memory/sqlite/memory-store.d.ts +1 -0
- package/dist/harness/memory/sqlite/memory-store.js +14 -4
- package/dist/harness/memory/sqlite/wisdom-store.d.ts +33 -14
- package/dist/harness/memory/sqlite/wisdom-store.js +257 -44
- package/dist/harness/memory/store.d.ts +1 -0
- package/dist/harness/memory/store.js +3 -0
- package/dist/harness/memory/time-format.d.ts +28 -0
- package/dist/harness/memory/time-format.js +52 -0
- package/dist/harness/memory/types.d.ts +343 -16
- package/dist/harness/memory/types.js +49 -0
- package/dist/harness/memory/wisdom-formation.d.ts +101 -0
- package/dist/harness/memory/wisdom-formation.js +304 -0
- package/dist/harness/memory/wisdom-gates.d.ts +50 -0
- package/dist/harness/memory/wisdom-gates.js +204 -0
- package/dist/harness/memory/wisdom-policy.d.ts +107 -0
- package/dist/harness/memory/wisdom-policy.js +220 -0
- package/dist/harness/memory/wisdom-types.d.ts +3 -2
- package/dist/harness/memory/wisdom-types.js +2 -2
- package/dist/harness/memory/wisdom.d.ts +27 -0
- package/dist/harness/memory/wisdom.js +181 -0
- package/dist/harness/observability/observer/hub.js +23 -1
- package/dist/harness/observability/observer/index.d.ts +2 -2
- package/dist/harness/observability/observer/index.js +1 -1
- package/dist/harness/observability/observer/types.d.ts +57 -0
- package/dist/harness/observability/observer/types.js +118 -9
- package/dist/harness/run/agent/agent.d.ts +27 -0
- package/dist/harness/run/agent/agent.js +45 -0
- package/dist/harness/run/concurrency/tool-loop-detection-core.d.ts +1 -1
- package/dist/harness/run/concurrency/tool-loop-detection-core.js +1 -1
- package/dist/harness/run/reliability/harness-events.d.ts +4 -0
- package/dist/harness/run/reliability/run-agent.js +116 -20
- package/dist/harness/run/reliability/run-metrics-collector.d.ts +28 -2
- package/dist/harness/run/reliability/run-metrics-collector.js +92 -2
- package/dist/harness/run/run-guard/default-run-guard.d.ts +0 -5
- package/dist/harness/run/run-guard/default-run-guard.js +104 -44
- package/dist/harness/run/run-scope.d.ts +52 -0
- package/dist/harness/run/runner.d.ts +101 -16
- package/dist/harness/run/runner.js +557 -158
- package/dist/harness/session/attachments/llm-intent.js +17 -17
- package/dist/harness/session/history/port.js +1 -0
- package/dist/harness/session/in-memory-store.d.ts +1 -0
- package/dist/harness/session/in-memory-store.js +22 -1
- package/dist/harness/session/index.d.ts +1 -0
- package/dist/harness/session/index.js +1 -0
- package/dist/harness/session/schedules/index.d.ts +10 -0
- package/dist/harness/session/schedules/index.js +10 -0
- package/dist/harness/session/schedules/render.d.ts +13 -0
- package/dist/harness/session/schedules/render.js +63 -0
- package/dist/harness/session/schedules/service.d.ts +179 -0
- package/dist/harness/session/schedules/service.js +695 -0
- package/dist/harness/session/schedules/store.d.ts +119 -0
- package/dist/harness/session/schedules/store.js +323 -0
- package/dist/harness/session/schedules/tools.d.ts +39 -0
- package/dist/harness/session/schedules/tools.js +442 -0
- package/dist/harness/session/schedules/types.d.ts +104 -0
- package/dist/harness/session/schedules/types.js +97 -0
- package/dist/harness/session/tasks/tools.js +22 -0
- package/dist/harness/session/title.d.ts +86 -0
- package/dist/harness/session/title.js +268 -0
- package/dist/harness/session/types.d.ts +35 -0
- package/dist/harness/shared/events/agent-event-map.d.ts +21 -0
- package/dist/harness/shared/events/agent-event-map.js +1 -0
- package/dist/harness/shared/types/agent-definition.d.ts +23 -0
- package/dist/index.d.ts +25 -9
- package/dist/index.js +11 -2
- package/dist/integration/providers/anthropic.d.ts +10 -0
- package/dist/integration/providers/anthropic.js +44 -1
- package/dist/integration/providers/openai.d.ts +10 -0
- package/dist/integration/providers/openai.js +58 -2
- package/dist/integration/providers/wire-dump-diff.d.ts +191 -0
- package/dist/integration/providers/wire-dump-diff.js +351 -0
- package/dist/integration/providers/wire-dump.d.ts +178 -0
- package/dist/integration/providers/wire-dump.js +396 -0
- package/dist/integration/storage/jsonl.d.ts +11 -0
- package/dist/integration/storage/jsonl.js +148 -39
- package/dist/integration/storage/session-index.js +63 -8
- package/dist/subsystems/cognition-steward/conceptualize/SUBSYSTEM.md +43 -0
- package/dist/subsystems/cognition-steward/conceptualize/config.yaml +50 -0
- package/dist/subsystems/cognition-steward/conceptualize/handler.d.ts +9 -0
- package/dist/subsystems/cognition-steward/conceptualize/handler.js +125 -0
- package/dist/subsystems/cognition-steward/consolidate/SUBSYSTEM.md +6 -0
- package/dist/subsystems/cognition-steward/consolidate/config.yaml +54 -0
- package/dist/subsystems/cognition-steward/consolidate/handler.d.ts +12 -0
- package/dist/subsystems/cognition-steward/consolidate/handler.js +93 -0
- package/dist/subsystems/memory-steward/backfill/handler.js +9 -0
- package/dist/subsystems/wisdom-steward/evaluate/config.yaml +50 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.d.ts +18 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.js +91 -0
- package/dist/subsystems/wisdom-steward/formation/SUBSYSTEM.md +42 -0
- package/dist/subsystems/wisdom-steward/formation/config.yaml +54 -0
- package/dist/subsystems/wisdom-steward/formation/handler.d.ts +18 -0
- package/dist/subsystems/wisdom-steward/formation/handler.js +212 -0
- package/dist/subsystems/wisdom-steward/govern/config.yaml +55 -0
- package/dist/subsystems/wisdom-steward/govern/handler.d.ts +17 -0
- package/dist/subsystems/wisdom-steward/govern/handler.js +68 -0
- package/package.json +115 -115
- package/dist/harness/collaboration/multi-agent/agent-registry-types.d.ts +0 -144
- package/dist/harness/collaboration/multi-agent/agent-registry-types.js +0 -25
- package/dist/harness/collaboration/multi-agent/index.d.ts +0 -17
- package/dist/harness/collaboration/multi-agent/index.js +0 -15
- package/dist/harness/collaboration/multi-agent/process.d.ts +0 -167
- package/dist/harness/collaboration/multi-agent/process.js +0 -256
- package/dist/harness/collaboration/multi-agent/registry.d.ts +0 -36
- package/dist/harness/collaboration/multi-agent/registry.js +0 -137
- package/dist/harness/collaboration/multi-agent/swarm.d.ts +0 -135
- package/dist/harness/collaboration/multi-agent/swarm.js +0 -317
- package/dist/harness/collaboration/multi-agent/types.d.ts +0 -66
- package/dist/harness/collaboration/multi-agent/types.js +0 -15
- package/dist/harness/collaboration/orchestration/async-task-store.d.ts +0 -107
- package/dist/harness/collaboration/orchestration/async-task-store.js +0 -12
- package/dist/harness/collaboration/orchestration/async-task.d.ts +0 -156
- package/dist/harness/collaboration/orchestration/async-task.js +0 -359
- package/dist/harness/collaboration/orchestration/planner/hybrid-planner.d.ts +0 -47
- package/dist/harness/collaboration/orchestration/planner/hybrid-planner.js +0 -61
- package/dist/harness/collaboration/orchestration/planner/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/planner/index.js +0 -6
- package/dist/harness/collaboration/orchestration/planner/llm-planner.d.ts +0 -54
- package/dist/harness/collaboration/orchestration/planner/llm-planner.js +0 -167
- package/dist/harness/collaboration/orchestration/planner/rule-planner.d.ts +0 -85
- package/dist/harness/collaboration/orchestration/planner/rule-planner.js +0 -175
- package/dist/harness/collaboration/orchestration/quality/classifier.d.ts +0 -21
- package/dist/harness/collaboration/orchestration/quality/classifier.js +0 -235
- package/dist/harness/collaboration/orchestration/quality/gate.d.ts +0 -29
- package/dist/harness/collaboration/orchestration/quality/gate.js +0 -409
- package/dist/harness/collaboration/orchestration/quality/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/quality/index.js +0 -8
- package/dist/harness/collaboration/orchestration/quality/types.d.ts +0 -159
- package/dist/harness/collaboration/orchestration/quality/types.js +0 -33
- package/dist/harness/collaboration/orchestration/scheduler/index.d.ts +0 -5
- package/dist/harness/collaboration/orchestration/scheduler/index.js +0 -4
- package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.d.ts +0 -143
- package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.js +0 -297
- package/dist/harness/collaboration/orchestration/strategy/classifier.d.ts +0 -12
- package/dist/harness/collaboration/orchestration/strategy/classifier.js +0 -81
- package/dist/harness/collaboration/orchestration/strategy/index.d.ts +0 -3
- package/dist/harness/collaboration/orchestration/strategy/index.js +0 -2
- package/dist/harness/collaboration/orchestration/strategy/router.d.ts +0 -28
- package/dist/harness/collaboration/orchestration/strategy/router.js +0 -105
- package/dist/harness/collaboration/orchestration/strategy/types.d.ts +0 -49
- package/dist/harness/collaboration/orchestration/strategy/types.js +0 -4
- package/dist/harness/collaboration/orchestration/workflow/engine.d.ts +0 -86
- package/dist/harness/collaboration/orchestration/workflow/engine.js +0 -298
- package/dist/harness/collaboration/orchestration/workflow/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/workflow/index.js +0 -7
- package/dist/harness/collaboration/orchestration/workflow/types.d.ts +0 -143
- package/dist/harness/collaboration/orchestration/workflow/types.js +0 -7
- package/dist/harness/governance/human-in-the-loop/approval-manager.d.ts +0 -32
- package/dist/harness/governance/human-in-the-loop/approval-manager.js +0 -93
- /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.d.ts +0 -0
- /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.js +0 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { isPathUnderRoots, isUnderAttachmentRoot, resolveToolPath, isUnderSessionUndoRoot, } from './platform.js';
|
|
2
|
+
import { gateEffect } from '../../execution-environment/effect-policy.js';
|
|
3
|
+
function resolveSafePath(rawPath, context, label) {
|
|
4
|
+
const cwd = context?.cwd ?? process.cwd();
|
|
5
|
+
const path = resolveToolPath(rawPath, cwd, {
|
|
6
|
+
allowRoots: context?.pathRoots,
|
|
7
|
+
containment: context?.pathContainment,
|
|
8
|
+
});
|
|
9
|
+
if (isUnderAttachmentRoot(path, context?.attachmentRoots)) {
|
|
10
|
+
throw new Error(`session attachments are read-only; cannot ${label} under attachments root`);
|
|
11
|
+
}
|
|
12
|
+
if (isUnderSessionUndoRoot(path, context?.undoRoots)) {
|
|
13
|
+
throw new Error(`session undo ledger is protected; cannot ${label} under sessions undo dir`);
|
|
14
|
+
}
|
|
15
|
+
return path;
|
|
16
|
+
}
|
|
17
|
+
async function requireEffects(context, toolName) {
|
|
18
|
+
const effects = context?.fileEffects;
|
|
19
|
+
if (!effects) {
|
|
20
|
+
throw new Error(`file_effects_not_configured: ${toolName} requires ToolExecutionContext.fileEffects`);
|
|
21
|
+
}
|
|
22
|
+
return effects;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* file_mkdir — create a directory (optionally parents)
|
|
26
|
+
*/
|
|
27
|
+
export function createFileMkdirTool() {
|
|
28
|
+
return {
|
|
29
|
+
definition: {
|
|
30
|
+
name: 'file_mkdir',
|
|
31
|
+
capabilities: ['fs-write'],
|
|
32
|
+
description: 'Create a directory. Creates parent directories when recursive=true (default). Cross-platform.',
|
|
33
|
+
parameters: {
|
|
34
|
+
path: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Directory path to create',
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
recursive: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
description: 'Create parent directories if needed (default: true)',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
// fs 写工具:所在 tool_call 批次整体串行
|
|
46
|
+
executionMode: 'sequential',
|
|
47
|
+
handler: async (args, context) => {
|
|
48
|
+
const { mkdir, stat } = await import('node:fs/promises');
|
|
49
|
+
const path = resolveSafePath(args.path, context, 'mkdir');
|
|
50
|
+
const recursive = args.recursive ?? true;
|
|
51
|
+
const st = await stat(path).catch(() => null);
|
|
52
|
+
if (st?.isDirectory()) {
|
|
53
|
+
return { path, created: false, existed: true };
|
|
54
|
+
}
|
|
55
|
+
if (st) {
|
|
56
|
+
throw new Error(`Path exists and is not a directory: ${path}`);
|
|
57
|
+
}
|
|
58
|
+
// Mirrors file_rmdir's gate shape: after this tool's existence checks
|
|
59
|
+
// (no-op calls never prompt) and before the mutation. transactional
|
|
60
|
+
// (in-roots) auto-allows; host-gate asks the host. Gate errors surface
|
|
61
|
+
// unwrapped (effect_denied stays identifiable).
|
|
62
|
+
await gateEffect({
|
|
63
|
+
kind: 'file.write',
|
|
64
|
+
path,
|
|
65
|
+
mode: 'create',
|
|
66
|
+
transactional: isPathUnderRoots(path, context?.pathRoots ?? []),
|
|
67
|
+
}, {
|
|
68
|
+
effects: context?.effectChannel ?? 'engine',
|
|
69
|
+
confirmEffect: context?.confirmEffect,
|
|
70
|
+
});
|
|
71
|
+
try {
|
|
72
|
+
await mkdir(path, { recursive });
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (error instanceof Error && /not a directory/.test(error.message))
|
|
76
|
+
throw error;
|
|
77
|
+
throw new Error(`Failed to create directory "${path}": ${error instanceof Error ? error.message : String(error)}`);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
path,
|
|
81
|
+
created: true,
|
|
82
|
+
existed: false,
|
|
83
|
+
reversible: false,
|
|
84
|
+
note: 'directory creation is not journaled for turn undo',
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* file_rename — rename/move a file or directory
|
|
91
|
+
*
|
|
92
|
+
* Files: journaled via recordRename (edit-resend undo).
|
|
93
|
+
* Directories: fs.rename; tree undo is not journaled (reversible:false).
|
|
94
|
+
*/
|
|
95
|
+
export function createFileRenameTool() {
|
|
96
|
+
return {
|
|
97
|
+
definition: {
|
|
98
|
+
name: 'file_rename',
|
|
99
|
+
capabilities: ['fs-write'],
|
|
100
|
+
description: 'Rename or move a file or directory. Overwrites the destination if it exists (file) or fails if destination directory exists. File moves are journaled for undo; directory moves are not tree-undoable.',
|
|
101
|
+
parameters: {
|
|
102
|
+
from: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
description: 'Source path',
|
|
105
|
+
required: true,
|
|
106
|
+
},
|
|
107
|
+
to: {
|
|
108
|
+
type: 'string',
|
|
109
|
+
description: 'Destination path',
|
|
110
|
+
required: true,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
// fs 写工具:所在 tool_call 批次整体串行
|
|
115
|
+
executionMode: 'sequential',
|
|
116
|
+
handler: async (args, context) => {
|
|
117
|
+
const { rename, stat, rm, readFile } = await import('node:fs/promises');
|
|
118
|
+
const from = resolveSafePath(args.from, context, 'rename');
|
|
119
|
+
const to = resolveSafePath(args.to, context, 'rename');
|
|
120
|
+
if (from === to) {
|
|
121
|
+
return { from, to, renamed: false, reason: 'same_path' };
|
|
122
|
+
}
|
|
123
|
+
let srcStat;
|
|
124
|
+
try {
|
|
125
|
+
srcStat = await stat(from);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
throw new Error(`Source not found: ${from}`);
|
|
129
|
+
}
|
|
130
|
+
await gateEffect({
|
|
131
|
+
kind: 'file.write',
|
|
132
|
+
path: to,
|
|
133
|
+
mode: 'overwrite',
|
|
134
|
+
transactional: isPathUnderRoots(from, context?.pathRoots ?? []) &&
|
|
135
|
+
isPathUnderRoots(to, context?.pathRoots ?? []),
|
|
136
|
+
}, {
|
|
137
|
+
effects: context?.effectChannel ?? 'engine',
|
|
138
|
+
confirmEffect: context?.confirmEffect,
|
|
139
|
+
});
|
|
140
|
+
const destStat = await stat(to).catch(() => null);
|
|
141
|
+
if (srcStat.isDirectory() && destStat?.isDirectory()) {
|
|
142
|
+
throw new Error(`Destination directory already exists: ${to}`);
|
|
143
|
+
}
|
|
144
|
+
if (srcStat.isDirectory() && destStat?.isFile()) {
|
|
145
|
+
throw new Error(`Cannot overwrite file with directory: ${to}`);
|
|
146
|
+
}
|
|
147
|
+
if (srcStat.isDirectory()) {
|
|
148
|
+
try {
|
|
149
|
+
await rename(from, to);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
throw new Error(`Failed to rename directory "${from}" → "${to}": ${error instanceof Error ? error.message : String(error)}`);
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
from,
|
|
156
|
+
to,
|
|
157
|
+
renamed: true,
|
|
158
|
+
kind: 'directory',
|
|
159
|
+
reversible: false,
|
|
160
|
+
note: 'directory move is not journaled for turn undo',
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
// Journal BEFORE any mutation so dest overwrite keeps a restorable `before`.
|
|
164
|
+
// recordRename reads both paths from disk (delete(from)+overwrite/create(to)).
|
|
165
|
+
const effects = await requireEffects(context, 'file_rename');
|
|
166
|
+
const before = await readFile(from);
|
|
167
|
+
await effects.recordRename(from, to);
|
|
168
|
+
// Windows: rename fails if destination file exists — replace after journaling
|
|
169
|
+
if (destStat?.isFile()) {
|
|
170
|
+
await rm(to, { force: true });
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
await rename(from, to);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
throw new Error(`Failed to rename file "${from}" → "${to}": ${error instanceof Error ? error.message : String(error)}`);
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
from,
|
|
180
|
+
to,
|
|
181
|
+
renamed: true,
|
|
182
|
+
kind: 'file',
|
|
183
|
+
reversible: true,
|
|
184
|
+
bytes: before.byteLength,
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* file_copy — copy a file (not a directory)
|
|
191
|
+
*/
|
|
192
|
+
export function createFileCopyTool() {
|
|
193
|
+
return {
|
|
194
|
+
definition: {
|
|
195
|
+
name: 'file_copy',
|
|
196
|
+
capabilities: ['fs-write', 'fs-read'],
|
|
197
|
+
description: 'Copy a file to a new path. Creates parent directories if needed. Does not copy directories (use shell only if policy allows).',
|
|
198
|
+
parameters: {
|
|
199
|
+
from: {
|
|
200
|
+
type: 'string',
|
|
201
|
+
description: 'Source file path',
|
|
202
|
+
required: true,
|
|
203
|
+
},
|
|
204
|
+
to: {
|
|
205
|
+
type: 'string',
|
|
206
|
+
description: 'Destination file path',
|
|
207
|
+
required: true,
|
|
208
|
+
},
|
|
209
|
+
overwrite: {
|
|
210
|
+
type: 'boolean',
|
|
211
|
+
description: 'Overwrite destination if it exists (default: false)',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
// fs 写工具:所在 tool_call 批次整体串行
|
|
216
|
+
executionMode: 'sequential',
|
|
217
|
+
handler: async (args, context) => {
|
|
218
|
+
const { copyFile, mkdir, stat, readFile } = await import('node:fs/promises');
|
|
219
|
+
const { dirname } = await import('node:path');
|
|
220
|
+
const from = resolveSafePath(args.from, context, 'copy');
|
|
221
|
+
const to = resolveSafePath(args.to, context, 'copy');
|
|
222
|
+
const overwrite = args.overwrite ?? false;
|
|
223
|
+
let srcStat;
|
|
224
|
+
try {
|
|
225
|
+
srcStat = await stat(from);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
throw new Error(`Source not found: ${from}`);
|
|
229
|
+
}
|
|
230
|
+
if (srcStat.isDirectory()) {
|
|
231
|
+
throw new Error(`file_copy does not copy directories: ${from}`);
|
|
232
|
+
}
|
|
233
|
+
const destExists = await stat(to).then(() => true, () => false);
|
|
234
|
+
if (destExists && !overwrite) {
|
|
235
|
+
throw new Error(`Destination exists (pass overwrite=true to replace): ${to}`);
|
|
236
|
+
}
|
|
237
|
+
await gateEffect({
|
|
238
|
+
kind: 'file.write',
|
|
239
|
+
path: to,
|
|
240
|
+
mode: destExists ? 'overwrite' : 'create',
|
|
241
|
+
transactional: isPathUnderRoots(to, context?.pathRoots ?? []),
|
|
242
|
+
}, {
|
|
243
|
+
effects: context?.effectChannel ?? 'engine',
|
|
244
|
+
confirmEffect: context?.confirmEffect,
|
|
245
|
+
});
|
|
246
|
+
const effects = await requireEffects(context, 'file_copy');
|
|
247
|
+
await mkdir(dirname(to), { recursive: true });
|
|
248
|
+
// Journal destination before overwrite / create
|
|
249
|
+
if (destExists) {
|
|
250
|
+
const prior = await readFile(to);
|
|
251
|
+
const after = await readFile(from);
|
|
252
|
+
await effects.recordOverwrite(to, prior, after);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
const after = await readFile(from);
|
|
256
|
+
await effects.recordCreate(to, after);
|
|
257
|
+
}
|
|
258
|
+
// Binary-safe copy (images, Office, etc.)
|
|
259
|
+
await copyFile(from, to);
|
|
260
|
+
return {
|
|
261
|
+
from,
|
|
262
|
+
to,
|
|
263
|
+
copied: true,
|
|
264
|
+
overwrite,
|
|
265
|
+
bytes: srcStat.size,
|
|
266
|
+
reversible: true,
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* file_stat — file/directory metadata
|
|
273
|
+
*/
|
|
274
|
+
export function createFileStatTool() {
|
|
275
|
+
return {
|
|
276
|
+
definition: {
|
|
277
|
+
name: 'file_stat',
|
|
278
|
+
capabilities: ['fs-read'],
|
|
279
|
+
description: 'Get file or directory metadata (type, size, mtime). Returns exists=false when missing. Cross-platform.',
|
|
280
|
+
parameters: {
|
|
281
|
+
path: {
|
|
282
|
+
type: 'string',
|
|
283
|
+
description: 'Path to stat',
|
|
284
|
+
required: true,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
handler: async (args, context) => {
|
|
289
|
+
const { stat, realpath } = await import('node:fs/promises');
|
|
290
|
+
const path = resolveSafePath(args.path, context, 'stat');
|
|
291
|
+
try {
|
|
292
|
+
const st = await stat(path);
|
|
293
|
+
const resolved = await realpath(path).catch(() => path);
|
|
294
|
+
return {
|
|
295
|
+
path,
|
|
296
|
+
realpath: resolved,
|
|
297
|
+
exists: true,
|
|
298
|
+
kind: st.isDirectory() ? 'directory' : st.isFile() ? 'file' : 'other',
|
|
299
|
+
size: st.size,
|
|
300
|
+
mtimeMs: st.mtimeMs,
|
|
301
|
+
ctimeMs: st.ctimeMs,
|
|
302
|
+
mode: st.mode,
|
|
303
|
+
readOnly: (st.mode & 0o200) === 0,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return { path, exists: false };
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* file_rmdir — remove an empty directory
|
|
314
|
+
*/
|
|
315
|
+
export function createFileRmdirTool() {
|
|
316
|
+
return {
|
|
317
|
+
definition: {
|
|
318
|
+
name: 'file_rmdir',
|
|
319
|
+
capabilities: ['fs-write'],
|
|
320
|
+
description: 'Remove an empty directory. Refuses non-empty directories (delete files first or use file_delete). Cross-platform.',
|
|
321
|
+
parameters: {
|
|
322
|
+
path: {
|
|
323
|
+
type: 'string',
|
|
324
|
+
description: 'Directory path to remove (must be empty)',
|
|
325
|
+
required: true,
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
// fs 写工具:所在 tool_call 批次整体串行
|
|
330
|
+
executionMode: 'sequential',
|
|
331
|
+
handler: async (args, context) => {
|
|
332
|
+
const { rmdir, readdir, stat } = await import('node:fs/promises');
|
|
333
|
+
const path = resolveSafePath(args.path, context, 'rmdir');
|
|
334
|
+
let st;
|
|
335
|
+
try {
|
|
336
|
+
st = await stat(path);
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
throw new Error(`Directory not found: ${path}`);
|
|
340
|
+
}
|
|
341
|
+
if (!st.isDirectory()) {
|
|
342
|
+
throw new Error(`Not a directory: ${path}`);
|
|
343
|
+
}
|
|
344
|
+
const entries = await readdir(path);
|
|
345
|
+
if (entries.length > 0) {
|
|
346
|
+
throw new Error(`Directory not empty (${entries.length} entries): ${path}. Remove contents first (file_delete / file_rmdir).`);
|
|
347
|
+
}
|
|
348
|
+
await gateEffect({
|
|
349
|
+
kind: 'file.write',
|
|
350
|
+
path,
|
|
351
|
+
mode: 'overwrite',
|
|
352
|
+
transactional: isPathUnderRoots(path, context?.pathRoots ?? []),
|
|
353
|
+
}, {
|
|
354
|
+
effects: context?.effectChannel ?? 'engine',
|
|
355
|
+
confirmEffect: context?.confirmEffect,
|
|
356
|
+
});
|
|
357
|
+
try {
|
|
358
|
+
await rmdir(path);
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
throw new Error(`Failed to remove directory "${path}": ${error instanceof Error ? error.message : String(error)}`);
|
|
362
|
+
}
|
|
363
|
+
return { path, removed: true, reversible: false, note: 'empty directory remove is not journaled' };
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
/** File/folder operation tools (built-in, zero deps) */
|
|
368
|
+
export function createFileOpsTools() {
|
|
369
|
+
return [
|
|
370
|
+
createFileMkdirTool(),
|
|
371
|
+
createFileRenameTool(),
|
|
372
|
+
createFileCopyTool(),
|
|
373
|
+
createFileStatTool(),
|
|
374
|
+
createFileRmdirTool(),
|
|
375
|
+
];
|
|
376
|
+
}
|
|
@@ -6,18 +6,28 @@
|
|
|
6
6
|
*
|
|
7
7
|
* 特性:
|
|
8
8
|
* - pattern_mode: auto(默认)/ literal / regex;`patterns[]` 多词任一命中
|
|
9
|
-
* - auto 仅认强信号(锚点/转义类/`.*`/`{n}
|
|
9
|
+
* - auto 仅认强信号(锚点/转义类/`.*`/`{n}`),代码字面量保持 literal
|
|
10
|
+
* - auto 下 `a|b` 恒为「分支字面 OR」:分支 trim + 转义后以 `|` 连接(`.` 是字面点,非通配);
|
|
11
|
+
* 任一分支为空(`foo|`、`|`)则整词按字面搜;要搜含竖线的字面文本用 pattern_mode=literal
|
|
12
|
+
* - 二进制嗅探:文件头 4KB 含 NUL 判为二进制跳过(无扩展名二进制如 .DS_Store 不漏入结果)
|
|
13
|
+
* - 结果含 matchedFiles 聚合(每文件命中数)与 diagnostics.root(实际搜索根,便于发现 path 传错)
|
|
10
14
|
* - 路径感知 glob(支持 `**` / `*` / `?` / `{a,b}`,匹配 root 相对路径;`\` 转义)
|
|
11
15
|
* - 逐行流式扫描;`max_file_bytes` 安全阀(默认 50MB)跳过异常巨文件
|
|
12
16
|
* - 上下文行(before/after)
|
|
13
17
|
* - 结果数量限制
|
|
18
|
+
* - L1 输出硬顶(F1-B1):结构化收缩、零 LLM,file+line 清单永远全保;
|
|
19
|
+
* 预算经 `summary.tools.file_search.maxReturnChars` 可调(缺省 8000)
|
|
14
20
|
* - 忽略常见无关目录(node_modules, .git 等)
|
|
15
21
|
* - 零结果时返回 diagnostics + hints,便于调用方自纠
|
|
16
22
|
*/
|
|
17
23
|
import type { RegisteredTool } from '@octopi-agent/core/types.js';
|
|
24
|
+
import { type ToolSummarySupport } from '../../../context/capabilities/summary/index.js';
|
|
18
25
|
/**
|
|
19
26
|
* 创建 file_search 工具
|
|
20
27
|
*
|
|
28
|
+
* @param options - 可选 summary support(L1 预算 binding;file_search 恒不跑 L2)
|
|
21
29
|
* @returns RegisteredTool
|
|
22
30
|
*/
|
|
23
|
-
export declare function createFileSearchTool(
|
|
31
|
+
export declare function createFileSearchTool(options?: {
|
|
32
|
+
summary?: ToolSummarySupport;
|
|
33
|
+
}): RegisteredTool;
|