@pentoshi/clai 4.11.7 → 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 +4 -447
- 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 +4 -458
- 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.js +0 -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 +1 -25
- 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 +403 -5087
- 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 +11 -1715
- package/dist/agent/tool-call-parser.js.map +1 -1
- package/dist/agent/tool-history.d.ts +1 -57
- package/dist/agent/tool-history.js +1 -68
- 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 +0 -14
- 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 +8 -47
- 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/index.d.ts +0 -36
- package/dist/prompts/index.js +0 -46
- package/dist/prompts/index.js.map +1 -1
- 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 +36 -1634
- 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 +31 -16
- 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
|
@@ -1,51 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `web.fetch` core orchestration: validate → resolve + pin DNS → SSRF-check
|
|
3
|
-
* → fetch (following redirects) → classify body → assemble metadata.
|
|
4
|
-
* `src/tools/web/fetch.ts` wraps this in a `ToolResult` adapter and
|
|
5
|
-
* audit-log emitter; this module never touches the registry, the safety
|
|
6
|
-
* classifier, or `auditLog`. All transport calls are injectable via
|
|
7
|
-
* {@link WebFetchCoreOptions} so tests can stub the network deterministically.
|
|
8
|
-
*/
|
|
9
|
-
import { Buffer } from "node:buffer";
|
|
10
1
|
import { lookup as defaultDnsLookup } from "node:dns/promises";
|
|
11
2
|
import http from "node:http";
|
|
12
3
|
import https from "node:https";
|
|
13
4
|
import { Capture } from "./capture.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { applyToCookies, applyToHeaders } from "./redact.js";
|
|
19
|
-
import { classify as classifyIp, classifyHost, isAllowedScheme, } from "./ssrf-guard.js";
|
|
20
|
-
import { DEFAULT_INCLUDE_HEADERS, DEFAULT_INCLUDE_REDIRECT_CHAIN, DEFAULT_INCLUDE_TIMING, DEFAULT_MAX_BYTES, DEFAULT_REDACT_SENSITIVE, DEFAULT_RESPONSE_MODE, FETCH_TIMEOUT_MS, HTTP_ERROR_BODY_PREVIEW_BYTES, MAX_FETCH_TIMEOUT_MS, MAX_MAX_BYTES, MAX_REDIRECT_HOPS, METADATA_BUDGET_BYTES, MIN_FETCH_TIMEOUT_MS, MIN_MAX_BYTES, RESPONSE_MODES, TRUNCATION_MARKER, } from "./types.js";
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
// Constants
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
/**
|
|
25
|
-
* Content-Type prefixes that always trigger the `binary-content` error
|
|
26
|
-
* kind, regardless of `responseMode` (Requirements 2.9 + 2.30).
|
|
27
|
-
*/
|
|
28
|
-
const BINARY_CONTENT_TYPE_PATTERNS = [
|
|
29
|
-
/^image\//i,
|
|
30
|
-
/^application\/octet-stream/i,
|
|
31
|
-
/^application\/pdf/i,
|
|
32
|
-
/^video\//i,
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Content-Type prefixes that trigger HTML-to-readable-text conversion
|
|
36
|
-
* in `responseMode="readable"` (Requirement 2.4). All other text
|
|
37
|
-
* Content-Types pass through unchanged in that mode (Requirement 2.5).
|
|
38
|
-
*/
|
|
39
|
-
const HTML_CONTENT_TYPE_PATTERN = /^(text\/html|application\/xhtml\+xml)/i;
|
|
40
|
-
/** Default User-Agent sent on outbound `web.fetch` requests. */
|
|
41
|
-
const DEFAULT_USER_AGENT = "clai-web-fetch/1.0";
|
|
42
|
-
/** Statuses that carry a `Location` header and trigger a redirect hop. */
|
|
43
|
-
const REDIRECT_STATUSES = new Set([
|
|
44
|
-
301, 302, 303, 307, 308,
|
|
45
|
-
]);
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
// Public entry
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
5
|
+
import { DEFAULT_RESPONSE_MODE, RESPONSE_MODES } from "./types.js";
|
|
6
|
+
import { networkError, runRequestLoop, timeoutError } from "./request-loop.js";
|
|
7
|
+
import { validateArgs } from "./validate-args.js";
|
|
8
|
+
import { buildSuccessOutcome, errorOutcome } from "./response-body.js";
|
|
49
9
|
/**
|
|
50
10
|
* Run the full `web.fetch` pipeline for the given arguments.
|
|
51
11
|
*
|
|
@@ -63,9 +23,6 @@ export async function webFetchCore(args, options = {}) {
|
|
|
63
23
|
const httpRequestFn = options.httpRequest ?? http.request;
|
|
64
24
|
const dnsLookupFn = options.dnsLookup ?? defaultDnsLookup;
|
|
65
25
|
const t0 = now();
|
|
66
|
-
// --------------------------------------------------------------------- 1
|
|
67
|
-
// Argument validation. Run synchronously before any I/O so a malformed
|
|
68
|
-
// call never reaches DNS or the network.
|
|
69
26
|
const validated = validateArgs(args);
|
|
70
27
|
if (!validated.ok) {
|
|
71
28
|
return errorOutcome({
|
|
@@ -78,12 +35,6 @@ export async function webFetchCore(args, options = {}) {
|
|
|
78
35
|
});
|
|
79
36
|
}
|
|
80
37
|
const a = validated.value;
|
|
81
|
-
// --------------------------------------------------------------------- 2
|
|
82
|
-
// Wire up a single AbortController + 30 s wall-clock timer. The signal
|
|
83
|
-
// is passed to DNS, the request, and the body reader so an abort
|
|
84
|
-
// anywhere in the pipeline collapses every dangling listener.
|
|
85
|
-
// Also forward the caller's AbortSignal so turn cancel / stall watchdog
|
|
86
|
-
// actually kill the fetch (previously only the local timer was wired).
|
|
87
38
|
const controller = new AbortController();
|
|
88
39
|
let timedOut = false;
|
|
89
40
|
let callerAborted = false;
|
|
@@ -91,9 +42,6 @@ export async function webFetchCore(args, options = {}) {
|
|
|
91
42
|
timedOut = true;
|
|
92
43
|
controller.abort();
|
|
93
44
|
}, a.timeoutMs);
|
|
94
|
-
// `unref` so the timer never holds the event loop open if the caller
|
|
95
|
-
// forgets to await us. `setTimeout` returns a `Timeout` in Node which
|
|
96
|
-
// exposes `.unref()`; the cast keeps lib.dom.d.ts happy.
|
|
97
45
|
timeoutHandle.unref?.();
|
|
98
46
|
const callerSignal = options.signal;
|
|
99
47
|
const onCallerAbort = () => {
|
|
@@ -114,8 +62,6 @@ export async function webFetchCore(args, options = {}) {
|
|
|
114
62
|
});
|
|
115
63
|
let lastUrl = a.url;
|
|
116
64
|
try {
|
|
117
|
-
// ----------------------------------------------------------------- 3-9
|
|
118
|
-
// Run the redirect-aware request loop.
|
|
119
65
|
const result = await runRequestLoop({
|
|
120
66
|
args: a,
|
|
121
67
|
capture,
|
|
@@ -143,9 +89,7 @@ export async function webFetchCore(args, options = {}) {
|
|
|
143
89
|
redactSensitive: a.redactSensitive,
|
|
144
90
|
});
|
|
145
91
|
}
|
|
146
|
-
// ----------------------------------------------------------------- 10
|
|
147
92
|
// Build a successful WebFetchOutcome with redactions and budget
|
|
148
|
-
// enforcement applied to the captured fields.
|
|
149
93
|
return buildSuccessOutcome({
|
|
150
94
|
args: a,
|
|
151
95
|
capture,
|
|
@@ -162,8 +106,6 @@ export async function webFetchCore(args, options = {}) {
|
|
|
162
106
|
});
|
|
163
107
|
}
|
|
164
108
|
catch (err) {
|
|
165
|
-
// Runaway exception: surface as "network" so the caller still gets
|
|
166
|
-
// a typed outcome instead of a thrown Error.
|
|
167
109
|
if (timedOut && !callerAborted) {
|
|
168
110
|
return errorOutcome({
|
|
169
111
|
requestedUrl: a.url,
|
|
@@ -224,131 +166,6 @@ export async function webFetchCore(args, options = {}) {
|
|
|
224
166
|
}
|
|
225
167
|
}
|
|
226
168
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Synchronously validate {@link WebFetchArgs} against Requirements 2.1,
|
|
229
|
-
* 2.2, 2.12, 2.13, 2.33, 2.34, 5.4, and 7.1–7.3.
|
|
230
|
-
*
|
|
231
|
-
* Returns the normalised arg bundle on success. On the first violation
|
|
232
|
-
* encountered, returns a `validation` error whose message names the
|
|
233
|
-
* offending argument and the rule that was broken.
|
|
234
|
-
*/
|
|
235
|
-
function validateArgs(args) {
|
|
236
|
-
// url: required string, parses as absolute URL with http(s) scheme,
|
|
237
|
-
// no whitespace, no ASCII control chars (Requirements 2.1, 2.12, 7.1, 7.3).
|
|
238
|
-
if (typeof args.url !== "string" || args.url.length === 0) {
|
|
239
|
-
return validationError("url is required and must be a non-empty string");
|
|
240
|
-
}
|
|
241
|
-
if (/\s/.test(args.url)) {
|
|
242
|
-
return validationError("url must not contain whitespace characters (Requirement 7.3)");
|
|
243
|
-
}
|
|
244
|
-
if (/[\u0000-\u001f\u007f]/.test(args.url)) {
|
|
245
|
-
return validationError("url must not contain ASCII control characters (Requirement 7.3)");
|
|
246
|
-
}
|
|
247
|
-
if (!isAllowedScheme(args.url)) {
|
|
248
|
-
return {
|
|
249
|
-
ok: false,
|
|
250
|
-
error: {
|
|
251
|
-
kind: "blocked-scheme",
|
|
252
|
-
message: `Refusing scheme: ${schemeOf(args.url)}`,
|
|
253
|
-
url: args.url,
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
// maxBytes: optional integer in [MIN_MAX_BYTES, MAX_MAX_BYTES] (2.2, 2.13).
|
|
258
|
-
let maxBytes = DEFAULT_MAX_BYTES;
|
|
259
|
-
if (args.maxBytes !== undefined) {
|
|
260
|
-
if (typeof args.maxBytes !== "number" ||
|
|
261
|
-
!Number.isInteger(args.maxBytes) ||
|
|
262
|
-
args.maxBytes < MIN_MAX_BYTES ||
|
|
263
|
-
args.maxBytes > MAX_MAX_BYTES) {
|
|
264
|
-
return validationError(`maxBytes must be an integer in [${MIN_MAX_BYTES}, ${MAX_MAX_BYTES}]`);
|
|
265
|
-
}
|
|
266
|
-
maxBytes = args.maxBytes;
|
|
267
|
-
}
|
|
268
|
-
let timeoutMs = FETCH_TIMEOUT_MS;
|
|
269
|
-
if (args.timeoutMs !== undefined) {
|
|
270
|
-
if (typeof args.timeoutMs !== "number" ||
|
|
271
|
-
!Number.isInteger(args.timeoutMs) ||
|
|
272
|
-
args.timeoutMs < MIN_FETCH_TIMEOUT_MS ||
|
|
273
|
-
args.timeoutMs > MAX_FETCH_TIMEOUT_MS) {
|
|
274
|
-
return validationError(`timeoutMs must be an integer in [${MIN_FETCH_TIMEOUT_MS}, ${MAX_FETCH_TIMEOUT_MS}]`);
|
|
275
|
-
}
|
|
276
|
-
timeoutMs = args.timeoutMs;
|
|
277
|
-
}
|
|
278
|
-
// includeHeaders: optional boolean (Requirement 2.34).
|
|
279
|
-
if (args.includeHeaders !== undefined && typeof args.includeHeaders !== "boolean") {
|
|
280
|
-
return validationError("includeHeaders must be a boolean");
|
|
281
|
-
}
|
|
282
|
-
const includeHeaders = args.responsePart === "headers"
|
|
283
|
-
? true
|
|
284
|
-
: args.includeHeaders ?? DEFAULT_INCLUDE_HEADERS;
|
|
285
|
-
// includeTls: optional boolean. Default is false so general browsing stays
|
|
286
|
-
// lean; callers can opt in when diagnostics matter.
|
|
287
|
-
if (args.includeTls !== undefined && typeof args.includeTls !== "boolean") {
|
|
288
|
-
return validationError("includeTls must be a boolean");
|
|
289
|
-
}
|
|
290
|
-
const includeTls = args.includeTls ?? false;
|
|
291
|
-
// includeTiming: optional boolean (Requirement 2.34).
|
|
292
|
-
if (args.includeTiming !== undefined && typeof args.includeTiming !== "boolean") {
|
|
293
|
-
return validationError("includeTiming must be a boolean");
|
|
294
|
-
}
|
|
295
|
-
const includeTiming = args.includeTiming ?? DEFAULT_INCLUDE_TIMING;
|
|
296
|
-
// includeRedirectChain: optional boolean (Requirement 2.34).
|
|
297
|
-
if (args.includeRedirectChain !== undefined &&
|
|
298
|
-
typeof args.includeRedirectChain !== "boolean") {
|
|
299
|
-
return validationError("includeRedirectChain must be a boolean");
|
|
300
|
-
}
|
|
301
|
-
const includeRedirectChain = args.includeRedirectChain ?? DEFAULT_INCLUDE_REDIRECT_CHAIN;
|
|
302
|
-
// responseMode: optional, must be "readable" or "raw" (Requirement 2.33).
|
|
303
|
-
if (args.responseMode !== undefined) {
|
|
304
|
-
if (typeof args.responseMode !== "string" ||
|
|
305
|
-
!RESPONSE_MODES.includes(args.responseMode)) {
|
|
306
|
-
return validationError(`responseMode must be one of: ${RESPONSE_MODES.join(", ")}`);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
const responseMode = args.responseMode ?? DEFAULT_RESPONSE_MODE;
|
|
310
|
-
let responsePart = "full";
|
|
311
|
-
if (args.responsePart !== undefined) {
|
|
312
|
-
if (args.responsePart !== "full" &&
|
|
313
|
-
args.responsePart !== "headers" &&
|
|
314
|
-
args.responsePart !== "body") {
|
|
315
|
-
return validationError("responsePart must be one of: full, headers, body");
|
|
316
|
-
}
|
|
317
|
-
responsePart = args.responsePart;
|
|
318
|
-
}
|
|
319
|
-
// redactSensitive: optional boolean (Requirement 2.34).
|
|
320
|
-
if (args.redactSensitive !== undefined &&
|
|
321
|
-
typeof args.redactSensitive !== "boolean") {
|
|
322
|
-
return validationError("redactSensitive must be a boolean");
|
|
323
|
-
}
|
|
324
|
-
const redactSensitive = args.redactSensitive ?? DEFAULT_REDACT_SENSITIVE;
|
|
325
|
-
return {
|
|
326
|
-
ok: true,
|
|
327
|
-
value: {
|
|
328
|
-
url: args.url,
|
|
329
|
-
maxBytes,
|
|
330
|
-
timeoutMs,
|
|
331
|
-
includeHeaders,
|
|
332
|
-
includeTls,
|
|
333
|
-
includeTiming,
|
|
334
|
-
includeRedirectChain,
|
|
335
|
-
responseMode,
|
|
336
|
-
responsePart,
|
|
337
|
-
redactSensitive,
|
|
338
|
-
},
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
function validationError(message) {
|
|
342
|
-
return {
|
|
343
|
-
ok: false,
|
|
344
|
-
error: { kind: "validation", message },
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Return `responseMode` resolved against the default. Used in the
|
|
349
|
-
* pre-validation error path where {@link NormalisedArgs} is not
|
|
350
|
-
* available yet but the metadata still needs a `mode` value.
|
|
351
|
-
*/
|
|
352
169
|
function resolveResponseMode(mode) {
|
|
353
170
|
if (mode === undefined)
|
|
354
171
|
return DEFAULT_RESPONSE_MODE;
|
|
@@ -356,875 +173,4 @@ function resolveResponseMode(mode) {
|
|
|
356
173
|
return mode;
|
|
357
174
|
return DEFAULT_RESPONSE_MODE;
|
|
358
175
|
}
|
|
359
|
-
/**
|
|
360
|
-
* Best-effort extraction of the scheme prefix for a URL string that may
|
|
361
|
-
* not parse cleanly. Used only inside `blocked-scheme` error messages.
|
|
362
|
-
*/
|
|
363
|
-
function schemeOf(raw) {
|
|
364
|
-
const m = raw.match(/^([a-z][a-z0-9+.\-]*):/i);
|
|
365
|
-
return m && typeof m[1] === "string" ? `${m[1]}:` : raw;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Run up to {@link MAX_REDIRECT_HOPS} request hops. Each hop:
|
|
369
|
-
*
|
|
370
|
-
* - parses the current URL
|
|
371
|
-
* - re-applies the SSRF pre-check on the hostname literal
|
|
372
|
-
* - resolves the hostname via {@link DnsLookupFn}, captures `dnsMs`
|
|
373
|
-
* and the resolved IP
|
|
374
|
-
* - re-applies the SSRF check on the resolved IP
|
|
375
|
-
* - builds a pinned-IP `https/http.request` with a custom `lookup`
|
|
376
|
-
* callback that returns the resolved IP synchronously
|
|
377
|
-
* - on a 3xx with `Location`, appends a redirect hop and loops
|
|
378
|
-
* - on a binary content type, returns `binary-content`
|
|
379
|
-
* - on a 4xx/5xx terminal, reads up to
|
|
380
|
-
* {@link HTTP_ERROR_BODY_PREVIEW_BYTES} bytes for the preview and
|
|
381
|
-
* returns `http-error`
|
|
382
|
-
* - on a 2xx terminal, reads the body up to `maxBytes` and returns
|
|
383
|
-
* success
|
|
384
|
-
*/
|
|
385
|
-
async function runRequestLoop(ctx) {
|
|
386
|
-
let currentUrl = ctx.args.url;
|
|
387
|
-
// We allow up to (1 initial + MAX_REDIRECT_HOPS redirects) requests:
|
|
388
|
-
// hop indices 0..MAX_REDIRECT_HOPS inclusive. A redirect produced on
|
|
389
|
-
// the final allowed iteration triggers the `redirect-limit` error
|
|
390
|
-
// because following it would exceed the cap (Requirement 2.14,
|
|
391
|
-
// Property 6).
|
|
392
|
-
for (let hop = 0; hop <= MAX_REDIRECT_HOPS; hop++) {
|
|
393
|
-
// Re-validate at every hop. Requirement 2.11 + design "Pipeline
|
|
394
|
-
// steps in detail" §8: each hop independently runs validation +
|
|
395
|
-
// SSRF + DNS.
|
|
396
|
-
if (!isAllowedScheme(currentUrl)) {
|
|
397
|
-
return {
|
|
398
|
-
ok: false,
|
|
399
|
-
lastUrl: currentUrl,
|
|
400
|
-
error: {
|
|
401
|
-
kind: "blocked-scheme",
|
|
402
|
-
message: `Refusing scheme: ${schemeOf(currentUrl)}`,
|
|
403
|
-
url: currentUrl,
|
|
404
|
-
},
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
let parsed;
|
|
408
|
-
try {
|
|
409
|
-
parsed = new URL(currentUrl);
|
|
410
|
-
}
|
|
411
|
-
catch {
|
|
412
|
-
return {
|
|
413
|
-
ok: false,
|
|
414
|
-
lastUrl: currentUrl,
|
|
415
|
-
error: {
|
|
416
|
-
kind: "validation",
|
|
417
|
-
message: `web.fetch: redirect target is not a valid URL: ${currentUrl}`,
|
|
418
|
-
url: currentUrl,
|
|
419
|
-
},
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
const hostname = parsed.hostname.replace(/^\[|\]$/g, "");
|
|
423
|
-
ctx.capture.setHopContext(hostname);
|
|
424
|
-
// SSRF pre-check on the hostname literal so e.g. https://127.0.0.1
|
|
425
|
-
// fails before any DNS work is done.
|
|
426
|
-
const hostClass = classifyHost(hostname);
|
|
427
|
-
if (hostClass !== null) {
|
|
428
|
-
return {
|
|
429
|
-
ok: false,
|
|
430
|
-
lastUrl: currentUrl,
|
|
431
|
-
error: {
|
|
432
|
-
kind: "blocked-address",
|
|
433
|
-
message: `Refusing to fetch ${hostClass.class} address ${hostname} (host=${hostname})`,
|
|
434
|
-
url: currentUrl,
|
|
435
|
-
},
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
// DNS resolve + pin IP for the actual TCP connect. Requirement 2.8
|
|
439
|
-
// / 2.11: the SSRF check is run against the resolved IP, and the
|
|
440
|
-
// socket is then connected to that exact IP via a custom `lookup`
|
|
441
|
-
// callback so DNS rebinding can not swap the address out from
|
|
442
|
-
// under us between resolve and connect.
|
|
443
|
-
const dnsStart = ctx.now();
|
|
444
|
-
let resolvedIp;
|
|
445
|
-
let resolvedFamily;
|
|
446
|
-
try {
|
|
447
|
-
const result = await ctx.dnsLookupFn(hostname, { family: 0 });
|
|
448
|
-
resolvedIp = result.address;
|
|
449
|
-
resolvedFamily = (result.family === 6 ? 6 : 4);
|
|
450
|
-
}
|
|
451
|
-
catch (err) {
|
|
452
|
-
return {
|
|
453
|
-
ok: false,
|
|
454
|
-
lastUrl: currentUrl,
|
|
455
|
-
error: networkError(currentUrl, err, "DNS resolution failed"),
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
const dnsMs = ctx.now() - dnsStart;
|
|
459
|
-
ctx.capture.markDnsResolved(dnsMs, resolvedIp);
|
|
460
|
-
const ipClass = classifyIp(resolvedIp);
|
|
461
|
-
if (ipClass !== null) {
|
|
462
|
-
return {
|
|
463
|
-
ok: false,
|
|
464
|
-
lastUrl: currentUrl,
|
|
465
|
-
error: {
|
|
466
|
-
kind: "blocked-address",
|
|
467
|
-
message: `Refusing to fetch ${ipClass.class} address ${resolvedIp} (host=${hostname})`,
|
|
468
|
-
url: currentUrl,
|
|
469
|
-
},
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
// Issue the pinned-IP request and consume the response.
|
|
473
|
-
const hopResult = await issueHop({
|
|
474
|
-
ctx,
|
|
475
|
-
currentUrl,
|
|
476
|
-
parsed,
|
|
477
|
-
resolvedIp,
|
|
478
|
-
resolvedFamily,
|
|
479
|
-
hop,
|
|
480
|
-
});
|
|
481
|
-
if (hopResult.kind === "redirect") {
|
|
482
|
-
// Append the *current* hop to the chain and follow.
|
|
483
|
-
ctx.capture.addRedirectHop(currentUrl, hopResult.status, hopResult.location);
|
|
484
|
-
// Resolve next URL: handle relative Locations against the
|
|
485
|
-
// *current* hop's URL.
|
|
486
|
-
let nextUrl;
|
|
487
|
-
try {
|
|
488
|
-
nextUrl = new URL(hopResult.location, parsed).toString();
|
|
489
|
-
}
|
|
490
|
-
catch {
|
|
491
|
-
return {
|
|
492
|
-
ok: false,
|
|
493
|
-
lastUrl: currentUrl,
|
|
494
|
-
error: {
|
|
495
|
-
kind: "validation",
|
|
496
|
-
message: `web.fetch: redirect Location is not a valid URL: ${hopResult.location}`,
|
|
497
|
-
url: currentUrl,
|
|
498
|
-
},
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
if (hop + 1 > MAX_REDIRECT_HOPS) {
|
|
502
|
-
return {
|
|
503
|
-
ok: false,
|
|
504
|
-
lastUrl: nextUrl,
|
|
505
|
-
error: {
|
|
506
|
-
kind: "redirect-limit",
|
|
507
|
-
message: `web.fetch: exceeded ${MAX_REDIRECT_HOPS}-redirect limit (last url=${nextUrl})`,
|
|
508
|
-
url: nextUrl,
|
|
509
|
-
},
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
currentUrl = nextUrl;
|
|
513
|
-
continue;
|
|
514
|
-
}
|
|
515
|
-
// Terminal hop (2xx/4xx/5xx or transport failure). Append the
|
|
516
|
-
// final hop to the redirect chain so callers see the complete
|
|
517
|
-
// path, then return.
|
|
518
|
-
if (hopResult.kind === "terminal") {
|
|
519
|
-
ctx.capture.addRedirectHop(currentUrl, hopResult.status);
|
|
520
|
-
return {
|
|
521
|
-
ok: true,
|
|
522
|
-
lastUrl: currentUrl,
|
|
523
|
-
contentType: hopResult.contentType,
|
|
524
|
-
body: hopResult.body,
|
|
525
|
-
bytesReceived: hopResult.bytesReceived,
|
|
526
|
-
truncated: hopResult.truncated,
|
|
527
|
-
...(hopResult.truncatedAt !== undefined
|
|
528
|
-
? { truncatedAt: hopResult.truncatedAt }
|
|
529
|
-
: {}),
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
// hopResult.kind === "error"
|
|
533
|
-
return {
|
|
534
|
-
ok: false,
|
|
535
|
-
lastUrl: currentUrl,
|
|
536
|
-
error: hopResult.error,
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
// Should be unreachable — the loop body either returns or sets
|
|
540
|
-
// currentUrl and continues. A defensive fallback keeps TS happy.
|
|
541
|
-
return {
|
|
542
|
-
ok: false,
|
|
543
|
-
lastUrl: currentUrl,
|
|
544
|
-
error: {
|
|
545
|
-
kind: "redirect-limit",
|
|
546
|
-
message: `web.fetch: exceeded ${MAX_REDIRECT_HOPS}-redirect limit (last url=${currentUrl})`,
|
|
547
|
-
url: currentUrl,
|
|
548
|
-
},
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* Issue a single GET request to `parsed.href` while pinning the TCP
|
|
553
|
-
* connection to `resolvedIp` via a custom `lookup` callback.
|
|
554
|
-
*
|
|
555
|
-
* The function handles every shape the response can take:
|
|
556
|
-
* - 3xx with a `Location` header → returns `{kind: "redirect"}`
|
|
557
|
-
* - 3xx without a `Location` → treated as a terminal 3xx
|
|
558
|
-
* - binary content type → returns a `binary-content` error
|
|
559
|
-
* - 4xx / 5xx → reads up to
|
|
560
|
-
* {@link HTTP_ERROR_BODY_PREVIEW_BYTES} bytes for the preview and
|
|
561
|
-
* returns an `http-error` error (Requirement 6.4)
|
|
562
|
-
* - 2xx → reads body up to `args.maxBytes`
|
|
563
|
-
* and returns `{kind: "terminal"}`
|
|
564
|
-
*
|
|
565
|
-
* Timing for `tcpMs`, `tlsMs`, and `ttfbMs` is recorded on the
|
|
566
|
-
* shared {@link Capture} and corresponds to the *current* hop. The
|
|
567
|
-
* builder always reflects the *last* hop's measurements (per its
|
|
568
|
-
* documented per-hop semantics).
|
|
569
|
-
*/
|
|
570
|
-
async function issueHop(input) {
|
|
571
|
-
const { ctx, currentUrl, parsed, resolvedIp, resolvedFamily } = input;
|
|
572
|
-
const isHttps = parsed.protocol === "https:";
|
|
573
|
-
const requestFn = isHttps ? ctx.httpsRequestFn : ctx.httpRequestFn;
|
|
574
|
-
const dnsEndedAt = ctx.now();
|
|
575
|
-
const requestOptions = {
|
|
576
|
-
method: "GET",
|
|
577
|
-
signal: ctx.controller.signal,
|
|
578
|
-
headers: {
|
|
579
|
-
// Identify ourselves and ask the server for prose-friendly bodies.
|
|
580
|
-
"user-agent": DEFAULT_USER_AGENT,
|
|
581
|
-
accept: "*/*",
|
|
582
|
-
"accept-encoding": "identity",
|
|
583
|
-
// Honor the URL's hostname for SNI and the Host header even though
|
|
584
|
-
// the socket is connecting to `resolvedIp`.
|
|
585
|
-
host: parsed.host,
|
|
586
|
-
},
|
|
587
|
-
// Pinned-IP lookup. Returns `resolvedIp` synchronously so the
|
|
588
|
-
// request's socket connects to the exact address the SSRF guard
|
|
589
|
-
// already classified.
|
|
590
|
-
lookup: pinnedLookup(resolvedIp, resolvedFamily),
|
|
591
|
-
};
|
|
592
|
-
return new Promise((resolve) => {
|
|
593
|
-
let req;
|
|
594
|
-
try {
|
|
595
|
-
req = requestFn(parsed, requestOptions);
|
|
596
|
-
}
|
|
597
|
-
catch (err) {
|
|
598
|
-
resolve({
|
|
599
|
-
kind: "error",
|
|
600
|
-
error: networkError(currentUrl, err),
|
|
601
|
-
});
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
let socketObserved = false;
|
|
605
|
-
let connectAt;
|
|
606
|
-
let secureAt;
|
|
607
|
-
let requestSentAt;
|
|
608
|
-
let settled = false;
|
|
609
|
-
const finish = (outcome) => {
|
|
610
|
-
if (settled)
|
|
611
|
-
return;
|
|
612
|
-
settled = true;
|
|
613
|
-
resolve(outcome);
|
|
614
|
-
};
|
|
615
|
-
req.on("socket", (socket) => {
|
|
616
|
-
if (socketObserved)
|
|
617
|
-
return;
|
|
618
|
-
socketObserved = true;
|
|
619
|
-
// `lookup` event fires once DNS has been resolved (our pinned
|
|
620
|
-
// lookup fires it synchronously). We do not record `dnsMs` here
|
|
621
|
-
// because we already measured it around `dnsLookupFn`.
|
|
622
|
-
socket.once("connect", () => {
|
|
623
|
-
connectAt = ctx.now();
|
|
624
|
-
const tcpMs = connectAt - dnsEndedAt;
|
|
625
|
-
ctx.capture.markTcpConnected(tcpMs);
|
|
626
|
-
});
|
|
627
|
-
if (isHttps) {
|
|
628
|
-
// `secureConnect` is emitted by `tls.TLSSocket` once the
|
|
629
|
-
// handshake completes.
|
|
630
|
-
socket.once("secureConnect", () => {
|
|
631
|
-
secureAt = ctx.now();
|
|
632
|
-
if (connectAt !== undefined) {
|
|
633
|
-
const tlsMs = secureAt - connectAt;
|
|
634
|
-
ctx.capture.markTlsHandshaked(tlsMs, socket);
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
req.on("error", (err) => {
|
|
640
|
-
// AbortController-driven aborts surface as `AbortError`.
|
|
641
|
-
if (ctx.controller.signal.aborted) {
|
|
642
|
-
finish({
|
|
643
|
-
kind: "error",
|
|
644
|
-
error: timeoutError(currentUrl, ctx.t0, ctx.now),
|
|
645
|
-
});
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
finish({
|
|
649
|
-
kind: "error",
|
|
650
|
-
error: networkError(currentUrl, err),
|
|
651
|
-
});
|
|
652
|
-
});
|
|
653
|
-
req.on("response", (res) => {
|
|
654
|
-
const ttfbMs = (() => {
|
|
655
|
-
if (typeof requestSentAt === "number") {
|
|
656
|
-
return ctx.now() - requestSentAt;
|
|
657
|
-
}
|
|
658
|
-
return ctx.now() - dnsEndedAt;
|
|
659
|
-
})();
|
|
660
|
-
const status = typeof res.statusCode === "number" ? res.statusCode : 0;
|
|
661
|
-
const headers = res.headers;
|
|
662
|
-
ctx.capture.markResponse(status, headers, ttfbMs);
|
|
663
|
-
// Capture every Set-Cookie header value (parsed individually)
|
|
664
|
-
// for the cookies array. Node returns a string[] for `set-cookie`
|
|
665
|
-
// when there are multiple lines.
|
|
666
|
-
const setCookieValues = collectSetCookieValues(headers);
|
|
667
|
-
for (const value of setCookieValues) {
|
|
668
|
-
ctx.capture.addSetCookieHeader(value);
|
|
669
|
-
}
|
|
670
|
-
const contentType = headerString(headers["content-type"]);
|
|
671
|
-
// Redirect handling (Requirement 2.11/2.14).
|
|
672
|
-
if (status >= 300 && status < 400 && REDIRECT_STATUSES.has(status)) {
|
|
673
|
-
const location = headerString(headers["location"]);
|
|
674
|
-
if (typeof location === "string" && location.length > 0) {
|
|
675
|
-
// Drain the response body to free the socket.
|
|
676
|
-
res.resume();
|
|
677
|
-
finish({ kind: "redirect", status, location });
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
// 3xx without Location: fall through and treat as terminal.
|
|
681
|
-
}
|
|
682
|
-
// Binary content rejection (Requirements 2.9 + 2.30) before we
|
|
683
|
-
// read any body bytes — including in `responseMode="raw"`.
|
|
684
|
-
if (typeof contentType === "string" &&
|
|
685
|
-
BINARY_CONTENT_TYPE_PATTERNS.some((re) => re.test(contentType))) {
|
|
686
|
-
res.resume();
|
|
687
|
-
finish({
|
|
688
|
-
kind: "error",
|
|
689
|
-
error: {
|
|
690
|
-
kind: "binary-content",
|
|
691
|
-
message: `Refusing binary content type: ${contentType}`,
|
|
692
|
-
url: currentUrl,
|
|
693
|
-
status,
|
|
694
|
-
},
|
|
695
|
-
});
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
// HTTP error (Requirement 6.4). Headers-only callers do not need a
|
|
699
|
-
// body preview; body/full callers receive up to 4 KiB.
|
|
700
|
-
if (status >= 400 && status < 600) {
|
|
701
|
-
if (ctx.args.responsePart === "headers") {
|
|
702
|
-
res.destroy();
|
|
703
|
-
finish({
|
|
704
|
-
kind: "error",
|
|
705
|
-
error: {
|
|
706
|
-
kind: "http-error",
|
|
707
|
-
message: `${status} ${currentUrl}`,
|
|
708
|
-
status,
|
|
709
|
-
url: currentUrl,
|
|
710
|
-
},
|
|
711
|
-
});
|
|
712
|
-
return;
|
|
713
|
-
}
|
|
714
|
-
readBody(res, HTTP_ERROR_BODY_PREVIEW_BYTES, ctx.controller).then(({ body, truncated, bytesReceived }) => {
|
|
715
|
-
let preview = renderBodyPreview(body, truncated, bytesReceived, contentType);
|
|
716
|
-
if (ctx.args.responseMode === "readable" &&
|
|
717
|
-
typeof contentType === "string" &&
|
|
718
|
-
HTML_CONTENT_TYPE_PATTERN.test(contentType)) {
|
|
719
|
-
const readable = toReadableText(decodeTextBody(body, contentType).text, currentUrl);
|
|
720
|
-
if (readable) {
|
|
721
|
-
preview = renderBodyPreview(Buffer.from(readable, "utf8"), truncated, bytesReceived, "text/plain; charset=utf-8");
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
finish({
|
|
725
|
-
kind: "error",
|
|
726
|
-
error: {
|
|
727
|
-
kind: "http-error",
|
|
728
|
-
message: `${status} ${currentUrl}`,
|
|
729
|
-
status,
|
|
730
|
-
url: currentUrl,
|
|
731
|
-
bodyPreview: preview,
|
|
732
|
-
},
|
|
733
|
-
});
|
|
734
|
-
}, (err) => {
|
|
735
|
-
if (ctx.controller.signal.aborted) {
|
|
736
|
-
finish({
|
|
737
|
-
kind: "error",
|
|
738
|
-
error: timeoutError(currentUrl, ctx.t0, ctx.now),
|
|
739
|
-
});
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
finish({
|
|
743
|
-
kind: "error",
|
|
744
|
-
error: networkError(currentUrl, err),
|
|
745
|
-
});
|
|
746
|
-
});
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
// Successful (2xx or non-Location 3xx) terminal hop. Headers-only
|
|
750
|
-
// requests can stop immediately instead of buffering a body they will
|
|
751
|
-
// discard in the adapter.
|
|
752
|
-
if (ctx.args.responsePart === "headers") {
|
|
753
|
-
res.destroy();
|
|
754
|
-
finish({
|
|
755
|
-
kind: "terminal",
|
|
756
|
-
status,
|
|
757
|
-
contentType,
|
|
758
|
-
body: "",
|
|
759
|
-
bytesReceived: 0,
|
|
760
|
-
truncated: false,
|
|
761
|
-
});
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
readBody(res, ctx.args.maxBytes, ctx.controller).then(({ body, truncated, bytesReceived }) => {
|
|
765
|
-
const text = classifyAndDecodeBody({
|
|
766
|
-
mode: ctx.args.responseMode,
|
|
767
|
-
contentType,
|
|
768
|
-
body,
|
|
769
|
-
maxBytes: ctx.args.maxBytes,
|
|
770
|
-
baseUrl: currentUrl,
|
|
771
|
-
});
|
|
772
|
-
finish({
|
|
773
|
-
kind: "terminal",
|
|
774
|
-
status,
|
|
775
|
-
contentType,
|
|
776
|
-
body: text,
|
|
777
|
-
bytesReceived,
|
|
778
|
-
truncated,
|
|
779
|
-
...(truncated ? { truncatedAt: bytesReceived } : {}),
|
|
780
|
-
});
|
|
781
|
-
}, (err) => {
|
|
782
|
-
if (ctx.controller.signal.aborted) {
|
|
783
|
-
finish({
|
|
784
|
-
kind: "error",
|
|
785
|
-
error: timeoutError(currentUrl, ctx.t0, ctx.now),
|
|
786
|
-
});
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
finish({
|
|
790
|
-
kind: "error",
|
|
791
|
-
error: networkError(currentUrl, err),
|
|
792
|
-
});
|
|
793
|
-
});
|
|
794
|
-
});
|
|
795
|
-
// Mark "request sent" right before flushing the headers. For a GET
|
|
796
|
-
// with no body, `req.end()` returns immediately after writing the
|
|
797
|
-
// header block to the socket buffer, so the synchronous timestamp
|
|
798
|
-
// is the closest non-platform-specific approximation of "the
|
|
799
|
-
// moment we sent the request."
|
|
800
|
-
requestSentAt = ctx.now();
|
|
801
|
-
req.end();
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
/**
|
|
805
|
-
* Build a Node `lookup` callback that synchronously resolves to
|
|
806
|
-
* `resolvedIp` so the socket connects to the IP the SSRF guard already
|
|
807
|
-
* classified.
|
|
808
|
-
*
|
|
809
|
-
* The callback must honor the `all` option. Node's `http`/`https` agents
|
|
810
|
-
* call `lookup` with `all: false` and expect the one-result form
|
|
811
|
-
* `(err, address, family)`. Bun's agent instead calls `lookup` with
|
|
812
|
-
* `{ all: true }` and expects the array form `(err, [{ address, family }])`;
|
|
813
|
-
* it then runs `results.sort((a, b) => b.family - a.family)` on whatever is
|
|
814
|
-
* passed back. Returning a bare string there throws
|
|
815
|
-
* "results.sort is not a function" and breaks every fetch under the
|
|
816
|
-
* Bun-compiled binary, so we branch on the requested form. The `options`
|
|
817
|
-
* argument may also be the callback itself when Node invokes the
|
|
818
|
-
* `lookup(hostname, callback)` overload.
|
|
819
|
-
*/
|
|
820
|
-
function pinnedLookup(resolvedIp, family) {
|
|
821
|
-
return function lookup(_hostname, options, callback) {
|
|
822
|
-
const wantsAll = typeof options === "object" && options !== null && options.all === true;
|
|
823
|
-
if (wantsAll) {
|
|
824
|
-
callback(null, [{ address: resolvedIp, family }]);
|
|
825
|
-
}
|
|
826
|
-
else {
|
|
827
|
-
callback(null, resolvedIp, family);
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
/**
|
|
832
|
-
* Collect every `Set-Cookie` line from {@link IncomingHttpHeaders}.
|
|
833
|
-
* Node returns a `string[]` when the header was sent multiple times,
|
|
834
|
-
* which is the common case for cookie-setting endpoints; we normalise
|
|
835
|
-
* the single-string form to a one-element array.
|
|
836
|
-
*/
|
|
837
|
-
function collectSetCookieValues(headers) {
|
|
838
|
-
const value = headers["set-cookie"];
|
|
839
|
-
if (Array.isArray(value))
|
|
840
|
-
return value.filter((v) => typeof v === "string");
|
|
841
|
-
if (typeof value === "string")
|
|
842
|
-
return [value];
|
|
843
|
-
return [];
|
|
844
|
-
}
|
|
845
|
-
/**
|
|
846
|
-
* Pick a single string out of an `IncomingHttpHeaders` value that
|
|
847
|
-
* Node may give us as `string | string[] | undefined`. Returns
|
|
848
|
-
* `undefined` if the header was not sent.
|
|
849
|
-
*/
|
|
850
|
-
function headerString(value) {
|
|
851
|
-
if (typeof value === "string")
|
|
852
|
-
return value;
|
|
853
|
-
if (Array.isArray(value))
|
|
854
|
-
return value.join(", ");
|
|
855
|
-
return undefined;
|
|
856
|
-
}
|
|
857
|
-
// ---------------------------------------------------------------------------
|
|
858
|
-
// Body streaming + classification
|
|
859
|
-
// ---------------------------------------------------------------------------
|
|
860
|
-
/**
|
|
861
|
-
* Read up to `maxBytes` from `res`, aborting the underlying request via
|
|
862
|
-
* `controller` once the cap is hit so the socket is freed instead of
|
|
863
|
-
* draining the whole response.
|
|
864
|
-
*
|
|
865
|
-
* Returns the collected `Buffer`, the byte count, and a `truncated`
|
|
866
|
-
* flag. Listener cleanup is handled in `finally` so no event emitter
|
|
867
|
-
* leaks if the caller's body classifier subsequently throws.
|
|
868
|
-
*/
|
|
869
|
-
function contentEncodingHeader(res) {
|
|
870
|
-
const raw = res.headers["content-encoding"];
|
|
871
|
-
if (Array.isArray(raw))
|
|
872
|
-
return raw.join(", ");
|
|
873
|
-
return typeof raw === "string" ? raw : undefined;
|
|
874
|
-
}
|
|
875
|
-
function readBody(res, maxBytes, controller) {
|
|
876
|
-
return readRawBody(res, maxBytes, controller).then((raw) => {
|
|
877
|
-
const decoded = decodeContentEncoding(raw.body, contentEncodingHeader(res));
|
|
878
|
-
if (decoded.applied.length === 0)
|
|
879
|
-
return raw;
|
|
880
|
-
if (decoded.body.byteLength <= maxBytes) {
|
|
881
|
-
return { ...raw, body: decoded.body };
|
|
882
|
-
}
|
|
883
|
-
return {
|
|
884
|
-
body: decoded.body.subarray(0, maxBytes),
|
|
885
|
-
truncated: true,
|
|
886
|
-
bytesReceived: raw.bytesReceived,
|
|
887
|
-
};
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
function readRawBody(res, maxBytes, _controller) {
|
|
891
|
-
return new Promise((resolve, reject) => {
|
|
892
|
-
const chunks = [];
|
|
893
|
-
let bytesReceived = 0;
|
|
894
|
-
let truncated = false;
|
|
895
|
-
let settled = false;
|
|
896
|
-
const onData = (chunk) => {
|
|
897
|
-
if (settled)
|
|
898
|
-
return;
|
|
899
|
-
const remaining = maxBytes - bytesReceived;
|
|
900
|
-
if (remaining <= 0) {
|
|
901
|
-
truncated = true;
|
|
902
|
-
bytesReceived = maxBytes;
|
|
903
|
-
cleanup();
|
|
904
|
-
try {
|
|
905
|
-
res.destroy();
|
|
906
|
-
}
|
|
907
|
-
catch {
|
|
908
|
-
// ignore — we're abandoning the socket deliberately
|
|
909
|
-
}
|
|
910
|
-
settled = true;
|
|
911
|
-
resolve({
|
|
912
|
-
body: Buffer.concat(chunks, bytesReceived),
|
|
913
|
-
truncated,
|
|
914
|
-
bytesReceived,
|
|
915
|
-
});
|
|
916
|
-
return;
|
|
917
|
-
}
|
|
918
|
-
if (chunk.byteLength > remaining) {
|
|
919
|
-
chunks.push(chunk.subarray(0, remaining));
|
|
920
|
-
bytesReceived += remaining;
|
|
921
|
-
truncated = true;
|
|
922
|
-
cleanup();
|
|
923
|
-
try {
|
|
924
|
-
res.destroy();
|
|
925
|
-
}
|
|
926
|
-
catch {
|
|
927
|
-
// ignore
|
|
928
|
-
}
|
|
929
|
-
settled = true;
|
|
930
|
-
resolve({
|
|
931
|
-
body: Buffer.concat(chunks, bytesReceived),
|
|
932
|
-
truncated,
|
|
933
|
-
bytesReceived,
|
|
934
|
-
});
|
|
935
|
-
return;
|
|
936
|
-
}
|
|
937
|
-
chunks.push(chunk);
|
|
938
|
-
bytesReceived += chunk.byteLength;
|
|
939
|
-
};
|
|
940
|
-
const onEnd = () => {
|
|
941
|
-
if (settled)
|
|
942
|
-
return;
|
|
943
|
-
settled = true;
|
|
944
|
-
cleanup();
|
|
945
|
-
resolve({
|
|
946
|
-
body: Buffer.concat(chunks, bytesReceived),
|
|
947
|
-
truncated,
|
|
948
|
-
bytesReceived,
|
|
949
|
-
});
|
|
950
|
-
};
|
|
951
|
-
const onError = (err) => {
|
|
952
|
-
if (settled)
|
|
953
|
-
return;
|
|
954
|
-
settled = true;
|
|
955
|
-
cleanup();
|
|
956
|
-
reject(err);
|
|
957
|
-
};
|
|
958
|
-
function cleanup() {
|
|
959
|
-
res.removeListener("data", onData);
|
|
960
|
-
res.removeListener("end", onEnd);
|
|
961
|
-
res.removeListener("error", onError);
|
|
962
|
-
}
|
|
963
|
-
res.on("data", onData);
|
|
964
|
-
res.once("end", onEnd);
|
|
965
|
-
res.once("error", onError);
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* Decode the response body bytes into the string surfaced by
|
|
970
|
-
* {@link WebFetchOutcome.body}.
|
|
971
|
-
*
|
|
972
|
-
* Decision matrix:
|
|
973
|
-
* - `mode = "raw"` → decode using the declared Content-Type
|
|
974
|
-
* charset (or HTML meta / UTF-8 fallback),
|
|
975
|
-
* up to `maxBytes`.
|
|
976
|
-
* - `mode = "readable"` AND
|
|
977
|
-
* content-type is HTML/XHTML → run {@link toReadableText} so chrome
|
|
978
|
-
* and non-rendering content are
|
|
979
|
-
* stripped (Requirements 2.4, 2.28).
|
|
980
|
-
* - `mode = "readable"` AND
|
|
981
|
-
* non-HTML text → UTF-8 (replace) up to `maxBytes`
|
|
982
|
-
* (Requirement 2.5).
|
|
983
|
-
*
|
|
984
|
-
* The `body` arg has already been truncated to `maxBytes` by
|
|
985
|
-
* {@link readBody}, so HTML conversion only ever runs on bytes that
|
|
986
|
-
* are already capped (Property 7).
|
|
987
|
-
*/
|
|
988
|
-
function classifyAndDecodeBody(input) {
|
|
989
|
-
const decoded = decodeTextBody(input.body, input.contentType).text;
|
|
990
|
-
if (input.mode === "raw")
|
|
991
|
-
return decoded;
|
|
992
|
-
if (typeof input.contentType === "string" &&
|
|
993
|
-
HTML_CONTENT_TYPE_PATTERN.test(input.contentType)) {
|
|
994
|
-
return toReadableText(decoded, input.baseUrl);
|
|
995
|
-
}
|
|
996
|
-
return decoded;
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Render the body preview included in `http-error` outcomes
|
|
1000
|
-
* (Requirement 6.4). The preview honors the response charset and is capped at
|
|
1001
|
-
* {@link HTTP_ERROR_BODY_PREVIEW_BYTES}; when the underlying body was
|
|
1002
|
-
* truncated we append the standard truncation marker so the agent can tell it
|
|
1003
|
-
* did not see the full response.
|
|
1004
|
-
*/
|
|
1005
|
-
function renderBodyPreview(body, truncated, _bytesReceived, contentType) {
|
|
1006
|
-
const text = decodeTextBody(body, contentType).text;
|
|
1007
|
-
if (!truncated)
|
|
1008
|
-
return text;
|
|
1009
|
-
return `${text}${TRUNCATION_MARKER}`;
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Compose a successful {@link WebFetchOutcome} from the captured
|
|
1013
|
-
* fields, applying redaction and the 64 KiB metadata budget.
|
|
1014
|
-
*
|
|
1015
|
-
* Implements the design's "Pipeline steps in detail" §11–12: redact
|
|
1016
|
-
* before metadata assembly, then run `budget.enforce` so the final
|
|
1017
|
-
* `metadata.budget.metadataBytes` reflects the size of the *trimmed*
|
|
1018
|
-
* payload.
|
|
1019
|
-
*/
|
|
1020
|
-
function buildSuccessOutcome(input) {
|
|
1021
|
-
const totalMs = input.now() - input.t0;
|
|
1022
|
-
const captured = input.capture.finalize(totalMs);
|
|
1023
|
-
return {
|
|
1024
|
-
ok: true,
|
|
1025
|
-
metadata: assembleMetadata({
|
|
1026
|
-
args: input.args,
|
|
1027
|
-
captured,
|
|
1028
|
-
requestedUrl: input.args.url,
|
|
1029
|
-
finalUrl: input.lastUrl,
|
|
1030
|
-
status: captured.status,
|
|
1031
|
-
contentType: input.contentType,
|
|
1032
|
-
bytesReceived: input.bytesReceived,
|
|
1033
|
-
truncated: input.truncated,
|
|
1034
|
-
...(input.truncatedAt !== undefined
|
|
1035
|
-
? { truncatedAt: input.truncatedAt }
|
|
1036
|
-
: {}),
|
|
1037
|
-
}),
|
|
1038
|
-
body: input.body,
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* Compose an `ok=false` {@link WebFetchOutcome}.
|
|
1043
|
-
*
|
|
1044
|
-
* The metadata envelope is always populated. Pipeline stages that ran
|
|
1045
|
-
* before the failure surface their captured values (e.g. `resolvedIp`
|
|
1046
|
-
* after a successful DNS lookup but a `blocked-address` IP); stages
|
|
1047
|
-
* that did not run carry default zero/empty values. This keeps the
|
|
1048
|
-
* audit-log payload built downstream uniform regardless of where the
|
|
1049
|
-
* failure surfaced.
|
|
1050
|
-
*/
|
|
1051
|
-
function errorOutcome(input) {
|
|
1052
|
-
const totalMs = input.now() - input.t0;
|
|
1053
|
-
const captured = input.capture !== undefined ? input.capture.finalize(totalMs) : undefined;
|
|
1054
|
-
const includeHeaders = input.includeHeaders ?? DEFAULT_INCLUDE_HEADERS;
|
|
1055
|
-
const includeTiming = input.includeTiming ?? DEFAULT_INCLUDE_TIMING;
|
|
1056
|
-
const includeRedirectChain = input.includeRedirectChain ?? DEFAULT_INCLUDE_REDIRECT_CHAIN;
|
|
1057
|
-
const includeTls = input.includeTls ?? false;
|
|
1058
|
-
const redactSensitive = input.redactSensitive ?? DEFAULT_REDACT_SENSITIVE;
|
|
1059
|
-
const args = {
|
|
1060
|
-
url: input.requestedUrl,
|
|
1061
|
-
maxBytes: DEFAULT_MAX_BYTES,
|
|
1062
|
-
timeoutMs: FETCH_TIMEOUT_MS,
|
|
1063
|
-
includeHeaders,
|
|
1064
|
-
includeTls,
|
|
1065
|
-
includeTiming,
|
|
1066
|
-
includeRedirectChain,
|
|
1067
|
-
responseMode: input.mode,
|
|
1068
|
-
responsePart: "full",
|
|
1069
|
-
redactSensitive,
|
|
1070
|
-
};
|
|
1071
|
-
const metadata = captured
|
|
1072
|
-
? assembleMetadata({
|
|
1073
|
-
args,
|
|
1074
|
-
captured,
|
|
1075
|
-
requestedUrl: input.requestedUrl,
|
|
1076
|
-
finalUrl: input.finalUrl,
|
|
1077
|
-
status: input.error.status ?? captured.status ?? 0,
|
|
1078
|
-
contentType: undefined,
|
|
1079
|
-
bytesReceived: 0,
|
|
1080
|
-
truncated: false,
|
|
1081
|
-
})
|
|
1082
|
-
: assembleEmptyMetadata({
|
|
1083
|
-
args,
|
|
1084
|
-
requestedUrl: input.requestedUrl,
|
|
1085
|
-
finalUrl: input.finalUrl,
|
|
1086
|
-
status: input.error.status ?? 0,
|
|
1087
|
-
});
|
|
1088
|
-
return {
|
|
1089
|
-
ok: false,
|
|
1090
|
-
metadata,
|
|
1091
|
-
body: "",
|
|
1092
|
-
error: input.error,
|
|
1093
|
-
};
|
|
1094
|
-
}
|
|
1095
|
-
/**
|
|
1096
|
-
* Build a {@link WebFetchMetadata} envelope from a {@link CapturedFields}
|
|
1097
|
-
* snapshot.
|
|
1098
|
-
*
|
|
1099
|
-
* Honors the `include*` flags from {@link NormalisedArgs}: setting a
|
|
1100
|
-
* flag to `false` strips the corresponding optional field from the
|
|
1101
|
-
* envelope (Requirements 2.15–2.18, 2.24). Sensitive headers / cookie
|
|
1102
|
-
* values are redacted by `applyToHeaders` / `applyToCookies` before
|
|
1103
|
-
* the 64 KiB budget loop runs in {@link enforceBudget}.
|
|
1104
|
-
*/
|
|
1105
|
-
function assembleMetadata(input) {
|
|
1106
|
-
const { args, captured } = input;
|
|
1107
|
-
const headersIn = args.includeHeaders ? captured.headers : undefined;
|
|
1108
|
-
const cookiesIn = captured.cookies;
|
|
1109
|
-
const redactedHeaders = headersIn !== undefined
|
|
1110
|
-
? applyToHeaders(headersIn, args.redactSensitive)
|
|
1111
|
-
: undefined;
|
|
1112
|
-
const redactedCookies = applyToCookies(cookiesIn, args.redactSensitive);
|
|
1113
|
-
const tlsIn = args.includeTls ? captured.tls : undefined;
|
|
1114
|
-
const timingIn = args.includeTiming ? captured.timing : undefined;
|
|
1115
|
-
const redirectChainIn = args.includeRedirectChain
|
|
1116
|
-
? captured.redirectChain
|
|
1117
|
-
: undefined;
|
|
1118
|
-
const budgeted = enforceBudget({
|
|
1119
|
-
...(redactedHeaders !== undefined ? { headers: redactedHeaders } : {}),
|
|
1120
|
-
...(tlsIn !== undefined ? { tls: tlsIn } : {}),
|
|
1121
|
-
...(timingIn !== undefined ? { timing: timingIn } : {}),
|
|
1122
|
-
...(redirectChainIn !== undefined ? { redirectChain: redirectChainIn } : {}),
|
|
1123
|
-
cookies: redactedCookies,
|
|
1124
|
-
});
|
|
1125
|
-
const meta = {
|
|
1126
|
-
requestedUrl: input.requestedUrl,
|
|
1127
|
-
finalUrl: input.finalUrl,
|
|
1128
|
-
status: input.status,
|
|
1129
|
-
resolvedIp: captured.resolvedIp,
|
|
1130
|
-
finalHostname: captured.finalHostname,
|
|
1131
|
-
mode: args.responseMode,
|
|
1132
|
-
bytesReceived: input.bytesReceived,
|
|
1133
|
-
truncated: input.truncated,
|
|
1134
|
-
budget: { metadataBytes: budgeted.metadataBytes, cap: METADATA_BUDGET_BYTES },
|
|
1135
|
-
};
|
|
1136
|
-
if (input.contentType !== undefined)
|
|
1137
|
-
meta.contentType = input.contentType;
|
|
1138
|
-
if (input.truncatedAt !== undefined)
|
|
1139
|
-
meta.truncatedAt = input.truncatedAt;
|
|
1140
|
-
if (budgeted.headers !== undefined)
|
|
1141
|
-
meta.headers = budgeted.headers;
|
|
1142
|
-
if (budgeted.tls !== undefined)
|
|
1143
|
-
meta.tls = budgeted.tls;
|
|
1144
|
-
if (budgeted.timing !== undefined)
|
|
1145
|
-
meta.timing = budgeted.timing;
|
|
1146
|
-
if (budgeted.redirectChain !== undefined)
|
|
1147
|
-
meta.redirectChain = budgeted.redirectChain;
|
|
1148
|
-
if (budgeted.cookies !== undefined)
|
|
1149
|
-
meta.cookies = budgeted.cookies;
|
|
1150
|
-
return meta;
|
|
1151
|
-
}
|
|
1152
|
-
/**
|
|
1153
|
-
* Build a minimal {@link WebFetchMetadata} envelope for failures that
|
|
1154
|
-
* surfaced before any transport-level capture happened (argument
|
|
1155
|
-
* validation, blocked scheme on the entry URL, etc.).
|
|
1156
|
-
*/
|
|
1157
|
-
function assembleEmptyMetadata(input) {
|
|
1158
|
-
const emptyTiming = { dnsMs: 0, tcpMs: 0, ttfbMs: 0, totalMs: 0 };
|
|
1159
|
-
const budgeted = enforceBudget({
|
|
1160
|
-
...(input.args.includeHeaders ? { headers: {} } : {}),
|
|
1161
|
-
...(input.args.includeTiming ? { timing: emptyTiming } : {}),
|
|
1162
|
-
...(input.args.includeRedirectChain
|
|
1163
|
-
? { redirectChain: [] }
|
|
1164
|
-
: {}),
|
|
1165
|
-
cookies: [],
|
|
1166
|
-
});
|
|
1167
|
-
const meta = {
|
|
1168
|
-
requestedUrl: input.requestedUrl,
|
|
1169
|
-
finalUrl: input.finalUrl,
|
|
1170
|
-
status: input.status,
|
|
1171
|
-
resolvedIp: "",
|
|
1172
|
-
finalHostname: tryHostname(input.finalUrl),
|
|
1173
|
-
mode: input.args.responseMode,
|
|
1174
|
-
bytesReceived: 0,
|
|
1175
|
-
truncated: false,
|
|
1176
|
-
budget: { metadataBytes: budgeted.metadataBytes, cap: METADATA_BUDGET_BYTES },
|
|
1177
|
-
};
|
|
1178
|
-
if (budgeted.headers !== undefined)
|
|
1179
|
-
meta.headers = budgeted.headers;
|
|
1180
|
-
if (budgeted.timing !== undefined)
|
|
1181
|
-
meta.timing = budgeted.timing;
|
|
1182
|
-
if (budgeted.redirectChain !== undefined)
|
|
1183
|
-
meta.redirectChain = budgeted.redirectChain;
|
|
1184
|
-
if (budgeted.cookies !== undefined)
|
|
1185
|
-
meta.cookies = budgeted.cookies;
|
|
1186
|
-
return meta;
|
|
1187
|
-
}
|
|
1188
|
-
/** Best-effort hostname extraction; returns "" for malformed URLs. */
|
|
1189
|
-
function tryHostname(url) {
|
|
1190
|
-
try {
|
|
1191
|
-
return new URL(url).hostname;
|
|
1192
|
-
}
|
|
1193
|
-
catch {
|
|
1194
|
-
return "";
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
// ---------------------------------------------------------------------------
|
|
1198
|
-
// Error helpers
|
|
1199
|
-
// ---------------------------------------------------------------------------
|
|
1200
|
-
/**
|
|
1201
|
-
* Build the `timeout` error from the design's error matrix:
|
|
1202
|
-
* "web.fetch: timeout after Ns (last url=…)" carrying the elapsed
|
|
1203
|
-
* wall-clock for callers that want to log it (Requirement 2.10).
|
|
1204
|
-
*/
|
|
1205
|
-
function timeoutError(lastUrl, t0, now) {
|
|
1206
|
-
const elapsedMs = Math.max(0, now() - t0);
|
|
1207
|
-
return {
|
|
1208
|
-
kind: "timeout",
|
|
1209
|
-
message: `web.fetch: timeout after ${Math.round(elapsedMs / 1000)}s (last url=${lastUrl}, elapsed=${elapsedMs}ms)`,
|
|
1210
|
-
url: lastUrl,
|
|
1211
|
-
};
|
|
1212
|
-
}
|
|
1213
|
-
/**
|
|
1214
|
-
* Build the generic `network` error used for DNS / connect / TLS
|
|
1215
|
-
* failures (Requirement 6.3 indirectly via the design's error matrix).
|
|
1216
|
-
* The optional `prefix` lets callers tag a more specific category
|
|
1217
|
-
* (e.g. "DNS resolution failed") in front of the underlying message.
|
|
1218
|
-
*/
|
|
1219
|
-
function networkError(lastUrl, err, prefix) {
|
|
1220
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
1221
|
-
const head = typeof prefix === "string" && prefix.length > 0
|
|
1222
|
-
? `${prefix}: `
|
|
1223
|
-
: "";
|
|
1224
|
-
return {
|
|
1225
|
-
kind: "network",
|
|
1226
|
-
message: `web.fetch: ${head}${detail} (url=${lastUrl})`,
|
|
1227
|
-
url: lastUrl,
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
176
|
//# sourceMappingURL=fetch-core.js.map
|