@sema-agent/core
Version:
Stateless, task-oriented AI agent core
1,245 lines • 54.7 kB
TypeScript
import type { AssertAllKeysHandled } from "./ask-origin.js";
import { type CheckpointFeature } from "./checkpoint-features.js";
import type { StoreFidelity, Checkpoint, CheckpointGate, PendingAction } from "./checkpoint-store.js";
/**
* The closed set of reader-requirement words this engine knows. The first seven are the feature table's keys
* (the features that raised the row format before it froze); then the row digest's scheme; then the members a feature
* had carried beside the one its word now names, and the members added after the table, each a capability a reader
* must have. Downstream reads them for display only (`CheckpointError.detail.requires`).
*/
export declare const REQUIREMENT_WORDS: readonly ["resource", "binding", "token", "orgAdmission", "f012", "realApproval", "face", "requirements_digest", "org_admission_inherited", "org_write_grant", "org_governed", "delegation_provenance", "skill_grants", "skill_card_binding", "hands_coordinates", "hands_home", "path_rule_anchors", "path_rule_installations", "permission_mode", "plan_mode_restore", "persisted_rule_mandate", "deployment_authored", "call_names", "write_face", "denial_limit_fallback", "leg_scope", "tool_ceiling", "tool_lists_judged", "own_tool_lists", "approval_targets", "approval_target_reads", "cross_boundary", "mount_site", "skill_scopes", "run_origin", "tool_declaration", "composition_leg", "row_task_id", "held_rows", "source_session", "tool_binding", "raw_name_identity", "isolation_scope", "from_subagent", "command_sandbox", "agent_config_dirs", "agent_home_dirs", "read_block", "persisted_rule_buckets", "constraint_layer_kinds", "run_ledger", "leg_identity", "started_shell", "rule_session"];
export type RequirementWord = (typeof REQUIREMENT_WORDS)[number];
/** Runtime twin of {@link RequirementWord}. */
export declare function isRequirementWord(word: unknown): word is RequirementWord;
/** Every feature of the feature table is a word (`requirements` is the frame). */
export type FeatureWordsAreRequirementWords = AssertAllKeysHandled<Exclude<Exclude<CheckpointFeature, "requirements">, RequirementWord>>;
/** What one persisted member owes the reader. The row digest covers every member a decision reads — a word member
* (a capability the reader must have) or a `digest` member (one every admitted reader already reads); a `mutable`
* member is rewritten after the mint by the store's own transitions, so the static digest cannot hold it; an
* `ignorable` member is shown and never decided. */
export type RequirementClass = {
readonly word: RequirementWord;
readonly earlier?: EarlierReading;
readonly elements?: RequirementElementWords;
} | {
readonly digest: "decision-read";
} | {
readonly mutable: string;
} | {
readonly ignorable: string;
} | {
readonly members: RequirementTable;
} | {
readonly variants: {
readonly [kind: string]: RequirementTable;
};
};
export type RequirementTable = {
readonly [key: string]: RequirementClass | RetiredMember;
};
/** The members a word member's value may hold that a reader must know as well — each element's, for an ARRAY member; the record's own,
* for a RECORD member: a row carries the member's word, and each word here for which the value (some element) holds that member — the
* law that a member an older reader would read wrongly owes a word, applied to the members inside one. The value is in the digest once,
* under the word member's own path (a word here digests nothing). */
export type RequirementElementWords = {
readonly [member: string]: {
readonly word: RequirementWord;
};
};
/** How an earlier engine read a member this engine reads another way — a member that owes a word now, or one the row type left
* ({@link RetiredMember}): as a digest member, so a row it minted holds the member at the same path and in the digest it stamped, and
* declares no word for it. `agrees` answers, from the record that holds the member alone, whether this engine's reading of the member
* gives what that earlier one gave: where it does, the row reads as written; where it cannot show that, the row is that engine's intact
* row, which this engine does not resume. A pure function of the record's own members — never a deployment fact, a registry or a
* clock — total, and `false` whenever the record cannot show it. */
export interface EarlierReading {
readonly was: "decision-read";
readonly agrees: (record: object) => boolean;
}
/** A member an earlier engine read that this engine neither reads nor writes: the row type left it, so no row this engine mints holds
* it, and a row that engine minted holds it inside the digest that engine stamped. Its entry names that reading: the requirement judge
* reads such a row with the member back in its digest — the one way that engine's intact row is told from a row changed in storage —
* and nothing else reads it. `retired` says when and why it left. */
export interface RetiredMember {
readonly retired: string;
readonly earlier: EarlierReading;
}
/** A table over EVERY key of record `T` — a member left out is a compile error at the table — and over each member `Retired` names,
* a {@link RetiredMember} (a name `T` still has is never a retired member: its entry is `never`). */
export type RequirementTableFor<T, Retired extends string = never> = {
readonly [K in keyof T]-?: RequirementClass;
} & {
readonly [K in Retired]: K extends keyof T ? never : RetiredMember;
};
/** One table per variant of the discriminated union `U` — a new kind, or a new member of any variant, is a compile
* error. Each variant's `kind` entry classifies the kind itself. */
export type RequirementVariantsFor<U extends {
kind: string;
}> = {
readonly [K in U["kind"]]: RequirementTableFor<Extract<U, {
kind: K;
}>>;
};
/** The words a table's entries carry, read off its literal type (nested records and variants walked). */
type WordsIn<C> = C extends {
readonly word: infer W;
} ? W | ElementWordsIn<C> : C extends {
readonly members: infer M;
} ? WordsOfTable<M> : C extends {
readonly variants: infer V;
} ? WordsOfTable<V[keyof V]> : never;
type WordsOfTable<T> = T extends unknown ? {
[K in keyof T]: WordsIn<T[K]>;
}[keyof T] : never;
type ElementWordsIn<C> = C extends {
readonly elements: infer E;
} ? {
[K in keyof E]: E[K] extends {
readonly word: infer W;
} ? W : never;
}[keyof E] : never;
export declare const INHERITED_GATE_REQUIREMENTS: {
readonly ancestorRules: {
readonly digest: "decision-read";
};
readonly shellGate: {
readonly digest: "decision-read";
};
readonly permissionMode: {
readonly word: "permission_mode";
};
readonly prePlanMode: {
readonly word: "plan_mode_restore";
};
readonly admittedOrgScopes: {
readonly word: "org_admission_inherited";
};
readonly ownAdmittedOrgScopes: {
readonly word: "orgAdmission";
};
readonly ownAdmittedOrgWriteScope: {
readonly word: "org_write_grant";
};
readonly orgAdmissionGoverned: {
readonly word: "org_governed";
};
readonly pathRuleAnchors: {
readonly word: "path_rule_anchors";
};
readonly pathRuleInstallations: {
readonly word: "path_rule_installations";
};
readonly persistedRuleBuckets: {
readonly word: "persisted_rule_buckets";
};
readonly requiresParentConstraint: {
readonly digest: "decision-read";
};
readonly parentConstraintCount: {
readonly digest: "decision-read";
};
readonly constraintChain: {
readonly word: "f012";
readonly elements: {
readonly kind: {
readonly word: "constraint_layer_kinds";
};
readonly rootLeg: {
readonly word: "constraint_layer_kinds";
};
};
};
readonly constraintDigest: {
readonly word: "f012";
};
};
export declare const CHECKPOINT_STATE_REQUIREMENTS: {
readonly activeTools: {
readonly digest: "decision-read";
};
readonly outputRef: {
readonly digest: "decision-read";
};
readonly nestedStats: {
readonly digest: "decision-read";
};
readonly readFileState: {
readonly digest: "decision-read";
};
readonly readFace: {
readonly word: "face";
};
readonly writeFace: {
readonly word: "write_face";
};
readonly readBlock: {
readonly word: "read_block";
};
readonly skillGrants: {
readonly word: "skill_grants";
};
readonly skillScopes: {
readonly word: "skill_scopes";
};
readonly reminderMark: {
readonly digest: "decision-read";
};
readonly repairBundle: {
readonly digest: "decision-read";
};
readonly workspaceHandle: {
readonly digest: "decision-read";
};
readonly pendingSteerQueue: {
readonly mutable: "store state-machine member; integrity = CAS contract + kit, see #1580";
};
readonly runningBackgroundTasks: {
readonly digest: "decision-read";
};
readonly handsCwd: {
readonly digest: "decision-read";
};
readonly handsRoot: {
readonly word: "hands_coordinates";
};
readonly handsHome: {
readonly word: "hands_home";
};
readonly activeWorktree: {
readonly digest: "decision-read";
};
readonly inheritedGate: {
readonly members: {
readonly ancestorRules: {
readonly digest: "decision-read";
};
readonly shellGate: {
readonly digest: "decision-read";
};
readonly permissionMode: {
readonly word: "permission_mode";
};
readonly prePlanMode: {
readonly word: "plan_mode_restore";
};
readonly admittedOrgScopes: {
readonly word: "org_admission_inherited";
};
readonly ownAdmittedOrgScopes: {
readonly word: "orgAdmission";
};
readonly ownAdmittedOrgWriteScope: {
readonly word: "org_write_grant";
};
readonly orgAdmissionGoverned: {
readonly word: "org_governed";
};
readonly pathRuleAnchors: {
readonly word: "path_rule_anchors";
};
readonly pathRuleInstallations: {
readonly word: "path_rule_installations";
};
readonly persistedRuleBuckets: {
readonly word: "persisted_rule_buckets";
};
readonly requiresParentConstraint: {
readonly digest: "decision-read";
};
readonly parentConstraintCount: {
readonly digest: "decision-read";
};
readonly constraintChain: {
readonly word: "f012";
readonly elements: {
readonly kind: {
readonly word: "constraint_layer_kinds";
};
readonly rootLeg: {
readonly word: "constraint_layer_kinds";
};
};
};
readonly constraintDigest: {
readonly word: "f012";
};
};
};
readonly announcedListings: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly gitAnnouncement: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly delegationProvenance: {
readonly word: "delegation_provenance";
};
readonly isDelegatedChild: {
readonly digest: "decision-read";
};
readonly rowTaskId: {
readonly word: "row_task_id";
};
readonly legTaskId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly sourceAgentName: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly fromSubagent: {
readonly word: "from_subagent";
};
readonly workflowMember: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly placementRootSessionId: {
readonly digest: "decision-read";
};
readonly compositionLeg: {
readonly word: "composition_leg";
};
readonly externalContentTarget: {
readonly digest: "decision-read";
};
readonly legScope: {
readonly word: "leg_scope";
};
readonly runOrigin: {
readonly word: "run_origin";
};
readonly toolCeiling: {
readonly word: "tool_ceiling";
};
readonly toolListsJudged: {
readonly word: "tool_lists_judged";
};
readonly ownToolLists: {
readonly word: "own_tool_lists";
};
readonly crossBoundaryRecorded: {
readonly word: "cross_boundary";
};
readonly commandSandbox: {
readonly word: "command_sandbox";
};
readonly agentConfigDirs: {
readonly word: "agent_config_dirs";
};
readonly agentHomeDirs: {
readonly word: "agent_home_dirs";
};
readonly runLedger: {
readonly word: "run_ledger";
};
readonly legIdentity: {
readonly word: "leg_identity";
readonly elements: {
readonly ruleSessionId: {
readonly word: "rule_session";
};
};
};
};
export declare const PENDING_ACTION_REQUIREMENTS: {
readonly tool_approval: {
readonly kind: {
readonly word: "binding";
};
readonly toolCallId: {
readonly digest: "decision-read";
};
readonly toolName: {
readonly digest: "decision-read";
};
readonly args: {
readonly digest: "decision-read";
};
readonly preview: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly previewWithheld: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly existingTarget: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly ruleOffers: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly ruleOffersAbsence: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly execCwd: {
readonly digest: "decision-read";
};
readonly commandSandbox: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly destination: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly requiresRealApproval: {
readonly digest: "decision-read";
};
readonly mandated: {
readonly word: "persisted_rule_mandate";
};
readonly authoredBy: {
readonly word: "deployment_authored";
};
readonly mandate: {
readonly digest: "decision-read";
};
readonly denialLimitFallback: {
readonly word: "denial_limit_fallback";
};
readonly classifierNoRuling: {
readonly digest: "decision-read";
};
readonly origin: {
readonly digest: "decision-read";
};
readonly askClass: {
readonly digest: "decision-read";
};
readonly classes: {
readonly digest: "decision-read";
};
readonly askReasons: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly cardMessage: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly cardAskRule: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly fromApprovalList: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly headline: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly boundInputHash: {
readonly word: "tool_binding";
readonly earlier: {
readonly was: "decision-read";
readonly agrees: () => false;
};
};
readonly boundGrantDigest: {
readonly word: "skill_card_binding";
};
readonly boundGrants: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly boundGrantAbsence: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly capabilityId: {
readonly word: "raw_name_identity";
readonly earlier: {
readonly was: "decision-read";
readonly agrees: (pending: object) => boolean;
};
};
readonly contractId: {
readonly digest: "decision-read";
};
readonly shapeDigest: {
readonly digest: "decision-read";
};
readonly implementationRevision: {
readonly digest: "decision-read";
};
readonly family: {
readonly digest: "decision-read";
};
readonly pathTarget: {
readonly digest: "decision-read";
};
readonly hostTarget: {
readonly digest: "decision-read";
};
readonly names: {
readonly word: "call_names";
};
readonly engineMounted: {
readonly word: "mount_site";
};
readonly startedShell: {
readonly word: "started_shell";
};
readonly declarationDigest: {
readonly word: "tool_declaration";
};
readonly targets: {
readonly word: "approval_targets";
};
readonly targetReads: {
readonly word: "approval_target_reads";
};
readonly hasBidiControls: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly batchToolCallIds: {
readonly digest: "decision-read";
};
readonly completedCallIds: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly resource_limit: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
};
readonly review: {
readonly kind: {
readonly digest: "decision-read";
};
};
readonly plan_review: {
readonly kind: {
readonly word: "binding";
};
readonly requestedByCallId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly planContentHash: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly task_done: {
readonly kind: {
readonly digest: "decision-read";
};
};
};
export type PendingRequirementsCoverEveryKind = AssertAllKeysHandled<Exclude<PendingAction["kind"], keyof typeof PENDING_ACTION_REQUIREMENTS>>;
export declare const CHECKPOINT_GATE_REQUIREMENTS: {
readonly human: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
readonly toolName: {
readonly digest: "decision-read";
};
readonly approvalCard: {
readonly digest: "decision-read";
};
readonly riskDescriptor: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly irreversible_ask: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
readonly toolName: {
readonly digest: "decision-read";
};
readonly approvalCard: {
readonly digest: "decision-read";
};
readonly safetyAxis: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly realApproval: {
readonly word: "realApproval";
};
readonly riskDescriptor: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly resource_limit: {
readonly kind: {
readonly word: "resource";
};
readonly reason: {
readonly digest: "decision-read";
};
readonly resumeAfterMs: {
readonly digest: "decision-read";
};
};
readonly needs_review: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
};
readonly plan_review: {
readonly kind: {
readonly word: "leg_identity";
readonly earlier: {
readonly was: "decision-read";
readonly agrees: () => true;
};
};
readonly reason: {
readonly digest: "decision-read";
};
};
readonly task_done: {
readonly kind: {
readonly digest: "decision-read";
};
};
};
export type GateRequirementsCoverEveryKind = AssertAllKeysHandled<Exclude<CheckpointGate["kind"], keyof typeof CHECKPOINT_GATE_REQUIREMENTS>>;
/** The row itself: its frame, its two records and its pause pair. */
export declare const CHECKPOINT_REQUIREMENTS: {
readonly token: {
readonly digest: "decision-read";
};
readonly checkpointId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly parentSessionId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly parentTaskId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly rootSessionId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly rootSessionIncarnation: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly version: {
readonly ignorable: "the format stamp itself";
};
readonly requires: {
readonly ignorable: "the format stamp itself";
};
readonly requirementsDigest: {
readonly word: "requirements_digest";
};
readonly scope: {
readonly digest: "decision-read";
};
readonly sessionId: {
readonly digest: "decision-read";
};
readonly leafId: {
readonly digest: "decision-read";
};
readonly heldRows: {
readonly word: "held_rows";
};
readonly state: {
readonly members: {
readonly activeTools: {
readonly digest: "decision-read";
};
readonly outputRef: {
readonly digest: "decision-read";
};
readonly nestedStats: {
readonly digest: "decision-read";
};
readonly readFileState: {
readonly digest: "decision-read";
};
readonly readFace: {
readonly word: "face";
};
readonly writeFace: {
readonly word: "write_face";
};
readonly readBlock: {
readonly word: "read_block";
};
readonly skillGrants: {
readonly word: "skill_grants";
};
readonly skillScopes: {
readonly word: "skill_scopes";
};
readonly reminderMark: {
readonly digest: "decision-read";
};
readonly repairBundle: {
readonly digest: "decision-read";
};
readonly workspaceHandle: {
readonly digest: "decision-read";
};
readonly pendingSteerQueue: {
readonly mutable: "store state-machine member; integrity = CAS contract + kit, see #1580";
};
readonly runningBackgroundTasks: {
readonly digest: "decision-read";
};
readonly handsCwd: {
readonly digest: "decision-read";
};
readonly handsRoot: {
readonly word: "hands_coordinates";
};
readonly handsHome: {
readonly word: "hands_home";
};
readonly activeWorktree: {
readonly digest: "decision-read";
};
readonly inheritedGate: {
readonly members: {
readonly ancestorRules: {
readonly digest: "decision-read";
};
readonly shellGate: {
readonly digest: "decision-read";
};
readonly permissionMode: {
readonly word: "permission_mode";
};
readonly prePlanMode: {
readonly word: "plan_mode_restore";
};
readonly admittedOrgScopes: {
readonly word: "org_admission_inherited";
};
readonly ownAdmittedOrgScopes: {
readonly word: "orgAdmission";
};
readonly ownAdmittedOrgWriteScope: {
readonly word: "org_write_grant";
};
readonly orgAdmissionGoverned: {
readonly word: "org_governed";
};
readonly pathRuleAnchors: {
readonly word: "path_rule_anchors";
};
readonly pathRuleInstallations: {
readonly word: "path_rule_installations";
};
readonly persistedRuleBuckets: {
readonly word: "persisted_rule_buckets";
};
readonly requiresParentConstraint: {
readonly digest: "decision-read";
};
readonly parentConstraintCount: {
readonly digest: "decision-read";
};
readonly constraintChain: {
readonly word: "f012";
readonly elements: {
readonly kind: {
readonly word: "constraint_layer_kinds";
};
readonly rootLeg: {
readonly word: "constraint_layer_kinds";
};
};
};
readonly constraintDigest: {
readonly word: "f012";
};
};
};
readonly announcedListings: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly gitAnnouncement: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly delegationProvenance: {
readonly word: "delegation_provenance";
};
readonly isDelegatedChild: {
readonly digest: "decision-read";
};
readonly rowTaskId: {
readonly word: "row_task_id";
};
readonly legTaskId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly sourceAgentName: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly fromSubagent: {
readonly word: "from_subagent";
};
readonly workflowMember: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly placementRootSessionId: {
readonly digest: "decision-read";
};
readonly compositionLeg: {
readonly word: "composition_leg";
};
readonly externalContentTarget: {
readonly digest: "decision-read";
};
readonly legScope: {
readonly word: "leg_scope";
};
readonly runOrigin: {
readonly word: "run_origin";
};
readonly toolCeiling: {
readonly word: "tool_ceiling";
};
readonly toolListsJudged: {
readonly word: "tool_lists_judged";
};
readonly ownToolLists: {
readonly word: "own_tool_lists";
};
readonly crossBoundaryRecorded: {
readonly word: "cross_boundary";
};
readonly commandSandbox: {
readonly word: "command_sandbox";
};
readonly agentConfigDirs: {
readonly word: "agent_config_dirs";
};
readonly agentHomeDirs: {
readonly word: "agent_home_dirs";
};
readonly runLedger: {
readonly word: "run_ledger";
};
readonly legIdentity: {
readonly word: "leg_identity";
readonly elements: {
readonly ruleSessionId: {
readonly word: "rule_session";
};
};
};
};
};
readonly resourceLedger: {
readonly members: {
readonly totalBudgetMicroUsd: {
readonly digest: "decision-read";
};
readonly totalTokens: {
readonly word: "token";
};
readonly spentMicroUsd: {
readonly digest: "decision-read";
};
readonly spentTokens: {
readonly digest: "decision-read";
};
readonly spentTurns: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly spentWalltimeMs: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly sliceCount: {
readonly digest: "decision-read";
};
};
};
readonly deadline: {
readonly digest: "decision-read";
};
readonly status: {
readonly mutable: "store state-machine member; integrity = CAS contract + kit, see #1580";
};
readonly createdAt: {
readonly digest: "decision-read";
};
readonly suspendCount: {
readonly digest: "decision-read";
};
readonly suspendedAt: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly humanReview: {
readonly digest: "decision-read";
};
readonly resolvedOutcome: {
readonly mutable: "store state-machine member; integrity = CAS contract + kit, see #1580";
};
readonly reopenReason: {
readonly mutable: "store state-machine member; integrity = CAS contract + kit, see #1580";
};
readonly rev: {
readonly mutable: "store state-machine member; integrity = CAS contract + kit, see #1580";
};
readonly sourceSessionId: {
readonly word: "source_session";
};
readonly sourceTaskId: {
readonly retired: "7.61.0 renamed it sourceSessionId, with no alias";
readonly earlier: {
readonly was: "decision-read";
readonly agrees: () => false;
};
};
readonly principal: {
readonly digest: "decision-read";
};
readonly isolationScope: {
readonly word: "isolation_scope";
};
readonly durableApproval: {
readonly digest: "decision-read";
};
readonly executionOutcome: {
readonly mutable: "store state-machine member; integrity = CAS contract + kit, see #1580";
};
readonly executionAtMs: {
readonly mutable: "the store's time stamp on the execution record: it changes after the mint and decides nothing";
};
readonly gate: {
readonly variants: {
readonly human: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
readonly toolName: {
readonly digest: "decision-read";
};
readonly approvalCard: {
readonly digest: "decision-read";
};
readonly riskDescriptor: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly irreversible_ask: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
readonly toolName: {
readonly digest: "decision-read";
};
readonly approvalCard: {
readonly digest: "decision-read";
};
readonly safetyAxis: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly realApproval: {
readonly word: "realApproval";
};
readonly riskDescriptor: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly resource_limit: {
readonly kind: {
readonly word: "resource";
};
readonly reason: {
readonly digest: "decision-read";
};
readonly resumeAfterMs: {
readonly digest: "decision-read";
};
};
readonly needs_review: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
};
readonly plan_review: {
readonly kind: {
readonly word: "leg_identity";
readonly earlier: {
readonly was: "decision-read";
readonly agrees: () => true;
};
};
readonly reason: {
readonly digest: "decision-read";
};
};
readonly task_done: {
readonly kind: {
readonly digest: "decision-read";
};
};
};
};
readonly pendingAction: {
readonly variants: {
readonly tool_approval: {
readonly kind: {
readonly word: "binding";
};
readonly toolCallId: {
readonly digest: "decision-read";
};
readonly toolName: {
readonly digest: "decision-read";
};
readonly args: {
readonly digest: "decision-read";
};
readonly preview: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly previewWithheld: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly existingTarget: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly ruleOffers: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly ruleOffersAbsence: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly execCwd: {
readonly digest: "decision-read";
};
readonly commandSandbox: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly destination: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly requiresRealApproval: {
readonly digest: "decision-read";
};
readonly mandated: {
readonly word: "persisted_rule_mandate";
};
readonly authoredBy: {
readonly word: "deployment_authored";
};
readonly mandate: {
readonly digest: "decision-read";
};
readonly denialLimitFallback: {
readonly word: "denial_limit_fallback";
};
readonly classifierNoRuling: {
readonly digest: "decision-read";
};
readonly origin: {
readonly digest: "decision-read";
};
readonly askClass: {
readonly digest: "decision-read";
};
readonly classes: {
readonly digest: "decision-read";
};
readonly askReasons: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly cardMessage: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly cardAskRule: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly fromApprovalList: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly headline: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly boundInputHash: {
readonly word: "tool_binding";
readonly earlier: {
readonly was: "decision-read";
readonly agrees: () => false;
};
};
readonly boundGrantDigest: {
readonly word: "skill_card_binding";
};
readonly boundGrants: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly boundGrantAbsence: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly capabilityId: {
readonly word: "raw_name_identity";
readonly earlier: {
readonly was: "decision-read";
readonly agrees: (pending: object) => boolean;
};
};
readonly contractId: {
readonly digest: "decision-read";
};
readonly shapeDigest: {
readonly digest: "decision-read";
};
readonly implementationRevision: {
readonly digest: "decision-read";
};
readonly family: {
readonly digest: "decision-read";
};
readonly pathTarget: {
readonly digest: "decision-read";
};
readonly hostTarget: {
readonly digest: "decision-read";
};
readonly names: {
readonly word: "call_names";
};
readonly engineMounted: {
readonly word: "mount_site";
};
readonly startedShell: {
readonly word: "started_shell";
};
readonly declarationDigest: {
readonly word: "tool_declaration";
};
readonly targets: {
readonly word: "approval_targets";
};
readonly targetReads: {
readonly word: "approval_target_reads";
};
readonly hasBidiControls: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly batchToolCallIds: {
readonly digest: "decision-read";
};
readonly completedCallIds: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly resource_limit: {
readonly kind: {
readonly digest: "decision-read";
};
readonly reason: {
readonly digest: "decision-read";
};
};
readonly review: {
readonly kind: {
readonly digest: "decision-read";
};
};
readonly plan_review: {
readonly kind: {
readonly word: "binding";
};
readonly requestedByCallId: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
readonly planContentHash: {
readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
};
};
readonly task_done: {
readonly kind: {
readonly digest: "decision-read";
};
};
};
};
};
/** ONE word list: the closed set is exactly the words the tables carry — every table word is a member (each entry is
* typed against the set) and every member is carried by some entry (this fence), both at compile time. */
export type RequirementWordsAreTheTablesWords = AssertAllKeysHandled<Exclude<RequirementWord, WordsOfTable<typeof CHECKPOINT_REQUIREMENTS>>>;
/** The words a row's content carries — a word for every word member present on it — sorted, without repeats.
* The ONE derivation: the mint writes it, the resume screen recomputes it. Total (a non-record reads as none). */
export declare function checkpointRequirementsFor(cp: Checkpoint): RequirementWord[];
/** A member a decision reads whose value the digest cannot encode: where it sits, and what it holds. */
export interface UnencodableMember {
readonly path: string;
readonly kind: "cycle" | "depth" | "function" | "symbol" | "unreadable" | "codec";
}
/** The row digest: sha256 (hex) over the binding serializer's canonical form ({@link canonicalize}: type-tagged,
* sorted keys) of every member a decision reads but the digest itself, keyed by path, each read through
* {@link digestProjection}. Never a constant: a value it cannot encode throws {@link RowNotEncodable}. */
export declare function requirementsDigestOf(cp: Checkpoint): string;
/** The one stamp: the row AS THE STORE AT `fidelity` HANDS IT BACK (the commit stamps with its store's declared
* fidelity, and writes exactly the row returned here), with the frozen version, the row digest of that reading and
* the words derived from it (the digest's word among them) — so a reader digests exactly what it read. A row that
* store's codec or the digest cannot encode is returned WITHOUT a digest, so it fails its own judge — which the
* commit asks before the write.
*
* ONE ABSENCE FORM: the row's top level and its `state` are written with an absent member OMITTED — a mint site may
* spell one as a key holding `undefined` (the state serializer names every member), and the stamp leaves that key out —
* so every store holds an engine-written row with one key set, and a key-reading answers as the value-reading does. The
* members below those two levels are written as given: a tool call's arguments, a decision-read record and the
* resource ledger are data whose keys the binding hash, the digest and the park's argument comparison read.
*
* FOR A HOST-MINTED ROW (exported at the package root for it — e.g. the `task_done` wake card a serving layer files and later
* hands to the wake): stamp it here before the write, at the store's declared fidelity —
* `put(token, stampCheckpointRequirements(checkpointFrom({ ... }), resolveDeclaredFidelity(store, "checkpointStore")))`. A store's
* `put` does not stamp, and a row below the format is refused `checkpoint.unsupported_version` / `seat_retired`. As the commit
* does, judge the stamped row once before the write (`judgeCheckpointRow`): a verdict that is not `ok` means a member the store's
* fidelity does not keep or the digest cannot encode (e.g. a BigInt at `json` fidelity) — do not write it. A stamped row is the host's own word:
* the resume takes it as a row this engine parked and does not judge again the decision it stands for (a host-minted
* `tool_approval` row whose `boundInputHash` matches the call runs that call without asking `toolPolicy.check`, as an
* engine-parked approval does — minting one is the host giving that approval). Stamp only rows
* the host itself mints — never to re-date a row another engine release wrote (a re-stamped old row is admitted as a current
* one: the judgments its old format owed are not run again). After the stamp, change no member a verdict reads:
* the digest no longer matches and the row is judged damaged. */
export declare function stampCheckpointRequirements(row: Checkpoint, fidelity: StoreFidelity): Checkpoint;
/** The row as the store at `fidelity` hands it back, judged — the commit's question before the write. */
export declare function judgeAsStored(cp: Checkpoint, fidelity: StoreFidelity): CheckpointRequirementsVerdict;
/** The resume screen's reading of a row's requirement list: `ok`; `lacking` (a newer engine wrote it); `earlier` (an earlier engine
* wrote it, intact, and this engine reads one of its members differently); `damaged` (its content does not read as it was recorded). */
export type CheckpointRequirementsVerdict = {
readonly kind: "ok";
} | {
readonly kind: "lacking";
readonly words: readonly string[];
} | {
readonly kind: "earlier";
readonly why: string;
} | {
readonly kind: "damaged";
readonly why: string;
};
/**
* Judge a row's requirement list and digest against this engine and against the row's content, before the claim — every row it is
* handed read as a row of the format (v10):
* - the list must be an array of strings; a word this engine lacks ⇒ `lacking` (a newer row); the digest's word
* must be declared (every v10 mint writes it); the words this engine knows must EQUAL the recomputed words, but for a
* recomputed word an earlier engine's mint left off ({@link EarlierReading}: every member carrying it agrees on its record); the
* digest must EQUAL the recomputed digest — a lost member, a lost element, a changed value is damage.
* - ONE reading tells an earlier engine's row from a damaged one: a row whose only differences are words it carries undeclared, each
* carried only by members whose entry names the reading an earlier engine gave them, and members this engine retired
* ({@link RetiredMember}), and whose digest equals its content's under that reading (each retired member it holds back in the
* digest), is exactly the row that engine wrote ⇒ `ok` where every member read under its earlier reading agrees, else `earlier`
* (this engine reads it differently). Anything else that does not match — a word declared and not carried, a word no earlier
* reading explains, a digest that differs under both readings — is `damaged`.
* The row judge asks it only of a row at the format: one above is refused by the version ceiling, one below by the floor
* (checkpoint-row-verdict.ts). Reads `requires` and the digest once each.
*/
export declare function judgeCheckpointRequirements(cp: Checkpoint): CheckpointRequirementsVerdict;
export {};