@elaraai/e3-types 1.0.83 → 1.0.85

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 (92) hide show
  1. package/dist/src/api.d.ts +583 -17
  2. package/dist/src/api.d.ts.map +1 -1
  3. package/dist/src/api.js +208 -22
  4. package/dist/src/api.js.map +1 -1
  5. package/dist/src/dataflow.d.ts +115 -12
  6. package/dist/src/dataflow.d.ts.map +1 -1
  7. package/dist/src/dataflow.js +151 -15
  8. package/dist/src/dataflow.js.map +1 -1
  9. package/dist/src/dataflow.spec.js +41 -7
  10. package/dist/src/dataflow.spec.js.map +1 -1
  11. package/dist/src/dataset-blob.d.ts +19 -2
  12. package/dist/src/dataset-blob.d.ts.map +1 -1
  13. package/dist/src/dataset-blob.js +100 -21
  14. package/dist/src/dataset-blob.js.map +1 -1
  15. package/dist/src/dataset-blob.spec.js +132 -0
  16. package/dist/src/dataset-blob.spec.js.map +1 -1
  17. package/dist/src/execution.d.ts +68 -8
  18. package/dist/src/execution.d.ts.map +1 -1
  19. package/dist/src/execution.js +49 -8
  20. package/dist/src/execution.js.map +1 -1
  21. package/dist/src/execution.spec.js +31 -9
  22. package/dist/src/execution.spec.js.map +1 -1
  23. package/dist/src/function.d.ts +12 -0
  24. package/dist/src/function.d.ts.map +1 -1
  25. package/dist/src/index.d.ts +9 -8
  26. package/dist/src/index.d.ts.map +1 -1
  27. package/dist/src/index.js +15 -12
  28. package/dist/src/index.js.map +1 -1
  29. package/dist/src/names.d.ts +9 -0
  30. package/dist/src/names.d.ts.map +1 -1
  31. package/dist/src/names.js.map +1 -1
  32. package/dist/src/pieces.d.ts +47 -0
  33. package/dist/src/pieces.d.ts.map +1 -0
  34. package/dist/src/pieces.js +17 -0
  35. package/dist/src/pieces.js.map +1 -0
  36. package/dist/src/pieces.spec.d.ts +6 -0
  37. package/dist/src/pieces.spec.d.ts.map +1 -0
  38. package/dist/src/pieces.spec.js +20 -0
  39. package/dist/src/pieces.spec.js.map +1 -0
  40. package/dist/src/record.d.ts +52 -0
  41. package/dist/src/record.d.ts.map +1 -1
  42. package/dist/src/record.js +25 -0
  43. package/dist/src/record.js.map +1 -1
  44. package/dist/src/record.spec.js +43 -6
  45. package/dist/src/record.spec.js.map +1 -1
  46. package/dist/src/release.d.ts +1 -1
  47. package/dist/src/release.js +1 -1
  48. package/dist/src/repository.d.ts +16 -0
  49. package/dist/src/repository.d.ts.map +1 -1
  50. package/dist/src/repository.js +15 -0
  51. package/dist/src/repository.js.map +1 -1
  52. package/dist/src/runner.d.ts +22 -7
  53. package/dist/src/runner.d.ts.map +1 -1
  54. package/dist/src/runner.js +14 -11
  55. package/dist/src/runner.js.map +1 -1
  56. package/dist/src/runner.spec.js +4 -4
  57. package/dist/src/runner.spec.js.map +1 -1
  58. package/dist/src/structure.d.ts +27 -0
  59. package/dist/src/structure.d.ts.map +1 -1
  60. package/dist/src/structure.js +59 -18
  61. package/dist/src/structure.js.map +1 -1
  62. package/dist/src/structure.spec.d.ts +6 -0
  63. package/dist/src/structure.spec.d.ts.map +1 -0
  64. package/dist/src/structure.spec.js +57 -0
  65. package/dist/src/structure.spec.js.map +1 -0
  66. package/dist/src/task.d.ts +13 -1
  67. package/dist/src/task.d.ts.map +1 -1
  68. package/dist/src/task.js +1 -1
  69. package/dist/src/task.spec.js +25 -4
  70. package/dist/src/task.spec.js.map +1 -1
  71. package/package.json +3 -2
  72. package/src/api.ts +225 -21
  73. package/src/dataflow.spec.ts +49 -7
  74. package/src/dataflow.ts +160 -14
  75. package/src/dataset-blob.spec.ts +147 -0
  76. package/src/dataset-blob.ts +97 -20
  77. package/src/execution.spec.ts +31 -9
  78. package/src/execution.ts +52 -7
  79. package/src/index.ts +39 -2
  80. package/src/names.ts +12 -0
  81. package/src/pieces.spec.ts +23 -0
  82. package/src/pieces.ts +49 -0
  83. package/src/record.spec.ts +51 -5
  84. package/src/record.ts +28 -0
  85. package/src/release.ts +1 -1
  86. package/src/repository.ts +18 -0
  87. package/src/runner.spec.ts +4 -4
  88. package/src/runner.ts +14 -11
  89. package/src/structure.spec.ts +65 -0
  90. package/src/structure.ts +64 -21
  91. package/src/task.spec.ts +29 -3
  92. package/src/task.ts +1 -1
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Keypaths: `parseKeypath` reads back what `pathToString` writes, whatever a
7
+ * field is named, with no structure to check it against; `parsePath` reads the
8
+ * same syntax and checks each field against a structure as it reads it.
9
+ */
10
+ import { describe, it } from 'node:test';
11
+ import assert from 'node:assert/strict';
12
+ import { IntegerType, equalFor, printFor, toEastTypeValue, variant } from '@elaraai/east';
13
+ import { TreePathType, parseKeypath, parsePath, pathToString } from './structure.js';
14
+ const equalPath = equalFor(TreePathType);
15
+ const printPath = printFor(TreePathType);
16
+ describe('parseKeypath', () => {
17
+ it('reads back what pathToString writes, whatever a field is named', () => {
18
+ const names = ['inputs', 'my field', 'a.b', 'a/b', 'back`tick', 'back\\slash', 'café', '1st', '', '`'];
19
+ for (const name of names) {
20
+ const path = [variant('field', 'inputs'), variant('field', name)];
21
+ const printed = pathToString(path);
22
+ if (name === '') {
23
+ // An empty field name prints as nothing a keypath can read.
24
+ assert.throws(() => parseKeypath(printed));
25
+ continue;
26
+ }
27
+ const read = parseKeypath(printed);
28
+ assert.ok(equalPath(read, path), `${JSON.stringify(name)}: ${printed} read back as ${printPath(read)}`);
29
+ }
30
+ });
31
+ it('reads the empty string as the root', () => {
32
+ assert.ok(equalPath(parseKeypath(''), []));
33
+ });
34
+ it('refuses a string that is not a keypath, naming where', () => {
35
+ assert.throws(() => parseKeypath('inputs.x'), { message: "parseKeypath: unexpected character at position 0: 'i'" });
36
+ assert.throws(() => parseKeypath('.inputs.'), { message: "parseKeypath: expected identifier after '.' at position 8" });
37
+ assert.throws(() => parseKeypath('.inputs!'), { message: "parseKeypath: unexpected character at position 7: '!'" });
38
+ });
39
+ });
40
+ describe('parsePath', () => {
41
+ const structure = variant('struct', new Map([
42
+ ['inputs', variant('struct', new Map([
43
+ ['sales', variant('value', { type: toEastTypeValue(IntegerType), writable: true })],
44
+ ]))],
45
+ ]));
46
+ it('reads a keypath, and the structure at it', () => {
47
+ const { path, structure: at } = parsePath('.inputs.sales', structure);
48
+ assert.ok(equalPath(path, [variant('field', 'inputs'), variant('field', 'sales')]));
49
+ assert.equal(at.type, 'value');
50
+ });
51
+ it('refuses a field the structure lacks before a malformed one after it, and a path into a dataset', () => {
52
+ assert.throws(() => parsePath('.nope!', structure), { message: "parsePath: field 'nope' not found at ''. Available: inputs" });
53
+ assert.throws(() => parsePath('.inputs!', structure), { message: "parsePath: unexpected character at position 7: '!'" });
54
+ assert.throws(() => parsePath('.inputs.sales.more', structure), { message: "parsePath: cannot descend into dataset at '.inputs.sales'" });
55
+ });
56
+ });
57
+ //# sourceMappingURL=structure.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.spec.js","sourceRoot":"","sources":["../../src/structure.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAiC,MAAM,gBAAgB,CAAC;AAEpH,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AACzC,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AAEzC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACxE,MAAM,KAA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,EAAE,EAAE,OAAO,EAAE,oDAAoD,EAAE,CAAC,CAAC;QACzH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,2DAA2D,EAAE,CAAC,CAAC;IAC5I,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;;;;;;;;;;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jD,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,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC3I,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GAEjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnG,MAAM,IAAI,GAAe;QACvB,IAAI,EAAE,gBAAgB;QACtB,IA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AI,EAAE,YAAY;YAClB,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC;SACpC,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC1F,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,iEAAiE,CAAC,CAAC;IAClH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,gBAAgB,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.83",
3
+ "version": "1.0.85",
4
4
  "description": "Shared type definitions for e3 (East Execution Engine)",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -18,12 +18,13 @@
