Skip to content

planning

Defined in: packages/sage/src/planning/assembly.ts:49

Policy for assembling an unsigned transaction from one Plan.

declare const feePayer: Address;
const policy: AssemblyPolicy = { feePayer, computeUnitLimit: 400_000 };

readonly optional commitment?: Commitment;

Defined in: packages/sage/src/planning/assembly.ts:53

readonly optional computeUnitLimit?: number;

Defined in: packages/sage/src/planning/assembly.ts:51

readonly feePayer: Address;

Defined in: packages/sage/src/planning/assembly.ts:50

readonly optional priorityFeeMicroLamports?: bigint;

Defined in: packages/sage/src/planning/assembly.ts:52


Defined in: packages/sage/src/planning/execution.ts:73

A transaction confirmed at the requested commitment.

declare const result: ConfirmedPlanExecution;
console.log(result.signature, result.slot);

readonly commitment: Commitment;

Defined in: packages/sage/src/planning/execution.ts:77

readonly signature: Signature;

Defined in: packages/sage/src/planning/execution.ts:75

readonly slot: bigint;

Defined in: packages/sage/src/planning/execution.ts:76

readonly status: "confirmed";

Defined in: packages/sage/src/planning/execution.ts:74


Defined in: packages/sage/src/planning/index.ts:205

Caller-owned fields accepted by the Plan factory.

affected and requiredSigners are intentionally absent because the factory derives them from writable metas and ordered step signers.

declare const step: PlanStep;
const input: CreatePlanInput = {
kind: 'fleet.move',
summary: 'Move the fleet.',
steps: [step],
preconditions: [],
};

readonly kind: string;

Defined in: packages/sage/src/planning/index.ts:206

readonly preconditions: readonly PlanPrecondition[];

Defined in: packages/sage/src/planning/index.ts:209

readonly steps: readonly PlanStep[];

Defined in: packages/sage/src/planning/index.ts:208

readonly summary: string;

Defined in: packages/sage/src/planning/index.ts:207


Defined in: packages/sage/src/planning/plan-sequence.ts:111

Exact caller-owned input accepted by createPlanSequence.

declare const step: PlanSequenceStep;
const input: CreatePlanSequenceInput = {
cluster: 'zink-ptr',
sequenceId: 'fleet-round-trip',
revision: 0,
steps: [step],
};

readonly cluster: ClusterIdentity;

Defined in: packages/sage/src/planning/plan-sequence.ts:112

readonly revision: number;

Defined in: packages/sage/src/planning/plan-sequence.ts:114

readonly sequenceId: string;

Defined in: packages/sage/src/planning/plan-sequence.ts:113

readonly steps: readonly PlanSequenceStep[];

Defined in: packages/sage/src/planning/plan-sequence.ts:115


Defined in: packages/sage/src/planning/execution.ts:55

Options for signing, submitting, confirming, and reconciling one Plan.

import type { TransactionSigner } from '@solana/kit';
declare const feePayer: TransactionSigner;
const options: ExecutePlanOptions = { feePayer };

readonly optional commitment?: Commitment;

Defined in: packages/sage/src/planning/execution.ts:60

readonly optional computeUnitLimit?: number;

Defined in: packages/sage/src/planning/execution.ts:58

readonly feePayer: TransactionSigner;

Defined in: packages/sage/src/planning/execution.ts:56

readonly optional pollIntervalMs?: number;

Defined in: packages/sage/src/planning/execution.ts:62

readonly optional priorityFeeMicroLamports?: bigint;

Defined in: packages/sage/src/planning/execution.ts:59

readonly optional signers?: readonly TransactionSigner[];

Defined in: packages/sage/src/planning/execution.ts:57

readonly optional timeoutMs?: number;

Defined in: packages/sage/src/planning/execution.ts:61


Defined in: packages/sage/src/planning/plan-sequence-execution.ts:74

