deepline 0.1.0 → 0.1.1

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 (97) hide show
  1. package/dist/cli/index.js +212 -54
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/cli/index.mjs +198 -40
  4. package/dist/cli/index.mjs.map +1 -1
  5. package/dist/index.d.mts +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/index.mjs +1 -1
  9. package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +3256 -0
  10. package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +710 -0
  11. package/dist/repo/apps/play-runner-workers/src/entry.ts +5070 -0
  12. package/dist/repo/apps/play-runner-workers/src/runtime/README.md +21 -0
  13. package/dist/repo/apps/play-runner-workers/src/runtime/batching.ts +177 -0
  14. package/dist/repo/apps/play-runner-workers/src/runtime/execution-plan.ts +52 -0
  15. package/dist/repo/apps/play-runner-workers/src/runtime/tool-batch.ts +100 -0
  16. package/dist/repo/apps/play-runner-workers/src/runtime/tool-result.ts +184 -0
  17. package/dist/repo/sdk/src/cli/commands/auth.ts +482 -0
  18. package/dist/repo/sdk/src/cli/commands/billing.ts +188 -0
  19. package/dist/repo/sdk/src/cli/commands/csv.ts +123 -0
  20. package/dist/repo/sdk/src/cli/commands/db.ts +119 -0
  21. package/dist/repo/sdk/src/cli/commands/feedback.ts +40 -0
  22. package/dist/repo/sdk/src/cli/commands/org.ts +117 -0
  23. package/dist/repo/sdk/src/cli/commands/play.ts +3200 -0
  24. package/dist/repo/sdk/src/cli/commands/tools.ts +687 -0
  25. package/dist/repo/sdk/src/cli/dataset-stats.ts +341 -0
  26. package/dist/repo/sdk/src/cli/index.ts +138 -0
  27. package/dist/repo/sdk/src/cli/progress.ts +135 -0
  28. package/dist/repo/sdk/src/cli/trace.ts +61 -0
  29. package/dist/repo/sdk/src/cli/utils.ts +145 -0
  30. package/dist/repo/sdk/src/client.ts +1188 -0
  31. package/dist/repo/sdk/src/compat.ts +77 -0
  32. package/dist/repo/sdk/src/config.ts +285 -0
  33. package/dist/repo/sdk/src/errors.ts +125 -0
  34. package/dist/repo/sdk/src/http.ts +391 -0
  35. package/dist/repo/sdk/src/index.ts +139 -0
  36. package/dist/repo/sdk/src/play.ts +1330 -0
  37. package/dist/repo/sdk/src/plays/bundle-play-file.ts +133 -0
  38. package/dist/repo/sdk/src/plays/harness-stub.ts +210 -0
  39. package/dist/repo/sdk/src/plays/local-file-discovery.ts +326 -0
  40. package/dist/repo/sdk/src/tool-output.ts +489 -0
  41. package/dist/repo/sdk/src/types.ts +669 -0
  42. package/dist/repo/sdk/src/version.ts +2 -0
  43. package/dist/repo/sdk/src/worker-play-entry.ts +286 -0
  44. package/dist/repo/shared_libs/observability/node-tracing.ts +129 -0
  45. package/dist/repo/shared_libs/observability/tracing.ts +98 -0
  46. package/dist/repo/shared_libs/play-runtime/backend.ts +139 -0
  47. package/dist/repo/shared_libs/play-runtime/batch-runtime.ts +182 -0
  48. package/dist/repo/shared_libs/play-runtime/batching-types.ts +91 -0
  49. package/dist/repo/shared_libs/play-runtime/context.ts +3999 -0
  50. package/dist/repo/shared_libs/play-runtime/coordinator-headers.ts +78 -0
  51. package/dist/repo/shared_libs/play-runtime/ctx-contract.ts +250 -0
  52. package/dist/repo/shared_libs/play-runtime/ctx-types.ts +713 -0
  53. package/dist/repo/shared_libs/play-runtime/dataset-id.ts +10 -0
  54. package/dist/repo/shared_libs/play-runtime/db-session-crypto.ts +304 -0
  55. package/dist/repo/shared_libs/play-runtime/db-session.ts +462 -0
  56. package/dist/repo/shared_libs/play-runtime/dedup-backend.ts +0 -0
  57. package/dist/repo/shared_libs/play-runtime/default-batch-strategies.ts +124 -0
  58. package/dist/repo/shared_libs/play-runtime/execution-plan.ts +262 -0
  59. package/dist/repo/shared_libs/play-runtime/live-events.ts +214 -0
  60. package/dist/repo/shared_libs/play-runtime/live-state-contract.ts +50 -0
  61. package/dist/repo/shared_libs/play-runtime/map-execution-frame.ts +114 -0
  62. package/dist/repo/shared_libs/play-runtime/map-row-identity.ts +158 -0
  63. package/dist/repo/shared_libs/play-runtime/profiles.ts +90 -0
  64. package/dist/repo/shared_libs/play-runtime/progress-emitter.ts +172 -0
  65. package/dist/repo/shared_libs/play-runtime/protocol.ts +121 -0
  66. package/dist/repo/shared_libs/play-runtime/public-play-contract.ts +42 -0
  67. package/dist/repo/shared_libs/play-runtime/result-normalization.ts +33 -0
  68. package/dist/repo/shared_libs/play-runtime/runtime-actions.ts +208 -0
  69. package/dist/repo/shared_libs/play-runtime/runtime-api.ts +1873 -0
  70. package/dist/repo/shared_libs/play-runtime/runtime-constraints.ts +2 -0
  71. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver-neon-serverless.ts +201 -0
  72. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver-pg.ts +48 -0
  73. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver.ts +84 -0
  74. package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +174 -0
  75. package/dist/repo/shared_libs/play-runtime/static-pipeline-types.ts +147 -0
  76. package/dist/repo/shared_libs/play-runtime/suspension.ts +68 -0
  77. package/dist/repo/shared_libs/play-runtime/tool-batch-executor.ts +146 -0
  78. package/dist/repo/shared_libs/play-runtime/tool-result.ts +387 -0
  79. package/dist/repo/shared_libs/play-runtime/tracing.ts +31 -0
  80. package/dist/repo/shared_libs/play-runtime/waterfall-replay.ts +75 -0
  81. package/dist/repo/shared_libs/play-runtime/worker-api-types.ts +140 -0
  82. package/dist/repo/shared_libs/plays/artifact-transport.ts +14 -0
  83. package/dist/repo/shared_libs/plays/artifact-types.ts +49 -0
  84. package/dist/repo/shared_libs/plays/bundling/index.ts +1346 -0
  85. package/dist/repo/shared_libs/plays/compiler-manifest.ts +186 -0
  86. package/dist/repo/shared_libs/plays/contracts.ts +51 -0
  87. package/dist/repo/shared_libs/plays/dataset.ts +308 -0
  88. package/dist/repo/shared_libs/plays/definition.ts +264 -0
  89. package/dist/repo/shared_libs/plays/file-refs.ts +11 -0
  90. package/dist/repo/shared_libs/plays/rate-limit-scheduler.ts +206 -0
  91. package/dist/repo/shared_libs/plays/resolve-static-pipeline.ts +164 -0
  92. package/dist/repo/shared_libs/plays/row-identity.ts +302 -0
  93. package/dist/repo/shared_libs/plays/runtime-validation.ts +415 -0
  94. package/dist/repo/shared_libs/plays/static-pipeline.ts +560 -0
  95. package/dist/repo/shared_libs/temporal/constants.ts +39 -0
  96. package/dist/repo/shared_libs/temporal/preview-config.ts +153 -0
  97. package/package.json +4 -4
