@sema-ai/core 1.275.1
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 +5433 -0
- package/LICENSE +27 -0
- package/NOTICE.md +30 -0
- package/README.md +1040 -0
- package/dist/agents/agent-definition.d.ts +10 -0
- package/dist/agents/agent-definition.d.ts.map +1 -0
- package/dist/agents/agent-definition.js +18 -0
- package/dist/agents/agent-definition.js.map +1 -0
- package/dist/agents/builtin-agents.d.ts +69 -0
- package/dist/agents/builtin-agents.d.ts.map +1 -0
- package/dist/agents/builtin-agents.js +177 -0
- package/dist/agents/builtin-agents.js.map +1 -0
- package/dist/agents/cascade.d.ts +101 -0
- package/dist/agents/cascade.d.ts.map +1 -0
- package/dist/agents/cascade.js +189 -0
- package/dist/agents/cascade.js.map +1 -0
- package/dist/agents/observer.d.ts +209 -0
- package/dist/agents/observer.d.ts.map +1 -0
- package/dist/agents/observer.js +495 -0
- package/dist/agents/observer.js.map +1 -0
- package/dist/agents/repair-loop.d.ts +236 -0
- package/dist/agents/repair-loop.d.ts.map +1 -0
- package/dist/agents/repair-loop.js +293 -0
- package/dist/agents/repair-loop.js.map +1 -0
- package/dist/agents/session-util.d.ts +8 -0
- package/dist/agents/session-util.d.ts.map +1 -0
- package/dist/agents/session-util.js +9 -0
- package/dist/agents/session-util.js.map +1 -0
- package/dist/agents/subagent-steps.d.ts +93 -0
- package/dist/agents/subagent-steps.d.ts.map +1 -0
- package/dist/agents/subagent-steps.js +206 -0
- package/dist/agents/subagent-steps.js.map +1 -0
- package/dist/agents/subagent.d.ts +441 -0
- package/dist/agents/subagent.d.ts.map +1 -0
- package/dist/agents/subagent.js +2492 -0
- package/dist/agents/subagent.js.map +1 -0
- package/dist/agents/suspend-guard.d.ts +35 -0
- package/dist/agents/suspend-guard.d.ts.map +1 -0
- package/dist/agents/suspend-guard.js +48 -0
- package/dist/agents/suspend-guard.js.map +1 -0
- package/dist/agents/teacher.d.ts +137 -0
- package/dist/agents/teacher.d.ts.map +1 -0
- package/dist/agents/teacher.js +575 -0
- package/dist/agents/teacher.js.map +1 -0
- package/dist/agents/team.d.ts +211 -0
- package/dist/agents/team.d.ts.map +1 -0
- package/dist/agents/team.js +293 -0
- package/dist/agents/team.js.map +1 -0
- package/dist/agents/tool-filter.d.ts +29 -0
- package/dist/agents/tool-filter.d.ts.map +1 -0
- package/dist/agents/tool-filter.js +50 -0
- package/dist/agents/tool-filter.js.map +1 -0
- package/dist/agents/verify.d.ts +177 -0
- package/dist/agents/verify.d.ts.map +1 -0
- package/dist/agents/verify.js +305 -0
- package/dist/agents/verify.js.map +1 -0
- package/dist/bench/metrics.d.ts +714 -0
- package/dist/bench/metrics.d.ts.map +1 -0
- package/dist/bench/metrics.js +618 -0
- package/dist/bench/metrics.js.map +1 -0
- package/dist/bin/sema-tb.d.ts +3 -0
- package/dist/bin/sema-tb.d.ts.map +1 -0
- package/dist/bin/sema-tb.js +516 -0
- package/dist/bin/sema-tb.js.map +1 -0
- package/dist/bin/tb-env.d.ts +13 -0
- package/dist/bin/tb-env.d.ts.map +1 -0
- package/dist/bin/tb-env.js +26 -0
- package/dist/bin/tb-env.js.map +1 -0
- package/dist/brain/anthropic.d.ts +46 -0
- package/dist/brain/anthropic.d.ts.map +1 -0
- package/dist/brain/anthropic.js +830 -0
- package/dist/brain/anthropic.js.map +1 -0
- package/dist/brain/circuit-breaker.d.ts +46 -0
- package/dist/brain/circuit-breaker.d.ts.map +1 -0
- package/dist/brain/circuit-breaker.js +173 -0
- package/dist/brain/circuit-breaker.js.map +1 -0
- package/dist/brain/degrading.d.ts +98 -0
- package/dist/brain/degrading.d.ts.map +1 -0
- package/dist/brain/degrading.js +249 -0
- package/dist/brain/degrading.js.map +1 -0
- package/dist/brain/errors.d.ts +31 -0
- package/dist/brain/errors.d.ts.map +1 -0
- package/dist/brain/errors.js +58 -0
- package/dist/brain/errors.js.map +1 -0
- package/dist/brain/failover.d.ts +18 -0
- package/dist/brain/failover.d.ts.map +1 -0
- package/dist/brain/failover.js +118 -0
- package/dist/brain/failover.js.map +1 -0
- package/dist/brain/model-presets.d.ts +36 -0
- package/dist/brain/model-presets.d.ts.map +1 -0
- package/dist/brain/model-presets.js +54 -0
- package/dist/brain/model-presets.js.map +1 -0
- package/dist/brain/openai.d.ts +43 -0
- package/dist/brain/openai.d.ts.map +1 -0
- package/dist/brain/openai.js +784 -0
- package/dist/brain/openai.js.map +1 -0
- package/dist/brain/reasoning.d.ts +138 -0
- package/dist/brain/reasoning.d.ts.map +1 -0
- package/dist/brain/reasoning.js +146 -0
- package/dist/brain/reasoning.js.map +1 -0
- package/dist/brain/repetition.d.ts +60 -0
- package/dist/brain/repetition.d.ts.map +1 -0
- package/dist/brain/repetition.js +121 -0
- package/dist/brain/repetition.js.map +1 -0
- package/dist/brain/request-params.d.ts +29 -0
- package/dist/brain/request-params.d.ts.map +1 -0
- package/dist/brain/request-params.js +78 -0
- package/dist/brain/request-params.js.map +1 -0
- package/dist/brain/retry.d.ts +18 -0
- package/dist/brain/retry.d.ts.map +1 -0
- package/dist/brain/retry.js +42 -0
- package/dist/brain/retry.js.map +1 -0
- package/dist/brain/routing.d.ts +19 -0
- package/dist/brain/routing.d.ts.map +1 -0
- package/dist/brain/routing.js +44 -0
- package/dist/brain/routing.js.map +1 -0
- package/dist/brain/status-sink.d.ts +46 -0
- package/dist/brain/status-sink.d.ts.map +1 -0
- package/dist/brain/status-sink.js +36 -0
- package/dist/brain/status-sink.js.map +1 -0
- package/dist/brain/stream-engine.d.ts +85 -0
- package/dist/brain/stream-engine.d.ts.map +1 -0
- package/dist/brain/stream-engine.js +391 -0
- package/dist/brain/stream-engine.js.map +1 -0
- package/dist/brain/timeout.d.ts +44 -0
- package/dist/brain/timeout.d.ts.map +1 -0
- package/dist/brain/timeout.js +41 -0
- package/dist/brain/timeout.js.map +1 -0
- package/dist/brain/tool-call-repair.d.ts +15 -0
- package/dist/brain/tool-call-repair.d.ts.map +1 -0
- package/dist/brain/tool-call-repair.js +67 -0
- package/dist/brain/tool-call-repair.js.map +1 -0
- package/dist/brain/walltime.d.ts +14 -0
- package/dist/brain/walltime.d.ts.map +1 -0
- package/dist/brain/walltime.js +14 -0
- package/dist/brain/walltime.js.map +1 -0
- package/dist/core/arg-summary.d.ts +19 -0
- package/dist/core/arg-summary.d.ts.map +1 -0
- package/dist/core/arg-summary.js +96 -0
- package/dist/core/arg-summary.js.map +1 -0
- package/dist/core/ask-question.d.ts +113 -0
- package/dist/core/ask-question.d.ts.map +1 -0
- package/dist/core/ask-question.js +246 -0
- package/dist/core/ask-question.js.map +1 -0
- package/dist/core/auto-compaction.d.ts +341 -0
- package/dist/core/auto-compaction.d.ts.map +1 -0
- package/dist/core/auto-compaction.js +495 -0
- package/dist/core/auto-compaction.js.map +1 -0
- package/dist/core/auto-promote.d.ts +126 -0
- package/dist/core/auto-promote.d.ts.map +1 -0
- package/dist/core/auto-promote.js +171 -0
- package/dist/core/auto-promote.js.map +1 -0
- package/dist/core/background-shell.d.ts +128 -0
- package/dist/core/background-shell.d.ts.map +1 -0
- package/dist/core/background-shell.js +42 -0
- package/dist/core/background-shell.js.map +1 -0
- package/dist/core/cache-break-detector.d.ts +63 -0
- package/dist/core/cache-break-detector.d.ts.map +1 -0
- package/dist/core/cache-break-detector.js +0 -0
- package/dist/core/cache-break-detector.js.map +1 -0
- package/dist/core/canonical-json.d.ts +45 -0
- package/dist/core/canonical-json.d.ts.map +1 -0
- package/dist/core/canonical-json.js +132 -0
- package/dist/core/canonical-json.js.map +1 -0
- package/dist/core/checkpoint-store.d.ts +1101 -0
- package/dist/core/checkpoint-store.d.ts.map +1 -0
- package/dist/core/checkpoint-store.js +514 -0
- package/dist/core/checkpoint-store.js.map +1 -0
- package/dist/core/consolidate-scope.d.ts +94 -0
- package/dist/core/consolidate-scope.d.ts.map +1 -0
- package/dist/core/consolidate-scope.js +158 -0
- package/dist/core/consolidate-scope.js.map +1 -0
- package/dist/core/context-edit.d.ts +82 -0
- package/dist/core/context-edit.d.ts.map +1 -0
- package/dist/core/context-edit.js +149 -0
- package/dist/core/context-edit.js.map +1 -0
- package/dist/core/context-guard.d.ts +43 -0
- package/dist/core/context-guard.d.ts.map +1 -0
- package/dist/core/context-guard.js +171 -0
- package/dist/core/context-guard.js.map +1 -0
- package/dist/core/dynamic-recall.d.ts +100 -0
- package/dist/core/dynamic-recall.d.ts.map +1 -0
- package/dist/core/dynamic-recall.js +108 -0
- package/dist/core/dynamic-recall.js.map +1 -0
- package/dist/core/exec-gate.d.ts +74 -0
- package/dist/core/exec-gate.d.ts.map +1 -0
- package/dist/core/exec-gate.js +143 -0
- package/dist/core/exec-gate.js.map +1 -0
- package/dist/core/exec-output-tail.d.ts +37 -0
- package/dist/core/exec-output-tail.d.ts.map +1 -0
- package/dist/core/exec-output-tail.js +63 -0
- package/dist/core/exec-output-tail.js.map +1 -0
- package/dist/core/file-snapshot-store.d.ts +137 -0
- package/dist/core/file-snapshot-store.d.ts.map +1 -0
- package/dist/core/file-snapshot-store.js +319 -0
- package/dist/core/file-snapshot-store.js.map +1 -0
- package/dist/core/git-worktree-env.d.ts +41 -0
- package/dist/core/git-worktree-env.d.ts.map +1 -0
- package/dist/core/git-worktree-env.js +64 -0
- package/dist/core/git-worktree-env.js.map +1 -0
- package/dist/core/hooks.d.ts +372 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +269 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/lsp-diagnostics.d.ts +74 -0
- package/dist/core/lsp-diagnostics.d.ts.map +1 -0
- package/dist/core/lsp-diagnostics.js +125 -0
- package/dist/core/lsp-diagnostics.js.map +1 -0
- package/dist/core/lsp-protocol.d.ts +28 -0
- package/dist/core/lsp-protocol.d.ts.map +1 -0
- package/dist/core/lsp-protocol.js +179 -0
- package/dist/core/lsp-protocol.js.map +1 -0
- package/dist/core/lsp-session.d.ts +56 -0
- package/dist/core/lsp-session.d.ts.map +1 -0
- package/dist/core/lsp-session.js +185 -0
- package/dist/core/lsp-session.js.map +1 -0
- package/dist/core/lsp.d.ts +132 -0
- package/dist/core/lsp.d.ts.map +1 -0
- package/dist/core/lsp.js +147 -0
- package/dist/core/lsp.js.map +1 -0
- package/dist/core/mcp.d.ts +294 -0
- package/dist/core/mcp.d.ts.map +1 -0
- package/dist/core/mcp.js +992 -0
- package/dist/core/mcp.js.map +1 -0
- package/dist/core/media-byte-cap.d.ts +34 -0
- package/dist/core/media-byte-cap.d.ts.map +1 -0
- package/dist/core/media-byte-cap.js +76 -0
- package/dist/core/media-byte-cap.js.map +1 -0
- package/dist/core/memory-engine/data-plane.d.ts +103 -0
- package/dist/core/memory-engine/data-plane.d.ts.map +1 -0
- package/dist/core/memory-engine/data-plane.js +272 -0
- package/dist/core/memory-engine/data-plane.js.map +1 -0
- package/dist/core/memory-engine/dual-root.d.ts +40 -0
- package/dist/core/memory-engine/dual-root.d.ts.map +1 -0
- package/dist/core/memory-engine/dual-root.js +95 -0
- package/dist/core/memory-engine/dual-root.js.map +1 -0
- package/dist/core/memory-engine/engine.d.ts +161 -0
- package/dist/core/memory-engine/engine.d.ts.map +1 -0
- package/dist/core/memory-engine/engine.js +1110 -0
- package/dist/core/memory-engine/engine.js.map +1 -0
- package/dist/core/memory-engine/file-backend.d.ts +162 -0
- package/dist/core/memory-engine/file-backend.d.ts.map +1 -0
- package/dist/core/memory-engine/file-backend.js +948 -0
- package/dist/core/memory-engine/file-backend.js.map +1 -0
- package/dist/core/memory-engine/frontmatter.d.ts +24 -0
- package/dist/core/memory-engine/frontmatter.d.ts.map +1 -0
- package/dist/core/memory-engine/frontmatter.js +135 -0
- package/dist/core/memory-engine/frontmatter.js.map +1 -0
- package/dist/core/memory-engine/index.d.ts +13 -0
- package/dist/core/memory-engine/index.d.ts.map +1 -0
- package/dist/core/memory-engine/index.js +28 -0
- package/dist/core/memory-engine/index.js.map +1 -0
- package/dist/core/memory-engine/layout.d.ts +123 -0
- package/dist/core/memory-engine/layout.d.ts.map +1 -0
- package/dist/core/memory-engine/layout.js +643 -0
- package/dist/core/memory-engine/layout.js.map +1 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts +22 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts.map +1 -0
- package/dist/core/memory-engine/memory-backend-contract.js +271 -0
- package/dist/core/memory-engine/memory-backend-contract.js.map +1 -0
- package/dist/core/memory-engine/migrate.d.ts +17 -0
- package/dist/core/memory-engine/migrate.d.ts.map +1 -0
- package/dist/core/memory-engine/migrate.js +35 -0
- package/dist/core/memory-engine/migrate.js.map +1 -0
- package/dist/core/memory-engine/scan.d.ts +20 -0
- package/dist/core/memory-engine/scan.d.ts.map +1 -0
- package/dist/core/memory-engine/scan.js +84 -0
- package/dist/core/memory-engine/scan.js.map +1 -0
- package/dist/core/memory-engine/scope-contract.d.ts +104 -0
- package/dist/core/memory-engine/scope-contract.d.ts.map +1 -0
- package/dist/core/memory-engine/scope-contract.js +288 -0
- package/dist/core/memory-engine/scope-contract.js.map +1 -0
- package/dist/core/memory-engine/sync-client.d.ts +100 -0
- package/dist/core/memory-engine/sync-client.d.ts.map +1 -0
- package/dist/core/memory-engine/sync-client.js +328 -0
- package/dist/core/memory-engine/sync-client.js.map +1 -0
- package/dist/core/memory-engine/sync.d.ts +97 -0
- package/dist/core/memory-engine/sync.d.ts.map +1 -0
- package/dist/core/memory-engine/sync.js +91 -0
- package/dist/core/memory-engine/sync.js.map +1 -0
- package/dist/core/memory-engine/types.d.ts +279 -0
- package/dist/core/memory-engine/types.d.ts.map +1 -0
- package/dist/core/memory-engine/types.js +9 -0
- package/dist/core/memory-engine/types.js.map +1 -0
- package/dist/core/memory-recall.d.ts +261 -0
- package/dist/core/memory-recall.d.ts.map +1 -0
- package/dist/core/memory-recall.js +600 -0
- package/dist/core/memory-recall.js.map +1 -0
- package/dist/core/memory-vector.d.ts +24 -0
- package/dist/core/memory-vector.d.ts.map +1 -0
- package/dist/core/memory-vector.js +51 -0
- package/dist/core/memory-vector.js.map +1 -0
- package/dist/core/memory.d.ts +502 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +881 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/message-utils.d.ts +7 -0
- package/dist/core/message-utils.d.ts.map +1 -0
- package/dist/core/message-utils.js +10 -0
- package/dist/core/message-utils.js.map +1 -0
- package/dist/core/oracle-isolation.d.ts +85 -0
- package/dist/core/oracle-isolation.d.ts.map +1 -0
- package/dist/core/oracle-isolation.js +121 -0
- package/dist/core/oracle-isolation.js.map +1 -0
- package/dist/core/permission-rules.d.ts +102 -0
- package/dist/core/permission-rules.d.ts.map +1 -0
- package/dist/core/permission-rules.js +357 -0
- package/dist/core/permission-rules.js.map +1 -0
- package/dist/core/present-plan-tool.d.ts +28 -0
- package/dist/core/present-plan-tool.d.ts.map +1 -0
- package/dist/core/present-plan-tool.js +119 -0
- package/dist/core/present-plan-tool.js.map +1 -0
- package/dist/core/pricing.d.ts +48 -0
- package/dist/core/pricing.d.ts.map +1 -0
- package/dist/core/pricing.js +46 -0
- package/dist/core/pricing.js.map +1 -0
- package/dist/core/property-harness.d.ts +126 -0
- package/dist/core/property-harness.d.ts.map +1 -0
- package/dist/core/property-harness.js +192 -0
- package/dist/core/property-harness.js.map +1 -0
- package/dist/core/push-queue.d.ts +10 -0
- package/dist/core/push-queue.d.ts.map +1 -0
- package/dist/core/push-queue.js +42 -0
- package/dist/core/push-queue.js.map +1 -0
- package/dist/core/remote-env.d.ts +432 -0
- package/dist/core/remote-env.d.ts.map +1 -0
- package/dist/core/remote-env.js +77 -0
- package/dist/core/remote-env.js.map +1 -0
- package/dist/core/roles.d.ts +74 -0
- package/dist/core/roles.d.ts.map +1 -0
- package/dist/core/roles.js +272 -0
- package/dist/core/roles.js.map +1 -0
- package/dist/core/runner/active-skill-scope.d.ts +64 -0
- package/dist/core/runner/active-skill-scope.d.ts.map +1 -0
- package/dist/core/runner/active-skill-scope.js +197 -0
- package/dist/core/runner/active-skill-scope.js.map +1 -0
- package/dist/core/runner/assemble-result.d.ts +191 -0
- package/dist/core/runner/assemble-result.d.ts.map +1 -0
- package/dist/core/runner/assemble-result.js +250 -0
- package/dist/core/runner/assemble-result.js.map +1 -0
- package/dist/core/runner/call-cap.d.ts +130 -0
- package/dist/core/runner/call-cap.d.ts.map +1 -0
- package/dist/core/runner/call-cap.js +151 -0
- package/dist/core/runner/call-cap.js.map +1 -0
- package/dist/core/runner/grounding-signal.d.ts +12 -0
- package/dist/core/runner/grounding-signal.d.ts.map +1 -0
- package/dist/core/runner/grounding-signal.js +94 -0
- package/dist/core/runner/grounding-signal.js.map +1 -0
- package/dist/core/runner/image.d.ts +23 -0
- package/dist/core/runner/image.d.ts.map +1 -0
- package/dist/core/runner/image.js +151 -0
- package/dist/core/runner/image.js.map +1 -0
- package/dist/core/runner/memory-consolidation.d.ts +112 -0
- package/dist/core/runner/memory-consolidation.d.ts.map +1 -0
- package/dist/core/runner/memory-consolidation.js +372 -0
- package/dist/core/runner/memory-consolidation.js.map +1 -0
- package/dist/core/runner/prepare-task.d.ts +583 -0
- package/dist/core/runner/prepare-task.d.ts.map +1 -0
- package/dist/core/runner/prepare-task.js +3612 -0
- package/dist/core/runner/prepare-task.js.map +1 -0
- package/dist/core/runner/prompt-suggestions.d.ts +33 -0
- package/dist/core/runner/prompt-suggestions.d.ts.map +1 -0
- package/dist/core/runner/prompt-suggestions.js +116 -0
- package/dist/core/runner/prompt-suggestions.js.map +1 -0
- package/dist/core/runner/runtask.d.ts +274 -0
- package/dist/core/runner/runtask.d.ts.map +1 -0
- package/dist/core/runner/runtask.js +4606 -0
- package/dist/core/runner/runtask.js.map +1 -0
- package/dist/core/runner/session-rule-policy.d.ts +28 -0
- package/dist/core/runner/session-rule-policy.d.ts.map +1 -0
- package/dist/core/runner/session-rule-policy.js +110 -0
- package/dist/core/runner/session-rule-policy.js.map +1 -0
- package/dist/core/runner/strict-output-schema.d.ts +36 -0
- package/dist/core/runner/strict-output-schema.d.ts.map +1 -0
- package/dist/core/runner/strict-output-schema.js +365 -0
- package/dist/core/runner/strict-output-schema.js.map +1 -0
- package/dist/core/runner/synthetic-tools.d.ts +72 -0
- package/dist/core/runner/synthetic-tools.d.ts.map +1 -0
- package/dist/core/runner/synthetic-tools.js +203 -0
- package/dist/core/runner/synthetic-tools.js.map +1 -0
- package/dist/core/runner/tool-disclosure.d.ts +117 -0
- package/dist/core/runner/tool-disclosure.d.ts.map +1 -0
- package/dist/core/runner/tool-disclosure.js +0 -0
- package/dist/core/runner/tool-disclosure.js.map +1 -0
- package/dist/core/runner/turn-attachments.d.ts +381 -0
- package/dist/core/runner/turn-attachments.d.ts.map +1 -0
- package/dist/core/runner/turn-attachments.js +596 -0
- package/dist/core/runner/turn-attachments.js.map +1 -0
- package/dist/core/runner/usage-accounting.d.ts +35 -0
- package/dist/core/runner/usage-accounting.d.ts.map +1 -0
- package/dist/core/runner/usage-accounting.js +45 -0
- package/dist/core/runner/usage-accounting.js.map +1 -0
- package/dist/core/runtime.d.ts +9 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js +17 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/core/safety-axis-vocab.d.ts +33 -0
- package/dist/core/safety-axis-vocab.d.ts.map +1 -0
- package/dist/core/safety-axis-vocab.js +35 -0
- package/dist/core/safety-axis-vocab.js.map +1 -0
- package/dist/core/safety-merge-corpus.d.ts +48 -0
- package/dist/core/safety-merge-corpus.d.ts.map +1 -0
- package/dist/core/safety-merge-corpus.js +203 -0
- package/dist/core/safety-merge-corpus.js.map +1 -0
- package/dist/core/scheduler.d.ts +126 -0
- package/dist/core/scheduler.d.ts.map +1 -0
- package/dist/core/scheduler.js +54 -0
- package/dist/core/scheduler.js.map +1 -0
- package/dist/core/secret-env.d.ts +23 -0
- package/dist/core/secret-env.d.ts.map +1 -0
- package/dist/core/secret-env.js +35 -0
- package/dist/core/secret-env.js.map +1 -0
- package/dist/core/select-model.d.ts +26 -0
- package/dist/core/select-model.d.ts.map +1 -0
- package/dist/core/select-model.js +58 -0
- package/dist/core/select-model.js.map +1 -0
- package/dist/core/sensitive-path-policy.d.ts +24 -0
- package/dist/core/sensitive-path-policy.d.ts.map +1 -0
- package/dist/core/sensitive-path-policy.js +96 -0
- package/dist/core/sensitive-path-policy.js.map +1 -0
- package/dist/core/session-policy-store.d.ts +102 -0
- package/dist/core/session-policy-store.d.ts.map +1 -0
- package/dist/core/session-policy-store.js +177 -0
- package/dist/core/session-policy-store.js.map +1 -0
- package/dist/core/session-reconcile.d.ts +63 -0
- package/dist/core/session-reconcile.d.ts.map +1 -0
- package/dist/core/session-reconcile.js +71 -0
- package/dist/core/session-reconcile.js.map +1 -0
- package/dist/core/session-store.d.ts +99 -0
- package/dist/core/session-store.d.ts.map +1 -0
- package/dist/core/session-store.js +298 -0
- package/dist/core/session-store.js.map +1 -0
- package/dist/core/session.d.ts +144 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +56 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/spec-contract.d.ts +147 -0
- package/dist/core/spec-contract.d.ts.map +1 -0
- package/dist/core/spec-contract.js +340 -0
- package/dist/core/spec-contract.js.map +1 -0
- package/dist/core/strategy-store.d.ts +50 -0
- package/dist/core/strategy-store.d.ts.map +1 -0
- package/dist/core/strategy-store.js +100 -0
- package/dist/core/strategy-store.js.map +1 -0
- package/dist/core/stub-env.d.ts +35 -0
- package/dist/core/stub-env.d.ts.map +1 -0
- package/dist/core/stub-env.js +69 -0
- package/dist/core/stub-env.js.map +1 -0
- package/dist/core/task-notification.d.ts +115 -0
- package/dist/core/task-notification.d.ts.map +1 -0
- package/dist/core/task-notification.js +247 -0
- package/dist/core/task-notification.js.map +1 -0
- package/dist/core/task-outcome.d.ts +80 -0
- package/dist/core/task-outcome.d.ts.map +1 -0
- package/dist/core/task-outcome.js +40 -0
- package/dist/core/task-outcome.js.map +1 -0
- package/dist/core/task-registry.d.ts +349 -0
- package/dist/core/task-registry.d.ts.map +1 -0
- package/dist/core/task-registry.js +1751 -0
- package/dist/core/task-registry.js.map +1 -0
- package/dist/core/tighten-task-spec.d.ts +27 -0
- package/dist/core/tighten-task-spec.d.ts.map +1 -0
- package/dist/core/tighten-task-spec.js +95 -0
- package/dist/core/tighten-task-spec.js.map +1 -0
- package/dist/core/tool-detach.d.ts +31 -0
- package/dist/core/tool-detach.d.ts.map +1 -0
- package/dist/core/tool-detach.js +62 -0
- package/dist/core/tool-detach.js.map +1 -0
- package/dist/core/tool-errors.d.ts +72 -0
- package/dist/core/tool-errors.d.ts.map +1 -0
- package/dist/core/tool-errors.js +194 -0
- package/dist/core/tool-errors.js.map +1 -0
- package/dist/core/tool-name-aliases.d.ts +5 -0
- package/dist/core/tool-name-aliases.d.ts.map +1 -0
- package/dist/core/tool-name-aliases.js +130 -0
- package/dist/core/tool-name-aliases.js.map +1 -0
- package/dist/core/tool-policy.d.ts +295 -0
- package/dist/core/tool-policy.d.ts.map +1 -0
- package/dist/core/tool-policy.js +567 -0
- package/dist/core/tool-policy.js.map +1 -0
- package/dist/core/tool-result-budget.d.ts +44 -0
- package/dist/core/tool-result-budget.d.ts.map +1 -0
- package/dist/core/tool-result-budget.js +140 -0
- package/dist/core/tool-result-budget.js.map +1 -0
- package/dist/core/tool-result-store.d.ts +136 -0
- package/dist/core/tool-result-store.d.ts.map +1 -0
- package/dist/core/tool-result-store.js +219 -0
- package/dist/core/tool-result-store.js.map +1 -0
- package/dist/core/tools.d.ts +14 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +98 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/core/trace.d.ts +340 -0
- package/dist/core/trace.d.ts.map +1 -0
- package/dist/core/trace.js +12 -0
- package/dist/core/trace.js.map +1 -0
- package/dist/core/types.d.ts +2828 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/untrusted-egress.d.ts +32 -0
- package/dist/core/untrusted-egress.d.ts.map +1 -0
- package/dist/core/untrusted-egress.js +49 -0
- package/dist/core/untrusted-egress.js.map +1 -0
- package/dist/core/untrusted-text.d.ts +64 -0
- package/dist/core/untrusted-text.d.ts.map +1 -0
- package/dist/core/untrusted-text.js +119 -0
- package/dist/core/untrusted-text.js.map +1 -0
- package/dist/core/warm-resume.d.ts +23 -0
- package/dist/core/warm-resume.d.ts.map +1 -0
- package/dist/core/warm-resume.js +28 -0
- package/dist/core/warm-resume.js.map +1 -0
- package/dist/core/with-retry.d.ts +43 -0
- package/dist/core/with-retry.d.ts.map +1 -0
- package/dist/core/with-retry.js +59 -0
- package/dist/core/with-retry.js.map +1 -0
- package/dist/core/workflow-journal-store.d.ts +44 -0
- package/dist/core/workflow-journal-store.d.ts.map +1 -0
- package/dist/core/workflow-journal-store.js +47 -0
- package/dist/core/workflow-journal-store.js.map +1 -0
- package/dist/core/workflow-run-store-contract.d.ts +31 -0
- package/dist/core/workflow-run-store-contract.d.ts.map +1 -0
- package/dist/core/workflow-run-store-contract.js +191 -0
- package/dist/core/workflow-run-store-contract.js.map +1 -0
- package/dist/core/workflow-run-store.d.ts +149 -0
- package/dist/core/workflow-run-store.d.ts.map +1 -0
- package/dist/core/workflow-run-store.js +110 -0
- package/dist/core/workflow-run-store.js.map +1 -0
- package/dist/engine/compaction/compaction.d.ts +139 -0
- package/dist/engine/compaction/compaction.d.ts.map +1 -0
- package/dist/engine/compaction/compaction.js +1030 -0
- package/dist/engine/compaction/compaction.js.map +1 -0
- package/dist/engine/compaction/utils.d.ts +45 -0
- package/dist/engine/compaction/utils.d.ts.map +1 -0
- package/dist/engine/compaction/utils.js +203 -0
- package/dist/engine/compaction/utils.js.map +1 -0
- package/dist/engine/execution-env/kill-tree.d.ts +20 -0
- package/dist/engine/execution-env/kill-tree.d.ts.map +1 -0
- package/dist/engine/execution-env/kill-tree.js +183 -0
- package/dist/engine/execution-env/kill-tree.js.map +1 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +133 -0
- package/dist/engine/execution-env/node-execution-env.d.ts.map +1 -0
- package/dist/engine/execution-env/node-execution-env.js +1031 -0
- package/dist/engine/execution-env/node-execution-env.js.map +1 -0
- package/dist/engine/harness/agent-harness.d.ts +174 -0
- package/dist/engine/harness/agent-harness.d.ts.map +1 -0
- package/dist/engine/harness/agent-harness.js +1053 -0
- package/dist/engine/harness/agent-harness.js.map +1 -0
- package/dist/engine/harness/messages.d.ts +17 -0
- package/dist/engine/harness/messages.d.ts.map +1 -0
- package/dist/engine/harness/messages.js +122 -0
- package/dist/engine/harness/messages.js.map +1 -0
- package/dist/engine/harness/types.d.ts +713 -0
- package/dist/engine/harness/types.d.ts.map +1 -0
- package/dist/engine/harness/types.js +100 -0
- package/dist/engine/harness/types.js.map +1 -0
- package/dist/engine/llm/diagnostics.d.ts +23 -0
- package/dist/engine/llm/diagnostics.d.ts.map +1 -0
- package/dist/engine/llm/diagnostics.js +32 -0
- package/dist/engine/llm/diagnostics.js.map +1 -0
- package/dist/engine/llm/event-stream.d.ts +25 -0
- package/dist/engine/llm/event-stream.d.ts.map +1 -0
- package/dist/engine/llm/event-stream.js +103 -0
- package/dist/engine/llm/event-stream.js.map +1 -0
- package/dist/engine/llm/index.d.ts +12 -0
- package/dist/engine/llm/index.d.ts.map +1 -0
- package/dist/engine/llm/index.js +12 -0
- package/dist/engine/llm/index.js.map +1 -0
- package/dist/engine/llm/types.d.ts +753 -0
- package/dist/engine/llm/types.d.ts.map +1 -0
- package/dist/engine/llm/types.js +2 -0
- package/dist/engine/llm/types.js.map +1 -0
- package/dist/engine/llm/validation.d.ts +8 -0
- package/dist/engine/llm/validation.d.ts.map +1 -0
- package/dist/engine/llm/validation.js +318 -0
- package/dist/engine/llm/validation.js.map +1 -0
- package/dist/engine/loop/agent-loop.d.ts +74 -0
- package/dist/engine/loop/agent-loop.d.ts.map +1 -0
- package/dist/engine/loop/agent-loop.js +1490 -0
- package/dist/engine/loop/agent-loop.js.map +1 -0
- package/dist/engine/loop/runtime-deps.d.ts +17 -0
- package/dist/engine/loop/runtime-deps.d.ts.map +1 -0
- package/dist/engine/loop/runtime-deps.js +21 -0
- package/dist/engine/loop/runtime-deps.js.map +1 -0
- package/dist/engine/loop/types.d.ts +609 -0
- package/dist/engine/loop/types.d.ts.map +1 -0
- package/dist/engine/loop/types.js +2 -0
- package/dist/engine/loop/types.js.map +1 -0
- package/dist/engine/lsp/frame-decoder.d.ts +16 -0
- package/dist/engine/lsp/frame-decoder.d.ts.map +1 -0
- package/dist/engine/lsp/frame-decoder.js +53 -0
- package/dist/engine/lsp/frame-decoder.js.map +1 -0
- package/dist/engine/lsp/node-lsp-manager.d.ts +105 -0
- package/dist/engine/lsp/node-lsp-manager.d.ts.map +1 -0
- package/dist/engine/lsp/node-lsp-manager.js +343 -0
- package/dist/engine/lsp/node-lsp-manager.js.map +1 -0
- package/dist/engine/lsp/stdio-lsp-transport.d.ts +37 -0
- package/dist/engine/lsp/stdio-lsp-transport.d.ts.map +1 -0
- package/dist/engine/lsp/stdio-lsp-transport.js +185 -0
- package/dist/engine/lsp/stdio-lsp-transport.js.map +1 -0
- package/dist/engine/session/import-validate.d.ts +44 -0
- package/dist/engine/session/import-validate.d.ts.map +1 -0
- package/dist/engine/session/import-validate.js +92 -0
- package/dist/engine/session/import-validate.js.map +1 -0
- package/dist/engine/session/memory-repo.d.ts +25 -0
- package/dist/engine/session/memory-repo.d.ts.map +1 -0
- package/dist/engine/session/memory-repo.js +59 -0
- package/dist/engine/session/memory-repo.js.map +1 -0
- package/dist/engine/session/memory-storage.d.ts +14 -0
- package/dist/engine/session/memory-storage.d.ts.map +1 -0
- package/dist/engine/session/memory-storage.js +17 -0
- package/dist/engine/session/memory-storage.js.map +1 -0
- package/dist/engine/session/repo-utils.d.ts +11 -0
- package/dist/engine/session/repo-utils.d.ts.map +1 -0
- package/dist/engine/session/repo-utils.js +40 -0
- package/dist/engine/session/repo-utils.js.map +1 -0
- package/dist/engine/session/session.d.ts +34 -0
- package/dist/engine/session/session.d.ts.map +1 -0
- package/dist/engine/session/session.js +227 -0
- package/dist/engine/session/session.js.map +1 -0
- package/dist/engine/session/storage-base.d.ts +38 -0
- package/dist/engine/session/storage-base.d.ts.map +1 -0
- package/dist/engine/session/storage-base.js +157 -0
- package/dist/engine/session/storage-base.js.map +1 -0
- package/dist/engine/session/timestamps.d.ts +3 -0
- package/dist/engine/session/timestamps.d.ts.map +1 -0
- package/dist/engine/session/timestamps.js +15 -0
- package/dist/engine/session/timestamps.js.map +1 -0
- package/dist/engine/session/uuid.d.ts +2 -0
- package/dist/engine/session/uuid.d.ts.map +1 -0
- package/dist/engine/session/uuid.js +50 -0
- package/dist/engine/session/uuid.js.map +1 -0
- package/dist/index.d.ts +160 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +374 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/harness.d.ts +26 -0
- package/dist/internal/harness.d.ts.map +1 -0
- package/dist/internal/harness.js +24 -0
- package/dist/internal/harness.js.map +1 -0
- package/dist/internal/llm.d.ts +9 -0
- package/dist/internal/llm.d.ts.map +1 -0
- package/dist/internal/llm.js +8 -0
- package/dist/internal/llm.js.map +1 -0
- package/dist/orchestration/builtin-workflows.d.ts +44 -0
- package/dist/orchestration/builtin-workflows.d.ts.map +1 -0
- package/dist/orchestration/builtin-workflows.js +165 -0
- package/dist/orchestration/builtin-workflows.js.map +1 -0
- package/dist/orchestration/dev-vm-script-runner.d.ts +24 -0
- package/dist/orchestration/dev-vm-script-runner.d.ts.map +1 -0
- package/dist/orchestration/dev-vm-script-runner.js +106 -0
- package/dist/orchestration/dev-vm-script-runner.js.map +1 -0
- package/dist/orchestration/goal.d.ts +97 -0
- package/dist/orchestration/goal.d.ts.map +1 -0
- package/dist/orchestration/goal.js +248 -0
- package/dist/orchestration/goal.js.map +1 -0
- package/dist/orchestration/run-spec.d.ts +63 -0
- package/dist/orchestration/run-spec.d.ts.map +1 -0
- package/dist/orchestration/run-spec.js +274 -0
- package/dist/orchestration/run-spec.js.map +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +187 -0
- package/dist/orchestration/run-workflow-tool.d.ts.map +1 -0
- package/dist/orchestration/run-workflow-tool.js +612 -0
- package/dist/orchestration/run-workflow-tool.js.map +1 -0
- package/dist/orchestration/workflow-governance.d.ts +70 -0
- package/dist/orchestration/workflow-governance.d.ts.map +1 -0
- package/dist/orchestration/workflow-governance.js +176 -0
- package/dist/orchestration/workflow-governance.js.map +1 -0
- package/dist/orchestration/workflow-meta.d.ts +41 -0
- package/dist/orchestration/workflow-meta.d.ts.map +1 -0
- package/dist/orchestration/workflow-meta.js +426 -0
- package/dist/orchestration/workflow-meta.js.map +1 -0
- package/dist/orchestration/workflow-observe.d.ts +77 -0
- package/dist/orchestration/workflow-observe.d.ts.map +1 -0
- package/dist/orchestration/workflow-observe.js +177 -0
- package/dist/orchestration/workflow-observe.js.map +1 -0
- package/dist/orchestration/workflow-primitives.d.ts +31 -0
- package/dist/orchestration/workflow-primitives.d.ts.map +1 -0
- package/dist/orchestration/workflow-primitives.js +104 -0
- package/dist/orchestration/workflow-primitives.js.map +1 -0
- package/dist/orchestration/workflow-sandbox-conformance.d.ts +34 -0
- package/dist/orchestration/workflow-sandbox-conformance.d.ts.map +1 -0
- package/dist/orchestration/workflow-sandbox-conformance.js +301 -0
- package/dist/orchestration/workflow-sandbox-conformance.js.map +1 -0
- package/dist/orchestration/workflow-script-runner.d.ts +127 -0
- package/dist/orchestration/workflow-script-runner.d.ts.map +1 -0
- package/dist/orchestration/workflow-script-runner.js +48 -0
- package/dist/orchestration/workflow-script-runner.js.map +1 -0
- package/dist/orchestration/workflow-script-store.d.ts +99 -0
- package/dist/orchestration/workflow-script-store.d.ts.map +1 -0
- package/dist/orchestration/workflow-script-store.js +133 -0
- package/dist/orchestration/workflow-script-store.js.map +1 -0
- package/dist/orchestration/workflow-size-guideline.d.ts +50 -0
- package/dist/orchestration/workflow-size-guideline.d.ts.map +1 -0
- package/dist/orchestration/workflow-size-guideline.js +78 -0
- package/dist/orchestration/workflow-size-guideline.js.map +1 -0
- package/dist/orchestration/workflow.d.ts +624 -0
- package/dist/orchestration/workflow.d.ts.map +1 -0
- package/dist/orchestration/workflow.js +1596 -0
- package/dist/orchestration/workflow.js.map +1 -0
- package/dist/prompts/default.d.ts +474 -0
- package/dist/prompts/default.d.ts.map +1 -0
- package/dist/prompts/default.js +676 -0
- package/dist/prompts/default.js.map +1 -0
- package/dist/prompts/supervisor.d.ts +60 -0
- package/dist/prompts/supervisor.d.ts.map +1 -0
- package/dist/prompts/supervisor.js +162 -0
- package/dist/prompts/supervisor.js.map +1 -0
- package/dist/scenarios/env.d.ts +41 -0
- package/dist/scenarios/env.d.ts.map +1 -0
- package/dist/scenarios/env.js +65 -0
- package/dist/scenarios/env.js.map +1 -0
- package/dist/scenarios/full-body.d.ts +47 -0
- package/dist/scenarios/full-body.d.ts.map +1 -0
- package/dist/scenarios/full-body.js +36 -0
- package/dist/scenarios/full-body.js.map +1 -0
- package/dist/scenarios/scenario-registry.d.ts +107 -0
- package/dist/scenarios/scenario-registry.d.ts.map +1 -0
- package/dist/scenarios/scenario-registry.js +192 -0
- package/dist/scenarios/scenario-registry.js.map +1 -0
- package/dist/scenarios/teacher-quickstart.d.ts +41 -0
- package/dist/scenarios/teacher-quickstart.d.ts.map +1 -0
- package/dist/scenarios/teacher-quickstart.js +32 -0
- package/dist/scenarios/teacher-quickstart.js.map +1 -0
- package/dist/server/http.d.ts +36 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +144 -0
- package/dist/server/http.js.map +1 -0
- package/dist/stores/file/checkpoint-store.d.ts +62 -0
- package/dist/stores/file/checkpoint-store.d.ts.map +1 -0
- package/dist/stores/file/checkpoint-store.js +250 -0
- package/dist/stores/file/checkpoint-store.js.map +1 -0
- package/dist/stores/file/file-snapshot-store.d.ts +43 -0
- package/dist/stores/file/file-snapshot-store.d.ts.map +1 -0
- package/dist/stores/file/file-snapshot-store.js +374 -0
- package/dist/stores/file/file-snapshot-store.js.map +1 -0
- package/dist/stores/file/fs-atomic.d.ts +95 -0
- package/dist/stores/file/fs-atomic.d.ts.map +1 -0
- package/dist/stores/file/fs-atomic.js +415 -0
- package/dist/stores/file/fs-atomic.js.map +1 -0
- package/dist/stores/file/index.d.ts +98 -0
- package/dist/stores/file/index.d.ts.map +1 -0
- package/dist/stores/file/index.js +109 -0
- package/dist/stores/file/index.js.map +1 -0
- package/dist/stores/file/memory-store.d.ts +95 -0
- package/dist/stores/file/memory-store.d.ts.map +1 -0
- package/dist/stores/file/memory-store.js +393 -0
- package/dist/stores/file/memory-store.js.map +1 -0
- package/dist/stores/file/session-policy-store.d.ts +24 -0
- package/dist/stores/file/session-policy-store.d.ts.map +1 -0
- package/dist/stores/file/session-policy-store.js +123 -0
- package/dist/stores/file/session-policy-store.js.map +1 -0
- package/dist/stores/file/session-store.d.ts +34 -0
- package/dist/stores/file/session-store.d.ts.map +1 -0
- package/dist/stores/file/session-store.js +175 -0
- package/dist/stores/file/session-store.js.map +1 -0
- package/dist/stores/file/tool-result-store.d.ts +23 -0
- package/dist/stores/file/tool-result-store.d.ts.map +1 -0
- package/dist/stores/file/tool-result-store.js +61 -0
- package/dist/stores/file/tool-result-store.js.map +1 -0
- package/dist/stores/file/workflow-journal-store.d.ts +36 -0
- package/dist/stores/file/workflow-journal-store.d.ts.map +1 -0
- package/dist/stores/file/workflow-journal-store.js +157 -0
- package/dist/stores/file/workflow-journal-store.js.map +1 -0
- package/dist/stores/file/workflow-run-store.d.ts +58 -0
- package/dist/stores/file/workflow-run-store.d.ts.map +1 -0
- package/dist/stores/file/workflow-run-store.js +178 -0
- package/dist/stores/file/workflow-run-store.js.map +1 -0
- package/dist/stores/pg.d.ts +210 -0
- package/dist/stores/pg.d.ts.map +1 -0
- package/dist/stores/pg.js +652 -0
- package/dist/stores/pg.js.map +1 -0
- package/dist/tools/fs/encoding.d.ts +51 -0
- package/dist/tools/fs/encoding.d.ts.map +1 -0
- package/dist/tools/fs/encoding.js +74 -0
- package/dist/tools/fs/encoding.js.map +1 -0
- package/dist/tools/fs/gh-rate-limit.d.ts +19 -0
- package/dist/tools/fs/gh-rate-limit.d.ts.map +1 -0
- package/dist/tools/fs/gh-rate-limit.js +35 -0
- package/dist/tools/fs/gh-rate-limit.js.map +1 -0
- package/dist/tools/fs/index.d.ts +246 -0
- package/dist/tools/fs/index.d.ts.map +1 -0
- package/dist/tools/fs/index.js +2130 -0
- package/dist/tools/fs/index.js.map +1 -0
- package/dist/tools/fs/pdf.d.ts +106 -0
- package/dist/tools/fs/pdf.d.ts.map +1 -0
- package/dist/tools/fs/pdf.js +178 -0
- package/dist/tools/fs/pdf.js.map +1 -0
- package/dist/tools/fs/repo-map.d.ts +15 -0
- package/dist/tools/fs/repo-map.d.ts.map +1 -0
- package/dist/tools/fs/repo-map.js +251 -0
- package/dist/tools/fs/repo-map.js.map +1 -0
- package/dist/tools/fs/safety.d.ts +168 -0
- package/dist/tools/fs/safety.d.ts.map +1 -0
- package/dist/tools/fs/safety.js +479 -0
- package/dist/tools/fs/safety.js.map +1 -0
- package/dist/tools/fs/search.d.ts +118 -0
- package/dist/tools/fs/search.d.ts.map +1 -0
- package/dist/tools/fs/search.js +650 -0
- package/dist/tools/fs/search.js.map +1 -0
- package/dist/tools/gitea-issue.d.ts +39 -0
- package/dist/tools/gitea-issue.d.ts.map +1 -0
- package/dist/tools/gitea-issue.js +91 -0
- package/dist/tools/gitea-issue.js.map +1 -0
- package/dist/tools/monitor.d.ts +64 -0
- package/dist/tools/monitor.d.ts.map +1 -0
- package/dist/tools/monitor.js +135 -0
- package/dist/tools/monitor.js.map +1 -0
- package/dist/tools/scheduler-tools.d.ts +48 -0
- package/dist/tools/scheduler-tools.d.ts.map +1 -0
- package/dist/tools/scheduler-tools.js +449 -0
- package/dist/tools/scheduler-tools.js.map +1 -0
- package/dist/tools/sql-adapters.d.ts +32 -0
- package/dist/tools/sql-adapters.d.ts.map +1 -0
- package/dist/tools/sql-adapters.js +31 -0
- package/dist/tools/sql-adapters.js.map +1 -0
- package/dist/tools/sql.d.ts +36 -0
- package/dist/tools/sql.d.ts.map +1 -0
- package/dist/tools/sql.js +131 -0
- package/dist/tools/sql.js.map +1 -0
- package/dist/tools/task-list.d.ts +26 -0
- package/dist/tools/task-list.d.ts.map +1 -0
- package/dist/tools/task-list.js +352 -0
- package/dist/tools/task-list.js.map +1 -0
- package/dist/tools/todo.d.ts +11 -0
- package/dist/tools/todo.d.ts.map +1 -0
- package/dist/tools/todo.js +126 -0
- package/dist/tools/todo.js.map +1 -0
- package/dist/tools/web.d.ts +59 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +607 -0
- package/dist/tools/web.js.map +1 -0
- package/dist/tools/worktree.d.ts +88 -0
- package/dist/tools/worktree.d.ts.map +1 -0
- package/dist/tools/worktree.js +434 -0
- package/dist/tools/worktree.js.map +1 -0
- package/docs/A1-ATTRIBUTION-ROUND1-2026-07-09.md +181 -0
- package/docs/AB-ORACLE-GATE-VERDICT-2026-07-10.md +100 -0
- package/docs/ANCHOR-GAP-INVENTORY-2026-07-09.md +143 -0
- package/docs/ARCHITECTURE.md +125 -0
- package/docs/BUGHUNT-2026-07-05-NIGHT.md +98 -0
- package/docs/BUILD.md +63 -0
- package/docs/CANCEL-ASYNC-ATTRIBUTION-2026-07-09.md +98 -0
- package/docs/CC-198-VS-201-DRIFT-2026-07-09.md +70 -0
- package/docs/CC-BASELINE-FAKE-ZERO-AUDIT-2026-07-09.md +51 -0
- package/docs/CC-DRIFT-198-206-AGENT-TYPES-2026-07-10.md +82 -0
- package/docs/CC-DRIFT-198-206-CHANGELOG-2026-07-10.md +82 -0
- package/docs/CC-DRIFT-198-206-REMINDERS-2026-07-10.md +96 -0
- package/docs/CC-DRIFT-198-206-ROADMAP-2026-07-10.md +110 -0
- package/docs/CC-DRIFT-198-206-TOOL-INVENTORY-2026-07-10.md +53 -0
- package/docs/CC-DRIFT-198-206-USAGE-CONSTANTS-2026-07-10.md +64 -0
- package/docs/CC-DRIFT-198-206-WORKFLOW-2026-07-10.md +83 -0
- package/docs/CC-PARITY-CHECKLIST.md +220 -0
- package/docs/CC-PARITY-DEEP-SWEEP-2026-07-07.md +149 -0
- package/docs/CC-SUBAGENT-PROMPT-STUDY-2026-07-09.md +219 -0
- package/docs/CC-TASK-REMINDER-CADENCE-STUDY-2026-07-09.md +396 -0
- package/docs/CC-TOOL-PARITY-SWEEP-2026-07.md +56 -0
- package/docs/CC-TOOL-PROMPT-DEEP-DIFF-2026-07-08.md +274 -0
- package/docs/CC-TOOLSURFACE-DEEP-DIVE-2026-07-07.md +197 -0
- package/docs/CC206-OBSERVER-ANCHORS-2026-07-11.md +463 -0
- package/docs/CC207-CORE-SWEEP-BACKLOG-2026-07-12.md +155 -0
- package/docs/CENTER-CONTROL-PLANE-SEAM.md +86 -0
- package/docs/CLEANUP-CONTRACT-ANCHOR-2026-07-09.md +83 -0
- package/docs/COLD-START-RSI-2026-07-09.md +72 -0
- package/docs/COMPACTION-LIVE-AUDIT-2026-07-09.md +114 -0
- package/docs/CONTEXT-lifecycle-extension-points-and-stop-attribution.md +71 -0
- package/docs/COREWARS-POLYGLOT-TRIAGE-2026-07-09.md +85 -0
- package/docs/DEADTARGET-OVERFULL-HBOX-2026-07-10.md +92 -0
- package/docs/DEADTARGET-PATH-TRACING-REVERSE-2026-07-10.md +87 -0
- package/docs/DEADTARGET-WINNING-AVG-COREWARS-2026-07-10.md +96 -0
- package/docs/DEEPSEEK-API-LIMITS-PROBE-2026-07-09.md +118 -0
- package/docs/DESIGN-140-MOCK-VERIFY-2026-07-11.md +79 -0
- package/docs/DESIGN-140-VERIFICATION-2026-07-11.md +43 -0
- package/docs/DESIGN-DRAFT-workflow-collab-2026-07-11.md +56 -0
- package/docs/DESIGN-ORACLE-GROUNDING-GATE-2026-07-10.md +167 -0
- package/docs/DESIGN-TFRAG-RECONCILE-SCAFFOLD-2026-07-09.md +102 -0
- package/docs/EXP-PA2-PE-DESIGN-2026-07-11.md +220 -0
- package/docs/EXT-DOGFOOD-2026-07-12.md +50 -0
- package/docs/FINAL-VERIFY-SURFACE-AUDIT-2026-07-09.md +44 -0
- package/docs/FRAG-RECON-INVESTIGATION-2026-07-09.md +183 -0
- package/docs/HANDOFF.md +121 -0
- package/docs/KNOWN-ISSUES.md +96 -0
- package/docs/LEGW-WINDOW-TAX-2026-07-10.md +82 -0
- package/docs/LIVE-PROBE-BATCH-2026-07-11.md +207 -0
- package/docs/M2-CERT-ATTRIBUTION-2026-07-10.md +61 -0
- package/docs/M25-LEG-VARIANCE-ATTRIBUTION-2026-07-10.md +81 -0
- package/docs/MAILMAN-TIMEOUT-ATTRIBUTION-2026-07-10.md +88 -0
- package/docs/MEMORY-BACKEND-DIALECT-NOTES.md +69 -0
- package/docs/MTEB-ESCAPE-HATCH-ATTRIBUTION-2026-07-09.md +57 -0
- package/docs/MTEB-LEADERBOARD-ATTRIBUTION-2026-07-10.md +134 -0
- package/docs/ORACLE-GATE-NEGATIVE-SAMPLE-2026-07-11.md +28 -0
- package/docs/PARITY-CONTEXT-TRANSACTIONS-2026-07-10.md +67 -0
- package/docs/PARITY-PROGRESS-MATRIX-2026-07-10.md +37 -0
- package/docs/PARITY-SPOT-AGENT-TYPES-2026-07-10.md +70 -0
- package/docs/PARITY-SPOT-REMINDERS-2026-07-10.md +144 -0
- package/docs/PARITY-SPOT-TOOL-INVENTORY-2026-07-10.md +61 -0
- package/docs/PARITY-SPOT-USAGE-CONSTANTS-2026-07-10.md +95 -0
- package/docs/PARITY-SPOT-WORKFLOW-2026-07-10.md +93 -0
- package/docs/PASSWORD-RECOVERY-PANEL-VERDICT-2026-07-10.md +62 -0
- package/docs/R8-R9-FINALIZE-COORDINATION-2026-07-09.md +124 -0
- package/docs/REPL-CODE-MODE-EVALUATION-2026-07-10.md +187 -0
- package/docs/REPORT-1249-TARGETED.md +48 -0
- package/docs/RESEARCH-3P-MEMORY-SWAP-2026-07-12.md +273 -0
- package/docs/ROADMAP.md +111 -0
- package/docs/RSI-CLOUD-DEPLOY-2026-07-06.md +289 -0
- package/docs/RSI-PROCESS-AI-COLDSTART-2026-07-11.md +68 -0
- package/docs/S18-THOROUGHNESS-AUDIT-2026-07-09.md +113 -0
- package/docs/SERVICE-INTEGRATION-GUIDE.md +298 -0
- package/docs/SUBAGENT-STREAM-RESILIENCE-PARITY-2026-07-10.md +118 -0
- package/docs/SWEBENCH-PRO-RECON-2026-07-11.md +31 -0
- package/docs/TB-EFFICIENCY-TELEMETRY-2026-07-08.md +114 -0
- package/docs/TB-FAILURE-AUTOPSY-2026-07-05-RERUN.md +67 -0
- package/docs/TB-FAIRNESS-AUDIT-2026-07-08.md +141 -0
- package/docs/TB-FULL-1257-2026-07-08.md +77 -0
- package/docs/TB-LEG-GAP-ATTRIBUTION-1261-1263-2026-07-11.md +154 -0
- package/docs/TB-REGRESSION-DAEMON-KILL-2026-07-08.md +58 -0
- package/docs/TB-RSI-CROSSCHECK-2026-07-06.md +68 -0
- package/docs/TB-RSI-LEDGER.md +30 -0
- package/docs/TB-STABLE-SET-2026-07-08.md +127 -0
- package/docs/TB21-RECON-2026-07-11.md +28 -0
- package/docs/TEST-DESIGN-BATCH-1-2-3.md +97 -0
- package/docs/THIRD-PARTY-INTEGRATION.md +45 -0
- package/docs/TOKEN-ESTIMATE-CALIBRATION-LIVE-2026-07-09.md +102 -0
- package/docs/audit-2026-06-10-/347/254/254/344/272/214/350/275/256-/347/251/272/347/231/275/345/214/272/344/270/216/345/277/230/346/216/245/347/272/277.md +147 -0
- package/docs/audit-2026-06-10-/350/256/241/347/256/227bug/346/211/253/346/217/217.md +163 -0
- package/docs/audit-2026-06-11-/344/277/256/345/244/215/345/244/215/345/256/241/344/270/216/345/233/236/345/275/222/344/270/223/346/211/253.md +95 -0
- package/docs/audit-2026-06-12-design71-P1/346/275/234/344/274/217/351/235/242/350/243/201/345/206/263/344/270/216/345/220/236/351/224/231/345/256/241/350/256/241.md +45 -0
- package/docs/audit-2026-06-12-/345/205/254/345/274/200/346/227/213/351/222/256/346/264/273/346/200/247/344/270/216vendored/346/255/273/350/267/257.md +63 -0
- package/docs/audit-2026-06-15/ADDENDUM-second-pass.md +88 -0
- package/docs/audit-2026-06-15/ARCHITECTURE-AND-ROADMAP.md +187 -0
- package/docs/audit-2026-06-15/DOC-CORRECTIONS.md +105 -0
- package/docs/audit-2026-06-15/INDEX.md +49 -0
- package/docs/audit-2026-06-15/ORCHESTRATION-STATUS.md +98 -0
- package/docs/audit-2026-06-15/PRODUCTION-ISSUES.md +189 -0
- package/docs/audit-2026-06-15/REFERENCES-literature.md +139 -0
- package/docs/audit-2026-06-15/VENDOR-REFACTOR-PLAN.md +96 -0
- package/docs/cc-probe-198/README.md +72 -0
- package/docs/cc-probe-198/STABILITY-AUDIT.md +118 -0
- package/docs/cc-probe-198/live-schema-monitor-worktree-2026-07-09.json +56 -0
- package/docs/cc-probe-198/mount-variants.json +536 -0
- package/docs/cc-probe-198/plan-mode-run.json +1 -0
- package/docs/cc-probe-198/probe-bash-bg.json +224 -0
- package/docs/cc-probe-198/probe-edit-mismatch.json +120 -0
- package/docs/cc-probe-198/probe-read-missing.json +62 -0
- package/docs/cc-probe-198/probe-search-empty.json +127 -0
- package/docs/cc-probe-198/probe-task-family.json +227 -0
- package/docs/cc-probe-198/probes.status +6 -0
- package/docs/cc-probe-198/raw-capture-interactive.json +948 -0
- package/docs/cc-probe-198/raw-capture-print.json +787 -0
- package/docs/cc-probe-198/raw-capture2-interactive.json +948 -0
- package/docs/cc-probe-198/raw-capture2-print.json +787 -0
- package/docs/cc-probe-198/system-prompt.txt +135 -0
- package/docs/cc-probe-198/tools-array.json +962 -0
- package/docs/durability-boundary.md +63 -0
- package/docs/fix-2026-06-10-/350/256/241/347/256/227bug/344/277/256/345/244/215-search/346/211/271.md +75 -0
- package/docs/fix-2026-06-11-/347/254/254/344/272/214/350/275/256-/344/277/256/345/244/215-search/346/211/271.md +62 -0
- package/docs/parity-sweep/REPORT-DYNAMIC.md +97 -0
- package/docs/parity-sweep/REPORT-STATIC-GGB.md +127 -0
- package/docs/parity-sweep/REPORT-STATIC-RWE.md +133 -0
- package/docs/vendor-history.md +385 -0
- package/docs/vendored-upstream-diff-2026-07.md +83 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAgB9D,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAIlD,CAAC;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;kHAC8G;IAC9G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;sGAEkG;IAClG,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,SAAS,GAAG,oBAAoB,GAAG,OAAO,CAAC;IACzD,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gHAAgH;IAChH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8GAA8G;IAC9G,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;mHAC+G;IAC/G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA6BD;;;wEAGwE;AACxE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQrD;AAED;;;oDAGoD;AACpD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAgBlH;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C;AA8BD,uGAAuG;AACvG,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAyB1F;AAED;6FAC6F;AAC7F,wBAAsB,WAAW,CAC/B,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,CAYnD;AAED;+DAC+D;AAC/D,MAAM,WAAW,UAAU;IACzB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;gEAE4D;IAC5D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6FAA6F;IAC7F,UAAU,EAAE,OAAO,CAAC;IACpB;4FACwF;IACxF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;uGACuG;AACvG,wBAAsB,IAAI,CACxB,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,EAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CA2CrB;AAsFD,wGAAwG;AACxG,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA0JlH;AAGD,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUjE;AAED,kGAAkG;AAClG,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA+ClH;AAED,mGAAmG;AACnG,wBAAsB,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnH;AAED,kHAAkH;AAClH,wBAAsB,OAAO,CAC3B,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,EAC1C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;;;;;;uGAYuG;AACvG,wBAAsB,eAAe,CACnC,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,EAC1C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,CAiC1J"}
|
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import { hasBinaryExtension } from "./safety.js";
|
|
2
|
+
/**
|
|
3
|
+
* grep/glob search engine (design/64 §10). Two paths, same output, so it works on any execution env:
|
|
4
|
+
* - **ripgrep when present** (detected once per env) — fast, respects .gitignore, skips binary/hidden.
|
|
5
|
+
* - **JS fallback** otherwise (remote E2B/SSH may have no `rg`) — hardened to NOT crawl `node_modules`,
|
|
6
|
+
* `build`, `.dart_tool`, …; it parses `.gitignore` and skips binary files, so it isn't slow or noisy.
|
|
7
|
+
* Output is relative `path:line:text` (content), `path` (files), or `path:count` — matching CC's GrepTool.
|
|
8
|
+
*/
|
|
9
|
+
const WALK_MAX_FILES = 5000;
|
|
10
|
+
const WALK_MAX_DEPTH = 32;
|
|
11
|
+
const GREP_DEFAULT_CAP = 250; // CC default (design/116 review S2)
|
|
12
|
+
const FILE_MAX_BYTES = 5 * 1024 * 1024; // skip very large files in the JS fallback (never useful to grep)
|
|
13
|
+
/** Directories never worth crawling (design/64 §10.3) — dependency/build/cache trees. */
|
|
14
|
+
export const DEFAULT_IGNORE_DIRS = new Set([
|
|
15
|
+
"node_modules", ".git", ".hg", ".svn", "build", "dist", "out", "target", ".dart_tool", ".pub-cache",
|
|
16
|
+
".next", ".nuxt", ".gradle", ".idea", ".vscode", "Pods", ".venv", "venv", "__pycache__", ".mypy_cache",
|
|
17
|
+
".pytest_cache", "coverage", ".turbo", ".cache", "vendor",
|
|
18
|
+
]);
|
|
19
|
+
/** JS-fallback file-type → glob map for {@link GrepParams.type} (the rg path uses rg's own type table). */
|
|
20
|
+
const TYPE_GLOBS = {
|
|
21
|
+
js: "*.{js,jsx,mjs,cjs}",
|
|
22
|
+
ts: "*.{ts,tsx,mts,cts}",
|
|
23
|
+
py: "*.{py,pyi}",
|
|
24
|
+
rust: "*.rs",
|
|
25
|
+
go: "*.go",
|
|
26
|
+
java: "*.java",
|
|
27
|
+
c: "*.{c,h}",
|
|
28
|
+
cpp: "*.{cpp,cc,cxx,hpp,hh}",
|
|
29
|
+
ruby: "*.rb",
|
|
30
|
+
php: "*.php",
|
|
31
|
+
swift: "*.swift",
|
|
32
|
+
kotlin: "*.{kt,kts}",
|
|
33
|
+
csharp: "*.cs",
|
|
34
|
+
sh: "*.{sh,bash,zsh}",
|
|
35
|
+
md: "*.{md,mdx}",
|
|
36
|
+
markdown: "*.{md,mdx}",
|
|
37
|
+
json: "*.json",
|
|
38
|
+
yaml: "*.{yml,yaml}",
|
|
39
|
+
html: "*.{html,htm}",
|
|
40
|
+
css: "*.{css,scss,less}",
|
|
41
|
+
};
|
|
42
|
+
const basename = (p) => p.slice(Math.max(p.lastIndexOf("/"), p.lastIndexOf("\\")) + 1); // [384] sweep: dual-family
|
|
43
|
+
const NO_MATCHES = "No matches.";
|
|
44
|
+
/** 批④ #6 (CC 2.1.198 Grep call, bundle :333383-333390): split the `glob` param into individual glob
|
|
45
|
+
* tokens — whitespace-separated first; a token WITHOUT braces is further split on commas
|
|
46
|
+
* (`"*.ts,*.tsx"` → two globs), while a brace token (`*.{ts,tsx}`) is kept whole (its commas are
|
|
47
|
+
* alternation syntax, not separators). CC-verbatim splitting rules. */
|
|
48
|
+
export function splitGlobParam(glob) {
|
|
49
|
+
const out = [];
|
|
50
|
+
for (const token of glob.split(/\s+/)) {
|
|
51
|
+
if (token.includes("{") && token.includes("}")) {
|
|
52
|
+
if (token.length > 0)
|
|
53
|
+
out.push(token);
|
|
54
|
+
}
|
|
55
|
+
else
|
|
56
|
+
out.push(...token.split(",").filter(Boolean));
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/** 批④ #8 (CC 2.1.198 RWp, bundle :332987): decompose an ABSOLUTE glob pattern into a base directory +
|
|
61
|
+
* relative pattern — cut at the last separator before the first glob metachar (`* ? [ {`); a pattern
|
|
62
|
+
* with no metachar splits dirname/basename. Returns undefined for a relative pattern (caller keeps it
|
|
63
|
+
* as-is) or when no usable base can be derived. */
|
|
64
|
+
export function splitAbsoluteGlobPattern(pattern) {
|
|
65
|
+
if (!(pattern.startsWith("/") || /^[A-Za-z]:[\\/]/.test(pattern)))
|
|
66
|
+
return undefined;
|
|
67
|
+
const m = /[*?[{]/.exec(pattern);
|
|
68
|
+
if (!m) {
|
|
69
|
+
const i = Math.max(pattern.lastIndexOf("/"), pattern.lastIndexOf("\\"));
|
|
70
|
+
if (i <= 0)
|
|
71
|
+
return undefined;
|
|
72
|
+
return { baseDir: pattern.slice(0, i), relativePattern: pattern.slice(i + 1) };
|
|
73
|
+
}
|
|
74
|
+
const prefix = pattern.slice(0, m.index);
|
|
75
|
+
const cut = Math.max(prefix.lastIndexOf("/"), prefix.lastIndexOf("\\"));
|
|
76
|
+
if (cut === -1)
|
|
77
|
+
return undefined;
|
|
78
|
+
let baseDir = pattern.slice(0, cut);
|
|
79
|
+
if (baseDir === "" && cut === 0)
|
|
80
|
+
baseDir = "/";
|
|
81
|
+
if (/^[A-Za-z]:$/.test(baseDir))
|
|
82
|
+
baseDir = baseDir + pattern[cut];
|
|
83
|
+
if (!baseDir)
|
|
84
|
+
return undefined;
|
|
85
|
+
return { baseDir, relativePattern: pattern.slice(cut + 1) };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* POSIX-safe single-quote so an arbitrary model-supplied string can't break out of the shell command that
|
|
89
|
+
* runs ripgrep. Wraps in single quotes (inside which the shell expands nothing — no `$()`, backtick, `;`, or
|
|
90
|
+
* glob) and escapes any embedded single quote via the `'\''` idiom (close, escaped-quote, reopen). Exported
|
|
91
|
+
* for direct injection testing (council [R145]). Renamed from `shq` for legibility.
|
|
92
|
+
*/
|
|
93
|
+
export function shellQuote(s) {
|
|
94
|
+
return `'${s.replace(/'/g, `'\\''`)}'`;
|
|
95
|
+
}
|
|
96
|
+
/** Compile a gitignore/glob token to a RegExp tested against a relative posix path. */
|
|
97
|
+
function globTokenToRegExp(token, anchored, braces = false) {
|
|
98
|
+
// `braces` (design/116 review B1): glob/grep patterns support `{a,b}` alternation (`*.{ts,tsx}`), which
|
|
99
|
+
// the escaping below would otherwise turn into a LITERAL `{ts,tsx}` that never matches — every brace
|
|
100
|
+
// entry in TYPE_GLOBS and any model-sent `glob:"*.{ts,tsx}"` silently returned "No matches." on the JS
|
|
101
|
+
// fallback. Kept OFF for the gitignore path (gitignore has no brace syntax — `{` is literal there).
|
|
102
|
+
const charToRe = (ch) => ch === "*" ? "[^/]*" : ch === "?" ? "[^/]" : ch.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
103
|
+
let re = "";
|
|
104
|
+
for (let i = 0; i < token.length; i++) {
|
|
105
|
+
const c = token[i];
|
|
106
|
+
if (c === "*") {
|
|
107
|
+
if (token[i + 1] === "*") {
|
|
108
|
+
re += ".*";
|
|
109
|
+
i++;
|
|
110
|
+
if (token[i + 1] === "/")
|
|
111
|
+
i++;
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
re += "[^/]*";
|
|
115
|
+
}
|
|
116
|
+
else if (c === "?")
|
|
117
|
+
re += "[^/]";
|
|
118
|
+
else if (braces && c === "{") {
|
|
119
|
+
const close = token.indexOf("}", i);
|
|
120
|
+
if (close > i + 1) {
|
|
121
|
+
// Non-nested alternation: each alternative gets the same *, ?, escape rules.
|
|
122
|
+
const alts = token.slice(i + 1, close).split(",").map((alt) => [...alt].map(charToRe).join(""));
|
|
123
|
+
re += `(?:${alts.join("|")})`;
|
|
124
|
+
i = close;
|
|
125
|
+
}
|
|
126
|
+
else
|
|
127
|
+
re += "\\{"; // unmatched/empty brace → literal
|
|
128
|
+
}
|
|
129
|
+
else
|
|
130
|
+
re += c.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
131
|
+
}
|
|
132
|
+
return new RegExp(`${anchored ? "^" : "(^|/)"}${re}$`);
|
|
133
|
+
}
|
|
134
|
+
/** Lightweight `.gitignore` matcher (handles comments, negation, dir-only `/`, anchoring, `*`/`?`). */
|
|
135
|
+
export function gitignoreMatcher(content) {
|
|
136
|
+
const rules = content
|
|
137
|
+
.split(/\r?\n/)
|
|
138
|
+
.map((l) => l.trim())
|
|
139
|
+
.filter((l) => l.length > 0 && !l.startsWith("#"))
|
|
140
|
+
.map((raw) => {
|
|
141
|
+
let neg = false;
|
|
142
|
+
let pat = raw;
|
|
143
|
+
if (pat.startsWith("!")) {
|
|
144
|
+
neg = true;
|
|
145
|
+
pat = pat.slice(1);
|
|
146
|
+
}
|
|
147
|
+
let dirOnly = false;
|
|
148
|
+
if (pat.endsWith("/")) {
|
|
149
|
+
dirOnly = true;
|
|
150
|
+
pat = pat.slice(0, -1);
|
|
151
|
+
}
|
|
152
|
+
const anchored = pat.startsWith("/");
|
|
153
|
+
if (anchored)
|
|
154
|
+
pat = pat.replace(/^\/+/, "");
|
|
155
|
+
return { neg, dirOnly, anchored, re: globTokenToRegExp(pat, anchored), bare: pat };
|
|
156
|
+
});
|
|
157
|
+
return (relRaw, isDir) => {
|
|
158
|
+
const rel = relRaw.replace(/\\/g, "/"); // [384] sweep: win32 rel keys are backslash-form; glob regexes are "/"-built
|
|
159
|
+
let ignored = false;
|
|
160
|
+
for (const r of rules) {
|
|
161
|
+
if (r.dirOnly && !isDir)
|
|
162
|
+
continue;
|
|
163
|
+
const hit = r.re.test(rel) || (!r.anchored && (r.re.test(basename(rel)) || rel.split("/").includes(r.bare)));
|
|
164
|
+
if (hit)
|
|
165
|
+
ignored = !r.neg;
|
|
166
|
+
}
|
|
167
|
+
return ignored;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** Build the combined ignore predicate (ignore-set ∪ .gitignore) for a JS-fallback walk.
|
|
171
|
+
* Exported so repo-map (design/72 §1) walks with the SAME ignore semantics as grep/glob. */
|
|
172
|
+
export async function buildIgnore(env, root, signal) {
|
|
173
|
+
let gi;
|
|
174
|
+
const giPath = `${root.replace(/\/+$/, "")}/.gitignore`;
|
|
175
|
+
const read = await env.readTextFile(giPath, signal).catch(() => undefined);
|
|
176
|
+
if (read && read.ok)
|
|
177
|
+
gi = gitignoreMatcher(read.value);
|
|
178
|
+
return (rel, isDir) => {
|
|
179
|
+
const base = basename(rel);
|
|
180
|
+
if (isDir && DEFAULT_IGNORE_DIRS.has(base))
|
|
181
|
+
return true;
|
|
182
|
+
if (base.startsWith(".") && base !== ".")
|
|
183
|
+
return true; // skip dotfiles/dirs (matches the prior walk)
|
|
184
|
+
if (gi && gi(rel, isDir))
|
|
185
|
+
return true;
|
|
186
|
+
return false;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/** Bounded, ignore-aware recursive walk. Returns absolute file paths under `start`. Exported for
|
|
190
|
+
* repo-map (design/72 §1) — same bounded/ignore-aware traversal as grep/glob, one source of truth. */
|
|
191
|
+
export async function walk(env, root, start, ignore, signal) {
|
|
192
|
+
const out = [];
|
|
193
|
+
const nameOnly = [];
|
|
194
|
+
let incomplete = false;
|
|
195
|
+
let skippedLarge = 0;
|
|
196
|
+
const rootPrefix = root.replace(/[\\/]+$/, "") + (root.includes("\\") ? "\\" : "/"); // [384] sweep(Opus 复审补漏)
|
|
197
|
+
const rel = (abs) => (abs.startsWith(rootPrefix) ? abs.slice(rootPrefix.length) : abs);
|
|
198
|
+
const stack = [{ dir: start, depth: 0 }];
|
|
199
|
+
const visited = new Set();
|
|
200
|
+
while (stack.length > 0 && out.length < WALK_MAX_FILES) {
|
|
201
|
+
const { dir, depth } = stack.pop();
|
|
202
|
+
if (visited.has(dir))
|
|
203
|
+
continue;
|
|
204
|
+
visited.add(dir);
|
|
205
|
+
const listing = await env.listDir(dir, signal);
|
|
206
|
+
if (!listing.ok)
|
|
207
|
+
continue;
|
|
208
|
+
for (const info of listing.value) {
|
|
209
|
+
if (info.kind === "directory") {
|
|
210
|
+
if (ignore(rel(info.path), true) || visited.has(info.path))
|
|
211
|
+
continue;
|
|
212
|
+
if (depth < WALK_MAX_DEPTH)
|
|
213
|
+
stack.push({ dir: info.path, depth: depth + 1 });
|
|
214
|
+
else
|
|
215
|
+
incomplete = true; // a real (non-ignored) subtree was cut off by the depth ceiling
|
|
216
|
+
}
|
|
217
|
+
else if (info.kind === "file") {
|
|
218
|
+
if (ignore(rel(info.path), false))
|
|
219
|
+
continue;
|
|
220
|
+
if (hasBinaryExtension(info.path)) {
|
|
221
|
+
if (nameOnly.length < WALK_MAX_FILES)
|
|
222
|
+
nameOnly.push(info.path);
|
|
223
|
+
else
|
|
224
|
+
incomplete = true;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (typeof info.size === "number" && info.size > FILE_MAX_BYTES) {
|
|
228
|
+
skippedLarge++;
|
|
229
|
+
if (nameOnly.length < WALK_MAX_FILES)
|
|
230
|
+
nameOnly.push(info.path);
|
|
231
|
+
else
|
|
232
|
+
incomplete = true;
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
out.push(info.path);
|
|
236
|
+
if (out.length >= WALK_MAX_FILES) {
|
|
237
|
+
incomplete = true; // boundary false-positive possible (exactly-N trees); markers say "may"
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (stack.length > 0 && out.length >= WALK_MAX_FILES)
|
|
244
|
+
incomplete = true;
|
|
245
|
+
return { files: out, nameOnly, incomplete, skippedLarge };
|
|
246
|
+
}
|
|
247
|
+
/** Honesty suffix for results built on a bounded walk: appended to EVERY output shape (including
|
|
248
|
+
* "No matches." — an unflagged empty result reads as "the code doesn't contain X", the exact harm the
|
|
249
|
+
* A-8 fix documented). Empty when the walk was exhaustive. */
|
|
250
|
+
function walkCaveat(w, forContentSearch) {
|
|
251
|
+
const parts = [];
|
|
252
|
+
if (w.incomplete)
|
|
253
|
+
parts.push(`file walk hit its ${WALK_MAX_FILES}-file/${WALK_MAX_DEPTH}-depth limit`);
|
|
254
|
+
if (forContentSearch && w.skippedLarge > 0) {
|
|
255
|
+
parts.push(`${w.skippedLarge} file(s) over ${Math.round(FILE_MAX_BYTES / (1024 * 1024))}MB not searched`);
|
|
256
|
+
}
|
|
257
|
+
return parts.length > 0 ? `\n…[results may be incomplete: ${parts.join("; ")}]` : "";
|
|
258
|
+
}
|
|
259
|
+
function compilePattern(p) {
|
|
260
|
+
if (p.regex) {
|
|
261
|
+
const re = new RegExp(p.pattern, p.ignore_case ? "i" : "");
|
|
262
|
+
return (l) => re.test(l);
|
|
263
|
+
}
|
|
264
|
+
if (p.ignore_case) {
|
|
265
|
+
const needle = p.pattern.toLowerCase();
|
|
266
|
+
return (l) => l.toLowerCase().includes(needle);
|
|
267
|
+
}
|
|
268
|
+
return (l) => l.includes(p.pattern);
|
|
269
|
+
}
|
|
270
|
+
/** 批④ #5: the matched (non-empty) substrings of one line, for `only_matching` (rg -o). Literal
|
|
271
|
+
* patterns return the file's ACTUAL span (case-insensitive match still reports the original casing). */
|
|
272
|
+
function matchedParts(line, p) {
|
|
273
|
+
const parts = [];
|
|
274
|
+
if (p.regex) {
|
|
275
|
+
const re = new RegExp(p.pattern, `g${p.ignore_case ? "i" : ""}`);
|
|
276
|
+
for (let m = re.exec(line); m !== null; m = re.exec(line)) {
|
|
277
|
+
if (m[0].length > 0)
|
|
278
|
+
parts.push(m[0]);
|
|
279
|
+
else
|
|
280
|
+
re.lastIndex++; // zero-width safety
|
|
281
|
+
if (parts.length > 1000)
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else if (p.pattern.length > 0) {
|
|
286
|
+
const hay = p.ignore_case ? line.toLowerCase() : line;
|
|
287
|
+
const needle = p.ignore_case ? p.pattern.toLowerCase() : p.pattern;
|
|
288
|
+
for (let idx = hay.indexOf(needle); idx !== -1; idx = hay.indexOf(needle, idx + needle.length)) {
|
|
289
|
+
parts.push(line.slice(idx, idx + needle.length));
|
|
290
|
+
if (parts.length > 1000)
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return parts;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* audit A-8: whole-file matcher for `multiline:true` (rg parity: `-U --multiline-dotall`). Returns
|
|
298
|
+
* [startLine, endLine] (1-based, inclusive) per match. Regex gets `s` (dot matches newline) + `g`;
|
|
299
|
+
* a literal pattern is an indexOf scan (it may contain real newlines).
|
|
300
|
+
*/
|
|
301
|
+
function multilineSpans(content, p, captureText = false) {
|
|
302
|
+
const spans = [];
|
|
303
|
+
// offset → 1-based line via precomputed line-start offsets
|
|
304
|
+
const starts = [0];
|
|
305
|
+
for (let i = 0; i < content.length; i++)
|
|
306
|
+
if (content[i] === "\n")
|
|
307
|
+
starts.push(i + 1);
|
|
308
|
+
const lineAt = (off) => {
|
|
309
|
+
let lo = 0, hi = starts.length - 1;
|
|
310
|
+
while (lo < hi) {
|
|
311
|
+
const mid = (lo + hi + 1) >> 1;
|
|
312
|
+
if (starts[mid] <= off)
|
|
313
|
+
lo = mid;
|
|
314
|
+
else
|
|
315
|
+
hi = mid - 1;
|
|
316
|
+
}
|
|
317
|
+
return lo + 1;
|
|
318
|
+
};
|
|
319
|
+
// 1.253 双轨终审 LOW (only_matching × multiline): the matched TEXT is captured only when the caller
|
|
320
|
+
// needs it (-o output), bounded per match so a pathological greedy span can't hold megabytes.
|
|
321
|
+
const MATCH_TEXT_MAX = 2_000;
|
|
322
|
+
if (p.regex) {
|
|
323
|
+
const re = new RegExp(p.pattern, `gs${p.ignore_case ? "i" : ""}`);
|
|
324
|
+
for (let m = re.exec(content); m !== null; m = re.exec(content)) {
|
|
325
|
+
spans.push([lineAt(m.index), lineAt(m.index + Math.max(0, m[0].length - 1)), captureText ? m[0].slice(0, MATCH_TEXT_MAX) : undefined]);
|
|
326
|
+
if (m[0].length === 0)
|
|
327
|
+
re.lastIndex++; // zero-width safety
|
|
328
|
+
if (spans.length > 10_000)
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
const hay = p.ignore_case ? content.toLowerCase() : content;
|
|
334
|
+
const needle = p.ignore_case ? p.pattern.toLowerCase() : p.pattern;
|
|
335
|
+
if (needle.length > 0) {
|
|
336
|
+
for (let idx = hay.indexOf(needle); idx !== -1; idx = hay.indexOf(needle, idx + needle.length)) {
|
|
337
|
+
spans.push([lineAt(idx), lineAt(idx + needle.length - 1), captureText ? content.slice(idx, idx + Math.min(needle.length, MATCH_TEXT_MAX)) : undefined]);
|
|
338
|
+
if (spans.length > 10_000)
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return spans;
|
|
344
|
+
}
|
|
345
|
+
/** JS-fallback grep: ignore-aware walk + per-line scan, honoring output_mode / context / head_limit. */
|
|
346
|
+
export async function jsGrep(env, root, p, signal) {
|
|
347
|
+
let test;
|
|
348
|
+
try {
|
|
349
|
+
test = compilePattern(p);
|
|
350
|
+
}
|
|
351
|
+
catch (e) {
|
|
352
|
+
return `Error (grep): invalid regex: ${e instanceof Error ? e.message : String(e)}`;
|
|
353
|
+
}
|
|
354
|
+
const ignore = await buildIgnore(env, root, signal);
|
|
355
|
+
const rootPrefix = root.replace(/[\\/]+$/, "") + (root.includes("\\") ? "\\" : "/");
|
|
356
|
+
const start = p.path ? (p.path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(p.path) ? p.path : `${rootPrefix}${p.path}`) : root;
|
|
357
|
+
const walked = await walk(env, root, start, ignore, signal);
|
|
358
|
+
const caveat = walkCaveat(walked, true);
|
|
359
|
+
let files = walked.files;
|
|
360
|
+
files.sort();
|
|
361
|
+
// head_limit 0 = unlimited (CC "Pass 0 for unlimited", design/116 review S2).
|
|
362
|
+
const cap = p.head_limit === 0 ? Infinity : Math.max(1, Math.floor(p.head_limit ?? GREP_DEFAULT_CAP));
|
|
363
|
+
const mode = p.output_mode ?? "content";
|
|
364
|
+
const rel = (abs) => (abs.startsWith(rootPrefix) ? abs.slice(rootPrefix.length) : abs);
|
|
365
|
+
// audit A-8: honor `glob` (rg parity: --glob). Previously silently ignored — a glob-scoped search
|
|
366
|
+
// scanned EVERY file, so unrelated matches filled the result cap and crowded out the real targets.
|
|
367
|
+
// 批④ #6: the param may carry SEVERAL globs (comma/whitespace-separated, CC parity) — match ANY.
|
|
368
|
+
if (p.glob) {
|
|
369
|
+
const globRes = splitGlobParam(p.glob).map((g) => globTokenToRegExp(g, false, true));
|
|
370
|
+
if (globRes.length > 0)
|
|
371
|
+
files = files.filter((f) => globRes.some((re) => re.test(rel(f))));
|
|
372
|
+
}
|
|
373
|
+
// design/116 W1: honor `type` (CC/rg --type) via the glob map; an unknown type is ignored (searching
|
|
374
|
+
// everything) with an honest note rather than silently returning nothing.
|
|
375
|
+
let typeNote = "";
|
|
376
|
+
if (p.type) {
|
|
377
|
+
const tg = TYPE_GLOBS[p.type.toLowerCase()];
|
|
378
|
+
if (tg) {
|
|
379
|
+
const typeRe = globTokenToRegExp(tg, false, true);
|
|
380
|
+
files = files.filter((f) => typeRe.test(basename(f)));
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
typeNote = `\n[note: unknown type "${p.type}" — searched all files]`;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// CC semantics (design/116 review S1, GrepTool.ts: "context takes precedence over context_before/context_after"):
|
|
387
|
+
// -C wins when sent; -B/-A only apply without it.
|
|
388
|
+
const ctxB = Math.max(0, Math.floor(p.context ?? p.context_before ?? 0));
|
|
389
|
+
const ctxA = Math.max(0, Math.floor(p.context ?? p.context_after ?? 0));
|
|
390
|
+
const ctx = Math.max(ctxB, ctxA); // legacy uses below (cap-marker honesty) key off "any context in play"
|
|
391
|
+
// design/116 W1: `offset` pagination — collect offset+cap items, emit the slice after the offset.
|
|
392
|
+
const off = Math.min(100_000, Math.max(0, Math.floor(p.offset ?? 0))); // clamped: a huge offset must not unbound the collection buffer
|
|
393
|
+
const collectCap = cap + off;
|
|
394
|
+
const out = [];
|
|
395
|
+
const fileMatches = [];
|
|
396
|
+
const counts = [];
|
|
397
|
+
// True totals: ACCUMULATE output only until `cap`, but keep COUNTING (cheap) so the `[capped at]`
|
|
398
|
+
// marker can report the real total, not the cap (output-cap honesty: a cap that looks like the total
|
|
399
|
+
// hides how much was dropped). Push a line only while under cap; the per-line guards below also stop
|
|
400
|
+
// the inner context loops from overshooting `cap` by a full match window.
|
|
401
|
+
let totalContent = 0;
|
|
402
|
+
let totalFiles = 0;
|
|
403
|
+
for (const f of files) {
|
|
404
|
+
const read = await env.readTextFile(f, signal);
|
|
405
|
+
if (!read.ok)
|
|
406
|
+
continue;
|
|
407
|
+
const lines = read.value.split("\n");
|
|
408
|
+
// rg parity: a trailing newline doesn't make a phantom final line. Drop one trailing "" so the
|
|
409
|
+
// JS-fallback line set (and its match count) matches ripgrep's instead of inflating by one.
|
|
410
|
+
if (lines.length > 1 && lines.at(-1) === "")
|
|
411
|
+
lines.pop();
|
|
412
|
+
let fileCount = 0;
|
|
413
|
+
if (p.multiline) {
|
|
414
|
+
// audit A-8: honor `multiline` (rg parity: -U --multiline-dotall). Previously silently ignored —
|
|
415
|
+
// per-line matching made any cross-line pattern return "No matches.", which reads as "the code
|
|
416
|
+
// doesn't contain X". Whole-file spans, mapped back to 1-based lines.
|
|
417
|
+
let spans;
|
|
418
|
+
try {
|
|
419
|
+
spans = multilineSpans(read.value, p, mode === "content" && p.only_matching === true);
|
|
420
|
+
}
|
|
421
|
+
catch (e) {
|
|
422
|
+
return `Error (grep): invalid regex: ${e instanceof Error ? e.message : String(e)}`;
|
|
423
|
+
}
|
|
424
|
+
fileCount = spans.length;
|
|
425
|
+
if (mode === "content") {
|
|
426
|
+
for (const [s, eL, text] of spans) {
|
|
427
|
+
// 1.253 双轨终审 LOW (批④ #5 completion): `-o` under multiline emits the matched SEGMENT,
|
|
428
|
+
// one output record per matched line (rg -U -o shape: the match's own lines, numbered from
|
|
429
|
+
// the span start), instead of silently falling back to whole-line windows. Context never
|
|
430
|
+
// applies under -o (same rule as the single-line branch).
|
|
431
|
+
if (p.only_matching && text !== undefined) {
|
|
432
|
+
const parts = text.split("\n");
|
|
433
|
+
for (let k = 0; k < parts.length; k++) {
|
|
434
|
+
if (out.length < collectCap)
|
|
435
|
+
out.push(`${rel(f)}:${s + k}:${parts[k].slice(0, 500)}`);
|
|
436
|
+
}
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
for (let j = Math.max(0, s - 1 - ctxB); j <= Math.min(lines.length - 1, eL - 1 + ctxA); j++) {
|
|
440
|
+
if (out.length < collectCap)
|
|
441
|
+
out.push(`${rel(f)}:${j + 1}:${lines[j].slice(0, 500)}`);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
for (let i = 0; i < lines.length; i++) {
|
|
448
|
+
if (!test(lines[i]))
|
|
449
|
+
continue;
|
|
450
|
+
fileCount++;
|
|
451
|
+
if (mode === "content") {
|
|
452
|
+
// 批④ #5 (`-o`): emit only the matched (non-empty) parts, one per output line (rg -o parity).
|
|
453
|
+
// Context windows don't apply in only-matching output (the parts ARE the output).
|
|
454
|
+
if (p.only_matching) {
|
|
455
|
+
for (const part of matchedParts(lines[i], p)) {
|
|
456
|
+
if (out.length < collectCap)
|
|
457
|
+
out.push(`${rel(f)}:${i + 1}:${part.slice(0, 500)}`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
else if (ctx > 0) {
|
|
461
|
+
for (let j = Math.max(0, i - ctxB); j <= Math.min(lines.length - 1, i + ctxA); j++) {
|
|
462
|
+
if (out.length < collectCap)
|
|
463
|
+
out.push(`${rel(f)}:${j + 1}:${lines[j].slice(0, 500)}`);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
else if (out.length < collectCap) {
|
|
467
|
+
out.push(`${rel(f)}:${i + 1}:${lines[i].slice(0, 500)}`);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if (mode === "content")
|
|
473
|
+
totalContent += fileCount; // matches are ≤ output lines (context inflates out)
|
|
474
|
+
if (fileCount > 0) {
|
|
475
|
+
totalFiles++;
|
|
476
|
+
if (mode === "files_with_matches" && fileMatches.length < collectCap)
|
|
477
|
+
fileMatches.push(rel(f));
|
|
478
|
+
else if (mode === "count" && counts.length < collectCap)
|
|
479
|
+
counts.push(`${rel(f)}:${fileCount}`);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// Offset pagination (design/116 W1): emit the window AFTER the first `off` collected items. An offset
|
|
483
|
+
// past the end is an honest empty ("No matches" + note), not an error.
|
|
484
|
+
const paged = (arr) => (off > 0 ? arr.slice(off, off + cap) : arr);
|
|
485
|
+
const offNote = off > 0 ? `\n[offset ${off}]` : "";
|
|
486
|
+
// Cap markers on EVERY output mode (content had one; files_with_matches/count silently dropped the
|
|
487
|
+
// tail — and the rg path marks all three, so the fallback was also behaviorally inconsistent with it).
|
|
488
|
+
// Report the REAL total (not the cap) so the dropped count is honest.
|
|
489
|
+
if (mode === "files_with_matches") {
|
|
490
|
+
const body = paged(fileMatches);
|
|
491
|
+
return body.length === 0
|
|
492
|
+
? NO_MATCHES + offNote + typeNote + caveat
|
|
493
|
+
: body.join("\n") + (totalFiles > off + cap ? `\n…[capped at ${cap} of ${totalFiles}]` : "") + offNote + typeNote + caveat;
|
|
494
|
+
}
|
|
495
|
+
if (mode === "count") {
|
|
496
|
+
const body = paged(counts);
|
|
497
|
+
return body.length === 0
|
|
498
|
+
? NO_MATCHES + offNote + typeNote + caveat
|
|
499
|
+
: body.join("\n") + (totalFiles > off + cap ? `\n…[capped at ${cap} of ${totalFiles}]` : "") + offNote + typeNote + caveat;
|
|
500
|
+
}
|
|
501
|
+
// `totalContent` counts MATCHES (exact: one per matching line, independent of context). `out` holds
|
|
502
|
+
// match+context lines, so when context is in play `out` can reach the cap on fewer matches — in that
|
|
503
|
+
// case the cap bounds OUTPUT lines, and the true match total is a lower bound on what was dropped.
|
|
504
|
+
const body = paged(out);
|
|
505
|
+
if (body.length === 0)
|
|
506
|
+
return NO_MATCHES + offNote + typeNote + caveat;
|
|
507
|
+
if (out.length < collectCap)
|
|
508
|
+
return body.join("\n") + offNote + typeNote + caveat; // nothing truncated
|
|
509
|
+
// Output was capped. One output line == one match ONLY for single-line matching with no context, where
|
|
510
|
+
// `totalContent` is the exact total and `[capped at C of T]` is precise. If context is in play (each match
|
|
511
|
+
// drags in a window) OR the match is multiline (codex [R145]: one span covers MANY lines), output lines ≥
|
|
512
|
+
// matches — the cap bounds OUTPUT lines, not matches, so naming an exact total would lie (the `capped at 4
|
|
513
|
+
// of 1` bug: 4 capped output lines, 1 multiline match). Report the match total as an honest lower bound.
|
|
514
|
+
const marker = ctx > 0 || p.multiline || p.only_matching // 批④ #5: -o can emit several parts per matching line — totals are a lower bound
|
|
515
|
+
? `\n…[capped at ${cap}; ${totalContent}+ match(es) found, more output omitted]`
|
|
516
|
+
: `\n…[capped at ${cap} of ${totalContent}]`;
|
|
517
|
+
return body.join("\n") + marker + offNote + typeNote + caveat;
|
|
518
|
+
}
|
|
519
|
+
const rgCache = new WeakMap();
|
|
520
|
+
/** Detect ripgrep once per env (cached). */
|
|
521
|
+
export function detectRipgrep(env) {
|
|
522
|
+
let cached = rgCache.get(env);
|
|
523
|
+
if (!cached) {
|
|
524
|
+
cached = env
|
|
525
|
+
.exec("rg --version", { timeout: 10 })
|
|
526
|
+
.then((r) => r.ok && r.value.exitCode === 0)
|
|
527
|
+
.catch(() => false);
|
|
528
|
+
rgCache.set(env, cached);
|
|
529
|
+
}
|
|
530
|
+
return cached;
|
|
531
|
+
}
|
|
532
|
+
/** ripgrep grep: build flags from params, run, normalize to the same output as {@link jsGrep}. */
|
|
533
|
+
export async function rgGrep(env, root, p, signal) {
|
|
534
|
+
const mode = p.output_mode ?? "content";
|
|
535
|
+
// --no-require-git: honor .gitignore even when the project dir isn't a git repo (ripgrep otherwise only
|
|
536
|
+
// applies .gitignore inside a git tree), so the rg path matches the JS fallback's ignore behavior.
|
|
537
|
+
const flags = ["--no-messages", "--no-require-git"];
|
|
538
|
+
// 批④ #7 (CC 2.1.198 verbatim, bundle :333367): bound each output line — a single pathological
|
|
539
|
+
// multi-MB line (minified bundle, base64 blob) must not blow the whole result.
|
|
540
|
+
// 1.253 双轨终审 LOW: --max-columns-preview keeps a PREFIX of an over-long matching line (with
|
|
541
|
+
// rg's "[... N more matches]" note) instead of replacing it with an elided placeholder — same
|
|
542
|
+
// "show the first 500 chars" behavior as the jsGrep fallback's line slice.
|
|
543
|
+
flags.push("--max-columns", "500", "--max-columns-preview");
|
|
544
|
+
if (!p.regex)
|
|
545
|
+
flags.push("-F"); // literal substring unless regex requested
|
|
546
|
+
if (p.ignore_case)
|
|
547
|
+
flags.push("-i");
|
|
548
|
+
if (p.multiline)
|
|
549
|
+
flags.push("-U", "--multiline-dotall");
|
|
550
|
+
if (mode === "content") {
|
|
551
|
+
flags.push("--no-heading", "-n");
|
|
552
|
+
if (p.only_matching)
|
|
553
|
+
flags.push("-o"); // 批④ #5 (CC: content mode only)
|
|
554
|
+
// CC semantics (design/116 review S1): -C wins over -B/-A when both are sent; -C alone sets both.
|
|
555
|
+
const ctxB = p.context ?? p.context_before;
|
|
556
|
+
const ctxA = p.context ?? p.context_after;
|
|
557
|
+
if (ctxB && ctxB > 0)
|
|
558
|
+
flags.push("-B", String(Math.floor(ctxB)));
|
|
559
|
+
if (ctxA && ctxA > 0)
|
|
560
|
+
flags.push("-A", String(Math.floor(ctxA)));
|
|
561
|
+
}
|
|
562
|
+
else if (mode === "files_with_matches")
|
|
563
|
+
flags.push("-l");
|
|
564
|
+
else if (mode === "count")
|
|
565
|
+
flags.push("-c");
|
|
566
|
+
// 批④ #6: comma/whitespace-separated glob list → one --glob per token (CC parity).
|
|
567
|
+
if (p.glob)
|
|
568
|
+
for (const g of splitGlobParam(p.glob))
|
|
569
|
+
flags.push("--glob", shellQuote(g));
|
|
570
|
+
// rg's built-in type table (design/116 W1, CC `type`). An unknown type makes rg exit(2) → JS fallback
|
|
571
|
+
// handles it with its own map/note, so a bad type never hard-errors.
|
|
572
|
+
if (p.type)
|
|
573
|
+
flags.push("--type", shellQuote(p.type));
|
|
574
|
+
const target = p.path ? shellQuote(p.path) : ".";
|
|
575
|
+
const cmd = `rg ${flags.join(" ")} -e ${shellQuote(p.pattern)} -- ${target}`;
|
|
576
|
+
const res = await env.exec(cmd, { cwd: root, timeout: 60, abortSignal: signal });
|
|
577
|
+
if (!res.ok)
|
|
578
|
+
return jsGrep(env, root, p, signal); // adapter/exec failure → fall back rather than error out
|
|
579
|
+
const { exitCode, stdout } = res.value;
|
|
580
|
+
if (exitCode === 1)
|
|
581
|
+
return NO_MATCHES; // rg: 1 = no matches
|
|
582
|
+
if (exitCode >= 2)
|
|
583
|
+
return jsGrep(env, root, p, signal); // rg error (e.g. bad regex it rejects) → JS fallback
|
|
584
|
+
const cap = p.head_limit === 0 ? Infinity : Math.max(1, Math.floor(p.head_limit ?? GREP_DEFAULT_CAP)); // 0 = unlimited (S2)
|
|
585
|
+
const off = Math.max(0, Math.floor(p.offset ?? 0));
|
|
586
|
+
const lines = stdout.split("\n").filter((l) => l.length > 0);
|
|
587
|
+
const capped = lines.slice(off, off + cap);
|
|
588
|
+
if (capped.length === 0)
|
|
589
|
+
return NO_MATCHES + (off > 0 ? `\n[offset ${off}]` : "");
|
|
590
|
+
// Report the REAL total (we have it: `lines.length`), not the cap, so the dropped count is honest.
|
|
591
|
+
return (capped.join("\n") +
|
|
592
|
+
(lines.length > off + cap ? `\n…[capped at ${cap} of ${lines.length}]` : "") +
|
|
593
|
+
(off > 0 ? `\n[offset ${off}]` : ""));
|
|
594
|
+
}
|
|
595
|
+
/** grep dispatch: ripgrep when the env has it, else the hardened JS fallback (design/64 §10.3). */
|
|
596
|
+
export async function runGrep(env, root, p, signal) {
|
|
597
|
+
return (await detectRipgrep(env)) ? rgGrep(env, root, p, signal) : jsGrep(env, root, p, signal);
|
|
598
|
+
}
|
|
599
|
+
/** glob: find files by name pattern, with optional sub-path scoping; returns RELATIVE paths (design/64 §10.4). */
|
|
600
|
+
export async function runGlob(env, root, pattern, opts = {}, signal) {
|
|
601
|
+
return (await runGlobDetailed(env, root, pattern, opts, signal)).text;
|
|
602
|
+
}
|
|
603
|
+
/** Structured sibling of {@link runGlob} (design/116 W3): same walk/match, plus the CC-shaped facts a
|
|
604
|
+
* shell renders (`filenames`/`numFiles`/`truncated`/`durationMs`/`totalMatches`/`countIsComplete`)
|
|
605
|
+
* without re-parsing the text.
|
|
606
|
+
*
|
|
607
|
+
* CC207 backlog P2-2 (CC 2.1.206:397761-398004 = 2.1.207:342454-342633, node-sliced verbatim):
|
|
608
|
+
* · `totalMatches` — "Total number of matching files before truncation. A lower bound when
|
|
609
|
+
* countIsComplete is false." (CC: `totalMatches: g.length`)
|
|
610
|
+
* · `countIsComplete` — "Whether totalMatches is the exact total (true) or a floor because the
|
|
611
|
+
* underlying search truncated its own output (false)." (CC: `countIsComplete: !m`, m = the rg
|
|
612
|
+
* enumeration cut its own output; sema equivalent = the bounded walk hit its file/depth ceiling)
|
|
613
|
+
* · `numFiles` — "Number of file paths returned (after any truncation)" (CC: `numFiles: u.length`
|
|
614
|
+
* post-slice; was matchedAll.length here — pre-truncation total — fixed to the CC contract)
|
|
615
|
+
* · `truncated` — CC: `y = m || g.length > n + r` (underlying-incomplete OR over the result cap). */
|
|
616
|
+
export async function runGlobDetailed(env, root, pattern, opts = {}, signal) {
|
|
617
|
+
const t0 = Date.now();
|
|
618
|
+
const ignore = await buildIgnore(env, root, signal);
|
|
619
|
+
const rootPrefix = root.replace(/[\\/]+$/, "") + (root.includes("\\") ? "\\" : "/");
|
|
620
|
+
const start = opts.path ? (opts.path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(opts.path) ? opts.path : `${rootPrefix}${opts.path}`) : root;
|
|
621
|
+
const walked = await walk(env, root, start, ignore, signal);
|
|
622
|
+
const caveat = walkCaveat(walked, false);
|
|
623
|
+
// Glob matches NAMES: binary/oversize files are legitimate glob results (only content search skips them).
|
|
624
|
+
const files = [...walked.files, ...walked.nameOnly];
|
|
625
|
+
const re = globTokenToRegExp(pattern, false, true);
|
|
626
|
+
const rel = (abs) => (abs.startsWith(rootPrefix) ? abs.slice(rootPrefix.length) : abs);
|
|
627
|
+
const cap = Math.max(1, Math.floor(opts.max ?? 500));
|
|
628
|
+
const matchedAll = files.filter((f) => re.test(rel(f)) || re.test(basename(f))).map(rel).sort();
|
|
629
|
+
const matched = matchedAll.slice(0, cap);
|
|
630
|
+
const totalMatches = matchedAll.length;
|
|
631
|
+
const countIsComplete = !walked.incomplete;
|
|
632
|
+
const truncated = !countIsComplete || totalMatches > cap;
|
|
633
|
+
// Model-facing truncation note: CC 2.1.206:397947-397957 verbatim (fn QTg; the third
|
|
634
|
+
// "totalMatches undefined" tier is CC's legacy-persisted-result branch — unreachable here,
|
|
635
|
+
// core always computes totalMatches). Appended as its own line iff truncated, like CC's
|
|
636
|
+
// `[...filenames, ...(truncated ? [QTg(e)] : [])].join("\n")`. The `matched.length === 0`
|
|
637
|
+
// exclusion is CC-congruent too (三轮复查亲核 206:398116-398120): CC's
|
|
638
|
+
// mapToolResultToToolResultBlockParam early-returns "No files found" on an empty filenames list
|
|
639
|
+
// BEFORE the truncated-note branch, so an empty-but-truncated walk carries no QTg note in CC
|
|
640
|
+
// either. The walkCaveat honesty suffix stays the one sema delta (A-8: an unflagged empty/partial
|
|
641
|
+
// result reads as exhaustive).
|
|
642
|
+
const capNote = !truncated || matched.length === 0
|
|
643
|
+
? ""
|
|
644
|
+
: countIsComplete
|
|
645
|
+
? `\n(Showing ${matched.length} of ${totalMatches} matching files; ${totalMatches - matched.length} more are not listed. Narrow the pattern or path to see the rest.)`
|
|
646
|
+
: `\n(Showing the first ${matched.length} files; there are more than ${totalMatches} matches. Narrow the pattern or path to see the rest.)`;
|
|
647
|
+
const text = matched.length === 0 ? "No files matched." + caveat : matched.join("\n") + capNote + caveat;
|
|
648
|
+
return { text, filenames: matched, numFiles: matched.length, truncated, durationMs: Date.now() - t0, totalMatches, countIsComplete };
|
|
649
|
+
}
|
|
650
|
+
//# sourceMappingURL=search.js.map
|