deepline 0.3.409 → 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 +206 -333
- 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-5HIIACF7.mjs → auth-LLXLIILR.mjs} +6 -6
- package/dist/cli/auth-UG4WOYGL.js +40 -0
- package/dist/cli/{billing-EVZ3ZWKC.mjs → billing-5FVXZYAC.mjs} +8 -8
- package/dist/cli/{billing-4275N7FL.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-TQNHMWUR.mjs → chunk-2YR7BIIC.mjs} +5 -2
- package/dist/cli/{chunk-AU4OFDFX.js → chunk-36AHOWVS.js} +26 -26
- package/dist/cli/{chunk-OSDXE27V.mjs → chunk-4PG4ARL2.mjs} +17 -10
- package/dist/cli/{chunk-PBZYY7VZ.mjs → chunk-4XQLVUC7.mjs} +734 -511
- package/dist/cli/chunk-5TUGWDEB.js +313 -0
- package/dist/cli/{chunk-DEC3JECC.js → chunk-5UUQAGJS.js} +5 -2
- package/dist/cli/{chunk-JRAVVJ3T.mjs → chunk-5V5Y37BC.mjs} +2 -2
- package/dist/cli/{chunk-PMVFAYL7.mjs → chunk-63ILLN5H.mjs} +2 -2
- package/dist/cli/{chunk-V76R6HMV.js → chunk-63S7X326.js} +1029 -806
- package/dist/cli/{chunk-VWBTTJYQ.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-GAICVLKL.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-FJCIUF34.js → chunk-FVLNYDI4.js} +128 -376
- package/dist/cli/{chunk-O3VSXP2F.js → chunk-FZJAM576.js} +50 -50
- package/dist/cli/{chunk-BZAMOCPA.mjs → chunk-IMZ56EOH.mjs} +3 -3
- package/dist/cli/{chunk-N44JHMKY.mjs → chunk-IPG42SD2.mjs} +452 -138
- package/dist/cli/chunk-J33TSWO5.js +8 -0
- package/dist/cli/{chunk-BEVLCKXG.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-WLOCMJWV.js → chunk-LTFL4JRN.js} +426 -721
- package/dist/cli/{chunk-YHPYUZZX.mjs → chunk-MAMVGOSC.mjs} +1 -1
- package/dist/cli/{chunk-NZSF57UO.mjs → chunk-MN2OWLFA.mjs} +2 -2
- package/dist/cli/{chunk-YD7B53RW.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-JGHG4NBA.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-FHPCKULR.mjs → chunk-PZSLPBDA.mjs} +2 -2
- package/dist/cli/{chunk-ILHRA7AD.js → chunk-QADCFSGH.js} +7 -7
- package/dist/cli/{chunk-RTCDW2GU.js → chunk-QJI5FIOW.js} +170 -49
- package/dist/cli/{chunk-WYQO2CBS.mjs → chunk-QL22Y56M.mjs} +149 -28
- package/dist/cli/{chunk-2PRO2JTX.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-2GI3QD3L.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-IT3XBJQR.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-WHG43Z67.js → chunk-ZFZ427HN.js} +11 -8
- package/dist/cli/{chunk-J6DCKJNM.mjs → chunk-ZKYEW55U.mjs} +16 -1
- package/dist/cli/{csv-BBOTCGQY.js → csv-7U3FJYKZ.js} +14 -14
- package/dist/cli/{csv-A2MP6EFV.mjs → csv-ZWLDMM4A.mjs} +5 -5
- package/dist/cli/{db-G4CODDCA.js → db-DNCGV5PC.js} +42 -47
- package/dist/cli/{db-3W5DMTUX.mjs → db-IMYXVMGI.mjs} +15 -20
- package/dist/cli/{describe-XYJ2ZT4M.mjs → describe-Q23DWJUK.mjs} +20 -15
- package/dist/cli/{describe-PQTQ5B6F.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-UR67CA5H.mjs → executions-A73EUGSI.mjs} +8 -8
- package/dist/cli/{executions-TLANVR7Y.js → executions-XOMPX2YJ.js} +10 -10
- package/dist/cli/{feedback-WHCMGEIL.mjs → feedback-N4GJ2POI.mjs} +11 -7
- package/dist/cli/{feedback-6C2YTRJL.js → feedback-QTCHNJJH.js} +13 -9
- package/dist/cli/{git-GWLB6VSA.mjs → git-4Q3JIQYZ.mjs} +6 -6
- package/dist/cli/git-I6CPBEVG.js +24 -0
- package/dist/cli/index.js +236 -348
- package/dist/cli/index.mjs +162 -274
- package/dist/cli/{legacy-noops-KF4XIFEF.mjs → legacy-noops-3SOVGFF7.mjs} +6 -6
- package/dist/cli/{legacy-noops-ZUFA7RWI.js → legacy-noops-4OSHZM34.js} +9 -9
- package/dist/cli/{monitors-TB3K2IVE.js → monitors-LVE2KZNG.js} +94 -94
- package/dist/cli/{monitors-6UOIDIMB.mjs → monitors-QP2XID2B.mjs} +8 -8
- package/dist/cli/{org-WGHHMVDZ.mjs → org-IVRETVQA.mjs} +8 -8
- package/dist/cli/{org-CKWMBPIR.js → org-XFLK5IAP.js} +68 -68
- package/dist/cli/{play-LYPAXCLD.mjs → play-DE7VH6NU.mjs} +533 -98
- package/dist/cli/{play-N2B3KAVS.js → play-XXTPPP23.js} +1067 -632
- package/dist/cli/{providers-UR42MD6Z.js → providers-DLD3I4JF.js} +11 -11
- package/dist/cli/{providers-6DI5BVZJ.mjs → providers-GX2NIZQQ.mjs} +8 -8
- package/dist/cli/{quickstart-MNA2S6PO.mjs → quickstart-72B4L4PK.mjs} +5 -5
- package/dist/cli/{quickstart-FCJG4XGB.js → quickstart-XNS3HSWC.js} +7 -7
- package/dist/cli/search-6NCH4HB5.js +30 -0
- package/dist/cli/{search-VPPYUJ2M.mjs → search-SUTRANJI.mjs} +9 -9
- package/dist/cli/{secrets-QOSMVO36.js → secrets-6OBLOVEV.js} +17 -17
- package/dist/cli/{secrets-DRI4W7Z5.mjs → secrets-FPFXXNUH.mjs} +8 -8
- package/dist/cli/sessions-235532DR.js +16 -0
- package/dist/cli/{sessions-DQNUKP43.mjs → sessions-R25I4QKN.mjs} +6 -6
- package/dist/cli/{settings-DWDK3Y2R.mjs → settings-AOP6F5PZ.mjs} +12 -12
- package/dist/cli/{settings-JUGGCOPS.js → settings-VL5FOFPN.js} +79 -79
- package/dist/cli/{setup-AWBHNYXK.js → setup-BSC67YT3.js} +45 -44
- package/dist/cli/{setup-D5DWVNY4.mjs → setup-ZMPHBHVJ.mjs} +11 -10
- package/dist/cli/skills-3IWLYYRL.js +29 -0
- package/dist/cli/{skills-YV2XR35J.mjs → skills-KF65TVFO.mjs} +7 -7
- package/dist/cli/tools-LR66SPYU.js +44 -0
- package/dist/cli/{tools-VFJYHNV2.mjs → tools-SX4XIPM7.mjs} +19 -14
- package/dist/cli/{update-IM6VOTGL.mjs → update-QRMFRAQQ.mjs} +11 -9
- package/dist/cli/update-SP7UEO53.js +31 -0
- package/dist/cli/{workflow-26URBWPV.mjs → workflow-FOEEEB7G.mjs} +44 -20
- package/dist/cli/{workflow-3BS6U6SL.js → workflow-KOCK2FLW.js} +54 -30
- package/dist/{client-BfInrZPB.d.mts → client-74k4IPh6.d.mts} +135 -54
- package/dist/{client-BMjJFpan.d.ts → client-C1IK1f8c.d.ts} +135 -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 +118 -102
- 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-F6BX32XZ.js +0 -40
- package/dist/cli/chunk-264PC2RN.mjs +0 -83
- package/dist/cli/chunk-44ZTYHMQ.mjs +0 -155
- package/dist/cli/chunk-53HN7WZN.js +0 -392
- package/dist/cli/chunk-7AALNGTA.mjs +0 -392
- package/dist/cli/chunk-ALD4COBH.js +0 -155
- package/dist/cli/chunk-CLJGSOVM.mjs +0 -1716
- package/dist/cli/chunk-WNUR6VP5.js +0 -83
- package/dist/cli/chunk-Z4VNJOF7.js +0 -1716
- package/dist/cli/git-VQFF6D7C.js +0 -24
- package/dist/cli/search-NCEEONMQ.js +0 -30
- package/dist/cli/sessions-3WYKQABW.js +0 -16
- package/dist/cli/skills-AKPAJVSO.js +0 -29
- package/dist/cli/tools-RBKEK6PM.js +0 -39
- package/dist/cli/update-VFNUBLDA.js +0 -29
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addDescribeOptions,
|
|
3
3
|
recordApiResponse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4PG4ARL2.mjs";
|
|
5
5
|
import {
|
|
6
6
|
recentSearchRef,
|
|
7
7
|
registerDeprecatedSearchCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XNZJKRJA.mjs";
|
|
9
9
|
import {
|
|
10
10
|
arrayField,
|
|
11
11
|
formatModelDescription,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
toolInputFieldsForDisplay,
|
|
25
25
|
toolMetadataJsonForDescribe,
|
|
26
26
|
toolOutputFieldsForDisplay
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-IMZ56EOH.mjs";
|
|
28
28
|
import {
|
|
29
29
|
shellQuote
|
|
30
30
|
} from "./chunk-OVDNJAJN.mjs";
|
|
@@ -32,6 +32,9 @@ import {
|
|
|
32
32
|
Capability,
|
|
33
33
|
observedMaxText
|
|
34
34
|
} from "./chunk-LJ5747UC.mjs";
|
|
35
|
+
import {
|
|
36
|
+
playToolListGetterMode
|
|
37
|
+
} from "./chunk-FR2ILQ4G.mjs";
|
|
35
38
|
import {
|
|
36
39
|
extractSummaryFields,
|
|
37
40
|
projectRowOutput,
|
|
@@ -39,22 +42,31 @@ import {
|
|
|
39
42
|
writeCsvOutputFile,
|
|
40
43
|
writeJsonOutputFile
|
|
41
44
|
} from "./chunk-FIVKWNMT.mjs";
|
|
42
|
-
import {
|
|
43
|
-
playToolListGetterMode
|
|
44
|
-
} from "./chunk-CLJGSOVM.mjs";
|
|
45
45
|
import {
|
|
46
46
|
DeeplineClient,
|
|
47
47
|
validateExecutionIdempotencyKey
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-4XQLVUC7.mjs";
|
|
49
49
|
import {
|
|
50
50
|
stableStringify
|
|
51
51
|
} from "./chunk-UBKA33KY.mjs";
|
|
52
52
|
import {
|
|
53
53
|
beginToolExecuteCommand,
|
|
54
54
|
getToolExecuteInvocationId,
|
|
55
|
+
maybeAutoUpdateAndRelaunch,
|
|
55
56
|
registerCompatibilityCatalog,
|
|
56
57
|
runToolExecuteStage
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-XHLKJOTN.mjs";
|
|
59
|
+
import {
|
|
60
|
+
isCliTraceEnabled,
|
|
61
|
+
recordCliTrace,
|
|
62
|
+
resolveCliMaintenancePolicy
|
|
63
|
+
} from "./chunk-ZKYEW55U.mjs";
|
|
64
|
+
import {
|
|
65
|
+
checkSdkCompatibility,
|
|
66
|
+
enforceSdkCompatibilityResponse,
|
|
67
|
+
flushDeferredSkillsSyncNotices,
|
|
68
|
+
syncSdkSkillsIfNeeded
|
|
69
|
+
} from "./chunk-XIHWSXSV.mjs";
|
|
58
70
|
import {
|
|
59
71
|
printCommandEnvelope,
|
|
60
72
|
printCompactJson,
|
|
@@ -62,14 +74,15 @@ import {
|
|
|
62
74
|
printJsonError,
|
|
63
75
|
renderCommandEnvelopeText,
|
|
64
76
|
shouldEmitJson
|
|
65
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-5V5Y37BC.mjs";
|
|
66
78
|
import {
|
|
79
|
+
readSdkSkillsLocalVersion,
|
|
67
80
|
resolveConfig,
|
|
68
81
|
sdkCliStateDirPath
|
|
69
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-RFB25DSQ.mjs";
|
|
70
83
|
import {
|
|
71
84
|
DeeplineError
|
|
72
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-E4IXDAZI.mjs";
|
|
73
86
|
|
|
74
87
|
// src/cli/commands/tools.ts
|
|
75
88
|
import { Option } from "commander";
|
|
@@ -251,6 +264,7 @@ function toolConnectionStatusMessage(input) {
|
|
|
251
264
|
}
|
|
252
265
|
|
|
253
266
|
// src/cli/commands/tools.ts
|
|
267
|
+
var TOOL_EXECUTE_PREFLIGHT_TIMEOUT_MS = 750;
|
|
254
268
|
var TOOL_COMMAND_TEMPLATES = {
|
|
255
269
|
describe: "deepline describe <toolId>",
|
|
256
270
|
execute: "deepline tools execute <toolId> --input '{...}'"
|
|
@@ -437,6 +451,17 @@ function categoryEnumerationRender(summaries) {
|
|
|
437
451
|
}
|
|
438
452
|
async function listToolCategories(emitJson, compact) {
|
|
439
453
|
const client = new DeeplineClient();
|
|
454
|
+
if (!emitJson) {
|
|
455
|
+
const summaries2 = (await client.listToolCategories()).map((category) => ({
|
|
456
|
+
...category,
|
|
457
|
+
description: describeToolCategory(category.name)
|
|
458
|
+
}));
|
|
459
|
+
printCommandEnvelope(
|
|
460
|
+
{ categories: summaries2, render: categoryEnumerationRender(summaries2) },
|
|
461
|
+
{ json: false }
|
|
462
|
+
);
|
|
463
|
+
return 0;
|
|
464
|
+
}
|
|
440
465
|
const rawTools = await client.listTools({ compact });
|
|
441
466
|
const items = rawTools.map(toListedTool);
|
|
442
467
|
const summaries = aggregateCategorySummaries(rawTools);
|
|
@@ -481,12 +506,11 @@ function unknownCategoryError(category, summaries, emitJson) {
|
|
|
481
506
|
}
|
|
482
507
|
async function listToolsInCategory(category, emitJson) {
|
|
483
508
|
const client = new DeeplineClient();
|
|
484
|
-
const rawTools = await client.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const summaries = aggregateCategorySummaries(allTools);
|
|
509
|
+
const { tools: rawTools, categories } = await client.listToolsInCategory(category);
|
|
510
|
+
const summaries = categories.map((item) => ({
|
|
511
|
+
...item,
|
|
512
|
+
description: describeToolCategory(item.name)
|
|
513
|
+
}));
|
|
490
514
|
if (!summaries.some((item) => item.name === category)) {
|
|
491
515
|
return unknownCategoryError(category, summaries, emitJson);
|
|
492
516
|
}
|
|
@@ -733,9 +757,6 @@ function playLikeToolExecuteErrorMessage(toolId, tool) {
|
|
|
733
757
|
'Or search provider tools only with: deepline search "<input you have -> result you need>" --type tools'
|
|
734
758
|
].join("\n");
|
|
735
759
|
}
|
|
736
|
-
function printPlayLikeToolExecuteError(toolId, tool) {
|
|
737
|
-
console.error(playLikeToolExecuteErrorMessage(toolId, tool));
|
|
738
|
-
}
|
|
739
760
|
var TOOL_ONLY_VIEWS = [
|
|
740
761
|
"compact",
|
|
741
762
|
"contractJson",
|
|
@@ -941,7 +962,7 @@ Examples:
|
|
|
941
962
|
process.exitCode = await narrowView();
|
|
942
963
|
return;
|
|
943
964
|
}
|
|
944
|
-
const { describeAnything } = await import("./describe-
|
|
965
|
+
const { describeAnything } = await import("./describe-Q23DWJUK.mjs");
|
|
945
966
|
process.exitCode = await describeAnything(
|
|
946
967
|
toolId,
|
|
947
968
|
{
|
|
@@ -1018,9 +1039,59 @@ Examples:
|
|
|
1018
1039
|
).option(
|
|
1019
1040
|
"--recovery-timeout-ms <milliseconds>",
|
|
1020
1041
|
"Maximum wait for a keyed execution to finish (default: 900000)"
|
|
1021
|
-
).action(
|
|
1022
|
-
|
|
1023
|
-
|
|
1042
|
+
).action(
|
|
1043
|
+
async (toolId, options, command) => {
|
|
1044
|
+
process.exitCode = await executeTool(
|
|
1045
|
+
toolId,
|
|
1046
|
+
options,
|
|
1047
|
+
void 0,
|
|
1048
|
+
true,
|
|
1049
|
+
resolveCliMaintenancePolicy(command.optsWithGlobals())
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
function beginDeferredToolExecuteCompatibility(toolId, cliInvocationId) {
|
|
1055
|
+
let metadata;
|
|
1056
|
+
const startedAt = performance.now();
|
|
1057
|
+
const baseUrl = resolveConfig().baseUrl;
|
|
1058
|
+
recordCliTrace({ phase: "cli.tool_execute_compatibility_start" });
|
|
1059
|
+
const result = runToolExecuteStage(
|
|
1060
|
+
"SDK compatibility",
|
|
1061
|
+
() => checkSdkCompatibility(baseUrl, {
|
|
1062
|
+
command: "tools execute",
|
|
1063
|
+
skillsVersion: readSdkSkillsLocalVersion(baseUrl),
|
|
1064
|
+
persistCache: false,
|
|
1065
|
+
timeoutMs: TOOL_EXECUTE_PREFLIGHT_TIMEOUT_MS,
|
|
1066
|
+
catalog: {
|
|
1067
|
+
toolId,
|
|
1068
|
+
cliInvocationId,
|
|
1069
|
+
purpose: "execution_warnings",
|
|
1070
|
+
acceptMetadata: (value) => {
|
|
1071
|
+
metadata = value;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
})
|
|
1075
|
+
).then(
|
|
1076
|
+
(compatibility) => {
|
|
1077
|
+
recordCliTrace({
|
|
1078
|
+
phase: "cli.tool_execute_compatibility_ready",
|
|
1079
|
+
ms: performance.now() - startedAt,
|
|
1080
|
+
ok: compatibility.error === null,
|
|
1081
|
+
hasMetadata: metadata !== void 0
|
|
1082
|
+
});
|
|
1083
|
+
return compatibility;
|
|
1084
|
+
},
|
|
1085
|
+
(error) => {
|
|
1086
|
+
recordCliTrace({
|
|
1087
|
+
phase: "cli.tool_execute_compatibility_ready",
|
|
1088
|
+
ms: performance.now() - startedAt,
|
|
1089
|
+
ok: false
|
|
1090
|
+
});
|
|
1091
|
+
throw error;
|
|
1092
|
+
}
|
|
1093
|
+
);
|
|
1094
|
+
return { result, readMetadata: () => metadata };
|
|
1024
1095
|
}
|
|
1025
1096
|
async function getTool(toolId, options = {}, compatibilityMetadata) {
|
|
1026
1097
|
if (!toolId) {
|
|
@@ -2300,9 +2371,23 @@ function buildToolExecuteRowArtifactEnvelope(input) {
|
|
|
2300
2371
|
}
|
|
2301
2372
|
};
|
|
2302
2373
|
}
|
|
2303
|
-
|
|
2374
|
+
function printToolExecutionWarnings(toolId, params, metadata) {
|
|
2375
|
+
if (metadata.deprecation?.message) {
|
|
2376
|
+
console.error(
|
|
2377
|
+
`Warning: ${toolId} is deprecated. ${metadata.deprecation.message}`
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
const requestWarning = firstMatchingToolRequestWarning(
|
|
2381
|
+
metadata.requestWarnings,
|
|
2382
|
+
params
|
|
2383
|
+
);
|
|
2384
|
+
if (requestWarning) {
|
|
2385
|
+
console.error(`Warning: ${requestWarning.message}`);
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
async function executeTool(toolId, options, compatibilityMetadata, deferCompatibility = false, maintenancePolicy = "configured") {
|
|
2304
2389
|
const output = toolExecuteJsonOption(options.json);
|
|
2305
|
-
const wantsJson =
|
|
2390
|
+
const wantsJson = (options.outputFormat ?? "auto").trim().toLowerCase() !== "csv";
|
|
2306
2391
|
let parsed;
|
|
2307
2392
|
try {
|
|
2308
2393
|
parsed = parseExecuteOptions(toolId, options, output);
|
|
@@ -2315,61 +2400,88 @@ async function executeTool(toolId, options) {
|
|
|
2315
2400
|
return error instanceof DeeplineError && error.code === "IDEMPOTENCY_KEY_INVALID" ? 2 : 1;
|
|
2316
2401
|
}
|
|
2317
2402
|
const cliInvocationId = getToolExecuteInvocationId() ?? beginToolExecuteCommand();
|
|
2403
|
+
const deferredCompatibility = deferCompatibility ? beginDeferredToolExecuteCompatibility(toolId, cliInvocationId) : void 0;
|
|
2404
|
+
const tracing = isCliTraceEnabled();
|
|
2405
|
+
const clientStartedAt = tracing ? performance.now() : void 0;
|
|
2318
2406
|
const client = new DeeplineClient();
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2407
|
+
if (clientStartedAt !== void 0) {
|
|
2408
|
+
recordCliTrace({
|
|
2409
|
+
phase: "cli.tool_execute_client_setup",
|
|
2410
|
+
ms: performance.now() - clientStartedAt
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2413
|
+
let metadata = compatibilityMetadata;
|
|
2414
|
+
const readMetadata = async () => {
|
|
2415
|
+
if (metadata) return metadata;
|
|
2416
|
+
try {
|
|
2417
|
+
metadata = await runToolExecuteStage(
|
|
2418
|
+
"tool metadata lookup",
|
|
2419
|
+
() => client.getTool(parsed.toolId, { cliInvocationId })
|
|
2330
2420
|
);
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2421
|
+
} catch (error) {
|
|
2422
|
+
if (isMissingToolMetadataError(error)) {
|
|
2423
|
+
const play = await runToolExecuteStage(
|
|
2424
|
+
"play alias lookup",
|
|
2425
|
+
() => findPlayForToolId(client, parsed.toolId, cliInvocationId)
|
|
2426
|
+
);
|
|
2427
|
+
if (play) {
|
|
2428
|
+
throw new DeeplineError(
|
|
2429
|
+
playAliasToolErrorMessage(parsed.toolId, play),
|
|
2430
|
+
400,
|
|
2431
|
+
"PLAY_ALIAS_USED_AS_TOOL"
|
|
2335
2432
|
);
|
|
2336
|
-
} else {
|
|
2337
|
-
printPlayAliasToolError(parsed.toolId, play);
|
|
2338
2433
|
}
|
|
2339
|
-
return 2;
|
|
2340
2434
|
}
|
|
2435
|
+
throw error;
|
|
2341
2436
|
}
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
metadata
|
|
2351
|
-
)
|
|
2352
|
-
)
|
|
2353
|
-
);
|
|
2354
|
-
} else {
|
|
2355
|
-
printPlayLikeToolExecuteError(
|
|
2356
|
-
parsed.toolId,
|
|
2357
|
-
metadata
|
|
2437
|
+
if (isPlayLikeTool(metadata)) {
|
|
2438
|
+
throw new DeeplineError(
|
|
2439
|
+
playLikeToolExecuteErrorMessage(
|
|
2440
|
+
parsed.toolId,
|
|
2441
|
+
metadata
|
|
2442
|
+
),
|
|
2443
|
+
400,
|
|
2444
|
+
"PLAY_ALIAS_USED_AS_TOOL"
|
|
2358
2445
|
);
|
|
2359
2446
|
}
|
|
2360
|
-
return
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2447
|
+
return metadata;
|
|
2448
|
+
};
|
|
2449
|
+
let executionWarningsPrinted = false;
|
|
2450
|
+
if (deferredCompatibility) {
|
|
2451
|
+
let preflightCompatibility;
|
|
2452
|
+
try {
|
|
2453
|
+
preflightCompatibility = await deferredCompatibility.result;
|
|
2454
|
+
} catch {
|
|
2455
|
+
}
|
|
2456
|
+
metadata = deferredCompatibility.readMetadata() ?? metadata;
|
|
2457
|
+
if (!metadata && preflightCompatibility?.response?.update_required !== true) {
|
|
2458
|
+
try {
|
|
2459
|
+
metadata = await readMetadata();
|
|
2460
|
+
} catch (error) {
|
|
2461
|
+
if (error instanceof DeeplineError && error.code === "PLAY_ALIAS_USED_AS_TOOL") {
|
|
2462
|
+
if (wantsJson) printJsonError(error);
|
|
2463
|
+
else console.error(error.message);
|
|
2464
|
+
return 2;
|
|
2465
|
+
}
|
|
2466
|
+
throw error;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
if (metadata) {
|
|
2470
|
+
printToolExecutionWarnings(parsed.toolId, parsed.params, metadata);
|
|
2471
|
+
executionWarningsPrinted = true;
|
|
2472
|
+
}
|
|
2473
|
+
} else {
|
|
2474
|
+
try {
|
|
2475
|
+
metadata = await readMetadata();
|
|
2476
|
+
} catch (error) {
|
|
2477
|
+
if (error instanceof DeeplineError && error.code === "PLAY_ALIAS_USED_AS_TOOL") {
|
|
2478
|
+
if (wantsJson) printJsonError(error);
|
|
2479
|
+
else console.error(error.message);
|
|
2480
|
+
return 2;
|
|
2481
|
+
}
|
|
2482
|
+
throw error;
|
|
2483
|
+
}
|
|
2484
|
+
printToolExecutionWarnings(parsed.toolId, parsed.params, metadata);
|
|
2373
2485
|
}
|
|
2374
2486
|
const responseIntent = parsed.outPath || parsed.outputFormat === "csv" || parsed.outputFormat === "csv_file" ? "row_artifact" : "raw";
|
|
2375
2487
|
const recovery = ToolCallRecovery.open({
|
|
@@ -2383,38 +2495,195 @@ async function executeTool(toolId, options) {
|
|
|
2383
2495
|
if (idempotencyKey) {
|
|
2384
2496
|
console.error(`Tool execution recovery key: ${idempotencyKey}`);
|
|
2385
2497
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2498
|
+
let submissionStartedAt = 0;
|
|
2499
|
+
const executeOptions = {
|
|
2500
|
+
...parsed.timeoutMs !== void 0 ? { timeout: parsed.timeoutMs } : {},
|
|
2501
|
+
responseIntent,
|
|
2502
|
+
...idempotencyKey ? { idempotencyKey } : {},
|
|
2503
|
+
...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {},
|
|
2504
|
+
searchRef: recentSearchRef(),
|
|
2505
|
+
cliInvocationId,
|
|
2506
|
+
onResponseReceived: recordApiResponse,
|
|
2507
|
+
...tracing ? {
|
|
2508
|
+
onServerTiming: (serverTiming) => recordCliTrace({
|
|
2509
|
+
phase: "tool_execute_server_timing",
|
|
2510
|
+
cliInvocationId,
|
|
2511
|
+
serverTiming,
|
|
2512
|
+
submissionToHeadersMs: performance.now() - submissionStartedAt
|
|
2513
|
+
})
|
|
2514
|
+
} : {}
|
|
2515
|
+
};
|
|
2516
|
+
let rawResponse;
|
|
2517
|
+
let successfulCompatibilityResponse;
|
|
2518
|
+
try {
|
|
2519
|
+
const executeResult = await runToolExecuteStage(
|
|
2520
|
+
"execute request",
|
|
2521
|
+
async () => {
|
|
2522
|
+
try {
|
|
2523
|
+
if (tracing) {
|
|
2524
|
+
submissionStartedAt = performance.now();
|
|
2525
|
+
recordCliTrace({ phase: "cli.tool_execute_request_start" });
|
|
2526
|
+
}
|
|
2527
|
+
return await client.executeTool(parsed.toolId, parsed.params, {
|
|
2528
|
+
...executeOptions,
|
|
2529
|
+
atomicToolOnly: true
|
|
2530
|
+
});
|
|
2531
|
+
} catch (error) {
|
|
2532
|
+
if (!(error instanceof DeeplineError) || error.code !== "ATOMIC_TOOL_EXECUTE_UNSUPPORTED")
|
|
2533
|
+
throw error;
|
|
2534
|
+
const baseUrl = resolveConfig().baseUrl;
|
|
2535
|
+
if (maintenancePolicy !== "off") {
|
|
2536
|
+
flushDeferredSkillsSyncNotices(baseUrl);
|
|
2537
|
+
}
|
|
2538
|
+
const compatibility = deferredCompatibility ? await deferredCompatibility.result : await runToolExecuteStage(
|
|
2539
|
+
"SDK compatibility",
|
|
2540
|
+
() => checkSdkCompatibility(baseUrl, {
|
|
2541
|
+
command: "tools execute",
|
|
2542
|
+
skillsVersion: readSdkSkillsLocalVersion(baseUrl),
|
|
2543
|
+
persistCache: maintenancePolicy !== "off"
|
|
2544
|
+
})
|
|
2405
2545
|
);
|
|
2546
|
+
if (compatibility.error) throw compatibility.error;
|
|
2547
|
+
metadata = deferredCompatibility?.readMetadata() ?? metadata;
|
|
2548
|
+
if (maintenancePolicy !== "off" && await maybeAutoUpdateAndRelaunch(
|
|
2549
|
+
compatibility.response,
|
|
2550
|
+
baseUrl,
|
|
2551
|
+
maintenancePolicy
|
|
2552
|
+
)) {
|
|
2553
|
+
return void 0;
|
|
2554
|
+
}
|
|
2555
|
+
enforceSdkCompatibilityResponse(compatibility.response, {
|
|
2556
|
+
quietAdvisory: wantsJson
|
|
2557
|
+
});
|
|
2558
|
+
if (maintenancePolicy !== "off") {
|
|
2559
|
+
await runToolExecuteStage(
|
|
2560
|
+
"agent skills sync",
|
|
2561
|
+
() => syncSdkSkillsIfNeeded(baseUrl, {
|
|
2562
|
+
update: compatibility.response?.skills,
|
|
2563
|
+
mode: "detached"
|
|
2564
|
+
})
|
|
2565
|
+
);
|
|
2566
|
+
}
|
|
2567
|
+
const legacyMetadata = await readMetadata();
|
|
2568
|
+
if (tracing) {
|
|
2569
|
+
submissionStartedAt = performance.now();
|
|
2570
|
+
recordCliTrace({ phase: "cli.tool_execute_request_start" });
|
|
2571
|
+
}
|
|
2572
|
+
return client.executeTool(parsed.toolId, parsed.params, {
|
|
2573
|
+
...executeOptions,
|
|
2574
|
+
...legacyMetadata.executionMetadata?.retrySafeTransientHttp === true ? { maxRetries: 2, retryApiErrors: true } : {}
|
|
2575
|
+
});
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
);
|
|
2579
|
+
if (executeResult === void 0) return 0;
|
|
2580
|
+
rawResponse = executeResult;
|
|
2581
|
+
} catch (error) {
|
|
2582
|
+
if (deferredCompatibility) {
|
|
2583
|
+
let compatibility;
|
|
2584
|
+
try {
|
|
2585
|
+
compatibility = await deferredCompatibility.result;
|
|
2586
|
+
} catch {
|
|
2587
|
+
}
|
|
2588
|
+
metadata = deferredCompatibility.readMetadata() ?? metadata;
|
|
2589
|
+
const updateRequiredBeforeExecution = error instanceof DeeplineError && error.code === "SDK_UPDATE_REQUIRED";
|
|
2590
|
+
if (updateRequiredBeforeExecution && maintenancePolicy !== "off" && compatibility && !compatibility.error) {
|
|
2591
|
+
const baseUrl = resolveConfig().baseUrl;
|
|
2592
|
+
if (await maybeAutoUpdateAndRelaunch(
|
|
2593
|
+
compatibility.response,
|
|
2594
|
+
baseUrl,
|
|
2595
|
+
maintenancePolicy
|
|
2596
|
+
)) {
|
|
2597
|
+
return 0;
|
|
2406
2598
|
}
|
|
2407
2599
|
}
|
|
2600
|
+
}
|
|
2601
|
+
if (error instanceof DeeplineError && error.code === "SDK_UPDATE_REQUIRED")
|
|
2408
2602
|
throw error;
|
|
2409
|
-
|
|
2603
|
+
let failure = error;
|
|
2604
|
+
try {
|
|
2605
|
+
await readMetadata();
|
|
2606
|
+
} catch (diagnosticError) {
|
|
2607
|
+
if (diagnosticError instanceof DeeplineError && diagnosticError.code === "PLAY_ALIAS_USED_AS_TOOL")
|
|
2608
|
+
failure = diagnosticError;
|
|
2609
|
+
}
|
|
2610
|
+
if (failure instanceof DeeplineError && failure.code === "PLAY_ALIAS_USED_AS_TOOL") {
|
|
2611
|
+
if (wantsJson) printJsonError(failure);
|
|
2612
|
+
else console.error(failure.message);
|
|
2613
|
+
return 2;
|
|
2614
|
+
}
|
|
2615
|
+
const guidanceLines = toolGuidanceLines(metadata?.guidance);
|
|
2616
|
+
if (guidanceLines.length > 0) {
|
|
2617
|
+
if (wantsJson && failure instanceof Error) {
|
|
2618
|
+
Object.assign(failure, { guidance: metadata?.guidance });
|
|
2619
|
+
} else {
|
|
2620
|
+
console.error(
|
|
2621
|
+
[`Guidance for ${parsed.toolId}:`, ...guidanceLines].join("\n")
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
throw failure;
|
|
2626
|
+
}
|
|
2627
|
+
if (deferredCompatibility) {
|
|
2628
|
+
let compatibility;
|
|
2629
|
+
try {
|
|
2630
|
+
compatibility = await deferredCompatibility.result;
|
|
2631
|
+
} catch {
|
|
2632
|
+
}
|
|
2633
|
+
metadata = deferredCompatibility.readMetadata() ?? metadata;
|
|
2634
|
+
const compatibilityResponse = compatibility?.response;
|
|
2635
|
+
successfulCompatibilityResponse = compatibilityResponse ?? void 0;
|
|
2636
|
+
const autoUpdate = compatibilityResponse?.auto_update;
|
|
2637
|
+
if (maintenancePolicy !== "off" && compatibilityResponse && autoUpdate?.should_auto_update && !autoUpdate.required && autoUpdate.reason !== "rollback_forced") {
|
|
2638
|
+
await maybeAutoUpdateAndRelaunch(
|
|
2639
|
+
compatibilityResponse,
|
|
2640
|
+
resolveConfig().baseUrl,
|
|
2641
|
+
maintenancePolicy
|
|
2642
|
+
);
|
|
2643
|
+
}
|
|
2644
|
+
if (!metadata) {
|
|
2645
|
+
try {
|
|
2646
|
+
metadata = await readMetadata();
|
|
2647
|
+
} catch {
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
if (metadata && !executionWarningsPrinted) {
|
|
2651
|
+
printToolExecutionWarnings(parsed.toolId, parsed.params, metadata);
|
|
2652
|
+
} else if (!metadata) {
|
|
2653
|
+
console.error(
|
|
2654
|
+
`Warning: execution metadata for ${parsed.toolId} was unavailable; the result is unchanged.`
|
|
2655
|
+
);
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
const responseMetadata = recordField(
|
|
2659
|
+
recordField(rawResponse, "_metadata"),
|
|
2660
|
+
"tool"
|
|
2410
2661
|
);
|
|
2662
|
+
const listOutputPaths = responseMetadata.listOutputPaths;
|
|
2663
|
+
let listExtractorPaths;
|
|
2664
|
+
if (Array.isArray(listOutputPaths) && listOutputPaths.every((path) => typeof path === "string")) {
|
|
2665
|
+
listExtractorPaths = listOutputPaths;
|
|
2666
|
+
} else {
|
|
2667
|
+
listExtractorPaths = listExtractorPathsFromUsageGuidance(
|
|
2668
|
+
await readMetadata()
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2671
|
+
if (isRecord(rawResponse)) {
|
|
2672
|
+
const { _metadata, ...execution } = rawResponse;
|
|
2673
|
+
rawResponse = execution;
|
|
2674
|
+
}
|
|
2411
2675
|
const { listConversion, summary, baseEnvelope } = await runToolExecuteStage(
|
|
2412
2676
|
"result formatting",
|
|
2413
|
-
() => {
|
|
2414
|
-
const listExtractorPaths = listExtractorPathsFromUsageGuidance(metadata);
|
|
2677
|
+
async () => {
|
|
2415
2678
|
const listConversion2 = tryConvertToList(rawResponse, {
|
|
2416
2679
|
listExtractorPaths
|
|
2417
2680
|
});
|
|
2681
|
+
if (toolExecuteExitCode(commandEnvelopeFromRawResponse(rawResponse)) !== 0 || listExtractorPaths.length > 0 && !listConversion2) {
|
|
2682
|
+
try {
|
|
2683
|
+
await readMetadata();
|
|
2684
|
+
} catch {
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2418
2687
|
const summary2 = extractSummaryFields(rawResponse);
|
|
2419
2688
|
const baseEnvelope2 = buildToolExecuteBaseEnvelope({
|
|
2420
2689
|
toolId: parsed.toolId,
|
|
@@ -2423,16 +2692,45 @@ async function executeTool(toolId, options) {
|
|
|
2423
2692
|
rawResponse,
|
|
2424
2693
|
listConversion: listConversion2,
|
|
2425
2694
|
summary: summary2,
|
|
2426
|
-
guidance: metadata
|
|
2695
|
+
guidance: metadata?.guidance,
|
|
2427
2696
|
listExpected: listExtractorPaths.length > 0
|
|
2428
2697
|
});
|
|
2429
2698
|
return { listConversion: listConversion2, summary: summary2, baseEnvelope: baseEnvelope2 };
|
|
2430
2699
|
}
|
|
2431
2700
|
);
|
|
2432
2701
|
const executeExitCode = toolExecuteExitCode(baseEnvelope);
|
|
2433
|
-
const
|
|
2702
|
+
const deliveredCompatibilityResponse = successfulCompatibilityResponse;
|
|
2703
|
+
let skillsSyncAttempted = false;
|
|
2704
|
+
const syncSkillsForDeliveredOutput = async () => {
|
|
2705
|
+
if (skillsSyncAttempted || maintenancePolicy === "off" || !deliveredCompatibilityResponse) {
|
|
2706
|
+
return;
|
|
2707
|
+
}
|
|
2708
|
+
skillsSyncAttempted = true;
|
|
2709
|
+
try {
|
|
2710
|
+
await runToolExecuteStage(
|
|
2711
|
+
"agent skills sync",
|
|
2712
|
+
() => syncSdkSkillsIfNeeded(resolveConfig().baseUrl, {
|
|
2713
|
+
update: deliveredCompatibilityResponse.skills,
|
|
2714
|
+
mode: "detached"
|
|
2715
|
+
})
|
|
2716
|
+
);
|
|
2717
|
+
} catch (error) {
|
|
2718
|
+
console.error(
|
|
2719
|
+
`Warning: automatic skills sync failed; the tool result is unchanged. ${error instanceof Error ? error.message : String(error)}`
|
|
2720
|
+
);
|
|
2721
|
+
}
|
|
2722
|
+
};
|
|
2723
|
+
const printDeliveredEnvelope = (envelope, options2 = {}) => printCommandEnvelope(envelope, {
|
|
2724
|
+
...options2,
|
|
2725
|
+
json: options2.json ?? wantsJson
|
|
2726
|
+
});
|
|
2727
|
+
const printDeliveredJsonEnvelope = async (envelope, options2 = {}) => {
|
|
2728
|
+
await syncSkillsForDeliveredOutput();
|
|
2729
|
+
printCommandEnvelope(envelope, { ...options2, json: true });
|
|
2730
|
+
};
|
|
2731
|
+
const delivered = await runToolExecuteStage("output delivery", async () => {
|
|
2434
2732
|
if (!parsed.outPath && (parsed.outputFormat === "json" || parsed.outputFormat === "auto" && wantsJson)) {
|
|
2435
|
-
|
|
2733
|
+
await printDeliveredJsonEnvelope(baseEnvelope);
|
|
2436
2734
|
return true;
|
|
2437
2735
|
}
|
|
2438
2736
|
if (parsed.outputFormat === "json_file") {
|
|
@@ -2440,16 +2738,13 @@ async function executeTool(toolId, options) {
|
|
|
2440
2738
|
rawResponse,
|
|
2441
2739
|
`payload_${parsed.toolId}`
|
|
2442
2740
|
);
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
local: {
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
},
|
|
2451
|
-
{ json: true }
|
|
2452
|
-
);
|
|
2741
|
+
await printDeliveredJsonEnvelope({
|
|
2742
|
+
...baseEnvelope,
|
|
2743
|
+
local: {
|
|
2744
|
+
...isRecord(baseEnvelope.local) ? baseEnvelope.local : {},
|
|
2745
|
+
payload_file: jsonPath
|
|
2746
|
+
}
|
|
2747
|
+
});
|
|
2453
2748
|
return true;
|
|
2454
2749
|
}
|
|
2455
2750
|
if (!listConversion) {
|
|
@@ -2473,18 +2768,20 @@ async function executeTool(toolId, options) {
|
|
|
2473
2768
|
rawResponse,
|
|
2474
2769
|
`payload_${parsed.toolId}`
|
|
2475
2770
|
);
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2771
|
+
const payloadEnvelope = {
|
|
2772
|
+
...baseEnvelope,
|
|
2773
|
+
local: {
|
|
2774
|
+
payload_file: jsonPath
|
|
2775
|
+
}
|
|
2776
|
+
};
|
|
2777
|
+
if (parsed.outputFormat === "csv_file" || wantsJson) {
|
|
2778
|
+
await printDeliveredJsonEnvelope(payloadEnvelope);
|
|
2779
|
+
} else {
|
|
2780
|
+
printDeliveredEnvelope(payloadEnvelope);
|
|
2781
|
+
}
|
|
2485
2782
|
return true;
|
|
2486
2783
|
}
|
|
2487
|
-
|
|
2784
|
+
await printDeliveredEnvelope(baseEnvelope, { json: false });
|
|
2488
2785
|
return true;
|
|
2489
2786
|
}
|
|
2490
2787
|
const rowOutput = projectRowOutput(listConversion);
|
|
@@ -2508,7 +2805,7 @@ async function executeTool(toolId, options) {
|
|
|
2508
2805
|
seededScript
|
|
2509
2806
|
});
|
|
2510
2807
|
if (parsed.outputFormat === "csv_file") {
|
|
2511
|
-
|
|
2808
|
+
await printDeliveredJsonEnvelope(materializedEnvelope);
|
|
2512
2809
|
return true;
|
|
2513
2810
|
}
|
|
2514
2811
|
if (parsed.outPath) {
|
|
@@ -2516,31 +2813,42 @@ async function executeTool(toolId, options) {
|
|
|
2516
2813
|
toolId: parsed.toolId,
|
|
2517
2814
|
idempotencyKey
|
|
2518
2815
|
});
|
|
2519
|
-
|
|
2520
|
-
json: wantsJson,
|
|
2521
|
-
text: `Wrote ${csv.rowCount} row(s) to ${csv.path}
|
|
2816
|
+
const outputText = `Wrote ${csv.rowCount} row(s) to ${csv.path}
|
|
2522
2817
|
inspect: ${inspection.inspect}
|
|
2523
|
-
|
|
2524
|
-
|
|
2818
|
+
`;
|
|
2819
|
+
if (wantsJson) {
|
|
2820
|
+
await printDeliveredJsonEnvelope(materializedEnvelope, {
|
|
2821
|
+
text: outputText
|
|
2822
|
+
});
|
|
2823
|
+
} else {
|
|
2824
|
+
printDeliveredEnvelope(materializedEnvelope, { text: outputText });
|
|
2825
|
+
}
|
|
2525
2826
|
return true;
|
|
2526
2827
|
}
|
|
2527
2828
|
if (parsed.noPreview) {
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
local
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2829
|
+
const outputEnvelope = {
|
|
2830
|
+
...materializedEnvelope,
|
|
2831
|
+
local: {
|
|
2832
|
+
...materializedEnvelope.local ?? {},
|
|
2833
|
+
output_path: csv.path
|
|
2834
|
+
}
|
|
2835
|
+
};
|
|
2836
|
+
if (wantsJson) {
|
|
2837
|
+
await printDeliveredJsonEnvelope(outputEnvelope, {
|
|
2838
|
+
text: `${csv.path}
|
|
2839
|
+
`
|
|
2840
|
+
});
|
|
2841
|
+
} else {
|
|
2842
|
+
printDeliveredEnvelope(outputEnvelope, { text: `${csv.path}
|
|
2843
|
+
` });
|
|
2844
|
+
}
|
|
2539
2845
|
return true;
|
|
2540
2846
|
}
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
}
|
|
2847
|
+
if (wantsJson && parsed.outputFormat !== "csv") {
|
|
2848
|
+
await printDeliveredJsonEnvelope(materializedEnvelope);
|
|
2849
|
+
} else {
|
|
2850
|
+
printDeliveredEnvelope(materializedEnvelope);
|
|
2851
|
+
}
|
|
2544
2852
|
return true;
|
|
2545
2853
|
});
|
|
2546
2854
|
if (delivered) {
|
|
@@ -2549,6 +2857,12 @@ inspect: ${inspection.inspect}
|
|
|
2549
2857
|
() => recovery.acknowledgeDelivery()
|
|
2550
2858
|
);
|
|
2551
2859
|
}
|
|
2860
|
+
if (delivered && deliveredCompatibilityResponse && deliveredCompatibilityResponse.update_required !== true) {
|
|
2861
|
+
enforceSdkCompatibilityResponse(deliveredCompatibilityResponse, {
|
|
2862
|
+
quietAdvisory: wantsJson || maintenancePolicy === "off" || deliveredCompatibilityResponse.auto_update?.should_auto_update === true
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
if (delivered && !skillsSyncAttempted) await syncSkillsForDeliveredOutput();
|
|
2552
2866
|
return delivered ? executeExitCode : 1;
|
|
2553
2867
|
}
|
|
2554
2868
|
|