deepline 0.1.153 → 0.1.154

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 (48) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +15 -0
  2. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +1180 -825
  3. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/batching.ts +34 -18
  4. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +41 -0
  5. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/receipts.ts +143 -8
  6. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-receipts.ts +104 -0
  7. package/dist/bundling-sources/sdk/src/index.ts +0 -1
  8. package/dist/bundling-sources/sdk/src/play.ts +3 -48
  9. package/dist/bundling-sources/sdk/src/plays/harness-stub.ts +27 -2
  10. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  11. package/dist/bundling-sources/sdk/src/worker-play-entry.ts +0 -10
  12. package/dist/bundling-sources/shared_libs/play-data-plane/index.ts +0 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +87 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +0 -59
  15. package/dist/bundling-sources/shared_libs/play-runtime/cell-staleness.ts +0 -253
  16. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +805 -1570
  17. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +47 -74
  18. package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +36 -14
  19. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +145 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +284 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/postgres-json.ts +12 -5
  22. package/dist/bundling-sources/shared_libs/play-runtime/run-lifecycle-policy.ts +78 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +10 -45
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +1 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +923 -535
  26. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver-neon-serverless.ts +45 -76
  27. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver.ts +12 -1
  28. package/dist/bundling-sources/shared_libs/play-runtime/step-program-dataset-builder.ts +1 -14
  29. package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +159 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +4 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +32 -0
  32. package/dist/bundling-sources/shared_libs/plays/definition.ts +4 -2
  33. package/dist/bundling-sources/shared_libs/plays/runtime-validation.ts +3 -14
  34. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +1 -43
  35. package/dist/cli/index.js +1301 -399
  36. package/dist/cli/index.mjs +1269 -361
  37. package/dist/{compiler-manifest-BjoRENv9.d.ts → compiler-manifest-DW1flrHk.d.mts} +0 -9
  38. package/dist/{compiler-manifest-BjoRENv9.d.mts → compiler-manifest-DW1flrHk.d.ts} +0 -9
  39. package/dist/index.d.mts +9 -38
  40. package/dist/index.d.ts +9 -38
  41. package/dist/index.js +22 -11
  42. package/dist/index.mjs +22 -11
  43. package/dist/plays/bundle-play-file.d.mts +2 -2
  44. package/dist/plays/bundle-play-file.d.ts +2 -2
  45. package/package.json +1 -1
  46. package/dist/bundling-sources/shared_libs/play-data-plane/cell-policy.ts +0 -76
  47. package/dist/bundling-sources/shared_libs/play-runtime/progress-emitter.ts +0 -197
  48. package/dist/bundling-sources/shared_libs/play-runtime/waterfall-replay.ts +0 -79