18
18
  "directory": "libs/e3/packages/e3-types"
19
19
  },
20
20
  "peerDependencies": {
21
- "@elaraai/east": "1.0.83"
21
+ "@elaraai/east": "1.0.85"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.0.0",
25
25
  "@typescript-eslint/eslint-plugin": "^8.47.0",
26
26
  "@typescript-eslint/parser": "^8.47.0",
27
+ "eslint": "^9.0.0",
27
28
  "eslint-plugin-headers": "^1.3.3",
28
29
  "typescript": "^5.7.2"
29
30
  },
package/src/api.ts CHANGED
@@ -36,10 +36,11 @@ import {
36
36
  } from '@elaraai/east';
37
37
 
38
38
  import { StructureType, TreePathType } from './structure.js';
39
+ import { StopReasonType } from './execution.js';
39
40
  import { IntakeFileType } from './intake.js';
40
41
  import { RunnerType } from './runner.js';
41
42
  import { TaskBodyType, TaskInputType, TaskOutputType, TaskPartitionType, TaskRoleType } from './task.js';
42
- import { RequeueReasonType, StageUnitType } from './dataflow.js';
43
+ import { DataflowForceType, RequeueReasonType, StageUnitType } from './dataflow.js';
43
44
 
44
45
  // =============================================================================
