@elaraai/e3-types 0.0.2-beta.5 → 0.0.2-beta.50

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 (59) hide show
  1. package/README.md +7 -4
  2. package/dist/src/api.d.ts +1111 -0
  3. package/dist/src/api.d.ts.map +1 -0
  4. package/dist/src/api.js +650 -0
  5. package/dist/src/api.js.map +1 -0
  6. package/dist/src/constants.d.ts +12 -0
  7. package/dist/src/constants.d.ts.map +1 -0
  8. package/dist/src/constants.js +12 -0
  9. package/dist/src/constants.js.map +1 -0
  10. package/dist/src/dataflow.d.ts +574 -0
  11. package/dist/src/dataflow.d.ts.map +1 -0
  12. package/dist/src/dataflow.js +366 -0
  13. package/dist/src/dataflow.js.map +1 -0
  14. package/dist/src/dataset-ref.d.ts +86 -0
  15. package/dist/src/dataset-ref.d.ts.map +1 -0
  16. package/dist/src/dataset-ref.js +82 -0
  17. package/dist/src/dataset-ref.js.map +1 -0
  18. package/dist/src/dataset.d.ts +4 -4
  19. package/dist/src/execution.d.ts +29 -21
  20. package/dist/src/execution.d.ts.map +1 -1
  21. package/dist/src/execution.js +8 -0
  22. package/dist/src/execution.js.map +1 -1
  23. package/dist/src/index.d.ts +7 -1
  24. package/dist/src/index.d.ts.map +1 -1
  25. package/dist/src/index.js +39 -1
  26. package/dist/src/index.js.map +1 -1
  27. package/dist/src/lock.d.ts +85 -0
  28. package/dist/src/lock.d.ts.map +1 -0
  29. package/dist/src/lock.js +71 -0
  30. package/dist/src/lock.js.map +1 -0
  31. package/dist/src/package.d.ts +235 -134
  32. package/dist/src/package.d.ts.map +1 -1
  33. package/dist/src/package.js +53 -23
  34. package/dist/src/package.js.map +1 -1
  35. package/dist/src/structure.d.ts +87 -73
  36. package/dist/src/structure.d.ts.map +1 -1
  37. package/dist/src/structure.js +8 -3
  38. package/dist/src/structure.js.map +1 -1
  39. package/dist/src/task.d.ts +5 -5
  40. package/dist/src/transfer.d.ts +52 -0
  41. package/dist/src/transfer.d.ts.map +1 -0
  42. package/dist/src/transfer.js +49 -0
  43. package/dist/src/transfer.js.map +1 -0
  44. package/dist/src/workspace.d.ts +7 -9
  45. package/dist/src/workspace.d.ts.map +1 -1
  46. package/dist/src/workspace.js +3 -5
  47. package/dist/src/workspace.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/api.ts +760 -0
  50. package/src/constants.ts +12 -0
  51. package/src/dataflow.ts +427 -0
  52. package/src/dataset-ref.ts +91 -0
  53. package/src/execution.ts +8 -0
  54. package/src/index.ts +183 -0
  55. package/src/lock.ts +90 -0
  56. package/src/package.ts +72 -23
  57. package/src/structure.ts +8 -3
  58. package/src/transfer.ts +56 -0
  59. package/src/workspace.ts +3 -5
