@sema-agent/core 7.5.1 → 7.5.2
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 +20 -0
- package/dist/core/protocol-table.d.ts +5 -0
- package/dist/core/protocol-table.js +1 -0
- package/dist/core/runner/abort-race.d.ts +41 -0
- package/dist/core/runner/abort-race.js +38 -0
- package/dist/core/runner/checkpoint-scope.d.ts +15 -3
- package/dist/core/runner/checkpoint-scope.js +3 -0
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/content-ask-bindings.d.ts +27 -0
- package/dist/core/runner/content-ask-bindings.js +1 -0
- package/dist/core/runner/contracts.d.ts +118 -6
- package/dist/core/runner/denial-limit-arms.d.ts +23 -0
- package/dist/core/runner/denial-limit-arms.js +21 -0
- package/dist/core/runner/inherited-ask-grants.d.ts +46 -0
- package/dist/core/runner/inherited-ask-grants.js +29 -0
- package/dist/core/runner/park-commit.d.ts +108 -0
- package/dist/core/runner/park-commit.js +32 -0
- package/dist/core/runner/{prepare-permission-rules.d.ts → permission-rule-lanes.d.ts} +109 -3
- package/dist/core/runner/{prepare-permission-rules.js → permission-rule-lanes.js} +47 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +110 -0
- package/dist/core/runner/prepare-ask-lane.js +133 -0
- package/dist/core/runner/prepare-boundary-parks.d.ts +105 -0
- package/dist/core/runner/prepare-boundary-parks.js +169 -0
- package/dist/core/runner/prepare-context-lane.d.ts +119 -0
- package/dist/core/runner/prepare-context-lane.js +230 -0
- package/dist/core/runner/prepare-gate-stations.d.ts +177 -0
- package/dist/core/runner/prepare-gate-stations.js +290 -0
- package/dist/core/runner/prepare-hands-readface.d.ts +4 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +4 -4
- package/dist/core/runner/prepare-memory-engine-session.d.ts +84 -0
- package/dist/core/runner/prepare-memory-engine-session.js +233 -0
- package/dist/core/runner/prepare-park-ask.d.ts +164 -0
- package/dist/core/runner/prepare-park-ask.js +377 -0
- package/dist/core/runner/prepare-policy-chain.d.ts +208 -0
- package/dist/core/runner/prepare-policy-chain.js +584 -0
- package/dist/core/runner/prepare-project-context.d.ts +1 -13
- package/dist/core/runner/prepare-project-context.js +1 -3
- package/dist/core/runner/prepare-prompt-assembly.d.ts +95 -0
- package/dist/core/runner/prepare-prompt-assembly.js +162 -0
- package/dist/core/runner/prepare-prompt-inputs.d.ts +1 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +3 -3
- package/dist/core/runner/prepare-protocol-tools.js +0 -3
- package/dist/core/runner/prepare-question-face.d.ts +3 -21
- package/dist/core/runner/prepare-question-face.js +2 -1
- package/dist/core/runner/prepare-safety-scan.d.ts +0 -5
- package/dist/core/runner/prepare-safety-scan.js +1 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +170 -0
- package/dist/core/runner/prepare-suspend-saga.js +308 -0
- package/dist/core/runner/prepare-task.d.ts +9 -136
- package/dist/core/runner/prepare-task.js +44 -2741
- package/dist/core/runner/prepare-turn-wiring.d.ts +154 -0
- package/dist/core/runner/prepare-turn-wiring.js +201 -0
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -3
- package/dist/core/runner/prepare-wiring-manifest.js +9 -2
- package/dist/core/runner/prepare-workspace-restore.d.ts +2 -29
- package/dist/core/runner/prepare-workspace-restore.js +3 -16
- package/dist/core/runner/prompt-hash-salt.d.ts +1 -0
- package/dist/core/runner/prompt-hash-salt.js +2 -0
- package/dist/core/runner/remote-env-retry.d.ts +29 -0
- package/dist/core/runner/remote-env-retry.js +16 -0
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/session.d.ts +12 -0
- package/dist/core/session.js +3 -0
- package/package.json +1 -1
- /package/dist/core/runner/{prepare-announce-once.d.ts → announce-once-ledger.d.ts} +0 -0
- /package/dist/core/runner/{prepare-announce-once.js → announce-once-ledger.js} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { AgentTool } from "../../internal/harness.js";
|
|
2
|
+
import type { Model } from "../../internal/llm.js";
|
|
3
|
+
import { assemblePrompt, type AssembledPrompt } from "../../prompt-assembly/assemble.js";
|
|
4
|
+
import { type PromptEpochArtifact } from "../../prompt-assembly/artifact.js";
|
|
5
|
+
import { type EpochDeclaredSections } from "../../prompt-assembly/epoch.js";
|
|
6
|
+
import { type EnvironmentFacts, type PromptProvider, type PromptTextDeclaration } from "../../prompts/default.js";
|
|
7
|
+
import { type StoredSession } from "../session.js";
|
|
8
|
+
import type { RunnerDeps } from "../types.js";
|
|
9
|
+
import type { AnnounceOnceSink, Prepared, PrepareResume, PromptFeatureFlags, RunInternals } from "./contracts.js";
|
|
10
|
+
/** The center adoption a run composes under: the artifact and, when the source stamped one, its revision. */
|
|
11
|
+
export type CenterAdoption = {
|
|
12
|
+
artifact: PromptEpochArtifact;
|
|
13
|
+
sourceRevision?: string;
|
|
14
|
+
};
|
|
15
|
+
export interface PreparePromptAssemblyInput {
|
|
16
|
+
/** borrowed-mutable — the acquired session. Read: `getPromptEpoch` (the pin, twice — the center arm and the epoch
|
|
17
|
+
* resolution), `getBranch` (the freshness discriminator on the pinless arms). Writer here: `appendPromptEpoch`, the
|
|
18
|
+
* ONE pin write of this leg (only when the resolution migrated). The acquire phase and the run loop write it elsewhere. */
|
|
19
|
+
session: Pick<StoredSession, "getPromptEpoch" | "getBranch" | "appendPromptEpoch">;
|
|
20
|
+
/** borrowed-readonly — the deployment seats: `promptSource` (the center artifact store and its live candidate), `onError`
|
|
21
|
+
* (the assembly's warn channel, the prompt-constitution line, the missing-declaration disclosure). Receiver preserved. */
|
|
22
|
+
deps: Pick<RunnerDeps, "promptSource" | "onError">;
|
|
23
|
+
/** borrowed-readonly — the trusted spawn-side channel: the parent's center closure (`parentCenterArtifactDigest`,
|
|
24
|
+
* `parentCenterSourceRevision`), the top-level freshness facts (`parentTaskId`, `parentSessionId`) and the named-child
|
|
25
|
+
* fact the teammate flag reads (`explicitAgentName`). */
|
|
26
|
+
internals: Pick<RunInternals, "parentCenterArtifactDigest" | "parentCenterSourceRevision" | "parentTaskId" | "parentSessionId" | "explicitAgentName"> | undefined;
|
|
27
|
+
/** borrowed-readonly — the resume leg, or undefined; PRESENCE only (a resumed leg is never truly fresh). */
|
|
28
|
+
resume: Pick<PrepareResume, "seed"> | undefined;
|
|
29
|
+
/** borrowed-readonly — the resolved prompt provider (compared against the default for `isDefaultProvider`). */
|
|
30
|
+
provider: PromptProvider;
|
|
31
|
+
/** borrowed-readonly — the caller's role-layer prompt, or undefined. */
|
|
32
|
+
userSystemPrompt: string | undefined;
|
|
33
|
+
/** borrowed-readonly — the caller's appended prompt, or undefined. */
|
|
34
|
+
userAppendSystemPrompt: string | undefined;
|
|
35
|
+
/** borrowed-readonly — the harness-context flags; the two orchestration flags are re-derived against the post-exclusion
|
|
36
|
+
* roster at assembly. */
|
|
37
|
+
featureFlags: PromptFeatureFlags;
|
|
38
|
+
/** borrowed-readonly — the MCP instructions block, or undefined. */
|
|
39
|
+
mcpInstructionsBlock: string | undefined;
|
|
40
|
+
/** borrowed-readonly — the memory block as the assembly reads it (the recall paragraph already stripped when a
|
|
41
|
+
* retraction ran), or undefined. */
|
|
42
|
+
memoryBlock: string | undefined;
|
|
43
|
+
/** borrowed-readonly — the environment facts; `date` is the assembly's date, the block builder re-renders on a date change. */
|
|
44
|
+
envFacts: EnvironmentFacts;
|
|
45
|
+
/** borrowed-readonly — the resolved prompt profile (a runtime fact of the assembly). */
|
|
46
|
+
promptProfile: "simple" | "classic";
|
|
47
|
+
/** borrowed-readonly — the fable mitigations switch (a runtime fact of the assembly). */
|
|
48
|
+
fableMitigations: boolean;
|
|
49
|
+
/** borrowed-readonly — the run's ONE tool roster, read only: the assembly receives DETACHED copies, the audit and the
|
|
50
|
+
* manifest read it in place. Never mutated here. */
|
|
51
|
+
tools: AgentTool[];
|
|
52
|
+
/** borrowed-readonly — the task model; only `promptGuidance` (the model-guidance section). */
|
|
53
|
+
model: Pick<Model, "promptGuidance">;
|
|
54
|
+
/** borrowed-readonly — the acquired session id (every operator line's attribution). */
|
|
55
|
+
sessionId: string;
|
|
56
|
+
/** borrowed-readonly — the session's reminder provenance mark (the declaration the assembled prompt must render). */
|
|
57
|
+
reminderMark: string;
|
|
58
|
+
/** borrowed-readonly — the once-per-session ledger's operator sink (the collision audit's two lines). */
|
|
59
|
+
onceLedger: Pick<AnnounceOnceSink, "onError">;
|
|
60
|
+
}
|
|
61
|
+
export interface PreparePromptAssemblyResult {
|
|
62
|
+
/** borrowed-mutable — the LIVE system prompt (an accessor cell over this phase's closure variable). Writers: this
|
|
63
|
+
* phase's `renderWithDate` (the date re-render, called by the listings phase's date_change seam); the turn-wiring
|
|
64
|
+
* phase's center candidate `apply` (the compaction-boundary swap). Readers: the harness construction, the cache
|
|
65
|
+
* fingerprint, the turn snapshot's stable text, the prompt-overhead term. */
|
|
66
|
+
systemPromptSeat: {
|
|
67
|
+
current: string;
|
|
68
|
+
};
|
|
69
|
+
/** owned — the date re-render, or undefined for a provider whose assembly cannot re-render. Returns the new prompt and
|
|
70
|
+
* writes it into `systemPromptSeat`. */
|
|
71
|
+
renderWithDate: ((date: string) => string) | undefined;
|
|
72
|
+
/** owned — the physical block face of the assembled prompt, or undefined (the harness's systemBlocks and the turn
|
|
73
|
+
* snapshot's layout groups). */
|
|
74
|
+
systemBlocks: AssembledPrompt["systemBlocks"];
|
|
75
|
+
/** borrowed-mutable — the composition manifest (`Prepared.promptManifest`). Writers after this phase: the tool-disclosure
|
|
76
|
+
* phase writes `toolDisclosure` (when deferred tools exist); the turn-wiring phase backfills `snapshot` and `lowering`
|
|
77
|
+
* once the final wire tool list exists. */
|
|
78
|
+
promptManifest: Prepared["promptManifest"];
|
|
79
|
+
/** owned — the provider-declared sections in the epoch shape (id, slot, chars, opt-in contentHash; never text). */
|
|
80
|
+
epochDeclaredSections: EpochDeclaredSections;
|
|
81
|
+
/** owned — the resolved epoch's artifact digest, the turn snapshot's identity element. */
|
|
82
|
+
epochArtifactDigestForSnapshot: string;
|
|
83
|
+
/** owned — the re-invokable assemble-inputs BUILDER: the compaction-boundary candidate re-assembles with a new
|
|
84
|
+
* artifact's declarations through it (facts and tails identical; only the center closure differs). */
|
|
85
|
+
buildAssembleInputs: (centerDecls?: PromptTextDeclaration[]) => Parameters<typeof assemblePrompt>[0];
|
|
86
|
+
/** borrowed-mutable — the LIVE center adoption (an accessor cell over this phase's closure variable), or undefined.
|
|
87
|
+
* Writers: this phase (the three arms; the all-shadowed drop on the fresh arm); the turn-wiring phase's center
|
|
88
|
+
* candidate `apply` (the boundary swap / the explicit-disable rollback). Readers: the two late-bound ctx getters
|
|
89
|
+
* (inherited-gate, caps-and-workflow), the pin write, the candidate's same-artifact test. */
|
|
90
|
+
centerAdoptionRef: {
|
|
91
|
+
current: CenterAdoption | undefined;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** The M13 phase body — prepareTask's prompt-assembly stretch, verbatim (see the module header). */
|
|
95
|
+
export declare function preparePromptAssembly(input: PreparePromptAssemblyInput): Promise<PreparePromptAssemblyResult>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { SEND_MESSAGE_TOOL_NAME } from "../../agents/send-message-tool.js";
|
|
3
|
+
import { assemblePrompt } from "../../prompt-assembly/assemble.js";
|
|
4
|
+
import { artifactDeclarations } from "../../prompt-assembly/artifact.js";
|
|
5
|
+
import { resolveEpochAgainstBundled } from "../../prompt-assembly/epoch.js";
|
|
6
|
+
import { SEMA_DEFAULT_PACK } from "../../prompt-assembly/packs/sema-default.js";
|
|
7
|
+
import { auditToolCollisions, projectToolManifest } from "../../prompt-assembly/tool-catalog.js";
|
|
8
|
+
import { buildEnvironmentContext, defaultPromptProvider } from "../../prompts/default.js";
|
|
9
|
+
import { protocolOf } from "../protocol-table.js";
|
|
10
|
+
import { reminderMarkDeclaration } from "../reminder-mint.js";
|
|
11
|
+
import { hasConversationContent } from "../session.js";
|
|
12
|
+
import { PROMPT_HASH_SALT } from "./prompt-hash-salt.js";
|
|
13
|
+
export async function preparePromptAssembly(input) {
|
|
14
|
+
const { session, deps, internals, resume, provider, userSystemPrompt, userAppendSystemPrompt, featureFlags, mcpInstructionsBlock, memoryBlock, envFacts, promptProfile, fableMitigations, tools, model, sessionId, reminderMark, onceLedger } = input;
|
|
15
|
+
let centerAdoption;
|
|
16
|
+
let centerAdoptionFresh = false;
|
|
17
|
+
{
|
|
18
|
+
const failUnavailable = (digest, via) => {
|
|
19
|
+
const e = new Error(`prompt snapshot unavailable: ${via} center prompt artifact ${digest.slice(0, 23)}… has no verified resolvable copy (artifact store miss/corrupt${deps.promptSource === undefined ? "; RunnerDeps.promptSource is not configured" : ""}) — refusing to recompose a hybrid prompt (protocol §9.2)`);
|
|
20
|
+
e.code = "prompt.snapshot_unavailable";
|
|
21
|
+
throw e;
|
|
22
|
+
};
|
|
23
|
+
const pinnedEarly = await session.getPromptEpoch();
|
|
24
|
+
if (pinnedEarly?.centerArtifactDigest !== undefined) {
|
|
25
|
+
const art = await deps.promptSource?.get(pinnedEarly.centerArtifactDigest);
|
|
26
|
+
if (art === undefined)
|
|
27
|
+
failUnavailable(pinnedEarly.centerArtifactDigest, "this session is pinned to");
|
|
28
|
+
centerAdoption = { artifact: art, ...(pinnedEarly.sourceRevision !== undefined ? { sourceRevision: pinnedEarly.sourceRevision } : {}) };
|
|
29
|
+
}
|
|
30
|
+
else if (pinnedEarly === undefined) {
|
|
31
|
+
if (internals?.parentCenterArtifactDigest !== undefined) {
|
|
32
|
+
const art = await deps.promptSource?.get(internals.parentCenterArtifactDigest);
|
|
33
|
+
if (art === undefined)
|
|
34
|
+
failUnavailable(internals.parentCenterArtifactDigest, "the spawning parent adopted");
|
|
35
|
+
centerAdoption = {
|
|
36
|
+
artifact: art,
|
|
37
|
+
...(internals.parentCenterSourceRevision !== undefined ? { sourceRevision: internals.parentCenterSourceRevision } : {}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
else if (resume === undefined && internals?.parentTaskId === undefined && internals?.parentSessionId === undefined) {
|
|
41
|
+
const candidate = deps.promptSource?.current();
|
|
42
|
+
if (candidate !== undefined && !hasConversationContent(await session.getBranch())) {
|
|
43
|
+
centerAdoption = { artifact: candidate.artifact, sourceRevision: candidate.sourceRevision };
|
|
44
|
+
centerAdoptionFresh = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const buildAssembleInputs = (centerDecls) => ({
|
|
50
|
+
provider,
|
|
51
|
+
isDefaultProvider: provider === defaultPromptProvider,
|
|
52
|
+
userSystemPrompt,
|
|
53
|
+
userAppendSystemPrompt,
|
|
54
|
+
tools: tools.map((t) => (t.aliases === undefined ? { ...t } : { ...t, aliases: [...t.aliases] })),
|
|
55
|
+
facts: {
|
|
56
|
+
supervisorEnabled: false,
|
|
57
|
+
teammateEnabled: internals?.explicitAgentName !== undefined && tools.some((t) => t.name === SEND_MESSAGE_TOOL_NAME),
|
|
58
|
+
...featureFlags,
|
|
59
|
+
orchestrationEnabled: featureFlags.orchestrationEnabled && tools.some((t) => t.name === "Workflow"),
|
|
60
|
+
orchestrationDeferred: featureFlags.orchestrationDeferred && tools.some((t) => t.name === "Workflow"),
|
|
61
|
+
promptProfile,
|
|
62
|
+
fableMitigations,
|
|
63
|
+
},
|
|
64
|
+
mcpInstructionsBlock,
|
|
65
|
+
memoryBlock,
|
|
66
|
+
buildEnvBlock: (date) => buildEnvironmentContext({ ...envFacts, date }) || undefined,
|
|
67
|
+
date: envFacts.date,
|
|
68
|
+
...(model.promptGuidance && model.promptGuidance.length > 0 ? { modelGuidance: model.promptGuidance.join("\n\n") } : {}),
|
|
69
|
+
onWarn: (message, phase) => deps.onError?.(new Error(message), { phase, sessionId }),
|
|
70
|
+
...(centerDecls !== undefined ? { centerDeclarations: centerDecls } : {}),
|
|
71
|
+
});
|
|
72
|
+
const assembled = assemblePrompt(buildAssembleInputs(centerAdoption !== undefined ? artifactDeclarations(centerAdoption.artifact) : undefined));
|
|
73
|
+
if (centerAdoption !== undefined && assembled.centerMounted !== true) {
|
|
74
|
+
const ownsWholePrompt = assembled.constitution === "provider-assembled";
|
|
75
|
+
const digest = centerAdoption.artifact.artifactDigest.slice(0, 23);
|
|
76
|
+
if (ownsWholePrompt) {
|
|
77
|
+
const e = new Error(`center prompt artifact ${digest}… cannot mount: this PromptProvider owns the whole prompt (assembled-identity pass-through) — upgrade the provider to stableBlocks/stableSystem or remove RunnerDeps.promptSource for this deployment`);
|
|
78
|
+
e.code = "prompt.center_unmountable";
|
|
79
|
+
throw e;
|
|
80
|
+
}
|
|
81
|
+
deps.onError?.(new Error(centerAdoptionFresh
|
|
82
|
+
? `prompt-constitution: center prompt artifact ${digest}… contributed NO section to this prompt — every section it declares collides with a PromptProvider stableBlocks declaration of the same id, and the deployment-local declaration wins. This session runs on the bundled prompt and is deliberately NOT pinned to the artifact (a pin claiming content the model never received would be durable and wrong). Rename the colliding section ids on either side to adopt it; the per-section collisions are reported individually on this channel.`
|
|
83
|
+
: `prompt-constitution: this session is pinned to center prompt artifact ${digest}…, but under the CURRENT PromptProvider every section that artifact declares collides with a stableBlocks declaration of the same id, so none of them compiled into this prompt. The session keeps its pin and continues on the bundled prompt — its epoch's declaredSections record what actually compiled. Rename the colliding section ids on either side to restore the artifact's content.`), { phase: "prompt-constitution", sessionId });
|
|
84
|
+
if (centerAdoptionFresh)
|
|
85
|
+
centerAdoption = undefined;
|
|
86
|
+
}
|
|
87
|
+
let systemPrompt = assembled.systemPrompt;
|
|
88
|
+
if (!systemPrompt.includes(reminderMarkDeclaration(reminderMark))) {
|
|
89
|
+
deps.onError?.(new Error("reminder-mark declaration missing from the assembled system prompt: this run's PromptProvider owns the prompt and did not render the mark declaration, so engine <system-reminder> tags carry a mark the model is never told about (the impersonation defense is inactive for this deployment). Render `reminderMarkDeclaration(ctx.reminderMark)` (exported; the value rides StablePromptContext.reminderMark) in the provider, or accept the disclosure."), { phase: "config", sessionId });
|
|
90
|
+
}
|
|
91
|
+
const renderWithDate = assembled.renderWithDate
|
|
92
|
+
? (date) => {
|
|
93
|
+
systemPrompt = assembled.renderWithDate(date);
|
|
94
|
+
return systemPrompt;
|
|
95
|
+
}
|
|
96
|
+
: undefined;
|
|
97
|
+
const promptConstitution = assembled.constitution;
|
|
98
|
+
const promptBlocks = assembled.legacyBlocks;
|
|
99
|
+
const collisionAudit = auditToolCollisions(tools);
|
|
100
|
+
for (const y of collisionAudit.yields) {
|
|
101
|
+
onceLedger.onError(new Error(`tool mount: caller tool "${y.name}" shadows another tool with the same canonical name (deliberate last-write-wins yield — the later mount serves)`), { phase: "config", sessionId });
|
|
102
|
+
}
|
|
103
|
+
for (const c of collisionAudit.aliasCollisions) {
|
|
104
|
+
onceLedger.onError(new Error(`tool mount: alias "${c.alias}" is claimed by both "${c.owners[0]}" and "${c.owners[1]}" (design/141 warn face — name resolution serves the later mount)`), { phase: "config", sessionId });
|
|
105
|
+
}
|
|
106
|
+
const saltedHash = (text) => createHash("sha256").update(PROMPT_HASH_SALT).update(text).digest("hex").slice(0, 12);
|
|
107
|
+
const promptManifest = {
|
|
108
|
+
constitution: promptConstitution,
|
|
109
|
+
blocks: promptBlocks.map((b) => ({ id: b.id, chars: b.text.length, hash: saltedHash(b.text) })),
|
|
110
|
+
...(assembled.sections
|
|
111
|
+
? { sections: assembled.sections.map((s) => ({ id: s.id, slot: s.slot, carrier: s.carrier, cadence: s.cadence, cacheClass: s.cacheClass, chars: s.text.length, hash: saltedHash(s.text), ...(s.declaredContentHash !== undefined ? { contentHash: s.declaredContentHash } : {}) })) }
|
|
112
|
+
: {}),
|
|
113
|
+
tools: projectToolManifest(tools, (t) => protocolOf(t.name)?.id ?? "caller"),
|
|
114
|
+
};
|
|
115
|
+
const epochDeclaredSections = (assembled.sections ?? [])
|
|
116
|
+
.filter((s) => s.origin === "provider")
|
|
117
|
+
.map((s) => ({ id: s.id, slot: s.slot, chars: s.text.length, ...(s.declaredContentHash !== undefined ? { contentHash: s.declaredContentHash } : {}) }));
|
|
118
|
+
let epochArtifactDigestForSnapshot = "";
|
|
119
|
+
{
|
|
120
|
+
const pinned = await session.getPromptEpoch();
|
|
121
|
+
const resolved = resolveEpochAgainstBundled(pinned, SEMA_DEFAULT_PACK, epochDeclaredSections);
|
|
122
|
+
epochArtifactDigestForSnapshot = resolved.descriptor.artifactDigest;
|
|
123
|
+
if (resolved.migrated) {
|
|
124
|
+
const priorConversation = pinned === undefined ? hasConversationContent(await session.getBranch()) : true;
|
|
125
|
+
const activatedBy = pinned === undefined && !priorConversation ? "session_start" : "legacy_migration";
|
|
126
|
+
await session.appendPromptEpoch({
|
|
127
|
+
...resolved.descriptor,
|
|
128
|
+
activatedBy,
|
|
129
|
+
...(centerAdoption !== undefined
|
|
130
|
+
? {
|
|
131
|
+
centerArtifactDigest: centerAdoption.artifact.artifactDigest,
|
|
132
|
+
...(centerAdoption.sourceRevision !== undefined ? { sourceRevision: centerAdoption.sourceRevision } : {}),
|
|
133
|
+
}
|
|
134
|
+
: {}),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
systemPromptSeat: {
|
|
140
|
+
get current() {
|
|
141
|
+
return systemPrompt;
|
|
142
|
+
},
|
|
143
|
+
set current(v) {
|
|
144
|
+
systemPrompt = v;
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
renderWithDate,
|
|
148
|
+
systemBlocks: assembled.systemBlocks,
|
|
149
|
+
promptManifest,
|
|
150
|
+
epochDeclaredSections,
|
|
151
|
+
epochArtifactDigestForSnapshot,
|
|
152
|
+
buildAssembleInputs,
|
|
153
|
+
centerAdoptionRef: {
|
|
154
|
+
get current() {
|
|
155
|
+
return centerAdoption;
|
|
156
|
+
},
|
|
157
|
+
set current(v) {
|
|
158
|
+
centerAdoption = v;
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -27,27 +27,8 @@ import type { LockedPreflight } from "../locked-config.js";
|
|
|
27
27
|
import type { MaterializedMcp } from "../mcp.js";
|
|
28
28
|
import type { ResolvedRole } from "../roles.js";
|
|
29
29
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
30
|
-
import type { PrepareResume, RunInternals, ToolFaceSnapshot } from "./contracts.js";
|
|
30
|
+
import type { PrepareResume, PromptFeatureFlags, RunInternals, ToolFaceSnapshot } from "./contracts.js";
|
|
31
31
|
import { type GitStatusLaneRef } from "./git-status-frame.js";
|
|
32
|
-
/** The runtime feature flags the stable prompt's harness-context block gates its sections on
|
|
33
|
-
* (design/64 §6.3: claim only what the task has). Spread into the assembly's StablePromptContext
|
|
34
|
-
* by the driver, which re-derives the two orchestration flags against the post-exclusion roster. */
|
|
35
|
-
export interface PromptFeatureFlags {
|
|
36
|
-
policyEnabled: boolean;
|
|
37
|
-
hooksEnabled: boolean;
|
|
38
|
-
isolationEnabled: boolean;
|
|
39
|
-
reminderMark: string;
|
|
40
|
-
readFaceOpen: boolean;
|
|
41
|
-
orchestrationEnabled: boolean;
|
|
42
|
-
orchestrationDeferred: boolean;
|
|
43
|
-
promptProfile: "simple" | "classic";
|
|
44
|
-
fableMitigations: boolean;
|
|
45
|
-
goalEnabled: boolean;
|
|
46
|
-
awarenessEnabled: boolean;
|
|
47
|
-
worktreeIsolated: boolean;
|
|
48
|
-
withinTaskCompactionEnabled: boolean;
|
|
49
|
-
isSubagent: boolean;
|
|
50
|
-
}
|
|
51
32
|
export interface PreparePromptInputsInput {
|
|
52
33
|
/** borrowed-readonly — the REBOUND spec (`spec′`). Read: `promptProvider`, `hooks` (flag), `systemPrompt`
|
|
53
34
|
* / `appendSystemPrompt` (the user prompt sources), `clientContext` (zone, email), `envFacts` (the
|
|
@@ -75,9 +75,9 @@ export interface PrepareProtocolToolsResult {
|
|
|
75
75
|
rebuildHarnessToolsRef: {
|
|
76
76
|
current?: () => Promise<void>;
|
|
77
77
|
};
|
|
78
|
-
/** borrowed-mutable — the content-origin re-classification seat. Writer: the
|
|
79
|
-
* (installs the re-runnable pass ONCE
|
|
80
|
-
* the rebuild closures before a swapped-in tool becomes callable. */
|
|
78
|
+
/** borrowed-mutable — the content-origin re-classification seat. Writer: the memory-engine-session phase
|
|
79
|
+
* (installs the re-runnable pass ONCE when it arms — a mounted engine-memory session or an upstream recorder
|
|
80
|
+
* channel; undefined otherwise). Read by the rebuild closures before a swapped-in tool becomes callable. */
|
|
81
81
|
contentOriginWrapRef: {
|
|
82
82
|
current?: () => void;
|
|
83
83
|
};
|
|
@@ -19,7 +19,6 @@ export async function prepareProtocolTools(input) {
|
|
|
19
19
|
const callerNames = new Set((spec.tools ?? []).flatMap((t) => [t.name, ...(t.aliases ?? [])]));
|
|
20
20
|
const clash = mcp.tools.find((t) => [t.name, ...(t.aliases ?? [])].some((name) => callerNames.has(name)));
|
|
21
21
|
if (clash) {
|
|
22
|
-
await mcp.dispose();
|
|
23
22
|
const e = new Error(`Tool name "${clash.name}" is reserved by an injected MCP tool — a caller tool of the same name would silently shadow it.`);
|
|
24
23
|
e.code = "config.reserved_tool_name";
|
|
25
24
|
throw e;
|
|
@@ -156,8 +155,6 @@ export async function prepareProtocolTools(input) {
|
|
|
156
155
|
const callerNames = new Set((spec.tools ?? []).flatMap((t) => [t.name, ...(t.aliases ?? [])]));
|
|
157
156
|
const clash = a2a.tools.find((t) => callerNames.has(t.name));
|
|
158
157
|
if (clash) {
|
|
159
|
-
await a2a.dispose();
|
|
160
|
-
await mcp.dispose();
|
|
161
158
|
const e = new Error(`Tool name "${clash.name}" is reserved by an injected A2A tool — a caller tool of the same name would silently shadow it.`);
|
|
162
159
|
e.code = "config.reserved_tool_name";
|
|
163
160
|
throw e;
|
|
@@ -17,30 +17,12 @@
|
|
|
17
17
|
* live read owes.
|
|
18
18
|
*/
|
|
19
19
|
import type { AgentTool } from "../../internal/harness.js";
|
|
20
|
-
import { type OnQuestion
|
|
20
|
+
import { type OnQuestion } from "../ask-question.js";
|
|
21
21
|
import { type CheckpointStore } from "../checkpoint-store.js";
|
|
22
22
|
import type { RunnerDeps, RuntimeCaps, TaskSpec } from "../types.js";
|
|
23
23
|
import type { PrepareResume } from "./contracts.js";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type ContentAskBinding = ({
|
|
27
|
-
kind: "answered";
|
|
28
|
-
answer: QuestionAnswer;
|
|
29
|
-
} | {
|
|
30
|
-
kind: "failed";
|
|
31
|
-
error: unknown;
|
|
32
|
-
}) & {
|
|
33
|
-
/** Digest of the exact question batch this outcome belongs to. The call id alone is not enough
|
|
34
|
-
* to redeem a binding: it comes from the model/provider and can repeat, so an entry that
|
|
35
|
-
* outlived its call (its call was allowed but never executed) could otherwise be handed to a
|
|
36
|
-
* LATER call that happens to reuse the id. Matching on the batch as well means an outcome can
|
|
37
|
-
* only ever be delivered for the question it was produced for. */
|
|
38
|
-
questionsHash: string;
|
|
39
|
-
/** The engine-minted per-delivery identity (see AskQuestionRequest.deliveryId) — carried so a
|
|
40
|
-
* stranded-answer disclosure names DELIVERIES, not call ids: call ids can repeat, and a
|
|
41
|
-
* disclosure keyed on them would collapse two lost answers into one. */
|
|
42
|
-
deliveryId: string;
|
|
43
|
-
};
|
|
24
|
+
import { type ContentAskBinding } from "./content-ask-bindings.js";
|
|
25
|
+
export { CONTENT_ASK_BINDING_CAP, type ContentAskBinding } from "./content-ask-bindings.js";
|
|
44
26
|
export interface PrepareQuestionFaceInput {
|
|
45
27
|
/** borrowed-readonly — the run's frozen question seat (spec > deps), resolved once at the top of prepare;
|
|
46
28
|
* the mount predicate and the live-face derivation both read this one value. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createAskUserQuestionTool, isLiveQuestionFace } from "../ask-question.js";
|
|
2
2
|
import { boundInputHashOf } from "../canonical-json.js";
|
|
3
3
|
import { resolveCheckpointStore } from "../checkpoint-store.js";
|
|
4
|
-
|
|
4
|
+
import { CONTENT_ASK_BINDING_CAP } from "./content-ask-bindings.js";
|
|
5
|
+
export { CONTENT_ASK_BINDING_CAP } from "./content-ask-bindings.js";
|
|
5
6
|
export function prepareQuestionFace(input) {
|
|
6
7
|
const { frozenOnQuestion, spec, deps, runtimeCaps, resolvedInteractionPosture, resume, sessionId, tools, inheritedUnavailableAsks } = input;
|
|
7
8
|
const onQuestion = frozenOnQuestion;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { RunnerDeps, TaskSpec, ToolEffect } from "../types.js";
|
|
2
2
|
import type { IrreversibilityTier, ReversibilityProbes } from "./contracts.js";
|
|
3
|
-
/** The namespaced-name shapes the protocol table currently owns, rendered for the two messages that have
|
|
4
|
-
* to name them (the caller-name reservation and the policy audit's unprefixed-name arm). Read from the
|
|
5
|
-
* table rather than written out: a message that hard-codes ONE protocol becomes wrong — while staying
|
|
6
|
-
* green — the moment a second one is appended, and both messages tell a deployment what to write. */
|
|
7
|
-
export declare const NAMESPACED_NAME_SHAPES: string;
|
|
8
3
|
export interface PrepareSafetyScanInput {
|
|
9
4
|
/** borrowed-readonly — the REBOUND spec (`spec′`, the config-doors result). The scan reads
|
|
10
5
|
* `tools`, `handsReadOnly` and `enablePlanMode`; it never mutates. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NAMESPACED_NAME_SHAPES } from "../protocol-table.js";
|
|
2
2
|
import { HAND_TOOL_EFFECTS } from "../../tools/fs/index.js";
|
|
3
3
|
import { OFFLOAD_TOOL_NAME } from "../tool-result-store.js";
|
|
4
4
|
import { PRESENT_PLAN_TOOL_NAME, ENTER_PLAN_MODE_TOOL_NAME } from "../present-plan-tool.js";
|
|
5
|
-
export const NAMESPACED_NAME_SHAPES = PROTOCOL_TABLE.map((ns) => `${ns.prefix}<peer>__<tool>`).join(", ");
|
|
6
5
|
export function prepareSafetyScan(input) {
|
|
7
6
|
const { spec, deps } = input;
|
|
8
7
|
const toolEffects = new Map();
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* design/390 §1.2 M19 (suspend saga) — prepareTask's DURABLE SETTLEMENT machinery, verbatim from the driver's
|
|
3
|
+
* gate-machinery block: the in-flight spend and repair-bundle folds, the §4.bis correctness-state serializer, the shared
|
|
4
|
+
* paused-VM compensation bound to this task's failure ledger, the put-commit + put-failure saga (the pre-put cut
|
|
5
|
+
* checkpoint, the screening-park disclosure, the rejection read-back with its three answers), the suspend-loop cap, the
|
|
6
|
+
* env capability split (suspendable / park-only / neither) and the park-only handle. The module-scope helpers only this
|
|
7
|
+
* segment called moved with it (the compensation's bound and body, the auto-mode latch reading, the placement stamp).
|
|
8
|
+
* The interface is the dependency list the segment had implicitly (design/238 R-1) — every seat below used to be
|
|
9
|
+
* captured off the driver's scope.
|
|
10
|
+
*
|
|
11
|
+
* SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await of its own (every await lives inside the closures it
|
|
12
|
+
* builds, which run at park time), so the phase adds no yield between the ask lane before it and the boundary parks
|
|
13
|
+
* after it (design/390 §1.5). Read-stability of the host handles for the call: {@link RunInternals}
|
|
14
|
+
* (`@contract prepare.deps-read-stable`).
|
|
15
|
+
*
|
|
16
|
+
* The saga exists exactly when the wiring-manifest phase's `gateMachineryActive` holds (the ask lane's presence law) —
|
|
17
|
+
* the boundary parks and the park closure key off `saga`'s presence, so the orchestrator grows no branch.
|
|
18
|
+
*/
|
|
19
|
+
import type { AgentHarness, ExecutionEnv } from "../../internal/harness.js";
|
|
20
|
+
import type { AutoModeDecider } from "../auto-mode.js";
|
|
21
|
+
import type { OwnOrgAdmissionVerdict } from "../memory-admission.js";
|
|
22
|
+
import type { RemoteExecutionEnv, SnapshotId } from "../remote-env.js";
|
|
23
|
+
import type { CheckpointStore, SerializedCheckpointState } from "../checkpoint-store.js";
|
|
24
|
+
import type { RemoteEnvFailureNote, RunnerDeps } from "../types.js";
|
|
25
|
+
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
26
|
+
import type { ReadFileState } from "../../tools/fs/safety.js";
|
|
27
|
+
import type { OutputRef } from "./synthetic-tools.js";
|
|
28
|
+
import type { HookInvocationIdentity } from "../hooks.js";
|
|
29
|
+
import type { InheritedGate, Prepared, PrepareResume, RunInternals, SuspendSaga } from "./contracts.js";
|
|
30
|
+
/**
|
|
31
|
+
* design/384 slice 2 — the ONE compensation for a paused-but-unparked VM, shared by the fence's
|
|
32
|
+
* post-pause checkpoints (③ in the park closure, ④ in the saga) and the saga's put-failure absent
|
|
33
|
+
* arm (previously inline there: same two hops, one implementation now, so the three sites cannot
|
|
34
|
+
* drift). Restores the workspace (bounded transient retry) then re-establishes consistency
|
|
35
|
+
* (`postResumeInit`), both hops under one INDEPENDENT `AbortSignal.timeout(io.boundMs)` —
|
|
36
|
+
* deliberately NOT the run/cut signal: the remote contract answers an already-aborted signal
|
|
37
|
+
* `{ok:false,"aborted"}`, so gating the restore on the very signal whose firing caused the
|
|
38
|
+
* compensation made it die instantly and strand the paused VM on exactly the run-abort arm that
|
|
39
|
+
* needs it most. The adapter signal is best-effort (a deaf adapter ignores it), so the caller's
|
|
40
|
+
* await is ALSO raced against the same bound — bounded decision, three outcomes:
|
|
41
|
+
* · settled ok ⇒ the VM is running again ({ok:true});
|
|
42
|
+
* · settled not-ok / threw ⇒ recorded + disclosed, {ok:false} — the caller takes its fatal
|
|
43
|
+
* fail-closed arm (abort the run; never continue on a paused VM);
|
|
44
|
+
* · bound fires with the adapter still in flight ⇒ {ok:false} NOW, and the in-flight call
|
|
45
|
+
* continues DETACHED + swallow-guarded with the late-settlement split:
|
|
46
|
+
* – late SUCCESS: a running VM now exists with no run and no committed row to own it — the
|
|
47
|
+
* detached continuation compensates the compensation with `destroy()` (the adapter's own
|
|
48
|
+
* best-effort contract, swallow-guarded, disclosed);
|
|
49
|
+
* – late FAILURE: disclosed; the VM is most likely still paused — provider-side TTL/GC
|
|
50
|
+
* territory, and the disclosure is the end of this engine's obligation (a deaf adapter's
|
|
51
|
+
* stranded VM is that adapter's own defect surface).
|
|
52
|
+
* Decide-then-disclose throughout: `io.disclose`/`io.noteFailure` must be swallow-guarded by the
|
|
53
|
+
* caller's binding, and nothing they do can change the returned verdict. Never throws. Exported for
|
|
54
|
+
* direct unit pinning (the bounded/deaf/late arms need a small bound; production binds the
|
|
55
|
+
* `PARK_COMPENSATION_TIMEOUT_MS` constant at the one call-site closure).
|
|
56
|
+
*/
|
|
57
|
+
export declare function compensateUnparkedPause(remoteEnv: RemoteExecutionEnv, snapshotId: SnapshotId, io: {
|
|
58
|
+
boundMs: number;
|
|
59
|
+
noteFailure: (note: RemoteEnvFailureNote) => void;
|
|
60
|
+
disclose: (err: unknown) => void;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
ok: true;
|
|
63
|
+
} | {
|
|
64
|
+
ok: false;
|
|
65
|
+
reason: string;
|
|
66
|
+
}>;
|
|
67
|
+
export interface PrepareSuspendSagaInput {
|
|
68
|
+
/** borrowed-readonly — the wiring-manifest phase's ONE activation predicate; false ⇒ this phase builds nothing and
|
|
69
|
+
* returns an absent saga. */
|
|
70
|
+
gateMachineryActive: boolean;
|
|
71
|
+
/** borrowed-mutable — prepare's abort seat. Writer here: the fail-closed arms (`abort()` when a paused VM cannot be
|
|
72
|
+
* restored, when the put outcome is unknowable, when the loop cap trips); `.signal` is read by the mint sites. */
|
|
73
|
+
abortController: {
|
|
74
|
+
readonly signal: AbortSignal;
|
|
75
|
+
abort(): void;
|
|
76
|
+
};
|
|
77
|
+
/** borrowed-mutable — the built harness. Writer here: `abort()` on the same fail-closed arms (release the gate,
|
|
78
|
+
* then stop the loop — the two-step every stop in this file takes). */
|
|
79
|
+
harness: Pick<AgentHarness, "abort">;
|
|
80
|
+
/** borrowed-readonly — the leg's checkpoint store, or undefined (then the saga answers `absent` and no park commits). */
|
|
81
|
+
checkpointStore: CheckpointStore | undefined;
|
|
82
|
+
/** borrowed-readonly — the deployment's error face, as a Pick over the SAME `deps` object (receiver preserved for
|
|
83
|
+
* `deps.onError?.()`): the put-failure disclosures, the compensation's disclose binding, the cap line. */
|
|
84
|
+
deps: Pick<RunnerDeps, "onError">;
|
|
85
|
+
/** borrowed-readonly — the acquired session id (every disclosure's tag, the running-tasks owner triple, the row's
|
|
86
|
+
* session). */
|
|
87
|
+
sessionId: string;
|
|
88
|
+
/** borrowed-readonly — the per-task identity (the running-tasks owner triple). */
|
|
89
|
+
hostTaskId: string;
|
|
90
|
+
/** borrowed-readonly — the registry scope (the running-tasks owner triple). */
|
|
91
|
+
taskScope: string;
|
|
92
|
+
/** borrowed-readonly — the loop's live spend seat (`Prepared.liveSpendRef`); `.get` is read at mint time. Not written
|
|
93
|
+
* here (runtask sets `.get`). */
|
|
94
|
+
liveSpendRef: Prepared["liveSpendRef"];
|
|
95
|
+
/** borrowed-readonly — the resume leg, or undefined: `seed.nestedStats` (the spend delta's base), `seed.repairBundle`
|
|
96
|
+
* (the pass-through bundle). */
|
|
97
|
+
resume: Pick<PrepareResume, "seed"> | undefined;
|
|
98
|
+
/** borrowed-readonly — the cumulative nested-usage accumulator (`Prepared.nestedStats`); read at mint time, copied
|
|
99
|
+
* onto the row. */
|
|
100
|
+
nestedStats: Prepared["nestedStats"];
|
|
101
|
+
/** borrowed-readonly — the trusted spawn-side channel: `repairBundle` (the live bundle) and `delegationProvenance`
|
|
102
|
+
* (the aggregate copied onto the row). */
|
|
103
|
+
internals: Pick<RunInternals, "repairBundle" | "delegationProvenance"> | undefined;
|
|
104
|
+
/** borrowed-readonly — the ToolSearch activation set (`Prepared.activeTools`); copied onto the row at mint time. */
|
|
105
|
+
activeTools: Prepared["activeTools"];
|
|
106
|
+
/** borrowed-readonly — the structured-output seat; `value`/`set` are copied onto the row at mint time. */
|
|
107
|
+
outputRef: OutputRef;
|
|
108
|
+
/** borrowed-readonly — the hand's read-file state for the checkpoint, or undefined (hands-less); its entries are
|
|
109
|
+
* copied onto the row at mint time. */
|
|
110
|
+
readFileStateForCheckpoint: ReadFileState | undefined;
|
|
111
|
+
/** borrowed-readonly — the inherited-gate phase's read-face section builder (the row's `readFace`). */
|
|
112
|
+
faceCheckpointSection: () => SerializedCheckpointState["readFace"];
|
|
113
|
+
/** borrowed-readonly — the leg's reminder provenance mark (travels with the row). */
|
|
114
|
+
reminderMark: string;
|
|
115
|
+
/** borrowed-readonly — the hand's live tracked cwd, or undefined; `current` is read at mint time. Not written here. */
|
|
116
|
+
handsCwdRef: CwdRef | undefined;
|
|
117
|
+
/** borrowed-readonly — the active EnterWorktree session seat, or undefined; `current` is read at mint time. */
|
|
118
|
+
worktreeSessionRef: Prepared["worktreeSessionRef"];
|
|
119
|
+
/** borrowed-readonly — the LIVE inherited parent constraints, or undefined (the row's `requiresParentConstraint`,
|
|
120
|
+
* count, frozen chain and the screening-park disclosure's predicate). */
|
|
121
|
+
inheritedParentConstraints: NonNullable<InheritedGate["parentConstraints"]>[number][] | undefined;
|
|
122
|
+
/** borrowed-readonly — the resume seed's inherited gate, or undefined (the carried-forward half of the same fields). */
|
|
123
|
+
seedInheritedGate: PrepareResume["seed"]["inheritedGate"];
|
|
124
|
+
/** borrowed-readonly — the inherited ancestor rules (data half), cloned onto the row. */
|
|
125
|
+
inheritedAncestorRules: InheritedGate["ancestorRules"];
|
|
126
|
+
/** borrowed-readonly — the inherited shell-gate doctrine, persisted verbatim. */
|
|
127
|
+
inheritedShellGate: InheritedGate["shellGate"];
|
|
128
|
+
/** borrowed-readonly — the auto-mode intent (seat ∨ live ∨ seed), carried while the latch is healthy. */
|
|
129
|
+
autoModeIntent: boolean;
|
|
130
|
+
/** borrowed-readonly — the auto-mode decider, or undefined (the latch-health reading only). */
|
|
131
|
+
autoModeDecider: AutoModeDecider | undefined;
|
|
132
|
+
/** borrowed-readonly — the inherited admitted org scopes, or undefined (copied onto the row). */
|
|
133
|
+
inheritedAdmittedOrgScopes: readonly string[] | undefined;
|
|
134
|
+
/** borrowed-readonly — this leg's OWN org verdict seat; `current` is read at mint time. Not written here. */
|
|
135
|
+
ownOrgVerdictRef: {
|
|
136
|
+
current: OwnOrgAdmissionVerdict | undefined;
|
|
137
|
+
};
|
|
138
|
+
/** borrowed-readonly — the monotonic org-governed provenance bit. */
|
|
139
|
+
orgGovernedProvenance: boolean;
|
|
140
|
+
/** borrowed-readonly — the listing frames' announced name-sets mirror (`Prepared.announcedListingsRef`); serialized
|
|
141
|
+
* onto the row at mint time. */
|
|
142
|
+
announcedListingsRef: Prepared["announcedListingsRef"];
|
|
143
|
+
/** borrowed-readonly — the git frame's lane ref (`Prepared.gitStatusRef`); `announced` is copied at mint time. */
|
|
144
|
+
gitStatusRef: Prepared["gitStatusRef"];
|
|
145
|
+
/** borrowed-readonly — the leg's identity envelope; only `isDelegatedChild` is read (the row's presence-coded bit). */
|
|
146
|
+
hookIdentity: Pick<HookInvocationIdentity, "isDelegatedChild">;
|
|
147
|
+
/** borrowed-readonly — the frozen prepare-time placement resolution (the row's placement stamp). */
|
|
148
|
+
placementRootResolved: string;
|
|
149
|
+
/** borrowed-readonly — the external-content-target fold (the row's monotonic bit). */
|
|
150
|
+
externalContentTargetActive: boolean;
|
|
151
|
+
/** borrowed-mutable — the run-scoped remote-lifecycle failure log (`Prepared.remoteEnvFailures`). Writer here: the
|
|
152
|
+
* compensation's note binding (`push`). */
|
|
153
|
+
remoteEnvFailures: Prepared["remoteEnvFailures"];
|
|
154
|
+
/** borrowed-readonly — the memory-engine session, or undefined; `harvest("checkpoint")` is called at the commit door. */
|
|
155
|
+
memoryEngineSession: Prepared["memoryEngineSession"];
|
|
156
|
+
/** borrowed-mutable — the loop-cap latch (`Prepared.suspendLoopRef`). Writer here: `hit = true` when the cap trips. */
|
|
157
|
+
suspendLoopRef: Prepared["suspendLoopRef"];
|
|
158
|
+
/** borrowed-readonly — the per-task owned env when a factory minted one, or undefined (the capability split). Never
|
|
159
|
+
* destroyed here. */
|
|
160
|
+
ownedEnv: ExecutionEnv | undefined;
|
|
161
|
+
/** borrowed-readonly — the restore-incomplete adapter's missing members, or undefined (excluded from both targets). */
|
|
162
|
+
incompleteSuspendAdapter: readonly ("resumeVM" | "postResumeInit")[] | undefined;
|
|
163
|
+
}
|
|
164
|
+
export interface PrepareSuspendSagaResult {
|
|
165
|
+
/** owned — the saga, or undefined exactly when `gateMachineryActive` is false (the boundary parks and the park closure
|
|
166
|
+
* key off this seat). */
|
|
167
|
+
saga: SuspendSaga | undefined;
|
|
168
|
+
}
|
|
169
|
+
/** The M19 suspend-saga phase body — prepareTask's durable settlement stretch, verbatim (see the module header). */
|
|
170
|
+
export declare function prepareSuspendSaga(input: PrepareSuspendSagaInput): PrepareSuspendSagaResult;
|