@sema-agent/core 7.52.0 → 7.54.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 +470 -0
- package/LICENSE +3 -1
- package/README.md +3 -1
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -6
- package/dist/agents/peer-session-drain.js +271 -182
- package/dist/agents/read-inbox-tool.d.ts +7 -0
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/send-message-tool.js +3 -4
- package/dist/agents/subagent.d.ts +6 -5
- package/dist/agents/subagent.js +117 -83
- package/dist/agents/tool-filter.d.ts +25 -4
- package/dist/agents/tool-filter.js +13 -3
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +4 -4
- package/dist/brain/model-presets.js +2 -1
- package/dist/brain/route-adjudicator.d.ts +6 -0
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +33 -14
- package/dist/core/allow-entry.d.ts +3 -1
- package/dist/core/allow-entry.js +3 -2
- package/dist/core/approval-object.d.ts +87 -0
- package/dist/core/approval-object.js +85 -0
- package/dist/core/arg-summary.d.ts +3 -2
- package/dist/core/arg-summary.js +17 -11
- package/dist/core/ask-origin.d.ts +43 -27
- package/dist/core/ask-origin.js +20 -11
- package/dist/core/ask-question.d.ts +0 -1
- package/dist/core/ask-question.js +4 -67
- package/dist/core/ask-unresolvable-notice.d.ts +3 -2
- package/dist/core/auto-compaction.d.ts +106 -50
- package/dist/core/auto-compaction.js +69 -53
- package/dist/core/auto-mode-prompt.d.ts +4 -2
- package/dist/core/auto-mode-prompt.js +4 -3
- package/dist/core/canonical-json.d.ts +69 -0
- package/dist/core/canonical-json.js +130 -8
- package/dist/core/checkpoint-requirements.d.ts +13 -7
- package/dist/core/checkpoint-requirements.js +4 -1
- package/dist/core/checkpoint-store.d.ts +60 -36
- package/dist/core/checkpoint-store.js +7 -6
- package/dist/core/child-clamp-seats.d.ts +45 -6
- package/dist/core/child-clamp-seats.js +56 -4
- package/dist/core/compliance.js +3 -1
- package/dist/core/consolidate-scope.d.ts +1 -1
- package/dist/core/cross-boundary-taint.d.ts +213 -0
- package/dist/core/cross-boundary-taint.js +196 -0
- package/dist/core/decision-receipt.d.ts +44 -1
- package/dist/core/decision-receipt.js +16 -0
- package/dist/core/effective-path-target.d.ts +28 -6
- package/dist/core/effective-path-target.js +28 -2
- package/dist/core/engine-notice.d.ts +47 -4
- package/dist/core/engine-notice.js +17 -1
- package/dist/core/engine-storage-backend.d.ts +73 -0
- package/dist/core/engine-storage-backend.js +1 -0
- package/dist/core/file-history-store.d.ts +6 -2
- package/dist/core/file-history-store.js +1 -0
- package/dist/core/gate-fold.js +13 -4
- package/dist/core/gate-lanes.js +41 -34
- package/dist/core/gate-outcome.d.ts +18 -9
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +21 -19
- package/dist/core/hooks.js +6 -5
- package/dist/core/locked-config.d.ts +110 -31
- package/dist/core/locked-config.js +155 -42
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mcp-probe.js +1 -1
- package/dist/core/mcp-server-spec.d.ts +152 -17
- package/dist/core/mcp-server-spec.js +223 -40
- package/dist/core/mcp.d.ts +21 -14
- package/dist/core/mcp.js +59 -54
- package/dist/core/memory-engine/engine.d.ts +14 -19
- package/dist/core/memory-engine/engine.js +9 -6
- package/dist/core/memory-engine/export-bundle.d.ts +1 -1
- package/dist/core/memory-engine/export-bundle.js +1 -1
- package/dist/core/memory-engine/file-backend.d.ts +2 -6
- package/dist/core/memory-engine/file-backend.js +1 -12
- package/dist/core/memory.d.ts +3 -3
- package/dist/core/mode-policy.d.ts +16 -26
- package/dist/core/mode-policy.js +5 -18
- package/dist/core/mods/kernel/dispatch.js +13 -15
- package/dist/core/mods/kernel/events.d.ts +9 -6
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +41 -11
- package/dist/core/mods/kernel/receive.js +124 -54
- package/dist/core/mods/kernel/site-rules.d.ts +80 -15
- package/dist/core/mods/kernel/site-rules.js +232 -40
- package/dist/core/mods/stations.d.ts +0 -6
- package/dist/core/mods/stations.js +0 -7
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +3 -1
- package/dist/core/parent-spec-seat.d.ts +12 -15
- package/dist/core/parent-spec-seat.js +14 -6
- package/dist/core/pause-registry.d.ts +35 -1
- package/dist/core/pause-registry.js +10 -0
- package/dist/core/permission-rule-consent.d.ts +18 -5
- package/dist/core/permission-rule-consent.js +13 -8
- package/dist/core/permission-rule-model.d.ts +87 -15
- package/dist/core/permission-rule-model.js +87 -8
- package/dist/core/permission-rule-org.d.ts +200 -33
- package/dist/core/permission-rule-org.js +217 -91
- package/dist/core/permission-rule-session.js +2 -2
- package/dist/core/permission-rule-store.d.ts +8 -0
- package/dist/core/permission-rule-store.js +1 -0
- package/dist/core/permission-rule-sync.js +3 -2
- package/dist/core/permission-rules.d.ts +7 -1
- package/dist/core/permission-rules.js +37 -8
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/read-only-shell.js +30 -9
- package/dist/core/remote-env.d.ts +41 -1
- package/dist/core/remote-env.js +18 -0
- package/dist/core/resume-startup-cause.d.ts +18 -0
- package/dist/core/resume-startup-cause.js +12 -0
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +8 -2
- package/dist/core/retired-keys.js +12 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/approval-feedback.d.ts +46 -0
- package/dist/core/runner/approval-feedback.js +41 -0
- package/dist/core/runner/compaction-call-options.d.ts +3 -3
- package/dist/core/runner/compaction-call-options.js +2 -2
- package/dist/core/runner/contracts.d.ts +34 -41
- package/dist/core/runner/cross-boundary-lane.d.ts +87 -0
- package/dist/core/runner/cross-boundary-lane.js +190 -0
- package/dist/core/runner/decide-continuation.d.ts +4 -4
- package/dist/core/runner/decide-continuation.js +3 -1
- package/dist/core/runner/gate-exit.d.ts +32 -12
- package/dist/core/runner/gate-exit.js +77 -34
- package/dist/core/runner/inherited-ask-grants.js +2 -2
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +5 -3
- package/dist/core/runner/person-path-rows.js +2 -2
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -4
- package/dist/core/runner/prepare-acquire-reconcile.js +3 -3
- package/dist/core/runner/prepare-ask-lane.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +3 -3
- package/dist/core/runner/prepare-config-doors.d.ts +58 -15
- package/dist/core/runner/prepare-config-doors.js +167 -146
- package/dist/core/runner/prepare-context-lane.js +6 -3
- package/dist/core/runner/prepare-defer-classify.js +4 -7
- package/dist/core/runner/prepare-delegation-surface.d.ts +5 -4
- package/dist/core/runner/prepare-delegation-surface.js +8 -7
- package/dist/core/runner/prepare-execution-env.d.ts +1 -2
- package/dist/core/runner/prepare-execution-env.js +2 -1
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -0
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -3
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +2 -0
- package/dist/core/runner/prepare-inherited-gate.js +3 -2
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +19 -6
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.d.ts +1 -1
- package/dist/core/runner/prepare-park-ask.js +9 -3
- package/dist/core/runner/prepare-policy-chain.d.ts +1 -1
- package/dist/core/runner/prepare-policy-chain.js +14 -19
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +6 -4
- package/dist/core/runner/prepare-prompt-assembly.d.ts +1 -1
- package/dist/core/runner/prepare-prompt-assembly.js +20 -16
- package/dist/core/runner/prepare-prompt-inputs.d.ts +12 -6
- package/dist/core/runner/prepare-prompt-inputs.js +6 -3
- package/dist/core/runner/prepare-protocol-tools.d.ts +7 -5
- package/dist/core/runner/prepare-protocol-tools.js +19 -12
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.d.ts +7 -2
- package/dist/core/runner/prepare-safety-scan.js +34 -27
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -2
- package/dist/core/runner/prepare-suspend-saga.js +6 -2
- package/dist/core/runner/prepare-task.js +22 -19
- package/dist/core/runner/prepare-turn-wiring.d.ts +10 -5
- package/dist/core/runner/prepare-turn-wiring.js +14 -49
- package/dist/core/runner/prepare-wiring-manifest.d.ts +10 -5
- package/dist/core/runner/prepare-wiring-manifest.js +9 -6
- package/dist/core/runner/prepare-workspace-restore.js +2 -2
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +16 -14
- package/dist/core/runner/resume-apply.js +4 -4
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-policy-outcome.d.ts +2 -2
- package/dist/core/runner/resume-policy-outcome.js +18 -15
- package/dist/core/runner/resume-preflight.js +2 -2
- package/dist/core/runner/resume-review-outcome.js +3 -3
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +1 -4
- package/dist/core/runner/run-leg.js +97 -43
- package/dist/core/runner/run-recovery-lanes.js +5 -3
- package/dist/core/runner/run-settle-and-teardown.js +2 -0
- package/dist/core/runner/run-terminal-adoption.js +21 -9
- package/dist/core/runner/run-turn-boundary.js +9 -3
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/session-file-state-replay.d.ts +5 -2
- package/dist/core/runner/session-file-state-replay.js +3 -2
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-steer-verb.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +13 -11
- package/dist/core/runner/sub-agent-deny-lists.js +7 -5
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-face-overlay.d.ts +24 -6
- package/dist/core/runner/tool-face-overlay.js +24 -15
- package/dist/core/runner-deps.d.ts +37 -22
- package/dist/core/session-policy-store.d.ts +19 -0
- package/dist/core/session-policy-store.js +22 -2
- package/dist/core/session-store.d.ts +35 -16
- package/dist/core/session-store.js +20 -12
- package/dist/core/{shell-lexer.d.ts → shell-run-candidates.d.ts} +36 -12
- package/dist/core/{shell-lexer.js → shell-run-candidates.js} +145 -225
- package/dist/core/shell-wrapper-table.d.ts +5 -3
- package/dist/core/shell-wrapper-table.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +2 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +49 -0
- package/dist/core/store-contracts/session-store-contract.js +639 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +12 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.js +5 -2
- package/dist/core/task-event.d.ts +44 -6
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-registry-agent.js +1 -0
- package/dist/core/task-registry-shared.d.ts +5 -0
- package/dist/core/task-registry.d.ts +7 -0
- package/dist/core/task-registry.js +17 -0
- package/dist/core/task-result.d.ts +1 -1
- package/dist/core/task-spec.d.ts +7 -7
- package/dist/core/tighten-task-spec.d.ts +6 -4
- package/dist/core/tighten-task-spec.js +2 -2
- package/dist/core/tool-catalog-entries.d.ts +1 -1
- package/dist/core/tool-catalog-entries.js +52 -52
- package/dist/core/tool-face-reader.d.ts +49 -0
- package/dist/core/tool-face-reader.js +94 -0
- package/dist/core/tool-face.d.ts +17 -8
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-policy.d.ts +67 -23
- package/dist/core/tool-policy.js +72 -60
- package/dist/core/tool-roster.d.ts +46 -28
- package/dist/core/tool-roster.js +91 -14
- package/dist/core/tool-spec-members.js +2 -2
- package/dist/core/tool-spec.d.ts +20 -4
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +24 -2
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.d.ts +23 -0
- package/dist/core/untrusted-text.js +10 -10
- package/dist/core/user-attachment.d.ts +56 -2
- package/dist/core/user-attachment.js +139 -56
- package/dist/core/wiring-manifest.d.ts +4 -2
- package/dist/engine/compaction/compaction.d.ts +2 -2
- package/dist/engine/compaction/utils.d.ts +2 -2
- package/dist/engine/harness/agent-harness.js +2 -1
- package/dist/engine/harness/types.d.ts +10 -4
- package/dist/engine/llm/types.d.ts +7 -2
- package/dist/engine/llm/types.js +2 -1
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +17 -5
- package/dist/engine/loop/types.d.ts +7 -1
- package/dist/engine/session/repo-utils.d.ts +5 -0
- package/dist/engine/session/repo-utils.js +9 -0
- package/dist/engine/session/storage-base.js +2 -2
- package/dist/index.d.ts +37 -17
- package/dist/index.js +31 -14
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/harness.js +1 -0
- package/dist/internal/llm.d.ts +1 -1
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-workflow-tool.d.ts +3 -0
- package/dist/orchestration/run-workflow-tool.js +1 -0
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -1
- package/dist/prompt-assembly/artifact-store.d.ts +44 -9
- package/dist/prompt-assembly/artifact-store.js +38 -12
- package/dist/prompt-assembly/artifact.d.ts +12 -11
- package/dist/prompt-assembly/artifact.js +52 -21
- package/dist/prompt-assembly/assemble.d.ts +2 -0
- package/dist/prompt-assembly/assemble.js +2 -1
- package/dist/prompt-assembly/catalog/index.js +2 -1
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +19 -2
- package/dist/prompt-assembly/catalog/schema.js +3 -0
- package/dist/prompt-assembly/composer.d.ts +2 -0
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/overlay.d.ts +21 -11
- package/dist/prompt-assembly/overlay.js +57 -19
- package/dist/prompt-assembly/select.d.ts +21 -6
- package/dist/prompt-assembly/select.js +41 -4
- package/dist/prompts/default.d.ts +1 -12
- package/dist/prompts/default.js +0 -3
- package/dist/shell/lex.d.ts +87 -8
- package/dist/shell/lex.js +283 -49
- package/dist/stores/file/index.d.ts +8 -6
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +14 -3
- package/dist/tools/fs/bash-program-position.d.ts +3 -15
- package/dist/tools/fs/bash-program-position.js +3 -10
- package/dist/tools/fs/bash-readonly-classifier.js +2 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-bash.js +72 -101
- package/dist/tools/fs/fs-read.d.ts +12 -0
- package/dist/tools/fs/fs-read.js +10 -9
- package/dist/tools/fs/fs-shared.d.ts +27 -31
- package/dist/tools/fs/fs-shared.js +12 -15
- package/dist/tools/fs/fs-write.js +1 -1
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -4
- package/dist/tools/fs/read-deny.d.ts +16 -3
- package/dist/tools/fs/read-deny.js +12 -9
- package/dist/tools/fs/safety.d.ts +7 -6
- package/dist/tools/fs/shell-read-bindings.d.ts +5 -3
- package/dist/tools/fs/shell-read-bindings.js +15 -16
- package/dist/tools/fs/shell-read-device.js +1 -1
- package/dist/tools/fs/shell-read-plan.js +36 -47
- package/dist/tools/fs/shell-read-word.d.ts +1 -6
- package/dist/tools/fs/shell-read-word.js +2 -20
- package/dist/tools/fs/shell-reentry-text.js +1 -1
- package/dist/tools/web.d.ts +2 -2
- package/package.json +4 -1
- package/test/export-surface.snapshot.json +5651 -5457
- package/wire-changes/core@7.53.0.json +1968 -0
- package/wire-changes/core@7.54.0.json +2870 -0
- package/dist/core/shell-scan.d.ts +0 -60
- package/dist/core/shell-scan.js +0 -183
|
@@ -41,7 +41,7 @@ export declare function readDenyLinksOf(env: ExecutionEnv, entries: readonly {
|
|
|
41
41
|
/**
|
|
42
42
|
* Which rows one placement reads, and where their heads are spelled:
|
|
43
43
|
* · `home` — the home-anchored rows (`~/…`), under each home; the row's run anchors it there;
|
|
44
|
-
* · `root` — the ROOTED rows (`/app/config-lkg.json`, {@link
|
|
44
|
+
* · `root` — the ROOTED rows (`/app/config-lkg.json`, {@link readDenyRowAnchor} `root`), under the filesystem root; the run
|
|
45
45
|
* anchors it there. A root is no home: read whether or not a home answered;
|
|
46
46
|
* · `unanchored` — the rows that open with the configuration directory's name (`~/.sema/…`, {@link agentConfigDirTail})
|
|
47
47
|
* under each spelling of the root the host declares for that directory (`RunnerDeps.agentConfigDir`): the head BELOW
|
|
@@ -4,7 +4,7 @@ import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, withGateTimeout } from "../../core/gate-
|
|
|
4
4
|
import { thrownText } from "../../core/thrown-value.js";
|
|
5
5
|
import { agentConfigDirTail } from "../../core/agent-config-dir.js";
|
|
6
6
|
import { validatePath } from "../../core/effective-path-target.js";
|
|
7
|
-
import {
|
|
7
|
+
import { readDenyPatternRun, readDenyRowAnchor, readDenyRunHead } from "./read-deny.js";
|
|
8
8
|
export const AUXILIARY_HOME_PROBE_MS = 2_000;
|
|
9
9
|
const said = new Set();
|
|
10
10
|
function sayOnce(kind, line) {
|
|
@@ -126,13 +126,14 @@ function anchoredRowsOf(entries, anchor) {
|
|
|
126
126
|
return rows;
|
|
127
127
|
}
|
|
128
128
|
function rowHeadOf(pattern, caseSensitive, anchor) {
|
|
129
|
+
const rowAnchor = readDenyRowAnchor(pattern);
|
|
129
130
|
if (anchor.at === "root") {
|
|
130
|
-
const head =
|
|
131
|
+
const head = rowAnchor === "root" ? literalHeadOf(pattern) : "";
|
|
131
132
|
return head.length > 0 ? head : undefined;
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
if (!homeAnchored)
|
|
134
|
+
if (rowAnchor !== "home")
|
|
135
135
|
return undefined;
|
|
136
|
+
const { run } = readDenyPatternRun(pattern);
|
|
136
137
|
if (anchor.at === "unanchored") {
|
|
137
138
|
const tail = agentConfigDirTail(run, caseSensitive);
|
|
138
139
|
return tail === undefined ? undefined : literalHeadOf(tail);
|
|
@@ -456,9 +456,22 @@ export declare function matchSegmentPatterns(path: string, compiled: readonly Co
|
|
|
456
456
|
/** One entry's refusal under the deny list's entry law ({@link normalizeEntry}, the compiler's own), or `undefined` when the
|
|
457
457
|
* entry is lawful — the law read without compiling, for a door that judges a list before anything folds it. */
|
|
458
458
|
export declare function readDenyEntryProblem(entry: unknown, layer: string): string | undefined;
|
|
459
|
-
/**
|
|
460
|
-
|
|
461
|
-
|
|
459
|
+
/** Where a deny row is anchored ({@link readDenyRowAnchor}): the filesystem root, the execution environment's home, or nowhere. */
|
|
460
|
+
export type ReadDenyRowAnchorWord = "root" | "home" | "none";
|
|
461
|
+
/**
|
|
462
|
+
* WHERE a deny row is anchored, as the one word every reader of a row asks: `home` — a HOME-anchored row (its first segment is
|
|
463
|
+
* exactly {@link READ_DENY_HOME_WORD}): its run starts right below the execution environment's home; `root` — a ROOTED row (it
|
|
464
|
+
* opens with `/` and is not home-anchored): its run starts at the first segment of an absolute path; `none` — an unanchored row,
|
|
465
|
+
* which may match anywhere in a judged path. The compiler's placement, the linked-location pass, the band's "has anything to
|
|
466
|
+
* place" test, the head a mount resolves for a row and the canonical spelling itself all read the anchor here, so a row has one
|
|
467
|
+
* anchor however many faces ask.
|
|
468
|
+
*
|
|
469
|
+
* The pattern is read as given and gives the answer its canonical form gives, so a spelling and its canonical form are one row
|
|
470
|
+
* (`//etc` and `/etc` are both `root`; `/~/x` is `~/x`, so `home`: a leading `/` before the home word is no root). Whether the
|
|
471
|
+
* text is a LEGAL row (no backslash, at least one segment below its anchor) is not asked here: that is
|
|
472
|
+
* {@link persistedReadDenyEntryProblem} and the compiler's refusal.
|
|
473
|
+
*/
|
|
474
|
+
export declare function readDenyRowAnchor(pattern: string): ReadDenyRowAnchorWord;
|
|
462
475
|
/**
|
|
463
476
|
* the PURE validation/canonicality predicate over a PERSISTED deny entry (checkpoint v9
|
|
464
477
|
* face section), for the resume pre-CAS ladder: it must refuse BEFORE the approval CAS everything
|
|
@@ -320,7 +320,7 @@ export function compileSegmentPattern(raw, fold) {
|
|
|
320
320
|
return null;
|
|
321
321
|
const flags = fold === "unicode" ? "i" : "";
|
|
322
322
|
const segments = parts.map((segment) => {
|
|
323
|
-
const escaped = segment.replace(/[.+^${}()|[\]\\?]/g, "\\$&").replace(
|
|
323
|
+
const escaped = segment.replace(/[.+^${}()|[\]\\?]/g, "\\$&").replace(/\*+/g, "[^/]*");
|
|
324
324
|
return new RegExp(`^${escaped}$`, flags);
|
|
325
325
|
});
|
|
326
326
|
return { raw, segments, foldAscii: fold === "ascii" };
|
|
@@ -486,10 +486,12 @@ function normalizeEntry(entry, layer) {
|
|
|
486
486
|
}
|
|
487
487
|
function canonicalReadDenyPattern(pattern) {
|
|
488
488
|
const joined = pattern.split("/").filter(Boolean).join("/");
|
|
489
|
-
return pattern
|
|
489
|
+
return readDenyRowAnchor(pattern) === "root" ? `/${joined}` : joined;
|
|
490
490
|
}
|
|
491
|
-
export function
|
|
492
|
-
|
|
491
|
+
export function readDenyRowAnchor(pattern) {
|
|
492
|
+
if (readDenyPatternRun(pattern).homeAnchored)
|
|
493
|
+
return "home";
|
|
494
|
+
return pattern.startsWith("/") ? "root" : "none";
|
|
493
495
|
}
|
|
494
496
|
export function persistedReadDenyEntryProblem(e) {
|
|
495
497
|
if (typeof e !== "object" || e === null)
|
|
@@ -548,14 +550,15 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
548
550
|
}
|
|
549
551
|
const homeSegments = [...new Set(checkedReadDenyHomes(homes))].map(homeAnchorSegments);
|
|
550
552
|
const compiled = normalized.map((e) => {
|
|
551
|
-
const {
|
|
553
|
+
const { run } = readDenyPatternRun(e.pattern);
|
|
554
|
+
const rowAnchor = readDenyRowAnchor(e.pattern);
|
|
552
555
|
const fold = e.caseSensitive ? "none" : "ascii";
|
|
553
556
|
const c = compileSegmentPattern(run, fold);
|
|
554
557
|
if (c === null)
|
|
555
558
|
throw new Error(`readDenyPatterns: pattern ${JSON.stringify(e.pattern)} compiled to zero segments.`);
|
|
556
|
-
if (
|
|
559
|
+
if (rowAnchor === "root")
|
|
557
560
|
return { ...c, raw: e.pattern, anchors: [[]], rootedOnly: true };
|
|
558
|
-
if (
|
|
561
|
+
if (rowAnchor === "none")
|
|
559
562
|
return { ...c, raw: e.pattern };
|
|
560
563
|
if (homeSegments.length === 0)
|
|
561
564
|
return { ...c, raw: e.pattern, unplacedHome: true };
|
|
@@ -566,8 +569,8 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
566
569
|
const linkedPlacements = [];
|
|
567
570
|
normalized.forEach((e, i) => {
|
|
568
571
|
const locations = linked.get(e.pattern);
|
|
569
|
-
const {
|
|
570
|
-
if (locations === undefined ||
|
|
572
|
+
const { run } = readDenyPatternRun(e.pattern);
|
|
573
|
+
if (locations === undefined || readDenyRowAnchor(e.pattern) === "none")
|
|
571
574
|
return;
|
|
572
575
|
const c = compiled[i];
|
|
573
576
|
const rest = c.segments.slice(readDenyRunHead(run));
|
|
@@ -66,12 +66,13 @@ export interface ReadEntry {
|
|
|
66
66
|
* disk (hash mismatch) always serves real content and the dedup disarms permanently.
|
|
67
67
|
* Optional/additive: absent = normal entry. */
|
|
68
68
|
seededFromContext?: boolean;
|
|
69
|
-
/** The
|
|
70
|
-
*
|
|
71
|
-
* (`applyContextShrinkToReadFileState`, `
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* retired by
|
|
69
|
+
/** The transmission that carried the body this entry dedups against — the tool call whose RESULT carried it, or the
|
|
70
|
+
* attachment frame that did (`attachmentTransmissionId`): when THAT transmission leaves the request (a stale-result
|
|
71
|
+
* clear, a trim), the entry retires with it (`applyContextShrinkToReadFileState`, `transmissions-gone` arm). Recorded
|
|
72
|
+
* only by the deliveries that TRANSMIT a body (a Read result or a frame replayed from the transcript included) — a
|
|
73
|
+
* write-back's content is the model's own arguments and a context-seeded entry never rode a message, so neither
|
|
74
|
+
* carries this and neither is retired by it. Optional/additive: absent (an
|
|
75
|
+
* older checkpoint) never matches. */
|
|
75
76
|
transmittedByToolCallId?: string;
|
|
76
77
|
}
|
|
77
78
|
/** Per-task record of which files have been read, keyed by canonical path: owned by prepare-task,
|
|
@@ -437,9 +437,11 @@ export declare function isArithmeticCommand(segment: LexedSegment): boolean;
|
|
|
437
437
|
/** The `[[` operators whose operands the arithmetic evaluator reads (`[[ x -eq y ]]`; `[` / `test` compare integers
|
|
438
438
|
* without evaluating them). */
|
|
439
439
|
export declare const ARITHMETIC_TEST_OPERATORS: ReadonlySet<string>;
|
|
440
|
-
/** The substitutions a parameter expansion's body hands the arithmetic evaluator: its subscript (`${a[…]}
|
|
441
|
-
* offset and length of a substring expansion (`${x:off:len}` — the shell expands them, then
|
|
442
|
-
|
|
440
|
+
/** The substitutions a parameter expansion's body hands the arithmetic evaluator: its subscript (`${a[…]}`, `${#a[…]}`,
|
|
441
|
+
* `${!a[…]}`) and the offset and length of a substring expansion (`${x:off:len}` — the shell expands them, then
|
|
442
|
+
* evaluates them), as the lexer's one reading of the body finds them ({@link parameterArithmeticTexts}). The body's own
|
|
443
|
+
* text only: what a VALUE runs when the expansion re-reads it is not followed (the station asks, see its caller). */
|
|
444
|
+
export declare function parameterBodySubstitutions(body: string, table: BindingTable | undefined): string[];
|
|
443
445
|
/**
|
|
444
446
|
* The substitutions the shell's ARITHMETIC evaluator runs while it evaluates `text`: every `$(…)`, backquote or process
|
|
445
447
|
* substitution inside an array SUBSCRIPT of it (`a[$(…)]` — quoted or not: the evaluator re-reads the text it is
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { argvOf, lexShell, literalTildeSpelling,
|
|
1
|
+
import { argvOf, arithmeticTextIsPlain, expansionHidesRun, expansionsInHeredocBody, lexShell, literalTildeSpelling, namesRedirectDescriptor, parameterArithmeticTexts } from "../../shell/lex.js";
|
|
2
2
|
import { shellWordsOf } from "../../shell/shell-words.js";
|
|
3
3
|
import { isShellSyntaxWord, LOOP_LIST_HEADS, readProgramPosition } from "./bash-program-position.js";
|
|
4
4
|
import { declaredAttributes, programRow, readArgRoles } from "./program-read-model.js";
|
|
@@ -456,18 +456,16 @@ export function bindingEffectOf(segment, argv, shape, readValue, shadow, availab
|
|
|
456
456
|
for (const t of segment.tokens) {
|
|
457
457
|
if (t.kind !== "heredoc" || t.quoted)
|
|
458
458
|
continue;
|
|
459
|
-
|
|
459
|
+
const expansions = expansionsInHeredocBody(t.body);
|
|
460
|
+
const evaluatesUnseen = (x) => (x.expansion.kind === "parameter" && expansionHidesRun(x.expansion)) || (x.expansion.kind === "arithmetic" && !arithmeticTextIsPlain(x.expansion.body ?? ""));
|
|
461
|
+
if (expansions === undefined || expansions.some((x) => x.unresolved !== undefined || evaluatesUnseen(x)))
|
|
460
462
|
unknownAll();
|
|
461
|
-
for (const
|
|
462
|
-
|
|
463
|
-
for (const name of arithmeticAssignedNames(s.body))
|
|
464
|
-
kill(name);
|
|
463
|
+
for (const name of assignedByPieces((expansions ?? []).map((x) => ({ span: [0, 0], quotedBy: undefined, expansion: x.expansion }))))
|
|
464
|
+
kill(name);
|
|
465
465
|
}
|
|
466
466
|
segment.tokens.forEach((t, i) => {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
if (m !== null)
|
|
470
|
-
kill(m[1]);
|
|
467
|
+
if (t.kind === "word" && namesRedirectDescriptor(t, segment.tokens[i + 1]))
|
|
468
|
+
kill(t.raw.slice(1, -1));
|
|
471
469
|
});
|
|
472
470
|
const tokens = segment.tokens;
|
|
473
471
|
if (isArithmeticCommand(segment)) {
|
|
@@ -665,8 +663,10 @@ function assignedByPieces(pieces) {
|
|
|
665
663
|
const out = [];
|
|
666
664
|
for (const p of pieces) {
|
|
667
665
|
const e = p.expansion;
|
|
668
|
-
if (e?.kind === "parameter" && e.name !== undefined && e.body !== undefined &&
|
|
666
|
+
if (e?.kind === "parameter" && e.name !== undefined && e.body !== undefined && (e.body.startsWith(`${e.name}=`) || e.body.startsWith(`${e.name}:=`)))
|
|
669
667
|
out.push(e.name);
|
|
668
|
+
if (e?.kind === "parameter" && e.body !== undefined)
|
|
669
|
+
out.push(...arithmeticAssignedNames(e.body));
|
|
670
670
|
if (e?.kind === "arithmetic" && e.body !== undefined)
|
|
671
671
|
out.push(...arithmeticAssignedNames(e.body));
|
|
672
672
|
}
|
|
@@ -1042,12 +1042,11 @@ export function isArithmeticCommand(segment) {
|
|
|
1042
1042
|
return a?.kind === "group" && a.op === "(" && b?.kind === "group" && b.op === "(";
|
|
1043
1043
|
}
|
|
1044
1044
|
export const ARITHMETIC_TEST_OPERATORS = new Set(["-eq", "-ne", "-lt", "-le", "-gt", "-ge"]);
|
|
1045
|
-
export function parameterBodySubstitutions(
|
|
1046
|
-
const
|
|
1047
|
-
const out = arithmeticSubstitutions(
|
|
1048
|
-
const offset = /^(?:\[[^\]]*\])?:(?![-=+?])(.*)$/s.exec(rest)?.[1];
|
|
1045
|
+
export function parameterBodySubstitutions(body, table) {
|
|
1046
|
+
const { subscript, offset } = parameterArithmeticTexts(body);
|
|
1047
|
+
const out = arithmeticSubstitutions(subscript === undefined ? "" : `[${subscript}]`, table);
|
|
1049
1048
|
if (offset !== undefined)
|
|
1050
|
-
out.push(...substitutionBodies(
|
|
1049
|
+
out.push(...substitutionBodies(offset, true), ...arithmeticSubstitutions(offset, table));
|
|
1051
1050
|
return [...new Set(out)];
|
|
1052
1051
|
}
|
|
1053
1052
|
export function arithmeticSubstitutions(text, table, chain = new Set(), budget = { left: ARITHMETIC_VALUES_MAX }) {
|
|
@@ -22,7 +22,7 @@ export function descriptorsBoundBy(r) {
|
|
|
22
22
|
return [r.fd];
|
|
23
23
|
if (r.op === "&>" || r.op === "&>>")
|
|
24
24
|
return [1, 2];
|
|
25
|
-
return [r.op === "<" || r.op === "<<<" || r.op === "<&" ? 0 : 1];
|
|
25
|
+
return [r.op === "<" || r.op === "<<<" || r.op === "<&" || r.op === "<>" ? 0 : 1];
|
|
26
26
|
}
|
|
27
27
|
export function bindDescriptors(into, r) {
|
|
28
28
|
for (const fd of descriptorsBoundBy(r))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { lexShell, PARSE_FAILURE_SENTENCE, substitutionsInHeredocBody, literalTextOf, literalTildeSpelling, } from "../../shell/lex.js";
|
|
2
|
-
import { programTextOf, readOfText, readsOf, rewritten, segmentReadingsOf, settledFieldsOf, spelledWithHome,
|
|
1
|
+
import { expansionsInHeredocBody, lexShell, PARSE_FAILURE_SENTENCE, substitutionsInHeredocBody, literalTextOf, literalTildeSpelling, parameterRereadsValue, UNRESOLVED_SENTENCE, } from "../../shell/lex.js";
|
|
2
|
+
import { programTextOf, readOfText, readsOf, rewritten, segmentReadingsOf, settledFieldsOf, spelledWithHome, unreadableSentenceOf } from "./shell-read-word.js";
|
|
3
3
|
import { assignmentArithmetic, bare, listedVerbCandidates, pathSubcommandOf, programTextSentence, pushAssignment, roleReads, subscriptOnly, unlistedWords } from "./shell-read-argv.js";
|
|
4
4
|
import { ARITHMETIC_TEST_OPERATORS, BindingThread, arithmeticSubstitutions, isArithmeticCommand, bindingEffectOf, joinRebound, loopListHeadAt, namesBoundIn, parameterBodySubstitutions, projectSegment, valueOf, } from "./shell-read-bindings.js";
|
|
5
5
|
import { commandEnvironmentNames, isShellSyntaxWord, programBasename, programPositionRunsShell, readProgramPosition, shellScanDeclineOf, } from "./bash-program-position.js";
|
|
@@ -310,51 +310,40 @@ function segmentFactsRead(segment, p, decl, table, nestedPlan, fed, toks) {
|
|
|
310
310
|
const nested = [];
|
|
311
311
|
const elsewhere = new Set();
|
|
312
312
|
const ctx = { table, reentered: [], programTextSeen: false };
|
|
313
|
-
const
|
|
313
|
+
const enclosedToo = (e) => [e, ...(e.inner ?? []).flatMap(enclosedToo)];
|
|
314
|
+
const expansionsOf = (sg) => sg.tokens.flatMap((t) => (t.kind === "word" ? t : t.kind === "redirect" ? t.target : undefined)?.pieces ?? []).flatMap((q) => (q.expansion !== undefined ? enclosedToo(q.expansion) : []));
|
|
314
315
|
const count = (list, body) => list.filter((b) => b === body).length;
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
arithmeticBody(body);
|
|
327
|
-
else
|
|
328
|
-
nested.push(nestedPlan(body, "substitution"));
|
|
329
|
-
}
|
|
330
|
-
let unreadableHeredoc = false;
|
|
331
|
-
for (const t of segment.tokens) {
|
|
332
|
-
if (t.kind !== "heredoc" || t.quoted)
|
|
333
|
-
continue;
|
|
334
|
-
const inner = substitutionsInHeredocBody(t.body);
|
|
335
|
-
if (inner === undefined) {
|
|
336
|
-
unreadableHeredoc = true;
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
for (const s of inner) {
|
|
340
|
-
if (s.kind === "arithmetic" && isArithmeticBody(s.body))
|
|
341
|
-
arithmeticBody(s.body);
|
|
316
|
+
const substitute = (body, here) => void (here ? ctx.reentered.push(body) : nested.push(nestedPlan(body, "substitution")));
|
|
317
|
+
const unread = (sentence) => void nested.push({ segments: [], unreadable: sentence, shape: { grouped: false, backgrounded: false, strayRedirection: false } });
|
|
318
|
+
const parameter = (e) => void (e.kind === "parameter" && e.body !== undefined && (parameterRereadsValue(e.body) && unread("a parameter expansion re-reads a value (an indirect `${!name}`, an evaluating `${name@P}`), which this station does not follow"), ctx.reentered.push(...parameterBodySubstitutions(e.body, table))));
|
|
319
|
+
const expandedText = (all, undelimited) => {
|
|
320
|
+
if (all === undefined)
|
|
321
|
+
return void unread(undelimited), false;
|
|
322
|
+
for (const x of all) {
|
|
323
|
+
if (x.expansion.kind === "arithmetic")
|
|
324
|
+
arithmeticBody(x.expansion.body ?? "");
|
|
325
|
+
else if (x.expansion.kind === "command")
|
|
326
|
+
substitute(x.expansion.body ?? "", x.currentShell === true);
|
|
342
327
|
else
|
|
343
|
-
|
|
328
|
+
parameter(x.expansion);
|
|
329
|
+
if (x.unresolved !== undefined)
|
|
330
|
+
void (unread(UNRESOLVED_SENTENCE[x.unresolved]), x.unresolved === "parameter_text" && expandedText(expansionsInHeredocBody(x.expansion.body ?? ""), UNRESOLVED_SENTENCE.parameter_text));
|
|
344
331
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
332
|
+
return all.some((x) => x.expansion.kind === "command");
|
|
333
|
+
};
|
|
334
|
+
const arithmeticBody = (body) => void (expandedText(expansionsInHeredocBody(body), "an arithmetic expansion carries a substitution this lexer cannot delimit") && unread("an arithmetic expansion evaluates what a command substitution in it prints, which this station does not read"), ctx.reentered.push(...arithmeticSubstitutions(body, table)));
|
|
335
|
+
const arithmetic = expansionsOf(segment).flatMap((e) => (e.kind === "arithmetic" && e.body !== undefined ? [e.body] : []));
|
|
336
|
+
for (const body of segment.substitutions)
|
|
337
|
+
(count(arithmetic, body) > 0 && count(arithmetic, body) === count(segment.substitutions, body) ? arithmeticBody(body) : substitute(body, segment.currentShell?.includes(body) === true));
|
|
338
|
+
for (const t of segment.tokens)
|
|
339
|
+
if (t.kind === "heredoc" && !t.quoted)
|
|
340
|
+
expandedText(expansionsInHeredocBody(t.body), "a here-document body carries a substitution this lexer cannot delimit");
|
|
341
|
+
for (const e of expansionsOf(segment))
|
|
342
|
+
parameter(e);
|
|
348
343
|
const shellSide = new Set(nested);
|
|
349
344
|
if (isArithmeticCommand(segment))
|
|
350
345
|
ctx.reentered.push(...arithmeticSubstitutions(p.argv.map((w) => w.folded).join(" "), table));
|
|
351
|
-
|
|
352
|
-
const w = t.kind === "word" ? t : t.kind === "redirect" ? t.target : undefined;
|
|
353
|
-
for (const q of w?.pieces ?? [])
|
|
354
|
-
if (q.expansion?.kind === "parameter" && q.expansion.name !== undefined && q.expansion.body !== undefined)
|
|
355
|
-
ctx.reentered.push(...parameterBodySubstitutions(q.expansion.name, q.expansion.body, table));
|
|
356
|
-
}
|
|
357
|
-
const redirects = p.redirects.map((r) => redirectFact(r, table, decl.homeDir));
|
|
346
|
+
const redirects = p.redirects.flatMap((r) => redirectFacts(r, table, decl.homeDir));
|
|
358
347
|
const reads = [];
|
|
359
348
|
for (const r of redirects)
|
|
360
349
|
if (r.direction === "in" && r.target !== undefined)
|
|
@@ -670,15 +659,15 @@ function dedupe(reads) {
|
|
|
670
659
|
function relativeSpelling(spelled) {
|
|
671
660
|
return !(isAbsoluteForFamily("own", spelled) || spelled.startsWith("~"));
|
|
672
661
|
}
|
|
673
|
-
function
|
|
662
|
+
function redirectFacts(r, table, homeDir) {
|
|
674
663
|
const fd = r.fd !== undefined ? { fd: r.fd } : {};
|
|
675
664
|
if (r.target === undefined)
|
|
676
|
-
return { op: r.op, direction: "dup", ...fd };
|
|
677
|
-
if (r.op === "<")
|
|
678
|
-
return { op: r.op, direction: "in", ...fd, target: bare(readsOf([r.target], table, homeDir)[0], "stdin_redirect") };
|
|
665
|
+
return [{ op: r.op, direction: "dup", ...fd }];
|
|
679
666
|
if (r.op === "<<<")
|
|
680
|
-
return { op: r.op, direction: "in", ...fd };
|
|
681
|
-
|
|
667
|
+
return [{ op: r.op, direction: "in", ...fd }];
|
|
668
|
+
const read = readsOf([r.target], table, homeDir)[0];
|
|
669
|
+
const inward = r.op === "<" || r.op === "<>" ? [{ op: r.op, direction: "in", ...fd, target: bare(read, "stdin_redirect") }] : [];
|
|
670
|
+
return r.op === "<" ? inward : [...inward, { op: r.op, direction: "out", ...fd, target: bare(read, "write_redirect_target") }];
|
|
682
671
|
}
|
|
683
672
|
function commandStringValue(row, toks, option) {
|
|
684
673
|
const at = toks.findIndex((r) => r.folded === option);
|
|
@@ -111,13 +111,8 @@ export declare function spelledWithHome(spelled: string, raw: string, home: stri
|
|
|
111
111
|
* bash expands the pattern (or reads another delimiter) where the lexer reads a split word, so what the text opens is
|
|
112
112
|
* not what the plan names: the whole text asks, and a deny hit anywhere still refuses. `globs: false` = the text is an
|
|
113
113
|
* arithmetic expression (`$((2*(3+4)))`), which bash evaluates and never globs. A compound assignment's value is no
|
|
114
|
-
* such word
|
|
114
|
+
* such word — the assignment reads nothing — unless the unread value may run something ({@link compoundValueHidesRun}). */
|
|
115
115
|
export declare function unreadableSentenceOf(lexed: LexedCommand, text: string, globs?: boolean): string | undefined;
|
|
116
|
-
/** An `$((…))` body the shell reads as ARITHMETIC: one parenthesised group spanning the whole body (`(2*(3+4))`),
|
|
117
|
-
* its bounds read off the lexer's structure — a quoted, escaped or commented parenthesis is text, not a bound — across
|
|
118
|
-
* the segments the lexer cuts at `&&` `||` `&` `|` and line breaks (operators arithmetic shares with the shell).
|
|
119
|
-
* `$((cat x); :)` opens the same way but its first group closes early: a command substitution holding a subshell. */
|
|
120
|
-
export declare function isArithmeticBody(body: string): boolean;
|
|
121
116
|
/** What the shell does to a word (or an assignment's value) before the program sees it, read off its pieces: the
|
|
122
117
|
* lexer's expansion facts alone. A quoted text that an evaluator or an interpreter later RUNS (an arithmetic
|
|
123
118
|
* subscript, an inline program) is no rewrite of the word: the slot it stands in says what it is (the program read
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { argvOf, lexShell, literalTildeSpelling, UNRESOLVED_SENTENCE } from "../../shell/lex.js";
|
|
1
|
+
import { argvOf, compoundValueHidesRun, lexShell, literalTildeSpelling, UNRESOLVED_SENTENCE } from "../../shell/lex.js";
|
|
2
2
|
import { expansionInWord, extglobOpenerIn, globInWord, homeExpansionOf } from "./bash-readonly-classifier.js";
|
|
3
3
|
import { floorOf, judgedSpellingOf, namesIn, wordFloorValues, wordValues } from "./shell-read-bindings.js";
|
|
4
4
|
export function readsOf(words, table, homeDir, split = false) {
|
|
@@ -150,7 +150,7 @@ export function unreadableSentenceOf(lexed, text, globs = true) {
|
|
|
150
150
|
for (const segment of lexed.segments) {
|
|
151
151
|
for (const token of segment.tokens) {
|
|
152
152
|
const word = token.kind === "word" ? token : token.kind === "redirect" ? token.target : undefined;
|
|
153
|
-
if (word?.unresolved === "compound_array_value" && word.assignment?.form === "compound")
|
|
153
|
+
if (word?.unresolved === "compound_array_value" && word.assignment?.form === "compound" && !compoundValueHidesRun(word))
|
|
154
154
|
continue;
|
|
155
155
|
if (word?.unresolved !== undefined)
|
|
156
156
|
return UNRESOLVED_SENTENCE[word.unresolved];
|
|
@@ -158,24 +158,6 @@ export function unreadableSentenceOf(lexed, text, globs = true) {
|
|
|
158
158
|
}
|
|
159
159
|
return globs && extglobOpenerIn(lexed, text) ? "an extended pattern (`?(…)` `*(…)` `+(…)` `@(…)` `!(…)`) is one this reader does not expand" : undefined;
|
|
160
160
|
}
|
|
161
|
-
export function isArithmeticBody(body) {
|
|
162
|
-
const l = body.startsWith("(") && body.endsWith(")") ? lexShell(body) : undefined;
|
|
163
|
-
if (l === undefined || "parseFailure" in l)
|
|
164
|
-
return false;
|
|
165
|
-
const tokens = l.segments.flatMap((sg) => sg.tokens);
|
|
166
|
-
if (tokens[0]?.kind !== "group" || tokens[0].op !== "(")
|
|
167
|
-
return false;
|
|
168
|
-
let depth = 0;
|
|
169
|
-
for (const [i, t] of tokens.entries()) {
|
|
170
|
-
if (t.kind !== "group")
|
|
171
|
-
continue;
|
|
172
|
-
if (t.op === "(")
|
|
173
|
-
depth++;
|
|
174
|
-
else if (--depth === 0)
|
|
175
|
-
return i === tokens.length - 1;
|
|
176
|
-
}
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
161
|
export function expandsOf(w) {
|
|
180
162
|
if (expansionInWord(w))
|
|
181
163
|
return "unresolvable";
|
|
@@ -210,7 +210,7 @@ export function stdinTextsOf(segment, fed) {
|
|
|
210
210
|
const literal = t.quoted ? t.body : literalHeredocBody(t.body);
|
|
211
211
|
out.push(literal === undefined ? { from: t.body } : { from: t.body, literal });
|
|
212
212
|
}
|
|
213
|
-
else if (t.kind === "redirect" && (t.fd ?? 0) === 0 && (t.op === "<<<" || t.op === "<" || (t.op === "<&" && t.dup !== "-"))) {
|
|
213
|
+
else if (t.kind === "redirect" && (t.fd ?? 0) === 0 && (t.op === "<<<" || t.op === "<" || t.op === "<>" || (t.op === "<&" && t.dup !== "-"))) {
|
|
214
214
|
const literal = t.op === "<<<" && t.target !== undefined ? literalTextOf(t.target.pieces) : undefined;
|
|
215
215
|
out.push({ from: `${t.op}${t.target?.raw ?? t.dup ?? ""}`, ...(literal !== undefined ? { literal } : {}) });
|
|
216
216
|
replacesPipe = true;
|
package/dist/tools/web.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export interface WebFetchGrounding {
|
|
|
77
77
|
}
|
|
78
78
|
export declare function htmlToText(html: string): string;
|
|
79
79
|
export declare function webFetchToolSpec(config?: WebFetchConfig): ToolSpec;
|
|
80
|
-
/** Defined (harness) form of web_fetch — back-compat for direct execution / tests. For `spec.tools`, use the raw
|
|
80
|
+
/** Defined (harness) form of web_fetch — back-compat (RL-1336-webfetch-factory) for direct execution / tests. For `spec.tools`, use the raw
|
|
81
81
|
* {@link webFetchToolSpec} (prepare-task defineTool-wraps spec.tools entries).
|
|
82
82
|
*
|
|
83
83
|
* ⚠️ CTX-DEPENDENT BEHAVIOR: this factory takes no `enrichCtx`, so the product it returns is sealed
|
|
@@ -215,7 +215,7 @@ export interface WebSearchConfig {
|
|
|
215
215
|
* `allowed_domains`/`blocked_domains` HINTS so a backend that supports native domain filtering (e.g. a
|
|
216
216
|
* `site:` query) can apply them up front. A backend MAY ignore `opts` — core re-enforces the domain
|
|
217
217
|
* constraint on the returned results as a floor (see `createWebSearchTool`), so honoring it is an
|
|
218
|
-
* optimization, not a correctness requirement.
|
|
218
|
+
* optimization, not a correctness requirement. A backend declaring fewer parameters is accepted as is.
|
|
219
219
|
*/
|
|
220
220
|
search: (query: string, signal?: AbortSignal, opts?: {
|
|
221
221
|
allowedDomains?: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.54.0",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
"gate:debts:rc": "node scripts/verify-debts.mjs --rc-gate",
|
|
78
78
|
"gate:anchor-claims": "node scripts/verify-anchor-claims.mjs",
|
|
79
79
|
"gate:anchor-claims:rc": "node scripts/verify-anchor-claims.mjs --require-corpus",
|
|
80
|
+
"gate:retirement-lines": "node scripts/verify-retirement-lines.mjs",
|
|
81
|
+
"gate:retirement-lines:rc": "node scripts/verify-retirement-lines.mjs --rc",
|
|
80
82
|
"gate:rulings": "node scripts/rulings-gate.mjs --require-comms",
|
|
81
83
|
"gate:error-surface": "node scripts/verify-error-surface.mjs",
|
|
82
84
|
"gate:criteria": "node scripts/criteria-lint.mjs",
|
|
@@ -111,6 +113,7 @@
|
|
|
111
113
|
"gate:negative-controls": "vitest run test/gate-negative-controls.test.ts",
|
|
112
114
|
"gate:memory-ga": "node scripts/gate-memory-distillation-ga.mjs",
|
|
113
115
|
"gate:all": "node scripts/gate-all.mjs",
|
|
116
|
+
"release:preflight": "node scripts/release-preflight.mjs",
|
|
114
117
|
"car:gate": "node scripts/car-gate.mjs"
|
|
115
118
|
},
|
|
116
119
|
"dependencies": {
|