Inputs for one fail-closed PlanSequence execution or resume invocation.

The commitment is restricted to rollback-safe confirmed or finalized evidence. Cancellation is observed only between steps.

declare const feePayer: ExecutePlanSequenceOptions['feePayer'];
declare const store: PlanSequenceStore;
const options: ExecutePlanSequenceOptions = { feePayer, store };

readonly optional commitment?: "confirmed" | "finalized";

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:78

readonly optional computeUnitLimit?: number;

Defined in: packages/sage/src/planning/execution.ts:58

ExecutePlanOptions.computeUnitLimit

readonly feePayer: TransactionSigner;

Defined in: packages/sage/src/planning/execution.ts:56

ExecutePlanOptions.feePayer

readonly optional onBeforeSign?: (presentation) => Promise<void>;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:81

ParameterType
presentationPlanSequencePresentation

Promise<void>

readonly optional pollIntervalMs?: number;

Defined in: packages/sage/src/planning/execution.ts:62

ExecutePlanOptions.pollIntervalMs

readonly optional priorityFeeMicroLamports?: bigint;

Defined in: packages/sage/src/planning/execution.ts:59

ExecutePlanOptions.priorityFeeMicroLamports

readonly optional signal?: AbortSignal;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:80

readonly optional signers?: readonly TransactionSigner[];

Defined in: packages/sage/src/planning/execution.ts:57

ExecutePlanOptions.signers

readonly store: PlanSequenceStore;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:79

readonly optional timeoutMs?: number;

Defined in: packages/sage/src/planning/execution.ts:61

ExecutePlanOptions.timeoutMs


Defined in: packages/sage/src/planning/index.ts:177

Inert, inspectable action data built only through planning factories.

declare const plan: Plan;
console.log(plan.summary);
console.log(plan.describe());

readonly [PLAN_BRAND]: true;

Defined in: packages/sage/src/planning/index.ts:186

readonly affected: readonly Address[];

Defined in: packages/sage/src/planning/index.ts:182

readonly kind: string;

Defined in: packages/sage/src/planning/index.ts:178

readonly preconditions: readonly PlanPrecondition[];

Defined in: packages/sage/src/planning/index.ts:181

readonly requiredSigners: readonly Address[];

Defined in: packages/sage/src/planning/index.ts:183

readonly steps: readonly PlanStep[];

Defined in: packages/sage/src/planning/index.ts:180

readonly summary: string;

Defined in: packages/sage/src/planning/index.ts:179

describe(): readonly string[];

Defined in: packages/sage/src/planning/index.ts:184

readonly string[]

toJSON():
| PlanJsonV1
| PlanJsonV2;

Defined in: packages/sage/src/planning/index.ts:185

| PlanJsonV1 | PlanJsonV2


Defined in: packages/sage/src/planning/index.ts:101

The complete persistent wire representation of a Plan.

declare const wire: PlanJsonV1;
console.log(wire.v); // 1

readonly affected: readonly string[];

Defined in: packages/sage/src/planning/index.ts:124

readonly kind: string;

Defined in: packages/sage/src/planning/index.ts:103

readonly preconditions: readonly {
address: string;
dataHash: string;
describes: string;
kind: "account-state";
}[];

Defined in: packages/sage/src/planning/index.ts:118

readonly requiredSigners: readonly string[];

Defined in: packages/sage/src/planning/index.ts:125

readonly steps: readonly {
describes: string;
instruction: {
accounts?: readonly {
address: string;
role: AccountRole;
}[];
data?: string;
programAddress: string;
};
signers: readonly string[];
}[];

Defined in: packages/sage/src/planning/index.ts:105

readonly summary: string;

Defined in: packages/sage/src/planning/index.ts:104

readonly v: 1;

Defined in: packages/sage/src/planning/index.ts:102


Defined in: packages/sage/src/planning/index.ts:140

The version-two Plan wire representation for semantic-bearing steps.

