deepline 0.1.182 → 0.1.184
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.
- package/dist/bundling-sources/apps/play-runner-workers/src/child-play-await.ts +203 -6
- package/dist/bundling-sources/apps/play-runner-workers/src/child-play-submit.ts +8 -1
- package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +639 -109
- package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +3 -2
- package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +1752 -1899
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +116 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +542 -78
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/receipts.ts +292 -11
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/run-work-dispatcher.ts +519 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +2381 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-receipts.ts +18 -5
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/work-budget.ts +130 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/worker-platform-budget.ts +39 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry-state.ts +2 -0
- package/dist/bundling-sources/sdk/src/client.ts +41 -0
- package/dist/bundling-sources/sdk/src/http.ts +23 -8
- package/dist/bundling-sources/sdk/src/plays/harness-stub.ts +56 -3
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/sdk/src/types.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +133 -10
- package/dist/bundling-sources/shared_libs/play-runtime/auth-scope-resolver.ts +92 -0
- package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +4 -4
- package/dist/bundling-sources/shared_libs/play-runtime/batching-types.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/child-run-id.ts +101 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1612 -287
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +105 -6
- package/dist/bundling-sources/shared_libs/play-runtime/dedup-backend.ts +0 -0
- package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durability-store.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +116 -16
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +186 -20
- package/dist/bundling-sources/shared_libs/play-runtime/dynamic-worker-version.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +133 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +245 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +5 -5
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/lease-policy.ts +52 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/providers.ts +3 -2
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +124 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +6 -2
- package/dist/bundling-sources/shared_libs/play-runtime/row-isolation.ts +48 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +158 -15
- package/dist/bundling-sources/shared_libs/play-runtime/run-terminal-source.ts +45 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +2038 -262
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-attempt-state-machine.ts +183 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +88 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +8 -1
- package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +19 -1
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +343 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +43 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +11 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +437 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +83 -6
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +28 -11
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +38 -6
- package/dist/bundling-sources/shared_libs/security/safe-outbound-fetch.ts +24 -17
- package/dist/cli/index.js +76 -17
- package/dist/cli/index.mjs +76 -17
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +63 -9
- package/dist/index.mjs +63 -9
- package/dist/plays/bundle-play-file.mjs +20 -6
- package/package.json +1 -1
|
@@ -6,16 +6,87 @@ import {
|
|
|
6
6
|
harnessFailRuntimeReceipt,
|
|
7
7
|
harnessFailRuntimeReceipts,
|
|
8
8
|
harnessGetRuntimeReceipt,
|
|
9
|
+
harnessHeartbeatRuntimeReceipts,
|
|
10
|
+
harnessReleaseRuntimeReceipt,
|
|
9
11
|
} from '../../../../sdk/src/plays/harness-stub';
|
|
10
12
|
import type { PreloadedRuntimeDbSessionInput } from '../../../play-harness-worker/src/rpc-types';
|
|
11
13
|
import type { WorkerRuntimeReceiptStore } from './receipts';
|
|
12
14
|
|
|
15
|
+
const RUNTIME_TEST_FAULT_NAMES = new Set([
|
|
16
|
+
'receipt_complete_write_fail',
|
|
17
|
+
'receipt_fail_write_fail',
|
|
18
|
+
'worker_receipt_complete_write_fail',
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
function createReceiptCompletionFaultForwarder(
|
|
22
|
+
header: string | null | undefined,
|
|
23
|
+
): () => string | null {
|
|
24
|
+
const value = header?.trim();
|
|
25
|
+
if (!value) return () => null;
|
|
26
|
+
const counts = new Map<string, number>();
|
|
27
|
+
for (const rawPart of value.split(',')) {
|
|
28
|
+
const part = rawPart.trim();
|
|
29
|
+
if (!part) continue;
|
|
30
|
+
const [rawName, rawCount] = part.split(':');
|
|
31
|
+
const name = rawName?.trim();
|
|
32
|
+
if (!name) continue;
|
|
33
|
+
if (!RUNTIME_TEST_FAULT_NAMES.has(name)) {
|
|
34
|
+
throw new Error(`Unsupported runtime test fault "${name}".`);
|
|
35
|
+
}
|
|
36
|
+
const count =
|
|
37
|
+
rawCount === undefined || rawCount.trim() === '' ? 1 : Number(rawCount);
|
|
38
|
+
if (!Number.isInteger(count) || count < 1) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Runtime test fault "${name}" count must be a positive integer.`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
counts.set(name, (counts.get(name) ?? 0) + count);
|
|
44
|
+
}
|
|
45
|
+
return () => {
|
|
46
|
+
const forwarded: string[] = [];
|
|
47
|
+
for (const [name, count] of counts) {
|
|
48
|
+
if (name !== 'worker_receipt_complete_write_fail') {
|
|
49
|
+
forwarded.push(`${name}:${count}`);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (count <= 0) continue;
|
|
53
|
+
forwarded.push('receipt_complete_write_fail:1');
|
|
54
|
+
// Keep repeated worker-scoped fault forwards distinct for the direct
|
|
55
|
+
// runtime fault consumer, whose state is keyed by runId + header value.
|
|
56
|
+
forwarded.push(`${name}:${count}`);
|
|
57
|
+
if (count === 1) {
|
|
58
|
+
counts.delete(name);
|
|
59
|
+
} else {
|
|
60
|
+
counts.set(name, count - 1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return forwarded.length > 0 ? forwarded.join(',') : null;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
13
67
|
export function createHarnessWorkerReceiptStore(input: {
|
|
14
68
|
executorToken: string;
|
|
15
69
|
orgId: string;
|
|
16
70
|
preloadedDbSessions?: PreloadedRuntimeDbSessionInput[] | null;
|
|
17
71
|
userEmail?: string | null;
|
|
72
|
+
runtimeTestFaultHeader?: string | null;
|
|
73
|
+
runAttempt?: number | null;
|
|
74
|
+
receiptLeaseTtlMs?: number | null;
|
|
18
75
|
}): WorkerRuntimeReceiptStore {
|
|
76
|
+
const runAttempt =
|
|
77
|
+
typeof input.runAttempt === 'number' && Number.isFinite(input.runAttempt)
|
|
78
|
+
? Math.max(0, Math.floor(input.runAttempt))
|
|
79
|
+
: null;
|
|
80
|
+
const runAttemptField = runAttempt == null ? {} : { runAttempt };
|
|
81
|
+
const leaseTtlField =
|
|
82
|
+
typeof input.receiptLeaseTtlMs === 'number' &&
|
|
83
|
+
Number.isFinite(input.receiptLeaseTtlMs) &&
|
|
84
|
+
input.receiptLeaseTtlMs > 0
|
|
85
|
+
? { leaseTtlMs: Math.floor(input.receiptLeaseTtlMs) }
|
|
86
|
+
: {};
|
|
87
|
+
const receiptCompletionFaultHeader = createReceiptCompletionFaultForwarder(
|
|
88
|
+
input.runtimeTestFaultHeader,
|
|
89
|
+
);
|
|
19
90
|
return {
|
|
20
91
|
getReceipt(command) {
|
|
21
92
|
return harnessGetRuntimeReceipt({
|
|
@@ -23,7 +94,9 @@ export function createHarnessWorkerReceiptStore(input: {
|
|
|
23
94
|
orgId: input.orgId,
|
|
24
95
|
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
25
96
|
userEmail: input.userEmail ?? null,
|
|
97
|
+
runtimeTestFaultHeader: input.runtimeTestFaultHeader ?? null,
|
|
26
98
|
runId: '',
|
|
99
|
+
...runAttemptField,
|
|
27
100
|
...command,
|
|
28
101
|
});
|
|
29
102
|
},
|
|
@@ -33,6 +106,9 @@ export function createHarnessWorkerReceiptStore(input: {
|
|
|
33
106
|
orgId: input.orgId,
|
|
34
107
|
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
35
108
|
userEmail: input.userEmail ?? null,
|
|
109
|
+
runtimeTestFaultHeader: input.runtimeTestFaultHeader ?? null,
|
|
110
|
+
...runAttemptField,
|
|
111
|
+
...leaseTtlField,
|
|
36
112
|
...command,
|
|
37
113
|
});
|
|
38
114
|
},
|
|
@@ -42,6 +118,9 @@ export function createHarnessWorkerReceiptStore(input: {
|
|
|
42
118
|
orgId: input.orgId,
|
|
43
119
|
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
44
120
|
userEmail: input.userEmail ?? null,
|
|
121
|
+
runtimeTestFaultHeader: input.runtimeTestFaultHeader ?? null,
|
|
122
|
+
...runAttemptField,
|
|
123
|
+
...leaseTtlField,
|
|
45
124
|
...command,
|
|
46
125
|
});
|
|
47
126
|
},
|
|
@@ -51,6 +130,8 @@ export function createHarnessWorkerReceiptStore(input: {
|
|
|
51
130
|
orgId: input.orgId,
|
|
52
131
|
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
53
132
|
userEmail: input.userEmail ?? null,
|
|
133
|
+
runtimeTestFaultHeader: receiptCompletionFaultHeader(),
|
|
134
|
+
...runAttemptField,
|
|
54
135
|
...command,
|
|
55
136
|
});
|
|
56
137
|
},
|
|
@@ -60,7 +141,12 @@ export function createHarnessWorkerReceiptStore(input: {
|
|
|
60
141
|
orgId: input.orgId,
|
|
61
142
|
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
62
143
|
userEmail: input.userEmail ?? null,
|
|
144
|
+
runtimeTestFaultHeader: receiptCompletionFaultHeader(),
|
|
63
145
|
...command,
|
|
146
|
+
receipts: command.receipts.map((receipt) => ({
|
|
147
|
+
...runAttemptField,
|
|
148
|
+
...receipt,
|
|
149
|
+
})),
|
|
64
150
|
});
|
|
65
151
|
},
|
|
66
152
|
failReceipt(command) {
|
|
@@ -69,6 +155,19 @@ export function createHarnessWorkerReceiptStore(input: {
|
|
|
69
155
|
orgId: input.orgId,
|
|
70
156
|
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
71
157
|
userEmail: input.userEmail ?? null,
|
|
158
|
+
runtimeTestFaultHeader: input.runtimeTestFaultHeader ?? null,
|
|
159
|
+
...runAttemptField,
|
|
160
|
+
...command,
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
releaseReceipt(command) {
|
|
164
|
+
return harnessReleaseRuntimeReceipt({
|
|
165
|
+
executorToken: input.executorToken,
|
|
166
|
+
orgId: input.orgId,
|
|
167
|
+
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
168
|
+
userEmail: input.userEmail ?? null,
|
|
169
|
+
runtimeTestFaultHeader: input.runtimeTestFaultHeader ?? null,
|
|
170
|
+
...runAttemptField,
|
|
72
171
|
...command,
|
|
73
172
|
});
|
|
74
173
|
},
|
|
@@ -78,6 +177,23 @@ export function createHarnessWorkerReceiptStore(input: {
|
|
|
78
177
|
orgId: input.orgId,
|
|
79
178
|
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
80
179
|
userEmail: input.userEmail ?? null,
|
|
180
|
+
runtimeTestFaultHeader: input.runtimeTestFaultHeader ?? null,
|
|
181
|
+
...command,
|
|
182
|
+
receipts: command.receipts.map((receipt) => ({
|
|
183
|
+
...runAttemptField,
|
|
184
|
+
...receipt,
|
|
185
|
+
})),
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
heartbeatReceipts(command) {
|
|
189
|
+
return harnessHeartbeatRuntimeReceipts({
|
|
190
|
+
executorToken: input.executorToken,
|
|
191
|
+
orgId: input.orgId,
|
|
192
|
+
preloadedDbSessions: input.preloadedDbSessions ?? null,
|
|
193
|
+
userEmail: input.userEmail ?? null,
|
|
194
|
+
runtimeTestFaultHeader: input.runtimeTestFaultHeader ?? null,
|
|
195
|
+
...runAttemptField,
|
|
196
|
+
...leaseTtlField,
|
|
81
197
|
...command,
|
|
82
198
|
});
|
|
83
199
|
},
|