@elaraai/e3-types 1.0.82 → 1.0.84

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 (47) hide show
  1. package/dist/src/api.d.ts +250 -2
  2. package/dist/src/api.d.ts.map +1 -1
  3. package/dist/src/api.js +94 -3
  4. package/dist/src/api.js.map +1 -1
  5. package/dist/src/execution.d.ts +8 -2
  6. package/dist/src/execution.d.ts.map +1 -1
  7. package/dist/src/execution.js +12 -2
  8. package/dist/src/execution.js.map +1 -1
  9. package/dist/src/execution.spec.js +5 -0
  10. package/dist/src/execution.spec.js.map +1 -1
  11. package/dist/src/function.d.ts +12 -0
  12. package/dist/src/function.d.ts.map +1 -1
  13. package/dist/src/index.d.ts +2 -2
  14. package/dist/src/index.d.ts.map +1 -1
  15. package/dist/src/index.js +4 -2
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/record.d.ts +52 -0
  18. package/dist/src/record.d.ts.map +1 -1
  19. package/dist/src/record.js +25 -0
  20. package/dist/src/record.js.map +1 -1
  21. package/dist/src/record.spec.js +43 -6
  22. package/dist/src/record.spec.js.map +1 -1
  23. package/dist/src/release.d.ts +1 -1
  24. package/dist/src/release.js +1 -1
  25. package/dist/src/runner.d.ts +22 -7
  26. package/dist/src/runner.d.ts.map +1 -1
  27. package/dist/src/runner.js +14 -11
  28. package/dist/src/runner.js.map +1 -1
  29. package/dist/src/runner.spec.js +4 -4
  30. package/dist/src/runner.spec.js.map +1 -1
  31. package/dist/src/task.d.ts +13 -1
  32. package/dist/src/task.d.ts.map +1 -1
  33. package/dist/src/task.js +1 -1
  34. package/dist/src/task.spec.js +25 -4
  35. package/dist/src/task.spec.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/api.ts +104 -3
  38. package/src/execution.spec.ts +7 -0
  39. package/src/execution.ts +12 -2
  40. package/src/index.ts +12 -0
  41. package/src/record.spec.ts +51 -5
  42. package/src/record.ts +28 -0
  43. package/src/release.ts +1 -1
  44. package/src/runner.spec.ts +4 -4
  45. package/src/runner.ts +14 -11
  46. package/src/task.spec.ts +29 -3
  47. package/src/task.ts +1 -1
@@ -13,23 +13,38 @@ import { VariantType, StructType, ArrayType, StringType, ValueTypeOf } from '@el
13
13
  /**
14
14
  * Wire representation of a runner — shared by tasks, functions and records.
15
15
  *
16
- * A known-runtime tag names a stock runner, and `platforms` names the platform
17
- * packages the units it runs load. `custom` carries a command, which e3 runs
18
- * with the arguments of a stock runner's `run`: `-i` for each input, `-o` for
19
- * the output, then the program's file. A custom task's body is its own
20
- * command, and its runner's is empty. Package authors can already execute
21
- * arbitrary commands via custom tasks, so `custom` grants no capability that
22
- * tasks don't have.
16
+ * A known-runtime tag names a stock runner: `platforms` names the platform
17
+ * packages the units it runs load, and `decode` how it reads a run unit's
18
+ * inputs — each collection `lazy`, a segment decoded as the program reaches
19
+ * it, or every input decoded `whole` before the program runs — which e3 writes
20
+ * into each run unit it stages for the runner. `custom` carries a command,
21
+ * which e3 runs with the arguments of a stock runner's `run`: `-i` for each
22
+ * input, `-o` for the output, then the program's file. A custom task's body is
23
+ * its own command, and its runner's is empty. Package authors can already
24
+ * execute arbitrary commands via custom tasks, so `custom` grants no
25
+ * capability that tasks don't have.
23
26
  */