Version two retains every version-one top-level field and adds optional normalized semantic facts to individual steps.

declare const plan: Plan;
const wire: PlanJsonV1 | PlanJsonV2 = plan.toJSON();
if (wire.v === 2) console.log(wire.steps[0]?.semantics);

readonly affected: readonly string[];

Defined in: packages/sage/src/planning/index.ts:164

readonly kind: string;

Defined in: packages/sage/src/planning/index.ts:142

readonly preconditions: readonly {
address: string;
dataHash: string;
describes: string;
kind: "account-state";
}[];

Defined in: packages/sage/src/planning/index.ts:158

readonly requiredSigners: readonly string[];

Defined in: packages/sage/src/planning/index.ts:165

readonly steps: readonly {
describes: string;
instruction: {
accounts?: readonly {
address: string;
role: AccountRole;
}[];
data?: string;
programAddress: string;
};
semantics?: readonly PlanSemanticFact[];
signers: readonly string[];
}[];

Defined in: packages/sage/src/planning/index.ts:144

readonly summary: string;

Defined in: packages/sage/src/planning/index.ts:143

readonly v: 2;

Defined in: packages/sage/src/planning/index.ts:141


Defined in: packages/sage/src/planning/index.ts:86

A closure-free whole-account freshness guard recorded at planning time.

declare const precondition: PlanPrecondition;
console.log(precondition.address, precondition.dataHash);

readonly address: Address;

Defined in: packages/sage/src/planning/index.ts:88

readonly dataHash: string;

Defined in: packages/sage/src/planning/index.ts:89

readonly describes: string;

Defined in: packages/sage/src/planning/index.ts:90

readonly kind: "account-state";

Defined in: packages/sage/src/planning/index.ts:87


Defined in: packages/sage/src/planning/plan-sequence.ts:129

Inert, immutable itinerary with cluster-bound resume identity.

describe() names stable step identities only. Each actual Plan remains lazy and must be presented separately when fresh authorization is requested.

declare const sequence: PlanSequence;
console.log(sequence.fingerprint, sequence.describe());

readonly cluster: ClusterIdentity;

Defined in: packages/sage/src/planning/plan-sequence.ts:130

readonly fingerprint: PlanSequenceFingerprint;

Defined in: packages/sage/src/planning/plan-sequence.ts:134

readonly revision: number;

Defined in: packages/sage/src/planning/plan-sequence.ts:132

readonly sequenceId: string;

Defined in: packages/sage/src/planning/plan-sequence.ts:131

readonly steps: readonly PlanSequenceStep[];

Defined in: packages/sage/src/planning/plan-sequence.ts:133

describe(): readonly string[];

Defined in: packages/sage/src/planning/plan-sequence.ts:135

readonly string[]


Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:85

Version-one caller-persisted Plan sequence checkpoint.

The value is exact-key, recursively frozen, and JSON-safe. It contains only stable sequence identity, confirmed public evidence, current write-ahead state, and caller-supplied local observation time.

declare const sequence: PlanSequence;
declare const callerOwnedStore: { save(value: string): Promise<void> };
const checkpoint: PlanSequenceCheckpointV1 = createPlanSequenceCheckpoint(
sequence,
'2026-08-28T12:00:00.000Z',
);
await callerOwnedStore.save(stringifyPlanSequenceCheckpoint(checkpoint));

readonly optional attempt?: PlanSequenceCheckpointAttemptV1;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:94

readonly cluster: ClusterIdentity;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:88

readonly confirmed: readonly PlanSequenceConfirmedStepV1[];

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:93

readonly fingerprint: PlanSequenceFingerprint;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:87

readonly nextStepIndex: number;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:92

readonly observedAt: string;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:95

readonly revision: number;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:90

readonly sequenceId: string;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:89

readonly stepIds: readonly string[];

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:91

readonly v: 1;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:86


Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:28