package/src/api.ts ADDED
@@ -0,0 +1,760 @@
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
+ /**
7
+ * API wire types for e3.
8
+ *
9
+ * These East types define the request/response schemas used by the e3 REST API.
10
+ * They are shared between e3-api-client and e3-api-server.
11
+ *
12
+ * Types that also serve as domain types (PackageImportResultType, DataflowGraphType,
13
+ * DataflowGraphTaskType) are defined in their respective modules and re-exported here.
14
+ *
15
+ * Two types are prefixed with "Api" to avoid name conflicts with domain types
16
+ * that have the same name but different structure:
17
+ * - ApiExecutionStatusType (vs ExecutionStatusType in execution.ts — on-disk task status)
18
+ * - ApiDataflowExecutionStateType (vs DataflowExecutionStateType in dataflow.ts — persistent state)
19
+ */
20
+
21
+ import {
22
+ VariantType,
23
+ StructType,
24
+ ArrayType,
25
+ OptionType,
26
+ StringType,
27
+ IntegerType,
28
+ FloatType,
29
+ BooleanType,
30
+ NullType,
31
+ EastTypeType,
32
+ type EastType,
33
+ type ValueTypeOf,
34
+ } from '@elaraai/east';
35
+
36
+ import { StructureType, TreePathType } from './structure.js';
37
+
38
+ // =============================================================================
39
+ // Error Types
40
+ // =============================================================================
41
+
42
+ export const WorkspaceNotFoundErrorType = StructType({ workspace: StringType });
43
+ export const WorkspaceNotDeployedErrorType = StructType({ workspace: StringType });
44
+ export const WorkspaceExistsErrorType = StructType({ workspace: StringType });
45
+ export const LockHolderType = StructType({
46
+ pid: IntegerType,
47
+ acquiredAt: StringType,
48
+ bootId: OptionType(StringType),
49
+ command: OptionType(StringType),
50
+ });
51
+ export const WorkspaceLockedErrorType = StructType({
52
+ workspace: StringType,
53
+ holder: VariantType({ unknown: NullType, known: LockHolderType }),
54
+ });
55
+ export const PackageNotFoundErrorType = StructType({
56
+ packageName: StringType,
57
+ version: OptionType(StringType),
58
+ });
59
+ export const PackageExistsErrorType = StructType({ packageName: StringType, version: StringType });
60
+ export const PackageInvalidErrorType = StructType({ reason: StringType });
61
+ export const DatasetNotFoundErrorType = StructType({ workspace: StringType, path: StringType });
62
+ export const TaskNotFoundErrorType = StructType({ task: StringType });
63
+ export const ExecutionNotFoundErrorType = StructType({ task: StringType });
64
+ export const ObjectNotFoundErrorType = StructType({ hash: StringType });
65
+ export const DataflowErrorType = StructType({ message: StringType });
66
+ export const PermissionDeniedErrorType = StructType({ path: StringType });
67
+ export const InternalErrorType = StructType({ message: StringType });
68
+ export const RepositoryNotFoundErrorType = StructType({ repo: StringType });
69
+
70
+ export const ErrorType = VariantType({
71
+ repository_not_found: RepositoryNotFoundErrorType,
72
+ workspace_not_found: WorkspaceNotFoundErrorType,
73
+ workspace_not_deployed: WorkspaceNotDeployedErrorType,
74
+ workspace_exists: WorkspaceExistsErrorType,
75
+ workspace_locked: WorkspaceLockedErrorType,
76
+ package_not_found: PackageNotFoundErrorType,
77
+ package_exists: PackageExistsErrorType,
78
+ package_invalid: PackageInvalidErrorType,
79
+ dataset_not_found: DatasetNotFoundErrorType,
80
+ task_not_found: TaskNotFoundErrorType,
81
+ execution_not_found: ExecutionNotFoundErrorType,
82
+ object_not_found: ObjectNotFoundErrorType,
83
+ dataflow_error: DataflowErrorType,
84
+ dataflow_aborted: NullType,
85
+ permission_denied: PermissionDeniedErrorType,
86
+ internal: InternalErrorType,
87
+ });
88
+
89
+ // =============================================================================
90
+ // Response Wrapper
91
+ // =============================================================================
92
+
93
+ export const ResponseType = <T extends EastType>(successType: T) => VariantType({
94
+ success: successType,
95
+ error: ErrorType,
96
+ });
97
+
98
+ // =============================================================================
99
+ // Repository Types
100
+ // =============================================================================
101
+
102
+ /**
103
+ * Repository status information.
104
+ *
105
+ * @property path - Absolute path to the e3 repository directory
106
+ * @property objectCount - Number of content-addressed objects stored
107
+ * @property packageCount - Number of imported packages
108
+ * @property workspaceCount - Number of workspaces
109
+ */
110
+ export const RepositoryStatusType = StructType({
111
+ path: StringType,
112
+ objectCount: IntegerType,
113
+ packageCount: IntegerType,
114
+ workspaceCount: IntegerType,
115
+ });
116
+
117
+ /**
118
+ * Garbage collection request options.
119
+ *
120
+ * @property dryRun - If true, report what would be deleted without deleting
121
+ * @property minAge - Minimum age in milliseconds for objects to be considered for deletion
122
+ */
123
+ export const GcRequestType = StructType({
124
+ dryRun: BooleanType,
125
+ minAge: OptionType(IntegerType),
126
+ });
127
+
128
+ /**
129
+ * Garbage collection result.
130
+ *
131
+ * @property deletedObjects - Number of unreferenced objects deleted
132
+ * @property deletedPartials - Number of incomplete uploads deleted
133
+ * @property retainedObjects - Number of objects still referenced
134
+ * @property skippedYoung - Number of objects skipped due to minAge
135
+ * @property bytesFreed - Total bytes freed by deletion
136
+ */
137
+ export const GcResultType = StructType({
138
+ deletedObjects: IntegerType,
139
+ deletedPartials: IntegerType,
140
+ retainedObjects: IntegerType,
141
+ skippedYoung: IntegerType,
142
+ bytesFreed: IntegerType,
143
+ });
144
+
145
+ // =============================================================================
146
+ // Async Operation Types
147
+ // =============================================================================
148
+
149
+ /**
150
+ * Status of an async operation.
151
+ *
152
+ * - `running`: Operation is in progress
153
+ * - `succeeded`: Operation completed successfully
154
+ * - `failed`: Operation failed with an error
155
+ */
156
+ export const AsyncOperationStatusType = VariantType({
157
+ running: NullType,
158
+ succeeded: NullType,
159
+ failed: NullType,
160
+ });
161
+
162
+ /**
163
+ * Result of starting an async GC operation.
164
+ *
165
+ * @property executionId - Unique identifier for this GC execution (UUID locally, Step Function ARN in cloud)
166
+ */
167
+ export const GcStartResultType = StructType({
168
+ executionId: StringType,
169
+ });
170
+
171
+ /**
172
+ * Status of an async GC operation.
173
+ *
174
+ * @property status - Current execution status
175
+ * @property stats - GC statistics (available when succeeded)
176
+ * @property error - Error message (available when failed)
177
+ */
178
+ export const GcStatusResultType = StructType({
179
+ status: AsyncOperationStatusType,
180
+ stats: OptionType(GcResultType),
181
+ error: OptionType(StringType),
182
+ });
183
+
184
+ // =============================================================================
185
+ // Package Types
186
+ // =============================================================================
187
+
188
+ /**
189
+ * Package list item (summary info).
190
+ *
191
+ * @property name - Package name
192
+ * @property version - Semantic version string
193
+ */
194
+ export const PackageListItemType = StructType({
195
+ name: StringType,
196
+ version: StringType,
197
+ });
198
+
199
+ /**
200
+ * Basic package info.
201
+ *
202
+ * @property name - Package name
203
+ * @property version - Semantic version string
204
+ * @property hash - SHA256 content hash
205
+ */
206
+ export const PackageInfoType = StructType({
207
+ name: StringType,
208
+ version: StringType,
209
+ hash: StringType,
210
+ });
211
+
212
+ /**
213
+ * Detailed package information including structure.
214
+ *
215
+ * @property name - Package name
216
+ * @property version - Semantic version string
217
+ * @property hash - SHA256 content hash
218
+ * @property tasks - List of task names defined in the package
219
+ * @property dataStructure - East structure type describing the package's data schema
220
+ */
221
+ export const PackageDetailsType = StructType({
222
+ name: StringType,
223
+ version: StringType,
224
+ hash: StringType,
225
+ tasks: ArrayType(StringType),
226
+ dataStructure: StructureType,
227
+ });
228
+
229
+ // =============================================================================
230
+ // Workspace Types
231
+ // =============================================================================
232
+
233
+ /**
234
+ * Request to create a new workspace.
235
+ *
236
+ * @property name - Unique workspace name
237
+ */
238
+ export const WorkspaceCreateRequestType = StructType({
239
+ name: StringType,
240
+ });
241
+
242
+ /**
243
+ * Workspace summary information.
244
+ *
245
+ * @property name - Workspace name
246
+ * @property deployed - Whether a package is deployed to this workspace
247
+ * @property packageName - Name of deployed package (if deployed)
248
+ * @property packageVersion - Version of deployed package (if deployed)
249
+ */
250
+ export const WorkspaceInfoType = StructType({
251
+ name: StringType,
252
+ deployed: BooleanType,
253
+ packageName: OptionType(StringType),
254
+ packageVersion: OptionType(StringType),
255
+ });
256
+
257
+ /**
258
+ * Request to deploy a package to a workspace.
259
+ *
260
+ * @property packageRef - Package reference in format "name" or "name@version"
261
+ */
262
+ export const WorkspaceDeployRequestType = StructType({
263
+ packageRef: StringType,
264
+ });
265
+
266
+ /**
267
+ * Workspace export request body.
268
+ *
269
+ * @property name - Optional custom package name
270
+ * @property version - Optional custom version
271
+ */
272
+ export const WorkspaceExportRequestType = StructType({
273
+ name: OptionType(StringType),
274
+ version: OptionType(StringType),
275
+ });
276
+
277
+ // =============================================================================
278
+ // Workspace Status Types
279
+ // =============================================================================
280
+
281
+ /**
282
+ * Dataset status variant.
283
+ *
284
+ * - `unset`: No value assigned to this dataset
285
+ * - `stale`: Value exists but is outdated (upstream changed)
286
+ * - `up-to-date`: Value is current
287
+ */
288
+ export const DatasetStatusType = VariantType({
289
+ unset: NullType,
290
+ stale: NullType,
291
+ 'up-to-date': NullType,
292
+ });
293
+
294
+ /** Task completed successfully. @property cached - True if result was from cache */
295
+ export const TaskStatusUpToDateType = StructType({ cached: BooleanType });
296
+
297
+ /** Task waiting on dependencies. @property reason - Human-readable wait reason */
298
+ export const TaskStatusWaitingType = StructType({ reason: StringType });
299
+
300
+ /** Task currently executing. */
301
+ export const TaskStatusInProgressType = StructType({
302
+ /** Process ID of the running task */
303
+ pid: OptionType(IntegerType),
304
+ /** ISO timestamp when execution started */
305
+ startedAt: OptionType(StringType),
306
+ });
307
+
308
+ /** Task exited with non-zero code. */
309
+ export const TaskStatusFailedType = StructType({
310
+ /** Process exit code */
311
+ exitCode: IntegerType,
312
+ /** ISO timestamp when task completed */
313
+ completedAt: OptionType(StringType),
314
+ });
315
+
316
+ /** Task encountered an internal error. */
317
+ export const TaskStatusErrorType = StructType({
318
+ /** Error message */
319
+ message: StringType,
320
+ /** ISO timestamp when error occurred */
321
+ completedAt: OptionType(StringType),
322
+ });
323
+
324
+ /** Task was running but process is no longer alive. */
325
+ export const TaskStatusStaleRunningType = StructType({
326
+ /** Last known process ID */
327
+ pid: OptionType(IntegerType),
328
+ /** ISO timestamp when execution started */
329
+ startedAt: OptionType(StringType),
330
+ });
331
+
332
+ /**
333
+ * Task execution status variant.
334
+ *
335
+ * - `up-to-date`: Task completed successfully (cached indicates if from cache)
336
+ * - `ready`: Task is ready to run (all inputs available)
337
+ * - `waiting`: Task waiting on upstream dependencies
338
+ * - `in-progress`: Task currently executing
339
+ * - `failed`: Task exited with non-zero exit code
340
+ * - `error`: Internal error during task execution
341
+ * - `stale-running`: Task was marked running but process died
342
+ */
343
+ export const TaskStatusType = VariantType({
344
+ 'up-to-date': TaskStatusUpToDateType,
345
+ ready: NullType,
346
+ waiting: TaskStatusWaitingType,
347
+ 'in-progress': TaskStatusInProgressType,
348
+ failed: TaskStatusFailedType,
349
+ error: TaskStatusErrorType,
350
+ 'stale-running': TaskStatusStaleRunningType,
351
+ });
352
+
353
+ /**
354
+ * Status information for a single dataset.
355
+ *
356
+ * @property path - Dataset path (e.g., ".inputs.config" or ".tasks.foo.output")
357
+ * @property status - Current status (unset, stale, or up-to-date)
358
+ * @property hash - SHA256 hash of current value (if set)
359
+ * @property isTaskOutput - True if this dataset is produced by a task
360
+ * @property producedBy - Name of task that produces this dataset (if isTaskOutput)
361
+ */
362
+ export const DatasetStatusInfoType = StructType({
363
+ path: StringType,
364
+ status: DatasetStatusType,
365
+ hash: OptionType(StringType),
366
+ isTaskOutput: BooleanType,
367
+ producedBy: OptionType(StringType),
368
+ });
369
+
370
+ /**
371
+ * Status information for a single task.
372
+ *
373
+ * @property name - Task name
374
+ * @property hash - Task definition hash (changes when task code changes)
375
+ * @property status - Current execution status
376
+ * @property inputs - Dataset paths this task reads from
377
+ * @property output - Dataset path this task writes to
378
+ * @property dependsOn - Names of tasks that must complete before this one
379
+ */
380
+ export const TaskStatusInfoType = StructType({
381
+ name: StringType,
382
+ hash: StringType,
383
+ status: TaskStatusType,
384
+ inputs: ArrayType(StringType),
385
+ output: StringType,
386
+ dependsOn: ArrayType(StringType),
387
+ });
388
+
389
+ /**
390
+ * Summary counts for workspace status.
391
+ */
392
+ export const WorkspaceStatusSummaryType = StructType({
393
+ /** Dataset status counts */
394
+ datasets: StructType({
395
+ total: IntegerType,
396
+ unset: IntegerType,
397
+ stale: IntegerType,
398
+ upToDate: IntegerType,
399
+ }),
400
+ /** Task status counts */
401
+ tasks: StructType({
402
+ total: IntegerType,
403
+ upToDate: IntegerType,
404
+ ready: IntegerType,
405
+ waiting: IntegerType,
406
+ inProgress: IntegerType,
407
+ failed: IntegerType,
408
+ error: IntegerType,
409
+ staleRunning: IntegerType,
410
+ }),
411
+ });
412
+
413
+ /**
414
+ * Complete workspace status including all datasets, tasks, and summary.
415
+ *
416
+ * @property workspace - Workspace name
417
+ * @property lock - Information about current lock holder (if locked)
418
+ * @property datasets - Status of all datasets in the workspace
419
+ * @property tasks - Status of all tasks in the workspace
420
+ * @property summary - Aggregated counts by status
421
+ */
422
+ export const WorkspaceStatusResultType = StructType({
423
+ workspace: StringType,
424
+ lock: OptionType(LockHolderType),
425
+ datasets: ArrayType(DatasetStatusInfoType),
426
+ tasks: ArrayType(TaskStatusInfoType),
427
+ summary: WorkspaceStatusSummaryType,
428
+ });
429
+
430
+ // =============================================================================
431
+ // Task Types
432
+ // =============================================================================
433
+
434
+ /**
435
+ * Task list item (summary info).
436
+ *
437
+ * @property name - Task name
438
+ * @property hash - Task definition hash
439
+ */
440
+ export const TaskListItemType = StructType({
441
+ name: StringType,
442
+ hash: StringType,
443
+ });
444
+
445
+ /**
446
+ * Detailed task information.
447
+ *
448
+ * @property name - Task name
449
+ * @property hash - Task definition hash
450
+ * @property commandIr - East IR for the task's command
451
+ * @property inputs - Tree paths for task inputs
452
+ * @property output - Tree path for task output
453
+ */
454
+ export const TaskDetailsType = StructType({
455
+ name: StringType,
456
+ hash: StringType,
457
+ commandIr: StringType,
458
+ inputs: ArrayType(TreePathType),
459
+ output: TreePathType,
460
+ });
461
+
462
+ // =============================================================================
463
+ // Execution Types
464
+ // =============================================================================
465
+
466
+ /**
467
+ * Request to start dataflow execution.
468
+ *
469
+ * @property concurrency - Maximum parallel tasks (default: 4)
470
+ * @property force - Force re-execution of all tasks
471
+ * @property filter - Filter to specific task names (glob pattern)
472
+ */
473
+ export const DataflowRequestType = StructType({
474
+ concurrency: OptionType(IntegerType),
475
+ force: BooleanType,
476
+ filter: OptionType(StringType),
477
+ });
478
+
479
+ /**
480
+ * Chunk of log data from task execution.
481
+ *
482
+ * @property data - Log content (UTF-8 text)
483
+ * @property offset - Byte offset from start of log
484
+ * @property size - Size of this chunk in bytes
485
+ * @property totalSize - Total size of the log file
486
+ * @property complete - True if this chunk reaches end of file
487
+ */
488
+ export const LogChunkType = StructType({
489
+ data: StringType,
490
+ offset: IntegerType,
491
+ size: IntegerType,
492
+ totalSize: IntegerType,
493
+ complete: BooleanType,
494
+ });
495
+
496
+ /**
497
+ * Result of executing a single task.
498
+ *
499
+ * @property name - Task name
500
+ * @property cached - True if result was retrieved from cache
501
+ * @property state - Execution outcome (success, failed, error, skipped)
502
+ * @property duration - Execution time in seconds
503
+ */
504
+ export const TaskExecutionResultType = StructType({
505
+ name: StringType,
506
+ cached: BooleanType,
507
+ state: VariantType({
508
+ success: NullType,
509
+ failed: StructType({ exitCode: IntegerType }),
510
+ error: StructType({ message: StringType }),
511
+ skipped: NullType,
512
+ }),
513
+ duration: FloatType,
514
+ });
515
+
516
+ /**
517
+ * Result of dataflow execution.
518
+ *
519
+ * @property success - True if all tasks completed successfully
520
+ * @property executed - Number of tasks that were executed
521
+ * @property cached - Number of tasks that used cached results
522
+ * @property failed - Number of tasks that failed
523
+ * @property skipped - Number of tasks that were skipped
524
+ * @property tasks - Per-task execution results
525
+ * @property duration - Total execution time in seconds
526
+ */
527
+ export const DataflowResultType = StructType({
528
+ success: BooleanType,
529
+ executed: IntegerType,
530
+ cached: IntegerType,
531
+ failed: IntegerType,
532
+ skipped: IntegerType,
533
+ tasks: ArrayType(TaskExecutionResultType),
534
+ duration: FloatType,
535
+ });
536
+
537
+ // =============================================================================
538
+ // Dataflow Execution State Types (for API polling)
539
+ // =============================================================================
540
+
541
+ /**
542
+ * Dataflow event types for API polling.
543
+ *
544
+ * - `start`: Task started executing
545
+ * - `complete`: Task executed and succeeded
546
+ * - `cached`: Task result retrieved from cache (no execution)
547
+ * - `failed`: Task exited with non-zero code
548
+ * - `error`: Internal error during task execution
549
+ * - `input_unavailable`: Task couldn't run because inputs not available
550
+ */
551
+ export const DataflowEventType = VariantType({
552
+ start: StructType({
553
+ task: StringType,
554
+ timestamp: StringType,
555
+ }),
556
+ complete: StructType({
557
+ task: StringType,
558
+ timestamp: StringType,
559
+ duration: FloatType,
560
+ }),
561
+ cached: StructType({
562
+ task: StringType,
563
+ timestamp: StringType,
564
+ }),
565
+ failed: StructType({
566
+ task: StringType,
567
+ timestamp: StringType,
568
+ duration: FloatType,
569
+ exitCode: IntegerType,
570
+ }),
571
+ error: StructType({
572
+ task: StringType,
573
+ timestamp: StringType,
574
+ message: StringType,
575
+ }),
576
+ input_unavailable: StructType({
577
+ task: StringType,
578
+ timestamp: StringType,
579
+ reason: StringType,
580
+ }),
581
+ });
582
+
583
+ /**
584
+ * Execution status for API polling responses.
585
+ *
586
+ * - `running`: Execution is in progress
587
+ * - `completed`: Execution finished successfully
588
+ * - `failed`: Execution finished with failures
589
+ * - `aborted`: Execution was cancelled
590
+ *
591
+ * Note: Named "Api*" to distinguish from the on-disk ExecutionStatusType
592
+ * in execution.ts which tracks individual task execution states.
593
+ */
594
+ export const ApiExecutionStatusType = VariantType({
595
+ running: NullType,
596
+ completed: NullType,
597
+ failed: NullType,
598
+ aborted: NullType,
599
+ });
600
+
601
+ /**
602
+ * Summary of dataflow execution results.
603
+ */
604
+ export const DataflowExecutionSummaryType = StructType({
605
+ executed: IntegerType,
606
+ cached: IntegerType,
607
+ failed: IntegerType,
608
+ skipped: IntegerType,
609
+ duration: FloatType,
610
+ });
611
+
612
+ /**
613
+ * Dataflow execution state returned by API polling.
614
+ *
615
+ * A lightweight view of the execution state for client polling.
616
+ *
617
+ * Note: Named "Api*" to distinguish from the persistent
618
+ * DataflowExecutionStateType in dataflow.ts which stores the full
619
+ * execution state on disk.
620
+ *
621
+ * @property status - Current execution status
622
+ * @property startedAt - ISO timestamp when execution started
623
+ * @property completedAt - ISO timestamp when execution finished (if done)
624
+ * @property summary - Execution summary (available when complete)
625
+ * @property events - Task events (may be paginated via offset/limit)
626
+ * @property totalEvents - Total number of events (for pagination)
627
+ */
628
+ export const ApiDataflowExecutionStateType = StructType({
629
+ status: ApiExecutionStatusType,
630
+ startedAt: StringType,
631
+ completedAt: OptionType(StringType),
632
+ summary: OptionType(DataflowExecutionSummaryType),
633
+ events: ArrayType(DataflowEventType),
634
+ totalEvents: IntegerType,
635
+ });
636
+
637
+ // =============================================================================
638
+ // Task Execution History Types
639
+ // =============================================================================
640
+
641
+ /**
642
+ * Execution status for history listing.
643
+ */
644
+ export const ExecutionHistoryStatusType = VariantType({
645
+ running: NullType,
646
+ success: NullType,
647
+ failed: NullType,
648
+ error: NullType,
649
+ });
650
+
651
+ /**
652
+ * A single execution in task history.
653
+ *
654
+ * @property inputsHash - Hash of concatenated inputs (execution identifier)
655
+ * @property inputHashes - Individual input object hashes
656
+ * @property status - Execution outcome
657
+ * @property startedAt - ISO timestamp when execution started
658
+ * @property completedAt - ISO timestamp when execution finished (if done)
659
+ * @property duration - Execution duration in milliseconds (if done)
660
+ * @property exitCode - Process exit code (if failed)
661
+ */
662
+ export const ExecutionListItemType = StructType({
663
+ inputsHash: StringType,
664
+ inputHashes: ArrayType(StringType),
665
+ status: ExecutionHistoryStatusType,
666
+ startedAt: StringType,
667
+ completedAt: OptionType(StringType),
668
+ duration: OptionType(IntegerType),
669
+ exitCode: OptionType(IntegerType),
670
+ });
671
+
672
+ // =============================================================================
673
+ // Dataset List Types (recursive)
674
+ // =============================================================================
675
+
676
+ /**
677
+ * Tree branch kind variant.
678
+ *
679
+ * Currently only `struct` branches exist. Future: `dict`, `array`, `variant`.
680
+ */
681
+ export const TreeKindType = VariantType({ struct: NullType });
682
+
683
+ /**
684
+ * A list entry -- either a dataset leaf or a tree branch.
685
+ *
686
+ * Used by the `?list=true&status=true` endpoints to return both
687
+ * tree structure entries and dataset leaves in a single flat list.
688
+ */
689
+ export const ListEntryType = VariantType({
690
+ dataset: StructType({
691
+ path: StringType,
692
+ type: EastTypeType,
693
+ hash: OptionType(StringType),
694
+ size: OptionType(IntegerType),
695
+ }),
696
+ tree: StructType({
697
+ path: StringType,
698
+ kind: TreeKindType,
699
+ }),
700
+ });
701
+
702
+ // =============================================================================
703
+ // Dataset Status Detail Types (single dataset query)
704
+ // =============================================================================
705
+
706
+ /**
707
+ * Detailed status of a single dataset.
708
+ *
709
+ * @property path - Dataset path (e.g., ".inputs.config")
710
+ * @property type - East type of the dataset
711
+ * @property refType - Ref type: "unassigned", "null", or "value"
712
+ * @property hash - Object hash (None if unassigned/null)
713
+ * @property size - Size in bytes (None if unassigned)
714
+ */
715
+ export const DatasetStatusDetailType = StructType({
716
+ path: StringType,
717
+ type: EastTypeType,
718
+ refType: StringType,
719
+ hash: OptionType(StringType),
720
+ size: OptionType(IntegerType),
721
+ });
722
+
723
+ // =============================================================================
724
+ // Value type aliases
725
+ // =============================================================================
726
+
727
+ export type Error = ValueTypeOf<typeof ErrorType>;
728
+ export type RepositoryStatus = ValueTypeOf<typeof RepositoryStatusType>;
729
+ export type GcRequest = ValueTypeOf<typeof GcRequestType>;
730
+ export type GcResult = ValueTypeOf<typeof GcResultType>;
731
+ export type AsyncOperationStatus = ValueTypeOf<typeof AsyncOperationStatusType>;
732
+ export type GcStartResult = ValueTypeOf<typeof GcStartResultType>;
733
+ export type GcStatusResult = ValueTypeOf<typeof GcStatusResultType>;
734
+ export type PackageListItem = ValueTypeOf<typeof PackageListItemType>;
735
+ export type PackageInfo = ValueTypeOf<typeof PackageInfoType>;
736
+ export type PackageDetails = ValueTypeOf<typeof PackageDetailsType>;
737
+ export type WorkspaceInfo = ValueTypeOf<typeof WorkspaceInfoType>;
738
+ export type WorkspaceCreateRequest = ValueTypeOf<typeof WorkspaceCreateRequestType>;
739
+ export type WorkspaceDeployRequest = ValueTypeOf<typeof WorkspaceDeployRequestType>;
740
+ export type DatasetStatus = ValueTypeOf<typeof DatasetStatusType>;
741
+ export type TaskStatus = ValueTypeOf<typeof TaskStatusType>;
742
+ export type DatasetStatusInfo = ValueTypeOf<typeof DatasetStatusInfoType>;
743
+ export type TaskStatusInfo = ValueTypeOf<typeof TaskStatusInfoType>;
744
+ export type WorkspaceStatusSummary = ValueTypeOf<typeof WorkspaceStatusSummaryType>;
745
+ export type WorkspaceStatusResult = ValueTypeOf<typeof WorkspaceStatusResultType>;
746
+ export type TaskListItem = ValueTypeOf<typeof TaskListItemType>;
747
+ export type TaskDetails = ValueTypeOf<typeof TaskDetailsType>;
748
+ export type DataflowRequest = ValueTypeOf<typeof DataflowRequestType>;
749
+ export type LogChunk = ValueTypeOf<typeof LogChunkType>;
750
+ export type TaskExecutionResult = ValueTypeOf<typeof TaskExecutionResultType>;
751
+ export type DataflowResult = ValueTypeOf<typeof DataflowResultType>;
752
+ export type DataflowEvent = ValueTypeOf<typeof DataflowEventType>;
753
+ export type ApiExecutionStatus = ValueTypeOf<typeof ApiExecutionStatusType>;
754
+ export type DataflowExecutionSummary = ValueTypeOf<typeof DataflowExecutionSummaryType>;
755
+ export type ApiDataflowExecutionState = ValueTypeOf<typeof ApiDataflowExecutionStateType>;
756
+ export type ExecutionHistoryStatus = ValueTypeOf<typeof ExecutionHistoryStatusType>;
757
+ export type ExecutionListItem = ValueTypeOf<typeof ExecutionListItemType>;
758
+ export type TreeKind = ValueTypeOf<typeof TreeKindType>;
759
+ export type ListEntry = ValueTypeOf<typeof ListEntryType>;
760
+ export type DatasetStatusDetail = ValueTypeOf<typeof DatasetStatusDetailType>;