24
27
  export declare const RunnerType: VariantType<{
25
28
  readonly east_node: StructType<{
26
29
  readonly platforms: ArrayType<StringType>;
30
+ readonly decode: VariantType<{
31
+ readonly lazy: import("@elaraai/east").NullType;
32
+ readonly whole: import("@elaraai/east").NullType;
33
+ }>;
27
34
  }>;
28
35
  readonly east_py: StructType<{
29
36
  readonly platforms: ArrayType<StringType>;
37
+ readonly decode: VariantType<{
38
+ readonly lazy: import("@elaraai/east").NullType;
39
+ readonly whole: import("@elaraai/east").NullType;
40
+ }>;
30
41
  }>;
31
42
  readonly east_c: StructType<{
32
43
  readonly platforms: ArrayType<StringType>;
44
+ readonly decode: VariantType<{
45
+ readonly lazy: import("@elaraai/east").NullType;
46
+ readonly whole: import("@elaraai/east").NullType;
47
+ }>;
33
48
  }>;
34
49
  readonly custom: StructType<{
35
50
  readonly command: ArrayType<StringType>;
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;EAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAGhF"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5G;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;EAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAGhF"}
@@ -9,22 +9,25 @@
9
9
  * tag pins the executable to one of the stock runners, which runs units through
10
10
  * its `exec` command; `custom` names a command of the author's own.
11
11
  */
12
- import { VariantType, StructType, ArrayType, StringType } from '@elaraai/east';
12
+ import { VariantType, StructType, ArrayType, StringType, UnitDecodeType } from '@elaraai/east';
13
13
  /**
14
14
  * Wire representation of a runner — shared by tasks, functions and records.
15
15
  *
16
- * A known-runtime tag names a stock runner, and `platforms` names the platform
17
- * packages the units it runs load. `custom` carries a command, which e3 runs
18
- * with the arguments of a stock runner's `run`: `-i` for each input, `-o` for
19
- * the output, then the program's file. A custom task's body is its own
20
- * command, and its runner's is empty. Package authors can already execute
21
- * arbitrary commands via custom tasks, so `custom` grants no capability that
22
- * tasks don't have.
16
+ * A known-runtime tag names a stock runner: `platforms` names the platform
17
+ * packages the units it runs load, and `decode` how it reads a run unit's
18
+ * inputs — each collection `lazy`, a segment decoded as the program reaches
19
+ * it, or every input decoded `whole` before the program runs — which e3 writes
20
+ * into each run unit it stages for the runner. `custom` carries a command,
21
+ * which e3 runs with the arguments of a stock runner's `run`: `-i` for each
22
+ * input, `-o` for the output, then the program's file. A custom task's body is
23
+ * its own command, and its runner's is empty. Package authors can already
24
+ * execute arbitrary commands via custom tasks, so `custom` grants no
25
+ * capability that tasks don't have.
23
26
  */
24
27
  export const RunnerType = VariantType({
25
- east_node: StructType({ platforms: ArrayType(StringType) }),
26
- east_py: StructType({ platforms: ArrayType(StringType) }),
27
- east_c: StructType({ platforms: ArrayType(StringType) }),
28
+ east_node: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
29
+ east_py: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
30
+ east_c: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
28
31
  custom: StructType({ command: ArrayType(StringType) }),
29
32
  });
30
33
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAe,MAAM,eA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,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACnF,MAAM,EAAK,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACnF,MAAM,EAAK,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;CAC1D,CAAC,CAAC;AAKH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAmB,EAAE,IAAc;IACpE,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"}
@@ -15,9 +15,9 @@ import * as assert from 'node:assert';
15
15
  import { variant } from '@elaraai/east';
16
16
  import { withRunnerLifeline } from './runner.js';
17
17
  const KNOWN = [
18
- ['east_node', variant('east_node', { platforms: ['@elaraai/east-node-std'] }), 'east-node'],
19
- ['east_py', variant('east_py', { platforms: ['east-py-std'] }), 'east-py'],
20
- ['east_c', variant('east_c', { platforms: ['east-c-std'] }), 'east-c'],
18
+ ['east_node', variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }), 'east-node'],
19
+ ['east_py', variant('east_py', { platforms: ['east-py-std'], decode: variant('lazy', null) }), 'east-py'],
20
+ ['east_c', variant('east_c', { platforms: ['east-c-std'], decode: variant('lazy', null) }), 'east-c'],
21
21
  ];