Persisted public confirmation evidence for one completed sequence step.

Slots use canonical unsigned decimal strings so checkpoint values remain directly JSON-serializable without losing integer precision.

declare const confirmed: PlanSequenceConfirmedStepV1;
console.log(confirmed.stepId, confirmed.slot);

readonly commitment: "confirmed" | "finalized";

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:33

readonly index: number;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:30

readonly signature: Signature;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:31

readonly slot: string;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:32

readonly stepId: string;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:29


Defined in: packages/sage/src/planning/plan-sequence-execution.ts:55

Fresh single-transaction authorization detail presented before signing.

declare const presentation: PlanSequencePresentation;
console.log(presentation.stepId, presentation.description);

readonly description: readonly string[];

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:59

readonly index: number;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:57

readonly plan: Plan;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:58

readonly stepId: string;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:56


Defined in: packages/sage/src/planning/plan-sequence.ts:93

One stable lazy step in a Plan sequence.

The callback may close over capability context. It creates no Plan until the caller reaches this step and invokes it with current progress.

declare const plan: Plan;
const step: PlanSequenceStep = {
id: 'undock',
prepare: async () => ({ status: 'ready', plan }),
};

readonly id: string;

Defined in: packages/sage/src/planning/plan-sequence.ts:94

prepare(context): Promise<PlanSequenceReadiness>;

Defined in: packages/sage/src/planning/plan-sequence.ts:95

ParameterType
contextPlanSequenceStepContext

Promise<PlanSequenceReadiness>


Defined in: packages/sage/src/planning/plan-sequence-execution.ts:43

Caller-owned durable checkpoint boundary.

Resolution of save() acknowledges that the checkpoint is durable. The SDK never signs or enters a submission boundary until the required save resolves.

const store: PlanSequenceStore = {
save: async (checkpoint) => localStorage.setItem('journey', JSON.stringify(checkpoint)),
};

save(checkpoint): Promise<void>;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:44

ParameterType
checkpointPlanSequenceCheckpointV1

Promise<void>


Defined in: packages/sage/src/planning/index.ts:71

One ordered instruction and its game-language signer requirements.

declare const step: PlanStep;
console.log(step.describes, step.signers);

readonly describes: string;

Defined in: packages/sage/src/planning/index.ts:73

readonly instruction: Instruction<string, readonly AccountMeta<string>[]>;

Defined in: packages/sage/src/planning/index.ts:72

readonly optional semantics?: readonly PlanSemanticFact[];

Defined in: packages/sage/src/planning/index.ts:74

readonly signers: readonly Address[];

Defined in: packages/sage/src/planning/index.ts:75


Defined in: packages/sage/src/planning/simulation.ts:39

Node-provenance result from simulating one unsigned Plan.

declare const result: SimulationResult;
console.log(result.slot, result.replacementBlockhash.blockhash);

readonly logs: readonly string[];

Defined in: packages/sage/src/planning/simulation.ts:42

readonly replacementBlockhash: Readonly<{
blockhash: string;
lastValidBlockHeight: bigint;
}>;

Defined in: packages/sage/src/planning/simulation.ts:44

readonly optional returnData?: SimulationReturnData;

Defined in: packages/sage/src/planning/simulation.ts:43

readonly slot: bigint;

Defined in: packages/sage/src/planning/simulation.ts:40

readonly unitsConsumed: bigint | undefined;

Defined in: packages/sage/src/planning/simulation.ts:41


Defined in: packages/sage/src/planning/simulation.ts:26

Return data emitted by the last program to set it during simulation.

declare const returnData: SimulationReturnData;
console.log(returnData.programAddress, returnData.data);

readonly data: string;

Defined in: packages/sage/src/planning/simulation.ts:28

readonly programAddress: Address;

Defined in: packages/sage/src/planning/simulation.ts:27

