deepline 0.1.41 → 0.1.42
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 +220 -34
- package/dist/cli/index.mjs +220 -34
- package/dist/index.d.mts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.js +12 -8
- package/dist/index.mjs +12 -8
- package/dist/repo/apps/play-runner-workers/src/entry.ts +89 -17
- package/dist/repo/sdk/src/types.ts +17 -0
- package/dist/repo/sdk/src/version.ts +2 -2
- package/dist/repo/shared_libs/play-runtime/tool-result.ts +79 -23
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -193,8 +193,8 @@ function resolveConfig(options) {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
// src/version.ts
|
|
196
|
-
var SDK_VERSION = "0.1.
|
|
197
|
-
var SDK_API_CONTRACT = "2026-05-
|
|
196
|
+
var SDK_VERSION = "0.1.42";
|
|
197
|
+
var SDK_API_CONTRACT = "2026-05-play-tool-result-errors";
|
|
198
198
|
|
|
199
199
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
200
200
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -7470,6 +7470,126 @@ function shouldUseLocalOnlyPlayCheck() {
|
|
|
7470
7470
|
const value = process.env.DEEPLINE_PLAY_CHECK_LOCAL_ONLY?.trim().toLowerCase();
|
|
7471
7471
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
7472
7472
|
}
|
|
7473
|
+
function isRecord3(value) {
|
|
7474
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
7475
|
+
}
|
|
7476
|
+
function stringValue(value) {
|
|
7477
|
+
return typeof value === "string" ? value.trim() : "";
|
|
7478
|
+
}
|
|
7479
|
+
function asArray(value) {
|
|
7480
|
+
return Array.isArray(value) ? value : [];
|
|
7481
|
+
}
|
|
7482
|
+
function extractionEntries(value) {
|
|
7483
|
+
if (Array.isArray(value)) return value.filter(isRecord3);
|
|
7484
|
+
if (!isRecord3(value)) return [];
|
|
7485
|
+
return Object.entries(value).map(
|
|
7486
|
+
([name, entry]) => isRecord3(entry) ? { name, ...entry } : { name }
|
|
7487
|
+
);
|
|
7488
|
+
}
|
|
7489
|
+
function firstRawPath(entry) {
|
|
7490
|
+
const details = isRecord3(entry.details) ? entry.details : {};
|
|
7491
|
+
const paths = [
|
|
7492
|
+
...asArray(details.rawToolOutputPaths),
|
|
7493
|
+
...asArray(details.raw_tool_output_paths),
|
|
7494
|
+
...asArray(details.candidatePaths),
|
|
7495
|
+
...asArray(details.candidate_paths)
|
|
7496
|
+
].map(stringValue).filter(Boolean);
|
|
7497
|
+
return paths[0];
|
|
7498
|
+
}
|
|
7499
|
+
function checkHintExpression(value) {
|
|
7500
|
+
return stringValue(value).replace(/^toolExecutionResult\./, "result.");
|
|
7501
|
+
}
|
|
7502
|
+
function checkHintRawPath(value) {
|
|
7503
|
+
return value?.replace(/^toolResponse\./, "result.toolResponse.");
|
|
7504
|
+
}
|
|
7505
|
+
function collectStaticPipelineToolIds(staticPipeline) {
|
|
7506
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7507
|
+
const visitPipeline = (pipeline) => {
|
|
7508
|
+
if (!isRecord3(pipeline)) return;
|
|
7509
|
+
for (const step of [
|
|
7510
|
+
...asArray(pipeline.stages),
|
|
7511
|
+
...asArray(pipeline.substeps)
|
|
7512
|
+
]) {
|
|
7513
|
+
if (!isRecord3(step)) continue;
|
|
7514
|
+
if (step.type === "tool") {
|
|
7515
|
+
const toolId = stringValue(step.toolId) || stringValue(step.tool);
|
|
7516
|
+
if (toolId) seen.add(toolId);
|
|
7517
|
+
}
|
|
7518
|
+
if (step.type === "play_call") {
|
|
7519
|
+
visitPipeline(step.pipeline);
|
|
7520
|
+
}
|
|
7521
|
+
}
|
|
7522
|
+
};
|
|
7523
|
+
visitPipeline(staticPipeline);
|
|
7524
|
+
return [...seen].sort();
|
|
7525
|
+
}
|
|
7526
|
+
function toolGetterHintFromMetadata(toolId, tool) {
|
|
7527
|
+
const usageGuidance = isRecord3(tool.usageGuidance) ? tool.usageGuidance : {};
|
|
7528
|
+
const resultGuidance = isRecord3(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord3(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
|
|
7529
|
+
const toolResponse = isRecord3(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord3(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
|
|
7530
|
+
const lists = extractionEntries(
|
|
7531
|
+
resultGuidance.extractedLists ?? resultGuidance.extracted_lists
|
|
7532
|
+
).map((entry) => ({
|
|
7533
|
+
name: stringValue(entry.name),
|
|
7534
|
+
expression: checkHintExpression(entry.expression),
|
|
7535
|
+
raw: checkHintRawPath(firstRawPath(entry))
|
|
7536
|
+
})).filter((entry) => entry.name && entry.expression);
|
|
7537
|
+
const values = extractionEntries(
|
|
7538
|
+
resultGuidance.extractedValues ?? resultGuidance.extracted_values
|
|
7539
|
+
).map((entry) => ({
|
|
7540
|
+
name: stringValue(entry.name),
|
|
7541
|
+
expression: checkHintExpression(entry.expression),
|
|
7542
|
+
raw: checkHintRawPath(firstRawPath(entry))
|
|
7543
|
+
})).filter((entry) => entry.name && entry.expression);
|
|
7544
|
+
return {
|
|
7545
|
+
toolId,
|
|
7546
|
+
lists,
|
|
7547
|
+
values,
|
|
7548
|
+
raw: checkHintExpression(toolResponse.raw) || "result.toolResponse.raw"
|
|
7549
|
+
};
|
|
7550
|
+
}
|
|
7551
|
+
async function buildToolGetterHints(client, staticPipeline) {
|
|
7552
|
+
const toolIds = collectStaticPipelineToolIds(staticPipeline);
|
|
7553
|
+
return Promise.all(
|
|
7554
|
+
toolIds.map(async (toolId) => {
|
|
7555
|
+
try {
|
|
7556
|
+
const tool = await client.getTool(toolId);
|
|
7557
|
+
return toolGetterHintFromMetadata(toolId, tool);
|
|
7558
|
+
} catch (error) {
|
|
7559
|
+
return {
|
|
7560
|
+
toolId,
|
|
7561
|
+
lists: [],
|
|
7562
|
+
values: [],
|
|
7563
|
+
raw: "result.toolResponse.raw",
|
|
7564
|
+
unavailable: error instanceof Error ? error.message : String(error)
|
|
7565
|
+
};
|
|
7566
|
+
}
|
|
7567
|
+
})
|
|
7568
|
+
);
|
|
7569
|
+
}
|
|
7570
|
+
function printToolGetterHints(hints) {
|
|
7571
|
+
if (!hints?.length) return;
|
|
7572
|
+
console.log(" Tool result getter hints:");
|
|
7573
|
+
for (const hint of hints) {
|
|
7574
|
+
console.log(` ${hint.toolId} output:`);
|
|
7575
|
+
if (hint.lists.length) {
|
|
7576
|
+
for (const entry of hint.lists) {
|
|
7577
|
+
const raw = entry.raw ? ` (raw: ${entry.raw})` : "";
|
|
7578
|
+
console.log(` - list ${entry.name}: ${entry.expression}${raw}`);
|
|
7579
|
+
}
|
|
7580
|
+
}
|
|
7581
|
+
if (hint.values.length) {
|
|
7582
|
+
const valueNames = hint.values.map((entry) => entry.name).join(", ");
|
|
7583
|
+
console.log(` - values: ${valueNames}`);
|
|
7584
|
+
for (const entry of hint.values) {
|
|
7585
|
+
const raw = entry.raw ? ` (raw: ${entry.raw})` : "";
|
|
7586
|
+
console.log(` ${entry.name}: ${entry.expression}${raw}`);
|
|
7587
|
+
}
|
|
7588
|
+
}
|
|
7589
|
+
if (hint.raw) console.log(` - raw: ${hint.raw}`);
|
|
7590
|
+
if (hint.unavailable) console.log(` - warning: ${hint.unavailable}`);
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7473
7593
|
async function handlePlayCheck(args) {
|
|
7474
7594
|
const options = parsePlayCheckOptions(args);
|
|
7475
7595
|
if (!isFileTarget(options.target)) {
|
|
@@ -7500,6 +7620,7 @@ async function handlePlayCheck(args) {
|
|
|
7500
7620
|
valid: true,
|
|
7501
7621
|
errors: [],
|
|
7502
7622
|
staticPipeline: graph.root.compilerManifest?.staticPipeline ?? null,
|
|
7623
|
+
toolGetterHints: [],
|
|
7503
7624
|
artifactHash: graph.root.artifact.artifactHash,
|
|
7504
7625
|
graphHash: graph.root.artifact.graphHash
|
|
7505
7626
|
};
|
|
@@ -7509,6 +7630,7 @@ async function handlePlayCheck(args) {
|
|
|
7509
7630
|
} else {
|
|
7510
7631
|
console.log(`\u2713 ${playName} passed local play check`);
|
|
7511
7632
|
console.log(` artifact: ${result2.artifactHash.slice(0, 12)}`);
|
|
7633
|
+
printToolGetterHints(result2.toolGetterHints);
|
|
7512
7634
|
}
|
|
7513
7635
|
return 0;
|
|
7514
7636
|
}
|
|
@@ -7519,21 +7641,27 @@ async function handlePlayCheck(args) {
|
|
|
7519
7641
|
sourceFiles: graph.root.sourceFiles,
|
|
7520
7642
|
artifact: graph.root.artifact
|
|
7521
7643
|
});
|
|
7644
|
+
const enrichedResult = {
|
|
7645
|
+
...result,
|
|
7646
|
+
toolGetterHints: result.toolGetterHints ?? await buildToolGetterHints(client, result.staticPipeline)
|
|
7647
|
+
};
|
|
7522
7648
|
if (options.jsonOutput) {
|
|
7523
|
-
process.stdout.write(`${JSON.stringify({ name: playName, ...
|
|
7649
|
+
process.stdout.write(`${JSON.stringify({ name: playName, ...enrichedResult })}
|
|
7524
7650
|
`);
|
|
7525
|
-
} else if (
|
|
7651
|
+
} else if (enrichedResult.valid) {
|
|
7526
7652
|
console.log(`\u2713 ${playName} passed cloud play check`);
|
|
7527
|
-
if (
|
|
7528
|
-
console.log(` artifact: ${
|
|
7653
|
+
if (enrichedResult.artifactHash) {
|
|
7654
|
+
console.log(` artifact: ${enrichedResult.artifactHash.slice(0, 12)}`);
|
|
7529
7655
|
}
|
|
7656
|
+
printToolGetterHints(enrichedResult.toolGetterHints);
|
|
7530
7657
|
} else {
|
|
7531
7658
|
console.error(`\u2717 ${playName} failed cloud play check`);
|
|
7532
|
-
for (const error of
|
|
7659
|
+
for (const error of enrichedResult.errors) {
|
|
7533
7660
|
console.error(` ${error}`);
|
|
7534
7661
|
}
|
|
7662
|
+
printToolGetterHints(enrichedResult.toolGetterHints);
|
|
7535
7663
|
}
|
|
7536
|
-
return
|
|
7664
|
+
return enrichedResult.valid ? 0 : 1;
|
|
7537
7665
|
}
|
|
7538
7666
|
async function handleFileBackedRun(options) {
|
|
7539
7667
|
if (options.target.kind !== "file") {
|
|
@@ -8636,7 +8764,7 @@ Pass-through input flags:
|
|
|
8636
8764
|
...options.logs ? ["--logs"] : [],
|
|
8637
8765
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
|
8638
8766
|
...options.force ? ["--force"] : [],
|
|
8639
|
-
...options.open === false ? ["--no-open"] : [],
|
|
8767
|
+
...options.noOpen || options.open === false ? ["--no-open"] : [],
|
|
8640
8768
|
...options.json ? ["--json"] : [],
|
|
8641
8769
|
...passthroughArgs
|
|
8642
8770
|
]);
|
|
@@ -9092,6 +9220,15 @@ function extractSummaryFields(payload) {
|
|
|
9092
9220
|
|
|
9093
9221
|
// src/cli/commands/tools.ts
|
|
9094
9222
|
function toListedTool(tool) {
|
|
9223
|
+
if (isPlayLikeTool(tool)) {
|
|
9224
|
+
const playReference = playReferenceForTool(tool);
|
|
9225
|
+
return {
|
|
9226
|
+
...tool,
|
|
9227
|
+
id: tool.toolId,
|
|
9228
|
+
type: "play",
|
|
9229
|
+
executeCommand: `deepline plays run ${playReference} --input '{...}' --watch`
|
|
9230
|
+
};
|
|
9231
|
+
}
|
|
9095
9232
|
return {
|
|
9096
9233
|
...tool,
|
|
9097
9234
|
id: tool.toolId,
|
|
@@ -9130,11 +9267,12 @@ async function searchTools(queryInput, options = {}) {
|
|
|
9130
9267
|
searchMode: options.searchMode,
|
|
9131
9268
|
includeSearchDebug: options.includeSearchDebug
|
|
9132
9269
|
});
|
|
9133
|
-
const items = result.tools.map(toListedTool);
|
|
9270
|
+
const items = result.tools.filter((tool) => !isPlayLikeTool(tool)).map(toListedTool);
|
|
9134
9271
|
const envelope = {
|
|
9135
9272
|
...result,
|
|
9136
9273
|
tools: items,
|
|
9137
9274
|
count: items.length,
|
|
9275
|
+
omitted_plays_hint: "Use `deepline plays search <query> --json` for prebuilt and org-owned plays.",
|
|
9138
9276
|
render: {
|
|
9139
9277
|
sections: [
|
|
9140
9278
|
{
|
|
@@ -9147,6 +9285,10 @@ async function searchTools(queryInput, options = {}) {
|
|
|
9147
9285
|
...item.inputSchema ? [" inputSchema: yes"] : []
|
|
9148
9286
|
];
|
|
9149
9287
|
})
|
|
9288
|
+
},
|
|
9289
|
+
{
|
|
9290
|
+
title: "plays",
|
|
9291
|
+
lines: ["For prebuilt or org-owned workflows, run: deepline plays search <query>"]
|
|
9150
9292
|
}
|
|
9151
9293
|
]
|
|
9152
9294
|
}
|
|
@@ -9165,13 +9307,36 @@ async function findPlayForToolId(client, toolId) {
|
|
|
9165
9307
|
const plays = await client.searchPlays({ query: requested, compact: true });
|
|
9166
9308
|
return plays.find((play) => playIdentifiers(play).includes(requested)) ?? null;
|
|
9167
9309
|
}
|
|
9168
|
-
function
|
|
9310
|
+
function playAliasToolErrorMessage(toolId, play) {
|
|
9169
9311
|
const playName = play.reference ?? play.name;
|
|
9170
|
-
|
|
9171
|
-
`${toolId} is a play, not a tool.
|
|
9312
|
+
return `${toolId} is a play, not a tool.
|
|
9172
9313
|
Use: deepline plays run ${playName} --input '{...}' --watch
|
|
9173
|
-
Inspect its schema with: deepline plays describe ${playName} --json
|
|
9174
|
-
|
|
9314
|
+
Inspect its schema with: deepline plays describe ${playName} --json`;
|
|
9315
|
+
}
|
|
9316
|
+
function printPlayAliasToolError(toolId, play) {
|
|
9317
|
+
console.error(playAliasToolErrorMessage(toolId, play));
|
|
9318
|
+
}
|
|
9319
|
+
function isPlayLikeTool(tool) {
|
|
9320
|
+
const record = tool;
|
|
9321
|
+
if (record.isPlay === true || record.is_play === true) return true;
|
|
9322
|
+
const playExpansion = recordField(record, "playExpansion", "play_expansion");
|
|
9323
|
+
if (Object.keys(playExpansion).length > 0) return true;
|
|
9324
|
+
const toolId = typeof record.toolId === "string" ? record.toolId : "";
|
|
9325
|
+
return toolId.endsWith("_waterfall");
|
|
9326
|
+
}
|
|
9327
|
+
function playReferenceForTool(tool) {
|
|
9328
|
+
const record = tool;
|
|
9329
|
+
const toolId = typeof record.toolId === "string" ? record.toolId : "play";
|
|
9330
|
+
return `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9331
|
+
}
|
|
9332
|
+
function playLikeToolExecuteErrorMessage(toolId) {
|
|
9333
|
+
const playReference = `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9334
|
+
return `${toolId} is a workflow/play entry, not an atomic provider tool.
|
|
9335
|
+
Use: deepline plays run ${playReference} --input '{...}' --watch
|
|
9336
|
+
Or search provider tools only with: deepline tools search "<query>" --json`;
|
|
9337
|
+
}
|
|
9338
|
+
function printPlayLikeToolExecuteError(toolId) {
|
|
9339
|
+
console.error(playLikeToolExecuteErrorMessage(toolId));
|
|
9175
9340
|
}
|
|
9176
9341
|
function registerToolsCommands(program) {
|
|
9177
9342
|
const tools = program.command("tools").description("Search, describe, and execute atomic provider tools.").addHelpText(
|
|
@@ -9346,7 +9511,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9346
9511
|
const operation = typeof tool.operation === "string" ? tool.operation : "";
|
|
9347
9512
|
const displayBase = operation && operation.startsWith(`${tool.provider}_`) ? operation.slice(String(tool.provider).length + 1) : operation ? `${tool.provider} ${operation}`.trim() : toolId;
|
|
9348
9513
|
const displayName = titleCase(displayBase || String(tool.displayName || toolId));
|
|
9349
|
-
const cost =
|
|
9514
|
+
const cost = isRecord4(tool.cost) ? tool.cost : null;
|
|
9350
9515
|
const deeplineCredits = numberField(tool, "deeplineCreditsPerPricingUnit", "deepline_credits_per_pricing_unit");
|
|
9351
9516
|
const deeplineUsdPerPricingUnit = numberField(tool, "deeplineUsdPerPricingUnit", "deepline_usd_per_pricing_unit");
|
|
9352
9517
|
const deeplineUsdPerCredit = numberField(tool, "deeplineUsdPerCredit", "deepline_usd_per_credit");
|
|
@@ -9396,7 +9561,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9396
9561
|
if (stepContributions.length) {
|
|
9397
9562
|
console.log(" step contributions:");
|
|
9398
9563
|
for (const item of stepContributions) {
|
|
9399
|
-
if (!
|
|
9564
|
+
if (!isRecord4(item)) continue;
|
|
9400
9565
|
const stepTool = typeof item.tool === "string" ? item.tool.trim() : "";
|
|
9401
9566
|
const low = typeof item.lowCredits === "number" ? item.lowCredits : null;
|
|
9402
9567
|
const high = typeof item.highCredits === "number" ? item.highCredits : null;
|
|
@@ -9436,7 +9601,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9436
9601
|
}
|
|
9437
9602
|
const toolExecutionResult = recordField(usageGuidance, "toolExecutionResult");
|
|
9438
9603
|
const extractedValues = arrayField(toolExecutionResult, "extractedValues", "extracted_values");
|
|
9439
|
-
const targets = extractedValues.map((entry) =>
|
|
9604
|
+
const targets = extractedValues.map((entry) => isRecord4(entry) && typeof entry.name === "string" ? entry.name : "").filter(Boolean).sort();
|
|
9440
9605
|
if (targets.length) {
|
|
9441
9606
|
console.log(` - Built-in extract targets: ${targets.join(", ")}`);
|
|
9442
9607
|
}
|
|
@@ -9477,7 +9642,7 @@ function printExtractions(label, entries) {
|
|
|
9477
9642
|
if (!entries.length) return;
|
|
9478
9643
|
console.log(` ${label}:`);
|
|
9479
9644
|
for (const entry of entries) {
|
|
9480
|
-
if (!
|
|
9645
|
+
if (!isRecord4(entry)) continue;
|
|
9481
9646
|
const name = stringField(entry, "name");
|
|
9482
9647
|
const expression = stringField(entry, "expression");
|
|
9483
9648
|
const details = recordField(entry, "details");
|
|
@@ -9517,12 +9682,12 @@ function printToolCost(input) {
|
|
|
9517
9682
|
return false;
|
|
9518
9683
|
}
|
|
9519
9684
|
function toolInputFieldsForDisplay(inputSchema) {
|
|
9520
|
-
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(
|
|
9521
|
-
const jsonSchema =
|
|
9522
|
-
const properties =
|
|
9685
|
+
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(isRecord4);
|
|
9686
|
+
const jsonSchema = isRecord4(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
|
|
9687
|
+
const properties = isRecord4(jsonSchema.properties) ? jsonSchema.properties : {};
|
|
9523
9688
|
const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
|
|
9524
9689
|
return Object.entries(properties).map(([name, value]) => {
|
|
9525
|
-
const property =
|
|
9690
|
+
const property = isRecord4(value) ? value : {};
|
|
9526
9691
|
return {
|
|
9527
9692
|
name,
|
|
9528
9693
|
type: typeof property.type === "string" ? property.type : "unknown",
|
|
@@ -9549,15 +9714,15 @@ function printJsonPreview(label, payload) {
|
|
|
9549
9714
|
}
|
|
9550
9715
|
function samplePayload(samples, key) {
|
|
9551
9716
|
const entry = samples[key];
|
|
9552
|
-
if (!
|
|
9717
|
+
if (!isRecord4(entry)) return void 0;
|
|
9553
9718
|
return Object.prototype.hasOwnProperty.call(entry, "payload") ? entry.payload : entry;
|
|
9554
9719
|
}
|
|
9555
9720
|
function commandEnvelopeFromRawResponse(rawResponse) {
|
|
9556
|
-
return
|
|
9721
|
+
return isRecord4(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
|
|
9557
9722
|
}
|
|
9558
9723
|
function listExtractorPathsFromUsageGuidance(tool) {
|
|
9559
9724
|
const toolExecutionResult = tool.usageGuidance?.toolExecutionResult;
|
|
9560
|
-
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists :
|
|
9725
|
+
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord4(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
|
|
9561
9726
|
return extractedLists.flatMap((entry) => {
|
|
9562
9727
|
const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
|
|
9563
9728
|
if (!Array.isArray(paths)) return [];
|
|
@@ -9584,7 +9749,7 @@ function formatDecimal(value) {
|
|
|
9584
9749
|
function formatUsd(value) {
|
|
9585
9750
|
return `$${formatDecimal(value)}`;
|
|
9586
9751
|
}
|
|
9587
|
-
function
|
|
9752
|
+
function isRecord4(value) {
|
|
9588
9753
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
9589
9754
|
}
|
|
9590
9755
|
function stringField(source, ...keys) {
|
|
@@ -9611,7 +9776,7 @@ function arrayField(source, ...keys) {
|
|
|
9611
9776
|
function recordField(source, ...keys) {
|
|
9612
9777
|
for (const key of keys) {
|
|
9613
9778
|
const value = source[key];
|
|
9614
|
-
if (
|
|
9779
|
+
if (isRecord4(value)) return value;
|
|
9615
9780
|
}
|
|
9616
9781
|
return {};
|
|
9617
9782
|
}
|
|
@@ -9709,8 +9874,11 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
9709
9874
|
// .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.' }))
|
|
9710
9875
|
// ctx.map is idempotent by map key + row key; reruns reuse completed rows.
|
|
9711
9876
|
const enrichedData = await ctx
|
|
9712
|
-
.map('enriched_data', rows
|
|
9713
|
-
.run({
|
|
9877
|
+
.map('enriched_data', rows)
|
|
9878
|
+
.run({
|
|
9879
|
+
key: ${rowKey},
|
|
9880
|
+
description: 'Enrich seeded rows.',
|
|
9881
|
+
});
|
|
9714
9882
|
|
|
9715
9883
|
return {
|
|
9716
9884
|
rows: enrichedData,
|
|
@@ -9740,7 +9908,7 @@ function buildToolExecuteBaseEnvelope(input) {
|
|
|
9740
9908
|
kind: summaryEntries.length > 0 ? "object" : "raw",
|
|
9741
9909
|
summary: input.summary
|
|
9742
9910
|
};
|
|
9743
|
-
const envelopeHasCanonicalOutput =
|
|
9911
|
+
const envelopeHasCanonicalOutput = isRecord4(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
|
|
9744
9912
|
const inspectCommand = `deepline tools execute ${input.toolId} --input ${shellQuote(JSON.stringify(input.params))} --json`;
|
|
9745
9913
|
const actions = input.listConversion ? [
|
|
9746
9914
|
{
|
|
@@ -9800,7 +9968,11 @@ async function executeTool(args) {
|
|
|
9800
9968
|
} catch (error) {
|
|
9801
9969
|
const play = await findPlayForToolId(client, parsed.toolId);
|
|
9802
9970
|
if (play) {
|
|
9803
|
-
|
|
9971
|
+
if (argsWantJson(args)) {
|
|
9972
|
+
printJsonError(new Error(playAliasToolErrorMessage(parsed.toolId, play)));
|
|
9973
|
+
} else {
|
|
9974
|
+
printPlayAliasToolError(parsed.toolId, play);
|
|
9975
|
+
}
|
|
9804
9976
|
return 2;
|
|
9805
9977
|
}
|
|
9806
9978
|
if (error instanceof DeeplineError) {
|
|
@@ -9808,6 +9980,14 @@ async function executeTool(args) {
|
|
|
9808
9980
|
}
|
|
9809
9981
|
throw error;
|
|
9810
9982
|
}
|
|
9983
|
+
if (isPlayLikeTool(metadata)) {
|
|
9984
|
+
if (argsWantJson(args)) {
|
|
9985
|
+
printJsonError(new Error(playLikeToolExecuteErrorMessage(parsed.toolId)));
|
|
9986
|
+
} else {
|
|
9987
|
+
printPlayLikeToolExecuteError(parsed.toolId);
|
|
9988
|
+
}
|
|
9989
|
+
return 2;
|
|
9990
|
+
}
|
|
9811
9991
|
const rawResponse = await client.executeTool(parsed.toolId, parsed.params);
|
|
9812
9992
|
const listConversion = tryConvertToList(rawResponse, {
|
|
9813
9993
|
listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
|
|
@@ -9830,7 +10010,7 @@ async function executeTool(args) {
|
|
|
9830
10010
|
{
|
|
9831
10011
|
...baseEnvelope,
|
|
9832
10012
|
local: {
|
|
9833
|
-
...
|
|
10013
|
+
...isRecord4(baseEnvelope.local) ? baseEnvelope.local : {},
|
|
9834
10014
|
payload_file: jsonPath
|
|
9835
10015
|
}
|
|
9836
10016
|
},
|
|
@@ -10428,9 +10608,15 @@ Notes:
|
|
|
10428
10608
|
|
|
10429
10609
|
Examples:
|
|
10430
10610
|
deepline version
|
|
10611
|
+
deepline version --json
|
|
10431
10612
|
deepline --version
|
|
10432
10613
|
`
|
|
10433
|
-
).action(() => {
|
|
10614
|
+
).option("--json", "Emit JSON output").action((options) => {
|
|
10615
|
+
if (options.json) {
|
|
10616
|
+
process.stdout.write(`${JSON.stringify({ version: SDK_VERSION })}
|
|
10617
|
+
`);
|
|
10618
|
+
return;
|
|
10619
|
+
}
|
|
10434
10620
|
process.stdout.write(`deepline ${SDK_VERSION}
|
|
10435
10621
|
`);
|
|
10436
10622
|
});
|
package/dist/index.d.mts
CHANGED
|
@@ -745,9 +745,25 @@ interface PlayCheckResult {
|
|
|
745
745
|
valid: boolean;
|
|
746
746
|
errors: string[];
|
|
747
747
|
staticPipeline?: Record<string, unknown> | null;
|
|
748
|
+
toolGetterHints?: PlayCheckToolGetterHint[];
|
|
748
749
|
artifactHash?: string | null;
|
|
749
750
|
graphHash?: string | null;
|
|
750
751
|
}
|
|
752
|
+
interface PlayCheckToolGetterHint {
|
|
753
|
+
toolId: string;
|
|
754
|
+
lists: Array<{
|
|
755
|
+
name: string;
|
|
756
|
+
expression: string;
|
|
757
|
+
raw?: string;
|
|
758
|
+
}>;
|
|
759
|
+
values: Array<{
|
|
760
|
+
name: string;
|
|
761
|
+
expression: string;
|
|
762
|
+
raw?: string;
|
|
763
|
+
}>;
|
|
764
|
+
raw?: string;
|
|
765
|
+
unavailable?: string;
|
|
766
|
+
}
|
|
751
767
|
/**
|
|
752
768
|
* Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
|
|
753
769
|
*
|
|
@@ -1477,8 +1493,8 @@ declare class DeeplineClient {
|
|
|
1477
1493
|
}>;
|
|
1478
1494
|
}
|
|
1479
1495
|
|
|
1480
|
-
declare const SDK_VERSION = "0.1.
|
|
1481
|
-
declare const SDK_API_CONTRACT = "2026-05-
|
|
1496
|
+
declare const SDK_VERSION = "0.1.42";
|
|
1497
|
+
declare const SDK_API_CONTRACT = "2026-05-play-tool-result-errors";
|
|
1482
1498
|
|
|
1483
1499
|
/**
|
|
1484
1500
|
* Base error class for all Deepline SDK errors.
|
package/dist/index.d.ts
CHANGED
|
@@ -745,9 +745,25 @@ interface PlayCheckResult {
|
|
|
745
745
|
valid: boolean;
|
|
746
746
|
errors: string[];
|
|
747
747
|
staticPipeline?: Record<string, unknown> | null;
|
|
748
|
+
toolGetterHints?: PlayCheckToolGetterHint[];
|
|
748
749
|
artifactHash?: string | null;
|
|
749
750
|
graphHash?: string | null;
|
|
750
751
|
}
|
|
752
|
+
interface PlayCheckToolGetterHint {
|
|
753
|
+
toolId: string;
|
|
754
|
+
lists: Array<{
|
|
755
|
+
name: string;
|
|
756
|
+
expression: string;
|
|
757
|
+
raw?: string;
|
|
758
|
+
}>;
|
|
759
|
+
values: Array<{
|
|
760
|
+
name: string;
|
|
761
|
+
expression: string;
|
|
762
|
+
raw?: string;
|
|
763
|
+
}>;
|
|
764
|
+
raw?: string;
|
|
765
|
+
unavailable?: string;
|
|
766
|
+
}
|
|
751
767
|
/**
|
|
752
768
|
* Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
|
|
753
769
|
*
|
|
@@ -1477,8 +1493,8 @@ declare class DeeplineClient {
|
|
|
1477
1493
|
}>;
|
|
1478
1494
|
}
|
|
1479
1495
|
|
|
1480
|
-
declare const SDK_VERSION = "0.1.
|
|
1481
|
-
declare const SDK_API_CONTRACT = "2026-05-
|
|
1496
|
+
declare const SDK_VERSION = "0.1.42";
|
|
1497
|
+
declare const SDK_API_CONTRACT = "2026-05-play-tool-result-errors";
|
|
1482
1498
|
|
|
1483
1499
|
/**
|
|
1484
1500
|
* Base error class for all Deepline SDK errors.
|
package/dist/index.js
CHANGED
|
@@ -215,8 +215,8 @@ function resolveConfig(options) {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
// src/version.ts
|
|
218
|
-
var SDK_VERSION = "0.1.
|
|
219
|
-
var SDK_API_CONTRACT = "2026-05-
|
|
218
|
+
var SDK_VERSION = "0.1.42";
|
|
219
|
+
var SDK_API_CONTRACT = "2026-05-play-tool-result-errors";
|
|
220
220
|
|
|
221
221
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
222
222
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -1883,9 +1883,8 @@ function buildTargets(result, resultIdentityGetters) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
return targets;
|
|
1885
1885
|
}
|
|
1886
|
-
function buildLists(
|
|
1886
|
+
function buildLists(resolved, metadata) {
|
|
1887
1887
|
const lists = {};
|
|
1888
|
-
const resolved = resolveListRows(result, metadata.listExtractorPaths);
|
|
1889
1888
|
for (const [name, list] of Object.entries(resolved)) {
|
|
1890
1889
|
lists[name] = {
|
|
1891
1890
|
path: list.path,
|
|
@@ -1920,9 +1919,10 @@ function buildExtractedAccessors(targets) {
|
|
|
1920
1919
|
})
|
|
1921
1920
|
);
|
|
1922
1921
|
}
|
|
1923
|
-
function buildListAccessors(
|
|
1922
|
+
function buildListAccessors(resolved, lists) {
|
|
1924
1923
|
return Object.fromEntries(
|
|
1925
1924
|
Object.entries(lists).map(([name, metadata]) => {
|
|
1925
|
+
const rows = resolved[name]?.rows ?? [];
|
|
1926
1926
|
const accessor = {
|
|
1927
1927
|
path: metadata.path,
|
|
1928
1928
|
count: metadata.count,
|
|
@@ -1930,7 +1930,7 @@ function buildListAccessors(result, lists) {
|
|
|
1930
1930
|
};
|
|
1931
1931
|
Object.defineProperty(accessor, "get", {
|
|
1932
1932
|
value() {
|
|
1933
|
-
return
|
|
1933
|
+
return rows;
|
|
1934
1934
|
},
|
|
1935
1935
|
enumerable: false
|
|
1936
1936
|
});
|
|
@@ -1950,7 +1950,11 @@ function createToolExecuteResult(input) {
|
|
|
1950
1950
|
resultRoot,
|
|
1951
1951
|
input.metadata.resultIdentityGetters
|
|
1952
1952
|
);
|
|
1953
|
-
const
|
|
1953
|
+
const resolvedLists = resolveListRows(
|
|
1954
|
+
resultRoot,
|
|
1955
|
+
input.metadata.listExtractorPaths
|
|
1956
|
+
);
|
|
1957
|
+
const lists = buildLists(resolvedLists, input.metadata);
|
|
1954
1958
|
const metadata = {
|
|
1955
1959
|
toolId: input.metadata.toolId,
|
|
1956
1960
|
execution: input.execution,
|
|
@@ -1962,7 +1966,7 @@ function createToolExecuteResult(input) {
|
|
|
1962
1966
|
...result.meta ? { meta: result.meta } : {}
|
|
1963
1967
|
};
|
|
1964
1968
|
const extractedValues = buildExtractedAccessors(targets);
|
|
1965
|
-
const extractedLists = buildListAccessors(
|
|
1969
|
+
const extractedLists = buildListAccessors(resolvedLists, lists);
|
|
1966
1970
|
const wrapper = {
|
|
1967
1971
|
status: input.status,
|
|
1968
1972
|
...input.jobId ? { job_id: input.jobId } : {},
|
package/dist/index.mjs
CHANGED
|
@@ -169,8 +169,8 @@ function resolveConfig(options) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
// src/version.ts
|
|
172
|
-
var SDK_VERSION = "0.1.
|
|
173
|
-
var SDK_API_CONTRACT = "2026-05-
|
|
172
|
+
var SDK_VERSION = "0.1.42";
|
|
173
|
+
var SDK_API_CONTRACT = "2026-05-play-tool-result-errors";
|
|
174
174
|
|
|
175
175
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
176
176
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -1837,9 +1837,8 @@ function buildTargets(result, resultIdentityGetters) {
|
|
|
1837
1837
|
}
|
|
1838
1838
|
return targets;
|
|
1839
1839
|
}
|
|
1840
|
-
function buildLists(
|
|
1840
|
+
function buildLists(resolved, metadata) {
|
|
1841
1841
|
const lists = {};
|
|
1842
|
-
const resolved = resolveListRows(result, metadata.listExtractorPaths);
|
|
1843
1842
|
for (const [name, list] of Object.entries(resolved)) {
|
|
1844
1843
|
lists[name] = {
|
|
1845
1844
|
path: list.path,
|
|
@@ -1874,9 +1873,10 @@ function buildExtractedAccessors(targets) {
|
|
|
1874
1873
|
})
|
|
1875
1874
|
);
|
|
1876
1875
|
}
|
|
1877
|
-
function buildListAccessors(
|
|
1876
|
+
function buildListAccessors(resolved, lists) {
|
|
1878
1877
|
return Object.fromEntries(
|
|
1879
1878
|
Object.entries(lists).map(([name, metadata]) => {
|
|
1879
|
+
const rows = resolved[name]?.rows ?? [];
|
|
1880
1880
|
const accessor = {
|
|
1881
1881
|
path: metadata.path,
|
|
1882
1882
|
count: metadata.count,
|
|
@@ -1884,7 +1884,7 @@ function buildListAccessors(result, lists) {
|
|
|
1884
1884
|
};
|
|
1885
1885
|
Object.defineProperty(accessor, "get", {
|
|
1886
1886
|
value() {
|
|
1887
|
-
return
|
|
1887
|
+
return rows;
|
|
1888
1888
|
},
|
|
1889
1889
|
enumerable: false
|
|
1890
1890
|
});
|
|
@@ -1904,7 +1904,11 @@ function createToolExecuteResult(input) {
|
|
|
1904
1904
|
resultRoot,
|
|
1905
1905
|
input.metadata.resultIdentityGetters
|
|
1906
1906
|
);
|
|
1907
|
-
const
|
|
1907
|
+
const resolvedLists = resolveListRows(
|
|
1908
|
+
resultRoot,
|
|
1909
|
+
input.metadata.listExtractorPaths
|
|
1910
|
+
);
|
|
1911
|
+
const lists = buildLists(resolvedLists, input.metadata);
|
|
1908
1912
|
const metadata = {
|
|
1909
1913
|
toolId: input.metadata.toolId,
|
|
1910
1914
|
execution: input.execution,
|
|
@@ -1916,7 +1920,7 @@ function createToolExecuteResult(input) {
|
|
|
1916
1920
|
...result.meta ? { meta: result.meta } : {}
|
|
1917
1921
|
};
|
|
1918
1922
|
const extractedValues = buildExtractedAccessors(targets);
|
|
1919
|
-
const extractedLists = buildListAccessors(
|
|
1923
|
+
const extractedLists = buildListAccessors(resolvedLists, lists);
|
|
1920
1924
|
const wrapper = {
|
|
1921
1925
|
status: input.status,
|
|
1922
1926
|
...input.jobId ? { job_id: input.jobId } : {},
|