@sema-agent/core 7.68.4 → 7.68.6
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 +43 -0
- package/dist/agents/peer-held-queue.d.ts +6 -1
- package/dist/agents/peer-held-queue.js +10 -1
- package/dist/agents/peer-idle.d.ts +3 -1
- package/dist/agents/peer-idle.js +4 -4
- package/dist/agents/peer-session-drain.d.ts +9 -1
- package/dist/agents/peer-session-drain.js +184 -115
- package/dist/core/allow-entry.d.ts +2 -2
- package/dist/core/allow-entry.js +6 -5
- package/dist/core/ask-headline.d.ts +2 -2
- package/dist/core/ask-origin.d.ts +31 -31
- package/dist/core/ask-origin.js +20 -13
- package/dist/core/runner/end-of-run.d.ts +26 -13
- package/dist/core/runner/end-of-run.js +43 -12
- package/dist/core/runner/prepare-task.js +1 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +2 -2
- package/dist/core/runner/runtask.js +2 -2
- package/dist/core/shell-read-silence.d.ts +2 -1
- package/dist/core/tool-policy.d.ts +4 -1
- package/dist/core/tool-policy.js +2 -2
- package/dist/tools/fs/removal-targets.js +7 -7
- package/package.json +2 -2
- package/wire-changes/core-stores-sql@7.68.5.json +39 -0
- package/wire-changes/core-stores-sql@7.68.6.json +39 -0
- package/wire-changes/core@7.68.5.json +141 -0
- package/wire-changes/core@7.68.6.json +125 -0
- package/wire-changes/mods-kernel@7.68.5.json +39 -0
- package/wire-changes/mods-kernel@7.68.6.json +39 -0
- package/wire-changes/primitives@7.68.5.json +39 -0
- package/wire-changes/primitives@7.68.6.json +39 -0
- package/wire-changes/wiki-gate@7.68.5.json +39 -0
- package/wire-changes/wiki-gate@7.68.6.json +39 -0
package/dist/core/allow-entry.js
CHANGED
|
@@ -450,13 +450,12 @@ export function readAllowRuleShadows(value) {
|
|
|
450
450
|
return undefined;
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
+
const ARRIVED_MARKED = "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule";
|
|
453
454
|
export const SHADOW_REASON = Object.freeze({
|
|
454
455
|
content_question: "the call is the engine's own question to a person",
|
|
455
456
|
hook: "an extension's screening asks about this call (a PreToolUse hook or a tool.check station) — the deployment's own screening is answered by a person",
|
|
456
457
|
ancestor: "the task that delegated this one owns this question",
|
|
457
458
|
dangerous_delete: "this removal targets a protected location (the filesystem root, a top-level directory, a home directory, or a workspace directory or one of its ancestors) — it is cleared by confirming this call, never by an allow rule",
|
|
458
|
-
unverifiable_delete: "this removal could not be verified safe — it is cleared by confirming this call, never by an allow rule",
|
|
459
|
-
unverifiable_shell_text: "the text this shell will run cannot be read by the engine — it is cleared by confirming this call, never by an allow rule",
|
|
460
459
|
transcript_write: "this write targets the session transcript — it is cleared by confirming this call, never by an allow rule",
|
|
461
460
|
org_rule: "an organization policy rule requires approval for this call",
|
|
462
461
|
rule_unreadable: "a rule that may govern this call cannot currently be read (this deployment's organization policy, a partition of the person's standing rules, or this call against a deny or ask rule), so whether one forbids it is unknown",
|
|
@@ -465,7 +464,7 @@ export const SHADOW_REASON = Object.freeze({
|
|
|
465
464
|
classifier_no_ruling: "the auto-mode classifier could not judge this call, so a person decides",
|
|
466
465
|
requires_user_interaction: "this tool's server declares that a call must be put to a person",
|
|
467
466
|
cross_boundary: MANDATE_DISCLOSURE.cross_boundary_taint,
|
|
468
|
-
operator_forced:
|
|
467
|
+
operator_forced: ARRIVED_MARKED,
|
|
469
468
|
shell_floor: MANDATE_DISCLOSURE.operator_always,
|
|
470
469
|
target_unresolved: MANDATE_DISCLOSURE.target_unresolved,
|
|
471
470
|
write_protection_on_disk: MANDATE_DISCLOSURE.write_protection,
|
|
@@ -475,8 +474,10 @@ export const SHADOW_REASON = Object.freeze({
|
|
|
475
474
|
policy_rra: "the deployment's policy requires a real approval for this call",
|
|
476
475
|
artifact_shared_read: "this read targets another task's shared artifact — it is cleared by confirming this call",
|
|
477
476
|
mode: "the permission mode puts this question to a person",
|
|
478
|
-
|
|
479
|
-
|
|
477
|
+
unverifiable_delete: ARRIVED_MARKED,
|
|
478
|
+
unverifiable_shell_text: ARRIVED_MARKED,
|
|
479
|
+
unstated: ARRIVED_MARKED,
|
|
480
|
+
ordinary: ARRIVED_MARKED,
|
|
480
481
|
});
|
|
481
482
|
function memberPhrase(s) {
|
|
482
483
|
const listed = `${s.entries.join(", ")}${s.omitted !== undefined ? ` and ${s.omitted} more` : ""}`;
|
|
@@ -32,8 +32,6 @@ export declare const ASK_HEADLINE_WHY: Readonly<{
|
|
|
32
32
|
readonly write_protection: "core/engine.ask-headline.write_protection";
|
|
33
33
|
readonly ancestor: "core/engine.ask-headline.ancestor";
|
|
34
34
|
readonly dangerous_delete: "core/engine.ask-headline.dangerous_delete";
|
|
35
|
-
readonly unverifiable_delete: "core/engine.ask-headline.unverifiable_delete";
|
|
36
|
-
readonly unverifiable_shell_text: "core/engine.ask-headline.unverifiable_shell_text";
|
|
37
35
|
readonly transcript_write: "core/engine.ask-headline.transcript_write";
|
|
38
36
|
readonly rule_unreadable: "core/engine.ask-headline.rule_unreadable";
|
|
39
37
|
readonly ask_rule: "core/engine.ask-headline.ask_rule";
|
|
@@ -50,6 +48,8 @@ export declare const ASK_HEADLINE_WHY: Readonly<{
|
|
|
50
48
|
readonly tool_marks_a2a: "core/engine.ask-headline.tool_marks_a2a";
|
|
51
49
|
readonly policy_rra: "core/engine.ask-headline.policy_rra";
|
|
52
50
|
readonly artifact_shared_read: "core/engine.ask-headline.artifact_shared_read";
|
|
51
|
+
readonly unverifiable_delete: "core/engine.ask-headline.unverifiable_delete";
|
|
52
|
+
readonly unverifiable_shell_text: "core/engine.ask-headline.unverifiable_shell_text";
|
|
53
53
|
readonly unstated: "core/engine.ask-headline.unstated";
|
|
54
54
|
readonly ordinary: "core/engine.ask-headline.ordinary";
|
|
55
55
|
}>;
|
|
@@ -403,12 +403,11 @@ export declare function ownedClearanceFacts(d: Extract<PermissionResult, {
|
|
|
403
403
|
* (`denialLimitFallback`: a self-declared one opts the policy's own ask out of automatic
|
|
404
404
|
* resolution, the safe direction, not a defect), so the invariant is pinned at the engine's two
|
|
405
405
|
* mint sites (the gate's fallback re-mint and the inherited station's) rather than thrown at
|
|
406
|
-
* derivation, where a policy's own object could trip it;
|
|
407
|
-
* guard's own record, which no policy composes but a policy wrapping an exported guard can relay beside a
|
|
408
|
-
* bit it cleared, so the bit is pinned at the two guard mint sites (the removal guard's ask, the
|
|
409
|
-
* session-transcript guard's);
|
|
406
|
+
* derivation, where a policy's own object could trip it;
|
|
410
407
|
* - `false` — the origin says nothing about the bit: a `policy` ask may carry it (a safety policy's
|
|
411
|
-
* own mandate) or not, and both are legal
|
|
408
|
+
* own mandate) or not, and both are legal; an `integrity_guard` ask carries it exactly when its guard's class
|
|
409
|
+
* explains it ({@link RRA_EXPLAINERS}: a protected-location removal, the session-transcript write — pinned at
|
|
410
|
+
* those two mint sites) and not for the two the engine raises because it could not read or verify the command.
|
|
412
411
|
*/
|
|
413
412
|
export declare const ORIGIN_IMPLIES_REAL_APPROVAL: {
|
|
414
413
|
readonly content_question: false;
|
|
@@ -420,7 +419,7 @@ export declare const ORIGIN_IMPLIES_REAL_APPROVAL: {
|
|
|
420
419
|
readonly hook: false;
|
|
421
420
|
readonly ask_rule: false;
|
|
422
421
|
readonly denial_limit_fallback: "at_mint";
|
|
423
|
-
readonly integrity_guard:
|
|
422
|
+
readonly integrity_guard: false;
|
|
424
423
|
readonly shell_gate_tighten: false;
|
|
425
424
|
readonly safety_tighten: false;
|
|
426
425
|
readonly policy: false;
|
|
@@ -648,10 +647,11 @@ export type ToolMarkSource = "deployment" | "mcp_annotation" | "a2a_default";
|
|
|
648
647
|
* `dangerous_delete` is a removal whose target is a protected location (`dangerousRemovalOf`: the filesystem root, a
|
|
649
648
|
* top-level directory, a home directory, or a workspace directory — the task root, the working directory, an additional
|
|
650
649
|
* working directory — or an ancestor of one): the reference implementation's dangerous-removal breaker, which no mode,
|
|
651
|
-
* allow rule or classifier answers. `unverifiable_delete` is
|
|
652
|
-
* `unverifiable_shell_text` is a shell handed text the command does not spell (a program's output, a substitution,
|
|
653
|
-
* file's content, an argv a stream fills in): the engine cannot read what that shell will execute.
|
|
654
|
-
*
|
|
650
|
+
* allow rule or classifier answers. `unverifiable_delete` is a recursive forced removal whose target the command text cannot
|
|
651
|
+
* resolve; `unverifiable_shell_text` is a shell handed text the command does not spell (a program's output, a substitution,
|
|
652
|
+
* a file's content, an argv a stream fills in): the engine cannot read what that shell will execute. What the engine cannot
|
|
653
|
+
* read or verify is no reason to ask more strictly than an ordinary question, so those two read the ordinary row
|
|
654
|
+
* ({@link ORDINARY_ROW}); they stay words of their own for the reason a card and a release name.
|
|
655
655
|
* `rule_unreadable` is a rule that may govern the call and cannot be read for it: the organization's snapshot, a partition of
|
|
656
656
|
* the person's store, or this call against a deny / ask row (the lexer's word, a content row, the read station's rows).
|
|
657
657
|
* `write_protection` and `write_protection_on_disk` are the two readings of one table hit, judged per written target and never
|
|
@@ -660,7 +660,7 @@ export type ToolMarkSource = "deployment" | "mcp_annotation" | "a2a_default";
|
|
|
660
660
|
* an innocent spelling the disk carries onto a guarded path, which the auto-mode classifier does not answer). A command
|
|
661
661
|
* writing several targets may carry both.
|
|
662
662
|
*/
|
|
663
|
-
export declare const ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "
|
|
663
|
+
export declare const ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "transcript_write", "org_rule", "rule_unreadable", "ask_rule", "denial_limit_fallback", "classifier_no_ruling", "requires_user_interaction", "cross_boundary", "operator_forced", "shell_floor", "target_unresolved", "probe", "write_protection_on_disk", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "policy_rra", "artifact_shared_read", "mode", "unverifiable_delete", "unverifiable_shell_text", "unstated", "ordinary"];
|
|
664
664
|
export type AskClass = (typeof ASK_CLASSES)[number];
|
|
665
665
|
/** Membership test for {@link AskClass} — the word crosses the wire on `tool_end.gate.disposition`. */
|
|
666
666
|
export declare function isAskClass(v: unknown): v is AskClass;
|
|
@@ -724,27 +724,13 @@ export declare const MODE_ARBITRATION: {
|
|
|
724
724
|
readonly ruleMayClear: false;
|
|
725
725
|
readonly hookAskFloor: false;
|
|
726
726
|
};
|
|
727
|
-
readonly dangerous_delete:
|
|
727
|
+
readonly dangerous_delete: {
|
|
728
728
|
readonly bypassImmune: true;
|
|
729
729
|
readonly classifierEligible: false;
|
|
730
730
|
readonly sandboxAdmission: false;
|
|
731
731
|
readonly ruleMayClear: false;
|
|
732
732
|
readonly hookAskFloor: true;
|
|
733
|
-
}
|
|
734
|
-
readonly unverifiable_delete: Readonly<{
|
|
735
|
-
readonly bypassImmune: true;
|
|
736
|
-
readonly classifierEligible: false;
|
|
737
|
-
readonly sandboxAdmission: false;
|
|
738
|
-
readonly ruleMayClear: false;
|
|
739
|
-
readonly hookAskFloor: true;
|
|
740
|
-
}>;
|
|
741
|
-
readonly unverifiable_shell_text: Readonly<{
|
|
742
|
-
readonly bypassImmune: true;
|
|
743
|
-
readonly classifierEligible: false;
|
|
744
|
-
readonly sandboxAdmission: false;
|
|
745
|
-
readonly ruleMayClear: false;
|
|
746
|
-
readonly hookAskFloor: true;
|
|
747
|
-
}>;
|
|
733
|
+
};
|
|
748
734
|
readonly transcript_write: {
|
|
749
735
|
readonly bypassImmune: false;
|
|
750
736
|
readonly classifierEligible: true;
|
|
@@ -878,6 +864,20 @@ export declare const MODE_ARBITRATION: {
|
|
|
878
864
|
readonly ruleMayClear: false;
|
|
879
865
|
readonly hookAskFloor: false;
|
|
880
866
|
};
|
|
867
|
+
readonly unverifiable_delete: Readonly<{
|
|
868
|
+
readonly bypassImmune: false;
|
|
869
|
+
readonly classifierEligible: true;
|
|
870
|
+
readonly sandboxAdmission: true;
|
|
871
|
+
readonly ruleMayClear: true;
|
|
872
|
+
readonly hookAskFloor: false;
|
|
873
|
+
}>;
|
|
874
|
+
readonly unverifiable_shell_text: Readonly<{
|
|
875
|
+
readonly bypassImmune: false;
|
|
876
|
+
readonly classifierEligible: true;
|
|
877
|
+
readonly sandboxAdmission: true;
|
|
878
|
+
readonly ruleMayClear: true;
|
|
879
|
+
readonly hookAskFloor: false;
|
|
880
|
+
}>;
|
|
881
881
|
readonly unstated: {
|
|
882
882
|
readonly bypassImmune: false;
|
|
883
883
|
readonly classifierEligible: true;
|
|
@@ -885,13 +885,13 @@ export declare const MODE_ARBITRATION: {
|
|
|
885
885
|
readonly ruleMayClear: true;
|
|
886
886
|
readonly hookAskFloor: false;
|
|
887
887
|
};
|
|
888
|
-
readonly ordinary: {
|
|
888
|
+
readonly ordinary: Readonly<{
|
|
889
889
|
readonly bypassImmune: false;
|
|
890
890
|
readonly classifierEligible: true;
|
|
891
891
|
readonly sandboxAdmission: true;
|
|
892
892
|
readonly ruleMayClear: true;
|
|
893
893
|
readonly hookAskFloor: false;
|
|
894
|
-
}
|
|
894
|
+
}>;
|
|
895
895
|
};
|
|
896
896
|
/** The fence over the arbitration table: `never` while every class has a row. */
|
|
897
897
|
export type ArbitrationTableCoversEveryClass = AssertAllKeysHandled<Exclude<AskClass, keyof typeof MODE_ARBITRATION>>;
|
|
@@ -976,7 +976,7 @@ export declare function screenAskClassMembers(askClass: unknown, classes: unknow
|
|
|
976
976
|
* The OWN half of the class derivation — what ONE ask says about itself through its own members, and the integrity guards
|
|
977
977
|
* its engine record carries for its call (`record`, read by the caller through {@link attestationOf}): the guards are engine
|
|
978
978
|
* findings, never a member, so a policy cannot move a real-approval question into a guard's class. The bare-bit rules are
|
|
979
|
-
* applied over THIS ask's own set: `requiresRealApproval` with no explaining class is `policy_rra
|
|
979
|
+
* applied over THIS ask's own set: `requiresRealApproval` with no explaining class, or beside the shell-text guard, is `policy_rra` ({@link bareBit}); a self-declared
|
|
980
980
|
* `mandated` with no other class is `operator_forced` (a deployment probe's own mandate, read conservatively). Returns the
|
|
981
981
|
* specific classes only — an empty set is "nothing but hesitation", which the caller reads as `ordinary`.
|
|
982
982
|
*/
|
|
@@ -994,7 +994,7 @@ export declare function decisionAskClassesOf(d: Extract<PermissionResult, {
|
|
|
994
994
|
* set is `ordinary`. The two faces the ask was raised under enter HERE and nowhere else, so every reader of the folded row
|
|
995
995
|
* reads it already folded: `readFace` — `roots` takes the classifier's lane from a set that holds a class the narrowed face
|
|
996
996
|
* withholds from it; `askFace` — `shell` reads a class {@link RELEASED_ON_SHELL_FACE} holds as not bypass-immune. Absent
|
|
997
|
-
* faces read the table's own rows. */
|
|
997
|
+
* faces read the table's own rows. A check that did not finish ({@link unfinishedCheck}) loses the classifier and floors a hook. */
|
|
998
998
|
export declare function foldArbitrationRow(classes: ReadonlySet<AskClass>, readFace?: ContainmentFace, askFace?: AskFace): ModeArbitrationRow;
|
|
999
999
|
/**
|
|
1000
1000
|
* The ONE class derivation: the decision half ({@link decisionAskClassesOf}) joined with the gate's own facts —
|
package/dist/core/ask-origin.js
CHANGED
|
@@ -195,7 +195,7 @@ export const ORIGIN_IMPLIES_REAL_APPROVAL = {
|
|
|
195
195
|
hook: false,
|
|
196
196
|
ask_rule: false,
|
|
197
197
|
denial_limit_fallback: "at_mint",
|
|
198
|
-
integrity_guard:
|
|
198
|
+
integrity_guard: false,
|
|
199
199
|
shell_gate_tighten: false,
|
|
200
200
|
safety_tighten: false,
|
|
201
201
|
policy: false,
|
|
@@ -274,8 +274,6 @@ export const ASK_CLASSES = Object.freeze([
|
|
|
274
274
|
"hook",
|
|
275
275
|
"ancestor",
|
|
276
276
|
"dangerous_delete",
|
|
277
|
-
"unverifiable_delete",
|
|
278
|
-
"unverifiable_shell_text",
|
|
279
277
|
"transcript_write",
|
|
280
278
|
"org_rule",
|
|
281
279
|
"rule_unreadable",
|
|
@@ -295,6 +293,8 @@ export const ASK_CLASSES = Object.freeze([
|
|
|
295
293
|
"policy_rra",
|
|
296
294
|
"artifact_shared_read",
|
|
297
295
|
"mode",
|
|
296
|
+
"unverifiable_delete",
|
|
297
|
+
"unverifiable_shell_text",
|
|
298
298
|
"unstated",
|
|
299
299
|
"ordinary",
|
|
300
300
|
]);
|
|
@@ -302,14 +302,12 @@ const ASK_CLASS_SET = new Set(ASK_CLASSES);
|
|
|
302
302
|
export function isAskClass(v) {
|
|
303
303
|
return ASK_CLASS_SET.has(v);
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const ORDINARY_ROW = Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: true, hookAskFloor: false });
|
|
306
306
|
export const MODE_ARBITRATION = {
|
|
307
307
|
content_question: { bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true },
|
|
308
308
|
hook: { bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false },
|
|
309
309
|
ancestor: { bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false },
|
|
310
|
-
dangerous_delete:
|
|
311
|
-
unverifiable_delete: REMOVAL_BREAKER_ROW,
|
|
312
|
-
unverifiable_shell_text: REMOVAL_BREAKER_ROW,
|
|
310
|
+
dangerous_delete: { bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true },
|
|
313
311
|
transcript_write: { bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true },
|
|
314
312
|
org_rule: { bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false },
|
|
315
313
|
rule_unreadable: { bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false },
|
|
@@ -329,8 +327,10 @@ export const MODE_ARBITRATION = {
|
|
|
329
327
|
policy_rra: { bypassImmune: true, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false },
|
|
330
328
|
artifact_shared_read: { bypassImmune: false, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true },
|
|
331
329
|
mode: { bypassImmune: false, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false },
|
|
330
|
+
unverifiable_delete: ORDINARY_ROW,
|
|
331
|
+
unverifiable_shell_text: ORDINARY_ROW,
|
|
332
332
|
unstated: { bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: true, hookAskFloor: false },
|
|
333
|
-
ordinary:
|
|
333
|
+
ordinary: ORDINARY_ROW,
|
|
334
334
|
};
|
|
335
335
|
export const ASK_FACES = Object.freeze(["shell", "other"]);
|
|
336
336
|
export function askFaceOf(toolName) {
|
|
@@ -344,7 +344,13 @@ function bypassImmuneOf(c) {
|
|
|
344
344
|
return [...c.classes].some((k) => bypassImmuneOn(k, c.askFace));
|
|
345
345
|
}
|
|
346
346
|
const CLASSIFIER_WITHHELD_ON_ROOTS = new Set(["probe"]);
|
|
347
|
-
|
|
347
|
+
function unfinishedCheck(classes) {
|
|
348
|
+
return classes.has("unverifiable_shell_text") && classes.has("policy_rra");
|
|
349
|
+
}
|
|
350
|
+
function bareBit(d, classes, record) {
|
|
351
|
+
return d.requiresRealApproval === true && (!explainsRealApprovalBit(classes) || record?.guards?.includes("unverifiable_shell_text") === true);
|
|
352
|
+
}
|
|
353
|
+
export const RRA_EXPLAINERS = new Set(["dangerous_delete", "transcript_write", "org_rule", "rule_unreadable", "denial_limit_fallback", "classifier_no_ruling", "ancestor", "artifact_shared_read", "requires_user_interaction", "cross_boundary"]);
|
|
348
354
|
export function explainsRealApprovalBit(classes) {
|
|
349
355
|
for (const c of classes)
|
|
350
356
|
if (RRA_EXPLAINERS.has(c))
|
|
@@ -399,7 +405,7 @@ export function ownAskClassesOf(d, record) {
|
|
|
399
405
|
out.add("hook");
|
|
400
406
|
if (d.decisionReason === "mode")
|
|
401
407
|
out.add("mode");
|
|
402
|
-
if (d
|
|
408
|
+
if (bareBit(d, out, record))
|
|
403
409
|
out.add("policy_rra");
|
|
404
410
|
if (out.size === 0 && d.mandated === true)
|
|
405
411
|
out.add("operator_forced");
|
|
@@ -415,8 +421,9 @@ export function decisionAskClassesOf(d, call) {
|
|
|
415
421
|
export function foldArbitrationRow(classes, readFace, askFace) {
|
|
416
422
|
if (classes.size === 0)
|
|
417
423
|
return MODE_ARBITRATION.ordinary;
|
|
418
|
-
const
|
|
419
|
-
|
|
424
|
+
const unfinished = unfinishedCheck(classes);
|
|
425
|
+
const withheld = unfinished || (readFace === "roots" && [...classes].some((c) => CLASSIFIER_WITHHELD_ON_ROOTS.has(c)));
|
|
426
|
+
let bypassImmune = false, classifierEligible = !withheld, sandboxAdmission = true, ruleMayClear = true, hookAskFloor = unfinished;
|
|
420
427
|
for (const c of classes) {
|
|
421
428
|
const row = MODE_ARBITRATION[c];
|
|
422
429
|
bypassImmune ||= bypassImmuneOn(c, askFace);
|
|
@@ -466,7 +473,7 @@ export function classifyAsk(d, facts) {
|
|
|
466
473
|
classes.add("unstated");
|
|
467
474
|
for (const c of facts.ancestorClasses ?? [])
|
|
468
475
|
classes.add(c);
|
|
469
|
-
if (d
|
|
476
|
+
if (bareBit(d, classes, record))
|
|
470
477
|
classes.add("policy_rra");
|
|
471
478
|
for (const c of record?.foldedClasses ?? [])
|
|
472
479
|
classes.add(c);
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The run's end: one per run, and the one
|
|
2
|
+
* The run's end: one per run, and the one place a run takes back everything it handed to something that outlives it.
|
|
3
3
|
*
|
|
4
|
-
* A run reaches
|
|
5
|
-
* never abort it), the caller-stop gate composed from it, a parent leg's tool signal a child run is handed
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* A run reaches holders that can outlive it — the caller's `TaskSpec.signal` (a host may keep one controller for many runs, or
|
|
5
|
+
* never abort it), the caller-stop gate composed from it, a parent leg's tool signal a child run is handed, and the process-level
|
|
6
|
+
* seats of its session (the idle machine, the held queue of each box the leg drains), which live as long as the process. What the
|
|
7
|
+
* run leaves on such a holder — a listener, a sink — stays reachable for as long as the holder does, and so does everything it
|
|
8
|
+
* closes over (the run's prepared state, its conversation, its tool table, its images). A composed signal (`AbortSignal.any`) or a
|
|
9
|
+
* timeout signal that carries an abort listener is held by the runtime itself until it aborts, so dropping the signal frees nothing
|
|
10
|
+
* either.
|
|
9
11
|
*
|
|
10
|
-
* The rule: the run
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* The rule: the run hands such a thing over only through its end — {@link RunEnd.listen} for a listener on a signal it does not
|
|
13
|
+
* own, {@link RunEnd.lend} for anything else, naming how it is taken back. The stream leg mints the end when the run starts and
|
|
14
|
+
* ends it once the run has settled — its result published by the run body, or by the failure backstop after a throw — so every
|
|
15
|
+
* hand-over is taken back whether or not the run reached its loop, and the host owes nothing after the run. A hand-over whose job
|
|
16
|
+
* ends sooner is taken back sooner (the release each verb returns); none outlives the run. Ending the run fires nothing and
|
|
17
|
+
* answers nothing: the caller-stop gate still answers "did the caller ask this run to stop?".
|
|
15
18
|
*
|
|
16
|
-
*
|
|
19
|
+
* A listener's release is an explicit `removeEventListener`, not the `{ signal }` listener option: the runtime keeps the latest
|
|
17
20
|
* listener hung with that option reachable through its target for as long as the target lives, so on a host's long-lived
|
|
18
21
|
* signal it would keep the last run reachable.
|
|
19
22
|
*/
|
|
@@ -23,7 +26,17 @@ export interface RunEnd {
|
|
|
23
26
|
* the run ended. A signal that already fired is the caller's to read: an abort is not replayed to a late listener.
|
|
24
27
|
*/
|
|
25
28
|
listen(signal: AbortSignal, onAbort: () => void): () => void;
|
|
26
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Something was handed to a holder that outlives the run: `takeBack` takes it back, once — at the run's end, or sooner through
|
|
31
|
+
* the return (idempotent). Lent after the run ended, it is taken back at once. `takeBack` must not throw; the end runs every
|
|
32
|
+
* take-back before it reports one that did.
|
|
33
|
+
*/
|
|
34
|
+
lend(takeBack: () => void): () => void;
|
|
35
|
+
/** The run ended: every hand-over not yet taken back is taken back; idempotent. Throws, once every take-back ran, when one threw. */
|
|
27
36
|
end(): void;
|
|
28
37
|
}
|
|
38
|
+
/** The stream leg's end of the run: `runEnd` ends once `settled` settles, either way. A take-back that threw (reported by
|
|
39
|
+
* {@link RunEnd.end} once every other one ran) goes to `onError`, not to the process as an unhandled rejection; the run's result
|
|
40
|
+
* stands. `onError` must not throw: the stream leg hands the deployment's error sink, which the Runner guards where it takes it. */
|
|
41
|
+
export declare function endOnSettle(runEnd: RunEnd, settled: Promise<unknown>, onError: (err: unknown) => void): void;
|
|
29
42
|
export declare function mintRunEnd(): RunEnd;
|
|
@@ -1,22 +1,53 @@
|
|
|
1
|
+
export function endOnSettle(runEnd, settled, onError) {
|
|
2
|
+
const end = () => {
|
|
3
|
+
try {
|
|
4
|
+
runEnd.end();
|
|
5
|
+
}
|
|
6
|
+
catch (err) {
|
|
7
|
+
onError(err);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
void settled.then(end, end);
|
|
11
|
+
}
|
|
1
12
|
export function mintRunEnd() {
|
|
2
|
-
let
|
|
13
|
+
let lent = new Set();
|
|
14
|
+
const lend = (takeBack) => {
|
|
15
|
+
let done = false;
|
|
16
|
+
const release = () => {
|
|
17
|
+
if (done)
|
|
18
|
+
return;
|
|
19
|
+
done = true;
|
|
20
|
+
lent?.delete(release);
|
|
21
|
+
takeBack();
|
|
22
|
+
};
|
|
23
|
+
if (lent === undefined)
|
|
24
|
+
release();
|
|
25
|
+
else
|
|
26
|
+
lent.add(release);
|
|
27
|
+
return release;
|
|
28
|
+
};
|
|
3
29
|
return {
|
|
4
30
|
listen(signal, onAbort) {
|
|
5
|
-
if (
|
|
31
|
+
if (lent === undefined)
|
|
6
32
|
return () => undefined;
|
|
7
33
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
8
|
-
|
|
9
|
-
signal.removeEventListener("abort", onAbort);
|
|
10
|
-
hung?.delete(release);
|
|
11
|
-
};
|
|
12
|
-
hung.add(release);
|
|
13
|
-
return release;
|
|
34
|
+
return lend(() => signal.removeEventListener("abort", onAbort));
|
|
14
35
|
},
|
|
36
|
+
lend,
|
|
15
37
|
end() {
|
|
16
|
-
const all =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
38
|
+
const all = lent;
|
|
39
|
+
lent = undefined;
|
|
40
|
+
const faults = [];
|
|
41
|
+
for (const release of all ?? []) {
|
|
42
|
+
try {
|
|
43
|
+
release();
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
faults.push(e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (faults.length > 0)
|
|
50
|
+
throw faults.length === 1 ? faults[0] : new AggregateError(faults, "RunEnd.end: a take-back threw");
|
|
20
51
|
},
|
|
21
52
|
};
|
|
22
53
|
}
|
|
@@ -906,7 +906,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
906
906
|
const autoStripNotice = createAutoStripNotice({ onNotice: deps.onNotice, legNotice, runId, announced: { announcedListingsRef, frameReceipts } });
|
|
907
907
|
const { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, riskAxesOf, ruleOffersOf, grantBindingOf, permissionRuleLane, permissionRuleGateLane, ruleLaneFacts, permissionRuleOrgLane, storedRuleWholeToolRefusals, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations } = await preparePolicyChain({ hostFloor: doors.hostFloor, spec, deps, sessionId, runId, hostTaskId, approvalWords, engineText, taskRootFinal, additionalRootsCanonical, writeLocation, executionEnv, lockedPreflight: installedPreflight, pathRuleAnchors: { leg: legAnchors, chainTop }, headLeads, tools, harnessTools, selector: toolFaceSnapshot.selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, approvalParkNotResumable, notResumableSays, forcedGateNotResumable, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus: legMods.bus, ownModChain, autoModeDecider: () => autoModeDeciderRef.current, whileClassifying: toolOccurrences.whileClassifying, readFace: () => resolvedReadFace, permissionMode, autoStripNotice, toolRosterDeltas: rosterSeat, stopForDenialLimit, askSource, abortController, now, ownSessionRulesRef });
|
|
908
908
|
toolTableViewRef.current = createToolTableView({ policy: effectivePolicy, stored: { wholeToolRefusals: storedRuleWholeToolRefusals }, roster: rosterSeat, fpRef, turnSnapshotRef });
|
|
909
|
-
const { onAsk, preToolContexts, blockedToolCalls, batchHaltRef, blockedTracked, suspendTargetGap, durableSuspendInfraReady, suspendLaneGap, resourceSuspendEligible, usageGovernance, durableApproval, wiringManifest, writeProtection, parkLaneArmed, gateMachineryActive, hookIdentity, hookEnvFace, sessionBoxBound } = prepareWiringManifest({ spec, deps, askSeat: doors.askSeat, hostFloorPosture: doors.hostFloor?.posture, crossBoundaryStationEngaged: crossBoundary.stationEngaged, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus: legMods.bus, standingModBus: legMods.standing, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard: advertisedWritableDirs?.planFile !== undefined ? { ...legWriteGuard, exemptFiles: [advertisedWritableDirs.planFile] } : legWriteGuard, mcp, irreversibleTools, egressTools, shellReadStationArmed: handsReadFace.shellReadStationArmed, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, harness, pausedRef, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive: handsReadFace.readDenyBuiltinTiersActive, lspManagerWired, lspDiagnosticsLive: lspDiagnostics !== undefined, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive: ownSessionRulesRef.current !== undefined, sessionBox, sessionAddress, checkpointScope, memoryPollution: () => memoryEngineSession?.pollution, advisorFact: advisor.manifest, runOrigin: doors.runOrigin, commandSandboxFact: commandSandboxRun.state === "unavailable" ? { state: "unavailable", reason: commandSandboxRun.reason } : { state: commandSandboxRun.state } });
|
|
909
|
+
const { onAsk, preToolContexts, blockedToolCalls, batchHaltRef, blockedTracked, suspendTargetGap, durableSuspendInfraReady, suspendLaneGap, resourceSuspendEligible, usageGovernance, durableApproval, wiringManifest, writeProtection, parkLaneArmed, gateMachineryActive, hookIdentity, hookEnvFace, sessionBoxBound } = prepareWiringManifest({ spec, deps, askSeat: doors.askSeat, hostFloorPosture: doors.hostFloor?.posture, crossBoundaryStationEngaged: crossBoundary.stationEngaged, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus: legMods.bus, standingModBus: legMods.standing, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard: advertisedWritableDirs?.planFile !== undefined ? { ...legWriteGuard, exemptFiles: [advertisedWritableDirs.planFile] } : legWriteGuard, mcp, irreversibleTools, egressTools, shellReadStationArmed: handsReadFace.shellReadStationArmed, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, harness, pausedRef, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive: handsReadFace.readDenyBuiltinTiersActive, lspManagerWired, lspDiagnosticsLive: lspDiagnostics !== undefined, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive: ownSessionRulesRef.current !== undefined, sessionBox, sessionAddress, runEnd, checkpointScope, memoryPollution: () => memoryEngineSession?.pollution, advisorFact: advisor.manifest, runOrigin: doors.runOrigin, commandSandboxFact: commandSandboxRun.state === "unavailable" ? { state: "unavailable", reason: commandSandboxRun.reason } : { state: commandSandboxRun.state } });
|
|
910
910
|
refuseDisplayWithoutSentences(legMods.bus, legEventsOf(hookIdentity));
|
|
911
911
|
agentStationsRef.current = createAgentStations({ bus: legMods.bus, identity: hookIdentity, permissionMode: () => permissionMode.observed });
|
|
912
912
|
sendStationRef.current = createSessionSendStation({ bus: legMods.bus, identity: hookIdentity });
|
|
@@ -170,6 +170,7 @@ export interface PrepareWiringManifestInput {
|
|
|
170
170
|
sessionBox: SessionBoxBinding | undefined;
|
|
171
171
|
/** borrowed-readonly — the leg's own session address (`sessionAddressOf`): the box is drained for it. */
|
|
172
172
|
sessionAddress: SessionAddress;
|
|
173
|
+
/** borrowed-mutable — the run's end: the drain hands what it binds the session's process-level seats through it (absent outside a stream). */ runEnd?: import("./end-of-run.js").RunEnd | undefined;
|
|
173
174
|
/** borrowed-readonly, read late — the memory session's one-way pollution face (absent with no memory session). The drain marks
|
|
174
175
|
* it when it INJECTS a letter from another principal (the injection path; the tool path is accounted by `ReadInbox`'s class). */
|
|
175
176
|
memoryPollution?: () => Pick<NonNullable<Prepared["memoryEngineSession"]>["pollution"], "markPolluted"> | undefined;
|
|
@@ -158,7 +158,7 @@ export function durableSuspendInfraGaps(facts) {
|
|
|
158
158
|
return gaps;
|
|
159
159
|
}
|
|
160
160
|
export function prepareWiringManifest(input) {
|
|
161
|
-
const { spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard, mcp, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, sessionBox, sessionAddress, harness, pausedRef, askSeat, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, runOrigin, commandSandboxFact } = input;
|
|
161
|
+
const { spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard, mcp, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, sessionBox, sessionAddress, runEnd, harness, pausedRef, askSeat, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, runOrigin, commandSandboxFact } = input;
|
|
162
162
|
const onAsk = askSeat.value;
|
|
163
163
|
const handWriteTools = toolRoster.entries.filter((e) => e.mountedBy === "hands" && (e.effect === "write" || e.effect === "idempotent")).map((e) => e.name);
|
|
164
164
|
const hasEffectAwareGate = policyLayers.length > 0 || chainJudges(standingModBus);
|
|
@@ -286,7 +286,7 @@ export function prepareWiringManifest(input) {
|
|
|
286
286
|
deps, lanes: drainLanes, assistantSeat: internals.principalInboxAssistant,
|
|
287
287
|
address: sessionAddress,
|
|
288
288
|
sessions,
|
|
289
|
-
runId,
|
|
289
|
+
runId, ...(runEnd !== undefined ? { runEnd } : {}),
|
|
290
290
|
scope: taskScope,
|
|
291
291
|
inject: internals.onTaskNotification,
|
|
292
292
|
ownTokens: () => internals?.peerSelfRef?.current.ownTokens ?? [],
|
|
@@ -35,7 +35,7 @@ import { ToolDetachHub } from "../tool-detach.js";
|
|
|
35
35
|
import { assertContextSettingsValue, assertContextSettingsWords, contextOverlayFor } from "../context-settings.js";
|
|
36
36
|
import { createRunState } from "./initial-run-state.js";
|
|
37
37
|
import { SessionWriteLedger } from "./session-write-ledger.js";
|
|
38
|
-
import { mintRunEnd } from "./end-of-run.js";
|
|
38
|
+
import { endOnSettle, mintRunEnd } from "./end-of-run.js";
|
|
39
39
|
import { teardownLegBudget } from "./teardown-bounded.js";
|
|
40
40
|
import { emitSettled, reconciledEnd } from "./tool-end-body.js";
|
|
41
41
|
import { answerFaceForRedeemedCall } from "./decide-continuation.js";
|
|
@@ -408,7 +408,7 @@ export class Runner {
|
|
|
408
408
|
}).onRunRejected);
|
|
409
409
|
void settled.then(() => acceptedSteerInputs.clear(), () => acceptedSteerInputs.clear());
|
|
410
410
|
void settled.then(() => declarationHold.release(), () => declarationHold.release());
|
|
411
|
-
|
|
411
|
+
endOnSettle(runEnd, settled, (err) => this.deps.onError?.(err, { phase: "degraded", sessionId: taskIdRef.sessionId ?? "(pre-session)", classification: "run-end-take-back" }));
|
|
412
412
|
const { reapSuspended } = streamReap({
|
|
413
413
|
live, runner: this.depsSeat,
|
|
414
414
|
locallyClaimedTokens: this.locallyClaimedTokens, parentConstraintRegistry: this.parentConstraintRegistry, suspendedEnvReaps: this.suspendedEnvReaps,
|
|
@@ -38,7 +38,8 @@ export declare function readStationAnswer(answer: ShellReadVerdict, call: Statio
|
|
|
38
38
|
/** The ask `d` with the silence a station's answer carries, each its own class on the question it keeps or mints: unread rows are a
|
|
39
39
|
* rule that could not be read (the rule lane's class); the finding `unanswered` is, unless rows are unread, the environment's silence —
|
|
40
40
|
* shell text the engine cannot read (a guard, attested on the ask's record for `call` beside the guards it already carries) — and the
|
|
41
|
-
* marks only pick whose. Either is a question only a person answers
|
|
41
|
+
* marks only pick whose. Either is a question only a person answers (the real-approval bit; beside the environment's guard alone no
|
|
42
|
+
* class explains it, and the class fold reads that pair as a check that did not finish); `probe` follows the finding. No silence ⇒ `d` itself. */
|
|
42
43
|
export declare function silencedBy<D extends Extract<PermissionResult, {
|
|
43
44
|
action: "ask";
|
|
44
45
|
}>>(d: D, verdict: ShellReadVerdict, call: {
|
|
@@ -1192,6 +1192,9 @@ export declare function createCoarseCommandNamePolicy(opts: {
|
|
|
1192
1192
|
* dialog (908517 / 909563) and re-attaches a matching user `ask` rule on the auto-mode surface (461507).
|
|
1193
1193
|
* Core has neither a persisted always-allow surface nor rule re-attachment — noted for whichever UI layer
|
|
1194
1194
|
* grows one.
|
|
1195
|
+
*
|
|
1196
|
+
* The bit now rides only the protected-location question; a target or shell text the guard could not read or verify is an ordinary
|
|
1197
|
+
* question — what the engine cannot read is no reason to ask more strictly (the class rows, `MODE_ARBITRATION`, say the rest).
|
|
1195
1198
|
*/
|
|
1196
1199
|
export declare function createUnverifiableDeletePolicy(opts?: {
|
|
1197
1200
|
/** Extra variable names treated as well-known-safe roots, ADDED to the default set `TMPDIR`/`HOME`
|
|
@@ -1899,7 +1902,7 @@ export declare function isPolicyApprover(v: unknown): boolean;
|
|
|
1899
1902
|
* and its call reaches the same answer.
|
|
1900
1903
|
*
|
|
1901
1904
|
* Only the classes a standing rule may clear can be declared — the column `ruleMayClear` of
|
|
1902
|
-
* {@link import("./ask-origin.js").MODE_ARBITRATION} (today `
|
|
1905
|
+
* {@link import("./ask-origin.js").MODE_ARBITRATION} (today `unverifiable_delete`, `unverifiable_shell_text`, `unstated` and `ordinary`): a table is a deployment's answer
|
|
1903
1906
|
* to the questions the allow layer itself may answer, by class instead of by tool. A question the engine mints demanding a
|
|
1904
1907
|
* person ({@link AskRequest.requiresRealApproval}) always carries a class outside that column, so no table covers it; a
|
|
1905
1908
|
* hand-built request carrying the bit beside a covered set is answered by the table and refused by the real-approval arm,
|
package/dist/core/tool-policy.js
CHANGED
|
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { argsReadFrom, carryArgsReadFrom, withArgsReading } from "./effective-path-target.js";
|
|
4
4
|
import { editRewrittenSentence, readRejudge, rewriteChasedSentence } from "./rewrite-rejudge.js";
|
|
5
5
|
import { brandPolicyAskClass } from "./ask-class.js";
|
|
6
|
-
import { ASK_CLASSES, decisionAskClassesOf, headlessDenialMessage, joinAskReasons, MODE_ARBITRATION, unresolvedAskDenialMessage } from "./ask-origin.js";
|
|
6
|
+
import { ASK_CLASSES, decisionAskClassesOf, explainsRealApprovalBit, headlessDenialMessage, joinAskReasons, MODE_ARBITRATION, unresolvedAskDenialMessage } from "./ask-origin.js";
|
|
7
7
|
import { attest, attestationOf, engineSentenceOf, isEngineAttestation, mergeAttestation, mintAttestation, withAttestation } from "./engine-attestation.js";
|
|
8
8
|
import { ownReadRootCandidate, readRootGrantSeat } from "./read-root-grant-screen.js";
|
|
9
9
|
import { liveWordsOf } from "./approval-words.js";
|
|
@@ -799,7 +799,7 @@ export function createUnverifiableDeletePolicy(opts) {
|
|
|
799
799
|
}, "external_authority");
|
|
800
800
|
}
|
|
801
801
|
function removalAsk(req, verdict) {
|
|
802
|
-
return attest({ action: "ask", decisionReason: "safety", requiresRealApproval: true, message: verdict.text }, req, { guards: [verdict.guard], sentence: { text: verdict.text, guard: verdict.guard } });
|
|
802
|
+
return attest({ action: "ask", decisionReason: "safety", ...(explainsRealApprovalBit([verdict.guard]) ? { requiresRealApproval: true } : {}), message: verdict.text }, req, { guards: [verdict.guard], sentence: { text: verdict.text, guard: verdict.guard } });
|
|
803
803
|
}
|
|
804
804
|
function pathSegments(p) {
|
|
805
805
|
return p.split(/[\\/]/).filter(Boolean);
|
|
@@ -234,18 +234,18 @@ const REMOVAL_GUARD_SENTENCE = {
|
|
|
234
234
|
},
|
|
235
235
|
},
|
|
236
236
|
unverifiable_delete: {
|
|
237
|
-
card: (row) => `
|
|
237
|
+
card: (row) => `This delete could not be checked first: ${row}. Writing the exact path into the command (or setting the variable to a literal path in the same command, e.g. \`DIR=/exact/path; rm -rf "$DIR"\`) lets the engine check it.`,
|
|
238
238
|
rows: {
|
|
239
|
-
rewritten: (f) => `\`${f.program}\`
|
|
240
|
-
stream: (f) => `\`${f.program}\`
|
|
241
|
-
relocated: (f) => `\`${f.program}\`
|
|
239
|
+
rewritten: (f) => `\`${f.program}\` deletes ${inlineUntrusted(f.operand, 200)} recursively and by force, and the shell fills that path in from a value this command does not set (a name with no value here or one set in a form the engine cannot read, a substitution, a parameter operator)`,
|
|
240
|
+
stream: (f) => `\`${f.program}\` deletes recursively and by force the paths named by the input it is fed (${inlineUntrusted(f.operand, 200)})`,
|
|
241
|
+
relocated: (f) => `\`${f.program}\` deletes ${inlineUntrusted(f.operand, 200)} recursively and by force, relative to a directory a launcher option moved it into, which this command does not say`,
|
|
242
242
|
},
|
|
243
243
|
},
|
|
244
244
|
unverifiable_shell_text: {
|
|
245
|
-
card: (row) => `
|
|
245
|
+
card: (row) => `This command could not be checked first: ${row}.`,
|
|
246
246
|
rows: {
|
|
247
|
-
produced: (f) => `\`${f.program}\` runs shell text that is
|
|
248
|
-
unread: (f) => `\`${f.program}\` runs shell text
|
|
247
|
+
produced: (f) => `\`${f.program}\` runs shell text that is only put together when the command runs (${inlineUntrusted(f.text, 200)}), so the engine cannot read it beforehand — writing that text into the command itself (a \`-c\` string, a here-document or a here-string) lets the engine read it`,
|
|
248
|
+
unread: (f) => `\`${f.program}\` runs shell text the engine cannot read (${inlineUntrusted(f.text, 200)})`,
|
|
249
249
|
position: (f) => inlineUntrusted(programPositionRefusalSentence(f.refusal), 400),
|
|
250
250
|
},
|
|
251
251
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "7.68.
|
|
3
|
+
"version": "7.68.6",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"dependencies": {
|
|
134
134
|
"@modelcontextprotocol/client": "2.4.0",
|
|
135
135
|
"@modelcontextprotocol/core": "2.4.0",
|
|
136
|
-
"@sema-agent/primitives": "7.68.
|
|
136
|
+
"@sema-agent/primitives": "7.68.6",
|
|
137
137
|
"typebox": "1.1.39",
|
|
138
138
|
"undici": "7.30.2"
|
|
139
139
|
},
|