type ConfirmedStep = Readonly<{
commitment: "confirmed" | "finalized";
index: number;
signature: Signature;
slot: bigint;
stepId: string;
}>;

Defined in: packages/sage/src/planning/plan-sequence.ts:37

Public confirmation evidence available to later lazy step preparation.

declare const confirmed: ConfirmedStep;
console.log(confirmed.stepId, confirmed.signature);

type PlanExecutionResult =
| ConfirmedPlanExecution
| UnknownPlanExecution;

Defined in: packages/sage/src/planning/execution.ts:113

Every non-throwing terminal outcome from executePlan.

declare const result: PlanExecutionResult;
if (result.status === 'unknown') console.log(result.signature);

type PlanSemanticFact =
| {
fact: string;
kind: "requires";
resource: string;
}
| {
fact: string;
kind: "invalidates";
resource: string;
}
| {
from: string;
kind: "transition";
resource: string;
to: string;
};

Defined in: packages/sage/src/planning/index.ts:45

One capability-authored opaque fact used to review Plan composition.

The planning core preserves these exact strings without interpreting capability vocabulary or inferring negation conventions.

const fact: PlanSemanticFact = {
kind: 'requires',
resource: 'fleet:Ravager',
fact: 'idle',
};

type PlanSequenceCheckpointAttemptV1 =
| Readonly<{
index: number;
phase: "prepared";
signerMode: "observable" | "opaque";
stepId: string;
}>
| Readonly<{
index: number;
phase: "signed";
signature: Signature;
signerMode: "observable";
stepId: string;
}>
| Readonly<{
index: number;
phase: "invoking";
signerMode: "opaque";
stepId: string;
}>;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:47

One durable write-ahead attempt at the checkpoint’s next step.

Observable signers persist signed with their public signature. Opaque combined sign/send signers persist invoking before entering that boundary.

declare const attempt: PlanSequenceCheckpointAttemptV1;
console.log(attempt.stepId, attempt.phase);

type PlanSequenceErrorCode =
| "SEQUENCE_IDENTITY_MISMATCH"
| "SEQUENCE_CHECKPOINT_INVALID"
| "SEQUENCE_CONFIRMATION_UNVERIFIABLE"
| "SEQUENCE_ATTEMPT_UNRESOLVED"
| "SEQUENCE_PREPARATION_FAILED"
| "SEQUENCE_PERSISTENCE_FAILED"
| "SEQUENCE_PRESENTATION_FAILED";

Defined in: packages/sage/src/planning/plan-sequence.ts:181

Sequence-owned failure codes that never carry raw callback diagnostics.

const code: PlanSequenceErrorCode = 'SEQUENCE_PREPARATION_FAILED';

type PlanSequenceFingerprint = string & {
[PLAN_SEQUENCE_FINGERPRINT_BRAND]: true;
};

Defined in: packages/sage/src/planning/plan-sequence.ts:25

Stable SHA-256 identity for one cluster-bound ordered Plan sequence.

readonly [PLAN_SEQUENCE_FINGERPRINT_BRAND]: true;
declare const fingerprint: PlanSequenceFingerprint;
console.log(fingerprint.length); // 64

type PlanSequencePhase =
| "preparing"
| "prepared"
| "signing"
| "signed"
| "invoking"
| "submitted"
| "confirmed";

Defined in: packages/sage/src/planning/plan-sequence.ts:165

Finite lifecycle phase safe to expose in a sequence result.

const phase: PlanSequencePhase = 'preparing';

type PlanSequenceReadiness =
| Readonly<{
plan: Plan;
status: "ready";
}>
| Readonly<{
notBefore?: string;
reason: string;
status: "waiting";
}>;

Defined in: packages/sage/src/planning/plan-sequence.ts:71

Exact result of freshly preparing one sequence step.

A waiting timestamp is a canonical UTC ISO-8601 string. It is advisory; the planning core neither interprets it nor polls automatically.

