@astrale-os/kernel-core 1.0.0-beta.3 → 1.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/schema/callables/execution.d.ts +300 -0
  2. package/dist/schema/callables/function.js +2 -1
  3. package/dist/schema/kernel/schema.d.ts +505 -87
  4. package/dist/schema/kernel/syscalls/contracts/execution.d.ts +241 -1
  5. package/dist/schema/kernel/syscalls/contracts/execution.js +77 -7
  6. package/dist/schema/kernel/syscalls/contracts/index.d.ts +2 -2
  7. package/dist/schema/kernel/syscalls/contracts/index.js +2 -2
  8. package/dist/schema/kernel/syscalls/contracts/install.d.ts +160 -0
  9. package/dist/schema/kernel/syscalls/contracts/install.js +48 -2
  10. package/dist/schema/kernel/syscalls/contracts/installation.d.ts +5 -0
  11. package/dist/schema/kernel/syscalls/contracts/installation.js +1 -1
  12. package/dist/schema/kernel/syscalls/contracts/query.d.ts +7 -0
  13. package/dist/schema/kernel/syscalls/contracts/query.js +8 -1
  14. package/dist/schema/kernel/syscalls/contracts/uninstall.d.ts +1 -0
  15. package/dist/schema/kernel/syscalls/contracts/uninstall.js +1 -0
  16. package/dist/schema/kernel/syscalls/declarations/execution.d.ts +150 -0
  17. package/dist/schema/kernel/syscalls/declarations/index.d.ts +212 -3
  18. package/dist/schema/kernel/syscalls/declarations/install.d.ts +58 -2
  19. package/dist/schema/kernel/syscalls/declarations/install.js +6 -4
  20. package/dist/schema/kernel/syscalls/declarations/query.d.ts +1 -0
  21. package/dist/schema/kernel/syscalls/declarations/uninstall.d.ts +3 -1
  22. package/dist/schema/kernel/syscalls/declarations/uninstall.js +2 -0
  23. package/dist/schema/kernel/syscalls/descriptors/execution.d.ts +150 -0
  24. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { type InstallClass, type InstallMode, type ValidationOptions } from './install.js';
1
2
  /** Terminal outcome of one durable call; a handler failure is an outcome, not a call error. */
2
3
  export declare const executionOutcome: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
3
4
  kind: import("zod").ZodLiteral<"completed">;
@@ -13,7 +14,102 @@ export declare const executionOutcome: import("zod").ZodUnion<readonly [import("
13
14
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
14
15
  kind: import("zod").ZodLiteral<"cancelled">;
15
16
  }, import("zod/v4/core").$strict>]>;
