@elaraai/e3-types 1.0.79 → 1.0.81

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 (158) hide show
  1. package/README.md +1 -1
  2. package/dist/src/api.d.ts +829 -36
  3. package/dist/src/api.d.ts.map +1 -1
  4. package/dist/src/api.js +301 -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 +17 -12
  45. package/dist/src/index.d.ts.map +1 -1
  46. package/dist/src/index.js +28 -20
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/intake.d.ts +75 -0
  49. package/dist/src/intake.d.ts.map +1 -0
  50. package/dist/src/intake.js +46 -0
  51. package/dist/src/intake.js.map +1 -0
  52. package/dist/src/lock.d.ts +253 -21
  53. package/dist/src/lock.d.ts.map +1 -1
  54. package/dist/src/lock.js +55 -21
  55. package/dist/src/lock.js.map +1 -1
  56. package/dist/src/names.d.ts +21 -0
  57. package/dist/src/names.d.ts.map +1 -0
  58. package/dist/src/names.js +31 -0
  59. package/dist/src/names.js.map +1 -0
  60. package/dist/src/package.d.ts +11 -78
  61. package/dist/src/package.d.ts.map +1 -1
  62. package/dist/src/package.js +13 -66
  63. package/dist/src/package.js.map +1 -1
  64. package/dist/src/record.d.ts +582 -18
  65. package/dist/src/record.d.ts.map +1 -1
  66. package/dist/src/record.js +405 -7
  67. package/dist/src/record.js.map +1 -1
  68. package/dist/src/{stream.spec.d.ts → record.spec.d.ts} +1 -1
  69. package/dist/src/record.spec.d.ts.map +1 -0
  70. package/dist/src/record.spec.js +143 -0
  71. package/dist/src/record.spec.js.map +1 -0
  72. package/dist/src/release.d.ts +36 -0
  73. package/dist/src/release.d.ts.map +1 -0
  74. package/dist/src/release.js +71 -0
  75. package/dist/src/release.js.map +1 -0
  76. package/dist/src/release.spec.d.ts +6 -0
  77. package/dist/src/release.spec.d.ts.map +1 -0
  78. package/dist/src/release.spec.js +42 -0
  79. package/dist/src/release.spec.js.map +1 -0
  80. package/dist/src/repository.d.ts +64 -0
  81. package/dist/src/repository.d.ts.map +1 -0
  82. package/dist/src/repository.js +49 -0
  83. package/dist/src/repository.js.map +1 -0
  84. package/dist/src/runner.d.ts +16 -62
  85. package/dist/src/runner.d.ts.map +1 -1
  86. package/dist/src/runner.js +16 -79
  87. package/dist/src/runner.js.map +1 -1
  88. package/dist/src/runner.spec.js +11 -85
  89. package/dist/src/runner.spec.js.map +1 -1
  90. package/dist/src/structure.d.ts +0 -57
  91. package/dist/src/structure.d.ts.map +1 -1
  92. package/dist/src/structure.js +0 -3
  93. package/dist/src/structure.js.map +1 -1
  94. package/dist/src/task.d.ts +210 -318
  95. package/dist/src/task.d.ts.map +1 -1
  96. package/dist/src/task.js +117 -472
  97. package/dist/src/task.js.map +1 -1
  98. package/dist/src/task.spec.js +62 -154
  99. package/dist/src/task.spec.js.map +1 -1
  100. package/dist/src/transfer.d.ts +38 -26
  101. package/dist/src/transfer.d.ts.map +1 -1
  102. package/dist/src/transfer.js +22 -26
  103. package/dist/src/transfer.js.map +1 -1
  104. package/dist/src/transfer.spec.js +4 -34
  105. package/dist/src/transfer.spec.js.map +1 -1
  106. package/dist/src/unit-plan.d.ts +130 -0
  107. package/dist/src/unit-plan.d.ts.map +1 -0
  108. package/dist/src/unit-plan.js +107 -0
  109. package/dist/src/unit-plan.js.map +1 -0
  110. package/dist/src/unit-plan.spec.d.ts +6 -0
  111. package/dist/src/unit-plan.spec.d.ts.map +1 -0
  112. package/dist/src/unit-plan.spec.js +29 -0
  113. package/dist/src/unit-plan.spec.js.map +1 -0
  114. package/dist/src/workspace.d.ts +22 -11
  115. package/dist/src/workspace.d.ts.map +1 -1
  116. package/dist/src/workspace.js +10 -11
  117. package/dist/src/workspace.js.map +1 -1
  118. package/package.json +3 -3
  119. package/src/api.ts +326 -32
  120. package/src/collection-manifest.ts +53 -0
  121. package/src/dataflow.spec.ts +223 -31
  122. package/src/dataflow.ts +183 -26
  123. package/src/dataset-blob.spec.ts +117 -0
  124. package/src/dataset-blob.ts +157 -21
  125. package/src/dataset-ref.ts +5 -4
  126. package/src/environment.ts +3 -2
  127. package/src/execution.spec.ts +114 -0
  128. package/src/execution.ts +175 -51
  129. package/src/function.ts +19 -32
  130. package/src/index.ts +141 -39
  131. package/src/intake.ts +53 -0
  132. package/src/lock.ts +67 -21
  133. package/src/names.ts +39 -0
  134. package/src/package.ts +15 -71
  135. package/src/record.spec.ts +195 -0
  136. package/src/record.ts +489 -7
  137. package/src/release.spec.ts +47 -0
  138. package/src/release.ts +69 -0
  139. package/src/repository.ts +67 -0
  140. package/src/runner.spec.ts +11 -94
  141. package/src/runner.ts +16 -80
  142. package/src/structure.ts +0 -8
  143. package/src/task.spec.ts +67 -188
  144. package/src/task.ts +140 -522
  145. package/src/transfer.spec.ts +4 -51
  146. package/src/transfer.ts +22 -26
  147. package/src/unit-plan.spec.ts +31 -0
  148. package/src/unit-plan.ts +121 -0
  149. package/src/workspace.ts +13 -11
  150. package/dist/src/stream.d.ts +0 -97
  151. package/dist/src/stream.d.ts.map +0 -1
  152. package/dist/src/stream.js +0 -134
  153. package/dist/src/stream.js.map +0 -1
  154. package/dist/src/stream.spec.d.ts.map +0 -1
  155. package/dist/src/stream.spec.js +0 -60
  156. package/dist/src/stream.spec.js.map +0 -1
  157. package/src/stream.spec.ts +0 -88
  158. 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,43 @@ 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,
