@elaraai/e3-types 1.0.79 → 1.0.80

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 (153) hide show
  1. package/README.md +1 -1
  2. package/dist/src/api.d.ts +569 -36
  3. package/dist/src/api.d.ts.map +1 -1
  4. package/dist/src/api.js +257 -32
  5. package/dist/src/api.js.map +1 -1
  6. package/dist/src/collection-manifest.d.ts +37 -0
  7. package/dist/src/collection-manifest.d.ts.map +1 -0
  8. package/dist/src/collection-manifest.js +37 -0
  9. package/dist/src/collection-manifest.js.map +1 -0
  10. package/dist/src/dataflow.d.ts +264 -19
  11. package/dist/src/dataflow.d.ts.map +1 -1
  12. package/dist/src/dataflow.js +156 -15
  13. package/dist/src/dataflow.js.map +1 -1
  14. package/dist/src/dataflow.spec.js +184 -27
  15. package/dist/src/dataflow.spec.js.map +1 -1
  16. package/dist/src/dataset-blob.d.ts +75 -15
  17. package/dist/src/dataset-blob.d.ts.map +1 -1
  18. package/dist/src/dataset-blob.js +95 -28
  19. package/dist/src/dataset-blob.js.map +1 -1
  20. package/dist/src/dataset-blob.spec.d.ts +6 -0
  21. package/dist/src/dataset-blob.spec.d.ts.map +1 -0
  22. package/dist/src/dataset-blob.spec.js +92 -0
  23. package/dist/src/dataset-blob.spec.js.map +1 -0
  24. package/dist/src/dataset-ref.d.ts +5 -4
  25. package/dist/src/dataset-ref.d.ts.map +1 -1
  26. package/dist/src/dataset-ref.js +5 -4
  27. package/dist/src/dataset-ref.js.map +1 -1
  28. package/dist/src/environment.d.ts +3 -2
  29. package/dist/src/environment.d.ts.map +1 -1
  30. package/dist/src/environment.js +3 -2
  31. package/dist/src/environment.js.map +1 -1
  32. package/dist/src/execution.d.ts +112 -18
  33. package/dist/src/execution.d.ts.map +1 -1
  34. package/dist/src/execution.js +174 -45
  35. package/dist/src/execution.js.map +1 -1
  36. package/dist/src/execution.spec.d.ts +6 -0
  37. package/dist/src/execution.spec.d.ts.map +1 -0
  38. package/dist/src/execution.spec.js +108 -0
  39. package/dist/src/execution.spec.js.map +1 -0
  40. package/dist/src/function.d.ts +14 -12
  41. package/dist/src/function.d.ts.map +1 -1
  42. package/dist/src/function.js +17 -32
  43. package/dist/src/function.js.map +1 -1
  44. package/dist/src/index.d.ts +16 -12
  45. package/dist/src/index.d.ts.map +1 -1
  46. package/dist/src/index.js +25 -20
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/lock.d.ts +68 -22
  49. package/dist/src/lock.d.ts.map +1 -1
  50. package/dist/src/lock.js +33 -22
  51. package/dist/src/lock.js.map +1 -1
  52. package/dist/src/names.d.ts +21 -0
  53. package/dist/src/names.d.ts.map +1 -0
  54. package/dist/src/names.js +31 -0
  55. package/dist/src/names.js.map +1 -0
  56. package/dist/src/package.d.ts +11 -78
  57. package/dist/src/package.d.ts.map +1 -1
  58. package/dist/src/package.js +13 -66
  59. package/dist/src/package.js.map +1 -1
  60. package/dist/src/record.d.ts +582 -18
  61. package/dist/src/record.d.ts.map +1 -1
  62. package/dist/src/record.js +405 -7
  63. package/dist/src/record.js.map +1 -1
  64. package/dist/src/{stream.spec.d.ts → record.spec.d.ts} +1 -1
  65. package/dist/src/record.spec.d.ts.map +1 -0
  66. package/dist/src/record.spec.js +143 -0
  67. package/dist/src/record.spec.js.map +1 -0
  68. package/dist/src/release.d.ts +36 -0
  69. package/dist/src/release.d.ts.map +1 -0
  70. package/dist/src/release.js +71 -0
  71. package/dist/src/release.js.map +1 -0
  72. package/dist/src/release.spec.d.ts +6 -0
  73. package/dist/src/release.spec.d.ts.map +1 -0
  74. package/dist/src/release.spec.js +42 -0
  75. package/dist/src/release.spec.js.map +1 -0
  76. package/dist/src/repository.d.ts +64 -0
  77. package/dist/src/repository.d.ts.map +1 -0
  78. package/dist/src/repository.js +49 -0
  79. package/dist/src/repository.js.map +1 -0
  80. package/dist/src/runner.d.ts +16 -62
  81. package/dist/src/runner.d.ts.map +1 -1
  82. package/dist/src/runner.js +16 -79
  83. package/dist/src/runner.js.map +1 -1
  84. package/dist/src/runner.spec.js +11 -85
  85. package/dist/src/runner.spec.js.map +1 -1
  86. package/dist/src/structure.d.ts +0 -57
  87. package/dist/src/structure.d.ts.map +1 -1
  88. package/dist/src/structure.js +0 -3
  89. package/dist/src/structure.js.map +1 -1
  90. package/dist/src/task.d.ts +210 -318
  91. package/dist/src/task.d.ts.map +1 -1
  92. package/dist/src/task.js +117 -472
  93. package/dist/src/task.js.map +1 -1
  94. package/dist/src/task.spec.js +62 -154
  95. package/dist/src/task.spec.js.map +1 -1
  96. package/dist/src/transfer.d.ts +16 -22
  97. package/dist/src/transfer.d.ts.map +1 -1
  98. package/dist/src/transfer.js +16 -22
  99. package/dist/src/transfer.js.map +1 -1
  100. package/dist/src/transfer.spec.js +4 -34
  101. package/dist/src/transfer.spec.js.map +1 -1
  102. package/dist/src/unit-plan.d.ts +130 -0
  103. package/dist/src/unit-plan.d.ts.map +1 -0
  104. package/dist/src/unit-plan.js +107 -0
  105. package/dist/src/unit-plan.js.map +1 -0
  106. package/dist/src/unit-plan.spec.d.ts +6 -0
  107. package/dist/src/unit-plan.spec.d.ts.map +1 -0
  108. package/dist/src/unit-plan.spec.js +29 -0
  109. package/dist/src/unit-plan.spec.js.map +1 -0
  110. package/dist/src/workspace.d.ts +22 -11
  111. package/dist/src/workspace.d.ts.map +1 -1
  112. package/dist/src/workspace.js +10 -11
  113. package/dist/src/workspace.js.map +1 -1
  114. package/package.json +3 -3
  115. package/src/api.ts +276 -32
  116. package/src/collection-manifest.ts +53 -0
  117. package/src/dataflow.spec.ts +223 -31
  118. package/src/dataflow.ts +183 -26
  119. package/src/dataset-blob.spec.ts +117 -0
  120. package/src/dataset-blob.ts +157 -21
  121. package/src/dataset-ref.ts +5 -4
  122. package/src/environment.ts +3 -2
  123. package/src/execution.spec.ts +114 -0
  124. package/src/execution.ts +175 -51
  125. package/src/function.ts +19 -32
  126. package/src/index.ts +122 -39
  127. package/src/lock.ts +39 -22
  128. package/src/names.ts +39 -0
  129. package/src/package.ts +15 -71
  130. package/src/record.spec.ts +195 -0
  131. package/src/record.ts +489 -7
  132. package/src/release.spec.ts +47 -0
  133. package/src/release.ts +69 -0
  134. package/src/repository.ts +67 -0
  135. package/src/runner.spec.ts +11 -94
  136. package/src/runner.ts +16 -80
  137. package/src/structure.ts +0 -8
  138. package/src/task.spec.ts +67 -188
  139. package/src/task.ts +140 -522
  140. package/src/transfer.spec.ts +4 -51
  141. package/src/transfer.ts +16 -22
  142. package/src/unit-plan.spec.ts +31 -0
  143. package/src/unit-plan.ts +121 -0
  144. package/src/workspace.ts +13 -11
  145. package/dist/src/stream.d.ts +0 -97
  146. package/dist/src/stream.d.ts.map +0 -1
  147. package/dist/src/stream.js +0 -134
  148. package/dist/src/stream.js.map +0 -1
  149. package/dist/src/stream.spec.d.ts.map +0 -1
  150. package/dist/src/stream.spec.js +0 -60
  151. package/dist/src/stream.spec.js.map +0 -1
  152. package/src/stream.spec.ts +0 -88
  153. package/src/stream.ts +0 -170
