deepline 0.1.38 → 0.1.39
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/cli/index.js +34 -220
- package/dist/cli/index.mjs +34 -220
- package/dist/index.d.mts +2 -18
- package/dist/index.d.ts +2 -18
- package/dist/index.js +8 -12
- package/dist/index.mjs +8 -12
- package/dist/repo/apps/play-runner-workers/src/entry.ts +17 -89
- package/dist/repo/sdk/src/types.ts +0 -17
- package/dist/repo/sdk/src/version.ts +2 -2
- package/dist/repo/shared_libs/play-runtime/tool-result.ts +23 -79
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -216,8 +216,8 @@ function resolveConfig(options) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// src/version.ts
|
|
219
|
-
var SDK_VERSION = "0.1.
|
|
220
|
-
var SDK_API_CONTRACT = "2026-05-v2-
|
|
219
|
+
var SDK_VERSION = "0.1.39";
|
|
220
|
+
var SDK_API_CONTRACT = "2026-05-v2-play-live-definition";
|
|
221
221
|
|
|
222
222
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
223
223
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -7491,126 +7491,6 @@ function shouldUseLocalOnlyPlayCheck() {
|
|
|
7491
7491
|
const value = process.env.DEEPLINE_PLAY_CHECK_LOCAL_ONLY?.trim().toLowerCase();
|
|
7492
7492
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
7493
7493
|
}
|
|
7494
|
-
function isRecord3(value) {
|
|
7495
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
7496
|
-
}
|
|
7497
|
-
function stringValue(value) {
|
|
7498
|
-
return typeof value === "string" ? value.trim() : "";
|
|
7499
|
-
}
|
|
7500
|
-
function asArray(value) {
|
|
7501
|
-
return Array.isArray(value) ? value : [];
|
|
7502
|
-
}
|
|
7503
|
-
function extractionEntries(value) {
|
|
7504
|
-
if (Array.isArray(value)) return value.filter(isRecord3);
|
|
7505
|
-
if (!isRecord3(value)) return [];
|
|
7506
|
-
return Object.entries(value).map(
|
|
7507
|
-
([name, entry]) => isRecord3(entry) ? { name, ...entry } : { name }
|
|
7508
|
-
);
|
|
7509
|
-
}
|
|
7510
|
-
function firstRawPath(entry) {
|
|
7511
|
-
const details = isRecord3(entry.details) ? entry.details : {};
|
|
7512
|
-
const paths = [
|
|
7513
|
-
...asArray(details.rawToolOutputPaths),
|
|
7514
|
-
...asArray(details.raw_tool_output_paths),
|
|
7515
|
-
...asArray(details.candidatePaths),
|
|
7516
|
-
...asArray(details.candidate_paths)
|
|
7517
|
-
].map(stringValue).filter(Boolean);
|
|
7518
|
-
return paths[0];
|
|
7519
|
-
}
|
|
7520
|
-
function checkHintExpression(value) {
|
|
7521
|
-
return stringValue(value).replace(/^toolExecutionResult\./, "result.");
|
|
7522
|
-
}
|
|
7523
|
-
function checkHintRawPath(value) {
|
|
7524
|
-
return value?.replace(/^toolResponse\./, "result.toolResponse.");
|
|
7525
|
-
}
|
|
7526
|
-
function collectStaticPipelineToolIds(staticPipeline) {
|
|
7527
|
-
const seen = /* @__PURE__ */ new Set();
|
|
7528
|
-
const visitPipeline = (pipeline) => {
|
|
7529
|
-
if (!isRecord3(pipeline)) return;
|
|
7530
|
-
for (const step of [
|
|
7531
|
-
...asArray(pipeline.stages),
|
|
7532
|
-
...asArray(pipeline.substeps)
|
|
7533
|
-
]) {
|
|
7534
|
-
if (!isRecord3(step)) continue;
|
|
7535
|
-
if (step.type === "tool") {
|
|
7536
|
-
const toolId = stringValue(step.toolId) || stringValue(step.tool);
|
|
7537
|
-
if (toolId) seen.add(toolId);
|
|
7538
|
-
}
|
|
7539
|
-
if (step.type === "play_call") {
|
|
7540
|
-
visitPipeline(step.pipeline);
|
|
7541
|
-
}
|
|
7542
|
-
}
|
|
7543
|
-
};
|
|
7544
|
-
visitPipeline(staticPipeline);
|
|
7545
|
-
return [...seen].sort();
|
|
7546
|
-
}
|
|
7547
|
-
function toolGetterHintFromMetadata(toolId, tool) {
|
|
7548
|
-
const usageGuidance = isRecord3(tool.usageGuidance) ? tool.usageGuidance : {};
|
|
7549
|
-
const resultGuidance = isRecord3(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord3(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
|
|
7550
|
-
const toolResponse = isRecord3(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord3(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
|
|
7551
|
-
const lists = extractionEntries(
|
|
7552
|
-
resultGuidance.extractedLists ?? resultGuidance.extracted_lists
|
|
7553
|
-
).map((entry) => ({
|
|
7554
|
-
name: stringValue(entry.name),
|
|
7555
|
-
expression: checkHintExpression(entry.expression),
|
|
7556
|
-
raw: checkHintRawPath(firstRawPath(entry))
|
|
7557
|
-
})).filter((entry) => entry.name && entry.expression);
|
|
7558
|
-
const values = extractionEntries(
|
|
7559
|
-
resultGuidance.extractedValues ?? resultGuidance.extracted_values
|
|
7560
|
-
).map((entry) => ({
|
|
7561
|
-
name: stringValue(entry.name),
|
|
7562
|
-
expression: checkHintExpression(entry.expression),
|
|
7563
|
-
raw: checkHintRawPath(firstRawPath(entry))
|
|
7564
|
-
})).filter((entry) => entry.name && entry.expression);
|
|
7565
|
-
return {
|
|
7566
|
-
toolId,
|
|
7567
|
-
lists,
|
|
7568
|
-
values,
|
|
7569
|
-
raw: checkHintExpression(toolResponse.raw) || "result.toolResponse.raw"
|
|
7570
|
-
};
|
|
7571
|
-
}
|
|
7572
|
-
async function buildToolGetterHints(client, staticPipeline) {
|
|
7573
|
-
const toolIds = collectStaticPipelineToolIds(staticPipeline);
|
|
7574
|
-
return Promise.all(
|
|
7575
|
-
toolIds.map(async (toolId) => {
|
|
7576
|
-
try {
|
|
7577
|
-
const tool = await client.getTool(toolId);
|
|
7578
|
-
return toolGetterHintFromMetadata(toolId, tool);
|
|
7579
|
-
} catch (error) {
|
|
7580
|
-
return {
|
|
7581
|
-
toolId,
|
|
7582
|
-
lists: [],
|
|
7583
|
-
values: [],
|
|
7584
|
-
raw: "result.toolResponse.raw",
|
|
7585
|
-
unavailable: error instanceof Error ? error.message : String(error)
|
|
7586
|
-
};
|
|
7587
|
-
}
|
|
7588
|
-
})
|
|
7589
|
-
);
|
|
7590
|
-
}
|
|
7591
|
-
function printToolGetterHints(hints) {
|
|
7592
|
-
if (!hints?.length) return;
|
|
7593
|
-
console.log(" Tool result getter hints:");
|
|
7594
|
-
for (const hint of hints) {
|
|
7595
|
-
console.log(` ${hint.toolId} output:`);
|
|
7596
|
-
if (hint.lists.length) {
|
|
7597
|
-
for (const entry of hint.lists) {
|
|
7598
|
-
const raw = entry.raw ? ` (raw: ${entry.raw})` : "";
|
|
7599
|
-
console.log(` - list ${entry.name}: ${entry.expression}${raw}`);
|
|
7600
|
-
}
|
|
7601
|
-
}
|
|
7602
|
-
if (hint.values.length) {
|
|
7603
|
-
const valueNames = hint.values.map((entry) => entry.name).join(", ");
|
|
7604
|
-
console.log(` - values: ${valueNames}`);
|
|
7605
|
-
for (const entry of hint.values) {
|
|
7606
|
-
const raw = entry.raw ? ` (raw: ${entry.raw})` : "";
|
|
7607
|
-
console.log(` ${entry.name}: ${entry.expression}${raw}`);
|
|
7608
|
-
}
|
|
7609
|
-
}
|
|
7610
|
-
if (hint.raw) console.log(` - raw: ${hint.raw}`);
|
|
7611
|
-
if (hint.unavailable) console.log(` - warning: ${hint.unavailable}`);
|
|
7612
|
-
}
|
|
7613
|
-
}
|
|
7614
7494
|
async function handlePlayCheck(args) {
|
|
7615
7495
|
const options = parsePlayCheckOptions(args);
|
|
7616
7496
|
if (!isFileTarget(options.target)) {
|
|
@@ -7641,7 +7521,6 @@ async function handlePlayCheck(args) {
|
|
|
7641
7521
|
valid: true,
|
|
7642
7522
|
errors: [],
|
|
7643
7523
|
staticPipeline: graph.root.compilerManifest?.staticPipeline ?? null,
|
|
7644
|
-
toolGetterHints: [],
|
|
7645
7524
|
artifactHash: graph.root.artifact.artifactHash,
|
|
7646
7525
|
graphHash: graph.root.artifact.graphHash
|
|
7647
7526
|
};
|
|
@@ -7651,7 +7530,6 @@ async function handlePlayCheck(args) {
|
|
|
7651
7530
|
} else {
|
|
7652
7531
|
console.log(`\u2713 ${playName} passed local play check`);
|
|
7653
7532
|
console.log(` artifact: ${result2.artifactHash.slice(0, 12)}`);
|
|
7654
|
-
printToolGetterHints(result2.toolGetterHints);
|
|
7655
7533
|
}
|
|
7656
7534
|
return 0;
|
|
7657
7535
|
}
|
|
@@ -7662,27 +7540,21 @@ async function handlePlayCheck(args) {
|
|
|
7662
7540
|
sourceFiles: graph.root.sourceFiles,
|
|
7663
7541
|
artifact: graph.root.artifact
|
|
7664
7542
|
});
|
|
7665
|
-
const enrichedResult = {
|
|
7666
|
-
...result,
|
|
7667
|
-
toolGetterHints: result.toolGetterHints ?? await buildToolGetterHints(client, result.staticPipeline)
|
|
7668
|
-
};
|
|
7669
7543
|
if (options.jsonOutput) {
|
|
7670
|
-
process.stdout.write(`${JSON.stringify({ name: playName, ...
|
|
7544
|
+
process.stdout.write(`${JSON.stringify({ name: playName, ...result })}
|
|
7671
7545
|
`);
|
|
7672
|
-
} else if (
|
|
7546
|
+
} else if (result.valid) {
|
|
7673
7547
|
console.log(`\u2713 ${playName} passed cloud play check`);
|
|
7674
|
-
if (
|
|
7675
|
-
console.log(` artifact: ${
|
|
7548
|
+
if (result.artifactHash) {
|
|
7549
|
+
console.log(` artifact: ${result.artifactHash.slice(0, 12)}`);
|
|
7676
7550
|
}
|
|
7677
|
-
printToolGetterHints(enrichedResult.toolGetterHints);
|
|
7678
7551
|
} else {
|
|
7679
7552
|
console.error(`\u2717 ${playName} failed cloud play check`);
|
|
7680
|
-
for (const error of
|
|
7553
|
+
for (const error of result.errors) {
|
|
7681
7554
|
console.error(` ${error}`);
|
|
7682
7555
|
}
|
|
7683
|
-
printToolGetterHints(enrichedResult.toolGetterHints);
|
|
7684
7556
|
}
|
|
7685
|
-
return
|
|
7557
|
+
return result.valid ? 0 : 1;
|
|
7686
7558
|
}
|
|
7687
7559
|
async function handleFileBackedRun(options) {
|
|
7688
7560
|
if (options.target.kind !== "file") {
|
|
@@ -8785,7 +8657,7 @@ Pass-through input flags:
|
|
|
8785
8657
|
...options.logs ? ["--logs"] : [],
|
|
8786
8658
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
|
8787
8659
|
...options.force ? ["--force"] : [],
|
|
8788
|
-
...options.
|
|
8660
|
+
...options.open === false ? ["--no-open"] : [],
|
|
8789
8661
|
...options.json ? ["--json"] : [],
|
|
8790
8662
|
...passthroughArgs
|
|
8791
8663
|
]);
|
|
@@ -9241,15 +9113,6 @@ function extractSummaryFields(payload) {
|
|
|
9241
9113
|
|
|
9242
9114
|
// src/cli/commands/tools.ts
|
|
9243
9115
|
function toListedTool(tool) {
|
|
9244
|
-
if (isPlayLikeTool(tool)) {
|
|
9245
|
-
const playReference = playReferenceForTool(tool);
|
|
9246
|
-
return {
|
|
9247
|
-
...tool,
|
|
9248
|
-
id: tool.toolId,
|
|
9249
|
-
type: "play",
|
|
9250
|
-
executeCommand: `deepline plays run ${playReference} --input '{...}' --watch`
|
|
9251
|
-
};
|
|
9252
|
-
}
|
|
9253
9116
|
return {
|
|
9254
9117
|
...tool,
|
|
9255
9118
|
id: tool.toolId,
|
|
@@ -9288,12 +9151,11 @@ async function searchTools(queryInput, options = {}) {
|
|
|
9288
9151
|
searchMode: options.searchMode,
|
|
9289
9152
|
includeSearchDebug: options.includeSearchDebug
|
|
9290
9153
|
});
|
|
9291
|
-
const items = result.tools.
|
|
9154
|
+
const items = result.tools.map(toListedTool);
|
|
9292
9155
|
const envelope = {
|
|
9293
9156
|
...result,
|
|
9294
9157
|
tools: items,
|
|
9295
9158
|
count: items.length,
|
|
9296
|
-
omitted_plays_hint: "Use `deepline plays search <query> --json` for prebuilt and org-owned plays.",
|
|
9297
9159
|
render: {
|
|
9298
9160
|
sections: [
|
|
9299
9161
|
{
|
|
@@ -9306,10 +9168,6 @@ async function searchTools(queryInput, options = {}) {
|
|
|
9306
9168
|
...item.inputSchema ? [" inputSchema: yes"] : []
|
|
9307
9169
|
];
|
|
9308
9170
|
})
|
|
9309
|
-
},
|
|
9310
|
-
{
|
|
9311
|
-
title: "plays",
|
|
9312
|
-
lines: ["For prebuilt or org-owned workflows, run: deepline plays search <query>"]
|
|
9313
9171
|
}
|
|
9314
9172
|
]
|
|
9315
9173
|
}
|
|
@@ -9328,36 +9186,13 @@ async function findPlayForToolId(client, toolId) {
|
|
|
9328
9186
|
const plays = await client.searchPlays({ query: requested, compact: true });
|
|
9329
9187
|
return plays.find((play) => playIdentifiers(play).includes(requested)) ?? null;
|
|
9330
9188
|
}
|
|
9331
|
-
function
|
|
9189
|
+
function printPlayAliasToolError(toolId, play) {
|
|
9332
9190
|
const playName = play.reference ?? play.name;
|
|
9333
|
-
|
|
9191
|
+
console.error(
|
|
9192
|
+
`${toolId} is a play, not a tool.
|
|
9334
9193
|
Use: deepline plays run ${playName} --input '{...}' --watch
|
|
9335
|
-
Inspect its schema with: deepline plays describe ${playName} --json
|
|
9336
|
-
|
|
9337
|
-
function printPlayAliasToolError(toolId, play) {
|
|
9338
|
-
console.error(playAliasToolErrorMessage(toolId, play));
|
|
9339
|
-
}
|
|
9340
|
-
function isPlayLikeTool(tool) {
|
|
9341
|
-
const record = tool;
|
|
9342
|
-
if (record.isPlay === true || record.is_play === true) return true;
|
|
9343
|
-
const playExpansion = recordField(record, "playExpansion", "play_expansion");
|
|
9344
|
-
if (Object.keys(playExpansion).length > 0) return true;
|
|
9345
|
-
const toolId = typeof record.toolId === "string" ? record.toolId : "";
|
|
9346
|
-
return toolId.endsWith("_waterfall");
|
|
9347
|
-
}
|
|
9348
|
-
function playReferenceForTool(tool) {
|
|
9349
|
-
const record = tool;
|
|
9350
|
-
const toolId = typeof record.toolId === "string" ? record.toolId : "play";
|
|
9351
|
-
return `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9352
|
-
}
|
|
9353
|
-
function playLikeToolExecuteErrorMessage(toolId) {
|
|
9354
|
-
const playReference = `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9355
|
-
return `${toolId} is a workflow/play entry, not an atomic provider tool.
|
|
9356
|
-
Use: deepline plays run ${playReference} --input '{...}' --watch
|
|
9357
|
-
Or search provider tools only with: deepline tools search "<query>" --json`;
|
|
9358
|
-
}
|
|
9359
|
-
function printPlayLikeToolExecuteError(toolId) {
|
|
9360
|
-
console.error(playLikeToolExecuteErrorMessage(toolId));
|
|
9194
|
+
Inspect its schema with: deepline plays describe ${playName} --json`
|
|
9195
|
+
);
|
|
9361
9196
|
}
|
|
9362
9197
|
function registerToolsCommands(program) {
|
|
9363
9198
|
const tools = program.command("tools").description("Search, describe, and execute atomic provider tools.").addHelpText(
|
|
@@ -9532,7 +9367,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9532
9367
|
const operation = typeof tool.operation === "string" ? tool.operation : "";
|
|
9533
9368
|
const displayBase = operation && operation.startsWith(`${tool.provider}_`) ? operation.slice(String(tool.provider).length + 1) : operation ? `${tool.provider} ${operation}`.trim() : toolId;
|
|
9534
9369
|
const displayName = titleCase(displayBase || String(tool.displayName || toolId));
|
|
9535
|
-
const cost =
|
|
9370
|
+
const cost = isRecord3(tool.cost) ? tool.cost : null;
|
|
9536
9371
|
const deeplineCredits = numberField(tool, "deeplineCreditsPerPricingUnit", "deepline_credits_per_pricing_unit");
|
|
9537
9372
|
const deeplineUsdPerPricingUnit = numberField(tool, "deeplineUsdPerPricingUnit", "deepline_usd_per_pricing_unit");
|
|
9538
9373
|
const deeplineUsdPerCredit = numberField(tool, "deeplineUsdPerCredit", "deepline_usd_per_credit");
|
|
@@ -9582,7 +9417,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9582
9417
|
if (stepContributions.length) {
|
|
9583
9418
|
console.log(" step contributions:");
|
|
9584
9419
|
for (const item of stepContributions) {
|
|
9585
|
-
if (!
|
|
9420
|
+
if (!isRecord3(item)) continue;
|
|
9586
9421
|
const stepTool = typeof item.tool === "string" ? item.tool.trim() : "";
|
|
9587
9422
|
const low = typeof item.lowCredits === "number" ? item.lowCredits : null;
|
|
9588
9423
|
const high = typeof item.highCredits === "number" ? item.highCredits : null;
|
|
@@ -9622,7 +9457,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9622
9457
|
}
|
|
9623
9458
|
const toolExecutionResult = recordField(usageGuidance, "toolExecutionResult");
|
|
9624
9459
|
const extractedValues = arrayField(toolExecutionResult, "extractedValues", "extracted_values");
|
|
9625
|
-
const targets = extractedValues.map((entry) =>
|
|
9460
|
+
const targets = extractedValues.map((entry) => isRecord3(entry) && typeof entry.name === "string" ? entry.name : "").filter(Boolean).sort();
|
|
9626
9461
|
if (targets.length) {
|
|
9627
9462
|
console.log(` - Built-in extract targets: ${targets.join(", ")}`);
|
|
9628
9463
|
}
|
|
@@ -9663,7 +9498,7 @@ function printExtractions(label, entries) {
|
|
|
9663
9498
|
if (!entries.length) return;
|
|
9664
9499
|
console.log(` ${label}:`);
|
|
9665
9500
|
for (const entry of entries) {
|
|
9666
|
-
if (!
|
|
9501
|
+
if (!isRecord3(entry)) continue;
|
|
9667
9502
|
const name = stringField(entry, "name");
|
|
9668
9503
|
const expression = stringField(entry, "expression");
|
|
9669
9504
|
const details = recordField(entry, "details");
|
|
@@ -9703,12 +9538,12 @@ function printToolCost(input) {
|
|
|
9703
9538
|
return false;
|
|
9704
9539
|
}
|
|
9705
9540
|
function toolInputFieldsForDisplay(inputSchema) {
|
|
9706
|
-
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(
|
|
9707
|
-
const jsonSchema =
|
|
9708
|
-
const properties =
|
|
9541
|
+
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(isRecord3);
|
|
9542
|
+
const jsonSchema = isRecord3(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
|
|
9543
|
+
const properties = isRecord3(jsonSchema.properties) ? jsonSchema.properties : {};
|
|
9709
9544
|
const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
|
|
9710
9545
|
return Object.entries(properties).map(([name, value]) => {
|
|
9711
|
-
const property =
|
|
9546
|
+
const property = isRecord3(value) ? value : {};
|
|
9712
9547
|
return {
|
|
9713
9548
|
name,
|
|
9714
9549
|
type: typeof property.type === "string" ? property.type : "unknown",
|
|
@@ -9735,15 +9570,15 @@ function printJsonPreview(label, payload) {
|
|
|
9735
9570
|
}
|
|
9736
9571
|
function samplePayload(samples, key) {
|
|
9737
9572
|
const entry = samples[key];
|
|
9738
|
-
if (!
|
|
9573
|
+
if (!isRecord3(entry)) return void 0;
|
|
9739
9574
|
return Object.prototype.hasOwnProperty.call(entry, "payload") ? entry.payload : entry;
|
|
9740
9575
|
}
|
|
9741
9576
|
function commandEnvelopeFromRawResponse(rawResponse) {
|
|
9742
|
-
return
|
|
9577
|
+
return isRecord3(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
|
|
9743
9578
|
}
|
|
9744
9579
|
function listExtractorPathsFromUsageGuidance(tool) {
|
|
9745
9580
|
const toolExecutionResult = tool.usageGuidance?.toolExecutionResult;
|
|
9746
|
-
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists :
|
|
9581
|
+
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord3(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
|
|
9747
9582
|
return extractedLists.flatMap((entry) => {
|
|
9748
9583
|
const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
|
|
9749
9584
|
if (!Array.isArray(paths)) return [];
|
|
@@ -9770,7 +9605,7 @@ function formatDecimal(value) {
|
|
|
9770
9605
|
function formatUsd(value) {
|
|
9771
9606
|
return `$${formatDecimal(value)}`;
|
|
9772
9607
|
}
|
|
9773
|
-
function
|
|
9608
|
+
function isRecord3(value) {
|
|
9774
9609
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
9775
9610
|
}
|
|
9776
9611
|
function stringField(source, ...keys) {
|
|
@@ -9797,7 +9632,7 @@ function arrayField(source, ...keys) {
|
|
|
9797
9632
|
function recordField(source, ...keys) {
|
|
9798
9633
|
for (const key of keys) {
|
|
9799
9634
|
const value = source[key];
|
|
9800
|
-
if (
|
|
9635
|
+
if (isRecord3(value)) return value;
|
|
9801
9636
|
}
|
|
9802
9637
|
return {};
|
|
9803
9638
|
}
|
|
@@ -9895,11 +9730,8 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
9895
9730
|
// .step('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.' }))
|
|
9896
9731
|
// ctx.map is idempotent by map key + row key; reruns reuse completed rows.
|
|
9897
9732
|
const enrichedData = await ctx
|
|
9898
|
-
.map('enriched_data', rows)
|
|
9899
|
-
.run({
|
|
9900
|
-
key: ${rowKey},
|
|
9901
|
-
description: 'Enrich seeded rows.',
|
|
9902
|
-
});
|
|
9733
|
+
.map('enriched_data', rows, { key: ${rowKey} })
|
|
9734
|
+
.run({ description: 'Enrich seeded rows.' });
|
|
9903
9735
|
|
|
9904
9736
|
return {
|
|
9905
9737
|
rows: enrichedData,
|
|
@@ -9929,7 +9761,7 @@ function buildToolExecuteBaseEnvelope(input) {
|
|
|
9929
9761
|
kind: summaryEntries.length > 0 ? "object" : "raw",
|
|
9930
9762
|
summary: input.summary
|
|
9931
9763
|
};
|
|
9932
|
-
const envelopeHasCanonicalOutput =
|
|
9764
|
+
const envelopeHasCanonicalOutput = isRecord3(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
|
|
9933
9765
|
const inspectCommand = `deepline tools execute ${input.toolId} --input ${shellQuote(JSON.stringify(input.params))} --json`;
|
|
9934
9766
|
const actions = input.listConversion ? [
|
|
9935
9767
|
{
|
|
@@ -9989,11 +9821,7 @@ async function executeTool(args) {
|
|
|
9989
9821
|
} catch (error) {
|
|
9990
9822
|
const play = await findPlayForToolId(client, parsed.toolId);
|
|
9991
9823
|
if (play) {
|
|
9992
|
-
|
|
9993
|
-
printJsonError(new Error(playAliasToolErrorMessage(parsed.toolId, play)));
|
|
9994
|
-
} else {
|
|
9995
|
-
printPlayAliasToolError(parsed.toolId, play);
|
|
9996
|
-
}
|
|
9824
|
+
printPlayAliasToolError(parsed.toolId, play);
|
|
9997
9825
|
return 2;
|
|
9998
9826
|
}
|
|
9999
9827
|
if (error instanceof DeeplineError) {
|
|
@@ -10001,14 +9829,6 @@ async function executeTool(args) {
|
|
|
10001
9829
|
}
|
|
10002
9830
|
throw error;
|
|
10003
9831
|
}
|
|
10004
|
-
if (isPlayLikeTool(metadata)) {
|
|
10005
|
-
if (argsWantJson(args)) {
|
|
10006
|
-
printJsonError(new Error(playLikeToolExecuteErrorMessage(parsed.toolId)));
|
|
10007
|
-
} else {
|
|
10008
|
-
printPlayLikeToolExecuteError(parsed.toolId);
|
|
10009
|
-
}
|
|
10010
|
-
return 2;
|
|
10011
|
-
}
|
|
10012
9832
|
const rawResponse = await client.executeTool(parsed.toolId, parsed.params);
|
|
10013
9833
|
const listConversion = tryConvertToList(rawResponse, {
|
|
10014
9834
|
listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
|
|
@@ -10031,7 +9851,7 @@ async function executeTool(args) {
|
|
|
10031
9851
|
{
|
|
10032
9852
|
...baseEnvelope,
|
|
10033
9853
|
local: {
|
|
10034
|
-
...
|
|
9854
|
+
...isRecord3(baseEnvelope.local) ? baseEnvelope.local : {},
|
|
10035
9855
|
payload_file: jsonPath
|
|
10036
9856
|
}
|
|
10037
9857
|
},
|
|
@@ -10629,15 +10449,9 @@ Notes:
|
|
|
10629
10449
|
|
|
10630
10450
|
Examples:
|
|
10631
10451
|
deepline version
|
|
10632
|
-
deepline version --json
|
|
10633
10452
|
deepline --version
|
|
10634
10453
|
`
|
|
10635
|
-
).
|
|
10636
|
-
if (options.json) {
|
|
10637
|
-
process.stdout.write(`${JSON.stringify({ version: SDK_VERSION })}
|
|
10638
|
-
`);
|
|
10639
|
-
return;
|
|
10640
|
-
}
|
|
10454
|
+
).action(() => {
|
|
10641
10455
|
process.stdout.write(`deepline ${SDK_VERSION}
|
|
10642
10456
|
`);
|
|
10643
10457
|
});
|