@sema-agent/core 7.33.8 → 7.34.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 +339 -0
- package/dist/agents/cross-session-judge.d.ts +16 -7
- package/dist/agents/cross-session-judge.js +18 -15
- package/dist/agents/peer-session-drain.d.ts +4 -0
- package/dist/agents/peer-session-drain.js +5 -2
- package/dist/agents/repair-loop.d.ts +1 -1
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +12 -3
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +2 -1
- package/dist/core/a2a.d.ts +3 -1
- package/dist/core/a2a.js +1 -1
- package/dist/core/ask-origin.d.ts +351 -154
- package/dist/core/ask-origin.js +223 -45
- package/dist/core/ask-unresolvable-notice.d.ts +5 -2
- package/dist/core/ask-unresolvable-notice.js +4 -3
- package/dist/core/auto-mode-arming.d.ts +17 -4
- package/dist/core/auto-mode-arming.js +31 -6
- package/dist/core/auto-mode-defaults.d.ts +16 -7
- package/dist/core/auto-mode-defaults.js +2 -1
- package/dist/core/auto-mode-directive.d.ts +18 -30
- package/dist/core/auto-mode-directive.js +9 -18
- package/dist/core/auto-mode-prompt.d.ts +62 -1
- package/dist/core/auto-mode-prompt.js +42 -4
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode-rebuild.js +1 -0
- package/dist/core/auto-mode.d.ts +32 -3
- package/dist/core/auto-mode.js +80 -41
- package/dist/core/checkpoint-store.d.ts +50 -35
- package/dist/core/checkpoint-store.js +58 -3
- package/dist/core/child-clamp-seats.js +1 -0
- package/dist/core/classifier-unavailable-arm.d.ts +57 -0
- package/dist/core/classifier-unavailable-arm.js +17 -0
- package/dist/core/effective-path-target.d.ts +12 -0
- package/dist/core/effective-path-target.js +18 -7
- package/dist/core/engine-notice.d.ts +53 -2
- package/dist/core/fs-write-gate-policy.d.ts +5 -1
- package/dist/core/fs-write-gate-policy.js +4 -1
- package/dist/core/gate-fold.js +17 -1
- package/dist/core/gate-lanes.js +111 -46
- package/dist/core/gate-outcome.d.ts +40 -7
- package/dist/core/gate-outcome.js +26 -4
- package/dist/core/governance-codes.d.ts +1 -1
- package/dist/core/governance-codes.js +12 -0
- package/dist/core/hooks.d.ts +50 -29
- package/dist/core/hooks.js +1 -3
- package/dist/core/mcp.js +1 -1
- package/dist/core/mode-policy.d.ts +182 -0
- package/dist/core/mode-policy.js +179 -0
- package/dist/core/oracle-isolation.d.ts +3 -3
- package/dist/core/permission-rule-model.d.ts +16 -3
- package/dist/core/permission-rule-model.js +36 -3
- package/dist/core/permission-rule-provider.d.ts +22 -11
- package/dist/core/permission-rule-provider.js +17 -7
- package/dist/core/permission-rules.d.ts +23 -1
- package/dist/core/permission-rules.js +35 -8
- package/dist/core/persisted-rule-arms.d.ts +10 -9
- package/dist/core/persisted-rule-arms.js +9 -6
- package/dist/core/present-plan-tool.d.ts +1 -1
- package/dist/core/present-plan-tool.js +3 -3
- package/dist/core/read-only-shell.d.ts +19 -19
- package/dist/core/read-only-shell.js +38 -12
- package/dist/core/retired-keys.d.ts +9 -3
- package/dist/core/retired-keys.js +5 -1
- package/dist/core/runner/classifier-ladder.d.ts +43 -1
- package/dist/core/runner/classifier-ladder.js +29 -0
- package/dist/core/runner/contracts.d.ts +37 -35
- package/dist/core/runner/denial-limit-arms.d.ts +30 -7
- package/dist/core/runner/denial-limit-arms.js +15 -9
- package/dist/core/runner/env-capability-census.js +1 -1
- package/dist/core/runner/gate-exit.d.ts +30 -4
- package/dist/core/runner/gate-exit.js +28 -7
- package/dist/core/runner/permission-rule-lanes.d.ts +9 -5
- package/dist/core/runner/permission-rule-lanes.js +44 -40
- package/dist/core/runner/persisted-path-rows.d.ts +64 -0
- package/dist/core/runner/persisted-path-rows.js +89 -0
- package/dist/core/runner/prepare-artifact.d.ts +5 -1
- package/dist/core/runner/prepare-artifact.js +9 -3
- package/dist/core/runner/prepare-ask-lane.d.ts +5 -3
- package/dist/core/runner/prepare-ask-lane.js +1 -1
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +39 -13
- package/dist/core/runner/prepare-caps-and-workflow.js +58 -29
- package/dist/core/runner/prepare-gate-stations.d.ts +33 -6
- package/dist/core/runner/prepare-gate-stations.js +32 -19
- package/dist/core/runner/prepare-hands-readface.d.ts +40 -17
- package/dist/core/runner/prepare-hands-readface.js +64 -53
- package/dist/core/runner/prepare-inherited-gate.d.ts +22 -22
- package/dist/core/runner/prepare-inherited-gate.js +37 -23
- package/dist/core/runner/prepare-park-ask.d.ts +2 -2
- package/dist/core/runner/prepare-park-ask.js +2 -1
- package/dist/core/runner/prepare-policy-chain.d.ts +22 -2
- package/dist/core/runner/prepare-policy-chain.js +39 -12
- package/dist/core/runner/prepare-protocol-tools.d.ts +28 -0
- package/dist/core/runner/prepare-protocol-tools.js +13 -3
- package/dist/core/runner/prepare-run-refs.d.ts +6 -6
- package/dist/core/runner/prepare-run-refs.js +9 -4
- package/dist/core/runner/prepare-safety-scan.d.ts +5 -0
- package/dist/core/runner/prepare-safety-scan.js +19 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +5 -5
- package/dist/core/runner/prepare-suspend-saga.js +6 -6
- package/dist/core/runner/prepare-task.js +51 -22
- package/dist/core/runner/prepare-wiring-manifest.d.ts +10 -6
- package/dist/core/runner/prepare-wiring-manifest.js +5 -3
- package/dist/core/runner/read-root-grant.d.ts +9 -0
- package/dist/core/runner/read-root-grant.js +12 -0
- package/dist/core/runner/retired-runner-deps.js +1 -0
- package/dist/core/runner/run-identity-wiring.js +1 -1
- package/dist/core/runner/run-leg.js +24 -15
- package/dist/core/runner/run-notification-lane.js +1 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.js +1 -1
- package/dist/core/runner/runtask.js +3 -0
- package/dist/core/runner/stream-mode-verb.d.ts +27 -0
- package/dist/core/runner/stream-mode-verb.js +19 -0
- package/dist/core/runner/turn-attachments.d.ts +3 -3
- package/dist/core/runner/turn-attachments.js +1 -1
- package/dist/core/runner/write-protection-station.d.ts +7 -1
- package/dist/core/runner/write-protection-station.js +6 -3
- package/dist/core/runner-deps.d.ts +31 -34
- package/dist/core/runtime-caps.d.ts +12 -3
- package/dist/core/safety-axis-vocab.d.ts +2 -2
- package/dist/core/safety-axis-vocab.js +1 -1
- package/dist/core/sensitive-path-policy.d.ts +4 -2
- package/dist/core/sensitive-path-policy.js +39 -30
- package/dist/core/task-event.d.ts +1 -1
- package/dist/core/task-result.d.ts +1 -1
- package/dist/core/task-spec.d.ts +41 -89
- package/dist/core/task-stream.d.ts +16 -0
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tighten-task-spec.d.ts +2 -2
- package/dist/core/tighten-task-spec.js +12 -14
- package/dist/core/tool-catalog-entries.js +4 -3
- package/dist/core/tool-policy.d.ts +54 -25
- package/dist/core/tool-policy.js +43 -2
- package/dist/core/tool-registry.d.ts +2 -0
- package/dist/core/tool-registry.js +3 -0
- package/dist/core/tool-spec.d.ts +8 -9
- package/dist/core/trace.d.ts +7 -6
- package/dist/core/types.d.ts +2 -1
- package/dist/core/wiring-manifest.d.ts +31 -5
- package/dist/core/wiring-manifest.js +28 -1
- package/dist/core/write-protect.d.ts +11 -1
- package/dist/core/write-protect.js +26 -15
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
- package/dist/engine/execution-env/node-execution-env.js +11 -1
- package/dist/engine/harness/types.d.ts +6 -7
- package/dist/engine/llm/types.d.ts +2 -4
- package/dist/engine/loop/types.d.ts +7 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.js +12 -3
- package/dist/orchestration/workflow-governance.js +1 -1
- package/dist/orchestration/workflow-primitives.d.ts +1 -1
- package/dist/orchestration/workflow-size-guideline.js +2 -2
- package/dist/tools/artifact/artifact-tool.d.ts +17 -0
- package/dist/tools/artifact/artifact-tool.js +16 -1
- package/dist/tools/fs/bash-readonly-classifier.d.ts +28 -7
- package/dist/tools/fs/bash-readonly-classifier.js +88 -0
- package/dist/tools/fs/containment-face.d.ts +9 -3
- package/dist/tools/fs/containment-face.js +2 -0
- package/dist/tools/fs/file-read-check.d.ts +49 -0
- package/dist/tools/fs/file-read-check.js +71 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-read.d.ts +1 -0
- package/dist/tools/fs/fs-search-tools.d.ts +2 -2
- package/dist/tools/fs/fs-search-tools.js +4 -4
- package/dist/tools/fs/fs-shared.js +20 -6
- package/dist/tools/fs/fs-write.d.ts +4 -3
- package/dist/tools/fs/fs-write.js +9 -9
- package/dist/tools/fs/index.d.ts +39 -3
- package/dist/tools/fs/index.js +38 -15
- package/dist/tools/fs/read-deny-home.d.ts +93 -0
- package/dist/tools/fs/read-deny-home.js +225 -0
- package/dist/tools/fs/read-deny.d.ts +176 -34
- package/dist/tools/fs/read-deny.js +268 -61
- package/dist/tools/fs/safety.d.ts +6 -1
- package/dist/tools/fs/safety.js +18 -5
- package/dist/tools/fs/search.d.ts +3 -0
- package/dist/tools/fs/search.js +47 -9
- package/dist/tools/fs/shell-read-check.d.ts +42 -11
- package/dist/tools/fs/shell-read-check.js +188 -13
- package/dist/tools/fs/shell-read-establish.d.ts +7 -3
- package/dist/tools/fs/shell-read-establish.js +134 -21
- package/dist/tools/fs/shell-read-identity.d.ts +7 -0
- package/dist/tools/fs/shell-read-identity.js +21 -0
- package/dist/tools/fs/shell-read-judge.d.ts +92 -32
- package/dist/tools/fs/shell-read-judge.js +43 -18
- package/dist/tools/fs/shell-read-plan.d.ts +4 -0
- package/dist/tools/fs/shell-read-plan.js +26 -4
- package/dist/tools/fs/shell-read-write-targets.d.ts +73 -0
- package/dist/tools/fs/shell-read-write-targets.js +173 -0
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +103 -11
- package/wire-changes/core@7.34.0.json +2621 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The ORIGIN of a surviving `ask` — WHICH AUTHORITY raised it, or took it over — as one word from a
|
|
3
|
-
* closed set
|
|
4
|
-
*
|
|
3
|
+
* closed set; and, below it, the ask's CLASS SET, the mode × class arbitration table and the one predicate a
|
|
4
|
+
* permission mode is read through.
|
|
5
5
|
*
|
|
6
6
|
* Why an axis of its own. The tool gate has several automatic ask-resolution lanes (the auto-mode
|
|
7
7
|
* classifier today; the persisted-rule lane and the sandbox-admission leg are the same shape), and each
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* one was a silent loosening (the new ask fell into whichever lane nobody had excluded it from).
|
|
13
13
|
*
|
|
14
14
|
* The replacement: the gate derives the origin ONCE from the facts its layers established
|
|
15
|
-
* ({@link askOriginOf})
|
|
16
|
-
*
|
|
17
|
-
* ({@link AssertAllKeysHandled}). Adding a kind of ask is then: one
|
|
18
|
-
* derivation, one row
|
|
19
|
-
* default for an unconsidered
|
|
15
|
+
* ({@link askOriginOf}) and stamps it on the surviving ask as the DISCLOSED word; the lanes read the ask's
|
|
16
|
+
* class SET ({@link classifyAsk}) folded onto one row of a table that MUST name every class
|
|
17
|
+
* ({@link MODE_ARBITRATION}, fenced by {@link AssertAllKeysHandled}). Adding a kind of ask is then: one
|
|
18
|
+
* class here, one arm in the derivation, one row in the table — and the compiler refuses the build until
|
|
19
|
+
* the row exists, so the default for an unconsidered class is a red build, never a silent allow.
|
|
20
20
|
*
|
|
21
21
|
* What is and is not an origin. An origin is WHO raised the question. Two facts that ride beside it
|
|
22
22
|
* are deliberately not origins: `requiresRealApproval` says what may CLEAR the question (a governance
|
|
@@ -42,14 +42,13 @@ import type { PermissionResult } from "./tool-policy.js";
|
|
|
42
42
|
* lane may answer it).
|
|
43
43
|
* - `org_rule` — an organization policy rule asked (or stamped an existing ask): "no configuration
|
|
44
44
|
* clears this, a person nods".
|
|
45
|
-
* - `rule_store_unavailable` — the
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* answer, what clears it, what the evidence records) are identical, and only the mechanism differs.
|
|
45
|
+
* - `rule_store_unavailable` — the person's rule store WAS read, but the CALL could not be read against
|
|
46
|
+
* their standing deny/ask rows (the tightening lexer's `unreadable` word: an expansion where a rule
|
|
47
|
+
* reads a word, an unterminated quote, a syntax error — the answer's `reason`): whether one of those
|
|
48
|
+
* rows forbids this call is unknown, so an allow tightens to an ask a person must clear and no automatic
|
|
49
|
+
* lane may answer. A store that could not be READ is not this word: its rows take no part in the
|
|
50
|
+
* decision (the call is judged as if the person had no persisted rows) and the run carries one
|
|
51
|
+
* `permission.rule_store_unavailable` notice instead.
|
|
53
52
|
* - `hook` — a deployment's PreToolUse screening face raised or co-raised the ask; the word is
|
|
54
53
|
* engine-stamped at the fold and is the deployment's own per-call adjudication.
|
|
55
54
|
* - `ask_rule` — an EXPLICIT `ask` permission rule matched: a person's standing "ask me each time",
|
|
@@ -57,7 +56,7 @@ import type { PermissionResult } from "./tool-policy.js";
|
|
|
57
56
|
* - `denial_limit_fallback` — the auto-mode classifier reached its denial bound and handed the call
|
|
58
57
|
* to a person; the classifier stands BEFORE this ask, never after it.
|
|
59
58
|
* - `shell_gate_tighten` — the gate's own irreversibility tighten raised the ask over a tier the COARSE
|
|
60
|
-
*
|
|
59
|
+
* shell seat installed (the shape tier on every full shell, or the `shellGate: "always"` floor), not an
|
|
61
60
|
* explicit per-tool mark. The gate records that its own tighten spoke; a policy stamping
|
|
62
61
|
* `decisionReason: "safety"` on its own ask does not become one.
|
|
63
62
|
* - `safety_tighten` — the gate's own post-fold tightens over an EXPLICIT fact of the call: the tool's
|
|
@@ -84,23 +83,6 @@ export declare function isAskOrigin(v: unknown): v is AskOrigin;
|
|
|
84
83
|
* other direction (a row for a word that is not in the set).
|
|
85
84
|
*/
|
|
86
85
|
export type AssertAllKeysHandled<T extends never> = T;
|
|
87
|
-
/**
|
|
88
|
-
* WHICH mechanism left the persisted-rule lane unable to enforce the person's deny/ask rows for a call —
|
|
89
|
-
* the two-word set behind the one origin word `rule_store_unavailable` (the AUTHORITY semantics are
|
|
90
|
-
* identical; the mechanism differs, and a consumer that renders "the store is down" for a call the lexer
|
|
91
|
-
* could not read is telling the person to fix the wrong thing):
|
|
92
|
-
* - `store` — the wired store could not be READ for this call (a read failure, a timeout, a thrown adapter);
|
|
93
|
-
* - `call` — the store was read, but the CALL could not be read against the person's rows (the
|
|
94
|
-
* tightening lexer's `unreadable` word: an expansion where a rule reads a word, an unterminated quote,
|
|
95
|
-
* a syntax error — the ask's message carries the lexer's own sentence).
|
|
96
|
-
* The gate reads the lane's answer ONCE into {@link AskOriginFacts.ruleStore}, derives the origin from it and
|
|
97
|
-
* stamps the word onto the surviving ask (`ruleStoreUnreadable`), which the approval request and the durable
|
|
98
|
-
* row carry beside `origin`.
|
|
99
|
-
*/
|
|
100
|
-
export declare const RULE_STORE_UNREADABLE_KINDS: readonly ["store", "call"];
|
|
101
|
-
export type RuleStoreUnreadable = (typeof RULE_STORE_UNREADABLE_KINDS)[number];
|
|
102
|
-
/** Membership test for {@link RuleStoreUnreadable} — the screen a row reader applies to a stored word. */
|
|
103
|
-
export declare function isRuleStoreUnreadable(v: unknown): v is RuleStoreUnreadable;
|
|
104
86
|
/** The facts about one call that only the gate holds — the derivation's inputs beyond the decision
|
|
105
87
|
* itself. Every member is a plain boolean/word read ONCE by the gate, so the derivation is a pure
|
|
106
88
|
* function that a test can drive arm by arm. */
|
|
@@ -113,10 +95,11 @@ export interface AskOriginFacts {
|
|
|
113
95
|
* read-back off the decision (a policy can put `decisionReason: "org_rule"` on its own ask; the
|
|
114
96
|
* gate's cell cannot be written by a policy). */
|
|
115
97
|
readonly org: "rule" | "unavailable" | undefined;
|
|
116
|
-
/** The gate's own record of its persisted-rule lane's READ:
|
|
117
|
-
*
|
|
118
|
-
* the call
|
|
119
|
-
|
|
98
|
+
/** The gate's own record of its persisted-rule lane's READ: the store was read, but THIS CALL could not be read
|
|
99
|
+
* against the person's deny/ask rows (the lane's answer carried the lexer's reason) — the origin
|
|
100
|
+
* `rule_store_unavailable`. Absent: the lane read the call, or its store could not be read and its rows took no
|
|
101
|
+
* part. Written only by the gate. */
|
|
102
|
+
readonly ruleCallUnreadable?: boolean;
|
|
120
103
|
/** Which of the gate's OWN post-fold tightens minted the standing ask, if one did — again the gate's
|
|
121
104
|
* record of its own layer (a tighten replaces an `allow` wholesale, so at most one fires per pass),
|
|
122
105
|
* never a read-back of `decisionReason: "safety"` off a decision a policy could have composed. */
|
|
@@ -144,7 +127,7 @@ export declare function askOriginOf(decision: Extract<PermissionResult, {
|
|
|
144
127
|
* Stamp the ask's origin word — and withdraw the disclosures that speak for the TIGHTEN alone when some
|
|
145
128
|
* layer above it is the reason this call is being asked about. Today that is one member: the read
|
|
146
129
|
* boundary's directory offer, whose claim holds only while the tighten is the whole reason. Every higher
|
|
147
|
-
* rung is a layer with a reason of its own — a standing `ask` row,
|
|
130
|
+
* rung is a layer with a reason of its own — a standing `ask` row, a call unreadable against the rows, an org
|
|
148
131
|
* verdict, a hook, the denial-limit fallback — which no directory grant answers, so the ask would stand
|
|
149
132
|
* after the grant and the offer would have promised a clearing it cannot deliver (measured: `cat
|
|
150
133
|
* <out-of-root>` under a standing `Bash(cat:*)` ask rule offered the directory and kept asking after it).
|
|
@@ -222,6 +205,8 @@ export interface RuleClearanceFacts {
|
|
|
222
205
|
/** An EXPLICIT `ask` permission rule matched this call (DSL, stamped at the rule policy's three
|
|
223
206
|
* matched-ask exits — bare, covering and param). */
|
|
224
207
|
matchedAskRule?: string;
|
|
208
|
+
/** The ask was minted by the deployment's own governance layer (see {@link import("./tool-policy.js").PermissionResult}). */
|
|
209
|
+
authoredBy?: "deployment";
|
|
225
210
|
/** The engine-stamped probe mandate (the reversibility probe declared this call's demotion
|
|
226
211
|
* structural — for the built-in shell probe, a read outside the session's allowed directories). */
|
|
227
212
|
probeMandated?: boolean;
|
|
@@ -230,6 +215,9 @@ export interface RuleClearanceFacts {
|
|
|
230
215
|
/** The ask is being resolved at an ANCESTOR's frozen approver (the three inherited-lane mint sites
|
|
231
216
|
* pass it literally) — this task's rule lane never adjudicates it. */
|
|
232
217
|
ancestorResolved?: boolean;
|
|
218
|
+
/** The classes of the contributors the policy fold carried under this ask (see {@link import("./tool-policy.js").PermissionResult});
|
|
219
|
+
* a member whose row no rule may clear keeps the question a person's. */
|
|
220
|
+
foldedAskClasses?: readonly AskClass[];
|
|
233
221
|
}
|
|
234
222
|
/** The ask FACE's mandate members — the bit and its table word, spread at the four mint stations and the
|
|
235
223
|
* park row. The stations hand it the SAME facts object they hand the rule-offer factory, so the card's word
|
|
@@ -239,6 +227,7 @@ export interface RuleClearanceFacts {
|
|
|
239
227
|
export declare function askMandateMember(ask: RuleClearanceFacts | undefined): {
|
|
240
228
|
mandated?: true;
|
|
241
229
|
mandate?: PersistedRuleMandate;
|
|
230
|
+
authoredBy?: "deployment";
|
|
242
231
|
};
|
|
243
232
|
/** The clearance facts of an ask the engine did not construct (a policy's verdict), each member read ONCE into
|
|
244
233
|
* an engine-owned value — for a station that keeps the answer past its own side effects, where the verdict's
|
|
@@ -280,64 +269,13 @@ export declare const ORIGIN_IMPLIES_REAL_APPROVAL: {
|
|
|
280
269
|
};
|
|
281
270
|
/** The fence over the consistency table: `never` while every origin has a row. */
|
|
282
271
|
export type RealApprovalTableCoversEveryOrigin = AssertAllKeysHandled<Exclude<AskOrigin, keyof typeof ORIGIN_IMPLIES_REAL_APPROVAL>>;
|
|
283
|
-
/**
|
|
284
|
-
* The auto-mode CLASSIFIER's table: may a live classifier verdict resolve an ask of this origin?
|
|
285
|
-
*
|
|
286
|
-
* The classifier is the deployment's delegate for CLASSIFY-doctrine hesitation — the `policy` family,
|
|
287
|
-
* and ONLY it. Every other origin is a question the classifier is structurally the wrong party to
|
|
288
|
-
* answer, each for its own reason (kept beside its row so the reason travels with the fact):
|
|
289
|
-
* - `content_question`: a permission decider's verdict is neither an answer nor a park — letting it
|
|
290
|
-
* speak would skip the durable mandate, the park and the content route in one step.
|
|
291
|
-
* - `ancestor_marked`: a marked call must reach the park with no synchronous decision-maker between.
|
|
292
|
-
* - `org_unavailable` / `org_rule`: judgment may clear a `requiresRealApproval` bit a POLICY minted,
|
|
293
|
-
* but not the org's — while adjudication is unavailable the org's answer is unknown, and an org
|
|
294
|
-
* ask carries the org's own "a person nods" semantic.
|
|
295
|
-
* - `rule_store_unavailable`: the person's own deny/ask rows are unreadable — whether one forbids this
|
|
296
|
-
* call is unknown, and a classifier verdict would answer that question in the person's stead.
|
|
297
|
-
* - `hook`: the deployment's own per-call adjudication; the classifier is its delegate for
|
|
298
|
-
* hesitation, not an override for its screening face.
|
|
299
|
-
* - `ask_rule`: a person's standing "ask me each time" — the classifier answering it would decide
|
|
300
|
-
* whether the person is asked at all, which is the rule's whole content.
|
|
301
|
-
* - `denial_limit_fallback`: the classifier already spoke (its bound is what minted this ask); an
|
|
302
|
-
* allow here would un-say the fallback, a block would count it twice.
|
|
303
|
-
* - `shell_gate_tighten` / `safety_tighten`: YES — the engine's own tightens are hesitation the
|
|
304
|
-
* deployment armed the classifier to resolve (the classify doctrine's whole point for the shell
|
|
305
|
-
* tier; the safety marks make the ask NON-BUDGETABLE at the durable park, a different axis from who
|
|
306
|
-
* may answer it live).
|
|
307
|
-
* A PROBE mandate riding the same `shell_gate_tighten` word (a read-boundary / out-of-root /
|
|
308
|
-
* recursive-read probe verdict, or a probe that did not answer) is NOT this table's to admit: the
|
|
309
|
-
* gate's mandate table excludes it at both classifier stations, the way the allow layer
|
|
310
|
-
* excludes it from a standing rule. This table says which QUESTIONS are the classifier's; the probe
|
|
311
|
-
* words say which asks are nobody's but a person's.
|
|
312
|
-
* - `policy`: YES — including a safety policy's `requiresRealApproval` ask (a live verdict is
|
|
313
|
-
* judgment, and arming auto mode is the deployment's explicit choice to let the classifier be the
|
|
314
|
-
* explicit ask-resolution for those classes).
|
|
315
|
-
* Exclusion is skip-not-deny: the ask flows the original chain (park / approver / headless deny) —
|
|
316
|
-
* narrower autonomy, never a lost ask.
|
|
317
|
-
*/
|
|
318
|
-
declare const CLASSIFIER_MAY_ANSWER: {
|
|
319
|
-
readonly content_question: false;
|
|
320
|
-
readonly ancestor_marked: false;
|
|
321
|
-
readonly org_unavailable: false;
|
|
322
|
-
readonly org_rule: false;
|
|
323
|
-
readonly rule_store_unavailable: false;
|
|
324
|
-
readonly hook: false;
|
|
325
|
-
readonly ask_rule: false;
|
|
326
|
-
readonly denial_limit_fallback: false;
|
|
327
|
-
readonly shell_gate_tighten: true;
|
|
328
|
-
readonly safety_tighten: true;
|
|
329
|
-
readonly policy: true;
|
|
330
|
-
};
|
|
331
|
-
/** The fence over the classifier table: `never` while every origin has a row (pinned by a type test). */
|
|
332
|
-
export type ClassifierTableCoversEveryOrigin = AssertAllKeysHandled<Exclude<AskOrigin, keyof typeof CLASSIFIER_MAY_ANSWER>>;
|
|
333
|
-
/** Whether the auto-mode classifier may resolve an ask of this origin (see the table's contract). */
|
|
334
|
-
export declare function classifierMayAnswer(origin: AskOrigin): boolean;
|
|
335
272
|
/**
|
|
336
273
|
* The MANDATE family — the closed set of words for "this ask stands by STRUCTURE, so a standing allow
|
|
337
|
-
* rule may not retire it".
|
|
338
|
-
* (
|
|
274
|
+
* rule may not retire it". A DISCLOSURE vocabulary: the word rides the approval card and the park row
|
|
275
|
+
* ({@link persistedRuleMandateOf} picks one), while what a live lane may do with the ask is decided by
|
|
276
|
+
* the ask's CLASS SET ({@link classifyAsk}, {@link MODE_ARBITRATION}) — never by this one word.
|
|
339
277
|
*
|
|
340
|
-
* - `operator_always` — the
|
|
278
|
+
* - `operator_always` — the operator's `always` floor: per-call confirmation for shell commands.
|
|
341
279
|
* - `tool_marks` — the tool's own egress / irreversibility declaration.
|
|
342
280
|
* - `probe_mandate` — this call's reversibility probe declared the demotion STRUCTURAL.
|
|
343
281
|
* - `probe_unanswered` — the probe was consulted and did not answer: the boundary is UNKNOWN.
|
|
@@ -350,53 +288,6 @@ export declare const PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool
|
|
|
350
288
|
export type PersistedRuleMandate = (typeof PERSISTED_RULE_MANDATES)[number];
|
|
351
289
|
/** Membership test for {@link PersistedRuleMandate} — the screen a row reader applies to a stored word. */
|
|
352
290
|
export declare function isPersistedRuleMandate(v: unknown): v is PersistedRuleMandate;
|
|
353
|
-
/**
|
|
354
|
-
* May a LIVE automatic lane answer an ask carrying this word? (The persisted-rule lane is not among
|
|
355
|
-
* them — every word binds it.) TWO COLUMNS, because the two lanes are not asking one question: the
|
|
356
|
-
* sandbox-admission leg asks whether CONTAINMENT already holds what this call would do, while the
|
|
357
|
-
* classifier asks whether the question itself is one a model verdict may settle. Five of the six words
|
|
358
|
-
* happen to answer both the same way today; that is a coincidence of those words, not an invariant, and
|
|
359
|
-
* the columns exist so the sixth does not have to lie in one of them. Each row's reason:
|
|
360
|
-
* - `write_protection`: yes — upstream parity (that judge runs BEFORE the general allow rules and marks
|
|
361
|
-
* its ask classifier-approvable); what is refused is a standing rule answering "may this agent rewrite
|
|
362
|
-
* its own configuration?" once, for good.
|
|
363
|
-
* - `write_protection_unresolved`: CLASSIFIER no — the table's answer for this call is unknown, and a
|
|
364
|
-
* verdict clearing it would answer a question the engine could not put. SANDBOX yes — containment
|
|
365
|
-
* holds the effect whether or not the target is on the table, which is the leg's whole doctrine, and
|
|
366
|
-
* an isolated environment that cannot resolve a path is the ordinary reason this word appears.
|
|
367
|
-
*/
|
|
368
|
-
declare const MANDATE_LANE_ANSWERS: {
|
|
369
|
-
readonly operator_always: {
|
|
370
|
-
readonly classifier: true;
|
|
371
|
-
readonly sandboxAdmission: true;
|
|
372
|
-
};
|
|
373
|
-
readonly tool_marks: {
|
|
374
|
-
readonly classifier: true;
|
|
375
|
-
readonly sandboxAdmission: true;
|
|
376
|
-
};
|
|
377
|
-
readonly probe_mandate: {
|
|
378
|
-
readonly classifier: false;
|
|
379
|
-
readonly sandboxAdmission: false;
|
|
380
|
-
};
|
|
381
|
-
readonly probe_unanswered: {
|
|
382
|
-
readonly classifier: false;
|
|
383
|
-
readonly sandboxAdmission: false;
|
|
384
|
-
};
|
|
385
|
-
readonly write_protection: {
|
|
386
|
-
readonly classifier: true;
|
|
387
|
-
readonly sandboxAdmission: true;
|
|
388
|
-
};
|
|
389
|
-
readonly write_protection_unresolved: {
|
|
390
|
-
readonly classifier: false;
|
|
391
|
-
readonly sandboxAdmission: true;
|
|
392
|
-
};
|
|
393
|
-
};
|
|
394
|
-
/** The fence over the mandate table: `never` while every word has a row. */
|
|
395
|
-
export type MandateTableCoversEveryMandate = AssertAllKeysHandled<Exclude<PersistedRuleMandate, keyof typeof MANDATE_LANE_ANSWERS>>;
|
|
396
|
-
/** Whether the auto-mode CLASSIFIER may answer an ask carrying this word; `undefined` (no mandate) admits it. */
|
|
397
|
-
export declare function classifierMayAnswerMandate(mandate: PersistedRuleMandate | undefined): boolean;
|
|
398
|
-
/** Whether the SANDBOX-ADMISSION leg may admit an ask carrying this word — the other column. */
|
|
399
|
-
export declare function sandboxMayAdmitMandate(mandate: PersistedRuleMandate | undefined): boolean;
|
|
400
291
|
/** WHY a matching persisted allow rule did not clear the ask, in the sentence a PERSON reads — one row per
|
|
401
292
|
* word (the ladder this replaces ended in a catch-all arm). Display prose; nothing reads it back to decide. */
|
|
402
293
|
declare const MANDATE_DISCLOSURE: {
|
|
@@ -423,11 +314,11 @@ export declare function mandateDisclosureOf(mandate: PersistedRuleMandate | unde
|
|
|
423
314
|
* are properties of the TOOL and are true of every call on the seat, so a mandate that is true of
|
|
424
315
|
* this one call must not be shadowed by the tier that happens to carry it (#502: the built-in
|
|
425
316
|
* shell probe raises it for a listed reader naming a path outside the session's roots — a boundary
|
|
426
|
-
* the deployment declared, which is exactly what the
|
|
317
|
+
* the deployment declared, which is exactly what the shape tier alone cannot say);
|
|
427
318
|
* · `egress` — the tool's own external-write mark, judged next: it is the tool's declaration even
|
|
428
|
-
* when the
|
|
429
|
-
* · `shellGated` + tier `"always"` — the operator's per-call confirmation
|
|
430
|
-
* (`"operator_always"`); the shell seat installs `"maybe"
|
|
319
|
+
* when the shell seat also installed a tier on the same name;
|
|
320
|
+
* · `shellGated` + tier `"always"` — the operator's `always` floor, a per-call confirmation
|
|
321
|
+
* (`"operator_always"`); without the floor the shell seat installs the shape tier's `"maybe"`,
|
|
431
322
|
* and THOSE asks stay the rule lane's home turf (`undefined`) — that is the don't-ask-again main case, and the per-call member
|
|
432
323
|
* above is deliberately the ONLY thing that carves a mandate out of it;
|
|
433
324
|
* · a tool's OWN `"always"`/`"maybe"` irreversibility tier without the doctrine (`"tool_marks"`).
|
|
@@ -455,8 +346,9 @@ export interface MandateMarks {
|
|
|
455
346
|
* {@link import("./types.js").ReversibilityVerdict.mandated}. */
|
|
456
347
|
probeMandated?: boolean;
|
|
457
348
|
/** The gate's own record that the write-protection judge covered this call and its table MATCHED
|
|
458
|
-
* (`GatePass.writeProtected`, written at the fourth post-fold tighten and
|
|
459
|
-
* like the org words: it rides the pass, not the decision, so no
|
|
349
|
+
* (`GatePass.writeProtected`, written at the fourth post-fold tighten for a write tool's target and by the read station
|
|
350
|
+
* for a shell command's written targets). A GATE fact like the org words: it rides the pass, not the decision, so no
|
|
351
|
+
* layer outside the engine declares it. */
|
|
460
352
|
writeProtected?: boolean;
|
|
461
353
|
/** The same record for the judge's other non-clear verdict — consulted, could not RESOLVE the target.
|
|
462
354
|
* The pair is the write face's twin of `probeMandated` / `probeUnanswered`, mutually exclusive. */
|
|
@@ -478,7 +370,7 @@ export interface MandateMarks {
|
|
|
478
370
|
* probe judged THIS command not reversible). A policy ask on a shell-gated tool that the doctrine's probe
|
|
479
371
|
* did not tighten and did not mandate is a plain ask: the tier was the probe's instrument, not a risk
|
|
480
372
|
* label, and the park stays the budgetable kind. Before this derivation the static tier alone set the bit,
|
|
481
|
-
* so every policy ask on
|
|
373
|
+
* so every policy ask on the full shell face parked non-budgetable.
|
|
482
374
|
*
|
|
483
375
|
* Deliberately NOT the rule-lane predicate verbatim: a shell tighten's ask is rule-clearable (a person's
|
|
484
376
|
* past yes to this command shape stands) yet non-budgetable (a budget's mechanical yes is not a person's).
|
|
@@ -491,11 +383,316 @@ export declare function safetyAxisOf(marks: MandateMarks & {
|
|
|
491
383
|
irreversible: boolean;
|
|
492
384
|
shell?: boolean;
|
|
493
385
|
} | undefined;
|
|
494
|
-
/**
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
386
|
+
/**
|
|
387
|
+
* The permission-mode closed set — the ONE key a caller sets (`TaskSpec.permissionMode`), spelled as the wire and
|
|
388
|
+
* the reference implementation spell it. A root task's absent key reads `default`; a child's absent key inherits
|
|
389
|
+
* its parent's effective mode ({@link clampPermissionMode}).
|
|
390
|
+
*/
|
|
391
|
+
export declare const PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
|
|
392
|
+
export type PermissionMode = (typeof PERMISSION_MODES)[number];
|
|
393
|
+
/** Membership test for {@link PermissionMode} — the word crosses process boundaries (a request body, a checkpoint row). */
|
|
394
|
+
export declare function isPermissionMode(v: unknown): v is PermissionMode;
|
|
395
|
+
/**
|
|
396
|
+
* The reference implementation's mode RANK, used for one thing only: a child's declared mode may not outrank
|
|
397
|
+
* the ceiling its parent hands down (a declaration is adopted iff `rank[declared] <= rank[ceiling]`, and
|
|
398
|
+
* `acceptEdits` / `auto` are incomparable). It is a clamping relation, not a per-class strictness order —
|
|
399
|
+
* `default` and `dontAsk` share a rank, and whether a mode releases a given ask is {@link MODE_ARBITRATION}'s.
|
|
400
|
+
*/
|
|
401
|
+
export declare const PERMISSION_MODE_RANK: {
|
|
402
|
+
readonly plan: 0;
|
|
403
|
+
readonly default: 1;
|
|
404
|
+
readonly dontAsk: 1;
|
|
405
|
+
readonly acceptEdits: 2;
|
|
406
|
+
readonly auto: 3;
|
|
407
|
+
readonly bypassPermissions: 4;
|
|
408
|
+
};
|
|
409
|
+
/** The fence over the rank table: `never` while every mode has a rank. */
|
|
410
|
+
export type RankTableCoversEveryMode = AssertAllKeysHandled<Exclude<PermissionMode, keyof typeof PERMISSION_MODE_RANK>>;
|
|
411
|
+
/**
|
|
412
|
+
* Clamp a child's DECLARED mode under its parent's ceiling. An absent declaration inherits the ceiling; a
|
|
413
|
+
* declaration the rank table does not admit under the ceiling is folded back to the ceiling (`clamped: true`
|
|
414
|
+
* — the caller discloses it, never silently). `bypassPermissions` is adopted only under a `bypassPermissions`
|
|
415
|
+
* parent, and the incomparable pair (`acceptEdits` ↔ `auto`) is never adopted across.
|
|
416
|
+
*/
|
|
417
|
+
export declare function clampPermissionMode(declared: PermissionMode | undefined, ceiling: PermissionMode): {
|
|
418
|
+
effective: PermissionMode;
|
|
419
|
+
clamped: boolean;
|
|
420
|
+
};
|
|
421
|
+
/** WHO put a tool's egress / irreversibility mark on the seat — the deployment's own declaration (`spec.tools`),
|
|
422
|
+
* a protocol server's self-report (MCP annotations), or the A2A default (every peer skill is an external write). */
|
|
423
|
+
export type ToolMarkSource = "deployment" | "mcp_annotation" | "a2a_default";
|
|
424
|
+
/**
|
|
425
|
+
* The ask CLASS set — WHY a surviving ask exists, as the set of authorities that stand behind it. One ask can
|
|
426
|
+
* belong to several classes at once (a hook door and an org verdict on one call); a class is derived from the
|
|
427
|
+
* FACTS the gate's layers established ({@link classifyAsk}), never from the disclosed `origin` / `mandate`
|
|
428
|
+
* words, which are single-winner projections and hide the members behind them. The array ORDER decides one
|
|
429
|
+
* thing only: which member is the DISCLOSED word (`askClass`) when several hold — the door-before-word,
|
|
430
|
+
* most-immune-first order; every lane reads the folded row ({@link foldArbitrationRow}), never the word.
|
|
431
|
+
*/
|
|
432
|
+
export declare const ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "unverifiable_delete", "transcript_write", "org_rule", "governance_unavailable", "rule_unreadable", "ask_rule", "denial_limit_fallback", "operator_forced", "write_protection_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "policy_rra", "artifact_shared_read", "mode", "ordinary"];
|
|
433
|
+
export type AskClass = (typeof ASK_CLASSES)[number];
|
|
434
|
+
/** Membership test for {@link AskClass} — the word crosses the wire on `tool_end.gate.disposition`. */
|
|
435
|
+
export declare function isAskClass(v: unknown): v is AskClass;
|
|
436
|
+
/** The four switches a class carries, one row per class ({@link MODE_ARBITRATION}). */
|
|
437
|
+
export interface ModeArbitrationRow {
|
|
438
|
+
/** The ask still reaches a person under `bypassPermissions` (the reference implementation's `bypassImmune`). */
|
|
439
|
+
readonly bypassImmune: boolean;
|
|
440
|
+
/** The auto-mode classifier may answer it. */
|
|
441
|
+
readonly classifierEligible: boolean;
|
|
442
|
+
/** The sandbox-admission leg may admit it (containment holds the effect). */
|
|
443
|
+
readonly sandboxAdmission: boolean;
|
|
444
|
+
/** A persisted allow rule may clear it. */
|
|
445
|
+
readonly ruleMayClear: boolean;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* The mode × class table. `bypassImmune` is the one new column (nothing said it before); the classifier and
|
|
449
|
+
* sandbox columns are the fold of the two former per-word lane tables (only `probe` moved: the classifier may
|
|
450
|
+
* now answer it — the read boundary's unestablishable spelling is fed to it as a deny-table row instead), and
|
|
451
|
+
* `ruleMayClear` restates {@link ruleClearanceOf}'s conclusion per class (a real-approval bit is never rule-clearable).
|
|
452
|
+
* `mode` is the permission mode's OWN question (`plan`'s two sentences, `decisionReason: "mode"`): the reference
|
|
453
|
+
* implementation puts it to a person past every allow rule and never to an automatic lane, and its bypass conversion
|
|
454
|
+
* releases it like any other non-immune ask.
|
|
455
|
+
*/
|
|
456
|
+
export declare const MODE_ARBITRATION: {
|
|
457
|
+
readonly content_question: {
|
|
458
|
+
readonly bypassImmune: true;
|
|
459
|
+
readonly classifierEligible: false;
|
|
460
|
+
readonly sandboxAdmission: false;
|
|
461
|
+
readonly ruleMayClear: false;
|
|
462
|
+
};
|
|
463
|
+
readonly hook: {
|
|
464
|
+
readonly bypassImmune: true;
|
|
465
|
+
readonly classifierEligible: false;
|
|
466
|
+
readonly sandboxAdmission: false;
|
|
467
|
+
readonly ruleMayClear: false;
|
|
468
|
+
};
|
|
469
|
+
readonly ancestor: {
|
|
470
|
+
readonly bypassImmune: true;
|
|
471
|
+
readonly classifierEligible: false;
|
|
472
|
+
readonly sandboxAdmission: false;
|
|
473
|
+
readonly ruleMayClear: false;
|
|
474
|
+
};
|
|
475
|
+
readonly unverifiable_delete: {
|
|
476
|
+
readonly bypassImmune: true;
|
|
477
|
+
readonly classifierEligible: true;
|
|
478
|
+
readonly sandboxAdmission: false;
|
|
479
|
+
readonly ruleMayClear: false;
|
|
480
|
+
};
|
|
481
|
+
readonly transcript_write: {
|
|
482
|
+
readonly bypassImmune: false;
|
|
483
|
+
readonly classifierEligible: true;
|
|
484
|
+
readonly sandboxAdmission: false;
|
|
485
|
+
readonly ruleMayClear: false;
|
|
486
|
+
};
|
|
487
|
+
readonly org_rule: {
|
|
488
|
+
readonly bypassImmune: true;
|
|
489
|
+
readonly classifierEligible: false;
|
|
490
|
+
readonly sandboxAdmission: false;
|
|
491
|
+
readonly ruleMayClear: false;
|
|
492
|
+
};
|
|
493
|
+
readonly governance_unavailable: {
|
|
494
|
+
readonly bypassImmune: true;
|
|
495
|
+
readonly classifierEligible: false;
|
|
496
|
+
readonly sandboxAdmission: false;
|
|
497
|
+
readonly ruleMayClear: false;
|
|
498
|
+
};
|
|
499
|
+
readonly rule_unreadable: {
|
|
500
|
+
readonly bypassImmune: false;
|
|
501
|
+
readonly classifierEligible: false;
|
|
502
|
+
readonly sandboxAdmission: false;
|
|
503
|
+
readonly ruleMayClear: false;
|
|
504
|
+
};
|
|
505
|
+
readonly ask_rule: {
|
|
506
|
+
readonly bypassImmune: true;
|
|
507
|
+
readonly classifierEligible: false;
|
|
508
|
+
readonly sandboxAdmission: false;
|
|
509
|
+
readonly ruleMayClear: false;
|
|
510
|
+
};
|
|
511
|
+
readonly denial_limit_fallback: {
|
|
512
|
+
readonly bypassImmune: true;
|
|
513
|
+
readonly classifierEligible: false;
|
|
514
|
+
readonly sandboxAdmission: false;
|
|
515
|
+
readonly ruleMayClear: false;
|
|
516
|
+
};
|
|
517
|
+
readonly operator_forced: {
|
|
518
|
+
readonly bypassImmune: true;
|
|
519
|
+
readonly classifierEligible: true;
|
|
520
|
+
readonly sandboxAdmission: true;
|
|
521
|
+
readonly ruleMayClear: false;
|
|
522
|
+
};
|
|
523
|
+
readonly write_protection_unresolved: {
|
|
524
|
+
readonly bypassImmune: true;
|
|
525
|
+
readonly classifierEligible: false;
|
|
526
|
+
readonly sandboxAdmission: true;
|
|
527
|
+
readonly ruleMayClear: false;
|
|
528
|
+
};
|
|
529
|
+
readonly probe: {
|
|
530
|
+
readonly bypassImmune: false;
|
|
531
|
+
readonly classifierEligible: true;
|
|
532
|
+
readonly sandboxAdmission: false;
|
|
533
|
+
readonly ruleMayClear: false;
|
|
534
|
+
};
|
|
535
|
+
readonly write_protection: {
|
|
536
|
+
readonly bypassImmune: false;
|
|
537
|
+
readonly classifierEligible: true;
|
|
538
|
+
readonly sandboxAdmission: true;
|
|
539
|
+
readonly ruleMayClear: false;
|
|
540
|
+
};
|
|
541
|
+
readonly tool_marks_mcp: {
|
|
542
|
+
readonly bypassImmune: false;
|
|
543
|
+
readonly classifierEligible: true;
|
|
544
|
+
readonly sandboxAdmission: true;
|
|
545
|
+
readonly ruleMayClear: false;
|
|
546
|
+
};
|
|
547
|
+
readonly tool_marks_a2a: {
|
|
548
|
+
readonly bypassImmune: false;
|
|
549
|
+
readonly classifierEligible: true;
|
|
550
|
+
readonly sandboxAdmission: true;
|
|
551
|
+
readonly ruleMayClear: false;
|
|
552
|
+
};
|
|
553
|
+
readonly policy_rra: {
|
|
554
|
+
readonly bypassImmune: true;
|
|
555
|
+
readonly classifierEligible: true;
|
|
556
|
+
readonly sandboxAdmission: false;
|
|
557
|
+
readonly ruleMayClear: false;
|
|
558
|
+
};
|
|
559
|
+
readonly artifact_shared_read: {
|
|
560
|
+
readonly bypassImmune: false;
|
|
561
|
+
readonly classifierEligible: false;
|
|
562
|
+
readonly sandboxAdmission: false;
|
|
563
|
+
readonly ruleMayClear: false;
|
|
564
|
+
};
|
|
565
|
+
readonly mode: {
|
|
566
|
+
readonly bypassImmune: false;
|
|
567
|
+
readonly classifierEligible: false;
|
|
568
|
+
readonly sandboxAdmission: false;
|
|
569
|
+
readonly ruleMayClear: false;
|
|
570
|
+
};
|
|
571
|
+
readonly ordinary: {
|
|
572
|
+
readonly bypassImmune: false;
|
|
573
|
+
readonly classifierEligible: true;
|
|
574
|
+
readonly sandboxAdmission: true;
|
|
575
|
+
readonly ruleMayClear: true;
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
/** The fence over the arbitration table: `never` while every class has a row. */
|
|
579
|
+
export type ArbitrationTableCoversEveryClass = AssertAllKeysHandled<Exclude<AskClass, keyof typeof MODE_ARBITRATION>>;
|
|
580
|
+
/** The classes whose own mint puts the `requiresRealApproval` bit on the ask — a bit one of them explains is not
|
|
581
|
+
* the bare bit `policy_rra` names. The mark classes (probe / write protection / tool marks / operator forced)
|
|
582
|
+
* mint no bit and explain none. */
|
|
583
|
+
export declare const RRA_EXPLAINERS: ReadonlySet<AskClass>;
|
|
584
|
+
/** The classes a permission mode can RELEASE (the `bypassImmune: false` rows) — the only words that can appear on
|
|
585
|
+
* `GateDisposition.released.askClass`; every other class reaches a person under every mode. */
|
|
586
|
+
export declare const RELEASABLE_ASK_CLASSES: readonly AskClass[];
|
|
587
|
+
/**
|
|
588
|
+
* The facts the class derivation reads beside the decision: the origin facts the gate holds, plus the tool
|
|
589
|
+
* seat's mark PROVENANCE ({@link ToolMarkSource}; a mark with no source reads as the deployment's, fail-closed),
|
|
590
|
+
* the A2A isolation switch (a set switch turns the A2A default into an operator's mandate), and — at an
|
|
591
|
+
* ancestor station — the classes the ancestor's own ask carries.
|
|
592
|
+
*/
|
|
593
|
+
export interface AskClassFacts extends AskOriginFacts {
|
|
594
|
+
readonly toolMarkSources?: ReadonlySet<ToolMarkSource>;
|
|
595
|
+
readonly a2aIsolatePeers?: boolean;
|
|
596
|
+
readonly ancestorClasses?: ReadonlySet<AskClass>;
|
|
597
|
+
}
|
|
598
|
+
/** The classification the arbitration reads: the whole set, the disclosed word (the set's first member in
|
|
599
|
+
* {@link ASK_CLASSES} order) and the row folded across the set. */
|
|
600
|
+
export interface AskClassification {
|
|
601
|
+
readonly classes: ReadonlySet<AskClass>;
|
|
602
|
+
readonly askClass: AskClass;
|
|
603
|
+
readonly row: ModeArbitrationRow;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* The DECISION half of the class derivation — what ONE ask says about itself through its own members, read
|
|
607
|
+
* per contributing ask at the policy fold so a member the fold does not copy (a guard mark, the unreadable-rule
|
|
608
|
+
* fact) is not lost behind the ask that won the slot. The bare-bit rules are applied over THIS ask's own set:
|
|
609
|
+
* `requiresRealApproval` with no explaining class is `policy_rra`; a self-declared `mandated` with no other
|
|
610
|
+
* class is `operator_forced` (a deployment probe's own mandate, read conservatively). Returns the specific
|
|
611
|
+
* classes only — an empty set is "nothing but hesitation", which the caller reads as `ordinary`.
|
|
612
|
+
*/
|
|
613
|
+
export declare function decisionAskClassesOf(d: Extract<PermissionResult, {
|
|
614
|
+
action: "ask";
|
|
615
|
+
}>): Set<AskClass>;
|
|
616
|
+
/** Fold a class set onto one row: `bypassImmune` by OR (any immune member keeps the ask), the three permissive
|
|
617
|
+
* switches by AND (one refusing member withholds the lane). An empty set is `ordinary`. */
|
|
618
|
+
export declare function foldArbitrationRow(classes: ReadonlySet<AskClass>): ModeArbitrationRow;
|
|
619
|
+
/**
|
|
620
|
+
* The ONE class derivation: the decision half ({@link decisionAskClassesOf}) joined with the gate's own facts —
|
|
621
|
+
* the question tool, an ancestor's mark, the org layer's two arms, the persisted lane's unreadable call, the tool
|
|
622
|
+
* seat's marks with their provenance, the read probe and the write-protection judge's records — then the bare
|
|
623
|
+
* real-approval rule re-read over the WHOLE set (an org verdict explains a bit the policy did not mint). The
|
|
624
|
+
* derivation reads facts and members, never the `origin` / `mandate` words.
|
|
625
|
+
*/
|
|
626
|
+
export declare function classifyAsk(d: Extract<PermissionResult, {
|
|
627
|
+
action: "ask";
|
|
628
|
+
}>, facts: AskClassFacts): AskClassification;
|
|
629
|
+
/** The refusal the model reads when an ask reaches a run with no approver: the reference implementation's sentence
|
|
630
|
+
* (2.1.280) — the call did NOT run because this session has no approval surface — with the run's own fact beside it
|
|
631
|
+
* and the ask's prompt as what was requested. The gate appends the caller-side remedy. */
|
|
632
|
+
export declare function headlessDenialMessage(toolName: string, askMessage: string): string;
|
|
633
|
+
/**
|
|
634
|
+
* The ONE sentence a headless auto-deny (an ask that reached its final deny because no approver is wired) adds
|
|
635
|
+
* after its refusal: the caller-side change that would have let this call run. Read off the effective mode, the
|
|
636
|
+
* ask's folded class row and whether the call is a covered write (the mode write gate's own question):
|
|
637
|
+
* · a class no permission mode releases (`bypassImmune`) — only a person can answer it: wire an approver;
|
|
638
|
+
* · the plan mode's own question (`mode`) — leave plan (steer the mode, or approve the plan) or wire an approver;
|
|
639
|
+
* · the write gate's own ask under `default` / `auto` — `acceptEdits` lets writes inside the working
|
|
640
|
+
* directories through without asking;
|
|
641
|
+
* · the same ask under `acceptEdits` — the target lies outside the working directories: add its directory to
|
|
642
|
+
* `additionalDirectories`;
|
|
643
|
+
* · any other releasable ask — `bypassPermissions` releases it (disclosed on the call).
|
|
644
|
+
* Every arm also names the approver seat. The refusal's tool text and the `delegation.ask_unresolvable` notice
|
|
645
|
+
* both carry this sentence — they call this function, neither spells it.
|
|
646
|
+
*/
|
|
647
|
+
export declare function headlessApprovalRemedy(input: {
|
|
648
|
+
readonly mode: PermissionMode | undefined;
|
|
649
|
+
readonly classification: AskClassification | undefined;
|
|
650
|
+
readonly coveredWrite: boolean;
|
|
651
|
+
readonly unplacedOptions?: {
|
|
652
|
+
readonly program: "cp" | "mv";
|
|
653
|
+
};
|
|
654
|
+
}): string;
|
|
655
|
+
/** The reference implementation's sentence (2.1.280) for a `cp` / `mv` the mode will not answer because it carries option
|
|
656
|
+
* words — the approval card's message under `acceptEdits` and the head of the headless remedy. */
|
|
657
|
+
export declare function fileCommandOptionsSentence(program: "cp" | "mv"): string;
|
|
658
|
+
/** What the mode arbitration decided for one surviving ask. `ask` hands it on unchanged (park / approver); `accepted` is
|
|
659
|
+
* the mode answering an ordinary question itself (`acceptEdits` on one of its file commands — an allow of the mode's own
|
|
660
|
+
* policy, like its in-root write gate, and no release: nothing is disclosed as released);
|
|
661
|
+
* `released` is an allow the mode granted (disclosed on `tool_end.gate.disposition.released`); `denied_by_mode`
|
|
662
|
+
* is a refusal the mode made (`deniedBy: "mode"`). */
|
|
663
|
+
export type Arbitration = {
|
|
664
|
+
kind: "ask";
|
|
665
|
+
} | {
|
|
666
|
+
kind: "accepted";
|
|
667
|
+
mode: "acceptEdits";
|
|
668
|
+
} | {
|
|
669
|
+
kind: "released";
|
|
670
|
+
mode: PermissionMode;
|
|
671
|
+
askClass: AskClass;
|
|
672
|
+
classes: readonly AskClass[];
|
|
673
|
+
origin?: AskOrigin;
|
|
674
|
+
mandate?: PersistedRuleMandate;
|
|
675
|
+
reason?: "rule_unreadable";
|
|
676
|
+
} | {
|
|
677
|
+
kind: "denied_by_mode";
|
|
678
|
+
mode: "bypassPermissions" | "dontAsk";
|
|
679
|
+
askClass: AskClass;
|
|
680
|
+
classes: readonly AskClass[];
|
|
681
|
+
};
|
|
682
|
+
/**
|
|
683
|
+
* The ONE mode read point. `dontAsk` refuses every ask but a hook's and an operator authority's (an org rule, an
|
|
684
|
+
* operator's forced confirmation, unreadable governance — a mode stance may not settle an operator-mandated
|
|
685
|
+
* gate); `bypassPermissions` refuses a write whose protection could not be judged (a person cannot be asked, and
|
|
686
|
+
* releasing would be looser than the allow the judge already refuses), keeps every immune class and releases the
|
|
687
|
+
* rest; `acceptEdits` answers an ORDINARY ask itself on a call the caller vouches is one of the mode's file commands
|
|
688
|
+
* (`call.fileCommand`, `accepted`); `plan`, `default` and `auto` hand every ask on (plan's own questions were raised by
|
|
689
|
+
* its write gate; the reference implementation refuses nothing at this point under plan — auto's classifier reads the
|
|
690
|
+
* row at its own station). Reads the class SET and the folded row — never the disclosed word.
|
|
691
|
+
*/
|
|
692
|
+
export declare function arbitrateByMode(mode: PermissionMode, c: AskClassification, disclosure?: {
|
|
693
|
+
origin?: AskOrigin;
|
|
694
|
+
mandate?: PersistedRuleMandate;
|
|
695
|
+
}, call?: {
|
|
696
|
+
readonly fileCommand?: boolean;
|
|
697
|
+
}): Arbitration;
|
|
501
698
|
export {};
|