package/src/execution.ts CHANGED
@@ -7,111 +7,235 @@
7
7
  * Execution status type definitions.
8
8
  *
9
9
  * An execution represents a single run of a task with specific inputs.
10
- * Executions are stored at: executions/<taskHash>/<inputsHash>/
10
+ * A local repository keeps each attempt at
11
+ * executions/<taskHash>/<inputsHash>/<executionId>/
11
12
  *
12
13
  * The status file tracks:
13
14
  * - For running: process identification for crash detection
14
- * - For success: output hash and timing
15
- * - For failed: exit code and timing
15
+ * - For success: output hash, timing, peak memory and a split task's last plan
16
+ * - For failed: exit code, timing and peak memory
16
17
  * - For error: internal error message and timing
18
+ * - For cancelled and interrupted: how e3, not the task, ended it
19
+ *
20
+ * Every case says whether the execution is a unit of a split task — a piece,
21
+ * or a merge of the pieces' outputs — which is recorded under its task's hash
22
+ * as the task's own executions are, but is not a run of the task.
17
23
  */
18
24
 
19
25
  import {
20
26
  VariantType,
21
27
  StructType,
22
28
  ArrayType,
29
+ OptionType,
23
30
  StringType,
24
31
  IntegerType,
32
+ BooleanType,
25
33
  DateTimeType,
26
34
  ValueTypeOf,
35
+ decodeBeast2For,
27
36
  } from '@elaraai/east';