declare const readiness: PlanSequenceReadiness;
if (readiness.status === 'ready') console.log(readiness.plan.describe());

type PlanSequenceResult<Checkpoint> =
| Readonly<{
checkpoint: Checkpoint;
index: number;
notBefore?: string;
phase: "preparing";
reason: string;
status: "waiting";
stepId: string;
}>
| Readonly<{
checkpoint: Checkpoint;
index: number;
phase: "preparing" | "confirmed";
status: "paused";
stepId: string;
}>
| Readonly<{
checkpoint: Checkpoint;
code: PlanSequenceResultCode;
index: number;
message: string;
phase: "preparing" | "prepared" | "signing";
status: "failed";
stepId: string;
}>
| Readonly<{
checkpoint: Checkpoint;
code: "SEQUENCE_PERSISTENCE_FAILED";
index: number;
message: string;
phase: "signed";
signature: Signature;
status: "failed";
stepId: string;
}>
| Readonly<{
checkpoint: Checkpoint;
code: PlanSequenceResultCode;
index: number;
message: string;
phase: "signed" | "invoking" | "submitted";
signature?: Signature;
status: "unknown";
stepId: string;
}>
| Readonly<{
checkpoint: Checkpoint;
index: number;
phase: "confirmed";
signature?: Signature;
status: "completed";
stepId: string;
}>;

Defined in: packages/sage/src/planning/plan-sequence.ts:216

Finite safe result envelope for future checkpoint-backed coordination.

The checkpoint codec supplies the generic checkpoint value. Raw errors, signers, transactions, blockhashes, and callback values are never fields. A boundary pause is preparing before the first step or confirmed after a completed step. If saving an observable signed attempt fails before submission, the result remains a signature-bearing failed outcome.

Type ParameterDefault type
Checkpointunknown
declare const result: PlanSequenceResult<{ readonly v: 1 }>;
if (result.status === 'failed') console.log(result.code, result.message);

type PlanSequenceResultCode =
| PlanSequenceErrorCode
| SageSdkErrorCode;

Defined in: packages/sage/src/planning/plan-sequence.ts:200

Finite error code carried by a failed or unknown sequence result.

Existing planning and execution errors retain their public SDK code; errors crossing callback or persistence boundaries use a sequence-owned code.

const code: PlanSequenceResultCode = 'INVALID_ACTION_INPUT';

type PlanSequenceStatus = "waiting" | "paused" | "failed" | "unknown" | "completed";

Defined in: packages/sage/src/planning/plan-sequence.ts:155

Every public sequence coordination status.

completed is the only successful terminal status.

const status: PlanSequenceStatus = 'waiting';

type PlanSequenceStepContext = Readonly<{
confirmed: readonly ConfirmedStep[];
index: number;
sequenceId: string;
stepId: string;
}>;

Defined in: packages/sage/src/planning/plan-sequence.ts:53

Stable sequence progress supplied to one capability-owned step callback.

declare const context: PlanSequenceStepContext;
console.log(context.sequenceId, context.stepId, context.confirmed.length);

type UnknownPlanExecution =
| Readonly<{
lastCheckedBlockHeight: bigint;
lastValidBlockHeight: bigint | null;
reason: "timeout";
signature: Signature;
status: "unknown";
}>
| Readonly<{
lastCheckedBlockHeight: bigint | null;
lastValidBlockHeight: bigint | null;
operation: "submission" | "signature-status" | "block-height";
reason: "transport-error";
signature: Signature;
status: "unknown";
}>;

Defined in: packages/sage/src/planning/execution.ts:88

A submitted transaction whose terminal state remains unknown.

declare const result: UnknownPlanExecution;
console.log(result.signature, result.lastValidBlockHeight);

function assemblePlan(
context,
plan,
policy): Promise<Readonly<{
messageBytes: TransactionMessageBytes;
signatures: SignaturesMap;
}> & TransactionWithBlockhashLifetime>;

