@sema-agent/core 7.69.0 → 7.69.1
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 +583 -0
- package/dist/agents/repair-loop.js +6 -14
- package/dist/agents/subagent.js +2 -1
- package/dist/agents/verify.d.ts +1 -1
- package/dist/agents/verify.js +7 -1
- package/dist/brain/reasoning-request.d.ts +7 -0
- package/dist/brain/reasoning-request.js +6 -0
- package/dist/core/agent-config-dir.d.ts +39 -3
- package/dist/core/agent-config-dir.js +67 -11
- package/dist/core/allow-entry.d.ts +5 -5
- package/dist/core/allow-entry.js +12 -6
- 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/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +1 -0
- package/dist/core/auto-compaction.d.ts +44 -62
- package/dist/core/auto-compaction.js +44 -103
- package/dist/core/cache-break-detector.d.ts +23 -11
- package/dist/core/cache-break-detector.js +11 -5
- package/dist/core/checkpoint-features.d.ts +1 -1
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-row-verdict.js +3 -0
- package/dist/core/checkpoint-store.d.ts +13 -2
- package/dist/core/child-clamp-seats.d.ts +30 -3
- package/dist/core/child-clamp-seats.js +24 -0
- package/dist/core/compaction-retired-members.d.ts +12 -0
- package/dist/core/compaction-retired-members.js +22 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +2 -0
- package/dist/core/context-edit.d.ts +32 -17
- package/dist/core/context-edit.js +28 -0
- package/dist/core/cron.d.ts +68 -0
- package/dist/core/cron.js +259 -0
- package/dist/core/engine-attestation.d.ts +16 -0
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-capabilities.d.ts +14 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +18 -7
- package/dist/core/engine-version.js +1 -1
- package/dist/core/gate-outcome.d.ts +29 -2
- package/dist/core/gate-outcome.js +6 -0
- package/dist/core/git-read-only.d.ts +10 -0
- package/dist/core/git-read-only.js +1 -0
- package/dist/core/git-worktree-env.js +9 -8
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- package/dist/core/locked-config.js +7 -3
- package/dist/core/lsp.d.ts +3 -0
- package/dist/core/lsp.js +3 -2
- package/dist/core/memory-engine/engine.d.ts +48 -12
- package/dist/core/memory-engine/engine.js +108 -46
- package/dist/core/memory-engine/file-backend.d.ts +2 -1
- package/dist/core/memory-engine/index-copies.d.ts +47 -0
- package/dist/core/memory-engine/index-copies.js +88 -0
- package/dist/core/memory-engine/layout.d.ts +20 -3
- package/dist/core/memory-engine/layout.js +39 -3
- package/dist/core/memory-engine/origin-clearance.d.ts +9 -7
- package/dist/core/memory-engine/origin-clearance.js +2 -4
- package/dist/core/memory-engine/types.d.ts +16 -3
- package/dist/core/mode-policy.d.ts +7 -1
- package/dist/core/mode-policy.js +9 -0
- package/dist/core/mods/session-compact.js +3 -3
- package/dist/core/mods/stations.d.ts +2 -0
- package/dist/core/mods/stations.js +2 -1
- package/dist/core/path-guard-rows.d.ts +8 -3
- package/dist/core/path-guard-rows.js +18 -5
- package/dist/core/peer-seat.d.ts +3 -0
- package/dist/core/peer-seat.js +3 -0
- package/dist/core/permission-rule-model.js +3 -2
- package/dist/core/process-identity.d.ts +11 -3
- package/dist/core/process-identity.js +26 -16
- package/dist/core/runner/assemble-result.d.ts +5 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/cleared-results-record.d.ts +33 -0
- package/dist/core/runner/cleared-results-record.js +56 -0
- package/dist/core/runner/compact-session.js +14 -9
- package/dist/core/runner/compaction-knobs.d.ts +1 -1
- package/dist/core/runner/continuation-gate.js +2 -1
- package/dist/core/runner/continues-from.d.ts +1 -1
- package/dist/core/runner/continues-from.js +1 -1
- package/dist/core/runner/contracts.d.ts +83 -31
- package/dist/core/runner/conversation-segment.d.ts +19 -12
- package/dist/core/runner/conversation-segment.js +27 -7
- package/dist/core/runner/derived-route-fallback.d.ts +2 -12
- package/dist/core/runner/derived-route-fallback.js +0 -6
- package/dist/core/runner/gate-exit.d.ts +2 -1
- package/dist/core/runner/gate-exit.js +4 -2
- package/dist/core/runner/git-status-frame.d.ts +2 -2
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/leg-caller-places.d.ts +39 -0
- package/dist/core/runner/leg-caller-places.js +23 -0
- package/dist/core/runner/leg-frame.d.ts +8 -2
- package/dist/core/runner/leg-receipt.d.ts +29 -2
- package/dist/core/runner/leg-receipt.js +37 -6
- package/dist/core/runner/media-removed-seat.d.ts +10 -6
- package/dist/core/runner/media-removed-seat.js +6 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -1
- package/dist/core/runner/messages-omitted-seat.js +15 -5
- package/dist/core/runner/person-path-rows.d.ts +25 -7
- package/dist/core/runner/person-path-rows.js +16 -2
- package/dist/core/runner/prefix-ledger.d.ts +120 -0
- package/dist/core/runner/prefix-ledger.js +176 -0
- package/dist/core/runner/prepare-advisor.d.ts +2 -0
- package/dist/core/runner/prepare-advisor.js +2 -1
- package/dist/core/runner/prepare-artifact.d.ts +3 -0
- package/dist/core/runner/prepare-artifact.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -8
- package/dist/core/runner/prepare-config-doors.js +15 -12
- package/dist/core/runner/prepare-context-lane.d.ts +25 -6
- package/dist/core/runner/prepare-context-lane.js +82 -27
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -2
- package/dist/core/runner/prepare-gate-stations.js +2 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +18 -5
- package/dist/core/runner/prepare-hands-readface.js +41 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -0
- package/dist/core/runner/prepare-inherited-gate.js +2 -0
- package/dist/core/runner/prepare-memory.d.ts +10 -2
- package/dist/core/runner/prepare-memory.js +51 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +3 -0
- package/dist/core/runner/prepare-policy-chain.js +13 -2
- package/dist/core/runner/prepare-prompt-assembly.d.ts +12 -4
- package/dist/core/runner/prepare-prompt-assembly.js +10 -4
- package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -7
- package/dist/core/runner/prepare-prompt-inputs.js +6 -7
- package/dist/core/runner/prepare-safety-scan.js +7 -0
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -0
- package/dist/core/runner/prepare-suspend-saga.js +3 -2
- package/dist/core/runner/prepare-task.js +59 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -11
- package/dist/core/runner/prepare-tool-disclosure-mount.js +7 -8
- package/dist/core/runner/prepare-turn-wiring.d.ts +16 -25
- package/dist/core/runner/prepare-turn-wiring.js +8 -18
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/prompt-suggestions.d.ts +3 -1
- package/dist/core/runner/prompt-suggestions.js +1 -1
- package/dist/core/runner/read-block-judge.d.ts +47 -0
- package/dist/core/runner/read-block-judge.js +33 -0
- package/dist/core/runner/role-resolution-table.d.ts +15 -10
- package/dist/core/runner/role-resolution-table.js +4 -5
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +7 -4
- package/dist/core/runner/rule-store-unreadable-notice.js +4 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +0 -10
- package/dist/core/runner/run-compaction-machinery.js +3 -39
- package/dist/core/runner/run-harness-handlers.js +4 -17
- package/dist/core/runner/run-identity-wiring.js +4 -1
- package/dist/core/runner/run-leg.js +11 -1
- package/dist/core/runner/run-recovery-lanes.d.ts +0 -4
- package/dist/core/runner/run-recovery-lanes.js +34 -18
- package/dist/core/runner/run-settle-and-teardown.d.ts +1 -3
- package/dist/core/runner/run-settle-and-teardown.js +14 -22
- package/dist/core/runner/run-telemetry-and-budget-seats.js +0 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +11 -30
- package/dist/core/runner/run-terminal-adoption.js +5 -88
- package/dist/core/runner/run-tool-mount-facts.js +1 -5
- package/dist/core/runner/run-turn-boundary.js +56 -26
- package/dist/core/runner/runtask.js +7 -7
- package/dist/core/runner/session-hash-salt.d.ts +18 -0
- package/dist/core/runner/session-hash-salt.js +36 -0
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +3 -3
- package/dist/core/runner/side-call-account.d.ts +9 -1
- package/dist/core/runner/side-call-account.js +15 -4
- package/dist/core/runner/skill-mention.d.ts +12 -0
- package/dist/core/runner/skill-mention.js +50 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-table-view.d.ts +5 -9
- package/dist/core/runner/tool-table-view.js +23 -21
- package/dist/core/runner/write-protection-station.d.ts +5 -2
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +25 -27
- package/dist/core/scheduler.d.ts +13 -3
- package/dist/core/scheduler.js +0 -12
- package/dist/core/secret-env.d.ts +47 -11
- package/dist/core/secret-env.js +65 -4
- package/dist/core/sensitive-path-policy.js +4 -0
- package/dist/core/session-checkout.js +10 -9
- package/dist/core/shell-read-silence.d.ts +2 -1
- package/dist/core/shell-run-candidates.d.ts +1 -1
- package/dist/core/shell-run-candidates.js +11 -3
- package/dist/core/task-event.d.ts +32 -10
- package/dist/core/task-intake.d.ts +5 -3
- package/dist/core/task-intake.js +6 -2
- package/dist/core/task-result.d.ts +39 -0
- package/dist/core/task-spec-members.d.ts +3 -0
- package/dist/core/task-spec-members.js +2 -2
- package/dist/core/task-spec.d.ts +37 -20
- package/dist/core/tool-policy.d.ts +30 -18
- package/dist/core/tool-policy.js +44 -32
- package/dist/core/tool-roster.d.ts +21 -7
- package/dist/core/tool-roster.js +34 -6
- package/dist/core/tool-spec-members.js +1 -1
- package/dist/core/tool-spec.d.ts +27 -0
- package/dist/core/tools.js +1 -0
- package/dist/core/trace.d.ts +42 -19
- package/dist/core/unc-spelling.d.ts +31 -0
- package/dist/core/unc-spelling.js +51 -0
- package/dist/core/wiring-manifest.d.ts +30 -3
- package/dist/core/wiring-manifest.js +10 -0
- package/dist/core/workflow-run-store-contract.js +22 -0
- package/dist/core/workflow-run-store.d.ts +17 -13
- package/dist/core/workflow-run-store.js +1 -1
- package/dist/core/write-protect.d.ts +4 -0
- package/dist/core/write-protect.js +17 -15
- package/dist/engine/compaction/compaction.d.ts +48 -98
- package/dist/engine/compaction/compaction.js +136 -216
- package/dist/engine/compaction/utils.d.ts +2 -11
- package/dist/engine/compaction/utils.js +4 -13
- package/dist/engine/execution-env/node-execution-env.js +17 -6
- package/dist/engine/harness/agent-harness.d.ts +19 -5
- package/dist/engine/harness/agent-harness.js +18 -7
- package/dist/engine/harness/types.d.ts +5 -7
- package/dist/engine/loop/agent-loop.d.ts +14 -1
- package/dist/engine/loop/agent-loop.js +31 -11
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/index.d.ts +9 -6
- package/dist/index.js +8 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/orchestration/run-spec.js +7 -2
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow-park-adoption.d.ts +66 -8
- package/dist/orchestration/workflow-park-adoption.js +195 -45
- package/dist/orchestration/workflow-types.d.ts +20 -0
- package/dist/orchestration/workflow-types.js +1 -0
- package/dist/orchestration/workflow.d.ts +3 -2
- package/dist/orchestration/workflow.js +10 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/events.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/mechanism.d.ts +8 -0
- package/dist/prompt-assembly/catalog/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +1 -1
- package/dist/prompt-assembly/catalog/schema.js +1 -0
- package/dist/prompt-assembly/catalog/sections.js +8 -0
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/select.js +1 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +14 -27
- package/dist/prompt-assembly/turn-snapshot.js +6 -18
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/default.d.ts +9 -0
- package/dist/prompts/default.js +4 -0
- package/dist/shell/lex.d.ts +75 -11
- package/dist/shell/lex.js +340 -76
- package/dist/tools/fs/bash-program-position.js +2 -6
- package/dist/tools/fs/bash-readonly-classifier.d.ts +18 -3
- package/dist/tools/fs/bash-readonly-classifier.js +19 -9
- package/dist/tools/fs/containment-face.d.ts +12 -3
- package/dist/tools/fs/containment-face.js +16 -7
- package/dist/tools/fs/file-read-check.d.ts +26 -1
- package/dist/tools/fs/file-read-check.js +20 -2
- package/dist/tools/fs/fs-bash.js +4 -4
- package/dist/tools/fs/fs-read.d.ts +3 -0
- package/dist/tools/fs/fs-read.js +2 -2
- 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/index.js +5 -3
- package/dist/tools/fs/pdf.js +12 -4
- package/dist/tools/fs/read-deny-home.d.ts +13 -2
- package/dist/tools/fs/read-deny-home.js +26 -22
- package/dist/tools/fs/read-deny.js +15 -6
- package/dist/tools/fs/removal-targets.d.ts +33 -17
- package/dist/tools/fs/removal-targets.js +160 -61
- package/dist/tools/fs/repo-map.d.ts +1 -1
- package/dist/tools/fs/repo-map.js +2 -2
- package/dist/tools/fs/safety.d.ts +28 -5
- package/dist/tools/fs/safety.js +72 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +8 -2
- package/dist/tools/fs/shell-read-bindings.js +25 -6
- package/dist/tools/fs/shell-read-check.d.ts +3 -0
- package/dist/tools/fs/shell-read-check.js +22 -4
- package/dist/tools/fs/shell-read-establish.js +73 -43
- package/dist/tools/fs/shell-read-judge.d.ts +32 -14
- package/dist/tools/fs/shell-read-judge.js +13 -5
- package/dist/tools/fs/shell-read-object-path.d.ts +5 -1
- package/dist/tools/fs/shell-read-object-path.js +17 -4
- package/dist/tools/fs/shell-read-plan.d.ts +8 -2
- package/dist/tools/fs/shell-read-plan.js +36 -22
- package/dist/tools/fs/shell-read-sourced.js +12 -4
- package/dist/tools/fs/shell-read-start.d.ts +4 -2
- package/dist/tools/fs/shell-read-start.js +3 -3
- package/dist/tools/fs/shell-read-workdir.d.ts +14 -6
- package/dist/tools/fs/shell-read-workdir.js +35 -17
- package/dist/tools/scheduler-tools.d.ts +7 -17
- package/dist/tools/scheduler-tools.js +9 -85
- package/dist/tools/worktree.js +5 -4
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +47 -1
- package/wire-changes/core-stores-sql@7.68.6.json +39 -0
- package/wire-changes/core-stores-sql@7.69.1.json +39 -0
- package/wire-changes/core@7.68.6.json +125 -0
- package/wire-changes/core@7.69.1.json +2561 -0
- package/wire-changes/mods-kernel@7.68.6.json +39 -0
- package/wire-changes/mods-kernel@7.69.1.json +39 -0
- package/wire-changes/primitives@7.68.6.json +39 -0
- package/wire-changes/primitives@7.69.1.json +39 -0
- package/wire-changes/wiki-gate@7.68.6.json +39 -0
- package/wire-changes/wiki-gate@7.69.1.json +39 -0
- package/dist/core/runner/prompt-hash-salt.d.ts +0 -1
- package/dist/core/runner/prompt-hash-salt.js +0 -2
|
@@ -173,7 +173,8 @@ export async function runRepairLoop(runner, implSpec, config) {
|
|
|
173
173
|
let laterAttemptSpec = implSpec;
|
|
174
174
|
const ownSpend = () => ({ costMicroUsd: anyAttemptUnpriced ? undefined : ownCostMicro, tokens: ownTokens, turns: ownTurns });
|
|
175
175
|
const cleanRestartSpec = () => ({ ...withoutSessionBinding(laterAttemptSpec), objective: `${implSpec.objective}\n\n${repairObjective(bundle)}` });
|
|
176
|
-
const
|
|
176
|
+
const gaveUp = (last, overAllowance) => ({ ...closeComposition(last, attempts), stats: cumulativeStats(last.stats), repairTerminal: "gave_up", bundle, ...(isolationClass ? { isolationClass } : {}), oracleCostMicroUsd, verification: { ...outcomeFor("gave_up", lastOracle, bundle.attemptCount), ...(overAllowance !== undefined ? { allowanceExhausted: overAllowance } : {}) } });
|
|
177
|
+
const stopBeforeDispatch = (message, errorCode) => lastResult !== undefined ? gaveUp(lastResult) : ({
|
|
177
178
|
taskId: implSpec.taskId ?? "",
|
|
178
179
|
result: message ?? `repair loop: attempt budget already spent (attemptCount ${bundle.attemptCount} >= maxAttempts ${maxAttempts}) — no attempt dispatched`, resultEntryIds: [],
|
|
179
180
|
intake: { committed: false },
|
|
@@ -189,12 +190,12 @@ export async function runRepairLoop(runner, implSpec, config) {
|
|
|
189
190
|
});
|
|
190
191
|
while (true) {
|
|
191
192
|
if (!restartedOnce && bundle.attemptCount >= maxAttempts)
|
|
192
|
-
return
|
|
193
|
+
return stopBeforeDispatch();
|
|
193
194
|
if (config.costCeilingMicroUsd != null && spend >= config.costCeilingMicroUsd) {
|
|
194
|
-
return
|
|
195
|
+
return stopBeforeDispatch(`repair loop: cost ceiling already spent (carried ${spend} >= ceiling ${config.costCeilingMicroUsd} micro-USD) — no attempt dispatched`, "repair.budget_exhausted");
|
|
195
196
|
}
|
|
196
197
|
if (config.totalTimeoutMs != null && priorActiveMs + (Date.now() - startedAt) >= config.totalTimeoutMs) {
|
|
197
|
-
return
|
|
198
|
+
return stopBeforeDispatch(`repair loop: active time budget already spent (carried ${priorActiveMs + (Date.now() - startedAt)}ms >= ${config.totalTimeoutMs}ms) — no attempt dispatched`, "repair.budget_exhausted");
|
|
198
199
|
}
|
|
199
200
|
stampAccount();
|
|
200
201
|
const isRepair = bundle.attemptCount > 0 && lastResult !== undefined && !restartedOnce;
|
|
@@ -284,16 +285,7 @@ export async function runRepairLoop(runner, implSpec, config) {
|
|
|
284
285
|
restartedOnce = true;
|
|
285
286
|
continue;
|
|
286
287
|
}
|
|
287
|
-
|
|
288
|
-
return {
|
|
289
|
-
...closeComposition(lastResult, attempts),
|
|
290
|
-
stats: cumulativeStats(lastResult.stats),
|
|
291
|
-
repairTerminal: terminal,
|
|
292
|
-
bundle,
|
|
293
|
-
...(isolationClass ? { isolationClass } : {}),
|
|
294
|
-
oracleCostMicroUsd,
|
|
295
|
-
verification: { ...outcomeFor(terminal, lastOracle, bundle.attemptCount), ...(overAllowance !== undefined ? { allowanceExhausted: overAllowance } : {}) },
|
|
296
|
-
};
|
|
288
|
+
return gaveUp(result, overAllowance);
|
|
297
289
|
}
|
|
298
290
|
}
|
|
299
291
|
}
|
package/dist/agents/subagent.js
CHANGED
|
@@ -106,6 +106,7 @@ import { OUTPUT_TOOL_NAME, mountRuleFace, toolFace } from "../core/tool-catalog-
|
|
|
106
106
|
import { canonicalNameValue } from "../core/permission-rule-model.js";
|
|
107
107
|
import { definitionAllowTools, definitionSelectorLayer, inheritedChildPool, inheritedHostSeats, inheritedMcpDeclarations, selectorLayerOf, withDefinitionServers, withoutWakerSeats } from "./inherited-tool-pool.js";
|
|
108
108
|
import { codedRefusal, readMember, thrownMarksOf, thrownText } from "../core/thrown-value.js";
|
|
109
|
+
import { GIT_READ_ONLY } from "../core/git-read-only.js";
|
|
109
110
|
const BG_AGENT_RESULT_MAX = 4_000;
|
|
110
111
|
const BG_AGENT_RESULT_FULL_MAX = 200_000;
|
|
111
112
|
function resultSettleFields(result) {
|
|
@@ -345,7 +346,7 @@ export function createSubagentWorktreeHelper(baseEnv, repoRoot, parentFloor) {
|
|
|
345
346
|
const readFloorNow = () => { const readFloor = parentFloor(); return readFloor !== undefined ? { readFloor } : {}; };
|
|
346
347
|
return {
|
|
347
348
|
async mint(childId) {
|
|
348
|
-
const probe = await baseEnv.exec(
|
|
349
|
+
const probe = await baseEnv.exec(`${GIT_READ_ONLY} rev-parse --is-inside-work-tree`, { cwd: repoRoot, ...readFloorNow() });
|
|
349
350
|
if (!probe.ok || probe.value.exitCode !== 0) {
|
|
350
351
|
const detail = probe.ok ? (probe.value.stderr || probe.value.stdout).trim().split("\n")[0] : thrownText(probe.error);
|
|
351
352
|
throw Object.assign(new Error(`the working directory ${repoRoot} is not a git repository${detail ? ` (${detail})` : ""}`), { code: WORKTREE_NOT_A_REPOSITORY });
|
package/dist/agents/verify.d.ts
CHANGED
|
@@ -302,7 +302,7 @@ export declare function verifyCompleted(runner: RunnerSelfSeat, result: TaskResu
|
|
|
302
302
|
* spawned it — its frames can arrive interleaved into a later leg's segment.
|
|
303
303
|
*
|
|
304
304
|
* ONE SEAT IS EXEMPT, because its frames are per-leg by construction: `onLegFrame` is handed every
|
|
305
|
-
* frame a leg offers with that leg's address (its task id and
|
|
305
|
+
* frame a leg offers with that leg's address (its task id, session and run id, engine facts), and this gate
|
|
306
306
|
* adds the leg's own LABEL (`at.leg`: `impl` / `verifier` / `fix` with the round). That label is
|
|
307
307
|
* minted HERE, in the dispatch that knows it — the engine stamps none — so this seat's consumer reads
|
|
308
308
|
* per-leg attribution instead of reconstructing it from arrival order. It is also the one place the
|
package/dist/agents/verify.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { namesRoleBase } from "../prompt-assembly/role-base.js";
|
|
3
3
|
import { releaseSession } from "./session-util.js";
|
|
4
|
-
import { childClampSeats, clampSourceOf, engineHeadlessLegSeats } from "../core/child-clamp-seats.js";
|
|
4
|
+
import { childClampSeats, clampSourceOf, engineHeadlessLegSeats, unionAddOnly } from "../core/child-clamp-seats.js";
|
|
5
5
|
import { applyParentSpecSeat, parentSpecSeatOf } from "../core/parent-spec-seat.js";
|
|
6
6
|
import { mapNestedSuspend, isDurablePause, pauseFamily } from "./suspend-guard.js";
|
|
7
7
|
import { delimitUntrusted, sanitizeUntrustedText } from "../core/untrusted-text.js";
|
|
@@ -127,6 +127,8 @@ async function verifyCompletedPlaced(runner, result, specBase, objective, config
|
|
|
127
127
|
const foldedRootsFace = specBase.readFace === "roots" || result.effectiveReadFace === "roots";
|
|
128
128
|
const foldedRootsWriteFace = specBase.writeFace === "roots" || result.effectiveWriteFace === "roots";
|
|
129
129
|
const foldedReadDeny = [...(specBase.readDenyPatterns ?? []), ...(result.effectiveReadDenyPatterns ?? [])];
|
|
130
|
+
const foldedConfigDirs = unionAddOnly("agentConfigDirs", specBase.agentConfigDirs, result.effectiveAgentConfigDirs);
|
|
131
|
+
const foldedHomeDirs = unionAddOnly("agentHomeDirs", specBase.agentHomeDirs, result.effectiveAgentHomeDirs);
|
|
130
132
|
const carryFrozenPosture = (r) => {
|
|
131
133
|
const face = result.effectiveReadFace === "roots" ? "roots" : r.effectiveReadFace;
|
|
132
134
|
const keyOf = (e) => `${e.caseSensitive ? "s" : "i"} ${e.pattern}`;
|
|
@@ -168,6 +170,8 @@ async function verifyCompletedPlaced(runner, result, specBase, objective, config
|
|
|
168
170
|
readFace: foldedRootsFace ? "roots" : undefined,
|
|
169
171
|
writeFace: foldedRootsWriteFace ? "roots" : undefined,
|
|
170
172
|
readDenyPatterns: foldedReadDeny,
|
|
173
|
+
agentConfigDirs: foldedConfigDirs,
|
|
174
|
+
agentHomeDirs: foldedHomeDirs,
|
|
171
175
|
}),
|
|
172
176
|
outputSchema: VerdictSchema,
|
|
173
177
|
enableBlockedReport: false,
|
|
@@ -295,6 +299,8 @@ async function verifyCompletedPlaced(runner, result, specBase, objective, config
|
|
|
295
299
|
readFace: foldedRootsFace ? "roots" : specBase.readFace,
|
|
296
300
|
writeFace: foldedRootsWriteFace ? "roots" : specBase.writeFace,
|
|
297
301
|
readDenyPatterns: foldedReadDeny,
|
|
302
|
+
agentConfigDirs: foldedConfigDirs,
|
|
303
|
+
agentHomeDirs: foldedHomeDirs,
|
|
298
304
|
}),
|
|
299
305
|
};
|
|
300
306
|
current = await runner.runTask(fixLegSpec, withLegIdentity(legInternals(), { kind: "fix", round }, internals));
|
|
@@ -152,6 +152,13 @@ export declare function resolutionOf(requested: ThinkingLevel, carried: Reasonin
|
|
|
152
152
|
* A `requested` outside the seven tiers is refused (`config.invalid_argument`).
|
|
153
153
|
*/
|
|
154
154
|
export declare function resolveReasoning(requested: ThinkingLevel, model: ReasoningRequestModel, facts?: ReasoningWireFacts): ResolvedReasoning;
|
|
155
|
+
/**
|
|
156
|
+
* Whether a request of tier `level` on `model`'s wire sizes its thinking budget from its output cap — read off the applier
|
|
157
|
+
* itself (a probe request at a soft cap, `tried` as an engine turn tries an undeclared tier): true exactly when the keys it
|
|
158
|
+
* writes carry a token budget (the Messages budget form), the one wire where a request's output cap changes what the provider
|
|
159
|
+
* renders ahead of the messages. Everywhere else the cap is a decoding control and a request's thinking keys do not read it.
|
|
160
|
+
*/
|
|
161
|
+
export declare function thinkingBudgetFollowsCap(model: ReasoningRequestModel, level: ThinkingLevel | undefined, tried: boolean): boolean;
|
|
155
162
|
/**
|
|
156
163
|
* #692 C-c — the effort tiers that actually REACH THE WIRE for this model, derived from the wire applier: the enabled tiers
|
|
157
164
|
* `t` for which a request of tier `t` carries an effort value and says `t` (not clamped, not suppressed by a `null`
|
|
@@ -243,6 +243,12 @@ export function resolveReasoning(requested, model, facts) {
|
|
|
243
243
|
});
|
|
244
244
|
return resolutionOf(requested, carried, api);
|
|
245
245
|
}
|
|
246
|
+
export function thinkingBudgetFollowsCap(model, level, tried) {
|
|
247
|
+
if (level === undefined)
|
|
248
|
+
return false;
|
|
249
|
+
const { body } = applyReasoningToRequest({ api: model.api ?? "unknown", model, level, body: { max_tokens: CAP_BLIND }, budget: { capIsHard: false }, ...(tried ? { withheld: [] } : {}) });
|
|
250
|
+
return isPlainObject(body.thinking) && body.thinking.budget_tokens !== undefined;
|
|
251
|
+
}
|
|
246
252
|
export function reasoningEffortLevelsOf(model) {
|
|
247
253
|
const api = model.api ?? "unknown";
|
|
248
254
|
const honored = THINKING_LEVELS.filter((t) => {
|
|
@@ -14,7 +14,43 @@ export declare const AGENT_CONFIG_DIR_INVALID_CODE = "config.agent_config_dir_in
|
|
|
14
14
|
export declare function agentConfigDirTail(run: string, caseSensitive?: boolean): string | undefined;
|
|
15
15
|
/** The segments of a declared root in lexical normal form — what a path's leading segments are compared with. */
|
|
16
16
|
export declare function agentConfigDirSegments(dir: string): string[];
|
|
17
|
-
/** The declared
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/** The code a declared HOME that names no directory is refused with (the caller's home, `TaskSpec.agentHomeDirs`). */
|
|
18
|
+
export declare const AGENT_HOME_DIR_INVALID_CODE = "config.agent_home_dir_invalid";
|
|
19
|
+
/**
|
|
20
|
+
* The two kinds of directory a host or a caller declares for the deny tables to place rows at — one check, one sentence
|
|
21
|
+
* shape, one code each:
|
|
22
|
+
* · `config` — a configuration root (`RunnerDeps.agentConfigDir`, `TaskSpec.agentConfigDirs`): the rows that open with the
|
|
23
|
+
* configuration directory's name are also placed below it ({@link agentConfigDirTail});
|
|
24
|
+
* · `home` — a home directory of the CALLER (`TaskSpec.agentHomeDirs`): the home-anchored read deny rows (`~/…`) are also
|
|
25
|
+
* placed below it, beside the homes the engine's own environment declares.
|
|
26
|
+
*/
|
|
27
|
+
export type DeclaredDirKind = "config" | "home";
|
|
28
|
+
/** A declared directory as given (`undefined` = none declared), or a refusal naming the seat and the shape of the value: not
|
|
29
|
+
* a string, empty, not absolute, no such directory, not a directory, not readable. The directory is looked at on the
|
|
30
|
+
* host's own file system — the host that declares it is the host that keeps it. */
|
|
31
|
+
export declare function checkedDeclaredDir(kind: DeclaredDirKind, value: unknown, seat: string): string | undefined;
|
|
32
|
+
/** The declared configuration root as given (`undefined` = none declared, the default location) — {@link checkedDeclaredDir}
|
|
33
|
+
* for the `config` kind. */
|
|
20
34
|
export declare function checkedAgentConfigDir(value: string | undefined, seat: string): string | undefined;
|
|
35
|
+
/** The task layer's seat for a kind (`TaskSpec.agentConfigDirs`, `TaskSpec.agentHomeDirs`) as its caller wrote it: absent, or
|
|
36
|
+
* a list whose every entry the one check accepts, each named by its index — the same code, the same sentences. A value that
|
|
37
|
+
* is not a list is refused under the same code (it would otherwise be read letter by letter). Every index is read, a hole
|
|
38
|
+
* too. Returns nothing: the leg reads the seat itself. */
|
|
39
|
+
export declare function assertTaskDeclaredDirs(kind: DeclaredDirKind, value: unknown, seat: string): void;
|
|
40
|
+
/** The clamp table's task-layer door for a kind's list: {@link assertTaskDeclaredDirs} under the row's owner label. */
|
|
41
|
+
export declare function declaredDirDoor(kind: DeclaredDirKind): (value: unknown, owner: string) => void;
|
|
42
|
+
/** The clamp table's entry law for a kind's list: `undefined` ⇔ the one entry check accepts the entry, else its refusal
|
|
43
|
+
* sentence (labelled with `owner`). */
|
|
44
|
+
export declare function declaredDirEntryLaw(kind: DeclaredDirKind): (entry: unknown, owner: string) => string | undefined;
|
|
45
|
+
/** The identity two declared directories fold by — every place that asks "is this the same declared directory" (the clamp
|
|
46
|
+
* table's union, the leg mint's sources, a caller home beside the engine's own) reads this one: a trailing slash, a `.`
|
|
47
|
+
* segment and a doubled separator fold away; a `..` segment does NOT ({@link foldRedundantPathSegments}): `a/link/..` and `a`
|
|
48
|
+
* are different directories when `link` is a symlink, and folding them would drop one of two declared places. Two spellings
|
|
49
|
+
* of one directory that survive this fold are both kept, and the row is placed at it twice — over-keeping costs nothing. */
|
|
50
|
+
export declare function declaredDirIdentity(dir: string): string;
|
|
51
|
+
/** A recorded list (`CheckpointState.agentConfigDirs` / `agentHomeDirs`) as a resume reads it: absent, or a list of absolute
|
|
52
|
+
* path strings — the shape a mint writes. Existence is not asked: it is the declaring moment's check (a typo guard), and a
|
|
53
|
+
* directory removed since is still placed at its spelling (a placement reads "no such directory" as nothing below it). A
|
|
54
|
+
* value of another shape is a damaged row, refused under the kind's code. Every index is read, a hole too (a store that
|
|
55
|
+
* keeps the row as an object, not JSON, can carry one). */
|
|
56
|
+
export declare function recordedDeclaredDirs(kind: DeclaredDirKind, value: unknown, seat: string): readonly string[] | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
|
-
import { normalizeAbsPathLexically } from "../tools/fs/safety.js";
|
|
2
|
+
import { foldRedundantPathSegments, normalizeAbsPathLexically } from "../tools/fs/safety.js";
|
|
3
3
|
import { validatePath } from "./effective-path-target.js";
|
|
4
|
+
import { thrownText } from "./thrown-value.js";
|
|
4
5
|
export const AGENT_CONFIG_DIR_SEGMENT = ".sema";
|
|
5
6
|
export const AGENT_CONFIG_DIR_INVALID_CODE = "config.agent_config_dir_invalid";
|
|
6
7
|
export function agentConfigDirTail(run, caseSensitive = false) {
|
|
@@ -21,30 +22,85 @@ function shown(value) {
|
|
|
21
22
|
return typeof value;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
export const AGENT_HOME_DIR_INVALID_CODE = "config.agent_home_dir_invalid";
|
|
26
|
+
const DECLARED_DIR = {
|
|
27
|
+
config: { code: AGENT_CONFIG_DIR_INVALID_CODE, what: "the host's own configuration root", absent: `the default \`~/${AGENT_CONFIG_DIR_SEGMENT}\` location` },
|
|
28
|
+
home: { code: AGENT_HOME_DIR_INVALID_CODE, what: "the caller's own home directory", absent: "the engine's own home directories alone" },
|
|
29
|
+
};
|
|
30
|
+
function invalidDeclaredDir(kind, seat, value, why) {
|
|
31
|
+
const d = DECLARED_DIR[kind];
|
|
32
|
+
const e = new Error(`${seat} ${shown(value)} ${why} — it must be the absolute path of an existing directory (${d.what}); ` +
|
|
33
|
+
`a value that names no directory would guard nothing, so it is refused rather than read as ${d.absent}.`);
|
|
34
|
+
e.code = d.code;
|
|
28
35
|
return e;
|
|
29
36
|
}
|
|
30
|
-
export function
|
|
37
|
+
export function checkedDeclaredDir(kind, value, seat) {
|
|
31
38
|
if (value === undefined)
|
|
32
39
|
return undefined;
|
|
33
40
|
if (typeof value !== "string")
|
|
34
|
-
throw
|
|
41
|
+
throw invalidDeclaredDir(kind, seat, value, `is a ${value === null ? "null" : typeof value}, not a string`);
|
|
35
42
|
if (value.length === 0)
|
|
36
|
-
throw
|
|
43
|
+
throw invalidDeclaredDir(kind, seat, value, "is an empty string");
|
|
37
44
|
if (validatePath(value, { intent: "validate-coordinate" }) === undefined)
|
|
38
|
-
throw
|
|
45
|
+
throw invalidDeclaredDir(kind, seat, value, "is not an absolute path");
|
|
39
46
|
let isDirectory;
|
|
40
47
|
try {
|
|
41
48
|
isDirectory = statSync(value).isDirectory();
|
|
42
49
|
}
|
|
43
50
|
catch (e) {
|
|
44
51
|
const code = typeof e === "object" && e !== null && "code" in e && typeof e.code === "string" ? e.code : "unreadable";
|
|
45
|
-
throw
|
|
52
|
+
throw invalidDeclaredDir(kind, seat, value, code === "ENOENT" || code === "ENOTDIR" ? "names no existing directory" : `could not be examined (${code})`);
|
|
46
53
|
}
|
|
47
54
|
if (!isDirectory)
|
|
48
|
-
throw
|
|
55
|
+
throw invalidDeclaredDir(kind, seat, value, "names a file, not a directory");
|
|
49
56
|
return value;
|
|
50
57
|
}
|
|
58
|
+
export function checkedAgentConfigDir(value, seat) {
|
|
59
|
+
return checkedDeclaredDir("config", value, seat);
|
|
60
|
+
}
|
|
61
|
+
function checkedDeclaredDirEntry(kind, entry, seat) {
|
|
62
|
+
if (entry === undefined)
|
|
63
|
+
throw invalidDeclaredDir(kind, seat, entry, "is missing (undefined, or a hole in the list), not a string");
|
|
64
|
+
checkedDeclaredDir(kind, entry, seat);
|
|
65
|
+
}
|
|
66
|
+
export function assertTaskDeclaredDirs(kind, value, seat) {
|
|
67
|
+
if (value === undefined)
|
|
68
|
+
return;
|
|
69
|
+
if (!Array.isArray(value))
|
|
70
|
+
throw invalidDeclaredDir(kind, seat, value, `is a ${value === null ? "null" : typeof value}, not a list of directories`);
|
|
71
|
+
const list = value;
|
|
72
|
+
for (let i = 0; i < list.length; i++)
|
|
73
|
+
checkedDeclaredDirEntry(kind, list[i], `${seat}[${i}]`);
|
|
74
|
+
}
|
|
75
|
+
export function declaredDirDoor(kind) {
|
|
76
|
+
return (value, owner) => assertTaskDeclaredDirs(kind, value, owner);
|
|
77
|
+
}
|
|
78
|
+
export function declaredDirEntryLaw(kind) {
|
|
79
|
+
return (entry, owner) => {
|
|
80
|
+
try {
|
|
81
|
+
checkedDeclaredDirEntry(kind, entry, owner);
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
return thrownText(e);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function declaredDirIdentity(dir) {
|
|
90
|
+
return foldRedundantPathSegments(dir);
|
|
91
|
+
}
|
|
92
|
+
export function recordedDeclaredDirs(kind, value, seat) {
|
|
93
|
+
if (value === undefined)
|
|
94
|
+
return undefined;
|
|
95
|
+
if (!Array.isArray(value))
|
|
96
|
+
throw invalidDeclaredDir(kind, seat, value, "is not a list (a damaged row)");
|
|
97
|
+
const list = value;
|
|
98
|
+
const out = [];
|
|
99
|
+
for (let i = 0; i < list.length; i++) {
|
|
100
|
+
const entry = list[i];
|
|
101
|
+
if (typeof entry !== "string" || validatePath(entry, { intent: "validate-coordinate" }) === undefined)
|
|
102
|
+
throw invalidDeclaredDir(kind, `${seat}[${i}]`, entry, "is not an absolute path (a damaged row)");
|
|
103
|
+
out.push(entry);
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
@@ -367,8 +367,6 @@ export declare const SHADOW_REASON: Readonly<{
|
|
|
367
367
|
readonly 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";
|
|
368
368
|
readonly ancestor: "the task that delegated this one owns this question";
|
|
369
369
|
readonly 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";
|
|
370
|
-
readonly unverifiable_delete: "this removal could not be verified safe — it is cleared by confirming this call, never by an allow rule";
|
|
371
|
-
readonly 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";
|
|
372
370
|
readonly transcript_write: "this write targets the session transcript — it is cleared by confirming this call, never by an allow rule";
|
|
373
371
|
readonly org_rule: "an organization policy rule requires approval for this call";
|
|
374
372
|
readonly org_unreadable: "this deployment's organization policy cannot currently be read, so whether one of its rules forbids this call is unknown";
|
|
@@ -379,7 +377,7 @@ export declare const SHADOW_REASON: Readonly<{
|
|
|
379
377
|
readonly classifier_no_ruling: "the auto-mode classifier could not judge this call, so a person decides";
|
|
380
378
|
readonly requires_user_interaction: "this tool's server declares that a call must be put to a person";
|
|
381
379
|
readonly cross_boundary: "this run executes on a device outside the deployment's trust boundary and the deployment is multi-tenant, so an org-side write — or, after an off-target read, a call bound for the device — is confirmed by the deployment's approver for this call: no standing allow rule and no automatic lane answers for it, and an allow the configuration gives (a blanket seat or a policy's answer) is refused";
|
|
382
|
-
readonly operator_forced:
|
|
380
|
+
readonly operator_forced: string;
|
|
383
381
|
readonly shell_floor: "this deployment mandates per-call confirmation for shell commands (shellGate: always)";
|
|
384
382
|
readonly target_unresolved: "where this write leads on disk could not be determined (a link on the way could not be examined, or the environment could not resolve the target), so whether it lands on a guarded path is unknown — it is cleared by confirming this call: no standing rule and no automatic decider answers for it, though a wired approver seat can";
|
|
385
383
|
readonly write_protection_on_disk: "this write's target is on the deployment's write-protection table (the agent's own configuration is guarded one look per write) — it is cleared by confirming this call, never by a standing allow rule";
|
|
@@ -391,8 +389,10 @@ export declare const SHADOW_REASON: Readonly<{
|
|
|
391
389
|
readonly sandbox_network: "a command in the run's OS sandbox connects to a host its sandbox does not list — an allow rule on the host (WebFetch(domain:<host>)) clears it, or confirm the connection";
|
|
392
390
|
readonly artifact_shared_read: "this read targets another task's shared artifact — it is cleared by confirming this call";
|
|
393
391
|
readonly mode: "the permission mode puts this question to a person";
|
|
394
|
-
readonly
|
|
395
|
-
readonly
|
|
392
|
+
readonly unverifiable_delete: string;
|
|
393
|
+
readonly unverifiable_shell_text: string;
|
|
394
|
+
readonly unstated: string;
|
|
395
|
+
readonly ordinary: string;
|
|
396
396
|
}>;
|
|
397
397
|
/** The fence over the reason table: `never` while every class that has a reason of its own has a row. */
|
|
398
398
|
export type ShadowReasonTableCoversEveryClass = AssertAllKeysHandled<Exclude<AskClass, keyof typeof SHADOW_REASON | AccountedClass>>;
|
package/dist/core/allow-entry.js
CHANGED
|
@@ -12,7 +12,7 @@ import { pathRuleLaneAnswer } from "./runner/permission-rule-lanes.js";
|
|
|
12
12
|
import { policyAnchors } from "./path-rule-binding.js";
|
|
13
13
|
import { receiptRefusal, receiveOwnProperties } from "./own-property-receipt.js";
|
|
14
14
|
import { callTargetReadingOf } from "./effective-path-target.js";
|
|
15
|
-
import { ASK_RULE_DISCLOSURE, MANDATE_DISCLOSURE, mandateDisclosureOf } from "./ask-origin.js";
|
|
15
|
+
import { ASK_RULE_DISCLOSURE, MANDATE_DISCLOSURE, MODE_ARBITRATION, mandateDisclosureOf } from "./ask-origin.js";
|
|
16
16
|
import { inlineUntrusted, isMintableProbeReason } from "./untrusted-text.js";
|
|
17
17
|
import { callerKey } from "./caller-text.js";
|
|
18
18
|
import { valueTypeLabel } from "./tool-name-list.js";
|
|
@@ -459,13 +459,17 @@ export function readAllowRuleShadows(value) {
|
|
|
459
459
|
return undefined;
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
+
const ARRIVED_MARKED_HEAD = "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so)";
|
|
463
|
+
const ARRIVED_MARKED = {
|
|
464
|
+
false: `${ARRIVED_MARKED_HEAD} — it is cleared by confirming this call, never by a standing allow rule`,
|
|
465
|
+
true: `${ARRIVED_MARKED_HEAD}, and that mark outranks an allow entry — it is cleared by confirming this call`,
|
|
466
|
+
};
|
|
467
|
+
const arrivedMarkedFor = (c) => ARRIVED_MARKED[`${MODE_ARBITRATION[c].ruleMayClear}`];
|
|
462
468
|
export const SHADOW_REASON = Object.freeze({
|
|
463
469
|
content_question: "the call is the engine's own question to a person",
|
|
464
470
|
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",
|
|
465
471
|
ancestor: "the task that delegated this one owns this question",
|
|
466
472
|
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",
|
|
467
|
-
unverifiable_delete: "this removal could not be verified safe — it is cleared by confirming this call, never by an allow rule",
|
|
468
|
-
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",
|
|
469
473
|
transcript_write: "this write targets the session transcript — it is cleared by confirming this call, never by an allow rule",
|
|
470
474
|
org_rule: "an organization policy rule requires approval for this call",
|
|
471
475
|
org_unreadable: "this deployment's organization policy cannot currently be read, so whether one of its rules forbids this call is unknown",
|
|
@@ -476,7 +480,7 @@ export const SHADOW_REASON = Object.freeze({
|
|
|
476
480
|
classifier_no_ruling: "the auto-mode classifier could not judge this call, so a person decides",
|
|
477
481
|
requires_user_interaction: "this tool's server declares that a call must be put to a person",
|
|
478
482
|
cross_boundary: MANDATE_DISCLOSURE.cross_boundary_taint,
|
|
479
|
-
operator_forced: "
|
|
483
|
+
operator_forced: arrivedMarkedFor("operator_forced"),
|
|
480
484
|
shell_floor: MANDATE_DISCLOSURE.operator_always,
|
|
481
485
|
target_unresolved: MANDATE_DISCLOSURE.target_unresolved,
|
|
482
486
|
write_protection_on_disk: MANDATE_DISCLOSURE.write_protection,
|
|
@@ -488,8 +492,10 @@ export const SHADOW_REASON = Object.freeze({
|
|
|
488
492
|
sandbox_network: "a command in the run's OS sandbox connects to a host its sandbox does not list — an allow rule on the host (WebFetch(domain:<host>)) clears it, or confirm the connection",
|
|
489
493
|
artifact_shared_read: "this read targets another task's shared artifact — it is cleared by confirming this call",
|
|
490
494
|
mode: "the permission mode puts this question to a person",
|
|
491
|
-
|
|
492
|
-
|
|
495
|
+
unverifiable_delete: arrivedMarkedFor("unverifiable_delete"),
|
|
496
|
+
unverifiable_shell_text: arrivedMarkedFor("unverifiable_shell_text"),
|
|
497
|
+
unstated: arrivedMarkedFor("unstated"),
|
|
498
|
+
ordinary: arrivedMarkedFor("ordinary"),
|
|
493
499
|
});
|
|
494
500
|
function memberPhrase(s) {
|
|
495
501
|
const listed = `${s.entries.join(", ")}${s.omitted !== undefined ? ` and ${s.omitted} more` : ""}`;
|
|
@@ -33,8 +33,6 @@ export declare const ASK_HEADLINE_WHY: Readonly<{
|
|
|
33
33
|
readonly write_protection: "core/engine.ask-headline.write_protection";
|
|
34
34
|
readonly ancestor: "core/engine.ask-headline.ancestor";
|
|
35
35
|
readonly dangerous_delete: "core/engine.ask-headline.dangerous_delete";
|
|
36
|
-
readonly unverifiable_delete: "core/engine.ask-headline.unverifiable_delete";
|
|
37
|
-
readonly unverifiable_shell_text: "core/engine.ask-headline.unverifiable_shell_text";
|
|
38
36
|
readonly transcript_write: "core/engine.ask-headline.transcript_write";
|
|
39
37
|
readonly org_rule: "core/engine.ask-headline.org_rule";
|
|
40
38
|
readonly org_unreadable: "core/engine.ask-headline.org_unreadable";
|
|
@@ -54,6 +52,8 @@ export declare const ASK_HEADLINE_WHY: Readonly<{
|
|
|
54
52
|
readonly tool_marks_a2a: "core/engine.ask-headline.tool_marks_a2a";
|
|
55
53
|
readonly policy_rra: "core/engine.ask-headline.policy_rra";
|
|
56
54
|
readonly artifact_shared_read: "core/engine.ask-headline.artifact_shared_read";
|
|
55
|
+
readonly unverifiable_delete: "core/engine.ask-headline.unverifiable_delete";
|
|
56
|
+
readonly unverifiable_shell_text: "core/engine.ask-headline.unverifiable_shell_text";
|
|
57
57
|
readonly sandbox_override: "core/engine.ask-headline.sandbox_override";
|
|
58
58
|
readonly sandbox_network: "core/engine.ask-headline.sandbox_network";
|
|
59
59
|
readonly unstated: "core/engine.ask-headline.unstated";
|
|
@@ -407,12 +407,11 @@ export declare function ownedClearanceFacts(d: Extract<PermissionResult, {
|
|
|
407
407
|
* (`denialLimitFallback`: a self-declared one opts the policy's own ask out of automatic
|
|
408
408
|
* resolution, the safe direction, not a defect), so the invariant is pinned at the engine's two
|
|
409
409
|
* mint sites (the gate's fallback re-mint and the inherited station's) rather than thrown at
|
|
410
|
-
* derivation, where a policy's own object could trip it;
|
|
411
|
-
* guard's own record, which no policy composes but a policy wrapping an exported guard can relay beside a
|
|
412
|
-
* bit it cleared, so the bit is pinned at the two guard mint sites (the removal guard's ask, the
|
|
413
|
-
* session-transcript guard's);
|
|
410
|
+
* derivation, where a policy's own object could trip it;
|
|
414
411
|
* - `false` — the origin says nothing about the bit: a `policy` ask may carry it (a safety policy's
|
|
415
|
-
* own mandate) or not, and both are legal
|
|
412
|
+
* own mandate) or not, and both are legal; an `integrity_guard` ask carries it exactly when its guard's class
|
|
413
|
+
* explains it ({@link RRA_EXPLAINERS}: a protected-location removal, the session-transcript write — pinned at
|
|
414
|
+
* those two mint sites) and not for the two the engine raises because it could not read or verify the command.
|
|
416
415
|
*/
|
|
417
416
|
export declare const ORIGIN_IMPLIES_REAL_APPROVAL: {
|
|
418
417
|
readonly content_question: false;
|
|
@@ -424,7 +423,7 @@ export declare const ORIGIN_IMPLIES_REAL_APPROVAL: {
|
|
|
424
423
|
readonly hook: false;
|
|
425
424
|
readonly ask_rule: false;
|
|
426
425
|
readonly denial_limit_fallback: "at_mint";
|
|
427
|
-
readonly integrity_guard:
|
|
426
|
+
readonly integrity_guard: false;
|
|
428
427
|
readonly shell_gate_tighten: false;
|
|
429
428
|
readonly safety_tighten: false;
|
|
430
429
|
readonly policy: false;
|
|
@@ -652,10 +651,11 @@ export type ToolMarkSource = "deployment" | "mcp_annotation" | "a2a_default";
|
|
|
652
651
|
* `dangerous_delete` is a removal whose target is a protected location (`dangerousRemovalOf`: the filesystem root, a
|
|
653
652
|
* top-level directory, a home directory, or a workspace directory — the task root, the working directory, an additional
|
|
654
653
|
* working directory — or an ancestor of one): the reference implementation's dangerous-removal breaker, which no mode,
|
|
655
|
-
* allow rule or classifier answers. `unverifiable_delete` is
|
|
656
|
-
* `unverifiable_shell_text` is a shell handed text the command does not spell (a program's output, a substitution,
|
|
657
|
-
* file's content, an argv a stream fills in
|
|
658
|
-
*
|
|
654
|
+
* allow rule or classifier answers. `unverifiable_delete` is a recursive forced removal whose target the command text cannot
|
|
655
|
+
* resolve; `unverifiable_shell_text` is a shell handed text the command does not spell (a program's output, a substitution,
|
|
656
|
+
* a file's content, an argv a stream fills in, a program word the command's own text fills in): the engine cannot read what
|
|
657
|
+
* that shell will execute. What the engine cannot read or verify is no reason to ask more strictly than an ordinary question,
|
|
658
|
+
* so those two read the ordinary row ({@link ORDINARY_ROW}); they stay words of their own for the reason a card and a release name.
|
|
659
659
|
* `sandbox_network` is a command running in the run's sandbox connecting to a host neither of the requirement's domain lists names
|
|
660
660
|
* (the engine's own question about a connection, put while the command runs): the reference implementation's network question —
|
|
661
661
|
* `bypassPermissions` releases it, `dontAsk` refuses it, auto mode's classifier answers it, an allow rule clears it, and the sandbox
|
|
@@ -679,7 +679,7 @@ export type ToolMarkSource = "deployment" | "mcp_annotation" | "a2a_default";
|
|
|
679
679
|
* onto a guarded path). The two read one arbitration row; they stay two classes because the card says which reading met the row.
|
|
680
680
|
* A command writing several targets may carry both.
|
|
681
681
|
*/
|
|
682
|
-
export declare const ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "
|
|
682
|
+
export declare const ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "transcript_write", "org_rule", "org_unreadable", "rule_unreadable", "call_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", "sandbox_override", "sandbox_network", "unstated", "ordinary"];
|
|
683
683
|
export type AskClass = (typeof ASK_CLASSES)[number];
|
|
684
684
|
/** Membership test for {@link AskClass} — the word crosses the wire on `tool_end.gate.disposition`. */
|
|
685
685
|
export declare function isAskClass(v: unknown): v is AskClass;
|
|
@@ -763,27 +763,13 @@ export declare const MODE_ARBITRATION: {
|
|
|
763
763
|
readonly ruleMayClear: false;
|
|
764
764
|
readonly hookAskFloor: false;
|
|
765
765
|
};
|
|
766
|
-
readonly dangerous_delete:
|
|
766
|
+
readonly dangerous_delete: {
|
|
767
767
|
readonly bypassImmune: true;
|
|
768
768
|
readonly classifierEligible: false;
|
|
769
769
|
readonly sandboxAdmission: false;
|
|
770
770
|
readonly ruleMayClear: false;
|
|
771
771
|
readonly hookAskFloor: true;
|
|
772
|
-
}
|
|
773
|
-
readonly unverifiable_delete: Readonly<{
|
|
774
|
-
readonly bypassImmune: true;
|
|
775
|
-
readonly classifierEligible: false;
|
|
776
|
-
readonly sandboxAdmission: false;
|
|
777
|
-
readonly ruleMayClear: false;
|
|
778
|
-
readonly hookAskFloor: true;
|
|
779
|
-
}>;
|
|
780
|
-
readonly unverifiable_shell_text: Readonly<{
|
|
781
|
-
readonly bypassImmune: true;
|
|
782
|
-
readonly classifierEligible: false;
|
|
783
|
-
readonly sandboxAdmission: false;
|
|
784
|
-
readonly ruleMayClear: false;
|
|
785
|
-
readonly hookAskFloor: true;
|
|
786
|
-
}>;
|
|
772
|
+
};
|
|
787
773
|
readonly transcript_write: {
|
|
788
774
|
readonly bypassImmune: false;
|
|
789
775
|
readonly classifierEligible: true;
|
|
@@ -931,6 +917,20 @@ export declare const MODE_ARBITRATION: {
|
|
|
931
917
|
readonly ruleMayClear: false;
|
|
932
918
|
readonly hookAskFloor: false;
|
|
933
919
|
};
|
|
920
|
+
readonly unverifiable_delete: Readonly<{
|
|
921
|
+
readonly bypassImmune: false;
|
|
922
|
+
readonly classifierEligible: true;
|
|
923
|
+
readonly sandboxAdmission: true;
|
|
924
|
+
readonly ruleMayClear: true;
|
|
925
|
+
readonly hookAskFloor: false;
|
|
926
|
+
}>;
|
|
927
|
+
readonly unverifiable_shell_text: Readonly<{
|
|
928
|
+
readonly bypassImmune: false;
|
|
929
|
+
readonly classifierEligible: true;
|
|
930
|
+
readonly sandboxAdmission: true;
|
|
931
|
+
readonly ruleMayClear: true;
|
|
932
|
+
readonly hookAskFloor: false;
|
|
933
|
+
}>;
|
|
934
934
|
readonly sandbox_override: {
|
|
935
935
|
readonly bypassImmune: false;
|
|
936
936
|
readonly classifierEligible: true;
|
|
@@ -952,13 +952,13 @@ export declare const MODE_ARBITRATION: {
|
|
|
952
952
|
readonly ruleMayClear: true;
|
|
953
953
|
readonly hookAskFloor: false;
|
|
954
954
|
};
|
|
955
|
-
readonly ordinary: {
|
|
955
|
+
readonly ordinary: Readonly<{
|
|
956
956
|
readonly bypassImmune: false;
|
|
957
957
|
readonly classifierEligible: true;
|
|
958
958
|
readonly sandboxAdmission: true;
|
|
959
959
|
readonly ruleMayClear: true;
|
|
960
960
|
readonly hookAskFloor: false;
|
|
961
|
-
}
|
|
961
|
+
}>;
|
|
962
962
|
};
|
|
963
963
|
/** The fence over the arbitration table: `never` while every class has a row. */
|
|
964
964
|
export type ArbitrationTableCoversEveryClass = AssertAllKeysHandled<Exclude<AskClass, keyof typeof MODE_ARBITRATION>>;
|
|
@@ -1046,7 +1046,7 @@ export declare function screenAskClassMembers(askClass: unknown, classes: unknow
|
|
|
1046
1046
|
* The OWN half of the class derivation — what ONE ask says about itself through its own members, and the integrity guards
|
|
1047
1047
|
* its engine record carries for its call (`record`, read by the caller through {@link attestationOf}): the guards are engine
|
|
1048
1048
|
* findings, never a member, so a policy cannot move a real-approval question into a guard's class. The bare-bit rules are
|
|
1049
|
-
* applied over THIS ask's own set: `requiresRealApproval` with no explaining class is `policy_rra
|
|
1049
|
+
* 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
|
|
1050
1050
|
* `mandated` with no other class is `operator_forced` (a deployment probe's own mandate, read conservatively). Returns the
|
|
1051
1051
|
* specific classes only — an empty set is "nothing but hesitation", which the caller reads as `ordinary`.
|
|
1052
1052
|
*/
|
|
@@ -1064,7 +1064,7 @@ export declare function decisionAskClassesOf(d: Extract<PermissionResult, {
|
|
|
1064
1064
|
* set is `ordinary`. The two faces the ask was raised under enter HERE and nowhere else, so every reader of the folded row
|
|
1065
1065
|
* reads it already folded: `readFace` — `roots` takes the classifier's lane from a set that holds a class the narrowed face
|
|
1066
1066
|
* withholds from it; `askFace` — `shell` reads a class {@link RELEASED_ON_SHELL_FACE} holds as not bypass-immune. Absent
|
|
1067
|
-
* faces read the table's own rows. */
|
|
1067
|
+
* faces read the table's own rows. A check that did not finish ({@link unfinishedCheck}) loses the classifier and floors a hook. */
|
|
1068
1068
|
export declare function foldArbitrationRow(classes: ReadonlySet<AskClass>, readFace?: ContainmentFace, askFace?: AskFace): ModeArbitrationRow;
|
|
1069
1069
|
/**
|
|
1070
1070
|
* The ONE class derivation: the decision half ({@link decisionAskClassesOf}) joined with the gate's own facts —
|