@sema-agent/core 7.54.1 → 7.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +950 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/builtin-agents.d.ts +12 -14
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.d.ts +36 -0
- package/dist/agents/cc-peer-directory.js +139 -0
- package/dist/agents/cc-peer-wire.d.ts +105 -0
- package/dist/agents/cc-peer-wire.js +98 -0
- package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
- package/dist/agents/cc-uds-peer-channel.js +457 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/cross-session-envelope.d.ts +4 -1
- package/dist/agents/cross-session-envelope.js +8 -1
- package/dist/agents/cross-session-judge.d.ts +2 -2
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +9 -8
- package/dist/agents/observer.d.ts +4 -5
- package/dist/agents/observer.js +2 -1
- package/dist/agents/peer-admission.d.ts +6 -0
- package/dist/agents/peer-admission.js +4 -1
- package/dist/agents/peer-directory.d.ts +65 -13
- package/dist/agents/peer-directory.js +90 -25
- package/dist/agents/peer-notices.d.ts +1 -1
- package/dist/agents/peer-session-drain.d.ts +3 -1
- package/dist/agents/peer-session-drain.js +3 -2
- package/dist/agents/read-inbox-tool.js +2 -1
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/send-message-tool.d.ts +10 -0
- package/dist/agents/send-message-tool.js +37 -8
- package/dist/agents/subagent.d.ts +39 -82
- package/dist/agents/subagent.js +109 -106
- package/dist/agents/tool-filter.d.ts +31 -46
- package/dist/agents/tool-filter.js +13 -33
- package/dist/agents/verify.d.ts +6 -5
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +43 -81
- package/dist/brain/errors.d.ts +15 -0
- package/dist/brain/errors.js +10 -0
- package/dist/brain/media-degrade.d.ts +18 -7
- package/dist/brain/media-degrade.js +13 -2
- package/dist/brain/model-capability.d.ts +37 -0
- package/dist/brain/model-capability.js +34 -0
- package/dist/brain/model-presets.d.ts +6 -12
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +27 -35
- package/dist/brain/openai.js +30 -98
- package/dist/brain/provider-dialect.d.ts +39 -3
- package/dist/brain/provider-dialect.js +28 -0
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +12 -12
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +62 -9
- package/dist/brain/request-params.js +42 -7
- package/dist/brain/retry.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +15 -0
- package/dist/brain/route-adjudicator.js +15 -0
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.js +6 -5
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/advisor-verdict.d.ts +120 -0
- package/dist/core/advisor-verdict.js +92 -0
- package/dist/core/agent-definition.d.ts +17 -8
- package/dist/core/allow-entry.d.ts +69 -36
- package/dist/core/allow-entry.js +81 -52
- package/dist/core/allow-rule-shadow.d.ts +10 -3
- package/dist/core/approval-object.d.ts +2 -1
- package/dist/core/approval-object.js +6 -6
- package/dist/core/ask-origin.d.ts +127 -29
- package/dist/core/ask-origin.js +87 -25
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +12 -7
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -2
- package/dist/core/auto-compaction.d.ts +11 -8
- package/dist/core/auto-compaction.js +4 -2
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/auto-mode-defaults.d.ts +8 -8
- package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
- package/dist/core/auto-mode-prompt.d.ts +1 -1
- package/dist/core/auto-mode.d.ts +17 -9
- package/dist/core/auto-mode.js +9 -6
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/canonical-json.d.ts +1 -1
- package/dist/core/canonical-json.js +2 -2
- package/dist/core/checkpoint-generation.d.ts +53 -0
- package/dist/core/checkpoint-generation.js +35 -0
- package/dist/core/checkpoint-queries.d.ts +180 -0
- package/dist/core/checkpoint-queries.js +272 -0
- package/dist/core/checkpoint-requirements.d.ts +19 -4
- package/dist/core/checkpoint-requirements.js +8 -14
- package/dist/core/checkpoint-store.d.ts +165 -72
- package/dist/core/checkpoint-store.js +79 -82
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +3 -16
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/context-edit.d.ts +6 -7
- package/dist/core/cross-boundary-taint.d.ts +11 -4
- package/dist/core/cross-boundary-taint.js +3 -3
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +19 -19
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/effective-path-target.d.ts +1 -1
- package/dist/core/engine-attestation.d.ts +93 -0
- package/dist/core/engine-attestation.js +70 -0
- package/dist/core/engine-capabilities.d.ts +4 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +45 -12
- package/dist/core/exec-output-tail.d.ts +1 -1
- package/dist/core/file-history-retention.d.ts +1 -1
- package/dist/core/file-history-store.d.ts +147 -21
- package/dist/core/file-history-store.js +58 -32
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -11
- package/dist/core/gate-lanes.js +81 -68
- package/dist/core/gate-outcome.d.ts +40 -6
- package/dist/core/gate-outcome.js +56 -0
- package/dist/core/governance-codes.d.ts +17 -3
- package/dist/core/governance-codes.js +16 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +21 -20
- package/dist/core/hooks.js +3 -1
- package/dist/core/host-floor.d.ts +128 -0
- package/dist/core/host-floor.js +206 -0
- package/dist/core/host-target.d.ts +84 -0
- package/dist/core/host-target.js +92 -0
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/lsp-diagnostics.d.ts +4 -4
- package/dist/core/lsp.d.ts +3 -3
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mcp-connection-pool.d.ts +18 -2
- package/dist/core/mcp-connection-pool.js +53 -6
- package/dist/core/mcp-failure.d.ts +23 -4
- package/dist/core/mcp-failure.js +26 -11
- package/dist/core/mcp-listing-drift.d.ts +10 -0
- package/dist/core/mcp-listing-drift.js +6 -0
- package/dist/core/mcp-server-link.d.ts +173 -0
- package/dist/core/mcp-server-link.js +127 -0
- package/dist/core/mcp-server-spec.d.ts +4 -2
- package/dist/core/mcp-session-end.d.ts +26 -0
- package/dist/core/mcp-session-end.js +29 -0
- package/dist/core/mcp-startup-request.d.ts +17 -0
- package/dist/core/mcp-startup-request.js +17 -0
- package/dist/core/mcp.d.ts +17 -13
- package/dist/core/mcp.js +240 -189
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/engine.d.ts +9 -9
- package/dist/core/memory-engine/engine.js +4 -4
- package/dist/core/memory-engine/layout.d.ts +60 -8
- package/dist/core/memory-engine/layout.js +65 -6
- package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
- package/dist/core/memory-engine/tools.js +4 -1
- package/dist/core/mode-policy.d.ts +1 -1
- package/dist/core/model-seat.d.ts +10 -3
- package/dist/core/mods/classic-events.d.ts +67 -0
- package/dist/core/mods/classic-events.js +1 -0
- package/dist/core/mods/dollar.d.ts +13 -0
- package/dist/core/mods/extension-call.d.ts +31 -0
- package/dist/core/mods/extension-call.js +43 -0
- package/dist/core/mods/kernel/dispatch.d.ts +20 -3
- package/dist/core/mods/kernel/dispatch.js +140 -69
- package/dist/core/mods/kernel/events.d.ts +47 -11
- package/dist/core/mods/kernel/events.js +66 -42
- package/dist/core/mods/kernel/index.d.ts +4 -4
- package/dist/core/mods/kernel/index.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +39 -5
- package/dist/core/mods/kernel/receive.js +290 -17
- package/dist/core/mods/kernel/registration.d.ts +33 -2
- package/dist/core/mods/kernel/registration.js +6 -7
- package/dist/core/mods/kernel/site-rules.d.ts +44 -16
- package/dist/core/mods/kernel/site-rules.js +24 -42
- package/dist/core/mods/spec-seats.d.ts +69 -0
- package/dist/core/mods/spec-seats.js +114 -0
- package/dist/core/mods/stations.d.ts +28 -8
- package/dist/core/mods/stations.js +29 -13
- package/dist/core/mods/tool-call.d.ts +79 -0
- package/dist/core/mods/tool-call.js +152 -0
- package/dist/core/namespaced-rule-name.d.ts +44 -24
- package/dist/core/namespaced-rule-name.js +50 -43
- package/dist/core/output-style.d.ts +1 -1
- package/dist/core/param-rule-reach.d.ts +15 -0
- package/dist/core/param-rule-reach.js +30 -0
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +6 -0
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/pause-registry.d.ts +16 -5
- package/dist/core/pause-registry.js +6 -2
- package/dist/core/peer-channel.d.ts +70 -0
- package/dist/core/peer-channel.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +30 -5
- package/dist/core/permission-rule-consent.js +147 -50
- package/dist/core/permission-rule-model.d.ts +245 -65
- package/dist/core/permission-rule-model.js +421 -107
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +7 -3
- package/dist/core/permission-rule-provider.d.ts +6 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +22 -26
- package/dist/core/permission-rule-store.js +12 -6
- package/dist/core/permission-rule-sync.d.ts +11 -2
- package/dist/core/permission-rule-sync.js +11 -3
- package/dist/core/permission-rule-syntax.d.ts +5 -4
- package/dist/core/permission-rule-syntax.js +2 -2
- package/dist/core/permission-rules.d.ts +53 -15
- package/dist/core/permission-rules.js +125 -100
- package/dist/core/persisted-rule-arms.d.ts +6 -4
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/present-plan-tool.js +3 -1
- package/dist/core/principal-name.d.ts +20 -0
- package/dist/core/principal-name.js +22 -0
- package/dist/core/prompt-section-seat.js +4 -6
- package/dist/core/protocol-http-auth.d.ts +26 -5
- package/dist/core/protocol-http-auth.js +137 -4
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/read-only-shell-table.d.ts +1 -1
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/retired-keys.d.ts +16 -0
- package/dist/core/retired-keys.js +16 -4
- package/dist/core/rewrite-rejudge.d.ts +60 -0
- package/dist/core/rewrite-rejudge.js +36 -0
- package/dist/core/roles.d.ts +34 -3
- package/dist/core/roles.js +66 -53
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-offer-read.d.ts +53 -0
- package/dist/core/rule-offer-read.js +146 -0
- package/dist/core/rule-owner.d.ts +46 -0
- package/dist/core/rule-owner.js +29 -0
- package/dist/core/runner/advisor-instructions.d.ts +70 -0
- package/dist/core/runner/advisor-instructions.js +61 -0
- package/dist/core/runner/advisor-tool.d.ts +33 -0
- package/dist/core/runner/advisor-tool.js +112 -0
- package/dist/core/runner/announce-once-ledger.d.ts +18 -26
- package/dist/core/runner/announce-once-ledger.js +19 -46
- package/dist/core/runner/approval-feedback.js +6 -3
- package/dist/core/runner/assemble-result.d.ts +2 -1
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/caller-roster.d.ts +21 -2
- package/dist/core/runner/caller-roster.js +38 -0
- package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
- package/dist/core/runner/capability-withheld-seat.js +24 -0
- package/dist/core/runner/classifier-ladder.d.ts +33 -13
- package/dist/core/runner/classifier-ladder.js +15 -14
- package/dist/core/runner/compaction-restate.d.ts +10 -6
- package/dist/core/runner/compaction-restate.js +9 -3
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +40 -33
- package/dist/core/runner/conversation-segment.d.ts +28 -0
- package/dist/core/runner/conversation-segment.js +42 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
- package/dist/core/runner/cross-boundary-lane.js +58 -34
- package/dist/core/runner/decide-continuation.d.ts +7 -4
- package/dist/core/runner/decide-continuation.js +2 -2
- package/dist/core/runner/denial-limit-arms.d.ts +4 -4
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +24 -24
- package/dist/core/runner/derived-route-fallback.js +9 -7
- package/dist/core/runner/file-history-request.d.ts +18 -0
- package/dist/core/runner/file-history-request.js +21 -13
- package/dist/core/runner/file-history-restore.d.ts +45 -0
- package/dist/core/runner/file-history-restore.js +46 -0
- package/dist/core/runner/gate-exit.d.ts +9 -3
- package/dist/core/runner/gate-exit.js +11 -5
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.js +38 -15
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +19 -8
- package/dist/core/runner/prepare-advisor.d.ts +63 -0
- package/dist/core/runner/prepare-advisor.js +77 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
- package/dist/core/runner/prepare-ask-lane.js +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +31 -38
- package/dist/core/runner/prepare-config-doors.js +57 -34
- package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
- package/dist/core/runner/prepare-defer-classify.js +7 -8
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +41 -73
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
- package/dist/core/runner/prepare-gate-stations.js +12 -8
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
- package/dist/core/runner/prepare-hands-readface.js +15 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
- package/dist/core/runner/prepare-inherited-gate.js +8 -6
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +12 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
- package/dist/core/runner/prepare-policy-chain.js +68 -81
- package/dist/core/runner/prepare-project-context.d.ts +5 -2
- package/dist/core/runner/prepare-project-context.js +6 -3
- package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
- package/dist/core/runner/prepare-prompt-assembly.js +10 -8
- package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
- package/dist/core/runner/prepare-prompt-inputs.js +4 -6
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +5 -4
- package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
- package/dist/core/runner/prepare-safety-scan.js +8 -23
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +5 -6
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +41 -35
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
- package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
- package/dist/core/runner/prepare-turn-wiring.js +2 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
- package/dist/core/runner/prepare-wiring-manifest.js +3 -3
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -12
- package/dist/core/runner/resume-checkpoint-screen.js +3 -0
- package/dist/core/runner/resume-claim.d.ts +4 -2
- package/dist/core/runner/resume-claim.js +15 -8
- package/dist/core/runner/resume-policy-outcome.js +1 -1
- package/dist/core/runner/retired-runner-deps.js +2 -1
- package/dist/core/runner/rewind-files.d.ts +15 -0
- package/dist/core/runner/rewind-files.js +132 -0
- package/dist/core/runner/run-attachment-seats.js +2 -2
- package/dist/core/runner/run-brain-sinks.d.ts +4 -1
- package/dist/core/runner/run-brain-sinks.js +4 -2
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -12
- package/dist/core/runner/run-git-lane.d.ts +1 -0
- package/dist/core/runner/run-harness-handlers.js +14 -7
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +43 -18
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.d.ts +1 -0
- package/dist/core/runner/run-turn-boundary.js +15 -22
- package/dist/core/runner/runtask.d.ts +3 -0
- package/dist/core/runner/runtask.js +8 -9
- package/dist/core/runner/session-read-file-states.d.ts +15 -0
- package/dist/core/runner/session-read-file-states.js +28 -0
- package/dist/core/runner/session-rule-policy.d.ts +22 -21
- package/dist/core/runner/session-rule-policy.js +17 -31
- package/dist/core/runner/shell-env-withheld.d.ts +33 -0
- package/dist/core/runner/shell-env-withheld.js +51 -0
- package/dist/core/runner/side-call-account.d.ts +32 -8
- package/dist/core/runner/side-call-account.js +23 -1
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +1 -1
- package/dist/core/runner/strict-output-schema.d.ts +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -6
- package/dist/core/runner/synthetic-tools.d.ts +16 -13
- package/dist/core/runner/synthetic-tools.js +8 -3
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +3 -4
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-end-body.js +10 -9
- package/dist/core/runner/tool-face-overlay.d.ts +2 -1
- package/dist/core/runner/tool-face-overlay.js +17 -1
- package/dist/core/runner/tool-not-executed.d.ts +5 -0
- package/dist/core/runner/tool-not-executed.js +11 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -0
- package/dist/core/runner/tool-occurrence.js +7 -0
- package/dist/core/runner/tool-progress-lane.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
- package/dist/core/runner/turn-attachments.d.ts +91 -80
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +42 -42
- package/dist/core/runtime-caps.d.ts +4 -4
- package/dist/core/safety-axis-vocab.d.ts +6 -4
- package/dist/core/safety-axis-vocab.js +6 -5
- package/dist/core/safety-merge-corpus.js +26 -2
- package/dist/core/same-plain-value.d.ts +40 -0
- package/dist/core/same-plain-value.js +49 -0
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/secret-env.d.ts +26 -3
- package/dist/core/secret-env.js +44 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +1 -1
- package/dist/core/session-policy-store.d.ts +102 -35
- package/dist/core/session-policy-store.js +210 -48
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +106 -37
- package/dist/core/session-store.js +165 -91
- package/dist/core/session.d.ts +101 -57
- package/dist/core/session.js +53 -0
- package/dist/core/shared-memory/tools.js +3 -1
- package/dist/core/shared-memory/types.d.ts +1 -1
- package/dist/core/shell-read-silence.d.ts +11 -12
- package/dist/core/shell-read-silence.js +9 -5
- package/dist/core/shell-run-candidates.js +3 -1
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/shell-wrapper-table.d.ts +14 -7
- package/dist/core/shell-wrapper-table.js +5 -4
- package/dist/core/side-query.d.ts +10 -0
- package/dist/core/side-query.js +15 -1
- package/dist/core/skill-grant.d.ts +7 -2
- package/dist/core/skill-grant.js +5 -0
- package/dist/core/skills-directory.js +6 -2
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
- package/dist/core/store-contracts/file-history-store-contract.js +74 -4
- package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
- package/dist/core/store-contracts/peer-directory-contract.js +14 -2
- package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
- package/dist/core/store-contracts/session-repo-contract.js +176 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
- package/dist/core/store-contracts/session-store-contract.js +361 -51
- package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/surrogate-safe-slice.d.ts +3 -3
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +42 -8
- package/dist/core/task-notification.d.ts +19 -15
- package/dist/core/task-registry-agent.d.ts +4 -4
- package/dist/core/task-registry-shared.d.ts +4 -4
- package/dist/core/task-registry-shared.js +1 -0
- package/dist/core/task-registry.d.ts +13 -4
- package/dist/core/task-registry.js +14 -2
- package/dist/core/task-result.d.ts +21 -3
- package/dist/core/task-spec.d.ts +69 -64
- package/dist/core/task-stream.d.ts +6 -6
- package/dist/core/task-tool-shape.d.ts +4 -4
- package/dist/core/tighten-task-spec.d.ts +1 -1
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +36 -2
- package/dist/core/tool-catalog-entries.js +69 -43
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-conformance.js +1 -0
- package/dist/core/tool-errors.d.ts +2 -2
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-face.d.ts +21 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +29 -8
- package/dist/core/tool-name-aliases.js +22 -4
- package/dist/core/tool-name-readings.d.ts +10 -43
- package/dist/core/tool-name-readings.js +2 -11
- package/dist/core/tool-policy.d.ts +85 -196
- package/dist/core/tool-policy.js +150 -175
- package/dist/core/tool-registry.d.ts +14 -7
- package/dist/core/tool-registry.js +17 -7
- package/dist/core/tool-result-store.js +5 -1
- package/dist/core/tool-roster.d.ts +57 -33
- package/dist/core/tool-roster.js +56 -68
- package/dist/core/tool-spec-members.js +8 -3
- package/dist/core/tool-spec.d.ts +53 -31
- package/dist/core/tools.js +51 -10
- package/dist/core/trace.d.ts +6 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/warm-resume.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +58 -0
- package/dist/core/wiring-manifest.js +14 -5
- package/dist/core/workflow-journal-store.d.ts +62 -0
- package/dist/core/workflow-journal-store.js +78 -2
- package/dist/core/workflow-run-store.d.ts +6 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +9 -9
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
- package/dist/engine/execution-env/node-execution-env.js +54 -24
- package/dist/engine/harness/agent-harness.d.ts +39 -9
- package/dist/engine/harness/agent-harness.js +87 -33
- package/dist/engine/harness/types.d.ts +58 -9
- package/dist/engine/harness/types.js +12 -1
- package/dist/engine/llm/types.d.ts +36 -19
- package/dist/engine/llm/validation.d.ts +4 -1
- package/dist/engine/llm/validation.js +13 -1
- package/dist/engine/loop/agent-loop.d.ts +23 -1
- package/dist/engine/loop/agent-loop.js +26 -34
- package/dist/engine/loop/types.d.ts +31 -19
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/memory-repo.d.ts +18 -12
- package/dist/engine/session/memory-repo.js +24 -9
- package/dist/engine/session/parent-chain-guard.d.ts +3 -2
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +32 -3
- package/dist/engine/session/repo-utils.js +50 -5
- package/dist/index.d.ts +47 -23
- package/dist/index.js +35 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +3 -3
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +8 -6
- package/dist/orchestration/run-workflow-tool.js +10 -6
- package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
- package/dist/orchestration/workflow-types.d.ts +18 -0
- package/dist/orchestration/workflow-types.js +6 -0
- package/dist/orchestration/workflow.d.ts +5 -13
- package/dist/orchestration/workflow.js +57 -49
- package/dist/prompt-assembly/artifact.d.ts +2 -2
- package/dist/prompt-assembly/artifact.js +5 -3
- package/dist/prompt-assembly/assemble.d.ts +3 -2
- package/dist/prompt-assembly/assemble.js +1 -1
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
- package/dist/prompt-assembly/catalog/schema.js +34 -2
- package/dist/prompt-assembly/catalog/sections.js +0 -1
- package/dist/prompt-assembly/composer.d.ts +3 -1
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/overlay.js +3 -3
- package/dist/prompt-assembly/renderers.d.ts +1 -1
- package/dist/prompt-assembly/renderers.js +0 -3
- package/dist/prompt-assembly/role-base.d.ts +15 -0
- package/dist/prompt-assembly/role-base.js +9 -0
- package/dist/prompt-assembly/select.d.ts +39 -14
- package/dist/prompt-assembly/select.js +47 -16
- package/dist/prompt-assembly/sugar.d.ts +17 -11
- package/dist/prompt-assembly/sugar.js +8 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
- package/dist/prompt-assembly/tool-catalog.js +117 -4
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
- package/dist/prompt-assembly/turn-snapshot.js +0 -3
- package/dist/prompt-assembly/types.d.ts +0 -7
- package/dist/prompts/default.d.ts +14 -14
- package/dist/scenarios/full-body.d.ts +15 -15
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.d.ts +4 -3
- package/dist/stores/file/adoption/adopt.js +27 -33
- package/dist/stores/file/adoption/marker.d.ts +6 -13
- package/dist/stores/file/adoption/marker.js +9 -17
- package/dist/stores/file/checkpoint-store.d.ts +24 -0
- package/dist/stores/file/checkpoint-store.js +45 -7
- package/dist/stores/file/file-history-store.d.ts +20 -19
- package/dist/stores/file/file-history-store.js +157 -141
- package/dist/stores/file/fs-atomic.d.ts +15 -0
- package/dist/stores/file/fs-atomic.js +89 -14
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +3 -0
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
- package/dist/stores/file/permission-rule-adopt.js +18 -18
- package/dist/stores/file/permission-rule-store.d.ts +18 -2
- package/dist/stores/file/permission-rule-store.js +31 -18
- package/dist/stores/file/session-policy-store.d.ts +3 -3
- package/dist/stores/file/session-store.d.ts +54 -16
- package/dist/stores/file/session-store.js +114 -85
- package/dist/stores/file/workflow-journal-store.d.ts +10 -4
- package/dist/stores/file/workflow-journal-store.js +28 -13
- package/dist/tools/artifact/artifact-text.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +5 -3
- package/dist/tools/fs/bash-program-position.d.ts +19 -2
- package/dist/tools/fs/bash-program-position.js +56 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
- package/dist/tools/fs/fs-bash.d.ts +2 -2
- package/dist/tools/fs/fs-bash.js +8 -6
- package/dist/tools/fs/fs-glob.d.ts +86 -0
- package/dist/tools/fs/fs-glob.js +226 -0
- package/dist/tools/fs/fs-read.js +14 -14
- package/dist/tools/fs/fs-search-tools.js +7 -7
- package/dist/tools/fs/fs-shared.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
- package/dist/tools/fs/notebook.d.ts +2 -2
- package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
- package/dist/tools/fs/pattern-kill-guard.js +397 -0
- package/dist/tools/fs/pdf.d.ts +9 -6
- package/dist/tools/fs/pdf.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +57 -7
- package/dist/tools/fs/program-read-model.js +11 -1
- package/dist/tools/fs/program-read-model.rows.js +78 -21
- package/dist/tools/fs/read-deny-home.js +3 -2
- package/dist/tools/fs/read-deny.d.ts +29 -7
- package/dist/tools/fs/read-deny.js +63 -22
- package/dist/tools/fs/removal-targets.d.ts +18 -8
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +16 -6
- package/dist/tools/fs/search.js +20 -26
- package/dist/tools/fs/shell-read-argv.js +89 -12
- package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
- package/dist/tools/fs/shell-read-bindings.js +41 -0
- package/dist/tools/fs/shell-read-check.js +12 -20
- package/dist/tools/fs/shell-read-environment.d.ts +5 -1
- package/dist/tools/fs/shell-read-environment.js +3 -2
- package/dist/tools/fs/shell-read-establish.d.ts +15 -0
- package/dist/tools/fs/shell-read-establish.js +19 -20
- package/dist/tools/fs/shell-read-judge.d.ts +4 -0
- package/dist/tools/fs/shell-read-judge.js +5 -2
- package/dist/tools/fs/shell-read-plan.js +24 -16
- package/dist/tools/fs/shell-read-start.d.ts +6 -1
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
- package/dist/tools/fs/shell-read-write-targets.js +2 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
- package/dist/tools/fs/shell-reentry-text.js +40 -2
- package/dist/tools/loop-tick.d.ts +2 -2
- package/dist/tools/scheduler-tools.js +5 -1
- package/dist/tools/task-list.d.ts +7 -7
- package/dist/tools/task-list.js +5 -1
- package/dist/tools/todo.js +65 -64
- package/dist/tools/web.d.ts +20 -15
- package/dist/tools/web.js +55 -69
- package/dist/tools/worktree.d.ts +3 -3
- package/dist/tools/worktree.js +3 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +5894 -5638
- package/wire-changes/core@7.55.0.json +3318 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
- package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { sliceHeadSafe, sliceTailSafe } from "../../core/surrogate-safe-slice.js";
|
|
2
2
|
import { isAbsoluteForFamily, normalizeAbsPathLexically, pathFamilyOf, pathIdentityOf, spellingOfIdentity } from "./safety.js";
|
|
3
3
|
import { PROBE_REASON_MAX } from "../../core/untrusted-text.js";
|
|
4
|
+
import { wildcardMatch } from "../../core/namespaced-rule-name.js";
|
|
4
5
|
import { validatePath } from "../../core/effective-path-target.js";
|
|
5
6
|
import { judgePathRows } from "../../core/path-guard-rows.js";
|
|
6
7
|
export const READ_DENY_HOME_WORD = "~";
|
|
@@ -313,17 +314,54 @@ function asciiLower(s) {
|
|
|
313
314
|
}
|
|
314
315
|
return out;
|
|
315
316
|
}
|
|
317
|
+
let UNIT_FOLD;
|
|
318
|
+
function foldedUnit(c) {
|
|
319
|
+
if (c < 0x80)
|
|
320
|
+
return c >= 0x61 && c <= 0x7a ? c - 0x20 : c;
|
|
321
|
+
const table = (UNIT_FOLD ??= new Int32Array(0x10000).fill(-1));
|
|
322
|
+
const known = table[c];
|
|
323
|
+
if (known >= 0)
|
|
324
|
+
return known;
|
|
325
|
+
const upper = String.fromCharCode(c).toUpperCase();
|
|
326
|
+
const folded = upper.length === 1 && upper.charCodeAt(0) >= 0x80 ? upper.charCodeAt(0) : c;
|
|
327
|
+
table[c] = folded;
|
|
328
|
+
return folded;
|
|
329
|
+
}
|
|
330
|
+
export function ignoreCaseFold(s) {
|
|
331
|
+
let out = "";
|
|
332
|
+
for (let from = 0; from < s.length; from += 4096) {
|
|
333
|
+
const codes = [];
|
|
334
|
+
for (let i = from, to = Math.min(from + 4096, s.length); i < to; i++)
|
|
335
|
+
codes.push(foldedUnit(s.charCodeAt(i)));
|
|
336
|
+
out += String.fromCharCode(...codes);
|
|
337
|
+
}
|
|
338
|
+
return out;
|
|
339
|
+
}
|
|
340
|
+
export const SEGMENT_FOLDS = { none: (s) => s, ascii: asciiLower, unicode: ignoreCaseFold };
|
|
341
|
+
function foldSegments(fold, segs) {
|
|
342
|
+
return segs.map((s) => SEGMENT_FOLDS[fold](s));
|
|
343
|
+
}
|
|
344
|
+
function foldedViewsOf(views) {
|
|
345
|
+
const memo = new Map();
|
|
346
|
+
return (fold) => {
|
|
347
|
+
let folded = memo.get(fold);
|
|
348
|
+
if (folded === undefined)
|
|
349
|
+
memo.set(fold, (folded = fold === "none" ? views : views.map((segs) => foldSegments(fold, segs))));
|
|
350
|
+
return folded;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function segmentMatcher(pattern) {
|
|
354
|
+
return {
|
|
355
|
+
anything: /^\*+$/.test(pattern),
|
|
356
|
+
test: (segment) => !segment.includes("/") && wildcardMatch(pattern, segment),
|
|
357
|
+
};
|
|
358
|
+
}
|
|
316
359
|
export function compileSegmentPattern(raw, fold) {
|
|
317
|
-
const source = fold
|
|
360
|
+
const source = SEGMENT_FOLDS[fold](raw);
|
|
318
361
|
const parts = source.split("/").filter(Boolean);
|
|
319
362
|
if (parts.length === 0)
|
|
320
363
|
return null;
|
|
321
|
-
|
|
322
|
-
const segments = parts.map((segment) => {
|
|
323
|
-
const escaped = segment.replace(/[.+^${}()|[\]\\?]/g, "\\$&").replace(/\*+/g, "[^/]*");
|
|
324
|
-
return new RegExp(`^${escaped}$`, flags);
|
|
325
|
-
});
|
|
326
|
-
return { raw, segments, foldAscii: fold === "ascii" };
|
|
364
|
+
return { raw, segments: parts.map(segmentMatcher), fold };
|
|
327
365
|
}
|
|
328
366
|
export function matchSegmentPatterns(path, compiled, opts) {
|
|
329
367
|
const readings = segmentReadingsOf(path, opts?.aliasResolved === true);
|
|
@@ -339,7 +377,13 @@ function segmentReadingsOf(path, aliasResolved) {
|
|
|
339
377
|
if (known !== undefined)
|
|
340
378
|
return known;
|
|
341
379
|
const views = segmentViewsOf(path, aliasResolved ? { aliasResolved } : undefined);
|
|
342
|
-
|
|
380
|
+
let folded;
|
|
381
|
+
const readings = {
|
|
382
|
+
views,
|
|
383
|
+
lowered: views.map((v) => foldSegments("ascii", v)),
|
|
384
|
+
folded: () => (folded ??= views.map((v) => foldSegments("unicode", v))),
|
|
385
|
+
rooted: isAbsoluteForFamily("own", path),
|
|
386
|
+
};
|
|
343
387
|
if (SEGMENT_READINGS.size >= 512)
|
|
344
388
|
SEGMENT_READINGS.clear();
|
|
345
389
|
SEGMENT_READINGS.set(key, readings);
|
|
@@ -347,7 +391,7 @@ function segmentReadingsOf(path, aliasResolved) {
|
|
|
347
391
|
}
|
|
348
392
|
function segmentRowMeets(pat, readings) {
|
|
349
393
|
const n = pat.segments.length;
|
|
350
|
-
const views = pat.
|
|
394
|
+
const views = pat.fold === "ascii" ? readings.lowered : pat.fold === "unicode" ? readings.folded() : readings.views;
|
|
351
395
|
for (const segs of views) {
|
|
352
396
|
const runAt = (i) => i + n <= segs.length && pat.segments.every((re, j) => re.test(segs[i + j] ?? ""));
|
|
353
397
|
if (pat.anchors !== undefined && readings.rooted) {
|
|
@@ -406,16 +450,13 @@ function rowMeetsPath(pat, segs, rooted) {
|
|
|
406
450
|
}
|
|
407
451
|
return false;
|
|
408
452
|
}
|
|
409
|
-
function isAnySegment(re) {
|
|
410
|
-
return /^\^(\[\^\/\]\*)+\$$/.test(re.source);
|
|
411
|
-
}
|
|
412
453
|
function rowNamedByRoot(pat, segs, rooted) {
|
|
413
454
|
if (pat.anchors !== undefined)
|
|
414
455
|
return rooted && rowMeetsPath(pat, segs, rooted) ? "named" : "none";
|
|
415
456
|
if (pat.rootedOnly === true)
|
|
416
457
|
return "none";
|
|
417
458
|
let k = 0;
|
|
418
|
-
while (k < pat.segments.length &&
|
|
459
|
+
while (k < pat.segments.length && pat.segments[k].anything)
|
|
419
460
|
k++;
|
|
420
461
|
const run = pat.segments.slice(k);
|
|
421
462
|
for (let i = 0; run.length > 0 && i < segs.length; i++) {
|
|
@@ -427,11 +468,11 @@ function rowNamedByRoot(pat, segs, rooted) {
|
|
|
427
468
|
}
|
|
428
469
|
function rowNamedByRootOf(rows, path) {
|
|
429
470
|
const rooted = isAbsoluteForFamily("own", path);
|
|
430
|
-
const
|
|
471
|
+
const foldedViews = foldedViewsOf(segmentViewsOf(path));
|
|
431
472
|
let unplaced;
|
|
432
473
|
for (const pat of rows) {
|
|
433
|
-
for (const view of
|
|
434
|
-
const relation = rowNamedByRoot(pat,
|
|
474
|
+
for (const view of foldedViews(pat.fold)) {
|
|
475
|
+
const relation = rowNamedByRoot(pat, view, rooted);
|
|
435
476
|
if (relation === "named")
|
|
436
477
|
return { pattern: pat.raw };
|
|
437
478
|
if (relation === "unplaced")
|
|
@@ -442,10 +483,10 @@ function rowNamedByRootOf(rows, path) {
|
|
|
442
483
|
}
|
|
443
484
|
function rowAtOrBelowOf(rows, path) {
|
|
444
485
|
const rooted = isAbsoluteForFamily("own", path);
|
|
445
|
-
const
|
|
486
|
+
const foldedViews = foldedViewsOf(segmentViewsOf(path));
|
|
446
487
|
for (const pat of rows) {
|
|
447
|
-
for (const view of
|
|
448
|
-
if (rowMeetsPath(pat,
|
|
488
|
+
for (const view of foldedViews(pat.fold))
|
|
489
|
+
if (rowMeetsPath(pat, view, rooted))
|
|
449
490
|
return pat.raw;
|
|
450
491
|
}
|
|
451
492
|
return null;
|
|
@@ -562,7 +603,7 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
562
603
|
return { ...c, raw: e.pattern };
|
|
563
604
|
if (homeSegments.length === 0)
|
|
564
605
|
return { ...c, raw: e.pattern, unplacedHome: true };
|
|
565
|
-
return { ...c, raw: e.pattern, anchors: homeSegments.map((segs) => (fold
|
|
606
|
+
return { ...c, raw: e.pattern, anchors: homeSegments.map((segs) => foldSegments(fold, segs)) };
|
|
566
607
|
});
|
|
567
608
|
if (!(linked instanceof Map))
|
|
568
609
|
throw new Error(`readDenyHomeLinks: expected a Map from a row's pattern to its locations, got ${typeof linked}.`);
|
|
@@ -576,13 +617,13 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
576
617
|
const rest = c.segments.slice(readDenyRunHead(run));
|
|
577
618
|
for (const location of new Set(checkedReadDenyHomes(locations, "readDenyHomeLinks"))) {
|
|
578
619
|
const segs = homeAnchorSegments(location);
|
|
579
|
-
linkedPlacements.push({ raw: e.pattern, segments: rest,
|
|
620
|
+
linkedPlacements.push({ raw: e.pattern, segments: rest, fold: c.fold, anchors: [foldSegments(c.fold, segs)], rootedOnly: true });
|
|
580
621
|
}
|
|
581
622
|
});
|
|
582
623
|
const judged = linkedPlacements.length === 0 ? compiled : [...compiled, ...linkedPlacements];
|
|
583
624
|
const segmentRows = judged.map((c) => {
|
|
584
625
|
const col = columns.get(c.raw);
|
|
585
|
-
return segmentGuardRow(c, { faces: ["read"], polarity: "deny", exemptible: false, fold: c.
|
|
626
|
+
return segmentGuardRow(c, { faces: ["read"], polarity: "deny", exemptible: false, fold: c.fold === "ascii" ? "ascii" : "exact", origin: col?.origin ?? "addition", ...(col?.tier !== undefined ? { tier: col.tier } : {}) });
|
|
586
627
|
});
|
|
587
628
|
const tableRows = [...segmentRows, ...ruleRows.map(ruleGuardRow)];
|
|
588
629
|
const rgExclusionGlobs = [];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EstablishedRead } from "./shell-read-judge.js";
|
|
1
2
|
import { type EstablishedPlan } from "./shell-read-establish.js";
|
|
2
3
|
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
3
4
|
import type { ToolCallRequest } from "../../core/tool-policy.js";
|
|
@@ -22,7 +23,7 @@ export interface DangerousRemoval {
|
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* The ONE dangerous-removal predicate: is removing this absolute path removing a protected location? The reference
|
|
25
|
-
* implementation's set
|
|
26
|
+
* implementation's set — the filesystem root (a drive root, a UNC share root), a home directory
|
|
26
27
|
* (every spelling the seat holds), a workspace directory or any of its ANCESTORS (the task root, the working directory, an
|
|
27
28
|
* additional working directory — whether the home lies inside the task root or the task root inside the home), a top-level
|
|
28
29
|
* directory (one segment below the root). `undefined` for a relative path or any other target.
|
|
@@ -35,8 +36,8 @@ export declare function dangerousRemovalOf(path: string, seat: RemovalSeat): Dan
|
|
|
35
36
|
* (`rewritten`), the operands of a removal its argv stream fills in (`stream`), or an operand relative to the directory a
|
|
36
37
|
* launcher option moved the removal into (`relocated`); or a shell handed text the engine cannot read
|
|
37
38
|
* (`unverifiable_shell_text`) — a text a program produces (`produced`: what a pipe or a `<(…)` carries, an argv a stream
|
|
38
|
-
* fills in, a substitution),
|
|
39
|
-
* segment whose program the walk could not name
|
|
39
|
+
* fills in, a substitution), a text nobody read (`unread`: one the lexer could not read at all, {@link unreadPlan}), or a
|
|
40
|
+
* segment whose program the walk could not name (`position`, {@link programUnread}). */
|
|
40
41
|
export type RemovalFinding = (DangerousRemoval & {
|
|
41
42
|
readonly guard: "dangerous_delete";
|
|
42
43
|
readonly untrackedFrom?: string;
|
|
@@ -49,7 +50,7 @@ export type RemovalFinding = (DangerousRemoval & {
|
|
|
49
50
|
readonly guard: "unverifiable_shell_text";
|
|
50
51
|
readonly program: string;
|
|
51
52
|
readonly text: string;
|
|
52
|
-
readonly source: "produced" | "unread";
|
|
53
|
+
readonly source: "produced" | "unread" | "position";
|
|
53
54
|
};
|
|
54
55
|
/**
|
|
55
56
|
* The names a removal target may be built on and still be verified: a root the SHELL provides, never one a command's
|
|
@@ -62,10 +63,12 @@ export type RemovalFinding = (DangerousRemoval & {
|
|
|
62
63
|
export declare const KNOWN_SAFE_ROOTS: readonly string[];
|
|
63
64
|
/**
|
|
64
65
|
* The removal findings of an established plan — ONE walk, nested plans included (a `bash -c` / `sh -c` text, a substitution
|
|
65
|
-
* body), two words. For every `rm` / `rmdir`
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
66
|
+
* body), two words. For every removal segment ({@link removalProgramOf}: an `rm` / `rmdir` the text names, or a program it
|
|
67
|
+
* does not settle, read as `rm`) whose argv the program does not refuse outright ({@link optionsReceived}), each of its
|
|
68
|
+
* OPERANDS (every write target that is not one of its option words: a word some implementation's reading of the
|
|
69
|
+
* program's row writes, {@link writeReadings}) as the plan established it on the WRITE face (the entry the program
|
|
70
|
+
* unlinks, and the deny-floor shadow of a home word the plan did not place) is judged by {@link dangerousRemovalOf},
|
|
71
|
+
* save one the program refuses by its own first step ({@link refusedByRemoval}: `.`, `..`). In a recursive forced removal ({@link recursiveForce}), an operand
|
|
69
72
|
* the shell rewrites from a value the plan's table does not settle — a name with no value here or one set in a form the
|
|
70
73
|
* table cannot read, a substitution, a parameter operator, a positional parameter — is an unverifiable target, save a
|
|
71
74
|
* literal path below a known-safe root the shell still provides there ({@link belowKnownSafeRoot}); so are the operands
|
|
@@ -80,6 +83,13 @@ export declare const KNOWN_SAFE_ROOTS: readonly string[];
|
|
|
80
83
|
* own. The read-face copy of an operand is not judged: it follows a link the removal does not follow.
|
|
81
84
|
*/
|
|
82
85
|
export declare function removalFindingsOf(established: EstablishedPlan, seat: RemovalSeat, safeRoots?: readonly string[], enclosingRelocated?: boolean): RemovalFinding[];
|
|
86
|
+
/** Does the removal program refuse this operand by its own first step — its last path component is `.` or `..`, trailing
|
|
87
|
+
* separators stripped (POSIX `rm` step 1, which GNU, BSD and BusyBox `rm` keep; `rmdir(2)` fails on such a component
|
|
88
|
+
* too)? It removes nothing there, wherever the name lands. The name is the one the program RECEIVES: a pattern's match
|
|
89
|
+
* (the spelling an expansion carries beside its origin: `.*` hands it `.` and `..` beside the dotfiles, and only those two
|
|
90
|
+
* are refused), else the word as the plan spells it; a word the shell rewrites from a value the plan does not settle
|
|
91
|
+
* names nothing known, and is never refused here. */
|
|
92
|
+
export declare function refusedByRemoval(read: EstablishedRead): boolean;
|
|
83
93
|
/** Does this plan (nested plans included) run a removal program, hand a shell a script built when it runs, or hold text
|
|
84
94
|
* nobody could read ({@link unreadPlan}, {@link programUnread})? The guard establishes nothing for a command that does none. */
|
|
85
95
|
export declare function planRunsRemoval(plan: EstablishedPlan["plan"]): boolean;
|
|
@@ -2,11 +2,11 @@ import { planShellReads } from "./shell-read-plan.js";
|
|
|
2
2
|
import { literalTextOf } from "../../shell/lex.js";
|
|
3
3
|
import { createShellReadEstablisher, establishShellReadsLexically } from "./shell-read-establish.js";
|
|
4
4
|
import { isAbsoluteForFamily, isWinFormPath, normalizeAbsPathLexically } from "./safety.js";
|
|
5
|
-
import { launchedCommands, launchedReadings, reentryText, scriptFileAt, spellLaunched } from "./shell-reentry-text.js";
|
|
6
|
-
import { readProgramPosition } from "./bash-program-position.js";
|
|
5
|
+
import { launchedCommands, launchedReadings, reentryText, runsStoredLine, scriptFileAt, spellLaunched } from "./shell-reentry-text.js";
|
|
6
|
+
import { declinedProgramSentence, readProgramPosition } from "./bash-program-position.js";
|
|
7
7
|
import { bashClassifyDefaultAllow } from "./bash-readonly-classifier.js";
|
|
8
8
|
import { programArgs } from "./shell-read-write-targets.js";
|
|
9
|
-
import { implementationsOf, programRow, runsShellText, selectedOptions, writeReadings } from "./program-read-model.js";
|
|
9
|
+
import { declaresOption, implementationsOf, programRow, rowRefusesArgv, runsShellText, selectedOptions, writeReadings } from "./program-read-model.js";
|
|
10
10
|
import { inlineUntrusted } from "../../core/untrusted-text.js";
|
|
11
11
|
export const SHELL_REMOVAL_COMMANDS = Object.freeze(["rm", "rmdir"]);
|
|
12
12
|
const REMOVAL_COMMAND_SET = new Set(SHELL_REMOVAL_COMMANDS);
|
|
@@ -68,10 +68,19 @@ function belowKnownSafeRoot(word, safe, segment) {
|
|
|
68
68
|
const below = rest.map((p) => p.literal).join("");
|
|
69
69
|
return /^\/[^*?[\]]+$/.test(below) && !below.split("/").includes("..");
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function optionsReceived(row, args) {
|
|
72
|
+
const rewrittenAt = args.findIndex((w) => w.rewritten === true);
|
|
73
|
+
const asWritten = (rewrittenAt < 0 ? args : args.slice(0, rewrittenAt)).map((w) => w.spelled);
|
|
74
|
+
const present = args.filter((w) => w.vanishes !== true);
|
|
75
|
+
const chosenAt = present.findIndex((w) => w.rewritten === true);
|
|
76
|
+
const shellChooses = chosenAt >= 0 && writeReadings(row, present.slice(0, chosenAt + 1).map((w) => w.spelled)).some((r) => r.written.length === 0);
|
|
77
|
+
return { refused: rowRefusesArgv(row, asWritten), shellChooses };
|
|
78
|
+
}
|
|
79
|
+
function recursiveForce(row, args, shellChooses) {
|
|
72
80
|
return implementationsOf(row).some((view) => {
|
|
73
81
|
const selected = selectedOptions(view, args, "one-implementation");
|
|
74
|
-
|
|
82
|
+
const selects = (has) => selected.some(has) || (shellChooses && declaresOption(view, has));
|
|
83
|
+
return selects((o) => o.selects === "traversal") && selects((o) => o.mode === "forced");
|
|
75
84
|
});
|
|
76
85
|
}
|
|
77
86
|
export function removalFindingsOf(established, seat, safeRoots = KNOWN_SAFE_ROOTS, enclosingRelocated = false) {
|
|
@@ -81,23 +90,27 @@ export function removalFindingsOf(established, seat, safeRoots = KNOWN_SAFE_ROOT
|
|
|
81
90
|
const safe = new Set(safeRoots);
|
|
82
91
|
for (const segment of established.plan.segments) {
|
|
83
92
|
const program = segment.verb?.basename;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
const removal = removalProgramOf(segment);
|
|
94
|
+
const args = removal === undefined ? [] : programArgs(segment);
|
|
95
|
+
const spelled = args.map((w) => w.spelled);
|
|
96
|
+
const received = removal === undefined ? undefined : optionsReceived(removal.row, args);
|
|
97
|
+
if (removal !== undefined && received?.refused === false) {
|
|
98
|
+
const { row, named } = removal;
|
|
88
99
|
const removed = new Set(writeReadings(row, spelled).flatMap((r) => r.written.map((w) => w.at)));
|
|
89
100
|
const options = new Set(args.filter((_, at) => !removed.has(at)).map((w) => w.raw));
|
|
90
|
-
const forced = recursiveForce(row, spelled);
|
|
101
|
+
const forced = recursiveForce(row, spelled, received.shellChooses);
|
|
91
102
|
if (forced && segment.reentry === "argv")
|
|
92
|
-
out.push({ guard: "unverifiable_delete", program, operand: segment.text.trim(), source: "stream" });
|
|
103
|
+
out.push({ guard: "unverifiable_delete", program: removal.program, operand: segment.text.trim(), source: "stream" });
|
|
93
104
|
const relocated = enclosingRelocated || readProgramPosition(segment.argv).launcherMovesBase;
|
|
94
105
|
for (const read of established.reads.get(segment) ?? []) {
|
|
95
|
-
if (read.candidate.face !== "write" || options.has(read.candidate.raw))
|
|
106
|
+
if ((named && read.candidate.face !== "write") || read.candidate.provenance === "program_path" || options.has(read.candidate.raw))
|
|
107
|
+
continue;
|
|
108
|
+
if (refusedByRemoval(read))
|
|
96
109
|
continue;
|
|
97
110
|
const kind = removalKindOf(read, seat);
|
|
98
111
|
if (kind !== undefined) {
|
|
99
112
|
const untracked = read.candidate.bases === "unmodelled" ? established.plan.segments.find((s) => s.bases === "unmodelled")?.text.trim() : undefined;
|
|
100
|
-
out.push({ guard: "dangerous_delete", kind, program, operand: read.candidate.raw, target: read.target ?? read.candidate.floorSpelled ?? read.candidate.spelled, ...(untracked !== undefined ? { untrackedFrom: untracked } : {}) });
|
|
113
|
+
out.push({ guard: "dangerous_delete", kind, program: removal.program, operand: read.candidate.raw, target: read.target ?? read.candidate.floorSpelled ?? read.candidate.spelled, ...(untracked !== undefined ? { untrackedFrom: untracked } : {}) });
|
|
101
114
|
continue;
|
|
102
115
|
}
|
|
103
116
|
if (!forced || read.established !== "unestablishable" || (read.candidate.expands !== "unresolvable" && !relocated))
|
|
@@ -105,14 +118,14 @@ export function removalFindingsOf(established, seat, safeRoots = KNOWN_SAFE_ROOT
|
|
|
105
118
|
const word = segment.argv.find((w) => w.raw === read.candidate.raw);
|
|
106
119
|
if (word !== undefined && belowKnownSafeRoot(word, safe, segment))
|
|
107
120
|
continue;
|
|
108
|
-
out.push({ guard: "unverifiable_delete", program, operand: read.candidate.raw, source: read.candidate.expands === "unresolvable" ? "rewritten" : "relocated" });
|
|
121
|
+
out.push({ guard: "unverifiable_delete", program: removal.program, operand: read.candidate.raw, source: read.candidate.expands === "unresolvable" ? "rewritten" : "relocated" });
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
124
|
const script = runtimeScriptOf(segment);
|
|
112
125
|
if (script !== undefined && program !== undefined)
|
|
113
126
|
out.push({ guard: "unverifiable_shell_text", program, text: script, source: "produced" });
|
|
114
127
|
if (programUnread(segment))
|
|
115
|
-
out.push({ guard: "unverifiable_shell_text", program: segment.launcherChain[0] ?? segment.text.trim(), text: segment.text.trim(), source: "
|
|
128
|
+
out.push({ guard: "unverifiable_shell_text", program: segment.launcherChain[0] ?? segment.text.trim(), text: segment.text.trim(), source: "position" });
|
|
116
129
|
const handedRelocated = enclosingRelocated || readProgramPosition(segment.argv).launcherMovesBase;
|
|
117
130
|
for (const nested of segment.nested) {
|
|
118
131
|
if (unreadPlan(nested)) {
|
|
@@ -143,7 +156,7 @@ function runtimeScriptOf(segment) {
|
|
|
143
156
|
const source = file === undefined ? undefined : argv[file];
|
|
144
157
|
if (source !== undefined && source.pieces.length === 1 && source.pieces[0].expansion?.kind === "process")
|
|
145
158
|
return source.raw;
|
|
146
|
-
if (pos.argvFromStdin)
|
|
159
|
+
if (pos.argvFromStdin || runsStoredLine(program.basename, argv.map((w) => w.folded)))
|
|
147
160
|
return segment.text.trim();
|
|
148
161
|
}
|
|
149
162
|
const named = pos.program !== undefined && pos.refusal === undefined ? [{ shell: program.basename, words: segment.argv.slice(pos.program.index + 1).map((_, k) => spell(pos.program.index + 1 + k)) }] : [];
|
|
@@ -157,8 +170,21 @@ function runtimeScriptOf(segment) {
|
|
|
157
170
|
}
|
|
158
171
|
const unreadPlan = (plan) => plan.unreadable !== undefined && plan.segments.length === 0;
|
|
159
172
|
const programUnread = (s) => s.declines.includes("unreadable_program_position");
|
|
173
|
+
const programNameUnsettled = (s) => s.verb !== undefined && s.reads.some((c) => c.provenance === "program_path" && c.expands === "unresolvable");
|
|
174
|
+
const RM_REMOVAL_ROW = programRow("rm");
|
|
175
|
+
function removalProgramOf(s) {
|
|
176
|
+
const basename = s.verb?.basename;
|
|
177
|
+
const row = basename !== undefined && REMOVAL_COMMAND_SET.has(basename) ? programRow(basename) : undefined;
|
|
178
|
+
if (row !== undefined)
|
|
179
|
+
return { program: basename, row, named: true };
|
|
180
|
+
return programNameUnsettled(s) && RM_REMOVAL_ROW !== undefined ? { program: s.verb.name, row: RM_REMOVAL_ROW, named: false } : undefined;
|
|
181
|
+
}
|
|
182
|
+
export function refusedByRemoval(read) {
|
|
183
|
+
const name = read.established === "expansion" ? read.spellings.find((s) => s !== read.origin) : read.candidate.expands === "unresolvable" ? undefined : read.candidate.spelled;
|
|
184
|
+
return name !== undefined && /(?:^|\/)\.\.?\/*$/.test(name);
|
|
185
|
+
}
|
|
160
186
|
export function planRunsRemoval(plan) {
|
|
161
|
-
return unreadPlan(plan) || plan.segments.some((s) => (s
|
|
187
|
+
return unreadPlan(plan) || plan.segments.some((s) => removalProgramOf(s) !== undefined || runtimeScriptOf(s) !== undefined || programUnread(s) || s.nested.some(planRunsRemoval));
|
|
162
188
|
}
|
|
163
189
|
const DANGEROUS_REMOVAL_SENTENCE = {
|
|
164
190
|
filesystem_root: (p, t) => `\`${p}\` would remove the filesystem root (${t})`,
|
|
@@ -172,8 +198,9 @@ const UNVERIFIABLE_REMOVAL_SENTENCE = {
|
|
|
172
198
|
relocated: (p, o) => `\`${p}\` recursive+force target ${o} is relative to a directory a launcher option moved the program into, which this command does not settle — the deleted path cannot be verified from this command`,
|
|
173
199
|
};
|
|
174
200
|
const UNREADABLE_TEXT_SENTENCE = {
|
|
175
|
-
produced: (p, t) => `\`${p}\` runs shell text that is built only when the command runs (${t}) — the text this shell will run cannot be read by the engine, so whether it removes anything is unknown`,
|
|
176
|
-
unread: (p, t) => `\`${p}\` runs shell text this guard cannot read (${t}) — the text this shell will run cannot be read by the engine, so whether it removes anything is unknown`,
|
|
201
|
+
produced: (p, t) => `\`${p}\` runs shell text that is built only when the command runs (${inlineUntrusted(t, 200)}) — the text this shell will run cannot be read by the engine, so whether it removes anything is unknown; write the text into the command itself (a \`-c\` string, a here-document or a here-string) and the engine reads it as it reads any command`,
|
|
202
|
+
unread: (p, t) => `\`${p}\` runs shell text this guard cannot read (${inlineUntrusted(t, 200)}) — the text this shell will run cannot be read by the engine, so whether it removes anything is unknown`,
|
|
203
|
+
position: (_p, t) => inlineUntrusted(declinedProgramSentence(t), 400),
|
|
177
204
|
};
|
|
178
205
|
function verdictOf(findings) {
|
|
179
206
|
for (const f of findings) {
|
|
@@ -187,7 +214,7 @@ function verdictOf(findings) {
|
|
|
187
214
|
return { guard: f.guard, text: UNVERIFIABLE_REMOVAL_SENTENCE[f.source](f.program, inlineUntrusted(f.operand, 200)) };
|
|
188
215
|
for (const f of findings)
|
|
189
216
|
if (f.guard === "unverifiable_shell_text")
|
|
190
|
-
return { guard: f.guard, text: UNREADABLE_TEXT_SENTENCE[f.source](f.program,
|
|
217
|
+
return { guard: f.guard, text: UNREADABLE_TEXT_SENTENCE[f.source](f.program, f.text) };
|
|
191
218
|
return undefined;
|
|
192
219
|
}
|
|
193
220
|
const REMOVAL_RESOLVE_TIMEOUT_MS = 10_000;
|
|
@@ -57,7 +57,7 @@ export interface ReadEntry {
|
|
|
57
57
|
* attachment picks the most RECENTLY read files, the way CC sorts readFileState by timestamp.
|
|
58
58
|
* Optional/additive: undefined (an entry seeded from an older checkpoint) sorts last, never breaks. */
|
|
59
59
|
lastReadAt?: number;
|
|
60
|
-
/**
|
|
60
|
+
/** TRUE when the Runner pre-seeded this entry because the file's FULL
|
|
61
61
|
* disk-verbatim text was injected into the model's context at startup
|
|
62
62
|
* (ProjectMemoryLoad.seededFiles — CC's own memory preload). A DEFAULT whole-file Read of an
|
|
63
63
|
* UNCHANGED seeded file
|
|
@@ -84,7 +84,7 @@ export declare function sha256(content: string): string;
|
|
|
84
84
|
export interface FsViolation {
|
|
85
85
|
code: "path_not_in_root" | "not_read" | "stale" | "ambiguous_edit" | "invalid" | "read_path_denied" | "write_path_denied";
|
|
86
86
|
/** Set on the `not_read` violation raised by an AUTO-TRUNCATED read
|
|
87
|
-
* ({@link ReadEntry.isPartialView}) rather than by a never-read file. Both carry the same
|
|
87
|
+
* ({@link ReadEntry.isPartialView}) rather than by a never-read file. Both carry the same
|
|
88
88
|
* message; only this one needs {@link PARTIAL_VIEW_READ_ESCAPE_HINT} appended, because for it a plain
|
|
89
89
|
* re-read is a fixpoint. */
|
|
90
90
|
partialView?: true;
|
|
@@ -238,7 +238,7 @@ export declare function binaryMagicFormat(bytes: Uint8Array): string | undefined
|
|
|
238
238
|
*/
|
|
239
239
|
export declare function isBinaryContent(sample: string): boolean;
|
|
240
240
|
/**
|
|
241
|
-
*
|
|
241
|
+
* The UNC/network-path predicate (`n.startsWith("\\\\") || n.startsWith("//")`). Pure.
|
|
242
242
|
*
|
|
243
243
|
* In CC this test is an EARLY ALLOW — it skips the binary-extension and device checks that follow it —
|
|
244
244
|
* and CC applies it to the NORMALIZED path, not the raw argument. See {@link canonicalizeTarget} for
|
|
@@ -572,7 +572,7 @@ export declare function rootAdmittingArtifactStore(storePhysical: string, rootsC
|
|
|
572
572
|
*/
|
|
573
573
|
export declare const PATH_NOT_IN_ROOT_ESCAPE_HINT = "(This boundary applies to the structured file tools. If you genuinely need content outside the allowed root(s), ask for the directory to be added to the deployment's additionalDirectories \u2014 or additionalReadDirectories for read-only access; a deployment that wants reads or writes open everywhere can declare readFace / writeFace: \"open\" instead of listing directories.)";
|
|
574
574
|
/** inv 1 (read-before-edit): a file must have been read this task before it can be edited/overwritten.
|
|
575
|
-
* Message
|
|
575
|
+
* Message as probed (all-tools-live-probe 2026-07-08 §2.1/§3.1/§5.1 — one message for
|
|
576
576
|
* Edit/Write/NotebookEdit: "before writing to it", not the old sema "before editing").
|
|
577
577
|
*
|
|
578
578
|
* CC parity (Edit and Write spell the read gate identically, `!p || p.isPartialView`): an
|
|
@@ -594,7 +594,7 @@ export declare function requireRead(state: ReadFileState, key: string): FsViolat
|
|
|
594
594
|
* Escape-hatch parenthetical appended to the read-before-edit refusal when the target file is over
|
|
595
595
|
* the Read tool's whole-file byte cap: a bare "read it first" would be un-followable there (a default
|
|
596
596
|
* whole-file Read refuses such files → refusal loop). Same parenthetical pattern as the Write tool's
|
|
597
|
-
* encoding-deadlock hint; the
|
|
597
|
+
* encoding-deadlock hint; the base sentence stays untouched for the normal-size case.
|
|
598
598
|
*/
|
|
599
599
|
export declare const OVERSIZE_READ_ESCAPE_HINT = "(This file is over the Read tool's whole-file byte cap, so a default Read is refused \u2014 read it in slices with explicit offset/limit to satisfy the read-first rule, or inspect/transform it with bash (e.g. `sed -n`, `grep`) instead.)";
|
|
600
600
|
/**
|
|
@@ -623,7 +623,7 @@ export declare const READ_REFUSED_ESCAPE_HINT = "(If the Read tool refuses this
|
|
|
623
623
|
/**
|
|
624
624
|
* Edit "no-op" guard (CC FileEditTool parity): refuse an edit whose `old_string`
|
|
625
625
|
* equals `new_string` — without it the edit passes the match check and writes the file back unchanged (a
|
|
626
|
-
* silent no-op that wastes a turn and dirties mtime).
|
|
626
|
+
* silent no-op that wastes a turn and dirties mtime). The message is worded so a CC-trained model recognizes it.
|
|
627
627
|
*/
|
|
628
628
|
export declare function checkNoChange(oldString: string, newString: string): FsViolation | undefined;
|
|
629
629
|
/** inv 2 (staleness): the file's current content hash must match what was recorded at read time.
|
|
@@ -667,7 +667,7 @@ export declare function resolveQuoteMatch(content: string, oldString: string): s
|
|
|
667
667
|
*/
|
|
668
668
|
export declare function resolveEscapeMatch(content: string, oldString: string): string | undefined;
|
|
669
669
|
/**
|
|
670
|
-
*
|
|
670
|
+
* Rewrite `newString` into the SAME spelling the matched
|
|
671
671
|
* span uses. Without this, a match found through {@link resolveEscapeMatch} would replace an escaped
|
|
672
672
|
* span with a literal-character replacement (or vice versa) and silently change the file's encoding
|
|
673
673
|
* convention at that spot. Hex case follows what the file itself used, per-character where known and by
|
|
@@ -677,7 +677,7 @@ export declare function adaptNewStringEscapes(oldString: string, matchedOld: str
|
|
|
677
677
|
/** CC `KZu` (@366558): the old_string shapes for which the escape layers above were even attempted —
|
|
678
678
|
* gates the explanatory note appended to a no-match refusal so it is never a false claim. */
|
|
679
679
|
export declare function escapeMatchWasAttempted(oldString: string): boolean;
|
|
680
|
-
/**
|
|
680
|
+
/** The escape-match miss note. */
|
|
681
681
|
export declare const ESCAPE_MATCH_MISS_NOTE = "\n(note: Edit also tried swapping \\uXXXX escapes and their characters; neither form matched, so the mismatch is likely elsewhere in old_string. Re-read the file and copy the exact surrounding text.)";
|
|
682
682
|
/**
|
|
683
683
|
* When the quote-forgiving match resolved to a curly-quoted file span, convert the straight quotes in
|
|
@@ -697,7 +697,7 @@ export declare function deletionOldString(content: string, oldString: string, ne
|
|
|
697
697
|
/**
|
|
698
698
|
* inv 3 (edit uniqueness): `oldString` must match exactly once unless `replaceAll`. Zero → not found;
|
|
699
699
|
* >1 without replaceAll → ambiguous. `truncated` adds a hint that unseen content may hold more matches (S2).
|
|
700
|
-
* Messages
|
|
700
|
+
* Messages as probed (all-tools-live-probe 2026-07-08 §2.1): first sentence(s) byte-exact,
|
|
701
701
|
* then a `String: <needle>` echo line (CC form). The sema truncated-read hint survives as a parenthetical
|
|
702
702
|
* appended to the sentence (probe verdict: "truncated 提示可并入括注保留").
|
|
703
703
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
2
2
|
import { type HomeViewsCarrier } from "./read-deny-home.js";
|
|
3
|
+
import { type FsGlob } from "./fs-glob.js";
|
|
3
4
|
/** The JS scanner's own output ceiling, in bytes of emitted content rows. Pinned to the
|
|
4
5
|
* ripgrep leg's figure ({@link MAX_EXEC_OUTPUT_BYTES}, the exec pipe's rolling-tail bound) so the two
|
|
5
6
|
* legs cannot disagree about how much one search may return; see the collection site in {@link jsGrep}
|
|
@@ -11,7 +12,7 @@ export declare const JS_GREP_OUTPUT_MAX_BYTES: number;
|
|
|
11
12
|
* "any dot-prefixed name is invisible" rule beside it. */
|
|
12
13
|
export declare const DEFAULT_IGNORE_DIRS: ReadonlySet<string>;
|
|
13
14
|
export interface GrepParams {
|
|
14
|
-
/** Regular expression (ripgrep semantics) —
|
|
15
|
+
/** Regular expression (ripgrep semantics) — the pattern is ALWAYS a regex; the
|
|
15
16
|
* old `regex?: boolean` literal-by-default switch is retired (a legacy `regex` argument sent by an
|
|
16
17
|
* old caller is tolerated and ignored at the tool layer, never a failure). */
|
|
17
18
|
pattern: string;
|
|
@@ -24,7 +25,7 @@ export interface GrepParams {
|
|
|
24
25
|
* line (rg -o / --only-matching). content mode only; ignored otherwise (CC parity). With
|
|
25
26
|
* `multiline` the JS fallback emits the matched SEGMENT's lines (rg -U -o shape). */
|
|
26
27
|
only_matching?: boolean;
|
|
27
|
-
/** content: `path:line:text`. files_with_matches (default
|
|
28
|
+
/** content: `path:line:text`. files_with_matches (default): `path`. count: `path:count`. */
|
|
28
29
|
output_mode?: "content" | "files_with_matches" | "count";
|
|
29
30
|
/** Lines of context around a match (content mode only) — CC's `-C`. */
|
|
30
31
|
context?: number;
|
|
@@ -44,10 +45,10 @@ export interface GrepParams {
|
|
|
44
45
|
/** Skip the first N output lines — CC's `offset` (pagination partner of head_limit). */
|
|
45
46
|
offset?: number;
|
|
46
47
|
}
|
|
47
|
-
/**
|
|
48
|
+
/** Split the `glob` param into individual glob
|
|
48
49
|
* tokens — whitespace-separated first; a token WITHOUT braces is further split on commas
|
|
49
50
|
* (`"*.ts,*.tsx"` → two globs), while a brace token (`*.{ts,tsx}`) is kept whole (its commas are
|
|
50
|
-
* alternation syntax, not separators).
|
|
51
|
+
* alternation syntax, not separators). */
|
|
51
52
|
export declare function splitGlobParam(glob: string): string[];
|
|
52
53
|
/**
|
|
53
54
|
* POSIX-safe single-quote so an arbitrary model-supplied string can't break out of the shell command that
|
|
@@ -56,6 +57,15 @@ export declare function splitGlobParam(glob: string): string[];
|
|
|
56
57
|
* Exported for direct injection testing.
|
|
57
58
|
*/
|
|
58
59
|
export declare function shellQuote(s: string): string;
|
|
60
|
+
/** Out-parameter for {@link compileGlobToken}: set to `true` when a glob-syntax construct
|
|
61
|
+
* could NOT be compiled and silently fell back to matching the metacharacter LITERALLY. Only the
|
|
62
|
+
* glob-syntax lane (`glob = true`) can set it; the gitignore lane has no such syntax to fail at. */
|
|
63
|
+
export interface GlobCompileReport {
|
|
64
|
+
degraded: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** Compile a gitignore/glob token to a matcher tested against a relative posix path. The matcher is the engine in
|
|
67
|
+
* `fs-glob.ts`: its cost is bounded by the token's length times the path's, whatever the arrangement of the stars. */
|
|
68
|
+
export declare function compileGlobToken(token: string, anchored: boolean, glob?: boolean, report?: GlobCompileReport): FsGlob;
|
|
59
69
|
/**
|
|
60
70
|
* The tokens of a `glob` argument that this engine CANNOT compile as glob syntax, i.e. the ones whose
|
|
61
71
|
* metacharacter would silently degrade to a literal match.
|
|
@@ -111,7 +121,7 @@ export interface WalkResult {
|
|
|
111
121
|
skippedUnreadable: number;
|
|
112
122
|
/** The walk was cut short by an abort — the result is a prefix, not a survey. */
|
|
113
123
|
aborted: boolean;
|
|
114
|
-
/**
|
|
124
|
+
/** Modification time (ms epoch) per walked path (files AND
|
|
115
125
|
* name-only entries), captured from the listing that discovered them — so glob can sort by mtime
|
|
116
126
|
* without a second stat pass. An env whose listings carry no numeric `mtimeMs` simply leaves
|
|
117
127
|
* entries out of this map (consumers fall back to name order). */
|
|
@@ -317,7 +327,7 @@ export declare function runGlob(env: ExecutionEnv, root: string, pattern: string
|
|
|
317
327
|
* shell renders (`filenames`/`numFiles`/`truncated`/`durationMs`/`totalMatches`/`countIsComplete`)
|
|
318
328
|
* without re-parsing the text.
|
|
319
329
|
*
|
|
320
|
-
*
|
|
330
|
+
* Backlog P2-2:
|
|
321
331
|
* · `totalMatches` — "Total number of matching files before truncation. A lower bound when
|
|
322
332
|
* countIsComplete is false." (CC: `totalMatches: g.length`)
|
|
323
333
|
* · `countIsComplete` — "Whether totalMatches is the exact total (true) or a floor because the
|