16
- export declare const executionStatus: import("zod").ZodObject<{
17
+ /**
18
+ * The steps a system execution reports as its `phase`: an install classifies, validates and
19
+ * activates; a repair session drains, awaits a command, attempts and activates; each ends
20
+ * `completed`, `rejected` or `cancelled`.
21
+ */
22
+ export declare const SYSTEM_EXECUTION_PHASES: readonly ["classifying", "validating", "activating", "draining", "awaiting", "attempting", "completed", "rejected", "cancelled"];
23
+ /** Continuity interruptions a validation survives before it ends. */
24
+ export declare const MAXIMUM_VALIDATION_INTERRUPTIONS = 3;
25
+ /**
26
+ * What a system execution shows beside its engine state, as the Runtime writes it and the Client
27
+ * reads it. `phase` is its own step; every other member is present only where it applies: the
28
+ * install's class, mode and validation options, the validation progress the store keeps, and for a
29
+ * repair session the admission it holds the Instance in, the `n` of the `command:<n>` signal it
30
+ * awaits and, while that wait is bounded, when it expires, the attempt running now, which the
31
+ * `abort:<number>` signal stops, and the last attempt that ended without activating, with its
32
+ * report. `uncertified` is the break-glass mark the Instance carries, shown on a live execution
33
+ * and on the session the mark names.
34
+ */
35
+ export declare const systemExecutionDetail: import("zod").ZodObject<{
36
+ phase: import("zod").ZodEnum<{
37
+ activating: "activating";
38
+ attempting: "attempting";
39
+ awaiting: "awaiting";
40
+ cancelled: "cancelled";
41
+ classifying: "classifying";
42
+ completed: "completed";
43
+ draining: "draining";
44
+ rejected: "rejected";
45
+ validating: "validating";
46
+ }>;
47
+ class: import("zod").ZodOptional<import("zod").ZodEnum<{
48
+ immediate: "immediate";
49
+ noop: "noop";
50
+ revalidate: "revalidate";
51
+ }>>;
52
+ mode: import("zod").ZodOptional<import("zod").ZodEnum<{
53
+ maintenance: "maintenance";
54
+ online: "online";
55
+ }>>;
56
+ validation: import("zod").ZodOptional<import("zod").ZodObject<{
57
+ scope: import("zod").ZodEnum<{
58
+ full: "full";
59
+ incremental: "incremental";
60
+ }>;
61
+ counts: import("zod").ZodEnum<{
62
+ exact: "exact";
63
+ sample: "sample";
64
+ }>;
65
+ }, import("zod/v4/core").$strict>>;
66
+ progress: import("zod").ZodOptional<import("zod").ZodObject<{
67
+ pages: import("zod").ZodNumber;
68
+ interruptions: import("zod").ZodNumber;
69
+ }, import("zod/v4/core").$strict>>;
70
+ instance: import("zod").ZodOptional<import("zod").ZodEnum<{
71
+ attempt: "attempt";
72
+ draining: "draining";
73
+ open: "open";
74
+ repair: "repair";
75
+ }>>;
76
+ command: import("zod").ZodOptional<import("zod").ZodNumber>;
77
+ expires: import("zod").ZodOptional<import("zod").ZodNumber>;
78
+ attempt: import("zod").ZodOptional<import("zod").ZodObject<{
79
+ number: import("zod").ZodNumber;
80
+ destination: import("zod").ZodEnum<{
81
+ previous: "previous";
82
+ target: "target";
83
+ }>;
84
+ }, import("zod/v4/core").$strict>>;
85
+ report: import("zod").ZodOptional<import("zod").ZodObject<{
86
+ attempt: import("zod").ZodNumber;
87
+ destination: import("zod").ZodEnum<{
88
+ previous: "previous";
89
+ target: "target";
90
+ }>;
91
+ result: import("zod").ZodEnum<{
92
+ aborted: "aborted";
93
+ interrupted: "interrupted";
94
+ "migration-required": "migration-required";
95
+ }>;
96
+ reason: import("zod").ZodOptional<import("zod").ZodString>;
97
+ summary: import("zod").ZodOptional<import("zod").ZodUnknown>;
98
+ }, import("zod/v4/core").$strict>>;
99
+ uncertified: import("zod").ZodOptional<import("zod").ZodObject<{
100
+ since: import("zod").ZodNumber;
101
+ session: import("zod").ZodOptional<import("zod").ZodString>;
102
+ operator: import("zod").ZodOptional<import("zod").ZodString>;
103
+ reason: import("zod").ZodOptional<import("zod").ZodString>;
104
+ }, import("zod/v4/core").$strict>>;
105
+ }, import("zod/v4/core").$strict>;
106
+ /**
107
+ * The status of one Execution: the engine state of one whose node exists, `detail` present on a
108
+ * system execution only; or, for Root alone, the state `deleted` of a system execution whose node
109
+ * was deleted, with the outcome its lifecycle record keeps for ever, so that it is never read as a
110
+ * live run.
111
+ */
112
+ export declare const executionStatus: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
17
113
  id: import("zod").ZodString;
18
114
  function: import("zod").ZodString;
19
115
  version: import("zod").ZodString;
@@ -28,6 +124,77 @@ export declare const executionStatus: import("zod").ZodObject<{
28
124
  waiting: "waiting";
29
125
  }>;
30
126
  createdAt: import("zod").ZodString;
127
+ detail: import("zod").ZodOptional<import("zod").ZodObject<{
128
+ phase: import("zod").ZodEnum<{
129
+ activating: "activating";
130
+ attempting: "attempting";
131
+ awaiting: "awaiting";
132
+ cancelled: "cancelled";
133
+ classifying: "classifying";
134
+ completed: "completed";
135
+ draining: "draining";
136
+ rejected: "rejected";
137
+ validating: "validating";
138
+ }>;
139
+ class: import("zod").ZodOptional<import("zod").ZodEnum<{
140
+ immediate: "immediate";
141
+ noop: "noop";
142
+ revalidate: "revalidate";
143
+ }>>;
144
+ mode: import("zod").ZodOptional<import("zod").ZodEnum<{
145
+ maintenance: "maintenance";
146
+ online: "online";
147
+ }>>;
148
+ validation: import("zod").ZodOptional<import("zod").ZodObject<{
149
+ scope: import("zod").ZodEnum<{
150
+ full: "full";
151
+ incremental: "incremental";
152
+ }>;
153
+ counts: import("zod").ZodEnum<{
154
+ exact: "exact";
155
+ sample: "sample";
156
+ }>;
157
+ }, import("zod/v4/core").$strict>>;
158
+ progress: import("zod").ZodOptional<import("zod").ZodObject<{
159
+ pages: import("zod").ZodNumber;
160
+ interruptions: import("zod").ZodNumber;
161
+ }, import("zod/v4/core").$strict>>;
162
+ instance: import("zod").ZodOptional<import("zod").ZodEnum<{
163
+ attempt: "attempt";
164
+ draining: "draining";
165
+ open: "open";
166
+ repair: "repair";
167
+ }>>;
168
+ command: import("zod").ZodOptional<import("zod").ZodNumber>;
169
+ expires: import("zod").ZodOptional<import("zod").ZodNumber>;
170
+ attempt: import("zod").ZodOptional<import("zod").ZodObject<{
171
+ number: import("zod").ZodNumber;
172
+ destination: import("zod").ZodEnum<{
173
+ previous: "previous";
174
+ target: "target";
175
+ }>;
176
+ }, import("zod/v4/core").$strict>>;
177
+ report: import("zod").ZodOptional<import("zod").ZodObject<{
178
+ attempt: import("zod").ZodNumber;
179
+ destination: import("zod").ZodEnum<{
180
+ previous: "previous";
181
+ target: "target";
182
+ }>;
183
+ result: import("zod").ZodEnum<{
184
+ aborted: "aborted";
185
+ interrupted: "interrupted";
186
+ "migration-required": "migration-required";
187
+ }>;
188
+ reason: import("zod").ZodOptional<import("zod").ZodString>;
189
+ summary: import("zod").ZodOptional<import("zod").ZodUnknown>;
190
+ }, import("zod/v4/core").$strict>>;
191
+ uncertified: import("zod").ZodOptional<import("zod").ZodObject<{
192
+ since: import("zod").ZodNumber;
193
+ session: import("zod").ZodOptional<import("zod").ZodString>;
194
+ operator: import("zod").ZodOptional<import("zod").ZodString>;
195
+ reason: import("zod").ZodOptional<import("zod").ZodString>;
196
+ }, import("zod/v4/core").$strict>>;
197
+ }, import("zod/v4/core").$strict>>;
31
198
  outcome: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
32
199
  kind: import("zod").ZodLiteral<"completed">;
33
200
  value: import("zod").ZodUnknown;
@@ -42,6 +209,27 @@ export declare const executionStatus: import("zod").ZodObject<{
42
209
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
43
210
  kind: import("zod").ZodLiteral<"cancelled">;
44
211
  }, import("zod/v4/core").$strict>]>>;