Defined in: packages/sage/src/planning/assembly.ts:244

Assembles one Plan into an unsigned blockhash-lifetime transaction.

Assembly validates compute and priority-fee policy before RPC, fetches one latest blockhash, and never signs, simulates, or submits the transaction.

ParameterType
contextSageContext
planPlan
policyAssemblyPolicy

Promise<Readonly<{ messageBytes: TransactionMessageBytes; signatures: SignaturesMap; }> & TransactionWithBlockhashLifetime>

declare const ctx: SageContext;
declare const plan: Plan;
declare const feePayer: Address;
const transaction = await assemblePlan(ctx, plan, { feePayer });

function combinePlans(...plans): Plan;

Defined in: packages/sage/src/planning/index.ts:734

Combines one or more Plans with deterministic associative flattening.

Semantic validation is eager. Conflict indices are relative to the flattened inputs of the combinePlans call that rejects them.

ParameterType
plansreadonly Plan[]

Plan

declare const undock: Plan;
declare const warp: Plan;
const movement = combinePlans(undock, warp);
console.log(movement.summary);

function confirmPlanSequenceCheckpointStep(
checkpoint,
evidence,
observedAt): PlanSequenceCheckpointV1;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:717

Appends public confirmation evidence and advances exactly one sequence step.

A step can advance only from its matching durable signed or invoking attempt. The attempt is cleared in the returned checkpoint.

ParameterType
checkpointPlanSequenceCheckpointV1
evidenceConfirmedStep
observedAtstring

PlanSequenceCheckpointV1

declare const checkpoint: PlanSequenceCheckpointV1;
declare const confirmed: ConfirmedStep;
const advanced = confirmPlanSequenceCheckpointStep(
checkpoint,
confirmed,
'2026-08-28T12:00:00.000Z',
);

function createPlan(input): Plan;

Defined in: packages/sage/src/planning/index.ts:530

Creates an inert branded Plan while deriving every aggregate field.

ParameterType
inputCreatePlanInput

Plan

declare const step: PlanStep;
const plan = createPlan({
kind: 'fleet.move',
summary: 'Move the fleet.',
steps: [step],
preconditions: [],
});
console.log(plan.affected);

function createPlanSequence(input): Promise<PlanSequence>;

Defined in: packages/sage/src/planning/plan-sequence.ts:571

Creates an inert Plan sequence and its canonical cluster-bound fingerprint.

Construction invokes no step callback and performs no context, wallet, signer, or network work. The only asynchronous operation is WebCrypto SHA-256 over the accepted canonical identity bytes.

ParameterType
inputCreatePlanSequenceInput

Promise<PlanSequence>

declare const step: PlanSequenceStep;
const sequence = await createPlanSequence({
cluster: 'zink-ptr',
sequenceId: 'fleet-round-trip',
revision: 0,
steps: [step],
});
console.log(sequence.fingerprint);

function createPlanSequenceCheckpoint(sequence, observedAt): PlanSequenceCheckpointV1;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:508

Creates an empty checkpoint bound to one exact Plan sequence.

ParameterType
sequencePlanSequence
observedAtstring

PlanSequenceCheckpointV1

declare const sequence: PlanSequence;
const checkpoint = createPlanSequenceCheckpoint(
sequence,
'2026-08-28T12:00:00.000Z',
);
console.log(checkpoint.nextStepIndex); // 0

function executePlan(
context,
plan,
options): Promise<PlanExecutionResult>;

Defined in: packages/sage/src/planning/execution.ts:891

Executes one Plan through local signer matching, freshness re-check, one submission, terminal confirmation, and confirmed-only cache invalidation.

ParameterType
contextSageContext
planPlan
optionsExecutePlanOptions

Promise<PlanExecutionResult>

