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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkPPDBRJRWjs = require('./chunk-PPDBRJRW.js');
|
|
4
4
|
|
|
5
5
|
// node_modules/csv-parse/dist/esm/sync.js
|
|
6
6
|
var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
@@ -3000,7 +3000,7 @@ function parseCsvDataInput(source, content, options = {}) {
|
|
|
3000
3000
|
} : {}
|
|
3001
3001
|
});
|
|
3002
3002
|
} catch (error) {
|
|
3003
|
-
throw new (0,
|
|
3003
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
3004
3004
|
`Input ${source.inputPath} could not be parsed as CSV (${source.value}): ${error instanceof Error ? error.message : String(error)}. This usually means an unclosed quote or ragged quoting. No run was created.`,
|
|
3005
3005
|
void 0,
|
|
3006
3006
|
"PLAY_INPUT_FILE_PREFLIGHT",
|
|
@@ -3008,7 +3008,7 @@ function parseCsvDataInput(source, content, options = {}) {
|
|
|
3008
3008
|
);
|
|
3009
3009
|
}
|
|
3010
3010
|
if (records.length === 0) {
|
|
3011
|
-
throw new (0,
|
|
3011
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
3012
3012
|
`${source.value} is empty: it has no header row and no data rows. No run was created.`,
|
|
3013
3013
|
void 0,
|
|
3014
3014
|
"PLAY_INPUT_FILE_PREFLIGHT",
|
|
@@ -3023,7 +3023,7 @@ function parseCsvDataInput(source, content, options = {}) {
|
|
|
3023
3023
|
if (name.length === 0) continue;
|
|
3024
3024
|
const prior = seen.get(name);
|
|
3025
3025
|
if (prior) {
|
|
3026
|
-
throw new (0,
|
|
3026
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
3027
3027
|
`Input ${source.inputPath} (${source.value}) has a duplicate CSV header "${name}" (columns ${prior.index + 1} and ${i + 1}). The second column would silently overwrite the first. Rename one of them. No run was created.`,
|
|
3028
3028
|
void 0,
|
|
3029
3029
|
"PLAY_INPUT_FILE_PREFLIGHT",
|
|
@@ -3039,7 +3039,7 @@ function parseCsvDataInput(source, content, options = {}) {
|
|
|
3039
3039
|
seen.set(name, { index: i, raw });
|
|
3040
3040
|
}
|
|
3041
3041
|
if (records.length - 1 < 1) {
|
|
3042
|
-
throw new (0,
|
|
3042
|
+
throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
|
|
3043
3043
|
`${source.value} has a header row but no data rows. No run was created.`,
|
|
3044
3044
|
void 0,
|
|
3045
3045
|
"PLAY_INPUT_FILE_PREFLIGHT",
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import {
|
|
2
|
+
canAutomaticallyApplyUpdatePlan,
|
|
3
|
+
compareUpdateVersions,
|
|
4
|
+
resolveUpdatePlan,
|
|
5
|
+
runAutomaticUpdatePlan,
|
|
6
|
+
shouldRunCliAutoUpdate
|
|
7
|
+
} from "./chunk-QL22Y56M.mjs";
|
|
8
|
+
import {
|
|
9
|
+
isCiEnvironment
|
|
10
|
+
} from "./chunk-XIHWSXSV.mjs";
|
|
11
|
+
import {
|
|
12
|
+
addJsonNotice,
|
|
13
|
+
isJsonOutputMode
|
|
14
|
+
} from "./chunk-5V5Y37BC.mjs";
|
|
15
|
+
import {
|
|
16
|
+
SDK_VERSION,
|
|
17
|
+
resolveApiKeyForBaseUrl
|
|
18
|
+
} from "./chunk-RFB25DSQ.mjs";
|
|
19
|
+
|
|
20
|
+
// src/cli/compatibility-catalog.ts
|
|
21
|
+
var readers = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
function registerCompatibilityCatalog(command, read) {
|
|
23
|
+
readers.set(command, read);
|
|
24
|
+
}
|
|
25
|
+
function compatibilityCatalog(command) {
|
|
26
|
+
return readers.get(command)?.();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/cli/self-update.ts
|
|
30
|
+
import { spawn } from "child_process";
|
|
31
|
+
var AUTO_UPDATE_TELEMETRY_TIMEOUT_MS = 2e3;
|
|
32
|
+
var TRUSTED_AUTO_UPDATE_ORIGIN = "https://code.deepline.com";
|
|
33
|
+
function trustedAutoUpdateRegistryUrl(baseUrl) {
|
|
34
|
+
try {
|
|
35
|
+
const url = new URL(baseUrl);
|
|
36
|
+
if (url.origin !== TRUSTED_AUTO_UPDATE_ORIGIN) return null;
|
|
37
|
+
return new URL("/api/v2/npm/", url.origin).toString();
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function reportAutoUpdateEvent(input) {
|
|
43
|
+
let apiKey = "";
|
|
44
|
+
try {
|
|
45
|
+
apiKey = resolveApiKeyForBaseUrl(input.baseUrl);
|
|
46
|
+
} catch {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!apiKey) return;
|
|
50
|
+
const controller = new AbortController();
|
|
51
|
+
const timeout = setTimeout(
|
|
52
|
+
() => controller.abort(),
|
|
53
|
+
AUTO_UPDATE_TELEMETRY_TIMEOUT_MS
|
|
54
|
+
);
|
|
55
|
+
try {
|
|
56
|
+
await fetch(new URL("/api/v2/telemetry/auto-update", input.baseUrl), {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: `Bearer ${apiKey}`,
|
|
60
|
+
"Content-Type": "application/json",
|
|
61
|
+
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
62
|
+
"X-Deepline-Client-Family": "sdk",
|
|
63
|
+
"X-Deepline-CLI-Family": "sdk",
|
|
64
|
+
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
65
|
+
"X-Deepline-SDK-Version": SDK_VERSION
|
|
66
|
+
},
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
event: input.event,
|
|
69
|
+
current_version: input.response.current?.trim() || SDK_VERSION,
|
|
70
|
+
target_version: input.response.latest,
|
|
71
|
+
reason: input.response.auto_update?.reason,
|
|
72
|
+
command: input.response.command ?? null,
|
|
73
|
+
install_kind: input.installKind,
|
|
74
|
+
...input.exitCode === void 0 ? {} : { exit_code: input.exitCode }
|
|
75
|
+
}),
|
|
76
|
+
signal: controller.signal
|
|
77
|
+
});
|
|
78
|
+
} catch {
|
|
79
|
+
} finally {
|
|
80
|
+
clearTimeout(timeout);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function envTruthy(name) {
|
|
84
|
+
const value = process.env[name]?.trim().toLowerCase();
|
|
85
|
+
return value === "1" || value === "true" || value === "yes";
|
|
86
|
+
}
|
|
87
|
+
function shouldSkipSelfUpdate(policy) {
|
|
88
|
+
return policy === "off" || envTruthy("DEEPLINE_SKIP_SELF_UPDATE") || envTruthy("DEEPLINE_NO_AUTO_UPDATE") || envTruthy("DEEPLINE_SKIP_SDK_AUTO_UPDATE") || envTruthy("DEEPLINE_DISABLE_AUTO_UPDATE") || !shouldRunCliAutoUpdate() || isCiEnvironment();
|
|
89
|
+
}
|
|
90
|
+
function isDowngradeAutoUpdateResponse(response) {
|
|
91
|
+
const target = response?.latest?.trim();
|
|
92
|
+
const current = response?.current?.trim() || SDK_VERSION;
|
|
93
|
+
if (!target) return false;
|
|
94
|
+
return compareUpdateVersions(target, current) < 0;
|
|
95
|
+
}
|
|
96
|
+
function relaunchCurrentCommand(plan, runtime = {}) {
|
|
97
|
+
return new Promise((resolve) => {
|
|
98
|
+
const command = plan.kind === "python-sidecar" ? plan.sidecarPath : runtime.execPath ?? process.execPath;
|
|
99
|
+
const argv = runtime.argv ?? process.argv;
|
|
100
|
+
const args = plan.kind === "python-sidecar" ? argv.slice(2) : argv.slice(1);
|
|
101
|
+
const platform = runtime.platform ?? process.platform;
|
|
102
|
+
const child = spawn(command, args, {
|
|
103
|
+
stdio: "inherit",
|
|
104
|
+
// The Node executable is a native binary and must be spawned directly;
|
|
105
|
+
// passing `C:\Program Files\...\node.exe` through cmd.exe splits it
|
|
106
|
+
// at the first space. The Python-sidecar launcher is a `.cmd` file on
|
|
107
|
+
// Windows and still needs the shell dispatch it has always used.
|
|
108
|
+
shell: plan.kind === "python-sidecar" && platform === "win32",
|
|
109
|
+
env: {
|
|
110
|
+
...process.env,
|
|
111
|
+
DEEPLINE_NO_AUTO_UPDATE: "1"
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
child.on("error", (error) => {
|
|
115
|
+
process.stderr.write(
|
|
116
|
+
`Deepline SDK/CLI updated, but relaunch failed: ${error.message}
|
|
117
|
+
`
|
|
118
|
+
);
|
|
119
|
+
resolve(1);
|
|
120
|
+
});
|
|
121
|
+
child.on("close", (code) => resolve(code ?? 1));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
var deferredAutoUpdate = null;
|
|
125
|
+
function hasDeferredAutoUpdate() {
|
|
126
|
+
return deferredAutoUpdate !== null;
|
|
127
|
+
}
|
|
128
|
+
async function runDeferredAutoUpdate() {
|
|
129
|
+
const apply = deferredAutoUpdate;
|
|
130
|
+
deferredAutoUpdate = null;
|
|
131
|
+
try {
|
|
132
|
+
await apply?.();
|
|
133
|
+
} catch (error) {
|
|
134
|
+
process.stderr.write(
|
|
135
|
+
`Deepline SDK/CLI auto-update failed: ${error instanceof Error ? error.message : String(error)}
|
|
136
|
+
`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async function maybeAutoUpdateAndRelaunch(response, baseUrl, policy = "configured") {
|
|
141
|
+
const autoUpdate = response?.auto_update;
|
|
142
|
+
if (!response || !autoUpdate?.should_auto_update || shouldSkipSelfUpdate(policy)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
if (isDowngradeAutoUpdateResponse(response)) {
|
|
146
|
+
const target = response.latest;
|
|
147
|
+
const current = response.current?.trim() || SDK_VERSION;
|
|
148
|
+
process.stderr.write(
|
|
149
|
+
`Deepline SDK/CLI auto-update refused: server advertised older ${target} than current ${current}. Continuing without mutating the CLI.
|
|
150
|
+
`
|
|
151
|
+
);
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const packageSpec = response.latest ? `deepline@${response.latest}` : void 0;
|
|
155
|
+
const plan = resolveUpdatePlan({
|
|
156
|
+
packageSpec,
|
|
157
|
+
requireVerifiedNpmOwnership: true,
|
|
158
|
+
npmFallbackRegistryUrl: trustedAutoUpdateRegistryUrl(baseUrl)
|
|
159
|
+
});
|
|
160
|
+
if (!canAutomaticallyApplyUpdatePlan(plan)) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
if (!autoUpdate.required && autoUpdate.reason !== "rollback_forced") {
|
|
164
|
+
deferredAutoUpdate = async () => {
|
|
165
|
+
await applyAutoUpdate(response, baseUrl, plan, "next_command");
|
|
166
|
+
};
|
|
167
|
+
if (isJsonOutputMode()) {
|
|
168
|
+
const target = response.latest?.trim();
|
|
169
|
+
addJsonNotice({
|
|
170
|
+
code: "sdk_update_queued",
|
|
171
|
+
message: `Deepline SDK/CLI update${target ? ` to ${target}` : ""} is queued after this command; the next command will use it if installation succeeds.`
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if (!await applyAutoUpdate(response, baseUrl, plan, "rerun")) return false;
|
|
177
|
+
const exitCode = await relaunchCurrentCommand(plan);
|
|
178
|
+
process.exit(exitCode);
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
async function applyAutoUpdate(response, baseUrl, plan, takesEffect) {
|
|
182
|
+
if (!canAutomaticallyApplyUpdatePlan(plan)) return false;
|
|
183
|
+
const autoUpdate = response.auto_update;
|
|
184
|
+
const label = autoUpdate?.reason === "rollback_forced" ? "has a server rollback pending and needs the latest rollback-aware CLI" : autoUpdate?.reason === "deprecated" ? "is deprecated and will update automatically" : autoUpdate?.required ? "requires an update" : "has an update available and will update automatically";
|
|
185
|
+
process.stderr.write(
|
|
186
|
+
`Deepline SDK/CLI ${label}; running ${plan.manualCommand}
|
|
187
|
+
`
|
|
188
|
+
);
|
|
189
|
+
void reportAutoUpdateEvent({
|
|
190
|
+
baseUrl,
|
|
191
|
+
response,
|
|
192
|
+
event: "started",
|
|
193
|
+
installKind: plan.kind
|
|
194
|
+
});
|
|
195
|
+
const updateResult = await runAutomaticUpdatePlan(plan);
|
|
196
|
+
if (updateResult.status === "skipped_previous_failure") {
|
|
197
|
+
void reportAutoUpdateEvent({
|
|
198
|
+
baseUrl,
|
|
199
|
+
response,
|
|
200
|
+
event: "skipped_previous_failure",
|
|
201
|
+
installKind: plan.kind,
|
|
202
|
+
exitCode: updateResult.exitCode
|
|
203
|
+
});
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
if (updateResult.exitCode !== 0) {
|
|
207
|
+
void reportAutoUpdateEvent({
|
|
208
|
+
baseUrl,
|
|
209
|
+
response,
|
|
210
|
+
event: "failed",
|
|
211
|
+
installKind: plan.kind,
|
|
212
|
+
exitCode: updateResult.exitCode
|
|
213
|
+
});
|
|
214
|
+
if (autoUpdate?.required) {
|
|
215
|
+
throw new Error(
|
|
216
|
+
`Automatic Deepline SDK/CLI update failed with exit code ${updateResult.exitCode}. ${response.message}`
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
process.stderr.write(
|
|
220
|
+
`Deepline SDK/CLI auto-update failed with exit code ${updateResult.exitCode}; continuing with ${response.current ?? "current version"}.
|
|
221
|
+
`
|
|
222
|
+
);
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
void reportAutoUpdateEvent({
|
|
226
|
+
baseUrl,
|
|
227
|
+
response,
|
|
228
|
+
event: "succeeded",
|
|
229
|
+
installKind: plan.kind,
|
|
230
|
+
exitCode: 0
|
|
231
|
+
});
|
|
232
|
+
const updateSummary = response.update_summary ? `
|
|
233
|
+
What changed in ${response.update_summary.version}: ${response.update_summary.summary}` : "";
|
|
234
|
+
process.stderr.write(
|
|
235
|
+
`${takesEffect === "rerun" ? "Deepline SDK/CLI updated; rerunning command." : `Deepline SDK/CLI updated to ${response.latest}; the next command uses it.`}${updateSummary}
|
|
236
|
+
`
|
|
237
|
+
);
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/cli/tool-execute-observability.ts
|
|
242
|
+
import { randomUUID } from "crypto";
|
|
243
|
+
var TOOL_EXECUTE_PROGRESS_INTERVAL_MS = 15e3;
|
|
244
|
+
var activeToolExecuteCommand = null;
|
|
245
|
+
function progressLine(line) {
|
|
246
|
+
if (!isJsonOutputMode()) console.error(line);
|
|
247
|
+
}
|
|
248
|
+
function beginToolExecuteCommand() {
|
|
249
|
+
if (activeToolExecuteCommand) return activeToolExecuteCommand.invocationId;
|
|
250
|
+
const invocationId = randomUUID();
|
|
251
|
+
activeToolExecuteCommand = {
|
|
252
|
+
invocationId,
|
|
253
|
+
startedAt: performance.now()
|
|
254
|
+
};
|
|
255
|
+
progressLine(`[tools execute ${invocationId}] started`);
|
|
256
|
+
return invocationId;
|
|
257
|
+
}
|
|
258
|
+
function getToolExecuteInvocationId() {
|
|
259
|
+
return activeToolExecuteCommand?.invocationId ?? null;
|
|
260
|
+
}
|
|
261
|
+
async function runToolExecuteStage(stage, action) {
|
|
262
|
+
const command = activeToolExecuteCommand;
|
|
263
|
+
if (!command) return action();
|
|
264
|
+
const startedAt = performance.now();
|
|
265
|
+
const elapsedMs = () => Math.round(performance.now() - startedAt);
|
|
266
|
+
progressLine(`[tools execute ${command.invocationId}] ${stage} started`);
|
|
267
|
+
const progressTimer = setInterval(() => {
|
|
268
|
+
progressLine(
|
|
269
|
+
`[tools execute ${command.invocationId}] ${stage} still running (${elapsedMs()}ms)`
|
|
270
|
+
);
|
|
271
|
+
}, TOOL_EXECUTE_PROGRESS_INTERVAL_MS);
|
|
272
|
+
progressTimer.unref?.();
|
|
273
|
+
try {
|
|
274
|
+
const result = await action();
|
|
275
|
+
if (result === false) {
|
|
276
|
+
progressLine(
|
|
277
|
+
`[tools execute ${command.invocationId}] ${stage} failed after ${elapsedMs()}ms`
|
|
278
|
+
);
|
|
279
|
+
} else {
|
|
280
|
+
progressLine(
|
|
281
|
+
`[tools execute ${command.invocationId}] ${stage} completed in ${elapsedMs()}ms`
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
return result;
|
|
285
|
+
} catch (error) {
|
|
286
|
+
progressLine(
|
|
287
|
+
`[tools execute ${command.invocationId}] ${stage} failed after ${elapsedMs()}ms`
|
|
288
|
+
);
|
|
289
|
+
throw error;
|
|
290
|
+
} finally {
|
|
291
|
+
clearInterval(progressTimer);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function finishToolExecuteCommand() {
|
|
295
|
+
const command = activeToolExecuteCommand;
|
|
296
|
+
if (!command) return;
|
|
297
|
+
progressLine(
|
|
298
|
+
`[tools execute ${command.invocationId}] finished in ${Math.round(performance.now() - command.startedAt)}ms`
|
|
299
|
+
);
|
|
300
|
+
activeToolExecuteCommand = null;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export {
|
|
304
|
+
registerCompatibilityCatalog,
|
|
305
|
+
compatibilityCatalog,
|
|
306
|
+
hasDeferredAutoUpdate,
|
|
307
|
+
runDeferredAutoUpdate,
|
|
308
|
+
maybeAutoUpdateAndRelaunch,
|
|
309
|
+
beginToolExecuteCommand,
|
|
310
|
+
getToolExecuteInvocationId,
|
|
311
|
+
runToolExecuteStage,
|
|
312
|
+
finishToolExecuteCommand
|
|
313
|
+
};
|