207
+ LockProgressType,
208
+ type LockProgress,
209
+ LockStatusType,
210
+ type LockStatus,
197
211
  } from './lock.js';
198
212
 
213
+ // How far a file being taken into the store has got: a deploy's file source,
214
+ // or an upload's delivery as its commit takes it in
215
+ export {
216
+ IntakeStepType,
217
+ type IntakeStep,
218
+ IntakeFileType,
219
+ type IntakeFile,
220
+ } from './intake.js';
221
+
222
+ // The repository's own records
223
+ export {
224
+ RepositoryRecordType,
225
+ type RepositoryRecord,
226
+ RepoStatusType,
227
+ type RepoStatus,
228
+ RepoMetadataType,
229
+ type RepoMetadata,
230
+ } from './repository.js';
231
+
232
+ // The release of e3 this build is, which what it keeps and ships records
233
+ export { E3_RELEASE, compareReleases } from './release.js';
234
+
235
+ // The names e3 makes paths of
236
+ export { type NamedKind, nameProblem } from './names.js';
237
+
199
238
  // Dataset transfer types
200
239
  export {
201
240
  TRANSFER_PROTOCOL_VERSION,
@@ -212,12 +251,32 @@ export {
212
251
  } from './transfer.js';
213
252
 
214
253
  // Dataset blob encoding — the ONE branch deciding segmentation, shared by the
215
- // store path (e3-core `datasetWrite`) and the package export path (e3 `export_`)
254
+ // store's door (e3-core `storeCollection`) and the package export (e3 `export_`)
216
255
  export {
217
256
  isCollectionRoot,
218
257
  encodeDatasetBlob,
258
+ writeCollectionManifest,
259
+ type CollectionSegmentRef,
260
+ type CollectionPiece,
261
+ type SegmentSink,
219
262
  } from './dataset-blob.js';
220
263
 
264
+ // The segment-object layout: a collection dataset is a manifest naming
265
+ // standalone segment objects, and the manifest is what the ref points at
266
+ export {
267
+ COLLECTION_MANIFEST_KIND,
268
+ CollectionManifestType,
269
+ CollectionManifestEntryType,
270
+ type CollectionManifest,
271
+ type CollectionManifestEntry,
272
+ isCollectionManifestType,
273
+ isCollectionManifest,
274
+ encodeCollectionManifest,
275
+ decodeCollectionManifest,
276
+ manifestElementCount,
277
+ manifestByteSize,
278
+ } from './collection-manifest.js';
279
+
221
280
  // The ONE declared-type-vs-wire-type check, shared by every door a value
222
281
  // enters a dataset through (the export, the set, the adopt, the API)
223
282
  export {
@@ -249,6 +308,7 @@ export {
249
308
  InternalErrorType,
250
309
  RepositoryNotFoundErrorType,
251
310
  DatasetTypeMismatchErrorType,
311
+ InvalidNameErrorType,
252
312
  ErrorType,
253
313
  ResponseType,
254
314
  // Repository
@@ -265,7 +325,16 @@ export {
265
325
  // Workspaces
266
326
  WorkspaceCreateRequestType,
267
327
  WorkspaceInfoType,
328
+ SchemaPolicyType,
268
329
  WorkspaceDeployRequestType,
330
+ RecordPlanType,
331
+ RecordIndexPlanType,
332
+ RecordDeployStepType,
333
+ RecordDeployStateType,
334
+ DeployProgressType,
335
+ WorkspaceDeployResultType,
336
+ WorkspaceDeployProgressType,
337
+ WorkspaceDeployStatusType,
269
338
  WorkspaceExportRequestType,
270
339
  // Workspace Status
271
340
  DatasetStatusType,
@@ -292,6 +361,9 @@ export {
292
361
  DataflowEventType,
293
362
  ApiExecutionStatusType,
294
363
  DataflowExecutionSummaryType,
364
+ DataflowBudgetType,
365
+ UnitWaitType,
366
+ SplitProgressType,
295
367
  ApiDataflowExecutionStateType,
296
368
  // Task Execution History
297
369
  ExecutionHistoryStatusType,
@@ -327,6 +399,15 @@ export {
327
399
  type WorkspaceInfo,
328
400
  type WorkspaceCreateRequest,
329
401
  type WorkspaceDeployRequest,
402
+ type SchemaPolicy,
403
+ type RecordPlan,
404
+ type RecordIndexPlan,
405
+ type RecordDeployStep,
406
+ type RecordDeployState,
407
+ type DeployProgress,
408
+ type WorkspaceDeployResult,
409
+ type WorkspaceDeployProgress,
410
+ type WorkspaceDeployStatus,
330
411
  type DatasetStatus,
331
412
  type TaskStatus as ApiTaskStatus,
332
413
  type DatasetStatusInfo,
@@ -342,6 +423,9 @@ export {
342
423
  type DataflowEvent,
343
424
  type ApiExecutionStatus,
344
425
  type DataflowExecutionSummary,
426
+ type DataflowBudget,
427
+ type UnitWait,
428
+ type SplitProgress,
345
429
  type ApiDataflowExecutionState,
346
430
  type ExecutionHistoryStatus,
347
431
  type ExecutionListItem,
@@ -371,11 +455,16 @@ export {
371
455
  type DataflowGraphTask,
372
456
  DataflowGraphType,
373
457
  type DataflowGraph,
458
+ StageUnitType,
459
+ type StageUnit,
460
+ RequeueReasonType,
461
+ type RequeueReason,
374
462
  ExecutionEventType,
375
463
  type ExecutionEvent,
376
464
  type PartitionProgress,
377
465
  DataflowExecutionStateType,
378
466
  type DataflowExecutionState,
467
+ decodeDataflowExecutionState,
379
468
  // Dataflow run history
380
469
  DataflowRunStatusType,
381
470
  type DataflowRunStatus,
@@ -386,3 +475,16 @@ export {
386
475
  DataflowRunType,
387
476
  type DataflowRun,
388
477
  } from './dataflow.js';
478
+
479
+ // A split task's unit graph, a stage at a time
480
+ export {
481
+ UNIT_PLAN_KIND,
482
+ UnitPlanGroupType,
483
+ type UnitPlanGroup,
484
+ UnitPlanStageType,
485
+ type UnitPlanStage,
486
+ UnitPlanType,
487
+ type UnitPlan,
488
+ encodeUnitPlan,
489
+ decodeUnitPlan,
490
+ } from './unit-plan.js';