@sema-agent/core 7.72.0 → 7.73.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 +319 -0
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +46 -2
- package/dist/agents/parked-resume-drive.d.ts +10 -0
- package/dist/agents/parked-resume-drive.js +9 -0
- package/dist/agents/retain-ledger.d.ts +3 -0
- package/dist/agents/send-message-tool.js +1 -0
- package/dist/agents/send-user-message-tool.d.ts +12 -0
- package/dist/agents/send-user-message-tool.js +67 -0
- package/dist/agents/subagent-steps.d.ts +9 -0
- package/dist/agents/subagent-steps.js +38 -0
- package/dist/agents/subagent.d.ts +2 -0
- package/dist/agents/subagent.js +43 -12
- package/dist/agents/verify.js +23 -8
- package/dist/agents/yield-adoption.js +3 -1
- package/dist/brain/anthropic.js +14 -9
- package/dist/brain/open-responses.js +4 -5
- package/dist/brain/openai.js +30 -23
- package/dist/brain/stream-engine.js +159 -151
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/allow-entry.js +3 -3
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/checkpoint-features.d.ts +3 -2
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-rekey.d.ts +1 -1
- package/dist/core/checkpoint-rekey.js +6 -1
- package/dist/core/checkpoint-requirements.d.ts +23 -3
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.js +7 -1
- package/dist/core/checkpoint-store.d.ts +24 -2
- package/dist/core/checkpoint-store.js +1 -0
- package/dist/core/child-clamp-seats.d.ts +15 -0
- package/dist/core/child-clamp-seats.js +15 -0
- package/dist/core/delegation-frames.d.ts +1 -0
- package/dist/core/delegation-frames.js +1 -1
- package/dist/core/engine-capabilities.d.ts +5 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +30 -22
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +19 -7
- package/dist/core/entries-not-applied.js +33 -1
- package/dist/core/governance-codes.d.ts +7 -1
- package/dist/core/governance-codes.js +13 -5
- package/dist/core/hooks.d.ts +3 -0
- package/dist/core/hooks.js +1 -0
- package/dist/core/host-instance.d.ts +23 -0
- package/dist/core/host-instance.js +69 -0
- package/dist/core/instruction-preview.d.ts +63 -0
- package/dist/core/instruction-preview.js +406 -0
- package/dist/core/leg-budget.d.ts +26 -0
- package/dist/core/leg-budget.js +9 -0
- package/dist/core/leg-identity.d.ts +51 -1
- package/dist/core/leg-identity.js +45 -2
- package/dist/core/manager-launch-check.d.ts +48 -0
- package/dist/core/manager-launch-check.js +64 -0
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-injection-drop.d.ts +20 -10
- package/dist/core/mcp-injection-drop.js +9 -3
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/member-outcome.d.ts +3 -2
- package/dist/core/member-outcome.js +1 -1
- package/dist/core/memory-engine/deletion-record.d.ts +46 -0
- package/dist/core/memory-engine/deletion-record.js +96 -0
- package/dist/core/memory-engine/engine.js +24 -16
- package/dist/core/memory-engine/file-backend.js +7 -5
- package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
- package/dist/core/memory-engine/projection-ledger.js +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +18 -13
- package/dist/core/memory-engine/scope-contract.js +18 -18
- package/dist/core/memory-engine/sync-client.js +26 -6
- package/dist/core/memory-engine/sync.d.ts +20 -2
- package/dist/core/memory-engine/sync.js +18 -17
- package/dist/core/mode-policy.d.ts +21 -6
- package/dist/core/mode-policy.js +15 -6
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/parent-spec-seat.d.ts +13 -11
- package/dist/core/parent-spec-seat.js +13 -9
- package/dist/core/peer-seat.js +3 -3
- package/dist/core/peer-task-store.d.ts +365 -0
- package/dist/core/peer-task-store.js +682 -0
- package/dist/core/permission-rule-consent.js +6 -11
- package/dist/core/permission-rule-model.d.ts +27 -0
- package/dist/core/permission-rule-model.js +33 -5
- package/dist/core/permission-rule-provider.d.ts +35 -33
- package/dist/core/permission-rule-provider.js +38 -295
- package/dist/core/permission-rule-store.d.ts +181 -8
- package/dist/core/permission-rule-store.js +420 -17
- package/dist/core/permission-rule-sync.js +15 -1
- package/dist/core/project-seat.d.ts +55 -0
- package/dist/core/project-seat.js +96 -0
- package/dist/core/protocol-http-auth.d.ts +3 -2
- package/dist/core/protocol-http-auth.js +26 -18
- package/dist/core/remote-env.d.ts +4 -4
- package/dist/core/retired-keys.js +1 -0
- package/dist/core/rule-offer-read.d.ts +1 -1
- package/dist/core/rule-offer-read.js +32 -4
- package/dist/core/run-ledger-seat.d.ts +66 -0
- package/dist/core/run-ledger-seat.js +70 -0
- package/dist/core/run-ledger.d.ts +332 -0
- package/dist/core/run-ledger.js +550 -0
- package/dist/core/runner/checkpoint-scope.d.ts +13 -3
- package/dist/core/runner/checkpoint-scope.js +12 -4
- package/dist/core/runner/construction-doors.js +6 -0
- package/dist/core/runner/contracts.d.ts +21 -5
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/nested-memory-lane.d.ts +22 -5
- package/dist/core/runner/nested-memory-lane.js +91 -30
- package/dist/core/runner/person-path-rows.d.ts +21 -16
- package/dist/core/runner/person-path-rows.js +80 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
- package/dist/core/runner/prepare-config-doors.d.ts +1 -0
- package/dist/core/runner/prepare-config-doors.js +5 -3
- package/dist/core/runner/prepare-context-lane.js +1 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +6 -0
- package/dist/core/runner/prepare-execution-env.d.ts +3 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
- package/dist/core/runner/prepare-hands-readface.js +12 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +13 -5
- package/dist/core/runner/prepare-run-refs.d.ts +1 -1
- package/dist/core/runner/prepare-run-refs.js +3 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
- package/dist/core/runner/prepare-suspend-saga.js +4 -2
- package/dist/core/runner/prepare-task.js +36 -27
- package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
- package/dist/core/runner/prepare-turn-wiring.js +2 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +5 -2
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-review-outcome.d.ts +3 -0
- package/dist/core/runner/resume-review-outcome.js +24 -1
- package/dist/core/runner/run-harness-handlers.js +3 -0
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +3 -0
- package/dist/core/runner/run-notification-lane.js +20 -1
- package/dist/core/runner/run-settle-and-teardown.js +21 -12
- package/dist/core/runner/run-stop-and-final-verify.js +6 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/runtask.d.ts +6 -2
- package/dist/core/runner/runtask.js +21 -9
- package/dist/core/runner/shell-env-withheld.d.ts +3 -2
- package/dist/core/runner/shell-env-withheld.js +1 -2
- package/dist/core/runner/stop-tail-notice.d.ts +10 -2
- package/dist/core/runner/stop-tail-notice.js +9 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/task-start-doors.js +6 -3
- package/dist/core/runner/terminal-account.d.ts +6 -1
- package/dist/core/runner/terminal-account.js +16 -1
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner-deps.d.ts +13 -10
- package/dist/core/secret-env.d.ts +53 -37
- package/dist/core/secret-env.js +44 -47
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +1 -0
- package/dist/core/session-store.d.ts +12 -6
- package/dist/core/session-store.js +26 -6
- package/dist/core/session.d.ts +31 -8
- package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
- package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
- package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/session-store-contract.js +87 -3
- package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
- package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
- package/dist/core/task-event.d.ts +10 -3
- package/dist/core/task-notification.d.ts +96 -10
- package/dist/core/task-notification.js +129 -5
- package/dist/core/task-registry-shared.d.ts +12 -1
- package/dist/core/task-registry-shared.js +3 -1
- package/dist/core/task-registry-workflow.d.ts +1 -1
- package/dist/core/task-registry-workflow.js +9 -1
- package/dist/core/task-registry.d.ts +39 -2
- package/dist/core/task-registry.js +76 -12
- package/dist/core/task-result.d.ts +13 -0
- package/dist/core/task-spec-members.d.ts +3 -1
- package/dist/core/task-spec-members.js +11 -3
- package/dist/core/task-spec.d.ts +48 -22
- package/dist/core/tool-catalog-entries.js +2 -0
- package/dist/core/tool-mount-facts.d.ts +1 -1
- package/dist/core/tool-mount-facts.js +1 -0
- package/dist/core/tool-mount-plan.d.ts +3 -1
- package/dist/core/tool-mount-plan.js +6 -0
- package/dist/core/tool-mount-static.d.ts +1 -1
- package/dist/core/tool-mount-static.js +4 -2
- package/dist/core/tool-result-store.d.ts +19 -2
- package/dist/core/tool-result-store.js +51 -2
- package/dist/core/tool-spec.d.ts +9 -2
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +26 -20
- package/dist/core/wiring-manifest.js +7 -3
- package/dist/core/workflow-journal-store.d.ts +53 -10
- package/dist/core/workflow-journal-store.js +27 -4
- package/dist/core/workflow-run-store-contract.js +16 -0
- package/dist/core/workflow-run-store.d.ts +9 -7
- package/dist/core/workflow-run-store.js +4 -1
- package/dist/engine/execution-env/node-execution-env.js +3 -1
- package/dist/engine/harness/types.d.ts +24 -1
- package/dist/engine/harness/types.js +10 -0
- package/dist/engine/llm/types.d.ts +5 -7
- package/dist/engine/lsp/node-lsp-manager.js +2 -1
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +15 -2
- package/dist/engine/session/session.js +34 -4
- package/dist/index.d.ts +18 -7
- package/dist/index.js +13 -4
- package/dist/orchestration/run-workflow-tool.js +40 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
- package/dist/orchestration/workflow-park-adoption.js +47 -12
- package/dist/orchestration/workflow-stop.d.ts +128 -0
- package/dist/orchestration/workflow-stop.js +156 -0
- package/dist/orchestration/workflow.d.ts +30 -6
- package/dist/orchestration/workflow.js +117 -55
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/stores/file/permission-rule-store.d.ts +3 -1
- package/dist/stores/file/permission-rule-store.js +0 -1
- package/dist/stores/file/workflow-journal-store.d.ts +16 -3
- package/dist/stores/file/workflow-journal-store.js +93 -5
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/tools/fs/file-write-check.js +9 -3
- package/dist/tools/fs/index.d.ts +8 -7
- package/dist/tools/fs/index.js +4 -4
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -5
- package/dist/tools/fs/read-deny.d.ts +33 -8
- package/dist/tools/fs/read-deny.js +114 -25
- package/dist/tools/fs/safety.d.ts +4 -1
- package/dist/tools/fs/safety.js +4 -2
- package/dist/tools/fs/shell-read-check.d.ts +9 -2
- package/dist/tools/fs/shell-read-check.js +96 -14
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +21 -11
- package/dist/tools/fs/shell-read-judge.d.ts +13 -1
- package/dist/tools/fs/shell-read-judge.js +26 -7
- package/dist/tools/fs/shell-read-plan.d.ts +5 -0
- package/dist/tools/fs/shell-read-write-targets.js +17 -9
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +131 -1
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import { insidePeerOfferOf } from "./a2a-bound-grant.js";
|
|
3
|
-
import { COMMAND_RULE_TOOL, a2aWholePeerName, cardRuleFormOf, escapeForDisclosure, isAddStamp, foldSpacing, formatRuleText, hasUnrenderableCharacters, parseRuleText, READ_RULE_TOOL, ruleAdmitsCommand, ruleBasesNeeded, ruleBreadthWarningsOf, segmentCoverageOf, suggestRuleForHost, suggestRuleForName, suggestRuleForTool, suggestRulesForCommand, EDITED_RULE_BREADTH_WARNING_CODES, RULE_OFFER_KINDS, UNCOVERED_SEGMENT_REASONS, RULE_BEHAVIORS, RULE_BEHAVIOR_PRECEDENCE, isRuleBehavior, } from "./permission-rule-model.js";
|
|
3
|
+
import { COMMAND_RULE_TOOL, a2aWholePeerName, cardRuleFormOf, escapeForDisclosure, isAddStamp, foldSpacing, formatRuleText, hasUnrenderableCharacters, parseRuleText, READ_RULE_TOOL, ruleAdmitsCommand, cautionsSeatOf, ruleBasesNeeded, ruleBreadthWarningsOf, segmentCoverageOf, suggestRuleForHost, suggestRuleForName, suggestRuleForTool, suggestRulesForCommand, EDITED_RULE_BREADTH_WARNING_CODES, RULE_OFFER_KINDS, UNCOVERED_SEGMENT_REASONS, RULE_BEHAVIORS, RULE_BEHAVIOR_PRECEDENCE, isRuleBehavior, } from "./permission-rule-model.js";
|
|
4
4
|
import { readRecordedRuleOwner, readRuleOwner, sameRuleOwner } from "./rule-owner.js";
|
|
5
5
|
import { principalNameOf, readPrincipal } from "./principal-name.js";
|
|
6
6
|
import { isPlainRecord } from "./mods/kernel/receive.js";
|
|
@@ -355,7 +355,7 @@ export function ruleOffersOfRecord(rec) {
|
|
|
355
355
|
if (t.match === "subpath") {
|
|
356
356
|
throw new Error("approval-record single offer references a directory rule — a shape this engine does not mint; refusing to render it");
|
|
357
357
|
}
|
|
358
|
-
return { kind: "single", ...t, ...stampOf(offer, offer.candidate) };
|
|
358
|
+
return { kind: "single", ...t, ...cautionsSeatOf(t.match, t.command), ...stampOf(offer, offer.candidate) };
|
|
359
359
|
}
|
|
360
360
|
for (const member of offer.candidates)
|
|
361
361
|
stampOf(offer, member);
|
|
@@ -393,7 +393,7 @@ export function ruleOffersOfRecord(rec) {
|
|
|
393
393
|
const t = tripleOf(candidate);
|
|
394
394
|
return t.match === "subpath"
|
|
395
395
|
? { kind: "directoryRead", rule: t.rule, directory: t.command, segment }
|
|
396
|
-
: { kind: "command", rule: t.rule, match: t.match, command: t.command, segment };
|
|
396
|
+
: { kind: "command", rule: t.rule, match: t.match, command: t.command, segment, ...cautionsSeatOf(t.match, t.command) };
|
|
397
397
|
}),
|
|
398
398
|
uncoveredSegments: count,
|
|
399
399
|
uncoveredDetail: detail,
|
|
@@ -951,18 +951,13 @@ async function applyRedemption(args) {
|
|
|
951
951
|
return refusal("store_read", `could not read the permission-rule store to confirm this ${args.candidate.behavior} rule stands after its redemption: ${errText(err)}`, "unknown");
|
|
952
952
|
}
|
|
953
953
|
if (!live) {
|
|
954
|
-
const
|
|
955
|
-
const
|
|
956
|
-
const unread = left === undefined ? snap?.unreadableRows?.find((u) => u.rule === args.parsedRule.rule && u.behavior === args.candidate.behavior) : undefined;
|
|
957
|
-
const entry = left === undefined && unread === undefined ? snap?.droppedRows?.find((d) => d.rule === args.parsedRule.rule && isElement(d)) : undefined;
|
|
958
|
-
const at = entry !== undefined && "element" in entry && entry.element !== undefined ? `the ${entry.element.partition === "session" ? "session" : "stored"} list's entry #${entry.element.index}` : "";
|
|
954
|
+
const left = snap?.droppedRows?.find((d) => d.rule === args.parsedRule.rule);
|
|
955
|
+
const unread = left === undefined ? snap?.unreadableRows?.find((u) => u.rule === args.parsedRule.rule && (u.behavior === args.candidate.behavior || u.member === "behavior")) : undefined;
|
|
959
956
|
return refusal("dot_removed", left !== undefined
|
|
960
957
|
? `this ${args.candidate.behavior} rule was stored (dot ${args.dot.actor}#${args.dot.counter}), and the store's read leaves the stored row out (${left.reason}) — it takes no part in any check, and a new consent would store it the same way`
|
|
961
958
|
: unread !== undefined
|
|
962
959
|
? `this ${args.candidate.behavior} rule was stored (dot ${args.dot.actor}#${args.dot.counter}), and the store's read cannot read the stored row back as data (its ${unread.member}: ${unread.reason}) — ${unread.reach === "as_read" ? `it applies as written${unread.member === "scope" ? " (everywhere: its scope is the part that could not be read)" : ""}, but this add of it cannot be named` : "it stands at its strictest reading (no allow rule clears a call it may reach)"} until the store serves its members as plain values`
|
|
963
|
-
:
|
|
964
|
-
? `this ${args.candidate.behavior} rule's redeemed dot ${args.dot.actor}#${args.dot.counter} is not live in the store's read, and the store serves an entry of this rule's text whose behavior word could not be read (${at}) — that entry is not read as a rule (nothing says it is a deny or an ask), so it takes no part in any check until the store serves it whole`
|
|
965
|
-
: `this ${args.candidate.behavior} rule's redeemed dot ${args.dot.actor}#${args.dot.counter} is not live in the store (removed since it was redeemed) — a removed rule is not re-landed by replaying its record; a new consent is required`);
|
|
960
|
+
: `this ${args.candidate.behavior} rule's redeemed dot ${args.dot.actor}#${args.dot.counter} is not live in the store (removed since it was redeemed) — a removed rule is not re-landed by replaying its record; a new consent is required`);
|
|
966
961
|
}
|
|
967
962
|
return { status: "redeemed", behavior: args.parsedRule.behavior, rule: args.parsedRule.rule, scope: args.candidate.scope, dot: args.dot, rev: landing.rev, alreadyRedeemed: args.replay };
|
|
968
963
|
}
|
|
@@ -1551,7 +1551,31 @@ export interface SegmentRuleSuggestion {
|
|
|
1551
1551
|
* a surface can adopt instead of writing its own, since raw command bytes displayed unprocessed can
|
|
1552
1552
|
* show a reader something other than what they authorize. */
|
|
1553
1553
|
readonly segment: string;
|
|
1554
|
+
/** What the rule reaches beyond the segment shown ({@link ruleOfferCautions}); absent when no word applies, or on an offer an
|
|
1555
|
+
* earlier release minted. */
|
|
1556
|
+
readonly cautions?: readonly RuleOfferCaution[];
|
|
1554
1557
|
}
|
|
1558
|
+
/**
|
|
1559
|
+
* The words a rule offer says it reaches beyond the call shown — the reference card's own set, read by a surface to warn before the
|
|
1560
|
+
* person says "don't ask again": `recursive_delete` (an `rm` that recurses, or a pattern over `rm`, which admits one), `writes_files`
|
|
1561
|
+
* (`mkdir` / `touch` / `rmdir` / `rm` / `mv` / `cp`), `runs_project_code` (`npm test`, `make` and `make <target>`), `whole_domain` (a
|
|
1562
|
+
* host rule), `whole_tool` (a whole-tool rule, an A2A whole-peer rule included). The reference's `shared_with_project` (a rule written
|
|
1563
|
+
* to the project's shared settings) is not in the set: an offer here names no destination. A closed set: a word a reader does not
|
|
1564
|
+
* know drops the offer ({@link import("./rule-offer-read.js").readRuleOffers}); a consumer exhaustive over it breaks on a new word.
|
|
1565
|
+
*/
|
|
1566
|
+
export declare const RULE_OFFER_CAUTIONS: readonly ["recursive_delete", "writes_files", "runs_project_code", "whole_domain", "whole_tool"];
|
|
1567
|
+
export type RuleOfferCaution = (typeof RULE_OFFER_CAUTIONS)[number];
|
|
1568
|
+
/**
|
|
1569
|
+
* The caution words of the offer whose rule is (`match`, `command`) — the ONE reading every place that builds an offer takes, from
|
|
1570
|
+
* the offer's own rule, in {@link RULE_OFFER_CAUTIONS} order. A command rule is read segment by segment (a compound's exact rule warns
|
|
1571
|
+
* for each command in it); a pattern (`prefix` / `wildcard` / `pattern`) over `rm` admits a recursive delete whatever it was minted
|
|
1572
|
+
* from. Every other match carries none.
|
|
1573
|
+
*/
|
|
1574
|
+
export declare function ruleOfferCautions(match: PersistedRuleMatch, command: string): readonly RuleOfferCaution[];
|
|
1575
|
+
/** The `cautions` seat of an offer whose rule is (`match`, `command`): the words when any applies, else nothing. */
|
|
1576
|
+
export declare function cautionsSeatOf(match: PersistedRuleMatch, command: string): {
|
|
1577
|
+
readonly cautions?: readonly RuleOfferCaution[];
|
|
1578
|
+
};
|
|
1555
1579
|
/** The batch member discriminants as a value: the `kind` words of {@link RuleOfferBatchMember}, both directions
|
|
1556
1580
|
* fenced at compile time ({@link RuleOfferBatchMemberKindsCoverEveryArm} / {@link RuleOfferBatchMemberArmsCoverEveryKind}).
|
|
1557
1581
|
* A consumer applying the degrade arm below (a member whose `kind` is outside this set drops the whole batch offer)
|
|
@@ -1637,6 +1661,9 @@ export type RuleOffer = {
|
|
|
1637
1661
|
* boundary (`a2a__<peer>`, "do not ask me again about this peer"), minted from the deployment's mounted-peers seat: the stamp the
|
|
1638
1662
|
* redemption writes onto the rule's add, the one an inside peer's question accepts. */
|
|
1639
1663
|
readonly peerFingerprint?: string;
|
|
1664
|
+
/** What the rule reaches beyond the call shown ({@link ruleOfferCautions}); absent when no word applies, or on an offer an
|
|
1665
|
+
* earlier release minted. */
|
|
1666
|
+
readonly cautions?: readonly RuleOfferCaution[];
|
|
1640
1667
|
} | {
|
|
1641
1668
|
readonly kind: "batch";
|
|
1642
1669
|
/** 1..5 per-segment members, segment order, deduplicated by rule text (design/382 B3: the
|
|
@@ -1680,7 +1680,7 @@ export function suggestRuleForTool(tool) {
|
|
|
1680
1680
|
const parsed = parseRuleText(formatRuleText("", "tool", tool), "allow");
|
|
1681
1681
|
if (!("rule" in parsed) || parsed.rule.match !== "tool" || parsed.rule.tool !== tool)
|
|
1682
1682
|
return undefined;
|
|
1683
|
-
return { kind: "single", rule: parsed.rule.rule, match: "tool", command: "" };
|
|
1683
|
+
return { kind: "single", rule: parsed.rule.rule, match: "tool", command: "", ...cautionsSeatOf("tool", "") };
|
|
1684
1684
|
}
|
|
1685
1685
|
export function suggestRuleForPeer(toolName, peerFingerprint) {
|
|
1686
1686
|
const peer = a2aPeerRuleOf(toolName);
|
|
@@ -1693,7 +1693,7 @@ export function suggestRuleForHost(tool, host) {
|
|
|
1693
1693
|
const parsed = parseRuleText(formatRuleText(host, "host", tool), "allow");
|
|
1694
1694
|
if (!("rule" in parsed) || parsed.rule.match !== "host" || parsed.rule.command !== host)
|
|
1695
1695
|
return undefined;
|
|
1696
|
-
return { kind: "single", rule: parsed.rule.rule, match: "host", command: host };
|
|
1696
|
+
return { kind: "single", rule: parsed.rule.rule, match: "host", command: host, ...cautionsSeatOf("host", host) };
|
|
1697
1697
|
}
|
|
1698
1698
|
export function suggestRuleForName(tool, name) {
|
|
1699
1699
|
if (ruleToolGrammarOf(tool) !== "name")
|
|
@@ -1728,6 +1728,34 @@ export function segmentCoverageOf(command, rules, call) {
|
|
|
1728
1728
|
};
|
|
1729
1729
|
});
|
|
1730
1730
|
}
|
|
1731
|
+
export const RULE_OFFER_CAUTIONS = Object.freeze(["recursive_delete", "writes_files", "runs_project_code", "whole_domain", "whole_tool"]);
|
|
1732
|
+
const FILE_WRITING_COMMANDS = new Set(["mkdir", "touch", "rmdir", "rm", "mv", "cp"]);
|
|
1733
|
+
const PROJECT_CODE_COMMAND = /^(?:npm test|make(?: [A-Za-z][A-Za-z0-9_-]*)?)$/;
|
|
1734
|
+
const OPEN_COMMAND_MATCHES = new Set(["prefix", "wildcard", "pattern"]);
|
|
1735
|
+
export function ruleOfferCautions(match, command) {
|
|
1736
|
+
if (match === "tool")
|
|
1737
|
+
return ["whole_tool"];
|
|
1738
|
+
if (match === "host" || match === "subdomain")
|
|
1739
|
+
return ["whole_domain"];
|
|
1740
|
+
if (match !== "exact" && !OPEN_COMMAND_MATCHES.has(match))
|
|
1741
|
+
return [];
|
|
1742
|
+
const shape = ruleLaneShapeOf(command, OFFER_READING);
|
|
1743
|
+
const found = new Set();
|
|
1744
|
+
for (const segment of "reject" in shape ? [command] : shape.segments) {
|
|
1745
|
+
const text = segment.trim();
|
|
1746
|
+
const argv = text.split(/\s+/).filter((t) => t !== "");
|
|
1747
|
+
const head = argv[0] ?? "";
|
|
1748
|
+
if (PROJECT_CODE_COMMAND.test(text))
|
|
1749
|
+
found.add("runs_project_code");
|
|
1750
|
+
else if (FILE_WRITING_COMMANDS.has(head))
|
|
1751
|
+
found.add(head === "rm" && (match !== "exact" || argv.some((a) => /^-[A-Za-z]*[rR]/.test(a) || a === "--recursive")) ? "recursive_delete" : "writes_files");
|
|
1752
|
+
}
|
|
1753
|
+
return RULE_OFFER_CAUTIONS.filter((w) => found.has(w));
|
|
1754
|
+
}
|
|
1755
|
+
export function cautionsSeatOf(match, command) {
|
|
1756
|
+
const words = ruleOfferCautions(match, command);
|
|
1757
|
+
return words.length > 0 ? { cautions: words } : {};
|
|
1758
|
+
}
|
|
1731
1759
|
export const RULE_OFFER_BATCH_MEMBER_KINDS = Object.freeze(["command", "directoryRead"]);
|
|
1732
1760
|
export const RULE_OFFER_KINDS = Object.freeze(["single", "batch"]);
|
|
1733
1761
|
export const UNCOVERED_SEGMENT_REASONS = Object.freeze(["redirection", "no_rule_form", "cap_overflow"]);
|
|
@@ -1752,7 +1780,7 @@ export function suggestRulesForCommand(command, ctx) {
|
|
|
1752
1780
|
const offers = [];
|
|
1753
1781
|
const exact = parseRuleText(formatRuleText(folded, "exact", COMMAND_RULE_TOOL), "allow");
|
|
1754
1782
|
if ("rule" in exact && exact.rule.match === "exact" && ruleAdmitsCommand(exact.rule, command)) {
|
|
1755
|
-
offers.push({ kind: "single", rule: exact.rule.rule, match: "exact", command: exact.rule.command });
|
|
1783
|
+
offers.push({ kind: "single", rule: exact.rule.rule, match: "exact", command: exact.rule.command, ...cautionsSeatOf("exact", exact.rule.command) });
|
|
1756
1784
|
}
|
|
1757
1785
|
const tokensOf = (s) => s.split(/\s+/).filter((t) => t !== "");
|
|
1758
1786
|
const bodyOf = (tokens) => longestReviewedBody(tokens) ?? genericPrefixBody(tokens);
|
|
@@ -1783,7 +1811,7 @@ export function suggestRulesForCommand(command, ctx) {
|
|
|
1783
1811
|
if (body !== undefined) {
|
|
1784
1812
|
const parsed = parseRuleText(formatRuleText(body, "wildcard", COMMAND_RULE_TOOL), "allow");
|
|
1785
1813
|
if ("rule" in parsed && parsed.rule.match === "wildcard" && ruleAdmitsCommand(parsed.rule, command)) {
|
|
1786
|
-
offers.push({ kind: "single", rule: parsed.rule.rule, match: "wildcard", command: parsed.rule.command });
|
|
1814
|
+
offers.push({ kind: "single", rule: parsed.rule.rule, match: "wildcard", command: parsed.rule.command, ...cautionsSeatOf("wildcard", parsed.rule.command) });
|
|
1787
1815
|
}
|
|
1788
1816
|
}
|
|
1789
1817
|
}
|
|
@@ -1828,7 +1856,7 @@ export function suggestRulesForCommand(command, ctx) {
|
|
|
1828
1856
|
const dirMember = mintDirectoryMember(cdDirs[i], segment);
|
|
1829
1857
|
const member = dirMember ?? (() => {
|
|
1830
1858
|
const rule = mintSegmentRule(segment);
|
|
1831
|
-
return rule !== undefined ? { kind: "command", ...rule, segment } : undefined;
|
|
1859
|
+
return rule !== undefined ? { kind: "command", ...rule, segment, ...cautionsSeatOf(rule.match, rule.command) } : undefined;
|
|
1832
1860
|
})();
|
|
1833
1861
|
if (member !== undefined && !minted.some((m) => m.rule === member.rule))
|
|
1834
1862
|
minted.push(member);
|
|
@@ -141,18 +141,17 @@ export interface EffectivePermissionRules {
|
|
|
141
141
|
* `org.disclosures`. */
|
|
142
142
|
disclosures: string[];
|
|
143
143
|
/** The personal rows that take no part in any check — a foreign writer's or a hand edit's, in practice — each with its text as
|
|
144
|
-
* served (
|
|
144
|
+
* served (an allow row whose text could not be read: the spelling of its stored fields or `(unreadable)`) and why:
|
|
145
145
|
* `scope_root_not_absolute` (its project scope root is not a complete absolute path; `scopeRoot` as served, a
|
|
146
146
|
* non-string root as its type), or an ALLOW row whose text is not a rule this grammar reads or not the canonical spelling of
|
|
147
147
|
* the row's own stored fields (`invalid_rule_text` / `metadata_mismatch`, {@link normalizePersistedRule}'s words) — or one a member of
|
|
148
148
|
* which could not be read as the type it holds (the faults {@link unreadableRows} names on a deny or ask row: `invalid_rule_text`
|
|
149
|
-
* for its text, `metadata_mismatch` for another member; `rule` is `(unreadable)` when the text is the
|
|
150
|
-
* a row only — the first member that could not be read), of the durable partition or of the session
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* deny or ask row is never left out for its spelling. Absent when none. The reader tells the person (`config.entries_not_applied`, kind `stored_rule_row`). */
|
|
149
|
+
* for its text, `metadata_mismatch` for another member; `rule` is the spelling of its fields or `(unreadable)` when the text is the
|
|
150
|
+
* one; `member` — present on such a row only — the first member that could not be read), of the durable partition or of the session
|
|
151
|
+
* one (its session's). An entry whose behavior word could not be read or is outside deny / ask / allow is NOT dropped here: it enters
|
|
152
|
+
* {@link unreadableRows} at its strictest reading (`member: "behavior"`). The optional `element` member is retained on the exported
|
|
153
|
+
* type for host-supplied views; the in-tree rule readers no longer produce it. A deny or ask row is never left out for its spelling.
|
|
154
|
+
* Absent when none. The reader tells the person (`config.entries_not_applied`, kind `stored_rule_row`). */
|
|
156
155
|
droppedRows?: ReadonlyArray<{
|
|
157
156
|
readonly reason: "scope_root_not_absolute";
|
|
158
157
|
readonly rule: string;
|
|
@@ -167,15 +166,16 @@ export interface EffectivePermissionRules {
|
|
|
167
166
|
readonly read: string;
|
|
168
167
|
};
|
|
169
168
|
}>;
|
|
170
|
-
/** The personal
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
169
|
+
/** The personal rows a member of which could not be read as the type it holds — deny and "ask me each time" rows, AND any entry whose
|
|
170
|
+
* behavior word could not be read (non-object, missing, non-string, throwing read, or a text outside deny / ask / allow): a read that
|
|
171
|
+
* throws, an object or a function where a value belongs, a list that is no list, and — every member a row holds: its behavior word,
|
|
172
|
+
* text, tool, match word and command (strings), its scope (an object), its list of adds (objects each holding its dot, an object
|
|
173
|
+
* holding its actor and counter; a hole, a primitive, an add with no dot, a dot with no actor or counter, or an add whose identity
|
|
174
|
+
* stamp only its prototype supplies — a stamp is an authorization, the add's own member only — there is an add that cannot be read) —
|
|
175
|
+
* a value that is none (absent, `null`, a number, a boolean). Such a member is the row's fault, never its partition's: the row is
|
|
176
|
+
* never read as no row, nor as a weaker one, and never ends a run (an entry whose behavior is no word of deny / ask / allow stands at
|
|
177
|
+
* its strictest reading with `behavior: "ask"` and `member: "behavior"`, since nothing says it was not a deny or an ask). The durable
|
|
178
|
+
* partition's rows and the session partition's are read the same way. Which reading it takes depends on WHICH member it is:
|
|
179
179
|
* · Its IDENTITY read — the stored fields the row's checks read to tell whether it reaches a call and what it then says (`tool`,
|
|
180
180
|
* `match`, and `command` save on a whole-tool row) — or, where one of them could not be read, its text did and is a rule this
|
|
181
181
|
* grammar reads: the row's identity is then ALL its text's (tool, match and command from the text's parse, the ones that read
|
|
@@ -188,22 +188,24 @@ export interface EffectivePermissionRules {
|
|
|
188
188
|
* row's, its session); a whole-tool row's command as `""`; its adds are those that could be read, or — none could — one unnamed add
|
|
189
189
|
* (`{ dot: { actor: "", counter: 0 }, origin: "user", createdAt: "" }`: a dot no write makes, so no redemption, delete or
|
|
190
190
|
* reconciliation names it), so it is live — a row whose adds read as an empty list no longer exists and is not named.
|
|
191
|
-
* · Its identity could not be read from its fields nor from its text (
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* (
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* `
|
|
203
|
-
*
|
|
204
|
-
* the text is the member)
|
|
205
|
-
*
|
|
206
|
-
*
|
|
191
|
+
* · Its identity could not be read from its fields nor from its text (or its behavior word could not be read): what it refuses is
|
|
192
|
+
* unknown, so it is not in `rules`, and it is never read as no row. It stands at its STRICTEST reading over the calls it may reach
|
|
193
|
+
* (`reach`, in its scope): such a call takes the answer a call takes while a partition cannot be read — no allow row clears it, a
|
|
194
|
+
* readable deny still refuses it, a readable ask row reaching it still asks (both questions ride the call), otherwise it is the store
|
|
195
|
+
* form's question — and every other row stands as read. `reach` is `{ tool }` when the row's tool reads as a tool name and only the
|
|
196
|
+
* gate judges rows like it (an ask row of any tool; a deny or unknown-behavior row of a tool whose rules speak for no path face):
|
|
197
|
+
* the calls a readable row of that tool would be read for. It is `every` otherwise — a deny or unknown-behavior row of a tool whose
|
|
198
|
+
* rules the path tables of the file, shell and search checks also read (those tables cannot hold a row nobody can read), or a row
|
|
199
|
+
* whose tool cannot be read — and while such a row stands, a path check that is no call refuses, as for a partition that could not
|
|
200
|
+
* be read.
|
|
201
|
+
* `behavior` is the row's own word (`"ask"` when its behavior word could not be read); `scope` is present when the row's scope reads
|
|
202
|
+
* as a durable scope or, a session partition's row, as its session's (absent: everywhere); `rule` is the row's ONE name: the text it
|
|
203
|
+
* stands under in `rules` for a row that stands as written (the spelling of its fields when the text is the member), the text as served
|
|
204
|
+
* otherwise (`(unreadable)` when the text is the member) — `removePersistedRule` retires only rows stored whole and answers `failed`
|
|
205
|
+
* (`committed: "no"`, telling the person to remove it in the store) when a displayed name matches a damaged restriction or standalone
|
|
206
|
+
* unretireable row; `member` the first member that could not be read; `reason` the word an allow row left out for the same fault takes
|
|
207
|
+
* (`invalid_rule_text` for its text, `metadata_mismatch` for another member). Absent when none. The reader tells the person
|
|
208
|
+
* (`config.entries_not_applied`, kind `stored_rule_row`). A date object where a time belongs is no such fault: it reads as its ISO text. */
|
|
207
209
|
unreadableRows?: ReadonlyArray<{
|
|
208
210
|
readonly reason: "invalid_rule_text" | "metadata_mismatch";
|
|
209
211
|
readonly rule: string;
|