28
37
 
38
+ /** A running execution's process identification. */
39
+ const RunningStatusType = StructType({
40
+ /** Unique execution ID (UUIDv7) */
41
+ executionId: StringType,
42
+ /** Input dataset hashes */
43
+ inputHashes: ArrayType(StringType),
44
+ /** When execution started */
45
+ startedAt: DateTimeType,
46
+ /** Process ID of the runner */
47
+ pid: IntegerType,
48
+ /** Process start time in jiffies since boot (from /proc/<pid>/stat field 22) */
49
+ pidStartTime: IntegerType,
50
+ /** System boot ID (from /proc/sys/kernel/random/boot_id) */
51
+ bootId: StringType,
52
+ /** Whether the execution is a unit of a split task — a piece, or a merge of
53
+ * the pieces' outputs — rather than a task's own execution, which the one
54
+ * unit of a task whose input closes no piece is */
55
+ unit: BooleanType,
56
+ });
57
+
58
+ const SuccessStatusType = StructType({
59
+ /** Unique execution ID (UUIDv7) */
60
+ executionId: StringType,
61
+ /** Input dataset hashes */
62
+ inputHashes: ArrayType(StringType),
63
+ /** Hash of the output dataset */
64
+ outputHash: StringType,
65
+ /** When execution started */
66
+ startedAt: DateTimeType,
67
+ /** When execution completed */
68
+ completedAt: DateTimeType,
69
+ /** The highest peak resident memory, in bytes, a runner process of the
70
+ * execution reached — a split task's, the largest of its units' — when
71
+ * its runners reported one */
72
+ peakBytes: OptionType(IntegerType),
73
+ /** A split task's: the `$plan` of the last stage it ran, which names the
74
+ * stages before it, and so every unit its output was assembled from;
75
+ * `none` for any other execution */
76
+ plan: OptionType(StringType),
77
+ /** Whether the execution is a unit of a split task — a piece, or a merge of
78
+ * the pieces' outputs — rather than a task's own execution, which the one
79
+ * unit of a task whose input closes no piece is */
80
+ unit: BooleanType,
81
+ });
82
+
83
+ const FailedStatusType = StructType({
84
+ /** Unique execution ID (UUIDv7) */
85
+ executionId: StringType,
86
+ /** Input dataset hashes */
87
+ inputHashes: ArrayType(StringType),
88
+ /** When execution started */
89
+ startedAt: DateTimeType,
90
+ /** When execution completed */
91
+ completedAt: DateTimeType,
92
+ /** Process exit code */
93
+ exitCode: IntegerType,
94
+ /** The highest peak resident memory, in bytes, a runner process of the
95
+ * execution reached — a split task's, the largest of its units' — when
96
+ * its runners reported one */
97
+ peakBytes: OptionType(IntegerType),
98
+ /** Whether the execution is a unit of a split task — a piece, or a merge of
99
+ * the pieces' outputs — rather than a task's own execution, which the one
100
+ * unit of a task whose input closes no piece is */
101
+ unit: BooleanType,
102
+ });
103
+
104
+ const ErrorStatusType = StructType({
105
+ /** Unique execution ID (UUIDv7) */
106
+ executionId: StringType,
107
+ /** Input dataset hashes */
108
+ inputHashes: ArrayType(StringType),
109
+ /** When execution started */
110
+ startedAt: DateTimeType,
111
+ /** When execution completed */
112
+ completedAt: DateTimeType,
113
+ /** Error message describing what went wrong */
114
+ message: StringType,
115
+ /** Whether the execution is a unit of a split task — a piece, or a merge of
116
+ * the pieces' outputs — rather than a task's own execution, which the one
117
+ * unit of a task whose input closes no piece is */
118
+ unit: BooleanType,
119
+ });
120
+
29
121
  /**
30
- * Execution status stored in executions/<taskHash>/<inputsHash>/status.beast2
31
- *
32
- * A variant type representing the four possible states of an execution:
122
+ * Execution status, stored locally at
123
+ * executions/<taskHash>/<inputsHash>/<executionId>/status.beast2
33
124
  *
34
125
  * - `running`: Task has been launched but not yet completed
35
126
  * - `success`: Task ran and returned exit code 0
36
127
  * - `failed`: Task ran and returned non-zero exit code
37
128
  * - `error`: e3 execution engine had an internal error (runner not found, output missing, etc.)
129
+ * - `cancelled`: e3 stopped the execution because the run was aborted, before
130
+ * its runner started or while it ran — not the task's own failure
131
+ * - `interrupted`: the orchestrator that owned the execution exited before it
132
+ * finished, and its runner is gone too, so nothing will write its outcome
38
133
  *
39
134
  * The `running` state includes process identification fields (pid, pidStartTime, bootId)
40
135
  * to enable detection of crashed executions. See design/e3-execution.md for details.
136
+ *
137
+ * Stored state: read it with {@link decodeExecutionStatus}.
41
138
  */