@@ -1,197 +0,0 @@
1
- import { sqlSafePlayColumnName } from '@shared_libs/plays/static-pipeline';
2
- import type {
3
- InlineWaterfallSpec,
4
- MapExecutionScope,
5
- PlayExecutionEvent,
6
- PlayRowUpdate,
7
- } from './ctx-types';
8
-
9
- type RowContextSnapshot = {
10
- fieldName?: string;
11
- mapScope?: MapExecutionScope;
12
- } | null;
13
-
14
- type CellStatus =
15
- | 'queued'
16
- | 'running'
17
- | 'completed'
18
- | 'failed'
19
- | 'cached'
20
- | 'missed'
21
- | 'skipped';
22
-
23
- export class PlayProgressEmitter {
24
- constructor(
25
- private readonly onRowUpdate:
26
- | ((update: PlayRowUpdate) => void | Promise<void>)
27
- | undefined,
28
- private readonly onExecutionEvent:
29
- | ((event: PlayExecutionEvent) => void | Promise<void>)
30
- | undefined,
31
- private readonly getRowContext: () => RowContextSnapshot,
32
- private readonly isInlineWaterfallToolStep: (
33
- step: InlineWaterfallSpec['steps'][number],
34
- ) => boolean,
35
- ) {}
36
-
37
- executionEvent(event: PlayExecutionEvent): void {
38
- if (!this.onExecutionEvent) {
39
- return;
40
- }
41
- void this.onExecutionEvent(event);
42
- }
43
-
44
- rowUpdate(
45
- key: string | null,
46
- tableNamespace: string | null,
47
- update: Omit<PlayRowUpdate, 'key'>,
48
- ): void {
49
- const rowContext = this.getRowContext();
50
- const rowScope = rowContext?.mapScope;
51
- if (rowScope && key) {
52
- this.executionEvent({
53
- type: 'map.row.updated',
54
- mapInvocationId: rowScope.mapInvocationId,
55
- mapNodeId: rowScope.mapNodeId ?? null,
56
- logicalNamespace: rowScope.logicalNamespace,
57
- artifactTableNamespace: rowScope.artifactTableNamespace,
58
- rowKey: key,
59
- rowStatus: update.status,
60
- fieldName: rowContext?.fieldName ?? null,
61
- stage: update.stage ?? null,
62
- provider: update.provider ?? null,
63
- at: Date.now(),
64
- });
65
- }
66
- if (!key || !this.onRowUpdate) {
67
- return;
68
- }
69
- void this.onRowUpdate({
70
- ...update,
71
- key,
72
- tableNamespace,
73
- });
74
- }
75
-
76
- fieldMetaUpdate(input: {
77
- rowId: number;
78
- key: string | null;
79
- tableNamespace: string | null;
80
- fieldName?: string | null;
81
- status: CellStatus;
82
- rowStatus?: PlayRowUpdate['status'];
83
- stage?: string | null;
84
- provider?: string | null;
85
- error?: string | null;
86
- reused?: boolean;
87
- dataPatch?: Record<string, unknown>;
88
- }): void {
89
- if (!input.fieldName) {
90
- this.rowUpdate(input.key, input.tableNamespace, {
91
- rowId: input.rowId,
92
- status: input.rowStatus,
93
- stage: input.stage ?? null,
94
- provider: input.provider ?? null,
95
- error: input.error ?? null,
96
- dataPatch: input.dataPatch ?? {},
97
- });
98
- return;
99
- }
100
-
101
- this.rowUpdate(input.key, input.tableNamespace, {
102
- rowId: input.rowId,
103
- status: input.rowStatus,
104
- stage: input.stage ?? null,
105
- provider: input.provider ?? null,
106
- error: input.error ?? null,
107
- dataPatch: input.dataPatch ?? {},
108
- cellMetaPatch: {
109
- [input.fieldName]: {
110
- status: input.status,
111
- stage: input.stage ?? null,
112
- provider: input.provider ?? null,
113
- error: input.error ?? null,
114
- ...(input.reused !== undefined ? { reused: input.reused } : {}),
115
- },
116
- },
117
- });
118
- }
119
-
120
- cellUpdate(input: {
121
- rowId: number;
122
- key: string | null;
123
- tableNamespace: string | null;
124
- columnName: string;
125
- status: CellStatus;
126
- rowStatus?: PlayRowUpdate['status'];
127
- stage?: string | null;
128
- provider?: string | null;
129
- error?: string | null;
130
- producer?: {
131
- kind: 'play' | 'tool' | 'code';
132
- id?: string | null;
133
- displayName?: string | null;
134
- playId?: string | null;
135
- toolId?: string | null;
136
- runId?: string | null;
137
- } | null;
138
- value?: unknown;
139
- }): void {
140
- this.rowUpdate(input.key, input.tableNamespace, {
141
- rowId: input.rowId,
142
- status: input.rowStatus,
143
- stage: input.stage ?? null,
144
- provider: input.provider ?? null,
145
- error: input.error ?? null,
146
- dataPatch:
147
- input.value === undefined ? {} : { [input.columnName]: input.value },
148
- cellMetaPatch: {
149
- [input.columnName]: {
150
- status: input.status,
151
- stage: input.stage ?? null,
152
- provider: input.provider ?? null,
153
- error: input.error ?? null,
154
- ...(input.producer !== undefined ? { producer: input.producer } : {}),
155
- },
156
- },
157
- });
158
- }
159
-
160
- queuedInlineWaterfallSteps(input: {
161
- rowId: number;
162
- key: string | null;
163
- tableNamespace: string | null;
164
- spec: InlineWaterfallSpec;
165
- }): void {
166
- for (const step of input.spec.steps) {
167
- this.cellUpdate({
168
- rowId: input.rowId,
169
- key: input.key,
170
- tableNamespace: input.tableNamespace,
171
- columnName: sqlSafePlayColumnName(`${input.spec.id}.${step.id}`),
172
- status: 'queued',
173
- stage: step.id,
174
- provider: this.isInlineWaterfallToolStep(step)
175
- ? (
176
- step as Extract<
177
- InlineWaterfallSpec['steps'][number],
178
- { toolId: string }
179
- >
180
- ).toolId
181
- : 'code',
182
- producer: this.isInlineWaterfallToolStep(step)
183
- ? {
184
- kind: 'tool',
185
- toolId: (
186
- step as Extract<
187
- InlineWaterfallSpec['steps'][number],
188
- { toolId: string }
189
- >
190
- ).toolId,
191
- }
192
- : { kind: 'code', id: step.id },
193
- value: null,
194
- });
195
- }
196
- }
197
- }
@@ -1,79 +0,0 @@
1
- import type {
2
- BatchResult,
3
- PlayCheckpoint,
4
- WaterfallRequest,
5
- } from './ctx-types';
6
-
7
- export class WaterfallReplayStore {
8
- constructor(private readonly checkpoint: PlayCheckpoint) {}
9
-
10
- checkpointKey(input: { rowId: number; rowKey?: string | null }): string {
11
- return input.rowKey?.trim() || String(input.rowId);
12
- }
13
-
14
- getResolved(
15
- queueKey: string,
16
- input: {
17
- rowId: number;
18
- rowKey?: string | null;
19
- },
20
- ): { found: boolean; value: unknown } {
21
- const resolved = this.checkpoint.resolvedWaterfalls[queueKey];
22
- if (!resolved) {
23
- return { found: false, value: undefined };
24
- }
25
- const durableKey = this.checkpointKey(input);
26
- if (Object.prototype.hasOwnProperty.call(resolved, durableKey)) {
27
- return { found: true, value: resolved[durableKey] };
28
- }
29
- return { found: false, value: undefined };
30
- }
31
-
32
- setResolved(
33
- queueKey: string,
34
- input: {
35
- rowId: number;
36
- rowKey?: string | null;
37
- },
38
- value: unknown,
39
- ): void {
40
- this.checkpoint.resolvedWaterfalls[queueKey] ??= {};
41
- this.checkpoint.resolvedWaterfalls[queueKey]![this.checkpointKey(input)] =
42
- value;
43
- }
44
-
45
- readProviderBatch(input: {
46
- batchKey: string;
47
- requests: readonly WaterfallRequest[];
48
- }): Array<{ request: WaterfallRequest; result: unknown | null }> | null {
49
- const cached = this.checkpoint.completedBatches[input.batchKey];
50
- if (!cached) {
51
- return null;
52
- }
53
- const recovered = cached.flatMap((entry) => {
54
- const request = input.requests.find((candidate) =>
55
- entry.rowKey
56
- ? candidate.rowKey === entry.rowKey
57
- : candidate.rowId === entry.rowId,
58
- );
59
- return request ? [{ request, result: entry.result }] : [];
60
- });
61
- return recovered.length > 0 ? recovered : null;
62
- }
63
-
64
- writeProviderBatch(
65
- batchKey: string,
66
- results: ReadonlyArray<{
67
- request: WaterfallRequest;
68
- result: unknown | null;
69
- }>,
70
- ): void {
71
- this.checkpoint.completedBatches[batchKey] = results.map(
72
- (entry): BatchResult => ({
73
- rowId: entry.request.rowId,
74
- rowKey: entry.request.rowKey ?? null,
75
- result: entry.result,
76
- }),
77
- );
78
- }
79
- }