import type { TransactionSigner } from '@solana/kit';
declare const ctx: SageContext;
declare const plan: Plan;
declare const feePayer: TransactionSigner;
const result = await executePlan(ctx, plan, { feePayer });
console.log(result.status, result.signature);

function executePlanSequence(
context,
sequence,
checkpointSource,
options): Promise<SequenceResult>;

Defined in: packages/sage/src/planning/plan-sequence-execution.ts:345

Executes or resumes one PlanSequence invocation without polling or retrying.

The checkpoint may be an SDK-created object, caller-owned decoded JSON, or a JSON string. It is strictly parsed against the exact sequence before any RPC, preparation, presentation, or signer work begins.

ParameterType
contextSageContext
sequencePlanSequence
checkpointSourceunknown
optionsExecutePlanSequenceOptions

Promise<SequenceResult>

declare const ctx: SageContext;
declare const sequence: PlanSequence;
declare const checkpointJson: string;
declare const options: ExecutePlanSequenceOptions;
const result = await executePlanSequence(ctx, sequence, checkpointJson, options);
console.log(result.status, result.checkpoint.nextStepIndex);

function parsePlanSequenceCheckpoint(sequence, source): PlanSequenceCheckpointV1;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:537

Parses and validates a checkpoint against one exact Plan sequence.

The source may be a JSON string or a caller-owned parsed JSON value.

ParameterType
sequencePlanSequence
sourceunknown

PlanSequenceCheckpointV1

declare const sequence: PlanSequence;
declare const storedJson: string;
const checkpoint = parsePlanSequenceCheckpoint(sequence, storedJson);
console.log(checkpoint.nextStepIndex);

function planFromJSON(json): Plan;

Defined in: packages/sage/src/planning/index.ts:614

Rehydrates and validates a complete versioned Plan wire value.

ParameterType
jsonunknown

Plan

declare const wire: PlanJsonV1 | PlanJsonV2;
const plan = planFromJSON(wire);
console.log(plan.describe());

function setPlanSequenceCheckpointAttempt(
checkpoint,
attempt,
observedAt): PlanSequenceCheckpointV1;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:649

Replaces the current write-ahead attempt without advancing sequence progress.

The first attempt must be prepared. An observable attempt may then become signed; an opaque attempt may become invoking.

ParameterType
checkpointPlanSequenceCheckpointV1
attemptPlanSequenceCheckpointAttemptV1
observedAtstring

PlanSequenceCheckpointV1

declare const checkpoint: PlanSequenceCheckpointV1;
const prepared = setPlanSequenceCheckpointAttempt(
checkpoint,
{
stepId: checkpoint.stepIds[checkpoint.nextStepIndex]!,
index: checkpoint.nextStepIndex,
phase: 'prepared',
signerMode: 'observable',
},
'2026-08-28T12:00:00.000Z',
);

function simulatePlan(
context,
plan,
policy): Promise<SimulationResult>;

Defined in: packages/sage/src/planning/simulation.ts:84

Simulates one Plan without receiving or invoking a signer.

The same assembly policy used for execution produces the unsigned transaction. The node replaces its recent blockhash and verifies no signatures.

ParameterType
contextSageContext
planPlan
policyAssemblyPolicy

Promise<SimulationResult>

declare const ctx: SageContext;
declare const plan: Plan;
declare const feePayer: Address;
const result = await simulatePlan(ctx, plan, { feePayer });
console.log(result.logs, result.unitsConsumed);

function stringifyPlanSequenceCheckpoint(checkpoint): string;

Defined in: packages/sage/src/planning/plan-sequence-checkpoint.ts:801

Serializes one SDK-created checkpoint to canonical compact JSON.

ParameterType
checkpointPlanSequenceCheckpointV1

string

declare const checkpoint: PlanSequenceCheckpointV1;
declare const callerOwnedStore: { save(value: string): Promise<void> };
const storedJson = stringifyPlanSequenceCheckpoint(checkpoint);
await callerOwnedStore.save(storedJson);