@sema-agent/core 7.61.0 → 7.63.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 +840 -0
- package/dist/agents/cascade.d.ts +11 -3
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/peer-held-queue.d.ts +27 -4
- package/dist/agents/peer-held-queue.js +81 -36
- package/dist/agents/peer-session-drain.js +13 -3
- package/dist/agents/subagent-transcript-placement.d.ts +23 -0
- package/dist/agents/subagent-transcript-placement.js +14 -0
- package/dist/agents/subagent.d.ts +6 -1
- package/dist/agents/subagent.js +143 -58
- package/dist/agents/suspend-guard.d.ts +38 -16
- package/dist/agents/suspend-guard.js +9 -4
- package/dist/agents/verify.js +4 -3
- package/dist/brain/route-adjudicator.js +9 -4
- package/dist/core/approval-object.js +1 -1
- package/dist/core/arg-summary.js +1 -1
- package/dist/core/ask-question.d.ts +2 -2
- package/dist/core/canonical-json.d.ts +23 -13
- package/dist/core/canonical-json.js +4 -4
- package/dist/core/checkpoint-features.d.ts +722 -0
- package/dist/core/checkpoint-features.js +98 -0
- package/dist/core/checkpoint-queries.d.ts +47 -4
- package/dist/core/checkpoint-queries.js +36 -16
- package/dist/core/checkpoint-requirements.d.ts +12 -5
- package/dist/core/checkpoint-requirements.js +11 -5
- package/dist/core/checkpoint-row-verdict.d.ts +110 -0
- package/dist/core/checkpoint-row-verdict.js +245 -0
- package/dist/core/checkpoint-store.d.ts +76 -753
- package/dist/core/checkpoint-store.js +83 -144
- package/dist/core/compliance.d.ts +6 -2
- package/dist/core/compliance.js +3 -3
- package/dist/core/engine-attestation.d.ts +1 -1
- package/dist/core/engine-notice.d.ts +38 -7
- package/dist/core/engine-notice.js +9 -2
- package/dist/core/gate-fold.js +2 -2
- package/dist/core/git-worktree-env.d.ts +62 -3
- package/dist/core/git-worktree-env.js +91 -30
- package/dist/core/governance-codes.d.ts +9 -3
- package/dist/core/governance-codes.js +16 -3
- package/dist/core/hooks.d.ts +13 -0
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/image-admission.d.ts +1 -1
- package/dist/core/locked-config.d.ts +2 -2
- package/dist/core/mcp-host-seat.js +6 -1
- package/dist/core/memory-engine/consolidation-driver.d.ts +33 -18
- package/dist/core/memory-engine/consolidation-driver.js +99 -98
- package/dist/core/memory-engine/consolidation.d.ts +73 -10
- package/dist/core/memory-engine/consolidation.js +167 -11
- package/dist/core/memory-engine/data-plane.d.ts +8 -4
- package/dist/core/memory-engine/data-plane.js +11 -6
- package/dist/core/memory-engine/delegation-settlement.d.ts +37 -35
- package/dist/core/memory-engine/delegation-settlement.js +53 -59
- package/dist/core/memory-engine/dual-root.d.ts +12 -6
- package/dist/core/memory-engine/dual-root.js +9 -5
- package/dist/core/memory-engine/engine.d.ts +98 -35
- package/dist/core/memory-engine/engine.js +477 -380
- package/dist/core/memory-engine/entry-scan.d.ts +8 -0
- package/dist/core/memory-engine/entry-scan.js +3 -0
- package/dist/core/memory-engine/file-backend.d.ts +29 -3
- package/dist/core/memory-engine/file-backend.js +66 -35
- package/dist/core/memory-engine/index.d.ts +7 -7
- package/dist/core/memory-engine/index.js +6 -6
- package/dist/core/memory-engine/landing-admission.d.ts +5 -3
- package/dist/core/memory-engine/landing-admission.js +3 -3
- package/dist/core/memory-engine/layout.d.ts +121 -45
- package/dist/core/memory-engine/layout.js +252 -102
- package/dist/core/memory-engine/memory-backend-contract.d.ts +19 -1
- package/dist/core/memory-engine/memory-backend-contract.js +320 -0
- package/dist/core/memory-engine/memory-deployment.d.ts +31 -8
- package/dist/core/memory-engine/memory-deployment.js +26 -12
- package/dist/core/memory-engine/scope-contract.d.ts +52 -11
- package/dist/core/memory-engine/scope-contract.js +68 -19
- package/dist/core/memory-engine/session-write-home.d.ts +3 -1
- package/dist/core/memory-engine/session-write-home.js +1 -1
- package/dist/core/memory-engine/sync-client.d.ts +3 -1
- package/dist/core/memory-engine/sync-client.js +7 -0
- package/dist/core/memory-engine/sync-report.d.ts +3 -2
- package/dist/core/memory-engine/sync-report.js +6 -2
- package/dist/core/memory-engine/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +10 -10
- package/dist/core/memory-engine/types.d.ts +118 -19
- package/dist/core/memory-engine/types.js +1 -0
- package/dist/core/memory-vector.d.ts +1 -1
- package/dist/core/memory.d.ts +10 -10
- package/dist/core/memory.js +15 -6
- package/dist/core/mode-policy.js +1 -1
- package/dist/core/mods/classic-events.d.ts +9 -1
- package/dist/core/mods/dollar.d.ts +32 -1
- package/dist/core/mods/dollar.js +13 -1
- package/dist/core/mods/kernel/events.d.ts +11 -3
- package/dist/core/mods/kernel/events.js +13 -10
- package/dist/core/mods/lifecycle-stations.d.ts +36 -4
- package/dist/core/mods/lifecycle-stations.js +44 -9
- package/dist/core/mods/session-append.d.ts +4 -1
- package/dist/core/mods/session-append.js +7 -0
- package/dist/core/mods/session-receive.js +12 -15
- package/dist/core/mods/stations.d.ts +70 -6
- package/dist/core/mods/stations.js +144 -1
- package/dist/core/own-property-receipt.d.ts +7 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/park-selfcheck.js +2 -2
- package/dist/core/pause-registry.d.ts +2 -0
- package/dist/core/pause-registry.js +3 -0
- package/dist/core/permission-rule-consent.d.ts +10 -3
- package/dist/core/permission-rule-consent.js +37 -24
- package/dist/core/permission-rule-store.d.ts +35 -1
- package/dist/core/permission-rule-store.js +27 -8
- package/dist/core/read-only-shell.js +3 -2
- package/dist/core/read-root-candidate.js +1 -1
- package/dist/core/redaction-marks.d.ts +8 -0
- package/dist/core/redaction-marks.js +6 -0
- package/dist/core/remote-env.d.ts +12 -1
- package/dist/core/remote-env.js +3 -0
- package/dist/core/resume-startup-cause.d.ts +5 -4
- package/dist/core/runner/child-tree.d.ts +29 -3
- package/dist/core/runner/child-tree.js +39 -16
- package/dist/core/runner/compact-session.js +5 -2
- package/dist/core/runner/contracts.d.ts +36 -17
- package/dist/core/runner/delegation-owner.d.ts +43 -0
- package/dist/core/runner/delegation-owner.js +59 -0
- package/dist/core/runner/gate-exit.js +2 -2
- package/dist/core/runner/inherited-ask-grants.js +1 -1
- package/dist/core/runner/lineage-reroot-view.d.ts +56 -0
- package/dist/core/runner/lineage-reroot-view.js +108 -0
- package/dist/core/runner/memory-consolidation-driver.d.ts +6 -3
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- package/dist/core/runner/memory-consolidation-write-judge.d.ts +2 -1
- package/dist/core/runner/memory-consolidation-write-judge.js +3 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +2 -1
- package/dist/core/runner/permission-rule-lanes.js +2 -2
- package/dist/core/runner/person-path-rows.d.ts +23 -3
- package/dist/core/runner/person-path-rows.js +31 -4
- package/dist/core/runner/placement-fence.d.ts +12 -0
- package/dist/core/runner/placement-fence.js +20 -6
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +7 -2
- package/dist/core/runner/prepare-ask-lane.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -6
- package/dist/core/runner/prepare-config-doors.js +3 -4
- package/dist/core/runner/prepare-execution-env.js +17 -6
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -2
- package/dist/core/runner/prepare-hands-readface.js +32 -10
- package/dist/core/runner/prepare-inherited-gate.d.ts +12 -8
- package/dist/core/runner/prepare-inherited-gate.js +14 -6
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -4
- package/dist/core/runner/prepare-memory-engine-session.js +4 -4
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +28 -20
- package/dist/core/runner/prepare-park-ask.js +4 -3
- package/dist/core/runner/prepare-task.js +22 -16
- package/dist/core/runner/prepare-workspace-restore.js +3 -6
- package/dist/core/runner/resume-admission.d.ts +3 -3
- package/dist/core/runner/resume-admission.js +6 -3
- package/dist/core/runner/resume-apply.d.ts +4 -0
- package/dist/core/runner/resume-apply.js +11 -4
- package/dist/core/runner/resume-checkpoint-screen.d.ts +9 -0
- package/dist/core/runner/resume-checkpoint-screen.js +4 -84
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +4 -1
- package/dist/core/runner/run-harness-handlers.d.ts +2 -0
- package/dist/core/runner/run-harness-handlers.js +3 -2
- package/dist/core/runner/run-leg.js +25 -8
- package/dist/core/runner/run-settle-and-teardown.js +6 -4
- package/dist/core/runner/run-stop-and-final-verify.js +2 -1
- package/dist/core/runner/run-turn-boundary.js +7 -4
- package/dist/core/runner/runtask.js +6 -6
- package/dist/core/runner/steering-preview.d.ts +9 -0
- package/dist/core/runner/steering-preview.js +5 -0
- package/dist/core/runner/stream-steer-verb.js +8 -0
- package/dist/core/runner/terminal-account.js +1 -1
- package/dist/core/runner/tool-face-overlay.js +2 -0
- package/dist/core/runner/turn-attachments.d.ts +5 -0
- package/dist/core/runner/turn-attachments.js +1 -1
- package/dist/core/runner-deps.d.ts +8 -4
- package/dist/core/secret-env.d.ts +9 -6
- package/dist/core/secret-env.js +41 -22
- package/dist/core/session-checkout.d.ts +108 -0
- package/dist/core/session-checkout.js +485 -0
- package/dist/core/session-store.d.ts +13 -5
- package/dist/core/session-store.js +28 -4
- package/dist/core/session.d.ts +29 -5
- package/dist/core/session.js +3 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +6 -12
- package/dist/core/store-contracts/checkpoint-store-contract.js +73 -6
- package/dist/core/store-contracts/session-store-contract.js +61 -8
- package/dist/core/task-event.d.ts +28 -1
- package/dist/core/task-notification.d.ts +9 -1
- package/dist/core/task-notification.js +8 -1
- package/dist/core/task-registry-agent.d.ts +40 -8
- package/dist/core/task-registry-agent.js +57 -24
- package/dist/core/task-registry-shared.d.ts +33 -11
- package/dist/core/task-registry-workflow.js +4 -3
- package/dist/core/task-registry.d.ts +27 -10
- package/dist/core/task-registry.js +19 -13
- package/dist/core/task-result.d.ts +5 -5
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +21 -1
- package/dist/core/terminal-cause.d.ts +6 -6
- package/dist/core/tool-face.d.ts +6 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-policy.d.ts +16 -13
- package/dist/core/tool-policy.js +11 -10
- package/dist/core/tool-roster.d.ts +4 -4
- package/dist/core/tool-spec.d.ts +42 -19
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-egress.d.ts +15 -4
- package/dist/core/untrusted-egress.js +23 -22
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
- package/dist/engine/execution-env/node-execution-env.js +12 -5
- package/dist/engine/harness/types.d.ts +77 -1
- package/dist/engine/harness/types.js +108 -0
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/parent-chain-guard.d.ts +3 -3
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/path-to-root.d.ts +18 -3
- package/dist/engine/session/path-to-root.js +15 -1
- package/dist/engine/session/repo-utils.d.ts +12 -1
- package/dist/engine/session/repo-utils.js +41 -0
- package/dist/engine/session/session.d.ts +24 -1
- package/dist/engine/session/session.js +46 -2
- package/dist/engine/session/storage-base.d.ts +20 -0
- package/dist/engine/session/storage-base.js +28 -9
- package/dist/index.d.ts +16 -12
- package/dist/index.js +11 -8
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +4 -3
- package/dist/internal/harness.js +3 -2
- package/dist/orchestration/run-workflow-tool.d.ts +7 -1
- package/dist/orchestration/run-workflow-tool.js +28 -11
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +6 -0
- package/dist/orchestration/workflow.js +5 -8
- package/dist/stores/file/checkpoint-store.d.ts +2 -0
- package/dist/stores/file/checkpoint-store.js +7 -6
- package/dist/stores/file/fs-atomic.d.ts +0 -22
- package/dist/stores/file/fs-atomic.js +0 -17
- package/dist/stores/file/index.d.ts +2 -9
- package/dist/stores/file/index.js +2 -4
- package/dist/stores/file/session-store.d.ts +13 -7
- package/dist/stores/file/session-store.js +42 -18
- package/dist/tools/fs/bash-program-position.d.ts +3 -2
- package/dist/tools/fs/bash-program-position.js +10 -10
- package/dist/tools/fs/program-read-model.d.ts +34 -10
- package/dist/tools/fs/program-read-model.js +37 -7
- package/dist/tools/fs/program-read-model.rows.js +13 -2
- package/dist/tools/fs/read-deny.d.ts +13 -1
- package/dist/tools/fs/read-deny.js +10 -2
- package/dist/tools/fs/removal-targets.js +5 -5
- package/dist/tools/fs/safety.d.ts +2 -0
- package/dist/tools/fs/safety.js +1 -1
- package/dist/tools/fs/shell-read-argv.d.ts +11 -2
- package/dist/tools/fs/shell-read-argv.js +45 -29
- package/dist/tools/fs/shell-read-bindings.d.ts +20 -2
- package/dist/tools/fs/shell-read-bindings.js +153 -69
- package/dist/tools/fs/shell-read-brace.d.ts +18 -0
- package/dist/tools/fs/shell-read-brace.js +79 -0
- package/dist/tools/fs/shell-read-check.js +29 -11
- package/dist/tools/fs/shell-read-establish.js +43 -22
- package/dist/tools/fs/shell-read-functions.js +2 -2
- package/dist/tools/fs/shell-read-judge.d.ts +11 -0
- package/dist/tools/fs/shell-read-judge.js +3 -3
- package/dist/tools/fs/shell-read-object-path.d.ts +59 -0
- package/dist/tools/fs/shell-read-object-path.js +119 -0
- package/dist/tools/fs/shell-read-plan.d.ts +18 -0
- package/dist/tools/fs/shell-read-plan.js +217 -104
- package/dist/tools/fs/shell-read-start.d.ts +76 -13
- package/dist/tools/fs/shell-read-start.js +97 -17
- package/dist/tools/fs/shell-read-word.d.ts +10 -0
- package/dist/tools/fs/shell-read-word.js +9 -5
- package/dist/tools/fs/shell-read-workdir.d.ts +54 -14
- package/dist/tools/fs/shell-read-workdir.js +103 -19
- package/dist/tools/fs/shell-read-write-targets.js +13 -8
- package/dist/tools/worktree.d.ts +3 -2
- package/dist/tools/worktree.js +7 -35
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +93 -43
- package/wire-changes/core-stores-sql@7.62.0.json +30 -0
- package/wire-changes/core-stores-sql@7.63.0.json +30 -0
- package/wire-changes/core@7.62.0.json +2181 -0
- package/wire-changes/core@7.63.0.json +3523 -0
- package/wire-changes/mods-kernel@7.62.0.json +42 -0
- package/wire-changes/mods-kernel@7.63.0.json +30 -0
- package/wire-changes/primitives@7.62.0.json +30 -0
- package/wire-changes/primitives@7.63.0.json +445 -0
- package/dist/core/consolidate-scope.d.ts +0 -93
- package/dist/core/consolidate-scope.js +0 -98
- package/dist/core/credential-vocabulary.d.ts +0 -176
- package/dist/core/credential-vocabulary.js +0 -190
- package/dist/core/redaction-passes.d.ts +0 -82
- package/dist/core/redaction-passes.js +0 -377
- package/dist/core/runner/memory-consolidation.d.ts +0 -109
- package/dist/core/runner/memory-consolidation.js +0 -251
|
@@ -2,7 +2,7 @@ import { snapshotActorAssertion } from "../../internal/llm.js";
|
|
|
2
2
|
import { CheckpointError, remainingBudgetMicroUsd } from "../checkpoint-store.js";
|
|
3
3
|
import { chainPolicyOnLeg, chainTopAnchors } from "./child-tree.js";
|
|
4
4
|
import { mintHookInvocationIdentity } from "../hooks.js";
|
|
5
|
-
import { admitLegMods, classicEventBase, failedHandlerClause, screenUserPrompt } from "../mods/stations.js";
|
|
5
|
+
import { admitLegMods, classicEventBase, failedHandlerClause, promptScreenHasHandlers, screenUserPrompt } from "../mods/stations.js";
|
|
6
6
|
import { legTaskIdOf } from "../leg-identity.js";
|
|
7
7
|
import { restoreRowTaskId } from "./checkpoint-scope.js";
|
|
8
8
|
import { checkToolPolicyProjection, policyCannotAnswer, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
@@ -24,12 +24,14 @@ export async function resumeApply(input) {
|
|
|
24
24
|
const { cp, config, internals, outcomeGate, wakeMessage, resumeSignal, recheckGovernanceWindow, plainReviewOutcome, plainParkOutcome, runner, effectiveDelegationFacts } = input;
|
|
25
25
|
let plainPolicyOutcome = input.plainPolicyOutcome;
|
|
26
26
|
let wakeHookContext;
|
|
27
|
+
let wakeDelivered = wakeMessage;
|
|
28
|
+
let wakeRewrittenBy;
|
|
27
29
|
let legMods;
|
|
28
30
|
if (outcomeGate === "wake" && wakeMessage !== undefined) {
|
|
29
31
|
if (resumeSignal?.aborted !== true) {
|
|
30
32
|
legMods = await admitLegMods({ spec: config, deps: runner.deps, sessionId: cp.sessionId, skills: skillsThatLoad(readSkillsSeat(config.skills)), reopenedSkills: frozenSkillScopesOf(cp.state) });
|
|
31
33
|
}
|
|
32
|
-
if (legMods !== undefined && legMods.bus
|
|
34
|
+
if (legMods !== undefined && promptScreenHasHandlers(legMods.bus)) {
|
|
33
35
|
const screenedMessage = wakeMessage;
|
|
34
36
|
const identity = mintHookInvocationIdentity({
|
|
35
37
|
sessionId: cp.sessionId,
|
|
@@ -61,6 +63,10 @@ export async function resumeApply(input) {
|
|
|
61
63
|
if (screen?.additionalContext !== undefined && screen.additionalContext !== "") {
|
|
62
64
|
wakeHookContext = screen.additionalContext;
|
|
63
65
|
}
|
|
66
|
+
if (screen?.kind === "answered" && screen.rewrittenBy !== undefined) {
|
|
67
|
+
wakeDelivered = { ...screenedMessage, text: screen.text };
|
|
68
|
+
wakeRewrittenBy = screen.rewrittenBy;
|
|
69
|
+
}
|
|
64
70
|
if (recheckGovernanceWindow !== undefined)
|
|
65
71
|
await recheckGovernanceWindow();
|
|
66
72
|
}
|
|
@@ -176,9 +182,10 @@ export async function resumeApply(input) {
|
|
|
176
182
|
if (outcomeForReview?.gate === "plan_review") {
|
|
177
183
|
outcomeForReview = { ...outcomeForReview, gateOutcome: mintDecideRecord(cp, outcomeForReview.hostDecision, { allowed: outcomeForReview.decision !== "reject", note: outcomeForReview.reason }) };
|
|
178
184
|
}
|
|
179
|
-
const
|
|
185
|
+
const parkOutcome = plainParkOutcome?.gate === "wake" && wakeDelivered !== wakeMessage && wakeDelivered !== undefined ? { gate: "wake", message: wakeDelivered } : plainParkOutcome;
|
|
186
|
+
const outcomeForStore = plainPolicyOutcome ?? outcomeForReview ?? parkOutcome;
|
|
180
187
|
if (outcomeForStore === undefined) {
|
|
181
188
|
throw new CheckpointError("checkpoint.invalid_outcome", `resume outcome (gate "${describeSuppliedValue(outcomeGate)}") matched the checkpoint gate but no lane captured it — refusing pre-CAS rather than passing the caller's live object to the store and the resumed run`);
|
|
182
189
|
}
|
|
183
|
-
return await input.next({ wakeHookContext, ...(legMods !== undefined ? { legMods } : {}), plainPolicyOutcome, outcomeForStore });
|
|
190
|
+
return await input.next({ wakeHookContext, wakeMessage: wakeDelivered, ...(wakeRewrittenBy !== undefined ? { wakeRewrittenBy } : {}), ...(legMods !== undefined ? { legMods } : {}), plainPolicyOutcome, outcomeForStore });
|
|
184
191
|
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resume ladder's CHECKPOINT SCREEN (E5) and its abort / workspace-handle / inherited-
|
|
3
|
+
* constraint rungs (E6), verbatim from `Runner.resumeStream`: the rungs a deployment fact or a resume input decides — the
|
|
4
|
+
* org-governance wiring check, the already-aborted signal, the remote-handle factory requirement, the requestedCwd conflict,
|
|
5
|
+
* the row's recorded ceiling and own lists (each when the leg runs under it), a renamed delegation mount, the parent-constraint
|
|
6
|
+
* count / content / installation checks, and the array-level snapshot of the validated chain. The rungs the row and the engine
|
|
7
|
+
* decide alone are the row's verdict, judged at admission (`judgeCheckpointRow`).
|
|
8
|
+
* Synchronous; every refusal throws pre-CAS.
|
|
9
|
+
*/
|
|
1
10
|
import { type Checkpoint } from "../checkpoint-store.js";
|
|
2
11
|
import type { RunInternals, RunnerDepsSeat } from "./contracts.js";
|
|
3
12
|
export interface ResumeCheckpointScreenInput {
|
|
@@ -1,85 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { validatePath } from "../effective-path-target.js";
|
|
3
|
-
import { isAskOrigin } from "../ask-origin.js";
|
|
4
|
-
import { CHECKPOINT_FEATURES, CheckpointError, checkpointVersionOf, MAX_SUPPORTED_CHECKPOINT_VERSION, realApprovalOrgFact } from "../checkpoint-store.js";
|
|
5
|
-
import { judgeCheckpointRequirements } from "../checkpoint-requirements.js";
|
|
1
|
+
import { CheckpointError, realApprovalOrgFact } from "../checkpoint-store.js";
|
|
6
2
|
import { constraintChainDigest, constraintChainEntryOfSuppliedLayer } from "../tool-policy.js";
|
|
7
|
-
import { readFrozenSkillGrants } from "../skill-grant.js";
|
|
8
|
-
import { readFrozenSkillScopes } from "../mods/spec-seats.js";
|
|
9
3
|
import { chainInstallationGaps, chainInstallationRefusal } from "./child-tree.js";
|
|
10
4
|
import { chainEntryFault } from "../mods/stations.js";
|
|
11
5
|
import { refusePersistedToolNames, refuseRenamedDelegationMounts } from "./sub-agent-deny-lists.js";
|
|
12
6
|
import { asResumeConfigRefusal } from "../mode-policy.js";
|
|
13
|
-
import { screenRecordedRunOrigin } from "../run-origin.js";
|
|
14
7
|
export function resumeCheckpointScreen(input) {
|
|
15
8
|
const { cp, resumeSignal, internals, tools, runner } = input;
|
|
16
|
-
const { realApproval: realApprovalRow, face: faceRow, f012: f012Row } = CHECKPOINT_FEATURES;
|
|
17
|
-
if (checkpointVersionOf(cp) > MAX_SUPPORTED_CHECKPOINT_VERSION) {
|
|
18
|
-
throw new CheckpointError("checkpoint.unsupported_version", `checkpoint requires reader capabilities this worker lacks (row format v${checkpointVersionOf(cp)}; this worker reads up to v${MAX_SUPPORTED_CHECKPOINT_VERSION}) — resume it on a worker at or above the version that parked it`, { reason: "version_newer" });
|
|
19
|
-
}
|
|
20
|
-
const requirements = judgeCheckpointRequirements(cp);
|
|
21
|
-
if (requirements.kind === "lacking")
|
|
22
|
-
throw new CheckpointError("checkpoint.unsupported_version", `checkpoint requires reader capabilities this worker lacks (${requirements.words.join(", ")}) — resume it on a worker at or above the version that parked it`, { reason: "version_newer", requires: requirements.words });
|
|
23
|
-
if (requirements.kind === "damaged")
|
|
24
|
-
throw new CheckpointError("checkpoint.invalid_outcome", `this checkpoint's reader-requirement list does not match the row (${requirements.why}) — refusing to resume a damaged row (corruption guard), the checkpoint stays pending; no worker can resume it: start the task again`, { reason: "requirements_damaged" });
|
|
25
9
|
const preCasGateBit = cp.gate.kind === "irreversible_ask" ? cp.gate.realApproval : undefined;
|
|
26
|
-
const preCasBitWellFormed = preCasGateBit !== undefined && typeof preCasGateBit === "object" && isAskOrigin(preCasGateBit.origin);
|
|
27
|
-
const faceSaysGoverned = (cp.state.readFace?.realApproval) === true;
|
|
28
|
-
const preCasBitViolation = checkpointVersionOf(cp) === realApprovalRow.version
|
|
29
|
-
? !preCasBitWellFormed
|
|
30
|
-
: checkpointVersionOf(cp) < realApprovalRow.version
|
|
31
|
-
? preCasGateBit !== undefined
|
|
32
|
-
: faceSaysGoverned
|
|
33
|
-
? !preCasBitWellFormed
|
|
34
|
-
: preCasGateBit !== undefined && !preCasBitWellFormed;
|
|
35
|
-
if (preCasBitViolation) {
|
|
36
|
-
throw new CheckpointError("checkpoint.invalid_outcome", checkpointVersionOf(cp) >= realApprovalRow.version
|
|
37
|
-
? `a v${checkpointVersionOf(cp)} checkpoint's realApproval gate bit must be well-formed (origin a member of the closed ask-origin set)${checkpointVersionOf(cp) === realApprovalRow.version ? " and present on an irreversible_ask gate" : ""} — this row's is not; refusing to resume a damaged real-approval row (corruption / downgrade guard), the checkpoint stays pending`
|
|
38
|
-
: `a v${checkpointVersionOf(cp)} checkpoint carries a realApproval gate bit no release of that version ever minted — refusing to honor a fabricated origin (corruption / forgery guard), the checkpoint stays pending`, { reason: checkpointVersionOf(cp) >= realApprovalRow.version ? "real_approval_damaged" : "real_approval_forged" });
|
|
39
|
-
}
|
|
40
|
-
{
|
|
41
|
-
const faceSectionRaw = cp.state.readFace;
|
|
42
|
-
const faceCandidate = faceSectionRaw !== undefined && typeof faceSectionRaw === "object" && faceSectionRaw !== null
|
|
43
|
-
? faceSectionRaw
|
|
44
|
-
: undefined;
|
|
45
|
-
const faceWellFormed = faceCandidate !== undefined &&
|
|
46
|
-
(faceCandidate.face === "open" || faceCandidate.face === "roots") &&
|
|
47
|
-
(faceCandidate.realApproval === undefined || faceCandidate.realApproval === true) &&
|
|
48
|
-
(faceCandidate.denyEntries === undefined ||
|
|
49
|
-
(Array.isArray(faceCandidate.denyEntries) &&
|
|
50
|
-
faceCandidate.denyEntries.every((e) => persistedReadDenyEntryProblem(e) === null)));
|
|
51
|
-
const v = checkpointVersionOf(cp);
|
|
52
|
-
if (v === faceRow.version ? !faceWellFormed : v < faceRow.version ? faceSectionRaw !== undefined : faceSectionRaw !== undefined && !faceWellFormed) {
|
|
53
|
-
throw new CheckpointError("checkpoint.invalid_outcome", checkpointVersionOf(cp) >= faceRow.version
|
|
54
|
-
? `a v${checkpointVersionOf(cp)} checkpoint must carry a well-formed read-face section (state.readFace) — this row's is missing or malformed; refusing to resume a damaged read-face row (corruption / downgrade guard), the checkpoint stays pending`
|
|
55
|
-
: `a v${checkpointVersionOf(cp)} checkpoint carries a read-face section no release of that version ever minted — refusing to honor a fabricated read-face state (corruption / forgery guard), the checkpoint stays pending`, { reason: checkpointVersionOf(cp) >= faceRow.version ? "read_face_damaged" : "read_face_forged" });
|
|
56
|
-
}
|
|
57
|
-
const writeFaceSectionRaw = cp.state.writeFace;
|
|
58
|
-
if (writeFaceSectionRaw !== undefined) {
|
|
59
|
-
const c = typeof writeFaceSectionRaw === "object" && writeFaceSectionRaw !== null ? writeFaceSectionRaw : undefined;
|
|
60
|
-
if (c === undefined || !(c.face === "open" || c.face === "roots")) {
|
|
61
|
-
throw new CheckpointError("checkpoint.invalid_outcome", `this checkpoint carries a write-face section (state.writeFace) that is not well-formed — refusing to resume a damaged write-face row (corruption guard), the checkpoint stays pending`, { reason: "write_face_damaged" });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (readFrozenSkillGrants(cp.state.skillGrants) === undefined)
|
|
65
|
-
throw new CheckpointError("checkpoint.invalid_outcome", "this checkpoint carries a skill-grant section (state.skillGrants) that does not read as grant rows under this engine — a damaged section, or a row an earlier release wrote whose entry this release reads as nothing (an entry with a surrounding space, say) — refusing to resume without the grant rows and refusals it carries; the checkpoint stays pending: finish it on a worker of the release that parked it, or expire it", { reason: "skill_grants_damaged" });
|
|
66
|
-
if (readFrozenSkillScopes(cp.state.skillScopes) === undefined)
|
|
67
|
-
throw new CheckpointError("checkpoint.invalid_outcome", "this checkpoint carries a skill-scope section (state.skillScopes) that does not read as a list of SkillSpec names — a damaged section — refusing to resume without the active skills' hooks it records; the checkpoint stays pending: finish it on a worker of the release that parked it, or expire it", { reason: "skill_scopes_damaged" });
|
|
68
|
-
for (const field of ["handsRoot", "handsHome", "handsCwd"]) {
|
|
69
|
-
const coordinate = cp.state[field];
|
|
70
|
-
if (coordinate !== undefined && validatePath(coordinate, { intent: "validate-coordinate" }) === undefined)
|
|
71
|
-
throw new CheckpointError("checkpoint.invalid_outcome", `this checkpoint's state.${field} is not an absolute path — refusing to resume a row whose hands' coordinates are damaged (corruption guard), the checkpoint stays pending`, { reason: "hands_coordinates_damaged" });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
10
|
if (realApprovalOrgFact(preCasGateBit) !== undefined && runner.deps.permissionRuleStore?.partitions.org !== true) {
|
|
75
11
|
throw new CheckpointError("checkpoint.unsupported_version", `this checkpoint's approval was minted under organization governance (org ${String(realApprovalOrgFact(preCasGateBit))}, routed as ${String(preCasGateBit?.origin)}) and this worker has no org adjudication wiring (its permission-rule store carries no org partition) — a governed approval may only be redeemed where governance can be enforced; the checkpoint stays pending, resume it on an org-wired worker`, { reason: "governed_unwired" });
|
|
76
12
|
}
|
|
77
|
-
const retiredWalltimeTotal = cp.resourceLedger?.totalWalltimeSec;
|
|
78
|
-
if (retiredWalltimeTotal !== undefined) {
|
|
79
|
-
throw new CheckpointError("checkpoint.walltime_axis_retired", "this checkpoint's ledger carries a cross-slice WALL-CLOCK allocation (resourceLedger.totalWalltimeSec), an axis this engine version retired — " +
|
|
80
|
-
"resuming here would run the leg with that ceiling unenforced. Rejected pre-CAS (the checkpoint stays pending): finish it on a worker of the " +
|
|
81
|
-
"previous release, or start a fresh task bounded by resourceSuspend.totalTokens / totalBudgetUsd.");
|
|
82
|
-
}
|
|
83
13
|
if (resumeSignal?.aborted === true && cp.status === "pending") {
|
|
84
14
|
throw new CheckpointError("checkpoint.resume_aborted", "the resume was handed an ALREADY-ABORTED signal — refusing to consume the approval on a leg that cannot run it (the checkpoint stays pending and is resumable with a live signal)");
|
|
85
15
|
}
|
|
@@ -91,8 +21,7 @@ export function resumeCheckpointScreen(input) {
|
|
|
91
21
|
"the restored workspace's own mount path is authoritative for the task root. Drop requestedCwd on resume legs " +
|
|
92
22
|
"(the checkpoint stays pending and is resumable without it).");
|
|
93
23
|
}
|
|
94
|
-
asResumeConfigRefusal("inheritedGate", () => refusePersistedToolNames((internals?.toolCeiling ?? undefined) === undefined ? cp.state.toolCeiling : undefined,
|
|
95
|
-
asResumeConfigRefusal("inheritedGate", () => void screenRecordedRunOrigin(cp.state.runOrigin));
|
|
24
|
+
asResumeConfigRefusal("inheritedGate", () => refusePersistedToolNames((internals?.toolCeiling ?? undefined) === undefined ? cp.state.toolCeiling : undefined, undefined, (internals?.ownToolLists ?? undefined) === undefined ? cp.state.ownToolLists : undefined));
|
|
96
25
|
asResumeConfigRefusal("taskConfig", () => refuseRenamedDelegationMounts(tools));
|
|
97
26
|
if (cp.state.inheritedGate?.requiresParentConstraint === true) {
|
|
98
27
|
const supplied = internals?.inheritedGate?.parentConstraints?.length ?? 0;
|
|
@@ -108,18 +37,9 @@ export function resumeCheckpointScreen(input) {
|
|
|
108
37
|
"re-supply would run the resumed leg under a different ancestor chain than it suspended with; " +
|
|
109
38
|
"rejected pre-CAS (the checkpoint stays pending) — re-resume with the full original chain");
|
|
110
39
|
}
|
|
111
|
-
if (checkpointVersionOf(cp) >= f012Row.version &&
|
|
112
|
-
(cp.state.inheritedGate.constraintChain === undefined || cp.state.inheritedGate.constraintDigest === undefined)) {
|
|
113
|
-
throw new CheckpointError("checkpoint.invalid_outcome", `a v${checkpointVersionOf(cp)} checkpoint that requires parent constraints must carry BOTH the frozen constraintChain and its constraintDigest (they are minted in one write with the version stamp) — this row carries neither or only one; refusing to fall back to the count-only contract on a damaged row (corruption / downgrade guard), the checkpoint stays pending`, { reason: "constraint_chain_missing" });
|
|
114
|
-
}
|
|
115
40
|
const expectedDigest = cp.state.inheritedGate.constraintDigest;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (persistedChain === undefined || constraintChainDigest(persistedChain) !== expectedDigest) {
|
|
119
|
-
throw new CheckpointError("resume.parent_constraint_mismatch", "the checkpoint's OWN recorded constraint chain does not match its recorded digest " +
|
|
120
|
-
"(corrupt / inconsistently-minted row) — the frozen deny data the resume would execute is not the data the " +
|
|
121
|
-
"digest authenticates; rejected pre-CAS (the checkpoint stays pending)");
|
|
122
|
-
}
|
|
41
|
+
const persistedChain = cp.state.inheritedGate.constraintChain;
|
|
42
|
+
if (expectedDigest !== undefined && persistedChain !== undefined) {
|
|
123
43
|
const suppliedDigest = constraintChainDigest((internals?.inheritedGate?.parentConstraints ?? []).map((pc, i) => constraintChainEntryOfSuppliedLayer(pc, persistedChain[i])));
|
|
124
44
|
if (suppliedDigest !== expectedDigest) {
|
|
125
45
|
throw new CheckpointError("resume.parent_constraint_mismatch", "the re-supplied parent-constraint chain's projection content does not match what the checkpoint recorded " +
|
|
@@ -45,6 +45,8 @@ export interface RunGitLaneInput {
|
|
|
45
45
|
onTurnEnd: (event: Extract<AgentHarnessEvent, {
|
|
46
46
|
type: "turn_end";
|
|
47
47
|
}>) => void;
|
|
48
|
+
/** borrowed-readonly — the harness-handlers lane's turn_start closure (awaited by the loop only when it raises). */
|
|
49
|
+
onTurnStart: () => Promise<void> | undefined;
|
|
48
50
|
/** borrowed-readonly — the turn-boundary lane's handler, registered on `turn_boundary` AFTER the owed-frame retry
|
|
49
51
|
* so a pending announcement is re-asserted into the session ahead of the boundary's own context work. */
|
|
50
52
|
onTurnBoundary: (event: {
|
|
@@ -3,7 +3,7 @@ import { wrapGitFrame } from "./git-leg-delivery.js";
|
|
|
3
3
|
import { appendAdmittedRow } from "../row-admission.js";
|
|
4
4
|
import { thrownText } from "../thrown-value.js";
|
|
5
5
|
export function runGitLane(input) {
|
|
6
|
-
const { prepared, queue, rs, ident, onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnBoundary, runner } = input;
|
|
6
|
+
const { prepared, queue, rs, ident, onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnStart, onTurnBoundary, runner } = input;
|
|
7
7
|
prepared.gitStatusRef.reassert = async () => {
|
|
8
8
|
const ref = prepared.gitStatusRef;
|
|
9
9
|
const frame = ref.frame;
|
|
@@ -81,6 +81,8 @@ export function runGitLane(input) {
|
|
|
81
81
|
const unsubBoundary = prepared.harness.on("turn_boundary", onTurnBoundary);
|
|
82
82
|
const unsub = prepared.harness.subscribe((event) => {
|
|
83
83
|
switch (event.type) {
|
|
84
|
+
case "turn_start":
|
|
85
|
+
return onTurnStart();
|
|
84
86
|
case "message_update":
|
|
85
87
|
onMessageUpdate(event);
|
|
86
88
|
break;
|
|
@@ -99,6 +101,7 @@ export function runGitLane(input) {
|
|
|
99
101
|
default:
|
|
100
102
|
break;
|
|
101
103
|
}
|
|
104
|
+
return undefined;
|
|
102
105
|
});
|
|
103
106
|
return { flushGitMirror, unsubGitRetry, unsubBoundary, unsub };
|
|
104
107
|
}
|
|
@@ -36,6 +36,8 @@ export interface RunHarnessHandlersResult {
|
|
|
36
36
|
onTurnEnd: (event: Extract<AgentHarnessEvent, {
|
|
37
37
|
type: "turn_end";
|
|
38
38
|
}>) => void;
|
|
39
|
+
/** A model turn began: `turn.start` (the loop awaits it before the turn's first request); `undefined` when unheard. */
|
|
40
|
+
onTurnStart: () => Promise<void> | undefined;
|
|
39
41
|
/** The leg's workspace-frame observation (`Prepared.workspaceFrame.observe`); the run body
|
|
40
42
|
* calls it after a resume's approved-call resolution, which bypasses onToolEnd. */
|
|
41
43
|
announceWorkspaceMove: () => void;
|
|
@@ -13,7 +13,7 @@ import { hasVerifiableStructureSignal } from "./grounding-signal.js";
|
|
|
13
13
|
import { announceToolCall, batchResponseDigest, emitSettled } from "./tool-end-body.js";
|
|
14
14
|
import { neverExecuted, stampRowNotExecuted } from "./tool-not-executed.js";
|
|
15
15
|
import { extensionCallOf, noteExtensionCallDenied, requesterOf } from "../mods/extension-call.js";
|
|
16
|
-
import { noteCompletedTurn } from "../mods/lifecycle-stations.js";
|
|
16
|
+
import { noteCompletedTurn, raiseStartedTurn } from "../mods/lifecycle-stations.js";
|
|
17
17
|
import { createResponseModelSeat } from "./response-model-seat.js";
|
|
18
18
|
import { createToolCallIdFoldSeat } from "./tool-call-id-fold-seat.js";
|
|
19
19
|
import { createFinishReasonSeat } from "./finish-reason-seat.js";
|
|
@@ -296,6 +296,7 @@ export function createHarnessHandlers(input) {
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
|
+
const onTurnStart = () => raiseStartedTurn(prepared.modBus, prepared.hookIdentity, stats.turns + 1, prepared.abortController.signal);
|
|
299
300
|
const onTurnEnd = (event) => {
|
|
300
301
|
stats.turns += 1;
|
|
301
302
|
noteCompletedTurn(prepared.modBus, rs.turn, event.message.role === "assistant" ? event.message : undefined, stats.turns, prepared.abortController.signal.aborted, rs.turn.turnUsageMissing ? undefined : rs.turn.turnUsage);
|
|
@@ -363,5 +364,5 @@ export function createHarnessHandlers(input) {
|
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
366
|
};
|
|
366
|
-
return { onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, announceWorkspaceMove };
|
|
367
|
+
return { onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnStart, announceWorkspaceMove };
|
|
367
368
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { snapshotActorAssertion } from "../../internal/llm.js";
|
|
2
|
-
import {
|
|
2
|
+
import { steeringPreview } from "./steering-preview.js";
|
|
3
3
|
import { isEngineQuestionFace } from "../ask-question.js";
|
|
4
4
|
import { CheckpointError, planReviewRequesterOf, readPendingSteerQueue, realApprovalOrgFact, remainingBudgetMicroUsd } from "../checkpoint-store.js";
|
|
5
5
|
import { normalizePersistedRuleHit } from "../rule-lane-reads.js";
|
|
6
6
|
import { decidersNote, SETTLEMENT_NOBODY_JUDGED } from "../gate-outcome.js";
|
|
7
7
|
import { formatHookFeedback } from "../hooks.js";
|
|
8
8
|
import { classicEventBase, failedHandlerClause, legEventsOf, legNoticeTaskId, openSubagent, screenUserPrompt, seatHears } from "../mods/stations.js";
|
|
9
|
+
import { raiseSessionEnd, raiseSessionStart } from "../mods/lifecycle-stations.js";
|
|
9
10
|
import { offeredAgentListing } from "../mods/agent-stations.js";
|
|
10
11
|
import { appendAdmittedRow } from "../row-admission.js";
|
|
11
12
|
import { buildAppliedHumanInputEvent, buildHumanInputEvent, projectHumanInput } from "../human-input-projection.js";
|
|
@@ -65,6 +66,9 @@ export async function runLeg(input) {
|
|
|
65
66
|
let strandedHumanAnswers = [];
|
|
66
67
|
const legRunOrigin = prepared.wiringManifest.leg?.runOrigin;
|
|
67
68
|
try {
|
|
69
|
+
const starting = raiseSessionStart(prepared.modBus, prepared.hookIdentity, { cwd: prepared.cwdRef?.current ?? prepared.taskRootPath, sessionId: prepared.sessionId }, prepared.abortController.signal);
|
|
70
|
+
if (starting !== undefined)
|
|
71
|
+
await starting;
|
|
68
72
|
if (prepared.abortController.signal.aborted) {
|
|
69
73
|
const e = new Error("run aborted");
|
|
70
74
|
e.name = "AbortError";
|
|
@@ -188,6 +192,7 @@ export async function runLeg(input) {
|
|
|
188
192
|
continuation += "\n\n" + formatHookFeedback(resume.wakeMessageHookContext, prepared.reminderMark);
|
|
189
193
|
engineSegments.push({ start: hookStart, end: continuation.length });
|
|
190
194
|
}
|
|
195
|
+
let delivered = { text: steer.text, rewrittenBy: source === "wake" ? resume.wakeMessageRewrittenBy : undefined };
|
|
191
196
|
if (source === "steer") {
|
|
192
197
|
const screen = await screenUserPrompt(prepared.modBus, {
|
|
193
198
|
...classicEventBase(prepared.hookIdentity, prepared.permissionMode.observed),
|
|
@@ -235,6 +240,8 @@ export async function runLeg(input) {
|
|
|
235
240
|
});
|
|
236
241
|
continue;
|
|
237
242
|
}
|
|
243
|
+
if (screen.kind === "answered" && screen.rewrittenBy !== undefined)
|
|
244
|
+
delivered = { text: screen.text, rewrittenBy: screen.rewrittenBy };
|
|
238
245
|
if ("context" in outcome && outcome.context !== undefined) {
|
|
239
246
|
const hookStart = continuation.length;
|
|
240
247
|
continuation += "\n\n" + formatHookFeedback(outcome.context, prepared.reminderMark);
|
|
@@ -243,14 +250,14 @@ export async function runLeg(input) {
|
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
252
|
const start = continuation.length;
|
|
246
|
-
const projected = projectHumanInput({ text:
|
|
253
|
+
const projected = projectHumanInput({ text: delivered.text, actor: steer.actor, source });
|
|
247
254
|
continuation +=
|
|
248
255
|
"\n\n" +
|
|
249
256
|
(steer.trusted ? formatHookFeedback(projected, prepared.reminderMark) : delimitUntrusted("supervisor steering message", projected));
|
|
250
257
|
if (steer.trusted)
|
|
251
258
|
engineSegments.push({ start, end: continuation.length });
|
|
252
259
|
appliedEvents.push(() => ({
|
|
253
|
-
...buildAppliedHumanInputEvent({ carrier: source, source, sessionSeq: nextHumanInputSeq(prepared.harness), inputId: steer.inputId, actor: steer.actor, principal: spec.principal, runOrigin: steer.runOrigin }),
|
|
260
|
+
...buildAppliedHumanInputEvent({ carrier: source, source, sessionSeq: nextHumanInputSeq(prepared.harness), inputId: steer.inputId, actor: steer.actor, principal: spec.principal, runOrigin: steer.runOrigin, rewrittenBy: delivered.rewrittenBy }),
|
|
254
261
|
...ident(),
|
|
255
262
|
}));
|
|
256
263
|
}
|
|
@@ -283,13 +290,13 @@ export async function runLeg(input) {
|
|
|
283
290
|
});
|
|
284
291
|
}
|
|
285
292
|
if (outputStyleWrapped !== undefined) {
|
|
286
|
-
const preview =
|
|
293
|
+
const preview = steeringPreview(prepared.outputStyleFrame);
|
|
287
294
|
prepared.frameReceipts.pending.push({ source: "output_style", text: continuation, commit: () => void (queue.push({ type: "steering_injected", source: "output_style", preview, ...ident() }), (rs.attach.attachmentsInjected += 1)) });
|
|
288
295
|
}
|
|
289
296
|
if (postureText !== undefined)
|
|
290
297
|
prepared.frameReceipts.pending.push({ source: "posture", text: continuation, commit: () => undefined });
|
|
291
298
|
if (unavailableResume !== undefined)
|
|
292
|
-
prepared.frameReceipts.pending.push({ source: "mcp_unavailable", text: continuation, commit: () => void (settleMcpUnavailable(prepared, unavailableResume.entries), queue.push({ type: "steering_injected", source: "mcp_unavailable", preview:
|
|
299
|
+
prepared.frameReceipts.pending.push({ source: "mcp_unavailable", text: continuation, commit: () => void (settleMcpUnavailable(prepared, unavailableResume.entries), queue.push({ type: "steering_injected", source: "mcp_unavailable", preview: steeringPreview(unavailableResume.body), ...ident() }), (rs.attach.attachmentsInjected += 1)) });
|
|
293
300
|
if (prepared.turnOpenRedelivery.current !== undefined)
|
|
294
301
|
await prepared.turnOpenRedelivery.current;
|
|
295
302
|
final = await withBrainSinks(() => prepared.harness.prompt(continuation, {
|
|
@@ -312,7 +319,8 @@ export async function runLeg(input) {
|
|
|
312
319
|
}
|
|
313
320
|
else {
|
|
314
321
|
const objectiveActor = entryActor;
|
|
315
|
-
|
|
322
|
+
let projectedObjective = projectHumanInput({ text: spec.objective, actor: objectiveActor, source: "objective" });
|
|
323
|
+
let objectiveRewrittenBy;
|
|
316
324
|
let effectiveObjective = projectedObjective;
|
|
317
325
|
let promptBlocked = false;
|
|
318
326
|
const author = objectiveAuthorOf(objectiveAuthor, (e) => runner.deps.onError?.(e, { phase: "config", sessionId: prepared.sessionId, classification: "input-author-unreadable" }));
|
|
@@ -325,6 +333,11 @@ export async function runLeg(input) {
|
|
|
325
333
|
...(objectiveActor !== undefined ? { actor: snapshotActorAssertion(objectiveActor) } : {}),
|
|
326
334
|
...(prepared.userAttachments !== undefined ? { userAttachments: userAttachmentDeclarations(prepared.userAttachments) } : {}),
|
|
327
335
|
}, prepared.abortController.signal);
|
|
336
|
+
if (screen?.kind === "answered" && screen.rewrittenBy !== undefined) {
|
|
337
|
+
projectedObjective = projectHumanInput({ text: screen.text, actor: objectiveActor, source: "objective" });
|
|
338
|
+
objectiveRewrittenBy = screen.rewrittenBy;
|
|
339
|
+
effectiveObjective = projectedObjective;
|
|
340
|
+
}
|
|
328
341
|
if (screen?.kind === "aborted") {
|
|
329
342
|
holdPrompt(prepared.blockedRef, prepared.reminderMark, "cancelled", `the task was cancelled while the deployment's userPromptSubmit hook was still screening this prompt; ` +
|
|
330
343
|
`the prompt was NOT submitted (fail-closed)`);
|
|
@@ -490,7 +503,7 @@ export async function runLeg(input) {
|
|
|
490
503
|
text: effectiveObjective,
|
|
491
504
|
commit: () => {
|
|
492
505
|
f.commit();
|
|
493
|
-
queue.push({ type: "steering_injected", source: f.source, preview:
|
|
506
|
+
queue.push({ type: "steering_injected", source: f.source, preview: steeringPreview(f.body), ...ident() });
|
|
494
507
|
rs.attach.attachmentsInjected += 1;
|
|
495
508
|
f.disclose();
|
|
496
509
|
},
|
|
@@ -514,6 +527,7 @@ export async function runLeg(input) {
|
|
|
514
527
|
...(spec.principal !== undefined ? { principal: spec.principal } : {}),
|
|
515
528
|
...(attachmentFrames.length > 0 ? { attachments: humanInputAttachmentsOf(attachmentFrames) } : {}),
|
|
516
529
|
...(legRunOrigin !== undefined ? { runOrigin: legRunOrigin } : {}),
|
|
530
|
+
...(objectiveRewrittenBy !== undefined ? { rewrittenBy: objectiveRewrittenBy } : {}),
|
|
517
531
|
}),
|
|
518
532
|
...ident(),
|
|
519
533
|
});
|
|
@@ -542,6 +556,9 @@ export async function runLeg(input) {
|
|
|
542
556
|
await settleTeardownLeg(() => prepared.mcp.dispose(), "mcp.dispose (tool_unavailable leg)", (e) => runner.deps.onError?.(e, { phase: "config", sessionId: prepared.sessionId }));
|
|
543
557
|
await settleTeardownLeg(() => prepared.a2a?.dispose(), "a2a.dispose (tool_unavailable leg)", (e) => runner.deps.onError?.(e, { phase: "config", sessionId: prepared.sessionId }));
|
|
544
558
|
await settleTeardownLeg(() => (prepared.ownedEnv && hasDestroy(prepared.ownedEnv) ? prepared.ownedEnv.destroy() : undefined), "ownedEnv.destroy (tool_unavailable leg)", (e) => runner.deps.onError?.(e, { phase: "config", sessionId: prepared.sessionId }));
|
|
559
|
+
const ending = raiseSessionEnd(prepared.modBus, prepared.hookIdentity, { reason: "failed", sessionId: prepared.sessionId });
|
|
560
|
+
if (ending !== undefined)
|
|
561
|
+
await ending;
|
|
545
562
|
throw err;
|
|
546
563
|
}
|
|
547
564
|
threw = err;
|
|
@@ -679,7 +696,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
679
696
|
return;
|
|
680
697
|
}
|
|
681
698
|
const executedArgs = resolvedArgs;
|
|
682
|
-
const unseen = !licenseCovers(pendingAction.boundInputHash, executedArgs);
|
|
699
|
+
const unseen = !licenseCovers(pendingAction.boundInputHash, pendingAction.toolName, executedArgs);
|
|
683
700
|
let beltReading;
|
|
684
701
|
const beltReq = () => ({ toolName: pendingAction.toolName, args: executedArgs, toolCallId: pendingAction.toolCallId, ...callFaceSeat(beltFace()), budget: beltBudget, ...(prepared.cwdRef !== undefined ? { cwd: prepared.cwdRef.current } : {}), ...(prepared.handsRoot !== undefined ? { root: prepared.handsRoot } : {}), ...advertisedWritableRootsSeat(prepared.advertisedWritableDirs), ...exemptRootsSeat(prepared.exemptRoots), ...(beltReading !== undefined ? { targetReading: beltReading } : {}), ...requestGrantBinding((call, args) => skillGrantBindingMembers(call, args, prepared.skillSpecs, SKILL_TOOL_NAME), pendingAction, executedArgs) });
|
|
685
702
|
const unjudgeable = unseen ? chainCannotJudge(resume.cp.state.inheritedGate) : undefined;
|
|
@@ -194,8 +194,9 @@ export async function runSettleAndTeardown(input) {
|
|
|
194
194
|
taskIdRef.delegationTerminalOwed = undefined;
|
|
195
195
|
if (rs.turn.completed !== undefined)
|
|
196
196
|
await raiseCompletedTurn(prepared.modBus, rs.turn, prepared.hookIdentity, undefined);
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
const ending = raiseSessionEnd(prepared.modBus, prepared.hookIdentity, { reason: terminalFace.status, sessionId: prepared.sessionId });
|
|
198
|
+
if (ending !== undefined)
|
|
199
|
+
await ending;
|
|
199
200
|
if (rs.degrade.degraded)
|
|
200
201
|
result.degraded = rs.degrade.degraded;
|
|
201
202
|
if (prepared.outputRef.set)
|
|
@@ -221,8 +222,9 @@ export async function runSettleAndTeardown(input) {
|
|
|
221
222
|
const mes = prepared.memoryEngineSession;
|
|
222
223
|
await settleTeardownLeg(() => mes.harvest(), "memoryEngineSession.harvest (settle leg)", (e) => runner.deps.onError?.(e, { phase: "config", sessionId: prepared.sessionId }));
|
|
223
224
|
const scope = mes.handle.writeScope;
|
|
224
|
-
if (scope !== null && autoRunOnRecommendationEffective(runner.deps) && scopeHasUnconsumedRecommendation(mes.engine, scope)) {
|
|
225
|
-
|
|
225
|
+
if (scope !== null && autoRunOnRecommendationEffective(runner.deps) && (await scopeHasUnconsumedRecommendation(mes.engine, scope))) {
|
|
226
|
+
const compliance = { postureOf: runner.deps.compliancePostureResolver, scopeContract: mes.scopeContract, denies: spec.complianceAdditionalDenies };
|
|
227
|
+
void autoRunConsolidationFromRecommendation({ deps: runner.deps, engine: mes.engine, scope, sessionId: prepared.sessionId, writeJudge: prepared.consolidationWriteJudge, compliance, onNotice: runner.deps.onNotice, onError: runner.deps.onError });
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
emitTrace(rs.telemetry.tracer, () => ({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { openSystemReminder } from "../reminder-mint.js";
|
|
2
2
|
import { formatHookFeedback } from "../hooks.js";
|
|
3
3
|
import { classicEventBase, dispatchClassic, legEventsOf, stringMembersAnswer, stringMembersOf } from "../mods/stations.js";
|
|
4
|
+
import { steeringPreview } from "./steering-preview.js";
|
|
4
5
|
import { asThrownError } from "../thrown-value.js";
|
|
5
6
|
const STOP_HOOK_BLOCK_CAP = 8;
|
|
6
7
|
export function runStopAndFinalVerify(input) {
|
|
@@ -22,7 +23,7 @@ export function runStopAndFinalVerify(input) {
|
|
|
22
23
|
return worst;
|
|
23
24
|
};
|
|
24
25
|
const emitFinalVerifyEcho = (body) => {
|
|
25
|
-
queue.push({ type: "steering_injected", source: "final_verification", preview: body
|
|
26
|
+
queue.push({ type: "steering_injected", source: "final_verification", preview: steeringPreview(body), ...ident() });
|
|
26
27
|
};
|
|
27
28
|
const owed = spec.oneShot === true ? deliveryObligations : undefined;
|
|
28
29
|
if (stopArmed || finalVerificationOn || owed !== undefined) {
|
|
@@ -3,13 +3,13 @@ import { mintSystemReminder } from "../reminder-mint.js";
|
|
|
3
3
|
import { eventDefaultOn } from "../../prompt-assembly/event-registry.js";
|
|
4
4
|
import { compactionFailureReason, compactionPassReport, DEFAULT_COMPACTION_INSTRUCTIONS, isCompactionManualCancel, manualCompactOutcomeOf, maybeCompact, mintCompactedEvent, nextTrimForceBackoff, recordCompactionAndCheckRapidRefill } from "../auto-compaction.js";
|
|
5
5
|
import { emitTrace } from "../trace.js";
|
|
6
|
-
import {
|
|
6
|
+
import { steeringPreview } from "./steering-preview.js";
|
|
7
7
|
import { ATTACHMENT_BYTE_CAP, CHANGED_FILES_MAX, TOTAL_TOKENS_REMINDER_DEFAULT_MODE, attachmentEnvelopeTags, clipToBytes, collectDateChange, collectDueAttachments, collectInstructionsChange, commitAgentListing, commitInstructionsChange, commitSkillsListing, isIntactSource, rebaseCadenceWindows, renderAgentListingFrame, renderMcpInstructionsDelta, selectMcpDroppedBatch, renderSkillsListingFrame } from "./turn-attachments.js";
|
|
8
8
|
import { announceListingTruncation } from "../skill-listing-budget.js";
|
|
9
9
|
import { buildWorkingFileAttachments, centerAdoptionOption, contextInstructionFilesOption, emitInputTruncated, forkContextOption, legCompactionSettings, legContextOverlayOption } from "./compaction-call-options.js";
|
|
10
10
|
import { classicEventBase, dispatchClassic, seatHears, stringMembersAnswer, stringMembersOf } from "../mods/stations.js";
|
|
11
11
|
import { offeredAgentListing } from "../mods/agent-stations.js";
|
|
12
|
-
import { raiseCompletedTurn } from "../mods/lifecycle-stations.js";
|
|
12
|
+
import { measureSession, raiseCompletedTurn } from "../mods/lifecycle-stations.js";
|
|
13
13
|
import { sanitizeUntrustedText, SHELLED_BODY_ENVELOPE_TAGS } from "../untrusted-text.js";
|
|
14
14
|
import { droppedToolDigest, withAnnounceDigests } from "./announce-once-ledger.js";
|
|
15
15
|
import { formatDiagnosticsBlock, withholdListedDiagnostics } from "../lsp-diagnostics.js";
|
|
@@ -192,7 +192,7 @@ export function createTurnBoundary(input) {
|
|
|
192
192
|
if (tightest !== undefined && tightest.ratio >= thresholds[index]) {
|
|
193
193
|
const percent = Math.min(100, Math.round(tightest.ratio * 100));
|
|
194
194
|
const body = limitApproachFrames(index === 0 ? 0 : 1, tightest.axis, percent, prepared.reminderMark);
|
|
195
|
-
const preview = body
|
|
195
|
+
const preview = steeringPreview(body);
|
|
196
196
|
prepared.frameReceipts.pending.push({
|
|
197
197
|
source: "limit_approach",
|
|
198
198
|
text: body,
|
|
@@ -458,7 +458,7 @@ export function createTurnBoundary(input) {
|
|
|
458
458
|
bundleReceipts.push({
|
|
459
459
|
source: a.source,
|
|
460
460
|
commit: () => {
|
|
461
|
-
queue.push({ type: "steering_injected", source: a.source, preview:
|
|
461
|
+
queue.push({ type: "steering_injected", source: a.source, preview: steeringPreview(a.body, a.echoBound), ...ident() });
|
|
462
462
|
rs.attach.attachmentsInjected += 1;
|
|
463
463
|
record?.();
|
|
464
464
|
},
|
|
@@ -623,6 +623,9 @@ export function createTurnBoundary(input) {
|
|
|
623
623
|
if (comp.contextUsage) {
|
|
624
624
|
const sections = contextUsageSections(prepared.promptManifest.sections);
|
|
625
625
|
queue.push({ type: "context_usage", ...comp.contextUsage, ...(sections !== undefined ? { sections } : {}), ...ident() });
|
|
626
|
+
const measured = measureSession(prepared.modBus, prepared.sessionMeasure, comp.contextUsage, prepared.hookIdentity, prepared.abortController.signal);
|
|
627
|
+
if (measured !== undefined)
|
|
628
|
+
await measured;
|
|
626
629
|
}
|
|
627
630
|
if (comp.unevaluableWindow) {
|
|
628
631
|
discloseUnevaluableWindow(comp.unevaluableWindow, prepared, rs.telemetry.tracer, rs.telemetry.taskId, runnerHooks.onError);
|
|
@@ -440,7 +440,7 @@ export class Runner {
|
|
|
440
440
|
const postToolBatchArmed = prepared.modBus.hasHandlers("classic.PostToolBatch");
|
|
441
441
|
const batchArgs = postToolBatchArmed ? new Map() : undefined;
|
|
442
442
|
rs.turn.toolBatch = [];
|
|
443
|
-
const { onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, announceWorkspaceMove } = createHarnessHandlers({
|
|
443
|
+
const { onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnStart, announceWorkspaceMove } = createHarnessHandlers({
|
|
444
444
|
prepared, stats, rs,
|
|
445
445
|
deps: {
|
|
446
446
|
spec, queue, internals, ident, mediaBudgetBase64Chars: this.deps.mediaBudgetBase64Chars,
|
|
@@ -469,7 +469,7 @@ export class Runner {
|
|
|
469
469
|
runner: this.depsSeat,
|
|
470
470
|
},
|
|
471
471
|
});
|
|
472
|
-
const { flushGitMirror, unsubGitRetry, unsubBoundary, unsub } = runGitLane({ prepared, queue, rs, ident, onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnBoundary, runner: this.depsSeat });
|
|
472
|
+
const { flushGitMirror, unsubGitRetry, unsubBoundary, unsub } = runGitLane({ prepared, queue, rs, ident, onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnStart, onTurnBoundary, runner: this.depsSeat });
|
|
473
473
|
return withLegRequestSinks(() => runLeg({
|
|
474
474
|
spec, queue, prepared, resume, rs, entryActor, objectiveAuthor: internals?.objectiveAuthor, effectiveTimeoutMs, timeout, pushContent, ident, emitCommitted, writeFamilyOf, startedToolCallIds,
|
|
475
475
|
announceWorkspaceMove, withBrainSinks, flushGitMirror, loopLatch, notificationLane, unsubscribeTaskNotifications, unsubGitRetry, unsubBoundary, unsub,
|
|
@@ -532,20 +532,20 @@ export class Runner {
|
|
|
532
532
|
cp, config, internals, outcomeGate, wakeMessage, resumeSignal, recheckGovernanceWindow,
|
|
533
533
|
plainPolicyOutcome: capturedPolicyOutcome, plainReviewOutcome, plainParkOutcome,
|
|
534
534
|
runner: this.depsSeat, effectiveDelegationFacts,
|
|
535
|
-
next: ({ wakeHookContext, legMods, plainPolicyOutcome, outcomeForStore }) => resumePreflight({
|
|
535
|
+
next: ({ wakeHookContext, wakeMessage: wakeDelivered, wakeRewrittenBy, legMods, plainPolicyOutcome, outcomeForStore }) => resumePreflight({
|
|
536
536
|
token, cp, resumeSignal, recheckGovernanceWindow, store, runner: this.depsSeat,
|
|
537
537
|
locallyClaimedTokens: this.locallyClaimedTokens, parentConstraintRegistry: this.parentConstraintRegistry, suspendedEnvReaps: this.suspendedEnvReaps,
|
|
538
538
|
next: () => resumeClaim({
|
|
539
539
|
token, cp, store, outcomeForStore, holder: internals?.holder,
|
|
540
540
|
locallyClaimedTokens: this.locallyClaimedTokens, parentConstraintRegistry: this.parentConstraintRegistry, suspendedEnvReaps: this.suspendedEnvReaps,
|
|
541
541
|
onDestroyError: (err, sessionId) => this.depsSeat.deps.onError?.(err, { phase: "config", sessionId }),
|
|
542
|
-
next: () => this.resumeHandoff({ token, cp, store, config, internals, resumeInternals, plainPolicyOutcome, redeemedAnswer, outcomeForStore, wakeMessage, wakeHookContext, legMods, resumeSignal }),
|
|
542
|
+
next: () => this.resumeHandoff({ token, cp, store, config, internals, resumeInternals, plainPolicyOutcome, redeemedAnswer, outcomeForStore, wakeMessage: wakeDelivered, wakeRewrittenBy, wakeHookContext, legMods, resumeSignal }),
|
|
543
543
|
}),
|
|
544
544
|
}),
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
547
|
async resumeHandoff(claimed) {
|
|
548
|
-
const { token, cp, store, config, internals, resumeInternals, plainPolicyOutcome, redeemedAnswer, outcomeForStore, wakeMessage, wakeHookContext, legMods, resumeSignal } = claimed;
|
|
548
|
+
const { token, cp, store, config, internals, resumeInternals, plainPolicyOutcome, redeemedAnswer, outcomeForStore, wakeMessage, wakeRewrittenBy, wakeHookContext, legMods, resumeSignal } = claimed;
|
|
549
549
|
let consumeFlipDone = false;
|
|
550
550
|
if (internals?.afterCheckpointResolve !== undefined) {
|
|
551
551
|
await internals.afterCheckpointResolve();
|
|
@@ -575,7 +575,7 @@ export class Runner {
|
|
|
575
575
|
throw new CheckpointError("checkpoint.resume_aborted", said);
|
|
576
576
|
throw new CheckpointError("checkpoint.reopen_failed", said);
|
|
577
577
|
}
|
|
578
|
-
return this.runTaskStream(spec, { cp, outcome: outcomeForStore, reopenUnstarted, recordExecutionOutcome, ...(wakeMessage !== undefined ? { wakeMessage } : {}), ...(wakeHookContext !== undefined ? { wakeMessageHookContext: wakeHookContext } : {}), ...(legMods !== undefined ? { legMods } : {}) }, resumeInternals);
|
|
578
|
+
return this.runTaskStream(spec, { cp, outcome: outcomeForStore, reopenUnstarted, recordExecutionOutcome, ...(wakeMessage !== undefined ? { wakeMessage } : {}), ...(wakeRewrittenBy !== undefined ? { wakeMessageRewrittenBy: wakeRewrittenBy } : {}), ...(wakeHookContext !== undefined ? { wakeMessageHookContext: wakeHookContext } : {}), ...(legMods !== undefined ? { legMods } : {}) }, resumeInternals);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
export function runTask(spec, deps) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The display bound, in characters, of a prose frame's echo. The wire contract names no number ("the injected text
|
|
3
|
+
* clipped to a display bound"); this is the one the stream has always used. A frame whose body is a list of rows the
|
|
4
|
+
* renderer already bounds declares its own wider bound on the frame (`TurnAttachment.echoBound`) rather than being
|
|
5
|
+
* cut mid-row by this one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const STEERING_PREVIEW_BUDGET = 220;
|
|
8
|
+
/** The echo text of an injected frame body, bounded at `bound` (the shared budget when the frame declares none). */
|
|
9
|
+
export declare function steeringPreview(body: string, bound?: number): string;
|
|
@@ -48,6 +48,7 @@ export function streamSteerVerb(input) {
|
|
|
48
48
|
};
|
|
49
49
|
let payload;
|
|
50
50
|
let mintsAFrame;
|
|
51
|
+
let rewrittenBy;
|
|
51
52
|
const publishQueued = (h) => {
|
|
52
53
|
const identity = internals?.parentToolCallId !== undefined ? { parentToolCallId: internals.parentToolCallId, sourceTaskId: h.hookIdentity.taskId } : {};
|
|
53
54
|
queue.push({
|
|
@@ -60,6 +61,7 @@ export function streamSteerVerb(input) {
|
|
|
60
61
|
...(actor !== undefined ? { actor } : {}),
|
|
61
62
|
...(actor?.issuer !== undefined ? { issuer: actor.issuer } : {}),
|
|
62
63
|
...(spec.principal !== undefined ? { principal: spec.principal } : {}),
|
|
64
|
+
...(rewrittenBy !== undefined ? { rewrittenBy } : {}),
|
|
63
65
|
}),
|
|
64
66
|
eventId: uuidv7(),
|
|
65
67
|
...identity,
|
|
@@ -111,6 +113,12 @@ export function streamSteerVerb(input) {
|
|
|
111
113
|
if (screen?.block !== undefined && screen.block !== "") {
|
|
112
114
|
throw steeringError(`the deployment's userPromptSubmit hook blocked this steering input: ${inlineUntrusted(screen.block)}`, "steering.blocked_by_hook");
|
|
113
115
|
}
|
|
116
|
+
if (screen?.kind === "answered" && screen.rewrittenBy !== undefined) {
|
|
117
|
+
const rewritten = projectHumanInput({ text: screen.text, actor, source: "steer" });
|
|
118
|
+
payload = trusted ? formatHookFeedback(rewritten, h.reminderMark) : frameMidTurnUserInput(rewritten);
|
|
119
|
+
mintsAFrame = payload.trim().length !== 0;
|
|
120
|
+
rewrittenBy = screen.rewrittenBy;
|
|
121
|
+
}
|
|
114
122
|
if (screen?.additionalContext !== undefined && screen.additionalContext !== "") {
|
|
115
123
|
payload = `${formatHookFeedback(screen.additionalContext, h.reminderMark)}\n\n${payload}`;
|
|
116
124
|
}
|
|
@@ -7,7 +7,7 @@ import { readMember } from "../thrown-value.js";
|
|
|
7
7
|
import { egressText } from "../untrusted-egress.js";
|
|
8
8
|
import { REDACTION_MARK } from "../redaction-marks.js";
|
|
9
9
|
import { isSensitiveName, looksLikeCredentialValue } from "../secret-env.js";
|
|
10
|
-
import { isSensitiveRecordKey } from "
|
|
10
|
+
import { isSensitiveRecordKey } from "@sema-agent/primitives";
|
|
11
11
|
const LOOP_EXIT_FAILURE = {
|
|
12
12
|
completed: undefined,
|
|
13
13
|
aborted_before_stream: undefined,
|
|
@@ -16,6 +16,8 @@ export const APPROVAL_CARD_REQUIRED_KEYS = Object.freeze({
|
|
|
16
16
|
plan: [],
|
|
17
17
|
question: [],
|
|
18
18
|
generic: [],
|
|
19
|
+
"computer-access": ["apps"],
|
|
20
|
+
"computer-control": [],
|
|
19
21
|
});
|
|
20
22
|
export function toolFaceProblem(face, schema, tool) {
|
|
21
23
|
return faceProblem(face, schema, tool);
|
|
@@ -194,6 +194,11 @@ export interface TurnAttachment {
|
|
|
194
194
|
* run: the caller runs it on the receipt of the message carrying the frame (`FrameReceipt`). A frame the lane cap
|
|
195
195
|
* drops is not returned, so its step never runs and the frame is due again; a clipped frame keeps it. */
|
|
196
196
|
commit?: () => void;
|
|
197
|
+
/** The bound, in characters, of this frame's `steering_injected` echo when the shared display budget would cut it
|
|
198
|
+
* mid-row: a frame whose body is a list of rows its renderer already bounds states the bound of that list (here, the
|
|
199
|
+
* lane cap it rides under) so the echo is the list the model received, not the first row or two of it. Absent = the
|
|
200
|
+
* shared budget ({@link import("./steering-preview.js").STEERING_PREVIEW_BUDGET}). */
|
|
201
|
+
echoBound?: number;
|
|
197
202
|
}
|
|
198
203
|
/** H4 — the thin projection of a todo list kept run-local (NEVER the wire-capped `tool_end.structured` card).
|
|
199
204
|
* Pure CONTENT memory: the write-window anchor lives on {@link AttachmentState.todoLastWriteTurn}
|