deepline 0.3.392 → 0.3.393
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/sdk/src/client.ts +156 -24
- package/dist/bundling-sources/sdk/src/compat.ts +9 -0
- package/dist/bundling-sources/sdk/src/http.ts +5 -1
- package/dist/bundling-sources/sdk/src/index.ts +5 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +182 -6
- package/dist/bundling-sources/sdk/src/release.ts +4 -1
- package/dist/bundling-sources/sdk/src/types.ts +13 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/request-warnings.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +315 -0
- package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +41 -8
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +418 -44
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +36 -3
- package/dist/bundling-sources/shared_libs/play-runtime/durable-invocation-fence.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +11 -3
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +19 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +158 -10
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +235 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +92 -58
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +30 -7
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1161 -316
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +28 -15
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +24 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +31 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +37 -4
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +172 -79
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +173 -1
- package/dist/cli/{auth-6JSA2ZCW.mjs → auth-5PXHA232.mjs} +4 -4
- package/dist/cli/auth-P3MVDTXM.js +39 -0
- package/dist/cli/{billing-Q5BLQHIU.js → billing-JFB2XLSO.js} +101 -74
- package/dist/cli/{billing-MRRO643H.mjs → billing-Z2N7ZAGM.mjs} +32 -5
- package/dist/cli/{chunk-CVLM3WMJ.js → chunk-2HAD745V.js} +242 -183
- package/dist/cli/{chunk-HGYBEAQP.mjs → chunk-2LGC4EFT.mjs} +3 -3
- package/dist/cli/{chunk-A3APGZFP.mjs → chunk-4PT2VA3A.mjs} +2 -2
- package/dist/cli/{chunk-6DBOU7UH.js → chunk-4XX6443T.js} +176 -87
- package/dist/cli/{chunk-2QLML6G4.mjs → chunk-5KWKZIQR.mjs} +4 -4
- package/dist/cli/{chunk-2G7DXFHI.mjs → chunk-5PRVMXKB.mjs} +27 -2
- package/dist/cli/{chunk-DSWSEHRX.mjs → chunk-6I73X254.mjs} +1 -1
- package/dist/cli/{chunk-ZTACINO5.mjs → chunk-7HR7BGZL.mjs} +13 -3
- package/dist/cli/{chunk-BB3FNYFY.js → chunk-AARX5L4B.js} +2 -2
- package/dist/cli/{chunk-WMS5U6YB.js → chunk-CDFH2DYL.js} +20 -19
- package/dist/cli/{chunk-R3O2CZ4H.mjs → chunk-FQ6VHPW4.mjs} +2 -2
- package/dist/cli/{chunk-MU6M3URX.mjs → chunk-HLEESTCH.mjs} +1 -1
- package/dist/cli/{chunk-Q6EOHNRH.mjs → chunk-JI2B4RZP.mjs} +119 -6
- package/dist/cli/{chunk-2Q3GEFL4.mjs → chunk-KIYU2TGL.mjs} +2 -2
- package/dist/cli/{chunk-Y6VOGHF2.mjs → chunk-KZZC33PY.mjs} +0 -181
- package/dist/cli/{chunk-UCKJQG25.js → chunk-L2SYLGRP.js} +8 -8
- package/dist/cli/{chunk-2GAHHSLB.mjs → chunk-LMMEAMA7.mjs} +3 -2
- package/dist/cli/{chunk-YAZCDBXX.mjs → chunk-LZPCDB7U.mjs} +3 -2
- package/dist/cli/{chunk-RV6ALZIX.js → chunk-M7Y7JYZX.js} +32 -7
- package/dist/cli/{chunk-QGKPTBRR.js → chunk-MS6GUPBB.js} +3 -3
- package/dist/cli/{chunk-4SFPVW7A.js → chunk-OXNOAD6Y.js} +26 -26
- package/dist/cli/{chunk-JOFPQGXW.js → chunk-PTDECJGP.js} +50 -50
- package/dist/cli/{chunk-5O4B6AUN.js → chunk-PWSWAN7Q.js} +25 -2
- package/dist/cli/{chunk-YN6YA7ZZ.mjs → chunk-Q26LUSQ2.mjs} +79 -20
- package/dist/cli/{chunk-3VN4FTE3.js → chunk-RDXFGPJU.js} +1 -182
- package/dist/cli/{chunk-7E66A24V.mjs → chunk-RKMB3N7K.mjs} +25 -2
- package/dist/cli/{chunk-JSLPHFP7.js → chunk-RWHWF5ZJ.js} +3 -2
- package/dist/cli/{chunk-3FV4GBRK.mjs → chunk-STNYIMIV.mjs} +97 -8
- package/dist/cli/chunk-UBKA33KY.mjs +310 -0
- package/dist/cli/{chunk-PAIMOGCM.js → chunk-UHNDVD3P.js} +125 -12
- package/dist/cli/{chunk-24VEN5PQ.mjs → chunk-UOGZUA24.mjs} +179 -17
- package/dist/cli/{chunk-T7OKJ2T6.js → chunk-VIQJIX2P.js} +73 -63
- package/dist/cli/{chunk-RIV2GS5E.js → chunk-VIWE6WRK.js} +627 -465
- package/dist/cli/{chunk-EY7RFC6A.js → chunk-W4WOMXR3.js} +15 -15
- package/dist/cli/chunk-XDVT3GOM.js +310 -0
- package/dist/cli/{chunk-2FQG2HU4.js → chunk-Z3OOZM5L.js} +8 -8
- package/dist/cli/{csv-E4QGUIGI.mjs → csv-KJWZHKCH.mjs} +3 -3
- package/dist/cli/{csv-26U5T24Z.js → csv-P3Z3YE7H.js} +12 -12
- package/dist/cli/{db-JTRJIAQW.mjs → db-NCM4CQIS.mjs} +6 -5
- package/dist/cli/{db-QHBFLMVL.js → db-NUZGJNQC.js} +31 -30
- package/dist/cli/{describe-E3DE3ZK3.mjs → describe-WT6MM2GO.mjs} +17 -16
- package/dist/cli/{describe-FDV2V74F.js → describe-YGSEN5WC.js} +24 -23
- package/dist/cli/{executions-VZYOGVQY.js → executions-PCOLHN7Q.js} +8 -7
- package/dist/cli/{executions-B3GTNPRE.mjs → executions-XS2IPJ4W.mjs} +6 -5
- package/dist/cli/{feedback-CR55FJA2.js → feedback-4MSH7TFU.js} +7 -7
- package/dist/cli/{feedback-4CEBR3OV.mjs → feedback-CCLTS5SV.mjs} +3 -3
- package/dist/cli/{git-NM2PHHZ4.mjs → git-K2DHPMPC.mjs} +4 -4
- package/dist/cli/git-RNM45FX4.js +23 -0
- package/dist/cli/index.js +96 -92
- package/dist/cli/index.mjs +46 -42
- package/dist/cli/{legacy-noops-A7MSW5ND.mjs → legacy-noops-B5S4AR3P.mjs} +4 -4
- package/dist/cli/{legacy-noops-ZUA4YFIH.js → legacy-noops-GPNOPFXV.js} +7 -7
- package/dist/cli/{monitors-NVPRQYP3.mjs → monitors-JLMAIPRG.mjs} +6 -5
- package/dist/cli/{monitors-ZE3TLZ4H.js → monitors-ZAWD7NSN.js} +87 -86
- package/dist/cli/{org-U7A6DV5D.js → org-P2KN4CES.js} +66 -65
- package/dist/cli/{org-KUBILNQV.mjs → org-T3JTHP4G.mjs} +6 -5
- package/dist/cli/{play-HRDXQ4QE.mjs → play-NK6BLRGL.mjs} +11 -10
- package/dist/cli/play-PDXR6JFB.js +158 -0
- package/dist/cli/{providers-OHIWI453.mjs → providers-3NQRA7IT.mjs} +6 -5
- package/dist/cli/{providers-VD6YTVQZ.js → providers-5QRZN3DT.js} +9 -8
- package/dist/cli/{quickstart-UBV2FONF.mjs → quickstart-PIA2JGPV.mjs} +3 -3
- package/dist/cli/{quickstart-ETTCWPA4.js → quickstart-R7NUZGNW.js} +5 -5
- package/dist/cli/run-identity-G257GQED.js +25 -0
- package/dist/cli/run-identity-MRNCEGV2.mjs +25 -0
- package/dist/cli/{search-F44IZRT7.mjs → search-AIDIIGLY.mjs} +7 -6
- package/dist/cli/search-QRWL7MFM.js +27 -0
- package/dist/cli/{secrets-CAEMRORF.js → secrets-BT3PGMWN.js} +15 -14
- package/dist/cli/{secrets-R6XOJZKU.mjs → secrets-OQNHL45O.mjs} +6 -5
- package/dist/cli/{sessions-6GC7OFTT.js → sessions-EYXWOSWK.js} +5 -5
- package/dist/cli/{sessions-RLN6UQS3.mjs → sessions-SF7WJPJP.mjs} +4 -4
- package/dist/cli/{settings-DPNVUAV2.js → settings-BA3GHBOD.js} +76 -75
- package/dist/cli/{settings-KIPAMRPP.mjs → settings-Y57JTFDD.mjs} +9 -8
- package/dist/cli/{setup-TU2F7PU5.mjs → setup-7GR5GBHA.mjs} +6 -6
- package/dist/cli/{setup-DTL3L5SG.js → setup-RERXYC66.js} +41 -41
- package/dist/cli/{skills-UV5MYJ46.mjs → skills-SJWIQAV5.mjs} +4 -4
- package/dist/cli/skills-V7EY75HB.js +28 -0
- package/dist/cli/tools-H5HLBCHH.js +41 -0
- package/dist/cli/{tools-QRRNDCQ7.mjs → tools-ZF3JXPNL.mjs} +10 -9
- package/dist/cli/update-472HA3LT.js +28 -0
- package/dist/cli/{update-4426TF35.mjs → update-FFFYQAOJ.mjs} +6 -6
- package/dist/cli/{workflow-HNLOVISB.js → workflow-SZJVQH4T.js} +17 -16
- package/dist/cli/{workflow-N4U5VLZ3.mjs → workflow-XVFEEGAS.mjs} +7 -6
- package/dist/{client-e6Qh5ZIg.d.mts → client-DU5dtHDy.d.mts} +153 -4
- package/dist/{client-Uxuy-xQ2.d.ts → client-mCE88hC4.d.ts} +153 -4
- package/dist/{compiler-manifest-CY2v8ab0.d.ts → compiler-manifest-DE4RdAiY.d.mts} +61 -1
- package/dist/{compiler-manifest-CY2v8ab0.d.mts → compiler-manifest-DE4RdAiY.d.ts} +61 -1
- package/dist/{index-B9fBZH1g.d.mts → index-BI6nWgaV.d.mts} +1 -1
- package/dist/{index-BZ6uzZJl.d.ts → index-Bi-f7HFT.d.ts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +120 -29
- package/dist/index.mjs +111 -20
- package/dist/install-integrity.json +91 -86
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +5 -2
- package/dist/plays/run-request.mjs +4 -1
- package/dist/release.d.mts +4 -1
- package/dist/release.d.ts +4 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
- package/dist/cli/auth-67TAELQL.js +0 -39
- package/dist/cli/git-I5JTK6YU.js +0 -23
- package/dist/cli/play-A2V7YDU7.js +0 -157
- package/dist/cli/search-WWXMBVPH.js +0 -26
- package/dist/cli/skills-SWOSEZLB.js +0 -28
- package/dist/cli/tools-IL2YCDQ6.js +0 -40
- package/dist/cli/update-BERDPEYR.js +0 -28
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// ../plays/row-identity.ts
|
|
2
|
+
var POSTGRES_IDENTIFIER_MAX_LENGTH = 63;
|
|
3
|
+
var MAP_KEY_NAMESPACE_MAX_LENGTH = POSTGRES_IDENTIFIER_MAX_LENGTH;
|
|
4
|
+
var SHA256_INITIAL_HASH = [
|
|
5
|
+
1779033703,
|
|
6
|
+
3144134277,
|
|
7
|
+
1013904242,
|
|
8
|
+
2773480762,
|
|
9
|
+
1359893119,
|
|
10
|
+
2600822924,
|
|
11
|
+
528734635,
|
|
12
|
+
1541459225
|
|
13
|
+
];
|
|
14
|
+
var SHA256_ROUND_CONSTANTS = [
|
|
15
|
+
1116352408,
|
|
16
|
+
1899447441,
|
|
17
|
+
3049323471,
|
|
18
|
+
3921009573,
|
|
19
|
+
961987163,
|
|
20
|
+
1508970993,
|
|
21
|
+
2453635748,
|
|
22
|
+
2870763221,
|
|
23
|
+
3624381080,
|
|
24
|
+
310598401,
|
|
25
|
+
607225278,
|
|
26
|
+
1426881987,
|
|
27
|
+
1925078388,
|
|
28
|
+
2162078206,
|
|
29
|
+
2614888103,
|
|
30
|
+
3248222580,
|
|
31
|
+
3835390401,
|
|
32
|
+
4022224774,
|
|
33
|
+
264347078,
|
|
34
|
+
604807628,
|
|
35
|
+
770255983,
|
|
36
|
+
1249150122,
|
|
37
|
+
1555081692,
|
|
38
|
+
1996064986,
|
|
39
|
+
2554220882,
|
|
40
|
+
2821834349,
|
|
41
|
+
2952996808,
|
|
42
|
+
3210313671,
|
|
43
|
+
3336571891,
|
|
44
|
+
3584528711,
|
|
45
|
+
113926993,
|
|
46
|
+
338241895,
|
|
47
|
+
666307205,
|
|
48
|
+
773529912,
|
|
49
|
+
1294757372,
|
|
50
|
+
1396182291,
|
|
51
|
+
1695183700,
|
|
52
|
+
1986661051,
|
|
53
|
+
2177026350,
|
|
54
|
+
2456956037,
|
|
55
|
+
2730485921,
|
|
56
|
+
2820302411,
|
|
57
|
+
3259730800,
|
|
58
|
+
3345764771,
|
|
59
|
+
3516065817,
|
|
60
|
+
3600352804,
|
|
61
|
+
4094571909,
|
|
62
|
+
275423344,
|
|
63
|
+
430227734,
|
|
64
|
+
506948616,
|
|
65
|
+
659060556,
|
|
66
|
+
883997877,
|
|
67
|
+
958139571,
|
|
68
|
+
1322822218,
|
|
69
|
+
1537002063,
|
|
70
|
+
1747873779,
|
|
71
|
+
1955562222,
|
|
72
|
+
2024104815,
|
|
73
|
+
2227730452,
|
|
74
|
+
2361852424,
|
|
75
|
+
2428436474,
|
|
76
|
+
2756734187,
|
|
77
|
+
3204031479,
|
|
78
|
+
3329325298
|
|
79
|
+
];
|
|
80
|
+
function stableValue(value) {
|
|
81
|
+
if (Array.isArray(value)) {
|
|
82
|
+
return value.map((entry) => stableValue(entry));
|
|
83
|
+
}
|
|
84
|
+
if (value && typeof value === "object") {
|
|
85
|
+
return Object.fromEntries(
|
|
86
|
+
Object.entries(value).filter(([, entry]) => entry !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, stableValue(entry)])
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
function stableStringify(value) {
|
|
92
|
+
return JSON.stringify(stableValue(value));
|
|
93
|
+
}
|
|
94
|
+
function rightRotate32(value, bits) {
|
|
95
|
+
return value >>> bits | value << 32 - bits;
|
|
96
|
+
}
|
|
97
|
+
function sha256Hex(input) {
|
|
98
|
+
const bytes = Array.from(new TextEncoder().encode(input));
|
|
99
|
+
const bitLength = bytes.length * 8;
|
|
100
|
+
bytes.push(128);
|
|
101
|
+
while (bytes.length % 64 !== 56) {
|
|
102
|
+
bytes.push(0);
|
|
103
|
+
}
|
|
104
|
+
const highBits = Math.floor(bitLength / 4294967296);
|
|
105
|
+
const lowBits = bitLength >>> 0;
|
|
106
|
+
bytes.push(
|
|
107
|
+
highBits >>> 24 & 255,
|
|
108
|
+
highBits >>> 16 & 255,
|
|
109
|
+
highBits >>> 8 & 255,
|
|
110
|
+
highBits & 255,
|
|
111
|
+
lowBits >>> 24 & 255,
|
|
112
|
+
lowBits >>> 16 & 255,
|
|
113
|
+
lowBits >>> 8 & 255,
|
|
114
|
+
lowBits & 255
|
|
115
|
+
);
|
|
116
|
+
const hash = [...SHA256_INITIAL_HASH];
|
|
117
|
+
const words = new Array(64).fill(0);
|
|
118
|
+
for (let offset = 0; offset < bytes.length; offset += 64) {
|
|
119
|
+
for (let index = 0; index < 16; index += 1) {
|
|
120
|
+
const wordOffset = offset + index * 4;
|
|
121
|
+
words[index] = (bytes[wordOffset] ?? 0) << 24 | (bytes[wordOffset + 1] ?? 0) << 16 | (bytes[wordOffset + 2] ?? 0) << 8 | (bytes[wordOffset + 3] ?? 0);
|
|
122
|
+
}
|
|
123
|
+
for (let index = 16; index < 64; index += 1) {
|
|
124
|
+
const s0 = rightRotate32(words[index - 15], 7) ^ rightRotate32(words[index - 15], 18) ^ words[index - 15] >>> 3;
|
|
125
|
+
const s1 = rightRotate32(words[index - 2], 17) ^ rightRotate32(words[index - 2], 19) ^ words[index - 2] >>> 10;
|
|
126
|
+
words[index] = words[index - 16] + s0 + words[index - 7] + s1 >>> 0;
|
|
127
|
+
}
|
|
128
|
+
let [a, b, c, d, e, f, g, h] = hash;
|
|
129
|
+
for (let index = 0; index < 64; index += 1) {
|
|
130
|
+
const s1 = rightRotate32(e, 6) ^ rightRotate32(e, 11) ^ rightRotate32(e, 25);
|
|
131
|
+
const ch = e & f ^ ~e & g;
|
|
132
|
+
const temp1 = h + s1 + ch + SHA256_ROUND_CONSTANTS[index] + words[index] >>> 0;
|
|
133
|
+
const s0 = rightRotate32(a, 2) ^ rightRotate32(a, 13) ^ rightRotate32(a, 22);
|
|
134
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
135
|
+
const temp2 = s0 + maj >>> 0;
|
|
136
|
+
h = g;
|
|
137
|
+
g = f;
|
|
138
|
+
f = e;
|
|
139
|
+
e = d + temp1 >>> 0;
|
|
140
|
+
d = c;
|
|
141
|
+
c = b;
|
|
142
|
+
b = a;
|
|
143
|
+
a = temp1 + temp2 >>> 0;
|
|
144
|
+
}
|
|
145
|
+
hash[0] = hash[0] + a >>> 0;
|
|
146
|
+
hash[1] = hash[1] + b >>> 0;
|
|
147
|
+
hash[2] = hash[2] + c >>> 0;
|
|
148
|
+
hash[3] = hash[3] + d >>> 0;
|
|
149
|
+
hash[4] = hash[4] + e >>> 0;
|
|
150
|
+
hash[5] = hash[5] + f >>> 0;
|
|
151
|
+
hash[6] = hash[6] + g >>> 0;
|
|
152
|
+
hash[7] = hash[7] + h >>> 0;
|
|
153
|
+
}
|
|
154
|
+
return hash.map((word) => word.toString(16).padStart(8, "0")).join("");
|
|
155
|
+
}
|
|
156
|
+
function sanitizeIdentifierPart(value) {
|
|
157
|
+
return value.trim().replace(/[^a-z0-9]+/gi, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
158
|
+
}
|
|
159
|
+
function validateIdentifierPart(rawValue, label, maxLength) {
|
|
160
|
+
const sanitized = sanitizeIdentifierPart(rawValue);
|
|
161
|
+
if (!sanitized) {
|
|
162
|
+
throw new Error(`${label} must contain a letter or number.`);
|
|
163
|
+
}
|
|
164
|
+
if (sanitized.length > maxLength) {
|
|
165
|
+
throw new Error(
|
|
166
|
+
`${label} is too long after normalization (${sanitized.length}/${maxLength}): "${sanitized}".`
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
return sanitized;
|
|
170
|
+
}
|
|
171
|
+
function normalizeTableNamespace(value) {
|
|
172
|
+
return validateIdentifierPart(
|
|
173
|
+
value,
|
|
174
|
+
"ctx.dataset() key",
|
|
175
|
+
MAP_KEY_NAMESPACE_MAX_LENGTH
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ../play-runtime/run-identity.ts
|
|
180
|
+
function sanitizePlayNameForWorkflowSegment(value) {
|
|
181
|
+
return value.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64);
|
|
182
|
+
}
|
|
183
|
+
function buildPlayWorkflowFamilyKey(playName) {
|
|
184
|
+
const normalized = playName.split("/").map(sanitizePlayNameForWorkflowSegment).filter(Boolean).join("/");
|
|
185
|
+
return normalized || "play";
|
|
186
|
+
}
|
|
187
|
+
function buildPlayWorkflowRunSuffix(now) {
|
|
188
|
+
const pad = (value, size = 2) => String(value).padStart(size, "0");
|
|
189
|
+
return [
|
|
190
|
+
now.getUTCFullYear(),
|
|
191
|
+
pad(now.getUTCMonth() + 1),
|
|
192
|
+
pad(now.getUTCDate()),
|
|
193
|
+
"t",
|
|
194
|
+
pad(now.getUTCHours()),
|
|
195
|
+
pad(now.getUTCMinutes()),
|
|
196
|
+
pad(now.getUTCSeconds()),
|
|
197
|
+
"-",
|
|
198
|
+
pad(now.getUTCMilliseconds(), 3)
|
|
199
|
+
].join("");
|
|
200
|
+
}
|
|
201
|
+
var CANONICAL_PLAY_RUN_TIMESTAMP_RE = /\/run\/(\d{4})(\d{2})(\d{2})t(\d{2})(\d{2})(\d{2})-(\d{3})(?:-|$)/;
|
|
202
|
+
function canonicalPlayRunStartedAtMs(runId) {
|
|
203
|
+
const match = CANONICAL_PLAY_RUN_TIMESTAMP_RE.exec(runId);
|
|
204
|
+
if (!match) return null;
|
|
205
|
+
const [, year, month, day, hour, minute, second, millisecond] = match;
|
|
206
|
+
const value = Date.UTC(
|
|
207
|
+
Number(year),
|
|
208
|
+
Number(month) - 1,
|
|
209
|
+
Number(day),
|
|
210
|
+
Number(hour),
|
|
211
|
+
Number(minute),
|
|
212
|
+
Number(second),
|
|
213
|
+
Number(millisecond)
|
|
214
|
+
);
|
|
215
|
+
if (!Number.isFinite(value)) return null;
|
|
216
|
+
const roundTrip = new Date(value);
|
|
217
|
+
return roundTrip.getUTCFullYear() === Number(year) && roundTrip.getUTCMonth() === Number(month) - 1 && roundTrip.getUTCDate() === Number(day) && roundTrip.getUTCHours() === Number(hour) && roundTrip.getUTCMinutes() === Number(minute) && roundTrip.getUTCSeconds() === Number(second) && roundTrip.getUTCMilliseconds() === Number(millisecond) ? value : null;
|
|
218
|
+
}
|
|
219
|
+
function buildRunEntropySuffix() {
|
|
220
|
+
const randomUuid = globalThis.crypto?.randomUUID?.();
|
|
221
|
+
if (randomUuid) {
|
|
222
|
+
return randomUuid.replace(/-/g, "").slice(0, 8);
|
|
223
|
+
}
|
|
224
|
+
return Math.random().toString(36).slice(2, 10).padEnd(8, "0");
|
|
225
|
+
}
|
|
226
|
+
function buildPlayWorkflowId(playName, now, options = {}) {
|
|
227
|
+
const familyKey = buildPlayWorkflowFamilyKey(playName);
|
|
228
|
+
const timestamp = now ?? /* @__PURE__ */ new Date();
|
|
229
|
+
const unique = options.unique ?? now === void 0;
|
|
230
|
+
const entropy = unique ? `-${buildRunEntropySuffix()}` : "";
|
|
231
|
+
return `play/${familyKey}/run/${buildPlayWorkflowRunSuffix(timestamp)}${entropy}`;
|
|
232
|
+
}
|
|
233
|
+
function buildCallerPlayWorkflowId(playName, request, now) {
|
|
234
|
+
const { workflowId: _ignored, ...intent } = request;
|
|
235
|
+
const wireIntent = JSON.parse(JSON.stringify(intent));
|
|
236
|
+
return `${buildPlayWorkflowId(playName, now, { unique: true })}-caller-${sha256Hex(stableStringify(wireIntent))}`;
|
|
237
|
+
}
|
|
238
|
+
function callerPlayWorkflowIdMatchesRequest(workflowId, request) {
|
|
239
|
+
const match = /^play\/[a-z0-9/-]+\/run\/\d{8}t\d{6}-\d{3}-[a-z0-9]{8}-caller-([a-f0-9]{64})$/.exec(
|
|
240
|
+
workflowId
|
|
241
|
+
);
|
|
242
|
+
if (!match || canonicalPlayRunStartedAtMs(workflowId) === null) return false;
|
|
243
|
+
const { workflowId: _ignored, ...intent } = request;
|
|
244
|
+
return match[1] === sha256Hex(stableStringify(JSON.parse(JSON.stringify(intent))));
|
|
245
|
+
}
|
|
246
|
+
function buildPlayRunIdentity(playName, now, options = {}) {
|
|
247
|
+
const workflowId = buildPlayWorkflowId(playName, now, {
|
|
248
|
+
unique: options.unique ?? now === void 0
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
workflowId,
|
|
252
|
+
runId: workflowId,
|
|
253
|
+
workflowFamilyKey: buildPlayWorkflowFamilyKey(playName)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function buildAsyncPlayRunIdentity(input) {
|
|
257
|
+
const digest = sha256Hex(
|
|
258
|
+
`${input.parentRunId}\0${input.invocationKey}`
|
|
259
|
+
).slice(0, 20);
|
|
260
|
+
const parentStartedAt = canonicalPlayRunStartedAtMs(input.parentRunId) ?? 0;
|
|
261
|
+
const base = buildPlayWorkflowId("async-child", new Date(parentStartedAt), {
|
|
262
|
+
unique: false
|
|
263
|
+
});
|
|
264
|
+
const workflowId = `${base}-async-${digest}`;
|
|
265
|
+
return {
|
|
266
|
+
workflowId,
|
|
267
|
+
runId: workflowId,
|
|
268
|
+
workflowFamilyKey: buildPlayWorkflowFamilyKey(input.playName)
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function buildRerunPlayRunIdentity(input) {
|
|
272
|
+
const digest = sha256Hex(
|
|
273
|
+
`rerun\0${input.sourceRunId}\0${input.idempotencyKey}`
|
|
274
|
+
).slice(0, 20);
|
|
275
|
+
const startedAt = canonicalPlayRunStartedAtMs(input.sourceRunId) ?? (typeof input.sourceStartedAtMs === "number" && Number.isFinite(input.sourceStartedAtMs) ? input.sourceStartedAtMs : 0);
|
|
276
|
+
const base = buildPlayWorkflowId(input.playName, new Date(startedAt), {
|
|
277
|
+
unique: false
|
|
278
|
+
});
|
|
279
|
+
const workflowId = `${base}-rerun-${digest}`;
|
|
280
|
+
return {
|
|
281
|
+
workflowId,
|
|
282
|
+
runId: workflowId,
|
|
283
|
+
workflowFamilyKey: buildPlayWorkflowFamilyKey(input.playName)
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function buildAsyncPlayRequestFingerprint(input) {
|
|
287
|
+
return sha256Hex(
|
|
288
|
+
stableStringify({
|
|
289
|
+
key: input.key,
|
|
290
|
+
playRef: input.playRef,
|
|
291
|
+
input: input.childInput
|
|
292
|
+
})
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export {
|
|
297
|
+
stableStringify,
|
|
298
|
+
sha256Hex,
|
|
299
|
+
normalizeTableNamespace,
|
|
300
|
+
buildPlayWorkflowFamilyKey,
|
|
301
|
+
buildPlayWorkflowRunSuffix,
|
|
302
|
+
canonicalPlayRunStartedAtMs,
|
|
303
|
+
buildPlayWorkflowId,
|
|
304
|
+
buildCallerPlayWorkflowId,
|
|
305
|
+
callerPlayWorkflowIdMatchesRequest,
|
|
306
|
+
buildPlayRunIdentity,
|
|
307
|
+
buildAsyncPlayRunIdentity,
|
|
308
|
+
buildRerunPlayRunIdentity,
|
|
309
|
+
buildAsyncPlayRequestFingerprint
|
|
310
|
+
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _chunkXDVT3GOMjs = require('./chunk-XDVT3GOM.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
4
8
|
var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
|
|
5
9
|
|
|
6
10
|
|
|
@@ -74,6 +78,9 @@ var PLAY_FILES_STAGE_PATH = "/api/v2/plays/files/stage";
|
|
|
74
78
|
var PLAY_FILES_STAGE_MINT_PATH = `${PLAY_FILES_STAGE_PATH}/mint`;
|
|
75
79
|
function buildPlayRunStartBody(request) {
|
|
76
80
|
return {
|
|
81
|
+
...request.admissionOrgId ? { admissionOrgId: request.admissionOrgId } : {},
|
|
82
|
+
...request.workflowId ? { workflowId: request.workflowId } : {},
|
|
83
|
+
...request.maxTotalCredits !== void 0 ? { maxTotalCredits: request.maxTotalCredits } : {},
|
|
77
84
|
...request.name ? { name: request.name } : {},
|
|
78
85
|
...request.revisionId ? { revisionId: request.revisionId } : {},
|
|
79
86
|
...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
|
|
@@ -105,18 +112,122 @@ function buildPlayRunStartBody(request) {
|
|
|
105
112
|
...request.testPolicyOverrides ? { testPolicyOverrides: request.testPolicyOverrides } : {}
|
|
106
113
|
};
|
|
107
114
|
}
|
|
108
|
-
async function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
async function preparePlayRunAdmission(http, request, onSubmission) {
|
|
116
|
+
let capability = null;
|
|
117
|
+
if (http.get) {
|
|
118
|
+
try {
|
|
119
|
+
capability = await http.get(PLAY_RUN_START_PATH);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (!(error instanceof _chunk7P5AA3SNjs.DeeplineError) || ![404, 405].includes(_nullishCoalesce(error.statusCode, () => ( 0))))
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
if (capability && !["caller-intent-v1", "unsupported"].includes(
|
|
125
|
+
_nullishCoalesce(capability.admissionContract, () => ( ""))
|
|
126
|
+
)) {
|
|
127
|
+
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
128
|
+
"The server admission capability response is unknown; execution was not submitted.",
|
|
129
|
+
503,
|
|
130
|
+
"PLAY_RUN_ADMISSION_CAPABILITY_UNKNOWN"
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const supportsCallerIntent = _optionalChain([capability, 'optionalAccess', _5 => _5.admissionContract]) === "caller-intent-v1";
|
|
135
|
+
if (supportsCallerIntent && (!_optionalChain([capability, 'optionalAccess', _6 => _6.orgId]) || request.admissionOrgId && request.admissionOrgId !== capability.orgId)) {
|
|
136
|
+
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
137
|
+
"The admission workspace could not be pinned to this request; execution was not submitted.",
|
|
138
|
+
409,
|
|
139
|
+
"PLAY_RUN_ADMISSION_TENANT_CONFLICT"
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
if (request.workflowId && !supportsCallerIntent) {
|
|
143
|
+
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
144
|
+
"This server has not enabled caller-owned admission recovery. Do not retry an ambiguous start.",
|
|
145
|
+
409,
|
|
146
|
+
"PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
if (request.maxTotalCredits !== void 0 && _optionalChain([capability, 'optionalAccess', _7 => _7.strictTotalBudget]) !== "fail-closed-v1") {
|
|
150
|
+
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
151
|
+
"This server cannot honor a strict total Play budget. Execution was not submitted.",
|
|
152
|
+
409,
|
|
153
|
+
"PLAY_TOTAL_BUDGET_UNSUPPORTED"
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
const wireBody = JSON.parse(
|
|
157
|
+
JSON.stringify(
|
|
158
|
+
buildPlayRunStartBody({
|
|
159
|
+
...request,
|
|
160
|
+
...supportsCallerIntent ? { admissionOrgId: capability.orgId } : {}
|
|
161
|
+
})
|
|
162
|
+
)
|
|
114
163
|
);
|
|
164
|
+
const workflowId = supportsCallerIntent ? _nullishCoalesce(request.workflowId, () => ( _chunkXDVT3GOMjs.buildCallerPlayWorkflowId.call(void 0, _nullishCoalesce(request.name, () => ( "play")), wireBody))) : void 0;
|
|
165
|
+
const submittedBody = workflowId ? { workflowId, ...wireBody } : wireBody;
|
|
166
|
+
if (workflowId && !_chunkXDVT3GOMjs.callerPlayWorkflowIdMatchesRequest.call(void 0, workflowId, submittedBody)) {
|
|
167
|
+
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
168
|
+
"workflowId must be the caller run ID of this same immutable request.",
|
|
169
|
+
400,
|
|
170
|
+
"PLAY_RUN_START_INTENT_CONFLICT"
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
if (onSubmission) {
|
|
174
|
+
if (!workflowId || !_optionalChain([capability, 'optionalAccess', _8 => _8.orgId])) {
|
|
175
|
+
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
176
|
+
"This server cannot persist a recoverable submission intent. Execution was not submitted.",
|
|
177
|
+
409,
|
|
178
|
+
"PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
await onSubmission({
|
|
182
|
+
workflowId,
|
|
183
|
+
orgId: capability.orgId,
|
|
184
|
+
request: submittedBody
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
return { body: submittedBody, workflowId, supportsCallerIntent };
|
|
188
|
+
}
|
|
189
|
+
async function startPlayRun(http, request, headers, onSubmission) {
|
|
190
|
+
const {
|
|
191
|
+
body: submittedBody,
|
|
192
|
+
workflowId,
|
|
193
|
+
supportsCallerIntent
|
|
194
|
+
} = await preparePlayRunAdmission(http, request, onSubmission);
|
|
195
|
+
let response;
|
|
196
|
+
try {
|
|
197
|
+
response = await http.post(
|
|
198
|
+
PLAY_RUN_START_PATH,
|
|
199
|
+
submittedBody,
|
|
200
|
+
headers,
|
|
201
|
+
{ maxRetries: 0, exactUrlOnly: true }
|
|
202
|
+
);
|
|
203
|
+
} catch (error) {
|
|
204
|
+
if (error instanceof _chunk7P5AA3SNjs.DeeplineError && ["NETWORK_TIMEOUT", "NETWORK_ERROR", "FETCH_FAILED"].includes(
|
|
205
|
+
_nullishCoalesce(error.code, () => ( ""))
|
|
206
|
+
) || error instanceof TypeError || error instanceof Error && ["AbortError", "TimeoutError"].includes(error.name)) {
|
|
207
|
+
const originalMessage = error instanceof Error ? error.message : "Transport failed";
|
|
208
|
+
const failure = new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
209
|
+
workflowId ? `${originalMessage} Admission outcome is unknown for ${workflowId}. Inspect this run before retrying; reuse this workflowId for the same immutable request.` : `${originalMessage} Admission outcome is unknown. This server did not prove caller-owned recovery support; inspect existing runs before starting again.`,
|
|
210
|
+
error instanceof _chunk7P5AA3SNjs.DeeplineError ? error.statusCode : void 0,
|
|
211
|
+
error instanceof _chunk7P5AA3SNjs.DeeplineError ? error.code : "NETWORK_ERROR",
|
|
212
|
+
{
|
|
213
|
+
...workflowId ? { runId: workflowId, workflowId } : {},
|
|
214
|
+
admissionState: "unknown",
|
|
215
|
+
recoverySupported: supportsCallerIntent,
|
|
216
|
+
next: {
|
|
217
|
+
inspect: workflowId ? `deepline runs get ${workflowId} --json` : "deepline runs list --json"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
Object.assign(failure, { cause: error });
|
|
222
|
+
throw failure;
|
|
223
|
+
}
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
115
226
|
return normalizePlayRunStart(response);
|
|
116
227
|
}
|
|
117
228
|
function isPlayRunPackage(value) {
|
|
118
229
|
return Boolean(
|
|
119
|
-
value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof _optionalChain([value, 'access',
|
|
230
|
+
value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof _optionalChain([value, 'access', _9 => _9.run, 'optionalAccess', _10 => _10.id]) === "string"
|
|
120
231
|
);
|
|
121
232
|
}
|
|
122
233
|
function normalizePlayRunStart(raw) {
|
|
@@ -156,7 +267,7 @@ function schemaMetadata(schema, key) {
|
|
|
156
267
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
157
268
|
}
|
|
158
269
|
function stringMetadata(metadata, key) {
|
|
159
|
-
const value = _optionalChain([metadata, 'optionalAccess',
|
|
270
|
+
const value = _optionalChain([metadata, 'optionalAccess', _11 => _11[key]]);
|
|
160
271
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
161
272
|
}
|
|
162
273
|
function inputFieldFromCsvArg(csvArg) {
|
|
@@ -164,7 +275,7 @@ function inputFieldFromCsvArg(csvArg) {
|
|
|
164
275
|
const match = /^\(?\s*input\.([A-Za-z_$][\w$]*)\s*\)?(?:\s*\?\?[\s\S]+)?$/.exec(
|
|
165
276
|
csvArg.trim()
|
|
166
277
|
);
|
|
167
|
-
return _nullishCoalesce(_optionalChain([match, 'optionalAccess',
|
|
278
|
+
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _12 => _12[1]]), () => ( null));
|
|
168
279
|
}
|
|
169
280
|
function fileInputBindingsFromPlaySchema(inputSchema) {
|
|
170
281
|
const csvInput = schemaMetadata(inputSchema, "csvInput");
|
|
@@ -295,7 +406,7 @@ async function uploadStagedFileToPresignedUrl(input) {
|
|
|
295
406
|
return;
|
|
296
407
|
}
|
|
297
408
|
const text = await response.text().catch(() => "");
|
|
298
|
-
const egressDenied = response.status === 403 && _optionalChain([response, 'access',
|
|
409
|
+
const egressDenied = response.status === 403 && _optionalChain([response, 'access', _13 => _13.headers, 'access', _14 => _14.get, 'call', _15 => _15("x-deny-reason"), 'optionalAccess', _16 => _16.trim, 'call', _17 => _17(), 'access', _18 => _18.toLowerCase, 'call', _19 => _19()]) === "host_not_allowed";
|
|
299
410
|
lastError = new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
300
411
|
`Direct storage upload of ${input.logicalPath} failed: ${response.status} ${text.slice(0, 200)}`,
|
|
301
412
|
response.status,
|
|
@@ -470,7 +581,7 @@ async function stageFileInputs(input) {
|
|
|
470
581
|
if (localFiles.length === 0) {
|
|
471
582
|
return { inputFile: null, packagedFiles: [] };
|
|
472
583
|
}
|
|
473
|
-
_optionalChain([input, 'access',
|
|
584
|
+
_optionalChain([input, 'access', _20 => _20.onStaging, 'optionalCall', _21 => _21(localFiles.length)]);
|
|
474
585
|
const uploads = await Promise.all(
|
|
475
586
|
localFiles.map(
|
|
476
587
|
async ({ file }) => createStagedFileUpload(file.logicalPath, await file.read(), input.codec)
|
|
@@ -520,6 +631,7 @@ function createSessionPlayRunHttp(fetchImpl = (...args) => fetch(...args)) {
|
|
|
520
631
|
return parsed;
|
|
521
632
|
};
|
|
522
633
|
return {
|
|
634
|
+
get: (path) => send(path, { method: "GET" }),
|
|
523
635
|
post: (path, body, headers) => send(path, {
|
|
524
636
|
method: "POST",
|
|
525
637
|
headers: { "content-type": "application/json", ...headers },
|
|
@@ -558,4 +670,5 @@ function createSessionPlayRunHttp(fetchImpl = (...args) => fetch(...args)) {
|
|
|
558
670
|
|
|
559
671
|
|
|
560
672
|
|
|
561
|
-
|
|
673
|
+
|
|
674
|
+
exports.isTerminalPlayRunLifecycleStatus = isTerminalPlayRunLifecycleStatus; exports.decodePlayRunPublicStatus = decodePlayRunPublicStatus; exports.PLAY_RUN_START_PATH = PLAY_RUN_START_PATH; exports.PLAY_RUN_START_STREAM_PATH = PLAY_RUN_START_STREAM_PATH; exports.PLAY_FILES_STAGE_PATH = PLAY_FILES_STAGE_PATH; exports.PLAY_FILES_STAGE_MINT_PATH = PLAY_FILES_STAGE_MINT_PATH; exports.buildPlayRunStartBody = buildPlayRunStartBody; exports.preparePlayRunAdmission = preparePlayRunAdmission; exports.startPlayRun = startPlayRun; exports.isPlayRunPackage = isPlayRunPackage; exports.normalizePlayRunStart = normalizePlayRunStart; exports.buildNamedPlayRunRequest = buildNamedPlayRunRequest; exports.CSV_DATA_INPUT_KEY = CSV_DATA_INPUT_KEY; exports.fileInputBindingsFromPlaySchema = fileInputBindingsFromPlaySchema; exports.fileInputBindingsFromStaticPipeline = fileInputBindingsFromStaticPipeline; exports.playRunFileInputBindings = playRunFileInputBindings; exports.getDottedInputValue = getDottedInputValue; exports.setDottedInputValue = setDottedInputValue; exports.webStagedFileCodec = webStagedFileCodec; exports.stagedFileContentType = stagedFileContentType; exports.createStagedFileUpload = createStagedFileUpload; exports.STAGE_LEGACY_MULTIPART_MAX_BYTES = STAGE_LEGACY_MULTIPART_MAX_BYTES; exports.mintStagedPlayFileUploads = mintStagedPlayFileUploads; exports.stagePlayFiles = stagePlayFiles; exports.stageFileInputs = stageFileInputs; exports.createSessionPlayRunHttp = createSessionPlayRunHttp;
|