deepline 0.3.324 → 0.3.326
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client.ts +23 -25
- package/dist/bundling-sources/sdk/src/compat.ts +11 -6
- package/dist/bundling-sources/sdk/src/db/query.ts +172 -0
- package/dist/bundling-sources/sdk/src/errors.ts +35 -0
- package/dist/bundling-sources/sdk/src/index.ts +13 -0
- package/dist/bundling-sources/sdk/src/play.ts +34 -31
- package/dist/bundling-sources/sdk/src/plays/authoring-graph-path.ts +13 -0
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +2 -1
- package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +189 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +84 -10
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +9 -0
- package/dist/cli/auth-6STWK6UK.js +31 -0
- package/dist/cli/{auth-6KWNR6AI.mjs → auth-VON5FFUK.mjs} +4 -4
- package/dist/cli/{billing-VQ2NUJLB.mjs → billing-X6JUEFRE.mjs} +4 -4
- package/dist/cli/{billing-CLLWHIAT.js → billing-YI4RZI2O.js} +70 -70
- package/dist/cli/{chunk-NC2ZXG2Y.js → chunk-3NGWGFVL.js} +26 -26
- package/dist/cli/{chunk-5CQ554BM.mjs → chunk-4AB4Y6FF.mjs} +1 -1
- package/dist/cli/{chunk-EXKRHZRG.js → chunk-4LNBSQM4.js} +5928 -5730
- package/dist/cli/{chunk-G4F2AIQ5.js → chunk-5NXHSRRE.js} +6 -6
- package/dist/cli/{chunk-XNL3SEMC.js → chunk-AFNEQ43J.js} +8 -3
- package/dist/cli/{chunk-XSEMQ4II.js → chunk-AGH6YP2T.js} +2 -1
- package/dist/cli/chunk-AID3OYVJ.js +8 -0
- package/dist/cli/{chunk-HHZDWBSQ.mjs → chunk-BQJVMKWL.mjs} +1 -1
- package/dist/cli/{chunk-TJGJTB5T.mjs → chunk-BR7GGTAE.mjs} +24 -1
- package/dist/cli/{chunk-IXYR65PW.js → chunk-BUYZEUY4.js} +1 -1
- package/dist/cli/{chunk-GROXVGGW.js → chunk-CUUHQ3AO.js} +6 -6
- package/dist/cli/{chunk-NIOFMRYW.mjs → chunk-DFDXKOLR.mjs} +98 -113
- package/dist/cli/{chunk-GMO3NBE2.js → chunk-EMZ7Y5SW.js} +70 -67
- package/dist/cli/chunk-GVESPYSY.mjs +234 -0
- package/dist/cli/{chunk-N5E66DP3.js → chunk-GVYKY6T6.js} +344 -254
- package/dist/cli/{chunk-EHSI2DMO.mjs → chunk-IQCCGOQH.mjs} +4 -20
- package/dist/cli/{chunk-76VKBPOC.mjs → chunk-JOA6IKDE.mjs} +7 -2
- package/dist/cli/{chunk-3ZKAKQYC.mjs → chunk-KLWBAQ5A.mjs} +104 -14
- package/dist/cli/{chunk-PAA4FYCF.js → chunk-KZ4PCK4O.js} +29 -45
- package/dist/cli/chunk-LVEDPCLJ.js +234 -0
- package/dist/cli/{chunk-I7RLL7LN.mjs → chunk-M7CPVMDB.mjs} +1 -1
- package/dist/cli/{chunk-2UQUOUAW.js → chunk-MDQZQ3NY.js} +2 -2
- package/dist/cli/{chunk-V5PA6TCT.js → chunk-MKHSZA2X.js} +48 -48
- package/dist/cli/{chunk-LHJKYMTS.mjs → chunk-MOBZS4F3.mjs} +1 -1
- package/dist/cli/chunk-OVDNJAJN.mjs +8 -0
- package/dist/cli/{chunk-QM2Z4FQF.js → chunk-T33W6JUJ.js} +6 -6
- package/dist/cli/{chunk-DO2VA5UP.mjs → chunk-TDSNAC3C.mjs} +2 -2
- package/dist/cli/{chunk-D5YJHGST.js → chunk-TXVOB5J2.js} +29 -6
- package/dist/cli/{chunk-TZZNI2A4.js → chunk-TZQMFWLF.js} +147 -162
- package/dist/cli/{chunk-NQJQ3CLX.mjs → chunk-VGKVLADU.mjs} +3 -3
- package/dist/cli/{chunk-U2RPP53P.mjs → chunk-VKXGOQG5.mjs} +5674 -5476
- package/dist/cli/{chunk-AKM5JVPG.mjs → chunk-W74E5ETE.mjs} +12 -9
- package/dist/cli/{chunk-7PZFGB7L.mjs → chunk-YIY74KUF.mjs} +2 -1
- package/dist/cli/{chunk-5QZFWY7C.mjs → chunk-ZRN6YOF2.mjs} +2 -2
- package/dist/cli/client-TEBW2P24.js +20 -0
- package/dist/cli/{client-VHUKTDAZ.mjs → client-ZMOKUNL2.mjs} +3 -3
- package/dist/cli/{csv-5MZY7HU5.js → csv-HZRKEI7J.js} +12 -12
- package/dist/cli/{csv-7DA4APB6.mjs → csv-IICJHJZ4.mjs} +3 -3
- package/dist/cli/{db-ICG3FUVE.js → db-TM5NZF73.js} +226 -149
- package/dist/cli/{db-7UPW3N5U.mjs → db-X4B7YFNY.mjs} +214 -137
- package/dist/cli/{describe-VDRY2JCE.js → describe-BDBARWZJ.js} +28 -27
- package/dist/cli/{describe-ZAPGM5ND.mjs → describe-GMVS3LFC.mjs} +12 -11
- package/dist/cli/{executions-TK3C2FAQ.mjs → executions-447ZJMN4.mjs} +4 -4
- package/dist/cli/{executions-D5GYCY3A.js → executions-QX25UOQM.js} +6 -6
- package/dist/cli/{feedback-PZAZZUXF.js → feedback-4IXUTBX7.js} +6 -6
- package/dist/cli/{feedback-T4EIP5QR.mjs → feedback-JB7HHIC6.mjs} +3 -3
- package/dist/cli/git-C7C7DTEH.js +23 -0
- package/dist/cli/{git-WBFWIVO5.mjs → git-VID6KGAA.mjs} +4 -4
- package/dist/cli/index.js +105 -87
- package/dist/cli/index.mjs +65 -47
- package/dist/cli/{legacy-noops-LRBJWXRK.js → legacy-noops-3FYTCOZO.js} +7 -7
- package/dist/cli/{legacy-noops-DUCK7OKN.mjs → legacy-noops-SGR3G5WS.mjs} +4 -4
- package/dist/cli/{monitors-WYH5AQIO.mjs → monitors-SH4FOMBM.mjs} +4 -4
- package/dist/cli/{monitors-7S2SL62G.js → monitors-SP52UHS4.js} +85 -85
- package/dist/cli/{org-XCSMLTUW.mjs → org-B32MMIQT.mjs} +4 -4
- package/dist/cli/{org-EQNGGHPV.js → org-UQMX7JOR.js} +60 -60
- package/dist/cli/play-UCIWBN7U.js +153 -0
- package/dist/cli/{play-A5ISFBJM.mjs → play-XTE4LUP7.mjs} +11 -10
- package/dist/cli/{providers-DR2CLD3N.js → providers-JNMJJ2OH.js} +7 -7
- package/dist/cli/{providers-KHTZFQ5I.mjs → providers-RWLN6FUR.mjs} +4 -4
- package/dist/cli/{quickstart-NIRWI6YU.js → quickstart-HK6WZ342.js} +5 -5
- package/dist/cli/{quickstart-KT4LKORA.mjs → quickstart-IDB3Y375.mjs} +3 -3
- package/dist/cli/{search-WCEXPBAT.mjs → search-6D3IFNPT.mjs} +5 -5
- package/dist/cli/search-LUZ2S7DH.js +26 -0
- package/dist/cli/{secrets-QSFEZGVE.js → secrets-JOQB57IE.js} +13 -13
- package/dist/cli/{secrets-TN7DW3QR.mjs → secrets-TZ53CQ3D.mjs} +4 -4
- package/dist/cli/{sessions-WSE5FN4H.mjs → sessions-4MBDC4EK.mjs} +4 -4
- package/dist/cli/{sessions-LJS6W67T.js → sessions-QSAICDXX.js} +5 -5
- package/dist/cli/{settings-FGS3VYJN.js → settings-OTOCW7L7.js} +74 -74
- package/dist/cli/{settings-Z3V53A6J.mjs → settings-RKQFMLDU.mjs} +7 -7
- package/dist/cli/{setup-GMH4VJS3.mjs → setup-2S5TNTUB.mjs} +6 -6
- package/dist/cli/{setup-ZA234HEY.js → setup-AKZUDVYY.js} +41 -41
- package/dist/cli/skills-26LASHZF.js +28 -0
- package/dist/cli/{skills-7G2RZMYH.mjs → skills-AGZXDLSA.mjs} +4 -4
- package/dist/cli/{tools-7EE4BGXO.mjs → tools-7Y6RD6FY.mjs} +8 -7
- package/dist/cli/tools-L5VIJQWX.js +39 -0
- package/dist/cli/{update-O5QEWS7K.mjs → update-M7YGF67I.mjs} +6 -6
- package/dist/cli/update-MNHF6M2F.js +28 -0
- package/dist/cli/{workflow-KE54RUTR.mjs → workflow-CTVE7S7W.mjs} +5 -5
- package/dist/cli/{workflow-M5PAAW3O.js → workflow-NGMY425T.js} +15 -15
- package/dist/{client-BV68GMPo.d.ts → client-DHq8dJ56.d.ts} +45 -11
- package/dist/{client-D9ACjiRC.d.mts → client-wiWPZhnI.d.mts} +45 -11
- package/dist/{compiler-manifest-BXcZ4P4W.d.mts → compiler-manifest-9TkZ_ykI.d.mts} +717 -711
- package/dist/{compiler-manifest-BXcZ4P4W.d.ts → compiler-manifest-9TkZ_ykI.d.ts} +717 -711
- package/dist/index-B-5_Xhud.d.mts +75 -0
- package/dist/index-ykksoEyR.d.ts +75 -0
- package/dist/index.d.mts +52 -13
- package/dist/index.d.ts +52 -13
- package/dist/index.js +92 -28
- package/dist/index.mjs +91 -27
- package/dist/install-integrity.json +91 -84
- package/dist/plays/bundle-play-file.d.mts +7 -75
- package/dist/plays/bundle-play-file.d.ts +7 -75
- package/dist/plays/bundle-play-file.mjs +1 -1
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +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/package.json +1 -1
- package/dist/cli/auth-LKSTC3YV.js +0 -31
- package/dist/cli/chunk-OWJZUE3Y.mjs +0 -103
- package/dist/cli/chunk-SDK3ZA2C.js +0 -103
- package/dist/cli/client-WMSTRUGP.js +0 -20
- package/dist/cli/git-73N6EUZ3.js +0 -23
- package/dist/cli/play-CLC2Z5SO.js +0 -152
- package/dist/cli/search-DM7IQS5F.js +0 -26
- package/dist/cli/skills-6APAQV6W.js +0 -28
- package/dist/cli/tools-EPYUFWPB.js +0 -38
- package/dist/cli/update-FPVX3XJC.js +0 -28
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkCUUHQ3AOjs = require('./chunk-CUUHQ3AO.js');
|
|
5
5
|
|
|
6
6
|
// src/cli/commands/sessions.ts
|
|
7
7
|
|
|
@@ -420,7 +420,7 @@ function buildSessionUploadContent(raw) {
|
|
|
420
420
|
return { encodedContent: encoded, needsChunking: true };
|
|
421
421
|
}
|
|
422
422
|
async function uploadPayload(path, payload) {
|
|
423
|
-
const { http } =
|
|
423
|
+
const { http } = _chunkCUUHQ3AOjs.getAuthedHttpClient.call(void 0, );
|
|
424
424
|
return await http.post(path, payload);
|
|
425
425
|
}
|
|
426
426
|
async function uploadChunkedSessions(sessions, options) {
|
|
@@ -452,7 +452,7 @@ async function uploadChunkedSessions(sessions, options) {
|
|
|
452
452
|
environments: sessions.map(() => detectShellContext()),
|
|
453
453
|
...options.rating ? { rating: options.rating } : {}
|
|
454
454
|
});
|
|
455
|
-
|
|
455
|
+
_chunkCUUHQ3AOjs.printCommandEnvelope.call(void 0,
|
|
456
456
|
{
|
|
457
457
|
...response,
|
|
458
458
|
ok: true,
|
|
@@ -481,7 +481,7 @@ async function handleSessionsSend(options) {
|
|
|
481
481
|
filename: _path.basename.call(void 0, filePath),
|
|
482
482
|
...rating ? { rating } : {}
|
|
483
483
|
});
|
|
484
|
-
|
|
484
|
+
_chunkCUUHQ3AOjs.printCommandEnvelope.call(void 0,
|
|
485
485
|
{
|
|
486
486
|
...response2,
|
|
487
487
|
ok: true,
|
|
@@ -530,7 +530,7 @@ async function handleSessionsSend(options) {
|
|
|
530
530
|
environment: detectShellContext(),
|
|
531
531
|
...rating ? { rating } : {}
|
|
532
532
|
});
|
|
533
|
-
|
|
533
|
+
_chunkCUUHQ3AOjs.printCommandEnvelope.call(void 0,
|
|
534
534
|
{
|
|
535
535
|
...response,
|
|
536
536
|
ok: true,
|
|
@@ -635,7 +635,7 @@ ${refreshMeta}
|
|
|
635
635
|
</body>
|
|
636
636
|
</html>`;
|
|
637
637
|
_fs.writeFileSync.call(void 0, outputPath, html, "utf8");
|
|
638
|
-
|
|
638
|
+
_chunkCUUHQ3AOjs.printCommandEnvelope.call(void 0,
|
|
639
639
|
{
|
|
640
640
|
ok: true,
|
|
641
641
|
file: outputPath,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkAID3OYVJjs = require('./chunk-AID3OYVJ.js');
|
|
4
|
+
|
|
5
|
+
// src/cli/described.ts
|
|
2
6
|
var SHAPE = "{}";
|
|
3
7
|
var SCHEMA_LINE_LIMIT = 100;
|
|
4
8
|
function isRecord(value) {
|
|
@@ -288,9 +292,10 @@ function examples(described, options) {
|
|
|
288
292
|
if (runner.via === "monitor") return { cli: runner.deploy, play: null };
|
|
289
293
|
if (runner.via === "tool") {
|
|
290
294
|
return {
|
|
291
|
-
cli: `deepline tools execute ${runner.toolId} --input
|
|
295
|
+
cli: `deepline tools execute ${runner.toolId} --input ${_chunkAID3OYVJjs.shellQuote.call(void 0, input)}`,
|
|
292
296
|
play: [
|
|
293
297
|
"const result = await ctx.tools.execute({",
|
|
298
|
+
" staleAfterSeconds: 0,",
|
|
294
299
|
` id: '${safeIdentifier(runner.toolId)}',`,
|
|
295
300
|
` tool: '${runner.toolId}',`,
|
|
296
301
|
` input: ${input},`,
|
|
@@ -300,7 +305,7 @@ function examples(described, options) {
|
|
|
300
305
|
};
|
|
301
306
|
}
|
|
302
307
|
return {
|
|
303
|
-
cli: _nullishCoalesce(runner.cli, () => ( `deepline plays run ${runner.reference} --input
|
|
308
|
+
cli: _nullishCoalesce(runner.cli, () => ( `deepline plays run ${runner.reference} --input ${_chunkAID3OYVJjs.shellQuote.call(void 0, input)}`)),
|
|
304
309
|
play: [
|
|
305
310
|
`const output = await ctx.runPlay('${safeIdentifier(runner.reference.replace(/^.*\//, ""))}', '${runner.reference}', ${input});`,
|
|
306
311
|
...reads((field) => `output.${field.name}`)
|
|
@@ -3408,7 +3408,8 @@ async function bundlePlayFile2(filePath, options = {}) {
|
|
|
3408
3408
|
exportName: options.exportName,
|
|
3409
3409
|
adapter: {
|
|
3410
3410
|
...createSdkPlayBundlingAdapter(),
|
|
3411
|
-
sourceIdentityRoot
|
|
3411
|
+
sourceIdentityRoot,
|
|
3412
|
+
...options.cache === false ? { cacheDir: null } : {}
|
|
3412
3413
|
}
|
|
3413
3414
|
});
|
|
3414
3415
|
if (result.success)
|
|
@@ -49,7 +49,7 @@ var SDK_RELEASE = {
|
|
|
49
49
|
// getters keep their established compatibility behavior.
|
|
50
50
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
51
51
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
52
|
-
version: "0.3.
|
|
52
|
+
version: "0.3.326",
|
|
53
53
|
updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
|
|
54
54
|
packageCapabilities: {
|
|
55
55
|
updatePreferences: 1
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-DLIRSHV6.mjs";
|
|
5
5
|
import {
|
|
6
6
|
SDK_RELEASE
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BQJVMKWL.mjs";
|
|
8
8
|
import {
|
|
9
9
|
DeeplineError,
|
|
10
10
|
TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
|
|
@@ -17,6 +17,28 @@ import {
|
|
|
17
17
|
} from "./chunk-NXGCO4JB.mjs";
|
|
18
18
|
|
|
19
19
|
// src/errors.ts
|
|
20
|
+
var CustomerDbQueryOutcomeUnknownError = class extends DeeplineError {
|
|
21
|
+
outcome = "unknown";
|
|
22
|
+
operationKey;
|
|
23
|
+
retryable;
|
|
24
|
+
constructor(cause, operationKey, options = {}) {
|
|
25
|
+
const recoveryAvailable = operationKey !== void 0 && options.recoveryAvailable !== false;
|
|
26
|
+
super(
|
|
27
|
+
operationKey === void 0 ? "SQL outcome is unknown. The unkeyed request was attempted once; inspect the database before issuing another write. An operation key added afterwards cannot recover this request." : recoveryAvailable ? "SQL outcome is unknown. Recover by submitting the same SQL and options with the original operation key; do not use a new key." : "SQL outcome is unknown. The server did not confirm atomic recovery support. Do not resubmit this write; inspect the database and confirm reader support before recovering with the original operation key.",
|
|
28
|
+
cause.statusCode,
|
|
29
|
+
"CUSTOMER_DB_QUERY_OUTCOME_UNKNOWN",
|
|
30
|
+
{
|
|
31
|
+
outcome: "unknown",
|
|
32
|
+
recovery: recoveryAvailable ? "original_operation_key" : "unavailable",
|
|
33
|
+
causeCode: cause.code
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
this.name = "CustomerDbQueryOutcomeUnknownError";
|
|
37
|
+
this.operationKey = operationKey;
|
|
38
|
+
this.retryable = recoveryAvailable;
|
|
39
|
+
Object.defineProperty(this, "cause", { value: cause, configurable: true });
|
|
40
|
+
}
|
|
41
|
+
};
|
|
20
42
|
var AuthError = class extends DeeplineError {
|
|
21
43
|
/** Constructed by the SDK when Deepline rejects the caller's credentials. */
|
|
22
44
|
constructor(message = "Authentication failed. Check your DEEPLINE_API_KEY.") {
|
|
@@ -1950,6 +1972,7 @@ ${COWORK_NETWORK_HINT}`;
|
|
|
1950
1972
|
}
|
|
1951
1973
|
|
|
1952
1974
|
export {
|
|
1975
|
+
CustomerDbQueryOutcomeUnknownError,
|
|
1953
1976
|
AuthError,
|
|
1954
1977
|
RateLimitError,
|
|
1955
1978
|
ToolRateLimitError,
|
|
@@ -49,7 +49,7 @@ var SDK_RELEASE = {
|
|
|
49
49
|
// getters keep their established compatibility behavior.
|
|
50
50
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
51
51
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
52
|
-
version: "0.3.
|
|
52
|
+
version: "0.3.326",
|
|
53
53
|
updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
|
|
54
54
|
packageCapabilities: {
|
|
55
55
|
updatePreferences: 1
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkTXVOB5J2js = require('./chunk-TXVOB5J2.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunk7P5AA3SNjs = require('./chunk-7P5AA3SN.js');
|
|
@@ -136,8 +136,8 @@ var BROWSER_OPEN_COOLDOWN_MS = 3e4;
|
|
|
136
136
|
var SAME_URL_BROWSER_OPEN_COOLDOWN_MS = 5 * 6e4;
|
|
137
137
|
var defaultBrowserCommandRunner = childProcess;
|
|
138
138
|
function getAuthedHttpClient() {
|
|
139
|
-
const config =
|
|
140
|
-
return { config, http: new (0,
|
|
139
|
+
const config = _chunkTXVOB5J2js.resolveConfig.call(void 0, );
|
|
140
|
+
return { config, http: new (0, _chunkTXVOB5J2js.HttpClient)(config) };
|
|
141
141
|
}
|
|
142
142
|
function stableOsUserId() {
|
|
143
143
|
try {
|
|
@@ -477,7 +477,7 @@ function collectLocalEnvInfo() {
|
|
|
477
477
|
os: `${process.platform} ${process.arch}`,
|
|
478
478
|
node_version: process.version,
|
|
479
479
|
home_dir: homeDir,
|
|
480
|
-
agent_runtime:
|
|
480
|
+
agent_runtime: _chunkTXVOB5J2js.detectAgentRuntime.call(void 0, )
|
|
481
481
|
};
|
|
482
482
|
const env = process.env;
|
|
483
483
|
const optional = {
|
|
@@ -725,9 +725,9 @@ function markdownTableFromRows(rows, preferredColumns = []) {
|
|
|
725
725
|
}
|
|
726
726
|
function withAgentCommandContext(value) {
|
|
727
727
|
const valueRecord = value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
728
|
-
return
|
|
728
|
+
return _chunkTXVOB5J2js.detectAgentRuntime.call(void 0, ) !== "unknown" && valueRecord && !Object.prototype.hasOwnProperty.call(valueRecord, "command_context") ? {
|
|
729
729
|
...valueRecord,
|
|
730
|
-
command_context:
|
|
730
|
+
command_context: _chunkTXVOB5J2js.resolveCliCommandContext.call(void 0, )
|
|
731
731
|
} : value;
|
|
732
732
|
}
|
|
733
733
|
function printJson(value, fields) {
|
|
@@ -3,11 +3,14 @@ import {
|
|
|
3
3
|
rateLimitSummary,
|
|
4
4
|
schemaField,
|
|
5
5
|
schemaFields
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JOA6IKDE.mjs";
|
|
7
|
+
import {
|
|
8
|
+
shellQuote
|
|
9
|
+
} from "./chunk-OVDNJAJN.mjs";
|
|
7
10
|
import {
|
|
8
11
|
recentSearchRef,
|
|
9
12
|
registerDeprecatedSearchCommand
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VGKVLADU.mjs";
|
|
11
14
|
import {
|
|
12
15
|
extractSummaryFields,
|
|
13
16
|
projectRowOutput,
|
|
@@ -17,8 +20,9 @@ import {
|
|
|
17
20
|
writeJsonOutputFile
|
|
18
21
|
} from "./chunk-MIMASXO4.mjs";
|
|
19
22
|
import {
|
|
20
|
-
DeeplineClient
|
|
21
|
-
|
|
23
|
+
DeeplineClient,
|
|
24
|
+
validateExecutionIdempotencyKey
|
|
25
|
+
} from "./chunk-KLWBAQ5A.mjs";
|
|
22
26
|
import {
|
|
23
27
|
beginToolExecuteCommand,
|
|
24
28
|
getToolExecuteInvocationId,
|
|
@@ -26,18 +30,17 @@ import {
|
|
|
26
30
|
runToolExecuteStage
|
|
27
31
|
} from "./chunk-WXLOW623.mjs";
|
|
28
32
|
import {
|
|
29
|
-
argsWantJson,
|
|
30
33
|
printCommandEnvelope,
|
|
31
34
|
printCompactJson,
|
|
32
35
|
printJson,
|
|
33
36
|
printJsonError,
|
|
34
37
|
renderCommandEnvelopeText,
|
|
35
38
|
shouldEmitJson
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-M7CPVMDB.mjs";
|
|
37
40
|
import {
|
|
38
41
|
resolveConfig,
|
|
39
42
|
sdkCliStateDirPath
|
|
40
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-BR7GGTAE.mjs";
|
|
41
44
|
import {
|
|
42
45
|
DeeplineError
|
|
43
46
|
} from "./chunk-NXGCO4JB.mjs";
|
|
@@ -1010,7 +1013,7 @@ Examples:
|
|
|
1010
1013
|
process.exitCode = await narrowView();
|
|
1011
1014
|
return;
|
|
1012
1015
|
}
|
|
1013
|
-
const { describeAnything } = await import("./describe-
|
|
1016
|
+
const { describeAnything } = await import("./describe-GMVS3LFC.mjs");
|
|
1014
1017
|
process.exitCode = await describeAnything(
|
|
1015
1018
|
toolId,
|
|
1016
1019
|
{ ...options, kinds: ["tools", "monitors"], fetchedTool: metadata },
|
|
@@ -1025,7 +1028,7 @@ Examples:
|
|
|
1025
1028
|
{ json: false }
|
|
1026
1029
|
)
|
|
1027
1030
|
);
|
|
1028
|
-
tools.command("execute <toolId>").description("Execute a tool by id.").addHelpText(
|
|
1031
|
+
tools.command("execute <toolId>").alias("call").description("Execute a tool by id.").addHelpText(
|
|
1029
1032
|
"after",
|
|
1030
1033
|
`
|
|
1031
1034
|
Notes:
|
|
@@ -1084,22 +1087,7 @@ Examples:
|
|
|
1084
1087
|
"--recovery-timeout-ms <milliseconds>",
|
|
1085
1088
|
"Maximum wait for a keyed execution to finish (default: 900000)"
|
|
1086
1089
|
).action(async (toolId, options) => {
|
|
1087
|
-
|
|
1088
|
-
toolId,
|
|
1089
|
-
...options.param.flatMap((value) => ["--param", value]),
|
|
1090
|
-
...options.json === true ? ["--json"] : [],
|
|
1091
|
-
...typeof options.json === "string" ? ["--json", options.json] : [],
|
|
1092
|
-
...options.input ? ["--input", options.input] : [],
|
|
1093
|
-
...options.payload ? ["--payload", options.payload] : [],
|
|
1094
|
-
...options.timeout ? ["--timeout", options.timeout] : [],
|
|
1095
|
-
...options.outputFormat ? ["--output-format", options.outputFormat] : [],
|
|
1096
|
-
...options.out ? ["--out", options.out] : [],
|
|
1097
|
-
...options.preview === false ? ["--no-preview"] : [],
|
|
1098
|
-
...options.idempotencyKey ? ["--idempotency-key", options.idempotencyKey] : [],
|
|
1099
|
-
...options.recover ? ["--recover"] : [],
|
|
1100
|
-
...options.recoveryTimeoutMs ? ["--recovery-timeout-ms", options.recoveryTimeoutMs] : []
|
|
1101
|
-
];
|
|
1102
|
-
process.exitCode = await executeTool(args);
|
|
1090
|
+
process.exitCode = await executeTool(toolId, options);
|
|
1103
1091
|
});
|
|
1104
1092
|
}
|
|
1105
1093
|
async function getTool(toolId, options = {}, compatibilityMetadata) {
|
|
@@ -1808,6 +1796,7 @@ function printToolExamplesOnly(tool, requestedToolId) {
|
|
|
1808
1796
|
console.log(`Use in a play:`);
|
|
1809
1797
|
console.log("```ts");
|
|
1810
1798
|
console.log("const result = await ctx.tools.execute({");
|
|
1799
|
+
console.log(" staleAfterSeconds: 0,");
|
|
1811
1800
|
console.log(` id: '${stableStepIdForTool(toolId)}',`);
|
|
1812
1801
|
console.log(` tool: '${toolId}',`);
|
|
1813
1802
|
console.log(
|
|
@@ -2545,87 +2534,63 @@ function parseJsonObjectArgument(raw, flagName) {
|
|
|
2545
2534
|
}
|
|
2546
2535
|
return parsed;
|
|
2547
2536
|
}
|
|
2548
|
-
function
|
|
2549
|
-
const
|
|
2537
|
+
function toolExecuteJsonOption(value) {
|
|
2538
|
+
const legacyInput = typeof value === "string" ? value : void 0;
|
|
2539
|
+
return {
|
|
2540
|
+
requested: value === true || legacyInput !== void 0,
|
|
2541
|
+
legacyInput
|
|
2542
|
+
};
|
|
2543
|
+
}
|
|
2544
|
+
function parseExecuteOptions(toolId, options, output) {
|
|
2550
2545
|
if (!toolId) {
|
|
2551
2546
|
throw new Error(
|
|
2552
2547
|
`Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--timeout <duration>] [--recover | --idempotency-key <key>] [--recovery-timeout-ms <ms>] [--out rows.csv] [--output-format auto|csv|csv_file|json|json_file] [--no-preview]`
|
|
2553
2548
|
);
|
|
2554
2549
|
}
|
|
2555
2550
|
const params = {};
|
|
2556
|
-
let outputFormat = "auto";
|
|
2557
|
-
let noPreview = false;
|
|
2558
|
-
let outPath = null;
|
|
2559
|
-
let timeoutMs;
|
|
2560
|
-
let idempotencyKey;
|
|
2561
|
-
let recover = false;
|
|
2551
|
+
let outputFormat = output.requested ? "json" : "auto";
|
|
2562
2552
|
let recoveryTimeoutMs;
|
|
2563
|
-
for (
|
|
2564
|
-
const
|
|
2565
|
-
if (
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
if (
|
|
2591
|
-
|
|
2592
|
-
continue;
|
|
2593
|
-
}
|
|
2594
|
-
if (arg === "--no-preview") {
|
|
2595
|
-
noPreview = true;
|
|
2596
|
-
continue;
|
|
2597
|
-
}
|
|
2598
|
-
if (arg === "--idempotency-key" && args[index + 1]) {
|
|
2599
|
-
idempotencyKey = args[++index];
|
|
2600
|
-
continue;
|
|
2601
|
-
}
|
|
2602
|
-
if (arg === "--recover") {
|
|
2603
|
-
recover = true;
|
|
2604
|
-
continue;
|
|
2605
|
-
}
|
|
2606
|
-
if (arg === "--recovery-timeout-ms" && args[index + 1]) {
|
|
2607
|
-
const parsed = Number(args[++index]);
|
|
2608
|
-
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
2609
|
-
throw new Error("--recovery-timeout-ms must be a non-negative number.");
|
|
2610
|
-
}
|
|
2611
|
-
recoveryTimeoutMs = parsed;
|
|
2612
|
-
continue;
|
|
2613
|
-
}
|
|
2614
|
-
if ((arg === "--out" || arg === "-o") && args[index + 1]) {
|
|
2615
|
-
outPath = resolve(args[++index]);
|
|
2616
|
-
continue;
|
|
2553
|
+
for (const kv of options.param ?? []) {
|
|
2554
|
+
const eqIdx = kv.indexOf("=");
|
|
2555
|
+
if (eqIdx > 0) params[kv.slice(0, eqIdx)] = kv.slice(eqIdx + 1);
|
|
2556
|
+
}
|
|
2557
|
+
if (output.legacyInput !== void 0) {
|
|
2558
|
+
Object.assign(
|
|
2559
|
+
params,
|
|
2560
|
+
parseJsonObjectArgument(output.legacyInput, "--json")
|
|
2561
|
+
);
|
|
2562
|
+
}
|
|
2563
|
+
if (options.input !== void 0) {
|
|
2564
|
+
Object.assign(params, parseJsonObjectArgument(options.input, "--input"));
|
|
2565
|
+
}
|
|
2566
|
+
if (options.payload !== void 0) {
|
|
2567
|
+
Object.assign(
|
|
2568
|
+
params,
|
|
2569
|
+
parseJsonObjectArgument(options.payload, "--payload")
|
|
2570
|
+
);
|
|
2571
|
+
}
|
|
2572
|
+
if (options.outputFormat !== void 0) {
|
|
2573
|
+
outputFormat = normalizeOutputFormat(options.outputFormat);
|
|
2574
|
+
}
|
|
2575
|
+
if (options.idempotencyKey !== void 0) {
|
|
2576
|
+
validateExecutionIdempotencyKey(options.idempotencyKey);
|
|
2577
|
+
}
|
|
2578
|
+
if (options.recoveryTimeoutMs !== void 0) {
|
|
2579
|
+
const parsed = Number(options.recoveryTimeoutMs);
|
|
2580
|
+
if (!options.recoveryTimeoutMs.trim() || !Number.isFinite(parsed) || parsed < 0) {
|
|
2581
|
+
throw new Error("--recovery-timeout-ms must be a non-negative number.");
|
|
2617
2582
|
}
|
|
2618
|
-
|
|
2583
|
+
recoveryTimeoutMs = parsed;
|
|
2619
2584
|
}
|
|
2620
2585
|
return {
|
|
2621
2586
|
toolId,
|
|
2622
2587
|
params,
|
|
2623
2588
|
outputFormat,
|
|
2624
|
-
noPreview,
|
|
2625
|
-
outPath,
|
|
2626
|
-
timeoutMs,
|
|
2627
|
-
idempotencyKey,
|
|
2628
|
-
recover,
|
|
2589
|
+
noPreview: options.preview === false,
|
|
2590
|
+
outPath: options.out !== void 0 ? resolve(options.out) : null,
|
|
2591
|
+
timeoutMs: options.timeout !== void 0 ? parseToolExecuteTimeout(options.timeout) : void 0,
|
|
2592
|
+
idempotencyKey: options.idempotencyKey,
|
|
2593
|
+
recover: options.recover === true,
|
|
2629
2594
|
recoveryTimeoutMs
|
|
2630
2595
|
};
|
|
2631
2596
|
}
|
|
@@ -2650,9 +2615,6 @@ function parseToolExecuteTimeout(raw) {
|
|
|
2650
2615
|
function safeFileStem(value) {
|
|
2651
2616
|
return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
|
|
2652
2617
|
}
|
|
2653
|
-
function shellQuote(value) {
|
|
2654
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
2655
|
-
}
|
|
2656
2618
|
function powerShellQuote(value) {
|
|
2657
2619
|
return `'${value.replace(/'/g, "''")}'`;
|
|
2658
2620
|
}
|
|
@@ -2682,6 +2644,7 @@ function seedToolListScript(input) {
|
|
|
2682
2644
|
|
|
2683
2645
|
export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
2684
2646
|
const result = await ctx.tools.execute({
|
|
2647
|
+
staleAfterSeconds: 0,
|
|
2685
2648
|
id: ${JSON.stringify(input.toolId)},
|
|
2686
2649
|
tool: ${JSON.stringify(input.toolId)},
|
|
2687
2650
|
input: ${JSON.stringify(input.payload)},
|
|
@@ -2699,7 +2662,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
2699
2662
|
// Pass it to ctx.dataset; use rows.peek/count/materialize only for deliberate bounded inspection.
|
|
2700
2663
|
// .withColumn('email_waterfall', (row, rowCtx) => rowCtx.runPlay('name_domain_email', 'name-and-domain-to-email', { first_name: String(row.first_name ?? ''), last_name: String(row.last_name ?? ''), domain: String(row.domain ?? '') }, { description: 'Resolve email.' }))
|
|
2701
2664
|
// .withColumn('phone_waterfall', (row, rowCtx) => rowCtx.runPlay('contact_phone', 'contact-to-phone', { first_name: String(row.first_name ?? ''), last_name: String(row.last_name ?? ''), email: String(row.email ?? '') }, { description: 'Resolve phone.' }))
|
|
2702
|
-
// ctx.dataset is idempotent
|
|
2665
|
+
// ctx.dataset is idempotent for completed rows during same-run recovery. New runs follow each call's freshness.
|
|
2703
2666
|
const enrichedData = await ctx
|
|
2704
2667
|
.dataset('enriched_data', rows)
|
|
2705
2668
|
.run({
|
|
@@ -2724,6 +2687,12 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
2724
2687
|
windowsCopyCommand: `New-Item -ItemType Directory -Force -Path ${powerShellQuote(projectDir.replace(/\//g, "\\"))} | Out-Null; Copy-Item -LiteralPath ${powerShellQuote(scriptPath)} -Destination ${powerShellQuote(`${projectDir.replace(/\//g, "\\")}\\${fileName}`)}`
|
|
2725
2688
|
};
|
|
2726
2689
|
}
|
|
2690
|
+
function toolExecutionInspection(input) {
|
|
2691
|
+
return {
|
|
2692
|
+
inspect: input.idempotencyKey !== void 0 ? `deepline executions get --idempotency-key ${shellQuote(input.idempotencyKey)} --json` : `deepline describe ${shellQuote(input.toolId)} --json`,
|
|
2693
|
+
inspectDescription: input.idempotencyKey !== void 0 ? "Read the saved execution without starting new work." : "Read the tool contract; this unkeyed call has no saved recovery identity."
|
|
2694
|
+
};
|
|
2695
|
+
}
|
|
2727
2696
|
function buildToolExecuteBaseEnvelope(input) {
|
|
2728
2697
|
const envelope = commandEnvelopeFromRawResponse(input.rawResponse);
|
|
2729
2698
|
const guidanceLines = toolExecuteExitCode(envelope) !== 0 || input.listExpected === true && !input.listConversion ? toolGuidanceLines(input.guidance) : [];
|
|
@@ -2749,7 +2718,7 @@ function buildToolExecuteBaseEnvelope(input) {
|
|
|
2749
2718
|
"output"
|
|
2750
2719
|
);
|
|
2751
2720
|
const billingLookup = typeof envelope.job_id === "string" && envelope.job_id.trim() ? `deepline billing usage --request-id ${shellQuote(envelope.job_id)} --json` : null;
|
|
2752
|
-
const
|
|
2721
|
+
const inspection = toolExecutionInspection(input);
|
|
2753
2722
|
const actions = input.listConversion ? [
|
|
2754
2723
|
{
|
|
2755
2724
|
label: "next",
|
|
@@ -2767,6 +2736,7 @@ function buildToolExecuteBaseEnvelope(input) {
|
|
|
2767
2736
|
if (billingLookup) {
|
|
2768
2737
|
actions.push({ label: "charge", command: billingLookup });
|
|
2769
2738
|
}
|
|
2739
|
+
actions.unshift({ label: "inspect", command: inspection.inspect });
|
|
2770
2740
|
return {
|
|
2771
2741
|
...envelope,
|
|
2772
2742
|
...input.idempotencyKey ? { idempotency_key: input.idempotencyKey } : {},
|
|
@@ -2775,13 +2745,13 @@ function buildToolExecuteBaseEnvelope(input) {
|
|
|
2775
2745
|
...summaryEntries.length > 0 ? { summary: input.summary } : {},
|
|
2776
2746
|
...warningMessages.length > 0 ? { warnings: warningMessages } : {},
|
|
2777
2747
|
next: {
|
|
2778
|
-
|
|
2748
|
+
...inspection,
|
|
2779
2749
|
...billingLookup ? { billing: billingLookup } : {},
|
|
2780
2750
|
...apifyRecovery ?? {},
|
|
2781
2751
|
...guidanceLines.length > 0 ? { guidance: input.guidance } : {},
|
|
2782
2752
|
playDebugging: "When fixing a play getter, inspect returned dataset handles with runs get and export rows with runs export; do not copy CLI preview paths blindly.",
|
|
2783
2753
|
...input.listConversion ? {
|
|
2784
|
-
expandToPlay: "Use stable map and step keys
|
|
2754
|
+
expandToPlay: "Use stable map and step keys for recovery within a run. New runs follow each call's explicit freshness.",
|
|
2785
2755
|
listSourcePath: input.listConversion.sourcePath ?? "auto-detected list in the CLI response preview"
|
|
2786
2756
|
} : {}
|
|
2787
2757
|
},
|
|
@@ -2832,6 +2802,7 @@ function buildToolExecuteRowArtifactEnvelope(input) {
|
|
|
2832
2802
|
void _next;
|
|
2833
2803
|
void _local;
|
|
2834
2804
|
const billingLookup = isRecord(input.baseEnvelope.next) && typeof input.baseEnvelope.next.billing === "string" ? input.baseEnvelope.next.billing : null;
|
|
2805
|
+
const inspection = toolExecutionInspection(input);
|
|
2835
2806
|
return {
|
|
2836
2807
|
...base,
|
|
2837
2808
|
status: typeof base.status === "string" ? base.status : "completed",
|
|
@@ -2873,10 +2844,10 @@ function buildToolExecuteRowArtifactEnvelope(input) {
|
|
|
2873
2844
|
windows_powershell: input.seededScript.windowsCopyCommand
|
|
2874
2845
|
},
|
|
2875
2846
|
next: {
|
|
2876
|
-
|
|
2847
|
+
...inspection,
|
|
2877
2848
|
...billingLookup ? { billing: billingLookup } : {},
|
|
2878
2849
|
listSourcePath: input.rowOutput.sourcePath,
|
|
2879
|
-
expandToPlay: "Use stable map and step keys
|
|
2850
|
+
expandToPlay: "Use stable map and step keys for recovery within a run. New runs follow each call's explicit freshness."
|
|
2880
2851
|
},
|
|
2881
2852
|
render: {
|
|
2882
2853
|
sections: [
|
|
@@ -2893,10 +2864,11 @@ function buildToolExecuteRowArtifactEnvelope(input) {
|
|
|
2893
2864
|
}
|
|
2894
2865
|
],
|
|
2895
2866
|
actions: [
|
|
2867
|
+
{ label: "inspect", command: inspection.inspect },
|
|
2896
2868
|
...billingLookup ? [{ label: "charge", command: billingLookup }] : [],
|
|
2897
2869
|
{
|
|
2898
2870
|
label: "next",
|
|
2899
|
-
command: "Move the script into a project folder and expand it into a Deepline play. Use stable map and step keys
|
|
2871
|
+
command: "Move the script into a project folder and expand it into a Deepline play. Use stable map and step keys for same-run recovery; choose explicit freshness for calls in new runs."
|
|
2900
2872
|
},
|
|
2901
2873
|
{
|
|
2902
2874
|
label: "macOS/Linux",
|
|
@@ -2910,17 +2882,19 @@ function buildToolExecuteRowArtifactEnvelope(input) {
|
|
|
2910
2882
|
}
|
|
2911
2883
|
};
|
|
2912
2884
|
}
|
|
2913
|
-
async function executeTool(
|
|
2885
|
+
async function executeTool(toolId, options) {
|
|
2886
|
+
const output = toolExecuteJsonOption(options.json);
|
|
2887
|
+
const wantsJson = shouldEmitJson(output.requested);
|
|
2914
2888
|
let parsed;
|
|
2915
2889
|
try {
|
|
2916
|
-
parsed = parseExecuteOptions(
|
|
2890
|
+
parsed = parseExecuteOptions(toolId, options, output);
|
|
2917
2891
|
} catch (error) {
|
|
2918
|
-
if (
|
|
2892
|
+
if (wantsJson) {
|
|
2919
2893
|
printJsonError(error);
|
|
2920
2894
|
} else {
|
|
2921
2895
|
console.error(error instanceof Error ? error.message : String(error));
|
|
2922
2896
|
}
|
|
2923
|
-
return 1;
|
|
2897
|
+
return error instanceof DeeplineError && error.code === "IDEMPOTENCY_KEY_INVALID" ? 2 : 1;
|
|
2924
2898
|
}
|
|
2925
2899
|
const cliInvocationId = getToolExecuteInvocationId() ?? beginToolExecuteCommand();
|
|
2926
2900
|
const client = new DeeplineClient();
|
|
@@ -2937,7 +2911,7 @@ async function executeTool(args) {
|
|
|
2937
2911
|
() => findPlayForToolId(client, parsed.toolId, cliInvocationId)
|
|
2938
2912
|
);
|
|
2939
2913
|
if (play) {
|
|
2940
|
-
if (
|
|
2914
|
+
if (wantsJson) {
|
|
2941
2915
|
printJsonError(
|
|
2942
2916
|
new Error(playAliasToolErrorMessage(parsed.toolId, play))
|
|
2943
2917
|
);
|
|
@@ -2950,7 +2924,7 @@ async function executeTool(args) {
|
|
|
2950
2924
|
throw error;
|
|
2951
2925
|
}
|
|
2952
2926
|
if (isPlayLikeTool(metadata)) {
|
|
2953
|
-
if (
|
|
2927
|
+
if (wantsJson) {
|
|
2954
2928
|
printJsonError(
|
|
2955
2929
|
new Error(
|
|
2956
2930
|
playLikeToolExecuteErrorMessage(
|
|
@@ -2992,7 +2966,7 @@ async function executeTool(args) {
|
|
|
2992
2966
|
}).catch((error) => {
|
|
2993
2967
|
const guidanceLines = toolGuidanceLines(metadata.guidance);
|
|
2994
2968
|
if (guidanceLines.length > 0) {
|
|
2995
|
-
if (
|
|
2969
|
+
if (wantsJson && error instanceof Error) {
|
|
2996
2970
|
Object.assign(error, { guidance: metadata.guidance });
|
|
2997
2971
|
} else {
|
|
2998
2972
|
console.error(
|
|
@@ -3049,10 +3023,14 @@ async function executeTool(args) {
|
|
|
3049
3023
|
}
|
|
3050
3024
|
if (!listConversion) {
|
|
3051
3025
|
if (parsed.outPath) {
|
|
3026
|
+
const inspection = toolExecutionInspection({
|
|
3027
|
+
toolId: parsed.toolId,
|
|
3028
|
+
idempotencyKey
|
|
3029
|
+
});
|
|
3052
3030
|
const error = new Error(
|
|
3053
|
-
`${parsed.toolId} did not expose row-shaped output to write as CSV.
|
|
3031
|
+
`${parsed.toolId} did not expose row-shaped output to write as CSV. ${inspection.inspectDescription} Run: ${inspection.inspect}`
|
|
3054
3032
|
);
|
|
3055
|
-
if (
|
|
3033
|
+
if (wantsJson) {
|
|
3056
3034
|
printJsonError(error);
|
|
3057
3035
|
} else {
|
|
3058
3036
|
console.error(error.message);
|
|
@@ -3090,6 +3068,8 @@ async function executeTool(args) {
|
|
|
3090
3068
|
rows: listConversion.rows
|
|
3091
3069
|
});
|
|
3092
3070
|
const materializedEnvelope = buildToolExecuteRowArtifactEnvelope({
|
|
3071
|
+
toolId: parsed.toolId,
|
|
3072
|
+
idempotencyKey,
|
|
3093
3073
|
baseEnvelope,
|
|
3094
3074
|
csv,
|
|
3095
3075
|
rowOutput,
|
|
@@ -3101,9 +3081,14 @@ async function executeTool(args) {
|
|
|
3101
3081
|
return true;
|
|
3102
3082
|
}
|
|
3103
3083
|
if (parsed.outPath) {
|
|
3084
|
+
const inspection = toolExecutionInspection({
|
|
3085
|
+
toolId: parsed.toolId,
|
|
3086
|
+
idempotencyKey
|
|
3087
|
+
});
|
|
3104
3088
|
printCommandEnvelope(materializedEnvelope, {
|
|
3105
|
-
json:
|
|
3089
|
+
json: wantsJson,
|
|
3106
3090
|
text: `Wrote ${csv.rowCount} row(s) to ${csv.path}
|
|
3091
|
+
inspect: ${inspection.inspect}
|
|
3107
3092
|
`
|
|
3108
3093
|
});
|
|
3109
3094
|
return true;
|