@sema-agent/core
Version:
Stateless, task-oriented AI agent core
1,211 lines • 96 kB
TypeScript
/**
* design/173 — the wiring manifest: a machine-readable disclosure of HOW this deployment/run is
* assembled around the optional human-interaction seams (ask / question / elicit / park lane /
* durability / fleet observability / governance surfaces).
*
* GUARANTEE BOUNDARY (design/173 §0): this is STATIC ASSEMBLY SELF-DISCLOSURE — seam presence and
* shape, as facts. It does NOT prove liveness (a callback bound to the wrong run, a dead queue, an
* adapter's internal failure, an answer routed to the wrong instance). Liveness belongs to
* round-trip probes, which are a separate obligation. Nothing here may claim "the wiring was
* verified" — only "the wiring was disclosed". This module provides no liveness API, deliberately;
* consumers (e.g. a park-wiring startup self-check) must quote this boundary rather than promise
* more than the manifest can know.
*
* TWO HALVES, ONE SCHEMA (design/173 §2.1): the STATIC half ({@link describeStaticWiring}) is a pure
* synchronous function over `(deps, spec)` — a server startup self-check. Facts it cannot compute
* (per-principal runtime caps, the prepare-time safety-tool vocabulary) are reported `"unresolved"`,
* never guessed, and `ask.effective` is OMITTED entirely (reporting "would park" as "auto-deny"
* would be a false fact, worse than silence). The EFFECTIVE half is built once per prepared leg by
* `prepareTask` from RESOLVED facts, through the SAME {@link deriveWiringManifest} derivation — two
* copies of the derivation would drift, so there is exactly one. A startup snapshot and a leg's
* effective snapshot are two DIFFERENT facts; neither may impersonate the other.
*/
import { type PermissionMode } from "./ask-origin.js";
import type { McpServerSpec } from "./mcp-server-spec.js";
import type { McpServerStatus } from "./mcp.js";
import type { RunnerDeps, TaskSpec } from "./types.js";
import { type StoreDurability } from "./checkpoint-store.js";
import { isEngineQuestionFace } from "./ask-question.js";
import type { ModAdmissionRecord } from "./mods/kernel/index.js";
import type { McpAuthorization, McpDelivered, McpFailureKind, McpServerLiveness } from "./mcp-failure.js";
import type { A2aRevocationStopCode } from "./protocol-revocation.js";
import type { WriteProtectionTargetView } from "./write-protect.js";
import type { DeclaredPlaceSource } from "./runner/leg-caller-places.js";
import { type OnAsk } from "./tool-policy.js";
import type { ApprovalRoute } from "./approval-route.js";
import { type RunOrigin } from "./run-origin.js";
import { engineLaneLegOf } from "./park-resumability.js";
import { type StaticToolPlanDeps, type StaticToolPlanSpec, type StaticWiringStatement } from "./tool-mount-static.js";
import { type ToolMountPlan } from "./tool-mount-plan.js";
import type { WorkspaceSnapshot } from "./workspace-snapshot.js";
import { type ProjectMarkerUnreadableReason } from "./memory-engine/scope-contract.js";
import { type HostInstanceDeclaration, type WiringLegInstance } from "./host-instance.js";
import type { WiringInstructions } from "./instruction-preview.js";
export type { HostInstanceDeclaration, WiringLegInstance };
export type { StoreDurability };
/** The manifest-face projection of {@link StoreDurability}: `"declared_durable"` (the name says it —
* a DECLARATION relayed, not a verification) vs `"process_local"` (declared so, or fail-closed
* absent). */
export type ManifestDurability = "declared_durable" | "process_local";
/** Which prepare leg an EFFECTIVE manifest describes (`leg` is absent on the static half — a
* startup self-check has no leg). taskId/parentTaskId ride the event's `TaskEventIdentity`, not
* this object (design/173 §8.4). "Every leg self-evidences" means ON ITS OWN STREAM: a delegated
* child's manifest rides the CHILD's event stream and is deliberately not in the parent-forwarding
* whitelist — a host that wants a child's assembly evidence subscribes to the child. */
export type WiringLegKind = "root" | "child" | "resume";
/** Which leg this is, the one reading: a leg a checkpoint row resumed, else a leg an engine lane of this run started (a delegated child
* or an observer sidecar's leg — {@link engineLaneLegOf}), else a root. The manifest's `leg` and the hooks' `legKind` report it, and
* only a `root` takes the deployment's start word (`RunnerDeps.permissionModeWhenUnset`). */
export declare function wiringLegKindOf(resumed: boolean, internals: Parameters<typeof engineLaneLegOf>[0]): WiringLegKind;
/** The shape of the resolved permission-ask seat ({@link resolveAskSeat}): an approver callback (`"callback"` — read as a
* person's channel), an approver callback the deployment declared a POLICY (`"policy_callback"`, `asPolicyApprover` — it
* answers on the deployment's behalf: relays an answer a person gave before, refuses, or answers `"unavailable"` so the ask
* parks), a blanket `"allow"`/`"deny"` policy setting, nothing at all, or `"declared_none"` — the run declared that nobody
* on it can be asked (`TaskSpec.approvalReach: "none"`), so a person's callback beside the declaration is not this run's
* approver. `"deny"` (a deliberate policy) and `"absent"` (no seat supplied a value — a degrade to the headless auto-deny
* default) are DISTINCT on purpose — design/173 — and so are `"absent"` and `"declared_none"`: one says nothing was wired,
* the other that the run said nobody can answer. The type is derived from the frozen list; {@link DEPLOYMENT_ASK_SEAT_FORMS} is
* derived from the same list. */
export declare const ASK_SEAM_FORMS: readonly ["callback", "policy_callback", "allow", "deny", "absent", "declared_none"];
export type AskSeamForm = (typeof ASK_SEAM_FORMS)[number];
/**
* The closed set of a run's approval-reach declaration (`TaskSpec.approvalReach`): `"none"` — nobody on this run can be
* asked to approve. It removes the one seat that could be a person (a `"callback"`; a `"policy_callback"` is not a person
* and stays); it never approves or releases anything.
* There is no positive word: "a person is reachable" is the `interactionPosture: "interactive"` promise, which has its own
* door.
*/
export declare const APPROVAL_REACH: readonly ["none"];
export type ApprovalReach = (typeof APPROVAL_REACH)[number];
/** Membership test for {@link ApprovalReach}. */
export declare function isApprovalReach(v: unknown): v is ApprovalReach;
/**
* The declaration's door: absent passes as absent, a member passes, anything else present is refused loudly
* (`config.approval_reach_invalid`) — a declaration nobody can read must not fold to "a person may be asked" (or to
* "nobody may"). Prepare, the static half and a resume's pre-claim screen call this one function.
*/
export declare function screenApprovalReach(v: unknown): ApprovalReach | undefined;
/** What a policy `ask` actually reaches under this assembly. `"policy_reachable"` = the deployment's approval policy
* answers it (a `"policy_callback"` seat — whose answer cannot be known ahead: a relayed earlier answer, a refusal, or
* `"unavailable"` and a park). `"unresolved"` = not computable from the facts at hand (the static half's park-dependent
* arm). The type is derived from the frozen list. */
export declare const ASK_EFFECTIVE_VALUES: readonly ["human_reachable", "policy_reachable", "auto_allow", "auto_deny", "park_only", "unresolved"];
export type AskEffective = (typeof ASK_EFFECTIVE_VALUES)[number];
/**
* The content-question channel, three-valued (design/173 §8.2 — a derived enum, not a bare
* boolean): `"wired"` (a resolved `onQuestion` face exists), `"absent"` (none), or
* `"stripped_bg_lane"` — the ENGINE deliberately stripped the spawn turn's per-request face from a
* leg that outlives the request: a session-scoped background/retained leg, or an agent the Workflow tool
* spawned (submit-and-return) — correct design, not a configuration lie; the flag is minted
* ONLY by the engine's strip sites, pair-produced with the strip itself — never inferred from spec
* shape).
*/
export type QuestionChannelState = "wired" | "absent" | "stripped_bg_lane";
/** Which seat supplied a resolved seam value (`spec` wins over `deps` everywhere). Tree-internal
* child legs read `"spec"` for inherited faces by construction — the delegation lane copies the
* parent's effective face onto the child SPEC seat (design/173 opus F7). */
export type SeamProvenance = "spec" | "deps";
/** Machine-readable reason codes for a park lane that is not (or not provably) effective. `leg_not_resumable`: a store, but nobody
* resumes this leg's decision parks (`approvalParkNotResumableOf`: a lane that holds no park of it, or the host's
* `durableApproval: false`) — the same word the `config.durable_gate_unavailable` notice's `cause` says. The type is derived from
* the frozen list. Its first two words are {@link SUSPEND_LANE_REASONS}' first two, in the same sense; the lists stay two, one per
* lane, since each field may hold only its own lane's words. */
export declare const PARK_LANE_REASONS: readonly ["no_checkpoint_store", "leg_not_resumable", "no_durable_approval_opt_in", "no_force_durable_gate", "no_armed_safety_vocabulary", "await_runtime_caps", "await_tool_vocabulary"];
export type ParkLaneReason = (typeof PARK_LANE_REASONS)[number];
/** Why a leg cannot suspend durably ({@link WiringManifest.suspendLane}) — declared in the leaf `suspend-lane-reasons.ts` (#5244: the
* notice's mint reads it without this module's graph), re-exported here as before. */
import type { SuspendLaneReason } from "./suspend-lane-reasons.js";
export { SUSPEND_LANE_REASONS, type SuspendLaneReason } from "./suspend-lane-reasons.js";
/**
* The closed set of auto-mode ARMING outcomes a leg's manifest reports
* ({@link WiringManifest.autoMode}). Minted from the arming predicate's own three-arm read, as the
* FIRST failing arm in predicate order:
* - `no_intent` — the declared permission mode is not `auto` (no `permissionMode: "auto"` seat, none
* inherited on the chain / recorded on the resumed checkpoint; a non-auto run).
* - `no_face` — intent, but no `RunnerDeps.autoMode` deployment face (the trust gate).
* - `denied` — intent + face, but the organization's deny bit (`RuntimeCaps.autoMode:false`)
* as the resolver STATED it.
* - `resolver_fault` — intent + face, and the deny bit was COINED by a resolver fault (a throw, or a
* marshalled/non-record result the value screen refused) — an outage, not a
* verdict; the same fail-closed outcome as `denied`, named apart so a consumer
* can tell "policy said no" from "the entitlement source was unreachable".
* - `armed` — all three arms held; the classifier decider was minted for this leg.
*/
export declare const AUTO_MODE_ARM_REASONS: readonly ["armed", "no_intent", "no_face", "denied", "resolver_fault"];
export type AutoModeArmReason = (typeof AUTO_MODE_ARM_REASONS)[number];
/**
* The leg's auto-mode arming FACT as the manifest carries it: `armed ⇔ reason === "armed"`; `deniedSource` (#692 C-d,
* additive) is present only beside a STATED `denied` and names which settings plane's ratchet turned auto mode off
* ({@link import("./runtime-caps.js").AUTO_MODE_DENY_SOURCES}: `org` / `local` / `settings`) — the resolver's
* own word, carried through, never inferred; a `denied` with no source is a resolver that does not track sources,
* and a `resolver_fault` never carries one (the screen strips a source it refused).
*/
export interface AutoModeArmFact {
armed: boolean;
reason: AutoModeArmReason;
deniedSource?: import("./runtime-caps.js").AutoModeDenySource;
}
/** The most tool names one MCP row lists ({@link WiringManifestMcpEntry.toolNames}) — the one bound on the list's size; a row holding more
* lists the first of them in roster order and says so ({@link WiringManifestMcpEntry.toolNamesTruncated}). */
export declare const MCP_ENTRY_TOOL_NAMES_MAX = 64;
/**
* One declared MCP server's materialization result for THIS leg — the per-server connection-state
* read face on {@link WiringManifest.mcp}. `status` is the connect-time verdict of this leg's
* materialize (a snapshot, never a heartbeat — the same semantics as `MaterializedMcp.statuses`,
* which it is projected from): `connected` (tools listed; `toolCount` = see the field), `failed` (the connect or the tool listing threw — `errorCode`/`delivered`/`httpStatus`/`authorization` are the
* failure record spread flat (see the MCP failure vocabulary's `McpFailure` and `failureFields`), `error` the
* neutralized, length-bounded remote text), `skipped` (declared on the spec but this leg produced no
* status for it — the materialization did not reach it). `source` is the DECLARING side's own label
* (`McpServerSpec.source`: plugin / user / project / local, or anything the deployment writes),
* echoed back so a shell can group servers by where the declaration came from; core reads nothing
* off it. Ordered as declared.
*/
export interface WiringManifestMcpEntry {
name: string;
source?: string;
/** `pending` — the leg's MCP wait budget (`RunnerDeps.mcpFirstRequestWaitMs`) ran out before this server's attempt settled: no tools
* yet (`toolCount: 0`); the row that replaces it, when it lands connected or failed, rides `tool_roster_delta.mcp`. */
status: "connected" | "failed" | "skipped" | "pending";
errorCode?: McpFailureKind;
delivered?: McpDelivered;
httpStatus?: number;
/** The `unauthorized` failure's authorization fact (`McpAuthorization`): present iff `errorCode === "unauthorized"`, copied whole
* from the status record (`authorizeUrl` the deployment seat's, `resourceMetadataUrl` the endpoint's own UNTRUSTED claim). */
authorization?: McpAuthorization;
error?: string;
/** How many of the server's tools the roster the row is read against holds: a run's roster (the valve and the deployment's
* `toolFaces` overlay applied — a tool either one leaves off is not counted), or, for `probeMcpServers` (no run, so no lists),
* what its own dial would mount. `0` on `failed` and on `skipped` (no connection, so nothing held). */
toolCount: number;
/** The names of the tools `toolCount` counts, as the roster holds them (the model-facing `mcp__<server>__<tool>` spelling, in roster
* order) — read off the same roster by the same call, so the two cannot disagree about what the run holds. PRESENT IFF the row is
* `connected` and at least one held name is listable: a name the provider's tool-name charset and length refuse is never listed.
* At most {@link MCP_ENTRY_TOOL_NAMES_MAX} names; when the list holds fewer names than `toolCount`, {@link WiringManifestMcpEntry.toolNamesTruncated}
* says so — a list is never cut silently. Absent on `failed` and `skipped` (nothing is held) and on a connected server that holds none. */
toolNames?: string[];
/** Present, and `true`, iff `toolNames` holds fewer names than `toolCount` (over the bound, or a held name that was not listable);
* absent otherwise — never written `false`. A consumer that wants the rest asks the roster (`WiringManifest.tools`). */
toolNamesTruncated?: true;
/**
* The engine's last liveness OBSERVATION about this server as of this leg's materialize — a per-leg
* snapshot of the record described on `McpServerStatus.liveness`, refreshed when a leg emits its
* manifest and at no other time (the engine runs no probe and adds no traffic of its own to answer
* it, so there is nothing here to poll).
*
* It is NOT `status`: that is the connect-time verdict of the dial ("did this leg mount it"), while
* this is what the connection layer learned about REACH — and the two legitimately disagree, most
* plainly on a server that answered the handshake with a protocol error (`status:"failed"` beside
* `liveness.state:"reachable"`: up, and misconfigured). It is NOT a re-dial's `outcome` either —
* that is one action's judgment, this is a standing observation the action updates.
*
* PRESENT IFF an observation exists. Absent = INDETERMINATE and nothing else: the leg produced no
* attempt record for this declaration (`status:"skipped"`), or the declaration could not be dialed
* at all (`errorCode:"invalid_config"` — a malformed url never reaches a transport), or the manifest
* predates the field. A consumer must not fold absence into `unknown`, into "healthy" or into "off";
* `unknown` is the different and stronger statement that core DID look and could not tell.
*/
liveness?: McpServerLiveness;
}
/**
* One declared A2A peer this leg dialed, as its materialization read it — the per-peer read face on {@link WiringManifest.a2a},
* projected from the leg's `MaterializedA2a.statuses` (a snapshot of the dial, never a heartbeat): `status` is `ready` (its card was
* read and its skills mounted) or `failed` (`errorCode` the failure kind its status row carries); `boundary` is the declaration's
* (`outside` when it says none); `fingerprint` the registration's stamp when the declaration carries one. The engine hands this to the
* host as a fact; whether a person's standing yes still holds for the registration is not read here.
*/
export interface WiringManifestA2aEntry {
name: string;
status: "ready" | "failed";
/** Absent only on a `failed` entry whose declaration (or its `boundary` word) could not be read: it says nothing about the side. */
boundary?: "inside" | "outside";
fingerprint?: string;
errorCode?: McpFailureKind;
/** Present iff the revocation door stopped the dial (the status row's `code`): `a2a.peer_revoked` or `a2a.revocation_unreadable`. `errorCode`
* says `revoked` for both; a host that branches on a withdrawn peer reads this word, never `errorCode` alone. */
code?: A2aRevocationStopCode;
}
/** Which LSP lanes this leg armed. The two lanes are INDEPENDENT and the word is their product: `tool` = the
* code-intelligence tool mounted and nothing more; `diagnostics` = the push lane armed (a registry-feeding
* manager, write-capable hands, no opt-out) while the tool is NOT on the roster; `tool_and_diagnostics` =
* both. A leg whose `LSP` tool was excluded can still be pushing diagnostics. */
export declare const LSP_LANES: readonly ["tool", "diagnostics", "tool_and_diagnostics"];
export type LspLane = (typeof LSP_LANES)[number];
/** Why a leg's hand band is NOT mounted ({@link WiringManifest.hands}`.reason`), one word per false branch of the
* hands decision (`prepare-execution-env.ts`): `no_execution_env` — neither env seat supplied one (no factory and no
* static env, or a factory that was asked and answered none); `not_needed` — the deployment wired a factory, the leg's
* plan read that it needs no environment (`ToolMountPlan.executionEnv.state === "unneeded"`), so the factory was not
* asked, and no static env stands. */
export declare const HANDS_UNMOUNTED_REASONS: readonly ["no_execution_env", "not_needed"];
export type HandsUnmountedReason = (typeof HANDS_UNMOUNTED_REASONS)[number];
/** The manifest's hands seam from the leg's two execution-env facts (see {@link WiringManifest.hands}): whether a hand band
* mounted, and whether a wired factory was left unasked. */
export declare function deriveHandsSeam(handsMounted: boolean, skippedFactory: boolean): {
mounted: boolean;
reason?: HandsUnmountedReason;
};
/** Which seat a deployment hands its legs' execution environments from — a factory per task, one static environment, or
* none — read off the deployment alone ({@link executionEnvSeatOf}): the ASSEMBLY fact the fingerprint hashes in place of the
* per-leg hands seam. */
export declare const EXECUTION_ENV_SEATS: readonly ["factory", "static", "none"];
export type ExecutionEnvSeat = (typeof EXECUTION_ENV_SEATS)[number];
/** The deployment's environment seat, read the way the execution-env phase reads the two seats (a factory wins). */
export declare function executionEnvSeatOf(deps: Pick<RunnerDeps, "executionEnvFactory" | "executionEnv">): ExecutionEnvSeat;
/** The forms a deployment's own approval seat takes: {@link ASK_SEAM_FORMS} less `declared_none` (a declaration is a task's),
* derived from that list in its order — a word added there is a deployment seat form too unless it is a declaration. */
export type DeploymentAskSeatForm = Exclude<AskSeamForm, "declared_none">;
export declare const DEPLOYMENT_ASK_SEAT_FORMS: readonly DeploymentAskSeatForm[];
/** The deployment's approval and question seats ({@link interactionSeatsOf}). */
export interface InteractionSeats {
readonly ask: DeploymentAskSeatForm;
readonly question: boolean;
}
/** The deployment's approval and question seats: the one seat resolutions ({@link resolveAskSeat}, {@link resolveQuestionSeam})
* read for a run that brings no seat of its own — the seats every leg of the deployment shares, whatever a task's own seat says.
* A value outside a seat's union is refused there, loudly. */
export declare function interactionSeatsOf(deps: Pick<RunnerDeps, "onAsk" | "onQuestion">): InteractionSeats;
/** The contract id the LSP tool mounts under (`createLspTool`) — the roster's structural discriminator, which
* a disclosure keys on instead of re-spelling the wire name. */
export declare const LSP_CONTRACT_ID = "core.lsp@1";
/** The manifest's LSP seam from its two INDEPENDENT facts (see {@link WiringManifest.lsp}): the lane word is
* their product, and is absent only when neither lane is live. */
export declare function deriveLspSeam(mounted: boolean, diagnosticsLive: boolean): {
mounted: boolean;
lane?: LspLane;
};
/**
* design/173 §2.2/§8.4 — the wiring manifest. Consumers MUST ignore unknown fields
* (`schemaVersion` bumps only on a semantic break of an EXISTING field). The TaskEvent face is the
* host/operator plane — the manifest never enters model context.
*/
export interface WiringManifest {
schemaVersion: 1;
/** Present on EFFECTIVE (per-leg) manifests only; never on a static manifest. `instance`: the leg's per-run identity
* (`{ runId, startedAt }` in epoch ms, minted once together at prepare entry) — present on every engine-minted effective
* manifest and never on a static one (optional on the type for pre-field producers and unit callers). `runOrigin`: the word of the input that
* opened this leg, when its host said so (the objective's `TaskSpec.runOrigin`, or the newest input a wake hands over; read
* once at the config doors), and on a leg a decision resumed, the checkpoint row's — absent when the host said nothing, and
* on a delegated child (a child is its parent's model's work). */
leg?: {
kind: WiringLegKind;
instance?: WiringLegInstance;
runOrigin?: RunOrigin;
};
/** Both halves — present iff the deployment declared `RunnerDeps.host` (`{ instanceId, startedAt }`, epoch ms); omitted
* when the deployment declared nothing. Single writer = the deployment; frozen copy detached from the caller's object;
* excluded from {@link configFingerprint}. */
host?: HostInstanceDeclaration;
/** Effective half only — the leg's team role ({@link import("../agents/team-role.js").teamRoleOf}):
* `lead` for a top-level leg, `teammate` for a named delegation, `none` for an unnamed one. Leg-local
* (excluded from the fingerprint). */
teamRole?: import("../agents/team-role.js").TeamRole;
/** Effective half only, present iff the spec reported one — the session's self-reported presence,
* the very object `TaskSpec.peerPresence` carried, for a host to copy into the directory row it
* writes without parsing the spec. Leg-local (excluded from the fingerprint). */
peerPresence?: import("../agents/peer-directory.js").PeerPresence;
/** The approval seat as this leg resolved it. Out of {@link configFingerprint}: a task's own `onAsk` / `approvalReach` decide
* the form, and `effective` folds the leg's mode and park lane. */
ask: {
form: AskSeamForm;
/** Absent iff no seat supplied a value (`"absent"`, or `"declared_none"` with nothing wired) — a fabricated provenance
* would be a false fact. */
provenance?: SeamProvenance;
/** OMITTED on the static half (design/173 §8.4): the absent-form arm depends on the park lane,
* which the static half cannot always resolve. Always present on the effective half. */
effective?: AskEffective;
/** The classes the resolved seat answers by itself, by its declared class table
* ({@link import("./tool-policy.js").declareClassAnswers}; in `ASK_CLASSES` order): an ask whose whole class set
* is among them is allowed as the deployment's policy, reaching nobody. Present ⇔ the seat carries a table — on
* either half, beside whatever `effective` says of the asks outside it. */
answeredClasses?: readonly import("./ask-origin.js").AskClass[];
};
/** The question channel. Out of {@link configFingerprint}: a task's own `onQuestion` and `interactiveTools` decide it, and the
* engine strips it on a leg that outlives the request. */
question: {
/** Three-valued channel state — see {@link QuestionChannelState}. The field keeps the frozen
* design name `wired`. */
wired: QuestionChannelState;
/** Present iff `wired === "wired"`. */
provenance?: SeamProvenance;
/**
* design/173 §3 (F13, effective half only) — the composition-lie detector:
* `interactiveTools === true` mounted the question tool while NO delivery face exists (no live
* `onQuestion`, no durable park consumer, not an engine-stripped lane). The model will be
* offered a question tool whose answers can reach nobody. Always disclosed here; under
* posture `"interactive"` the prepare door additionally refuses the leg.
*/
interactiveToolsWithoutDeliveryFace?: true;
};
/** The interaction-posture declaration (the prepare door's input): `"interactive"` promises a
* reachable human and the door refuses a leg that cannot deliver one, `"headless"` documents the
* opposite, `"absent"` = no declaration (no check). Until this field existed, posture was the one
* interactive-face declaration the manifest did not report. Out of {@link configFingerprint}: a task's declaration. */
interaction: {
posture: "interactive" | "headless" | "absent";
};
/** `seamWired` = a deployment `onElicit` seam exists. Seam presence ≠ the elicitation family is
* usable: the other half is per-server opt-in (`spec.mcp[].elicitation === true`), counted in
* `serversOptedIn` (statically readable from the spec). `seamWired` is IN {@link configFingerprint} (the deployment's
* seat); `serversOptedIn` is out (a task's servers). */
elicit: {
seamWired: boolean;
serversOptedIn: number;
};
/** The durable park lane as this leg resolved it. Out of {@link configFingerprint}: a task can switch its checkpoint store off
* or bring its own, opt into durable approval, a principal's caps can force the gate, and the safety vocabulary follows the
* leg's roster and environment. The deployment's own store seat is {@link checkpoint}. */
parkLane: {
/** A checkpoint store is wired (capability — design/173: capability and current policy
* are reported separately). */
capable: boolean;
/** capable ∧ the leg's parks can be resumed ∧ (durableApproval opt-in ∨ forceDurableGate entitlement ∨ armed safety-tool
* vocabulary). `"unresolved"` on a static half that cannot decide (runtime caps / tool
* vocabulary are prepare-time facts). */
effective: boolean | "unresolved";
/** Why `effective` is `false`/`"unresolved"` — empty when `true`. The derivation chain an
* operator follows from `static unresolved` to `effective park unavailable`. */
reasons: readonly ParkLaneReason[];
/** design/173 §8.4 (opus R7): the DECLARED durability of the resolved checkpoint store — an
* armed park lane over a process-local store is the "armed but memory-backed" degrade shape
* §1 names, and it must be reportable. Present iff `capable`. */
checkpointDurability?: ManifestDurability;
};
/**
* Effective half only — whether this leg CAN suspend durably at a clean turn boundary, the readiness every
* external cause and every opted-in task axis suspends on. A statement about readiness, never about one
* request's outcome: a ready leg can still have one suspend refused at run time (the environment declines
* the snapshot, the store refuses the write) — that request's own disclosure names it.
* - `ready` — a scheduler's yield (`TaskSpec.preemptSignal`) parks this leg at its next clean boundary; not
* ready ⇒ the yield is answered by continuing, said once on the deployment's error face.
* - `reasons` — the missing pieces (empty ⇔ ready).
* - `recoverableAcrossProcesses` — ready AND both the checkpoint store and the session store DECLARE
* durability, so a park minted here can be continued by another process (a drain hand-off). False ⇒ only
* this process can continue it. Derived from the same declarations `parkLane.checkpointDurability` and
* `session.store` report; a screening parent-constraint chain still has to be re-supplied by the host that
* resumes on a fresh Runner (the park's own disclosure says so).
*/
suspendLane?: {
ready: boolean;
reasons: readonly SuspendLaneReason[];
recoverableAcrossProcesses: boolean;
};
/** The session store's DECLARED durability (declaration relayed verbatim — never class-name
* sniffing; absent declaration reads fail-closed as `process_local`). */
session: {
store: ManifestDurability;
};
/** Effective half only, ALWAYS present on an engine-minted effective manifest: whether the DEPLOYMENT wired a checkpoint store
* (`RunnerDeps.checkpointStore`) — its seat, not the store this leg resolved (a run that switches its own off with
* `TaskSpec.checkpointStore: "disabled"`, or brings its own, is what {@link parkLane} reports). IN {@link configFingerprint}.
* ABSENT = an older mint or an external derivation, never a state. */
checkpoint?: {
storeWired: boolean;
};
/** Effective half only, ALWAYS present on an engine-minted effective manifest: the DEPLOYMENT's approval and question seats
* ({@link interactionSeatsOf}: `RunnerDeps.onAsk`'s form, whether `RunnerDeps.onQuestion` is a live face) — its seats, not what
* this leg resolved (a task's own `onAsk` / `approvalReach` / `onQuestion` and the leg's park lane are what {@link ask} and
* {@link question} report). IN {@link configFingerprint}. ABSENT = an older mint or an external derivation, never a state. */
interactionSeats?: InteractionSeats;
/** `subagentTranscripts` — subagent transcript persistence: the deployment-level delegation-
* transcript durability TIER, a pure declaration read ({@link resolveSubagentTranscriptTier}):
* `none` = no agent-row store (pre-151 in-memory lifecycle); `rows` = rows + terminal snapshots
* survive a restart, transcripts follow the session store's fate; `full` = the C18 promise —
* a completed/failed/killed(non-user) subagent minted through the deps-visible assembly is
* continuable across a process restart. A statement about the DEPS-VISIBLE assembly only: a
* caller-mounted Agent tool over its own runner is outside this manifest's sight (per-read
* honest degrade + the integrity notice own that case, never a fabricated tier) — and that
* blind spot is load-bearing here, because the store this field is derived from is the ROOT
* leg's while the store an ordinary child transcript is actually minted through is the AGENT
* TOOL's runner's ({@link resolveSubagentTranscriptTier} names the rule and the fork-lane
* exception). The word names ADDRESSABILITY: `none`/`rows` are silent on whether a child
* transcript reaches disk at all, and only `full` promises the a* handle survives a restart. */
fleet: {
backgroundAgentStore: boolean;
hostChildEventSink: boolean;
subagentTranscripts: SubagentTranscriptTier;
};
/** design/179 — the persisted allow-rule seam. The ONE loosening seam in the assembly, so its presence
* is a fact an operator has to be able to read off the manifest rather than infer. `false` on a
* deployment that wired no store, which is the shape the field has to have: an absent field would say
* "this build has no such feature", and a present-and-false one says "it exists and is off here". */
permissionRules: {
storeWired: boolean;
/** design/182 §9 — this deployment DECLARED that it drives cloud sync for the wired rule store
* (`RunnerDeps.permissionRuleSyncWired`). Connecting a bucket to a sync endpoint merges every
* device, the transport and the server into ONE consent trust domain, which is a fact an operator
* reads off the manifest rather than infers. `false` on a deployment that does not sync — same
* present-and-false shape as `storeWired`, for the same reason. */
syncWired: boolean;
/** design/182 §7 / design/389 — this deployment DECLARED org governance (the store was composed with
* an `org` partition, whose constructor refuses a declaration with no snapshot source). `true` also means
* the fail-closed availability contract is armed: while no org snapshot can be adjudicated
* against, every terminal allow tightens to a real-approval ask. */
orgGoverned: boolean;
};
/**
* Governance surfaces (presence facts only). `audience: "operator"` is the MACHINE-READABLE
* projection classification (design/173): a serving layer forwarding this event to a
* multi-tenant/shared stream MUST project this section for operators only — and when it does no
* projection, the default is to NOT disclose the section, never to leak it.
*/
governance: {
audience: "operator";
lockedConfig: boolean;
compliance: boolean;
memoryAdmission: boolean;
retention: boolean;
};
/**
* EFFECTIVE half only, present iff the model gate trimmed a default-mounted tool from THIS run's
* roster: the per-session READ face of the same fact `config.tool_model_gate_removed` announces on
* the operator sink (one notice per sink, not per session — a client that needs "which default tools
* did MY session lose" reads it here). `class` = the gate class the table keyed the trim on, `removed`
* = the wire names not mounted, `restore` = the three valves in one sentence. Minted from the SAME
* gate decision the notice reads (one source, projected twice); absent = no trim on this run. A gate
* table with several classes trimming at once reports the FIRST class here and every removed name
* across classes in `removed` (the notice keeps its per-class lines). Out of {@link configFingerprint}: the leg's model and roster.
*/
modelGate?: {
class: string;
removed: readonly string[];
restore: string;
};
/**
* EFFECTIVE half only, and ALWAYS present on an engine-minted effective manifest (unlike
* `modelGate`, which is present only when a trim happened: auto mode has an answer on every leg,
* so absence here means an older mint or an external derivation, never "not applicable"). The
* per-leg READ face of the auto-mode arming decision: `armed` ⇔ `reason === "armed"` (the
* classifier decider was minted for this leg), and `reason` names the first arm that failed
* otherwise — see {@link AUTO_MODE_ARM_REASONS}. A serving layer that used to infer the mode from
* spec shape reads it here instead. The classifier's availability is a per-CALL fact (an unavailable
* round goes on to the approval seat or is refused with a sentence that says so, and the next round is
* classified afresh), so there is no session-level
* breaker face here. Out of {@link configFingerprint}: the arming follows the leg's mode (a child clamped under its parent
* legitimately differs) and the principal's entitlement.
*/
autoMode?: AutoModeArmFact;
/**
* EFFECTIVE half only, and ALWAYS present on an engine-minted effective manifest (the `autoMode`
* posture: every leg has an answer — an empty array is "this leg declared no servers", absence is
* an older mint or an external derivation). The per-server MCP connection-state read face: one
* {@link WiringManifestMcpEntry} per server the leg's frozen spec declared, in declaration order,
* projected from THIS leg's materialization (`MaterializedMcp.statuses`) — a connect-time snapshot
* of "did this leg connect", never a live health signal. A shell that shows per-server state
* (connected / failed with a cause a person can act on / tool counts, grouped by declaring
* `source`) reads it here instead of inferring from the roster or the failure notices. NOT part of
* {@link configFingerprint}: connection state is a fact about this leg's attempt, not about the
* assembly, and legs of one assembly must fingerprint alike whether or not a server was up.
*/
mcp?: readonly WiringManifestMcpEntry[];
/**
* EFFECTIVE half only — the per-peer A2A read face, the {@link mcp} face's sibling: one entry per declared peer this leg dialed, in
* declaration order ({@link WiringManifestA2aEntry}). Present iff the leg dialed at least one peer. What a host reads to say which
* peers this leg talks to, under which registration (`fingerprint`) and on which side of the trust boundary (`boundary`). NOT part
* of {@link configFingerprint}, for the reason `mcp` is not.
*/
a2a?: readonly WiringManifestA2aEntry[];
/**
* design/388 §2.5 — EFFECTIVE half only, and ALWAYS present on an engine-minted effective manifest:
* the leg's TOOL ROSTER — one row per mounted instance in wire order, every declared axis, the
* engine-minted identity (`capabilityId`), the schema-derived `inputKeys` / rule vocabulary and the
* roster `digest`. The static half has no roster (it mounts nothing); what it can say about the set is
* {@link toolPlan}. NOT part of
* {@link configFingerprint}: a roster is per-leg by construction (a child leg mounts a different set
* under the same assembly), so hashing it would break the cross-leg equality the fingerprint
* advertises — the roster carries its own digest for that. A run-time change to the set arrives as a
* `tool_roster_delta` event, never as a re-emitted manifest.
*/
tools?: import("./tool-roster.js").ToolRoster;
/**
* BOTH halves: the leg's mount plan — every definition the mount table names, by the row that mounts it, read over the
* facts this half can see. A tool is on a leg's roster if and only if its row in the mount table holds over that leg's
* facts. On the STATIC half (`half: "static"`) the rows are read over the facts a deployment knows before any task:
* `mounted` members mount on every top-level leg those deps run for that spec; `conditional` members name the per-task,
* per-principal or live facts that decide them (`when`); absent definitions name the facts that keep them off
* (`because`). The plan never guesses a fact it cannot read. On the EFFECTIVE half (`half: "effective"`) every fact is
* read, so the members are exactly the roster's, all `mounted`, and `absent` names the definitions the leg left off.
* NOT part of {@link configFingerprint}, for the roster's reason.
*/
toolPlan?: ToolMountPlan;
/**
* EFFECTIVE half only: the leg's mods admission — one record per registration of the two seats, in run order: a
* mounted one with the patterns it actually hung (`events`), the ones among them it only watches (`observe`: every
* handler it hung on the pattern is a watcher — a registration that only watches has `observe` equal to `events`) and the
* judges skipped while it was judged (`skipped`), or a refused one with who refused it and why (`refusedBy`,
* `reason`); either carries the registration's `provenance` label as the host gave it (absent when none was given — no
* default is minted). PRESENT IFF the leg has a registration — a deployment that wires none reports nothing here and its
* manifest (and {@link configFingerprint}) is byte-for-byte what it was. Absence reads as "this leg carries no
* registration", NOT as "no extension judges this leg's calls": a delegated child can still be screened by an
* ancestor's chain through the gate's constraint fold. EXCLUDED from {@link configFingerprint}: the task seat is a
* per-task seat, so one assembly's legs legitimately differ on it.
*/
mods?: readonly ModAdmissionRecord[];
/**
* EFFECTIVE half only: the LSP code-intelligence seam. PRESENT IFF a manager seat resolved
* (`spec.lspManager ?? deps.lspManager`); a deployment that wires none reports nothing (byte-for-byte
* unchanged, fingerprint included). `mounted` is the ROSTER fact, not the seat fact — a wired manager
* whose `LSP` tool was excluded reports `false` — and `lane` is INDEPENDENT of it: the diagnostics push
* lane arms on the manager, the hands and the opt-out, never on the mount, so
* `{mounted:false, lane:"diagnostics"}` is a real and reachable state. `lane` is absent only when
* neither lane is live.
*/
lsp?: {
mounted: boolean;
lane?: LspLane;
};
/**
* EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: is this leg's HAND band (the file
* tools, and the shell tools where the env has a shell) mounted — the value the band's mount reads, stated
* positively instead of inferred from `tools[]` or the write-protection word. `true` ⇔ the factory minted an env
* or the static `executionEnv` seat is not `undefined` (a JS caller's `null` and a `StubExecutionEnv` count: the
* band mounts over them, without a shell); `false` carries `reason` ({@link HandsUnmountedReason}), which is absent
* beside `true`. Whether a full shell is reachable is `tools[]`'s fact. ABSENT = an older mint or an external
* derivation, never a state. Out of {@link configFingerprint}: on a factory deployment a leg that needs no environment
* reports `not_needed` beside its siblings' `true` — a per-leg fact; the assembly's seat is {@link executionEnvSeat}.
*/
hands?: {
mounted: boolean;
reason?: HandsUnmountedReason;
};
/**
* EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: the seat the deployment hands its legs'
* environments from ({@link ExecutionEnvSeat}). IN {@link configFingerprint}: an ASSEMBLY fact — two deployments that differ
* in whether and how they wire an environment hash apart, while one deployment's legs agree on it whatever each needs.
* ABSENT = an older mint or an external derivation, never a state.
*/
executionEnvSeat?: ExecutionEnvSeat;
/**
* EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: the leg's PERMISSION MODE as the engine
* resolved it — `requested` (the caller's word; absent = declared nothing), `effective` (the mode the leg runs under:
* the request clamped under a parent's ceiling, then folded to `default` where the deployment denies it or the
* classifier face is absent), `foldedBy` (present iff the two differ: `operator_deny` / `face_absent` /
* `inherited_ceiling`). The same three members answer every steer of the mode (`TaskStream.setPermissionMode`) and
* ride the fold notice's detail. A shell renders its mode indicator from `effective`, never from what it sent.
* ABSENT = an older mint, never a state. Leg-local (excluded from {@link configFingerprint}: a child clamped under its
* parent legitimately differs from it).
*/
permissionMode?: import("./mode-policy.js").PermissionModeReceipt;
/**
* EFFECTIVE half only, PRESENT IFF the leg asks for fast mode (`TaskSpec.fastMode`) or its session has sent fast speed: the
* leg's fast-mode reading at its start (`fastModeReadingOf`, `brain/fast-mode.ts` — the reference's init `fast_mode_state` /
* `fast_mode_disabled_reason`, plus when a cooldown ends): `{ state, reason?, cooldown?: { until, reason } }`. A change during
* the leg is `model.fast_mode_changed`; the verb answers with the same shape. Leg-local (excluded from {@link configFingerprint}:
* a session's cooldown is not configuration).
*/
fastMode?: import("../brain/fast-mode.js").FastModeReading;
/**
* EFFECTIVE half only, PRESENT IFF this leg compiled a write-protection judge — a deployment that
* replaced the table with `[]` opted the layer out entirely, and reports nothing here rather than a
* judge-shaped word about a judge that does not exist (absence = "no judge on this leg", which is a
* different fact from either value below, and strictly weaker than both).
*
* `targetView` is the JUDGE'S OWN word (`WriteProtectionMatcher.targetView`, relayed verbatim), and it
* is how an operator tells a hands-less deployment's write floor from a hands-ful one without inspecting
* the engine's seats — the same fact `config.write_protection_target_view_absent` announces once per run
* when a covered write tool is mounted beside a `"spelling-only"` judge.
*
* Out of the fingerprint below (like `tools`/`lsp`/`mods`): which view the judge got follows whether the LEG has an
* environment, and on a factory deployment a leg that needs none judges by spelling beside siblings that hold the target
* view; the assembly's part of it is {@link executionEnvSeat}.
*
* @contract write_protection.target_view_disclosed — WHICH reading of a write's target the leg's
* write-protection judge holds is DISCLOSED, never inferred: the judge self-reports one of two words at
* its compile (`"target"` — it holds an execution environment and re-judges a table-missing spelling on
* its resolved real target; `"spelling-only"` — it holds none, so the spelling is the whole judgment and
* an alias onto a protected path is cleared), the leg's wiring manifest relays that word verbatim, and a
* `"spelling-only"` judge with a covered write tool mounted also announces
* `config.write_protection_target_view_absent` exactly once per run; the disclosure changes no verdict —
* the absence law it makes readable is the judge's own and stands unaltered.
*/
writeProtection?: {
targetView: WriteProtectionTargetView;
};
/**
* EFFECTIVE half only; the present-iff law is the contract sentence below. `builtinTiers` names the
* tiers that MATERIALLY activate rows, in {@link
* import("../tools/fs/read-deny.js").READ_DENY_BUILTIN_TIERS} order — not the tiers the operator
* typed: one whose every row `readDenyBuiltinExclude` removed is not named. Deliberately NOT
* reported: `readDenyPatterns`, deployment-supplied TEXTS rather than an enum, so absence means "no
* BUILT-IN row judges", never "no read is deny-judged". IN the fingerprint: the selection is read off the deployment's
* two seats (`RunnerDeps.readDenyBuiltinTiers` / `readDenyBuiltinExclude`), so legs of one deployment agree.
*
* @contract read_deny.builtin_activation_disclosed — WHETHER the built-in sensitive-path read deny
* table judges a leg is DISCLOSED, never inferred: the tier selection is the deployment's (absent = the default
* tiers, an explicit `[]` = none), the leg that compiles the judge relays the tiers its own resolution materially
* activated, and the manifest carries that section iff at least one built-in row is active (absence
* = no built-in row judges; an empty array is never emitted — "off" and "on to nothing" are one
* fact). The disclosure changes no verdict.
*/
readDeny?: {
builtinTiers: readonly string[];
};
/**
* EFFECTIVE half only, OUTSIDE {@link configFingerprint} (it follows the leg's environment). PRESENT IFF the read-deny table this
* leg compiled at prepare holds rows and the leg's execution environment does not declare it keeps the byte floor
* (`capabilities.keepsReadFloor`), on a deployment that does not require the floor (one that does refuses the leg instead):
* the engine refuses what a command names, but a recursive read under a root reads the files below it there, deny rows
* included. Always `{ kept: false }` when present. The leg's wiring AS IT STARTED: a table the leg compiles after the manifest
* went out (the person's persisted rules changed mid-run) is not here — the leg's record over its whole life is
* {@link import("./task-result.js").TaskResult.readDenyFloor}, which reads the same latch when the result is assembled (so it
* holds wherever this cell does, and carries the rows' counts). The person's notice `config.read_deny_floor_unkept` is told once per session while the fact holds (a leg that kept the floor ends it), and only when the caller brought rows. ABSENT = the
* floor is kept, or the table held no row, or the leg was minted by an engine older than this member — a reader cannot tell
* the three apart from the manifest alone (the engine's version can).
*/
readDenyFloor?: {
kept: false;
};
/**
* EFFECTIVE half only, OUTSIDE {@link configFingerprint} (a task declares its own). PRESENT IFF the leg places deny rows at a
* declared place: a configuration root (`agentConfigDirs` — `RunnerDeps.agentConfigDir`, `TaskSpec.agentConfigDirs`, a resumed
* row's) or a caller's home (`agentHomeDirs` — `TaskSpec.agentHomeDirs`, a resumed row's). Each list holds one entry per place
* the leg's one mint holds, `from` naming every layer that declared it (`"deployment"` / `"task"` / `"checkpoint"`); a list with
* no place is absent. The paths themselves are not reported (host texts, the {@link readDeny} class): the section says how
* many places guard the leg and where each came from — a host that handed a root and sees no `"task"` entry knows it did not
* arrive. ABSENT = no declared place (the engine's own homes only), or an engine older than this member.
*/
declaredPlaces?: {
agentConfigDirs?: ReadonlyArray<{
readonly from: readonly DeclaredPlaceSource[];
}>;
agentHomeDirs?: ReadonlyArray<{
readonly from: readonly DeclaredPlaceSource[];
}>;
};
/**
* EFFECTIVE half only. PRESENT IFF auto-consolidation is EFFECTIVELY armed on this
* deployment (`autoRunOnRecommendationEffective`: an explicit `true`, or an absent seat under the
* named default `AUTO_RUN_ON_RECOMMENDATION_DEFAULT` where both consolidation seats are wired): a
* terminal harvest that crosses the threshold auto-runs one host consolidation — memory content
* auto-egresses to the configured model. ABSENT (and the manifest, including `configFingerprint`,
* byte-identical) when not armed — an explicit `false`, or a default that does not arm it.
* IN the fingerprint (read off the deployment's seats); always
* `{ onRecommendation: true }` when present — the prepare door refuses an armed-but-unrunnable state.
*/
autoConsolidation?: {
onRecommendation: true;
};
/**
* EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: does this leg capture file history.
* `"on"` — it records (store wired, neither layer declared it off, a filesystem env mounted). `"disabled"` — it does
* not, whichever layer or missing half made it so (`TaskSpec.fileHistory`, `RunnerDeps.fileHistoryStore: "disabled"`, `RunnerDeps.fileHistoryCapture: "off"`,
* no store, no filesystem env); the host knows its own deployment seat. ABSENT = an older mint or an external
* derivation, never a state. Out of {@link configFingerprint}: the request word is a per-task seat (`mods` reasoning).
*/
fileHistory?: "on" | "disabled";
/**
* EFFECTIVE half only, present iff the task's command sandbox requirement is in force (`TaskSpec.sandbox.enabled`): `"armed"` —
* the leg's environment keeps a command sandbox and every command its shell faces start runs in it (or is not started);
* `"unavailable"` — it keeps none and the task allowed that (`failIfUnavailable: false`), so the commands run unsandboxed
* (`reason` says why; the run's `config.command_sandbox_unavailable` notice says the same); `"not_needed"` — no environment
* stands under the leg (its factory was not asked, or the deployment has none), so it starts no command for a sandbox to hold
* (the hands seam says `mounted: false`). Absent = no requirement in force (a requirement the environment cannot meet under
* `failIfUnavailable` refuses the run, so no manifest says it). Out of {@link configFingerprint}: the requirement is a per-task
* seat (a child runs under its parent's merged with its own).
*/
commandSandbox?: {
readonly state: "armed" | "not_needed";
} | {
readonly state: "unavailable";
readonly reason: string;
};
/**
* EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: does this leg read the project's instruction files, and if
* not, which half kept them out — one word per state, read off the task's declaration alone. `"on"` — the task declares an instruction
* family (`TaskSpec.instructionFamily`) and the request left it on: the instruction-file lane reads it at the task root and below (on a leg
* with hands; {@link WiringManifest.instructions} says what it holds). `"disabled"` — a family is declared and the request turned it off
* (`TaskSpec.projectMemory: "disabled"`; the lane is not seated). `"absent"` — no family is declared (the manifest's word for a seat nothing
* supplied, as `ask` / `question` spell it), whatever the request said. The member missing = an older mint or an external derivation, never
* a state. Out of {@link configFingerprint}: the request word is a per-task seat (`fileHistory` reasoning).
*/
projectMemory?: "on" | "disabled" | "absent";
/**
* EFFECTIVE half only — the roots' instruction files this leg holds as it starts. Present ⇔ the instruction-file lane is seated (a
* family declared and left on, hands mounted, or host-text withholds recorded). `selected` = the task root's family members the
* conversation holds or the leg's first load has on its way, relative to the task root; `additionalDirectories` = same per opted-in
* additional root; `included` = `@`-included files loaded on first load (present iff non-empty); `withheld` = lane-discovered and
* host-text files withheld on first load (present iff non-empty, with `blockedAfterApproval` on `outside_its_root` when Read admission
* would still refuse after approval). Produced by the same reading as `Runner.previewInstructions`. Out of {@link configFingerprint}.
*/
instructions?: WiringInstructions;
/**
* EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: are the legs THIS leg delegates (sync,
* background, forked, workflow, retained, resumed and observer-sidecar legs, at any depth) bound by a rule written to this
* leg's session AFTER they started. `childrenReadLive: true` ⇔ the leg enforces its own session-rule layer (a
* `sessionPolicyStore` is wired and the task carries a `sessionId`) and so hands that session's key on to the legs it
* delegates, each of which re-reads the row at every tool gate: a rule written mid-run binds the agent's next call, whether
* or not the session had a row when the agent was spawned. `false` ⇒ no layer, so no key is handed on (no store wired, or
* the task names no session). ABSENT = an older engine: assume nothing. A statement about the DEPS-VISIBLE assembly — a
* delegation tool mounted over a Runner with no store of its own cannot re-read (it announces
* `config.session_rules_unreadable` and keeps the spawn-time snapshot). Leg-local (excluded from {@link configFingerprint}:
* `sessionId` is a per-task seat); the leg-start snapshot, like the rest of this object.
*/
sessionRules?: {
childrenReadLive: boolean;
};
/**
* EFFECTIVE half only; present ⇔ the deployment declared a host floor (`RunnerDeps.hostFloor`): its POSTURE — whether an `only` list
* bounds what is reachable (`onlyMode`; `onlyCount: 0` with it = no structured egress at all) and how many entries each list holds.
* Deliberately not the entries' text (deployment-supplied hosts, the {@link WiringManifest.readDeny} class). IN the fingerprint: the
* declaration is the deployment's, so legs of one assembly agree.
*/
hostFloor?: import("./host-floor.js").HostFloorPosture;
/**
* EFFECTIVE half only — the advisor tool on this leg, as the leg STARTED (a snapshot: a switch-off that lands later in the
* leg is not in it; a host reads the conversation's current state off the transcript, `advisorHoldOf`). Present ⇔ the leg's
* spec names an advisor model. `requested` = the ref as given (a Model's `id`; absent when the deployment switch ignored it
* unread); `main` = the leg's resolved model; `state` `on` (with `model`, the resolved advisor), `held` (the conversation
* switched it off; `hold` = the cause) or `not_attached` (`reason`; `routeCode` on `route_refused` — the refusal's code, or
* `route.judgment_failed` for a judgment that threw or answered no verdict; absent when the refusal stated none). Out of
* {@link configFingerprint}: a per-task seat.
*/
advisor?: WiringAdvisorFact;
/**
* EFFECTIVE half only — this leg's project verdict, projected from the same mint as `workspace_changed.project`
* (same shape: `{ id, source: "marker" | "declared" }`). Present iff the leg has a project verdict, including legs
* that emit no `workspace_changed` frame (`hands.reason: "not_needed"`). Absent when the leg has no verdict or the
* marker could not be read. Only prepared legs emit a manifest (a refused leg has no manifest; refusal detail rides
* `terminal.detail`); a delegated child's manifest rides the child's own stream, never forwarded onto the parent's.
* Out of {@link configFingerprint}: a per-leg fact.
*/
project?: NonNullable<WorkspaceSnapshot["project"]>;
/**
* EFFECTIVE half only — present iff this prepared leg ran in a workspace whose `.sema/project` marker could not be
* read (or whose ancestor `.git` walk failed), projected from the same `resolveSessionProject` read as P-e refusal
* detail (zero second read; no file content and no error text). `markerPath` passes through the same
* {@link codedDetailStringOf} screen as P-e `terminal.detail` (redacted when credential-shaped, omitted when over
* the coded-detail string bound or when `reason === "repo_root_unreadable"`). Mutually exclusive with
* {@link WiringManifest.project} (never both present on one manifest; a leg declaring `TaskSpec.project` beside an
* unreadable marker is refused and emits no manifest). A host (e.g. the service layer) leaves its stored project row
* untouched on it. Out of {@link configFingerprint}: a per-leg fact.
*/
projectMarkerUnreadable?: {
readonly reason: ProjectMarkerUnreadableReason;
readonly markerPath?: string;
};
/** EFFECTIVE half only — a short, non-sensitive fingerprint (sha256 prefix over the canonical JSON of the members read off
* the DEPLOYMENT's own seats, the ones this module's `deploymentPart` names; every one an enum/boolean/count, no secrets) so an
* operator can correlate legs that ran under the same deployment: a root, its children and its resumes, a leg that starts
* an environment and one that needs none, a run that switches its checkpoint store off, all carry one value. Every other
* member is reported and out of it (a task's spec, a principal's caps, the leg's roster, mode or environment, a
* connection attempt). */
configFingerprint?: string;
}
/**
* The FULL fact set both halves derive from — one input shape, one derivation
* ({@link deriveWiringManifest}), so the halves cannot drift. `undefined` on the optional park
* atoms means "not knowable at this half" and derives `"unresolved"`, never a guess.
*/
export interface WiringFacts {
half: "static" | "effective";
/** Required on the effective half; must be absent on the static half. */
leg?: WiringLegKind;
/** Effective half only, reported inside `leg.instance` — minted once at prepare entry; refused on the static half. */
legInstance?: WiringLegInstance;
/** Effective half only, reported inside `leg` — see {@link WiringManifest.leg}. */
runOrigin?: RunOrigin;
/** Both halves — present iff declared on `RunnerDeps.host`; see {@link WiringManifest.host}. */
host?: HostInstanceDeclaration;
/** Effective half only — see {@link WiringManifest.teamRole}. */
teamRole?: import("../agents/team-role.js").TeamRole;
/** Effective half only — see {@link WiringManifest.peerPresence}; copied, never aliased. */
peerPresence?: import("../agents/peer-directory.js").PeerPresence;
askForm: AskSeamForm;
askProvenance?: SeamProvenance;
/** See {@link WiringManifest.ask.answeredClasses}. */
askAnsweredClasses?: readonly import("./ask-origin.js").AskClass[];
questionWired: boolean;
questionProvenance?: SeamProvenance;
/** The engine-minted strip flag (trusted RunInternals channel) — effective half only; the static
* half has no run internals and never reports `stripped_bg_lane`. */
questionStrippedByEngine?: boolean;
/** F13 composition-lie fact (effective half only). */
interactiveToolsWithoutDeliveryFace?: boolean;
/** The interaction-posture declaration this half can see: the static half reads `spec ?? deps`,
* the effective half reports the RESOLVED posture (spec > spawning parent > deps). Absent = no
* declaration anywhere — reported as `"absent"`, never guessed. */
interactionPosture?: "interactive" | "headless";
elicitSeamWired: boolean;
elicitServersOptedIn: number;
parkCapable: boolean;
/** Nobody resumes this leg's decision parks (`approvalParkNotResumableOf` named a source); absent ⇔ no source spoke. Known on both
* halves — the static half reads a top-level leg, whose one source is the host's `durableApproval: false`. */
parkLegNotResumable?: boolean;
parkDurableApprovalOptIn: boolean;
/** `undefined` = unresolved at this half (per-principal runtime caps are a prepare-time fact). */
parkForceDurableGate?: boolean;
/** Effective half only — the `forceDurableGate` entitlement binds this leg and nobody resumes its parks (the driver's one refusal
* fact, the one the ask lane refuses by and the `config.durable_gate_unavailable` announcement reads): every permission ask of the
* leg is refused without asking anyone. Absent ⇔ false; `true` stands only beside {@link parkLegNotResumable}. */
forcedGateNotResumable?: boolean;
/** `undefined` = unresolved at this half (the irreversible/egress tool vocabulary and the shell read station —
* the three sources of a mandated ask — are assembled in prepare). */
parkSafetyVocabularyArmed?: boolean;
/** Effective half only — {@link approvalParkWithheldOf}: the leg's permission asks stay out of its park lane (the lane itself, and the
* question tool's asks in it, are unchanged). Absent ⇔ false. */
approvalParkWithheld?: true;
/** Present iff `parkCapable` (the resolved checkpoint store's declaration). */
checkpointDurability?: StoreDurability;
sessionDurability: StoreDurability;
/** Effective half only — `RunnerDeps.checkpointStore !== undefined` ({@link WiringManifest.checkpoint}); the engine always passes it. */
checkpointStoreWired?: boolean;
/** Effective half: the durable-suspend infrastructure's missing pieces (empty ⇔ ready), relayed from the one
* derivation the suspend lanes are exposed on. Absent on the static half (the per-task env is a prepare-time fact). */
suspendLaneReasons?: readonly SuspendLaneReason[];
backgroundAgentStoreWired: boolean;
/** Subagent transcript persistence — the declared delegation-transcript tier (see
* {@link WiringManifest.fleet}). Optional for external `deriveWiringManifest` callers: absent
* derives fail-closed from `backgroundAgentStoreWired` alone (`rows`/`none` — under-promise,
* never `full`); the engine's own halves always pass the resolved value. */
subagentTranscriptTier?: SubagentTranscriptTier;
/** design/179 — a persisted allow-rule store provider is wired. */
permissionRuleStoreWired: boolean;
/** design/182 §9 — the deployment declared that it drives cloud sync for that store. */
permissionRuleSyncWired: boolean;
/** design/182 §7 — the deployment declared org governance (an org rule overlay is wired). */
permissionRuleOrgGoverned: boolean;
hostChildEventSinkWired: boolean;
lockedConfigWired: boolean;
complianceWired: boolean;
memoryAdmissionWired: boolean;
retentionPolicyWired: boolean;
/** Effective half only — see {@link WiringManifest.modelGate}; the static half has no roster to trim. */
modelGate?: {
class: string;
removed: readonly string[];
restore: string;
};
/** Effective half only — see {@link WiringManifest.autoMode}; the static half has no leg to arm.
* `armed` must agree with `reason` (`armed ⇔ reason === "armed"`); a contradicting pair is refused, and so
* is a `deniedSource` beside any reason but `denied` or spelled outside its closed set. */
autoMode?: AutoModeArmFact;
/** Effective half only — see {@link WiringManifest.mcp}; the static half materializes nothing.
* Copied entry-wise onto the manifest (the caller's array is never aliased). */
mcp?: readonly WiringManifestMcpEntry[];
/** Effective half only — see {@link WiringManifest.a2a}; copied entry-wise, and left off when it holds no entry. */
a2a?: readonly WiringManifestA2aEntry[];
/** Effective half only — the leg's minted tool roster (see {@link WiringManifest.tools}). */
tools?: import("./tool-roster.js").ToolRoster;
/** Both halves — the leg's mount plan (see {@link WiringManifest.toolPlan}); its own `half` must be the manifest's. */
toolPlan?: ToolMountPlan;
/** Effective half only — the leg's mods admission records ({@link WiringManifest.mods}); an empty array and an absent value derive the same thing (no section). */
mods?: readonly ModAdmissionRecord[];
/** Effective half only — the LSP seam ({@link WiringManifest.lsp}); absent ⇒ no manager wired. */
lsp?: {
mounted: boolean;
lane?: LspLane;
};
/** Effective half only — the hands seam ({@link WiringManifest.hands}, {@link deriveHandsSeam}); the engine always passes it. */
hands?: {
mounted: boolean;
reason?: HandsUnmountedReason;
};
/** Effective half only — the deployment's environment seat ({@link WiringManifest.executionEnvSeat}); the engine always passes it. */
executionEnvSeat?: ExecutionEnvSeat;
/** Effective half only — the deployment's approval and question seats ({@link WiringManifest.interactionSeats}); the engine always passes it. */
interactionSeats?: InteractionSeats;
/** Effective half only — the leg's permission-mode receipt ({@link WiringManifest.permissionMode}); the engine always passes it.
* Screened: `effective` a mode word, `requested` a mode word or absent, `foldedBy` a fold reason or absent. */
permissionMode?: import("./mode-policy.js").PermissionModeReceipt;
/** Effective half only — the leg's fast-mode reading at its start ({@link WiringManifest.fastMode}); absent ⇒ the leg neither asks
* nor sent it. Screened: `state` a word of its set, `reason` one or absent, `cooldown` present exactly with `cooldown`. */
fastMode?: import("../brain/fast-mode.js").FastModeReading;
/** Effective half only — the compiled write-protection judge's OWN target-view word
* ({@link WiringManifest.writeProtection}); absent ⇒ this leg compiled no judge (an emptied table). */
writeProtectionTargetView?: WriteProtectionTargetView;
/** Effective half only — the built-in read-deny TIERS this leg's configuration materially activated
* ({@link WiringManifest.readDeny}); empty and absent derive the same thing (no section). */
readDenyBuiltinTiersActive?: readonly string[];
/** Effective half only — the byte floor's judgment of the table the leg compiled ({@link WiringManifest.readDenyFloor}): `true` ⇔
* rows on an environment that does not keep the floor; absent or `false` ⇒ no cell. */
readDenyFloorUnkept?: boolean;
/** Effective half only — the leg's declared places as its one mint holds them ({@link WiringManifest.declaredPlaces}): per list,
* the layers each place came from (index-aligned with the mint's places); empty lists ⇒ no section. */
declaredPlaces?: {
readonly agentConfigDirs: ReadonlyArray<readonly DeclaredPlaceSource[]>;
readonly agentHomeDirs: ReadonlyArray<readonly DeclaredPlaceSource[]>;
};
/** Effective half only — `RunnerDeps.autoRunOnRecommendation === true`
* ({@link WiringManifest.autoConsolidation}); false ⇒ no section (byte-identical manifest). */
autoConsolidationOnRecommendation?: boolean;
/** Effective half only — the file-history phase's word ({@link WiringManifest.fileHistory}); the engine always passes it. */
fileHistory?: "on" | "disabled";
/** Effective half only — the run's command sandbox ({@link WiringManifest.commandSandbox}), relayed from its one judgment; absent or `off` ⇒ no cell. */
commandSandbox?: {
readonly state: "off";
} | {
readonly state: "not_needed";
} | {
readonly state: "armed";
} | {
readonly state: "unavailable";
readonly reason: string;
};
/** Effective half only — the project-context phase's word ({@link WiringManifest.projectMemory}); the engine always passes it. */
projectMemory?: WiringManifest["projectMemory"];
/** Effective half only — {@link WiringManifest.sessionRules}`.childrenReadLive`: this leg's session-rule layer published its key for its children's chain. Read off that wiring, never a constant. */
sessionRulesChildrenReadLive?: boolean;
/** Effective half only — the advisor phase's answer ({@link WiringManifest.advisor}), relayed, never re-derived. */
advisor?: WiringAdvisorFact;
/** Effective half only — the compiled host floor's posture ({@link WiringManifest.hostFloor}); absent ⇒ none declared. */
hostFloor?: import("./host-floor.js").HostFloorPosture;
/** Effective half only — this leg's project verdict ({@link WiringManifest.project}), relayed from the leg's one mint; absent ⇒ no verdict. */
project?: WiringManifest["project"];
/** Effective half only — unreadable-marker fact ({@link WiringManifest.projectMarkerUnreadable}), relayed from the leg's one mint; mutually exclusive with {@link project}. */
projectMarkerUnreadable?: WiringManifest["projectMarkerUnreadable"];
}
/** {@link WiringManifest.advisor}. */
export interface WiringAdvisorFact {
requested?: string;
main: string;
state: "on" | "not_attached" | "held";
model?: string;
reason?: import("./advisor-verdict.js").AdvisorNotAttachedReason;
routeCode?: import("../brain/route-adjudicator.js").RouteJudgmentCause;
hold?: import("./advisor-verdict.js").AdvisorHold;
}
/** Named view of the deps seats the static half reads (a `Pick` of the real {@link RunnerDeps} —
* single-source shapes, no parallel hand-copied interface). */
export type StaticWiringDeps = Pick<RunnerDeps, "host" | "onAsk" | "onQuestion" | "interactionPosture" | "onElicit" | "checkpointStore" | "sessionStore" | "backgroundAgentStore" | "onBackgroundChildEvent" | "lockedConfig" | "compliancePostureResolver" | "memoryScopeAdmission" | "retentionPolicy" | "permissionRuleStore" | "permissionRuleSyncWired"> & StaticToolPlanDeps;
/** Named view of the spec seats the static half reads (a `Pick` of the real {@link TaskSpec}). */
export type StaticWiringSpec = Pick<TaskSpec, "onAsk" | "approvalReach" | "onQuestion" | "checkpointStore" | "durableApproval" | "mcp" | "interactiveTools" | "interactionPosture"> & StaticToolPlanSpec;
/**
* Read a store's {@link StoreDurability} declaration: absent ⇒ `"process-local"` (fail-closed —
* under-promise, never over-promise), a declared value passes through, and an UNPARSEABLE value is
* refused loudly (`config.store_durability_invalid`) — a junk declaration silently folded to either
* arm would be a manifest that lies in whichever direction the fold picked.
*/
export declare function resolveDeclaredDurability(store: {
readonly durability?: StoreDurability;
} | undefined, storeName: string): StoreDurability;
/** Subagent transcript persistence — the deployment-level delegation-transcript durability tier
* (see {@link WiringManifest.fleet}). */
export type SubagentTranscriptTier = "none" | "rows" | "full";
/**
* Subagent transcript persistence — the ONE deployment-level tier derivation (pure declaration
* read, no probing, no class-name sniffing — the wiring-manifest posture): `none` without an
* agent-row store; with one, `full` iff the session store DECLARES its subagent placement
* partition durable, else `rows`. A junk placement declaration is refused loudly
* (`config.store_durability_invalid` — the resolveDeclaredDurability rule: an unparseable
* declaration silently folded to either arm would make the manifest lie in whichever direction the
* fold picked). This is the DEPLOYMENT-level judgment only; the per-handle "did this row's
* transcript actually land" question belongs to `durableAgentRowProbe` (the S1b release-flip gate)
* — two different questions, deliberately two named faces (do not merge them back into one).
*
* WHICH session store to pass: the one on the runner the Agent tool was mounted with
* (`SubagentToolOptions.runner.sessions`), because that is the store an ordinary (sync/background)
* child transcript is minted through — the fork lane deliberately branches through the HOST store
* instead, see the law on `SubagentToolOptions.runner`. A deployment that serves root tasks from one
* runner and delegated children from another (a throwaway sub-task store, a routing store) has two
* different stores here, and passing the ROOT deps' store reports the root lane's fate under the
* child lane's name. Note what the three words do and do not promise about DISK: this tier names
* ADDRESSABILITY, not persistence. `none` is returned before any store is inspected, so it covers
* both "the transcript is on disk but nothing can address it" and "there is no transcript" — an
* operator asking whether a child conversation is readable afterwards must read the delegation
* store's own durability + release/evict semantics, not this word.
*/
export declare function resolveSubagentTranscriptTier(agentStoreWired: boolean, sessionStore: {
readonly placements?: {
subagent?: {
durability: StoreDurability;
};
};
} | undefined): SubagentTranscriptTier;
/**
* The ONE `ask.effective` derivation (design/173) — shared by the effective manifest AND
* the posture door (`config.interaction_posture`): the door passes neither `mode` nor `forcedGate` and judges the SEAT alone
* (it runs before the leg's entitlements are resolved), the manifest passes its leg's effective mode AT THE LEG'S START and
* the leg's forced gate (the manifest is minted once; a runtime reader pairs {@link askSeatEffective} with the live mode
* instead), so the two read one table and differ only by the two facts the door does not have:
* - MODE BEFORE SEAT: under `dontAsk` the mode refuses every ask a policy raises (`arbitrateByMode`; only a
* hook's own ask beside no rule or safety ask is handed on, and that is the hook lane's decision, not a policy
* `ask`), so no seat answers one — whatever the seat and the park lane say, the word is `auto_deny`;
* - THE FORCED GATE BEFORE THE SEAT: where the `forceDurableGate` entitlement takes the leg's asks ({@link forcedGateTakesAsks}:
* its park lane holds them, or nobody resumes the leg) no seat is asked — a park takes the ask ahead of any approver, and on
* a leg nobody resumes it is refused unconsulted — so every seat reads as the no-seat arm below (`park_only`, or `auto_deny`);
* - a live approver callback ⇒ `human_reachable` (regardless of the park lane);
* - an approver callback the deployment declared a policy ⇒ `policy_reachable` (regardless of the park lane, like any
* callback: it is asked first, and an ask parks only when it answers `"unavailable"`);
* - blanket `"allow"`/`"deny"` ⇒ the park lane decides first: a string seat is NOT a live approver,
* so on an armed park lane the ask parks and the honest report is `park_only` — reporting the
* blanket as what the ask "reaches" would be a false fact of exactly the kind this module refuses.
* Off the park lane the blanket is what happens: the deliberate auto policies;
* - no seat at all, or a run that declared nobody can be asked (`declared_none`) ⇒ the park lane decides: armed ⇒
* `park_only` (the deployment's park is its own statement that an answer can wait for a person), unresolved ⇒
* `unresolved`, else the headless degrade `auto_deny`.
*/
export declare function deriveAskEffective(form: AskSeamForm, parkEffective: boolean | "unresolved", mode?: PermissionMode, forcedGate?: boolean): AskEffective;
/**
* The SEAT's own `ask.effective` of an effective leg — {@link deriveAskEffective} with no mode, from the facts the leg's manifest is
* minted from (the form, the park lane, the forced gate). The manifest's `ask.effective` is the word AS OF THE LEG'S START under its
* start mode, and a steer moves the mode afterwards; a runtime consumer that reads the word per call (the classifier's approval seat,
* the posture row, the peer lane's mode fold) therefore reads THIS word and the leg's LIVE mode beside it — never the start-of-leg
* fold, which would carry a `dontAsk` start's refusal into the leg's later modes. Minted once per leg, beside the manifest.
*/
export declare function askSeatEffective(facts: WiringFacts): AskEffective;
export { APPROVAL_ROUTES, isApprovalRoute, type ApprovalRoute } from "./approval-route.js";
/**
* The APPROVAL SEAT as a route, read off the ONE ask derivation above, never re-derived: `human_reachable` ⇒
* `live_approver`; `policy_reachable` ⇒ `policy_seat`; `park_only` ⇒ `durable_park` (where the park cannot take the ask, a
* blanket seat behind it refuses the bit); `auto_allow`, `auto_deny` and `unresolved` ⇒ `none`. Every station that forks on
* "does a handed-on ask reach a decider" reads this word — the leg's gate from the leg's seat word ({@link askSeatEffective}),
* an ancestor's frozen seat through {@link frozenApproverRoute} — and the fork, its observer and the sentence a person reads
* all read the same word.
*/
export declare function approvalRouteOf(ask: {
readonly effective?: AskEffective;
}): ApprovalRoute;
/**
* The route from an ancestor's FROZEN approver (the inherited fold's station): the same table read with that seat's own
* form and no park — the inherited station resolves at the frozen seat, whose only roads to a decider are its callbacks
* (a person's, or a policy's; the leg's park is reached only through a callback's `unavailable`), so a blanket or absent
* frozen seat is `none`.
*/
export declare function frozenApproverRoute(onAsk: OnAsk | undefined): ApprovalRoute;
/** The seat form of a seat VALUE: a function is a callback — a policy's when the deployment marked it one
* ({@link isPolicyApprover}), else a person's — the two blanket words are themselves, nothing is `absent`; anything else is
* no form at all (`undefined` — {@link resolveAskSeat} refuses it loudly). */
export declare function askSeamFormOf(v: unknown): Exclude<AskSeamForm, "declared_none"> | undefined;
/** Which seat forms `approvalReach: "none"` sets aside: the one that could be a person — a `"callback"`. A policy callback
* and a blanket policy stay (neither ever claimed to be a person). The ONE reading of the declaration's reach: the run's
* own seat ({@link resolveAskSeat}) and the ancestor seats a declared-none leg sees on its chain both read it. */
export declare function reachSetsAside(form: AskSeamForm | undefined): boolean;
/** Do this leg's permission asks stay out of its park lane? Yes on a workflow member whose seat resolved to `declared_none` (the
* declaration that nobody can be asked, and no policy seat beside it): a parked member would hold its run on an approval nobody on the
* run is there to give, so its permission asks settle as on the same leg with no park lane — refused, and the member goes on. Any other
* seat form keeps the lane (a blanket word or a policy callback is a decider the park was ordered ahead of); the question tool's asks
* and the resource parks keep it too, and the host leg's own asks park as before. `member`: the leg runs as a workflow member by
* its live internals (a fresh spawn's or a workflow drive's, never a parked row's record). */
export declare function approvalParkWithheldOf(leg: {
readonly member: boolean;
readonly form: AskSeamForm;
}): boolean;
/** May this call take the leg's park lane (the gate station hands it the park closure only then)? The engine's question tool's call
* (read off the call's face, as the gate reads it) takes the lane alone; a permission call also needs the leg's seat word to let an
* ask reach the park — `auto_deny` means it does not (beside an armed lane that word comes only from {@link approvalParkWithheldOf}). */
export declare function callMayTakeParkLane(seatWord: AskEffective | undefined, face: Parameters<typeof isEngineQuestionFace>[0]): boolean;
export declare function deriveWiringManifest(facts: WiringFacts): WiringManifest;
/** A run's approval seat as its one resolution froze it: the value every reader that needs the approver itself reads
* (`undefined` when nothing on this run can be asked), the form the manifest reports and every reader of the word derives
* from, the seat that supplied the value, and the declaration when the run made one. */
export interface AskSeat {
readonly value: OnAsk | undefined;
readonly form: AskSeamForm;
/** Absent iff no seat supplied a value. A callback the declaration set aside still names its seat. */
readonly provenance?: SeamProvenance;
readonly reach?: ApprovalReach;
}
/**
* THE approval-seat resolution — the one place a run's `spec.onAsk` / `deps.onAsk` are read. Prepare calls it once, at
* its config doors (before any resource is taken), and hands the frozen result down; the static half calls it for its
* own self-check. The seat is the spec's when the spec's key is PRESENT, else the deployment's (presence, not `??`: a
* spec `null` is a junk value, never a fall-through to the deployment). A value outside the `OnAsk` union is refused
* loudly (`config.interaction_wiring`), a declaration outside {@link APPROVAL_REACH} too (`config.approval_reach_invalid`).
*
* `approvalReach: "none"` is one sentence here ({@link reachSetsAside}): a blanket `"allow"` / `"deny"` stays what it is, and
* so does an approver the deployment declared a policy (`policy_callback` — neither ever claimed to be a person); a person's
* callback, or no seat, becomes `declared_none` with NO value — so the readers of the value
* (the approver lane, the park's sync-first decline, the durable-mandate source, a child's inherited seat) and the readers
* of the word ({@link deriveAskEffective}) cannot disagree about whether a person is there.
*/
export declare function resolveAskSeat(spec: Pick<TaskSpec, "onAsk" | "approvalReach">, deps: Pick<RunnerDeps, "onAsk">): AskSeat;
/** The form and provenance half of {@link resolveAskSeat} — the projection the manifest's two halves and a server's
* per-leg judgment read (hand it the request's `approvalReach` beside the seat) — and the classes the resolved seat's
* declared table answers ({@link askAnsweredClassesOf}). */
export declare function resolveAskSeamForm(spec: Pick<TaskSpec, "onAsk" | "approvalReach">, deps: Pick<RunnerDeps, "onAsk">): {
form: AskSeamForm;
provenance?: SeamProvenance;
answeredClasses?: readonly import("./ask-origin.js").AskClass[];
};
/** The manifest's `ask.answeredClasses` fact for a resolved seat: the classes its value's declared table answers
* ({@link declaredAnswerClassesOf}) — none for a seat the declaration set aside, which holds no value. Both halves read it. */
export declare function askAnsweredClassesOf(seat: Pick<AskSeat, "value">): readonly import("./ask-origin.js").AskClass[] | undefined;
/** The one question-seat resolution (`spec` wins over `deps`), shared by both halves. Review fold
* r2-F2: a NON-FUNCTION present value (a JS caller passing `onQuestion: null`/junk) is refused
* loudly — the engine's `??` resolution would keep it, the mount's presence check would count it,
* and the manifest would report `wired` for a callback nothing can ever call.
*
* design/174: "a value is present" is NOT the criterion — `wired` is derived through THE shared
* {@link isLiveQuestionFace} predicate, the same one the gate routes on. The reserved
* `QUESTION_AWAITS_RESUME` placeholder is a function and is the documented standard assembly of the
* durable topology, but its whole contract is that it never runs; reporting it as a wired channel
* told an operator a question could reach a person in-stream when the only real delivery face on
* that assembly is the park lane (which this manifest reports separately, and honestly). */
export declare function resolveQuestionSeam(spec: Pick<TaskSpec, "onQuestion">, deps: Pick<RunnerDeps, "onQuestion">): {
wired: boolean;
provenance?: SeamProvenance;
};
/** Count of MCP servers that opted into elicitation on this spec (the per-server half of the
* elicit capability — statically readable). */
export declare function countElicitOptIns(spec: Pick<TaskSpec, "mcp">): number;
/** The one elicit-seat resolution, shared by both halves (review fold r3-F3 — the onQuestion rule
* applies here too): absent ⇒ not wired; a function ⇒ wired; a present NON-function (a JS caller
* passing null/junk) is refused loudly rather than reported as a live seam nothing can call. */
export declare function resolveElicitSeam(deps: Pick<RunnerDeps, "onElicit">): boolean;
/**
* The interaction posture's word, judged against its two words — the ONE judgment of it: the static manifest's, and the config-door
* phase's value door (which a resume's screen calls before its claim). A present value outside `"interactive"` / `"headless"` (`""`
* included: a present junk value, not absence) is refused loudly, `config.interaction_posture`; absent stays absent.
*/
export declare function screenInteractionPostureWord(posture: unknown): "interactive" | "headless" | undefined;
/**
* design/173 §2.1 — the STATIC half: a pure synchronous description of what `(deps, spec)` can
* prove about the wiring, for a server's startup self-check. Facts that only prepare can resolve
* (per-principal runtime caps, the safety-tool vocabulary) derive `"unresolved"`; `ask.effective`
* is omitted entirely (see the module doc). This is DISCLOSURE, not verification — see the §0
* guarantee boundary above. `spec` may be omitted for a spec-less deployment self-check.
*
* `toolPlan` is the mount table read over the facts this half can read (tool-mount-static.ts): a member it calls
* `mounted` mounts on every top-level leg `(deps, spec)` starts (the contract below says which legs), a definition it calls absent
* on none, and a member a per-task, per-principal or live fact decides is `conditional` and names that fact. Reading it takes the
* spec's one read first and then runs these doors of prepare over those values (the permission-mode doors, the tool lists and
* selector, the locked-config preflight of the declared peers, a named model), so a spec those doors refuse is refused here —
* after the seat resolutions above it, before the screens `deriveWiringManifest` runs over the assembled facts; prepare's other
* refusals are not judged (below). Its `executionEnv` answers whether a leg of
* `(deps, spec)` needs an execution environment; the session's own needs (its checkout record, a resume, a delegating
* caller's placement) stay open — the answer is never `unneeded` — unless `statement` says the submission mints its session
* (`{ session: "new" }`). Over that statement, a static `unneeded` holds on the leg (the leg's own reading only adds facts).
*
* What the `toolPlan` answers (the table's contract), for a freshly started top-level leg of `(deps, spec)` that gets past prepare,
* over the modes and words the spec itself states. A resumed leg is not in these promises: it takes the permission mode its
* checkpoint recorded, which this read does not know (with a recorded `plan` mode and none requested, `EnterPlanMode` and
* `ExitPlanMode` are absent here and mounted there).
* · a member it marks `mounted` is on the roster, and a definition it marks absent is not — with one exception, in both
* directions: a caller tool that carries `ToolSpec.withAgents` is rebuilt for the task's agents and the rebuilt tool may answer
* to another name, so the name it brings is on the roster and unlisted, and the name it was handed under may be gone;
* · a member it marks `conditional`, and a family of a declared peer, may be on the roster — `when` names what decides it;
* · a name it does not list as a member is, as a rule, not on the roster. Besides the rebuild above, the tools a declared MCP or
* A2A peer lists are on it under that peer's namespace prefix (the family stands for them; a remote tool's own name is never a
* member), and a caller tool's aliases are spellings that dispatch to a listed name, not names of their own;
* · what prepare refuses the whole roster for is not judged here: a caller tool named `Skill` beside a skill that loads (the name
* is reserved), a name another per-turn station takes, the safety scan of the caller's tools, a plan file the leg has no hands
* to write (the doors named above are the exception: they run here, over the spec's own values);
* · `ToolSearch` is `conditional` on `names.deferred`, an honest "not known": the leg's deferral classification over the tools it
* mounts decides it — a tool's own or the task's explicit deferral (`defer`, `TaskSpec.deferTools`), the pins against it
* (`alwaysLoad`, `TaskSpec.alwaysLoadTools`), the size threshold (`RunnerDeps.toolSearch`, `RunnerDeps.deferMode`), the tools a
* declared peer lists, the valve admitting `ToolSearch` — and this table does not run that classification;
* · two rows state what the leg reads from the spec, by the leg's own function: the `Skill` row holds exactly when a skill loads
* (`loadedSkills`; a skill over the load limit does not load), and a spec that declares `ownHandsReadOnly` is read as read-only
* hands (`withOwnLegHands`: Write / Edit absent, `Bash` the read-only one). The spec is read once by member name
* (`readCallerSpec`), as the Runner reads it, and its refusal (a member that cannot be read, a retired key, a key the engine does
* not read) is thrown here as the leg's config door throws it; `executionEnv` is read over the facts the leg holds when it decides
* whether to start an environment (`listing.skills` is stated after).
*/
export declare function describeStaticWiring(deps: StaticWiringDeps, handed?: StaticWiringSpec, statement?: StaticWiringStatement): WiringManifest;
/**
* The wiring manifest's per-server MCP read face for one leg (`WiringManifest.mcp`): every
* server the leg's FROZEN entry snapshot declared, in declaration order, joined by name to this leg's
* materialization statuses. Pure projection — no connection logic, no second look at any transport:
* · a status `connected` ⇒ `connected` with the server's tools among `rosterNames` — the names of the roster the row is read
* against: a run's (the valve and the deployment's overlay applied), or the no-run probe's own dials (no run, so no lists apply); the row counts them and lists their names off that one read ({@link toolFieldsOfServer}, at most {@link MCP_ENTRY_TOOL_NAMES_MAX});
* · a status `failed` ⇒ `failed` with the failure record the materialization stamped (`errorCode`/`delivered`/
* `httpStatus`/`authorization` = the MCP vocabulary's `McpFailure` spread flat, copied by its one projection `failureFields`) and the remote text SECRET-REDACTED (an HTTP endpoint's error body rides the SDK's message
* verbatim, and a body that echoes the bearer it rejected must not reach a stream consumer),
* then neutralized + bounded to the reminder's own 240 (the same bound the once-per-session
* ledger applies to that text — one face, one width);
* · a status `pending` ⇒ `pending`, `toolCount: 0` (the leg's wait budget ran out before the attempt settled; the row that replaces it rides `tool_roster_delta.mcp`);
* · no status at all ⇒ `skipped` (the declaration stands, this leg produced no attempt record for it).
* `source` is echoed from the declaration (single-line, bounded; core reads nothing off it), and
* `liveness` is the status record's own observation deep-copied (see {@link WiringManifestMcpEntry.liveness}).
* The entries are fresh objects so the manifest never aliases the status records the refresh face mutates.
*/
export declare function mcpManifestEntries(entries: ReadonlyArray<McpServerSpec> | undefined, statuses: ReadonlyArray<McpServerStatus>, rosterNames: ReadonlyArray<string>): WiringManifestMcpEntry[];