212
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
213
+ id: import("zod").ZodString;
214
+ state: import("zod").ZodLiteral<"deleted">;
215
+ outcome: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
216
+ kind: import("zod").ZodLiteral<"completed">;
217
+ value: import("zod").ZodUnknown;
218
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
219
+ kind: import("zod").ZodLiteral<"failed">;
220
+ error: import("zod").ZodObject<{
221
+ code: import("zod").ZodString;
222
+ message: import("zod").ZodString;
223
+ family: import("zod").ZodOptional<import("zod").ZodString>;
224
+ details: import("zod").ZodOptional<import("zod").ZodUnknown>;
225
+ }, import("zod/v4/core").$strict>;
226
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
227
+ kind: import("zod").ZodLiteral<"cancelled">;
228
+ }, import("zod/v4/core").$strict>]>;
229
+ }, import("zod/v4/core").$strict>]>;
230
+ /** What a durable call answers at once: the Execution it created or recovered. */
231
+ export declare const executionRef: import("zod").ZodObject<{
232
+ id: import("zod").ZodString;
45
233
  }, import("zod/v4/core").$strict>;
46
234
  export declare const executionStatusInput: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
47
235
  export declare const executionResultInput: import("zod").ZodObject<{
@@ -58,3 +246,55 @@ export declare const executionSignalOutput: import("zod").ZodObject<{}, import("
58
246
  export declare const executionResumeInput: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
59
247
  export declare const executionDeleteInput: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
60
248
  export declare const executionDeleteOutput: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
249
+ export type SystemExecutionPhase = (typeof SYSTEM_EXECUTION_PHASES)[number];
250
+ /** One attempt of a repair session that ended without activating its destination. */
251
+ export interface AttemptReport {
252
+ readonly attempt: number;
253
+ /** `target` for an `apply`, `previous` for a cooperative cancel or an idle expiry. */
254
+ readonly destination: 'target' | 'previous';
255
+ readonly result: 'migration-required' | 'interrupted' | 'aborted';
256
+ /** The public failure code that interrupted it. */
257
+ readonly reason?: string;
258
+ /** The public migration report of a refuted attempt, versioned by its owner. */
259
+ readonly summary?: unknown;
260
+ }
261
+ /** The detail of a system execution's status; see `systemExecutionDetail`. */
262
+ export interface SystemExecutionDetail {
263
+ readonly phase: SystemExecutionPhase;
264
+ readonly class?: InstallClass;
265
+ readonly mode?: InstallMode;
266
+ readonly validation?: ValidationOptions;
267
+ /** Pages validated so far, and continuity interruptions of at most three. */
268
+ readonly progress?: {
269
+ readonly pages: number;
270
+ readonly interruptions: number;
271
+ };
272
+ /** The admission a repair session holds the Instance in. */
273
+ readonly instance?: 'open' | 'draining' | 'repair' | 'attempt';
274
+ /** The `n` of the `command:<n>` signal a waiting session awaits. */
275
+ readonly command?: number;
276
+ /**
277
+ * When a waiting session's idle bound passes (epoch milliseconds): without a command by then, it
278
+ * tries to return to its source. Absent once an idle return was refuted: it then waits for Root.
279
+ */
280
+ readonly expires?: number;
281
+ /** The attempt running now; the `abort:<number>` signal stops it. */
282
+ readonly attempt?: {
283
+ readonly number: number;
284
+ readonly destination: 'target' | 'previous';
285
+ };
286
+ /** The last attempt that ended without activating. */
287
+ readonly report?: AttemptReport;
288
+ /** The break-glass mark the Instance carries: no certificate covers its stored facts. */
289
+ readonly uncertified?: UncertifiedMark;
290
+ }
291
+ /**
292
+ * The mark a break-glass exit leaves on the Instance until a `full` validation commits: when it
293
+ * was set (epoch milliseconds), the session it closed, and the operator and reason the Host named.
294
+ */
295
+ export interface UncertifiedMark {
296
+ readonly since: number;
297
+ readonly session?: string;
298
+ readonly operator?: string;
299
+ readonly reason?: string;
300
+ }
@@ -1,5 +1,6 @@
1
1
  import { fullMatch } from '@astrale-os/kernel-dsl/v1/value/full-match';
2
2
  import { boolean, enum as enumeration, literal, number, strictObject, string, union, unknown as unknownSchema, } from 'zod';
3
+ import { INSTALL_CLASSES, INSTALL_MODES, validationOptions, } from './install.js';
3
4
  const nodeId = string().min(1).max(255).check(fullMatch('[A-Za-z0-9._-]+'));
4
5
  const empty = strictObject({});
5
6
  /** Engine-observed state; never persisted on the Execution. */
@@ -25,14 +26,83 @@ export const executionOutcome = union([
25
26
  strictObject({ kind: literal('failed'), error: failure }),
26
27
  strictObject({ kind: literal('cancelled') }),
27
28
  ]);
28
- export const executionStatus = strictObject({
29
- id: nodeId,
30
- function: nodeId,
31
- version: string().check(fullMatch('sha256:[0-9a-f]{64}')),
32
- state,
33
- createdAt: string().min(1),
34
- outcome: executionOutcome.optional(),
29
+ /**
30
+ * The steps a system execution reports as its `phase`: an install classifies, validates and
31
+ * activates; a repair session drains, awaits a command, attempts and activates; each ends
32
+ * `completed`, `rejected` or `cancelled`.
33
+ */
34
+ export const SYSTEM_EXECUTION_PHASES = Object.freeze([
35
+ 'classifying',
36
+ 'validating',
37
+ 'activating',
38
+ 'draining',
39
+ 'awaiting',
40
+ 'attempting',
41
+ 'completed',
42
+ 'rejected',
43
+ 'cancelled',
44
+ ]);
45
+ /** Continuity interruptions a validation survives before it ends. */
46
+ export const MAXIMUM_VALIDATION_INTERRUPTIONS = 3;
47
+ const destination = enumeration(['target', 'previous']);
48
+ const ordinal = number().int().min(1);
49
+ /**
50
+ * What a system execution shows beside its engine state, as the Runtime writes it and the Client
51
+ * reads it. `phase` is its own step; every other member is present only where it applies: the
52
+ * install's class, mode and validation options, the validation progress the store keeps, and for a
53
+ * repair session the admission it holds the Instance in, the `n` of the `command:<n>` signal it
54
+ * awaits and, while that wait is bounded, when it expires, the attempt running now, which the
55
+ * `abort:<number>` signal stops, and the last attempt that ended without activating, with its
56
+ * report. `uncertified` is the break-glass mark the Instance carries, shown on a live execution
57
+ * and on the session the mark names.
58
+ */
59
+ export const systemExecutionDetail = strictObject({
60
+ phase: enumeration(SYSTEM_EXECUTION_PHASES),
61
+ class: enumeration(INSTALL_CLASSES).optional(),
62
+ mode: enumeration(INSTALL_MODES).optional(),
63
+ validation: validationOptions.optional(),
64
+ progress: strictObject({
65
+ pages: number().int().min(0),
66
+ interruptions: number().int().min(0).max(MAXIMUM_VALIDATION_INTERRUPTIONS),
67
+ }).optional(),
68
+ instance: enumeration(['open', 'draining', 'repair', 'attempt']).optional(),
69
+ command: ordinal.optional(),
70
+ expires: number().int().min(0).optional(),
71
+ attempt: strictObject({ number: ordinal, destination }).optional(),
72
+ report: strictObject({
73
+ attempt: ordinal,
74
+ destination,
75
+ result: enumeration(['migration-required', 'interrupted', 'aborted']),
76
+ reason: string().check(fullMatch('[A-Z][A-Z0-9_]{0,63}')).optional(),
77
+ summary: unknownSchema().optional(),
78
+ }).optional(),
79
+ uncertified: strictObject({
80
+ since: number().int().min(0),
81
+ session: nodeId.optional(),
82
+ operator: string().min(1).max(64).optional(),
83
+ reason: string().min(1).max(256).optional(),
84
+ }).optional(),
35
85
  });
86
+ /**
87
+ * The status of one Execution: the engine state of one whose node exists, `detail` present on a
88
+ * system execution only; or, for Root alone, the state `deleted` of a system execution whose node
89
+ * was deleted, with the outcome its lifecycle record keeps for ever, so that it is never read as a
90
+ * live run.
91
+ */
92
+ export const executionStatus = union([
93
+ strictObject({
94
+ id: nodeId,
95
+ function: nodeId,
96
+ version: string().check(fullMatch('sha256:[0-9a-f]{64}')),
97
+ state,
98
+ createdAt: string().min(1),
99
+ detail: systemExecutionDetail.optional(),
100
+ outcome: executionOutcome.optional(),
101
+ }),
102
+ strictObject({ id: nodeId, state: literal('deleted'), outcome: executionOutcome }),
103
+ ]);
104
+ /** What a durable call answers at once: the Execution it created or recovered. */
105
+ export const executionRef = strictObject({ id: nodeId });
36
106
  export const executionStatusInput = empty;
37
107
  export const executionResultInput = strictObject({ waitMs: number().int().min(0).optional() });
38
108
  export const executionCancelInput = strictObject({ force: boolean().optional() });
@@ -2,8 +2,8 @@ export { admitInput, admitOutput } from './admit.js';
2
2
  export { blobSlot, DOWNLOAD_PARTS_MEDIA_TYPE, downloadInput, MAXIMUM_BLOB_BYTES, MAXIMUM_DOWNLOAD_SLOTS, uploadInput, uploadOutput, } from './blob.js';
3
3
  export { MAXIMUM_CHECKS, canInput, canOutput } from './can.js';
4
4
  export { delegateInput, delegateOutput } from './delegate.js';
5
- export { executionCancelInput, executionDeleteInput, executionDeleteOutput, executionOutcome, executionResultInput, executionResumeInput, executionSignalInput, executionSignalOutput, executionStatus, executionStatusInput, } from './execution.js';
6
- export { installInput, installReceipt, type DomainRequest, type InstallInput, type InstallReceipt, } from './install.js';
5
+ export { executionCancelInput, executionDeleteInput, executionDeleteOutput, executionOutcome, executionRef, executionResultInput, executionResumeInput, executionSignalInput, executionSignalOutput, executionStatus, executionStatusInput, MAXIMUM_VALIDATION_INTERRUPTIONS, SYSTEM_EXECUTION_PHASES, systemExecutionDetail, type AttemptReport, type SystemExecutionDetail, type SystemExecutionPhase, type UncertifiedMark, } from './execution.js';
6
+ export { abortSignal, commandSignal, INSTALL_CLASSES, INSTALL_MODES, installInput, installOutput, installReceipt, installSessionAbort, installSessionCommand, validationOptions, type DomainRequest, type InstallClass, type InstallInput, type InstallMode, type InstallOutput, type InstallReceipt, type InstallSessionAbort, type InstallSessionCommand, type InstallValidation, type ValidationOptions, } from './install.js';
7
7
  export { introspectInput } from './introspect.js';
8
8
  export { journalInput, journalOutput } from './journal.js';
9
9
  export { impersonateInput, impersonateOutput } from './impersonate.js';
@@ -2,8 +2,8 @@ export { admitInput, admitOutput } from './admit.js';
2
2
  export { blobSlot, DOWNLOAD_PARTS_MEDIA_TYPE, downloadInput, MAXIMUM_BLOB_BYTES, MAXIMUM_DOWNLOAD_SLOTS, uploadInput, uploadOutput, } from './blob.js';
3
3
  export { MAXIMUM_CHECKS, canInput, canOutput } from './can.js';
4
4
  export { delegateInput, delegateOutput } from './delegate.js';
5
- export { executionCancelInput, executionDeleteInput, executionDeleteOutput, executionOutcome, executionResultInput, executionResumeInput, executionSignalInput, executionSignalOutput, executionStatus, executionStatusInput, } from './execution.js';
6
- export { installInput, installReceipt, } from './install.js';
5
+ export { executionCancelInput, executionDeleteInput, executionDeleteOutput, executionOutcome, executionRef, executionResultInput, executionResumeInput, executionSignalInput, executionSignalOutput, executionStatus, executionStatusInput, MAXIMUM_VALIDATION_INTERRUPTIONS, SYSTEM_EXECUTION_PHASES, systemExecutionDetail, } from './execution.js';
6
+ export { abortSignal, commandSignal, INSTALL_CLASSES, INSTALL_MODES, installInput, installOutput, installReceipt, installSessionAbort, installSessionCommand, validationOptions, } from './install.js';
7
7
  export { introspectInput } from './introspect.js';
8
8
  export { journalInput, journalOutput } from './journal.js';
9
9
  export { impersonateInput, impersonateOutput } from './impersonate.js';
@@ -1,4 +1,27 @@
1
1
  import type { OperationId } from '../../../installation/operation-id.js';
2
+ /**
3
+ * What an install does to the stored data: nothing changes (`noop`), it applies at once without
4
+ * reading the data (`immediate`), or it revalidates the data before it applies (`revalidate`).
5
+ */
6
+ export declare const INSTALL_CLASSES: readonly ["noop", "immediate", "revalidate"];
7
+ /**
8
+ * How an install runs. `online` (the default) keeps the Instance open: it validates online and
9
+ * only its activation briefly pauses writes. `maintenance`, for Root only, opens a maintenance
10
+ * session: the Instance is closed to every other caller while Root repairs the data in it, then
11
+ * applies the target.
12
+ */
13
+ export declare const INSTALL_MODES: readonly ["online", "maintenance"];
14
+ /** The validation options an install runs with, defaults filled in. */
15
+ export declare const validationOptions: import("zod").ZodObject<{
16
+ scope: import("zod").ZodEnum<{
17
+ full: "full";
18
+ incremental: "incremental";
19
+ }>;
20
+ counts: import("zod").ZodEnum<{
21
+ exact: "exact";
22
+ sample: "sample";
23
+ }>;
24
+ }, import("zod/v4/core").$strict>;
2
25
  export declare const domainRequest: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
3
26
  artifact: import("zod").ZodObject<{
4
27
  digest: import("zod").ZodString;
@@ -25,6 +48,7 @@ export declare const domainRequest: import("zod").ZodUnion<readonly [import("zod
25
48
  revision: import("zod").ZodOptional<import("zod").ZodString>;
26
49
  currentRevision: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
27
50
  }, import("zod/v4/core").$strict>]>;
51
+ /** One install, all of it its intent: its operation, its Domains, its mode and validation options. */
28
52
  export declare const installInput: import("zod").ZodObject<{
29
53
  operation: import("zod").ZodString;
30
54
  domains: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
@@ -53,6 +77,20 @@ export declare const installInput: import("zod").ZodObject<{
53
77
  revision: import("zod").ZodOptional<import("zod").ZodString>;
54
78
  currentRevision: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
55
79
  }, import("zod/v4/core").$strict>]>>;
80
+ mode: import("zod").ZodOptional<import("zod").ZodEnum<{
81
+ maintenance: "maintenance";
82
+ online: "online";
83
+ }>>;
84
+ validation: import("zod").ZodOptional<import("zod").ZodObject<{
85
+ scope: import("zod").ZodOptional<import("zod").ZodEnum<{
86
+ full: "full";
87
+ incremental: "incremental";
88
+ }>>;
89
+ counts: import("zod").ZodOptional<import("zod").ZodEnum<{
90
+ exact: "exact";
91
+ sample: "sample";
92
+ }>>;
93
+ }, import("zod/v4/core").$strict>>;
56
94
  }, import("zod/v4/core").$strict>;
57
95
  export declare const installReceipt: import("zod").ZodObject<{
58
96
  operation: import("zod").ZodString;
@@ -99,6 +137,90 @@ export declare const installReceipt: import("zod").ZodObject<{
99
137
  }, import("zod/v4/core").$strict>>;
100
138
  }, import("zod/v4/core").$strict>>;
101
139
  }, import("zod/v4/core").$strict>;
140
+ /**
141
+ * What a completed install ends with, the value its Execution's `result` yields: the committed
142
+ * receipt, or the exact generation of each root it proved unchanged.
143
+ */
144
+ export declare const installOutput: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
145
+ changed: import("zod").ZodLiteral<true>;
146
+ receipt: import("zod").ZodObject<{
147
+ operation: import("zod").ZodString;
148
+ transitions: import("zod").ZodArray<import("zod").ZodObject<{
149
+ intent: import("zod").ZodObject<{
150
+ transition: import("zod").ZodString;
151
+ operation: import("zod").ZodString;
152
+ origin: import("zod").ZodString;
153
+ previous: import("zod").ZodNullable<import("zod").ZodObject<{
154
+ origin: import("zod").ZodString;
155
+ revision: import("zod").ZodString;
156
+ generation: import("zod").ZodString;
157
+ }, import("zod/v4/core").$strict>>;
158
+ generation: import("zod").ZodNullable<import("zod").ZodObject<{
159
+ origin: import("zod").ZodString;
160
+ revision: import("zod").ZodString;
161
+ generation: import("zod").ZodString;
162
+ }, import("zod/v4/core").$strict>>;
163
+ consent: import("zod").ZodOptional<import("zod").ZodObject<{
164
+ issuer: import("zod").ZodObject<{
165
+ from: import("zod").ZodString;
166
+ to: import("zod").ZodString;
167
+ }, import("zod/v4/core").$strict>;
168
+ previous: import("zod").ZodEnum<{
169
+ drain: "drain";
170
+ revoke: "revoke";
171
+ }>;
172
+ }, import("zod/v4/core").$strict>>;
173
+ }, import("zod/v4/core").$strict>;
174
+ phase: import("zod").ZodEnum<{
175
+ converge: "converge";
176
+ cutover: "cutover";
177
+ }>;
178
+ state: import("zod").ZodLiteral<"committed">;
179
+ readiness: import("zod").ZodOptional<import("zod").ZodObject<{
180
+ generation: import("zod").ZodString;
181
+ transition: import("zod").ZodString;
182
+ dependencies: import("zod").ZodArray<import("zod").ZodObject<{
183
+ origin: import("zod").ZodString;
184
+ generation: import("zod").ZodString;
185
+ readiness: import("zod").ZodString;
186
+ meaning: import("zod").ZodString;
187
+ }, import("zod/v4/core").$strict>>;
188
+ }, import("zod/v4/core").$strict>>;
189
+ }, import("zod/v4/core").$strict>>;
190
+ }, import("zod/v4/core").$strict>;
191
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
192
+ changed: import("zod").ZodLiteral<false>;
193
+ domains: import("zod").ZodArray<import("zod").ZodObject<{
194
+ origin: import("zod").ZodString;
195
+ revision: import("zod").ZodString;
196
+ generation: import("zod").ZodString;
197
+ }, import("zod/v4/core").$strict>>;
198
+ }, import("zod/v4/core").$strict>]>;
199
+ /**
200
+ * The value of the `command:<n>` signal of a waiting repair session: attempt the target, with
201
+ * validation options that only widen the default.
202
+ */
203
+ export declare const installSessionCommand: import("zod").ZodObject<{
204
+ kind: import("zod").ZodLiteral<"apply">;
205
+ validation: import("zod").ZodOptional<import("zod").ZodObject<{
206
+ scope: import("zod").ZodOptional<import("zod").ZodEnum<{
207
+ full: "full";
208
+ incremental: "incremental";
209
+ }>>;
210
+ counts: import("zod").ZodOptional<import("zod").ZodEnum<{
211
+ exact: "exact";
212
+ sample: "sample";
213
+ }>>;
214
+ }, import("zod/v4/core").$strict>>;
215
+ }, import("zod/v4/core").$strict>;
216
+ /** The value of the `abort:<n>` signal of a repair session: stop attempt `n`, then wait again. */
217
+ export declare const installSessionAbort: import("zod").ZodObject<{
218
+ kind: import("zod").ZodLiteral<"abort">;
219
+ }, import("zod/v4/core").$strict>;
220
+ /** The name of the signal that sends the `n`th command to a repair session. */
221
+ export declare function commandSignal(n: number): `command:${number}`;
222
+ /** The name of the signal that aborts attempt `n` of a repair session. */
223
+ export declare function abortSignal(n: number): `abort:${number}`;
102
224
  type NonEmpty<Value> = readonly [Value, ...Value[]];
103
225
  export type InstallationDigest = `sha256:${string}`;
104
226
  export type ReleaseDigest = InstallationDigest;
@@ -179,12 +301,50 @@ export type DomainRequest = {
179
301
  readonly artifact: ArtifactRef;
180
302
  readonly currentRevision?: string | null;
181
303
  } | ReleaseRequest;
304
+ /** `online` (default) never closes the Instance; `maintenance` opens a maintenance session. */
305
+ export type InstallMode = (typeof INSTALL_MODES)[number];
306
+ /** What an install does to the stored data; see `INSTALL_CLASSES`. */
307
+ export type InstallClass = (typeof INSTALL_CLASSES)[number];
308
+ /**
309
+ * What an install asks its data validation to read beyond the default. `scope: 'full'` trusts
310
+ * nothing of the stored data and reads every rule of the destination over every retained extent;
311
+ * `counts: 'exact'` walks every refuted rule to its end, so its count is exact. Each option only
312
+ * widens the default (`incremental`, `sample`).
313
+ */
314
+ export interface InstallValidation {
315
+ readonly scope?: 'incremental' | 'full';
316
+ readonly counts?: 'sample' | 'exact';
317
+ }
318
+ /** The validation options an install runs with, defaults filled in. */
319
+ export interface ValidationOptions {
320
+ readonly scope: 'incremental' | 'full';
321
+ readonly counts: 'sample' | 'exact';
322
+ }
182
323
  export interface InstallInput {
183
324
  readonly operation: OperationId;
184
325
  readonly domains: NonEmpty<DomainRequest>;
326
+ readonly mode?: InstallMode;
327
+ readonly validation?: InstallValidation;
185
328
  }
186
329
  export interface InstallReceipt {
187
330
  readonly operation: OperationId;
188
331
  readonly transitions: NonEmpty<TransitionReceipt>;
189
332
  }
333
+ /** What a completed install ends with; see `installOutput`. */
334
+ export type InstallOutput = {
335
+ readonly changed: true;
336
+ readonly receipt: InstallReceipt;
337
+ } | {
338
+ readonly changed: false;
339
+ readonly domains: NonEmpty<DomainGeneration>;
340
+ };
341
+ /** The `command:<n>` signal value of a repair session. */
342
+ export interface InstallSessionCommand {
343
+ readonly kind: 'apply';
344
+ readonly validation?: InstallValidation;
345
+ }
346
+ /** The `abort:<n>` signal value of a repair session. */
347
+ export interface InstallSessionAbort {
348
+ readonly kind: 'abort';
349
+ }
190
350
  export {};
@@ -1,5 +1,21 @@
1
- import { array, strictObject, union } from 'zod';
2
- import { artifactRef, installationDigest, installationText, issuerConsent, operationIdSchema, transitionReceipt, } from './installation.js';
1
+ import { array, enum as enumeration, literal, strictObject, union } from 'zod';
2
+ import { artifactRef, domainGeneration, installationDigest, installationText, issuerConsent, operationIdSchema, transitionReceipt, } from './installation.js';
3
+ /**
4
+ * What an install does to the stored data: nothing changes (`noop`), it applies at once without
5
+ * reading the data (`immediate`), or it revalidates the data before it applies (`revalidate`).
6
+ */
7
+ export const INSTALL_CLASSES = Object.freeze(['noop', 'immediate', 'revalidate']);
8
+ /**
9
+ * How an install runs. `online` (the default) keeps the Instance open: it validates online and
10
+ * only its activation briefly pauses writes. `maintenance`, for Root only, opens a maintenance
11
+ * session: the Instance is closed to every other caller while Root repairs the data in it, then
12
+ * applies the target.
13
+ */
14
+ export const INSTALL_MODES = Object.freeze(['online', 'maintenance']);
15
+ const scope = enumeration(['incremental', 'full']);
16
+ const counts = enumeration(['sample', 'exact']);
17
+ /** The validation options an install runs with, defaults filled in. */
18
+ export const validationOptions = strictObject({ scope, counts });
3
19
  export const domainRequest = union([
4
20
  strictObject({
5
21
  artifact: artifactRef,
@@ -16,11 +32,41 @@ export const domainRequest = union([
16
32
  currentRevision: installationText.nullable().optional(),
17
33
  }),
18
34
  ]);
35
+ const installValidation = strictObject({ scope: scope.optional(), counts: counts.optional() });
36
+ /** One install, all of it its intent: its operation, its Domains, its mode and validation options. */
19
37
  export const installInput = strictObject({
20
38
  operation: operationIdSchema,
21
39
  domains: array(domainRequest).min(1),
40
+ mode: enumeration(INSTALL_MODES).optional(),
41
+ validation: installValidation.optional(),
22
42
  });
23
43
  export const installReceipt = strictObject({
24
44
  operation: operationIdSchema,
25
45
  transitions: array(transitionReceipt).min(1),
26
46
  });
47
+ /**
48
+ * What a completed install ends with, the value its Execution's `result` yields: the committed
49
+ * receipt, or the exact generation of each root it proved unchanged.
50
+ */
51
+ export const installOutput = union([
52
+ strictObject({ changed: literal(true), receipt: installReceipt }),
53
+ strictObject({ changed: literal(false), domains: array(domainGeneration).min(1) }),
54
+ ]);
55
+ /**
56
+ * The value of the `command:<n>` signal of a waiting repair session: attempt the target, with
57
+ * validation options that only widen the default.
58
+ */
59
+ export const installSessionCommand = strictObject({
60
+ kind: literal('apply'),
61
+ validation: installValidation.optional(),
62
+ });
63
+ /** The value of the `abort:<n>` signal of a repair session: stop attempt `n`, then wait again. */
64
+ export const installSessionAbort = strictObject({ kind: literal('abort') });
65
+ /** The name of the signal that sends the `n`th command to a repair session. */
66
+ export function commandSignal(n) {
67
+ return `command:${n}`;
68
+ }
69
+ /** The name of the signal that aborts attempt `n` of a repair session. */
70
+ export function abortSignal(n) {
71
+ return `abort:${n}`;
72
+ }