@pentoshi/clai 4.11.5 → 4.11.8
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/dist/agent/compaction/summary-execution.d.ts +32 -0
- package/dist/agent/compaction/summary-execution.js +407 -0
- package/dist/agent/compaction/summary-execution.js.map +1 -0
- package/dist/agent/compaction-attempt.d.ts +5 -1
- package/dist/agent/compaction-attempt.js +22 -12
- package/dist/agent/compaction-attempt.js.map +1 -1
- package/dist/agent/compaction-executor.d.ts +5 -53
- package/dist/agent/compaction-executor.js +11 -442
- package/dist/agent/compaction-executor.js.map +1 -1
- package/dist/agent/compaction-summary.d.ts +0 -25
- package/dist/agent/compaction-summary.js +0 -20
- package/dist/agent/compaction-summary.js.map +1 -1
- package/dist/agent/confirm-port.d.ts +0 -6
- package/dist/agent/confirm-port.js +0 -11
- package/dist/agent/confirm-port.js.map +1 -1
- package/dist/agent/context/compact-with-summary.d.ts +34 -0
- package/dist/agent/context/compact-with-summary.js +381 -0
- package/dist/agent/context/compact-with-summary.js.map +1 -0
- package/dist/agent/context-breakdown.d.ts +0 -12
- package/dist/agent/context-breakdown.js +0 -16
- package/dist/agent/context-breakdown.js.map +1 -1
- package/dist/agent/context-manager.d.ts +4 -90
- package/dist/agent/context-manager.js +6 -464
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/continue-orient.d.ts +0 -19
- package/dist/agent/continue-orient.js +0 -24
- package/dist/agent/continue-orient.js.map +1 -1
- package/dist/agent/durable-blocks.d.ts +5 -0
- package/dist/agent/durable-blocks.js +16 -0
- package/dist/agent/durable-blocks.js.map +1 -0
- package/dist/agent/durable-envelope.d.ts +0 -2
- package/dist/agent/durable-envelope.js +0 -16
- package/dist/agent/durable-envelope.js.map +1 -1
- package/dist/agent/events.d.ts +6 -17
- package/dist/agent/evidence/task-classification.d.ts +25 -0
- package/dist/agent/evidence/task-classification.js +124 -0
- package/dist/agent/evidence/task-classification.js.map +1 -0
- package/dist/agent/evidence/task-selection.d.ts +29 -0
- package/dist/agent/evidence/task-selection.js +148 -0
- package/dist/agent/evidence/task-selection.js.map +1 -0
- package/dist/agent/evidence/tool-budgets.d.ts +12 -0
- package/dist/agent/evidence/tool-budgets.js +82 -0
- package/dist/agent/evidence/tool-budgets.js.map +1 -0
- package/dist/agent/evidence-governor.d.ts +0 -3
- package/dist/agent/evidence-governor.js.map +1 -1
- package/dist/agent/injected-blocks.d.ts +1 -0
- package/dist/agent/injected-blocks.js +14 -4
- package/dist/agent/injected-blocks.js.map +1 -1
- package/dist/agent/message-slim.d.ts +2 -0
- package/dist/agent/message-slim.js +45 -2
- package/dist/agent/message-slim.js.map +1 -1
- package/dist/agent/outcomes.d.ts +0 -1
- package/dist/agent/outcomes.js +0 -11
- package/dist/agent/outcomes.js.map +1 -1
- package/dist/agent/parser/arg-formatting.d.ts +3 -0
- package/dist/agent/parser/arg-formatting.js +99 -0
- package/dist/agent/parser/arg-formatting.js.map +1 -0
- package/dist/agent/parser/bare-recognition.d.ts +6 -0
- package/dist/agent/parser/bare-recognition.js +106 -0
- package/dist/agent/parser/bare-recognition.js.map +1 -0
- package/dist/agent/parser/parse-entry.d.ts +9 -0
- package/dist/agent/parser/parse-entry.js +198 -0
- package/dist/agent/parser/parse-entry.js.map +1 -0
- package/dist/agent/parser/repetition.d.ts +1 -0
- package/dist/agent/parser/repetition.js +72 -0
- package/dist/agent/parser/repetition.js.map +1 -0
- package/dist/agent/parser/salvage.d.ts +8 -0
- package/dist/agent/parser/salvage.js +100 -0
- package/dist/agent/parser/salvage.js.map +1 -0
- package/dist/agent/parser/vendor-protocols.d.ts +21 -0
- package/dist/agent/parser/vendor-protocols.js +265 -0
- package/dist/agent/parser/vendor-protocols.js.map +1 -0
- package/dist/agent/parser/xml-protocol.d.ts +7 -0
- package/dist/agent/parser/xml-protocol.js +455 -0
- package/dist/agent/parser/xml-protocol.js.map +1 -0
- package/dist/agent/plan/actions/plan-clear.d.ts +4 -0
- package/dist/agent/plan/actions/plan-clear.js +46 -0
- package/dist/agent/plan/actions/plan-clear.js.map +1 -0
- package/dist/agent/plan/actions/plan-create.d.ts +4 -0
- package/dist/agent/plan/actions/plan-create.js +371 -0
- package/dist/agent/plan/actions/plan-create.js.map +1 -0
- package/dist/agent/plan/actions/task-add.d.ts +5 -0
- package/dist/agent/plan/actions/task-add.js +131 -0
- package/dist/agent/plan/actions/task-add.js.map +1 -0
- package/dist/agent/plan/actions/task-move.d.ts +5 -0
- package/dist/agent/plan/actions/task-move.js +72 -0
- package/dist/agent/plan/actions/task-move.js.map +1 -0
- package/dist/agent/plan/context-message.d.ts +2 -0
- package/dist/agent/plan/context-message.js +91 -0
- package/dist/agent/plan/context-message.js.map +1 -0
- package/dist/agent/plan/handle-plan-tool.d.ts +24 -0
- package/dist/agent/plan/handle-plan-tool.js +310 -0
- package/dist/agent/plan/handle-plan-tool.js.map +1 -0
- package/dist/agent/plan/normalization.d.ts +19 -0
- package/dist/agent/plan/normalization.js +175 -0
- package/dist/agent/plan/normalization.js.map +1 -0
- package/dist/agent/plan-implement-compact.d.ts +0 -20
- package/dist/agent/plan-implement-compact.js +0 -21
- package/dist/agent/plan-implement-compact.js.map +1 -1
- package/dist/agent/plan-mode-reminders.d.ts +0 -24
- package/dist/agent/plan-mode-reminders.js +0 -21
- package/dist/agent/plan-mode-reminders.js.map +1 -1
- package/dist/agent/plan-tool.d.ts +5 -60
- package/dist/agent/plan-tool.js +7 -1235
- package/dist/agent/plan-tool.js.map +1 -1
- package/dist/agent/progress-pause-policy.d.ts +0 -1
- package/dist/agent/progress-pause-policy.js +1 -5
- package/dist/agent/progress-pause-policy.js.map +1 -1
- package/dist/agent/progress.d.ts +0 -5
- package/dist/agent/progress.js +0 -14
- package/dist/agent/progress.js.map +1 -1
- package/dist/agent/project-root.d.ts +0 -21
- package/dist/agent/project-root.js +0 -36
- package/dist/agent/project-root.js.map +1 -1
- package/dist/agent/prompt-composer.d.ts +0 -1
- package/dist/agent/prompt-composer.js +0 -2
- package/dist/agent/prompt-composer.js.map +1 -1
- package/dist/agent/reliability-policy.d.ts +0 -38
- package/dist/agent/reliability-policy.js +0 -39
- package/dist/agent/reliability-policy.js.map +1 -1
- package/dist/agent/request-accounting.d.ts +0 -30
- package/dist/agent/request-accounting.js +2 -26
- package/dist/agent/request-accounting.js.map +1 -1
- package/dist/agent/request-budget.d.ts +0 -2
- package/dist/agent/request-budget.js +0 -13
- package/dist/agent/request-budget.js.map +1 -1
- package/dist/agent/responder-context.js +14 -3
- package/dist/agent/responder-context.js.map +1 -1
- package/dist/agent/responder-parent.d.ts +0 -10
- package/dist/agent/responder-parent.js +0 -12
- package/dist/agent/responder-parent.js.map +1 -1
- package/dist/agent/runner.d.ts +0 -30
- package/dist/agent/runner.js +404 -5057
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/scope-context.d.ts +0 -1
- package/dist/agent/scope-context.js +0 -1
- package/dist/agent/scope-context.js.map +1 -1
- package/dist/agent/scratch-write.d.ts +0 -1
- package/dist/agent/scratch-write.js +0 -1
- package/dist/agent/scratch-write.js.map +1 -1
- package/dist/agent/session-policy.d.ts +0 -28
- package/dist/agent/session-policy.js +0 -34
- package/dist/agent/session-policy.js.map +1 -1
- package/dist/agent/session-state.d.ts +0 -38
- package/dist/agent/session-state.js +4 -41
- package/dist/agent/session-state.js.map +1 -1
- package/dist/agent/step-budget.d.ts +0 -4
- package/dist/agent/step-budget.js +0 -4
- package/dist/agent/step-budget.js.map +1 -1
- package/dist/agent/stop-summary.d.ts +0 -5
- package/dist/agent/stop-summary.js +0 -8
- package/dist/agent/stop-summary.js.map +1 -1
- package/dist/agent/stream-recovery.d.ts +1 -54
- package/dist/agent/stream-recovery.js +4 -53
- package/dist/agent/stream-recovery.js.map +1 -1
- package/dist/agent/task-evidence.d.ts +10 -159
- package/dist/agent/task-evidence.js +10 -477
- package/dist/agent/task-evidence.js.map +1 -1
- package/dist/agent/task-plan.d.ts +0 -8
- package/dist/agent/task-plan.js +0 -6
- package/dist/agent/task-plan.js.map +1 -1
- package/dist/agent/task-sync.d.ts +0 -25
- package/dist/agent/task-sync.js +0 -31
- package/dist/agent/task-sync.js.map +1 -1
- package/dist/agent/tool-call-parser.d.ts +10 -205
- package/dist/agent/tool-call-parser.js +13 -1716
- package/dist/agent/tool-call-parser.js.map +1 -1
- package/dist/agent/tool-history-projection.d.ts +7 -0
- package/dist/agent/tool-history-projection.js +455 -0
- package/dist/agent/tool-history-projection.js.map +1 -0
- package/dist/agent/tool-history.d.ts +8 -67
- package/dist/agent/tool-history.js +156 -219
- package/dist/agent/tool-history.js.map +1 -1
- package/dist/agent/tool-output-formatting.d.ts +0 -18
- package/dist/agent/tool-output-formatting.js +0 -28
- package/dist/agent/tool-output-formatting.js.map +1 -1
- package/dist/agent/turn/automatic-compaction-execution.d.ts +14 -0
- package/dist/agent/turn/automatic-compaction-execution.js +19 -0
- package/dist/agent/turn/automatic-compaction-execution.js.map +1 -0
- package/dist/agent/turn/compaction-admission.d.ts +25 -0
- package/dist/agent/turn/compaction-admission.js +40 -0
- package/dist/agent/turn/compaction-admission.js.map +1 -0
- package/dist/agent/turn/compaction-candidate.d.ts +10 -0
- package/dist/agent/turn/compaction-candidate.js +12 -0
- package/dist/agent/turn/compaction-candidate.js.map +1 -0
- package/dist/agent/turn/compaction-coordinator.d.ts +42 -0
- package/dist/agent/turn/compaction-coordinator.js +169 -0
- package/dist/agent/turn/compaction-coordinator.js.map +1 -0
- package/dist/agent/turn/compaction-durable-envelope.d.ts +24 -0
- package/dist/agent/turn/compaction-durable-envelope.js +54 -0
- package/dist/agent/turn/compaction-durable-envelope.js.map +1 -0
- package/dist/agent/turn/compaction-final-fit.d.ts +10 -0
- package/dist/agent/turn/compaction-final-fit.js +14 -0
- package/dist/agent/turn/compaction-final-fit.js.map +1 -0
- package/dist/agent/turn/compaction-messages.d.ts +6 -0
- package/dist/agent/turn/compaction-messages.js +15 -0
- package/dist/agent/turn/compaction-messages.js.map +1 -0
- package/dist/agent/turn/compaction-replay-selection.d.ts +10 -0
- package/dist/agent/turn/compaction-replay-selection.js +27 -0
- package/dist/agent/turn/compaction-replay-selection.js.map +1 -0
- package/dist/agent/turn/compaction-request-estimator.d.ts +7 -0
- package/dist/agent/turn/compaction-request-estimator.js +13 -0
- package/dist/agent/turn/compaction-request-estimator.js.map +1 -0
- package/dist/agent/turn/compaction-summarizer.d.ts +21 -0
- package/dist/agent/turn/compaction-summarizer.js +41 -0
- package/dist/agent/turn/compaction-summarizer.js.map +1 -0
- package/dist/agent/turn/continuation-overlap.d.ts +1 -0
- package/dist/agent/turn/continuation-overlap.js +35 -0
- package/dist/agent/turn/continuation-overlap.js.map +1 -0
- package/dist/agent/turn/contracts.d.ts +25 -0
- package/dist/agent/turn/contracts.js +2 -0
- package/dist/agent/turn/contracts.js.map +1 -0
- package/dist/agent/turn/event-emitter.d.ts +21 -0
- package/dist/agent/turn/event-emitter.js +116 -0
- package/dist/agent/turn/event-emitter.js.map +1 -0
- package/dist/agent/turn/evidence-flags.d.ts +16 -0
- package/dist/agent/turn/evidence-flags.js +44 -0
- package/dist/agent/turn/evidence-flags.js.map +1 -0
- package/dist/agent/turn/finalizer.d.ts +28 -0
- package/dist/agent/turn/finalizer.js +44 -0
- package/dist/agent/turn/finalizer.js.map +1 -0
- package/dist/agent/turn/history-writer.d.ts +17 -0
- package/dist/agent/turn/history-writer.js +72 -0
- package/dist/agent/turn/history-writer.js.map +1 -0
- package/dist/agent/turn/inserted-text.d.ts +1 -0
- package/dist/agent/turn/inserted-text.js +2 -0
- package/dist/agent/turn/inserted-text.js.map +1 -0
- package/dist/agent/turn/loop/answer-assessment.d.ts +22 -0
- package/dist/agent/turn/loop/answer-assessment.js +30 -0
- package/dist/agent/turn/loop/answer-assessment.js.map +1 -0
- package/dist/agent/turn/loop/answer-path.d.ts +20 -0
- package/dist/agent/turn/loop/answer-path.js +92 -0
- package/dist/agent/turn/loop/answer-path.js.map +1 -0
- package/dist/agent/turn/loop/call-binding.d.ts +17 -0
- package/dist/agent/turn/loop/call-binding.js +42 -0
- package/dist/agent/turn/loop/call-binding.js.map +1 -0
- package/dist/agent/turn/loop/canonicalize-turn-call.d.ts +5 -0
- package/dist/agent/turn/loop/canonicalize-turn-call.js +12 -0
- package/dist/agent/turn/loop/canonicalize-turn-call.js.map +1 -0
- package/dist/agent/turn/loop/completion-interpretation.d.ts +34 -0
- package/dist/agent/turn/loop/completion-interpretation.js +71 -0
- package/dist/agent/turn/loop/completion-interpretation.js.map +1 -0
- package/dist/agent/turn/loop/deps.d.ts +98 -0
- package/dist/agent/turn/loop/deps.js +2 -0
- package/dist/agent/turn/loop/deps.js.map +1 -0
- package/dist/agent/turn/loop/empty-response.d.ts +22 -0
- package/dist/agent/turn/loop/empty-response.js +51 -0
- package/dist/agent/turn/loop/empty-response.js.map +1 -0
- package/dist/agent/turn/loop/final-outcome.d.ts +15 -0
- package/dist/agent/turn/loop/final-outcome.js +49 -0
- package/dist/agent/turn/loop/final-outcome.js.map +1 -0
- package/dist/agent/turn/loop/group-execution.d.ts +14 -0
- package/dist/agent/turn/loop/group-execution.js +44 -0
- package/dist/agent/turn/loop/group-execution.js.map +1 -0
- package/dist/agent/turn/loop/model-only-rounds.d.ts +31 -0
- package/dist/agent/turn/loop/model-only-rounds.js +49 -0
- package/dist/agent/turn/loop/model-only-rounds.js.map +1 -0
- package/dist/agent/turn/loop/native-tool-calls.d.ts +12 -0
- package/dist/agent/turn/loop/native-tool-calls.js +57 -0
- package/dist/agent/turn/loop/native-tool-calls.js.map +1 -0
- package/dist/agent/turn/loop/native-write-salvage.d.ts +18 -0
- package/dist/agent/turn/loop/native-write-salvage.js +92 -0
- package/dist/agent/turn/loop/native-write-salvage.js.map +1 -0
- package/dist/agent/turn/loop/output-budget.d.ts +40 -0
- package/dist/agent/turn/loop/output-budget.js +76 -0
- package/dist/agent/turn/loop/output-budget.js.map +1 -0
- package/dist/agent/turn/loop/plan-call-deferral.d.ts +12 -0
- package/dist/agent/turn/loop/plan-call-deferral.js +32 -0
- package/dist/agent/turn/loop/plan-call-deferral.js.map +1 -0
- package/dist/agent/turn/loop/request-assembly.d.ts +32 -0
- package/dist/agent/turn/loop/request-assembly.js +97 -0
- package/dist/agent/turn/loop/request-assembly.js.map +1 -0
- package/dist/agent/turn/loop/round-closeout.d.ts +56 -0
- package/dist/agent/turn/loop/round-closeout.js +77 -0
- package/dist/agent/turn/loop/round-closeout.js.map +1 -0
- package/dist/agent/turn/loop/round-recorder.d.ts +38 -0
- package/dist/agent/turn/loop/round-recorder.js +71 -0
- package/dist/agent/turn/loop/round-recorder.js.map +1 -0
- package/dist/agent/turn/loop/round-request.d.ts +19 -0
- package/dist/agent/turn/loop/round-request.js +169 -0
- package/dist/agent/turn/loop/round-request.js.map +1 -0
- package/dist/agent/turn/loop/round-state.d.ts +11 -0
- package/dist/agent/turn/loop/round-state.js +11 -0
- package/dist/agent/turn/loop/round-state.js.map +1 -0
- package/dist/agent/turn/loop/run-rounds.d.ts +5 -0
- package/dist/agent/turn/loop/run-rounds.js +664 -0
- package/dist/agent/turn/loop/run-rounds.js.map +1 -0
- package/dist/agent/turn/loop/sequence-suppression.d.ts +54 -0
- package/dist/agent/turn/loop/sequence-suppression.js +112 -0
- package/dist/agent/turn/loop/sequence-suppression.js.map +1 -0
- package/dist/agent/turn/loop/state.d.ts +38 -0
- package/dist/agent/turn/loop/state.js +29 -0
- package/dist/agent/turn/loop/state.js.map +1 -0
- package/dist/agent/turn/loop/stream-failure.d.ts +55 -0
- package/dist/agent/turn/loop/stream-failure.js +149 -0
- package/dist/agent/turn/loop/stream-failure.js.map +1 -0
- package/dist/agent/turn/loop/stream-request.d.ts +16 -0
- package/dist/agent/turn/loop/stream-request.js +21 -0
- package/dist/agent/turn/loop/stream-request.js.map +1 -0
- package/dist/agent/turn/loop/stream-session.d.ts +41 -0
- package/dist/agent/turn/loop/stream-session.js +136 -0
- package/dist/agent/turn/loop/stream-session.js.map +1 -0
- package/dist/agent/turn/loop/tool-call-recovery.d.ts +25 -0
- package/dist/agent/turn/loop/tool-call-recovery.js +162 -0
- package/dist/agent/turn/loop/tool-call-recovery.js.map +1 -0
- package/dist/agent/turn/loop/unrun-calls.d.ts +12 -0
- package/dist/agent/turn/loop/unrun-calls.js +27 -0
- package/dist/agent/turn/loop/unrun-calls.js.map +1 -0
- package/dist/agent/turn/loop/wire-occurrences.d.ts +31 -0
- package/dist/agent/turn/loop/wire-occurrences.js +45 -0
- package/dist/agent/turn/loop/wire-occurrences.js.map +1 -0
- package/dist/agent/turn/mcp-agent-tools.d.ts +17 -0
- package/dist/agent/turn/mcp-agent-tools.js +69 -0
- package/dist/agent/turn/mcp-agent-tools.js.map +1 -0
- package/dist/agent/turn/message-assembly.d.ts +14 -0
- package/dist/agent/turn/message-assembly.js +22 -0
- package/dist/agent/turn/message-assembly.js.map +1 -0
- package/dist/agent/turn/outcome-accounting.d.ts +27 -0
- package/dist/agent/turn/outcome-accounting.js +91 -0
- package/dist/agent/turn/outcome-accounting.js.map +1 -0
- package/dist/agent/turn/plan-mode-gate.d.ts +16 -0
- package/dist/agent/turn/plan-mode-gate.js +36 -0
- package/dist/agent/turn/plan-mode-gate.js.map +1 -0
- package/dist/agent/turn/plan-persistence.d.ts +28 -0
- package/dist/agent/turn/plan-persistence.js +56 -0
- package/dist/agent/turn/plan-persistence.js.map +1 -0
- package/dist/agent/turn/prompt-sections.d.ts +9 -0
- package/dist/agent/turn/prompt-sections.js +67 -0
- package/dist/agent/turn/prompt-sections.js.map +1 -0
- package/dist/agent/turn/responder-claims.d.ts +16 -0
- package/dist/agent/turn/responder-claims.js +37 -0
- package/dist/agent/turn/responder-claims.js.map +1 -0
- package/dist/agent/turn/responder-dependency.d.ts +3 -0
- package/dist/agent/turn/responder-dependency.js +36 -0
- package/dist/agent/turn/responder-dependency.js.map +1 -0
- package/dist/agent/turn/responder-inbox.d.ts +28 -0
- package/dist/agent/turn/responder-inbox.js +57 -0
- package/dist/agent/turn/responder-inbox.js.map +1 -0
- package/dist/agent/turn/responder-job-linkage.d.ts +30 -0
- package/dist/agent/turn/responder-job-linkage.js +124 -0
- package/dist/agent/turn/responder-job-linkage.js.map +1 -0
- package/dist/agent/turn/responder-read-tool.d.ts +26 -0
- package/dist/agent/turn/responder-read-tool.js +83 -0
- package/dist/agent/turn/responder-read-tool.js.map +1 -0
- package/dist/agent/turn/scaffold-outcome.d.ts +7 -0
- package/dist/agent/turn/scaffold-outcome.js +93 -0
- package/dist/agent/turn/scaffold-outcome.js.map +1 -0
- package/dist/agent/turn/scaffold-preflight.d.ts +8 -0
- package/dist/agent/turn/scaffold-preflight.js +31 -0
- package/dist/agent/turn/scaffold-preflight.js.map +1 -0
- package/dist/agent/turn/session-state-projection.d.ts +18 -0
- package/dist/agent/turn/session-state-projection.js +46 -0
- package/dist/agent/turn/session-state-projection.js.map +1 -0
- package/dist/agent/turn/setup/compaction-services.d.ts +55 -0
- package/dist/agent/turn/setup/compaction-services.js +69 -0
- package/dist/agent/turn/setup/compaction-services.js.map +1 -0
- package/dist/agent/turn/setup/evidence-rehydration.d.ts +3 -0
- package/dist/agent/turn/setup/evidence-rehydration.js +22 -0
- package/dist/agent/turn/setup/evidence-rehydration.js.map +1 -0
- package/dist/agent/turn/setup/mcp-agent-ports.d.ts +29 -0
- package/dist/agent/turn/setup/mcp-agent-ports.js +26 -0
- package/dist/agent/turn/setup/mcp-agent-ports.js.map +1 -0
- package/dist/agent/turn/setup/prompt-classification.d.ts +10 -0
- package/dist/agent/turn/setup/prompt-classification.js +18 -0
- package/dist/agent/turn/setup/prompt-classification.js.map +1 -0
- package/dist/agent/turn/setup/responder-wake.d.ts +16 -0
- package/dist/agent/turn/setup/responder-wake.js +18 -0
- package/dist/agent/turn/setup/responder-wake.js.map +1 -0
- package/dist/agent/turn/setup/session-state.d.ts +20 -0
- package/dist/agent/turn/setup/session-state.js +23 -0
- package/dist/agent/turn/setup/session-state.js.map +1 -0
- package/dist/agent/turn/setup/task-gate-setup.d.ts +19 -0
- package/dist/agent/turn/setup/task-gate-setup.js +21 -0
- package/dist/agent/turn/setup/task-gate-setup.js.map +1 -0
- package/dist/agent/turn/setup/turn-budget.d.ts +19 -0
- package/dist/agent/turn/setup/turn-budget.js +34 -0
- package/dist/agent/turn/setup/turn-budget.js.map +1 -0
- package/dist/agent/turn/setup/turn-messages.d.ts +25 -0
- package/dist/agent/turn/setup/turn-messages.js +38 -0
- package/dist/agent/turn/setup/turn-messages.js.map +1 -0
- package/dist/agent/turn/setup/turn-state-machine.d.ts +13 -0
- package/dist/agent/turn/setup/turn-state-machine.js +52 -0
- package/dist/agent/turn/setup/turn-state-machine.js.map +1 -0
- package/dist/agent/turn/system-sections.d.ts +36 -0
- package/dist/agent/turn/system-sections.js +157 -0
- package/dist/agent/turn/system-sections.js.map +1 -0
- package/dist/agent/turn/task-autostart.d.ts +12 -0
- package/dist/agent/turn/task-autostart.js +35 -0
- package/dist/agent/turn/task-autostart.js.map +1 -0
- package/dist/agent/turn/task-batch-guard.d.ts +18 -0
- package/dist/agent/turn/task-batch-guard.js +83 -0
- package/dist/agent/turn/task-batch-guard.js.map +1 -0
- package/dist/agent/turn/task-credit.d.ts +15 -0
- package/dist/agent/turn/task-credit.js +49 -0
- package/dist/agent/turn/task-credit.js.map +1 -0
- package/dist/agent/turn/task-gate.d.ts +13 -0
- package/dist/agent/turn/task-gate.js +34 -0
- package/dist/agent/turn/task-gate.js.map +1 -0
- package/dist/agent/turn/task-update-gate.d.ts +13 -0
- package/dist/agent/turn/task-update-gate.js +40 -0
- package/dist/agent/turn/task-update-gate.js.map +1 -0
- package/dist/agent/turn/task-work-signals.d.ts +3 -0
- package/dist/agent/turn/task-work-signals.js +44 -0
- package/dist/agent/turn/task-work-signals.js.map +1 -0
- package/dist/agent/turn/tool-call-preparation.d.ts +20 -0
- package/dist/agent/turn/tool-call-preparation.js +67 -0
- package/dist/agent/turn/tool-call-preparation.js.map +1 -0
- package/dist/agent/turn/tool-evidence-signals.d.ts +22 -0
- package/dist/agent/turn/tool-evidence-signals.js +101 -0
- package/dist/agent/turn/tool-evidence-signals.js.map +1 -0
- package/dist/agent/turn/tool-execution/authorization.d.ts +32 -0
- package/dist/agent/turn/tool-execution/authorization.js +100 -0
- package/dist/agent/turn/tool-execution/authorization.js.map +1 -0
- package/dist/agent/turn/tool-execution/deps.d.ts +74 -0
- package/dist/agent/turn/tool-execution/deps.js +2 -0
- package/dist/agent/turn/tool-execution/deps.js.map +1 -0
- package/dist/agent/turn/tool-execution/dispatch.d.ts +27 -0
- package/dist/agent/turn/tool-execution/dispatch.js +76 -0
- package/dist/agent/turn/tool-execution/dispatch.js.map +1 -0
- package/dist/agent/turn/tool-execution/engagement-checkpoint.d.ts +7 -0
- package/dist/agent/turn/tool-execution/engagement-checkpoint.js +32 -0
- package/dist/agent/turn/tool-execution/engagement-checkpoint.js.map +1 -0
- package/dist/agent/turn/tool-execution/engagement-gate.d.ts +16 -0
- package/dist/agent/turn/tool-execution/engagement-gate.js +55 -0
- package/dist/agent/turn/tool-execution/engagement-gate.js.map +1 -0
- package/dist/agent/turn/tool-execution/gates.d.ts +21 -0
- package/dist/agent/turn/tool-execution/gates.js +45 -0
- package/dist/agent/turn/tool-execution/gates.js.map +1 -0
- package/dist/agent/turn/tool-execution/guards.d.ts +42 -0
- package/dist/agent/turn/tool-execution/guards.js +62 -0
- package/dist/agent/turn/tool-execution/guards.js.map +1 -0
- package/dist/agent/turn/tool-execution/meta-tools.d.ts +50 -0
- package/dist/agent/turn/tool-execution/meta-tools.js +114 -0
- package/dist/agent/turn/tool-execution/meta-tools.js.map +1 -0
- package/dist/agent/turn/tool-execution/plan-tool-ledger.d.ts +10 -0
- package/dist/agent/turn/tool-execution/plan-tool-ledger.js +50 -0
- package/dist/agent/turn/tool-execution/plan-tool-ledger.js.map +1 -0
- package/dist/agent/turn/tool-execution/result-framing.d.ts +36 -0
- package/dist/agent/turn/tool-execution/result-framing.js +54 -0
- package/dist/agent/turn/tool-execution/result-framing.js.map +1 -0
- package/dist/agent/turn/tool-execution/run-setup.d.ts +29 -0
- package/dist/agent/turn/tool-execution/run-setup.js +64 -0
- package/dist/agent/turn/tool-execution/run-setup.js.map +1 -0
- package/dist/agent/turn/tool-execution/single-tool.d.ts +4 -0
- package/dist/agent/turn/tool-execution/single-tool.js +613 -0
- package/dist/agent/turn/tool-execution/single-tool.js.map +1 -0
- package/dist/agent/turn/tool-execution/state.d.ts +19 -0
- package/dist/agent/turn/tool-execution/state.js +13 -0
- package/dist/agent/turn/tool-execution/state.js.map +1 -0
- package/dist/agent/turn/tool-execution/supervision.d.ts +20 -0
- package/dist/agent/turn/tool-execution/supervision.js +44 -0
- package/dist/agent/turn/tool-execution/supervision.js.map +1 -0
- package/dist/agent/turn/tool-result-recorder.d.ts +26 -0
- package/dist/agent/turn/tool-result-recorder.js +54 -0
- package/dist/agent/turn/tool-result-recorder.js.map +1 -0
- package/dist/agent/turn/tool-routing.d.ts +23 -0
- package/dist/agent/turn/tool-routing.js +58 -0
- package/dist/agent/turn/tool-routing.js.map +1 -0
- package/dist/agent/turn/tool-watchdog.d.ts +22 -0
- package/dist/agent/turn/tool-watchdog.js +135 -0
- package/dist/agent/turn/tool-watchdog.js.map +1 -0
- package/dist/agent/turn/turn-counters.d.ts +9 -0
- package/dist/agent/turn/turn-counters.js +13 -0
- package/dist/agent/turn/turn-counters.js.map +1 -0
- package/dist/agent/turn/workspace-setup.d.ts +29 -0
- package/dist/agent/turn/workspace-setup.js +74 -0
- package/dist/agent/turn/workspace-setup.js.map +1 -0
- package/dist/agent/workspace-orient.d.ts +0 -45
- package/dist/agent/workspace-orient.js +3 -69
- package/dist/agent/workspace-orient.js.map +1 -1
- package/dist/app/adapters/agent-event-adapter.d.ts +0 -1
- package/dist/app/adapters/agent-event-adapter.js +1 -4
- package/dist/app/adapters/agent-event-adapter.js.map +1 -1
- package/dist/app/adapters/current-interactive-sessions-adapter.d.ts +0 -1
- package/dist/app/adapters/current-interactive-sessions-adapter.js +0 -1
- package/dist/app/adapters/current-interactive-sessions-adapter.js.map +1 -1
- package/dist/app/adapters/current-jobs-adapter.d.ts +0 -1
- package/dist/app/adapters/current-jobs-adapter.js +0 -1
- package/dist/app/adapters/current-jobs-adapter.js.map +1 -1
- package/dist/app/adapters/current-store-adapter.d.ts +0 -1
- package/dist/app/adapters/current-store-adapter.js +0 -1
- package/dist/app/adapters/current-store-adapter.js.map +1 -1
- package/dist/app/adapters/quiet-meta-tools.d.ts +0 -11
- package/dist/app/adapters/quiet-meta-tools.js +0 -11
- package/dist/app/adapters/quiet-meta-tools.js.map +1 -1
- package/dist/app/commands/catalog.d.ts +0 -8
- package/dist/app/commands/catalog.js +10 -32
- package/dist/app/commands/catalog.js.map +1 -1
- package/dist/app/commands/command.d.ts +0 -4
- package/dist/app/commands/command.js.map +1 -1
- package/dist/app/commands/registry.d.ts +0 -3
- package/dist/app/commands/registry.js +1 -7
- package/dist/app/commands/registry.js.map +1 -1
- package/dist/app/confirm-prompt-text.d.ts +0 -6
- package/dist/app/confirm-prompt-text.js +0 -6
- package/dist/app/confirm-prompt-text.js.map +1 -1
- package/dist/app/controllers/cancel-all-result.d.ts +0 -5
- package/dist/app/controllers/cancel-all-result.js +0 -5
- package/dist/app/controllers/cancel-all-result.js.map +1 -1
- package/dist/app/controllers/plan-controller.d.ts +0 -6
- package/dist/app/controllers/plan-controller.js +0 -11
- package/dist/app/controllers/plan-controller.js.map +1 -1
- package/dist/app/controllers/session-compact-helper.d.ts +0 -9
- package/dist/app/controllers/session-compact-helper.js +14 -21
- package/dist/app/controllers/session-compact-helper.js.map +1 -1
- package/dist/app/controllers/session-context-usage.d.ts +0 -11
- package/dist/app/controllers/session-context-usage.js +22 -30
- package/dist/app/controllers/session-context-usage.js.map +1 -1
- package/dist/app/controllers/session-controller.d.ts +1 -38
- package/dist/app/controllers/session-controller.js +11 -49
- package/dist/app/controllers/session-controller.js.map +1 -1
- package/dist/app/controllers/session-naming.d.ts +0 -4
- package/dist/app/controllers/session-naming.js +0 -4
- package/dist/app/controllers/session-naming.js.map +1 -1
- package/dist/app/controllers/session-persistence.d.ts +0 -6
- package/dist/app/controllers/session-persistence.js +0 -10
- package/dist/app/controllers/session-persistence.js.map +1 -1
- package/dist/app/controllers/session-responder.js +0 -4
- package/dist/app/controllers/session-responder.js.map +1 -1
- package/dist/app/controllers/session-turn-request.d.ts +0 -1
- package/dist/app/controllers/session-turn-request.js +0 -1
- package/dist/app/controllers/session-turn-request.js.map +1 -1
- package/dist/app/controllers/session-usage-ledger.d.ts +6 -1
- package/dist/app/controllers/session-usage-ledger.js +43 -3
- package/dist/app/controllers/session-usage-ledger.js.map +1 -1
- package/dist/app/controllers/turn-controller.js +2 -6
- package/dist/app/controllers/turn-controller.js.map +1 -1
- package/dist/app/events/app-event.d.ts +1 -11
- package/dist/app/events/app-event.js +0 -1
- package/dist/app/events/app-event.js.map +1 -1
- package/dist/app/events/event-buffer.d.ts +0 -6
- package/dist/app/events/event-buffer.js +0 -6
- package/dist/app/events/event-buffer.js.map +1 -1
- package/dist/app/events/sequencer.d.ts +0 -2
- package/dist/app/events/sequencer.js +0 -1
- package/dist/app/events/sequencer.js.map +1 -1
- package/dist/app/ports/agent-port.d.ts +0 -19
- package/dist/app/ports/interactive-sessions-port.d.ts +0 -13
- package/dist/app/ports/interactive-sessions-port.js +0 -7
- package/dist/app/ports/interactive-sessions-port.js.map +1 -1
- package/dist/app/ports/persistence-port.d.ts +0 -14
- package/dist/app/ports/updates-port.d.ts +0 -5
- package/dist/classic/app/ClassicApp.js +0 -2
- package/dist/classic/app/ClassicApp.js.map +1 -1
- package/dist/classic/app/action-handlers.js +0 -4
- package/dist/classic/app/action-handlers.js.map +1 -1
- package/dist/classic/app/git-branch.js +0 -1
- package/dist/classic/app/git-branch.js.map +1 -1
- package/dist/classic/app/use-feed.d.ts +0 -7
- package/dist/classic/app/use-feed.js +0 -5
- package/dist/classic/app/use-feed.js.map +1 -1
- package/dist/classic/app/wiring-interactions.js +0 -2
- package/dist/classic/app/wiring-interactions.js.map +1 -1
- package/dist/classic/blocks/assistant-lines.d.ts +0 -1
- package/dist/classic/blocks/assistant-lines.js +0 -1
- package/dist/classic/blocks/assistant-lines.js.map +1 -1
- package/dist/classic/blocks/batch-lines.d.ts +0 -1
- package/dist/classic/blocks/batch-lines.js +0 -1
- package/dist/classic/blocks/batch-lines.js.map +1 -1
- package/dist/classic/blocks/block-context.d.ts +0 -7
- package/dist/classic/blocks/block-context.js +0 -1
- package/dist/classic/blocks/block-context.js.map +1 -1
- package/dist/classic/blocks/compacted-lines.d.ts +0 -1
- package/dist/classic/blocks/compacted-lines.js +0 -1
- package/dist/classic/blocks/compacted-lines.js.map +1 -1
- package/dist/classic/blocks/diff-lines.d.ts +0 -3
- package/dist/classic/blocks/diff-lines.js +0 -4
- package/dist/classic/blocks/diff-lines.js.map +1 -1
- package/dist/classic/blocks/intro-lines.d.ts +0 -5
- package/dist/classic/blocks/intro-lines.js +0 -5
- package/dist/classic/blocks/intro-lines.js.map +1 -1
- package/dist/classic/blocks/notice-lines.d.ts +0 -4
- package/dist/classic/blocks/notice-lines.js +0 -6
- package/dist/classic/blocks/notice-lines.js.map +1 -1
- package/dist/classic/blocks/thinking-lines.d.ts +0 -1
- package/dist/classic/blocks/thinking-lines.js +0 -1
- package/dist/classic/blocks/thinking-lines.js.map +1 -1
- package/dist/classic/blocks/tool-lines.d.ts +0 -7
- package/dist/classic/blocks/tool-lines.js +0 -10
- package/dist/classic/blocks/tool-lines.js.map +1 -1
- package/dist/classic/blocks/user-lines.d.ts +0 -1
- package/dist/classic/blocks/user-lines.js +0 -1
- package/dist/classic/blocks/user-lines.js.map +1 -1
- package/dist/classic/bootstrap/osc52-renderer.js +0 -1
- package/dist/classic/bootstrap/osc52-renderer.js.map +1 -1
- package/dist/classic/chrome/Chrome.d.ts +0 -1
- package/dist/classic/chrome/Chrome.js.map +1 -1
- package/dist/classic/chrome/Composer.d.ts +0 -5
- package/dist/classic/chrome/Composer.js +0 -5
- package/dist/classic/chrome/Composer.js.map +1 -1
- package/dist/classic/chrome/composer-controller.js +0 -4
- package/dist/classic/chrome/composer-controller.js.map +1 -1
- package/dist/classic/chrome/composer-frame.d.ts +0 -3
- package/dist/classic/chrome/composer-frame.js +0 -3
- package/dist/classic/chrome/composer-frame.js.map +1 -1
- package/dist/classic/chrome/directory-row.d.ts +0 -7
- package/dist/classic/chrome/directory-row.js +0 -7
- package/dist/classic/chrome/directory-row.js.map +1 -1
- package/dist/classic/chrome/row-budget.d.ts +0 -2
- package/dist/classic/chrome/row-budget.js +0 -8
- package/dist/classic/chrome/row-budget.js.map +1 -1
- package/dist/classic/chrome/status-rows.d.ts +0 -12
- package/dist/classic/chrome/status-rows.js +0 -16
- package/dist/classic/chrome/status-rows.js.map +1 -1
- package/dist/classic/chrome/toast-rows.d.ts +0 -4
- package/dist/classic/chrome/toast-rows.js +0 -9
- package/dist/classic/chrome/toast-rows.js.map +1 -1
- package/dist/classic/feed/Feed.d.ts +0 -5
- package/dist/classic/feed/Feed.js +0 -4
- package/dist/classic/feed/Feed.js.map +1 -1
- package/dist/classic/feed/FeedStatic.d.ts +0 -8
- package/dist/classic/feed/FeedStatic.js +0 -8
- package/dist/classic/feed/FeedStatic.js.map +1 -1
- package/dist/classic/feed/ScrollbarGutter.js +0 -1
- package/dist/classic/feed/ScrollbarGutter.js.map +1 -1
- package/dist/classic/feed/block-height.d.ts +0 -7
- package/dist/classic/feed/block-height.js +0 -7
- package/dist/classic/feed/block-height.js.map +1 -1
- package/dist/classic/feed/commit-ledger.d.ts +0 -12
- package/dist/classic/feed/commit-ledger.js +0 -10
- package/dist/classic/feed/commit-ledger.js.map +1 -1
- package/dist/classic/feed/feed-blocks.d.ts +0 -8
- package/dist/classic/feed/feed-blocks.js +0 -6
- package/dist/classic/feed/feed-blocks.js.map +1 -1
- package/dist/classic/feed/live-tail-policy.d.ts +0 -13
- package/dist/classic/feed/live-tail-policy.js +0 -11
- package/dist/classic/feed/live-tail-policy.js.map +1 -1
- package/dist/classic/feed/scrollbar-rows.d.ts +0 -1
- package/dist/classic/feed/scrollbar-rows.js +0 -1
- package/dist/classic/feed/scrollbar-rows.js.map +1 -1
- package/dist/classic/feed/transcript-window.d.ts +0 -10
- package/dist/classic/feed/transcript-window.js +0 -6
- package/dist/classic/feed/transcript-window.js.map +1 -1
- package/dist/classic/input/input-router.js +0 -2
- package/dist/classic/input/input-router.js.map +1 -1
- package/dist/classic/panels/completion-rows.js +2 -1
- package/dist/classic/panels/completion-rows.js.map +1 -1
- package/dist/classic/panels/keys-panel.d.ts +0 -1
- package/dist/classic/panels/keys-panel.js +0 -1
- package/dist/classic/panels/keys-panel.js.map +1 -1
- package/dist/classic/panels/pager-panel.d.ts +0 -5
- package/dist/classic/panels/pager-panel.js +0 -11
- package/dist/classic/panels/pager-panel.js.map +1 -1
- package/dist/classic/panels/panel-controller.d.ts +0 -2
- package/dist/classic/panels/panel-controller.js +0 -2
- package/dist/classic/panels/panel-controller.js.map +1 -1
- package/dist/classic/panels/panel-frame.js +0 -2
- package/dist/classic/panels/panel-frame.js.map +1 -1
- package/dist/classic/panels/panel-wheel.d.ts +0 -5
- package/dist/classic/panels/panel-wheel.js +0 -5
- package/dist/classic/panels/panel-wheel.js.map +1 -1
- package/dist/classic/panels/secret-panel.d.ts +0 -1
- package/dist/classic/panels/secret-panel.js +0 -1
- package/dist/classic/panels/secret-panel.js.map +1 -1
- package/dist/classic/panels/text-editor-panel.d.ts +0 -1
- package/dist/classic/panels/text-editor-panel.js +0 -1
- package/dist/classic/panels/text-editor-panel.js.map +1 -1
- package/dist/classic/render/ansi-text.d.ts +0 -19
- package/dist/classic/render/ansi-text.js +0 -19
- package/dist/classic/render/ansi-text.js.map +1 -1
- package/dist/classic/render/glyphs.d.ts +0 -4
- package/dist/classic/render/glyphs.js +0 -4
- package/dist/classic/render/glyphs.js.map +1 -1
- package/dist/classic/render/ink-theme.d.ts +0 -10
- package/dist/classic/render/ink-theme.js +0 -6
- package/dist/classic/render/ink-theme.js.map +1 -1
- package/dist/classic/render/measure.d.ts +0 -12
- package/dist/classic/render/measure.js +0 -12
- package/dist/classic/render/measure.js.map +1 -1
- package/dist/classic/render/shell-width.d.ts +0 -8
- package/dist/classic/render/shell-width.js +0 -8
- package/dist/classic/render/shell-width.js.map +1 -1
- package/dist/classic/render/wrap.d.ts +0 -11
- package/dist/classic/render/wrap.js +0 -8
- package/dist/classic/render/wrap.js.map +1 -1
- package/dist/commands/doctor.js +0 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/providers.d.ts +0 -1
- package/dist/commands/providers.js +0 -22
- package/dist/commands/providers.js.map +1 -1
- package/dist/commands/search-providers.d.ts +0 -1
- package/dist/commands/search-providers.js +0 -4
- package/dist/commands/search-providers.js.map +1 -1
- package/dist/commands/update/installers.d.ts +61 -0
- package/dist/commands/update/installers.js +505 -0
- package/dist/commands/update/installers.js.map +1 -0
- package/dist/commands/update-install.d.ts +4 -65
- package/dist/commands/update-install.js +6 -506
- package/dist/commands/update-install.js.map +1 -1
- package/dist/commands/update.d.ts +0 -6
- package/dist/commands/update.js +1 -11
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +3 -10
- package/dist/index.js.map +1 -1
- package/dist/interactive-session/artifact-writer.d.ts +0 -1
- package/dist/interactive-session/artifact-writer.js +0 -1
- package/dist/interactive-session/artifact-writer.js.map +1 -1
- package/dist/interactive-session/cleanup.d.ts +0 -10
- package/dist/interactive-session/cleanup.js +0 -13
- package/dist/interactive-session/cleanup.js.map +1 -1
- package/dist/interactive-session/config.d.ts +0 -16
- package/dist/interactive-session/config.js +0 -13
- package/dist/interactive-session/config.js.map +1 -1
- package/dist/interactive-session/manager.d.ts +0 -27
- package/dist/interactive-session/manager.js +0 -42
- package/dist/interactive-session/manager.js.map +1 -1
- package/dist/interactive-session/output-store.d.ts +0 -6
- package/dist/interactive-session/output-store.js +0 -5
- package/dist/interactive-session/output-store.js.map +1 -1
- package/dist/interactive-session/output-view.d.ts +0 -4
- package/dist/interactive-session/output-view.js +0 -12
- package/dist/interactive-session/output-view.js.map +1 -1
- package/dist/interactive-session/recovery-journal.d.ts +0 -7
- package/dist/interactive-session/recovery-journal.js +0 -7
- package/dist/interactive-session/recovery-journal.js.map +1 -1
- package/dist/interactive-session/registry.d.ts +0 -25
- package/dist/interactive-session/registry.js +0 -27
- package/dist/interactive-session/registry.js.map +1 -1
- package/dist/interactive-session/runtime.d.ts +0 -30
- package/dist/interactive-session/runtime.js +0 -23
- package/dist/interactive-session/runtime.js.map +1 -1
- package/dist/interactive-session/session-runtime.d.ts +0 -9
- package/dist/interactive-session/session-runtime.js +0 -10
- package/dist/interactive-session/session-runtime.js.map +1 -1
- package/dist/interactive-session/streaming-redactor.d.ts +0 -14
- package/dist/interactive-session/streaming-redactor.js +0 -18
- package/dist/interactive-session/streaming-redactor.js.map +1 -1
- package/dist/interactive-session/telemetry.d.ts +0 -8
- package/dist/interactive-session/telemetry.js +0 -7
- package/dist/interactive-session/telemetry.js.map +1 -1
- package/dist/interactive-session/transport-factory.d.ts +0 -5
- package/dist/interactive-session/transport-factory.js +0 -5
- package/dist/interactive-session/transport-factory.js.map +1 -1
- package/dist/interactive-session/transport-pipe.d.ts +0 -7
- package/dist/interactive-session/transport-pipe.js +0 -14
- package/dist/interactive-session/transport-pipe.js.map +1 -1
- package/dist/interactive-session/transport.d.ts +0 -26
- package/dist/interactive-session/transport.js +0 -20
- package/dist/interactive-session/transport.js.map +1 -1
- package/dist/interactive-session/types.d.ts +0 -19
- package/dist/interactive-session/types.js +0 -22
- package/dist/interactive-session/types.js.map +1 -1
- package/dist/llm/adapters/anthropic-stream-events.d.ts +38 -0
- package/dist/llm/adapters/anthropic-stream-events.js +144 -0
- package/dist/llm/adapters/anthropic-stream-events.js.map +1 -0
- package/dist/llm/adapters/anthropic-tools.d.ts +5 -55
- package/dist/llm/adapters/anthropic-tools.js +6 -208
- package/dist/llm/adapters/anthropic-tools.js.map +1 -1
- package/dist/llm/adapters/anthropic-wire-blocks.d.ts +9 -0
- package/dist/llm/adapters/anthropic-wire-blocks.js +59 -0
- package/dist/llm/adapters/anthropic-wire-blocks.js.map +1 -0
- package/dist/llm/adapters/gemini-tools.d.ts +0 -6
- package/dist/llm/adapters/gemini-tools.js +0 -24
- package/dist/llm/adapters/gemini-tools.js.map +1 -1
- package/dist/llm/adapters/ollama-tools.js +0 -5
- package/dist/llm/adapters/ollama-tools.js.map +1 -1
- package/dist/llm/adapters/openai-tools.d.ts +0 -4
- package/dist/llm/adapters/openai-tools.js +2 -11
- package/dist/llm/adapters/openai-tools.js.map +1 -1
- package/dist/llm/agentrouter.d.ts +0 -9
- package/dist/llm/agentrouter.js +10 -60
- package/dist/llm/agentrouter.js.map +1 -1
- package/dist/llm/anthropic.d.ts +0 -7
- package/dist/llm/anthropic.js +2 -30
- package/dist/llm/anthropic.js.map +1 -1
- package/dist/llm/artifacts/legacy-blocks.d.ts +3 -0
- package/dist/llm/artifacts/legacy-blocks.js +109 -0
- package/dist/llm/artifacts/legacy-blocks.js.map +1 -0
- package/dist/llm/artifacts/replay-selection.d.ts +9 -0
- package/dist/llm/artifacts/replay-selection.js +48 -0
- package/dist/llm/artifacts/replay-selection.js.map +1 -0
- package/dist/llm/aws-mantle.js +2 -4
- package/dist/llm/aws-mantle.js.map +1 -1
- package/dist/llm/bynara.js +2 -0
- package/dist/llm/bynara.js.map +1 -1
- package/dist/llm/cache-affinity.d.ts +1 -0
- package/dist/llm/cache-affinity.js +6 -0
- package/dist/llm/cache-affinity.js.map +1 -1
- package/dist/llm/capabilities.d.ts +7 -36
- package/dist/llm/capabilities.js +11 -502
- package/dist/llm/capabilities.js.map +1 -1
- package/dist/llm/capability/state.d.ts +25 -0
- package/dist/llm/capability/state.js +125 -0
- package/dist/llm/capability/state.js.map +1 -0
- package/dist/llm/capability/tool-dialect.d.ts +3 -0
- package/dist/llm/capability/tool-dialect.js +78 -0
- package/dist/llm/capability/tool-dialect.js.map +1 -0
- package/dist/llm/capability/vision-patterns.d.ts +4 -0
- package/dist/llm/capability/vision-patterns.js +188 -0
- package/dist/llm/capability/vision-patterns.js.map +1 -0
- package/dist/llm/capability/vision-registry.d.ts +20 -0
- package/dist/llm/capability/vision-registry.js +112 -0
- package/dist/llm/capability/vision-registry.js.map +1 -0
- package/dist/llm/context-snapshot.d.ts +0 -18
- package/dist/llm/context-snapshot.js +1 -8
- package/dist/llm/context-snapshot.js.map +1 -1
- package/dist/llm/context-windows.d.ts +0 -6
- package/dist/llm/context-windows.js +0 -30
- package/dist/llm/context-windows.js.map +1 -1
- package/dist/llm/custom-provider-profile.d.ts +4 -23
- package/dist/llm/custom-provider-profile.js +4 -515
- package/dist/llm/custom-provider-profile.js.map +1 -1
- package/dist/llm/custom-providers.d.ts +0 -23
- package/dist/llm/custom-providers.js +2 -27
- package/dist/llm/custom-providers.js.map +1 -1
- package/dist/llm/effort-fallback.d.ts +0 -38
- package/dist/llm/effort-fallback.js +0 -38
- package/dist/llm/effort-fallback.js.map +1 -1
- package/dist/llm/fireworks.js +2 -0
- package/dist/llm/fireworks.js.map +1 -1
- package/dist/llm/free.js +7 -2
- package/dist/llm/free.js.map +1 -1
- package/dist/llm/gemini.d.ts +0 -1
- package/dist/llm/gemini.js +2 -19
- package/dist/llm/gemini.js.map +1 -1
- package/dist/llm/hetzner.js +2 -0
- package/dist/llm/hetzner.js.map +1 -1
- package/dist/llm/http.d.ts +24 -251
- package/dist/llm/http.js +19 -2021
- package/dist/llm/http.js.map +1 -1
- package/dist/llm/key-rotation.d.ts +0 -32
- package/dist/llm/key-rotation.js +6 -37
- package/dist/llm/key-rotation.js.map +1 -1
- package/dist/llm/lightning.d.ts +0 -8
- package/dist/llm/lightning.js +3 -18
- package/dist/llm/lightning.js.map +1 -1
- package/dist/llm/merge-gateway.d.ts +0 -9
- package/dist/llm/merge-gateway.js +2 -44
- package/dist/llm/merge-gateway.js.map +1 -1
- package/dist/llm/modal.js +3 -15
- package/dist/llm/modal.js.map +1 -1
- package/dist/llm/model-families.d.ts +0 -5
- package/dist/llm/model-families.js +0 -5
- package/dist/llm/model-families.js.map +1 -1
- package/dist/llm/model-layers/model-patterns.d.ts +7 -0
- package/dist/llm/model-layers/model-patterns.js +30 -0
- package/dist/llm/model-layers/model-patterns.js.map +1 -0
- package/dist/llm/model-layers/model-rules.d.ts +8 -0
- package/dist/llm/model-layers/model-rules.js +221 -0
- package/dist/llm/model-layers/model-rules.js.map +1 -0
- package/dist/llm/model-layers/nvidia-layer.d.ts +2 -0
- package/dist/llm/model-layers/nvidia-layer.js +135 -0
- package/dist/llm/model-layers/nvidia-layer.js.map +1 -0
- package/dist/llm/nvidia.js +3 -11
- package/dist/llm/nvidia.js.map +1 -1
- package/dist/llm/ollama.js +2 -11
- package/dist/llm/ollama.js.map +1 -1
- package/dist/llm/openai.js +2 -0
- package/dist/llm/openai.js.map +1 -1
- package/dist/llm/openrouter.js +3 -1
- package/dist/llm/openrouter.js.map +1 -1
- package/dist/llm/operation-ledger.d.ts +0 -6
- package/dist/llm/operation-ledger.js +0 -6
- package/dist/llm/operation-ledger.js.map +1 -1
- package/dist/llm/operation-usage.d.ts +2 -0
- package/dist/llm/operation-usage.js +27 -0
- package/dist/llm/operation-usage.js.map +1 -1
- package/dist/llm/orcarouter.d.ts +0 -4
- package/dist/llm/orcarouter.js +3 -26
- package/dist/llm/orcarouter.js.map +1 -1
- package/dist/llm/profile/control-rejections.d.ts +14 -0
- package/dist/llm/profile/control-rejections.js +75 -0
- package/dist/llm/profile/control-rejections.js.map +1 -0
- package/dist/llm/profile/custom-layer.d.ts +3 -0
- package/dist/llm/profile/custom-layer.js +83 -0
- package/dist/llm/profile/custom-layer.js.map +1 -0
- package/dist/llm/profile/layer-merge.d.ts +3 -0
- package/dist/llm/profile/layer-merge.js +185 -0
- package/dist/llm/profile/layer-merge.js.map +1 -0
- package/dist/llm/profile/spec-validation.d.ts +5 -0
- package/dist/llm/profile/spec-validation.js +289 -0
- package/dist/llm/profile/spec-validation.js.map +1 -0
- package/dist/llm/profile/spec-vocabulary.d.ts +21 -0
- package/dist/llm/profile/spec-vocabulary.js +142 -0
- package/dist/llm/profile/spec-vocabulary.js.map +1 -0
- package/dist/llm/provider-identity.d.ts +5 -0
- package/dist/llm/provider-identity.js +130 -0
- package/dist/llm/provider-identity.js.map +1 -0
- package/dist/llm/provider-info-text.d.ts +1 -0
- package/dist/llm/provider-info-text.js +587 -0
- package/dist/llm/provider-info-text.js.map +1 -0
- package/dist/llm/provider-model-layers.d.ts +2 -0
- package/dist/llm/provider-model-layers.js +6 -380
- package/dist/llm/provider-model-layers.js.map +1 -1
- package/dist/llm/provider-profile-layers.js +0 -2
- package/dist/llm/provider-profile-layers.js.map +1 -1
- package/dist/llm/provider-profile.d.ts +10 -12
- package/dist/llm/provider-profile.js +6 -265
- package/dist/llm/provider-profile.js.map +1 -1
- package/dist/llm/provider.d.ts +4 -16
- package/dist/llm/provider.js +6 -760
- package/dist/llm/provider.js.map +1 -1
- package/dist/llm/qwen-cloud.js +2 -4
- package/dist/llm/qwen-cloud.js.map +1 -1
- package/dist/llm/reasoning-artifacts.d.ts +5 -50
- package/dist/llm/reasoning-artifacts.js +11 -198
- package/dist/llm/reasoning-artifacts.js.map +1 -1
- package/dist/llm/reasoning-capability.js +0 -16
- package/dist/llm/reasoning-capability.js.map +1 -1
- package/dist/llm/request-fingerprint.d.ts +0 -4
- package/dist/llm/request-fingerprint.js +0 -4
- package/dist/llm/request-fingerprint.js.map +1 -1
- package/dist/llm/request-plan.d.ts +0 -14
- package/dist/llm/request-plan.js +0 -23
- package/dist/llm/request-plan.js.map +1 -1
- package/dist/llm/responses/item-events.d.ts +3 -0
- package/dist/llm/responses/item-events.js +93 -0
- package/dist/llm/responses/item-events.js.map +1 -0
- package/dist/llm/responses-complete.d.ts +1 -1
- package/dist/llm/responses-complete.js +2 -1
- package/dist/llm/responses-complete.js.map +1 -1
- package/dist/llm/responses-config.js.map +1 -1
- package/dist/llm/responses-http.d.ts +1 -0
- package/dist/llm/responses-http.js +3 -1
- package/dist/llm/responses-http.js.map +1 -1
- package/dist/llm/responses-parse.d.ts +3 -0
- package/dist/llm/responses-parse.js +19 -6
- package/dist/llm/responses-parse.js.map +1 -1
- package/dist/llm/responses-request.d.ts +2 -1
- package/dist/llm/responses-request.js +7 -2
- package/dist/llm/responses-request.js.map +1 -1
- package/dist/llm/responses-shape.d.ts +5 -0
- package/dist/llm/responses-shape.js +16 -0
- package/dist/llm/responses-shape.js.map +1 -0
- package/dist/llm/responses-stream-accumulator.d.ts +1 -1
- package/dist/llm/responses-stream-accumulator.js +8 -9
- package/dist/llm/responses-stream-accumulator.js.map +1 -1
- package/dist/llm/responses-stream-events.d.ts +2 -0
- package/dist/llm/responses-stream-events.js +34 -102
- package/dist/llm/responses-stream-events.js.map +1 -1
- package/dist/llm/responses-stream-watchdog.js.map +1 -1
- package/dist/llm/responses-stream.js +9 -4
- package/dist/llm/responses-stream.js.map +1 -1
- package/dist/llm/router.d.ts +7 -44
- package/dist/llm/router.js +24 -1145
- package/dist/llm/router.js.map +1 -1
- package/dist/llm/routing/attempt-complete.d.ts +3 -0
- package/dist/llm/routing/attempt-complete.js +120 -0
- package/dist/llm/routing/attempt-complete.js.map +1 -0
- package/dist/llm/routing/attempt-request.d.ts +21 -0
- package/dist/llm/routing/attempt-request.js +99 -0
- package/dist/llm/routing/attempt-request.js.map +1 -0
- package/dist/llm/routing/attempt-stream.d.ts +3 -0
- package/dist/llm/routing/attempt-stream.js +256 -0
- package/dist/llm/routing/attempt-stream.js.map +1 -0
- package/dist/llm/routing/error-classification.d.ts +15 -0
- package/dist/llm/routing/error-classification.js +151 -0
- package/dist/llm/routing/error-classification.js.map +1 -0
- package/dist/llm/routing/failure-report.d.ts +22 -0
- package/dist/llm/routing/failure-report.js +128 -0
- package/dist/llm/routing/failure-report.js.map +1 -0
- package/dist/llm/routing/key-rotation.d.ts +21 -0
- package/dist/llm/routing/key-rotation.js +207 -0
- package/dist/llm/routing/key-rotation.js.map +1 -0
- package/dist/llm/routing/provider-selection.d.ts +8 -0
- package/dist/llm/routing/provider-selection.js +119 -0
- package/dist/llm/routing/provider-selection.js.map +1 -0
- package/dist/llm/sampling.d.ts +0 -15
- package/dist/llm/sampling.js +0 -9
- package/dist/llm/sampling.js.map +1 -1
- package/dist/llm/session-affinity.d.ts +2 -0
- package/dist/llm/session-affinity.js +9 -0
- package/dist/llm/session-affinity.js.map +1 -0
- package/dist/llm/stream-progress.d.ts +0 -1
- package/dist/llm/stream-progress.js +0 -15
- package/dist/llm/stream-progress.js.map +1 -1
- package/dist/llm/system-messages.d.ts +0 -22
- package/dist/llm/system-messages.js +6 -22
- package/dist/llm/system-messages.js.map +1 -1
- package/dist/llm/token-estimate-calibration.d.ts +0 -6
- package/dist/llm/token-estimate-calibration.js +0 -26
- package/dist/llm/token-estimate-calibration.js.map +1 -1
- package/dist/llm/token-usage.d.ts +8 -69
- package/dist/llm/token-usage.js +10 -257
- package/dist/llm/token-usage.js.map +1 -1
- package/dist/llm/tokenrouter.d.ts +0 -12
- package/dist/llm/tokenrouter.js +3 -14
- package/dist/llm/tokenrouter.js.map +1 -1
- package/dist/llm/tool-protocol.d.ts +3 -22
- package/dist/llm/tool-protocol.js +20 -155
- package/dist/llm/tool-protocol.js.map +1 -1
- package/dist/llm/tool-wire/argument-repair.d.ts +4 -0
- package/dist/llm/tool-wire/argument-repair.js +174 -0
- package/dist/llm/tool-wire/argument-repair.js.map +1 -0
- package/dist/llm/transport-events.d.ts +12 -0
- package/dist/llm/transport-events.js +29 -0
- package/dist/llm/transport-events.js.map +1 -0
- package/dist/llm/usage/provider-parsers.d.ts +11 -0
- package/dist/llm/usage/provider-parsers.js +220 -0
- package/dist/llm/usage/provider-parsers.js.map +1 -0
- package/dist/llm/wire/abort-race.d.ts +1 -0
- package/dist/llm/wire/abort-race.js +34 -0
- package/dist/llm/wire/abort-race.js.map +1 -0
- package/dist/llm/wire/capability-errors.d.ts +11 -0
- package/dist/llm/wire/capability-errors.js +92 -0
- package/dist/llm/wire/capability-errors.js.map +1 -0
- package/dist/llm/wire/chat-body.d.ts +40 -0
- package/dist/llm/wire/chat-body.js +172 -0
- package/dist/llm/wire/chat-body.js.map +1 -0
- package/dist/llm/wire/model-catalog.d.ts +4 -0
- package/dist/llm/wire/model-catalog.js +34 -0
- package/dist/llm/wire/model-catalog.js.map +1 -0
- package/dist/llm/wire/openai-complete.d.ts +27 -0
- package/dist/llm/wire/openai-complete.js +138 -0
- package/dist/llm/wire/openai-complete.js.map +1 -0
- package/dist/llm/wire/openai-stream.d.ts +36 -0
- package/dist/llm/wire/openai-stream.js +665 -0
- package/dist/llm/wire/openai-stream.js.map +1 -0
- package/dist/llm/wire/reasoning-artifacts.d.ts +45 -0
- package/dist/llm/wire/reasoning-artifacts.js +140 -0
- package/dist/llm/wire/reasoning-artifacts.js.map +1 -0
- package/dist/llm/wire/reasoning-payload.d.ts +9 -0
- package/dist/llm/wire/reasoning-payload.js +212 -0
- package/dist/llm/wire/reasoning-payload.js.map +1 -0
- package/dist/llm/wire/response-errors.d.ts +5 -0
- package/dist/llm/wire/response-errors.js +182 -0
- package/dist/llm/wire/response-errors.js.map +1 -0
- package/dist/llm/wire/responses-first.d.ts +30 -0
- package/dist/llm/wire/responses-first.js +335 -0
- package/dist/llm/wire/responses-first.js.map +1 -0
- package/dist/llm/wire/stream-framing.d.ts +38 -0
- package/dist/llm/wire/stream-framing.js +217 -0
- package/dist/llm/wire/stream-framing.js.map +1 -0
- package/dist/mcp/runtime.d.ts +0 -15
- package/dist/mcp/runtime.js +0 -8
- package/dist/mcp/runtime.js.map +1 -1
- package/dist/modes/ask.d.ts +0 -3
- package/dist/modes/ask.js +0 -22
- package/dist/modes/ask.js.map +1 -1
- package/dist/noninteractive/blocks/tool-blocks.d.ts +35 -0
- package/dist/noninteractive/blocks/tool-blocks.js +206 -0
- package/dist/noninteractive/blocks/tool-blocks.js.map +1 -0
- package/dist/noninteractive/readline-prompts.d.ts +0 -21
- package/dist/noninteractive/readline-prompts.js +0 -31
- package/dist/noninteractive/readline-prompts.js.map +1 -1
- package/dist/noninteractive/stdio-confirm-port.d.ts +0 -9
- package/dist/noninteractive/stdio-confirm-port.js +0 -9
- package/dist/noninteractive/stdio-confirm-port.js.map +1 -1
- package/dist/noninteractive/stream-blocks.d.ts +3 -49
- package/dist/noninteractive/stream-blocks.js +14 -234
- package/dist/noninteractive/stream-blocks.js.map +1 -1
- package/dist/noninteractive/stream-renderer.d.ts +0 -10
- package/dist/noninteractive/stream-renderer.js +0 -10
- package/dist/noninteractive/stream-renderer.js.map +1 -1
- package/dist/noninteractive/stream-spinner.d.ts +0 -8
- package/dist/noninteractive/stream-spinner.js +0 -8
- package/dist/noninteractive/stream-spinner.js.map +1 -1
- package/dist/os/bun-runtime.d.ts +0 -15
- package/dist/os/bun-runtime.js +0 -33
- package/dist/os/bun-runtime.js.map +1 -1
- package/dist/os/command.d.ts +0 -6
- package/dist/os/command.js +0 -13
- package/dist/os/command.js.map +1 -1
- package/dist/os/cwd.d.ts +0 -5
- package/dist/os/cwd.js +0 -6
- package/dist/os/cwd.js.map +1 -1
- package/dist/os/permissions.d.ts +0 -11
- package/dist/os/permissions.js +0 -13
- package/dist/os/permissions.js.map +1 -1
- package/dist/os/process-identity.d.ts +0 -22
- package/dist/os/process-identity.js +0 -23
- package/dist/os/process-identity.js.map +1 -1
- package/dist/os/process-tree.d.ts +0 -7
- package/dist/os/process-tree.js +0 -8
- package/dist/os/process-tree.js.map +1 -1
- package/dist/prompts/embedded.js +1 -1
- package/dist/prompts/embedded.js.map +1 -1
- package/dist/prompts/index.d.ts +0 -36
- package/dist/prompts/index.js +2 -47
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/system.agent.md +2 -2
- package/dist/safety/classifier.d.ts +5 -26
- package/dist/safety/classifier.js +5 -573
- package/dist/safety/classifier.js.map +1 -1
- package/dist/safety/engagement-policy.d.ts +0 -13
- package/dist/safety/engagement-policy.js +0 -32
- package/dist/safety/engagement-policy.js.map +1 -1
- package/dist/safety/patterns.d.ts +0 -108
- package/dist/safety/patterns.js +0 -159
- package/dist/safety/patterns.js.map +1 -1
- package/dist/safety/shell-classification.d.ts +19 -0
- package/dist/safety/shell-classification.js +215 -0
- package/dist/safety/shell-classification.js.map +1 -0
- package/dist/safety/tool-classification.d.ts +4 -0
- package/dist/safety/tool-classification.js +260 -0
- package/dist/safety/tool-classification.js.map +1 -0
- package/dist/store/config/endpoints.d.ts +85 -0
- package/dist/store/config/endpoints.js +298 -0
- package/dist/store/config/endpoints.js.map +1 -0
- package/dist/store/config/settings.d.ts +11 -0
- package/dist/store/config/settings.js +52 -0
- package/dist/store/config/settings.js.map +1 -0
- package/dist/store/config.d.ts +6 -169
- package/dist/store/config.js +4 -411
- package/dist/store/config.js.map +1 -1
- package/dist/store/engagement.d.ts +0 -1
- package/dist/store/engagement.js +0 -3
- package/dist/store/engagement.js.map +1 -1
- package/dist/store/history/jsonl-backend.d.ts +7 -0
- package/dist/store/history/jsonl-backend.js +151 -0
- package/dist/store/history/jsonl-backend.js.map +1 -0
- package/dist/store/history/jsonl-lock.d.ts +2 -0
- package/dist/store/history/jsonl-lock.js +100 -0
- package/dist/store/history/jsonl-lock.js.map +1 -0
- package/dist/store/history/lifecycle.d.ts +14 -0
- package/dist/store/history/lifecycle.js +316 -0
- package/dist/store/history/lifecycle.js.map +1 -0
- package/dist/store/history/recovery.d.ts +62 -0
- package/dist/store/history/recovery.js +253 -0
- package/dist/store/history/recovery.js.map +1 -0
- package/dist/store/history/session-queries.d.ts +9 -0
- package/dist/store/history/session-queries.js +142 -0
- package/dist/store/history/session-queries.js.map +1 -0
- package/dist/store/history/sqlite-backend.d.ts +25 -0
- package/dist/store/history/sqlite-backend.js +209 -0
- package/dist/store/history/sqlite-backend.js.map +1 -0
- package/dist/store/history-index.d.ts +0 -5
- package/dist/store/history-index.js +0 -10
- package/dist/store/history-index.js.map +1 -1
- package/dist/store/history.d.ts +12 -97
- package/dist/store/history.js +12 -1214
- package/dist/store/history.js.map +1 -1
- package/dist/store/keys/search-providers.d.ts +33 -0
- package/dist/store/keys/search-providers.js +211 -0
- package/dist/store/keys/search-providers.js.map +1 -0
- package/dist/store/keys/secret-store.d.ts +40 -0
- package/dist/store/keys/secret-store.js +249 -0
- package/dist/store/keys/secret-store.js.map +1 -0
- package/dist/store/keys.d.ts +8 -95
- package/dist/store/keys.js +7 -537
- package/dist/store/keys.js.map +1 -1
- package/dist/store/logs.d.ts +0 -1
- package/dist/store/logs.js +1 -7
- package/dist/store/logs.js.map +1 -1
- package/dist/store/paths.d.ts +0 -12
- package/dist/store/paths.js +0 -12
- package/dist/store/paths.js.map +1 -1
- package/dist/store/plan/jsonl-backend.d.ts +7 -0
- package/dist/store/plan/jsonl-backend.js +115 -0
- package/dist/store/plan/jsonl-backend.js.map +1 -0
- package/dist/store/plan/mutation.d.ts +25 -0
- package/dist/store/plan/mutation.js +270 -0
- package/dist/store/plan/mutation.js.map +1 -0
- package/dist/store/plan/sqlite-backend.d.ts +66 -0
- package/dist/store/plan/sqlite-backend.js +66 -0
- package/dist/store/plan/sqlite-backend.js.map +1 -0
- package/dist/store/plan/task-normalization.d.ts +8 -0
- package/dist/store/plan/task-normalization.js +165 -0
- package/dist/store/plan/task-normalization.js.map +1 -0
- package/dist/store/plan.d.ts +9 -176
- package/dist/store/plan.js +11 -742
- package/dist/store/plan.js.map +1 -1
- package/dist/store/project.js +0 -5
- package/dist/store/project.js.map +1 -1
- package/dist/store/responder-settlement.d.ts +0 -1
- package/dist/store/responder-settlement.js +0 -3
- package/dist/store/responder-settlement.js.map +1 -1
- package/dist/store/scope.d.ts +0 -16
- package/dist/store/scope.js +0 -22
- package/dist/store/scope.js.map +1 -1
- package/dist/store/session-workspace.d.ts +0 -51
- package/dist/store/session-workspace.js +0 -57
- package/dist/store/session-workspace.js.map +1 -1
- package/dist/store/task-transitions.d.ts +0 -7
- package/dist/store/task-transitions.js +0 -6
- package/dist/store/task-transitions.js.map +1 -1
- package/dist/tools/batch/batch-parsing.d.ts +11 -0
- package/dist/tools/batch/batch-parsing.js +78 -0
- package/dist/tools/batch/batch-parsing.js.map +1 -0
- package/dist/tools/batch/limits.d.ts +6 -0
- package/dist/tools/batch/limits.js +17 -0
- package/dist/tools/batch/limits.js.map +1 -0
- package/dist/tools/batch/run-batch.d.ts +3 -0
- package/dist/tools/batch/run-batch.js +402 -0
- package/dist/tools/batch/run-batch.js.map +1 -0
- package/dist/tools/batch-fail-policy.d.ts +0 -29
- package/dist/tools/batch-fail-policy.js +0 -31
- package/dist/tools/batch-fail-policy.js.map +1 -1
- package/dist/tools/call-normalization.d.ts +2 -0
- package/dist/tools/call-normalization.js +165 -0
- package/dist/tools/call-normalization.js.map +1 -0
- package/dist/tools/capabilities.d.ts +0 -1
- package/dist/tools/capabilities.js +0 -28
- package/dist/tools/capabilities.js.map +1 -1
- package/dist/tools/command-intent.d.ts +0 -19
- package/dist/tools/command-intent.js +0 -65
- package/dist/tools/command-intent.js.map +1 -1
- package/dist/tools/definitions/aggregate.d.ts +2 -0
- package/dist/tools/definitions/aggregate.js +263 -0
- package/dist/tools/definitions/aggregate.js.map +1 -0
- package/dist/tools/definitions/context-1.d.ts +2 -0
- package/dist/tools/definitions/context-1.js +8 -0
- package/dist/tools/definitions/context-1.js.map +1 -0
- package/dist/tools/definitions/context-2.d.ts +2 -0
- package/dist/tools/definitions/context-2.js +90 -0
- package/dist/tools/definitions/context-2.js.map +1 -0
- package/dist/tools/definitions/define.d.ts +7 -0
- package/dist/tools/definitions/define.js +53 -0
- package/dist/tools/definitions/define.js.map +1 -0
- package/dist/tools/definitions/files.d.ts +2 -0
- package/dist/tools/definitions/files.js +193 -0
- package/dist/tools/definitions/files.js.map +1 -0
- package/dist/tools/definitions/network-1.d.ts +2 -0
- package/dist/tools/definitions/network-1.js +72 -0
- package/dist/tools/definitions/network-1.js.map +1 -0
- package/dist/tools/definitions/network-2.d.ts +2 -0
- package/dist/tools/definitions/network-2.js +22 -0
- package/dist/tools/definitions/network-2.js.map +1 -0
- package/dist/tools/definitions/orchestration.d.ts +2 -0
- package/dist/tools/definitions/orchestration.js +122 -0
- package/dist/tools/definitions/orchestration.js.map +1 -0
- package/dist/tools/definitions/pentest.d.ts +2 -0
- package/dist/tools/definitions/pentest.js +91 -0
- package/dist/tools/definitions/pentest.js.map +1 -0
- package/dist/tools/definitions/selection.d.ts +9 -0
- package/dist/tools/definitions/selection.js +84 -0
- package/dist/tools/definitions/selection.js.map +1 -0
- package/dist/tools/definitions/shell.d.ts +2 -0
- package/dist/tools/definitions/shell.js +83 -0
- package/dist/tools/definitions/shell.js.map +1 -0
- package/dist/tools/definitions/terminal.d.ts +2 -0
- package/dist/tools/definitions/terminal.js +91 -0
- package/dist/tools/definitions/terminal.js.map +1 -0
- package/dist/tools/definitions/web-1.d.ts +2 -0
- package/dist/tools/definitions/web-1.js +68 -0
- package/dist/tools/definitions/web-1.js.map +1 -0
- package/dist/tools/definitions/web-2.d.ts +2 -0
- package/dist/tools/definitions/web-2.js +59 -0
- package/dist/tools/definitions/web-2.js.map +1 -0
- package/dist/tools/definitions.d.ts +3 -16
- package/dist/tools/definitions.js +8 -1238
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/diff/line-ops.d.ts +34 -0
- package/dist/tools/diff/line-ops.js +218 -0
- package/dist/tools/diff/line-ops.js.map +1 -0
- package/dist/tools/dns-native.d.ts +0 -5
- package/dist/tools/dns-native.js +0 -16
- package/dist/tools/dns-native.js.map +1 -1
- package/dist/tools/external-tools.d.ts +0 -8
- package/dist/tools/external-tools.js.map +1 -1
- package/dist/tools/file-diff.d.ts +3 -78
- package/dist/tools/file-diff.js +2 -271
- package/dist/tools/file-diff.js.map +1 -1
- package/dist/tools/fs/internals-2.d.ts +1 -0
- package/dist/tools/fs/internals-2.js +6 -0
- package/dist/tools/fs/internals-2.js.map +1 -0
- package/dist/tools/fs/internals.d.ts +4 -0
- package/dist/tools/fs/internals.js +23 -0
- package/dist/tools/fs/internals.js.map +1 -0
- package/dist/tools/fs/mutations.d.ts +17 -0
- package/dist/tools/fs/mutations.js +396 -0
- package/dist/tools/fs/mutations.js.map +1 -0
- package/dist/tools/fs/read-window.d.ts +14 -0
- package/dist/tools/fs/read-window.js +288 -0
- package/dist/tools/fs/read-window.js.map +1 -0
- package/dist/tools/fs/read.d.ts +7 -0
- package/dist/tools/fs/read.js +164 -0
- package/dist/tools/fs/read.js.map +1 -0
- package/dist/tools/fs/search.d.ts +13 -0
- package/dist/tools/fs/search.js +125 -0
- package/dist/tools/fs/search.js.map +1 -0
- package/dist/tools/fs.d.ts +4 -79
- package/dist/tools/fs.js +26 -1115
- package/dist/tools/fs.js.map +1 -1
- package/dist/tools/handlers/args.d.ts +8 -0
- package/dist/tools/handlers/args.js +50 -0
- package/dist/tools/handlers/args.js.map +1 -0
- package/dist/tools/handlers/context-1.d.ts +2 -0
- package/dist/tools/handlers/context-1.js +7 -0
- package/dist/tools/handlers/context-1.js.map +1 -0
- package/dist/tools/handlers/context-2.d.ts +2 -0
- package/dist/tools/handlers/context-2.js +14 -0
- package/dist/tools/handlers/context-2.js.map +1 -0
- package/dist/tools/handlers/files-1.d.ts +2 -0
- package/dist/tools/handlers/files-1.js +51 -0
- package/dist/tools/handlers/files-1.js.map +1 -0
- package/dist/tools/handlers/files-2.d.ts +2 -0
- package/dist/tools/handlers/files-2.js +31 -0
- package/dist/tools/handlers/files-2.js.map +1 -0
- package/dist/tools/handlers/network-1.d.ts +2 -0
- package/dist/tools/handlers/network-1.js +52 -0
- package/dist/tools/handlers/network-1.js.map +1 -0
- package/dist/tools/handlers/network-2.d.ts +2 -0
- package/dist/tools/handlers/network-2.js +32 -0
- package/dist/tools/handlers/network-2.js.map +1 -0
- package/dist/tools/handlers/network-3.d.ts +2 -0
- package/dist/tools/handlers/network-3.js +17 -0
- package/dist/tools/handlers/network-3.js.map +1 -0
- package/dist/tools/handlers/nmap-preparation.d.ts +13 -0
- package/dist/tools/handlers/nmap-preparation.js +66 -0
- package/dist/tools/handlers/nmap-preparation.js.map +1 -0
- package/dist/tools/handlers/orchestration-1.d.ts +2 -0
- package/dist/tools/handlers/orchestration-1.js +7 -0
- package/dist/tools/handlers/orchestration-1.js.map +1 -0
- package/dist/tools/handlers/orchestration-2.d.ts +2 -0
- package/dist/tools/handlers/orchestration-2.js +16 -0
- package/dist/tools/handlers/orchestration-2.js.map +1 -0
- package/dist/tools/handlers/pentest.d.ts +2 -0
- package/dist/tools/handlers/pentest.js +208 -0
- package/dist/tools/handlers/pentest.js.map +1 -0
- package/dist/tools/handlers/responder-job-options.d.ts +3 -0
- package/dist/tools/handlers/responder-job-options.js +16 -0
- package/dist/tools/handlers/responder-job-options.js.map +1 -0
- package/dist/tools/handlers/shell-1.d.ts +2 -0
- package/dist/tools/handlers/shell-1.js +94 -0
- package/dist/tools/handlers/shell-1.js.map +1 -0
- package/dist/tools/handlers/shell-2.d.ts +2 -0
- package/dist/tools/handlers/shell-2.js +49 -0
- package/dist/tools/handlers/shell-2.js.map +1 -0
- package/dist/tools/handlers/shell-3.d.ts +2 -0
- package/dist/tools/handlers/shell-3.js +47 -0
- package/dist/tools/handlers/shell-3.js.map +1 -0
- package/dist/tools/handlers/web.d.ts +2 -0
- package/dist/tools/handlers/web.js +168 -0
- package/dist/tools/handlers/web.js.map +1 -0
- package/dist/tools/http/agents.d.ts +10 -0
- package/dist/tools/http/agents.js +63 -0
- package/dist/tools/http/agents.js.map +1 -0
- package/dist/tools/http/evidence-format.d.ts +37 -0
- package/dist/tools/http/evidence-format.js +181 -0
- package/dist/tools/http/evidence-format.js.map +1 -0
- package/dist/tools/http/fetch.d.ts +31 -0
- package/dist/tools/http/fetch.js +480 -0
- package/dist/tools/http/fetch.js.map +1 -0
- package/dist/tools/http/retry-policy.d.ts +14 -0
- package/dist/tools/http/retry-policy.js +144 -0
- package/dist/tools/http/retry-policy.js.map +1 -0
- package/dist/tools/http.d.ts +1 -45
- package/dist/tools/http.js +1 -920
- package/dist/tools/http.js.map +1 -1
- package/dist/tools/image.d.ts +0 -15
- package/dist/tools/image.js +0 -21
- package/dist/tools/image.js.map +1 -1
- package/dist/tools/interactive-session-tools.d.ts +0 -7
- package/dist/tools/interactive-session-tools.js +0 -13
- package/dist/tools/interactive-session-tools.js.map +1 -1
- package/dist/tools/jobs/helpers.d.ts +6 -0
- package/dist/tools/jobs/helpers.js +63 -0
- package/dist/tools/jobs/helpers.js.map +1 -0
- package/dist/tools/jobs/limits.d.ts +20 -0
- package/dist/tools/jobs/limits.js +21 -0
- package/dist/tools/jobs/limits.js.map +1 -0
- package/dist/tools/jobs/polling-policy.d.ts +11 -0
- package/dist/tools/jobs/polling-policy.js +33 -0
- package/dist/tools/jobs/polling-policy.js.map +1 -0
- package/dist/tools/jobs/process-identity.d.ts +5 -0
- package/dist/tools/jobs/process-identity.js +80 -0
- package/dist/tools/jobs/process-identity.js.map +1 -0
- package/dist/tools/jobs/redacted-writer.d.ts +25 -0
- package/dist/tools/jobs/redacted-writer.js +134 -0
- package/dist/tools/jobs/redacted-writer.js.map +1 -0
- package/dist/tools/jobs/types.d.ts +152 -0
- package/dist/tools/jobs/types.js +2 -0
- package/dist/tools/jobs/types.js.map +1 -0
- package/dist/tools/jobs.d.ts +8 -210
- package/dist/tools/jobs.js +13 -453
- package/dist/tools/jobs.js.map +1 -1
- package/dist/tools/net-ping-sweep.d.ts +0 -8
- package/dist/tools/net-ping-sweep.js +0 -22
- package/dist/tools/net-ping-sweep.js.map +1 -1
- package/dist/tools/network-context.d.ts +0 -4
- package/dist/tools/network-context.js +0 -8
- package/dist/tools/network-context.js.map +1 -1
- package/dist/tools/nmap-runner.d.ts +0 -21
- package/dist/tools/nmap-runner.js +0 -43
- package/dist/tools/nmap-runner.js.map +1 -1
- package/dist/tools/output-selection.d.ts +0 -1
- package/dist/tools/output-selection.js +0 -3
- package/dist/tools/output-selection.js.map +1 -1
- package/dist/tools/package-binary.js +0 -7
- package/dist/tools/package-binary.js.map +1 -1
- package/dist/tools/pdf/read.d.ts +6 -0
- package/dist/tools/pdf/read.js +529 -0
- package/dist/tools/pdf/read.js.map +1 -0
- package/dist/tools/pdf.d.ts +2 -6
- package/dist/tools/pdf.js +1 -528
- package/dist/tools/pdf.js.map +1 -1
- package/dist/tools/pentest-workflows.js +0 -12
- package/dist/tools/pentest-workflows.js.map +1 -1
- package/dist/tools/policies/output-policy.d.ts +0 -17
- package/dist/tools/policies/output-policy.js +0 -18
- package/dist/tools/policies/output-policy.js.map +1 -1
- package/dist/tools/reducers/ffuf.d.ts +0 -5
- package/dist/tools/reducers/ffuf.js +0 -8
- package/dist/tools/reducers/ffuf.js.map +1 -1
- package/dist/tools/reducers/gobuster.js +0 -1
- package/dist/tools/reducers/gobuster.js.map +1 -1
- package/dist/tools/reducers/httpx.js +0 -1
- package/dist/tools/reducers/httpx.js.map +1 -1
- package/dist/tools/reducers/nmap.d.ts +0 -5
- package/dist/tools/reducers/nmap.js +0 -5
- package/dist/tools/reducers/nmap.js.map +1 -1
- package/dist/tools/reducers/nuclei.js +0 -1
- package/dist/tools/reducers/nuclei.js.map +1 -1
- package/dist/tools/reducers/subdomains.d.ts +0 -4
- package/dist/tools/reducers/subdomains.js +0 -4
- package/dist/tools/reducers/subdomains.js.map +1 -1
- package/dist/tools/reducers/types.d.ts +0 -5
- package/dist/tools/registry.d.ts +4 -20
- package/dist/tools/registry.js +42 -1636
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/shell/artifact-name.d.ts +1 -0
- package/dist/tools/shell/artifact-name.js +6 -0
- package/dist/tools/shell/artifact-name.js.map +1 -0
- package/dist/tools/shell/capture.d.ts +31 -0
- package/dist/tools/shell/capture.js +135 -0
- package/dist/tools/shell/capture.js.map +1 -0
- package/dist/tools/shell/exec-attempt.d.ts +10 -0
- package/dist/tools/shell/exec-attempt.js +288 -0
- package/dist/tools/shell/exec-attempt.js.map +1 -0
- package/dist/tools/shell/internals-2.d.ts +16 -0
- package/dist/tools/shell/internals-2.js +48 -0
- package/dist/tools/shell/internals-2.js.map +1 -0
- package/dist/tools/shell/internals.d.ts +10 -0
- package/dist/tools/shell/internals.js +51 -0
- package/dist/tools/shell/internals.js.map +1 -0
- package/dist/tools/shell/spawn-argv.d.ts +17 -0
- package/dist/tools/shell/spawn-argv.js +248 -0
- package/dist/tools/shell/spawn-argv.js.map +1 -0
- package/dist/tools/shell-quoting.d.ts +1 -0
- package/dist/tools/shell-quoting.js +7 -0
- package/dist/tools/shell-quoting.js.map +1 -0
- package/dist/tools/shell.d.ts +4 -82
- package/dist/tools/shell.js +7 -845
- package/dist/tools/shell.js.map +1 -1
- package/dist/tools/sudo-session.d.ts +0 -41
- package/dist/tools/sudo-session.js +0 -44
- package/dist/tools/sudo-session.js.map +1 -1
- package/dist/tools/tool-types.d.ts +0 -7
- package/dist/tools/validate.d.ts +0 -35
- package/dist/tools/validate.js +2 -67
- package/dist/tools/validate.js.map +1 -1
- package/dist/tools/web/audit.d.ts +0 -74
- package/dist/tools/web/audit.js +0 -39
- package/dist/tools/web/audit.js.map +1 -1
- package/dist/tools/web/budget.d.ts +0 -35
- package/dist/tools/web/budget.js +0 -75
- package/dist/tools/web/budget.js.map +1 -1
- package/dist/tools/web/capture.d.ts +0 -106
- package/dist/tools/web/capture.js +0 -148
- package/dist/tools/web/capture.js.map +1 -1
- package/dist/tools/web/decode.d.ts +0 -8
- package/dist/tools/web/decode.js +0 -9
- package/dist/tools/web/decode.js.map +1 -1
- package/dist/tools/web/fetch-core.d.ts +2 -32
- package/dist/tools/web/fetch-core.js +4 -1058
- package/dist/tools/web/fetch-core.js.map +1 -1
- package/dist/tools/web/fetch.d.ts +0 -29
- package/dist/tools/web/fetch.js +0 -46
- package/dist/tools/web/fetch.js.map +1 -1
- package/dist/tools/web/issue-hop.d.ts +57 -0
- package/dist/tools/web/issue-hop.js +396 -0
- package/dist/tools/web/issue-hop.js.map +1 -0
- package/dist/tools/web/providers/brave.d.ts +0 -40
- package/dist/tools/web/providers/brave.js +1 -100
- package/dist/tools/web/providers/brave.js.map +1 -1
- package/dist/tools/web/providers/duckduckgo.d.ts +0 -41
- package/dist/tools/web/providers/duckduckgo.js +0 -104
- package/dist/tools/web/providers/duckduckgo.js.map +1 -1
- package/dist/tools/web/providers/exa.d.ts +0 -43
- package/dist/tools/web/providers/exa.js +1 -102
- package/dist/tools/web/providers/exa.js.map +1 -1
- package/dist/tools/web/providers/provider.d.ts +0 -69
- package/dist/tools/web/providers/provider.js +0 -28
- package/dist/tools/web/providers/provider.js.map +1 -1
- package/dist/tools/web/providers/tavily.d.ts +0 -46
- package/dist/tools/web/providers/tavily.js +1 -111
- package/dist/tools/web/providers/tavily.js.map +1 -1
- package/dist/tools/web/readable.d.ts +0 -62
- package/dist/tools/web/readable.js +1 -132
- package/dist/tools/web/readable.js.map +1 -1
- package/dist/tools/web/redact.d.ts +0 -26
- package/dist/tools/web/redact.js +0 -2
- package/dist/tools/web/redact.js.map +1 -1
- package/dist/tools/web/request-loop.d.ts +38 -0
- package/dist/tools/web/request-loop.js +172 -0
- package/dist/tools/web/request-loop.js.map +1 -0
- package/dist/tools/web/response-body.d.ts +41 -0
- package/dist/tools/web/response-body.js +174 -0
- package/dist/tools/web/response-body.js.map +1 -0
- package/dist/tools/web/search-attempts.d.ts +20 -0
- package/dist/tools/web/search-attempts.js +303 -0
- package/dist/tools/web/search-attempts.js.map +1 -0
- package/dist/tools/web/search.d.ts +0 -33
- package/dist/tools/web/search.js +3 -396
- package/dist/tools/web/search.js.map +1 -1
- package/dist/tools/web/ssrf-guard.d.ts +0 -42
- package/dist/tools/web/ssrf-guard.js +0 -57
- package/dist/tools/web/ssrf-guard.js.map +1 -1
- package/dist/tools/web/types.d.ts +0 -197
- package/dist/tools/web/types.js +0 -41
- package/dist/tools/web/types.js.map +1 -1
- package/dist/tools/web/validate-args.d.ts +11 -0
- package/dist/tools/web/validate-args.js +107 -0
- package/dist/tools/web/validate-args.js.map +1 -0
- package/dist/tools/whois-native.d.ts +0 -4
- package/dist/tools/whois-native.js +0 -6
- package/dist/tools/whois-native.js.map +1 -1
- package/dist/tools/wordlists.js +0 -32
- package/dist/tools/wordlists.js.map +1 -1
- package/dist/tui-v2/app/App.d.ts +0 -10
- package/dist/tui-v2/app/App.js +67 -112
- package/dist/tui-v2/app/App.js.map +1 -1
- package/dist/tui-v2/bootstrap/pager-export.d.ts +0 -8
- package/dist/tui-v2/bootstrap/pager-export.js +0 -11
- package/dist/tui-v2/bootstrap/pager-export.js.map +1 -1
- package/dist/tui-v2/bootstrap/patch-opentui-text.d.ts +0 -5
- package/dist/tui-v2/bootstrap/patch-opentui-text.js +0 -5
- package/dist/tui-v2/bootstrap/patch-opentui-text.js.map +1 -1
- package/dist/tui-v2/bootstrap/resize-repaint.d.ts +16 -20
- package/dist/tui-v2/bootstrap/resize-repaint.js +34 -13
- package/dist/tui-v2/bootstrap/resize-repaint.js.map +1 -1
- package/dist/tui-v2/bootstrap/start-tui-v2.d.ts +0 -7
- package/dist/tui-v2/bootstrap/start-tui-v2.js +10 -27
- package/dist/tui-v2/bootstrap/start-tui-v2.js.map +1 -1
- package/dist/tui-v2/components/completion/completion-menu.d.ts +0 -4
- package/dist/tui-v2/components/completion/completion-menu.js +2 -6
- package/dist/tui-v2/components/completion/completion-menu.js.map +1 -1
- package/dist/tui-v2/components/composer/composer-input-box.d.ts +0 -4
- package/dist/tui-v2/components/composer/composer-input-box.js +1 -10
- package/dist/tui-v2/components/composer/composer-input-box.js.map +1 -1
- package/dist/tui-v2/components/composer/paste-chip.d.ts +0 -7
- package/dist/tui-v2/components/composer/paste-chip.js +0 -7
- package/dist/tui-v2/components/composer/paste-chip.js.map +1 -1
- package/dist/tui-v2/components/jobs/jobs-panel.d.ts +0 -12
- package/dist/tui-v2/components/jobs/jobs-panel.js +0 -34
- package/dist/tui-v2/components/jobs/jobs-panel.js.map +1 -1
- package/dist/tui-v2/components/modal/confirm-modal.d.ts +0 -8
- package/dist/tui-v2/components/modal/confirm-modal.js +0 -4
- package/dist/tui-v2/components/modal/confirm-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/keys-modal.d.ts +0 -11
- package/dist/tui-v2/components/modal/keys-modal.js +0 -24
- package/dist/tui-v2/components/modal/keys-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/prompt-actions-modal.d.ts +0 -6
- package/dist/tui-v2/components/modal/prompt-actions-modal.js +4 -13
- package/dist/tui-v2/components/modal/prompt-actions-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/scope-modal.d.ts +0 -5
- package/dist/tui-v2/components/modal/scope-modal.js +0 -12
- package/dist/tui-v2/components/modal/scope-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/secret-modal.d.ts +0 -8
- package/dist/tui-v2/components/modal/secret-modal.js +0 -17
- package/dist/tui-v2/components/modal/secret-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/text-editor-modal.d.ts +0 -6
- package/dist/tui-v2/components/modal/text-editor-modal.js +0 -6
- package/dist/tui-v2/components/modal/text-editor-modal.js.map +1 -1
- package/dist/tui-v2/components/overlay/overlay-host.d.ts +0 -14
- package/dist/tui-v2/components/overlay/overlay-host.js +0 -2
- package/dist/tui-v2/components/overlay/overlay-host.js.map +1 -1
- package/dist/tui-v2/components/pager/pager-line.d.ts +0 -5
- package/dist/tui-v2/components/pager/pager-line.js +0 -10
- package/dist/tui-v2/components/pager/pager-line.js.map +1 -1
- package/dist/tui-v2/components/pager/pager.d.ts +0 -14
- package/dist/tui-v2/components/pager/pager.js +3 -58
- package/dist/tui-v2/components/pager/pager.js.map +1 -1
- package/dist/tui-v2/components/picker/picker.d.ts +0 -6
- package/dist/tui-v2/components/picker/picker.js +3 -12
- package/dist/tui-v2/components/picker/picker.js.map +1 -1
- package/dist/tui-v2/components/plan/plan-pane-anim.d.ts +0 -25
- package/dist/tui-v2/components/plan/plan-pane-anim.js +0 -23
- package/dist/tui-v2/components/plan/plan-pane-anim.js.map +1 -1
- package/dist/tui-v2/components/plan/plan-view.d.ts +0 -7
- package/dist/tui-v2/components/plan/plan-view.js +0 -20
- package/dist/tui-v2/components/plan/plan-view.js.map +1 -1
- package/dist/tui-v2/components/plan/use-pane-presence.d.ts +0 -9
- package/dist/tui-v2/components/plan/use-pane-presence.js +0 -9
- package/dist/tui-v2/components/plan/use-pane-presence.js.map +1 -1
- package/dist/tui-v2/components/queue/queue-panel.d.ts +0 -12
- package/dist/tui-v2/components/queue/queue-panel.js +2 -4
- package/dist/tui-v2/components/queue/queue-panel.js.map +1 -1
- package/dist/tui-v2/components/status/status-line.d.ts +0 -17
- package/dist/tui-v2/components/status/status-line.js +0 -10
- package/dist/tui-v2/components/status/status-line.js.map +1 -1
- package/dist/tui-v2/components/toast/toast-anim.d.ts +0 -20
- package/dist/tui-v2/components/toast/toast-anim.js +0 -15
- package/dist/tui-v2/components/toast/toast-anim.js.map +1 -1
- package/dist/tui-v2/components/toast/toast-host.d.ts +0 -12
- package/dist/tui-v2/components/toast/toast-host.js +1 -29
- package/dist/tui-v2/components/toast/toast-host.js.map +1 -1
- package/dist/tui-v2/components/transcript/assistant-message.d.ts +0 -11
- package/dist/tui-v2/components/transcript/assistant-message.js +3 -24
- package/dist/tui-v2/components/transcript/assistant-message.js.map +1 -1
- package/dist/tui-v2/components/transcript/compacted-row.d.ts +0 -6
- package/dist/tui-v2/components/transcript/compacted-row.js +2 -6
- package/dist/tui-v2/components/transcript/compacted-row.js.map +1 -1
- package/dist/tui-v2/components/transcript/file-diff-card.d.ts +0 -9
- package/dist/tui-v2/components/transcript/file-diff-card.js +0 -16
- package/dist/tui-v2/components/transcript/file-diff-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/intro-card.d.ts +0 -9
- package/dist/tui-v2/components/transcript/intro-card.js +2 -13
- package/dist/tui-v2/components/transcript/intro-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/linkable-text.d.ts +0 -16
- package/dist/tui-v2/components/transcript/linkable-text.js +0 -11
- package/dist/tui-v2/components/transcript/linkable-text.js.map +1 -1
- package/dist/tui-v2/components/transcript/notice-row.d.ts +0 -7
- package/dist/tui-v2/components/transcript/notice-row.js +2 -18
- package/dist/tui-v2/components/transcript/notice-row.js.map +1 -1
- package/dist/tui-v2/components/transcript/search-bar.d.ts +0 -10
- package/dist/tui-v2/components/transcript/search-bar.js +0 -3
- package/dist/tui-v2/components/transcript/search-bar.js.map +1 -1
- package/dist/tui-v2/components/transcript/selectable-line.d.ts +0 -16
- package/dist/tui-v2/components/transcript/selectable-line.js +0 -9
- package/dist/tui-v2/components/transcript/selectable-line.js.map +1 -1
- package/dist/tui-v2/components/transcript/thinking-block.d.ts +0 -18
- package/dist/tui-v2/components/transcript/thinking-block.js +2 -40
- package/dist/tui-v2/components/transcript/thinking-block.js.map +1 -1
- package/dist/tui-v2/components/transcript/tool-card.d.ts +0 -19
- package/dist/tui-v2/components/transcript/tool-card.js +2 -42
- package/dist/tui-v2/components/transcript/tool-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-row.d.ts +0 -14
- package/dist/tui-v2/components/transcript/transcript-row.js +0 -13
- package/dist/tui-v2/components/transcript/transcript-row.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-scroll-port.d.ts +0 -32
- package/dist/tui-v2/components/transcript/transcript-scroll-port.js +0 -22
- package/dist/tui-v2/components/transcript/transcript-scroll-port.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-view.d.ts +0 -9
- package/dist/tui-v2/components/transcript/transcript-view.js +4 -67
- package/dist/tui-v2/components/transcript/transcript-view.js.map +1 -1
- package/dist/tui-v2/components/transcript/use-click-without-drag.d.ts +0 -7
- package/dist/tui-v2/components/transcript/use-click-without-drag.js +1 -11
- package/dist/tui-v2/components/transcript/use-click-without-drag.js.map +1 -1
- package/dist/tui-v2/components/transcript/use-native-selection-copy.d.ts +0 -7
- package/dist/tui-v2/components/transcript/use-native-selection-copy.js +0 -9
- package/dist/tui-v2/components/transcript/use-native-selection-copy.js.map +1 -1
- package/dist/tui-v2/components/transcript/use-transcript-selection.d.ts +0 -1
- package/dist/tui-v2/components/transcript/use-transcript-selection.js +0 -14
- package/dist/tui-v2/components/transcript/use-transcript-selection.js.map +1 -1
- package/dist/tui-v2/components/transcript/user-message.d.ts +0 -2
- package/dist/tui-v2/components/transcript/user-message.js +2 -7
- package/dist/tui-v2/components/transcript/user-message.js.map +1 -1
- package/dist/tui-v2/composer/composer-editor.d.ts +0 -20
- package/dist/tui-v2/composer/composer-editor.js +0 -61
- package/dist/tui-v2/composer/composer-editor.js.map +1 -1
- package/dist/tui-v2/composer/composer-wheel.d.ts +0 -17
- package/dist/tui-v2/composer/composer-wheel.js +0 -17
- package/dist/tui-v2/composer/composer-wheel.js.map +1 -1
- package/dist/tui-v2/composer/disable-native-textarea-scroll.d.ts +0 -12
- package/dist/tui-v2/composer/disable-native-textarea-scroll.js +0 -13
- package/dist/tui-v2/composer/disable-native-textarea-scroll.js.map +1 -1
- package/dist/tui-v2/composer/textarea-keybindings.d.ts +0 -19
- package/dist/tui-v2/composer/textarea-keybindings.js +0 -34
- package/dist/tui-v2/composer/textarea-keybindings.js.map +1 -1
- package/dist/tui-v2/composer/use-draft-actions.d.ts +0 -10
- package/dist/tui-v2/composer/use-draft-actions.js +0 -5
- package/dist/tui-v2/composer/use-draft-actions.js.map +1 -1
- package/dist/tui-v2/hooks/terminal-dimensions.d.ts +6 -0
- package/dist/tui-v2/hooks/terminal-dimensions.js +14 -0
- package/dist/tui-v2/hooks/terminal-dimensions.js.map +1 -0
- package/dist/tui-v2/input/chord-from-opentui-key.d.ts +0 -17
- package/dist/tui-v2/input/chord-from-opentui-key.js +0 -17
- package/dist/tui-v2/input/chord-from-opentui-key.js.map +1 -1
- package/dist/tui-v2/rendering/ansi-to-styled.d.ts +0 -12
- package/dist/tui-v2/rendering/ansi-to-styled.js +0 -10
- package/dist/tui-v2/rendering/ansi-to-styled.js.map +1 -1
- package/dist/tui-v2/rendering/pager-markdown.d.ts +0 -18
- package/dist/tui-v2/rendering/pager-markdown.js +0 -14
- package/dist/tui-v2/rendering/pager-markdown.js.map +1 -1
- package/dist/types.d.ts +2 -135
- package/dist/types.js +0 -3
- package/dist/types.js.map +1 -1
- package/dist/ui/mentions/expand.d.ts +26 -0
- package/dist/ui/mentions/expand.js +308 -0
- package/dist/ui/mentions/expand.js.map +1 -0
- package/dist/ui/mentions/file-suggestions.d.ts +7 -0
- package/dist/ui/mentions/file-suggestions.js +106 -0
- package/dist/ui/mentions/file-suggestions.js.map +1 -0
- package/dist/ui/mentions.d.ts +6 -70
- package/dist/ui/mentions.js +8 -482
- package/dist/ui/mentions.js.map +1 -1
- package/dist/ui/plan-pane.d.ts +0 -15
- package/dist/ui/plan-pane.js +1 -16
- package/dist/ui/plan-pane.js.map +1 -1
- package/dist/ui/thinking.d.ts +0 -8
- package/dist/ui/thinking.js +0 -13
- package/dist/ui/thinking.js.map +1 -1
- package/dist/ui-core/actions/action-id.d.ts +0 -8
- package/dist/ui-core/actions/action-id.js +0 -25
- package/dist/ui-core/actions/action-id.js.map +1 -1
- package/dist/ui-core/actions/action-router.d.ts +0 -10
- package/dist/ui-core/actions/action-router.js +0 -16
- package/dist/ui-core/actions/action-router.js.map +1 -1
- package/dist/ui-core/actions/cancel-timing.d.ts +0 -3
- package/dist/ui-core/actions/cancel-timing.js +0 -3
- package/dist/ui-core/actions/cancel-timing.js.map +1 -1
- package/dist/ui-core/actions/format-shortcuts.d.ts +0 -9
- package/dist/ui-core/actions/format-shortcuts.js +0 -9
- package/dist/ui-core/actions/format-shortcuts.js.map +1 -1
- package/dist/ui-core/actions/keymap.d.ts +0 -9
- package/dist/ui-core/actions/keymap.js +0 -39
- package/dist/ui-core/actions/keymap.js.map +1 -1
- package/dist/ui-core/actions/mode-cycle.d.ts +0 -2
- package/dist/ui-core/actions/mode-cycle.js +0 -4
- package/dist/ui-core/actions/mode-cycle.js.map +1 -1
- package/dist/ui-core/bootstrap/can-use-tui.d.ts +0 -6
- package/dist/ui-core/bootstrap/can-use-tui.js +0 -9
- package/dist/ui-core/bootstrap/can-use-tui.js.map +1 -1
- package/dist/ui-core/bootstrap/capabilities.d.ts +0 -8
- package/dist/ui-core/bootstrap/capabilities.js +1 -8
- package/dist/ui-core/bootstrap/capabilities.js.map +1 -1
- package/dist/ui-core/bootstrap/composition-root.d.ts +0 -17
- package/dist/ui-core/bootstrap/composition-root.js +30 -19
- package/dist/ui-core/bootstrap/composition-root.js.map +1 -1
- package/dist/ui-core/bootstrap/console-guard.d.ts +0 -15
- package/dist/ui-core/bootstrap/console-guard.js +32 -0
- package/dist/ui-core/bootstrap/console-guard.js.map +1 -1
- package/dist/ui-core/bootstrap/console-suppress.js +2 -7
- package/dist/ui-core/bootstrap/console-suppress.js.map +1 -1
- package/dist/ui-core/bootstrap/exit-epilogue.d.ts +0 -6
- package/dist/ui-core/bootstrap/exit-epilogue.js +0 -5
- package/dist/ui-core/bootstrap/exit-epilogue.js.map +1 -1
- package/dist/ui-core/bootstrap/lifecycle.d.ts +0 -42
- package/dist/ui-core/bootstrap/lifecycle.js +0 -31
- package/dist/ui-core/bootstrap/lifecycle.js.map +1 -1
- package/dist/ui-core/bootstrap/overlay-ports.d.ts +0 -11
- package/dist/ui-core/bootstrap/overlay-ports.js +0 -13
- package/dist/ui-core/bootstrap/overlay-ports.js.map +1 -1
- package/dist/ui-core/bootstrap/theme-mode-cache.js +0 -5
- package/dist/ui-core/bootstrap/theme-mode-cache.js.map +1 -1
- package/dist/ui-core/commands/command-handlers.d.ts +0 -6
- package/dist/ui-core/commands/command-handlers.js +0 -6
- package/dist/ui-core/commands/command-handlers.js.map +1 -1
- package/dist/ui-core/commands/config-commands.d.ts +0 -3
- package/dist/ui-core/commands/config-commands.js +0 -7
- package/dist/ui-core/commands/config-commands.js.map +1 -1
- package/dist/ui-core/commands/key-commands.d.ts +2 -0
- package/dist/ui-core/commands/key-commands.js +79 -213
- package/dist/ui-core/commands/key-commands.js.map +1 -1
- package/dist/ui-core/commands/keys/editors.d.ts +15 -0
- package/dist/ui-core/commands/keys/editors.js +127 -0
- package/dist/ui-core/commands/keys/editors.js.map +1 -0
- package/dist/ui-core/commands/mcp-commands.js +0 -6
- package/dist/ui-core/commands/mcp-commands.js.map +1 -1
- package/dist/ui-core/commands/picker-commands.d.ts +3 -14
- package/dist/ui-core/commands/picker-commands.js +6 -694
- package/dist/ui-core/commands/picker-commands.js.map +1 -1
- package/dist/ui-core/commands/pickers/custom-provider.d.ts +3 -0
- package/dist/ui-core/commands/pickers/custom-provider.js +170 -0
- package/dist/ui-core/commands/pickers/custom-provider.js.map +1 -0
- package/dist/ui-core/commands/pickers/history.d.ts +3 -0
- package/dist/ui-core/commands/pickers/history.js +185 -0
- package/dist/ui-core/commands/pickers/history.js.map +1 -0
- package/dist/ui-core/commands/pickers/output-pager.d.ts +5 -0
- package/dist/ui-core/commands/pickers/output-pager.js +90 -0
- package/dist/ui-core/commands/pickers/output-pager.js.map +1 -0
- package/dist/ui-core/commands/pickers/search-reasoning.d.ts +4 -0
- package/dist/ui-core/commands/pickers/search-reasoning.js +184 -0
- package/dist/ui-core/commands/pickers/search-reasoning.js.map +1 -0
- package/dist/ui-core/commands/session-commands.d.ts +0 -4
- package/dist/ui-core/commands/session-commands.js +23 -17
- package/dist/ui-core/commands/session-commands.js.map +1 -1
- package/dist/ui-core/commands/startup-update.d.ts +0 -6
- package/dist/ui-core/commands/startup-update.js +0 -6
- package/dist/ui-core/commands/startup-update.js.map +1 -1
- package/dist/ui-core/composer/arrow-intent.d.ts +0 -10
- package/dist/ui-core/composer/arrow-intent.js +0 -14
- package/dist/ui-core/composer/arrow-intent.js.map +1 -1
- package/dist/ui-core/composer/completion.d.ts +0 -9
- package/dist/ui-core/composer/completion.js +1 -13
- package/dist/ui-core/composer/completion.js.map +1 -1
- package/dist/ui-core/composer/composer-action-port.d.ts +0 -10
- package/dist/ui-core/composer/composer-action-port.js +0 -10
- package/dist/ui-core/composer/composer-action-port.js.map +1 -1
- package/dist/ui-core/composer/composer-height.d.ts +0 -12
- package/dist/ui-core/composer/composer-height.js +0 -12
- package/dist/ui-core/composer/composer-height.js.map +1 -1
- package/dist/ui-core/composer/composer-wheel.d.ts +0 -17
- package/dist/ui-core/composer/composer-wheel.js +0 -17
- package/dist/ui-core/composer/composer-wheel.js.map +1 -1
- package/dist/ui-core/composer/draft-actions.d.ts +0 -14
- package/dist/ui-core/composer/draft-actions.js +0 -13
- package/dist/ui-core/composer/draft-actions.js.map +1 -1
- package/dist/ui-core/composer/history-nav.d.ts +0 -9
- package/dist/ui-core/composer/history-nav.js +0 -9
- package/dist/ui-core/composer/history-nav.js.map +1 -1
- package/dist/ui-core/composer/input-history.d.ts +0 -1
- package/dist/ui-core/composer/input-history.js +0 -1
- package/dist/ui-core/composer/input-history.js.map +1 -1
- package/dist/ui-core/composer/newline-hint.d.ts +0 -7
- package/dist/ui-core/composer/newline-hint.js +0 -9
- package/dist/ui-core/composer/newline-hint.js.map +1 -1
- package/dist/ui-core/composer/paste-placeholder.d.ts +0 -23
- package/dist/ui-core/composer/paste-placeholder.js +0 -21
- package/dist/ui-core/composer/paste-placeholder.js.map +1 -1
- package/dist/ui-core/composer/prompt-history.d.ts +0 -11
- package/dist/ui-core/composer/prompt-history.js +0 -11
- package/dist/ui-core/composer/prompt-history.js.map +1 -1
- package/dist/ui-core/composer/secret-buffer.d.ts +0 -8
- package/dist/ui-core/composer/secret-buffer.js +0 -8
- package/dist/ui-core/composer/secret-buffer.js.map +1 -1
- package/dist/ui-core/composer/textarea-keybindings.d.ts +0 -15
- package/dist/ui-core/composer/textarea-keybindings.js +0 -30
- package/dist/ui-core/composer/textarea-keybindings.js.map +1 -1
- package/dist/ui-core/controllers/focus-controller.d.ts +0 -11
- package/dist/ui-core/controllers/focus-controller.js +0 -11
- package/dist/ui-core/controllers/focus-controller.js.map +1 -1
- package/dist/ui-core/controllers/interruptible-controller.d.ts +0 -6
- package/dist/ui-core/controllers/interruptible-controller.js +0 -6
- package/dist/ui-core/controllers/interruptible-controller.js.map +1 -1
- package/dist/ui-core/controllers/overlay-controller.d.ts +1 -81
- package/dist/ui-core/controllers/overlay-controller.js +1 -48
- package/dist/ui-core/controllers/overlay-controller.js.map +1 -1
- package/dist/ui-core/controllers/selection-controller.d.ts +0 -9
- package/dist/ui-core/controllers/selection-controller.js +0 -7
- package/dist/ui-core/controllers/selection-controller.js.map +1 -1
- package/dist/ui-core/controllers/toast-controller.d.ts +0 -24
- package/dist/ui-core/controllers/toast-controller.js +0 -15
- package/dist/ui-core/controllers/toast-controller.js.map +1 -1
- package/dist/ui-core/layout/compute-layout.d.ts +0 -19
- package/dist/ui-core/layout/compute-layout.js +0 -32
- package/dist/ui-core/layout/compute-layout.js.map +1 -1
- package/dist/ui-core/motion/ease.d.ts +0 -6
- package/dist/ui-core/motion/ease.js +0 -6
- package/dist/ui-core/motion/ease.js.map +1 -1
- package/dist/ui-core/notify.d.ts +0 -8
- package/dist/ui-core/notify.js +0 -8
- package/dist/ui-core/notify.js.map +1 -1
- package/dist/ui-core/plan/plan-lifecycle.d.ts +0 -27
- package/dist/ui-core/plan/plan-lifecycle.js +0 -45
- package/dist/ui-core/plan/plan-lifecycle.js.map +1 -1
- package/dist/ui-core/ports/clipboard-osc52.d.ts +0 -8
- package/dist/ui-core/ports/clipboard-osc52.js +0 -7
- package/dist/ui-core/ports/clipboard-osc52.js.map +1 -1
- package/dist/ui-core/ports/pager-export-port.js +0 -2
- package/dist/ui-core/ports/pager-export-port.js.map +1 -1
- package/dist/ui-core/ports/renderer-port.d.ts +0 -6
- package/dist/ui-core/react/providers.d.ts +0 -7
- package/dist/ui-core/react/providers.js +0 -7
- package/dist/ui-core/react/providers.js.map +1 -1
- package/dist/ui-core/react/use-has-draft.d.ts +0 -5
- package/dist/ui-core/react/use-has-draft.js +0 -5
- package/dist/ui-core/react/use-has-draft.js.map +1 -1
- package/dist/ui-core/react/use-overlay.d.ts +0 -1
- package/dist/ui-core/react/use-overlay.js +0 -1
- package/dist/ui-core/react/use-overlay.js.map +1 -1
- package/dist/ui-core/react/use-plan.d.ts +0 -1
- package/dist/ui-core/react/use-plan.js +0 -1
- package/dist/ui-core/react/use-plan.js.map +1 -1
- package/dist/ui-core/react/use-toast.d.ts +0 -1
- package/dist/ui-core/react/use-toast.js +0 -3
- package/dist/ui-core/react/use-toast.js.map +1 -1
- package/dist/ui-core/react/use-transcript-store.d.ts +0 -7
- package/dist/ui-core/react/use-transcript-store.js +0 -7
- package/dist/ui-core/react/use-transcript-store.js.map +1 -1
- package/dist/ui-core/rendering/artifact-pager-source.d.ts +0 -7
- package/dist/ui-core/rendering/artifact-pager-source.js +0 -3
- package/dist/ui-core/rendering/artifact-pager-source.js.map +1 -1
- package/dist/ui-core/rendering/batch-sections.d.ts +0 -38
- package/dist/ui-core/rendering/batch-sections.js +1 -47
- package/dist/ui-core/rendering/batch-sections.js.map +1 -1
- package/dist/ui-core/rendering/code-block.d.ts +0 -25
- package/dist/ui-core/rendering/code-block.js +0 -47
- package/dist/ui-core/rendering/code-block.js.map +1 -1
- package/dist/ui-core/rendering/context-limit.js +0 -2
- package/dist/ui-core/rendering/context-limit.js.map +1 -1
- package/dist/ui-core/rendering/duration.js +0 -3
- package/dist/ui-core/rendering/duration.js.map +1 -1
- package/dist/ui-core/rendering/exit-summary/table.d.ts +23 -0
- package/dist/ui-core/rendering/exit-summary/table.js +194 -0
- package/dist/ui-core/rendering/exit-summary/table.js.map +1 -0
- package/dist/ui-core/rendering/exit-summary.js +1 -210
- package/dist/ui-core/rendering/exit-summary.js.map +1 -1
- package/dist/ui-core/rendering/file-diff-view.d.ts +0 -27
- package/dist/ui-core/rendering/file-diff-view.js +0 -29
- package/dist/ui-core/rendering/file-diff-view.js.map +1 -1
- package/dist/ui-core/rendering/format-help.d.ts +0 -13
- package/dist/ui-core/rendering/format-help.js +0 -18
- package/dist/ui-core/rendering/format-help.js.map +1 -1
- package/dist/ui-core/rendering/format-keys.js +0 -2
- package/dist/ui-core/rendering/format-keys.js.map +1 -1
- package/dist/ui-core/rendering/format-usage.js +18 -5
- package/dist/ui-core/rendering/format-usage.js.map +1 -1
- package/dist/ui-core/rendering/incremental-strip.js +0 -13
- package/dist/ui-core/rendering/incremental-strip.js.map +1 -1
- package/dist/ui-core/rendering/intro-header.js +0 -1
- package/dist/ui-core/rendering/intro-header.js.map +1 -1
- package/dist/ui-core/rendering/job-tail-source.d.ts +0 -9
- package/dist/ui-core/rendering/job-tail-source.js +0 -9
- package/dist/ui-core/rendering/job-tail-source.js.map +1 -1
- package/dist/ui-core/rendering/link-detector.d.ts +0 -8
- package/dist/ui-core/rendering/link-detector.js +0 -10
- package/dist/ui-core/rendering/link-detector.js.map +1 -1
- package/dist/ui-core/rendering/markdown/tables.d.ts +8 -0
- package/dist/ui-core/rendering/markdown/tables.js +276 -0
- package/dist/ui-core/rendering/markdown/tables.js.map +1 -0
- package/dist/ui-core/rendering/markdown.d.ts +4 -9
- package/dist/ui-core/rendering/markdown.js +224 -593
- package/dist/ui-core/rendering/markdown.js.map +1 -1
- package/dist/ui-core/rendering/open-tool-output.d.ts +0 -30
- package/dist/ui-core/rendering/open-tool-output.js +0 -39
- package/dist/ui-core/rendering/open-tool-output.js.map +1 -1
- package/dist/ui-core/rendering/pager-chrome.d.ts +0 -20
- package/dist/ui-core/rendering/pager-chrome.js +0 -24
- package/dist/ui-core/rendering/pager-chrome.js.map +1 -1
- package/dist/ui-core/rendering/pager-source.d.ts +0 -17
- package/dist/ui-core/rendering/pager-source.js +0 -27
- package/dist/ui-core/rendering/pager-source.js.map +1 -1
- package/dist/ui-core/rendering/pager-text.d.ts +0 -21
- package/dist/ui-core/rendering/pager-text.js +0 -31
- package/dist/ui-core/rendering/pager-text.js.map +1 -1
- package/dist/ui-core/rendering/pager-view-policy.d.ts +0 -24
- package/dist/ui-core/rendering/pager-view-policy.js +0 -31
- package/dist/ui-core/rendering/pager-view-policy.js.map +1 -1
- package/dist/ui-core/rendering/picker-filter.d.ts +0 -11
- package/dist/ui-core/rendering/picker-filter.js +0 -11
- package/dist/ui-core/rendering/picker-filter.js.map +1 -1
- package/dist/ui-core/rendering/plan-view.d.ts +0 -39
- package/dist/ui-core/rendering/plan-view.js +0 -37
- package/dist/ui-core/rendering/plan-view.js.map +1 -1
- package/dist/ui-core/rendering/prompt-preview.d.ts +0 -5
- package/dist/ui-core/rendering/prompt-preview.js +0 -5
- package/dist/ui-core/rendering/prompt-preview.js.map +1 -1
- package/dist/ui-core/rendering/sanitize-display.d.ts +0 -10
- package/dist/ui-core/rendering/sanitize-display.js +0 -14
- package/dist/ui-core/rendering/sanitize-display.js.map +1 -1
- package/dist/ui-core/rendering/status-segments.js +3 -3
- package/dist/ui-core/rendering/status-segments.js.map +1 -1
- package/dist/ui-core/rendering/streaming-markdown.js +0 -11
- package/dist/ui-core/rendering/streaming-markdown.js.map +1 -1
- package/dist/ui-core/rendering/syntax/clike.d.ts +22 -0
- package/dist/ui-core/rendering/syntax/clike.js +168 -0
- package/dist/ui-core/rendering/syntax/clike.js.map +1 -0
- package/dist/ui-core/rendering/syntax/keywords.d.ts +24 -0
- package/dist/ui-core/rendering/syntax/keywords.js +169 -0
- package/dist/ui-core/rendering/syntax/keywords.js.map +1 -0
- package/dist/ui-core/rendering/syntax/language-highlighters.d.ts +18 -0
- package/dist/ui-core/rendering/syntax/language-highlighters.js +538 -0
- package/dist/ui-core/rendering/syntax/language-highlighters.js.map +1 -0
- package/dist/ui-core/rendering/syntax/language-table.d.ts +3 -0
- package/dist/ui-core/rendering/syntax/language-table.js +244 -0
- package/dist/ui-core/rendering/syntax/language-table.js.map +1 -0
- package/dist/ui-core/rendering/syntax-highlight.d.ts +6 -28
- package/dist/ui-core/rendering/syntax-highlight.js +5 -1177
- package/dist/ui-core/rendering/syntax-highlight.js.map +1 -1
- package/dist/ui-core/rendering/text-format.d.ts +0 -3
- package/dist/ui-core/rendering/text-format.js +0 -3
- package/dist/ui-core/rendering/text-format.js.map +1 -1
- package/dist/ui-core/rendering/text-width.d.ts +0 -26
- package/dist/ui-core/rendering/text-width.js +0 -26
- package/dist/ui-core/rendering/text-width.js.map +1 -1
- package/dist/ui-core/rendering/theme.d.ts +0 -65
- package/dist/ui-core/rendering/theme.js +0 -24
- package/dist/ui-core/rendering/theme.js.map +1 -1
- package/dist/ui-core/rendering/thinking-tail.js +0 -3
- package/dist/ui-core/rendering/thinking-tail.js.map +1 -1
- package/dist/ui-core/rendering/tool-presenter.d.ts +0 -41
- package/dist/ui-core/rendering/tool-presenter.js +1 -67
- package/dist/ui-core/rendering/tool-presenter.js.map +1 -1
- package/dist/ui-core/rendering/transcript-semantic.d.ts +0 -8
- package/dist/ui-core/rendering/transcript-semantic.js +0 -13
- package/dist/ui-core/rendering/transcript-semantic.js.map +1 -1
- package/dist/ui-core/rendering/user-message-wrap.d.ts +0 -16
- package/dist/ui-core/rendering/user-message-wrap.js +0 -16
- package/dist/ui-core/rendering/user-message-wrap.js.map +1 -1
- package/dist/ui-core/rendering/wordmark.d.ts +0 -8
- package/dist/ui-core/rendering/wordmark.js +0 -21
- package/dist/ui-core/rendering/wordmark.js.map +1 -1
- package/dist/ui-core/state/hydrate/classic-transcript.d.ts +8 -0
- package/dist/ui-core/state/hydrate/classic-transcript.js +168 -0
- package/dist/ui-core/state/hydrate/classic-transcript.js.map +1 -0
- package/dist/ui-core/state/hydrate/from-messages.d.ts +6 -0
- package/dist/ui-core/state/hydrate/from-messages.js +237 -0
- package/dist/ui-core/state/hydrate/from-messages.js.map +1 -0
- package/dist/ui-core/state/pager-search.d.ts +0 -9
- package/dist/ui-core/state/pager-search.js +1 -8
- package/dist/ui-core/state/pager-search.js.map +1 -1
- package/dist/ui-core/state/semantic-document.d.ts +0 -8
- package/dist/ui-core/state/semantic-document.js +0 -8
- package/dist/ui-core/state/semantic-document.js.map +1 -1
- package/dist/ui-core/state/thinking-copy.d.ts +0 -8
- package/dist/ui-core/state/thinking-copy.js +0 -8
- package/dist/ui-core/state/thinking-copy.js.map +1 -1
- package/dist/ui-core/state/transcript/apply-app-event.d.ts +8 -0
- package/dist/ui-core/state/transcript/apply-app-event.js +406 -0
- package/dist/ui-core/state/transcript/apply-app-event.js.map +1 -0
- package/dist/ui-core/state/transcript/message-lifecycle.d.ts +7 -0
- package/dist/ui-core/state/transcript/message-lifecycle.js +285 -0
- package/dist/ui-core/state/transcript/message-lifecycle.js.map +1 -0
- package/dist/ui-core/state/transcript-compaction.d.ts +0 -19
- package/dist/ui-core/state/transcript-compaction.js +0 -21
- package/dist/ui-core/state/transcript-compaction.js.map +1 -1
- package/dist/ui-core/state/transcript-hydrate.d.ts +6 -52
- package/dist/ui-core/state/transcript-hydrate.js +5 -470
- package/dist/ui-core/state/transcript-hydrate.js.map +1 -1
- package/dist/ui-core/state/transcript-reducer.d.ts +1 -15
- package/dist/ui-core/state/transcript-reducer.js +1 -708
- package/dist/ui-core/state/transcript-reducer.js.map +1 -1
- package/dist/ui-core/state/transcript-search.d.ts +0 -8
- package/dist/ui-core/state/transcript-search.js +0 -8
- package/dist/ui-core/state/transcript-search.js.map +1 -1
- package/dist/ui-core/state/transcript-store.d.ts +0 -26
- package/dist/ui-core/state/transcript-store.js +0 -28
- package/dist/ui-core/state/transcript-store.js.map +1 -1
- package/dist/ui-core/state/transcript-types.d.ts +0 -33
- package/dist/ui-core/state/transcript-types.js +0 -17
- package/dist/ui-core/state/transcript-types.js.map +1 -1
- package/dist/ui-core/state/transcript-window.d.ts +0 -8
- package/dist/ui-core/state/transcript-window.js +0 -8
- package/dist/ui-core/state/transcript-window.js.map +1 -1
- package/dist/version.generated.d.ts +2 -2
- package/dist/version.generated.js +2 -2
- package/package.json +19 -2
- package/dist/agent/finalize-gate.d.ts +0 -54
- package/dist/agent/finalize-gate.js +0 -97
- package/dist/agent/finalize-gate.js.map +0 -1
- package/dist/agent/must-continue.d.ts +0 -36
- package/dist/agent/must-continue.js +0 -172
- package/dist/agent/must-continue.js.map +0 -1
package/dist/tools/fs.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { open,
|
|
1
|
+
import { lstatSync, readlinkSync, realpathSync } from "node:fs";
|
|
2
|
+
import { open, readFile, unlink, rename, mkdir, stat, chmod, } from "node:fs/promises";
|
|
3
3
|
import { join, dirname, basename, relative, resolve } from "node:path";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
import { createInterface } from "node:readline";
|
|
6
4
|
import { homedir, tmpdir } from "node:os";
|
|
7
|
-
import { execa } from "execa";
|
|
8
5
|
import { getConfig } from "../store/config.js";
|
|
9
6
|
import { safeCwd } from "../os/cwd.js";
|
|
10
|
-
import { getActiveProjectRoot
|
|
11
|
-
import { buildFileChange
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* stays 0755 and a private key/config stays 0600 after an edit.
|
|
19
|
-
* - Data is flushed (fsync) before the rename, and the temp file is removed on
|
|
20
|
-
* any failure so a crash cannot leave a stray `.clai-*` file behind.
|
|
21
|
-
*/
|
|
7
|
+
import { getActiveProjectRoot } from "../agent/project-root.js";
|
|
8
|
+
import { buildFileChange } from "./file-diff.js";
|
|
9
|
+
import { describeWrite } from "./fs/mutations.js";
|
|
10
|
+
import { ensureWriteAllowed } from "./fs/internals.js";
|
|
11
|
+
import { resolvePath } from "./fs/internals-2.js";
|
|
12
|
+
export { fsList, fsRead } from "./fs/read.js";
|
|
13
|
+
export { fsAppend, fsDelete, fsEdit, fsWriteMany } from "./fs/mutations.js";
|
|
14
|
+
export { fsSearch } from "./fs/search.js";
|
|
22
15
|
let atomicWriteCounter = 0;
|
|
23
16
|
const fileMutationLanes = new Map();
|
|
24
17
|
const RETRYABLE_FS_CODES = new Set(["EAGAIN", "EBUSY", "EMFILE", "ENFILE", "EPERM"]);
|
|
@@ -28,7 +21,7 @@ function mutationKey(path) {
|
|
|
28
21
|
function mutationTarget(path) {
|
|
29
22
|
return canonicalizeForContainment(path) ?? path;
|
|
30
23
|
}
|
|
31
|
-
async function withFileMutation(path, operation) {
|
|
24
|
+
export async function withFileMutation(path, operation) {
|
|
32
25
|
const key = mutationKey(mutationTarget(path));
|
|
33
26
|
const previous = fileMutationLanes.get(key) ?? Promise.resolve();
|
|
34
27
|
let release;
|
|
@@ -46,39 +39,6 @@ async function withFileMutation(path, operation) {
|
|
|
46
39
|
fileMutationLanes.delete(key);
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
|
-
function appendShrankFailure(path, expected, actual) {
|
|
50
|
-
return {
|
|
51
|
-
ok: false,
|
|
52
|
-
output: `fs.append integrity check failed: expected prior bytes=${expected} but the file is only ${actual}. ` +
|
|
53
|
-
`It was truncated or this is the wrong path — appending would silently drop the missing content. (${path})`,
|
|
54
|
-
exitCode: 1,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function appendAlreadyApplied(original, content, position) {
|
|
58
|
-
if (content.length === 0)
|
|
59
|
-
return false;
|
|
60
|
-
return position === "start"
|
|
61
|
-
? original.startsWith(content)
|
|
62
|
-
: original.endsWith(content);
|
|
63
|
-
}
|
|
64
|
-
async function fileTailEquals(path, size, content) {
|
|
65
|
-
const expected = Buffer.from(content, "utf8");
|
|
66
|
-
if (expected.length === 0 || size < expected.length)
|
|
67
|
-
return false;
|
|
68
|
-
let handle;
|
|
69
|
-
try {
|
|
70
|
-
handle = await open(path, "r");
|
|
71
|
-
const buffer = Buffer.alloc(expected.length);
|
|
72
|
-
await handle.read(buffer, 0, expected.length, size - expected.length);
|
|
73
|
-
return buffer.equals(expected);
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
finally {
|
|
79
|
-
await handle?.close().catch(() => undefined);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
42
|
function retryableFsError(error) {
|
|
83
43
|
const code = error && typeof error === "object" && "code" in error
|
|
84
44
|
? String(error.code ?? "")
|
|
@@ -126,50 +86,6 @@ export async function writeFileAtomic(resolved, contents) {
|
|
|
126
86
|
}
|
|
127
87
|
}
|
|
128
88
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Threshold above which whole-file mutation is refused or replaced by an
|
|
131
|
-
* in-place strategy. Reading and rewriting a very large file holds 2x its size
|
|
132
|
-
* in heap in a process that also carries transcript state.
|
|
133
|
-
*/
|
|
134
|
-
const LARGE_MUTATION_BYTES = 8 * 1024 * 1024;
|
|
135
|
-
/** Compact integrity footer so the model trusts a write without re-reading. */
|
|
136
|
-
function describeWrite(path, content, verb) {
|
|
137
|
-
const bytes = Buffer.byteLength(content, "utf8");
|
|
138
|
-
const lines = content.length === 0 ? 0 : content.split(/\r?\n/).length;
|
|
139
|
-
const sha = createHash("sha256").update(content, "utf8").digest("hex").slice(0, 12);
|
|
140
|
-
const lastNonEmpty = content
|
|
141
|
-
.split(/\r?\n/)
|
|
142
|
-
.map((l) => l.trimEnd())
|
|
143
|
-
.filter((l) => l.length > 0)
|
|
144
|
-
.at(-1);
|
|
145
|
-
const tail = lastNonEmpty
|
|
146
|
-
? lastNonEmpty.length > 80
|
|
147
|
-
? `${lastNonEmpty.slice(0, 77)}…`
|
|
148
|
-
: lastNonEmpty
|
|
149
|
-
: "(empty)";
|
|
150
|
-
return (`${verb} ${path}\n` +
|
|
151
|
-
` bytes=${bytes} lines=${lines} sha256_12=${sha}\n` +
|
|
152
|
-
` ends_with: ${JSON.stringify(tail)}\n` +
|
|
153
|
-
` Do NOT re-read this file to verify the write unless editing further — trust this receipt.`);
|
|
154
|
-
}
|
|
155
|
-
// Full-file soft caps. Normal source files fit; logs/dumps/minified bundles
|
|
156
|
-
// auto-page with a head window + next-offset instructions instead of dumping
|
|
157
|
-
// megabytes into context. Hard byte ceiling still applies for raw full reads.
|
|
158
|
-
const DEFAULT_READ_MAX_BYTES = 8 * 1024 * 1024;
|
|
159
|
-
/** Soft auto-head when full read would blow the budget (bytes). */
|
|
160
|
-
const SOFT_FULL_READ_BYTES = 256 * 1024;
|
|
161
|
-
/** Soft auto-head when file has more than this many lines. */
|
|
162
|
-
const SOFT_FULL_READ_LINES = 2000;
|
|
163
|
-
/** Default lines for auto-head / default line-window limit. */
|
|
164
|
-
const DEFAULT_LINE_WINDOW = 200;
|
|
165
|
-
const DEFAULT_LIST_MAX_ENTRIES = 500;
|
|
166
|
-
/** Pattern scan hard stop (bytes streamed). */
|
|
167
|
-
const PATTERN_SCAN_MAX_BYTES = 32 * 1024 * 1024;
|
|
168
|
-
const DEFAULT_PATTERN_MAX_MATCHES = 20;
|
|
169
|
-
const HARD_PATTERN_MAX_MATCHES = 100;
|
|
170
|
-
const DEFAULT_PATTERN_CONTEXT = 2;
|
|
171
|
-
const HARD_PATTERN_CONTEXT = 20;
|
|
172
|
-
const BINARY_SAMPLE_BYTES = 8192;
|
|
173
89
|
function expandHome(path) {
|
|
174
90
|
if (path === "~")
|
|
175
91
|
return homedir();
|
|
@@ -178,21 +94,6 @@ function expandHome(path) {
|
|
|
178
94
|
}
|
|
179
95
|
return path;
|
|
180
96
|
}
|
|
181
|
-
/** Resolve path with tilde expansion + sticky plan project root for relatives. */
|
|
182
|
-
function resolvePath(path) {
|
|
183
|
-
const resolved = resolveToolPath(path);
|
|
184
|
-
return remapAgentCwdWrite(resolved, path);
|
|
185
|
-
}
|
|
186
|
-
/** Resolve path for reads: tilde expansion + project root for relatives.
|
|
187
|
-
* Reads should never apply the write-only agent→project remap. */
|
|
188
|
-
function resolveReadPath(path) {
|
|
189
|
-
return resolveToolPath(path);
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Decide whether a path falls inside configured sandbox roots / cwd / home.
|
|
193
|
-
* Used for UX (outside-cwd confirm) and optional sandboxReads opt-in.
|
|
194
|
-
* Writes are not hard-blocked by sandbox — outside cwd always prompts instead.
|
|
195
|
-
*/
|
|
196
97
|
export function pathInsideSandbox(resolvedPath, mode) {
|
|
197
98
|
const roots = [
|
|
198
99
|
...getConfig().sandboxRoots.map((root) => resolve(expandHome(root))),
|
|
@@ -207,17 +108,10 @@ export function pathInsideSandbox(resolvedPath, mode) {
|
|
|
207
108
|
return (rel === "" || (!rel.startsWith("..") && !resolve(rel).startsWith("..")));
|
|
208
109
|
});
|
|
209
110
|
}
|
|
210
|
-
/** True when target is under root (or equal). */
|
|
211
111
|
function isUnderRoot(root, target) {
|
|
212
112
|
const rel = relative(resolve(root), resolve(target));
|
|
213
|
-
return rel === "" || (!rel.startsWith("..") && !resolve(rel).startsWith(".."));
|
|
113
|
+
return (rel === "" || (!rel.startsWith("..") && !resolve(rel).startsWith("..")));
|
|
214
114
|
}
|
|
215
|
-
/**
|
|
216
|
-
* Canonicalize an existing target or its nearest existing ancestor. This
|
|
217
|
-
* resolves directory and leaf symlinks even when the final file does not yet
|
|
218
|
-
* exist, so lexical `project/link/file` paths cannot escape a trusted root.
|
|
219
|
-
* Returning undefined is conservative: callers must require confirmation.
|
|
220
|
-
*/
|
|
221
115
|
function canonicalizeForContainment(path) {
|
|
222
116
|
let cursor = resolve(path);
|
|
223
117
|
let suffix = [];
|
|
@@ -246,13 +140,6 @@ function canonicalizeForContainment(path) {
|
|
|
246
140
|
}
|
|
247
141
|
}
|
|
248
142
|
}
|
|
249
|
-
/**
|
|
250
|
-
* True when a write sits outside the working directory and active project
|
|
251
|
-
* root, but not system temp / scratch (agent scratch lives under tmpdir and
|
|
252
|
-
* must not spam confirmations). Default permissions confirm such writes;
|
|
253
|
-
* allow-all auto-approves them. Deletes are handled separately and always
|
|
254
|
-
* confirm.
|
|
255
|
-
*/
|
|
256
143
|
export function isOutsideWorkingDirectory(resolvedPath) {
|
|
257
144
|
const target = canonicalizeForContainment(resolvedPath);
|
|
258
145
|
if (!target)
|
|
@@ -264,11 +151,6 @@ export function isOutsideWorkingDirectory(resolvedPath) {
|
|
|
264
151
|
const canonicalProject = projectRoot
|
|
265
152
|
? canonicalizeForContainment(projectRoot)
|
|
266
153
|
: undefined;
|
|
267
|
-
// A scaffolded/discovered project can intentionally live outside the CLAI
|
|
268
|
-
// process cwd (for example ~/Desktop/bloging-app). Once that root is pinned,
|
|
269
|
-
// writes inside it are part of the active user-approved workspace and should
|
|
270
|
-
// honor allow-all instead of prompting for every file. Siblings and deletes
|
|
271
|
-
// remain protected by the runner's normal confirmation rules.
|
|
272
154
|
if (canonicalProject && isUnderRoot(canonicalProject, target))
|
|
273
155
|
return false;
|
|
274
156
|
const canonicalTmp = canonicalizeForContainment(tmpdir());
|
|
@@ -276,454 +158,9 @@ export function isOutsideWorkingDirectory(resolvedPath) {
|
|
|
276
158
|
return false;
|
|
277
159
|
return true;
|
|
278
160
|
}
|
|
279
|
-
/** Resolve a tool path for permission checks (tilde + project root). */
|
|
280
161
|
export function resolveFsToolPath(path) {
|
|
281
162
|
return resolvePath(path);
|
|
282
163
|
}
|
|
283
|
-
/** Throw with a useful message when a read/list/search escapes the sandbox. */
|
|
284
|
-
function ensureReadAllowed(resolved, original, confirmed) {
|
|
285
|
-
if (confirmed)
|
|
286
|
-
return;
|
|
287
|
-
// Unrestricted reads by default (sandboxReads=false). When enabled, still
|
|
288
|
-
// allow after user confirmation.
|
|
289
|
-
if (getConfig().sandboxReads === false)
|
|
290
|
-
return;
|
|
291
|
-
if (!pathInsideSandbox(resolved, "read")) {
|
|
292
|
-
throw new Error(`Read blocked — "${original}" resolves outside the approved sandbox roots. Add the path with /cwd or sandboxRoots, or set sandboxReads=false.`);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Resolve path for writes. Outside-cwd is not hard-blocked — the runner
|
|
297
|
-
* confirms such writes under default permissions and honors allow-all. No
|
|
298
|
-
* secret-path gate (pentest must be free to touch .ssh/.env-like paths on
|
|
299
|
-
* targets).
|
|
300
|
-
*/
|
|
301
|
-
function ensureWriteAllowed(path, confirmed) {
|
|
302
|
-
const resolved = resolvePath(path);
|
|
303
|
-
void confirmed;
|
|
304
|
-
return resolved;
|
|
305
|
-
}
|
|
306
|
-
/** Stream file lines without loading the whole file into memory. */
|
|
307
|
-
async function* iterateFileLines(resolved) {
|
|
308
|
-
const stream = createReadStream(resolved, { encoding: "utf8" });
|
|
309
|
-
const rl = createInterface({ input: stream, crlfDelay: Infinity });
|
|
310
|
-
try {
|
|
311
|
-
for await (const line of rl) {
|
|
312
|
-
yield line;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
finally {
|
|
316
|
-
rl.close();
|
|
317
|
-
stream.destroy();
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
async function sampleLooksBinary(resolved) {
|
|
321
|
-
const handle = await open(resolved, "r");
|
|
322
|
-
try {
|
|
323
|
-
const buf = Buffer.alloc(BINARY_SAMPLE_BYTES);
|
|
324
|
-
const { bytesRead } = await handle.read(buf, 0, BINARY_SAMPLE_BYTES, 0);
|
|
325
|
-
if (bytesRead === 0)
|
|
326
|
-
return false;
|
|
327
|
-
const sample = buf.subarray(0, bytesRead);
|
|
328
|
-
// NUL in the first chunk → almost certainly binary.
|
|
329
|
-
if (sample.includes(0))
|
|
330
|
-
return true;
|
|
331
|
-
// High ratio of non-text control bytes (excluding tab/lf/cr).
|
|
332
|
-
let control = 0;
|
|
333
|
-
for (let i = 0; i < sample.length; i += 1) {
|
|
334
|
-
const c = sample[i];
|
|
335
|
-
if (c < 9 || (c > 13 && c < 32) || c === 127)
|
|
336
|
-
control += 1;
|
|
337
|
-
}
|
|
338
|
-
return control / sample.length > 0.1;
|
|
339
|
-
}
|
|
340
|
-
finally {
|
|
341
|
-
await handle.close().catch(() => undefined);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Normalize pattern strings models commonly emit:
|
|
346
|
-
* - `/foo/i` or `/foo/gim` → body + flags
|
|
347
|
-
* - bare `foo` → source as-is
|
|
348
|
-
* Never throws; invalid regex returns a clear error the model can fix.
|
|
349
|
-
*/
|
|
350
|
-
function compileReadPattern(source, caseInsensitive) {
|
|
351
|
-
let trimmed = source.trim();
|
|
352
|
-
if (!trimmed) {
|
|
353
|
-
return {
|
|
354
|
-
ok: false,
|
|
355
|
-
error: 'fs.read pattern must be a non-empty string. Examples: "function\\\\s+foo", "export function handle", or "/TODO/i". Do not pass an empty pattern.',
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
let flags = caseInsensitive ? "i" : "";
|
|
359
|
-
// Accept /pattern/flags form that models often copy from editors.
|
|
360
|
-
const slashForm = trimmed.match(/^\/([\s\S]+)\/([gimsuy]*)$/);
|
|
361
|
-
if (slashForm) {
|
|
362
|
-
trimmed = slashForm[1];
|
|
363
|
-
const fromSlash = slashForm[2] ?? "";
|
|
364
|
-
// Drop global — we scan line-by-line; g would make lastIndex sticky bugs.
|
|
365
|
-
flags = [...new Set(`${flags}${fromSlash}`.replace(/g/g, "").split(""))].join("");
|
|
366
|
-
}
|
|
367
|
-
if (!trimmed) {
|
|
368
|
-
return {
|
|
369
|
-
ok: false,
|
|
370
|
-
error: 'fs.read pattern body is empty after stripping /…/ delimiters. Pass a real pattern, e.g. "class\\\\s+App".',
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
try {
|
|
374
|
-
return { ok: true, re: new RegExp(trimmed, flags || undefined) };
|
|
375
|
-
}
|
|
376
|
-
catch (error) {
|
|
377
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
378
|
-
return {
|
|
379
|
-
ok: false,
|
|
380
|
-
error: `Invalid regex pattern: ${msg}. ` +
|
|
381
|
-
`Pass a JS regex source (escape special chars) or /pattern/flags. ` +
|
|
382
|
-
`For literal text with dots/parens, escape them (e.g. "foo\\\\.bar\\\\(") or use fs.search then fs.read with offset around the hit line.`,
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
function resolveLineWindow(options) {
|
|
387
|
-
const hasStart = typeof options.startLine === "number" || typeof options.offset === "number";
|
|
388
|
-
const hasEnd = typeof options.endLine === "number";
|
|
389
|
-
const hasLimit = typeof options.limit === "number";
|
|
390
|
-
if (!hasStart && !hasEnd && !hasLimit) {
|
|
391
|
-
return { ok: true, start: 1, limit: DEFAULT_LINE_WINDOW };
|
|
392
|
-
}
|
|
393
|
-
let start = 1;
|
|
394
|
-
let note;
|
|
395
|
-
if (typeof options.startLine === "number" && typeof options.offset === "number") {
|
|
396
|
-
if (options.startLine !== options.offset) {
|
|
397
|
-
note = `note: both startLine=${options.startLine} and offset=${options.offset} set; using startLine`;
|
|
398
|
-
}
|
|
399
|
-
start = options.startLine;
|
|
400
|
-
}
|
|
401
|
-
else if (typeof options.startLine === "number") {
|
|
402
|
-
start = options.startLine;
|
|
403
|
-
}
|
|
404
|
-
else if (typeof options.offset === "number") {
|
|
405
|
-
start = options.offset;
|
|
406
|
-
}
|
|
407
|
-
else if (hasEnd) {
|
|
408
|
-
// endLine alone: treat as lines 1..endLine
|
|
409
|
-
start = 1;
|
|
410
|
-
}
|
|
411
|
-
if (!Number.isFinite(start)) {
|
|
412
|
-
return { ok: false, error: "fs.read startLine/offset must be a number" };
|
|
413
|
-
}
|
|
414
|
-
start = Math.floor(start);
|
|
415
|
-
// Models often send 0-based offsets; lines are 1-indexed — coerce gently.
|
|
416
|
-
if (start === 0) {
|
|
417
|
-
start = 1;
|
|
418
|
-
note = note
|
|
419
|
-
? `${note}; offset/startLine 0 treated as 1 (lines are 1-indexed)`
|
|
420
|
-
: "note: offset/startLine 0 treated as 1 (lines are 1-indexed)";
|
|
421
|
-
}
|
|
422
|
-
else if (start < 1) {
|
|
423
|
-
return {
|
|
424
|
-
ok: false,
|
|
425
|
-
error: "fs.read startLine/offset must be an integer >= 1 (or 0, treated as 1)",
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
let limit;
|
|
429
|
-
if (hasEnd) {
|
|
430
|
-
const end = options.endLine;
|
|
431
|
-
if (!Number.isInteger(end) && !Number.isFinite(end)) {
|
|
432
|
-
return { ok: false, error: "fs.read endLine must be a number" };
|
|
433
|
-
}
|
|
434
|
-
const endLine = Math.floor(end);
|
|
435
|
-
if (endLine < start) {
|
|
436
|
-
return {
|
|
437
|
-
ok: false,
|
|
438
|
-
error: `fs.read requires startLine/offset <= endLine (got ${start}..${endLine})`,
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
limit = endLine - start + 1;
|
|
442
|
-
if (hasLimit && options.limit > 0 && options.limit < limit) {
|
|
443
|
-
limit = Math.floor(options.limit);
|
|
444
|
-
note = note
|
|
445
|
-
? `${note}; limit=${limit} caps endLine window`
|
|
446
|
-
: `note: limit=${limit} caps endLine window`;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
else if (hasLimit && options.limit > 0) {
|
|
450
|
-
limit = Math.floor(options.limit);
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
limit = DEFAULT_LINE_WINDOW;
|
|
454
|
-
}
|
|
455
|
-
if (limit < 1) {
|
|
456
|
-
return { ok: false, error: "fs.read limit must be a positive integer" };
|
|
457
|
-
}
|
|
458
|
-
// Hard cap per call so a bad limit cannot dump millions of lines.
|
|
459
|
-
limit = Math.min(limit, 5000);
|
|
460
|
-
return note ? { ok: true, start, limit, note } : { ok: true, start, limit };
|
|
461
|
-
}
|
|
462
|
-
async function readLineWindow(resolved, start, limit, fileBytes, note) {
|
|
463
|
-
const collected = [];
|
|
464
|
-
let lineNo = 0;
|
|
465
|
-
let totalLines = 0;
|
|
466
|
-
let reachedEnd = true;
|
|
467
|
-
for await (const line of iterateFileLines(resolved)) {
|
|
468
|
-
lineNo += 1;
|
|
469
|
-
totalLines = lineNo;
|
|
470
|
-
if (lineNo < start)
|
|
471
|
-
continue;
|
|
472
|
-
if (collected.length < limit) {
|
|
473
|
-
collected.push(`${lineNo}: ${line}`);
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
476
|
-
// Keep counting remaining lines for accurate "of N" footer when cheap.
|
|
477
|
-
// For huge files we still stream once; stop counting past a soft ceiling
|
|
478
|
-
// after the window is full so we don't burn CPU on multi-GB logs.
|
|
479
|
-
if (lineNo >= start + limit + 200_000) {
|
|
480
|
-
reachedEnd = false;
|
|
481
|
-
break;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
if (collected.length === 0) {
|
|
486
|
-
const header = `# fs.read path=${resolved} bytes=${fileBytes}\n` +
|
|
487
|
-
(totalLines === 0
|
|
488
|
-
? `# file is empty\n`
|
|
489
|
-
: `# requested lines ${start}+ but file has only ${totalLines} line(s)\n`) +
|
|
490
|
-
`# next: use a smaller offset, or omit offset/limit for auto-head on large files`;
|
|
491
|
-
return {
|
|
492
|
-
ok: true,
|
|
493
|
-
output: note ? `${header}\n# ${note}` : header,
|
|
494
|
-
truncated: false,
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
const first = start;
|
|
498
|
-
const last = start + collected.length - 1;
|
|
499
|
-
const hasMore = !reachedEnd || totalLines > last;
|
|
500
|
-
const totalLabel = reachedEnd ? String(totalLines) : `${totalLines}+`;
|
|
501
|
-
const header = `# fs.read path=${resolved} lines=${first}-${last} of ${totalLabel} bytes=${fileBytes}` +
|
|
502
|
-
(note ? `\n# ${note}` : "");
|
|
503
|
-
const next = hasMore
|
|
504
|
-
? `\n# hasMore=true next=${JSON.stringify({ offset: last + 1, limit })}`
|
|
505
|
-
: `\n# hasMore=false`;
|
|
506
|
-
return {
|
|
507
|
-
ok: true,
|
|
508
|
-
output: `${header}\n${collected.join("\n")}${next}`,
|
|
509
|
-
truncated: hasMore,
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
async function readByPattern(resolved, options, fileBytes) {
|
|
513
|
-
const compiled = compileReadPattern(options.pattern ?? "", options.caseInsensitive);
|
|
514
|
-
if (!compiled.ok) {
|
|
515
|
-
return { ok: false, output: compiled.error, exitCode: 1 };
|
|
516
|
-
}
|
|
517
|
-
const re = compiled.re;
|
|
518
|
-
const context = Math.min(HARD_PATTERN_CONTEXT, Math.max(0, Math.floor(options.context ?? DEFAULT_PATTERN_CONTEXT)));
|
|
519
|
-
const maxMatches = Math.min(HARD_PATTERN_MAX_MATCHES, Math.max(1, Math.floor(options.maxMatches ?? DEFAULT_PATTERN_MAX_MATCHES)));
|
|
520
|
-
// Optional range filter when offset/startLine/endLine also provided.
|
|
521
|
-
let rangeStart = 1;
|
|
522
|
-
let rangeEnd = Number.POSITIVE_INFINITY;
|
|
523
|
-
if (typeof options.offset === "number" ||
|
|
524
|
-
typeof options.startLine === "number" ||
|
|
525
|
-
typeof options.endLine === "number" ||
|
|
526
|
-
typeof options.limit === "number") {
|
|
527
|
-
const win = resolveLineWindow(options);
|
|
528
|
-
if (!win.ok)
|
|
529
|
-
return { ok: false, output: win.error, exitCode: 1 };
|
|
530
|
-
rangeStart = win.start;
|
|
531
|
-
rangeEnd = win.start + win.limit - 1;
|
|
532
|
-
}
|
|
533
|
-
// Ring buffer of recent lines for leading context.
|
|
534
|
-
const ring = [];
|
|
535
|
-
const matchBlocks = [];
|
|
536
|
-
let matches = 0;
|
|
537
|
-
let lineNo = 0;
|
|
538
|
-
let bytesSeen = 0;
|
|
539
|
-
let truncatedScan = false;
|
|
540
|
-
/** Lines still needed as trailing context after a match. */
|
|
541
|
-
let pendingAfter = 0;
|
|
542
|
-
let currentBlock = [];
|
|
543
|
-
const flushBlock = () => {
|
|
544
|
-
if (currentBlock.length === 0)
|
|
545
|
-
return;
|
|
546
|
-
matchBlocks.push(currentBlock.join("\n"));
|
|
547
|
-
currentBlock = [];
|
|
548
|
-
};
|
|
549
|
-
for await (const line of iterateFileLines(resolved)) {
|
|
550
|
-
lineNo += 1;
|
|
551
|
-
bytesSeen += Buffer.byteLength(line, "utf8") + 1;
|
|
552
|
-
if (bytesSeen > PATTERN_SCAN_MAX_BYTES) {
|
|
553
|
-
truncatedScan = true;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
// Maintain ring for context-before (only lines we might need).
|
|
557
|
-
ring.push(line);
|
|
558
|
-
if (ring.length > context + 1)
|
|
559
|
-
ring.shift();
|
|
560
|
-
const inRange = lineNo >= rangeStart && lineNo <= rangeEnd;
|
|
561
|
-
const isMatch = inRange && re.test(line);
|
|
562
|
-
if (pendingAfter > 0 && !isMatch) {
|
|
563
|
-
currentBlock.push(`${lineNo}: ${line}`);
|
|
564
|
-
pendingAfter -= 1;
|
|
565
|
-
if (pendingAfter === 0)
|
|
566
|
-
flushBlock();
|
|
567
|
-
// After draining trailing context for the last shown match, keep
|
|
568
|
-
// scanning only long enough to learn whether more matches exist.
|
|
569
|
-
if (matches >= maxMatches && pendingAfter === 0) {
|
|
570
|
-
// fall through to isMatch checks below on later lines
|
|
571
|
-
}
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
if (isMatch && matches < maxMatches) {
|
|
575
|
-
// If we were still emitting after-context, close previous block first
|
|
576
|
-
// only when this match is outside that window; otherwise merge.
|
|
577
|
-
if (pendingAfter === 0 && currentBlock.length > 0)
|
|
578
|
-
flushBlock();
|
|
579
|
-
if (pendingAfter === 0) {
|
|
580
|
-
// Leading context from ring (exclude current line, last is current).
|
|
581
|
-
const before = ring.slice(0, Math.max(0, ring.length - 1));
|
|
582
|
-
const startCtx = before.slice(Math.max(0, before.length - context));
|
|
583
|
-
const ctxStartLine = lineNo - startCtx.length;
|
|
584
|
-
for (let i = 0; i < startCtx.length; i += 1) {
|
|
585
|
-
currentBlock.push(`${ctxStartLine + i}: ${startCtx[i]}`);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
currentBlock.push(`${lineNo}: ${line}`);
|
|
589
|
-
matches += 1;
|
|
590
|
-
pendingAfter = context;
|
|
591
|
-
if (pendingAfter === 0)
|
|
592
|
-
flushBlock();
|
|
593
|
-
// Do not break yet: keep scanning so hasMore can detect further hits.
|
|
594
|
-
continue;
|
|
595
|
-
}
|
|
596
|
-
if (isMatch && matches >= maxMatches) {
|
|
597
|
-
// One more hit beyond the display cap → hasMore.
|
|
598
|
-
matches += 1;
|
|
599
|
-
break;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
if (pendingAfter > 0)
|
|
603
|
-
flushBlock();
|
|
604
|
-
const capped = matches > maxMatches;
|
|
605
|
-
const shown = Math.min(matches, maxMatches);
|
|
606
|
-
const header = `# fs.read path=${resolved} pattern=${JSON.stringify(options.pattern)} ` +
|
|
607
|
-
`matches=${shown}${capped ? `+` : ""} ` +
|
|
608
|
-
`context=${context} bytes=${fileBytes}` +
|
|
609
|
-
(truncatedScan
|
|
610
|
-
? `\n# scan stopped at ${PATTERN_SCAN_MAX_BYTES} bytes (file large; narrow with startLine/endLine or use fs.search)`
|
|
611
|
-
: "") +
|
|
612
|
-
(rangeEnd !== Number.POSITIVE_INFINITY
|
|
613
|
-
? `\n# searched lines ${rangeStart}-${rangeEnd === Number.POSITIVE_INFINITY ? "∞" : rangeEnd}`
|
|
614
|
-
: "");
|
|
615
|
-
if (shown === 0) {
|
|
616
|
-
return {
|
|
617
|
-
ok: true,
|
|
618
|
-
output: `${header}\n# no matches. Try a simpler pattern, caseInsensitive:true, or fs.search for multi-file hits.\n` +
|
|
619
|
-
`# tip: fs.read with offset/limit to page, or omit pattern for full/auto-head read`,
|
|
620
|
-
truncated: truncatedScan,
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
const body = matchBlocks.join("\n--\n");
|
|
624
|
-
const footer = capped
|
|
625
|
-
? `\n# hasMore=true (capped at maxMatches=${maxMatches}; raise maxMatches up to ${HARD_PATTERN_MAX_MATCHES} or narrow the range)`
|
|
626
|
-
: `\n# hasMore=false`;
|
|
627
|
-
return {
|
|
628
|
-
ok: true,
|
|
629
|
-
output: `${header}\n${body}${footer}`,
|
|
630
|
-
truncated: truncatedScan || capped,
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
export async function fsRead(path, options = {}) {
|
|
634
|
-
const resolved = resolveReadPath(path);
|
|
635
|
-
ensureReadAllowed(resolved, path, options.confirmed);
|
|
636
|
-
// Directory → list contents (models often fs.read a folder by mistake).
|
|
637
|
-
let fileBytes = 0;
|
|
638
|
-
try {
|
|
639
|
-
const st = await stat(resolved);
|
|
640
|
-
if (st.isDirectory()) {
|
|
641
|
-
const listed = await fsList(resolved, {
|
|
642
|
-
maxEntries: options.limit && options.limit > 0 ? options.limit : undefined,
|
|
643
|
-
confirmed: options.confirmed,
|
|
644
|
-
});
|
|
645
|
-
return {
|
|
646
|
-
...listed,
|
|
647
|
-
output: `Path is a directory (not a file): ${resolved}\n` +
|
|
648
|
-
`Listing contents (use fs.list for dirs, fs.read for files):\n\n` +
|
|
649
|
-
(listed.output ?? ""),
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
if (!st.isFile()) {
|
|
653
|
-
return {
|
|
654
|
-
ok: false,
|
|
655
|
-
output: `Not a regular file or directory: ${resolved}`,
|
|
656
|
-
exitCode: 1,
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
fileBytes = st.size;
|
|
660
|
-
}
|
|
661
|
-
catch (error) {
|
|
662
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
663
|
-
return { ok: false, output: msg, exitCode: 1 };
|
|
664
|
-
}
|
|
665
|
-
if (await sampleLooksBinary(resolved)) {
|
|
666
|
-
return {
|
|
667
|
-
ok: false,
|
|
668
|
-
output: `Binary or non-text file: ${resolved} (${fileBytes} bytes). ` +
|
|
669
|
-
`Use shell tools for hex/binary inspection, or fs.read with maxBytes only after confirming it is text.`,
|
|
670
|
-
exitCode: 1,
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
// 1) Pattern mode
|
|
674
|
-
if (typeof options.pattern === "string") {
|
|
675
|
-
return readByPattern(resolved, options, fileBytes);
|
|
676
|
-
}
|
|
677
|
-
// 2) Explicit line window
|
|
678
|
-
const wantsWindow = typeof options.offset === "number" ||
|
|
679
|
-
typeof options.limit === "number" ||
|
|
680
|
-
typeof options.startLine === "number" ||
|
|
681
|
-
typeof options.endLine === "number";
|
|
682
|
-
if (wantsWindow) {
|
|
683
|
-
const win = resolveLineWindow(options);
|
|
684
|
-
if (!win.ok)
|
|
685
|
-
return { ok: false, output: win.error, exitCode: 1 };
|
|
686
|
-
return readLineWindow(resolved, win.start, win.limit, fileBytes, win.note);
|
|
687
|
-
}
|
|
688
|
-
// 3) Auto-head for large files (soft byte/line budget)
|
|
689
|
-
const maxBytes = options.maxBytes ?? DEFAULT_READ_MAX_BYTES;
|
|
690
|
-
if (fileBytes > SOFT_FULL_READ_BYTES) {
|
|
691
|
-
const result = await readLineWindow(resolved, 1, DEFAULT_LINE_WINDOW, fileBytes, `auto-head: file is ${fileBytes} bytes (>${SOFT_FULL_READ_BYTES}); returning first ${DEFAULT_LINE_WINDOW} lines. ` +
|
|
692
|
-
`Use offset/limit, startLine/endLine, or pattern= to fetch more without loading the whole file.`);
|
|
693
|
-
return { ...result, truncated: true };
|
|
694
|
-
}
|
|
695
|
-
// Full read with hard byte cap (stream into string up to maxBytes).
|
|
696
|
-
const handle = await open(resolved, "r");
|
|
697
|
-
try {
|
|
698
|
-
const st = await handle.stat();
|
|
699
|
-
const cap = Math.min(st.size, maxBytes);
|
|
700
|
-
const buffer = Buffer.alloc(cap);
|
|
701
|
-
const { bytesRead } = await handle.read(buffer, 0, cap, 0);
|
|
702
|
-
const text = buffer.subarray(0, bytesRead).toString("utf8");
|
|
703
|
-
// Soft line cap even when under byte soft limit (huge single-line minified
|
|
704
|
-
// is handled by bytes; many-line small files by counting).
|
|
705
|
-
const lineCount = text.length === 0 ? 0 : text.split(/\r?\n/).length;
|
|
706
|
-
if (lineCount > SOFT_FULL_READ_LINES && st.size <= maxBytes) {
|
|
707
|
-
// Re-read as window instead of dumping 2k+ lines.
|
|
708
|
-
return readLineWindow(resolved, 1, DEFAULT_LINE_WINDOW, fileBytes, `auto-head: file has ${lineCount} lines (>${SOFT_FULL_READ_LINES}); returning first ${DEFAULT_LINE_WINDOW}. ` +
|
|
709
|
-
`Use offset/limit or pattern= for the rest.`);
|
|
710
|
-
}
|
|
711
|
-
const truncated = st.size > maxBytes;
|
|
712
|
-
const suffix = truncated
|
|
713
|
-
? `\n# truncated at ${maxBytes.toLocaleString()} bytes of ${st.size.toLocaleString()} — page with offset/limit or pattern= instead of re-reading the whole file`
|
|
714
|
-
: "";
|
|
715
|
-
return {
|
|
716
|
-
ok: true,
|
|
717
|
-
output: truncated
|
|
718
|
-
? `# fs.read path=${resolved} bytes=${fileBytes} truncated=true\n${text}${suffix}`
|
|
719
|
-
: text,
|
|
720
|
-
truncated,
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
finally {
|
|
724
|
-
await handle.close().catch(() => undefined);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
164
|
export async function fsWrite(path, content, options = {}) {
|
|
728
165
|
const resolved = ensureWriteAllowed(path, options.confirmed);
|
|
729
166
|
return withFileMutation(resolved, async () => {
|
|
@@ -753,11 +190,17 @@ export async function fsWrite(path, content, options = {}) {
|
|
|
753
190
|
};
|
|
754
191
|
});
|
|
755
192
|
}
|
|
756
|
-
/** Atomically replace an inclusive, 1-indexed line range in an existing file. */
|
|
757
193
|
export async function fsReplaceLines(path, startLine, endLine, content, options = {}) {
|
|
758
194
|
const resolved = ensureWriteAllowed(path, options.confirmed);
|
|
759
|
-
if (!Number.isInteger(startLine) ||
|
|
760
|
-
|
|
195
|
+
if (!Number.isInteger(startLine) ||
|
|
196
|
+
!Number.isInteger(endLine) ||
|
|
197
|
+
startLine < 1 ||
|
|
198
|
+
endLine < startLine) {
|
|
199
|
+
return {
|
|
200
|
+
ok: false,
|
|
201
|
+
output: "fs.replaceLines requires integers with 1 <= startLine <= endLine",
|
|
202
|
+
exitCode: 1,
|
|
203
|
+
};
|
|
761
204
|
}
|
|
762
205
|
return withFileMutation(resolved, async () => {
|
|
763
206
|
const original = await readFile(resolved, "utf8");
|
|
@@ -767,7 +210,11 @@ export async function fsReplaceLines(path, startLine, endLine, content, options
|
|
|
767
210
|
if (hadFinalNewline)
|
|
768
211
|
lines.pop();
|
|
769
212
|
if (endLine > lines.length) {
|
|
770
|
-
return {
|
|
213
|
+
return {
|
|
214
|
+
ok: false,
|
|
215
|
+
output: `fs.replaceLines range ${startLine}-${endLine} exceeds ${lines.length} lines`,
|
|
216
|
+
exitCode: 1,
|
|
217
|
+
};
|
|
771
218
|
}
|
|
772
219
|
const replacement = content === "" ? [] : content.split(/\r?\n/);
|
|
773
220
|
if (replacement.at(-1) === "")
|
|
@@ -791,540 +238,4 @@ export async function fsReplaceLines(path, startLine, endLine, content, options
|
|
|
791
238
|
};
|
|
792
239
|
});
|
|
793
240
|
}
|
|
794
|
-
const WRITE_MANY_MAX_FILES = 50;
|
|
795
|
-
/**
|
|
796
|
-
* Write several files in a single tool call. This is the workhorse for
|
|
797
|
-
* scaffolding a project: a React app, an Express server, etc. all need a
|
|
798
|
-
* handful of files, and forcing one fs.write per file burns through the
|
|
799
|
-
* agent's step budget (the most common reason a scaffold never finished).
|
|
800
|
-
*
|
|
801
|
-
* Each entry is validated and written independently — a bad path does not
|
|
802
|
-
* abort the whole batch. Parent directories are created automatically, just
|
|
803
|
-
* like fs.write.
|
|
804
|
-
*/
|
|
805
|
-
export async function fsWriteMany(files, options = {}) {
|
|
806
|
-
if (!Array.isArray(files) || files.length === 0) {
|
|
807
|
-
return {
|
|
808
|
-
ok: false,
|
|
809
|
-
output: 'fs.writeMany requires a non-empty "files" array of { path, content } objects.',
|
|
810
|
-
exitCode: 1,
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
if (files.length > WRITE_MANY_MAX_FILES) {
|
|
814
|
-
return {
|
|
815
|
-
ok: false,
|
|
816
|
-
output: `fs.writeMany accepts at most ${WRITE_MANY_MAX_FILES} files per call (got ${files.length}). Split the scaffold into smaller batches.`,
|
|
817
|
-
exitCode: 1,
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
const written = [];
|
|
821
|
-
const failures = [];
|
|
822
|
-
const changes = [];
|
|
823
|
-
for (const file of files) {
|
|
824
|
-
if (!file ||
|
|
825
|
-
typeof file !== "object" ||
|
|
826
|
-
typeof file.path !== "string" ||
|
|
827
|
-
file.path.length === 0 ||
|
|
828
|
-
typeof file.content !== "string") {
|
|
829
|
-
failures.push(`invalid entry — each file needs a non-empty string "path" and a string "content": ${JSON.stringify(file)}`);
|
|
830
|
-
continue;
|
|
831
|
-
}
|
|
832
|
-
try {
|
|
833
|
-
const resolved = ensureWriteAllowed(file.path, options.confirmed);
|
|
834
|
-
const mutation = await withFileMutation(resolved, async () => {
|
|
835
|
-
let before = "";
|
|
836
|
-
let existed = false;
|
|
837
|
-
try {
|
|
838
|
-
before = await readFile(resolved, "utf8");
|
|
839
|
-
existed = true;
|
|
840
|
-
}
|
|
841
|
-
catch (error) {
|
|
842
|
-
if (error?.code !== "ENOENT")
|
|
843
|
-
throw error;
|
|
844
|
-
}
|
|
845
|
-
await mkdir(dirname(resolved), { recursive: true });
|
|
846
|
-
await writeFileAtomic(resolved, file.content);
|
|
847
|
-
return { before, existed };
|
|
848
|
-
});
|
|
849
|
-
const bytes = Buffer.byteLength(file.content, "utf8");
|
|
850
|
-
const nLines = file.content.length === 0 ? 0 : file.content.split(/\r?\n/).length;
|
|
851
|
-
const sha = createHash("sha256")
|
|
852
|
-
.update(file.content, "utf8")
|
|
853
|
-
.digest("hex")
|
|
854
|
-
.slice(0, 12);
|
|
855
|
-
written.push(`${resolved} (bytes=${bytes} lines=${nLines} sha256_12=${sha})`);
|
|
856
|
-
changes.push(buildFileChange({
|
|
857
|
-
path: resolved,
|
|
858
|
-
before: mutation.before,
|
|
859
|
-
after: file.content,
|
|
860
|
-
kind: mutation.existed ? "overwrite" : "create",
|
|
861
|
-
}));
|
|
862
|
-
}
|
|
863
|
-
catch (error) {
|
|
864
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
865
|
-
failures.push(`${file.path}: ${msg}`);
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
// Clean multi-line receipt: one path per line (UI lists basenames; pager
|
|
869
|
-
// still has full paths). Avoid repeating the same dump twice in the spool.
|
|
870
|
-
const lines = [];
|
|
871
|
-
if (written.length > 0) {
|
|
872
|
-
lines.push(`Wrote ${written.length} file(s):`);
|
|
873
|
-
for (const p of written)
|
|
874
|
-
lines.push(` ${p}`);
|
|
875
|
-
}
|
|
876
|
-
if (failures.length > 0) {
|
|
877
|
-
lines.push(`Failed ${failures.length} file(s):`);
|
|
878
|
-
for (const f of failures)
|
|
879
|
-
lines.push(` ${f}`);
|
|
880
|
-
}
|
|
881
|
-
return {
|
|
882
|
-
ok: failures.length === 0,
|
|
883
|
-
output: lines.join("\n"),
|
|
884
|
-
exitCode: failures.length === 0 ? 0 : 1,
|
|
885
|
-
...(changes.length > 0 ? { fileChanges: changes } : {}),
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
export async function fsList(path, options = {}) {
|
|
889
|
-
const resolved = resolveReadPath(path);
|
|
890
|
-
ensureReadAllowed(resolved, path, options.confirmed);
|
|
891
|
-
const maxEntries = options.maxEntries ?? DEFAULT_LIST_MAX_ENTRIES;
|
|
892
|
-
try {
|
|
893
|
-
const entries = await readdir(resolved, { withFileTypes: true });
|
|
894
|
-
const sorted = [...entries].sort((left, right) => left.name.localeCompare(right.name, undefined, { numeric: true }));
|
|
895
|
-
const hiddenCount = sorted.filter((entry) => entry.name.startsWith(".")).length;
|
|
896
|
-
const truncated = sorted.length > maxEntries;
|
|
897
|
-
const visible = truncated ? sorted.slice(0, maxEntries) : sorted;
|
|
898
|
-
if (visible.length === 0) {
|
|
899
|
-
return {
|
|
900
|
-
ok: true,
|
|
901
|
-
output: `(empty directory) ${resolved}`,
|
|
902
|
-
truncated,
|
|
903
|
-
};
|
|
904
|
-
}
|
|
905
|
-
const lines = [
|
|
906
|
-
`Directory ${resolved}: ${sorted.length.toLocaleString()} entr${sorted.length === 1 ? "y" : "ies"} (${hiddenCount.toLocaleString()} hidden included)`,
|
|
907
|
-
...visible.map((entry) => `${entry.isDirectory() ? "dir " : "file"} ${entry.name}${entry.name.startsWith(".") ? " [hidden]" : ""}`),
|
|
908
|
-
];
|
|
909
|
-
if (truncated) {
|
|
910
|
-
lines.push(`... (${(sorted.length - maxEntries).toLocaleString()} entries omitted of ${sorted.length.toLocaleString()})`);
|
|
911
|
-
}
|
|
912
|
-
return {
|
|
913
|
-
ok: true,
|
|
914
|
-
output: lines.join("\n"),
|
|
915
|
-
truncated,
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
catch (error) {
|
|
919
|
-
const err = error;
|
|
920
|
-
// Missing path is a valid existence observation for scaffold/preflight —
|
|
921
|
-
// not a hard tool failure that blocks task.done or loop-guard retries.
|
|
922
|
-
if (err?.code === "ENOENT" || err?.code === "ENOTDIR") {
|
|
923
|
-
return {
|
|
924
|
-
ok: true,
|
|
925
|
-
output: `path does not exist: ${resolved}\n` +
|
|
926
|
-
`Safe to create/scaffold here. Do not treat this as a tool failure.`,
|
|
927
|
-
exitCode: 0,
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
931
|
-
return {
|
|
932
|
-
ok: false,
|
|
933
|
-
output: `fs.list failed: ${msg}`,
|
|
934
|
-
exitCode: 1,
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
export async function fsSearch(pattern, path = safeCwd(), options = {}) {
|
|
939
|
-
const resolved = resolveReadPath(path);
|
|
940
|
-
ensureReadAllowed(resolved, path, options.confirmed);
|
|
941
|
-
const maxMatches = Math.min(200, Math.max(1, Math.floor(options.maxMatches ?? 50)));
|
|
942
|
-
const maxPerFile = Math.min(200, Math.max(1, Math.floor(options.maxPerFile ?? 20)));
|
|
943
|
-
const context = Math.min(10, Math.max(0, Math.floor(options.context ?? 0)));
|
|
944
|
-
const timeoutMs = Math.min(120_000, Math.max(1_000, Math.floor(options.timeoutMs ?? 15_000)));
|
|
945
|
-
if (!pattern.trim()) {
|
|
946
|
-
return {
|
|
947
|
-
ok: false,
|
|
948
|
-
output: 'fs.search requires a non-empty "pattern"',
|
|
949
|
-
exitCode: 1,
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
// Prefer content hits (path:line:text) so the model can jump to fs.read
|
|
953
|
-
// with offset around interesting lines — not just file names.
|
|
954
|
-
try {
|
|
955
|
-
const rgArgs = [
|
|
956
|
-
"--line-number",
|
|
957
|
-
"--no-heading",
|
|
958
|
-
"--color",
|
|
959
|
-
"never",
|
|
960
|
-
// Cap hits per file so one noisy log cannot fill the budget alone.
|
|
961
|
-
"--max-count",
|
|
962
|
-
String(maxPerFile),
|
|
963
|
-
"--max-filesize",
|
|
964
|
-
"1M",
|
|
965
|
-
"--max-columns",
|
|
966
|
-
"300",
|
|
967
|
-
"--max-columns-preview",
|
|
968
|
-
];
|
|
969
|
-
if (options.caseInsensitive)
|
|
970
|
-
rgArgs.push("-i");
|
|
971
|
-
if (options.fixedString)
|
|
972
|
-
rgArgs.push("-F");
|
|
973
|
-
if (options.hidden)
|
|
974
|
-
rgArgs.push("--hidden");
|
|
975
|
-
if (options.filesOnly)
|
|
976
|
-
rgArgs.push("-l");
|
|
977
|
-
if (context > 0)
|
|
978
|
-
rgArgs.push("-C", String(context));
|
|
979
|
-
if (options.glob)
|
|
980
|
-
rgArgs.push("-g", options.glob);
|
|
981
|
-
// `--` keeps a pattern that starts with `-` from being parsed as a flag.
|
|
982
|
-
rgArgs.push("--", pattern, resolved);
|
|
983
|
-
const result = await execa("rg", rgArgs, {
|
|
984
|
-
reject: false,
|
|
985
|
-
all: true,
|
|
986
|
-
timeout: timeoutMs,
|
|
987
|
-
});
|
|
988
|
-
// rg exit 1 = no matches (still ok for the model); 2 = error
|
|
989
|
-
if (result.exitCode === 0 || result.exitCode === 1) {
|
|
990
|
-
const body = (result.all ?? "").trim();
|
|
991
|
-
if (!body) {
|
|
992
|
-
return {
|
|
993
|
-
ok: true,
|
|
994
|
-
output: `# fs.search pattern=${JSON.stringify(pattern)} path=${resolved}\n# no matches`,
|
|
995
|
-
exitCode: 0,
|
|
996
|
-
};
|
|
997
|
-
}
|
|
998
|
-
const allLines = body.split("\n").filter(Boolean);
|
|
999
|
-
const lines = allLines.slice(0, maxMatches);
|
|
1000
|
-
const truncated = allLines.length > maxMatches;
|
|
1001
|
-
return {
|
|
1002
|
-
ok: true,
|
|
1003
|
-
output: `# fs.search pattern=${JSON.stringify(pattern)} path=${resolved} hits=${lines.length}` +
|
|
1004
|
-
(truncated ? ` (capped at ${maxMatches})` : "") +
|
|
1005
|
-
`\n# tip: fs.read path=… offset=<line> limit=… or pattern= for a focused window\n` +
|
|
1006
|
-
lines.join("\n"),
|
|
1007
|
-
exitCode: 0,
|
|
1008
|
-
truncated,
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
// Fall through to grep on rg hard failure.
|
|
1012
|
-
}
|
|
1013
|
-
catch {
|
|
1014
|
-
// rg missing — try grep
|
|
1015
|
-
}
|
|
1016
|
-
try {
|
|
1017
|
-
const grepArgs = ["-R", "-n", "-I", "-m", String(maxPerFile)];
|
|
1018
|
-
if (options.caseInsensitive)
|
|
1019
|
-
grepArgs.push("-i");
|
|
1020
|
-
if (options.fixedString)
|
|
1021
|
-
grepArgs.push("-F");
|
|
1022
|
-
if (options.filesOnly)
|
|
1023
|
-
grepArgs.push("-l");
|
|
1024
|
-
if (context > 0)
|
|
1025
|
-
grepArgs.push("-C", String(context));
|
|
1026
|
-
if (options.glob)
|
|
1027
|
-
grepArgs.push(`--include=${options.glob}`);
|
|
1028
|
-
grepArgs.push("--", pattern, resolved);
|
|
1029
|
-
const result = await execa("grep", grepArgs, {
|
|
1030
|
-
reject: false,
|
|
1031
|
-
all: true,
|
|
1032
|
-
timeout: timeoutMs,
|
|
1033
|
-
});
|
|
1034
|
-
const body = (result.all ?? "").trim();
|
|
1035
|
-
if (!body || result.exitCode === 1) {
|
|
1036
|
-
return {
|
|
1037
|
-
ok: true,
|
|
1038
|
-
output: `# fs.search pattern=${JSON.stringify(pattern)} path=${resolved}\n# no matches`,
|
|
1039
|
-
exitCode: 0,
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
if (result.exitCode !== 0 && result.exitCode !== 1) {
|
|
1043
|
-
return {
|
|
1044
|
-
ok: false,
|
|
1045
|
-
output: body || `fs.search failed (exit ${result.exitCode})`,
|
|
1046
|
-
exitCode: result.exitCode ?? 1,
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
return {
|
|
1050
|
-
ok: true,
|
|
1051
|
-
output: `# fs.search pattern=${JSON.stringify(pattern)} path=${resolved}\n` +
|
|
1052
|
-
`# tip: fs.read path=… offset=<line> limit=… for a focused window\n` +
|
|
1053
|
-
body,
|
|
1054
|
-
exitCode: 0,
|
|
1055
|
-
};
|
|
1056
|
-
}
|
|
1057
|
-
catch (error) {
|
|
1058
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1059
|
-
return {
|
|
1060
|
-
ok: false,
|
|
1061
|
-
output: `fs.search failed (need ripgrep or grep): ${msg}`,
|
|
1062
|
-
exitCode: 1,
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* Atomic search-and-replace edit. Reads the file, validates the match
|
|
1068
|
-
* count, performs replacement, and writes back.
|
|
1069
|
-
*/
|
|
1070
|
-
export async function fsEdit(path, oldText, newText, expectedReplacements, options = {}) {
|
|
1071
|
-
const resolved = ensureWriteAllowed(path, options.confirmed);
|
|
1072
|
-
return withFileMutation(resolved, async () => {
|
|
1073
|
-
const priorStat = await stat(resolved).catch(() => undefined);
|
|
1074
|
-
if (priorStat?.isFile() && priorStat.size > LARGE_MUTATION_BYTES) {
|
|
1075
|
-
return {
|
|
1076
|
-
ok: false,
|
|
1077
|
-
output: `fs.edit refuses ${resolved}: ${priorStat.size.toLocaleString()} bytes exceeds the ${Math.round(LARGE_MUTATION_BYTES / (1024 * 1024))}MB whole-file edit limit. ` +
|
|
1078
|
-
`Use fs.replaceLines for a bounded line range, or a streaming tool (sed -i / awk) via shell.exec.`,
|
|
1079
|
-
exitCode: 1,
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
const content = await readFile(resolved, "utf8");
|
|
1083
|
-
const expected = expectedReplacements ?? 1;
|
|
1084
|
-
let targetOldText = oldText;
|
|
1085
|
-
let targetNewText = newText;
|
|
1086
|
-
// Count occurrences (exact match first)
|
|
1087
|
-
let count = 0;
|
|
1088
|
-
let searchPos = 0;
|
|
1089
|
-
while (true) {
|
|
1090
|
-
const idx = content.indexOf(targetOldText, searchPos);
|
|
1091
|
-
if (idx === -1)
|
|
1092
|
-
break;
|
|
1093
|
-
count += 1;
|
|
1094
|
-
searchPos = idx + targetOldText.length;
|
|
1095
|
-
}
|
|
1096
|
-
// Fallback: match CRLF / LF line ending differences or trailing whitespace
|
|
1097
|
-
if (count === 0) {
|
|
1098
|
-
const hasCRLF = content.includes("\r\n");
|
|
1099
|
-
const candidateOld = hasCRLF
|
|
1100
|
-
? oldText.replace(/\r?\n/g, "\r\n")
|
|
1101
|
-
: oldText.replace(/\r\n/g, "\n");
|
|
1102
|
-
const candidateNew = hasCRLF
|
|
1103
|
-
? newText.replace(/\r?\n/g, "\r\n")
|
|
1104
|
-
: newText.replace(/\r\n/g, "\n");
|
|
1105
|
-
let altCount = 0;
|
|
1106
|
-
let altPos = 0;
|
|
1107
|
-
while (true) {
|
|
1108
|
-
const idx = content.indexOf(candidateOld, altPos);
|
|
1109
|
-
if (idx === -1)
|
|
1110
|
-
break;
|
|
1111
|
-
altCount += 1;
|
|
1112
|
-
altPos = idx + candidateOld.length;
|
|
1113
|
-
}
|
|
1114
|
-
if (altCount > 0) {
|
|
1115
|
-
targetOldText = candidateOld;
|
|
1116
|
-
targetNewText = candidateNew;
|
|
1117
|
-
count = altCount;
|
|
1118
|
-
}
|
|
1119
|
-
else {
|
|
1120
|
-
const trimmedOld = candidateOld.trimEnd();
|
|
1121
|
-
if (trimmedOld.length > 0) {
|
|
1122
|
-
let trimCount = 0;
|
|
1123
|
-
let trimPos = 0;
|
|
1124
|
-
while (true) {
|
|
1125
|
-
const idx = content.indexOf(trimmedOld, trimPos);
|
|
1126
|
-
if (idx === -1)
|
|
1127
|
-
break;
|
|
1128
|
-
trimCount += 1;
|
|
1129
|
-
trimPos = idx + trimmedOld.length;
|
|
1130
|
-
}
|
|
1131
|
-
if (trimCount > 0) {
|
|
1132
|
-
targetOldText = trimmedOld;
|
|
1133
|
-
targetNewText = candidateNew.trimEnd();
|
|
1134
|
-
count = trimCount;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
if (count === 0) {
|
|
1140
|
-
return {
|
|
1141
|
-
ok: false,
|
|
1142
|
-
output: `No matches found for the search text in ${resolved}. The text to replace was not found.`,
|
|
1143
|
-
exitCode: 1,
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
if (count !== expected) {
|
|
1147
|
-
return {
|
|
1148
|
-
ok: false,
|
|
1149
|
-
output: `Found ${count} occurrence(s) of the search text, but expected exactly ${expected}. Aborting to avoid unintended changes. Use expectedReplacements=${count} if you want to replace all.`,
|
|
1150
|
-
exitCode: 1,
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
|
-
const updated = content.replaceAll(targetOldText, targetNewText);
|
|
1154
|
-
// Atomic, mode-preserving, race-safe replacement.
|
|
1155
|
-
await writeFileAtomic(resolved, updated);
|
|
1156
|
-
const change = buildFileChange({
|
|
1157
|
-
path: resolved,
|
|
1158
|
-
before: content,
|
|
1159
|
-
after: updated,
|
|
1160
|
-
kind: "edit",
|
|
1161
|
-
});
|
|
1162
|
-
const preview = formatUnifiedPreview(change, { maxLines: 24 });
|
|
1163
|
-
return {
|
|
1164
|
-
ok: true,
|
|
1165
|
-
output: `Replaced ${count} occurrence(s) in ${resolved}.\n${preview}`,
|
|
1166
|
-
fileChanges: [change],
|
|
1167
|
-
};
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Delete a file or directory. Requires the path to be inside the
|
|
1172
|
-
* write sandbox and not a secret path.
|
|
1173
|
-
*/
|
|
1174
|
-
export async function fsDelete(path, recursive, options = {}) {
|
|
1175
|
-
const resolved = ensureWriteAllowed(path, options.confirmed);
|
|
1176
|
-
return withFileMutation(resolved, async () => {
|
|
1177
|
-
try {
|
|
1178
|
-
// Snapshot text content for diff UI when deleting a single small file.
|
|
1179
|
-
let before = "";
|
|
1180
|
-
let canDiff = false;
|
|
1181
|
-
if (!recursive) {
|
|
1182
|
-
try {
|
|
1183
|
-
const st = await stat(resolved);
|
|
1184
|
-
if (st.isFile() && st.size <= 200_000) {
|
|
1185
|
-
before = await readFile(resolved, "utf8");
|
|
1186
|
-
canDiff = true;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
catch {
|
|
1190
|
-
/* ignore — delete may still succeed or fail below */
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
if (recursive) {
|
|
1194
|
-
await rm(resolved, { recursive: true, force: false });
|
|
1195
|
-
return { ok: true, output: `Deleted (recursive): ${resolved}` };
|
|
1196
|
-
}
|
|
1197
|
-
await unlink(resolved);
|
|
1198
|
-
const change = canDiff
|
|
1199
|
-
? buildFileChange({
|
|
1200
|
-
path: resolved,
|
|
1201
|
-
before,
|
|
1202
|
-
after: "",
|
|
1203
|
-
kind: "delete",
|
|
1204
|
-
})
|
|
1205
|
-
: buildFileChange({
|
|
1206
|
-
path: resolved,
|
|
1207
|
-
before: "",
|
|
1208
|
-
after: "",
|
|
1209
|
-
kind: "delete",
|
|
1210
|
-
});
|
|
1211
|
-
return {
|
|
1212
|
-
ok: true,
|
|
1213
|
-
output: `Deleted: ${resolved}`,
|
|
1214
|
-
fileChanges: [change],
|
|
1215
|
-
};
|
|
1216
|
-
}
|
|
1217
|
-
catch (error) {
|
|
1218
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1219
|
-
return { ok: false, output: `Delete failed: ${msg}`, exitCode: 1 };
|
|
1220
|
-
}
|
|
1221
|
-
});
|
|
1222
|
-
}
|
|
1223
|
-
export async function fsAppend(path, content, options = {}) {
|
|
1224
|
-
const resolved = ensureWriteAllowed(path, options.confirmed);
|
|
1225
|
-
const position = options.position ?? "end";
|
|
1226
|
-
const expectedPriorBytes = options.expectedPriorBytes;
|
|
1227
|
-
if (position !== "start" && position !== "end") {
|
|
1228
|
-
return {
|
|
1229
|
-
ok: false,
|
|
1230
|
-
output: `Invalid position: "${position}". Must be "start" or "end".`,
|
|
1231
|
-
exitCode: 1,
|
|
1232
|
-
};
|
|
1233
|
-
}
|
|
1234
|
-
if (expectedPriorBytes !== undefined &&
|
|
1235
|
-
(!Number.isSafeInteger(expectedPriorBytes) || expectedPriorBytes < 0)) {
|
|
1236
|
-
return {
|
|
1237
|
-
ok: false,
|
|
1238
|
-
output: "fs.append expectedPriorBytes must be a non-negative safe integer.",
|
|
1239
|
-
exitCode: 1,
|
|
1240
|
-
};
|
|
1241
|
-
}
|
|
1242
|
-
return withFileMutation(resolved, async () => {
|
|
1243
|
-
const priorStat = await stat(resolved).catch(() => undefined);
|
|
1244
|
-
if (priorStat?.isFile() &&
|
|
1245
|
-
priorStat.size > LARGE_MUTATION_BYTES &&
|
|
1246
|
-
position === "end") {
|
|
1247
|
-
const priorBytes = priorStat.size;
|
|
1248
|
-
if (expectedPriorBytes !== undefined && expectedPriorBytes > priorBytes) {
|
|
1249
|
-
return appendShrankFailure(resolved, expectedPriorBytes, priorBytes);
|
|
1250
|
-
}
|
|
1251
|
-
const stale = expectedPriorBytes !== undefined && expectedPriorBytes < priorBytes;
|
|
1252
|
-
if (stale && (await fileTailEquals(resolved, priorBytes, content))) {
|
|
1253
|
-
return {
|
|
1254
|
-
ok: true,
|
|
1255
|
-
output: describeWrite(resolved, content, "Append already applied to") +
|
|
1256
|
-
`\n prior_bytes=${priorBytes} expected_prior_bytes=${expectedPriorBytes}`,
|
|
1257
|
-
};
|
|
1258
|
-
}
|
|
1259
|
-
await appendFile(resolved, content, "utf8");
|
|
1260
|
-
const afterBytes = (await stat(resolved).catch(() => undefined))?.size ??
|
|
1261
|
-
priorBytes + Buffer.byteLength(content, "utf8");
|
|
1262
|
-
return {
|
|
1263
|
-
ok: true,
|
|
1264
|
-
output: describeWrite(resolved, content, "Appended (end) to") +
|
|
1265
|
-
`\n prior_bytes=${priorBytes} after_bytes=${afterBytes}` +
|
|
1266
|
-
(stale ? `\n note: expectedPriorBytes=${expectedPriorBytes} was stale; appended at ${priorBytes}.` : "") +
|
|
1267
|
-
`\n note: file exceeds ${Math.round(LARGE_MUTATION_BYTES / (1024 * 1024))}MB — appended in place and skipped the diff/receipt hash of the whole file.`,
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
let original = "";
|
|
1271
|
-
try {
|
|
1272
|
-
original = await readFile(resolved, "utf8");
|
|
1273
|
-
}
|
|
1274
|
-
catch (error) {
|
|
1275
|
-
if (error?.code !== "ENOENT")
|
|
1276
|
-
throw error;
|
|
1277
|
-
if (expectedPriorBytes !== undefined && expectedPriorBytes !== 0) {
|
|
1278
|
-
return {
|
|
1279
|
-
ok: false,
|
|
1280
|
-
output: `fs.append integrity check failed: expected prior bytes=${expectedPriorBytes} but file does not exist.`,
|
|
1281
|
-
exitCode: 1,
|
|
1282
|
-
};
|
|
1283
|
-
}
|
|
1284
|
-
await mkdir(dirname(resolved), { recursive: true });
|
|
1285
|
-
await writeFileAtomic(resolved, content);
|
|
1286
|
-
const change = buildFileChange({
|
|
1287
|
-
path: resolved,
|
|
1288
|
-
before: "",
|
|
1289
|
-
after: content,
|
|
1290
|
-
kind: "create",
|
|
1291
|
-
});
|
|
1292
|
-
return {
|
|
1293
|
-
ok: true,
|
|
1294
|
-
output: describeWrite(resolved, content, "Created"),
|
|
1295
|
-
fileChanges: [change],
|
|
1296
|
-
};
|
|
1297
|
-
}
|
|
1298
|
-
const priorBytes = Buffer.byteLength(original, "utf8");
|
|
1299
|
-
if (expectedPriorBytes !== undefined && expectedPriorBytes > priorBytes) {
|
|
1300
|
-
return appendShrankFailure(resolved, expectedPriorBytes, priorBytes);
|
|
1301
|
-
}
|
|
1302
|
-
const stale = expectedPriorBytes !== undefined && expectedPriorBytes < priorBytes;
|
|
1303
|
-
if (stale && appendAlreadyApplied(original, content, position)) {
|
|
1304
|
-
return {
|
|
1305
|
-
ok: true,
|
|
1306
|
-
output: describeWrite(resolved, original, "Append already applied to") +
|
|
1307
|
-
`\n prior_bytes=${priorBytes} expected_prior_bytes=${expectedPriorBytes}`,
|
|
1308
|
-
};
|
|
1309
|
-
}
|
|
1310
|
-
const next = position === "start" ? content + original : original + content;
|
|
1311
|
-
await writeFileAtomic(resolved, next);
|
|
1312
|
-
const afterBytes = Buffer.byteLength(next, "utf8");
|
|
1313
|
-
const change = buildFileChange({
|
|
1314
|
-
path: resolved,
|
|
1315
|
-
before: original,
|
|
1316
|
-
after: next,
|
|
1317
|
-
kind: "append",
|
|
1318
|
-
});
|
|
1319
|
-
return {
|
|
1320
|
-
ok: true,
|
|
1321
|
-
output: describeWrite(resolved, next, `Appended (${position}) to`) +
|
|
1322
|
-
`\n prior_bytes=${priorBytes} after_bytes=${afterBytes}` +
|
|
1323
|
-
(stale
|
|
1324
|
-
? `\n note: expectedPriorBytes=${expectedPriorBytes} was stale; appended at ${priorBytes}.`
|
|
1325
|
-
: ""),
|
|
1326
|
-
fileChanges: [change],
|
|
1327
|
-
};
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1330
241
|
//# sourceMappingURL=fs.js.map
|