22
22
  describe('withRunnerLifeline', () => {
23
23
  for (const [tag, runner, bin] of KNOWN) {
@@ -32,7 +32,7 @@ describe('withRunnerLifeline', () => {
32
32
  assert.deepStrictEqual(withRunnerLifeline(runner, args), args);
33
33
  });
34
34
  it('is a no-op on a degenerate argv and does not mutate its input', () => {
35
- const runner = variant('east_c', { platforms: [] });
35
+ const runner = variant('east_c', { platforms: [], decode: variant('lazy', null) });
36
36
  assert.deepStrictEqual(withRunnerLifeline(runner, ['east-c']), ['east-c']);
37
37
  const args = ['east-c', 'exec', 'unit.beast2'];
38
38
  const before = [...args];
@@ -1 +1 @@
1
- {"version":3,"file":"runner.spec.js","sourceRoot":"","sources":["../../src/runner.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AAEnE,MAAM,KAAK,GAAyC;IAClD,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC;IAC3F,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC;IAC1E,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC;CACvE,CAAC;AAEF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC;QACvC,EAAE,CAAC,uDAAuD,GAAG,EAAE,EAAE,GAAG,EAAE;YACpE,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;YAChD,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,MAAM,EAA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AC,2EAA2E,EAAE,GAAG,EAAE;QACnF,MAAM,MAAM,GAAgB,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5F,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;QACtG,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACnF,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3E,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QACzB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -160,7 +160,7 @@ export type TaskRole = ValueTypeOf<typeof TaskRoleType>;
160
160
  * const task: TaskObject = {
161
161
  * kind: TASK_OBJECT_KIND,
162
162
  * body: variant('east', { program: '5e7a3b...' }),
163
- * runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
163
+ * runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
164
164
  * inputs: [{ path: [variant('field', 'inputs'), variant('field', 'sales')], partition: none }],
165
165
  * output: { path: [variant('field', 'tasks'), variant('field', 'totals'), variant('field', 'output')], kind: variant('value', null) },
166
166
  * role: variant('data', null),
@@ -185,12 +185,24 @@ export declare const TaskObjectType: StructType<{
185
185
  readonly runner: VariantType<{
186
186
  readonly east_node: StructType<{
187
187
  readonly platforms: ArrayType<StringType>;
188
+ readonly decode: VariantType<{
189
+ readonly lazy: NullType;
190
+ readonly whole: NullType;
191
+ }>;
188
192
  }>;
189
193
  readonly east_py: StructType<{
190
194
  readonly platforms: ArrayType<StringType>;
195
+ readonly decode: VariantType<{
196
+ readonly lazy: NullType;
197
+ readonly whole: NullType;
198
+ }>;
191
199
  }>;
192
200
  readonly east_c: StructType<{
193
201
  readonly platforms: ArrayType<StringType>;
202
+ readonly decode: VariantType<{
203
+ readonly lazy: NullType;
204
+ readonly whole: NullType;
205
+ }>;
194
206
  }>;
195
207
  readonly custom: StructType<{
196
208
  readonly command: ArrayType<StringType>;
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAmB,MAAM,eAAe,CAAC;AAInI;qBACqB;AACrB,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY;;;;;;;EAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAC/C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;EAA4C,CAAC;AAC3E,MAAM,MAAM,iB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AAO,kBAAkB,CAAC,CAAC;AAEpE,sDAAsD;AACtD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;EAGzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAK3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;EAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAC/C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc;IACzB,uCAAuC;;IAEvC,0BAA0B;;;;;;;;;IAE1B;gDAC4C;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE5C,kEAAkE;;;;;;;;;IAElE,iDAAiD;;;;;;;;;;;;;;;;;;IAEjD,8BAA8B;;;;;;;;;;;;;;IAE9B;uCACmC;;EAEnC,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAI5D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAc7D"}
package/dist/src/task.js CHANGED
@@ -107,7 +107,7 @@ export const TaskRoleType = VariantType({
107
107
  * const task: TaskObject = {
108
108
  * kind: TASK_OBJECT_KIND,
109
109
  * body: variant('east', { program: '5e7a3b...' }),
110
- * runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
110
+ * runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
111
111
  * inputs: [{ path: [variant('field', 'inputs'), variant('field', 'sales')], partition: none }],
112
112
  * output: { path: [variant('field', 'tasks'), variant('field', 'totals'), variant('field', 'output')], kind: variant('value', null) },
113
113
  * role: variant('data', null),
@@ -7,8 +7,8 @@
7
7
  */
8
8
  import { describe, it } from 'node:test';
9
9
  import assert from 'node:assert/strict';
10
- import { ArrayType, BlobType, IntegerType, OptionType, StringType, StructType, encodeBeast2For, none, some, variant } from '@elaraai/east';
11
- import { TASK_OBJECT_KIND, TaskObjectType, decodeTaskObject, } from './task.js';
10
+ import { ArrayType, BlobType, IntegerType, OptionType, StringType, StructType, VariantType, encodeBeast2For, none, some, variant } from '@elaraai/east';
11
+ import { TASK_OBJECT_KIND, TaskBodyType, TaskInputType, TaskObjectType, TaskOutputType, TaskRoleType, decodeTaskObject, } from './task.js';
12
12
  import { RunnerType } from './runner.js';
13
13
  import { TreePathType } from './structure.js';
14
14
  describe('TaskObjectType', () => {
@@ -18,7 +18,7 @@ describe('TaskObjectType', () => {
18
18
  const base = {
19
19
  kind: TASK_OBJECT_KIND,
20
20
  body: variant('east', { program: 'a'.repeat(64) }),
21
- runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
21
+ runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
22
22
  inputs: [{ path: sales, partition: none }],
23
23
  output: { path: totals, kind: variant('value', null) },
24
24
  role: variant('data', null),
@@ -40,6 +40,7 @@ describe('TaskObjectType', () => {
40
40
  },
41
41
  { ...base, output: { path: totals, kind: variant('fold', { zero: 'e'.repeat(64), combine: 'f'.repeat(64) }) } },
42
42
  { ...base, output: { path: totals, kind: variant('set', null) } },
43
+ { ...base, runner: variant('east_py', { platforms: ['east-py-std'], decode: variant('whole', null) }) },
43
44
  { ...base, role: variant('ui', { paths: [sales], functions: ['forecast'], records: ['plans'], pages: [rates] }) },
44
45
  ];
45
46
  const encode = encodeBeast2For(TaskObjectType);
@@ -62,11 +63,31 @@ describe('TaskObjectType', () => {
62
63
  output: totals,
63
64
  kind: none,
64
65
  metadata: none,
65
- runner: variant('east_node', { platforms: [] }),
66
+ runner: variant('east_node', { platforms: [], decode: variant('lazy', null) }),
66
67
  environment: none,
67
68
  });
68
69
  assert.throws(() => decodeTaskObject(older), /exported by an older e3 SDK — re-export it with the current one/);
69
70
  });
71
+ it('refuses a task object whose runner predates its decode, saying to re-export the package', () => {
72
+ // A stock runner as a package exported before runners said how they read
73
+ // a program's inputs: its platforms alone.
74
+ const PreDecodeRunnerType = VariantType({
75
+ east_node: StructType({ platforms: ArrayType(StringType) }),
76
+ east_py: StructType({ platforms: ArrayType(StringType) }),
77
+ east_c: StructType({ platforms: ArrayType(StringType) }),
78
+ custom: StructType({ command: ArrayType(StringType) }),
79
+ });
80
+ const older = encodeBeast2For(StructType({
81
+ kind: StringType,
82
+ body: TaskBodyType,
83
+ runner: PreDecodeRunnerType,
84
+ inputs: ArrayType(TaskInputType),
85
+ output: TaskOutputType,
86
+ role: TaskRoleType,
87
+ environment: OptionType(StringType),
88
+ }))({ ...base, runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }) });
89
+ assert.throws(() => decodeTaskObject(older), /exported by an older e3 SDK — re-export it with the current one/);
90
+ });
70
91
  it('refuses an object of the task shape that carries another kind tag', () => {
71
92
  assert.throws(() => decodeTaskObject(encodeBeast2For(TaskObjectType)({ ...base, kind: '$plan' })), /its kind is '\$plan', not '\$task'/);
72
93
  });
@@ -1 +1 @@
1
- {"version":3,"file":"task.spec.js","sourceRoot":"","sources":["../../src/task.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAA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B,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,oCAAoC,CAAC,CAAC;IAC3I,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/e3-types",
3
- "version": "1.0.82",
3
+ "version": "1.0.84",
4
4
  "description": "Shared type definitions for e3 (East Execution Engine)",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -18,7 +18,7 @@
18
18
  "directory": "libs/e3/packages/e3-types"
19
19
  },
20
20
  "peerDependencies": {
21
- "@elaraai/east": "1.0.82"
21
+ "@elaraai/east": "1.0.84"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.0.0",
package/src/api.ts CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  import { StructureType, TreePathType } from './structure.js';
39
39
  import { IntakeFileType } from './intake.js';
40
40
  import { RunnerType } from './runner.js';
41
- import { TaskBodyType, TaskInputType, TaskOutputType, TaskRoleType } from './task.js';
41
+ import { TaskBodyType, TaskInputType, TaskOutputType, TaskPartitionType, TaskRoleType } from './task.js';
42
42
  import { RequeueReasonType, StageUnitType } from './dataflow.js';
43
43
 
44
44
  // =============================================================================
@@ -1040,6 +1040,11 @@ export const DiagnosticType = StructType({
1040
1040
  * - `invalid`: signature/IR error; nothing ran
1041
1041
  * - `too_large`: result over `maxResultBytes`; deploy a task and read it with `datasetGet`
1042
1042
  * - `timed_out`: exceeded `timeoutMs` / the server's sync deadline guard
1043
+ *
1044
+ * `inputs` names what the call read: each dataset argument's path and the hash
1045
+ * it was pinned at, in argument order, so an answer can be reproduced and a
1046
+ * stale one noticed. It is empty for a named function call, for a one-shot
1047
+ * with value arguments only, and for an `invalid` result.
1043
1048
  */
1044
1049
  export const ExecuteResultType = StructType({
1045
1050
  outcome: VariantType({
@@ -1053,6 +1058,7 @@ export const ExecuteResultType = StructType({
1053
1058
  stderr: StringType,
1054
1059
  stdoutTruncated: BooleanType,
1055
1060
  stderrTruncated: BooleanType,
1061
+ inputs: ArrayType(StructType({ path: TreePathType, hash: StringType })),
1056
1062
  });
1057
1063
 
1058
1064
  /** Named function call. Positional args, one beast2-encoded value per param. */
@@ -1075,8 +1081,11 @@ export const FunctionSignatureType = StructType({
1075
1081
  * at call time, optionally bound to existing workspace datasets, returning
1076
1082
  * the result inline and persisting nothing.
1077
1083
  *
1078
- * SECURITY: one-shot evaluates a caller-supplied IR — remote code execution
1079
- * with the server's authority. Gate behind an elevated role.
1084
+ * SECURITY: one-shot evaluates a caller-supplied IR. One that is platform-free
1085
+ * — a stock runtime given no platform package, and a body that calls no
1086
+ * platform function — only computes over its arguments, and a caller who may
1087
+ * read the workspace may run it. Any other is code with the server's
1088
+ * authority, which only an elevated grant runs (e3-core `oneShotExecute`).
1080
1089
  */
1081
1090
  export const OneShotRequestType = StructType({
1082
1091
  bodyIr: BlobType, // anonymous EastIR, not deployed
@@ -1088,6 +1097,93 @@ export const OneShotRequestType = StructType({
1088
1097
  limits: OptionType(ExecuteLimitsType),
1089
1098
  });
1090
1099
 
1100
+ /**
1101
+ * A split call's argument: a workspace dataset, pinned by its hash at launch;
1102
+ * a stored object by its hash, such as an earlier split call's output, which
1103
+ * chains a plan's stages; or a value.
1104
+ */
1105
+ export const SplitCallArgType = VariantType({
1106
+ dataset: TreePathType,
1107
+ object: StringType,
1108
+ value: BlobType,
1109
+ });
1110
+
1111
+ /**
1112
+ * A split call: a caller's program run over a dataset's pieces as a job, as e3
1113
+ * runs an index build, and the pieces' outputs assembled by an output kind.
1114
+ *
1115
+ * `bodyIr` is the program each piece runs, which emits into its trailing
1116
+ * parameter. At least one argument is partitioned, as a task input's
1117
+ * `e3.partition` is: the pieces are cut over the partitioned argument that
1118
+ * weighs the most, the others partitioned are cut at the same keys, and one
1119
+ * not partitioned reaches every piece whole. `output` is how the pieces'
1120
+ * outputs combine, as a task's output kinds do, with its programs and its zero
1121
+ * inline. `then`, when given, runs once over the assembled output and then the
1122
+ * arguments, and its value is the call's.
1123
+ *
1124
+ * SECURITY: a caller whose one-shot grant is `platform_free` may launch one
1125
+ * only when it is platform-free: a stock runtime given no platform package,
1126
+ * and none of `bodyIr`, `then`, `merge` or `combine` calling a platform
1127
+ * function (e3-core `splitCallPlatformUse`).
1128
+ */
1129
+ export const SplitCallRequestType = StructType({
1130
+ bodyIr: BlobType,
1131
+ args: ArrayType(StructType({
1132
+ arg: SplitCallArgType,
1133
+ partition: OptionType(TaskPartitionType),
1134
+ })),
1135
+ output: VariantType({
1136
+ array: NullType,
1137
+ dict: StructType({ merge: OptionType(BlobType) }),
1138
+ fold: StructType({ combine: BlobType, zero: BlobType }),
1139
+ set: NullType,
1140
+ }),
1141
+ then: OptionType(BlobType),
1142
+ runner: RunnerType,
1143
+ limits: OptionType(ExecuteLimitsType),
1144
+ });
1145
+
1146
+ /**
1147
+ * How far a split call's job has got: the stage its units are in — the pieces
1148
+ * (`partition`), a merge of a set's or a dict's outputs, or a fold's partials
1149
+ * combined — and how many of the stage's units have finished.
1150
+ */
1151
+ export const SplitCallProgressType = StructType({
1152
+ phase: VariantType({ combine: NullType, merge: NullType, partition: NullType }),
1153
+ done: IntegerType,
1154
+ units: IntegerType,
1155
+ });
1156
+
1157
+ /**
1158
+ * What a split call's pieces would be, which an explain's job plans and runs
1159
+ * nothing for: the piece count, the argument they are cut over, by its
1160
+ * position, and what that argument weighs in the store, in bytes.
1161
+ */
1162
+ export const SplitCallPlanType = StructType({
1163
+ pieces: IntegerType,
1164
+ over: IntegerType,
1165
+ bytes: IntegerType,
1166
+ });
1167
+
1168
+ /**
1169
+ * A split call's status, as its poll answers it.
1170
+ *
1171
+ * - `processing`: the job runs, and how far it has got once it has said
1172
+ * - `completed`: the call's result, and the assembled output's hash once the
1173
+ * pieces ran — what a caller reads through the object route when the result
1174
+ * is `too_large`, or passes on as the next call's `object` argument; an
1175
+ * explain found wrong ends here too, `invalid`
1176
+ * - `planned`: an explain's answer, the pieces the call's run would cut, which
1177
+ * its job stored for the run to take up, and ran no unit for
1178
+ * - `failed`: why e3 could not run it
1179
+ */
1180
+ export const SplitCallStatusType = VariantType({
1181
+ processing: OptionType(SplitCallProgressType),
1182
+ completed: StructType({ result: ExecuteResultType, output: OptionType(StringType) }),
1183
+ planned: SplitCallPlanType,
1184
+ failed: StructType({ message: StringType }),
1185
+ });
1186
+
1091
1187
  /**
1092
1188
  * A record mutation call. Positional args (after the implicit current state),
1093
1189
  * one beast2-encoded value per declared parameter.
@@ -1228,6 +1324,11 @@ export type ExecuteResult = ValueTypeOf<typeof ExecuteResultType>;
1228
1324
  export type FunctionCallRequest = ValueTypeOf<typeof FunctionCallRequestType>;
1229
1325
  export type FunctionSignature = ValueTypeOf<typeof FunctionSignatureType>;
1230
1326
  export type OneShotRequest = ValueTypeOf<typeof OneShotRequestType>;
1327
+ export type SplitCallArg = ValueTypeOf<typeof SplitCallArgType>;
1328
+ export type SplitCallRequest = ValueTypeOf<typeof SplitCallRequestType>;
1329
+ export type SplitCallProgress = ValueTypeOf<typeof SplitCallProgressType>;
1330
+ export type SplitCallStatus = ValueTypeOf<typeof SplitCallStatusType>;
1331
+ export type SplitCallPlan = ValueTypeOf<typeof SplitCallPlanType>;
1231
1332
  export type MutationCallRequest = ValueTypeOf<typeof MutationCallRequestType>;
1232
1333
  export type MutationResult = ValueTypeOf<typeof MutationResultType>;
1233
1334
  export type RecordSignature = ValueTypeOf<typeof RecordSignatureType>;
@@ -70,6 +70,13 @@ describe('ExecutionStatusType', () => {
70
70
  assert.deepEqual(executionStatusRoots(variant('cancelled', { ...stopped, unit: false })), []);
71
71
  });
72
72
 
73
+ it('keeps from gc the inputs a running attempt reads, passing over a merge\'s tag', () => {
74
+ const running = { executionId: '0199-c', startedAt: new Date(1000), pid: 4242n, pidStartTime: 7n, bootId: 'boot' };
75
+ assert.deepEqual(executionStatusRoots(variant('running', { ...running, inputHashes: ['a'.repeat(64), 'd'.repeat(64)], unit: false })),
76
+ ['a'.repeat(64), 'd'.repeat(64)]);
77
+ assert.deepEqual(executionStatusRoots(variant('running', { ...running, inputHashes: ['merge', 'e'.repeat(64)], unit: true })), ['e'.repeat(64)]);
78
+ });
79
+
73
80
  it('refuses a record an older e3 wrote, naming the fix', () => {
74
81
  const refusal = /^Error: the execution status does not decode: an older e3 wrote this repository — re-create it: deploy again and import its data again \(/;
75
82
  const records = [
package/src/execution.ts CHANGED
@@ -175,19 +175,29 @@ export const ExecutionStatusType = VariantType({
175
175
 
176
176
  export type ExecutionStatus = ValueTypeOf<typeof ExecutionStatusType>;
177
177
 
178
+ /** An object's hash: a SHA-256 in lowercase hex. */
179
+ const OBJECT_HASH = /^[0-9a-f]{64}$/;
180
+
178
181
  /**
179
182
  * The objects an execution's record keeps from garbage collection: a
180
183
  * 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.
184
+ * before it and so the units gc keeps beside the task; and the inputs a
185
+ * running attempt reads.
182
186
  *
183
187
  * @remarks
184
188
  * Every backend's scan of execution roots applies it, as gc does to the
185
- * executions it keeps.
189
+ * executions it keeps. A running attempt reads its inputs as it goes — a unit
190
+ * fetches their segments as it reads them — so gc beside running work never
191
+ * takes one from under it, however long it runs: a merge's `merge` tag, which
192
+ * names no object, is passed over. gc keeps whatever is running, so a
193
+ * `running` record nothing repairs keeps its inputs until an execution of its
194
+ * task over them does.
186
195
  *
187
196
  * @param status - the execution's status
188
197
  * @returns the hashes of the objects it keeps
189
198
  */
190
199
  export function executionStatusRoots(status: ExecutionStatus): string[] {
200
+ if (status.type === 'running') return status.value.inputHashes.filter((hash) => OBJECT_HASH.test(hash));
191
201
  if (status.type !== 'success') return [];
192
202
  const { outputHash, plan } = status.value;
193
203
  return plan.type === 'some' ? [outputHash, plan.value] : [outputHash];
package/src/index.ts CHANGED
@@ -122,6 +122,7 @@ export {
122
122
  decodeRecordObject,
123
123
  RecordIndexObjectType,
124
124
  type RecordIndexObject,
125
+ decodeRecordIndexObject,
125
126
  RECORD_STATE_KIND,
126
127
  RecordStateType,
127
128
  type RecordState,
@@ -380,6 +381,12 @@ export {
380
381
  FunctionCallRequestType,
381
382
  FunctionSignatureType,
382
383
  OneShotRequestType,
384
+ // Split calls
385
+ SplitCallArgType,
386
+ SplitCallRequestType,
387
+ SplitCallProgressType,
388
+ SplitCallStatusType,
389
+ SplitCallPlanType,
383
390
  MutationCallRequestType,
384
391
  MutationResultType,
385
392
  RecordSignatureType,
@@ -438,6 +445,11 @@ export {
438
445
  type FunctionCallRequest,
439
446
  type FunctionSignature,
440
447
  type OneShotRequest,
448
+ type SplitCallArg,
449
+ type SplitCallRequest,
450
+ type SplitCallProgress,
451
+ type SplitCallStatus,
452
+ type SplitCallPlan,
441
453
  type MutationCallRequest,
442
454
  type MutationResult,
443
455
  type RecordSignature,
@@ -6,26 +6,29 @@
6
6
  /**
7
7
  * The record wire types' decoders: each reads the current shape, and refuses
8
8
  * an older one naming the fix — a commit an older e3 wrote, whose repository
9
- * is re-created, and a mutation, migration or record object an older SDK
10
- * exported, whose package is re-exported.
9
+ * is re-created, and a mutation, migration, index or record object an older
10
+ * SDK exported, whose package is re-exported.
11
11
  */
12
12
 
13
13
  import { describe, it } from 'node:test';
14
14
  import assert from 'node:assert/strict';
15
- import { DateTimeType, DictType, IntegerType, OptionType, StringType, StructType, ArrayType, EastTypeType, encodeBeast2For, isTypeValueEqual, some, toEastTypeValue, variant } from '@elaraai/east';
15
+ import { BooleanType, DateTimeType, DictType, IntegerType, OptionType, StringType, StructType, ArrayType, EastTypeType, VariantType, encodeBeast2For, isTypeValueEqual, some, toEastTypeValue, variant } from '@elaraai/east';
16
16
  import { RunnerType } from './runner.js';
17
17
  import {
18
18
  MigrationObjectType,
19
19
  MutationObjectType,
20
20
  RecordCommitType,
21
+ RecordIndexObjectType,
21
22
  RecordObjectType,
22
23
  decodeMigrationObject,
23
24
  decodeMutationObject,
24
25
  decodeRecordCommit,
26
+ decodeRecordIndexObject,
25
27
  decodeRecordObject,
26
28
  type MigrationObject,
27
29
  type MutationObject,
28
30
  type RecordCommit,
31
+ type RecordIndexObject,
29
32
  type RecordObject,
30
33
  } from './record.js';
31
34
 
@@ -65,7 +68,7 @@ describe('decodeMutationObject', () => {
65
68
  const mutation: MutationObject = {
66
69
  bodyIr: 'a'.repeat(64),
67
70
  argTypes: [toEastTypeValue(IntegerType)],
68
- runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
71
+ runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
69
72
  form: variant('edit', null),
70
73
  programIr: 'b'.repeat(64),
71
74
  };
@@ -113,6 +116,49 @@ describe('decodeMutationObject', () => {
113
116
  });
114
117
  });
115
118
 
119
+ describe('decodeRecordIndexObject', () => {
120
+ const index: RecordIndexObject = {
121
+ keyIr: 'a'.repeat(64),
122
+ multi: false,
123
+ valueIr: some('b'.repeat(64)),
124
+ keyType: toEastTypeValue(StringType),
125
+ valueType: toEastTypeValue(IntegerType),
126
+ buildIr: 'c'.repeat(64),
127
+ runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('whole', null) }),
128
+ };
129
+
130
+ it('round-trips a current index object, its types among it', () => {
131
+ const decoded = decodeRecordIndexObject(encodeBeast2For(RecordIndexObjectType)(index));
132
+ // A decoded type value carries no memoized identity, so only the East
133
+ // comparison says whether two of them are the same type.
134
+ assert.ok(isTypeValueEqual(decoded.keyType, index.keyType));
135
+ assert.ok(isTypeValueEqual(decoded.valueType, index.valueType));
136
+ const { keyType: _keyType, valueType: _valueType, ...rest } = decoded;
137
+ const { keyType: _k, valueType: _v, ...expected } = index;
138
+ assert.deepEqual(rest, expected);
139
+ });
140
+
141
+ it('refuses an index object whose runner predates its decode, naming the fix', () => {
142
+ // A stock runner as a package exported before runners said how they read
143
+ // a program's inputs: its platforms alone.
144
+ const PreDecodeRunnerType = VariantType({
145
+ east_node: StructType({ platforms: ArrayType(StringType) }),
146
+ east_py: StructType({ platforms: ArrayType(StringType) }),
147
+ east_c: StructType({ platforms: ArrayType(StringType) }),
148
+ custom: StructType({ command: ArrayType(StringType) }),
149
+ });
150
+ const PreDecodeIndexType = StructType({
151
+ keyIr: StringType, multi: BooleanType, valueIr: OptionType(StringType), keyType: EastTypeType,
152
+ valueType: EastTypeType, buildIr: StringType, runner: PreDecodeRunnerType,
153
+ });
154
+ const older = encodeBeast2For(PreDecodeIndexType)({ ...index, runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }) });
155
+ assert.throws(
156
+ () => decodeRecordIndexObject(older),
157
+ /^Error: the index object does not decode: the package was exported by an older e3 SDK — re-export it with the current one \(/,
158
+ );
159
+ });
160
+ });
161
+
116
162
  describe('decodeMigrationObject', () => {
117
163
  const RowV1Type = StructType({ name: StringType });
118
164
  const RowV2Type = StructType({ name: StringType, shift: IntegerType });
@@ -122,7 +168,7 @@ describe('decodeMigrationObject', () => {
122
168
  to: toEastTypeValue(DictType(StringType, RowV2Type)),
123
169
  bodyIr: 'a'.repeat(64),
124
170
  programIr: 'b'.repeat(64),
125
- runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
171
+ runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
126
172
  };
127
173
 
128
174
  it('round-trips a current migration, its types among it', () => {