@sema-agent/core 7.73.0 → 7.74.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 +246 -0
- package/dist/agents/list-agents-tool.js +1 -1
- package/dist/agents/retain-ledger.js +3 -3
- package/dist/agents/send-message-tool.js +4 -4
- package/dist/brain/anthropic.d.ts +42 -1
- package/dist/brain/anthropic.js +54 -4
- package/dist/brain/failover.d.ts +5 -0
- package/dist/brain/failover.js +51 -22
- package/dist/brain/model-lane.d.ts +12 -3
- package/dist/brain/model-lane.js +5 -5
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +1 -1
- package/dist/brain/route-adjudicator.d.ts +33 -4
- package/dist/brain/route-adjudicator.js +49 -12
- package/dist/brain/stream-engine.js +9 -7
- package/dist/brain/stream-shared.d.ts +4 -3
- package/dist/brain/stream-shared.js +2 -2
- package/dist/core/allow-entry.js +1 -1
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-headline.d.ts +1 -1
- package/dist/core/ask-origin.d.ts +44 -4
- package/dist/core/ask-origin.js +29 -10
- package/dist/core/background-agent-store.d.ts +1 -0
- package/dist/core/background-agent-store.js +49 -8
- package/dist/core/checkpoint-row-verdict.d.ts +1 -1
- package/dist/core/checkpoint-row-verdict.js +2 -2
- package/dist/core/checkpoint-store.d.ts +2 -0
- package/dist/core/checkpoint-store.js +8 -2
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/cron.js +9 -1
- package/dist/core/deployment-shape.d.ts +7 -0
- package/dist/core/deployment-shape.js +19 -0
- package/dist/core/engine-capabilities.d.ts +9 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +14 -9
- package/dist/core/engine-version.js +1 -1
- package/dist/core/gate-fold.js +5 -4
- package/dist/core/gate-lanes.js +8 -12
- package/dist/core/gate-outcome.d.ts +8 -2
- package/dist/core/gate-outcome.js +10 -3
- package/dist/core/governance-codes.d.ts +8 -2
- package/dist/core/governance-codes.js +9 -1
- package/dist/core/hook-condition.d.ts +37 -0
- package/dist/core/hook-condition.js +567 -0
- package/dist/core/hooks.d.ts +2 -0
- package/dist/core/mode-policy.d.ts +4 -0
- package/dist/core/mode-policy.js +18 -2
- package/dist/core/model-seat.d.ts +8 -5
- package/dist/core/model-shell.d.ts +129 -0
- package/dist/core/model-shell.js +249 -0
- package/dist/core/mods/kernel/digest.d.ts +4 -0
- package/dist/core/mods/kernel/digest.js +5 -0
- package/dist/core/mods/kernel/dispatch.d.ts +3 -0
- package/dist/core/mods/kernel/dispatch.js +15 -6
- package/dist/core/mods/kernel/events.d.ts +21 -5
- package/dist/core/mods/kernel/events.js +19 -10
- package/dist/core/mods/kernel/hash-mirror.d.ts +1 -0
- package/dist/core/mods/kernel/hash-mirror.js +55 -0
- package/dist/core/mods/kernel/index.d.ts +1 -0
- package/dist/core/mods/kernel/index.js +1 -0
- package/dist/core/mods/kernel/package-reader.d.ts +48 -0
- package/dist/core/mods/kernel/package-reader.js +149 -0
- package/dist/core/mods/kernel/site-rules.d.ts +4 -0
- package/dist/core/mods/kernel/site-rules.js +13 -0
- package/dist/core/mods/package.d.ts +7 -3
- package/dist/core/mods/package.js +47 -80
- package/dist/core/permission-rule-org.js +13 -3
- package/dist/core/permission-rules.js +4 -1
- package/dist/core/retain-seat.d.ts +42 -0
- package/dist/core/retain-seat.js +76 -0
- package/dist/core/rewind-refusal-codes.d.ts +8 -0
- package/dist/core/rewind-refusal-codes.js +12 -0
- package/dist/core/roles.d.ts +2 -2
- package/dist/core/roles.js +15 -1
- package/dist/core/rule-store-fault.d.ts +9 -7
- package/dist/core/rule-store-fault.js +8 -3
- package/dist/core/runner/checkpoint-scope.d.ts +1 -0
- package/dist/core/runner/checkpoint-scope.js +4 -2
- package/dist/core/runner/compact-session.js +1 -1
- package/dist/core/runner/construction-doors.js +2 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +8 -1
- package/dist/core/runner/cross-boundary-lane.js +4 -0
- package/dist/core/runner/gate-exit.d.ts +7 -0
- package/dist/core/runner/gate-exit.js +2 -1
- package/dist/core/runner/model-lane-seat.d.ts +3 -0
- package/dist/core/runner/model-lane-seat.js +4 -0
- package/dist/core/runner/person-path-rows.d.ts +6 -0
- package/dist/core/runner/person-path-rows.js +13 -0
- package/dist/core/runner/prepare-config-doors.js +9 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +6 -0
- package/dist/core/runner/prepare-gate-stations.js +3 -1
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-task.js +6 -3
- package/dist/core/runner/prepare-wiring-manifest.js +3 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -2
- package/dist/core/runner/role-seat-defaulted.d.ts +3 -3
- package/dist/core/runner/role-seat-defaulted.js +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.js +3 -3
- package/dist/core/runner/run-harness-handlers.js +1 -1
- package/dist/core/runner/run-leg.js +2 -2
- package/dist/core/runner/shell-env-withheld.d.ts +3 -2
- package/dist/core/runner/shell-env-withheld.js +24 -1
- package/dist/core/runner/sub-agent-deny-lists.js +9 -5
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-not-executed.d.ts +27 -8
- package/dist/core/runner/tool-not-executed.js +22 -11
- package/dist/core/runner/write-protection-station.d.ts +1 -1
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +4 -0
- package/dist/core/secret-env.d.ts +8 -0
- package/dist/core/secret-env.js +5 -2
- package/dist/core/shell-read-silence.d.ts +40 -2
- package/dist/core/shell-read-silence.js +23 -4
- package/dist/core/task-event.d.ts +4 -4
- package/dist/core/task-notification.js +6 -1
- package/dist/core/task-registry-agent.d.ts +1 -0
- package/dist/core/task-registry-agent.js +1 -1
- package/dist/core/task-registry.d.ts +1 -0
- package/dist/core/task-registry.js +4 -3
- package/dist/core/task-result.d.ts +5 -3
- package/dist/core/task-spec-members.js +8 -0
- package/dist/core/tool-gate-phase.d.ts +6 -3
- package/dist/core/tool-gate-phase.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +7 -3
- package/dist/core/tool-mount-facts.js +6 -2
- package/dist/core/tool-mount-plan.d.ts +1 -1
- package/dist/core/tool-mount-plan.js +4 -3
- package/dist/core/tool-result-store.d.ts +37 -1
- package/dist/core/tool-result-store.js +168 -23
- package/dist/core/trace.d.ts +3 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +75 -1
- package/dist/engine/execution-env/node-execution-env.js +225 -13
- package/dist/engine/harness/types.d.ts +25 -0
- package/dist/engine/llm/types.d.ts +8 -0
- package/dist/engine/llm/validation.d.ts +8 -1
- package/dist/engine/llm/validation.js +31 -2
- package/dist/host-env.d.ts +10 -0
- package/dist/host-env.js +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +9 -2
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/goal.js +1 -1
- package/dist/orchestration/workflow-primitives.js +10 -1
- package/dist/orchestration/workflow-script-runner.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +1 -1
- package/dist/orchestration/workflow.js +2 -2
- package/dist/shell/lex.d.ts +2 -2
- package/dist/shell/lex.js +1 -1
- package/dist/tools/fs/bash-model-shell.d.ts +23 -0
- package/dist/tools/fs/bash-model-shell.js +25 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -0
- package/dist/tools/fs/bash-readonly-classifier.js +3 -0
- package/dist/tools/fs/fs-bash.js +13 -11
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-check.js +39 -9
- package/dist/tools/fs/shell-read-plan.d.ts +2 -3
- package/dist/tools/fs/shell-read-plan.js +8 -5
- package/dist/tools/fs/shell-read-word.d.ts +8 -0
- package/dist/tools/fs/shell-read-word.js +13 -4
- package/dist/tools/monitor.js +12 -8
- package/dist/tools/scheduler-tools.d.ts +1 -0
- package/dist/tools/scheduler-tools.js +5 -2
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +62 -3
- package/wire-changes/answers/core-stores-sql@7.74.0.json +7 -0
- package/wire-changes/answers/core@7.74.0.json +68 -0
- package/wire-changes/answers/mods-kernel@7.74.0.json +21 -0
- package/wire-changes/answers/primitives@7.74.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.74.0.json +8 -0
- package/wire-changes/core-stores-sql@7.74.0.json +143 -0
- package/wire-changes/core@7.74.0.json +2210 -0
- package/wire-changes/mods-kernel@7.74.0.json +421 -0
- package/wire-changes/primitives@7.74.0.json +174 -0
- package/wire-changes/wiki-gate@7.74.0.json +145 -0
|
@@ -116,9 +116,9 @@ export interface EngineNotice {
|
|
|
116
116
|
* re-inserted under the ref (an earlier attempt of the same idempotent re-put may have stored the row: a failed write, not an
|
|
117
117
|
* empty ref); `detail: { ref, sessionId, cause, occurrenceId }`, per occurrence (`ref` names the row, not the attempt), dedup
|
|
118
118
|
* key (code, occurrenceId). The session's own entry with no identity recorded is told ONCE PER SESSION instead (its own sentence).
|
|
119
|
-
* - `"tool_result.offload_put_unsettled"` —
|
|
120
|
-
*
|
|
121
|
-
*
|
|
119
|
+
* - `"tool_result.offload_put_unsettled"` — an engine-awaited tool-result store write did not settle at `OFFLOAD_PUT_WAIT_BOUND_MS` (10 000 ms), so the waiting site finished as unconfirmed: a cleared batch's request still goes out (never waited on again; each write runs on: lands ⇒ reads back, fails ⇒ `tool_result.offload_put_failed`),
|
|
120
|
+
* or a tool call's result is returned as is (and any unsettled `details` member carries no ref);
|
|
121
|
+
* told once per request batch, or once per tool call covering its body and `details` writes pending at the bound, `detail: { refs, sessionId, boundMs, occurrenceId }`; a cancel tells nothing.
|
|
122
122
|
* - `"tool_result.media_refused"` — an executed call's result carried media blocks (an image or a document, from
|
|
123
123
|
* an MCP server, a host tool, an engine tool or a `tool_result` hook's replacement) whose bytes the tool-result
|
|
124
124
|
* seat's admission refused: not a base64 payload, a media type outside the closed set, over the cap, bytes
|
|
@@ -803,6 +803,11 @@ export interface EngineNotice {
|
|
|
803
803
|
* names the way out (build a new execution environment). The environment's own seat hears it once; a run on that
|
|
804
804
|
* environment also hands it to the Runner's seat (`RunnerDeps.onNotice`) — the same words, once per run, as a tool call
|
|
805
805
|
* ends — with `sessionId` and `runId` added to the detail: `{ index, name, sessionId, runId }`.
|
|
806
|
+
* - `"config.model_shell_unmounted"` — a leg with hands on an I/O environment and no start for model-written shell text ready
|
|
807
|
+
* (`ExecutionEnv.modelShell` undeclared or unavailable): Bash, Monitor and background commands are not offered; once per leg;
|
|
808
|
+
* audience `operator`; `detail: { reason: "undeclared" | "unavailable", cause? }` (built by `modelShellUnmountedNotice`).
|
|
809
|
+
* - `"config.shell_state_env_dropped"` — variables of `SHELL_STATE_ENV` a start did not pass (configuration's, and the host process's
|
|
810
|
+
* own by each row's rule), as the call that started it ends, each once per run; audience `operator`; `detail: { keys }`, names only.
|
|
806
811
|
* - `"config.command_sandbox_unavailable"` — the task requires a command sandbox (`TaskSpec.sandbox.enabled`) with
|
|
807
812
|
* `failIfUnavailable: false`, and its execution environment keeps none (`capabilities.commandSandbox` is not true): the
|
|
808
813
|
* run proceeds and its commands run unsandboxed. Under `failIfUnavailable` (its default) the prepare fails with the same
|
|
@@ -871,13 +876,13 @@ export interface EngineNotice {
|
|
|
871
876
|
* {@link ENGINE_NOTICE_CODES}, and a consumer table must not keep a row for them.
|
|
872
877
|
* - `"permission.rule_store_unavailable"` — the person's persisted permission rules could not be read (a read
|
|
873
878
|
* failure, a corrupt or unreadable store, a read that did not answer in time), so that read's rows were SKIPPED:
|
|
874
|
-
* none of their allow, ask or deny rows took part in the decisions it served.
|
|
875
|
-
*
|
|
876
|
-
*
|
|
879
|
+
* none of their allow, ask or deny rows took part in the decisions it served. Told under every mode (at `"call"`, class
|
|
880
|
+
* `rule_unreadable`: asking modes ask, a headless run refuses; under a mode that answers the class unasked — auto's classifier, the bypass
|
|
881
|
+
* release — the sentence states that cost, and the operator's notice below, `gate.disposition` `released` / `asked` and the trace also record it); at `"prepare"` the
|
|
877
882
|
* run's path tables lack the rows for the whole run. `detail.at` names the read that found it first: `"prepare"` (the path rows the run's file and
|
|
878
883
|
* shell checks take at run start — the next run reads them again) or `"call"` (one call's own rule check — every
|
|
879
|
-
* later call reads again, so the rows apply as soon as a read succeeds). Told once per SESSION per fault set
|
|
880
|
-
* through the session's announced record (`AnnounceOnceLedger.oncePerSession`): the first read that finds it tells it, a later run of
|
|
884
|
+
* later call reads again, so the rows apply as soon as a read succeeds). Told once per SESSION per fault set — a fault first found at a
|
|
885
|
+
* call, once per run — through the session's announced record (`AnnounceOnceLedger.oncePerSession`): the first read that finds it tells it, a later run of
|
|
881
886
|
* the same session over the same fault set says nothing, a different fault set is told again, a run with no session record to read tells
|
|
882
887
|
* it once per run, and a delegated agent's child (a session of its own) tells it once itself; the trace keeps every read's line (`permission.rule_store_unreadable`).
|
|
883
888
|
* `detail: { at, sessionId, runId, faults }` — `faults` one `{ sources, reason }` per partition the read could not read (a read
|
|
@@ -887,7 +892,7 @@ export interface EngineNotice {
|
|
|
887
892
|
* others), `owner_mismatch` (the folder is another account's), `damaged` (the stored rules, or what holds them, are damaged or not in
|
|
888
893
|
* a form this engine reads: for a file store a link, not an ordinary file, bytes that are no rule file, or a marker that is none), `later_grammar` (a newer engine wrote them), `no_answer` (the read did not answer in time) or `unclassified` (a
|
|
889
894
|
* store that states none of these). The sentence names the partition, the cause and the repair; no path rides the notice (the store's own disclosure line carries where). Audience `user`.
|
|
890
|
-
* - `"permission.rule_store_unreadable_relaxed"` — the same fact where the leg's mode answers the class with nobody asked (`auto`, `bypassPermissions`),
|
|
895
|
+
* - `"permission.rule_store_unreadable_relaxed"` — the same fact where the leg's mode answers the class with nobody asked (`auto`, `bypassPermissions`), beside the person's notice above; once per SESSION per (fault set, mode) — a fault first found at a call, once per run — `detail: { at, mode, sessionId, runId, faults }` (as above; no rule text, no path). Also minted, under those modes only, for deny or ask rows whose rule itself could not be read (`EffectivePermissionRules.unreadableRows` other than `as_read`): the calls they may reach take the same class (`faults`: `damaged` over the sources their scopes name). Audience `operator`.
|
|
891
896
|
* - `"permission.revival_root_policy_unrestated"` (7.71.0) — a resume on the runner that holds a parked agent's chain live (it registered it when the agent last parked there: its spawn, or an earlier revival there), handed no root task policy (`RunInternals.rootPolicy` / `parkedResume.rootPolicy`) for a chain that carries the root task's own layer: the chain it runs under keeps that layer as registered (on another runner the same resume is refused for it). Said on the resuming runner's `onNotice` the moment the resume's claim is won, before the leg starts — an attempt refused before the claim, or one that loses it, says nothing; a start that fails after the claim and reopens the row says it again on the next won claim (no per-token suppression). `detail: { sessionId }` (the revived leg's). Audience `operator`, attention `act`.
|
|
892
897
|
* - `"config.entries_not_applied"` (7.70.0) — an entry the person wrote did not apply. One frame per kind (`detail.kind`, closed
|
|
893
898
|
* `ENTRIES_NOT_APPLIED_KINDS`), each told as its own mint decides and in its own sentence; `detail: { kind, entries, count, identity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ENGINE_VERSION = "7.
|
|
1
|
+
export const ENGINE_VERSION = "7.74.0";
|
package/dist/core/gate-fold.js
CHANGED
|
@@ -89,6 +89,7 @@ export async function runGateFold(pass) {
|
|
|
89
89
|
traceHookCrash(input, new Error(`shell read station ${kind === "timeout" ? "timed out" : "threw"} for tool "${toolName}" (toolCallId ${toolCallId}) — where this call reads could not be established: ${thrownText(err)}`), notifier);
|
|
90
90
|
}
|
|
91
91
|
verdict = station.unanswered(pass.req, kind === "timeout" ? "the read station timed out" : "the read station could not answer");
|
|
92
|
+
pass.shellReadFallback = true;
|
|
92
93
|
}
|
|
93
94
|
applyShellReadVerdict(pass, verdict, toolName, input.shellGated === true);
|
|
94
95
|
}
|
|
@@ -265,7 +266,7 @@ function applyStationDisposition(pass, reading, toolName, shellGated) {
|
|
|
265
266
|
pass.shellReadDetails = verdict.details;
|
|
266
267
|
if (pass.decision.action !== "allow") {
|
|
267
268
|
if (pass.decision.action === "ask")
|
|
268
|
-
pass.decision = silencedBy(withProbeMandate(pass.decision, account), verdict, pass.req);
|
|
269
|
+
pass.decision = silencedBy(withProbeMandate(pass.decision, account), verdict, pass.req, pass);
|
|
269
270
|
return;
|
|
270
271
|
}
|
|
271
272
|
const candidate = normalizeReadRootCandidate(verdict.readRootCandidate);
|
|
@@ -276,7 +277,7 @@ function applyStationDisposition(pass, reading, toolName, shellGated) {
|
|
|
276
277
|
probeMandated: true,
|
|
277
278
|
...(account !== undefined ? { probeReason: account } : {}),
|
|
278
279
|
...(candidate !== undefined ? { probeReadRootCandidate: candidate } : {}),
|
|
279
|
-
}, verdict, pass.req);
|
|
280
|
+
}, verdict, pass.req, pass);
|
|
280
281
|
if (candidate !== undefined)
|
|
281
282
|
pass.shellReadOffer = true;
|
|
282
283
|
pass.tightenedBy = shellGated ? "shell_gate" : "safety";
|
|
@@ -288,7 +289,7 @@ function applyStationDisposition(pass, reading, toolName, shellGated) {
|
|
|
288
289
|
pass.shellReadDetails = verdict.details;
|
|
289
290
|
const cause = verdict.cause !== undefined ? normalizeProbeCause(verdict.cause) : undefined;
|
|
290
291
|
if (pass.decision.action === "ask")
|
|
291
|
-
pass.decision = silencedBy(cause !== undefined && pass.decision.probeCause === undefined ? { ...pass.decision, probeCause: cause } : pass.decision, verdict, pass.req);
|
|
292
|
+
pass.decision = silencedBy(cause !== undefined && pass.decision.probeCause === undefined ? { ...pass.decision, probeCause: cause } : pass.decision, verdict, pass.req, pass);
|
|
292
293
|
if (pass.decision.action === "allow") {
|
|
293
294
|
const candidate = normalizeReadRootCandidate(verdict.readRootCandidate);
|
|
294
295
|
pass.decision = silencedBy({
|
|
@@ -298,7 +299,7 @@ function applyStationDisposition(pass, reading, toolName, shellGated) {
|
|
|
298
299
|
...(account !== undefined ? { probeReason: account } : {}),
|
|
299
300
|
...(cause !== undefined ? { probeCause: cause } : {}),
|
|
300
301
|
...(candidate !== undefined ? { probeReadRootCandidate: candidate } : {}),
|
|
301
|
-
}, verdict, pass.req);
|
|
302
|
+
}, verdict, pass.req, pass);
|
|
302
303
|
if (candidate !== undefined)
|
|
303
304
|
pass.shellReadOffer = true;
|
|
304
305
|
pass.tightenedBy = shellGated ? "shell_gate" : "safety";
|
package/dist/core/gate-lanes.js
CHANGED
|
@@ -12,10 +12,9 @@ import { routesContent } from "./tool-catalog-entries.js";
|
|
|
12
12
|
import { applyPersistedTightening, disclosedRuleSet } from "./persisted-rule-arms.js";
|
|
13
13
|
import { skillAllowDecision, skillRowRefusal } from "./skill-grant.js";
|
|
14
14
|
import { allowRuleShadowOf, askFallbackMessage, cardDisclosureOf, inheritedAskFallbackMessage, withAllowRuleShadow } from "./allow-entry.js";
|
|
15
|
-
import { CD_GIT_COMPOUND_SENTENCE, changesDirectoryBeforeGit
|
|
16
|
-
import { readShellCommand } from "./shell-run-candidates.js";
|
|
15
|
+
import { CD_GIT_COMPOUND_SENTENCE, changesDirectoryBeforeGit } from "./read-only-shell.js";
|
|
17
16
|
import { COMMAND_RULE_TOOL, ruleShapeOf } from "./permission-rule-model.js";
|
|
18
|
-
import {
|
|
17
|
+
import { isProtectedWrite } from "./tool-registry.js";
|
|
19
18
|
import { callFaceSeat } from "./tool-roster.js";
|
|
20
19
|
import { wireOf } from "./tool-name-readings.js";
|
|
21
20
|
import { modeAcceptsFileCommand } from "./mode-policy.js";
|
|
@@ -24,7 +23,7 @@ import { exitGate, passAskFace, releaseRecordOf, takeSettledScreen, untakenValue
|
|
|
24
23
|
import { readOrgRuleLane, readPersistedRuleLane } from "./rule-lane-reads.js";
|
|
25
24
|
import { traceHookCrash } from "./gate-crash-trace.js";
|
|
26
25
|
import { createGateDeadline, awaitWriteProtectionJudgment, withGateTimeout } from "./gate-bounded-await.js";
|
|
27
|
-
import { readStationAnswer } from "./shell-read-silence.js";
|
|
26
|
+
import { confinedCallOf, readOnlyShellCall, readStationAnswer } from "./shell-read-silence.js";
|
|
28
27
|
import { judgedInputOf, raiseToolCheck } from "./mods/stations.js";
|
|
29
28
|
import { agentIdOf } from "./leg-identity.js";
|
|
30
29
|
import { extensionAllowOf, readToolChecks } from "./tool-check-reading.js";
|
|
@@ -250,7 +249,7 @@ export async function runGateLanes(pass) {
|
|
|
250
249
|
}
|
|
251
250
|
const readModeOn = async (standing, classification, mode) => {
|
|
252
251
|
const fileCommandByWord = modeAcceptsFileCommand(mode, wireOf("lanes.modeFileCommand", pass.req), pass.policyRewrite ?? pass.currentInput);
|
|
253
|
-
const verdict = arbitrateByMode(mode, classification, { ...(standing.origin !== undefined ? { origin: standing.origin } : {}), ...(standing.mandate !== undefined ? { mandate: standing.mandate } : {}) }, { fileCommand: pass.shellWritesPlaced === true && fileCommandByWord });
|
|
252
|
+
const verdict = arbitrateByMode(mode, classification, { ...(standing.origin !== undefined ? { origin: standing.origin } : {}), ...(standing.mandate !== undefined ? { mandate: standing.mandate } : {}) }, { fileCommand: pass.shellWritesPlaced === true && fileCommandByWord, ...confinedCallOf(input.confined, pass, pass.policyRewrite ?? pass.currentInput, input.confined !== undefined ? input.trackedCwd?.() : undefined) });
|
|
254
253
|
if (verdict.kind === "ask" && fileCommandByWord && pass.shellWritesPlaced !== true && pass.shellUnplacedOptions !== undefined && classification.classes.size === 1 && classification.classes.has("ordinary")) {
|
|
255
254
|
pass.decision = { ...standing, message: fileCommandOptionsSentence(pass.shellUnplacedOptions.program) };
|
|
256
255
|
}
|
|
@@ -403,12 +402,9 @@ export async function runGateLanes(pass) {
|
|
|
403
402
|
pass.decision = stampAskOrigin(stamped, originFacts, classifyStanding(stamped, originFacts));
|
|
404
403
|
}
|
|
405
404
|
if (allowMayClear("rule") && pass.probeBoundaryDeclined !== true && pass.leavesSandbox !== true && wireOf("lanes.readOnlyShellAllow", pass.req) === COMMAND_RULE_TOOL) {
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
const backgrounded = typeof args === "object" && args !== null && args.run_in_background === true;
|
|
410
|
-
const shape = typeof command === "string" ? readShellCommand(command) : undefined;
|
|
411
|
-
if (typeof command === "string" && shape !== undefined && !backgrounded && readOnlyShellVerdict(command, { shape, cwd: input.trackedCwd?.() }).readOnly) {
|
|
405
|
+
const reading = readOnlyShellCall(pass.req.args, input.trackedCwd?.());
|
|
406
|
+
if (reading.readOnly) {
|
|
407
|
+
const command = reading.command;
|
|
412
408
|
pass.decision = {
|
|
413
409
|
action: "allow",
|
|
414
410
|
message: "the command is read-only (upstream's read-only command tables) — allowed without asking",
|
|
@@ -418,7 +414,7 @@ export async function runGateLanes(pass) {
|
|
|
418
414
|
await notifier.notifyAsync(() => input.onReadOnlyAllowed?.({ toolName: pass.req.toolName, toolCallId, command }), "toolGate.readOnlyAllowed");
|
|
419
415
|
afterRuleClear();
|
|
420
416
|
}
|
|
421
|
-
else if (shape !== undefined && pass.tightenedBy === "shell_gate" && changesDirectoryBeforeGit(shape, input.trackedCwd?.())) {
|
|
417
|
+
else if (reading.shape !== undefined && pass.tightenedBy === "shell_gate" && changesDirectoryBeforeGit(reading.shape, input.trackedCwd?.())) {
|
|
422
418
|
pass.decision = { ...pass.decision, message: CD_GIT_COMPOUND_SENTENCE };
|
|
423
419
|
}
|
|
424
420
|
}
|
|
@@ -573,6 +573,10 @@ export interface ModeRelease {
|
|
|
573
573
|
readonly rowCount: number;
|
|
574
574
|
readonly tableUnread?: true;
|
|
575
575
|
};
|
|
576
|
+
/** The mode released the call BECAUSE the Runner declares its shape (`RunnerDeps.deploymentShape`): `classes` holds a class of
|
|
577
|
+
* {@link import("./ask-origin.js").RELEASED_ON_CONFINED_RUNNER} that keeps the question on a Runner that declares none. Absent ⇒ the
|
|
578
|
+
* release stands on any Runner. Not a class: the class set is the question's, this is the deployment's declaration. */
|
|
579
|
+
confined?: true;
|
|
576
580
|
}
|
|
577
581
|
/** The read-deny table one call is judged with: the active built-in tiers and the rows beside them (`ToolGateInput.readDenyInForce`). */
|
|
578
582
|
export interface ReadDenyTable {
|
|
@@ -624,7 +628,8 @@ export interface ModeRefusal {
|
|
|
624
628
|
* when present, are members of their closed sets, `reason` names a member of `classes` (the mint takes it from
|
|
625
629
|
* that set), and `readUnestablished`, when present, names a table: `tiers` and `rows` lists of strings, `rows` at most
|
|
626
630
|
* {@link READ_DENY_ROWS_NAMED} long, `rowCount` a whole number no smaller than `rows`, and `tableUnread`, when present,
|
|
627
|
-
* `true` beside an empty table (no tiers, no rows, `rowCount: 0`)
|
|
631
|
+
* `true` beside an empty table (no tiers, no rows, `rowCount: 0`), and `confined`, when present, is `true` — a mode
|
|
632
|
+
* releases nothing a person answered;
|
|
628
633
|
* I8 `deniedBy === "mode"` ⇔ `mode` present (`bypassPermissions` | `dontAsk`) with `askClass` and `classes`;
|
|
629
634
|
* I9 `disposition.clearedBy` present ⇒ `kind === "allowed"`, no settlement and no release (an allow member cleared the ask
|
|
630
635
|
* before anyone answered it), `member` one of the allow layer's members, `entries` a list of strings, `omitted` a positive
|
|
@@ -716,7 +721,8 @@ export type RetiredReasonsAreClassWords = AssertAllKeysHandled<Exclude<RetiredWo
|
|
|
716
721
|
export declare function isRetiredMember<S extends MemberSet>(set: S, word: unknown): word is RetiredWord<S>;
|
|
717
722
|
/**
|
|
718
723
|
* The release law of THIS engine (I7's policy half): a mode release names a set of classes that one face of the engine's table
|
|
719
|
-
* releases whole (`releasableAskClassesFor`) — the arbitration releases a set only when no member is immune on the call's face
|
|
724
|
+
* releases whole (`releasableAskClassesFor`) — the arbitration releases a set only when no member is immune on the call's face; a
|
|
725
|
+
* release that says `confined` reads the confined Runner's lists and holds a member only they release.
|
|
720
726
|
* Policy, not shape — it moves between versions — so only the producer reading of {@link screenGateOutcome} reads it.
|
|
721
727
|
* Module-level only; not part of the package root.
|
|
722
728
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAskClass, isAskOrigin, isModeReleaseReason, isPermissionMode, isPersistedRuleMandate, ASK_FACES, releasableAskClassesFor } from "./ask-origin.js";
|
|
1
|
+
import { isAskClass, isAskOrigin, isModeReleaseReason, isPermissionMode, isPersistedRuleMandate, ASK_FACES, releasableAskClassesFor, confinedReleasableAskClassesFor, RELEASED_ON_CONFINED_RUNNER } from "./ask-origin.js";
|
|
2
2
|
import { isAutoModeFallbackCause } from "./auto-mode.js";
|
|
3
3
|
import { ALLOW_LIST_GRANTS, ALLOW_RULE_MEMBERS, isAllowListGrant } from "./allow-rule-shadow.js";
|
|
4
4
|
import { refusalEchoDefects } from "./refusal-echo.js";
|
|
@@ -213,10 +213,15 @@ export function releasePolicyDefects(g) {
|
|
|
213
213
|
const classes = r?.classes;
|
|
214
214
|
if (!isAskClass(askClass) || !Array.isArray(classes) || !classes.every(isAskClass))
|
|
215
215
|
return [];
|
|
216
|
-
|
|
216
|
+
const confined = r?.confined === true;
|
|
217
|
+
const listOn = (face, on) => (on ? confinedReleasableAskClassesFor(face) : releasableAskClassesFor(face));
|
|
218
|
+
if (!ASK_FACES.some((face) => listOn(face, confined).includes(askClass)))
|
|
217
219
|
return [`I7: released.askClass "${askClass}" is not a releasable class under this engine's table`];
|
|
218
220
|
const held = [askClass, ...classes];
|
|
219
|
-
|
|
221
|
+
const releases = (on) => ASK_FACES.some((face) => held.every((c) => listOn(face, on).includes(c)));
|
|
222
|
+
if (!releases(confined))
|
|
223
|
+
return [`I7: released.classes ${JSON.stringify(classes)} is not a set one face of this engine's table releases`];
|
|
224
|
+
return confined && (releases(false) || !classes.some((c) => RELEASED_ON_CONFINED_RUNNER.includes(c))) ? [`I7: released.confined stands only on a release the declaration made (its classes ${JSON.stringify(classes)} hold no class only a confined Runner releases)`] : [];
|
|
220
225
|
}
|
|
221
226
|
const LIST_MEMBERS = new Set(["request", "deployment"]);
|
|
222
227
|
const ALLOW_MEMBER_SET = new Set(ALLOW_RULE_MEMBERS);
|
|
@@ -392,6 +397,8 @@ export function screenGateOutcome(g, opts) {
|
|
|
392
397
|
defects.push(`I7: released.reason "${String(r.reason)}" is not a member of released.classes`);
|
|
393
398
|
if (r.readUnestablished !== undefined)
|
|
394
399
|
defects.push(...readUnappliedDefects(r.readUnestablished));
|
|
400
|
+
if (r.confined !== undefined && r.confined !== true)
|
|
401
|
+
defects.push(`I7: released.confined ${spelled(r.confined)} is not true`);
|
|
395
402
|
}
|
|
396
403
|
}
|
|
397
404
|
if (denied !== undefined && denied.clearedBy !== undefined)
|
|
@@ -180,7 +180,7 @@ export type NoticeAttention = "act" | "inform" | "audit";
|
|
|
180
180
|
* the union's catalog ({@link EngineNotice.code}). The groups below say only which family a row joins,
|
|
181
181
|
* so the catalog is not written a second time here and the two cannot drift.
|
|
182
182
|
*/
|
|
183
|
-
export declare const ENGINE_NOTICE_CODES: readonly ["config.autocompact_window_clamped", "config.env_timeout_discarded", "config.materialize_env_discarded", "config.models_swapped", "config.context_settings_swapped", "config.read_face_swapped", "config.read_face_deployment_clamped", "config.write_face_swapped", "config.write_face_deployment_clamped", "config.read_deny_swapped", "config.tool_model_gate_removed", "config.tool_model_gate_unknown_class", "config.tool_model_gate_env_invalid", "config.artifact_host_invalid", "config.task_root_not_canonical", "config.write_protection_target_view_absent", "config.path_view_unresolved", "config.execution_env_capability_invalid", "config.execution_env_failure_contract_broken", "config.read_deny_floor_unkept", "config.read_floor_confinement_unavailable", "config.inherit_env_declared_late", "config.command_sandbox_unavailable", "config.tool_card_undeclared", "config.tool_face_undeclared", "config.tool_face_invalid", "config.host_sink_failed", "config.seat_malformed", "config.session_delete_withheld", "config.env_knob_adjusted", "config.read_deny_home", "config.permission_rules_skipped", "config.process_start_time_unavailable", "config.data_root_spelling_split", "config.durable_gate_unavailable", "config.peer_admission_out_of_range", "config.peer_lane_unmounted", "config.scheduler_store_unmoved", "config.secret_env_scrubbed", "inherit_env.names_withheld", "config.credential_not_withheld", "config.cross_boundary_posture_undeclared", "config.cross_boundary_record_unwritten", "config.permission_mode_unavailable", "permission.rule_store_unavailable", "permission.rule_store_unreadable_relaxed", "config.entries_not_applied", "config.session_rules_earlier_grammar", "config.session_rules_reread", "config.skill_deny_unreadable", "config.legacy_tool_name", "config.toolpolicy.unmatched_names", "config.agent.unknown_tool", "permission.allow_rule_not_used_in_auto", "permission.revival_root_policy_unrestated", "mods.registration_refused", "mods.registration_refused_deployment", "mods.display_withheld", "mods.stop_ended", "mods.stop_continue_dropped", "mods.package_key_unread", "peer.inbound_disposition", "peer.inbound_unread", "peer.notice_user_only", "peer.receipt_delivered_user_only", "peer.held_settled", "peer.held_approval_unhonored", "peer.held_decision_applied", "peer.idle_subscription", "peer.idle_subscription_declined", "classifier.denial_limit", "classifier.fallback", "classifier.seat_rate_limited", "classifier.role_defaulted", "classifier.contract_broken", "classifier.unavailable", "classifier.unavailable_handed_on", "classifier.review_skipped", "checkpoint.execution_outcome_unrecorded", "delegation.transcript_integrity", "delegation.ask_unresolvable", "delegation.resume_lane_missing", "delegation.spawn_depth_unknown", "delegation.delivery_discarded", "delegation.settlement_external", "delegation.settlement_write_failed", "delegation.durable_row_unpersisted", "delegation.parked_card_unreadable", "delegation.parked_card_id_untrusted", "delegation.agent_row_ending_unreadable", "protocol.revocation_probe_failed", "mcp.server_redialed", "mcp.authorization_required", "mcp.server_unavailable", "mcp.server_connecting", "mcp.credential_echoed", "a2a.peer_card_drift", "mcp.server_stderr", "workflow.governance_key_stripped", "workflow.agent_option_ignored", "workflow.parked_decision_unused", "workflow.parked_decision_used", "workflow.record_unwritten", "memory.session_polluted", "memory.harvest_quarantined", "memory.harvest_refused", "memory.harvest_conflict", "memory.delegation_static_mark_waived", "memory.content_class_declared", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "memory.consolidation_recommended", "memory.consolidation_committed", "memory.consolidation_conflict", "memory.consolidation_incomplete", "memory.consolidation_refused", "memory.consolidation_withheld", "memory.restore_withheld", "memory.project_scope_absent", "memory.notice_unscoped", "route.fallback_to_primary", "route.classifier_unroutable", "route.seat_detached", "advisor.not_attached", "route.credential_origin_mismatch", "route.credential_mismatch", "route.credential_rebound", "route.response_model_mismatch", "route.tool_call_id_folded", "route.finish_reason_unknown", "route.stream_end_ignored", "route.stream_content_dropped", "route.extra_body_reserved_dropped", "model.capability_downgraded", "model.fast_mode_changed", "model.fallback", "model.fallback_side_call", "context.tool_turn_repaired", "context.media_removed", "context.tool_schema_removed", "context.messages_omitted", "instructions.withheld", "instructions.outside_root", "instructions.family_undeclared", "task.user_steer_undrained", "task.user_followup_undrained", "task.undelivered_input_dropped", "steering.parked_input_blocked", "task.turn_interrupted", "task.halt_unconsumed", "mods.turn_aborted", "mods.turn_abort_unconsumed", "task.late_approval", "task.interrupt_unconsumed", "task.wait_ceiling_reached", "task.manager_launch_narrowed", "task.completed_past_limit", "task.verdict_refused", "task.tool_turn_incomplete", "task.tool_turn_unrecovered", "approval.read_root_granted", "approval.read_root_grant_rejected", "approval.session_call_granted", "approval.session_call_grant_rejected", "approval.approver_defect", "memory.capture_opted_out", "memory.capture_switched_off", "memory.capture_optout_unpersisted", "memory.mount_failed", "skills.listing_truncated", "agents.listing_truncated", "tool_result.offload_put_failed", "tool_result.offload_put_unsettled", "tool_result.media_refused", "tool_result.media_persisted", "tool_result.read_refused", "artifact.owner_refused", "config.image_processor_unavailable", "fs.staging_file_left", "fs.staging_file_swept", "store.tail_segment_unjudged", "store.lock_retained", "store.lock_reclaimed_on_declaration", "store.append_log_parked", "store.tree_id_stamp_incomplete", "store.process_anchor_unavailable", "store.process_anchor_lost", "engine.debug_trace", "session.lineage_rerooted", "rewind.boundary_unrecorded", "rewind.file_left_as_is", "verify.verifier_is_implementer", "workspace.sync_failed", "memory.layer_locked_legacy", "server.model_unreachable", "permission.entry_mode_clamped", "model.context_window_assumed", "config.store_ephemeral", "memory.sync_layer_parked"];
|
|
183
|
+
export declare const ENGINE_NOTICE_CODES: readonly ["config.autocompact_window_clamped", "config.env_timeout_discarded", "config.materialize_env_discarded", "config.models_swapped", "config.context_settings_swapped", "config.read_face_swapped", "config.read_face_deployment_clamped", "config.write_face_swapped", "config.write_face_deployment_clamped", "config.read_deny_swapped", "config.tool_model_gate_removed", "config.tool_model_gate_unknown_class", "config.tool_model_gate_env_invalid", "config.artifact_host_invalid", "config.task_root_not_canonical", "config.write_protection_target_view_absent", "config.path_view_unresolved", "config.execution_env_capability_invalid", "config.execution_env_failure_contract_broken", "config.read_deny_floor_unkept", "config.read_floor_confinement_unavailable", "config.inherit_env_declared_late", "config.model_shell_unmounted", "config.shell_state_env_dropped", "config.command_sandbox_unavailable", "config.tool_card_undeclared", "config.tool_face_undeclared", "config.tool_face_invalid", "config.host_sink_failed", "config.seat_malformed", "config.session_delete_withheld", "config.env_knob_adjusted", "config.read_deny_home", "config.permission_rules_skipped", "config.process_start_time_unavailable", "config.data_root_spelling_split", "config.durable_gate_unavailable", "config.peer_admission_out_of_range", "config.peer_lane_unmounted", "config.scheduler_store_unmoved", "config.secret_env_scrubbed", "inherit_env.names_withheld", "config.credential_not_withheld", "config.cross_boundary_posture_undeclared", "config.cross_boundary_record_unwritten", "config.permission_mode_unavailable", "permission.rule_store_unavailable", "permission.rule_store_unreadable_relaxed", "config.entries_not_applied", "config.session_rules_earlier_grammar", "config.session_rules_reread", "config.skill_deny_unreadable", "config.legacy_tool_name", "config.toolpolicy.unmatched_names", "config.agent.unknown_tool", "permission.allow_rule_not_used_in_auto", "permission.revival_root_policy_unrestated", "mods.registration_refused", "mods.registration_refused_deployment", "mods.display_withheld", "mods.stop_ended", "mods.stop_continue_dropped", "mods.package_key_unread", "peer.inbound_disposition", "peer.inbound_unread", "peer.notice_user_only", "peer.receipt_delivered_user_only", "peer.held_settled", "peer.held_approval_unhonored", "peer.held_decision_applied", "peer.idle_subscription", "peer.idle_subscription_declined", "classifier.denial_limit", "classifier.fallback", "classifier.seat_rate_limited", "classifier.role_defaulted", "classifier.contract_broken", "classifier.unavailable", "classifier.unavailable_handed_on", "classifier.review_skipped", "checkpoint.execution_outcome_unrecorded", "delegation.transcript_integrity", "delegation.ask_unresolvable", "delegation.resume_lane_missing", "delegation.spawn_depth_unknown", "delegation.delivery_discarded", "delegation.settlement_external", "delegation.settlement_write_failed", "delegation.durable_row_unpersisted", "delegation.parked_card_unreadable", "delegation.parked_card_id_untrusted", "delegation.agent_row_ending_unreadable", "protocol.revocation_probe_failed", "mcp.server_redialed", "mcp.authorization_required", "mcp.server_unavailable", "mcp.server_connecting", "mcp.credential_echoed", "a2a.peer_card_drift", "mcp.server_stderr", "workflow.governance_key_stripped", "workflow.agent_option_ignored", "workflow.parked_decision_unused", "workflow.parked_decision_used", "workflow.record_unwritten", "memory.session_polluted", "memory.harvest_quarantined", "memory.harvest_refused", "memory.harvest_conflict", "memory.delegation_static_mark_waived", "memory.content_class_declared", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "memory.consolidation_recommended", "memory.consolidation_committed", "memory.consolidation_conflict", "memory.consolidation_incomplete", "memory.consolidation_refused", "memory.consolidation_withheld", "memory.restore_withheld", "memory.project_scope_absent", "memory.notice_unscoped", "route.fallback_to_primary", "route.classifier_unroutable", "route.seat_detached", "advisor.not_attached", "route.credential_origin_mismatch", "route.credential_mismatch", "route.credential_rebound", "route.response_model_mismatch", "route.tool_call_id_folded", "route.finish_reason_unknown", "route.stream_end_ignored", "route.stream_content_dropped", "route.extra_body_reserved_dropped", "model.capability_downgraded", "model.fast_mode_changed", "model.fallback", "model.fallback_side_call", "context.tool_turn_repaired", "context.media_removed", "context.tool_schema_removed", "context.messages_omitted", "instructions.withheld", "instructions.outside_root", "instructions.family_undeclared", "task.user_steer_undrained", "task.user_followup_undrained", "task.undelivered_input_dropped", "steering.parked_input_blocked", "task.turn_interrupted", "task.halt_unconsumed", "mods.turn_aborted", "mods.turn_abort_unconsumed", "task.late_approval", "task.interrupt_unconsumed", "task.wait_ceiling_reached", "task.manager_launch_narrowed", "task.completed_past_limit", "task.verdict_refused", "task.tool_turn_incomplete", "task.tool_turn_unrecovered", "approval.read_root_granted", "approval.read_root_grant_rejected", "approval.session_call_granted", "approval.session_call_grant_rejected", "approval.approver_defect", "memory.capture_opted_out", "memory.capture_switched_off", "memory.capture_optout_unpersisted", "memory.mount_failed", "skills.listing_truncated", "agents.listing_truncated", "tool_result.offload_put_failed", "tool_result.offload_put_unsettled", "tool_result.media_refused", "tool_result.media_persisted", "tool_result.read_refused", "artifact.owner_refused", "config.image_processor_unavailable", "fs.staging_file_left", "fs.staging_file_swept", "store.tail_segment_unjudged", "store.lock_retained", "store.lock_reclaimed_on_declaration", "store.append_log_parked", "store.tree_id_stamp_incomplete", "store.process_anchor_unavailable", "store.process_anchor_lost", "engine.debug_trace", "session.lineage_rerooted", "rewind.boundary_unrecorded", "rewind.file_left_as_is", "verify.verifier_is_implementer", "workspace.sync_failed", "memory.layer_locked_legacy", "server.model_unreachable", "permission.entry_mode_clamped", "model.context_window_assumed", "config.store_ephemeral", "memory.sync_layer_parked"];
|
|
184
184
|
/** A catalogued code (see {@link ENGINE_NOTICE_CODES}); {@link NOTICE_MINTER} says who mints it. NOT the type of
|
|
185
185
|
* `EngineNotice.code`, which stays `string` — a host forwarding its own notices through the same
|
|
186
186
|
* sink is a supported shape, and narrowing that field would break it. */
|
|
@@ -293,6 +293,8 @@ declare const NOTICE_AUDIENCE_TABLE: {
|
|
|
293
293
|
readonly "config.read_deny_floor_unkept": "user";
|
|
294
294
|
readonly "config.read_floor_confinement_unavailable": "operator";
|
|
295
295
|
readonly "config.inherit_env_declared_late": "operator";
|
|
296
|
+
readonly "config.model_shell_unmounted": "operator";
|
|
297
|
+
readonly "config.shell_state_env_dropped": "operator";
|
|
296
298
|
readonly "config.command_sandbox_unavailable": "user";
|
|
297
299
|
readonly "config.tool_card_undeclared": "operator";
|
|
298
300
|
readonly "config.tool_face_undeclared": "operator";
|
|
@@ -412,7 +414,7 @@ export type AudienceTableCoversEveryNoticeCode = AssertAllKeysHandled<Exclude<En
|
|
|
412
414
|
* {@link ENGINE_NOTICE_CODES} is enforced on the table above, where narrowing costs nobody anything.
|
|
413
415
|
*/
|
|
414
416
|
export declare const NOTICE_AUDIENCE: Readonly<Record<string, NoticeAudience>>;
|
|
415
|
-
/** The audience for `code` —
|
|
417
|
+
/** The audience for `code` — the catalog's own rows only; an unregistered code, or a name an object inherits (`constructor`, `valueOf`, …), reads `"operator"`. */
|
|
416
418
|
export declare function noticeAudienceOf(code: string): NoticeAudience;
|
|
417
419
|
/**
|
|
418
420
|
* The attention registry ({@link NoticeAttention}): one row per {@link ENGINE_NOTICE_CODES} member, kept in lockstep by the
|
|
@@ -528,6 +530,8 @@ declare const NOTICE_ATTENTION_TABLE: {
|
|
|
528
530
|
readonly "config.execution_env_capability_invalid": "act";
|
|
529
531
|
readonly "config.execution_env_failure_contract_broken": "act";
|
|
530
532
|
readonly "config.inherit_env_declared_late": "act";
|
|
533
|
+
readonly "config.model_shell_unmounted": "act";
|
|
534
|
+
readonly "config.shell_state_env_dropped": "act";
|
|
531
535
|
readonly "config.tool_card_undeclared": "act";
|
|
532
536
|
readonly "config.tool_face_undeclared": "act";
|
|
533
537
|
readonly "config.tool_face_invalid": "act";
|
|
@@ -688,6 +692,8 @@ declare const NOTICE_MINTER_TABLE: {
|
|
|
688
692
|
readonly "config.read_deny_floor_unkept": "engine";
|
|
689
693
|
readonly "config.read_floor_confinement_unavailable": "engine";
|
|
690
694
|
readonly "config.inherit_env_declared_late": "engine";
|
|
695
|
+
readonly "config.model_shell_unmounted": "engine";
|
|
696
|
+
readonly "config.shell_state_env_dropped": "engine";
|
|
691
697
|
readonly "config.command_sandbox_unavailable": "engine";
|
|
692
698
|
readonly "config.tool_card_undeclared": "engine";
|
|
693
699
|
readonly "config.tool_face_undeclared": "engine";
|
|
@@ -160,6 +160,8 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
160
160
|
"config.read_deny_floor_unkept",
|
|
161
161
|
"config.read_floor_confinement_unavailable",
|
|
162
162
|
"config.inherit_env_declared_late",
|
|
163
|
+
"config.model_shell_unmounted",
|
|
164
|
+
"config.shell_state_env_dropped",
|
|
163
165
|
"config.command_sandbox_unavailable",
|
|
164
166
|
"config.tool_card_undeclared",
|
|
165
167
|
"config.tool_face_undeclared",
|
|
@@ -431,6 +433,8 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
431
433
|
"config.read_deny_floor_unkept": "user",
|
|
432
434
|
"config.read_floor_confinement_unavailable": "operator",
|
|
433
435
|
"config.inherit_env_declared_late": "operator",
|
|
436
|
+
"config.model_shell_unmounted": "operator",
|
|
437
|
+
"config.shell_state_env_dropped": "operator",
|
|
434
438
|
"config.command_sandbox_unavailable": "user",
|
|
435
439
|
"config.tool_card_undeclared": "operator",
|
|
436
440
|
"config.tool_face_undeclared": "operator",
|
|
@@ -543,7 +547,7 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
543
547
|
};
|
|
544
548
|
export const NOTICE_AUDIENCE = NOTICE_AUDIENCE_TABLE;
|
|
545
549
|
export function noticeAudienceOf(code) {
|
|
546
|
-
return NOTICE_AUDIENCE[code]
|
|
550
|
+
return Object.hasOwn(NOTICE_AUDIENCE, code) ? NOTICE_AUDIENCE[code] : "operator";
|
|
547
551
|
}
|
|
548
552
|
const NOTICE_ATTENTION_TABLE = {
|
|
549
553
|
"config.command_sandbox_unavailable": "act",
|
|
@@ -651,6 +655,8 @@ const NOTICE_ATTENTION_TABLE = {
|
|
|
651
655
|
"config.execution_env_capability_invalid": "act",
|
|
652
656
|
"config.execution_env_failure_contract_broken": "act",
|
|
653
657
|
"config.inherit_env_declared_late": "act",
|
|
658
|
+
"config.model_shell_unmounted": "act",
|
|
659
|
+
"config.shell_state_env_dropped": "act",
|
|
654
660
|
"config.tool_card_undeclared": "act",
|
|
655
661
|
"config.tool_face_undeclared": "act",
|
|
656
662
|
"config.tool_face_invalid": "act",
|
|
@@ -783,6 +789,8 @@ const NOTICE_MINTER_TABLE = {
|
|
|
783
789
|
"config.read_deny_floor_unkept": "engine",
|
|
784
790
|
"config.read_floor_confinement_unavailable": "engine",
|
|
785
791
|
"config.inherit_env_declared_late": "engine",
|
|
792
|
+
"config.model_shell_unmounted": "engine",
|
|
793
|
+
"config.shell_state_env_dropped": "engine",
|
|
786
794
|
"config.command_sandbox_unavailable": "engine",
|
|
787
795
|
"config.tool_card_undeclared": "engine",
|
|
788
796
|
"config.tool_face_undeclared": "engine",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const HOOK_CONDITION_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "PermissionRequest", "PermissionDenied"];
|
|
2
|
+
export declare const HOOK_CONDITION_UNTESTED_REASONS: readonly ["not_a_tool_event", "condition_unreadable", "name_unjudged", "content_unjudged", "invalid_input"];
|
|
3
|
+
export interface HookConditionInput {
|
|
4
|
+
readonly condition: string;
|
|
5
|
+
readonly event: string;
|
|
6
|
+
readonly toolName?: string;
|
|
7
|
+
readonly toolInput?: Readonly<Record<string, unknown>>;
|
|
8
|
+
/** The caller's statement that the call's tool is the engine's own catalog tool of that name — not a host tool mounted under the same name. Only `true` or absent; without it a condition with content is not judged. */
|
|
9
|
+
readonly engineOwned?: true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Frozen verdict returned by {@link judgeHookCondition}:
|
|
13
|
+
* - `"matched"` — the condition definitely matches this local hook call;
|
|
14
|
+
* - `"not_matched"` — reserved; this version does not mint it;
|
|
15
|
+
* - `"untested"` — the judge withholds a definite verdict, with a closed `reason` word and a fixed `detail` sentence.
|
|
16
|
+
*/
|
|
17
|
+
export type HookConditionVerdict = {
|
|
18
|
+
readonly verdict: "matched";
|
|
19
|
+
} | {
|
|
20
|
+
readonly verdict: "not_matched";
|
|
21
|
+
} | {
|
|
22
|
+
readonly verdict: "untested";
|
|
23
|
+
readonly reason: (typeof HOOK_CONDITION_UNTESTED_REASONS)[number];
|
|
24
|
+
readonly detail: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Judge whether a hook entry's `if` condition matches a local tool call.
|
|
28
|
+
*
|
|
29
|
+
* Both promises (a definite answer only where the reference would give the same, and no host code run for plain data) hold in a realm whose built-in objects are as loaded; the base-prototype check (R-J) catches a key added to, removed from, or reordered on `Object.prototype` or `Array.prototype` relative to load and returns `untested` with reason `invalid_input` before any other read (empty-condition and bare-name inputs included).
|
|
30
|
+
* All structural validation — the outer record and, when `toolInput` is present for a named tool, its tool-specific shape — runs before any answer (empty-condition and bare-name matches included).
|
|
31
|
+
* Definite `matched` verdicts are returned only for three classes: (1) empty condition `""`, (2) canonicalized equal engine-catalog non-`Monitor` tool names without content, and (3) a `Bash` condition with content (at most 1 000 characters) when the caller states `engineOwned: true`, `toolInput` is valid, and the plain-character command matches; every other case returns `untested` with a closed reason word (`not_matched` is reserved and not minted in this version).
|
|
32
|
+
* For a `Bash` condition with content, an own `run_in_background` or `dangerouslyDisableSandbox` key on `toolInput` whose value passes the shape check (a boolean, or `undefined`) returns `untested` with reason `content_unjudged` — because whether the reference's input schema carries these keys depends on its configuration and with the key absent from the schema the call does not parse and the hook is skipped — whereas a value of another type (`null` included) returns `untested` with reason `invalid_input` during structural validation before that, and an absent key changes nothing.
|
|
33
|
+
* On other optional members (`toolName`, `toolInput`, `engineOwned`, and optional `Bash` input fields other than `run_in_background` and `dangerouslyDisableSandbox` under a content condition), an own property whose value is `undefined` is treated as absent, whereas `command: undefined`, `null`, or any wrong-typed value returns `untested` with reason `invalid_input`.
|
|
34
|
+
*
|
|
35
|
+
* Never throws and runs no `RegExp` against input strings; every returned verdict is a pre-frozen object. Other built-in modifications (descriptor flags/enumerability, replaced values, changed prototype links, other built-in prototypes) and pre-load pollution are outside the contract (`docs/KNOWN-LIMITS.md` KL-4994-b).
|
|
36
|
+
*/
|
|
37
|
+
export declare function judgeHookCondition(input: unknown): HookConditionVerdict;
|