42
139
  export const ExecutionStatusType = VariantType({
43
- /** Task has been launched but not yet completed */
44
- running: StructType({
45
- /** Unique execution ID (UUIDv7) */
46
- executionId: StringType,
47
- /** Input dataset hashes */
48
- inputHashes: ArrayType(StringType),
49
- /** When execution started */
50
- startedAt: DateTimeType,
51
- /** Process ID of the runner */
52
- pid: IntegerType,
53
- /** Process start time in jiffies since boot (from /proc/<pid>/stat field 22) */
54
- pidStartTime: IntegerType,
55
- /** System boot ID (from /proc/sys/kernel/random/boot_id) */
56
- bootId: StringType,
57
- }),
58
- /** Task ran and returned exit code 0 */
59
- success: StructType({
60
- /** Unique execution ID (UUIDv7) */
61
- executionId: StringType,
62
- /** Input dataset hashes */
63
- inputHashes: ArrayType(StringType),
64
- /** Hash of the output dataset */
65
- outputHash: StringType,
66
- /** When execution started */
67
- startedAt: DateTimeType,
68
- /** When execution completed */
69
- completedAt: DateTimeType,
70
- }),
71
- /** Task ran and returned non-zero exit code */
72
- failed: StructType({
140
+ running: RunningStatusType,
141
+ success: SuccessStatusType,
142
+ failed: FailedStatusType,
143
+ error: ErrorStatusType,
144
+ cancelled: StructType({
73
145
  /** Unique execution ID (UUIDv7) */
74
146
  executionId: StringType,
75
147
  /** Input dataset hashes */
76
148
  inputHashes: ArrayType(StringType),
77
149
  /** When execution started */
78
150
  startedAt: DateTimeType,
79
- /** When execution completed */
151
+ /** When e3 stopped it */
80
152
  completedAt: DateTimeType,
81
- /** Process exit code */
82
- exitCode: IntegerType,
153
+ /** Whether the execution is a unit of a split task — a piece, or a merge of
154
+ * the pieces' outputs — rather than a task's own execution, which the one
155
+ * unit of a task whose input closes no piece is */
156
+ unit: BooleanType,
83
157
  }),
84
- /** e3 execution engine had an internal error */
85
- error: StructType({
158
+ interrupted: StructType({
86
159
  /** Unique execution ID (UUIDv7) */
87
160
  executionId: StringType,
88
161
  /** Input dataset hashes */
89
162
  inputHashes: ArrayType(StringType),
90
163
  /** When execution started */
91
164
  startedAt: DateTimeType,
92
- /** When execution completed */
165
+ /** When the interruption was found */
93
166
  completedAt: DateTimeType,
94
- /** Error message describing what went wrong */
95
- message: StringType,
167
+ /** Process ID the runner had */
168
+ pid: IntegerType,
169
+ /** Whether the execution is a unit of a split task — a piece, or a merge of
170
+ * the pieces' outputs — rather than a task's own execution, which the one
171
+ * unit of a task whose input closes no piece is */
172
+ unit: BooleanType,
96
173
  }),
97
174
  });
98
175
 
99
176
  export type ExecutionStatus = ValueTypeOf<typeof ExecutionStatusType>;
100
177
 
101
178
  /**
102
- * The orchestrator process that launched an execution (issue #770).
179
+ * The objects an execution's record keeps from garbage collection: a
180
+ * success's output, and a split task's last `$plan`, which names every stage
181
+ * before it and so the units gc keeps beside the task.
182
+ *
183
+ * @remarks
184
+ * Every backend's scan of execution roots applies it, as gc does to the
185
+ * executions it keeps.
186
+ *
187
+ * @param status - the execution's status
188
+ * @returns the hashes of the objects it keeps
189
+ */
190
+ export function executionStatusRoots(status: ExecutionStatus): string[] {
191
+ if (status.type !== 'success') return [];
192
+ const { outputHash, plan } = status.value;
193
+ return plan.type === 'some' ? [outputHash, plan.value] : [outputHash];
194
+ }
195
+
196
+ const decodeCurrentStatus = decodeBeast2For(ExecutionStatusType);
197
+
198
+ /**
199
+ * Decode an execution status.
200
+ *
201
+ * @remarks
202
+ * Stored state, so it changes by hard cutover: a repository an older e3 wrote
203
+ * is re-created rather than read, and this says so.
204
+ *
205
+ * @param data - the stored bytes
206
+ * @returns the status
207
+ * @throws {Error} When the bytes are not a current status — one an older e3
208
+ * wrote, whose repository is re-created.
209
+ */
210
+ export function decodeExecutionStatus(data: Uint8Array): ExecutionStatus {
211
+ try {
212
+ return decodeCurrentStatus(data);
213
+ } catch (err) {
214
+ throw new Error(
215
+ `the execution status does not decode: an older e3 wrote this repository — re-create it: deploy again and import its data again ` +
216
+ `(${err instanceof Error ? err.message : String(err)})`,
217
+ );
218
+ }
219
+ }
220
+
221
+ /**
222
+ * The orchestrator process that launched an execution.
103
223
  *
104
224
  * @remarks
105
- * Written beside the execution's `running` status as the `owner` sidecar. A
225
+ * Written beside the execution's `running` status as its owner record. A
106
226
  * `running` record whose runner is gone is repaired only when its owner is
107
227
  * gone too: a live owner may be between the runner's exit and the record's
108
228
  * write, hashing the output.
229
+ *
230
+ * Stored state: a record of another shape is read as none recorded.
109
231
  */
110
- export interface ExecutionOwner {
232
+ export const ExecutionOwnerType = StructType({
111
233
  /** Process ID of the orchestrator */
112
- pid: number;
234
+ pid: IntegerType,
113
235
  /** Orchestrator start time in jiffies since boot (from /proc/<pid>/stat field 22) */
114
- pidStartTime: number;
236
+ pidStartTime: IntegerType,
115
237
  /** System boot ID (from /proc/sys/kernel/random/boot_id) */
116
- bootId: string;
117
- }
238
+ bootId: StringType,
239
+ });
240
+
241
+ export type ExecutionOwner = ValueTypeOf<typeof ExecutionOwnerType>;
package/src/function.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * non-TS clients) have the types they need to encode arguments.
18
18
  */
19
19
 
20
- import { StructType, StringType, ArrayType, EastTypeType, OptionType, ValueTypeOf, decodeBeast2For, none } from '@elaraai/east';
20
+ import { StructType, StringType, ArrayType, EastTypeType, OptionType, ValueTypeOf, decodeBeast2For } from '@elaraai/east';
21
21
  import { RunnerType } from './runner.js';
22
22
 
23
23
  /**
@@ -25,21 +25,19 @@ import { RunnerType } from './runner.js';
25
25
  * `PackageObject.functions`.
26
26
  */
27
27
  export const FunctionObjectType = StructType({
28
- /** Hash of the encoded EastIR bundle (encodeEastIR), like a task's commandIr object. */
28
+ /** Hash of the encoded EastIR bundle (encodeEastIR), as a task's program is. */
29
29
  bodyIr: StringType,
30
30
  /** Positional parameter types — the IR's signature, surfaced for arity/type
31
31
  * validation and `describe` without decoding the whole IR. */
32
32
  inputTypes: ArrayType(EastTypeType),
33
33
  /** Return type — used to decode the result `value` blob client-side. */
34
34
  outputType: EastTypeType,
35
- /** Author-chosen runtime; resolved to argv by runnerToArgv. One of the known
36
- * runtime tags — there is no raw-argv runner for functions. */
35
+ /** Author-chosen runtime: a stock runner runs the function as a unit, and a
36
+ * `custom` one runs its command with `run`'s arguments. */
37
37
  runner: RunnerType,
38
38
  /**
39
39
  * Hash of an `EnvironmentSpecType` object the function executes in;
40
- * `none` ⇒ the stock runtime image. Appended LAST (BEAST2 encodes struct
41
- * fields positionally) with a legacy dual decoder — see
42
- * {@link decodeFunctionObject}.
40
+ * `none` ⇒ the stock runtime image.
43
41
  */
44
42
  environment: OptionType(StringType),
45
43
  });
@@ -47,39 +45,28 @@ export type FunctionObjectType = typeof FunctionObjectType;
47
45
 
48
46
  export type FunctionObject = ValueTypeOf<typeof FunctionObjectType>;
49
47
 
50
- /**
51
- * The pre-`environment` function object wire shape, kept only so
52
- * {@link decodeFunctionObject} can read functions exported before execution
53
- * environments existed.
54
- */
55
- const PreEnvironmentFunctionObjectType = StructType({
56
- bodyIr: StringType,
57
- inputTypes: ArrayType(EastTypeType),
58
- outputType: EastTypeType,
59
- runner: RunnerType,
60
- });
61
-
62
48
  const decodeCurrentFunction = decodeBeast2For(FunctionObjectType);
63
- const decodePreEnvironmentFunction = decodeBeast2For(PreEnvironmentFunctionObjectType);
64
49
 
65
50
  /**
66
- * Decode a `FunctionObject` from BEAST2 bytes, tolerating the
67
- * pre-`environment` wire format (dual-decode migration, like
68
- * `decodePackageObject`).
51
+ * Decode a `FunctionObject` from BEAST2 bytes.
52
+ *
53
+ * @remarks
54
+ * A package-borne wire, so it changes by hard cutover: a package exported by
55
+ * an older SDK is re-exported with the current one, and this says so.
69
56
  *
70
- * Every function-read path — local AND cloud — must use this instead of
71
- * `decodeBeast2For(FunctionObjectType)` directly. Older bytes decode with
72
- * `environment` defaulted to `none`.
57
+ * @param data - the stored bytes
58
+ * @returns the function object
59
+ * @throws {Error} When the bytes are not a current function object — a
60
+ * package exported by an older SDK, which is re-exported with the current
61
+ * one.
73
62
  */
74
63
  export function decodeFunctionObject(data: Uint8Array): FunctionObject {
75
64
  try {
76
65
  return decodeCurrentFunction(data);
77
66
  } catch (err) {
78
- try {
79
- const legacy = decodePreEnvironmentFunction(data);
80
- return { ...legacy, environment: none };
81
- } catch {
82
- throw err; // no known shape — surface the current-format error
83
- }
67
+ throw new Error(
68
+ `the function object does not decode: the package was exported by an older e3 SDK — re-export it with the current one ` +
69
+ `(${err instanceof Error ? err.message : String(err)})`,
70
+ );
84
71
  }
85
72
  }
package/src/index.ts CHANGED
@@ -41,40 +41,26 @@ export {
41
41
 
42
42
  // Task definitions
43
43
  export {
44
+ TASK_OBJECT_KIND,
44
45
  TaskObjectType,
45
46
  type TaskObject,
46
47
  decodeTaskObject,
47
- TASK_KIND_PARTITION,
48
- TASK_KIND_STREAM,
49
- TASK_KIND_MERGE,
50
- PartitionTaskMetadataType,
51
- type PartitionTaskMetadata,
52
- encodePartitionTaskMetadata,
53
- decodePartitionTaskMetadata,
54
- StreamTaskMetadataType,
55
- type StreamTaskMetadata,
56
- encodeStreamTaskMetadata,
57
- decodeStreamTaskMetadata,
58
- PartitionPlanType,
59
- MergeRangePlanType,
60
- type PartitionPlan,
61
- type MergeRangePlan,
62
- encodePartitionPlan,
63
- decodePartitionPlan,
64
- type ProjectionShape,
65
- partitionProjectionShape,
66
- projectedKeyType,
67
- projectKey,
48
+ TaskBodyType,
49
+ type TaskBody,
50
+ TaskPartitionType,
51
+ type TaskPartition,
52
+ TaskInputType,
53
+ type TaskInput,
54
+ TaskOutputKindType,
55
+ type TaskOutputKind,
56
+ TaskOutputType,
57
+ type TaskOutput,
58
+ DataManifestType,
59
+ type DataManifest,
60
+ TaskRoleType,
61
+ type TaskRole,
68
62
  } from './task.js';
69
63
 
70
- // Stream and merge commands
71
- export {
72
- type StreamMergeMode,
73
- type StreamCommandSpec,
74
- streamCommandIr,
75
- mergeCommandIr,
76
- } from './stream.js';
77
-
78
64
  // Execution environments
79
65
  export {
80
66
  EnvironmentSpecType,
@@ -109,17 +95,12 @@ export {
109
95
  parseDatasetPath,
110
96
  parsePackageRef,
111
97
  urlPathToTreePath,
112
- // Backwards compatibility
113
- DatasetSchemaType,
114
- type DatasetSchema,
115
98
  } from './structure.js';
116
99
 
117
- // Runner wire types (functions)
100
+ // Runner wire types
118
101
  export {
119
102
  RunnerType,
120
103
  type RunnerValue,
121
- runnerToArgv,
122
- withRunnerVerbose,
123
104
  withRunnerLifeline,
124
105
  } from './runner.js';
125
106
 
@@ -138,6 +119,29 @@ export {
138
119
  type MutationObject,
139
120
  RecordObjectType,
140
121
  type RecordObject,
122
+ decodeRecordObject,
123
+ RecordIndexObjectType,
124
+ type RecordIndexObject,
125
+ RECORD_STATE_KIND,
126
+ RecordStateType,
127
+ type RecordState,
128
+ isRecordStateType,
129
+ indexCollectionType,
130
+ indexWindowType,
131
+ decodeRecordCommit,
132
+ decodeMutationObject,
133
+ MutationFormType,
134
+ type MutationForm,
135
+ MigrationObjectType,
136
+ type MigrationObject,
137
+ decodeMigrationObject,
138
+ MigrationFormType,
139
+ type MigrationForm,
140
+ DELTA_CONFLICT,
141
+ patchOpsType,
142
+ mutationDeltaType,
143
+ editTypeOf,
144
+ type DeltaTarget,
141
145
  } from './record.js';
142
146
 
143
147
  // Package objects
@@ -149,9 +153,6 @@ export {
149
153
  DatasetSourceWireType,
150
154
  type DatasetSourceWire,
151
155
  decodePackageObject,
152
- // Backwards compatibility
153
- PackageDatasetsType,
154
- type PackageDatasets,
155
156
  // Package transfer types
156
157
  PackageTransferInitRequestType,
157
158
  type PackageTransferInitRequest,
@@ -177,12 +178,17 @@ export {
177
178
  export {
178
179
  WorkspaceStateType,
179
180
  type WorkspaceState,
181
+ WorkspaceRecordType,
182
+ type WorkspaceRecord,
180
183
  } from './workspace.js';
181
184
 
182
185
  // Execution status
183
186
  export {
184
187
  ExecutionStatusType,
185
188
  type ExecutionStatus,
189
+ decodeExecutionStatus,
190
+ executionStatusRoots,
191
+ ExecutionOwnerType,
186
192
  type ExecutionOwner,
187
193
  } from './execution.js';
188
194
 
@@ -192,10 +198,30 @@ export {
192
198
  type LockOperation,
193
199
  ProcessHolderType,
194
200
  type ProcessHolder,
201
+ LambdaHolderType,
202
+ type LambdaHolder,
203
+ LockHolderVariantType,
204
+ type LockHolderVariant,
195
205
  LockStateType,
196
206
  type LockState,
197
207
  } from './lock.js';
198
208
 
209
+ // The repository's own records
210
+ export {
211
+ RepositoryRecordType,
212
+ type RepositoryRecord,
213
+ RepoStatusType,
214
+ type RepoStatus,
215
+ RepoMetadataType,
216
+ type RepoMetadata,
217
+ } from './repository.js';
218
+
219
+ // The release of e3 this build is, which what it keeps and ships records
220
+ export { E3_RELEASE, compareReleases } from './release.js';
221
+
222
+ // The names e3 makes paths of
223
+ export { type NamedKind, nameProblem } from './names.js';
224
+
199
225
  // Dataset transfer types
200
226
  export {
201
227
  TRANSFER_PROTOCOL_VERSION,
@@ -212,12 +238,32 @@ export {
212
238
  } from './transfer.js';
213
239
 
214
240
  // Dataset blob encoding — the ONE branch deciding segmentation, shared by the
215
- // store path (e3-core `datasetWrite`) and the package export path (e3 `export_`)
241
+ // store's door (e3-core `storeCollection`) and the package export (e3 `export_`)
216
242
  export {
217
243
  isCollectionRoot,
218
244
  encodeDatasetBlob,
245
+ writeCollectionManifest,
246
+ type CollectionSegmentRef,
247
+ type CollectionPiece,
248
+ type SegmentSink,
219
249
  } from './dataset-blob.js';
220
250
 
251
+ // The segment-object layout: a collection dataset is a manifest naming
252
+ // standalone segment objects, and the manifest is what the ref points at
253
+ export {
254
+ COLLECTION_MANIFEST_KIND,
255
+ CollectionManifestType,
256
+ CollectionManifestEntryType,
257
+ type CollectionManifest,
258
+ type CollectionManifestEntry,
259
+ isCollectionManifestType,
260
+ isCollectionManifest,
261
+ encodeCollectionManifest,
262
+ decodeCollectionManifest,
263
+ manifestElementCount,
264
+ manifestByteSize,
265
+ } from './collection-manifest.js';
266
+
221
267
  // The ONE declared-type-vs-wire-type check, shared by every door a value
222
268
  // enters a dataset through (the export, the set, the adopt, the API)
223
269
  export {
@@ -249,6 +295,7 @@ export {
249
295
  InternalErrorType,
250
296
  RepositoryNotFoundErrorType,
251
297
  DatasetTypeMismatchErrorType,
298
+ InvalidNameErrorType,
252
299
  ErrorType,
253
300
  ResponseType,
254
301
  // Repository
@@ -265,7 +312,13 @@ export {
265
312
  // Workspaces
266
313
  WorkspaceCreateRequestType,
267
314
  WorkspaceInfoType,
315
+ SchemaPolicyType,
268
316
  WorkspaceDeployRequestType,
317
+ RecordPlanType,
318
+ RecordIndexPlanType,
319
+ WorkspaceDeployResultType,
320
+ WorkspaceDeployProgressType,
321
+ WorkspaceDeployStatusType,
269
322
  WorkspaceExportRequestType,
270
323
  // Workspace Status
271
324
  DatasetStatusType,
@@ -292,6 +345,9 @@ export {
292
345
  DataflowEventType,
293
346
  ApiExecutionStatusType,
294
347
  DataflowExecutionSummaryType,
348
+ DataflowBudgetType,
349
+ UnitWaitType,
350
+ SplitProgressType,
295
351
  ApiDataflowExecutionStateType,
296
352
  // Task Execution History
297
353
  ExecutionHistoryStatusType,
@@ -327,6 +383,12 @@ export {
327
383
  type WorkspaceInfo,
328
384
  type WorkspaceCreateRequest,
329
385
  type WorkspaceDeployRequest,
386
+ type SchemaPolicy,
387
+ type RecordPlan,
388
+ type RecordIndexPlan,
389
+ type WorkspaceDeployResult,
390
+ type WorkspaceDeployProgress,
391
+ type WorkspaceDeployStatus,
330
392
  type DatasetStatus,
331
393
  type TaskStatus as ApiTaskStatus,
332
394
  type DatasetStatusInfo,
@@ -342,6 +404,9 @@ export {
342
404
  type DataflowEvent,
343
405
  type ApiExecutionStatus,
344
406
  type DataflowExecutionSummary,
407
+ type DataflowBudget,
408
+ type UnitWait,
409
+ type SplitProgress,
345
410
  type ApiDataflowExecutionState,
346
411
  type ExecutionHistoryStatus,
347
412
  type ExecutionListItem,
@@ -371,11 +436,16 @@ export {
371
436
  type DataflowGraphTask,
372
437
  DataflowGraphType,
373
438
  type DataflowGraph,
439
+ StageUnitType,
440
+ type StageUnit,
441
+ RequeueReasonType,
442
+ type RequeueReason,
374
443
  ExecutionEventType,
375
444
  type ExecutionEvent,
376
445
  type PartitionProgress,
377
446
  DataflowExecutionStateType,
378
447
  type DataflowExecutionState,
448
+ decodeDataflowExecutionState,
379
449
  // Dataflow run history
380
450
  DataflowRunStatusType,
381
451
  type DataflowRunStatus,
@@ -386,3 +456,16 @@ export {
386
456
  DataflowRunType,
387
457
  type DataflowRun,
388
458
  } from './dataflow.js';
459
+
460
+ // A split task's unit graph, a stage at a time
461
+ export {
462
+ UNIT_PLAN_KIND,
463
+ UnitPlanGroupType,
464
+ type UnitPlanGroup,
465
+ UnitPlanStageType,
466
+ type UnitPlanStage,
467
+ UnitPlanType,
468
+ type UnitPlan,
469
+ encodeUnitPlan,
470
+ decodeUnitPlan,
471
+ } from './unit-plan.js';