45
46
  // Error Types
@@ -565,6 +566,9 @@ export const DatasetStatusInfoType = StructType({
565
566
  * @property peakBytes - The highest peak resident memory, in bytes, a runner
566
567
  * of the execution the status comes from reached: the one the output came
567
568
  * from, or the failure; `none` when it recorded none, or while it runs
569
+ * @property stopped - Why the latest attempt over the task's current inputs
570
+ * stopped, when it was cancelled or interrupted and the task therefore reads
571
+ * `ready`; `none` otherwise
568
572
  */
569
573
  export const TaskStatusInfoType = StructType({
570
574
  name: StringType,
@@ -574,6 +578,7 @@ export const TaskStatusInfoType = StructType({
574
578
  output: StringType,
575
579
  dependsOn: ArrayType(StringType),
576
580
  peakBytes: OptionType(IntegerType),
581
+ stopped: OptionType(StopReasonType),
577
582
  });
578
583
 
579
584
  /**
@@ -664,11 +669,15 @@ export const TaskDetailsType = StructType({
664
669
  * Request to start dataflow execution. The run takes the server's budget of
665
670
  * cores and memory, which it shares with everything else the server runs.
666
671
  *
667
- * @property force - Force re-execution of all tasks
668
- * @property filter - Filter to specific task names (glob pattern)
672
+ * @property force - The tasks the run re-executes even where the cache holds
673
+ * their results: none, all, or the tasks named ({@link DataflowForceType}).
674
+ * A start naming a task the graph does not have, or one the filter's run set
675
+ * leaves out, is refused before anything runs.
676
+ * @property filter - One task's exact name: the run runs that task and its
677
+ * dependency closure, and no other task
669
678
  */
670
679
  export const DataflowRequestType = StructType({
671
- force: BooleanType,
680
+ force: DataflowForceType,
672
681
  filter: OptionType(StringType),
673
682
  });
674
683
 
@@ -689,6 +698,29 @@ export const LogChunkType = StructType({
689
698
  complete: BooleanType,
690
699
  });
691
700
 
701
+ /**
702
+ * Chunk of a task's log, as the logs route serves it: a {@link LogChunkType}'s
703
+ * fields, and the execution it was read from. A client polling the log reads
704
+ * on from its offset, starts over when the execution changes, and stops
705
+ * reading once the execution has ended and its log is read.
706
+ *
707
+ * @property inputsHash - The execution's inputs hash, which a request names,
708
+ * with its id, to read on from the same execution
709
+ * @property executionId - The execution's id
710
+ * @property ended - True once the execution is recorded as anything but
711
+ * running: its log grows no more
712
+ */
713
+ export const TaskLogChunkType = StructType({
714
+ data: StringType,
715
+ offset: IntegerType,
716
+ size: IntegerType,
717
+ totalSize: IntegerType,
718
+ complete: BooleanType,
719
+ inputsHash: StringType,
720
+ executionId: StringType,
721
+ ended: BooleanType,
722
+ });
723
+
692
724
  /**
693
725
  * Result of executing a single task.
694
726
  *
@@ -876,12 +908,32 @@ export const SplitProgressType = StructType({
876
908
  * DataflowExecutionStateType in dataflow.ts which stores the full
877
909
  * execution state on disk.
878
910
  *
911
+ * A poll names a cursor (`since`), the sequence number of the last event it
912
+ * has, and is served the run's events past it, at most its `limit`, and never
913
+ * more than {@link DATAFLOW_POLL_EVENTS_MAX}; the response's `nextSeq` is the
914
+ * cursor of the poll after it. A poll that has every event reads no event of
915
+ * the run, so a client polls on a timer for the whole run at the cost of what
916
+ * is new.
917
+ *
918
+ * The response names the run (`runId`) and where its events end (`lastSeq`).
919
+ * A cursor counts a run's own events, so a client that sees another run starts
920
+ * from 0. A poll whose `nextSeq` is before `lastSeq` left events for the next,
921
+ * which a client reads before it takes a run's end as its last word; and a
922
+ * client opens a running run's feed near its tail from `lastSeq`, or follows
923
+ * its progress with polls that ask for no events (`limit` 0).
924
+ *
925
+ * @property runId - The run's id, a UUIDv7
879
926
  * @property status - Current execution status
880
927
  * @property startedAt - ISO timestamp when execution started
881
928
  * @property completedAt - ISO timestamp when execution finished (if done)
882
929
  * @property summary - Execution summary (available when complete)
883
- * @property events - Task events (may be paginated via offset/limit)
884
- * @property totalEvents - Total number of events (for pagination)
930
+ * @property events - The run's task events past the poll's cursor, at most
931
+ * its limit, in the order they happened
932
+ * @property nextSeq - The cursor past the events served, which the next poll
933
+ * passes as `since`: the poll's own when it served none
934
+ * @property lastSeq - The sequence number of the run's last event when the
935
+ * poll read it, 0 while it has none: the cursor of a poll that has every
936
+ * event
885
937
  * @property budget - The server's budget now, where it has one: a server whose
886
938
  * runners hold none, as a remote backend's, serves `none`
887
939
  * @property waiting - The tasks and units of the run waiting for room, while it
@@ -890,25 +942,36 @@ export const SplitProgressType = StructType({
890
942
  * stores it
891
943
  */
892
944
  export const ApiDataflowExecutionStateType = StructType({
945
+ runId: StringType,
893
946
  status: ApiExecutionStatusType,
894
947
  startedAt: StringType,
895
948
  completedAt: OptionType(StringType),
896
949
  summary: OptionType(DataflowExecutionSummaryType),
897
950
  events: ArrayType(DataflowEventType),
898
- totalEvents: IntegerType,
951
+ nextSeq: IntegerType,
952
+ lastSeq: IntegerType,
899
953
  budget: OptionType(DataflowBudgetType),
900
954
  waiting: ArrayType(UnitWaitType),
901
955
  splits: ArrayType(SplitProgressType),
902
956
  });
903
957
 
958
+ /**
959
+ * The most events a poll of a run is served ({@link ApiDataflowExecutionStateType}):
960
+ * a poll that names no `limit`, or a larger one, is served this many, so an
961
+ * answer stays within what a host's response may hold however long the run. A
962
+ * client reads on from the answer's `nextSeq`.
963
+ */
964
+ export const DATAFLOW_POLL_EVENTS_MAX = 1_000;
965
+
904
966
  // =============================================================================
905
967
  // Task Execution History Types
906
968
  // =============================================================================
907
969
 
908
970
  /**
909
971
  * Execution status for history listing: `cancelled` when e3 stopped the
910
- * execution because its run was aborted, `interrupted` when the orchestrator
911
- * that owned it exited before it finished.
972
+ * execution because the signal it ran under was aborted, `interrupted` when
973
+ * it can no longer finish — its runner and its owner are gone, its host says
974
+ * so, or its run yielded mid-stage. Each says why in its item's `reason`.
912
975
  */
913
976
  export const ExecutionHistoryStatusType = VariantType({
914
977
  running: NullType,
@@ -920,9 +983,12 @@ export const ExecutionHistoryStatusType = VariantType({
920
983
  });
921
984
 
922
985
  /**
923
- * A single execution in task history.
986
+ * A single execution in task history: a run of the task, never a split task's
987
+ * unit. The history lists them the latest first, a page at a time.
924
988
  *
925
989
  * @property inputsHash - Hash of concatenated inputs (execution identifier)
990
+ * @property executionId - The run's id, a UUIDv7: the next page is the runs
991
+ * before the last one's
926
992
  * @property inputHashes - Individual input object hashes
927
993
  * @property status - Execution outcome
928
994
  * @property startedAt - ISO timestamp when execution started
@@ -931,9 +997,11 @@ export const ExecutionHistoryStatusType = VariantType({
931
997
  * @property exitCode - Process exit code (if failed)
932
998
  * @property peakBytes - The highest peak resident memory, in bytes, a runner
933
999
  * of the execution reached, when it succeeded or failed and one reported it
1000
+ * @property reason - Why it stopped, when it was cancelled or interrupted
934
1001
  */
935
1002
  export const ExecutionListItemType = StructType({
936
1003
  inputsHash: StringType,
1004
+ executionId: StringType,
937
1005
  inputHashes: ArrayType(StringType),
938
1006
  status: ExecutionHistoryStatusType,
939
1007
  startedAt: StringType,
@@ -941,8 +1009,23 @@ export const ExecutionListItemType = StructType({
941
1009
  duration: OptionType(IntegerType),
942
1010
  exitCode: OptionType(IntegerType),
943
1011
  peakBytes: OptionType(IntegerType),
1012
+ reason: OptionType(StopReasonType),
944
1013
  });
945
1014
 
1015
+ /**
1016
+ * The runs a page of a task's history holds when its request names no
1017
+ * `limit`.
1018
+ */
1019
+ export const TASK_EXECUTIONS_PAGE_DEFAULT = 100;
1020
+
1021
+ /**
1022
+ * The most runs a page of a task's history holds ({@link ExecutionListItemType}):
1023
+ * a request naming a larger `limit` is served this many, so a page stays
1024
+ * within what a host's response may hold. A client reads on with the last
1025
+ * run's id as `before`.
1026
+ */
1027
+ export const TASK_EXECUTIONS_PAGE_MAX = 1_000;
1028
+
946
1029
  // =============================================================================
947
1030
  // Dataset List Types (recursive)
948
1031
  // =============================================================================
@@ -1043,8 +1126,8 @@ export const DiagnosticType = StructType({
1043
1126
  *
1044
1127
  * `inputs` names what the call read: each dataset argument's path and the hash
1045
1128
  * 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.
1129
+ * stale one noticed. It is empty for a call with value arguments only, and for
1130
+ * an `invalid` result.
1048
1131
  */
1049
1132
  export const ExecuteResultType = StructType({
1050
1133
  outcome: VariantType({
@@ -1061,9 +1144,24 @@ export const ExecuteResultType = StructType({
1061
1144
  inputs: ArrayType(StructType({ path: TreePathType, hash: StringType })),
1062
1145
  });
1063
1146
 
1064
- /** Named function call. Positional args, one beast2-encoded value per param. */
1147
+ /**
1148
+ * A call's argument: a beast2-encoded value, or a dataset of the workspace the
1149
+ * call runs in, resolved and pinned by its content hash at launch and named in
1150
+ * the result's `inputs`. A named function call and a one-shot take it alike.
1151
+ */
1152
+ export const CallArgType = VariantType({
1153
+ value: BlobType,
1154
+ dataset: TreePathType,
1155
+ });
1156
+
1157
+ /**
1158
+ * Named function call. Positional args, one per param: a value, or a dataset
1159
+ * of the workspace ({@link CallArgType}). The package-scoped route has no
1160
+ * workspace to read a dataset from, and answers a dataset argument `invalid`;
1161
+ * the workspace-scoped route pins it, as a one-shot's is.
1162
+ */
1065
1163
  export const FunctionCallRequestType = StructType({
1066
- args: ArrayType(BlobType),
1164
+ args: ArrayType(CallArgType),
1067
1165
  runner: OptionType(RunnerType), // optional override; only the known runtimes
1068
1166
  limits: OptionType(ExecuteLimitsType),
1069
1167
  });
@@ -1089,10 +1187,7 @@ export const FunctionSignatureType = StructType({
1089
1187
  */
1090
1188
  export const OneShotRequestType = StructType({
1091
1189
  bodyIr: BlobType, // anonymous EastIR, not deployed
1092
- args: ArrayType(VariantType({ // each arg: an inline value OR a live dataset
1093
- value: BlobType,
1094
- dataset: TreePathType, // workspace-scoped; resolved + pinned by content hash at launch
1095
- })),
1190
+ args: ArrayType(CallArgType), // each arg: an inline value OR a live dataset, pinned at launch
1096
1191
  runner: RunnerType,
1097
1192
  limits: OptionType(ExecuteLimitsType),
1098
1193
  });
@@ -1219,10 +1314,26 @@ export const MutationResultType = StructType({
1219
1314
  }),
1220
1315
  });
1221
1316
 
1317
+ /**
1318
+ * When a record applied one step of its migration chain.
1319
+ *
1320
+ * @property at - When the step was applied: the time of the deploy that
1321
+ * applied it; `none` for a step a record applied before e3 kept the time
1322
+ * @property commit - The commit that applied it: its `$migrate:<name>` commit,
1323
+ * or the `$init` or `$reset` commit that counted the chain applied; `none`
1324
+ * once a compaction has cut it from the chain, or for a step a record applied
1325
+ * before e3 kept it
1326
+ */
1327
+ export const RecordMigrationAppliedType = StructType({
1328
+ at: OptionType(DateTimeType),
1329
+ commit: OptionType(StringType),
1330
+ });
1331
+
1222
1332
  /**
1223
1333
  * A record's callable surface, returned by `describe` so dynamic callers can
1224
- * encode mutation arguments and read through its indexes. The mutation
1225
- * `argTypes` are the EXTRA parameters after the implicit current state.
1334
+ * encode mutation arguments and read through its indexes, and a console can
1335
+ * show the record whole without reading its history. The mutation `argTypes`
1336
+ * are the EXTRA parameters after the implicit current state.
1226
1337
  */
1227
1338
  export const RecordSignatureType = StructType({
1228
1339
  name: StringType,
@@ -1246,6 +1357,26 @@ export const RecordSignatureType = StructType({
1246
1357
  valueType: EastTypeType,
1247
1358
  /** Whether a row may hold several index keys. */
1248
1359
  multi: BooleanType,
1360
+ /** Whether the record's head state holds the index, built under the
1361
+ * declaration the deployed package carries. A deploy, a reindex and a
1362
+ * system commit build what the state lacks; a read through an index the
1363
+ * state holds no build of answers `index_not_found`. */
1364
+ built: BooleanType,
1365
+ })),
1366
+ /** The migration chain the record declares, in order. A deployed record
1367
+ * has applied every step, since a deploy migrates it or is refused. */
1368
+ migrations: ArrayType(StructType({
1369
+ name: StringType,
1370
+ /** The step's form — `value`, `rows` or `rekey` — which says what it
1371
+ * runs over: the whole state, its rows, or its rows under new keys. */
1372
+ form: StringType,
1373
+ /** The record's type before the step. */
1374
+ from: EastTypeType,
1375
+ /** The record's type after it. */
1376
+ to: EastTypeType,
1377
+ /** When the record applied the step, and the commit that did; `none`
1378
+ * when it has not applied it. */
1379
+ applied: OptionType(RecordMigrationAppliedType),
1249
1380
  })),
1250
1381
  });
1251
1382
 
@@ -1262,11 +1393,78 @@ export const RecordCommitInfoType = StructType({
1262
1393
  delta: OptionType(StringType),
1263
1394
  });
1264
1395
 
1396
+ /**
1397
+ * One argument of a record's commit, as the history previews it.
1398
+ *
1399
+ * @property type - The argument's own East type, as its encoding carries it
1400
+ * @property bytes - Its encoded size
1401
+ * @property text - Its value printed as East text, cut at
1402
+ * {@link RECORD_ARG_TEXT_CHARS} characters; empty for an argument over
1403
+ * {@link RECORD_ARG_TEXT_BYTES}, which is not printed, and for one that
1404
+ * cannot be
1405
+ * @property truncated - Whether `text` holds less than the whole value
1406
+ */
1407
+ export const RecordArgPreviewType = StructType({
1408
+ type: EastTypeType,
1409
+ bytes: IntegerType,
1410
+ text: StringType,
1411
+ truncated: BooleanType,
1412
+ });
1413
+
1414
+ /**
1415
+ * A record commit's arguments, as the history previews them.
1416
+ *
1417
+ * @property hash - The arguments' object, which the objects route serves
1418
+ * whole: a beast2 `Array<Blob>` of the encoded arguments, in order
1419
+ * @property bytes - The object's size
1420
+ * @property values - Each argument's preview, in order; empty when the object
1421
+ * is over {@link RECORD_ARGS_READ_BYTES}, which the history does not read,
1422
+ * or holds arguments that are not East values, as a system commit may
1423
+ * record its caller's
1424
+ */
1425
+ export const RecordCommitArgsType = StructType({
1426
+ hash: StringType,
1427
+ bytes: IntegerType,
1428
+ values: ArrayType(RecordArgPreviewType),
1429
+ });
1430
+
1431
+ /**
1432
+ * One commit in a record's history, as the history route answers it: a
1433
+ * {@link RecordCommitInfoType}'s fields, and a preview of its arguments, so a
1434
+ * history says what a commit set as well as which mutation ran.
1435
+ * `RecordCommitInfoType` stays without them: e3-ui's record binding and the
1436
+ * pages built on it carry it in their East types.
1437
+ */
1438
+ export const RecordHistoryCommitType = StructType({
1439
+ hash: StringType,
1440
+ parent: OptionType(StringType),
1441
+ state: StringType,
1442
+ mutation: StringType,
1443
+ actor: StringType,
1444
+ at: DateTimeType,
1445
+ /** The delta this commit applied, when it wrote one. */
1446
+ delta: OptionType(StringType),
1447
+ /** The commit's arguments, previewed; `none` for a commit with none. */
1448
+ args: OptionType(RecordCommitArgsType),
1449
+ });
1450
+
1265
1451
  /** A page of a record's commit history, newest first. */
1266
1452
  export const RecordHistoryResultType = StructType({
1267
- commits: ArrayType(RecordCommitInfoType),
1453
+ commits: ArrayType(RecordHistoryCommitType),
1268
1454
  });
1269
1455
 
1456
+ /** The characters of an argument's East text a history preview keeps. */
1457
+ export const RECORD_ARG_TEXT_CHARS = 256;
1458
+
1459
+ /** The encoded size, in bytes, past which a history preview prints no text
1460
+ * of an argument, only its type and size. */
1461
+ export const RECORD_ARG_TEXT_BYTES = 64 * 1024;
1462
+
1463
+ /** The size, in bytes, past which a history reads no commit's arguments'
1464
+ * object, and previews none of them: a page reads at most this much of
1465
+ * arguments per commit, however large a patch is. */
1466
+ export const RECORD_ARGS_READ_BYTES = 1024 * 1024;
1467
+
1270
1468
  // =============================================================================
1271
1469
  // Value type aliases
1272
1470
  // =============================================================================
@@ -1304,6 +1502,7 @@ export type TaskListItem = ValueTypeOf<typeof TaskListItemType>;
1304
1502
  export type TaskDetails = ValueTypeOf<typeof TaskDetailsType>;
1305
1503
  export type DataflowRequest = ValueTypeOf<typeof DataflowRequestType>;
1306
1504
  export type LogChunk = ValueTypeOf<typeof LogChunkType>;
1505
+ export type TaskLogChunk = ValueTypeOf<typeof TaskLogChunkType>;
1307
1506
  export type TaskExecutionResult = ValueTypeOf<typeof TaskExecutionResultType>;
1308
1507
  export type DataflowResult = ValueTypeOf<typeof DataflowResultType>;
1309
1508
  export type DataflowEvent = ValueTypeOf<typeof DataflowEventType>;
@@ -1321,6 +1520,7 @@ export type DatasetStatusDetail = ValueTypeOf<typeof DatasetStatusDetailType>;
1321
1520
  export type ExecuteLimits = ValueTypeOf<typeof ExecuteLimitsType>;
1322
1521
  export type Diagnostic = ValueTypeOf<typeof DiagnosticType>;
1323
1522
  export type ExecuteResult = ValueTypeOf<typeof ExecuteResultType>;
1523
+ export type CallArg = ValueTypeOf<typeof CallArgType>;
1324
1524
  export type FunctionCallRequest = ValueTypeOf<typeof FunctionCallRequestType>;
1325
1525
  export type FunctionSignature = ValueTypeOf<typeof FunctionSignatureType>;
1326
1526
  export type OneShotRequest = ValueTypeOf<typeof OneShotRequestType>;
@@ -1331,6 +1531,10 @@ export type SplitCallStatus = ValueTypeOf<typeof SplitCallStatusType>;
1331
1531
  export type SplitCallPlan = ValueTypeOf<typeof SplitCallPlanType>;
1332
1532
  export type MutationCallRequest = ValueTypeOf<typeof MutationCallRequestType>;
1333
1533
  export type MutationResult = ValueTypeOf<typeof MutationResultType>;
1534
+ export type RecordMigrationApplied = ValueTypeOf<typeof RecordMigrationAppliedType>;
1334
1535
  export type RecordSignature = ValueTypeOf<typeof RecordSignatureType>;
1335
1536
  export type RecordCommitInfo = ValueTypeOf<typeof RecordCommitInfoType>;
1537
+ export type RecordArgPreview = ValueTypeOf<typeof RecordArgPreviewType>;
1538
+ export type RecordCommitArgs = ValueTypeOf<typeof RecordCommitArgsType>;
1539
+ export type RecordHistoryCommit = ValueTypeOf<typeof RecordHistoryCommitType>;
1336
1540
  export type RecordHistoryResult = ValueTypeOf<typeof RecordHistoryResultType>;