@@ -0,0 +1,208 @@
1
+ import type { ComputeBillingItem } from './worker-api-types';
2
+ import type { DbSessionOperation } from './db-session';
3
+ import type { PlayRowUpdate } from './ctx-types';
4
+ import type { PlaySheetContract } from '../plays/static-pipeline';
5
+
6
+ export type RuntimeRunStatusAction = {
7
+ action: 'update_run_status';
8
+ playId: string;
9
+ status: string;
10
+ error?: string;
11
+ runtimeBackend?: string | null;
12
+ artifactHash?: string | null;
13
+ graphHash?: string | null;
14
+ waitKind?: string | null;
15
+ waitUntil?: number | null;
16
+ activeBoundaryId?: string | null;
17
+ lastCheckpointAt?: number | null;
18
+ liveLogs?: string[];
19
+ liveTimeline?: unknown;
20
+ liveNodeProgress?: unknown;
21
+ result?: Record<string, unknown> | null;
22
+ };
23
+
24
+ export type RuntimeSheetAction =
25
+ | {
26
+ action: 'ensure_sheet';
27
+ playName: string;
28
+ tableNamespace: string;
29
+ sheetContract?: PlaySheetContract | null;
30
+ userEmail?: string | null;
31
+ }
32
+ | {
33
+ action: 'create_db_session';
34
+ playName: string;
35
+ target: {
36
+ tableNamespace: string;
37
+ logicalTable: 'sheet_rows' | 'dataset_rows' | 'play_output';
38
+ };
39
+ operations: DbSessionOperation[];
40
+ limits?: {
41
+ maxRows?: number;
42
+ maxBytes?: number;
43
+ maxRequests?: number;
44
+ };
45
+ sheetContract?: PlaySheetContract | null;
46
+ ttlSeconds?: number;
47
+ userEmail?: string | null;
48
+ }
49
+ | {
50
+ action: 'apply_row_updates';
51
+ playName: string;
52
+ tableNamespace: string;
53
+ sheetContract?: PlaySheetContract | null;
54
+ contractSnapshot?: unknown;
55
+ runId: string;
56
+ userEmail?: string | null;
57
+ updates: Array<Omit<PlayRowUpdate, 'rowId'> & { runId?: string }>;
58
+ }
59
+ | {
60
+ action: 'start_sheet_dataset';
61
+ playName: string;
62
+ tableNamespace: string;
63
+ sheetContract?: PlaySheetContract | null;
64
+ contractSnapshot?: unknown;
65
+ rows: unknown;
66
+ runId: string;
67
+ userEmail?: string | null;
68
+ }
69
+ | {
70
+ action: 'persist_completed_sheet_rows';
71
+ playName: string;
72
+ tableNamespace: string;
73
+ sheetContract?: PlaySheetContract | null;
74
+ contractSnapshot?: unknown;
75
+ rows: unknown;
76
+ outputFields: string[];
77
+ runId: string;
78
+ userEmail?: string | null;
79
+ };
80
+
81
+ export type RuntimeArtifactAction =
82
+ | {
83
+ action: 'create_signed_artifact_url';
84
+ storageKey: string;
85
+ }
86
+ | {
87
+ action: 'create_signed_staged_file_url';
88
+ file: { storageKey: string };
89
+ };
90
+
91
+ export type RuntimeBillingAction =
92
+ | {
93
+ action: 'compute_billing_upsert';
94
+ sessionId: string;
95
+ orgId: string;
96
+ userId?: string | null;
97
+ operation: string;
98
+ workflowId?: string;
99
+ runId?: string;
100
+ }
101
+ | {
102
+ action: 'compute_billing_record_item';
103
+ sessionId: string;
104
+ orgId: string;
105
+ userId?: string | null;
106
+ operation: string;
107
+ item: ComputeBillingItem;
108
+ }
109
+ | {
110
+ action: 'compute_billing_finalize';
111
+ sessionId: string;
112
+ orgId: string;
113
+ userId?: string | null;
114
+ operation: string;
115
+ status: 'completed' | 'error';
116
+ workflowId?: string;
117
+ runId?: string;
118
+ maxCreditsPerRun?: number | null;
119
+ finalItem: ComputeBillingItem;
120
+ };
121
+
122
+ export type RuntimeReceiptAction =
123
+ | {
124
+ action: 'get_runtime_step_receipt';
125
+ playName: string;
126
+ runId: string;
127
+ key: string;
128
+ }
129
+ | {
130
+ action: 'claim_runtime_step_receipt';
131
+ playName: string;
132
+ runId: string;
133
+ key: string;
134
+ }
135
+ | {
136
+ action: 'complete_runtime_step_receipt';
137
+ playName: string;
138
+ runId: string;
139
+ key: string;
140
+ output: unknown;
141
+ }
142
+ | {
143
+ action: 'fail_runtime_step_receipt';
144
+ playName: string;
145
+ runId: string;
146
+ key: string;
147
+ error: string;
148
+ }
149
+ | {
150
+ action: 'skip_runtime_step_receipt';
151
+ playName: string;
152
+ runId: string;
153
+ key: string;
154
+ output?: unknown;
155
+ };
156
+
157
+ export type RuntimePlayResolutionAction = {
158
+ action: 'resolve_play';
159
+ playRef: string;
160
+ };
161
+
162
+ export type RuntimeResultsAction = {
163
+ action: 'save_results';
164
+ playId: string;
165
+ userId?: string | null;
166
+ result: {
167
+ success: boolean;
168
+ error?: string;
169
+ publicResult?: Record<string, unknown> | null;
170
+ maxCreditsPerRun?: number | null;
171
+ temporalActionEstimate?: Record<string, unknown> | null;
172
+ };
173
+ };
174
+
175
+ export type RuntimeApiAction =
176
+ | RuntimePlayResolutionAction
177
+ | RuntimeSheetAction
178
+ | RuntimeArtifactAction
179
+ | RuntimeRunStatusAction
180
+ | RuntimeResultsAction
181
+ | RuntimeBillingAction
182
+ | RuntimeReceiptAction;
183
+
184
+ export type RuntimeBatchAction = {
185
+ action: 'batch';
186
+ events: RuntimeApiAction[];
187
+ };
188
+
189
+ export const runtimeRunActions = {
190
+ updateStatus(input: Omit<RuntimeRunStatusAction, 'action'>): RuntimeRunStatusAction {
191
+ return { action: 'update_run_status', ...input };
192
+ },
193
+ } as const;
194
+
195
+ export const runtimeSheetActions = {
196
+ startDataset(input: Omit<Extract<RuntimeSheetAction, { action: 'start_sheet_dataset' }>, 'action'>) {
197
+ return { action: 'start_sheet_dataset', ...input } satisfies RuntimeSheetAction;
198
+ },
199
+ persistCompletedRows(input: Omit<Extract<RuntimeSheetAction, { action: 'persist_completed_sheet_rows' }>, 'action'>) {
200
+ return { action: 'persist_completed_sheet_rows', ...input } satisfies RuntimeSheetAction;
201
+ },
202
+ } as const;
203
+
204
+ export const runtimeBillingActions = {
205
+ finalize(input: Omit<Extract<RuntimeBillingAction, { action: 'compute_billing_finalize' }>, 'action'>) {
206
+ return { action: 'compute_billing_finalize', ...input } satisfies RuntimeBillingAction;
207
+ },
208
+ } as const;