deepline 0.3.534 → 0.3.536
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client-core.ts +254 -147
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/plays/local-file-discovery.ts +27 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +16 -5
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +2 -23
- package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +26 -14
- package/dist/bundling-sources/shared_libs/integration-contracts/monitor-input-contract.ts +33 -8
- package/dist/bundling-sources/shared_libs/monitors/fleets/count-drift-alert.ts +121 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +14 -82
- package/dist/bundling-sources/shared_libs/monitors/package.json +1 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +4 -4
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -26
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +21 -31
- package/dist/bundling-sources/shared_libs/play-runtime/call-requeue-state-machine.ts +420 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +727 -102
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-retry-policy.ts +624 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -10
- package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +71 -2
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +60 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +372 -10
- package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +15 -2
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/fixture-capacity-simulator.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts +6 -2
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +5 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +63 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +31 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +11 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +73 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +169 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +26 -4
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +90 -49
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +136 -30
- package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +13 -1
- package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +68 -1
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +63 -13
- package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +57 -1
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +22 -9
- package/dist/cli/auth-6XQKFOLG.js +43 -0
- package/dist/cli/{auth-MHQYIMVX.mjs → auth-KCTCUO7P.mjs} +7 -7
- package/dist/cli/{billing-YQLNP4S5.js → billing-4VBGZ3CT.js} +273 -112
- package/dist/cli/{billing-LX2PSBJ4.mjs → billing-OOJHKLNS.mjs} +185 -24
- package/dist/cli/{chunk-DGKTHWWH.js → chunk-2B4IOGFD.js} +406 -382
- package/dist/cli/{chunk-MQORQ7WL.js → chunk-2FCSUOYN.js} +55 -55
- package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
- package/dist/cli/{chunk-6IFZPEJE.mjs → chunk-2YWJS76L.mjs} +1 -1
- package/dist/cli/{chunk-E7TP25I2.mjs → chunk-3PCYV6ZJ.mjs} +2 -2
- package/dist/cli/{chunk-LGRZCHKC.js → chunk-4E5JXZ3W.js} +18 -20
- package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
- package/dist/cli/{chunk-SUWTLXCV.js → chunk-6BBGUQJJ.js} +67 -146
- package/dist/cli/{chunk-JBBJDFUJ.js → chunk-6VUGBQZQ.js} +5 -5
- package/dist/cli/{chunk-2P3NVX65.mjs → chunk-AB2GBOD4.mjs} +40 -27
- package/dist/cli/{chunk-62SOZ67Y.mjs → chunk-ANUKBZ6W.mjs} +475 -11
- package/dist/cli/{chunk-MG6YL4M7.mjs → chunk-BASLYGXK.mjs} +101 -77
- package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
- package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
- package/dist/cli/{chunk-RH3YRMUY.js → chunk-CIDN5K23.js} +1 -1
- package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
- package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
- package/dist/cli/{chunk-UWNVFAFN.js → chunk-CWSLUNA6.js} +33 -33
- package/dist/cli/{chunk-5FXMEEF4.mjs → chunk-CXTW7SRW.mjs} +67 -146
- package/dist/cli/{chunk-O53LHONF.mjs → chunk-DA2I2M7D.mjs} +2 -2
- package/dist/cli/{chunk-EYXUAJAU.mjs → chunk-DQHUJMCL.mjs} +5 -5
- package/dist/cli/{chunk-7GFR5Y4J.mjs → chunk-DUYAMLOC.mjs} +1 -1
- package/dist/cli/{chunk-OMVVHX4U.mjs → chunk-E24UGPGG.mjs} +13 -15
- package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
- package/dist/cli/{chunk-KJVY7V2X.mjs → chunk-GF32SBST.mjs} +1 -1
- package/dist/cli/{chunk-AK622KIG.mjs → chunk-GHLDCLSC.mjs} +1 -1
- package/dist/cli/{chunk-A6HNT4EE.js → chunk-GTVZKY3F.js} +2 -2
- package/dist/cli/{chunk-BXIUZM5N.mjs → chunk-HAJQGP5V.mjs} +2 -2
- package/dist/cli/{chunk-6CEUQYMB.js → chunk-HWDKRN7L.js} +3 -3
- package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
- package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
- package/dist/cli/{chunk-WR4WETRU.mjs → chunk-JUHDJNSI.mjs} +4 -4
- package/dist/cli/{chunk-TQH3533L.mjs → chunk-KPQHUVYW.mjs} +5 -5
- package/dist/cli/{chunk-V7SCRUFQ.js → chunk-KWYGWO4Y.js} +9 -6
- package/dist/cli/{chunk-DZS4JC7I.js → chunk-LDGZFDUB.js} +2 -2
- package/dist/cli/{chunk-EGTUOYYG.js → chunk-LN6RXDTB.js} +523 -59
- package/dist/cli/{chunk-DQ5ADV2J.mjs → chunk-LZXZQPA2.mjs} +4 -1
- package/dist/cli/{chunk-MYSKWJMA.js → chunk-MSP4DTSD.js} +13 -13
- package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
- package/dist/cli/{chunk-NNAE7E23.mjs → chunk-OUDTOMZC.mjs} +7 -9
- package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
- package/dist/cli/{chunk-ENCA6O2D.mjs → chunk-PNY3BWHP.mjs} +2 -2
- package/dist/cli/{chunk-KSA2XE4T.js → chunk-Q4MNUOS4.js} +316 -303
- package/dist/cli/{chunk-GTXSUPCJ.js → chunk-Q5CXV3E3.js} +2 -2
- package/dist/cli/{chunk-VAG5YKP6.mjs → chunk-RVSSQPQO.mjs} +1 -1
- package/dist/cli/{chunk-VE7ZPLN2.js → chunk-SLPJ3LXI.js} +22 -22
- package/dist/cli/{chunk-IX45S5VC.js → chunk-TX5TUHJN.js} +17 -19
- package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
- package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
- package/dist/cli/{chunk-NDFNBJGL.js → chunk-VBDZIMWD.js} +26 -26
- package/dist/cli/{chunk-GVGQ6NZW.js → chunk-W7AEIGZR.js} +41 -41
- package/dist/cli/{chunk-WDNRPZED.mjs → chunk-WC5M3JXE.mjs} +2 -2
- package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
- package/dist/cli/{chunk-MQX363YF.js → chunk-XBAH3TKU.js} +5 -5
- package/dist/cli/{chunk-BDWZBMGV.mjs → chunk-XJD2GYUP.mjs} +5 -5
- package/dist/cli/{chunk-XRZJKHUA.mjs → chunk-XVZRJJDS.mjs} +4 -4
- package/dist/cli/{chunk-TVINIDHB.js → chunk-Y2NTPYGS.js} +17 -17
- package/dist/cli/{chunk-6GTGWZJG.mjs → chunk-YBMHOH6H.mjs} +4 -4
- package/dist/cli/{chunk-TG2UB3A5.mjs → chunk-YRLAUGQY.mjs} +3 -3
- package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
- package/dist/cli/{chunk-KXQCUX3X.mjs → chunk-Z7UIOGW4.mjs} +3 -3
- package/dist/cli/{chunk-HCD36BP6.js → chunk-ZEV2Y56V.js} +44 -44
- package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
- package/dist/cli/{chunk-XBK6WCVA.js → chunk-ZILSRDIN.js} +8 -8
- package/dist/cli/{chunk-B2AS3R5W.js → chunk-ZISEH7OL.js} +16 -16
- package/dist/cli/{chunk-HPJAE6PP.js → chunk-ZZ4MF2GI.js} +6 -6
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-U3M2G76R.js → csv-2V2DIFNG.js} +15 -15
- package/dist/cli/{csv-4ID4E5W3.mjs → csv-P3HLK4GO.mjs} +6 -6
- package/dist/cli/{db-IHAQIKEQ.js → db-MREAQVW6.js} +36 -36
- package/dist/cli/{db-LHX5BBCZ.mjs → db-ZYOY3QRQ.mjs} +9 -9
- package/dist/cli/describe-IKZFOADR.mjs +49 -0
- package/dist/cli/describe-WW3OQRLP.js +49 -0
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/describe-core.js +5 -5
- package/dist/cli/describe-core.mjs +4 -4
- package/dist/cli/{executions-CJ5LV23G.js → executions-H5IJ7QSQ.js} +11 -11
- package/dist/cli/{executions-UJ6JZUL5.mjs → executions-KTSY5M34.mjs} +9 -9
- package/dist/cli/{feedback-TGUBVGRP.js → feedback-724QK3Z5.js} +16 -16
- package/dist/cli/{feedback-YGTPJBRJ.mjs → feedback-WWJRIXEU.mjs} +8 -8
- package/dist/cli/git-PHYRD56H.js +25 -0
- package/dist/cli/{git-3DOTQHJO.mjs → git-R5VRG7X6.mjs} +7 -7
- package/dist/cli/index.js +151 -157
- package/dist/cli/index.mjs +51 -57
- package/dist/cli/{legacy-noops-BHEHVFHI.js → legacy-noops-C6GDEGPU.js} +11 -11
- package/dist/cli/{legacy-noops-RBBYRVLG.mjs → legacy-noops-PWZ5XLAO.mjs} +8 -8
- package/dist/cli/{monitors-XECKLAXA.js → monitors-VAVQ4WCE.js} +125 -122
- package/dist/cli/{monitors-5AJCG6IV.mjs → monitors-WQSKMHAP.mjs} +19 -16
- package/dist/cli/{org-DOBAIYWG.js → org-CWWRWXZQ.js} +89 -89
- package/dist/cli/{org-ZAAIEZKB.mjs → org-MAL4QPVF.mjs} +9 -9
- package/dist/cli/{play-KLYRMQPF.mjs → play-ILW6MSNG.mjs} +174 -80
- package/dist/cli/{play-E74VN6B7.js → play-WJOWK5PQ.js} +690 -596
- package/dist/cli/{providers-XTQXV5LB.mjs → providers-4V2NMLZZ.mjs} +9 -9
- package/dist/cli/{providers-APZ6SOSK.js → providers-W662ANCH.js} +12 -12
- package/dist/cli/{quickstart-S6WN6NWW.js → quickstart-BW6EBUYX.js} +8 -8
- package/dist/cli/{quickstart-X7RHHQCH.mjs → quickstart-C22BR743.mjs} +6 -6
- package/dist/cli/{run-3YLIJJ57.js → run-KW7KW4FX.js} +50 -53
- package/dist/cli/{run-TZPBBSPX.mjs → run-SPAU5IMW.mjs} +31 -34
- package/dist/cli/search-HLE54W5G.js +32 -0
- package/dist/cli/{search-VLHE2CMZ.mjs → search-XPC75HLM.mjs} +10 -11
- package/dist/cli/{search-output-73BYB7UE.mjs → search-output-JKYJSEPM.mjs} +6 -6
- package/dist/cli/{search-output-GCT7PQIT.js → search-output-VJYE7USJ.js} +8 -8
- package/dist/cli/{secrets-RLOTGKQZ.mjs → secrets-OJG73GXQ.mjs} +9 -9
- package/dist/cli/{secrets-J6CEKXKQ.js → secrets-YB57KGSB.js} +18 -18
- package/dist/cli/{sessions-7HZ7OZ62.mjs → sessions-7ZL37BW4.mjs} +8 -8
- package/dist/cli/sessions-VEBYZIEU.js +22 -0
- package/dist/cli/{settings-WRV5XEZC.js → settings-A7DD2ZYE.js} +88 -89
- package/dist/cli/{settings-72K5YCIS.mjs → settings-RKSQB7FA.mjs} +15 -16
- package/dist/cli/{setup-KQFY6WT4.mjs → setup-NXDUTITY.mjs} +11 -12
- package/dist/cli/{setup-QVXWT2EQ.js → setup-S3K5YU62.js} +51 -52
- package/dist/cli/skills-NVQ744CN.js +36 -0
- package/dist/cli/{skills-C3K3E473.mjs → skills-VMFAIDO6.mjs} +9 -10
- package/dist/cli/{tools-4A2OH6MB.mjs → tools-52NTHBSJ.mjs} +20 -21
- package/dist/cli/tools-SBDUL3WB.js +56 -0
- package/dist/cli/update-HHVFZPCV.js +34 -0
- package/dist/cli/{update-BS6USKPR.mjs → update-SAKBEKMV.mjs} +11 -12
- package/dist/cli/{views-WB6GFTRX.mjs → views-ACRV7MD6.mjs} +54 -10
- package/dist/cli/{views-4NZGAXHL.js → views-C3GJOBDG.js} +66 -22
- package/dist/cli/{workflow-2D4WX55R.mjs → workflow-CS22E7TC.mjs} +10 -10
- package/dist/cli/{workflow-L2QTQZYV.js → workflow-ZNWCZEGN.js} +20 -20
- package/dist/{client-DoUVSkqC.d.mts → client-BlLYQDNo.d.mts} +1 -1
- package/dist/{client-DQm56zMs.d.ts → client-DSQlkIDO.d.ts} +1 -1
- package/dist/{client-core-C7KkUIE_.d.ts → client-core-CDwapXy5.d.ts} +167 -108
- package/dist/{client-core-CPlwsC1Q.d.mts → client-core-rX7n2H8U.d.mts} +167 -108
- package/dist/{compiler-manifest-DsxsQP-T.d.mts → compiler-manifest-BHNC4RL-.d.mts} +58 -21
- package/dist/{compiler-manifest-DsxsQP-T.d.ts → compiler-manifest-BHNC4RL-.d.ts} +58 -21
- package/dist/{errors-qdJUVQ3g.d.mts → errors-D7sPXrvB.d.mts} +1 -1
- package/dist/{errors-Bk5h1D-C.d.ts → errors-lhtIWG5Z.d.ts} +1 -1
- package/dist/{index-bL66eHYz.d.ts → index-CQTBHXHr.d.ts} +1 -1
- package/dist/{index-PaupwX1B.d.mts → index-NaDZq2xf.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +15 -15
- package/dist/index.mjs +11 -11
- package/dist/install-integrity.json +131 -132
- package/dist/monitor-fleet-contract.d.mts +17 -11
- package/dist/monitor-fleet-contract.d.ts +17 -11
- package/dist/monitor-fleet-contract.js +3 -3
- package/dist/monitor-fleet-contract.mjs +2 -2
- package/dist/monitor-input-contract.js +2 -2
- package/dist/monitor-input-contract.mjs +1 -1
- 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 +67 -3
- 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 +3 -3
- package/dist/plays/run-request.mjs +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +12 -12
- package/dist/server.mjs +6 -6
- package/package.json +1 -1
- package/dist/cli/auth-UP2RGPI6.js +0 -43
- package/dist/cli/chunk-5LZ5VSOK.mjs +0 -405
- package/dist/cli/chunk-D3J2Y2BP.js +0 -405
- package/dist/cli/describe-CI4MREFF.mjs +0 -50
- package/dist/cli/describe-IVTSD7ST.js +0 -50
- package/dist/cli/git-R3W25XIF.js +0 -25
- package/dist/cli/pages-FUOSF6BE.mjs +0 -266
- package/dist/cli/pages-TLC2N6L7.js +0 -266
- package/dist/cli/search-NB5CBALV.js +0 -33
- package/dist/cli/sessions-SFCZSB77.js +0 -22
- package/dist/cli/skills-WIJEHVLA.js +0 -37
- package/dist/cli/tools-VMMERMLO.js +0 -57
- package/dist/cli/update-54WZQDTS.js +0 -35
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var _chunkXBK6WCVAjs = require('./chunk-XBK6WCVA.js');
|
|
6
5
|
|
|
7
6
|
|
|
8
|
-
var
|
|
7
|
+
var _chunkZILSRDINjs = require('./chunk-ZILSRDIN.js');
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
var _chunkCWSLUNA6js = require('./chunk-CWSLUNA6.js');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkBBTKAASQjs = require('./chunk-BBTKAASQ.js');
|
|
14
20
|
|
|
15
21
|
// src/cli/json-fields.ts
|
|
16
22
|
var RUN_FIELDS = new Set(
|
|
@@ -45,7 +51,7 @@ function parseJsonFields(args, surface) {
|
|
|
45
51
|
if (parts.some(
|
|
46
52
|
(part) => !/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(part) || ["__proto__", "prototype", "constructor"].includes(part)
|
|
47
53
|
) || !allowed.has(parts[0])) {
|
|
48
|
-
throw new (0,
|
|
54
|
+
throw new (0, _chunkBBTKAASQjs.DeeplineError)(
|
|
49
55
|
`Unknown --json field '${path}'. Available roots: ${[...allowed].join(", ")}.`,
|
|
50
56
|
void 0,
|
|
51
57
|
"INVALID_ARGUMENT"
|
|
@@ -53,7 +59,7 @@ function parseJsonFields(args, surface) {
|
|
|
53
59
|
}
|
|
54
60
|
if (parts[0] === "run" && parts[1] && !RUN_FIELDS.has(parts[1])) {
|
|
55
61
|
const hint = parts[1] === "url" ? " Use runUrl." : parts[1] === "stats" ? " Dataset summaries are in datasets; run timing is in run.durationMs." : "";
|
|
56
|
-
throw new (0,
|
|
62
|
+
throw new (0, _chunkBBTKAASQjs.DeeplineError)(
|
|
57
63
|
`Unknown --json run field '${parts[1]}'. Available: ${[...RUN_FIELDS].join(", ")}.${hint}`,
|
|
58
64
|
void 0,
|
|
59
65
|
"INVALID_ARGUMENT"
|
|
@@ -63,7 +69,7 @@ function parseJsonFields(args, surface) {
|
|
|
63
69
|
const target = args[0] && !args[0].startsWith("-") ? args[0] : "<target>";
|
|
64
70
|
const command = surface === "get" ? "runs get" : `plays ${surface}`;
|
|
65
71
|
const quotedTarget = `'${target.replace(/'/g, "'\\''")}'`;
|
|
66
|
-
throw new (0,
|
|
72
|
+
throw new (0, _chunkBBTKAASQjs.DeeplineError)(
|
|
67
73
|
`--json diagnostics requires --full. For inspection, use: deepline ${surface === "run" ? "runs get <run-id>" : `${command} ${quotedTarget}`} --full`,
|
|
68
74
|
void 0,
|
|
69
75
|
"INVALID_ARGUMENT"
|
|
@@ -73,7 +79,7 @@ function parseJsonFields(args, surface) {
|
|
|
73
79
|
fields = [..._nullishCoalesce(fields, () => ( [])), ...paths];
|
|
74
80
|
}
|
|
75
81
|
if (fields && normalized.includes("--input") && surface === "get") {
|
|
76
|
-
throw new (0,
|
|
82
|
+
throw new (0, _chunkBBTKAASQjs.DeeplineError)(
|
|
77
83
|
"--json fields selects the run response, not --input. Use bare --json with --input.",
|
|
78
84
|
void 0,
|
|
79
85
|
"INVALID_ARGUMENT"
|
|
@@ -186,6 +192,388 @@ function withJsonNotices(value) {
|
|
|
186
192
|
return { ...record, notices };
|
|
187
193
|
}
|
|
188
194
|
|
|
195
|
+
// src/cli/failure-reporting.ts
|
|
196
|
+
var _os = require('os');
|
|
197
|
+
var FAILURE_REPORT_DISABLE_ENV = "DEEPLINE_DISABLE_FAILURE_REPORTING";
|
|
198
|
+
var REPORT_FAILURE_TIMEOUT_MS = 1e4;
|
|
199
|
+
var BACKGROUND_REPORT_FAILURE_TIMEOUT_MS = 2e3;
|
|
200
|
+
var MAX_FAILURE_TEXT_CHARS = 4e3;
|
|
201
|
+
var MAX_COMMAND_TOKENS = 3;
|
|
202
|
+
var REPORTABLE_EXIT_CODES = /* @__PURE__ */ new Set([4, 5]);
|
|
203
|
+
var EMAIL_RE = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
|
|
204
|
+
var UNIX_PATH_RE = /(?:\/Users\/|\/home\/|\/var\/folders\/|\/tmp\/|\/sessions\/)[^"'\n\r`]+/g;
|
|
205
|
+
var WINDOWS_PATH_RE = /[A-Za-z]:(?:\\{1,2})(?:Users|Temp|tmp)(?:\\{1,2})[^"'\n\r`]+/g;
|
|
206
|
+
var ASSIGNMENT_SECRET_RE = /\b(access[_-]?token|api[_-]?key|apikey|auth(?:orization)?|bearer|password|secret|session)\b(\s*[:=]\s*)(?!Bearer\s+\[redacted-secret\])([^\s,;]+)/gi;
|
|
207
|
+
var BEARER_SECRET_RE = /\b(bearer)\s+([A-Za-z0-9._-]+)/gi;
|
|
208
|
+
var GENERIC_TOKEN_RE = /\b(?:dlp|sk|ghp|xox[baprs])[-_A-Za-z0-9]{8,}\b/g;
|
|
209
|
+
var SECRET_OPTION_RE = /^--?(?:access[-_]?token|api[-_]?key|apikey|auth(?:orization)?|bearer|password|secret|session|token)$/i;
|
|
210
|
+
function truthyEnv(name) {
|
|
211
|
+
return ["1", "true", "yes", "on"].includes(
|
|
212
|
+
String(_nullishCoalesce(process.env[name], () => ( ""))).trim().toLowerCase()
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
function isFailureReportingDisabled() {
|
|
216
|
+
return truthyEnv(FAILURE_REPORT_DISABLE_ENV);
|
|
217
|
+
}
|
|
218
|
+
function redactFailureText(value, maxChars = MAX_FAILURE_TEXT_CHARS) {
|
|
219
|
+
const home = _optionalChain([process, 'access', _2 => _2.env, 'access', _3 => _3.HOME, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()]);
|
|
220
|
+
let text = String(_nullishCoalesce(value, () => ( "")));
|
|
221
|
+
if (!text) return "";
|
|
222
|
+
if (home && home !== "/") {
|
|
223
|
+
text = text.split(home).join("~");
|
|
224
|
+
}
|
|
225
|
+
return text.replace(EMAIL_RE, "[redacted-email]").replace(UNIX_PATH_RE, "[redacted-path]").replace(WINDOWS_PATH_RE, "[redacted-path]").replace(BEARER_SECRET_RE, "$1 [redacted-secret]").replace(ASSIGNMENT_SECRET_RE, "$1$2[redacted-secret]").replace(GENERIC_TOKEN_RE, "[redacted-secret]").slice(0, maxChars);
|
|
226
|
+
}
|
|
227
|
+
function sanitizeCommand(argv, prefix = "deepline") {
|
|
228
|
+
const tokens = [];
|
|
229
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
230
|
+
const arg = argv[index];
|
|
231
|
+
const value = String(_nullishCoalesce(arg, () => ( ""))).trim();
|
|
232
|
+
if (!value) continue;
|
|
233
|
+
if (value.startsWith("-")) {
|
|
234
|
+
if (!value.includes("=") && SECRET_OPTION_RE.test(value)) {
|
|
235
|
+
index += 1;
|
|
236
|
+
}
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
tokens.push(redactFailureText(value, 200));
|
|
240
|
+
if (tokens.length >= MAX_COMMAND_TOKENS) break;
|
|
241
|
+
}
|
|
242
|
+
return tokens.length > 0 ? [prefix, ...tokens].join(" ") : prefix;
|
|
243
|
+
}
|
|
244
|
+
function errorMessage(error) {
|
|
245
|
+
if (error instanceof Error) return `${error.name}: ${error.message}`;
|
|
246
|
+
return String(_nullishCoalesce(error, () => ( "")));
|
|
247
|
+
}
|
|
248
|
+
function errorStack(error) {
|
|
249
|
+
if (error instanceof Error && error.stack) {
|
|
250
|
+
return redactFailureText(error.stack);
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
function classifyNetworkFailure(error) {
|
|
255
|
+
const seen = /* @__PURE__ */ new Set();
|
|
256
|
+
let current = error;
|
|
257
|
+
while (current && !seen.has(current)) {
|
|
258
|
+
seen.add(current);
|
|
259
|
+
const record = typeof current === "object" && current !== null ? current : {};
|
|
260
|
+
const code = String(_nullishCoalesce(record.code, () => ( ""))).toLowerCase();
|
|
261
|
+
const name = current instanceof Error ? current.name.toLowerCase() : "";
|
|
262
|
+
const text = String(
|
|
263
|
+
current instanceof Error ? current.message : current
|
|
264
|
+
).toLowerCase();
|
|
265
|
+
const combined = `${code} ${name} ${text}`;
|
|
266
|
+
if (combined.includes("aborterror") || combined.includes("timeout") || combined.includes("timed out") || combined.includes("etimedout")) {
|
|
267
|
+
return "network_timeout";
|
|
268
|
+
}
|
|
269
|
+
if (combined.includes("enotfound") || combined.includes("eai_again") || combined.includes("getaddrinfo") || combined.includes("name or service not known") || combined.includes("temporary failure in name resolution")) {
|
|
270
|
+
return "network_dns_resolution_failed";
|
|
271
|
+
}
|
|
272
|
+
if (combined.includes("econnrefused") || combined.includes("connection refused")) {
|
|
273
|
+
return "network_connection_refused";
|
|
274
|
+
}
|
|
275
|
+
if (combined.includes("econnreset") || combined.includes("connection reset")) {
|
|
276
|
+
return "network_connection_reset";
|
|
277
|
+
}
|
|
278
|
+
if (combined.includes("incompleteread") || combined.includes("incomplete read")) {
|
|
279
|
+
return "network_incomplete_read";
|
|
280
|
+
}
|
|
281
|
+
if (combined.includes("remotedisconnected") || combined.includes("remote end closed connection") || combined.includes("other side closed") || combined.includes("socket hang up")) {
|
|
282
|
+
return "network_remote_disconnected";
|
|
283
|
+
}
|
|
284
|
+
if (
|
|
285
|
+
// Local filenames and retry commands may contain "ssl" or "tls".
|
|
286
|
+
// Require a transport identifier or protocol failure text instead.
|
|
287
|
+
code.includes("ssl") || code.includes("tls") || name.includes("ssl") || name.includes("tls") || /(?:^|[\s[(:])(?:ssl|tls)[\s:_-]+(?:error|handshake|certificate|routines|connection|failed|failure)(?:$|[\s:_-])/.test(
|
|
288
|
+
text
|
|
289
|
+
) || combined.includes("unexpected_eof_while_reading")
|
|
290
|
+
) {
|
|
291
|
+
return "network_ssl_error";
|
|
292
|
+
}
|
|
293
|
+
current = _nullishCoalesce(record.cause, () => ( record.context));
|
|
294
|
+
}
|
|
295
|
+
return "network_error";
|
|
296
|
+
}
|
|
297
|
+
function classifyNetworkCauseCategory(error) {
|
|
298
|
+
const seen = /* @__PURE__ */ new Set();
|
|
299
|
+
let cause = error;
|
|
300
|
+
while (cause && typeof cause === "object" && !seen.has(cause)) {
|
|
301
|
+
seen.add(cause);
|
|
302
|
+
const record = cause;
|
|
303
|
+
if (record.code === "UND_ERR_CONNECT_TIMEOUT") return "connect_timeout";
|
|
304
|
+
cause = record.cause;
|
|
305
|
+
}
|
|
306
|
+
switch (classifyNetworkFailure(error)) {
|
|
307
|
+
case "network_dns_resolution_failed":
|
|
308
|
+
return "dns";
|
|
309
|
+
case "network_ssl_error":
|
|
310
|
+
return "tls";
|
|
311
|
+
case "network_connection_reset":
|
|
312
|
+
return "reset";
|
|
313
|
+
case "network_timeout":
|
|
314
|
+
return "timeout";
|
|
315
|
+
default:
|
|
316
|
+
return "unknown";
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
function isNetworkFailure(error) {
|
|
320
|
+
if (!(error instanceof Error)) return false;
|
|
321
|
+
if (error instanceof _chunkBBTKAASQjs.DeeplineError && error.statusCode) return false;
|
|
322
|
+
const code = classifyNetworkFailure(error);
|
|
323
|
+
return code !== "network_error" || /unable to connect|unable to stream/i.test(error.message);
|
|
324
|
+
}
|
|
325
|
+
function buildEnvironmentContext() {
|
|
326
|
+
const context = {
|
|
327
|
+
os: _os.platform.call(void 0, ),
|
|
328
|
+
os_release: _os.release.call(void 0, ),
|
|
329
|
+
platform: `${_os.platform.call(void 0, )}-${_os.release.call(void 0, )}-${process.arch}`,
|
|
330
|
+
node_version: process.version,
|
|
331
|
+
runtime: "Node.js",
|
|
332
|
+
hostname: _os.hostname.call(void 0, ),
|
|
333
|
+
agent_runtime: _chunkCWSLUNA6js.detectAgentRuntime.call(void 0, )
|
|
334
|
+
};
|
|
335
|
+
for (const key of ["CLAUDE_CODE_REMOTE", "DEEPLINE_PLUGIN_MODE"]) {
|
|
336
|
+
const normalized = _optionalChain([process, 'access', _6 => _6.env, 'access', _7 => _7[key], 'optionalAccess', _8 => _8.trim, 'call', _9 => _9()]);
|
|
337
|
+
if (normalized) context[key.toLowerCase()] = normalized;
|
|
338
|
+
}
|
|
339
|
+
if (_optionalChain([process, 'access', _10 => _10.env, 'access', _11 => _11.CLAUDE_PROJECT_DIR, 'optionalAccess', _12 => _12.trim, 'call', _13 => _13()])) {
|
|
340
|
+
context.claude_project_dir_present = "true";
|
|
341
|
+
}
|
|
342
|
+
if (_optionalChain([process, 'access', _14 => _14.env, 'access', _15 => _15.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()])) {
|
|
343
|
+
context.deepline_plugin_root_present = "true";
|
|
344
|
+
}
|
|
345
|
+
if (_optionalChain([process, 'access', _18 => _18.env, 'access', _19 => _19.DEEPLINE_PLUGIN_SKILLS_DIR, 'optionalAccess', _20 => _20.trim, 'call', _21 => _21()])) {
|
|
346
|
+
context.deepline_plugin_skills_dir_present = "true";
|
|
347
|
+
}
|
|
348
|
+
if (_optionalChain([process, 'access', _22 => _22.env, 'access', _23 => _23.HOME, 'optionalAccess', _24 => _24.trim, 'call', _25 => _25(), 'access', _26 => _26.startsWith, 'call', _27 => _27("/sessions/")])) {
|
|
349
|
+
context.home_scope = "sessions";
|
|
350
|
+
}
|
|
351
|
+
return context;
|
|
352
|
+
}
|
|
353
|
+
function failureReportHeaders(apiKey) {
|
|
354
|
+
const agentSessionId = _chunkCWSLUNA6js.agentSessionIdFromEnvironment.call(void 0, );
|
|
355
|
+
return {
|
|
356
|
+
..._chunkCWSLUNA6js.deploymentProtectionHeaders.call(void 0, ),
|
|
357
|
+
...agentSessionId ? { "X-Deepline-Agent-Session-Id": agentSessionId } : {},
|
|
358
|
+
Authorization: `Bearer ${apiKey}`,
|
|
359
|
+
"Content-Type": "application/json",
|
|
360
|
+
"User-Agent": `deepline-ts-sdk/${_chunkCWSLUNA6js.SDK_VERSION}`,
|
|
361
|
+
"X-Deepline-Client-Family": "sdk",
|
|
362
|
+
"X-Deepline-CLI-Family": "sdk",
|
|
363
|
+
"X-Deepline-Agent-Runtime": _chunkCWSLUNA6js.detectAgentRuntime.call(void 0, ),
|
|
364
|
+
"X-Deepline-CLI-Version": _chunkCWSLUNA6js.SDK_VERSION,
|
|
365
|
+
"X-Deepline-SDK-Version": _chunkCWSLUNA6js.SDK_VERSION
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async function postFailureReport(input) {
|
|
369
|
+
const controller = new AbortController();
|
|
370
|
+
const timeout = setTimeout(() => controller.abort(), input.timeoutMs);
|
|
371
|
+
if (input.background) timeout.unref();
|
|
372
|
+
try {
|
|
373
|
+
await fetch(new URL("/api/v2/cli/report-failure", input.baseUrl), {
|
|
374
|
+
method: "POST",
|
|
375
|
+
headers: failureReportHeaders(input.apiKey),
|
|
376
|
+
body: JSON.stringify(input.body),
|
|
377
|
+
signal: controller.signal
|
|
378
|
+
});
|
|
379
|
+
return true;
|
|
380
|
+
} catch (e) {
|
|
381
|
+
return false;
|
|
382
|
+
} finally {
|
|
383
|
+
clearTimeout(timeout);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
function boundedTelemetryString(value, maxChars) {
|
|
387
|
+
return redactFailureText(value.trim(), maxChars);
|
|
388
|
+
}
|
|
389
|
+
async function maybeReportAutomaticSkillsSyncFailure(input) {
|
|
390
|
+
if (isFailureReportingDisabled()) return false;
|
|
391
|
+
let apiKey = "";
|
|
392
|
+
try {
|
|
393
|
+
apiKey = _chunkZILSRDINjs.resolveApiKeyForBaseUrl.call(void 0, input.baseUrl);
|
|
394
|
+
} catch (e2) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
if (!apiKey) return false;
|
|
398
|
+
const attempts = input.attempts.slice(0, 2).map((attempt) => ({
|
|
399
|
+
installer: attempt.installer,
|
|
400
|
+
outcome: attempt.outcome,
|
|
401
|
+
exit_code: typeof attempt.exitCode === "number" && Number.isFinite(attempt.exitCode) ? Math.trunc(attempt.exitCode) : null
|
|
402
|
+
}));
|
|
403
|
+
const agents = input.agents.slice(0, 8).map((agent) => boundedTelemetryString(agent, 100)).filter(Boolean);
|
|
404
|
+
const baseUrl = input.baseUrl.replace(/\/$/, "");
|
|
405
|
+
const failureKind = "background_warning";
|
|
406
|
+
const failureCode2 = "SKILLS_AUTO_SYNC_FAILED";
|
|
407
|
+
const failureStage = "skills_install";
|
|
408
|
+
return postFailureReport({
|
|
409
|
+
baseUrl,
|
|
410
|
+
apiKey,
|
|
411
|
+
timeoutMs: BACKGROUND_REPORT_FAILURE_TIMEOUT_MS,
|
|
412
|
+
background: true,
|
|
413
|
+
body: {
|
|
414
|
+
command: "deepline skills",
|
|
415
|
+
subcommand: "skills",
|
|
416
|
+
failure_kind: failureKind,
|
|
417
|
+
failure_code: failureCode2,
|
|
418
|
+
failure_stage: failureStage,
|
|
419
|
+
error_body: "Automatic Deepline skills installation failed.",
|
|
420
|
+
cli_version: _chunkCWSLUNA6js.SDK_VERSION,
|
|
421
|
+
context: {
|
|
422
|
+
environment: buildEnvironmentContext(),
|
|
423
|
+
skills_sync: {
|
|
424
|
+
skills_package: boundedTelemetryString(input.skillsPackage, 100),
|
|
425
|
+
remote_skills_version: boundedTelemetryString(
|
|
426
|
+
input.remoteSkillsVersion,
|
|
427
|
+
200
|
|
428
|
+
),
|
|
429
|
+
agents,
|
|
430
|
+
target_skill_count: Math.max(
|
|
431
|
+
0,
|
|
432
|
+
Math.trunc(
|
|
433
|
+
Number.isFinite(input.targetSkillCount) ? input.targetSkillCount : 0
|
|
434
|
+
)
|
|
435
|
+
),
|
|
436
|
+
marker_written: input.markerWritten,
|
|
437
|
+
attempts
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
function subcommandFromArgv(argv) {
|
|
444
|
+
return _nullishCoalesce(argv.find((arg) => arg && !arg.startsWith("-")), () => ( null));
|
|
445
|
+
}
|
|
446
|
+
function commandTokens(argv) {
|
|
447
|
+
return argv.map((arg) => String(_nullishCoalesce(arg, () => ( ""))).trim()).filter((arg) => arg && !arg.startsWith("-"));
|
|
448
|
+
}
|
|
449
|
+
function isServerLoggedPlayRunStartFailure(input) {
|
|
450
|
+
const [subcommand, command] = commandTokens(input.argv);
|
|
451
|
+
return subcommand === "plays" && command === "run" && input.error instanceof _chunkBBTKAASQjs.DeeplineError && typeof input.error.statusCode === "number";
|
|
452
|
+
}
|
|
453
|
+
function shouldReport(input) {
|
|
454
|
+
if (input.error !== void 0) return true;
|
|
455
|
+
return input.exitCode !== null && REPORTABLE_EXIT_CODES.has(input.exitCode);
|
|
456
|
+
}
|
|
457
|
+
function failureCode(input) {
|
|
458
|
+
if (input.error !== void 0) {
|
|
459
|
+
if (isNetworkFailure(input.error))
|
|
460
|
+
return classifyNetworkFailure(input.error);
|
|
461
|
+
if (input.error instanceof _chunkBBTKAASQjs.DeeplineError && input.error.code) {
|
|
462
|
+
return input.error.code;
|
|
463
|
+
}
|
|
464
|
+
if (input.error instanceof Error && input.error.name)
|
|
465
|
+
return input.error.name;
|
|
466
|
+
return "CLI_FAILURE";
|
|
467
|
+
}
|
|
468
|
+
return input.exitCode === 4 ? "network_error" : "command_exit";
|
|
469
|
+
}
|
|
470
|
+
function resolvedExitCode(input) {
|
|
471
|
+
if (typeof input.exitCode === "number" && Number.isFinite(input.exitCode)) {
|
|
472
|
+
return Math.trunc(input.exitCode);
|
|
473
|
+
}
|
|
474
|
+
if (input.error === void 0) return null;
|
|
475
|
+
return isNetworkFailure(input.error) ? 4 : 5;
|
|
476
|
+
}
|
|
477
|
+
function resolveSdkCliFailureExitCode(error) {
|
|
478
|
+
return isNetworkFailure(error) ? 4 : 1;
|
|
479
|
+
}
|
|
480
|
+
function resolvedFailureKind(input) {
|
|
481
|
+
return input.error === void 0 ? "command_exit" : "uncaught_exception";
|
|
482
|
+
}
|
|
483
|
+
function safeRequestDiagnostics(error) {
|
|
484
|
+
if (!(error instanceof _chunkBBTKAASQjs.DeeplineError)) return null;
|
|
485
|
+
const request = _optionalChain([error, 'access', _28 => _28.details, 'optionalAccess', _29 => _29.request]);
|
|
486
|
+
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
487
|
+
return null;
|
|
488
|
+
const value = request;
|
|
489
|
+
const result = {};
|
|
490
|
+
if (typeof value.phase === "string" && [
|
|
491
|
+
"before_request",
|
|
492
|
+
"retry_wait",
|
|
493
|
+
"awaiting_headers",
|
|
494
|
+
"reading_body"
|
|
495
|
+
].includes(value.phase))
|
|
496
|
+
result.phase = value.phase;
|
|
497
|
+
if (typeof value.method === "string" && /^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS)$/.test(value.method))
|
|
498
|
+
result.method = value.method;
|
|
499
|
+
if (typeof value.url === "string") {
|
|
500
|
+
try {
|
|
501
|
+
const url = new URL(value.url);
|
|
502
|
+
if (url.protocol === "https:" || url.protocol === "http:") {
|
|
503
|
+
result.url = redactFailureText(`${url.origin}${url.pathname}`, 1e3);
|
|
504
|
+
}
|
|
505
|
+
} catch (e3) {
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (typeof value.failedAtUtc === "string" && Number.isFinite(Date.parse(value.failedAtUtc))) {
|
|
509
|
+
result.failedAtUtc = new Date(value.failedAtUtc).toISOString();
|
|
510
|
+
}
|
|
511
|
+
for (const key of ["elapsedMs", "attempts"]) {
|
|
512
|
+
const number = value[key];
|
|
513
|
+
if (typeof number === "number" && Number.isSafeInteger(number) && number >= 0)
|
|
514
|
+
result[key] = number;
|
|
515
|
+
}
|
|
516
|
+
return Object.keys(result).length > 0 ? result : null;
|
|
517
|
+
}
|
|
518
|
+
function buildFailureReport(input) {
|
|
519
|
+
const durationMs = Math.max(0, Date.now() - input.startedAtMs);
|
|
520
|
+
const request = safeRequestDiagnostics(input.error);
|
|
521
|
+
const failureKind = resolvedFailureKind({
|
|
522
|
+
exitCode: input.exitCode,
|
|
523
|
+
error: input.error
|
|
524
|
+
});
|
|
525
|
+
const code = failureCode({ exitCode: input.exitCode, error: input.error });
|
|
526
|
+
const errorBody = input.error === void 0 ? `SDK CLI command exited ${_nullishCoalesce(input.exitCode, () => ( "unknown"))}` : errorMessage(input.error);
|
|
527
|
+
const networkCauseCategory = input.error !== void 0 && isNetworkFailure(input.error) ? classifyNetworkCauseCategory(input.error) : null;
|
|
528
|
+
return {
|
|
529
|
+
command: sanitizeCommand(input.argv),
|
|
530
|
+
subcommand: subcommandFromArgv(input.argv),
|
|
531
|
+
error_status: input.exitCode,
|
|
532
|
+
error_body: redactFailureText(errorBody),
|
|
533
|
+
exit_code: input.exitCode,
|
|
534
|
+
duration_ms: durationMs,
|
|
535
|
+
error_class: input.error instanceof Error ? input.error.name : null,
|
|
536
|
+
stack_trace: errorStack(input.error),
|
|
537
|
+
failure_kind: failureKind,
|
|
538
|
+
failure_code: code,
|
|
539
|
+
failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
|
|
540
|
+
cli_version: _chunkCWSLUNA6js.SDK_VERSION,
|
|
541
|
+
context: {
|
|
542
|
+
base_url: redactFailureText(input.baseUrl, 400),
|
|
543
|
+
command_summary: sanitizeCommand(input.argv),
|
|
544
|
+
environment: buildEnvironmentContext(),
|
|
545
|
+
...request ? { request } : {},
|
|
546
|
+
failure_kind: failureKind,
|
|
547
|
+
failure_code: code,
|
|
548
|
+
failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
|
|
549
|
+
duration_ms: durationMs,
|
|
550
|
+
...input.exitCode !== null ? { exit_code: input.exitCode } : {},
|
|
551
|
+
...networkCauseCategory ? { network_cause_category: networkCauseCategory } : {}
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
async function maybeReportSdkCliFailure(input) {
|
|
556
|
+
if (isFailureReportingDisabled()) return false;
|
|
557
|
+
if (isServerLoggedPlayRunStartFailure(input)) return false;
|
|
558
|
+
const exitCode = resolvedExitCode(input);
|
|
559
|
+
if (!shouldReport({ exitCode, error: input.error })) return false;
|
|
560
|
+
const baseUrl = _chunkZILSRDINjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
|
|
561
|
+
const apiKey = _chunkZILSRDINjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
|
|
562
|
+
if (!apiKey) return false;
|
|
563
|
+
return postFailureReport({
|
|
564
|
+
baseUrl,
|
|
565
|
+
apiKey,
|
|
566
|
+
timeoutMs: REPORT_FAILURE_TIMEOUT_MS,
|
|
567
|
+
body: buildFailureReport({
|
|
568
|
+
argv: input.argv,
|
|
569
|
+
startedAtMs: input.startedAtMs,
|
|
570
|
+
error: input.error,
|
|
571
|
+
exitCode,
|
|
572
|
+
baseUrl
|
|
573
|
+
})
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
|
|
189
577
|
// src/cli/utils.ts
|
|
190
578
|
var _crypto = require('crypto');
|
|
191
579
|
|
|
@@ -196,7 +584,7 @@ var _crypto = require('crypto');
|
|
|
196
584
|
|
|
197
585
|
var _fs = require('fs');
|
|
198
586
|
var _promises = require('fs/promises');
|
|
199
|
-
|
|
587
|
+
|
|
200
588
|
var _path = require('path');
|
|
201
589
|
var _child_process = require('child_process'); var childProcess = _interopRequireWildcard(_child_process);
|
|
202
590
|
var _sync = require('csv-parse/sync');
|
|
@@ -255,7 +643,7 @@ function decodeAs(run, toByte) {
|
|
|
255
643
|
if (!bytes.subarray(0, i).some((b) => b >= 194 && b <= 244)) return null;
|
|
256
644
|
try {
|
|
257
645
|
return STRICT_UTF8.decode(bytes.subarray(0, i));
|
|
258
|
-
} catch (
|
|
646
|
+
} catch (e4) {
|
|
259
647
|
return null;
|
|
260
648
|
}
|
|
261
649
|
}
|
|
@@ -294,15 +682,15 @@ var BROWSER_OPEN_COOLDOWN_MS = 3e4;
|
|
|
294
682
|
var SAME_URL_BROWSER_OPEN_COOLDOWN_MS = 5 * 6e4;
|
|
295
683
|
var defaultBrowserCommandRunner = childProcess;
|
|
296
684
|
function getAuthedHttpClient() {
|
|
297
|
-
const config =
|
|
298
|
-
return { config, http: new (0,
|
|
685
|
+
const config = _chunkZILSRDINjs.resolveConfig.call(void 0, );
|
|
686
|
+
return { config, http: new (0, _chunkZILSRDINjs.HttpClient)(config) };
|
|
299
687
|
}
|
|
300
688
|
function stableOsUserId() {
|
|
301
689
|
try {
|
|
302
690
|
const info = _os.userInfo.call(void 0, );
|
|
303
691
|
if (typeof info.uid === "number") return `uid-${info.uid}`;
|
|
304
692
|
if (info.username) return `user-${info.username}`;
|
|
305
|
-
} catch (
|
|
693
|
+
} catch (e5) {
|
|
306
694
|
}
|
|
307
695
|
return "unknown-user";
|
|
308
696
|
}
|
|
@@ -329,7 +717,7 @@ function claimBrowserOpen(now = Date.now(), stateDir, targetUrl) {
|
|
|
329
717
|
try {
|
|
330
718
|
_fs.mkdirSync.call(void 0, lockPath, { mode: 448 });
|
|
331
719
|
locked = true;
|
|
332
|
-
} catch (
|
|
720
|
+
} catch (e6) {
|
|
333
721
|
return false;
|
|
334
722
|
}
|
|
335
723
|
let lastOpenedAt = 0;
|
|
@@ -358,7 +746,7 @@ function claimBrowserOpen(now = Date.now(), stateDir, targetUrl) {
|
|
|
358
746
|
{ encoding: "utf-8", mode: 384 }
|
|
359
747
|
);
|
|
360
748
|
return true;
|
|
361
|
-
} catch (
|
|
749
|
+
} catch (e7) {
|
|
362
750
|
return true;
|
|
363
751
|
} finally {
|
|
364
752
|
if (locked) {
|
|
@@ -370,7 +758,7 @@ function extractUrlHost(raw) {
|
|
|
370
758
|
try {
|
|
371
759
|
const parsed = new URL(raw.includes("://") ? raw : `https://${raw}`);
|
|
372
760
|
return parsed.port ? `${parsed.hostname.toLowerCase()}:${parsed.port}` : parsed.hostname.toLowerCase();
|
|
373
|
-
} catch (
|
|
761
|
+
} catch (e8) {
|
|
374
762
|
return "";
|
|
375
763
|
}
|
|
376
764
|
}
|
|
@@ -391,7 +779,7 @@ function browserAppNameFromBundleId(bundleId) {
|
|
|
391
779
|
function currentOsUsername() {
|
|
392
780
|
try {
|
|
393
781
|
return _os.userInfo.call(void 0, ).username || "";
|
|
394
|
-
} catch (
|
|
782
|
+
} catch (e9) {
|
|
395
783
|
return "";
|
|
396
784
|
}
|
|
397
785
|
}
|
|
@@ -405,9 +793,9 @@ function readMacosUserHome(runner = defaultBrowserCommandRunner) {
|
|
|
405
793
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
406
794
|
);
|
|
407
795
|
const match = String(output).match(/NFSHomeDirectory:\s*(.+)\s*$/m);
|
|
408
|
-
const home = _optionalChain([match, 'optionalAccess',
|
|
796
|
+
const home = _optionalChain([match, 'optionalAccess', _30 => _30[1], 'optionalAccess', _31 => _31.trim, 'call', _32 => _32()]);
|
|
409
797
|
if (home) return home;
|
|
410
|
-
} catch (
|
|
798
|
+
} catch (e10) {
|
|
411
799
|
}
|
|
412
800
|
}
|
|
413
801
|
return _os.homedir.call(void 0, );
|
|
@@ -441,7 +829,7 @@ function readDefaultMacBrowserBundleId(runner = defaultBrowserCommandRunner) {
|
|
|
441
829
|
return "";
|
|
442
830
|
};
|
|
443
831
|
return pickBundle("https") || pickBundle("http");
|
|
444
|
-
} catch (
|
|
832
|
+
} catch (e11) {
|
|
445
833
|
return "";
|
|
446
834
|
}
|
|
447
835
|
}
|
|
@@ -557,7 +945,7 @@ function hasOnlyHeadlessMacosBrowserInstances(appName, runner = defaultBrowserCo
|
|
|
557
945
|
return lines.every(
|
|
558
946
|
(line) => line.includes("--headless") || line.includes("--no-startup-window")
|
|
559
947
|
);
|
|
560
|
-
} catch (
|
|
948
|
+
} catch (e12) {
|
|
561
949
|
return false;
|
|
562
950
|
}
|
|
563
951
|
}
|
|
@@ -571,7 +959,7 @@ function openNewVisibleMacosBrowserInstance(appName, targetUrl, runner = default
|
|
|
571
959
|
}
|
|
572
960
|
);
|
|
573
961
|
return true;
|
|
574
|
-
} catch (
|
|
962
|
+
} catch (e13) {
|
|
575
963
|
return false;
|
|
576
964
|
}
|
|
577
965
|
}
|
|
@@ -593,7 +981,7 @@ function openUrlMacos(targetUrl, allowFocus, runner = defaultBrowserCommandRunne
|
|
|
593
981
|
stdio: "ignore"
|
|
594
982
|
});
|
|
595
983
|
return true;
|
|
596
|
-
} catch (
|
|
984
|
+
} catch (e14) {
|
|
597
985
|
return false;
|
|
598
986
|
}
|
|
599
987
|
}
|
|
@@ -622,7 +1010,7 @@ function openInBrowser(url, options = {}) {
|
|
|
622
1010
|
}
|
|
623
1011
|
childProcess.execFileSync("xdg-open", [targetUrl], { stdio: "ignore" });
|
|
624
1012
|
return "opened";
|
|
625
|
-
} catch (
|
|
1013
|
+
} catch (e15) {
|
|
626
1014
|
return "failed";
|
|
627
1015
|
}
|
|
628
1016
|
}
|
|
@@ -630,12 +1018,12 @@ function sleep(ms) {
|
|
|
630
1018
|
return new Promise((resolvePromise) => setTimeout(resolvePromise, ms));
|
|
631
1019
|
}
|
|
632
1020
|
function collectLocalEnvInfo() {
|
|
633
|
-
const homeDir = _optionalChain([process, 'access',
|
|
1021
|
+
const homeDir = _optionalChain([process, 'access', _33 => _33.env, 'access', _34 => _34.HOME, 'optionalAccess', _35 => _35.trim, 'call', _36 => _36()]) || _os.homedir.call(void 0, );
|
|
634
1022
|
const info = {
|
|
635
1023
|
os: `${process.platform} ${process.arch}`,
|
|
636
1024
|
node_version: process.version,
|
|
637
1025
|
home_dir: homeDir,
|
|
638
|
-
agent_runtime:
|
|
1026
|
+
agent_runtime: _chunkCWSLUNA6js.detectAgentRuntime.call(void 0, )
|
|
639
1027
|
};
|
|
640
1028
|
const env = process.env;
|
|
641
1029
|
const optional = {
|
|
@@ -643,15 +1031,15 @@ function collectLocalEnvInfo() {
|
|
|
643
1031
|
deepline_plugin_mode: env.DEEPLINE_PLUGIN_MODE
|
|
644
1032
|
};
|
|
645
1033
|
for (const [key, value] of Object.entries(optional)) {
|
|
646
|
-
if (_optionalChain([value, 'optionalAccess',
|
|
1034
|
+
if (_optionalChain([value, 'optionalAccess', _37 => _37.trim, 'call', _38 => _38()])) info[key] = value.trim();
|
|
647
1035
|
}
|
|
648
|
-
if (_optionalChain([env, 'access',
|
|
1036
|
+
if (_optionalChain([env, 'access', _39 => _39.CLAUDE_PROJECT_DIR, 'optionalAccess', _40 => _40.trim, 'call', _41 => _41()])) {
|
|
649
1037
|
info.claude_project_dir_present = "true";
|
|
650
1038
|
}
|
|
651
|
-
if (_optionalChain([env, 'access',
|
|
1039
|
+
if (_optionalChain([env, 'access', _42 => _42.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()])) {
|
|
652
1040
|
info.deepline_plugin_root_present = "true";
|
|
653
1041
|
}
|
|
654
|
-
if (_optionalChain([env, 'access',
|
|
1042
|
+
if (_optionalChain([env, 'access', _45 => _45.DEEPLINE_PLUGIN_SKILLS_DIR, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47()])) {
|
|
655
1043
|
info.deepline_plugin_skills_dir_present = "true";
|
|
656
1044
|
}
|
|
657
1045
|
if (info.home_dir === "/sessions" || info.home_dir.startsWith("/sessions/")) {
|
|
@@ -670,7 +1058,7 @@ function readCsvRows(csvPath) {
|
|
|
670
1058
|
});
|
|
671
1059
|
}
|
|
672
1060
|
function csvStringFromRows(rows, columns) {
|
|
673
|
-
const effectiveColumns = _optionalChain([columns, 'optionalAccess',
|
|
1061
|
+
const effectiveColumns = _optionalChain([columns, 'optionalAccess', _48 => _48.length]) ? columns : Object.keys(_nullishCoalesce(rows[0], () => ( {})));
|
|
674
1062
|
if (!effectiveColumns.length) {
|
|
675
1063
|
return _sync3.stringify.call(void 0,
|
|
676
1064
|
rows.map(() => ({})),
|
|
@@ -733,7 +1121,7 @@ function csvSafeJsonString(value) {
|
|
|
733
1121
|
try {
|
|
734
1122
|
const serialized = JSON.stringify(value, csvSafeJsonReplacer);
|
|
735
1123
|
return _nullishCoalesce(serialized, () => ( null));
|
|
736
|
-
} catch (
|
|
1124
|
+
} catch (e16) {
|
|
737
1125
|
return String(value);
|
|
738
1126
|
}
|
|
739
1127
|
}
|
|
@@ -747,7 +1135,7 @@ function parseMaybeJsonObject(value) {
|
|
|
747
1135
|
}
|
|
748
1136
|
try {
|
|
749
1137
|
return JSON.parse(trimmed);
|
|
750
|
-
} catch (
|
|
1138
|
+
} catch (e17) {
|
|
751
1139
|
return value;
|
|
752
1140
|
}
|
|
753
1141
|
}
|
|
@@ -755,7 +1143,7 @@ function failureMessageFromRecord(value) {
|
|
|
755
1143
|
const status = typeof value.status === "string" ? value.status.trim().toLowerCase() : "";
|
|
756
1144
|
const directError = typeof value.error === "string" ? value.error.trim() : typeof value.last_error === "string" ? value.last_error.trim() : "";
|
|
757
1145
|
const result = value.result && typeof value.result === "object" && !Array.isArray(value.result) ? value.result : null;
|
|
758
|
-
const resultError = typeof _optionalChain([result, 'optionalAccess',
|
|
1146
|
+
const resultError = typeof _optionalChain([result, 'optionalAccess', _49 => _49.error]) === "string" ? result.error.trim() : typeof _optionalChain([result, 'optionalAccess', _50 => _50.message]) === "string" ? result.message.trim() : "";
|
|
759
1147
|
if (!directError && !resultError && status !== "error" && status !== "failed") {
|
|
760
1148
|
return null;
|
|
761
1149
|
}
|
|
@@ -882,9 +1270,9 @@ function markdownTableFromRows(rows, preferredColumns = []) {
|
|
|
882
1270
|
}
|
|
883
1271
|
function withAgentCommandContext(value) {
|
|
884
1272
|
const valueRecord = value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
885
|
-
return
|
|
1273
|
+
return _chunkCWSLUNA6js.detectAgentRuntime.call(void 0, ) !== "unknown" && valueRecord && !Object.prototype.hasOwnProperty.call(valueRecord, "command_context") ? {
|
|
886
1274
|
...valueRecord,
|
|
887
|
-
command_context:
|
|
1275
|
+
command_context: _chunkZILSRDINjs.resolveCliCommandContext.call(void 0, )
|
|
888
1276
|
} : value;
|
|
889
1277
|
}
|
|
890
1278
|
function printJson(value, fields) {
|
|
@@ -900,63 +1288,131 @@ function printCompactJson(value) {
|
|
|
900
1288
|
);
|
|
901
1289
|
}
|
|
902
1290
|
function cliToolExecutionFailure(error) {
|
|
903
|
-
const failure =
|
|
1291
|
+
const failure = _chunkBBTKAASQjs.serializeToolExecutionFailure.call(void 0, error);
|
|
904
1292
|
if (!failure) return null;
|
|
905
1293
|
const { publicDetails: _publicDetails, ...facts } = failure;
|
|
906
1294
|
return facts;
|
|
907
1295
|
}
|
|
1296
|
+
var UPSTREAM_BODY_EXCERPT_CHARS = 300;
|
|
1297
|
+
var UPSTREAM_BODY_MAX_DEPTH = 6;
|
|
1298
|
+
var CREDENTIAL_FIELD_RE = /(?:^|[-_])(?:auth|key|sig(?:nature)?|session)$|api[-_]?key|apikey|access[-_]?key|private|token|secret|passw(?:or)?d|authorization|cookie|credential|bearer/i;
|
|
1299
|
+
var TRANSIENT_CLIENT_ERROR_STATUSES = /* @__PURE__ */ new Set([408, 425, 429]);
|
|
1300
|
+
function maskCredentialFields(value, depth = 0) {
|
|
1301
|
+
if (value === null || typeof value !== "object") return value;
|
|
1302
|
+
if (depth >= UPSTREAM_BODY_MAX_DEPTH) return "[nested]";
|
|
1303
|
+
if (Array.isArray(value)) {
|
|
1304
|
+
return value.map((entry) => maskCredentialFields(entry, depth + 1));
|
|
1305
|
+
}
|
|
1306
|
+
return Object.fromEntries(
|
|
1307
|
+
Object.entries(value).map(([key, entry]) => [
|
|
1308
|
+
key,
|
|
1309
|
+
CREDENTIAL_FIELD_RE.test(key) ? "[redacted-secret]" : maskCredentialFields(entry, depth + 1)
|
|
1310
|
+
])
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
function formatUpstreamBodyExcerpt(body) {
|
|
1314
|
+
let value = body;
|
|
1315
|
+
if (typeof value === "string") {
|
|
1316
|
+
const trimmed = value.trim();
|
|
1317
|
+
if (!trimmed) return "(empty body)";
|
|
1318
|
+
try {
|
|
1319
|
+
value = JSON.parse(trimmed);
|
|
1320
|
+
} catch (e18) {
|
|
1321
|
+
value = trimmed;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
if (value === null || value === void 0) return "(empty body)";
|
|
1325
|
+
let text;
|
|
1326
|
+
try {
|
|
1327
|
+
text = typeof value === "string" ? value : _nullishCoalesce(JSON.stringify(maskCredentialFields(value)), () => ( String(value)));
|
|
1328
|
+
} catch (e19) {
|
|
1329
|
+
text = String(value);
|
|
1330
|
+
}
|
|
1331
|
+
const redacted = redactFailureText(text, Number.MAX_SAFE_INTEGER).replace(/\s+/g, " ").trim();
|
|
1332
|
+
if (!redacted) return "(empty body)";
|
|
1333
|
+
return redacted.length > UPSTREAM_BODY_EXCERPT_CHARS ? `${redacted.slice(0, UPSTREAM_BODY_EXCERPT_CHARS)}\u2026 (full body: rerun with --json)` : redacted;
|
|
1334
|
+
}
|
|
1335
|
+
function permanentProviderFailureLine(status, connectedCredential) {
|
|
1336
|
+
if (typeof status !== "number" || status < 400 || status >= 500) return null;
|
|
1337
|
+
if (TRANSIENT_CLIENT_ERROR_STATUSES.has(status)) return null;
|
|
1338
|
+
if (connectedCredential && (status === 401 || status === 403)) {
|
|
1339
|
+
return "Permanent: the provider refused this credential or its permissions. Check the connected key and its plan before retrying.";
|
|
1340
|
+
}
|
|
1341
|
+
return "Permanent: the provider rejected this request. Retrying it unchanged will fail again.";
|
|
1342
|
+
}
|
|
908
1343
|
function formatToolExecutionErrorDiagnostic(error) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1344
|
+
return formatCliFailureDiagnostic(errorToJsonPayload(error).error);
|
|
1345
|
+
}
|
|
1346
|
+
function formatCliFailureDiagnostic(error) {
|
|
1347
|
+
if (error === null || typeof error !== "object") return null;
|
|
1348
|
+
const record = error;
|
|
1349
|
+
const failure = _chunkBBTKAASQjs.normalizeToolExecutionFailure.call(void 0, record.tool_error);
|
|
1350
|
+
const upstreamResponse = _chunkBBTKAASQjs.readToolUpstreamResponse.call(void 0, record);
|
|
1351
|
+
if (!failure && !upstreamResponse) return null;
|
|
1352
|
+
const lines = [];
|
|
1353
|
+
if (failure) {
|
|
1354
|
+
lines.push(
|
|
1355
|
+
`Tool: ${failure.toolId}${failure.provider ? `; provider: ${failure.provider}` : ""}${failure.operation ? `; operation: ${failure.operation}` : ""}.`,
|
|
1356
|
+
`Failure: ${failure.origin} / ${failure.category}. Same-call retry: ${failure.retryable ? `safe${failure.retryAfterMs === null ? "" : ` after ${failure.retryAfterMs}ms`}` : "unsafe"}.`
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
if (upstreamResponse) {
|
|
1360
|
+
lines.push(
|
|
1361
|
+
`Provider response: HTTP ${upstreamResponse.status}: ${formatUpstreamBodyExcerpt(upstreamResponse.body)}`
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
if (!failure || failure.origin === "provider" && !failure.retryable) {
|
|
1365
|
+
const permanent = permanentProviderFailureLine(
|
|
1366
|
+
_nullishCoalesce(_optionalChain([upstreamResponse, 'optionalAccess', _51 => _51.status]), () => ( _optionalChain([failure, 'optionalAccess', _52 => _52.statusCode]))),
|
|
1367
|
+
upstreamResponse !== null && upstreamResponse !== void 0
|
|
1368
|
+
);
|
|
1369
|
+
if (permanent) lines.push(permanent);
|
|
1370
|
+
}
|
|
1371
|
+
if (_optionalChain([failure, 'optionalAccess', _53 => _53.networkKind]) || _optionalChain([failure, 'optionalAccess', _54 => _54.networkScope])) {
|
|
916
1372
|
lines.push(
|
|
917
1373
|
`Network: ${_nullishCoalesce(failure.networkKind, () => ( "unknown"))}${failure.networkScope ? ` (${failure.networkScope})` : ""}.`
|
|
918
1374
|
);
|
|
919
1375
|
}
|
|
920
|
-
if (failure.requestId) lines.push(`Request: ${failure.requestId}.`);
|
|
1376
|
+
if (_optionalChain([failure, 'optionalAccess', _55 => _55.requestId])) lines.push(`Request: ${failure.requestId}.`);
|
|
921
1377
|
return lines.join("\n");
|
|
922
1378
|
}
|
|
923
1379
|
function errorToJsonPayload(error) {
|
|
924
1380
|
const message = error instanceof Error ? error.message : String(error);
|
|
925
1381
|
const toolFailure = cliToolExecutionFailure(error);
|
|
926
|
-
const upstreamResponse =
|
|
1382
|
+
const upstreamResponse = _chunkBBTKAASQjs.readToolUpstreamResponse.call(void 0, error);
|
|
927
1383
|
const maybeRecord = error && typeof error === "object" ? error : null;
|
|
928
|
-
const code = typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
1384
|
+
const code = typeof _optionalChain([maybeRecord, 'optionalAccess', _56 => _56.code]) === "string" ? maybeRecord.code : error instanceof SyntaxError ? "INVALID_JSON" : "CLI_ERROR";
|
|
929
1385
|
const details = {};
|
|
930
|
-
const exitCode = typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
931
|
-
if (typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
1386
|
+
const exitCode = typeof _optionalChain([maybeRecord, 'optionalAccess', _57 => _57.exitCode]) === "number" ? maybeRecord.exitCode : void 0;
|
|
1387
|
+
if (typeof _optionalChain([maybeRecord, 'optionalAccess', _58 => _58.statusCode]) === "number") {
|
|
932
1388
|
details.statusCode = maybeRecord.statusCode;
|
|
933
1389
|
}
|
|
934
|
-
if (typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
1390
|
+
if (typeof _optionalChain([maybeRecord, 'optionalAccess', _59 => _59.status]) === "number") {
|
|
935
1391
|
details.status = maybeRecord.status;
|
|
936
1392
|
}
|
|
937
|
-
if (typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
1393
|
+
if (typeof _optionalChain([maybeRecord, 'optionalAccess', _60 => _60.requestId]) === "string" || _optionalChain([maybeRecord, 'optionalAccess', _61 => _61.requestId]) === null) {
|
|
938
1394
|
details.requestId = maybeRecord.requestId;
|
|
939
1395
|
}
|
|
940
|
-
if (typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
1396
|
+
if (typeof _optionalChain([maybeRecord, 'optionalAccess', _62 => _62.retryable]) === "boolean") {
|
|
941
1397
|
details.retryable = maybeRecord.retryable;
|
|
942
1398
|
}
|
|
943
|
-
if (_optionalChain([maybeRecord, 'optionalAccess',
|
|
1399
|
+
if (_optionalChain([maybeRecord, 'optionalAccess', _63 => _63.publicDetails]) && typeof maybeRecord.publicDetails === "object" && !Array.isArray(maybeRecord.publicDetails)) {
|
|
944
1400
|
details.publicDetails = maybeRecord.publicDetails;
|
|
945
1401
|
}
|
|
946
|
-
if (_optionalChain([maybeRecord, 'optionalAccess',
|
|
1402
|
+
if (_optionalChain([maybeRecord, 'optionalAccess', _64 => _64.details]) && typeof maybeRecord.details === "object" && !Array.isArray(maybeRecord.details)) {
|
|
947
1403
|
details.details = maybeRecord.details;
|
|
948
1404
|
}
|
|
949
|
-
if (_optionalChain([maybeRecord, 'optionalAccess',
|
|
1405
|
+
if (_optionalChain([maybeRecord, 'optionalAccess', _65 => _65.guidance]) && typeof maybeRecord.guidance === "object" && !Array.isArray(maybeRecord.guidance)) {
|
|
950
1406
|
details.guidance = maybeRecord.guidance;
|
|
951
1407
|
}
|
|
952
1408
|
const providerConcurrency = providerConcurrencyDiagnostic(maybeRecord);
|
|
953
1409
|
if (providerConcurrency) {
|
|
954
1410
|
details.providerConcurrency = providerConcurrency;
|
|
955
1411
|
}
|
|
956
|
-
if (typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
1412
|
+
if (typeof _optionalChain([maybeRecord, 'optionalAccess', _66 => _66.cause]) === "string") {
|
|
957
1413
|
details.cause = maybeRecord.cause;
|
|
958
1414
|
}
|
|
959
|
-
const statusCode = typeof _optionalChain([maybeRecord, 'optionalAccess',
|
|
1415
|
+
const statusCode = typeof _optionalChain([maybeRecord, 'optionalAccess', _67 => _67.statusCode]) === "number" ? maybeRecord.statusCode : typeof _optionalChain([maybeRecord, 'optionalAccess', _68 => _68.status]) === "number" ? maybeRecord.status : _nullishCoalesce(_optionalChain([toolFailure, 'optionalAccess', _69 => _69.statusCode]), () => ( void 0));
|
|
960
1416
|
return {
|
|
961
1417
|
ok: false,
|
|
962
1418
|
status: "failed",
|
|
@@ -1018,12 +1474,12 @@ function clip(value, maxLength) {
|
|
|
1018
1474
|
// src/cli/command-envelope.ts
|
|
1019
1475
|
function renderSections(render) {
|
|
1020
1476
|
const lines = [];
|
|
1021
|
-
for (const section of _nullishCoalesce(_optionalChain([render, 'optionalAccess',
|
|
1477
|
+
for (const section of _nullishCoalesce(_optionalChain([render, 'optionalAccess', _70 => _70.sections]), () => ( []))) {
|
|
1022
1478
|
if (!section.title || section.lines.length === 0) continue;
|
|
1023
1479
|
lines.push(section.title);
|
|
1024
1480
|
lines.push(...section.lines.map((line) => ` ${line}`));
|
|
1025
1481
|
}
|
|
1026
|
-
for (const action of _nullishCoalesce(_optionalChain([render, 'optionalAccess',
|
|
1482
|
+
for (const action of _nullishCoalesce(_optionalChain([render, 'optionalAccess', _71 => _71.actions]), () => ( []))) {
|
|
1027
1483
|
if (!action.label || !action.command) continue;
|
|
1028
1484
|
lines.push(`${action.label}: ${action.command}`);
|
|
1029
1485
|
}
|
|
@@ -1081,4 +1537,12 @@ function printCommandEnvelope(envelope, options = {}) {
|
|
|
1081
1537
|
|
|
1082
1538
|
|
|
1083
1539
|
|
|
1084
|
-
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
exports.parseJsonFields = parseJsonFields; exports.jsonFieldArgs = jsonFieldArgs; exports.describeArgs = describeArgs; exports.isJsonOutputMode = isJsonOutputMode; exports.installJsonStderrGuard = installJsonStderrGuard; exports.addJsonNotice = addJsonNotice; exports.writeRawStderr = writeRawStderr; exports.markJsonOutputHandled = markJsonOutputHandled; exports.takeSilentJsonFailureMessage = takeSilentJsonFailureMessage; exports.isFailureReportingDisabled = isFailureReportingDisabled; exports.redactFailureText = redactFailureText; exports.sanitizeCommand = sanitizeCommand; exports.failureReportHeaders = failureReportHeaders; exports.maybeReportAutomaticSkillsSyncFailure = maybeReportAutomaticSkillsSyncFailure; exports.resolveSdkCliFailureExitCode = resolveSdkCliFailureExitCode; exports.maybeReportSdkCliFailure = maybeReportSdkCliFailure; exports.getAuthedHttpClient = getAuthedHttpClient; exports.openInBrowser = openInBrowser; exports.sleep = sleep; exports.collectLocalEnvInfo = collectLocalEnvInfo; exports.readCsvRows = readCsvRows; exports.csvStringFromRows = csvStringFromRows; exports.csvSafeJsonString = csvSafeJsonString; exports.recordRows = recordRows; exports.dataExportRows = dataExportRows; exports.dataExportColumns = dataExportColumns; exports.dataExportCsvString = dataExportCsvString; exports.markdownTableFromRows = markdownTableFromRows; exports.printJson = printJson; exports.printCompactJson = printCompactJson; exports.formatToolExecutionErrorDiagnostic = formatToolExecutionErrorDiagnostic; exports.formatCliFailureDiagnostic = formatCliFailureDiagnostic; exports.errorToJsonPayload = errorToJsonPayload; exports.formatProviderConcurrencyDiagnostic = formatProviderConcurrencyDiagnostic; exports.printJsonError = printJsonError; exports.shouldEmitJson = shouldEmitJson; exports.argsWantJson = argsWantJson; exports.createTimestampedName = createTimestampedName; exports.clip = clip; exports.renderCommandEnvelopeText = renderCommandEnvelopeText; exports.printCommandEnvelope = printCommandEnvelope;
|