deepline 0.3.408 → 0.3.410
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/agent-runtime.ts +18 -1
- package/dist/bundling-sources/sdk/src/client.ts +212 -334
- package/dist/bundling-sources/sdk/src/compat.ts +45 -2
- package/dist/bundling-sources/sdk/src/db/query.ts +9 -10
- package/dist/bundling-sources/sdk/src/http.ts +38 -20
- package/dist/bundling-sources/sdk/src/index.ts +4 -5
- package/dist/bundling-sources/sdk/src/play.ts +10 -10
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +6 -4
- package/dist/bundling-sources/sdk/src/plays/check-local-play-graph.ts +114 -0
- package/dist/bundling-sources/sdk/src/plays/client.ts +431 -0
- package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +2 -2
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +106 -16
- package/dist/bundling-sources/sdk/src/release.ts +13 -7
- package/dist/bundling-sources/sdk/src/runs/read-errors.ts +8 -0
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +124 -13
- package/dist/bundling-sources/sdk/src/tool-calls.ts +108 -19
- package/dist/bundling-sources/sdk/src/types.ts +18 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/execute-retry-contract.ts +37 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/package.json +3 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +277 -76
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/dataset-row-input.ts +124 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +6 -62
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +67 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +64 -6
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +1 -5
- package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/egress-probe.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +26 -16
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +36 -11
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +35 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +21 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +11 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +85 -20
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +71 -13
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-execution-queries.ts +100 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +9 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +337 -146
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +26 -12
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +425 -102
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +181 -124
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +152 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +5 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +31 -0
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +10 -0
- package/dist/bundling-sources/shared_libs/plays/ambiguous-write-error.ts +25 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +63 -68
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +129 -63
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +14 -0
- package/dist/bundling-sources/shared_libs/plays/enrich-play-compiler.ts +58 -16
- package/dist/bundling-sources/shared_libs/plays/fetch-http-error.ts +50 -0
- package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +351 -0
- package/dist/bundling-sources/shared_libs/plays/tool-list-getter-mode.ts +9 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/cli/{auth-UVD3CUBB.mjs → auth-LLXLIILR.mjs} +6 -6
- package/dist/cli/auth-UG4WOYGL.js +40 -0
- package/dist/cli/{billing-BZVTXXLM.mjs → billing-5FVXZYAC.mjs} +8 -8
- package/dist/cli/{billing-BZVYAF6T.js → billing-NFPK7GYP.js} +84 -84
- package/dist/cli/{chunk-ZAAKSJAS.js → chunk-27GJKC5Q.js} +17 -10
- package/dist/cli/{chunk-UHNDVD3P.js → chunk-2H4EY7KH.js} +100 -41
- package/dist/cli/{chunk-WTT6CLED.mjs → chunk-2YR7BIIC.mjs} +5 -2
- package/dist/cli/{chunk-3ZB6IIA7.js → chunk-36AHOWVS.js} +26 -26
- package/dist/cli/{chunk-OSDXE27V.mjs → chunk-4PG4ARL2.mjs} +17 -10
- package/dist/cli/{chunk-LOYISF7S.mjs → chunk-4XQLVUC7.mjs} +738 -512
- package/dist/cli/{chunk-J5PTX66Y.js → chunk-5MLCBXXU.js} +8 -1
- package/dist/cli/chunk-5TUGWDEB.js +313 -0
- package/dist/cli/{chunk-D6FFBSM5.js → chunk-5UUQAGJS.js} +5 -2
- package/dist/cli/{chunk-4CFULMRB.mjs → chunk-5V5Y37BC.mjs} +2 -2
- package/dist/cli/{chunk-PMVFAYL7.mjs → chunk-63ILLN5H.mjs} +2 -2
- package/dist/cli/{chunk-AUMD2VXP.js → chunk-63S7X326.js} +1032 -806
- package/dist/cli/{chunk-4QFT5LGV.mjs → chunk-6PGATQ6L.mjs} +6 -3
- package/dist/cli/{chunk-6BJK4EJ3.mjs → chunk-AARWVK4C.mjs} +2132 -65
- package/dist/cli/{chunk-FERRDNMO.js → chunk-AD47BXN2.js} +5 -5
- package/dist/cli/{chunk-4RNDKFNQ.js → chunk-D37FEBES.js} +2 -2
- package/dist/cli/{chunk-S6R3OX7B.js → chunk-E4CABWXL.js} +25 -2
- package/dist/cli/{chunk-NXGCO4JB.mjs → chunk-E4IXDAZI.mjs} +5 -0
- package/dist/cli/chunk-EQ4Z7RJW.mjs +35 -0
- package/dist/cli/chunk-FR2ILQ4G.mjs +8 -0
- package/dist/cli/{chunk-QUAQX3FQ.js → chunk-FVLNYDI4.js} +128 -376
- package/dist/cli/{chunk-BRJUESQV.js → chunk-FZJAM576.js} +50 -50
- package/dist/cli/{chunk-BZAMOCPA.mjs → chunk-IMZ56EOH.mjs} +3 -3
- package/dist/cli/{chunk-IOHRWLQE.mjs → chunk-IPG42SD2.mjs} +452 -138
- package/dist/cli/chunk-J33TSWO5.js +8 -0
- package/dist/cli/{chunk-XXLXOUUU.mjs → chunk-JNXJZ577.mjs} +1 -1
- package/dist/cli/{chunk-JI2B4RZP.mjs → chunk-KCC3FKIW.mjs} +71 -12
- package/dist/cli/{chunk-6IKARAYD.mjs → chunk-L2VKAASU.mjs} +23 -0
- package/dist/cli/{chunk-PYZZMAJQ.mjs → chunk-LFSHGNT2.mjs} +8 -1
- package/dist/cli/{chunk-2XXXFPTD.js → chunk-LTFL4JRN.js} +426 -721
- package/dist/cli/{chunk-YHPYUZZX.mjs → chunk-MAMVGOSC.mjs} +1 -1
- package/dist/cli/{chunk-URACNNLO.mjs → chunk-MN2OWLFA.mjs} +2 -2
- package/dist/cli/{chunk-Q3PUHXOY.js → chunk-NF4V5DTY.js} +12 -12
- package/dist/cli/{chunk-Q2E4E4FJ.js → chunk-NPBJI7RE.js} +8 -8
- package/dist/cli/chunk-NTVLGHFM.js +501 -0
- package/dist/cli/{chunk-HQXL5526.mjs → chunk-NUX2QHNC.mjs} +1 -1
- package/dist/cli/{chunk-E3PJF6YP.js → chunk-OBB4QXHA.js} +19 -4
- package/dist/cli/{chunk-SEFMGO3Z.js → chunk-OQQOXSYA.js} +2184 -117
- package/dist/cli/chunk-OZ6E3IRZ.js +6084 -0
- package/dist/cli/{chunk-7P5AA3SN.js → chunk-PPDBRJRW.js} +6 -1
- package/dist/cli/{chunk-IWBXJDZA.mjs → chunk-PZSLPBDA.mjs} +2 -2
- package/dist/cli/{chunk-ILHRA7AD.js → chunk-QADCFSGH.js} +7 -7
- package/dist/cli/{chunk-ECVLPS67.js → chunk-QJI5FIOW.js} +170 -49
- package/dist/cli/{chunk-I3DHIXVJ.mjs → chunk-QL22Y56M.mjs} +149 -28
- package/dist/cli/{chunk-SD7MXAJA.mjs → chunk-RFB25DSQ.mjs} +36 -284
- package/dist/cli/chunk-T44IIOT6.mjs +501 -0
- package/dist/cli/chunk-VK2LZ5IP.js +35 -0
- package/dist/cli/chunk-VKKVSFRD.js +62 -0
- package/dist/cli/{chunk-RWCY6YI2.js → chunk-VYKV5XHL.js} +644 -330
- package/dist/cli/{chunk-GSK6NHVM.js → chunk-WU4U6VSB.js} +5 -5
- package/dist/cli/chunk-XHLKJOTN.mjs +313 -0
- package/dist/cli/{chunk-MJELBQBU.mjs → chunk-XIHWSXSV.mjs} +330 -625
- package/dist/cli/chunk-XNZJKRJA.mjs +6084 -0
- package/dist/cli/chunk-ZCALLYF6.mjs +62 -0
- package/dist/cli/{chunk-ZBABPK6Y.js → chunk-ZFZ427HN.js} +11 -8
- package/dist/cli/{chunk-SJVVBWRL.mjs → chunk-ZKYEW55U.mjs} +16 -1
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-XLGLHJ6P.js → csv-7U3FJYKZ.js} +14 -14
- package/dist/cli/{csv-WPSXG6ZZ.mjs → csv-ZWLDMM4A.mjs} +5 -5
- package/dist/cli/{db-5PTNJG4X.js → db-DNCGV5PC.js} +42 -47
- package/dist/cli/{db-ABS57ABJ.mjs → db-IMYXVMGI.mjs} +15 -20
- package/dist/cli/{describe-PVWQJ2PB.mjs → describe-Q23DWJUK.mjs} +20 -15
- package/dist/cli/{describe-EZS6PQXA.js → describe-S34JUX5W.js} +27 -22
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/describe-core.js +6 -6
- package/dist/cli/describe-core.mjs +5 -5
- package/dist/cli/{executions-OKJGATQZ.mjs → executions-A73EUGSI.mjs} +8 -8
- package/dist/cli/{executions-FNTAFQ7Y.js → executions-XOMPX2YJ.js} +10 -10
- package/dist/cli/{feedback-W27HDMRR.mjs → feedback-N4GJ2POI.mjs} +11 -7
- package/dist/cli/{feedback-6YBOMSUA.js → feedback-QTCHNJJH.js} +13 -9
- package/dist/cli/{git-YOOUEL6M.mjs → git-4Q3JIQYZ.mjs} +6 -6
- package/dist/cli/git-I6CPBEVG.js +24 -0
- package/dist/cli/index.js +240 -352
- package/dist/cli/index.mjs +163 -275
- package/dist/cli/{legacy-noops-V6OKW7VR.mjs → legacy-noops-3SOVGFF7.mjs} +6 -6
- package/dist/cli/{legacy-noops-2VZ7XT6C.js → legacy-noops-4OSHZM34.js} +9 -9
- package/dist/cli/{monitors-FBWGVIUS.js → monitors-LVE2KZNG.js} +94 -94
- package/dist/cli/{monitors-P2YYWTWT.mjs → monitors-QP2XID2B.mjs} +8 -8
- package/dist/cli/{org-DVMG6H3C.mjs → org-IVRETVQA.mjs} +8 -8
- package/dist/cli/{org-3XUSVX5T.js → org-XFLK5IAP.js} +68 -68
- package/dist/cli/{play-GNC5CQAS.mjs → play-DE7VH6NU.mjs} +533 -98
- package/dist/cli/{play-YG5L4BWQ.js → play-XXTPPP23.js} +1067 -632
- package/dist/cli/{providers-7PSWG2OV.js → providers-DLD3I4JF.js} +11 -11
- package/dist/cli/{providers-JR33SLWL.mjs → providers-GX2NIZQQ.mjs} +8 -8
- package/dist/cli/{quickstart-VUOBQYIQ.mjs → quickstart-72B4L4PK.mjs} +5 -5
- package/dist/cli/{quickstart-FDVZ5BL3.js → quickstart-XNS3HSWC.js} +7 -7
- package/dist/cli/search-6NCH4HB5.js +30 -0
- package/dist/cli/{search-JZYLO33K.mjs → search-SUTRANJI.mjs} +9 -9
- package/dist/cli/{secrets-VS266FVA.js → secrets-6OBLOVEV.js} +17 -17
- package/dist/cli/{secrets-3MCYBT4I.mjs → secrets-FPFXXNUH.mjs} +8 -8
- package/dist/cli/sessions-235532DR.js +16 -0
- package/dist/cli/{sessions-ELLLT23E.mjs → sessions-R25I4QKN.mjs} +6 -6
- package/dist/cli/{settings-PZCKAFII.mjs → settings-AOP6F5PZ.mjs} +12 -12
- package/dist/cli/{settings-7364NMMA.js → settings-VL5FOFPN.js} +79 -79
- package/dist/cli/{setup-PMWYLCT6.js → setup-BSC67YT3.js} +45 -44
- package/dist/cli/{setup-A7GQ4KIA.mjs → setup-ZMPHBHVJ.mjs} +11 -10
- package/dist/cli/skills-3IWLYYRL.js +29 -0
- package/dist/cli/{skills-WS6BIFPQ.mjs → skills-KF65TVFO.mjs} +7 -7
- package/dist/cli/tools-LR66SPYU.js +44 -0
- package/dist/cli/{tools-BR4DOZA2.mjs → tools-SX4XIPM7.mjs} +19 -14
- package/dist/cli/{update-D2B7UNFT.mjs → update-QRMFRAQQ.mjs} +11 -9
- package/dist/cli/update-SP7UEO53.js +31 -0
- package/dist/cli/{workflow-PQXC2R47.mjs → workflow-FOEEEB7G.mjs} +44 -20
- package/dist/cli/{workflow-6ODTCYXU.js → workflow-KOCK2FLW.js} +54 -30
- package/dist/{client-Z9Pye1Wm.d.mts → client-74k4IPh6.d.mts} +137 -54
- package/dist/{client-BcvhDfJJ.d.ts → client-C1IK1f8c.d.ts} +137 -54
- package/dist/{compiler-manifest-Ycx-hoAr.d.mts → compiler-manifest-lzWpbV3w.d.mts} +83 -66
- package/dist/{compiler-manifest-Ycx-hoAr.d.ts → compiler-manifest-lzWpbV3w.d.ts} +83 -66
- package/dist/{index-CZXgiN3E.d.mts → index-C8Cy-YTm.d.ts} +5 -1
- package/dist/{index-NPG5pqxQ.d.ts → index-CtNK-0nI.d.mts} +5 -1
- package/dist/index.d.mts +47 -9
- package/dist/index.d.ts +47 -9
- package/dist/index.js +17 -14
- package/dist/index.mjs +13 -10
- package/dist/install-integrity.json +120 -104
- 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 +5 -4
- package/dist/plays/csv-data-input.js +3 -3
- package/dist/plays/csv-data-input.mjs +2 -2
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +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 +11 -3
- package/dist/plays/run-request.mjs +10 -2
- package/dist/release.d.mts +15 -6
- package/dist/release.d.ts +15 -6
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/package.json +2 -2
- package/dist/cli/auth-3GB2K636.js +0 -40
- package/dist/cli/chunk-67RWR34T.mjs +0 -155
- package/dist/cli/chunk-CLJGSOVM.mjs +0 -1716
- package/dist/cli/chunk-HQY2SG3K.js +0 -83
- package/dist/cli/chunk-OSFWFV72.js +0 -155
- package/dist/cli/chunk-Q3LFI3VH.js +0 -392
- package/dist/cli/chunk-WPAB4DCU.mjs +0 -83
- package/dist/cli/chunk-YMOFWHGO.mjs +0 -392
- package/dist/cli/chunk-Z4VNJOF7.js +0 -1716
- package/dist/cli/git-YKUXXJOR.js +0 -24
- package/dist/cli/search-PPPYC5OZ.js +0 -30
- package/dist/cli/sessions-TEHEWW7O.js +0 -16
- package/dist/cli/skills-SYS7VRRK.js +0 -29
- package/dist/cli/tools-KK4BKVQR.js +0 -39
- package/dist/cli/update-2IV5JTX2.js +0 -29
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkE4CABWXLjs = require('./chunk-E4CABWXL.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -13,7 +13,9 @@ var _chunkS6R3OX7Bjs = require('./chunk-S6R3OX7B.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunk2H4EY7KHjs = require('./chunk-2H4EY7KH.js');
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
|
|
@@ -24,16 +26,18 @@ var _chunkKXMNM4AQjs = require('./chunk-KXMNM4AQ.js');
|
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
var _chunkQUAQX3FQjs = require('./chunk-QUAQX3FQ.js');
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
var
|
|
31
|
+
var _chunkFVLNYDI4js = require('./chunk-FVLNYDI4.js');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkNPBJI7REjs = require('./chunk-NPBJI7RE.js');
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
|
|
34
38
|
|
|
35
39
|
|
|
36
|
-
var
|
|
40
|
+
var _chunkPPDBRJRWjs = require('./chunk-PPDBRJRW.js');
|
|
37
41
|
|
|
38
42
|
// src/pagination.ts
|
|
39
43
|
async function* iterateCursorPages(fetchPage) {
|
|
@@ -67,7 +71,7 @@ function requireBillingIdempotencyKey(value) {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
if (!valid) {
|
|
70
|
-
throw new (0,
|
|
74
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
71
75
|
"Billing idempotencyKey must contain 1\u2013200 characters with no leading or trailing whitespace and be valid HTTP header text.",
|
|
72
76
|
void 0,
|
|
73
77
|
"INVALID_BILLING_IDEMPOTENCY_KEY"
|
|
@@ -77,25 +81,25 @@ function requireBillingIdempotencyKey(value) {
|
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
// src/db/query.ts
|
|
80
|
-
function planCustomerDbQuery(input) {
|
|
84
|
+
function planCustomerDbQuery(input, maxRetries = 3) {
|
|
81
85
|
if (typeof input.sql !== "string" || !input.sql.trim())
|
|
82
|
-
throw new (0,
|
|
86
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)("sql must not be empty.", 400, "INVALID_SQL");
|
|
83
87
|
if (input.operationKey !== void 0 && typeof input.operationKey !== "string")
|
|
84
|
-
throw new (0,
|
|
88
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
85
89
|
"operationKey must be a string containing 1\u2013512 characters.",
|
|
86
90
|
400,
|
|
87
91
|
"INVALID_OPERATION_KEY"
|
|
88
92
|
);
|
|
89
93
|
const operationKey = input.operationKey;
|
|
90
94
|
if (operationKey !== void 0 && (!operationKey.trim() || operationKey.length > 512)) {
|
|
91
|
-
throw new (0,
|
|
95
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
92
96
|
"operationKey must contain 1\u2013512 characters.",
|
|
93
97
|
400,
|
|
94
98
|
"INVALID_OPERATION_KEY"
|
|
95
99
|
);
|
|
96
100
|
}
|
|
97
101
|
if (input.maxRows !== void 0 && (!Number.isSafeInteger(input.maxRows) || input.maxRows < 1 || input.maxRows > 1e3)) {
|
|
98
|
-
throw new (0,
|
|
102
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
99
103
|
"maxRows must be a whole number from 1 to 1000.",
|
|
100
104
|
400,
|
|
101
105
|
"INVALID_MAX_ROWS"
|
|
@@ -118,13 +122,13 @@ function planCustomerDbQuery(input) {
|
|
|
118
122
|
recovery: operationKey === void 0 ? "unkeyed_unknown_outcome" : "original_operation_key"
|
|
119
123
|
},
|
|
120
124
|
transport: {
|
|
121
|
-
maxRetries: 0,
|
|
122
|
-
urlFailover: "disabled"
|
|
125
|
+
maxRetries: operationKey === void 0 ? 0 : maxRetries,
|
|
126
|
+
urlFailover: operationKey === void 0 ? "disabled" : "loopback_only"
|
|
123
127
|
}
|
|
124
128
|
};
|
|
125
129
|
}
|
|
126
|
-
async function queryCustomerDatabase(http, input) {
|
|
127
|
-
const plan = planCustomerDbQuery(input);
|
|
130
|
+
async function queryCustomerDatabase(http, input, maxRetries) {
|
|
131
|
+
const plan = planCustomerDbQuery(input, maxRetries);
|
|
128
132
|
let result;
|
|
129
133
|
try {
|
|
130
134
|
result = await http.post(
|
|
@@ -137,10 +141,10 @@ async function queryCustomerDatabase(http, input) {
|
|
|
137
141
|
}
|
|
138
142
|
);
|
|
139
143
|
} catch (error) {
|
|
140
|
-
if (error instanceof
|
|
144
|
+
if (error instanceof _chunkPPDBRJRWjs.DeeplineError && (_optionalChain([error, 'access', _ => _.code, 'optionalAccess', _2 => _2.startsWith, 'call', _3 => _3("NETWORK_")]) || // Older API readers return PostgreSQL errors as HTTP 400, including
|
|
141
145
|
// lost connections and explicitly unknown transaction resolution.
|
|
142
146
|
/^08[A-Z0-9]{3}$/.test(_nullishCoalesce(error.code, () => ( ""))) || ["57P01", "57P02", "57P03"].includes(_nullishCoalesce(error.code, () => ( ""))) || error.statusCode === 408 || (_nullishCoalesce(error.statusCode, () => ( 0))) >= 500)) {
|
|
143
|
-
throw new (0,
|
|
147
|
+
throw new (0, _chunkNPBJI7REjs.CustomerDbQueryOutcomeUnknownError)(
|
|
144
148
|
error,
|
|
145
149
|
plan.request.body.operation_key
|
|
146
150
|
);
|
|
@@ -148,8 +152,8 @@ async function queryCustomerDatabase(http, input) {
|
|
|
148
152
|
throw error;
|
|
149
153
|
}
|
|
150
154
|
if (!result || typeof result !== "object" || Array.isArray(result) || typeof result.command !== "string" || !Array.isArray(result.columns) || !Array.isArray(result.rows) || typeof result.truncated !== "boolean" || result.row_count !== null && (!Number.isSafeInteger(result.row_count) || result.row_count < 0) || !Number.isSafeInteger(result.row_count_returned) || result.row_count_returned < 0) {
|
|
151
|
-
throw new (0,
|
|
152
|
-
new (0,
|
|
155
|
+
throw new (0, _chunkNPBJI7REjs.CustomerDbQueryOutcomeUnknownError)(
|
|
156
|
+
new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
153
157
|
"The SQL response did not contain a valid result.",
|
|
154
158
|
200,
|
|
155
159
|
"CUSTOMER_DB_QUERY_RESPONSE_INVALID"
|
|
@@ -159,8 +163,8 @@ async function queryCustomerDatabase(http, input) {
|
|
|
159
163
|
}
|
|
160
164
|
const operation = result.operation;
|
|
161
165
|
if (input.operationKey !== void 0 && (!operation || operation.operation_key !== input.operationKey || !Number.isSafeInteger(operation.completed_at_ms) || operation.completed_at_ms < 0 || !["executed", "operation_recovery"].includes(operation.source))) {
|
|
162
|
-
throw new (0,
|
|
163
|
-
new (0,
|
|
166
|
+
throw new (0, _chunkNPBJI7REjs.CustomerDbQueryOutcomeUnknownError)(
|
|
167
|
+
new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
164
168
|
"The server did not confirm the original atomic SQL operation.",
|
|
165
169
|
200,
|
|
166
170
|
"CUSTOMER_DB_OPERATION_ACK_INVALID"
|
|
@@ -189,6 +193,156 @@ function resolveLookupClientTimeoutMs(toolId) {
|
|
|
189
193
|
return lookupClientTimeouts.get(toolId.trim().toLowerCase());
|
|
190
194
|
}
|
|
191
195
|
|
|
196
|
+
// ../play-runtime/execute-server-timing.ts
|
|
197
|
+
var EXECUTE_SERVER_TIMING_STAGES = [
|
|
198
|
+
"auth",
|
|
199
|
+
"rate_limit",
|
|
200
|
+
"catalog",
|
|
201
|
+
// Local preparation accumulates compilation/hooks/pricing inside catalog
|
|
202
|
+
// and executor loading before the final provider permit. Do not add it to
|
|
203
|
+
// catalog or total. Credential selection excludes charge admission.
|
|
204
|
+
"credential_plan",
|
|
205
|
+
"provider_prepare",
|
|
206
|
+
"charge_open",
|
|
207
|
+
// Charge admission substages. `charge_open` keeps its original meaning — the
|
|
208
|
+
// TOTAL of all charge-admission work — so an existing reader is unchanged and
|
|
209
|
+
// these four explain work inside it. The authorization action adapter splits
|
|
210
|
+
// its wall into snapshot, remaining action time and application retry gaps.
|
|
211
|
+
// Absent stages are unobserved, not confident zero durations.
|
|
212
|
+
// - `charge_eligibility` canonical wallet and cap authorization snapshot
|
|
213
|
+
// - `charge_cap_preflight` legacy standalone cap work (zero in current path)
|
|
214
|
+
// - `charge_open_mutation` remaining action wall, including transport and
|
|
215
|
+
// failed attempts; legacy name, not mutation CPU
|
|
216
|
+
// - `charge_retry_wait` elapsed gaps before application RPC retries;
|
|
217
|
+
// native Convex logs attribute internal OCC retries
|
|
218
|
+
"charge_eligibility",
|
|
219
|
+
"charge_cap_preflight",
|
|
220
|
+
"charge_open_mutation",
|
|
221
|
+
"charge_retry_wait",
|
|
222
|
+
// Billing completion slices explain the full stage, including transport.
|
|
223
|
+
// Handoff headers/body are nested within billing_handoff, not additive.
|
|
224
|
+
"billing_settle",
|
|
225
|
+
"billing_price",
|
|
226
|
+
"billing_precision",
|
|
227
|
+
"billing_caps",
|
|
228
|
+
"billing_catalog",
|
|
229
|
+
"billing_witness",
|
|
230
|
+
"billing_handoff",
|
|
231
|
+
"billing_handoff_rpc",
|
|
232
|
+
"billing_handoff_headers",
|
|
233
|
+
"billing_handoff_after_headers",
|
|
234
|
+
// Process-wide activity over the RPC interval, including concurrent work.
|
|
235
|
+
// These overlap the wall clocks above; they are not request-attributed CPU.
|
|
236
|
+
"billing_handoff_process_cpu",
|
|
237
|
+
"billing_handoff_event_loop_active",
|
|
238
|
+
"billing_handoff_event_loop_idle",
|
|
239
|
+
"fixture_load",
|
|
240
|
+
"execute",
|
|
241
|
+
"identity",
|
|
242
|
+
"usage_schedule",
|
|
243
|
+
// Managed AI inference slices: `ai_prepare` includes request preparation and
|
|
244
|
+
// contains `ai_billing_authorize`; `ai_provider_work_start` is the durable
|
|
245
|
+
// pre-call transition; `ai_gateway_first_output` is the time to the first
|
|
246
|
+
// model-output part (excluding SDK control chunks); and
|
|
247
|
+
// `ai_gateway_stream_wall` is the end-to-end SDK stream
|
|
248
|
+
// collection wall. Stream wall includes awaited finish callbacks, so evidence
|
|
249
|
+
// persistence and settlement overlap it. First-output and stream wall both
|
|
250
|
+
// include Gateway/network/upstream time; neither claims provider-internal
|
|
251
|
+
// model time.
|
|
252
|
+
"ai_prepare",
|
|
253
|
+
"ai_billing_authorize",
|
|
254
|
+
"ai_provider_work_start",
|
|
255
|
+
"ai_gateway_first_output",
|
|
256
|
+
"ai_gateway_stream_wall",
|
|
257
|
+
"ai_generation_evidence_persist",
|
|
258
|
+
"ai_billing_settlement",
|
|
259
|
+
"ai_output_canonicalization",
|
|
260
|
+
"ai_result_persist",
|
|
261
|
+
// Provider HTTP slices are only nonzero for calls that take this path:
|
|
262
|
+
// admission; `provider_fetch_headers` until response headers arrive (or
|
|
263
|
+
// `provider_fetch_error_wait` for a rejected fetch); retry backoff; body
|
|
264
|
+
// read, JSON parse, result transform and output normalization are separate.
|
|
265
|
+
"provider_admission",
|
|
266
|
+
"provider_fetch_headers",
|
|
267
|
+
"provider_fetch_error_wait",
|
|
268
|
+
"provider_retry_wait",
|
|
269
|
+
"provider_body_read",
|
|
270
|
+
"provider_json_parse",
|
|
271
|
+
"provider_result_transform",
|
|
272
|
+
"provider_output_normalization",
|
|
273
|
+
"total",
|
|
274
|
+
// The execution gateway preserves these disjoint stages beside the app
|
|
275
|
+
// handler's stages. They are deliberately part of this small, additive
|
|
276
|
+
// response diagnostic contract: a long sandbox-to-headers wall is otherwise
|
|
277
|
+
// incorrectly reduced to "network" after the app handler reports quickly.
|
|
278
|
+
"auth_launch",
|
|
279
|
+
"auth_verify",
|
|
280
|
+
"body_parse",
|
|
281
|
+
"dispatch_pool",
|
|
282
|
+
"dispatch_callback",
|
|
283
|
+
// The execution relay measures its own upstream fetch. `upstream_headers`
|
|
284
|
+
// contains the app handler's `total`; subtracting those two clocks leaves
|
|
285
|
+
// only the Vercel/platform-or-transit boundary, never a made-up provider
|
|
286
|
+
// latency. `upstream_body` follows headers while the relay buffers the
|
|
287
|
+
// bounded response before it returns to the runner.
|
|
288
|
+
"upstream_headers",
|
|
289
|
+
"upstream_body"
|
|
290
|
+
];
|
|
291
|
+
var PUBLIC_EXECUTE_SERVER_TIMING_STAGES = [
|
|
292
|
+
// Route total includes lazy execution-module loading. The handler's
|
|
293
|
+
// public_total keeps its existing meaning so older readers remain valid.
|
|
294
|
+
"public_load",
|
|
295
|
+
"public_route",
|
|
296
|
+
// Core and recovery initialization overlap authentication. Their wall is
|
|
297
|
+
// included in public_total; these stages are not additive.
|
|
298
|
+
"public_core_load",
|
|
299
|
+
"public_recovery_load",
|
|
300
|
+
"public_auth",
|
|
301
|
+
"public_claim",
|
|
302
|
+
"public_claim_headers",
|
|
303
|
+
"public_claim_after_headers",
|
|
304
|
+
"public_core",
|
|
305
|
+
"public_prepare",
|
|
306
|
+
"public_r2",
|
|
307
|
+
"public_complete",
|
|
308
|
+
"public_complete_headers",
|
|
309
|
+
"public_complete_after_headers",
|
|
310
|
+
"public_total"
|
|
311
|
+
];
|
|
312
|
+
var ALL_EXECUTE_SERVER_TIMING_STAGES = /* @__PURE__ */ (() => [
|
|
313
|
+
...EXECUTE_SERVER_TIMING_STAGES,
|
|
314
|
+
...PUBLIC_EXECUTE_SERVER_TIMING_STAGES
|
|
315
|
+
])();
|
|
316
|
+
function parseExecuteServerTiming(header) {
|
|
317
|
+
if (typeof header !== "string" || !header.trim()) return null;
|
|
318
|
+
const durations = /* @__PURE__ */ new Map();
|
|
319
|
+
for (const rawEntry of header.split(",")) {
|
|
320
|
+
const parts = rawEntry.split(";");
|
|
321
|
+
const name = _optionalChain([parts, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.trim, 'call', _6 => _6(), 'access', _7 => _7.toLowerCase, 'call', _8 => _8()]);
|
|
322
|
+
if (!name) continue;
|
|
323
|
+
for (const parameter of parts.slice(1)) {
|
|
324
|
+
const separator = parameter.indexOf("=");
|
|
325
|
+
if (separator < 0) continue;
|
|
326
|
+
const key = parameter.slice(0, separator).trim().toLowerCase();
|
|
327
|
+
if (key !== "dur") continue;
|
|
328
|
+
const value = parameter.slice(separator + 1).trim().replace(/^"|"$/g, "");
|
|
329
|
+
const parsed = value === "" ? Number.NaN : Number(value);
|
|
330
|
+
if (Number.isFinite(parsed) && parsed >= 0) {
|
|
331
|
+
durations.set(name, parsed);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const timing = Object.fromEntries(
|
|
336
|
+
ALL_EXECUTE_SERVER_TIMING_STAGES.map((stage) => [
|
|
337
|
+
stage,
|
|
338
|
+
_nullishCoalesce(durations.get(stage), () => ( null))
|
|
339
|
+
])
|
|
340
|
+
);
|
|
341
|
+
return ALL_EXECUTE_SERVER_TIMING_STAGES.some(
|
|
342
|
+
(stage) => timing[stage] !== null
|
|
343
|
+
) ? timing : null;
|
|
344
|
+
}
|
|
345
|
+
|
|
192
346
|
// ../integration-contracts/theirstack/execution-policy.ts
|
|
193
347
|
var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
|
|
194
348
|
var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
|
|
@@ -267,7 +421,7 @@ function usesExtendedBetterContactLauncherBudget(toolId) {
|
|
|
267
421
|
var CLI_INVOCATION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
268
422
|
function validateCliInvocationId(value) {
|
|
269
423
|
if (!CLI_INVOCATION_ID_PATTERN.test(value)) {
|
|
270
|
-
throw new (0,
|
|
424
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
271
425
|
"CLI invocation IDs must be UUID v4 values.",
|
|
272
426
|
void 0,
|
|
273
427
|
"CLI_INVOCATION_ID_INVALID"
|
|
@@ -279,11 +433,11 @@ function validateCliInvocationId(value) {
|
|
|
279
433
|
var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
|
|
280
434
|
var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
|
|
281
435
|
var EXECUTE_RESPONSE_INTENT_HEADER = "x-deepline-execute-response-intent";
|
|
282
|
-
var RAW_V2_EXECUTE_RESPONSE_CONTRACT =
|
|
436
|
+
var RAW_V2_EXECUTE_RESPONSE_CONTRACT = _chunkE4CABWXLjs.RAW_V2_TOOL_RESPONSE_CONTRACT;
|
|
283
437
|
var DEFAULT_EXECUTION_RECOVERY_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
284
438
|
function validateExecutionIdempotencyKey(key) {
|
|
285
439
|
if (typeof key !== "string" || key.length < 1 || key.length > 200 || !/^[A-Za-z0-9._:-]+$/.test(key)) {
|
|
286
|
-
throw new (0,
|
|
440
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
287
441
|
"Execution idempotency keys must be 1\u2013200 ASCII letters, digits, dots, underscores, colons, or hyphens.",
|
|
288
442
|
void 0,
|
|
289
443
|
"IDEMPOTENCY_KEY_INVALID"
|
|
@@ -296,20 +450,20 @@ function getExecutionRecoveryState(value) {
|
|
|
296
450
|
return state === "running" || state === "completed" || state === "outcome_unknown" ? state : null;
|
|
297
451
|
}
|
|
298
452
|
function isRecoverableExecutionAttemptError(error) {
|
|
299
|
-
if (error instanceof
|
|
453
|
+
if (error instanceof _chunkPPDBRJRWjs.ToolExecutionError) {
|
|
300
454
|
return error.code === "EXECUTION_IN_PROGRESS" || error.origin === "deepline" && error.category === "network" && error.networkScope === "client_to_deepline";
|
|
301
455
|
}
|
|
302
|
-
return error instanceof
|
|
456
|
+
return error instanceof _chunkPPDBRJRWjs.DeeplineError && (error.code === "EXECUTION_IN_PROGRESS" || _optionalChain([error, 'access', _9 => _9.code, 'optionalAccess', _10 => _10.startsWith, 'call', _11 => _11("NETWORK_")]) === true && error.statusCode === void 0);
|
|
303
457
|
}
|
|
304
458
|
function isRecoverableExecutionLookupError(error) {
|
|
305
459
|
if (isRecoverableExecutionAttemptError(error)) return true;
|
|
306
|
-
return error instanceof
|
|
460
|
+
return error instanceof _chunkPPDBRJRWjs.DeeplineError && (error.statusCode === 429 || error.statusCode !== void 0 && error.statusCode >= 500);
|
|
307
461
|
}
|
|
308
462
|
function timeoutWithinRecoveryBudget(requestTimeoutMs, defaultRequestTimeoutMs, remainingMs) {
|
|
309
463
|
return Math.min(_nullishCoalesce(requestTimeoutMs, () => ( defaultRequestTimeoutMs)), remainingMs);
|
|
310
464
|
}
|
|
311
465
|
function executionRecoveryError(input) {
|
|
312
|
-
return new (0,
|
|
466
|
+
return new (0, _chunkPPDBRJRWjs.ToolExecutionError)(input.message, {
|
|
313
467
|
toolId: input.toolId,
|
|
314
468
|
provider: null,
|
|
315
469
|
operation: input.toolId,
|
|
@@ -377,7 +531,7 @@ function materializeToolExecutionResponse(response) {
|
|
|
377
531
|
}
|
|
378
532
|
const rawV2 = toolResponse.rawV2;
|
|
379
533
|
const view = toolResponse.view;
|
|
380
|
-
const providerMeta =
|
|
534
|
+
const providerMeta = _chunkE4CABWXLjs.providerMetaFromToolResponseRawV2.call(void 0,
|
|
381
535
|
rawV2,
|
|
382
536
|
_nullishCoalesce(view, () => ( "rawV2"))
|
|
383
537
|
);
|
|
@@ -386,7 +540,7 @@ function materializeToolExecutionResponse(response) {
|
|
|
386
540
|
...response,
|
|
387
541
|
toolResponse: {
|
|
388
542
|
...toolResponse,
|
|
389
|
-
raw:
|
|
543
|
+
raw: _chunkE4CABWXLjs.legacyRawFromToolResponseRawV2.call(void 0,
|
|
390
544
|
rawV2,
|
|
391
545
|
_nullishCoalesce(view, () => ( "rawV2")),
|
|
392
546
|
responseMeta
|
|
@@ -408,54 +562,47 @@ var ToolCalls = class {
|
|
|
408
562
|
this.configuredRequestTimeoutMs = configuredRequestTimeoutMs;
|
|
409
563
|
}
|
|
410
564
|
async call(toolId, input, options) {
|
|
411
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
565
|
+
if (_optionalChain([options, 'optionalAccess', _12 => _12.cliInvocationId]) !== void 0) {
|
|
412
566
|
validateCliInvocationId(options.cliInvocationId);
|
|
413
567
|
}
|
|
414
568
|
const inputSnapshot = JSON.parse(JSON.stringify(input));
|
|
415
|
-
const metadataSnapshot = _optionalChain([options, 'optionalAccess',
|
|
416
|
-
const idempotencyKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
569
|
+
const metadataSnapshot = _optionalChain([options, 'optionalAccess', _13 => _13.metadata]) ? JSON.parse(JSON.stringify(options.metadata)) : void 0;
|
|
570
|
+
const idempotencyKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _14 => _14.idempotencyKey]), () => ( (_optionalChain([options, 'optionalAccess', _15 => _15.recover]) ? crypto.randomUUID() : void 0)));
|
|
417
571
|
if (idempotencyKey !== void 0) {
|
|
418
572
|
validateExecutionIdempotencyKey(idempotencyKey);
|
|
419
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
420
|
-
throw new (0,
|
|
573
|
+
if (_optionalChain([options, 'optionalAccess', _16 => _16.recoveryTimeoutMs]) !== void 0 && (!Number.isFinite(options.recoveryTimeoutMs) || options.recoveryTimeoutMs < 0)) {
|
|
574
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
421
575
|
"recoveryTimeoutMs must be a finite, non-negative number.",
|
|
422
576
|
void 0,
|
|
423
577
|
"IDEMPOTENCY_KEY_INVALID"
|
|
424
578
|
);
|
|
425
579
|
}
|
|
426
|
-
await _optionalChain([options, 'optionalAccess',
|
|
580
|
+
await _optionalChain([options, 'optionalAccess', _17 => _17.onExecution, 'optionalCall', _18 => _18({ idempotencyKey })]);
|
|
427
581
|
}
|
|
428
|
-
const timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
582
|
+
const timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _19 => _19.timeout]), () => ( resolveToolExecuteTimeoutMs(
|
|
429
583
|
toolId,
|
|
430
584
|
inputSnapshot,
|
|
431
585
|
this.configuredRequestTimeoutMs
|
|
432
586
|
)));
|
|
433
|
-
if (idempotencyKey !== void 0) {
|
|
434
|
-
await this.lookupExecutionByKey(
|
|
435
|
-
idempotencyKey,
|
|
436
|
-
timeoutMs,
|
|
437
|
-
_optionalChain([options, 'optionalAccess', _15 => _15.cliInvocationId])
|
|
438
|
-
);
|
|
439
|
-
}
|
|
440
587
|
const isApifySync = toolId.trim().toLowerCase() === "apify_run_actor_sync";
|
|
441
588
|
const headers = {
|
|
442
589
|
[EXECUTE_RESPONSE_CONTRACT_HEADER]: RAW_V2_EXECUTE_RESPONSE_CONTRACT,
|
|
443
590
|
...isApifySync ? { "X-Deepline-Apify-Sync-Response-Budget": "extended-v1" } : {},
|
|
444
|
-
[
|
|
445
|
-
|
|
591
|
+
[_chunkPPDBRJRWjs.TOOL_EXECUTION_ERROR_SCHEMA_HEADER]: String(
|
|
592
|
+
_chunkPPDBRJRWjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION
|
|
446
593
|
),
|
|
447
|
-
..._optionalChain([options, 'optionalAccess',
|
|
448
|
-
[EXECUTE_RESPONSE_INTENT_HEADER]: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
594
|
+
..._optionalChain([options, 'optionalAccess', _20 => _20.includeToolMetadata]) ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
|
|
595
|
+
[EXECUTE_RESPONSE_INTENT_HEADER]: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _21 => _21.responseIntent]), () => ( "raw")),
|
|
449
596
|
...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
|
|
450
|
-
..._optionalChain([options, 'optionalAccess',
|
|
451
|
-
..._optionalChain([options, 'optionalAccess',
|
|
597
|
+
..._optionalChain([options, 'optionalAccess', _22 => _22.searchRef]) ? { "x-deepline-search-ref": options.searchRef } : {},
|
|
598
|
+
..._optionalChain([options, 'optionalAccess', _23 => _23.cliInvocationId]) !== void 0 ? { "x-deepline-cli-invocation-id": options.cliInvocationId } : {}
|
|
452
599
|
};
|
|
453
600
|
let lastResponse = null;
|
|
454
601
|
const observeTerminal = (failure) => {
|
|
455
602
|
if (!lastResponse) return;
|
|
456
603
|
if (failure) {
|
|
457
604
|
const { error } = failure;
|
|
458
|
-
if (isRecoverableExecutionAttemptError(error) || !(error instanceof
|
|
605
|
+
if (isRecoverableExecutionAttemptError(error) || !(error instanceof _chunkPPDBRJRWjs.DeeplineError) || error.statusCode === void 0 || error.statusCode !== lastResponse.httpStatus || error.code === "EXECUTION_OUTCOME_UNKNOWN")
|
|
459
606
|
return;
|
|
460
607
|
}
|
|
461
608
|
const body = lastResponse.body;
|
|
@@ -463,38 +610,91 @@ var ToolCalls = class {
|
|
|
463
610
|
if (recovery === "running" || recovery === "outcome_unknown") return;
|
|
464
611
|
const state = isRecord(body) ? body.status : null;
|
|
465
612
|
const terminal = state === "completed" || state === "failed" || state === "cancelled" ? state : state === "canceled" ? "cancelled" : failure ? "failed" : null;
|
|
466
|
-
if (terminal)
|
|
467
|
-
|
|
613
|
+
if (!terminal || !_optionalChain([options, 'optionalAccess', _24 => _24.onResponseReceived])) return;
|
|
614
|
+
const reportObservationFailure = () => console.error("[tools.execute] response observation failed");
|
|
615
|
+
try {
|
|
616
|
+
const notification = options.onResponseReceived({
|
|
468
617
|
receivedAtMs: lastResponse.receivedAtMs,
|
|
469
618
|
httpStatus: lastResponse.httpStatus,
|
|
470
619
|
state: terminal
|
|
471
|
-
})
|
|
620
|
+
});
|
|
621
|
+
void Promise.resolve(notification).catch(reportObservationFailure);
|
|
622
|
+
} catch (e2) {
|
|
623
|
+
reportObservationFailure();
|
|
624
|
+
}
|
|
472
625
|
};
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
{
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
626
|
+
const legacyEndpoint = `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`;
|
|
627
|
+
let useLegacyEndpoint = idempotencyKey === void 0;
|
|
628
|
+
const atomicToolOnly = _optionalChain([options, 'optionalAccess', _25 => _25.atomicToolOnly]) === true;
|
|
629
|
+
const dispatchRequest = async (requestTimeoutMs) => {
|
|
630
|
+
let recoverySupported = false;
|
|
631
|
+
let atomicToolsSupported = false;
|
|
632
|
+
const post = () => this.http.post(
|
|
633
|
+
atomicToolOnly ? `/api/v2/tools/${encodeURIComponent(toolId)}/execute` : useLegacyEndpoint ? legacyEndpoint : `/api/v2/executions/by-key/${encodeURIComponent(idempotencyKey)}?tool_id=${encodeURIComponent(toolId)}`,
|
|
634
|
+
{
|
|
635
|
+
payload: inputSnapshot,
|
|
636
|
+
...metadataSnapshot ? { metadata: metadataSnapshot } : {}
|
|
637
|
+
},
|
|
638
|
+
headers,
|
|
639
|
+
{
|
|
640
|
+
timeout: requestTimeoutMs,
|
|
641
|
+
maxRetries: idempotencyKey ? 0 : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _26 => _26.maxRetries]), () => ( 0)),
|
|
642
|
+
...atomicToolOnly && !idempotencyKey && _optionalChain([options, 'optionalAccess', _27 => _27.maxRetries]) === void 0 ? { executePolicyMaxRetries: 2 } : {},
|
|
643
|
+
retryApiErrors: atomicToolOnly || _optionalChain([options, 'optionalAccess', _28 => _28.retryApiErrors]) === true,
|
|
644
|
+
retryFromExecutePolicy: atomicToolOnly,
|
|
645
|
+
exactUrlOnly: true,
|
|
646
|
+
toolId,
|
|
647
|
+
idempotencyKey,
|
|
648
|
+
onResponse: (response2) => {
|
|
649
|
+
lastResponse = null;
|
|
650
|
+
atomicToolsSupported = response2.headers.get(_chunkFVLNYDI4js.ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER) === "true";
|
|
651
|
+
recoverySupported = response2.headers.get("X-Deepline-Idempotency-Supported") === "true";
|
|
652
|
+
if (_optionalChain([options, 'optionalAccess', _29 => _29.onServerTiming])) {
|
|
653
|
+
try {
|
|
654
|
+
const notification = options.onServerTiming(
|
|
655
|
+
parseExecuteServerTiming(
|
|
656
|
+
response2.headers.get("server-timing")
|
|
657
|
+
)
|
|
658
|
+
);
|
|
659
|
+
void Promise.resolve(notification).catch(() => void 0);
|
|
660
|
+
} catch (e3) {
|
|
661
|
+
}
|
|
495
662
|
}
|
|
663
|
+
},
|
|
664
|
+
onResponseBody: (observation) => {
|
|
665
|
+
lastResponse = observation;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
);
|
|
669
|
+
try {
|
|
670
|
+
return await post();
|
|
671
|
+
} catch (error) {
|
|
672
|
+
if (atomicToolOnly) {
|
|
673
|
+
if (!atomicToolsSupported && !recoverySupported && !(error instanceof _chunkPPDBRJRWjs.ToolExecutionError) && error instanceof _chunkPPDBRJRWjs.DeeplineError && (error.statusCode === 404 || error.statusCode === 405)) {
|
|
674
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
675
|
+
"This server does not support atomic tool execution.",
|
|
676
|
+
error.statusCode,
|
|
677
|
+
"ATOMIC_TOOL_EXECUTE_UNSUPPORTED"
|
|
678
|
+
);
|
|
496
679
|
}
|
|
680
|
+
throw error;
|
|
681
|
+
}
|
|
682
|
+
if (useLegacyEndpoint || recoverySupported || !(error instanceof _chunkPPDBRJRWjs.DeeplineError) || error.statusCode !== 404 && error.statusCode !== 405)
|
|
683
|
+
throw error;
|
|
684
|
+
lastResponse = null;
|
|
685
|
+
await this.lookupExecutionByKey(
|
|
686
|
+
idempotencyKey,
|
|
687
|
+
requestTimeoutMs,
|
|
688
|
+
_optionalChain([options, 'optionalAccess', _30 => _30.cliInvocationId])
|
|
497
689
|
);
|
|
690
|
+
useLegacyEndpoint = true;
|
|
691
|
+
return post();
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
const request = async (requestTimeoutMs) => {
|
|
695
|
+
lastResponse = null;
|
|
696
|
+
try {
|
|
697
|
+
return await dispatchRequest(requestTimeoutMs);
|
|
498
698
|
} catch (error) {
|
|
499
699
|
observeTerminal({ error });
|
|
500
700
|
throw error;
|
|
@@ -502,7 +702,7 @@ var ToolCalls = class {
|
|
|
502
702
|
};
|
|
503
703
|
let response;
|
|
504
704
|
let recoveryDeadline = null;
|
|
505
|
-
const recoveryTimeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
705
|
+
const recoveryTimeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _31 => _31.recoveryTimeoutMs]), () => ( DEFAULT_EXECUTION_RECOVERY_TIMEOUT_MS));
|
|
506
706
|
let retryDelayMs = 1e3;
|
|
507
707
|
const recoveryTimeoutError = () => executionRecoveryError({
|
|
508
708
|
toolId,
|
|
@@ -530,7 +730,7 @@ var ToolCalls = class {
|
|
|
530
730
|
this.defaultRequestTimeoutMs,
|
|
531
731
|
remainingMs
|
|
532
732
|
),
|
|
533
|
-
_optionalChain([options, 'optionalAccess',
|
|
733
|
+
_optionalChain([options, 'optionalAccess', _32 => _32.cliInvocationId])
|
|
534
734
|
);
|
|
535
735
|
} catch (error) {
|
|
536
736
|
if (!isRecoverableExecutionLookupError(error)) throw error;
|
|
@@ -568,7 +768,7 @@ var ToolCalls = class {
|
|
|
568
768
|
recoveryDeadline = Date.now() + recoveryTimeoutMs;
|
|
569
769
|
}
|
|
570
770
|
} catch (error) {
|
|
571
|
-
if (idempotencyKey && error instanceof
|
|
771
|
+
if (idempotencyKey && error instanceof _chunkPPDBRJRWjs.DeeplineError && error.code === "EXECUTION_OUTCOME_UNKNOWN") {
|
|
572
772
|
throw executionRecoveryError({
|
|
573
773
|
toolId,
|
|
574
774
|
idempotencyKey,
|
|
@@ -603,7 +803,7 @@ var ToolCalls = class {
|
|
|
603
803
|
validateExecutionIdempotencyKey(idempotencyKey);
|
|
604
804
|
const result = await this.lookupExecutionByKey(idempotencyKey);
|
|
605
805
|
if (!result) {
|
|
606
|
-
throw new (0,
|
|
806
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
607
807
|
`No execution exists for idempotency key ${idempotencyKey}.`,
|
|
608
808
|
404,
|
|
609
809
|
"EXECUTION_NOT_FOUND"
|
|
@@ -629,7 +829,7 @@ var ToolCalls = class {
|
|
|
629
829
|
}
|
|
630
830
|
);
|
|
631
831
|
if (!supported) {
|
|
632
|
-
throw new (0,
|
|
832
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
633
833
|
"This Deepline server does not support recoverable tool executions; no tool was dispatched.",
|
|
634
834
|
422,
|
|
635
835
|
"IDEMPOTENCY_NOT_SUPPORTED"
|
|
@@ -639,6 +839,309 @@ var ToolCalls = class {
|
|
|
639
839
|
}
|
|
640
840
|
};
|
|
641
841
|
|
|
842
|
+
// ../play-runtime/runtime-environment.ts
|
|
843
|
+
var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
|
|
844
|
+
var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
|
|
845
|
+
var PLAY_RUNTIME_SANDBOX_PLACEMENT_POLICY_PATTERN = /^[a-z][a-z0-9_]*@[1-9][0-9]*$/;
|
|
846
|
+
function normalizePlayRuntimeNamespace(value) {
|
|
847
|
+
if (typeof value !== "string") return null;
|
|
848
|
+
const normalized = value.trim();
|
|
849
|
+
return PLAY_RUNTIME_NAMESPACE_PATTERN.test(normalized) ? normalized : null;
|
|
850
|
+
}
|
|
851
|
+
function normalizePlayRuntimeSandboxPlacementPolicy(value) {
|
|
852
|
+
if (typeof value !== "string") return null;
|
|
853
|
+
const normalized = value.trim();
|
|
854
|
+
return PLAY_RUNTIME_SANDBOX_PLACEMENT_POLICY_PATTERN.test(normalized) ? normalized : null;
|
|
855
|
+
}
|
|
856
|
+
function normalizePlayRuntimeSelection(value) {
|
|
857
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
858
|
+
const record = value;
|
|
859
|
+
if (Object.keys(record).some(
|
|
860
|
+
(key) => key !== "environment" && key !== "namespace" && key !== "backend" && key !== "sandboxPlacementPolicy"
|
|
861
|
+
) || record.environment !== "preview") {
|
|
862
|
+
return null;
|
|
863
|
+
}
|
|
864
|
+
const namespace = normalizePlayRuntimeNamespace(record.namespace);
|
|
865
|
+
if (!namespace) return null;
|
|
866
|
+
const sandboxPlacementPolicy = record.sandboxPlacementPolicy === void 0 ? void 0 : normalizePlayRuntimeSandboxPlacementPolicy(
|
|
867
|
+
record.sandboxPlacementPolicy
|
|
868
|
+
);
|
|
869
|
+
if (record.sandboxPlacementPolicy !== void 0 && sandboxPlacementPolicy === null) {
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
if (record.backend !== void 0 && record.backend !== _chunkE4CABWXLjs.PLAY_RUNTIME_BACKENDS.daytona && record.backend !== _chunkE4CABWXLjs.PLAY_RUNTIME_BACKENDS.modal) {
|
|
873
|
+
return null;
|
|
874
|
+
}
|
|
875
|
+
return {
|
|
876
|
+
environment: "preview",
|
|
877
|
+
namespace,
|
|
878
|
+
...record.backend === void 0 ? {} : { backend: record.backend },
|
|
879
|
+
...sandboxPlacementPolicy ? { sandboxPlacementPolicy } : {}
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
function normalizePlayRuntimeEnvironment(value) {
|
|
883
|
+
return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// src/plays/client.ts
|
|
887
|
+
function normalizePlayRunIntegrationMode(value) {
|
|
888
|
+
if (value === "live" || value === "eval_stub" || value === "fixture") {
|
|
889
|
+
return value;
|
|
890
|
+
}
|
|
891
|
+
return void 0;
|
|
892
|
+
}
|
|
893
|
+
function resolvePlayRunIntegrationMode(request, env) {
|
|
894
|
+
return normalizePlayRunIntegrationMode(
|
|
895
|
+
_nullishCoalesce(request.integrationMode, () => ( env.DEEPLINE_EVAL_INTEGRATION_MODE))
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
function resolvePlayRunRuntimeSelection(request, env) {
|
|
899
|
+
if (request.runtime !== void 0) {
|
|
900
|
+
const runtime = normalizePlayRuntimeSelection(request.runtime);
|
|
901
|
+
if (!runtime) {
|
|
902
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
903
|
+
'runtime must be { environment: "preview", namespace, backend?: "daytona" | "modal", sandboxPlacementPolicy?: "policy_name@1" } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
|
|
904
|
+
void 0,
|
|
905
|
+
"INVALID_RUNTIME_SELECTION"
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
return runtime;
|
|
909
|
+
}
|
|
910
|
+
const configured = _optionalChain([env, 'access', _33 => _33.DEEPLINE_RUNTIME_ENVIRONMENT, 'optionalAccess', _34 => _34.trim, 'call', _35 => _35()]);
|
|
911
|
+
const configuredNamespace = _optionalChain([env, 'access', _36 => _36.DEEPLINE_RUNTIME_NAMESPACE, 'optionalAccess', _37 => _37.trim, 'call', _38 => _38()]);
|
|
912
|
+
const configuredToken = _optionalChain([env, 'access', _39 => _39.DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN, 'optionalAccess', _40 => _40.trim, 'call', _41 => _41()]);
|
|
913
|
+
const configuredPlacementPolicy = _optionalChain([env, 'access', _42 => _42.DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()]);
|
|
914
|
+
if (!configured) {
|
|
915
|
+
if (configuredNamespace || configuredToken || configuredPlacementPolicy) {
|
|
916
|
+
const present = [];
|
|
917
|
+
if (configuredNamespace) present.push("DEEPLINE_RUNTIME_NAMESPACE");
|
|
918
|
+
if (configuredToken) present.push("DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN");
|
|
919
|
+
if (configuredPlacementPolicy) {
|
|
920
|
+
present.push("DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY");
|
|
921
|
+
}
|
|
922
|
+
const isPlural = present.length > 1;
|
|
923
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
924
|
+
[
|
|
925
|
+
`Incomplete play runtime selection: ${present.join(" and ")} ${isPlural ? "are" : "is"} set but DEEPLINE_RUNTIME_ENVIRONMENT is not.`,
|
|
926
|
+
"Preview routing requires DEEPLINE_RUNTIME_ENVIRONMENT=preview together with DEEPLINE_RUNTIME_NAMESPACE; the token alone authorizes nothing.",
|
|
927
|
+
`If you did not export ${isPlural ? "these" : "this"} yourself, ${isPlural ? "they were" : "it was"} most likely auto-loaded from a .env or .env.local in the current directory (bun loads those automatically, and in a git worktree .env.local is usually a symlink to the main checkout).`,
|
|
928
|
+
`To run against the app-native runtime, clear ${isPlural ? "them" : "it"} for this command: ${present.map((name) => `${name}=`).join(" ")} <your deepline command>`
|
|
929
|
+
].join("\n"),
|
|
930
|
+
void 0,
|
|
931
|
+
"INVALID_RUNTIME_ENVIRONMENT"
|
|
932
|
+
);
|
|
933
|
+
}
|
|
934
|
+
return void 0;
|
|
935
|
+
}
|
|
936
|
+
const environment = normalizePlayRuntimeEnvironment(configured);
|
|
937
|
+
if (!environment) {
|
|
938
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
939
|
+
`DEEPLINE_RUNTIME_ENVIRONMENT supports only explicit preview selection. Received "${configured}". Omit it to use the app-native runtime.`,
|
|
940
|
+
void 0,
|
|
941
|
+
"INVALID_RUNTIME_ENVIRONMENT"
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
const namespace = normalizePlayRuntimeNamespace(configuredNamespace);
|
|
945
|
+
if (!namespace) {
|
|
946
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
947
|
+
"DEEPLINE_RUNTIME_NAMESPACE is required for preview and must match ^[a-z][a-z0-9-]{0,30}$.",
|
|
948
|
+
void 0,
|
|
949
|
+
"INVALID_RUNTIME_NAMESPACE"
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
const configuredBackendValue = _optionalChain([env, 'access', _45 => _45.DEEPLINE_PLAY_RUNNER_BACKEND, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47()]);
|
|
953
|
+
const configuredBackend = configuredBackendValue === "daytona" || configuredBackendValue === "modal" ? configuredBackendValue : void 0;
|
|
954
|
+
if (configuredBackendValue && !configuredBackend) {
|
|
955
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
956
|
+
`DEEPLINE_PLAY_RUNNER_BACKEND must be daytona or modal for preview runtime selection. Received "${configuredBackendValue}".`,
|
|
957
|
+
void 0,
|
|
958
|
+
"INVALID_RUNTIME_BACKEND"
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
if (configuredPlacementPolicy && !normalizePlayRuntimeSandboxPlacementPolicy(configuredPlacementPolicy)) {
|
|
962
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
963
|
+
`DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY must be a versioned placement policy id such as daytona_only@1. Received "${configuredPlacementPolicy}".`,
|
|
964
|
+
void 0,
|
|
965
|
+
"INVALID_RUNTIME_SANDBOX_PLACEMENT_POLICY"
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
return {
|
|
969
|
+
environment,
|
|
970
|
+
namespace,
|
|
971
|
+
...configuredBackend ? { backend: configuredBackend } : {},
|
|
972
|
+
...configuredPlacementPolicy ? { sandboxPlacementPolicy: configuredPlacementPolicy } : {}
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
function resolveStartPlayRunRequest(request, env) {
|
|
976
|
+
const integrationMode = resolvePlayRunIntegrationMode(request, env);
|
|
977
|
+
const testPolicyOverrides = _nullishCoalesce(request.testPolicyOverrides, () => ( parseEnvTestPolicyOverrides(env)));
|
|
978
|
+
const runtime = resolvePlayRunRuntimeSelection(request, env);
|
|
979
|
+
const resolved = { ...request };
|
|
980
|
+
delete resolved.integrationMode;
|
|
981
|
+
delete resolved.runtime;
|
|
982
|
+
delete resolved.testPolicyOverrides;
|
|
983
|
+
if (integrationMode) resolved.integrationMode = integrationMode;
|
|
984
|
+
if (runtime) resolved.runtime = runtime;
|
|
985
|
+
if (testPolicyOverrides) resolved.testPolicyOverrides = testPolicyOverrides;
|
|
986
|
+
return { request: resolved, runtime };
|
|
987
|
+
}
|
|
988
|
+
function runtimeSelectionHeaders(runtime, env) {
|
|
989
|
+
if (!runtime) return void 0;
|
|
990
|
+
const token = _optionalChain([env, 'access', _48 => _48.DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN, 'optionalAccess', _49 => _49.trim, 'call', _50 => _50()]);
|
|
991
|
+
if (!token) {
|
|
992
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
993
|
+
"DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN is required for explicit preview runtime selection.",
|
|
994
|
+
void 0,
|
|
995
|
+
"RUNTIME_ENVIRONMENT_TOKEN_REQUIRED"
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
const receivers = _optionalChain([env, 'access', _51 => _51.DEEPLINE_RUNTIME_RETAINED_PIPELINE_RECEIVERS, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()]);
|
|
999
|
+
return {
|
|
1000
|
+
[_chunkFVLNYDI4js.RUNTIME_ENVIRONMENT_TOKEN_HEADER]: token,
|
|
1001
|
+
...receivers ? { [_chunkFVLNYDI4js.RETAINED_PIPELINE_RECEIVERS_HEADER]: receivers } : {}
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
function normalizeTestPolicyOverrides(value, source) {
|
|
1005
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1006
|
+
return value;
|
|
1007
|
+
}
|
|
1008
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
1009
|
+
`${source} must be a JSON object.`,
|
|
1010
|
+
void 0,
|
|
1011
|
+
"INVALID_TEST_POLICY_OVERRIDES"
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
function parseEnvTestPolicyOverrides(env) {
|
|
1015
|
+
const raw = env.DEEPLINE_TEST_POLICY_OVERRIDES;
|
|
1016
|
+
const trimmed = _optionalChain([raw, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()]);
|
|
1017
|
+
if (!trimmed) return void 0;
|
|
1018
|
+
let parsed;
|
|
1019
|
+
try {
|
|
1020
|
+
parsed = JSON.parse(trimmed);
|
|
1021
|
+
} catch (error) {
|
|
1022
|
+
const detail = error instanceof Error ? ` ${error.message}` : "";
|
|
1023
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
1024
|
+
`DEEPLINE_TEST_POLICY_OVERRIDES must be valid JSON.${detail}`,
|
|
1025
|
+
void 0,
|
|
1026
|
+
"INVALID_TEST_POLICY_OVERRIDES"
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
return normalizeTestPolicyOverrides(parsed, "DEEPLINE_TEST_POLICY_OVERRIDES");
|
|
1030
|
+
}
|
|
1031
|
+
function isRecord2(value) {
|
|
1032
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1033
|
+
}
|
|
1034
|
+
function normalizePlayStatus(raw) {
|
|
1035
|
+
const runPackage = _chunk2H4EY7KHjs.isPlayRunPackage.call(void 0, raw) ? raw : _chunk2H4EY7KHjs.isPlayRunPackage.call(void 0, raw.package) ? raw.package : null;
|
|
1036
|
+
const packageRun = _optionalChain([runPackage, 'optionalAccess', _56 => _56.run]);
|
|
1037
|
+
const rawStatus = typeof raw.status === "string" ? raw.status : typeof _optionalChain([packageRun, 'optionalAccess', _57 => _57.status]) === "string" ? packageRun.status : null;
|
|
1038
|
+
const status = _chunk2H4EY7KHjs.decodePlayRunPublicStatus.call(void 0, rawStatus);
|
|
1039
|
+
if (!status) {
|
|
1040
|
+
throw new Error(
|
|
1041
|
+
`Invalid play run lifecycle status in API response: ${JSON.stringify(rawStatus)}.`
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : _nullishCoalesce(_optionalChain([packageRun, 'optionalAccess', _58 => _58.id]), () => ( ""));
|
|
1045
|
+
const legacyOverview = _nullishCoalesce(_optionalChain([runPackage, 'optionalAccess', _59 => _59.overview]), () => ( raw.overview));
|
|
1046
|
+
const runStatus = _nullishCoalesce(_optionalChain([runPackage, 'optionalAccess', _60 => _60.runStatus]), () => ( raw.runStatus));
|
|
1047
|
+
return {
|
|
1048
|
+
...raw,
|
|
1049
|
+
runId,
|
|
1050
|
+
...isRecord2(legacyOverview) ? {
|
|
1051
|
+
overview: legacyOverview
|
|
1052
|
+
} : {},
|
|
1053
|
+
...isRecord2(runStatus) ? { runStatus } : {},
|
|
1054
|
+
...runPackage ? {
|
|
1055
|
+
package: runPackage,
|
|
1056
|
+
outputs: runPackage.outputs
|
|
1057
|
+
} : {},
|
|
1058
|
+
status
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
var PlayClient = class {
|
|
1062
|
+
constructor(http, environment = process.env) {
|
|
1063
|
+
this.http = http;
|
|
1064
|
+
this.environment = environment;
|
|
1065
|
+
}
|
|
1066
|
+
async startPlayRun(request, options) {
|
|
1067
|
+
const resolved = resolveStartPlayRunRequest(request, this.environment);
|
|
1068
|
+
const headers = runtimeSelectionHeaders(resolved.runtime, this.environment);
|
|
1069
|
+
return _chunk2H4EY7KHjs.startPlayRun.call(void 0,
|
|
1070
|
+
this.http,
|
|
1071
|
+
resolved.request,
|
|
1072
|
+
_optionalChain([options, 'optionalAccess', _61 => _61.cliAdmission]) ? { ...headers, "X-Deepline-API-Major": String(_chunkFVLNYDI4js.SDK_API_MAJOR) } : headers,
|
|
1073
|
+
options
|
|
1074
|
+
);
|
|
1075
|
+
}
|
|
1076
|
+
async getPlayStatus(workflowId, options) {
|
|
1077
|
+
const params = new URLSearchParams();
|
|
1078
|
+
if (_optionalChain([options, 'optionalAccess', _62 => _62.billing]) === false) {
|
|
1079
|
+
params.set("billing", "false");
|
|
1080
|
+
}
|
|
1081
|
+
if (_optionalChain([options, 'optionalAccess', _63 => _63.full]) === true) {
|
|
1082
|
+
params.set("full", "true");
|
|
1083
|
+
}
|
|
1084
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
1085
|
+
const response = await this.http.get(
|
|
1086
|
+
`/api/v2/runs/${encodeURIComponent(workflowId)}${query}`
|
|
1087
|
+
);
|
|
1088
|
+
return normalizePlayStatus(response);
|
|
1089
|
+
}
|
|
1090
|
+
async cancelPlay(workflowId) {
|
|
1091
|
+
await this.http.request(
|
|
1092
|
+
`/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
|
|
1093
|
+
{ method: "POST" }
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
async stopPlay(workflowId, options) {
|
|
1097
|
+
return this.http.post(
|
|
1098
|
+
`/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
|
|
1099
|
+
_optionalChain([options, 'optionalAccess', _64 => _64.reason]) ? { reason: options.reason } : {}
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
async listPlayRuns(playName) {
|
|
1103
|
+
const encodedName = encodeURIComponent(playName);
|
|
1104
|
+
const response = await this.http.get(
|
|
1105
|
+
`/api/v2/plays/${encodedName}/runs`
|
|
1106
|
+
);
|
|
1107
|
+
return _nullishCoalesce(response.runs, () => ( []));
|
|
1108
|
+
}
|
|
1109
|
+
async getPlay(name, options) {
|
|
1110
|
+
const encodedName = encodeURIComponent(name);
|
|
1111
|
+
const query = _optionalChain([options, 'optionalAccess', _65 => _65.source]) ? `?include=source&revision=${encodeURIComponent(options.source)}` : _optionalChain([options, 'optionalAccess', _66 => _66.guidance]) ? "?include=guidance" : "";
|
|
1112
|
+
return this.http.get(`/api/v2/plays/${encodedName}${query}`);
|
|
1113
|
+
}
|
|
1114
|
+
async clearPlayHistory(name, request = {}) {
|
|
1115
|
+
const encodedName = encodeURIComponent(name);
|
|
1116
|
+
return this.http.post(
|
|
1117
|
+
`/api/v2/plays/${encodedName}/history/clear`,
|
|
1118
|
+
request
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
async listPlayVersions(name, options) {
|
|
1122
|
+
const encodedName = encodeURIComponent(name);
|
|
1123
|
+
const suffix = _optionalChain([options, 'optionalAccess', _67 => _67.full]) ? "?full=true" : "";
|
|
1124
|
+
const response = await this.http.get(
|
|
1125
|
+
`/api/v2/plays/${encodedName}/versions${suffix}`
|
|
1126
|
+
);
|
|
1127
|
+
return _nullishCoalesce(response.versions, () => ( []));
|
|
1128
|
+
}
|
|
1129
|
+
async publishPlayVersion(name, request = {}) {
|
|
1130
|
+
const encodedName = encodeURIComponent(name);
|
|
1131
|
+
return this.http.post(
|
|
1132
|
+
`/api/v2/plays/${encodedName}/live`,
|
|
1133
|
+
request
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
function createPlayClient(options) {
|
|
1138
|
+
const config = _chunkFVLNYDI4js.resolveConfig.call(void 0, options);
|
|
1139
|
+
return new PlayClient(
|
|
1140
|
+
new (0, _chunkFVLNYDI4js.HttpClient)(config),
|
|
1141
|
+
_nullishCoalesce(config.environment, () => ( process.env))
|
|
1142
|
+
);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
642
1145
|
// ../product-notifications/contract.ts
|
|
643
1146
|
var PRODUCT_NOTIFICATION_EVENT_CATALOG = [
|
|
644
1147
|
{
|
|
@@ -846,10 +1349,13 @@ function stripLeadingTimestamp(line) {
|
|
|
846
1349
|
|
|
847
1350
|
// src/runs/read-errors.ts
|
|
848
1351
|
function isTransientPlayRunReadError(error) {
|
|
849
|
-
if (error instanceof
|
|
1352
|
+
if (error instanceof _chunkPPDBRJRWjs.DeeplineError && error.code === "PLAY_START_OUTCOME_UNKNOWN") {
|
|
1353
|
+
return false;
|
|
1354
|
+
}
|
|
1355
|
+
if (error instanceof _chunkPPDBRJRWjs.DeeplineError && error.code === "PLAY_STREAM_NETWORK_ABORTED") {
|
|
850
1356
|
return true;
|
|
851
1357
|
}
|
|
852
|
-
if (error instanceof
|
|
1358
|
+
if (error instanceof _chunkPPDBRJRWjs.DeeplineError && typeof error.statusCode === "number") {
|
|
853
1359
|
return error.statusCode >= 500 && error.statusCode < 600;
|
|
854
1360
|
}
|
|
855
1361
|
const text = error instanceof Error ? error.message : String(error);
|
|
@@ -1353,7 +1859,7 @@ function bounded(value, maxBytes = MAX_BYTES) {
|
|
|
1353
1859
|
let encoded;
|
|
1354
1860
|
try {
|
|
1355
1861
|
encoded = JSON.stringify(value);
|
|
1356
|
-
} catch (
|
|
1862
|
+
} catch (e4) {
|
|
1357
1863
|
fail("Run event query must be bounded JSON without cycles.");
|
|
1358
1864
|
}
|
|
1359
1865
|
if (!encoded || new TextEncoder().encode(encoded).length > maxBytes)
|
|
@@ -1553,7 +2059,7 @@ function parseDsl(input) {
|
|
|
1553
2059
|
}
|
|
1554
2060
|
try {
|
|
1555
2061
|
return JSON.parse(input.slice(start, position));
|
|
1556
|
-
} catch (
|
|
2062
|
+
} catch (e5) {
|
|
1557
2063
|
fail("Run event DSL requires valid JSON scalars.");
|
|
1558
2064
|
}
|
|
1559
2065
|
};
|
|
@@ -1578,7 +2084,7 @@ function parseDsl(input) {
|
|
|
1578
2084
|
input.slice(position)
|
|
1579
2085
|
);
|
|
1580
2086
|
if (!operation) {
|
|
1581
|
-
const token = _nullishCoalesce(_nullishCoalesce(_optionalChain([/^(?:[=!<>~]+|[A-Za-z_]+)/, 'access',
|
|
2087
|
+
const token = _nullishCoalesce(_nullishCoalesce(_optionalChain([/^(?:[=!<>~]+|[A-Za-z_]+)/, 'access', _68 => _68.exec, 'call', _69 => _69(input.slice(position)), 'optionalAccess', _70 => _70[0]]), () => ( input[position])), () => ( "<end>"));
|
|
1582
2088
|
if (token === "=") {
|
|
1583
2089
|
const corrected = `${input.slice(0, position)}==${input.slice(position + 1)}`;
|
|
1584
2090
|
fail(
|
|
@@ -1657,7 +2163,7 @@ function normalizeRunEventQueryTimestamp(value) {
|
|
|
1657
2163
|
return /[1-9]/.test(extraMicros) ? canonical2.replace(/Z$/, `${extraMicros}Z`) : canonical2;
|
|
1658
2164
|
}
|
|
1659
2165
|
function timestampMicros(value) {
|
|
1660
|
-
const fraction = _nullishCoalesce(_optionalChain([/\.(\d+)Z$/, 'access',
|
|
2166
|
+
const fraction = _nullishCoalesce(_optionalChain([/\.(\d+)Z$/, 'access', _71 => _71.exec, 'call', _72 => _72(value), 'optionalAccess', _73 => _73[1]]), () => ( ""));
|
|
1661
2167
|
return BigInt(Date.parse(value)) * BigInt(1e3) + BigInt(fraction.padEnd(6, "0").slice(3));
|
|
1662
2168
|
}
|
|
1663
2169
|
function time(value, nowMs, fallback) {
|
|
@@ -1886,57 +2392,15 @@ var TERMINAL_RESERVE_BYTES = 64 * 1024;
|
|
|
1886
2392
|
var encoder = new TextEncoder();
|
|
1887
2393
|
|
|
1888
2394
|
// ../play-runtime/secret-redaction.ts
|
|
1889
|
-
var SECRET_REDACTION_PLACEHOLDER = "[REDACTED_SECRET]";
|
|
1890
|
-
var BEARER_TOKEN_RE = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/g;
|
|
1891
|
-
var BASIC_CREDENTIAL_RE = /\bBasic\s+[A-Za-z0-9+/]{4,}={0,2}\b/g;
|
|
1892
|
-
var JWT_RE = /\b[A-Za-z0-9_-]{8,16384}\.[A-Za-z0-9_-]{1,16384}\.[A-Za-z0-9_-]{8,16384}\b/g;
|
|
1893
|
-
var EMAIL_LOCAL_CHAR_RE = /[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]/;
|
|
1894
|
-
var EMAIL_DOMAIN_RE = /^[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?\.[A-Za-z]{2,63}\b/;
|
|
1895
|
-
function isEmailLocalPart(value, start, end) {
|
|
1896
|
-
let localStart = start;
|
|
1897
|
-
while (localStart > 0 && EMAIL_LOCAL_CHAR_RE.test(value[localStart - 1])) {
|
|
1898
|
-
localStart -= 1;
|
|
1899
|
-
}
|
|
1900
|
-
let localEnd = end;
|
|
1901
|
-
while (localEnd < value.length && EMAIL_LOCAL_CHAR_RE.test(value[localEnd])) {
|
|
1902
|
-
localEnd += 1;
|
|
1903
|
-
}
|
|
1904
|
-
return localStart < localEnd && localEnd - localStart <= 64 && value[localEnd] === "@" && EMAIL_DOMAIN_RE.test(value.slice(localEnd + 1));
|
|
1905
|
-
}
|
|
1906
|
-
function redactTokenUnlessEmail(match, offset, source) {
|
|
1907
|
-
return isEmailLocalPart(source, offset, offset + match.length) ? match : SECRET_REDACTION_PLACEHOLDER;
|
|
1908
|
-
}
|
|
1909
|
-
var PRIVATE_KEY_RE = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g;
|
|
1910
2395
|
var SENSITIVE_FIELD_NAME = "authorization|cookie|password|(?:client[_-]?)?secret|(?:access|refresh)[_-]?token|(?:x[_-]?)?api[_-]?key|private[_-]?key|token|credentials";
|
|
1911
|
-
var COMMON_SECRET_RE = /\b(?:[prs]k_(?:live|test)_|(?:pat|ghp|github_pat)_|xox[baprs]-)[A-Za-z0-9_./+=:-]{12,}\b/gi;
|
|
1912
|
-
var GENERIC_PREFIXED_SECRET_RE = /\b(?:key|token|secret|api[_-]?key)_[A-Za-z0-9_./+=:-]{12,}\b/gi;
|
|
1913
|
-
var URL_SECRET_VALUE_RE = /\b(?:[spr]k|pat|ghp|github_pat|xox)[A-Za-z0-9_./+=:-]{12,}\b/i;
|
|
1914
|
-
var GENERIC_SECRET_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password)\b\s*[:=]\s*["']?[^"',\s]{12,}["']?/gi;
|
|
1915
|
-
var HIGH_ENTROPY_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password|authorization|(?:access|refresh)[_-]?token)\b\s*[:=]\s*["']?[^"',\s]{16,}["']?/gi;
|
|
1916
|
-
var SENSITIVE_URL_PARAM_RE = /[?#&](?:\w*(?:key|token)|secret|password|authorization|credential|signature|sig)(?:=|$)/i;
|
|
1917
2396
|
var SENSITIVE_FIELD_NAME_RE = new RegExp(
|
|
1918
2397
|
`(^|[._-])(?:${SENSITIVE_FIELD_NAME})$`,
|
|
1919
2398
|
"i"
|
|
1920
2399
|
);
|
|
1921
|
-
var SENSITIVE_FIELD_NAME_CACHE_MAX_ENTRIES = 4096;
|
|
1922
|
-
var sensitiveFieldNameCache = /* @__PURE__ */ new Map();
|
|
1923
|
-
function isSensitiveFieldName(key) {
|
|
1924
|
-
const cached = sensitiveFieldNameCache.get(key);
|
|
1925
|
-
if (cached !== void 0) return cached;
|
|
1926
|
-
const sensitive = SENSITIVE_FIELD_NAME_RE.test(key);
|
|
1927
|
-
if (sensitiveFieldNameCache.size >= SENSITIVE_FIELD_NAME_CACHE_MAX_ENTRIES) {
|
|
1928
|
-
sensitiveFieldNameCache.clear();
|
|
1929
|
-
}
|
|
1930
|
-
sensitiveFieldNameCache.set(key, sensitive);
|
|
1931
|
-
return sensitive;
|
|
1932
|
-
}
|
|
1933
2400
|
var SERIALIZED_SECRET_FIELD_RE = new RegExp(
|
|
1934
2401
|
`"(${SENSITIVE_FIELD_NAME})"\\s*:\\s*(?:"[^"\\\\]*"|\\{[^{}]*\\})`,
|
|
1935
2402
|
"gi"
|
|
1936
2403
|
);
|
|
1937
|
-
function escapeRegExp(value) {
|
|
1938
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1939
|
-
}
|
|
1940
2404
|
var REDACTION_TRIGGER_RE = new RegExp(
|
|
1941
2405
|
[
|
|
1942
2406
|
// Sensitive field names, in object keys and in `name=`/`"name":` text.
|
|
@@ -1971,147 +2435,6 @@ var REDACTION_TRIGGER_RE = new RegExp(
|
|
|
1971
2435
|
].join("|"),
|
|
1972
2436
|
"i"
|
|
1973
2437
|
);
|
|
1974
|
-
function mightContainRedactableSecret(value) {
|
|
1975
|
-
return REDACTION_TRIGGER_RE.test(value);
|
|
1976
|
-
}
|
|
1977
|
-
function redactSecretLikeString(value) {
|
|
1978
|
-
if (!mightContainRedactableSecret(value)) return value;
|
|
1979
|
-
const serializedRedacted = value.replace(
|
|
1980
|
-
SERIALIZED_SECRET_FIELD_RE,
|
|
1981
|
-
`"$1":"${SECRET_REDACTION_PLACEHOLDER}"`
|
|
1982
|
-
);
|
|
1983
|
-
const trimmed = serializedRedacted.trim();
|
|
1984
|
-
if (/^https?:\/\/\S+$/i.test(trimmed)) {
|
|
1985
|
-
if (/^https?:\/\/[^/?#@]+@/i.test(trimmed) || SENSITIVE_URL_PARAM_RE.test(trimmed)) {
|
|
1986
|
-
return SECRET_REDACTION_PLACEHOLDER;
|
|
1987
|
-
}
|
|
1988
|
-
if (!URL_SECRET_VALUE_RE.test(serializedRedacted)) {
|
|
1989
|
-
return serializedRedacted;
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
return serializedRedacted.replace(PRIVATE_KEY_RE, SECRET_REDACTION_PLACEHOLDER).replace(BEARER_TOKEN_RE, `Bearer ${SECRET_REDACTION_PLACEHOLDER}`).replace(BASIC_CREDENTIAL_RE, `Basic ${SECRET_REDACTION_PLACEHOLDER}`).replace(JWT_RE, redactTokenUnlessEmail).replace(COMMON_SECRET_RE, redactTokenUnlessEmail).replace(GENERIC_PREFIXED_SECRET_RE, redactTokenUnlessEmail).replace(GENERIC_SECRET_ASSIGNMENT_RE, SECRET_REDACTION_PLACEHOLDER).replace(HIGH_ENTROPY_ASSIGNMENT_RE, (match) => {
|
|
1993
|
-
const separator = match.includes("=") ? "=" : ":";
|
|
1994
|
-
const [key] = match.split(separator, 1);
|
|
1995
|
-
return `${key.trim()}${separator}${SECRET_REDACTION_PLACEHOLDER}`;
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
function createSecretRedactionContext(initialValues = []) {
|
|
1999
|
-
const exactSecrets = /* @__PURE__ */ new Set();
|
|
2000
|
-
const exactSecretMatchers = /* @__PURE__ */ new Map();
|
|
2001
|
-
function register(value) {
|
|
2002
|
-
if (value.length > 0) exactSecrets.add(value);
|
|
2003
|
-
}
|
|
2004
|
-
function matchersForSecret(secret) {
|
|
2005
|
-
const cached = exactSecretMatchers.get(secret);
|
|
2006
|
-
if (cached) return cached;
|
|
2007
|
-
const literals = [secret];
|
|
2008
|
-
try {
|
|
2009
|
-
const encoded = encodeURIComponent(secret);
|
|
2010
|
-
if (encoded !== secret) literals.push(encoded);
|
|
2011
|
-
} catch (e4) {
|
|
2012
|
-
}
|
|
2013
|
-
const built = literals.map((literal) => ({
|
|
2014
|
-
literal,
|
|
2015
|
-
matcher: new RegExp(escapeRegExp(literal), "g")
|
|
2016
|
-
}));
|
|
2017
|
-
exactSecretMatchers.set(secret, built);
|
|
2018
|
-
return built;
|
|
2019
|
-
}
|
|
2020
|
-
for (const value of initialValues) register(value);
|
|
2021
|
-
function containsRegisteredSecret(value, {
|
|
2022
|
-
includeEncoded = false,
|
|
2023
|
-
minimumLength = 1
|
|
2024
|
-
} = {}) {
|
|
2025
|
-
for (const secret of exactSecrets) {
|
|
2026
|
-
if (secret.length < minimumLength) continue;
|
|
2027
|
-
if (value.includes(secret)) return true;
|
|
2028
|
-
if (includeEncoded) {
|
|
2029
|
-
try {
|
|
2030
|
-
const encoded = encodeURIComponent(secret);
|
|
2031
|
-
if (encoded !== secret && value.includes(encoded)) return true;
|
|
2032
|
-
} catch (e5) {
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
return false;
|
|
2037
|
-
}
|
|
2038
|
-
function matchesRegisteredSecret(value) {
|
|
2039
|
-
return exactSecrets.has(value);
|
|
2040
|
-
}
|
|
2041
|
-
function redactRegisteredSecrets(value) {
|
|
2042
|
-
if (exactSecrets.size === 0) return value;
|
|
2043
|
-
let output = value;
|
|
2044
|
-
for (const secret of exactSecrets) {
|
|
2045
|
-
for (const { literal, matcher } of matchersForSecret(secret)) {
|
|
2046
|
-
if (!output.includes(literal)) continue;
|
|
2047
|
-
matcher.lastIndex = 0;
|
|
2048
|
-
output = output.replace(matcher, SECRET_REDACTION_PLACEHOLDER);
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
return output;
|
|
2052
|
-
}
|
|
2053
|
-
function redactString(value) {
|
|
2054
|
-
const output = redactRegisteredSecrets(value);
|
|
2055
|
-
return redactSecretLikeString(output);
|
|
2056
|
-
}
|
|
2057
|
-
function redact(value) {
|
|
2058
|
-
if (typeof value === "string") return redactString(value);
|
|
2059
|
-
if (Array.isArray(value)) {
|
|
2060
|
-
let changed = false;
|
|
2061
|
-
const next = new Array(value.length);
|
|
2062
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
2063
|
-
const entry = value[index];
|
|
2064
|
-
const redacted = redact(entry);
|
|
2065
|
-
next[index] = redacted;
|
|
2066
|
-
if (redacted !== entry) changed = true;
|
|
2067
|
-
}
|
|
2068
|
-
return changed ? next : value;
|
|
2069
|
-
}
|
|
2070
|
-
if (value && typeof value === "object") {
|
|
2071
|
-
const prototype = Object.getPrototypeOf(value);
|
|
2072
|
-
let changed = prototype !== Object.prototype && prototype !== null;
|
|
2073
|
-
const source = value;
|
|
2074
|
-
const keys = Object.keys(source);
|
|
2075
|
-
const redactedValues = new Array(keys.length);
|
|
2076
|
-
for (let index = 0; index < keys.length; index += 1) {
|
|
2077
|
-
const key = keys[index];
|
|
2078
|
-
const entry = source[key];
|
|
2079
|
-
const redacted = isSensitiveFieldName(key) ? SECRET_REDACTION_PLACEHOLDER : redact(entry);
|
|
2080
|
-
redactedValues[index] = redacted;
|
|
2081
|
-
if (redacted !== entry) changed = true;
|
|
2082
|
-
}
|
|
2083
|
-
if (!changed) return value;
|
|
2084
|
-
return Object.fromEntries(
|
|
2085
|
-
keys.map((key, index) => [key, redactedValues[index]])
|
|
2086
|
-
);
|
|
2087
|
-
}
|
|
2088
|
-
return value;
|
|
2089
|
-
}
|
|
2090
|
-
function redactKnownSecrets(value) {
|
|
2091
|
-
if (typeof value === "string") return redactRegisteredSecrets(value);
|
|
2092
|
-
if (Array.isArray(value)) {
|
|
2093
|
-
return value.map((entry) => redactKnownSecrets(entry));
|
|
2094
|
-
}
|
|
2095
|
-
if (value && typeof value === "object") {
|
|
2096
|
-
return Object.fromEntries(
|
|
2097
|
-
Object.entries(value).map(([key, entry]) => [
|
|
2098
|
-
key,
|
|
2099
|
-
redactKnownSecrets(entry)
|
|
2100
|
-
])
|
|
2101
|
-
);
|
|
2102
|
-
}
|
|
2103
|
-
return value;
|
|
2104
|
-
}
|
|
2105
|
-
return {
|
|
2106
|
-
register,
|
|
2107
|
-
containsRegisteredSecret,
|
|
2108
|
-
matchesRegisteredSecret,
|
|
2109
|
-
redactRegisteredSecrets,
|
|
2110
|
-
redactString,
|
|
2111
|
-
redactKnownSecrets,
|
|
2112
|
-
redact
|
|
2113
|
-
};
|
|
2114
|
-
}
|
|
2115
2438
|
|
|
2116
2439
|
// ../play-runtime/output-size-limits.ts
|
|
2117
2440
|
var TERMINAL_RUN_RESULT_MAX_BYTES = 6 * 1024 * 1024;
|
|
@@ -2127,9 +2450,6 @@ var RUNTIME_RECEIPT_WRITER_TARGET_BATCH_BYTES = 8 * 1024 * 1024;
|
|
|
2127
2450
|
var RUNNER_POST_TERMINAL_DIAGNOSTIC_MAX_BYTES = 64 * 1024;
|
|
2128
2451
|
var JSON_SIZE_LIMIT_REACHED = Symbol("JSON_SIZE_LIMIT_REACHED");
|
|
2129
2452
|
|
|
2130
|
-
// ../play-runtime/ledger-safe-payload.ts
|
|
2131
|
-
var ledgerIngressRedactor = createSecretRedactionContext();
|
|
2132
|
-
|
|
2133
2453
|
// ../play-runtime/docflow-node-io.ts
|
|
2134
2454
|
var utf8Encoder = new TextEncoder();
|
|
2135
2455
|
var PLAY_DATASET_BRAND = Symbol.for("deepline.play.dataset");
|
|
@@ -2319,7 +2639,7 @@ var TERMINAL_STATUS_BY_EVENT_TYPE = {
|
|
|
2319
2639
|
|
|
2320
2640
|
// ../play-runtime/run-snapshot-stream.ts
|
|
2321
2641
|
function isTerminalPlayRunLiveStatus(status) {
|
|
2322
|
-
return
|
|
2642
|
+
return _chunk2H4EY7KHjs.isTerminalPlayRunLifecycleStatus.call(void 0, status);
|
|
2323
2643
|
}
|
|
2324
2644
|
function makeRunStreamEvent(input) {
|
|
2325
2645
|
return {
|
|
@@ -2349,10 +2669,10 @@ function getStepStatusSignature(snapshot) {
|
|
|
2349
2669
|
_nullishCoalesce(state.artifactTableNamespace, () => ( "")),
|
|
2350
2670
|
_nullishCoalesce(state.startedAt, () => ( "")),
|
|
2351
2671
|
_nullishCoalesce(state.completedAt, () => ( "")),
|
|
2352
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2353
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2672
|
+
_nullishCoalesce(_optionalChain([state, 'access', _74 => _74.progress, 'optionalAccess', _75 => _75.startedAt]), () => ( "")),
|
|
2673
|
+
_nullishCoalesce(_optionalChain([state, 'access', _76 => _76.progress, 'optionalAccess', _77 => _77.completedAt]), () => ( "")),
|
|
2354
2674
|
_nullishCoalesce(state.updatedAt, () => ( "")),
|
|
2355
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2675
|
+
_nullishCoalesce(_optionalChain([state, 'access', _78 => _78.progress, 'optionalAccess', _79 => _79.updatedAt]), () => ( ""))
|
|
2356
2676
|
].join(":")
|
|
2357
2677
|
).join("|");
|
|
2358
2678
|
}
|
|
@@ -2361,11 +2681,11 @@ function getStepProgressSignature(snapshot) {
|
|
|
2361
2681
|
snapshot.nodeStates.map((state) => [
|
|
2362
2682
|
state.nodeId,
|
|
2363
2683
|
projectPlayStepProgressCounters(_nullishCoalesce(state.progress, () => ( {}))),
|
|
2364
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2365
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2366
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2367
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2368
|
-
_nullishCoalesce(_optionalChain([state, 'access',
|
|
2684
|
+
_nullishCoalesce(_optionalChain([state, 'access', _80 => _80.progress, 'optionalAccess', _81 => _81.artifactTableNamespace]), () => ( "")),
|
|
2685
|
+
_nullishCoalesce(_optionalChain([state, 'access', _82 => _82.progress, 'optionalAccess', _83 => _83.startedAt]), () => ( "")),
|
|
2686
|
+
_nullishCoalesce(_optionalChain([state, 'access', _84 => _84.progress, 'optionalAccess', _85 => _85.completedAt]), () => ( "")),
|
|
2687
|
+
_nullishCoalesce(_optionalChain([state, 'access', _86 => _86.progress, 'optionalAccess', _87 => _87.updatedAt]), () => ( "")),
|
|
2688
|
+
_nullishCoalesce(_optionalChain([state, 'access', _88 => _88.progress, 'optionalAccess', _89 => _89.message]), () => ( ""))
|
|
2369
2689
|
])
|
|
2370
2690
|
);
|
|
2371
2691
|
}
|
|
@@ -2435,8 +2755,8 @@ function diffPlayRunStreamEvents(input) {
|
|
|
2435
2755
|
if (state.status === "idle") {
|
|
2436
2756
|
continue;
|
|
2437
2757
|
}
|
|
2438
|
-
const persistedStartedAt = _nullishCoalesce(_nullishCoalesce(state.startedAt, () => ( _optionalChain([state, 'access',
|
|
2439
|
-
const persistedCompletedAt = _nullishCoalesce(_nullishCoalesce(state.completedAt, () => ( _optionalChain([state, 'access',
|
|
2758
|
+
const persistedStartedAt = _nullishCoalesce(_nullishCoalesce(state.startedAt, () => ( _optionalChain([state, 'access', _90 => _90.progress, 'optionalAccess', _91 => _91.startedAt]))), () => ( null));
|
|
2759
|
+
const persistedCompletedAt = _nullishCoalesce(_nullishCoalesce(state.completedAt, () => ( _optionalChain([state, 'access', _92 => _92.progress, 'optionalAccess', _93 => _93.completedAt]))), () => ( null));
|
|
2440
2760
|
events.push(
|
|
2441
2761
|
makeRunStreamEvent({
|
|
2442
2762
|
cursor,
|
|
@@ -2450,7 +2770,7 @@ function diffPlayRunStreamEvents(input) {
|
|
|
2450
2770
|
...resolveTimingWindow({
|
|
2451
2771
|
startedAt: persistedStartedAt,
|
|
2452
2772
|
completedAt: persistedCompletedAt,
|
|
2453
|
-
updatedAt: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(state.updatedAt, () => ( _optionalChain([state, 'access',
|
|
2773
|
+
updatedAt: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(state.updatedAt, () => ( _optionalChain([state, 'access', _94 => _94.progress, 'optionalAccess', _95 => _95.updatedAt]))), () => ( snapshot.updatedAt)), () => ( null))
|
|
2454
2774
|
})
|
|
2455
2775
|
}
|
|
2456
2776
|
})
|
|
@@ -2504,9 +2824,9 @@ function diffPlayRunStreamEvents(input) {
|
|
|
2504
2824
|
if (next.snapshotSignature !== previous.snapshotSignature) {
|
|
2505
2825
|
const enrichedNodeStates = snapshot.nodeStates.map((state) => {
|
|
2506
2826
|
const timing = resolveTimingWindow({
|
|
2507
|
-
startedAt: _nullishCoalesce(_nullishCoalesce(state.startedAt, () => ( _optionalChain([state, 'access',
|
|
2508
|
-
completedAt: _nullishCoalesce(_nullishCoalesce(state.completedAt, () => ( _optionalChain([state, 'access',
|
|
2509
|
-
updatedAt: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(state.updatedAt, () => ( _optionalChain([state, 'access',
|
|
2827
|
+
startedAt: _nullishCoalesce(_nullishCoalesce(state.startedAt, () => ( _optionalChain([state, 'access', _96 => _96.progress, 'optionalAccess', _97 => _97.startedAt]))), () => ( null)),
|
|
2828
|
+
completedAt: _nullishCoalesce(_nullishCoalesce(state.completedAt, () => ( _optionalChain([state, 'access', _98 => _98.progress, 'optionalAccess', _99 => _99.completedAt]))), () => ( null)),
|
|
2829
|
+
updatedAt: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(state.updatedAt, () => ( _optionalChain([state, 'access', _100 => _100.progress, 'optionalAccess', _101 => _101.updatedAt]))), () => ( snapshot.updatedAt)), () => ( null))
|
|
2510
2830
|
});
|
|
2511
2831
|
return {
|
|
2512
2832
|
...state,
|
|
@@ -2550,19 +2870,21 @@ function diffPlayRunStreamEvents(input) {
|
|
|
2550
2870
|
|
|
2551
2871
|
// src/runs/watch-polling.ts
|
|
2552
2872
|
var RUN_WATCH_POLL_INTERVAL_MS = 2e3;
|
|
2873
|
+
var RUN_WATCH_STARTUP_POLL_INTERVAL_MS = 500;
|
|
2874
|
+
var RUN_WATCH_STARTUP_WINDOW_MS = 6e3;
|
|
2553
2875
|
function waitForNextPoll(ms, signal) {
|
|
2554
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
2876
|
+
if (_optionalChain([signal, 'optionalAccess', _102 => _102.aborted])) {
|
|
2555
2877
|
return Promise.resolve(false);
|
|
2556
2878
|
}
|
|
2557
2879
|
return new Promise((resolve) => {
|
|
2558
2880
|
const finish = (elapsed) => {
|
|
2559
2881
|
clearTimeout(timeout);
|
|
2560
|
-
_optionalChain([signal, 'optionalAccess',
|
|
2882
|
+
_optionalChain([signal, 'optionalAccess', _103 => _103.removeEventListener, 'call', _104 => _104("abort", onAbort)]);
|
|
2561
2883
|
resolve(elapsed);
|
|
2562
2884
|
};
|
|
2563
2885
|
const onAbort = () => finish(false);
|
|
2564
2886
|
const timeout = setTimeout(() => finish(true), ms);
|
|
2565
|
-
_optionalChain([signal, 'optionalAccess',
|
|
2887
|
+
_optionalChain([signal, 'optionalAccess', _105 => _105.addEventListener, 'call', _106 => _106("abort", onAbort, { once: true })]);
|
|
2566
2888
|
});
|
|
2567
2889
|
}
|
|
2568
2890
|
function readSnapshotResponse(response, runId) {
|
|
@@ -2576,7 +2898,16 @@ function readSnapshotResponse(response, runId) {
|
|
|
2576
2898
|
) || typeof snapshot.totalLogCount !== "number" || !Array.isArray(snapshot.nodeStates)) {
|
|
2577
2899
|
throw new Error(`Run watch returned an invalid snapshot for ${runId}.`);
|
|
2578
2900
|
}
|
|
2579
|
-
|
|
2901
|
+
if (record.terminalStatus !== void 0 && (!record.terminalStatus || typeof record.terminalStatus !== "object" || Array.isArray(record.terminalStatus) || !isTerminalPlayRunLiveStatus(snapshot.status))) {
|
|
2902
|
+
throw new Error(
|
|
2903
|
+
`Run watch returned an invalid terminal status for ${runId}.`
|
|
2904
|
+
);
|
|
2905
|
+
}
|
|
2906
|
+
return {
|
|
2907
|
+
runId,
|
|
2908
|
+
snapshot,
|
|
2909
|
+
...record.terminalStatus !== void 0 ? { terminalStatus: record.terminalStatus } : {}
|
|
2910
|
+
};
|
|
2580
2911
|
}
|
|
2581
2912
|
async function backfillRotatedLogTail(input) {
|
|
2582
2913
|
if (!input.previous.runSignature || input.snapshot.logsUnavailable) {
|
|
@@ -2613,26 +2944,71 @@ async function backfillRotatedLogTail(input) {
|
|
|
2613
2944
|
}
|
|
2614
2945
|
async function* watchRunEvents(options) {
|
|
2615
2946
|
const { http, runId, signal } = options;
|
|
2616
|
-
const
|
|
2947
|
+
const params = new URLSearchParams({ watchSnapshot: "true" });
|
|
2948
|
+
if (options.deferLogs) params.set("deferLogs", "true");
|
|
2949
|
+
if (options.omitTerminalLogs) params.set("omitTerminalLogs", "true");
|
|
2950
|
+
if (options.terminalStatus) {
|
|
2951
|
+
params.set(
|
|
2952
|
+
"terminalStatus",
|
|
2953
|
+
options.terminalStatus.full ? "full" : "compact"
|
|
2954
|
+
);
|
|
2955
|
+
if (options.terminalStatus.billing === false)
|
|
2956
|
+
params.set("billing", "false");
|
|
2957
|
+
if (options.terminalStatus.runStatus)
|
|
2958
|
+
params.set("terminalRunStatus", "true");
|
|
2959
|
+
}
|
|
2960
|
+
const path = `/api/v2/runs/${encodeURIComponent(runId)}?${params}`;
|
|
2617
2961
|
const streamId = `play-run-watch:${runId}`;
|
|
2618
|
-
const
|
|
2962
|
+
const watchStartedAt = Date.now();
|
|
2619
2963
|
let previous = EMPTY_PLAY_RUN_STREAM_DIFF_STATE;
|
|
2620
2964
|
let consecutiveFailures = 0;
|
|
2621
2965
|
let outageNoticeSent = false;
|
|
2622
|
-
|
|
2966
|
+
let pollCount = 0;
|
|
2967
|
+
while (!_optionalChain([signal, 'optionalAccess', _107 => _107.aborted])) {
|
|
2623
2968
|
const pollStartedAt = Date.now();
|
|
2969
|
+
const poll = ++pollCount;
|
|
2970
|
+
const pollIntervalMs = _nullishCoalesce(options.pollIntervalMs, () => ( (pollStartedAt - watchStartedAt < RUN_WATCH_STARTUP_WINDOW_MS ? RUN_WATCH_STARTUP_POLL_INTERVAL_MS : RUN_WATCH_POLL_INTERVAL_MS)));
|
|
2624
2971
|
let snapshot;
|
|
2972
|
+
let terminalStatus;
|
|
2973
|
+
let responseStatus;
|
|
2974
|
+
let serverTiming;
|
|
2975
|
+
let pollReported = false;
|
|
2976
|
+
const reportPoll = () => {
|
|
2977
|
+
if (!options.onPoll || pollReported) return;
|
|
2978
|
+
pollReported = true;
|
|
2979
|
+
try {
|
|
2980
|
+
options.onPoll({
|
|
2981
|
+
poll,
|
|
2982
|
+
durationMs: Date.now() - pollStartedAt,
|
|
2983
|
+
...responseStatus !== void 0 ? { status: responseStatus } : {},
|
|
2984
|
+
...serverTiming ? { serverTiming } : {}
|
|
2985
|
+
});
|
|
2986
|
+
} catch (e6) {
|
|
2987
|
+
}
|
|
2988
|
+
};
|
|
2625
2989
|
try {
|
|
2626
|
-
const response = await http.get(path, {
|
|
2627
|
-
|
|
2990
|
+
const response = await http.get(path, {
|
|
2991
|
+
signal,
|
|
2992
|
+
...options.onPoll ? {
|
|
2993
|
+
onResponse: (response2) => {
|
|
2994
|
+
responseStatus = response2.status;
|
|
2995
|
+
serverTiming = _nullishCoalesce(response2.headers.get("server-timing"), () => ( void 0));
|
|
2996
|
+
}
|
|
2997
|
+
} : {}
|
|
2998
|
+
});
|
|
2999
|
+
const parsed = readSnapshotResponse(response, runId);
|
|
3000
|
+
terminalStatus = parsed.terminalStatus;
|
|
3001
|
+
snapshot = options.deferLogs ? parsed.snapshot : await backfillRotatedLogTail({
|
|
2628
3002
|
http,
|
|
2629
3003
|
runId,
|
|
2630
|
-
snapshot:
|
|
3004
|
+
snapshot: parsed.snapshot,
|
|
2631
3005
|
previous,
|
|
2632
3006
|
signal
|
|
2633
3007
|
});
|
|
3008
|
+
reportPoll();
|
|
2634
3009
|
} catch (error) {
|
|
2635
|
-
|
|
3010
|
+
reportPoll();
|
|
3011
|
+
if (_optionalChain([signal, 'optionalAccess', _108 => _108.aborted])) {
|
|
2636
3012
|
return;
|
|
2637
3013
|
}
|
|
2638
3014
|
if (!isTransientPlayRunReadError(error)) {
|
|
@@ -2641,13 +3017,13 @@ async function* watchRunEvents(options) {
|
|
|
2641
3017
|
consecutiveFailures += 1;
|
|
2642
3018
|
const reason = error instanceof Error ? error.message : String(error);
|
|
2643
3019
|
if (!outageNoticeSent) {
|
|
2644
|
-
_optionalChain([options, 'access',
|
|
3020
|
+
_optionalChain([options, 'access', _109 => _109.onRetry, 'optionalCall', _110 => _110({
|
|
2645
3021
|
attempt: consecutiveFailures,
|
|
2646
3022
|
delayMs: pollIntervalMs,
|
|
2647
3023
|
reason
|
|
2648
3024
|
})]);
|
|
2649
|
-
_optionalChain([options, 'access',
|
|
2650
|
-
`[watch] run snapshot request failed; retrying
|
|
3025
|
+
_optionalChain([options, 'access', _111 => _111.onNotice, 'optionalCall', _112 => _112(
|
|
3026
|
+
`[watch] run snapshot request failed; retrying snapshot polling (${reason})`
|
|
2651
3027
|
)]);
|
|
2652
3028
|
outageNoticeSent = true;
|
|
2653
3029
|
}
|
|
@@ -2661,77 +3037,63 @@ async function* watchRunEvents(options) {
|
|
|
2661
3037
|
continue;
|
|
2662
3038
|
}
|
|
2663
3039
|
if (outageNoticeSent) {
|
|
2664
|
-
_optionalChain([options, 'access',
|
|
3040
|
+
_optionalChain([options, 'access', _113 => _113.onNotice, 'optionalCall', _114 => _114("[watch] run snapshot polling recovered")]);
|
|
2665
3041
|
outageNoticeSent = false;
|
|
2666
3042
|
}
|
|
2667
3043
|
consecutiveFailures = 0;
|
|
3044
|
+
if (terminalStatus) {
|
|
3045
|
+
await _optionalChain([options, 'access', _115 => _115.terminalStatus, 'optionalAccess', _116 => _116.onStatus, 'call', _117 => _117(terminalStatus, snapshot.status)]);
|
|
3046
|
+
}
|
|
2668
3047
|
const diff = diffPlayRunStreamEvents({
|
|
2669
3048
|
streamId,
|
|
2670
3049
|
snapshot,
|
|
2671
3050
|
previous
|
|
2672
3051
|
});
|
|
2673
3052
|
previous = diff.next;
|
|
2674
|
-
for (const event of diff.events) {
|
|
2675
|
-
yield event;
|
|
2676
|
-
}
|
|
2677
|
-
if (isTerminalPlayRunLiveStatus(snapshot.status)) {
|
|
2678
|
-
return;
|
|
2679
|
-
}
|
|
2680
|
-
const remaining = Math.max(
|
|
2681
|
-
0,
|
|
2682
|
-
pollIntervalMs - (Date.now() - pollStartedAt)
|
|
2683
|
-
);
|
|
2684
|
-
if (!await waitForNextPoll(remaining, signal)) {
|
|
2685
|
-
return;
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
}
|
|
2689
|
-
|
|
2690
|
-
// ../play-runtime/runtime-environment.ts
|
|
2691
|
-
var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
|
|
2692
|
-
var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
|
|
2693
|
-
var PLAY_RUNTIME_SANDBOX_PLACEMENT_POLICY_PATTERN = /^[a-z][a-z0-9_]*@[1-9][0-9]*$/;
|
|
2694
|
-
function normalizePlayRuntimeNamespace(value) {
|
|
2695
|
-
if (typeof value !== "string") return null;
|
|
2696
|
-
const normalized = value.trim();
|
|
2697
|
-
return PLAY_RUNTIME_NAMESPACE_PATTERN.test(normalized) ? normalized : null;
|
|
2698
|
-
}
|
|
2699
|
-
function normalizePlayRuntimeSandboxPlacementPolicy(value) {
|
|
2700
|
-
if (typeof value !== "string") return null;
|
|
2701
|
-
const normalized = value.trim();
|
|
2702
|
-
return PLAY_RUNTIME_SANDBOX_PLACEMENT_POLICY_PATTERN.test(normalized) ? normalized : null;
|
|
2703
|
-
}
|
|
2704
|
-
function normalizePlayRuntimeSelection(value) {
|
|
2705
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
2706
|
-
const record = value;
|
|
2707
|
-
if (Object.keys(record).some(
|
|
2708
|
-
(key) => key !== "environment" && key !== "namespace" && key !== "backend" && key !== "sandboxPlacementPolicy"
|
|
2709
|
-
) || record.environment !== "preview") {
|
|
2710
|
-
return null;
|
|
2711
|
-
}
|
|
2712
|
-
const namespace = normalizePlayRuntimeNamespace(record.namespace);
|
|
2713
|
-
if (!namespace) return null;
|
|
2714
|
-
const sandboxPlacementPolicy = record.sandboxPlacementPolicy === void 0 ? void 0 : normalizePlayRuntimeSandboxPlacementPolicy(
|
|
2715
|
-
record.sandboxPlacementPolicy
|
|
2716
|
-
);
|
|
2717
|
-
if (record.sandboxPlacementPolicy !== void 0 && sandboxPlacementPolicy === null) {
|
|
2718
|
-
return null;
|
|
2719
|
-
}
|
|
2720
|
-
if (record.backend !== void 0 && record.backend !== _chunkS6R3OX7Bjs.PLAY_RUNTIME_BACKENDS.daytona && record.backend !== _chunkS6R3OX7Bjs.PLAY_RUNTIME_BACKENDS.modal) {
|
|
2721
|
-
return null;
|
|
3053
|
+
for (const event of diff.events) {
|
|
3054
|
+
yield event;
|
|
3055
|
+
}
|
|
3056
|
+
if (isTerminalPlayRunLiveStatus(snapshot.status)) {
|
|
3057
|
+
return;
|
|
3058
|
+
}
|
|
3059
|
+
const remaining = Math.max(
|
|
3060
|
+
0,
|
|
3061
|
+
pollIntervalMs - (Date.now() - pollStartedAt)
|
|
3062
|
+
);
|
|
3063
|
+
if (!await waitForNextPoll(remaining, signal)) {
|
|
3064
|
+
return;
|
|
3065
|
+
}
|
|
2722
3066
|
}
|
|
2723
|
-
return {
|
|
2724
|
-
environment: "preview",
|
|
2725
|
-
namespace,
|
|
2726
|
-
...record.backend === void 0 ? {} : { backend: record.backend },
|
|
2727
|
-
...sandboxPlacementPolicy ? { sandboxPlacementPolicy } : {}
|
|
2728
|
-
};
|
|
2729
|
-
}
|
|
2730
|
-
function normalizePlayRuntimeEnvironment(value) {
|
|
2731
|
-
return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
|
|
2732
3067
|
}
|
|
2733
3068
|
|
|
2734
3069
|
// src/client.ts
|
|
3070
|
+
function invalidToolDiscoveryResponse() {
|
|
3071
|
+
return new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
3072
|
+
"The server returned an invalid tool discovery response.",
|
|
3073
|
+
502,
|
|
3074
|
+
"INVALID_TOOL_DISCOVERY_RESPONSE"
|
|
3075
|
+
);
|
|
3076
|
+
}
|
|
3077
|
+
function readToolCategorySummaries(value) {
|
|
3078
|
+
if (!Array.isArray(value)) throw invalidToolDiscoveryResponse();
|
|
3079
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3080
|
+
return value.map((item) => {
|
|
3081
|
+
if (!item || typeof item !== "object" || !("name" in item) || typeof item.name !== "string" || !item.name.trim() || seen.has(item.name) || !("count" in item) || typeof item.count !== "number" || !Number.isSafeInteger(item.count) || item.count < 0) {
|
|
3082
|
+
throw invalidToolDiscoveryResponse();
|
|
3083
|
+
}
|
|
3084
|
+
seen.add(item.name);
|
|
3085
|
+
return { name: item.name, count: item.count };
|
|
3086
|
+
});
|
|
3087
|
+
}
|
|
3088
|
+
function summarizeToolCategories(tools) {
|
|
3089
|
+
const counts = /* @__PURE__ */ new Map();
|
|
3090
|
+
for (const tool of tools) {
|
|
3091
|
+
for (const category of _nullishCoalesce(tool.categories, () => ( []))) {
|
|
3092
|
+
counts.set(category, (_nullishCoalesce(counts.get(category), () => ( 0))) + 1);
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
return [...counts].map(([name, count]) => ({ name, count })).sort((a, b) => b.count - a.count || a.name.localeCompare(b.name));
|
|
3096
|
+
}
|
|
2735
3097
|
var MAX_NOTIFICATION_GROUP_CREATE_TARGETS = 50;
|
|
2736
3098
|
function parseNotificationGroupTarget(value) {
|
|
2737
3099
|
const normalized = value.trim();
|
|
@@ -2744,7 +3106,7 @@ function parseNotificationGroupTarget(value) {
|
|
|
2744
3106
|
}
|
|
2745
3107
|
return { kind: "email", email };
|
|
2746
3108
|
}
|
|
2747
|
-
const slack = _optionalChain([/^slack:(.+)$/i, 'access',
|
|
3109
|
+
const slack = _optionalChain([/^slack:(.+)$/i, 'access', _118 => _118.exec, 'call', _119 => _119(normalized), 'optionalAccess', _120 => _120[1], 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()]);
|
|
2748
3110
|
if (!slack) {
|
|
2749
3111
|
const provider = normalized.split(":", 1)[0] || normalized;
|
|
2750
3112
|
throw new Error(
|
|
@@ -2752,7 +3114,7 @@ function parseNotificationGroupTarget(value) {
|
|
|
2752
3114
|
);
|
|
2753
3115
|
}
|
|
2754
3116
|
const member = /^member:([UW][A-Z0-9]{8,})$/i.exec(slack);
|
|
2755
|
-
if (_optionalChain([member, 'optionalAccess',
|
|
3117
|
+
if (_optionalChain([member, 'optionalAccess', _123 => _123[1]])) {
|
|
2756
3118
|
return { kind: "slack", memberId: member[1].toUpperCase() };
|
|
2757
3119
|
}
|
|
2758
3120
|
if (slack.toLowerCase().startsWith("member:")) {
|
|
@@ -2776,170 +3138,26 @@ var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
|
|
|
2776
3138
|
var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
|
|
2777
3139
|
var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
|
|
2778
3140
|
var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 25e5;
|
|
2779
|
-
function normalizePlayRunIntegrationMode(value) {
|
|
2780
|
-
if (value === "live" || value === "eval_stub" || value === "fixture") {
|
|
2781
|
-
return value;
|
|
2782
|
-
}
|
|
2783
|
-
return void 0;
|
|
2784
|
-
}
|
|
2785
|
-
function resolvePlayRunIntegrationMode(request, env) {
|
|
2786
|
-
return normalizePlayRunIntegrationMode(
|
|
2787
|
-
_nullishCoalesce(request.integrationMode, () => ( env.DEEPLINE_EVAL_INTEGRATION_MODE))
|
|
2788
|
-
);
|
|
2789
|
-
}
|
|
2790
|
-
function resolvePlayRunRuntimeSelection(request, env) {
|
|
2791
|
-
if (request.runtime !== void 0) {
|
|
2792
|
-
const runtime = normalizePlayRuntimeSelection(request.runtime);
|
|
2793
|
-
if (!runtime) {
|
|
2794
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2795
|
-
'runtime must be { environment: "preview", namespace, backend?: "daytona" | "modal", sandboxPlacementPolicy?: "policy_name@1" } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
|
|
2796
|
-
void 0,
|
|
2797
|
-
"INVALID_RUNTIME_SELECTION"
|
|
2798
|
-
);
|
|
2799
|
-
}
|
|
2800
|
-
return runtime;
|
|
2801
|
-
}
|
|
2802
|
-
const configured = _optionalChain([env, 'access', _79 => _79.DEEPLINE_RUNTIME_ENVIRONMENT, 'optionalAccess', _80 => _80.trim, 'call', _81 => _81()]);
|
|
2803
|
-
const configuredNamespace = _optionalChain([env, 'access', _82 => _82.DEEPLINE_RUNTIME_NAMESPACE, 'optionalAccess', _83 => _83.trim, 'call', _84 => _84()]);
|
|
2804
|
-
const configuredToken = _optionalChain([env, 'access', _85 => _85.DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN, 'optionalAccess', _86 => _86.trim, 'call', _87 => _87()]);
|
|
2805
|
-
const configuredPlacementPolicy = _optionalChain([env, 'access', _88 => _88.DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()]);
|
|
2806
|
-
if (!configured) {
|
|
2807
|
-
if (configuredNamespace || configuredToken || configuredPlacementPolicy) {
|
|
2808
|
-
const present = [];
|
|
2809
|
-
if (configuredNamespace) present.push("DEEPLINE_RUNTIME_NAMESPACE");
|
|
2810
|
-
if (configuredToken) present.push("DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN");
|
|
2811
|
-
if (configuredPlacementPolicy) {
|
|
2812
|
-
present.push("DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY");
|
|
2813
|
-
}
|
|
2814
|
-
const isPlural = present.length > 1;
|
|
2815
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2816
|
-
[
|
|
2817
|
-
`Incomplete play runtime selection: ${present.join(" and ")} ${isPlural ? "are" : "is"} set but DEEPLINE_RUNTIME_ENVIRONMENT is not.`,
|
|
2818
|
-
"Preview routing requires DEEPLINE_RUNTIME_ENVIRONMENT=preview together with DEEPLINE_RUNTIME_NAMESPACE; the token alone authorizes nothing.",
|
|
2819
|
-
`If you did not export ${isPlural ? "these" : "this"} yourself, ${isPlural ? "they were" : "it was"} most likely auto-loaded from a .env or .env.local in the current directory (bun loads those automatically, and in a git worktree .env.local is usually a symlink to the main checkout).`,
|
|
2820
|
-
`To run against the app-native runtime, clear ${isPlural ? "them" : "it"} for this command: ${present.map((name) => `${name}=`).join(" ")} <your deepline command>`
|
|
2821
|
-
].join("\n"),
|
|
2822
|
-
void 0,
|
|
2823
|
-
"INVALID_RUNTIME_ENVIRONMENT"
|
|
2824
|
-
);
|
|
2825
|
-
}
|
|
2826
|
-
return void 0;
|
|
2827
|
-
}
|
|
2828
|
-
const environment = normalizePlayRuntimeEnvironment(configured);
|
|
2829
|
-
if (!environment) {
|
|
2830
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2831
|
-
`DEEPLINE_RUNTIME_ENVIRONMENT supports only explicit preview selection. Received "${configured}". Omit it to use the app-native runtime.`,
|
|
2832
|
-
void 0,
|
|
2833
|
-
"INVALID_RUNTIME_ENVIRONMENT"
|
|
2834
|
-
);
|
|
2835
|
-
}
|
|
2836
|
-
const namespace = normalizePlayRuntimeNamespace(configuredNamespace);
|
|
2837
|
-
if (!namespace) {
|
|
2838
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2839
|
-
"DEEPLINE_RUNTIME_NAMESPACE is required for preview and must match ^[a-z][a-z0-9-]{0,30}$.",
|
|
2840
|
-
void 0,
|
|
2841
|
-
"INVALID_RUNTIME_NAMESPACE"
|
|
2842
|
-
);
|
|
2843
|
-
}
|
|
2844
|
-
const configuredBackendValue = _optionalChain([env, 'access', _91 => _91.DEEPLINE_PLAY_RUNNER_BACKEND, 'optionalAccess', _92 => _92.trim, 'call', _93 => _93()]);
|
|
2845
|
-
const configuredBackend = configuredBackendValue === "daytona" || configuredBackendValue === "modal" ? configuredBackendValue : void 0;
|
|
2846
|
-
if (configuredBackendValue && !configuredBackend) {
|
|
2847
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2848
|
-
`DEEPLINE_PLAY_RUNNER_BACKEND must be daytona or modal for preview runtime selection. Received "${configuredBackendValue}".`,
|
|
2849
|
-
void 0,
|
|
2850
|
-
"INVALID_RUNTIME_BACKEND"
|
|
2851
|
-
);
|
|
2852
|
-
}
|
|
2853
|
-
if (configuredPlacementPolicy && !normalizePlayRuntimeSandboxPlacementPolicy(configuredPlacementPolicy)) {
|
|
2854
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2855
|
-
`DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY must be a versioned placement policy id such as daytona_only@1. Received "${configuredPlacementPolicy}".`,
|
|
2856
|
-
void 0,
|
|
2857
|
-
"INVALID_RUNTIME_SANDBOX_PLACEMENT_POLICY"
|
|
2858
|
-
);
|
|
2859
|
-
}
|
|
2860
|
-
return {
|
|
2861
|
-
environment,
|
|
2862
|
-
namespace,
|
|
2863
|
-
...configuredBackend ? { backend: configuredBackend } : {},
|
|
2864
|
-
...configuredPlacementPolicy ? { sandboxPlacementPolicy: configuredPlacementPolicy } : {}
|
|
2865
|
-
};
|
|
2866
|
-
}
|
|
2867
|
-
function resolveStartPlayRunRequest(request, env) {
|
|
2868
|
-
const integrationMode = resolvePlayRunIntegrationMode(request, env);
|
|
2869
|
-
const testPolicyOverrides = _nullishCoalesce(request.testPolicyOverrides, () => ( parseEnvTestPolicyOverrides(env)));
|
|
2870
|
-
const runtime = resolvePlayRunRuntimeSelection(request, env);
|
|
2871
|
-
const resolved = { ...request };
|
|
2872
|
-
delete resolved.integrationMode;
|
|
2873
|
-
delete resolved.runtime;
|
|
2874
|
-
delete resolved.testPolicyOverrides;
|
|
2875
|
-
if (integrationMode) resolved.integrationMode = integrationMode;
|
|
2876
|
-
if (runtime) resolved.runtime = runtime;
|
|
2877
|
-
if (testPolicyOverrides) resolved.testPolicyOverrides = testPolicyOverrides;
|
|
2878
|
-
return { request: resolved, runtime };
|
|
2879
|
-
}
|
|
2880
|
-
function runtimeSelectionHeaders(runtime, env) {
|
|
2881
|
-
if (!runtime) return void 0;
|
|
2882
|
-
const token = _optionalChain([env, 'access', _94 => _94.DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN, 'optionalAccess', _95 => _95.trim, 'call', _96 => _96()]);
|
|
2883
|
-
if (!token) {
|
|
2884
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2885
|
-
"DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN is required for explicit preview runtime selection.",
|
|
2886
|
-
void 0,
|
|
2887
|
-
"RUNTIME_ENVIRONMENT_TOKEN_REQUIRED"
|
|
2888
|
-
);
|
|
2889
|
-
}
|
|
2890
|
-
const receivers = _optionalChain([env, 'access', _97 => _97.DEEPLINE_RUNTIME_RETAINED_PIPELINE_RECEIVERS, 'optionalAccess', _98 => _98.trim, 'call', _99 => _99()]);
|
|
2891
|
-
return {
|
|
2892
|
-
[_chunkQUAQX3FQjs.RUNTIME_ENVIRONMENT_TOKEN_HEADER]: token,
|
|
2893
|
-
...receivers ? { [_chunkQUAQX3FQjs.RETAINED_PIPELINE_RECEIVERS_HEADER]: receivers } : {}
|
|
2894
|
-
};
|
|
2895
|
-
}
|
|
2896
3141
|
function isolatedCiRuntimeEventReadHeaders(env) {
|
|
2897
|
-
const schema = _optionalChain([env, 'access',
|
|
2898
|
-
if (_optionalChain([env, 'access',
|
|
3142
|
+
const schema = _optionalChain([env, 'access', _124 => _124.DEEPLINE_RUNTIME_SCHEDULER_SCHEMA, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()]);
|
|
3143
|
+
if (_optionalChain([env, 'access', _127 => _127.DEEPLINE_SYNTHETIC_RUN, 'optionalAccess', _128 => _128.trim, 'call', _129 => _129()]) !== "1" || !schema || !/^fly_absurd_pr_\d+_\d+(?:_\d+)?$/.test(schema)) {
|
|
2899
3144
|
return void 0;
|
|
2900
3145
|
}
|
|
2901
|
-
const token = _optionalChain([env, 'access',
|
|
3146
|
+
const token = _optionalChain([env, 'access', _130 => _130.DEEPLINE_INTERNAL_TOKEN, 'optionalAccess', _131 => _131.trim, 'call', _132 => _132()]);
|
|
2902
3147
|
if (!token) {
|
|
2903
|
-
throw new (0,
|
|
3148
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
2904
3149
|
"DEEPLINE_INTERNAL_TOKEN is required for isolated CI runtime event reads.",
|
|
2905
3150
|
void 0,
|
|
2906
3151
|
"RUNTIME_EVENT_INTERNAL_TOKEN_REQUIRED"
|
|
2907
3152
|
);
|
|
2908
3153
|
}
|
|
2909
|
-
return { [
|
|
2910
|
-
}
|
|
2911
|
-
function normalizeTestPolicyOverrides(value, source) {
|
|
2912
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2913
|
-
return value;
|
|
2914
|
-
}
|
|
2915
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2916
|
-
`${source} must be a JSON object.`,
|
|
2917
|
-
void 0,
|
|
2918
|
-
"INVALID_TEST_POLICY_OVERRIDES"
|
|
2919
|
-
);
|
|
2920
|
-
}
|
|
2921
|
-
function parseEnvTestPolicyOverrides(env) {
|
|
2922
|
-
const raw = env.DEEPLINE_TEST_POLICY_OVERRIDES;
|
|
2923
|
-
const trimmed = _optionalChain([raw, 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()]);
|
|
2924
|
-
if (!trimmed) return void 0;
|
|
2925
|
-
let parsed;
|
|
2926
|
-
try {
|
|
2927
|
-
parsed = JSON.parse(trimmed);
|
|
2928
|
-
} catch (error) {
|
|
2929
|
-
const detail = error instanceof Error ? ` ${error.message}` : "";
|
|
2930
|
-
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
2931
|
-
`DEEPLINE_TEST_POLICY_OVERRIDES must be valid JSON.${detail}`,
|
|
2932
|
-
void 0,
|
|
2933
|
-
"INVALID_TEST_POLICY_OVERRIDES"
|
|
2934
|
-
);
|
|
2935
|
-
}
|
|
2936
|
-
return normalizeTestPolicyOverrides(parsed, "DEEPLINE_TEST_POLICY_OVERRIDES");
|
|
3154
|
+
return { [_chunkFVLNYDI4js.COORDINATOR_INTERNAL_TOKEN_HEADER]: token };
|
|
2937
3155
|
}
|
|
2938
3156
|
function sleep(ms) {
|
|
2939
3157
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2940
3158
|
}
|
|
2941
3159
|
function isTransientCompileManifestError(error) {
|
|
2942
|
-
if (error instanceof
|
|
3160
|
+
if (error instanceof _chunkPPDBRJRWjs.DeeplineError && typeof error.statusCode === "number") {
|
|
2943
3161
|
return error.statusCode === 408 || error.statusCode === 425 || error.statusCode === 499 || error.statusCode >= 500 && error.statusCode < 600;
|
|
2944
3162
|
}
|
|
2945
3163
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -2948,9 +3166,9 @@ function isTransientCompileManifestError(error) {
|
|
|
2948
3166
|
);
|
|
2949
3167
|
}
|
|
2950
3168
|
function requireCompileManifestResponse(response, playName) {
|
|
2951
|
-
const compilerManifest = _optionalChain([response, 'optionalAccess',
|
|
3169
|
+
const compilerManifest = _optionalChain([response, 'optionalAccess', _133 => _133.compilerManifest]);
|
|
2952
3170
|
if (!compilerManifest || typeof compilerManifest !== "object" || Array.isArray(compilerManifest)) {
|
|
2953
|
-
throw new (0,
|
|
3171
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
2954
3172
|
`Compile manifest response did not include compilerManifest for ${playName}.`,
|
|
2955
3173
|
502,
|
|
2956
3174
|
"API_RESPONSE_INVALID",
|
|
@@ -3000,7 +3218,7 @@ function chunkRegisterPlayArtifacts(artifacts) {
|
|
|
3000
3218
|
}
|
|
3001
3219
|
function searchParams(options) {
|
|
3002
3220
|
const params = new URLSearchParams();
|
|
3003
|
-
params.set("q", _nullishCoalesce(_optionalChain([options, 'access',
|
|
3221
|
+
params.set("q", _nullishCoalesce(_optionalChain([options, 'access', _134 => _134.query, 'optionalAccess', _135 => _135.trim, 'call', _136 => _136()]), () => ( "")));
|
|
3004
3222
|
params.set(
|
|
3005
3223
|
"include_search_debug",
|
|
3006
3224
|
options.includeSearchDebug ? "true" : "false"
|
|
@@ -3010,13 +3228,13 @@ function searchParams(options) {
|
|
|
3010
3228
|
if (options.offset !== void 0) {
|
|
3011
3229
|
params.set("offset", String(options.offset));
|
|
3012
3230
|
}
|
|
3013
|
-
if (_optionalChain([options, 'access',
|
|
3231
|
+
if (_optionalChain([options, 'access', _137 => _137.categories, 'optionalAccess', _138 => _138.trim, 'call', _139 => _139()])) {
|
|
3014
3232
|
params.set("categories", options.categories.trim());
|
|
3015
3233
|
}
|
|
3016
|
-
if (_optionalChain([options, 'access',
|
|
3234
|
+
if (_optionalChain([options, 'access', _140 => _140.searchTerms, 'optionalAccess', _141 => _141.trim, 'call', _142 => _142()])) {
|
|
3017
3235
|
params.set("search_terms", options.searchTerms.trim());
|
|
3018
3236
|
}
|
|
3019
|
-
if (_optionalChain([options, 'access',
|
|
3237
|
+
if (_optionalChain([options, 'access', _143 => _143.task, 'optionalAccess', _144 => _144.trim, 'call', _145 => _145()])) params.set("task", options.task.trim());
|
|
3020
3238
|
return params;
|
|
3021
3239
|
}
|
|
3022
3240
|
var RUNS_FAILED_LOG_LIMIT = 20;
|
|
@@ -3042,7 +3260,7 @@ var MONITOR_JOB_RECONCILIATION_STATES = [
|
|
|
3042
3260
|
"partial",
|
|
3043
3261
|
"mismatched"
|
|
3044
3262
|
];
|
|
3045
|
-
function
|
|
3263
|
+
function isRecord3(value) {
|
|
3046
3264
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
3047
3265
|
}
|
|
3048
3266
|
function isPrebuiltPlayDescription(play) {
|
|
@@ -3053,33 +3271,6 @@ function preferPrebuiltPlayDescriptions(plays) {
|
|
|
3053
3271
|
(left, right) => Number(right.play.pinned) - Number(left.play.pinned) || Number(isPrebuiltPlayDescription(right.play)) - Number(isPrebuiltPlayDescription(left.play)) || left.index - right.index
|
|
3054
3272
|
).map(({ play }) => play);
|
|
3055
3273
|
}
|
|
3056
|
-
function normalizePlayStatus(raw) {
|
|
3057
|
-
const runPackage = _chunkUHNDVD3Pjs.isPlayRunPackage.call(void 0, raw) ? raw : _chunkUHNDVD3Pjs.isPlayRunPackage.call(void 0, raw.package) ? raw.package : null;
|
|
3058
|
-
const packageRun = _optionalChain([runPackage, 'optionalAccess', _124 => _124.run]);
|
|
3059
|
-
const rawStatus = typeof raw.status === "string" ? raw.status : typeof _optionalChain([packageRun, 'optionalAccess', _125 => _125.status]) === "string" ? packageRun.status : null;
|
|
3060
|
-
const status = _chunkUHNDVD3Pjs.decodePlayRunPublicStatus.call(void 0, rawStatus);
|
|
3061
|
-
if (!status) {
|
|
3062
|
-
throw new Error(
|
|
3063
|
-
`Invalid play run lifecycle status in API response: ${JSON.stringify(rawStatus)}.`
|
|
3064
|
-
);
|
|
3065
|
-
}
|
|
3066
|
-
const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : _nullishCoalesce(_optionalChain([packageRun, 'optionalAccess', _126 => _126.id]), () => ( ""));
|
|
3067
|
-
const legacyOverview = _nullishCoalesce(_optionalChain([runPackage, 'optionalAccess', _127 => _127.overview]), () => ( raw.overview));
|
|
3068
|
-
const runStatus = _nullishCoalesce(_optionalChain([runPackage, 'optionalAccess', _128 => _128.runStatus]), () => ( raw.runStatus));
|
|
3069
|
-
return {
|
|
3070
|
-
...raw,
|
|
3071
|
-
runId,
|
|
3072
|
-
...isRecord2(legacyOverview) ? {
|
|
3073
|
-
overview: legacyOverview
|
|
3074
|
-
} : {},
|
|
3075
|
-
...isRecord2(runStatus) ? { runStatus } : {},
|
|
3076
|
-
...runPackage ? {
|
|
3077
|
-
package: runPackage,
|
|
3078
|
-
outputs: runPackage.outputs
|
|
3079
|
-
} : {},
|
|
3080
|
-
status
|
|
3081
|
-
};
|
|
3082
|
-
}
|
|
3083
3274
|
function readStringArray(value) {
|
|
3084
3275
|
return Array.isArray(value) ? value.filter((line) => typeof line === "string") : [];
|
|
3085
3276
|
}
|
|
@@ -3091,7 +3282,7 @@ function playLiveRunStatus(event) {
|
|
|
3091
3282
|
return null;
|
|
3092
3283
|
}
|
|
3093
3284
|
const payload = getPlayLiveEventPayload(event);
|
|
3094
|
-
return _nullishCoalesce(
|
|
3285
|
+
return _nullishCoalesce(_chunk2H4EY7KHjs.decodePlayRunPublicStatus.call(void 0, payload.status), () => ( (_chunk2H4EY7KHjs.isPlayRunPackage.call(void 0, payload) ? _chunk2H4EY7KHjs.decodePlayRunPublicStatus.call(void 0, payload.run.status) : null)));
|
|
3095
3286
|
}
|
|
3096
3287
|
function appendPlayLiveLogLines(state, payload) {
|
|
3097
3288
|
const lines = readStringArray(payload.lines);
|
|
@@ -3123,9 +3314,9 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
3123
3314
|
if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
|
|
3124
3315
|
return null;
|
|
3125
3316
|
}
|
|
3126
|
-
const runId = typeof payload.runId === "string" && payload.runId ? payload.runId :
|
|
3317
|
+
const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : _chunk2H4EY7KHjs.isPlayRunPackage.call(void 0, payload) ? payload.run.id : state.runId;
|
|
3127
3318
|
const status = _nullishCoalesce(playLiveRunStatus(event), () => ( state.status));
|
|
3128
|
-
const progressPayload =
|
|
3319
|
+
const progressPayload = isRecord3(payload.progress) ? payload.progress : {};
|
|
3129
3320
|
if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
|
|
3130
3321
|
const payloadLogs = readStringArray(payload.logs);
|
|
3131
3322
|
const progressLogs = readStringArray(progressPayload.logs);
|
|
@@ -3136,7 +3327,7 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
3136
3327
|
}
|
|
3137
3328
|
if ("result" in payload) {
|
|
3138
3329
|
state.result = payload.result;
|
|
3139
|
-
} else if (
|
|
3330
|
+
} else if (_chunk2H4EY7KHjs.isPlayRunPackage.call(void 0, payload)) {
|
|
3140
3331
|
state.result = payload;
|
|
3141
3332
|
}
|
|
3142
3333
|
if (typeof payload.error === "string" && payload.error.trim()) {
|
|
@@ -3149,7 +3340,7 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
3149
3340
|
...payload,
|
|
3150
3341
|
runId,
|
|
3151
3342
|
status,
|
|
3152
|
-
...
|
|
3343
|
+
..._chunk2H4EY7KHjs.isPlayRunPackage.call(void 0, payload) ? { package: payload, outputs: payload.outputs } : {},
|
|
3153
3344
|
progress: {
|
|
3154
3345
|
...progressRecord,
|
|
3155
3346
|
status: typeof progressRecord.status === "string" ? progressRecord.status : status,
|
|
@@ -3167,9 +3358,9 @@ function playRunResultFromStatus(status, startedAt, fallbackRunId) {
|
|
|
3167
3358
|
runId: status.runId || fallbackRunId,
|
|
3168
3359
|
result: _nullishCoalesce(status.package, () => ( status.result)),
|
|
3169
3360
|
...status.package ? { package: status.package } : {},
|
|
3170
|
-
logs: _nullishCoalesce(_optionalChain([status, 'access',
|
|
3361
|
+
logs: _nullishCoalesce(_optionalChain([status, 'access', _146 => _146.progress, 'optionalAccess', _147 => _147.logs]), () => ( [])),
|
|
3171
3362
|
durationMs: Date.now() - startedAt,
|
|
3172
|
-
error: _nullishCoalesce(_optionalChain([status, 'access',
|
|
3363
|
+
error: _nullishCoalesce(_optionalChain([status, 'access', _148 => _148.progress, 'optionalAccess', _149 => _149.error]), () => ( (status.status !== "completed" ? status.status : void 0)))
|
|
3173
3364
|
};
|
|
3174
3365
|
}
|
|
3175
3366
|
var DeeplineClient = (_class = class _DeeplineClient {
|
|
@@ -3177,6 +3368,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3177
3368
|
|
|
3178
3369
|
|
|
3179
3370
|
|
|
3371
|
+
|
|
3180
3372
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
3181
3373
|
|
|
3182
3374
|
/** Current mutable customer database namespace backed by `/api/v2/db/query`. */
|
|
@@ -3197,13 +3389,14 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3197
3389
|
* @throws {@link ConfigError} if no API key can be resolved from any source.
|
|
3198
3390
|
*/
|
|
3199
3391
|
constructor(options) {
|
|
3200
|
-
this.config =
|
|
3392
|
+
this.config = _chunkFVLNYDI4js.resolveConfig.call(void 0, options);
|
|
3201
3393
|
this.environment = _nullishCoalesce(this.config.environment, () => ( process.env));
|
|
3202
|
-
this.http = new (0,
|
|
3394
|
+
this.http = new (0, _chunkFVLNYDI4js.HttpClient)(this.config);
|
|
3395
|
+
this.playClient = new PlayClient(this.http, this.environment);
|
|
3203
3396
|
this.toolCalls = new ToolCalls(
|
|
3204
3397
|
this.http,
|
|
3205
3398
|
this.config.timeout,
|
|
3206
|
-
_optionalChain([options, 'optionalAccess',
|
|
3399
|
+
_optionalChain([options, 'optionalAccess', _150 => _150.timeout])
|
|
3207
3400
|
);
|
|
3208
3401
|
this.runs = {
|
|
3209
3402
|
getReceipts: (runId, options2) => this.getRunReceipts(runId, options2),
|
|
@@ -3240,7 +3433,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3240
3433
|
};
|
|
3241
3434
|
this.db = {
|
|
3242
3435
|
query: (input) => this.queryDb(input),
|
|
3243
|
-
planQuery: (input) => planCustomerDbQuery(input)
|
|
3436
|
+
planQuery: (input) => planCustomerDbQuery(input, this.config.maxRetries)
|
|
3244
3437
|
};
|
|
3245
3438
|
this.billing = {
|
|
3246
3439
|
quote: (input) => this.http.post("/api/v2/billing/quote", input),
|
|
@@ -3266,7 +3459,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3266
3459
|
{},
|
|
3267
3460
|
{
|
|
3268
3461
|
"Idempotency-Key": requireBillingIdempotencyKey(
|
|
3269
|
-
_nullishCoalesce(_optionalChain([options2, 'optionalAccess',
|
|
3462
|
+
_nullishCoalesce(_optionalChain([options2, 'optionalAccess', _151 => _151.idempotencyKey]), () => ( globalThis.crypto.randomUUID()))
|
|
3270
3463
|
)
|
|
3271
3464
|
}
|
|
3272
3465
|
),
|
|
@@ -3285,7 +3478,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3285
3478
|
available: (toolIdOrOptions, options2) => this.getMonitorsAvailable(toolIdOrOptions, options2),
|
|
3286
3479
|
check: (definition) => this.checkMonitor(definition),
|
|
3287
3480
|
deploy: (definition, options2) => this.deployMonitor(definition, options2),
|
|
3288
|
-
sync: (definition, options2) => _optionalChain([options2, 'optionalAccess',
|
|
3481
|
+
sync: (definition, options2) => _optionalChain([options2, 'optionalAccess', _152 => _152.dryRun]) ? this.deployMonitor(definition, { dryRun: true }) : this.syncScalarMonitor(definition, options2),
|
|
3289
3482
|
list: (options2) => this.listMonitors(options2),
|
|
3290
3483
|
get: (key) => this.getMonitor(key),
|
|
3291
3484
|
test: (key, payload, options2) => this.testMonitorWebhook(key, payload, options2),
|
|
@@ -3294,13 +3487,13 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3294
3487
|
update: (key, patch) => this.updateMonitor(key, patch),
|
|
3295
3488
|
delete: (key, options2) => this.deleteMonitor(key, options2),
|
|
3296
3489
|
reactivate: (key, options2) => this.reactivateMonitor(key, options2),
|
|
3297
|
-
start: (key, options2) => _optionalChain([options2, 'optionalAccess',
|
|
3490
|
+
start: (key, options2) => _optionalChain([options2, 'optionalAccess', _153 => _153.dryRun]) ? this.submitMonitorBatch({
|
|
3298
3491
|
kind: "reactivate",
|
|
3299
3492
|
scope: { kind: "keys", monitorKeys: [key] },
|
|
3300
3493
|
dryRun: true,
|
|
3301
3494
|
idempotencyKey: _nullishCoalesce(options2.idempotencyKey, () => ( this.monitorJobIdempotencyKey(`start-${key}`)))
|
|
3302
3495
|
}) : this.submitScalarMonitorLifecycle(key, "start", options2),
|
|
3303
|
-
stop: (key, options2) => _optionalChain([options2, 'optionalAccess',
|
|
3496
|
+
stop: (key, options2) => _optionalChain([options2, 'optionalAccess', _154 => _154.dryRun]) ? this.submitMonitorBatch({
|
|
3304
3497
|
kind: "deactivate",
|
|
3305
3498
|
scope: { kind: "keys", monitorKeys: [key] },
|
|
3306
3499
|
dryRun: true,
|
|
@@ -3404,26 +3597,65 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3404
3597
|
*/
|
|
3405
3598
|
async listTools(options) {
|
|
3406
3599
|
const params = new URLSearchParams();
|
|
3407
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3600
|
+
if (_optionalChain([options, 'optionalAccess', _155 => _155.categories, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()])) {
|
|
3408
3601
|
params.set("categories", options.categories.trim());
|
|
3409
3602
|
}
|
|
3410
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3603
|
+
if (_optionalChain([options, 'optionalAccess', _158 => _158.tags, 'optionalAccess', _159 => _159.trim, 'call', _160 => _160()])) {
|
|
3411
3604
|
params.set("tags", options.tags.trim());
|
|
3412
3605
|
}
|
|
3413
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3606
|
+
if (_optionalChain([options, 'optionalAccess', _161 => _161.grep, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()])) {
|
|
3414
3607
|
params.set("grep", options.grep.trim());
|
|
3415
3608
|
params.set("grep_mode", _nullishCoalesce(options.grepMode, () => ( "all")));
|
|
3416
3609
|
}
|
|
3417
|
-
params.set("compact", _optionalChain([options, 'optionalAccess',
|
|
3610
|
+
params.set("compact", _optionalChain([options, 'optionalAccess', _164 => _164.compact]) === true ? "true" : "false");
|
|
3418
3611
|
const suffix = params.toString() ? `?${params.toString()}` : "";
|
|
3419
3612
|
const res = await this.http.get(
|
|
3420
3613
|
`/api/v2/tools${suffix}`
|
|
3421
3614
|
);
|
|
3422
3615
|
return res.tools;
|
|
3423
3616
|
}
|
|
3617
|
+
/** List category counts without downloading tool definitions. */
|
|
3618
|
+
async listToolCategories() {
|
|
3619
|
+
const response = await this.http.get(
|
|
3620
|
+
"/api/v2/tools?view=categories&compact=true"
|
|
3621
|
+
);
|
|
3622
|
+
if (response.view === "categories") {
|
|
3623
|
+
return readToolCategorySummaries(response.categories);
|
|
3624
|
+
}
|
|
3625
|
+
if (response.view === void 0 && Array.isArray(response.tools)) {
|
|
3626
|
+
return summarizeToolCategories(response.tools);
|
|
3627
|
+
}
|
|
3628
|
+
throw invalidToolDiscoveryResponse();
|
|
3629
|
+
}
|
|
3630
|
+
/** Read one complete category and its live category counts in one request. */
|
|
3631
|
+
async listToolsInCategory(category, options) {
|
|
3632
|
+
const normalizedCategory = category.trim();
|
|
3633
|
+
if (!normalizedCategory || category.includes(",")) {
|
|
3634
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
3635
|
+
"Provide one non-empty tool category.",
|
|
3636
|
+
400,
|
|
3637
|
+
"INVALID_TOOL_CATEGORY"
|
|
3638
|
+
);
|
|
3639
|
+
}
|
|
3640
|
+
const params = new URLSearchParams({
|
|
3641
|
+
view: "category",
|
|
3642
|
+
categories: normalizedCategory,
|
|
3643
|
+
compact: _optionalChain([options, 'optionalAccess', _165 => _165.compact]) === true ? "true" : "false"
|
|
3644
|
+
});
|
|
3645
|
+
const response = await this.http.get(
|
|
3646
|
+
`/api/v2/tools?${params}`
|
|
3647
|
+
);
|
|
3648
|
+
if (!Array.isArray(response.tools) || response.view !== "category" && response.view !== void 0) {
|
|
3649
|
+
throw invalidToolDiscoveryResponse();
|
|
3650
|
+
}
|
|
3651
|
+
return {
|
|
3652
|
+
tools: response.tools,
|
|
3653
|
+
categories: response.view === "category" ? readToolCategorySummaries(response.categories) : await this.listToolCategories()
|
|
3654
|
+
};
|
|
3655
|
+
}
|
|
3424
3656
|
/** List discoverable providers without requiring a local plugin catalog. */
|
|
3425
3657
|
async listProviders(options) {
|
|
3426
|
-
const suffix = _optionalChain([options, 'optionalAccess',
|
|
3658
|
+
const suffix = _optionalChain([options, 'optionalAccess', _166 => _166.changed]) ? "?changed=true" : "";
|
|
3427
3659
|
const res = await this.http.get(
|
|
3428
3660
|
`/api/v2/tools/providers${suffix}`
|
|
3429
3661
|
);
|
|
@@ -3454,8 +3686,8 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3454
3686
|
*/
|
|
3455
3687
|
async search(options = {}) {
|
|
3456
3688
|
const params = searchParams(options);
|
|
3457
|
-
if (_optionalChain([options, 'access',
|
|
3458
|
-
if (_optionalChain([options, 'access',
|
|
3689
|
+
if (_optionalChain([options, 'access', _167 => _167.types, 'optionalAccess', _168 => _168.length])) params.set("types", options.types.join(","));
|
|
3690
|
+
if (_optionalChain([options, 'access', _169 => _169.exclude, 'optionalAccess', _170 => _170.length])) {
|
|
3459
3691
|
params.set("exclude", options.exclude.join(","));
|
|
3460
3692
|
}
|
|
3461
3693
|
return this.http.get(`/api/v2/search?${params.toString()}`);
|
|
@@ -3477,7 +3709,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3477
3709
|
* ```
|
|
3478
3710
|
*/
|
|
3479
3711
|
async getTool(toolId, options) {
|
|
3480
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3712
|
+
if (_optionalChain([options, 'optionalAccess', _171 => _171.cliInvocationId]) !== void 0) {
|
|
3481
3713
|
validateCliInvocationId(options.cliInvocationId);
|
|
3482
3714
|
}
|
|
3483
3715
|
return this.http.request(
|
|
@@ -3490,7 +3722,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3490
3722
|
retryApiErrors: true,
|
|
3491
3723
|
headers: {
|
|
3492
3724
|
"x-deepline-tool-meta-only": "1",
|
|
3493
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3725
|
+
..._optionalChain([options, 'optionalAccess', _172 => _172.cliInvocationId]) !== void 0 ? { "x-deepline-cli-invocation-id": options.cliInvocationId } : {}
|
|
3494
3726
|
}
|
|
3495
3727
|
}
|
|
3496
3728
|
);
|
|
@@ -3559,7 +3791,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3559
3791
|
return this.executeTool(toolId, input, options);
|
|
3560
3792
|
}
|
|
3561
3793
|
async queryDb(input) {
|
|
3562
|
-
return queryCustomerDatabase(this.http, input);
|
|
3794
|
+
return queryCustomerDatabase(this.http, input, this.config.maxRetries);
|
|
3563
3795
|
}
|
|
3564
3796
|
/**
|
|
3565
3797
|
* Run a bounded SQL query against the current mutable customer database.
|
|
@@ -3581,7 +3813,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3581
3813
|
return this.http.post(
|
|
3582
3814
|
"/api/v2/ingestion/repair",
|
|
3583
3815
|
{
|
|
3584
|
-
..._optionalChain([input, 'optionalAccess',
|
|
3816
|
+
..._optionalChain([input, 'optionalAccess', _173 => _173.provider]) ? { provider: input.provider } : {}
|
|
3585
3817
|
}
|
|
3586
3818
|
);
|
|
3587
3819
|
}
|
|
@@ -3625,13 +3857,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3625
3857
|
* ```
|
|
3626
3858
|
*/
|
|
3627
3859
|
async startPlayRun(request, options) {
|
|
3628
|
-
|
|
3629
|
-
return _chunkUHNDVD3Pjs.startPlayRun.call(void 0,
|
|
3630
|
-
this.http,
|
|
3631
|
-
resolved.request,
|
|
3632
|
-
runtimeSelectionHeaders(resolved.runtime, this.environment),
|
|
3633
|
-
_optionalChain([options, 'optionalAccess', _156 => _156.onSubmission])
|
|
3634
|
-
);
|
|
3860
|
+
return this.playClient.startPlayRun(request, options);
|
|
3635
3861
|
}
|
|
3636
3862
|
/**
|
|
3637
3863
|
* Prepare a tenant-scoped start intent without executing it. Its stream
|
|
@@ -3639,10 +3865,10 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3639
3865
|
*/
|
|
3640
3866
|
async preparePlayRunAdmission(request, options) {
|
|
3641
3867
|
const resolved = resolveStartPlayRunRequest(request, this.environment);
|
|
3642
|
-
const prepared = await
|
|
3868
|
+
const prepared = await _chunk2H4EY7KHjs.preparePlayRunAdmission.call(void 0,
|
|
3643
3869
|
this.http,
|
|
3644
3870
|
resolved.request,
|
|
3645
|
-
_optionalChain([options, 'optionalAccess',
|
|
3871
|
+
_optionalChain([options, 'optionalAccess', _174 => _174.onSubmission])
|
|
3646
3872
|
);
|
|
3647
3873
|
const bodyJson = JSON.stringify(prepared.body);
|
|
3648
3874
|
const headers = runtimeSelectionHeaders(resolved.runtime, this.environment);
|
|
@@ -3652,30 +3878,35 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3652
3878
|
...prepared,
|
|
3653
3879
|
async *startStream(streamOptions) {
|
|
3654
3880
|
if (submitted && !prepared.supportsCallerIntent) {
|
|
3655
|
-
throw new (0,
|
|
3881
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
3656
3882
|
"This server has not enabled caller-owned admission recovery. Do not retry an ambiguous start.",
|
|
3657
3883
|
409,
|
|
3658
3884
|
"PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
|
|
3659
3885
|
);
|
|
3660
3886
|
}
|
|
3661
3887
|
if (submitted) {
|
|
3662
|
-
await
|
|
3888
|
+
await _chunk2H4EY7KHjs.preparePlayRunAdmission.call(void 0,
|
|
3663
3889
|
http,
|
|
3664
3890
|
JSON.parse(bodyJson)
|
|
3665
3891
|
);
|
|
3666
3892
|
}
|
|
3667
3893
|
submitted = true;
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
{
|
|
3894
|
+
const streamPath = _optionalChain([options, 'optionalAccess', _175 => _175.cliAdmission]) ? _chunk2H4EY7KHjs.CLI_PLAY_RUN_START_STREAM_PATH : _chunk2H4EY7KHjs.PLAY_RUN_START_STREAM_PATH;
|
|
3895
|
+
try {
|
|
3896
|
+
for await (const event of http.streamSse(streamPath, {
|
|
3671
3897
|
method: "POST",
|
|
3672
3898
|
body: JSON.parse(bodyJson),
|
|
3673
3899
|
headers,
|
|
3674
|
-
signal: _optionalChain([streamOptions, 'optionalAccess',
|
|
3900
|
+
signal: _optionalChain([streamOptions, 'optionalAccess', _176 => _176.signal]),
|
|
3675
3901
|
exactUrlOnly: true
|
|
3902
|
+
})) {
|
|
3903
|
+
if (event.scope === "play") yield event;
|
|
3904
|
+
}
|
|
3905
|
+
} catch (error) {
|
|
3906
|
+
if (_optionalChain([options, 'optionalAccess', _177 => _177.cliAdmission]) && error instanceof _chunkPPDBRJRWjs.DeeplineError && (error.statusCode === 404 || error.statusCode === 405)) {
|
|
3907
|
+
throw new (0, _chunk2H4EY7KHjs.CliPlayAdmissionUnsupportedError)(error.statusCode);
|
|
3676
3908
|
}
|
|
3677
|
-
|
|
3678
|
-
if (event.scope === "play") yield event;
|
|
3909
|
+
throw error;
|
|
3679
3910
|
}
|
|
3680
3911
|
}
|
|
3681
3912
|
};
|
|
@@ -3695,7 +3926,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3695
3926
|
*/
|
|
3696
3927
|
async *startPlayRunStream(request, options) {
|
|
3697
3928
|
const prepared = await this.preparePlayRunAdmission(request, options);
|
|
3698
|
-
yield* prepared.startStream({ signal: _optionalChain([options, 'optionalAccess',
|
|
3929
|
+
yield* prepared.startStream({ signal: _optionalChain([options, 'optionalAccess', _178 => _178.signal]) });
|
|
3699
3930
|
}
|
|
3700
3931
|
/**
|
|
3701
3932
|
* Register a bundled play artifact.
|
|
@@ -3848,7 +4079,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3848
4079
|
compilerManifest,
|
|
3849
4080
|
...input.input ? { input: input.input } : {},
|
|
3850
4081
|
...input.inputFile ? { inputFile: input.inputFile } : {},
|
|
3851
|
-
..._optionalChain([input, 'access',
|
|
4082
|
+
..._optionalChain([input, 'access', _179 => _179.packagedFiles, 'optionalAccess', _180 => _180.length]) ? { packagedFiles: input.packagedFiles } : {},
|
|
3852
4083
|
...input.force ? { force: true } : {},
|
|
3853
4084
|
...input.forceToolRefresh ? { forceToolRefresh: true } : {}
|
|
3854
4085
|
});
|
|
@@ -3878,29 +4109,29 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3878
4109
|
* ```
|
|
3879
4110
|
*/
|
|
3880
4111
|
async submitPlay(code, csvPath, name, options) {
|
|
3881
|
-
const runtimeInput = _optionalChain([options, 'optionalAccess',
|
|
4112
|
+
const runtimeInput = _optionalChain([options, 'optionalAccess', _181 => _181.input]) ? { ...options.input } : {};
|
|
3882
4113
|
if (csvPath) {
|
|
3883
4114
|
runtimeInput.file = csvPath;
|
|
3884
4115
|
}
|
|
3885
|
-
const sourceCode = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3886
|
-
const artifact = _optionalChain([options, 'optionalAccess',
|
|
3887
|
-
if (!_optionalChain([name, 'optionalAccess',
|
|
4116
|
+
const sourceCode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.sourceCode]), () => ( code));
|
|
4117
|
+
const artifact = _optionalChain([options, 'optionalAccess', _183 => _183.artifact]);
|
|
4118
|
+
if (!_optionalChain([name, 'optionalAccess', _184 => _184.trim, 'call', _185 => _185()])) {
|
|
3888
4119
|
throw new Error("submitPlay requires a play name.");
|
|
3889
4120
|
}
|
|
3890
4121
|
if (!artifact) {
|
|
3891
4122
|
throw new Error("submitPlay requires a bundled play artifact.");
|
|
3892
4123
|
}
|
|
3893
|
-
const compilerManifest = await _asyncNullishCoalesce(await _asyncOptionalChain([options, 'optionalAccess', async
|
|
4124
|
+
const compilerManifest = await _asyncNullishCoalesce(await _asyncOptionalChain([options, 'optionalAccess', async _186 => _186.compilerManifest]), async () => ( await this.compilePlayManifest({
|
|
3894
4125
|
name,
|
|
3895
4126
|
sourceCode,
|
|
3896
|
-
sourceFiles: _optionalChain([options, 'optionalAccess',
|
|
4127
|
+
sourceFiles: _optionalChain([options, 'optionalAccess', _187 => _187.sourceFiles]),
|
|
3897
4128
|
artifact
|
|
3898
4129
|
})));
|
|
3899
4130
|
const registeredArtifact = await this.registerPlayArtifact({
|
|
3900
4131
|
name,
|
|
3901
4132
|
sourceCode,
|
|
3902
|
-
sourceFiles: _optionalChain([options, 'optionalAccess',
|
|
3903
|
-
description: _optionalChain([options, 'optionalAccess',
|
|
4133
|
+
sourceFiles: _optionalChain([options, 'optionalAccess', _188 => _188.sourceFiles]),
|
|
4134
|
+
description: _optionalChain([options, 'optionalAccess', _189 => _189.description]),
|
|
3904
4135
|
artifact,
|
|
3905
4136
|
compilerManifest,
|
|
3906
4137
|
publish: false
|
|
@@ -3914,17 +4145,17 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3914
4145
|
name,
|
|
3915
4146
|
artifactStorageKey: registeredArtifact.artifactStorageKey,
|
|
3916
4147
|
sourceCode,
|
|
3917
|
-
description: _optionalChain([options, 'optionalAccess',
|
|
4148
|
+
description: _optionalChain([options, 'optionalAccess', _190 => _190.description]),
|
|
3918
4149
|
staticPipeline: _nullishCoalesce(registeredArtifact.staticPipeline, () => ( null)),
|
|
3919
4150
|
artifactHash: typeof artifact.artifactHash === "string" ? artifact.artifactHash : void 0,
|
|
3920
4151
|
graphHash: typeof artifact.graphHash === "string" ? artifact.graphHash : void 0,
|
|
3921
4152
|
runtimeArtifact: artifact,
|
|
3922
4153
|
compilerManifest,
|
|
3923
4154
|
...Object.keys(runtimeInput).length > 0 ? { input: runtimeInput } : {},
|
|
3924
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3925
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3926
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3927
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4155
|
+
..._optionalChain([options, 'optionalAccess', _191 => _191.inputFile]) ? { inputFile: options.inputFile } : {},
|
|
4156
|
+
..._optionalChain([options, 'optionalAccess', _192 => _192.packagedFiles, 'optionalAccess', _193 => _193.length]) ? { packagedFiles: options.packagedFiles } : {},
|
|
4157
|
+
..._optionalChain([options, 'optionalAccess', _194 => _194.force]) ? { force: true } : {},
|
|
4158
|
+
..._optionalChain([options, 'optionalAccess', _195 => _195.forceToolRefresh]) ? { forceToolRefresh: true } : {}
|
|
3928
4159
|
});
|
|
3929
4160
|
}
|
|
3930
4161
|
/**
|
|
@@ -3952,7 +4183,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3952
4183
|
* ```
|
|
3953
4184
|
*/
|
|
3954
4185
|
async stagePlayFiles(files) {
|
|
3955
|
-
return
|
|
4186
|
+
return _chunk2H4EY7KHjs.stagePlayFiles.call(void 0, this.http, files);
|
|
3956
4187
|
}
|
|
3957
4188
|
/**
|
|
3958
4189
|
* Mint short-lived presigned upload targets for staged play files.
|
|
@@ -3961,7 +4192,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3961
4192
|
* For other files, the server returns a presigned PUT URL. Upload the file body to that URL.
|
|
3962
4193
|
*/
|
|
3963
4194
|
async mintStagedPlayFileUploads(files) {
|
|
3964
|
-
return
|
|
4195
|
+
return _chunk2H4EY7KHjs.mintStagedPlayFileUploads.call(void 0, this.http, files);
|
|
3965
4196
|
}
|
|
3966
4197
|
/**
|
|
3967
4198
|
* Resolve staged play files by content hash without uploading bytes.
|
|
@@ -3991,27 +4222,35 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
3991
4222
|
* ```
|
|
3992
4223
|
*/
|
|
3993
4224
|
async getPlayStatus(workflowId, options) {
|
|
3994
|
-
|
|
3995
|
-
if (_optionalChain([options, 'optionalAccess', _177 => _177.billing]) === false) {
|
|
3996
|
-
params.set("billing", "false");
|
|
3997
|
-
}
|
|
3998
|
-
if (_optionalChain([options, 'optionalAccess', _178 => _178.full]) === true) {
|
|
3999
|
-
params.set("full", "true");
|
|
4000
|
-
}
|
|
4001
|
-
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
4002
|
-
const response = await this.http.get(
|
|
4003
|
-
`/api/v2/runs/${encodeURIComponent(workflowId)}${query}`
|
|
4004
|
-
);
|
|
4005
|
-
return normalizePlayStatus(response);
|
|
4225
|
+
return this.playClient.getPlayStatus(workflowId, options);
|
|
4006
4226
|
}
|
|
4007
|
-
/**
|
|
4227
|
+
/**
|
|
4228
|
+
* Poll authenticated snapshots and emit changes; `deferLogs` delays terminal logs; `omitTerminalLogs` skips them.
|
|
4229
|
+
*/
|
|
4008
4230
|
async *watchRunEvents(workflowId, options) {
|
|
4009
4231
|
for await (const event of watchRunEvents({
|
|
4010
4232
|
http: this.http,
|
|
4011
4233
|
runId: workflowId,
|
|
4012
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
4013
|
-
onNotice: _optionalChain([options, 'optionalAccess',
|
|
4014
|
-
onRetry: _optionalChain([options, 'optionalAccess',
|
|
4234
|
+
signal: _optionalChain([options, 'optionalAccess', _196 => _196.signal]),
|
|
4235
|
+
onNotice: _optionalChain([options, 'optionalAccess', _197 => _197.onNotice]),
|
|
4236
|
+
onRetry: _optionalChain([options, 'optionalAccess', _198 => _198.onRetry]),
|
|
4237
|
+
deferLogs: _optionalChain([options, 'optionalAccess', _199 => _199.deferLogs]),
|
|
4238
|
+
omitTerminalLogs: _optionalChain([options, 'optionalAccess', _200 => _200.omitTerminalLogs]),
|
|
4239
|
+
onPoll: _optionalChain([options, 'optionalAccess', _201 => _201.onPoll]),
|
|
4240
|
+
..._optionalChain([options, 'optionalAccess', _202 => _202.terminalStatus]) ? {
|
|
4241
|
+
terminalStatus: {
|
|
4242
|
+
...options.terminalStatus,
|
|
4243
|
+
onStatus: async (raw, expectedStatus) => {
|
|
4244
|
+
const status = normalizePlayStatus(raw);
|
|
4245
|
+
if (status.runId !== workflowId || status.status !== expectedStatus) {
|
|
4246
|
+
throw new Error(
|
|
4247
|
+
`Run watch returned a mismatched terminal status for ${workflowId}.`
|
|
4248
|
+
);
|
|
4249
|
+
}
|
|
4250
|
+
await _optionalChain([options, 'access', _203 => _203.terminalStatus, 'optionalAccess', _204 => _204.onStatus, 'call', _205 => _205(status)]);
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
} : {}
|
|
4015
4254
|
})) {
|
|
4016
4255
|
yield event;
|
|
4017
4256
|
}
|
|
@@ -4023,12 +4262,12 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4023
4262
|
* @deprecated Use `watchRunEvents` for ordinary run watching.
|
|
4024
4263
|
*/
|
|
4025
4264
|
async *streamPlayRunEvents(workflowId, options) {
|
|
4026
|
-
const headers = _optionalChain([options, 'optionalAccess',
|
|
4265
|
+
const headers = _optionalChain([options, 'optionalAccess', _206 => _206.lastEventId]) && options.lastEventId.trim() ? { "Last-Event-ID": options.lastEventId.trim() } : void 0;
|
|
4027
4266
|
const params = new URLSearchParams();
|
|
4028
|
-
params.set("mode", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4267
|
+
params.set("mode", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _207 => _207.mode]), () => ( "cli")));
|
|
4029
4268
|
for await (const event of this.http.streamSse(
|
|
4030
4269
|
`/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
|
|
4031
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
4270
|
+
{ signal: _optionalChain([options, 'optionalAccess', _208 => _208.signal]), headers }
|
|
4032
4271
|
)) {
|
|
4033
4272
|
if (event.scope === "play") {
|
|
4034
4273
|
yield event;
|
|
@@ -4044,31 +4283,38 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4044
4283
|
*/
|
|
4045
4284
|
async *observeRunEvents(runId, options) {
|
|
4046
4285
|
yield* this.watchRunEvents(runId, {
|
|
4047
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
4048
|
-
onNotice: _optionalChain([options, 'optionalAccess',
|
|
4286
|
+
signal: _optionalChain([options, 'optionalAccess', _209 => _209.signal]),
|
|
4287
|
+
onNotice: _optionalChain([options, 'optionalAccess', _210 => _210.onNotice])
|
|
4049
4288
|
});
|
|
4050
4289
|
}
|
|
4051
4290
|
/** Poll snapshots to terminal status and return the durable package. */
|
|
4052
4291
|
async watchRunToTerminal(runId, options) {
|
|
4053
4292
|
let terminalObserved = false;
|
|
4293
|
+
let terminalStatus = null;
|
|
4054
4294
|
for await (const event of this.watchRunEvents(runId, {
|
|
4055
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
4056
|
-
onNotice: _optionalChain([options, 'optionalAccess',
|
|
4057
|
-
onRetry: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4295
|
+
signal: _optionalChain([options, 'optionalAccess', _211 => _211.signal]),
|
|
4296
|
+
onNotice: _optionalChain([options, 'optionalAccess', _212 => _212.onNotice]),
|
|
4297
|
+
onRetry: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _213 => _213.onRetry]), () => ( _optionalChain([options, 'optionalAccess', _214 => _214.onReconnect]))),
|
|
4298
|
+
terminalStatus: {
|
|
4299
|
+
runStatus: true,
|
|
4300
|
+
onStatus: (status) => {
|
|
4301
|
+
terminalStatus = status;
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4058
4304
|
})) {
|
|
4059
|
-
_optionalChain([options, 'optionalAccess',
|
|
4060
|
-
if (
|
|
4305
|
+
_optionalChain([options, 'optionalAccess', _215 => _215.onEvent, 'optionalCall', _216 => _216(event)]);
|
|
4306
|
+
if (_chunk2H4EY7KHjs.isTerminalPlayRunLifecycleStatus.call(void 0, playLiveRunStatus(event))) {
|
|
4061
4307
|
terminalObserved = true;
|
|
4062
4308
|
}
|
|
4063
4309
|
}
|
|
4064
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4065
|
-
throw new (0,
|
|
4310
|
+
if (_optionalChain([options, 'optionalAccess', _217 => _217.signal, 'optionalAccess', _218 => _218.aborted])) {
|
|
4311
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)("Run watch aborted.", void 0, "ABORTED");
|
|
4066
4312
|
}
|
|
4067
|
-
const refreshed = await this.getRunStatus(runId);
|
|
4068
|
-
if (terminalObserved ||
|
|
4313
|
+
const refreshed = await _asyncNullishCoalesce(terminalStatus, async () => ( await this.getRunStatus(runId)));
|
|
4314
|
+
if (terminalObserved || _chunk2H4EY7KHjs.isTerminalPlayRunLifecycleStatus.call(void 0, refreshed.status)) {
|
|
4069
4315
|
return refreshed;
|
|
4070
4316
|
}
|
|
4071
|
-
throw new (0,
|
|
4317
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4072
4318
|
`Run watch for ${runId} ended before a terminal status.`,
|
|
4073
4319
|
void 0,
|
|
4074
4320
|
"PLAY_WATCH_ENDED"
|
|
@@ -4101,10 +4347,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4101
4347
|
* ```
|
|
4102
4348
|
*/
|
|
4103
4349
|
async cancelPlay(workflowId) {
|
|
4104
|
-
|
|
4105
|
-
`/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
|
|
4106
|
-
{ method: "POST" }
|
|
4107
|
-
);
|
|
4350
|
+
return this.playClient.cancelPlay(workflowId);
|
|
4108
4351
|
}
|
|
4109
4352
|
/**
|
|
4110
4353
|
* Stop a running play execution, including open HITL waits.
|
|
@@ -4113,10 +4356,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4113
4356
|
* @param options.reason - Optional audit/debug reason
|
|
4114
4357
|
*/
|
|
4115
4358
|
async stopPlay(workflowId, options) {
|
|
4116
|
-
return this.
|
|
4117
|
-
`/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
|
|
4118
|
-
_optionalChain([options, 'optionalAccess', _195 => _195.reason]) ? { reason: options.reason } : {}
|
|
4119
|
-
);
|
|
4359
|
+
return this.playClient.stopPlay(workflowId, options);
|
|
4120
4360
|
}
|
|
4121
4361
|
/**
|
|
4122
4362
|
* List recent runs for a named play.
|
|
@@ -4136,11 +4376,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4136
4376
|
* ```
|
|
4137
4377
|
*/
|
|
4138
4378
|
async listPlayRuns(playName) {
|
|
4139
|
-
|
|
4140
|
-
const response = await this.http.get(
|
|
4141
|
-
`/api/v2/plays/${encodedName}/runs`
|
|
4142
|
-
);
|
|
4143
|
-
return _nullishCoalesce(response.runs, () => ( []));
|
|
4379
|
+
return this.playClient.listPlayRuns(playName);
|
|
4144
4380
|
}
|
|
4145
4381
|
// ---------------------------------------------------------------------------
|
|
4146
4382
|
// Legacy workflows (double-shipped). Thin pass-throughs over the live cloud
|
|
@@ -4151,7 +4387,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4151
4387
|
/** List the org's workflows. `GET /api/v2/workflows`. */
|
|
4152
4388
|
async listWorkflows(options) {
|
|
4153
4389
|
const params = new URLSearchParams();
|
|
4154
|
-
if (typeof _optionalChain([options, 'optionalAccess',
|
|
4390
|
+
if (typeof _optionalChain([options, 'optionalAccess', _219 => _219.limit]) === "number") {
|
|
4155
4391
|
params.set("limit", String(options.limit));
|
|
4156
4392
|
}
|
|
4157
4393
|
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
@@ -4204,7 +4440,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4204
4440
|
/** List a workflow's runs. `GET /api/v2/workflows/:id/runs`. */
|
|
4205
4441
|
async listWorkflowRuns(id, options) {
|
|
4206
4442
|
const params = new URLSearchParams();
|
|
4207
|
-
if (typeof _optionalChain([options, 'optionalAccess',
|
|
4443
|
+
if (typeof _optionalChain([options, 'optionalAccess', _220 => _220.limit]) === "number") {
|
|
4208
4444
|
params.set("limit", String(options.limit));
|
|
4209
4445
|
}
|
|
4210
4446
|
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
@@ -4240,10 +4476,10 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4240
4476
|
*/
|
|
4241
4477
|
async getRunStatus(runId, options) {
|
|
4242
4478
|
const params = new URLSearchParams();
|
|
4243
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4479
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.full]) === true) {
|
|
4244
4480
|
params.set("full", "true");
|
|
4245
4481
|
}
|
|
4246
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4482
|
+
if (_optionalChain([options, 'optionalAccess', _222 => _222.configuration]) === true) {
|
|
4247
4483
|
params.set("include", "configuration");
|
|
4248
4484
|
}
|
|
4249
4485
|
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
@@ -4251,15 +4487,15 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4251
4487
|
`/api/v2/runs/${encodeURIComponent(runId)}${query}`,
|
|
4252
4488
|
{ headers: { "x-deepline-run-status": "1" } }
|
|
4253
4489
|
);
|
|
4254
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4255
|
-
throw new (0,
|
|
4490
|
+
if (_optionalChain([options, 'optionalAccess', _223 => _223.configuration]) === true && !Object.hasOwn(response, "contract")) {
|
|
4491
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4256
4492
|
"This server does not support recorded configuration reads.",
|
|
4257
4493
|
void 0,
|
|
4258
4494
|
"RUN_CONFIGURATION_UNAVAILABLE"
|
|
4259
4495
|
);
|
|
4260
4496
|
}
|
|
4261
4497
|
const status = normalizePlayStatus(response);
|
|
4262
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4498
|
+
if (_optionalChain([options, 'optionalAccess', _224 => _224.failedLogs]) !== true || status.status !== "failed") {
|
|
4263
4499
|
return status;
|
|
4264
4500
|
}
|
|
4265
4501
|
const requestedFailedLogLimit = typeof options.failedLogLimit === "number" && Number.isFinite(options.failedLogLimit) ? Math.max(1, Math.floor(options.failedLogLimit)) : RUNS_FAILED_LOG_LIMIT;
|
|
@@ -4303,14 +4539,14 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4303
4539
|
async getRunChildren(parentRunId, options) {
|
|
4304
4540
|
const launchKey = options.launchKey.trim();
|
|
4305
4541
|
if (!launchKey) {
|
|
4306
|
-
throw new (0,
|
|
4542
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4307
4543
|
"runs.children requires a nonempty launchKey.",
|
|
4308
4544
|
void 0,
|
|
4309
4545
|
"INVALID_CHILD_RUN_LAUNCH_KEY"
|
|
4310
4546
|
);
|
|
4311
4547
|
}
|
|
4312
4548
|
if (options.limit !== void 0 && (!Number.isInteger(options.limit) || options.limit < 1 || options.limit > 50)) {
|
|
4313
|
-
throw new (0,
|
|
4549
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4314
4550
|
"runs.children limit must be an integer from 1 to 50.",
|
|
4315
4551
|
void 0,
|
|
4316
4552
|
"INVALID_CHILD_RUN_PAGE_LIMIT"
|
|
@@ -4348,7 +4584,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4348
4584
|
/** The same tenant-scoped run history searched by the dashboard and CLI. */
|
|
4349
4585
|
async getRunsHistory(options = {}) {
|
|
4350
4586
|
const params = new URLSearchParams();
|
|
4351
|
-
const search = _optionalChain([options, 'access',
|
|
4587
|
+
const search = _optionalChain([options, 'access', _225 => _225.search, 'optionalAccess', _226 => _226.trim, 'call', _227 => _227()]);
|
|
4352
4588
|
if (search && search.length > 200) {
|
|
4353
4589
|
throw new Error("Run search must be at most 200 characters.");
|
|
4354
4590
|
}
|
|
@@ -4374,16 +4610,16 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4374
4610
|
}
|
|
4375
4611
|
/** Read one run page without discarding server pagination metadata. */
|
|
4376
4612
|
async listRunsPage(options) {
|
|
4377
|
-
const playName = _optionalChain([options, 'access',
|
|
4613
|
+
const playName = _optionalChain([options, 'access', _228 => _228.play, 'optionalAccess', _229 => _229.trim, 'call', _230 => _230()]);
|
|
4378
4614
|
const params = new URLSearchParams();
|
|
4379
4615
|
if (playName) {
|
|
4380
4616
|
params.set("play", playName);
|
|
4381
4617
|
}
|
|
4382
|
-
const status = _optionalChain([options, 'access',
|
|
4618
|
+
const status = _optionalChain([options, 'access', _231 => _231.status, 'optionalAccess', _232 => _232.trim, 'call', _233 => _233()]);
|
|
4383
4619
|
if (status) {
|
|
4384
4620
|
params.set("status", status);
|
|
4385
4621
|
}
|
|
4386
|
-
const node = _optionalChain([options, 'access',
|
|
4622
|
+
const node = _optionalChain([options, 'access', _234 => _234.node, 'optionalAccess', _235 => _235.trim, 'call', _236 => _236()]);
|
|
4387
4623
|
if (node) {
|
|
4388
4624
|
if (!playName)
|
|
4389
4625
|
throw new Error("runs.list options.node requires options.play.");
|
|
@@ -4457,9 +4693,9 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4457
4693
|
* A different key starts another rerun.
|
|
4458
4694
|
*/
|
|
4459
4695
|
async rerun(runId, options) {
|
|
4460
|
-
const idempotencyKey = _optionalChain([options, 'optionalAccess',
|
|
4461
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4462
|
-
throw new (0,
|
|
4696
|
+
const idempotencyKey = _optionalChain([options, 'optionalAccess', _237 => _237.idempotencyKey, 'optionalAccess', _238 => _238.trim, 'call', _239 => _239()]);
|
|
4697
|
+
if (_optionalChain([options, 'optionalAccess', _240 => _240.idempotencyKey]) !== void 0 && !idempotencyKey) {
|
|
4698
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4463
4699
|
"runs.rerun idempotencyKey must not be empty.",
|
|
4464
4700
|
void 0,
|
|
4465
4701
|
"INVALID_IDEMPOTENCY_KEY"
|
|
@@ -4467,7 +4703,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4467
4703
|
}
|
|
4468
4704
|
return this.http.post(
|
|
4469
4705
|
`/api/v2/runs/${encodeURIComponent(runId)}/rerun`,
|
|
4470
|
-
_optionalChain([options, 'optionalAccess',
|
|
4706
|
+
_optionalChain([options, 'optionalAccess', _241 => _241.inputOverrides]) ? { inputOverrides: options.inputOverrides } : {},
|
|
4471
4707
|
{ "Idempotency-Key": idempotencyKey || globalThis.crypto.randomUUID() }
|
|
4472
4708
|
);
|
|
4473
4709
|
}
|
|
@@ -4481,21 +4717,21 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4481
4717
|
* ```
|
|
4482
4718
|
*/
|
|
4483
4719
|
async getRunLogs(runId, options) {
|
|
4484
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4485
|
-
throw new (0,
|
|
4720
|
+
if (_optionalChain([options, 'optionalAccess', _242 => _242.all]) === true && options.failed === true) {
|
|
4721
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4486
4722
|
"runs.logs cannot combine all and failed views.",
|
|
4487
4723
|
void 0,
|
|
4488
4724
|
"INVALID_RUN_LOG_VIEW"
|
|
4489
4725
|
);
|
|
4490
4726
|
}
|
|
4491
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4492
|
-
throw new (0,
|
|
4727
|
+
if (_optionalChain([options, 'optionalAccess', _243 => _243.cursor]) !== void 0 && options.failed === true) {
|
|
4728
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4493
4729
|
"runs.logs cannot combine failed with cursor.",
|
|
4494
4730
|
void 0,
|
|
4495
4731
|
"INVALID_RUN_LOG_VIEW"
|
|
4496
4732
|
);
|
|
4497
4733
|
}
|
|
4498
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4734
|
+
if (_optionalChain([options, 'optionalAccess', _244 => _244.failed]) === true) {
|
|
4499
4735
|
const requestedLimit = typeof options.limit === "number" && Number.isFinite(options.limit) && options.limit > 0 ? Math.trunc(options.limit) : RUNS_FAILED_LOG_LIMIT;
|
|
4500
4736
|
const failedLimit = Math.min(RUNS_FAILED_LOG_LIMIT, requestedLimit);
|
|
4501
4737
|
const page = await this.http.get(
|
|
@@ -4520,18 +4756,18 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4520
4756
|
...page.logsTruncated ? { logsTruncated: true } : {}
|
|
4521
4757
|
};
|
|
4522
4758
|
}
|
|
4523
|
-
const beforeSequence = _optionalChain([options, 'optionalAccess',
|
|
4524
|
-
const limit = _optionalChain([options, 'optionalAccess',
|
|
4759
|
+
const beforeSequence = _optionalChain([options, 'optionalAccess', _245 => _245.cursor]) !== void 0 ? parseRunLogsCursor(options.cursor) : null;
|
|
4760
|
+
const limit = _optionalChain([options, 'optionalAccess', _246 => _246.all]) ? Number.MAX_SAFE_INTEGER : typeof _optionalChain([options, 'optionalAccess', _247 => _247.limit]) === "number" && Number.isFinite(options.limit) && options.limit > 0 ? Math.trunc(options.limit) : 200;
|
|
4525
4761
|
const fetchPage = (afterSeq2, pageLimit) => this.http.get(
|
|
4526
4762
|
`/api/v2/runs/${encodeURIComponent(runId)}/logs?afterSeq=${afterSeq2}&limit=${pageLimit}`,
|
|
4527
4763
|
{ retryApiErrors: true }
|
|
4528
4764
|
);
|
|
4529
4765
|
const probe = await fetchPage(0, 1);
|
|
4530
4766
|
const lastStoredSeq = probe.lastStoredSeq;
|
|
4531
|
-
const oldestStoredSeq = _nullishCoalesce(_optionalChain([probe, 'access',
|
|
4767
|
+
const oldestStoredSeq = _nullishCoalesce(_optionalChain([probe, 'access', _248 => _248.entries, 'access', _249 => _249[0], 'optionalAccess', _250 => _250.seq]), () => ( null));
|
|
4532
4768
|
const upperSeq = beforeSequence === null ? Number.POSITIVE_INFINITY : Math.min(beforeSequence - 1, lastStoredSeq);
|
|
4533
4769
|
const windowEndSeq = Math.min(upperSeq, lastStoredSeq);
|
|
4534
|
-
let afterSeq = _optionalChain([options, 'optionalAccess',
|
|
4770
|
+
let afterSeq = _optionalChain([options, 'optionalAccess', _251 => _251.all]) ? 0 : Math.max(0, windowEndSeq - limit);
|
|
4535
4771
|
const entries = [];
|
|
4536
4772
|
while (entries.length < limit && afterSeq < upperSeq) {
|
|
4537
4773
|
const page = await fetchPage(
|
|
@@ -4565,7 +4801,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4565
4801
|
hasMore: olderLinesExist,
|
|
4566
4802
|
nextCursor: olderLinesExist ? encodeRunLogsCursor(firstSequence) : null,
|
|
4567
4803
|
entries: entries.map((entry) => entry.line),
|
|
4568
|
-
view: _optionalChain([options, 'optionalAccess',
|
|
4804
|
+
view: _optionalChain([options, 'optionalAccess', _252 => _252.all]) ? "all" : "tail",
|
|
4569
4805
|
...probe.logsTruncated ? { logsTruncated: true } : {}
|
|
4570
4806
|
};
|
|
4571
4807
|
}
|
|
@@ -4639,7 +4875,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4639
4875
|
if (selection !== void 0) {
|
|
4640
4876
|
const runtime = normalizePlayRuntimeSelection(selection);
|
|
4641
4877
|
if (!runtime) {
|
|
4642
|
-
throw new (0,
|
|
4878
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4643
4879
|
"Run event queries require a valid Preview runtime selection.",
|
|
4644
4880
|
void 0,
|
|
4645
4881
|
"INVALID_RUNTIME_SELECTION"
|
|
@@ -4696,7 +4932,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4696
4932
|
if (options.runtime !== void 0) {
|
|
4697
4933
|
const runtime = normalizePlayRuntimeSelection(options.runtime);
|
|
4698
4934
|
if (!runtime) {
|
|
4699
|
-
throw new (0,
|
|
4935
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4700
4936
|
"runs.searchEvents runtime must be a valid Preview selection.",
|
|
4701
4937
|
void 0,
|
|
4702
4938
|
"INVALID_RUNTIME_SELECTION"
|
|
@@ -4741,7 +4977,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4741
4977
|
limit: String(_nullishCoalesce(input.limit, () => ( 5e3))),
|
|
4742
4978
|
offset: String(_nullishCoalesce(input.offset, () => ( 0)))
|
|
4743
4979
|
});
|
|
4744
|
-
if (_optionalChain([input, 'access',
|
|
4980
|
+
if (_optionalChain([input, 'access', _253 => _253.runId, 'optionalAccess', _254 => _254.trim, 'call', _255 => _255()])) {
|
|
4745
4981
|
params.set("runId", input.runId.trim());
|
|
4746
4982
|
}
|
|
4747
4983
|
if (input.rowMode === "all" || input.rowMode === "live") {
|
|
@@ -4751,9 +4987,9 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4751
4987
|
`/api/v2/plays/${encodeURIComponent(input.playName)}/sheet?${params.toString()}`,
|
|
4752
4988
|
{ signal: input.signal }
|
|
4753
4989
|
);
|
|
4754
|
-
const requestedRunId = _optionalChain([input, 'access',
|
|
4990
|
+
const requestedRunId = _optionalChain([input, 'access', _256 => _256.runId, 'optionalAccess', _257 => _257.trim, 'call', _258 => _258()]) || "";
|
|
4755
4991
|
if (requestedRunId) {
|
|
4756
|
-
const confirmedRunId = _optionalChain([result, 'access',
|
|
4992
|
+
const confirmedRunId = _optionalChain([result, 'access', _259 => _259.scope, 'optionalAccess', _260 => _260.kind]) === "run" ? result.scope.runId.trim() : "";
|
|
4757
4993
|
const foreignRowRunIds = [
|
|
4758
4994
|
...new Set(
|
|
4759
4995
|
result.rows.map(
|
|
@@ -4761,8 +4997,8 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4761
4997
|
).filter((runId) => runId && runId !== requestedRunId)
|
|
4762
4998
|
)
|
|
4763
4999
|
];
|
|
4764
|
-
if (_optionalChain([result, 'access',
|
|
4765
|
-
throw new (0,
|
|
5000
|
+
if (_optionalChain([result, 'access', _261 => _261.scope, 'optionalAccess', _262 => _262.kind]) !== "run" || confirmedRunId !== requestedRunId || foreignRowRunIds.length > 0) {
|
|
5001
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4766
5002
|
`Run-scoped dataset export was not confirmed for ${requestedRunId}; no rows were returned to the caller. Update Deepline, then retry the same export command. Do not rerun the play.`,
|
|
4767
5003
|
void 0,
|
|
4768
5004
|
"RUN_EXPORT_SCOPE_MISMATCH",
|
|
@@ -4790,7 +5026,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4790
5026
|
async stopRun(runId, options) {
|
|
4791
5027
|
return this.http.post(
|
|
4792
5028
|
`/api/v2/runs/${encodeURIComponent(runId)}/stop`,
|
|
4793
|
-
_optionalChain([options, 'optionalAccess',
|
|
5029
|
+
_optionalChain([options, 'optionalAccess', _263 => _263.reason]) ? { reason: options.reason } : {}
|
|
4794
5030
|
);
|
|
4795
5031
|
}
|
|
4796
5032
|
/**
|
|
@@ -4808,16 +5044,16 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4808
5044
|
* The method clears workspace run-slot state without requiring each run ID.
|
|
4809
5045
|
*/
|
|
4810
5046
|
async stopAllRuns(options) {
|
|
4811
|
-
const dryRun = _optionalChain([options, 'optionalAccess',
|
|
5047
|
+
const dryRun = _optionalChain([options, 'optionalAccess', _264 => _264.dryRun]) === true;
|
|
4812
5048
|
const result = await this.http.post(
|
|
4813
5049
|
"/api/v2/runs/stop-all",
|
|
4814
5050
|
{
|
|
4815
|
-
..._optionalChain([options, 'optionalAccess',
|
|
5051
|
+
..._optionalChain([options, 'optionalAccess', _265 => _265.reason]) ? { reason: options.reason } : {},
|
|
4816
5052
|
...dryRun ? { dryRun: true } : {}
|
|
4817
5053
|
}
|
|
4818
5054
|
);
|
|
4819
5055
|
if (dryRun && !isStopAllPlayRunsDryRunResult(result)) {
|
|
4820
|
-
throw new (0,
|
|
5056
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
4821
5057
|
"This Deepline server does not support runs stop-all --dry-run and performed a real stop-all. Update the server before using --dry-run.",
|
|
4822
5058
|
void 0,
|
|
4823
5059
|
"STOP_ALL_DRY_RUN_UNSUPPORTED"
|
|
@@ -4833,7 +5069,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4833
5069
|
* `origin: "owned"` for org-owned plays.
|
|
4834
5070
|
*/
|
|
4835
5071
|
async listPlays(options) {
|
|
4836
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
5072
|
+
if (!_optionalChain([options, 'optionalAccess', _266 => _266.grep, 'optionalAccess', _267 => _267.trim, 'call', _268 => _268()])) {
|
|
4837
5073
|
return (await this.requestPlaysPage(options, false)).plays;
|
|
4838
5074
|
}
|
|
4839
5075
|
const plays = [];
|
|
@@ -4855,45 +5091,45 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4855
5091
|
}
|
|
4856
5092
|
async requestPlaysPage(options, paginateInventory = true) {
|
|
4857
5093
|
const params = new URLSearchParams();
|
|
4858
|
-
if (paginateInventory && !_optionalChain([options, 'optionalAccess',
|
|
5094
|
+
if (paginateInventory && !_optionalChain([options, 'optionalAccess', _269 => _269.grep, 'optionalAccess', _270 => _270.trim, 'call', _271 => _271()]))
|
|
4859
5095
|
params.set("inventory_paginated", "1");
|
|
4860
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4861
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5096
|
+
if (_optionalChain([options, 'optionalAccess', _272 => _272.origin])) params.set("origin", options.origin);
|
|
5097
|
+
if (_optionalChain([options, 'optionalAccess', _273 => _273.categories])) {
|
|
4862
5098
|
params.set(
|
|
4863
5099
|
"categories",
|
|
4864
5100
|
Array.isArray(options.categories) ? options.categories.join(",") : options.categories
|
|
4865
5101
|
);
|
|
4866
5102
|
}
|
|
4867
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5103
|
+
if (_optionalChain([options, 'optionalAccess', _274 => _274.categories]) || _optionalChain([options, 'optionalAccess', _275 => _275.includeToolCategories])) {
|
|
4868
5104
|
params.set("include_tool_categories", "1");
|
|
4869
5105
|
}
|
|
4870
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5106
|
+
if (_optionalChain([options, 'optionalAccess', _276 => _276.tags])) {
|
|
4871
5107
|
params.set(
|
|
4872
5108
|
"tags",
|
|
4873
5109
|
Array.isArray(options.tags) ? options.tags.join(",") : options.tags
|
|
4874
5110
|
);
|
|
4875
5111
|
}
|
|
4876
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4877
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5112
|
+
if (_optionalChain([options, 'optionalAccess', _277 => _277.includeArchived])) params.set("include_archived", "1");
|
|
5113
|
+
if (_optionalChain([options, 'optionalAccess', _278 => _278.includeCostEstimates])) {
|
|
4878
5114
|
params.set("include_cost_estimates", "1");
|
|
4879
5115
|
}
|
|
4880
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5116
|
+
if (_optionalChain([options, 'optionalAccess', _279 => _279.grep, 'optionalAccess', _280 => _280.trim, 'call', _281 => _281()])) {
|
|
4881
5117
|
params.set("grep", options.grep.trim());
|
|
4882
5118
|
params.set("limit", "60");
|
|
4883
5119
|
}
|
|
4884
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5120
|
+
if (_optionalChain([options, 'optionalAccess', _282 => _282.limit]) !== void 0) {
|
|
4885
5121
|
if (!Number.isSafeInteger(options.limit) || options.limit < 1) {
|
|
4886
5122
|
throw new Error("Play page limit must be a positive integer");
|
|
4887
5123
|
}
|
|
4888
5124
|
params.set("limit", String(options.limit));
|
|
4889
5125
|
}
|
|
4890
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5126
|
+
if (_optionalChain([options, 'optionalAccess', _283 => _283.cursor])) params.set("cursor", options.cursor);
|
|
4891
5127
|
const suffix = params.size ? `?${params.toString()}` : "";
|
|
4892
5128
|
const response = await this.http.get(`/api/v2/plays${suffix}`);
|
|
4893
5129
|
return {
|
|
4894
5130
|
plays: _nullishCoalesce(response.plays, () => ( [])),
|
|
4895
|
-
cursor: _nullishCoalesce(_nullishCoalesce(_optionalChain([response, 'access',
|
|
4896
|
-
hasMore: Boolean(_nullishCoalesce(_optionalChain([response, 'access',
|
|
5131
|
+
cursor: _nullishCoalesce(_nullishCoalesce(_optionalChain([response, 'access', _284 => _284.pagination, 'optionalAccess', _285 => _285.cursor]), () => ( response.cursor)), () => ( null)),
|
|
5132
|
+
hasMore: Boolean(_nullishCoalesce(_optionalChain([response, 'access', _286 => _286.pagination, 'optionalAccess', _287 => _287.hasMore]), () => ( response.hasMore)))
|
|
4897
5133
|
};
|
|
4898
5134
|
}
|
|
4899
5135
|
/** Read definition-level settings, independently of code revisions. */
|
|
@@ -4950,8 +5186,8 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
4950
5186
|
return this.http.post("/api/v2/integrations/connect", {
|
|
4951
5187
|
provider: "slack",
|
|
4952
5188
|
scopes: [...PRODUCT_NOTIFICATION_SLACK_OAUTH_SCOPES],
|
|
4953
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4954
|
-
..._optionalChain([options, 'optionalAccess',
|
|
5189
|
+
..._optionalChain([options, 'optionalAccess', _288 => _288.successUrl]) ? { success_url: options.successUrl } : {},
|
|
5190
|
+
..._optionalChain([options, 'optionalAccess', _289 => _289.failureUrl]) ? { failure_url: options.failureUrl } : {}
|
|
4955
5191
|
});
|
|
4956
5192
|
}
|
|
4957
5193
|
/** List Slack channels visible to the connected Deepline Slack app. */
|
|
@@ -5026,7 +5262,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5026
5262
|
}
|
|
5027
5263
|
const targets = input.targets.map(parseNotificationGroupTarget);
|
|
5028
5264
|
const legacyEvents = _nullishCoalesce(input.legacyEvents, () => ( []));
|
|
5029
|
-
const legacyTarget = targets.length === 1 && _optionalChain([targets, 'access',
|
|
5265
|
+
const legacyTarget = targets.length === 1 && _optionalChain([targets, 'access', _290 => _290[0], 'optionalAccess', _291 => _291.kind]) === "slack" && legacyEvents.length > 0 ? targets[0] : null;
|
|
5030
5266
|
if (legacyEvents.length > 0 && !legacyTarget) {
|
|
5031
5267
|
throw new Error(
|
|
5032
5268
|
"--for is supported only by the legacy one-Slack-target form. Create the group first, then add rules in notification configuration."
|
|
@@ -5062,7 +5298,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5062
5298
|
const existingGroup = current.configuration.groups.find(
|
|
5063
5299
|
(candidate) => candidate.name.toLowerCase() === name.toLowerCase()
|
|
5064
5300
|
);
|
|
5065
|
-
const groupKey = _nullishCoalesce(_optionalChain([existingGroup, 'optionalAccess',
|
|
5301
|
+
const groupKey = _nullishCoalesce(_optionalChain([existingGroup, 'optionalAccess', _292 => _292.groupKey]), () => ( notificationObjectKey("group")));
|
|
5066
5302
|
const group = _nullishCoalesce(existingGroup, () => ( {
|
|
5067
5303
|
groupKey,
|
|
5068
5304
|
name,
|
|
@@ -5251,7 +5487,10 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5251
5487
|
}
|
|
5252
5488
|
);
|
|
5253
5489
|
const plays = (_nullishCoalesce(response.plays, () => ( []))).map(
|
|
5254
|
-
(play) => _chunkKXMNM4AQjs.describePlayListItem.call(void 0, play, {
|
|
5490
|
+
(play) => _chunkKXMNM4AQjs.describePlayListItem.call(void 0, play, {
|
|
5491
|
+
...options,
|
|
5492
|
+
pipeline: _nullishCoalesce(options.pipeline, () => ( true))
|
|
5493
|
+
})
|
|
5255
5494
|
);
|
|
5256
5495
|
if (scope === "prebuilt") {
|
|
5257
5496
|
return plays.filter(isPrebuiltPlayDescription);
|
|
@@ -5278,14 +5517,12 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5278
5517
|
* ```
|
|
5279
5518
|
*/
|
|
5280
5519
|
async getPlay(name, options) {
|
|
5281
|
-
|
|
5282
|
-
const query = _optionalChain([options, 'optionalAccess', _270 => _270.source]) ? `?include=source&revision=${encodeURIComponent(options.source)}` : _optionalChain([options, 'optionalAccess', _271 => _271.guidance]) ? "?include=guidance" : "";
|
|
5283
|
-
return this.http.get(`/api/v2/plays/${encodedName}${query}`);
|
|
5520
|
+
return this.playClient.getPlay(name, options);
|
|
5284
5521
|
}
|
|
5285
5522
|
/** Read one trigger inventory page without loading run histories. */
|
|
5286
5523
|
async listPlayTriggerInventory(options) {
|
|
5287
5524
|
const params = new URLSearchParams({ view: "inventory" });
|
|
5288
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5525
|
+
if (_optionalChain([options, 'optionalAccess', _293 => _293.cursor])) params.set("cursor", options.cursor);
|
|
5289
5526
|
return this.http.get(`/api/v2/plays/triggers?${params}`);
|
|
5290
5527
|
}
|
|
5291
5528
|
/** Read one trigger's recent runs, with an explicit partial-history flag. */
|
|
@@ -5294,7 +5531,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5294
5531
|
view: "history",
|
|
5295
5532
|
binding_id: bindingId
|
|
5296
5533
|
});
|
|
5297
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5534
|
+
if (_optionalChain([options, 'optionalAccess', _294 => _294.limit]) !== void 0)
|
|
5298
5535
|
params.set("history_limit", String(options.limit));
|
|
5299
5536
|
return this.http.get(`/api/v2/plays/triggers?${params}`);
|
|
5300
5537
|
}
|
|
@@ -5326,11 +5563,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5326
5563
|
* the play definition or revisions.
|
|
5327
5564
|
*/
|
|
5328
5565
|
async clearPlayHistory(name, request = {}) {
|
|
5329
|
-
|
|
5330
|
-
return this.http.post(
|
|
5331
|
-
`/api/v2/plays/${encodedName}/history/clear`,
|
|
5332
|
-
request
|
|
5333
|
-
);
|
|
5566
|
+
return this.playClient.clearPlayHistory(name, request);
|
|
5334
5567
|
}
|
|
5335
5568
|
/**
|
|
5336
5569
|
* List saved versions for a named play.
|
|
@@ -5342,12 +5575,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5342
5575
|
* @returns Version list (newest first)
|
|
5343
5576
|
*/
|
|
5344
5577
|
async listPlayVersions(name, options) {
|
|
5345
|
-
|
|
5346
|
-
const suffix = _optionalChain([options, 'optionalAccess', _274 => _274.full]) ? "?full=true" : "";
|
|
5347
|
-
const response = await this.http.get(
|
|
5348
|
-
`/api/v2/plays/${encodedName}/versions${suffix}`
|
|
5349
|
-
);
|
|
5350
|
-
return _nullishCoalesce(response.versions, () => ( []));
|
|
5578
|
+
return this.playClient.listPlayVersions(name, options);
|
|
5351
5579
|
}
|
|
5352
5580
|
/**
|
|
5353
5581
|
* Make a play revision live.
|
|
@@ -5368,11 +5596,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5368
5596
|
* ```
|
|
5369
5597
|
*/
|
|
5370
5598
|
async publishPlayVersion(name, request = {}) {
|
|
5371
|
-
|
|
5372
|
-
return this.http.post(
|
|
5373
|
-
`/api/v2/plays/${encodedName}/live`,
|
|
5374
|
-
request
|
|
5375
|
-
);
|
|
5599
|
+
return this.playClient.publishPlayVersion(name, request);
|
|
5376
5600
|
}
|
|
5377
5601
|
/**
|
|
5378
5602
|
* Move an org-owned play to Trash. This disables its active triggers while
|
|
@@ -5495,14 +5719,14 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5495
5719
|
*/
|
|
5496
5720
|
async runPlay(code, csvPath, name, options) {
|
|
5497
5721
|
const { workflowId } = await this.submitPlay(code, csvPath, name, {
|
|
5498
|
-
input: _optionalChain([options, 'optionalAccess',
|
|
5499
|
-
sourceCode: _optionalChain([options, 'optionalAccess',
|
|
5500
|
-
artifact: _optionalChain([options, 'optionalAccess',
|
|
5501
|
-
compilerManifest: _optionalChain([options, 'optionalAccess',
|
|
5502
|
-
inputFile: _optionalChain([options, 'optionalAccess',
|
|
5503
|
-
packagedFiles: _optionalChain([options, 'optionalAccess',
|
|
5504
|
-
force: _optionalChain([options, 'optionalAccess',
|
|
5505
|
-
forceToolRefresh: _optionalChain([options, 'optionalAccess',
|
|
5722
|
+
input: _optionalChain([options, 'optionalAccess', _295 => _295.input]),
|
|
5723
|
+
sourceCode: _optionalChain([options, 'optionalAccess', _296 => _296.sourceCode]),
|
|
5724
|
+
artifact: _optionalChain([options, 'optionalAccess', _297 => _297.artifact]),
|
|
5725
|
+
compilerManifest: _optionalChain([options, 'optionalAccess', _298 => _298.compilerManifest]),
|
|
5726
|
+
inputFile: _optionalChain([options, 'optionalAccess', _299 => _299.inputFile]),
|
|
5727
|
+
packagedFiles: _optionalChain([options, 'optionalAccess', _300 => _300.packagedFiles]),
|
|
5728
|
+
force: _optionalChain([options, 'optionalAccess', _301 => _301.force]),
|
|
5729
|
+
forceToolRefresh: _optionalChain([options, 'optionalAccess', _302 => _302.forceToolRefresh])
|
|
5506
5730
|
});
|
|
5507
5731
|
const start = Date.now();
|
|
5508
5732
|
const state = {
|
|
@@ -5513,7 +5737,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5513
5737
|
latest: null
|
|
5514
5738
|
};
|
|
5515
5739
|
let terminalObserved = null;
|
|
5516
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5740
|
+
if (_optionalChain([options, 'optionalAccess', _303 => _303.signal, 'optionalAccess', _304 => _304.aborted])) {
|
|
5517
5741
|
await this.cancelPlay(workflowId);
|
|
5518
5742
|
return {
|
|
5519
5743
|
success: false,
|
|
@@ -5524,9 +5748,9 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5524
5748
|
};
|
|
5525
5749
|
}
|
|
5526
5750
|
for await (const event of this.watchRunEvents(workflowId, {
|
|
5527
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
5751
|
+
signal: _optionalChain([options, 'optionalAccess', _305 => _305.signal])
|
|
5528
5752
|
})) {
|
|
5529
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5753
|
+
if (_optionalChain([options, 'optionalAccess', _306 => _306.signal, 'optionalAccess', _307 => _307.aborted])) {
|
|
5530
5754
|
await this.cancelPlay(workflowId);
|
|
5531
5755
|
return {
|
|
5532
5756
|
success: false,
|
|
@@ -5536,19 +5760,19 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5536
5760
|
error: "Cancelled by user"
|
|
5537
5761
|
};
|
|
5538
5762
|
}
|
|
5539
|
-
const previousStatus = _optionalChain([state, 'access',
|
|
5763
|
+
const previousStatus = _optionalChain([state, 'access', _308 => _308.latest, 'optionalAccess', _309 => _309.status]);
|
|
5540
5764
|
const status = updatePlayLiveStatusState(state, event);
|
|
5541
5765
|
if (!status) {
|
|
5542
5766
|
continue;
|
|
5543
5767
|
}
|
|
5544
5768
|
if (event.type !== "play.run.status" || status.status !== previousStatus) {
|
|
5545
|
-
_optionalChain([options, 'optionalAccess',
|
|
5769
|
+
_optionalChain([options, 'optionalAccess', _310 => _310.onProgress, 'optionalCall', _311 => _311(status)]);
|
|
5546
5770
|
}
|
|
5547
|
-
if (
|
|
5771
|
+
if (_chunk2H4EY7KHjs.isTerminalPlayRunLifecycleStatus.call(void 0, status.status)) {
|
|
5548
5772
|
terminalObserved = status;
|
|
5549
5773
|
}
|
|
5550
5774
|
}
|
|
5551
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5775
|
+
if (_optionalChain([options, 'optionalAccess', _312 => _312.signal, 'optionalAccess', _313 => _313.aborted])) {
|
|
5552
5776
|
await this.cancelPlay(workflowId);
|
|
5553
5777
|
return {
|
|
5554
5778
|
success: false,
|
|
@@ -5564,7 +5788,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5564
5788
|
).catch(() => terminalObserved);
|
|
5565
5789
|
return playRunResultFromStatus(finalStatus, start, workflowId);
|
|
5566
5790
|
}
|
|
5567
|
-
throw new (0,
|
|
5791
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5568
5792
|
`Run watch for ${workflowId} ended before the run reached a terminal state.`,
|
|
5569
5793
|
void 0,
|
|
5570
5794
|
"PLAY_RUN_STREAM_ENDED",
|
|
@@ -5592,7 +5816,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5592
5816
|
async getBillingUsageEvent(requestId) {
|
|
5593
5817
|
const normalizedRequestId = requestId.trim();
|
|
5594
5818
|
if (normalizedRequestId.length === 0 || normalizedRequestId.length > 200 || normalizedRequestId !== requestId) {
|
|
5595
|
-
throw new (0,
|
|
5819
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5596
5820
|
"Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
|
|
5597
5821
|
void 0,
|
|
5598
5822
|
"INVALID_USAGE_REQUEST_ID"
|
|
@@ -5601,9 +5825,9 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5601
5825
|
const response = await this.http.get(
|
|
5602
5826
|
`/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`
|
|
5603
5827
|
);
|
|
5604
|
-
const event = _optionalChain([response, 'access',
|
|
5828
|
+
const event = _optionalChain([response, 'access', _314 => _314.entries, 'optionalAccess', _315 => _315[0]]);
|
|
5605
5829
|
if (!event) {
|
|
5606
|
-
throw new (0,
|
|
5830
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5607
5831
|
"No usage event was found for this request_id.",
|
|
5608
5832
|
void 0,
|
|
5609
5833
|
"USAGE_EVENT_NOT_FOUND"
|
|
@@ -5632,14 +5856,14 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5632
5856
|
if (options.requestId !== void 0) {
|
|
5633
5857
|
const requestId = options.requestId.trim();
|
|
5634
5858
|
if (requestId.length === 0 || requestId.length > 200 || requestId !== options.requestId) {
|
|
5635
|
-
throw new (0,
|
|
5859
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5636
5860
|
"Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
|
|
5637
5861
|
void 0,
|
|
5638
5862
|
"INVALID_USAGE_REQUEST_ID"
|
|
5639
5863
|
);
|
|
5640
5864
|
}
|
|
5641
5865
|
if (options.runId !== void 0 || options.cursor !== void 0 || options.offset !== void 0) {
|
|
5642
|
-
throw new (0,
|
|
5866
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5643
5867
|
"requestId cannot be combined with runId, cursor, or offset.",
|
|
5644
5868
|
void 0,
|
|
5645
5869
|
"INVALID_USAGE_FILTERS"
|
|
@@ -5732,7 +5956,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5732
5956
|
async cancelBillingSubscription(options) {
|
|
5733
5957
|
return this.http.post(
|
|
5734
5958
|
"/api/v2/billing/subscription/cancel",
|
|
5735
|
-
{ action: _optionalChain([options, 'optionalAccess',
|
|
5959
|
+
{ action: _optionalChain([options, 'optionalAccess', _316 => _316.undo]) ? "undo_cancel" : "cancel" }
|
|
5736
5960
|
);
|
|
5737
5961
|
}
|
|
5738
5962
|
/**
|
|
@@ -5744,7 +5968,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5744
5968
|
*/
|
|
5745
5969
|
async listBillingInvoices(options) {
|
|
5746
5970
|
const params = new URLSearchParams();
|
|
5747
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5971
|
+
if (_optionalChain([options, 'optionalAccess', _317 => _317.limit]) !== void 0) {
|
|
5748
5972
|
params.set("limit", String(options.limit));
|
|
5749
5973
|
}
|
|
5750
5974
|
const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
|
|
@@ -5802,7 +6026,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5802
6026
|
/** Recover only the original workspace, credit amount, and purchase key; never charge. */
|
|
5803
6027
|
async recoverTargetBillingCreditPurchase(options) {
|
|
5804
6028
|
if (typeof options.idempotencyKey !== "string") {
|
|
5805
|
-
throw new (0,
|
|
6029
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5806
6030
|
"The original billing idempotencyKey is required.",
|
|
5807
6031
|
void 0,
|
|
5808
6032
|
"INVALID_BILLING_IDEMPOTENCY_KEY"
|
|
@@ -5812,14 +6036,14 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5812
6036
|
options.idempotencyKey
|
|
5813
6037
|
);
|
|
5814
6038
|
if (!Number.isSafeInteger(options.credits) || options.credits <= 0) {
|
|
5815
|
-
throw new (0,
|
|
6039
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5816
6040
|
"credits must be a positive safe integer.",
|
|
5817
6041
|
void 0,
|
|
5818
6042
|
"INVALID_CREDITS"
|
|
5819
6043
|
);
|
|
5820
6044
|
}
|
|
5821
6045
|
if (typeof options.orgId !== "string" || !options.orgId.trim() || options.orgId !== options.orgId.trim()) {
|
|
5822
|
-
throw new (0,
|
|
6046
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5823
6047
|
"The original orgId is required without surrounding whitespace.",
|
|
5824
6048
|
void 0,
|
|
5825
6049
|
"INVALID_ORG_ID"
|
|
@@ -5854,7 +6078,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5854
6078
|
/** Create a Stripe-hosted portal session for payment recovery and invoices. */
|
|
5855
6079
|
async createTargetBillingPortalSession(options) {
|
|
5856
6080
|
const response = await this.http.post(
|
|
5857
|
-
_optionalChain([options, 'optionalAccess',
|
|
6081
|
+
_optionalChain([options, 'optionalAccess', _318 => _318.flow]) === "customer_update" ? "/api/v2/billing/portal-sessions?flow=customer_update" : "/api/v2/billing/portal-sessions",
|
|
5858
6082
|
{}
|
|
5859
6083
|
);
|
|
5860
6084
|
return response.data;
|
|
@@ -5904,8 +6128,8 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5904
6128
|
return this.http.request("/api/v2/monitors/audit", {
|
|
5905
6129
|
method: "POST",
|
|
5906
6130
|
body: {
|
|
5907
|
-
..._optionalChain([options, 'optionalAccess',
|
|
5908
|
-
..._optionalChain([options, 'optionalAccess',
|
|
6131
|
+
..._optionalChain([options, 'optionalAccess', _319 => _319.fleetId]) ? { fleet_id: options.fleetId } : {},
|
|
6132
|
+
..._optionalChain([options, 'optionalAccess', _320 => _320.cursor]) ? { cursor: options.cursor } : {}
|
|
5909
6133
|
},
|
|
5910
6134
|
maxRetries: 0
|
|
5911
6135
|
});
|
|
@@ -5915,8 +6139,8 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5915
6139
|
return this.http.request("/api/v2/monitors/repair", {
|
|
5916
6140
|
method: "POST",
|
|
5917
6141
|
body: {
|
|
5918
|
-
..._optionalChain([options, 'optionalAccess',
|
|
5919
|
-
..._optionalChain([options, 'optionalAccess',
|
|
6142
|
+
..._optionalChain([options, 'optionalAccess', _321 => _321.fleetId]) ? { fleet_id: options.fleetId } : {},
|
|
6143
|
+
..._optionalChain([options, 'optionalAccess', _322 => _322.dryRun]) === void 0 ? {} : { dry_run: options.dryRun }
|
|
5920
6144
|
},
|
|
5921
6145
|
maxRetries: 0
|
|
5922
6146
|
});
|
|
@@ -5924,7 +6148,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5924
6148
|
/** Delivery and convergence health. Prefer `client.monitors.health(...)`. */
|
|
5925
6149
|
async readMonitorsHealth(options) {
|
|
5926
6150
|
const params = new URLSearchParams();
|
|
5927
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6151
|
+
if (_optionalChain([options, 'optionalAccess', _323 => _323.fleetId])) params.set("fleet_id", options.fleetId);
|
|
5928
6152
|
const query = params.toString();
|
|
5929
6153
|
const suffix = query ? `?${query}` : "";
|
|
5930
6154
|
return this.http.request(
|
|
@@ -5936,7 +6160,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5936
6160
|
async submitMonitorBatch(options) {
|
|
5937
6161
|
const idempotencyKey = options.idempotencyKey.trim();
|
|
5938
6162
|
if (!idempotencyKey) {
|
|
5939
|
-
throw new (0,
|
|
6163
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5940
6164
|
"Monitor batch idempotencyKey is required.",
|
|
5941
6165
|
void 0,
|
|
5942
6166
|
"INVALID_MONITOR_BATCH_IDEMPOTENCY_KEY"
|
|
@@ -5944,7 +6168,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5944
6168
|
}
|
|
5945
6169
|
if (options.kind === "deploy") {
|
|
5946
6170
|
if (!options.manifestNdjson.trim()) {
|
|
5947
|
-
throw new (0,
|
|
6171
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5948
6172
|
"Monitor batch deploy requires a non-empty NDJSON manifest.",
|
|
5949
6173
|
void 0,
|
|
5950
6174
|
"INVALID_MONITOR_BATCH_MANIFEST"
|
|
@@ -5990,14 +6214,14 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
5990
6214
|
async getMonitorBatch(operationId, options) {
|
|
5991
6215
|
const runId = operationId.trim();
|
|
5992
6216
|
if (!runId) {
|
|
5993
|
-
throw new (0,
|
|
6217
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
5994
6218
|
"Monitor batch operation id is required.",
|
|
5995
6219
|
void 0,
|
|
5996
6220
|
"INVALID_MONITOR_BATCH_OPERATION_ID"
|
|
5997
6221
|
);
|
|
5998
6222
|
}
|
|
5999
6223
|
const params = new URLSearchParams();
|
|
6000
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6224
|
+
if (_optionalChain([options, 'optionalAccess', _324 => _324.cursor])) params.set("cursor", options.cursor);
|
|
6001
6225
|
const suffix = params.size > 0 ? `?${params}` : "";
|
|
6002
6226
|
return this.http.request(
|
|
6003
6227
|
`/api/v2/monitors/batch/${encodeURIComponent(runId)}${suffix}`,
|
|
@@ -6041,7 +6265,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6041
6265
|
* `client.monitors.deploy(...)`.
|
|
6042
6266
|
*/
|
|
6043
6267
|
async deployMonitor(definition, options) {
|
|
6044
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6268
|
+
if (_optionalChain([options, 'optionalAccess', _325 => _325.dryRun])) {
|
|
6045
6269
|
return this.http.request("/api/v2/monitors/check", {
|
|
6046
6270
|
method: "POST",
|
|
6047
6271
|
body: definition
|
|
@@ -6077,12 +6301,12 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6077
6301
|
/** List deployed monitors. Prefer `client.monitors.list(...)`. */
|
|
6078
6302
|
async listMonitors(options) {
|
|
6079
6303
|
const params = new URLSearchParams();
|
|
6080
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6081
|
-
else if (_optionalChain([options, 'optionalAccess',
|
|
6082
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6304
|
+
if (_optionalChain([options, 'optionalAccess', _326 => _326.state])) params.set("state", options.state);
|
|
6305
|
+
else if (_optionalChain([options, 'optionalAccess', _327 => _327.status])) params.set("status", options.status);
|
|
6306
|
+
if (_optionalChain([options, 'optionalAccess', _328 => _328.limit]) !== void 0)
|
|
6083
6307
|
params.set("limit", String(options.limit));
|
|
6084
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6085
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6308
|
+
if (_optionalChain([options, 'optionalAccess', _329 => _329.cursor])) params.set("cursor", options.cursor);
|
|
6309
|
+
if (_optionalChain([options, 'optionalAccess', _330 => _330.includeConsumers])) params.set("include_consumers", "true");
|
|
6086
6310
|
const query = params.toString();
|
|
6087
6311
|
const suffix = query ? `?${query}` : "";
|
|
6088
6312
|
return this.http.request(
|
|
@@ -6098,8 +6322,8 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6098
6322
|
);
|
|
6099
6323
|
}
|
|
6100
6324
|
async testMonitorWebhook(key, payload, options) {
|
|
6101
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6102
|
-
throw new (0,
|
|
6325
|
+
if (_optionalChain([options, 'optionalAccess', _331 => _331.dispatch]) === true || _optionalChain([options, 'optionalAccess', _332 => _332.validationOnly]) === false) {
|
|
6326
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
6103
6327
|
"Monitor tests are validation-only and cannot dispatch events.",
|
|
6104
6328
|
void 0,
|
|
6105
6329
|
"MONITOR_TEST_DISPATCH_NOT_SUPPORTED"
|
|
@@ -6153,19 +6377,19 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6153
6377
|
}
|
|
6154
6378
|
/** Delete a deployed monitor and its upstream provider resource. `dryRun` returns the delete plan. Prefer `client.monitors.delete(...)`. */
|
|
6155
6379
|
async deleteMonitor(key, options) {
|
|
6156
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6157
|
-
throw new (0,
|
|
6380
|
+
if (_optionalChain([options, 'optionalAccess', _333 => _333.localOnly]) === true) {
|
|
6381
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
6158
6382
|
"localOnly monitor deletion is no longer supported. Monitor deletion always deprovisions the upstream provider resource.",
|
|
6159
6383
|
void 0,
|
|
6160
6384
|
"MONITOR_LOCAL_ONLY_DELETE_NOT_SUPPORTED"
|
|
6161
6385
|
);
|
|
6162
6386
|
}
|
|
6163
6387
|
const params = new URLSearchParams();
|
|
6164
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6388
|
+
if (_optionalChain([options, 'optionalAccess', _334 => _334.dryRun])) params.set("dry_run", "true");
|
|
6165
6389
|
const query = params.toString();
|
|
6166
6390
|
return this.http.request(
|
|
6167
6391
|
`/api/v2/monitors/deployed/${encodeURIComponent(key)}${query ? `?${query}` : ""}`,
|
|
6168
|
-
_optionalChain([options, 'optionalAccess',
|
|
6392
|
+
_optionalChain([options, 'optionalAccess', _335 => _335.dryRun]) ? { method: "DELETE" } : {
|
|
6169
6393
|
method: "DELETE",
|
|
6170
6394
|
// Deletion is a provider lifecycle operation. A timeout is an
|
|
6171
6395
|
// unknown outcome, not authority to begin another delete attempt.
|
|
@@ -6178,10 +6402,10 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6178
6402
|
* Prefer `client.monitors.reactivate(...)`.
|
|
6179
6403
|
*/
|
|
6180
6404
|
async reactivateMonitor(key, options) {
|
|
6181
|
-
const query = _optionalChain([options, 'optionalAccess',
|
|
6405
|
+
const query = _optionalChain([options, 'optionalAccess', _336 => _336.dryRun]) ? "?dry_run=true" : "";
|
|
6182
6406
|
return this.http.request(
|
|
6183
6407
|
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/reactivate${query}`,
|
|
6184
|
-
_optionalChain([options, 'optionalAccess',
|
|
6408
|
+
_optionalChain([options, 'optionalAccess', _337 => _337.dryRun]) ? { method: "POST", body: {} } : {
|
|
6185
6409
|
method: "POST",
|
|
6186
6410
|
body: {},
|
|
6187
6411
|
// Reactivation can create an upstream resource, so it must not use
|
|
@@ -6195,7 +6419,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6195
6419
|
// ——————————————————————————————————————————————————————————
|
|
6196
6420
|
static __initStatic() {this.MONITOR_JOB_IDEMPOTENCY_KEY_MAX_LENGTH = 96}
|
|
6197
6421
|
monitorJobIdempotencyKey(operation) {
|
|
6198
|
-
const uuid = _nullishCoalesce(_optionalChain([globalThis, 'access',
|
|
6422
|
+
const uuid = _nullishCoalesce(_optionalChain([globalThis, 'access', _338 => _338.crypto, 'optionalAccess', _339 => _339.randomUUID, 'optionalCall', _340 => _340()]), () => ( `${Date.now()}-${Math.random().toString(36).slice(2)}`));
|
|
6199
6423
|
const prefix = "monitor-job-";
|
|
6200
6424
|
const safeOperation = operation.replace(/[^A-Za-z0-9._-]/g, "-");
|
|
6201
6425
|
const maxOperationLength = Math.max(
|
|
@@ -6206,7 +6430,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6206
6430
|
}
|
|
6207
6431
|
monitorJobHeaders(operation, idempotencyKey) {
|
|
6208
6432
|
return {
|
|
6209
|
-
"Idempotency-Key": _optionalChain([idempotencyKey, 'optionalAccess',
|
|
6433
|
+
"Idempotency-Key": _optionalChain([idempotencyKey, 'optionalAccess', _341 => _341.trim, 'call', _342 => _342()]) || this.monitorJobIdempotencyKey(operation)
|
|
6210
6434
|
};
|
|
6211
6435
|
}
|
|
6212
6436
|
async deployMonitorBatch(definitions, options) {
|
|
@@ -6217,7 +6441,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6217
6441
|
body: { version: 1, kind: "batch", monitors: definitions },
|
|
6218
6442
|
headers: this.monitorJobHeaders(
|
|
6219
6443
|
"batch-deploy",
|
|
6220
|
-
_optionalChain([options, 'optionalAccess',
|
|
6444
|
+
_optionalChain([options, 'optionalAccess', _343 => _343.idempotencyKey])
|
|
6221
6445
|
),
|
|
6222
6446
|
maxRetries: 0,
|
|
6223
6447
|
exactUrlOnly: true
|
|
@@ -6236,11 +6460,11 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6236
6460
|
version: 1,
|
|
6237
6461
|
kind: "batch",
|
|
6238
6462
|
monitors: definitions,
|
|
6239
|
-
..._optionalChain([options, 'optionalAccess',
|
|
6463
|
+
..._optionalChain([options, 'optionalAccess', _344 => _344.expectedGeneration]) === void 0 ? {} : { expected_generation: options.expectedGeneration }
|
|
6240
6464
|
},
|
|
6241
6465
|
headers: this.monitorJobHeaders(
|
|
6242
6466
|
`batch-sync-${batchId}`,
|
|
6243
|
-
_optionalChain([options, 'optionalAccess',
|
|
6467
|
+
_optionalChain([options, 'optionalAccess', _345 => _345.idempotencyKey])
|
|
6244
6468
|
),
|
|
6245
6469
|
maxRetries: 0,
|
|
6246
6470
|
exactUrlOnly: true
|
|
@@ -6255,7 +6479,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6255
6479
|
body: {},
|
|
6256
6480
|
headers: this.monitorJobHeaders(
|
|
6257
6481
|
`batch-start-${batchId}`,
|
|
6258
|
-
_optionalChain([options, 'optionalAccess',
|
|
6482
|
+
_optionalChain([options, 'optionalAccess', _346 => _346.idempotencyKey])
|
|
6259
6483
|
),
|
|
6260
6484
|
maxRetries: 0,
|
|
6261
6485
|
exactUrlOnly: true
|
|
@@ -6270,7 +6494,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6270
6494
|
body: {},
|
|
6271
6495
|
headers: this.monitorJobHeaders(
|
|
6272
6496
|
`batch-stop-${batchId}`,
|
|
6273
|
-
_optionalChain([options, 'optionalAccess',
|
|
6497
|
+
_optionalChain([options, 'optionalAccess', _347 => _347.idempotencyKey])
|
|
6274
6498
|
),
|
|
6275
6499
|
maxRetries: 0,
|
|
6276
6500
|
exactUrlOnly: true
|
|
@@ -6291,7 +6515,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6291
6515
|
body: {},
|
|
6292
6516
|
headers: this.monitorJobHeaders(
|
|
6293
6517
|
`${action}-${monitorKey}`,
|
|
6294
|
-
_optionalChain([options, 'optionalAccess',
|
|
6518
|
+
_optionalChain([options, 'optionalAccess', _348 => _348.idempotencyKey])
|
|
6295
6519
|
),
|
|
6296
6520
|
maxRetries: 0,
|
|
6297
6521
|
exactUrlOnly: true
|
|
@@ -6304,7 +6528,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6304
6528
|
body: definition,
|
|
6305
6529
|
headers: this.monitorJobHeaders(
|
|
6306
6530
|
`sync-${definition.key}`,
|
|
6307
|
-
_optionalChain([options, 'optionalAccess',
|
|
6531
|
+
_optionalChain([options, 'optionalAccess', _349 => _349.idempotencyKey])
|
|
6308
6532
|
),
|
|
6309
6533
|
maxRetries: 0,
|
|
6310
6534
|
exactUrlOnly: true
|
|
@@ -6317,7 +6541,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6317
6541
|
);
|
|
6318
6542
|
}
|
|
6319
6543
|
async getMonitorJobLogs(jobId, options) {
|
|
6320
|
-
const query = _optionalChain([options, 'optionalAccess',
|
|
6544
|
+
const query = _optionalChain([options, 'optionalAccess', _350 => _350.limit]) === void 0 ? "" : `?limit=${encodeURIComponent(String(options.limit))}`;
|
|
6321
6545
|
return this.http.request(
|
|
6322
6546
|
`/api/v2/monitors/jobs/${encodeURIComponent(jobId)}/logs${query}`,
|
|
6323
6547
|
{ method: "GET" }
|
|
@@ -6330,15 +6554,15 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6330
6554
|
);
|
|
6331
6555
|
}
|
|
6332
6556
|
async waitForMonitorJob(jobId, options) {
|
|
6333
|
-
const timeoutMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6334
|
-
const pollIntervalMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6557
|
+
const timeoutMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _351 => _351.timeoutMs]), () => ( 10 * 6e4)));
|
|
6558
|
+
const pollIntervalMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _352 => _352.pollIntervalMs]), () => ( 2e3)));
|
|
6335
6559
|
const terminal = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled"]);
|
|
6336
6560
|
const startedAt = Date.now();
|
|
6337
6561
|
let latest = await this.getMonitorJob(jobId);
|
|
6338
6562
|
while (true) {
|
|
6339
|
-
_optionalChain([options, 'optionalAccess',
|
|
6563
|
+
_optionalChain([options, 'optionalAccess', _353 => _353.onProgress, 'optionalCall', _354 => _354(latest)]);
|
|
6340
6564
|
const job = latest.job;
|
|
6341
|
-
const state = typeof _optionalChain([job, 'optionalAccess',
|
|
6565
|
+
const state = typeof _optionalChain([job, 'optionalAccess', _355 => _355.state]) === "string" ? job.state : void 0;
|
|
6342
6566
|
if (state && terminal.has(state)) return latest;
|
|
6343
6567
|
if (Date.now() - startedAt >= timeoutMs) return latest;
|
|
6344
6568
|
await sleep(pollIntervalMs);
|
|
@@ -6349,12 +6573,12 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6349
6573
|
// Monitor Fleets
|
|
6350
6574
|
// ——————————————————————————————————————————————————————————
|
|
6351
6575
|
monitorFleetIdempotencyKey(operation) {
|
|
6352
|
-
const uuid = _optionalChain([globalThis, 'access',
|
|
6576
|
+
const uuid = _optionalChain([globalThis, 'access', _356 => _356.crypto, 'optionalAccess', _357 => _357.randomUUID, 'optionalCall', _358 => _358()]);
|
|
6353
6577
|
return `monitor-fleet-${operation}-${_nullishCoalesce(uuid, () => ( `${Date.now()}-${Math.random().toString(36).slice(2)}`))}`;
|
|
6354
6578
|
}
|
|
6355
6579
|
monitorFleetHeaders(operation, idempotencyKey) {
|
|
6356
6580
|
return {
|
|
6357
|
-
"Idempotency-Key": _optionalChain([idempotencyKey, 'optionalAccess',
|
|
6581
|
+
"Idempotency-Key": _optionalChain([idempotencyKey, 'optionalAccess', _359 => _359.trim, 'call', _360 => _360()]) || this.monitorFleetIdempotencyKey(operation)
|
|
6358
6582
|
};
|
|
6359
6583
|
}
|
|
6360
6584
|
monitorFleetPath(fleetId) {
|
|
@@ -6374,15 +6598,15 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6374
6598
|
const fleetId = typeof definitionOrId === "string" ? definitionOrId : definitionOrId.id;
|
|
6375
6599
|
const body = {
|
|
6376
6600
|
...typeof definitionOrId === "string" ? {} : { definition: definitionOrId },
|
|
6377
|
-
..._optionalChain([options, 'optionalAccess',
|
|
6378
|
-
..._optionalChain([options, 'optionalAccess',
|
|
6601
|
+
..._optionalChain([options, 'optionalAccess', _361 => _361.dryRun]) ? { dry_run: true } : {},
|
|
6602
|
+
..._optionalChain([options, 'optionalAccess', _362 => _362.expectedGeneration]) !== void 0 ? { expected_generation: options.expectedGeneration } : {}
|
|
6379
6603
|
};
|
|
6380
6604
|
return this.http.request(
|
|
6381
6605
|
this.monitorFleetPath(fleetId),
|
|
6382
6606
|
{
|
|
6383
6607
|
method: "PUT",
|
|
6384
6608
|
body,
|
|
6385
|
-
headers: this.monitorFleetHeaders("sync", _optionalChain([options, 'optionalAccess',
|
|
6609
|
+
headers: this.monitorFleetHeaders("sync", _optionalChain([options, 'optionalAccess', _363 => _363.idempotencyKey])),
|
|
6386
6610
|
maxRetries: 0,
|
|
6387
6611
|
exactUrlOnly: true
|
|
6388
6612
|
}
|
|
@@ -6395,8 +6619,8 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6395
6619
|
}
|
|
6396
6620
|
async getMonitorFleet(fleetId, options) {
|
|
6397
6621
|
const params = new URLSearchParams();
|
|
6398
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6399
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6622
|
+
if (_optionalChain([options, 'optionalAccess', _364 => _364.drift])) params.set("drift", "1");
|
|
6623
|
+
if (_optionalChain([options, 'optionalAccess', _365 => _365.limit]) !== void 0)
|
|
6400
6624
|
params.set("limit", String(options.limit));
|
|
6401
6625
|
const query = params.toString();
|
|
6402
6626
|
return this.http.request(
|
|
@@ -6409,10 +6633,10 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6409
6633
|
this.monitorFleetPath(fleetId),
|
|
6410
6634
|
{
|
|
6411
6635
|
method: "DELETE",
|
|
6412
|
-
body: _optionalChain([options, 'optionalAccess',
|
|
6636
|
+
body: _optionalChain([options, 'optionalAccess', _366 => _366.dryRun]) ? { dry_run: true } : {},
|
|
6413
6637
|
headers: this.monitorFleetHeaders(
|
|
6414
6638
|
"deactivate",
|
|
6415
|
-
_optionalChain([options, 'optionalAccess',
|
|
6639
|
+
_optionalChain([options, 'optionalAccess', _367 => _367.idempotencyKey])
|
|
6416
6640
|
),
|
|
6417
6641
|
maxRetries: 0,
|
|
6418
6642
|
exactUrlOnly: true
|
|
@@ -6427,7 +6651,7 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6427
6651
|
body: {},
|
|
6428
6652
|
headers: this.monitorFleetHeaders(
|
|
6429
6653
|
"reactivate",
|
|
6430
|
-
_optionalChain([options, 'optionalAccess',
|
|
6654
|
+
_optionalChain([options, 'optionalAccess', _368 => _368.idempotencyKey])
|
|
6431
6655
|
),
|
|
6432
6656
|
maxRetries: 0,
|
|
6433
6657
|
exactUrlOnly: true
|
|
@@ -6444,13 +6668,13 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6444
6668
|
* identical to "the request failed".
|
|
6445
6669
|
*/
|
|
6446
6670
|
async waitForMonitorFleetConvergence(fleetId, options) {
|
|
6447
|
-
const timeoutMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6448
|
-
const pollIntervalMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6449
|
-
const terminal = _optionalChain([options, 'optionalAccess',
|
|
6671
|
+
const timeoutMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _369 => _369.timeoutMs]), () => ( 10 * 6e4)));
|
|
6672
|
+
const pollIntervalMs = Math.max(1, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _370 => _370.pollIntervalMs]), () => ( 2e3)));
|
|
6673
|
+
const terminal = _optionalChain([options, 'optionalAccess', _371 => _371.until]) === "deactivated" ? /* @__PURE__ */ new Set(["deactivated", "degraded"]) : /* @__PURE__ */ new Set(["converged", "degraded", "deactivated"]);
|
|
6450
6674
|
const startedAt = Date.now();
|
|
6451
6675
|
let latest = await this.getMonitorFleet(fleetId);
|
|
6452
6676
|
while (true) {
|
|
6453
|
-
_optionalChain([options, 'optionalAccess',
|
|
6677
|
+
_optionalChain([options, 'optionalAccess', _372 => _372.onProgress, 'optionalCall', _373 => _373(latest)]);
|
|
6454
6678
|
const status = typeof latest.status === "string" ? latest.status : void 0;
|
|
6455
6679
|
if (status && terminal.has(status)) return latest;
|
|
6456
6680
|
if (Date.now() - startedAt >= timeoutMs) return latest;
|
|
@@ -6510,4 +6734,6 @@ var DeeplineClient = (_class = class _DeeplineClient {
|
|
|
6510
6734
|
|
|
6511
6735
|
|
|
6512
6736
|
|
|
6513
|
-
|
|
6737
|
+
|
|
6738
|
+
|
|
6739
|
+
exports.iterateCursorPages = iterateCursorPages; exports.requireBillingIdempotencyKey = requireBillingIdempotencyKey; exports.planCustomerDbQuery = planCustomerDbQuery; exports.validateExecutionIdempotencyKey = validateExecutionIdempotencyKey; exports.normalizePlayStatus = normalizePlayStatus; exports.createPlayClient = createPlayClient; exports.PRODUCT_NOTIFICATION_EVENT_CATALOG = PRODUCT_NOTIFICATION_EVENT_CATALOG; exports.resolveLegacySlackNotification = resolveLegacySlackNotification; exports.RUN_EVENT_SEARCH_KIND_VALUES = RUN_EVENT_SEARCH_KIND_VALUES; exports.logProvenanceReaches = logProvenanceReaches; exports.logLevelReaches = logLevelReaches; exports.parseLogLevel = parseLogLevel; exports.classifyLogLine = classifyLogLine; exports.isTransientPlayRunReadError = isTransientPlayRunReadError; exports.encodeRunLogsCursor = encodeRunLogsCursor; exports.isRunLogsCursor = isRunLogsCursor; exports.RunEventQueryInputError = RunEventQueryInputError; exports.normalizeRunEventOperationRequest = normalizeRunEventOperationRequest; exports.isStopAllPlayRunsDryRunResult = isStopAllPlayRunsDryRunResult; exports.MONITOR_JOB_STATES = MONITOR_JOB_STATES; exports.MONITOR_JOB_PHASES = MONITOR_JOB_PHASES; exports.MONITOR_JOB_RECONCILIATION_STATES = MONITOR_JOB_RECONCILIATION_STATES; exports.DeeplineClient = DeeplineClient;
|