deepline 0.1.41 → 0.1.45
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 +218 -56
- package/dist/cli/index.mjs +218 -56
- package/dist/index.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +107 -23
- package/dist/index.mjs +107 -23
- package/dist/repo/apps/play-runner-workers/src/entry.ts +123 -19
- package/dist/repo/sdk/src/client.ts +1 -1
- package/dist/repo/sdk/src/play.ts +38 -3
- package/dist/repo/sdk/src/types.ts +35 -0
- package/dist/repo/sdk/src/version.ts +2 -2
- package/dist/repo/shared_libs/play-runtime/tool-result.ts +168 -47
- 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.45";
|
|
197
|
+
var SDK_API_CONTRACT = "2026-05-promo-redemption-policy";
|
|
198
198
|
|
|
199
199
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
200
200
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -741,7 +741,7 @@ var DeeplineClient = class {
|
|
|
741
741
|
params.set("search_terms", options.searchTerms.trim());
|
|
742
742
|
}
|
|
743
743
|
return this.http.get(
|
|
744
|
-
`/api/v2/
|
|
744
|
+
`/api/v2/tools/search?${params.toString()}`
|
|
745
745
|
);
|
|
746
746
|
}
|
|
747
747
|
/**
|
|
@@ -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,28 +9267,9 @@ async function searchTools(queryInput, options = {}) {
|
|
|
9130
9267
|
searchMode: options.searchMode,
|
|
9131
9268
|
includeSearchDebug: options.includeSearchDebug
|
|
9132
9269
|
});
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
tools: items,
|
|
9137
|
-
count: items.length,
|
|
9138
|
-
render: {
|
|
9139
|
-
sections: [
|
|
9140
|
-
{
|
|
9141
|
-
title: `${items.length} tools found:`,
|
|
9142
|
-
lines: items.flatMap((item) => {
|
|
9143
|
-
const cats = item.categories.length ? ` [${item.categories.join(", ")}]` : "";
|
|
9144
|
-
return [
|
|
9145
|
-
`${item.toolId}${cats}`,
|
|
9146
|
-
` ${item.description}`,
|
|
9147
|
-
...item.inputSchema ? [" inputSchema: yes"] : []
|
|
9148
|
-
];
|
|
9149
|
-
})
|
|
9150
|
-
}
|
|
9151
|
-
]
|
|
9152
|
-
}
|
|
9153
|
-
};
|
|
9154
|
-
printCommandEnvelope(envelope, { json: options.json || shouldEmitJson() });
|
|
9270
|
+
printCommandEnvelope(result, {
|
|
9271
|
+
json: options.json || shouldEmitJson()
|
|
9272
|
+
});
|
|
9155
9273
|
return 0;
|
|
9156
9274
|
}
|
|
9157
9275
|
function playIdentifiers(play) {
|
|
@@ -9165,13 +9283,36 @@ async function findPlayForToolId(client, toolId) {
|
|
|
9165
9283
|
const plays = await client.searchPlays({ query: requested, compact: true });
|
|
9166
9284
|
return plays.find((play) => playIdentifiers(play).includes(requested)) ?? null;
|
|
9167
9285
|
}
|
|
9168
|
-
function
|
|
9286
|
+
function playAliasToolErrorMessage(toolId, play) {
|
|
9169
9287
|
const playName = play.reference ?? play.name;
|
|
9170
|
-
|
|
9171
|
-
`${toolId} is a play, not a tool.
|
|
9288
|
+
return `${toolId} is a play, not a tool.
|
|
9172
9289
|
Use: deepline plays run ${playName} --input '{...}' --watch
|
|
9173
|
-
Inspect its schema with: deepline plays describe ${playName} --json
|
|
9174
|
-
|
|
9290
|
+
Inspect its schema with: deepline plays describe ${playName} --json`;
|
|
9291
|
+
}
|
|
9292
|
+
function printPlayAliasToolError(toolId, play) {
|
|
9293
|
+
console.error(playAliasToolErrorMessage(toolId, play));
|
|
9294
|
+
}
|
|
9295
|
+
function isPlayLikeTool(tool) {
|
|
9296
|
+
const record = tool;
|
|
9297
|
+
if (record.isPlay === true || record.is_play === true) return true;
|
|
9298
|
+
const playExpansion = recordField(record, "playExpansion", "play_expansion");
|
|
9299
|
+
if (Object.keys(playExpansion).length > 0) return true;
|
|
9300
|
+
const toolId = typeof record.toolId === "string" ? record.toolId : "";
|
|
9301
|
+
return toolId.endsWith("_waterfall");
|
|
9302
|
+
}
|
|
9303
|
+
function playReferenceForTool(tool) {
|
|
9304
|
+
const record = tool;
|
|
9305
|
+
const toolId = typeof record.toolId === "string" ? record.toolId : "play";
|
|
9306
|
+
return `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9307
|
+
}
|
|
9308
|
+
function playLikeToolExecuteErrorMessage(toolId) {
|
|
9309
|
+
const playReference = `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9310
|
+
return `${toolId} is a workflow/play entry, not an atomic provider tool.
|
|
9311
|
+
Use: deepline plays run ${playReference} --input '{...}' --watch
|
|
9312
|
+
Or search provider tools only with: deepline tools search "<query>" --json`;
|
|
9313
|
+
}
|
|
9314
|
+
function printPlayLikeToolExecuteError(toolId) {
|
|
9315
|
+
console.error(playLikeToolExecuteErrorMessage(toolId));
|
|
9175
9316
|
}
|
|
9176
9317
|
function registerToolsCommands(program) {
|
|
9177
9318
|
const tools = program.command("tools").description("Search, describe, and execute atomic provider tools.").addHelpText(
|
|
@@ -9346,7 +9487,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9346
9487
|
const operation = typeof tool.operation === "string" ? tool.operation : "";
|
|
9347
9488
|
const displayBase = operation && operation.startsWith(`${tool.provider}_`) ? operation.slice(String(tool.provider).length + 1) : operation ? `${tool.provider} ${operation}`.trim() : toolId;
|
|
9348
9489
|
const displayName = titleCase(displayBase || String(tool.displayName || toolId));
|
|
9349
|
-
const cost =
|
|
9490
|
+
const cost = isRecord4(tool.cost) ? tool.cost : null;
|
|
9350
9491
|
const deeplineCredits = numberField(tool, "deeplineCreditsPerPricingUnit", "deepline_credits_per_pricing_unit");
|
|
9351
9492
|
const deeplineUsdPerPricingUnit = numberField(tool, "deeplineUsdPerPricingUnit", "deepline_usd_per_pricing_unit");
|
|
9352
9493
|
const deeplineUsdPerCredit = numberField(tool, "deeplineUsdPerCredit", "deepline_usd_per_credit");
|
|
@@ -9396,7 +9537,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9396
9537
|
if (stepContributions.length) {
|
|
9397
9538
|
console.log(" step contributions:");
|
|
9398
9539
|
for (const item of stepContributions) {
|
|
9399
|
-
if (!
|
|
9540
|
+
if (!isRecord4(item)) continue;
|
|
9400
9541
|
const stepTool = typeof item.tool === "string" ? item.tool.trim() : "";
|
|
9401
9542
|
const low = typeof item.lowCredits === "number" ? item.lowCredits : null;
|
|
9402
9543
|
const high = typeof item.highCredits === "number" ? item.highCredits : null;
|
|
@@ -9436,7 +9577,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9436
9577
|
}
|
|
9437
9578
|
const toolExecutionResult = recordField(usageGuidance, "toolExecutionResult");
|
|
9438
9579
|
const extractedValues = arrayField(toolExecutionResult, "extractedValues", "extracted_values");
|
|
9439
|
-
const targets = extractedValues.map((entry) =>
|
|
9580
|
+
const targets = extractedValues.map((entry) => isRecord4(entry) && typeof entry.name === "string" ? entry.name : "").filter(Boolean).sort();
|
|
9440
9581
|
if (targets.length) {
|
|
9441
9582
|
console.log(` - Built-in extract targets: ${targets.join(", ")}`);
|
|
9442
9583
|
}
|
|
@@ -9477,7 +9618,7 @@ function printExtractions(label, entries) {
|
|
|
9477
9618
|
if (!entries.length) return;
|
|
9478
9619
|
console.log(` ${label}:`);
|
|
9479
9620
|
for (const entry of entries) {
|
|
9480
|
-
if (!
|
|
9621
|
+
if (!isRecord4(entry)) continue;
|
|
9481
9622
|
const name = stringField(entry, "name");
|
|
9482
9623
|
const expression = stringField(entry, "expression");
|
|
9483
9624
|
const details = recordField(entry, "details");
|
|
@@ -9517,12 +9658,12 @@ function printToolCost(input) {
|
|
|
9517
9658
|
return false;
|
|
9518
9659
|
}
|
|
9519
9660
|
function toolInputFieldsForDisplay(inputSchema) {
|
|
9520
|
-
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(
|
|
9521
|
-
const jsonSchema =
|
|
9522
|
-
const properties =
|
|
9661
|
+
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(isRecord4);
|
|
9662
|
+
const jsonSchema = isRecord4(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
|
|
9663
|
+
const properties = isRecord4(jsonSchema.properties) ? jsonSchema.properties : {};
|
|
9523
9664
|
const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
|
|
9524
9665
|
return Object.entries(properties).map(([name, value]) => {
|
|
9525
|
-
const property =
|
|
9666
|
+
const property = isRecord4(value) ? value : {};
|
|
9526
9667
|
return {
|
|
9527
9668
|
name,
|
|
9528
9669
|
type: typeof property.type === "string" ? property.type : "unknown",
|
|
@@ -9549,15 +9690,15 @@ function printJsonPreview(label, payload) {
|
|
|
9549
9690
|
}
|
|
9550
9691
|
function samplePayload(samples, key) {
|
|
9551
9692
|
const entry = samples[key];
|
|
9552
|
-
if (!
|
|
9693
|
+
if (!isRecord4(entry)) return void 0;
|
|
9553
9694
|
return Object.prototype.hasOwnProperty.call(entry, "payload") ? entry.payload : entry;
|
|
9554
9695
|
}
|
|
9555
9696
|
function commandEnvelopeFromRawResponse(rawResponse) {
|
|
9556
|
-
return
|
|
9697
|
+
return isRecord4(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
|
|
9557
9698
|
}
|
|
9558
9699
|
function listExtractorPathsFromUsageGuidance(tool) {
|
|
9559
9700
|
const toolExecutionResult = tool.usageGuidance?.toolExecutionResult;
|
|
9560
|
-
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists :
|
|
9701
|
+
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord4(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
|
|
9561
9702
|
return extractedLists.flatMap((entry) => {
|
|
9562
9703
|
const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
|
|
9563
9704
|
if (!Array.isArray(paths)) return [];
|
|
@@ -9584,7 +9725,7 @@ function formatDecimal(value) {
|
|
|
9584
9725
|
function formatUsd(value) {
|
|
9585
9726
|
return `$${formatDecimal(value)}`;
|
|
9586
9727
|
}
|
|
9587
|
-
function
|
|
9728
|
+
function isRecord4(value) {
|
|
9588
9729
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
9589
9730
|
}
|
|
9590
9731
|
function stringField(source, ...keys) {
|
|
@@ -9611,7 +9752,7 @@ function arrayField(source, ...keys) {
|
|
|
9611
9752
|
function recordField(source, ...keys) {
|
|
9612
9753
|
for (const key of keys) {
|
|
9613
9754
|
const value = source[key];
|
|
9614
|
-
if (
|
|
9755
|
+
if (isRecord4(value)) return value;
|
|
9615
9756
|
}
|
|
9616
9757
|
return {};
|
|
9617
9758
|
}
|
|
@@ -9709,8 +9850,11 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
9709
9850
|
// .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
9851
|
// ctx.map is idempotent by map key + row key; reruns reuse completed rows.
|
|
9711
9852
|
const enrichedData = await ctx
|
|
9712
|
-
.map('enriched_data', rows
|
|
9713
|
-
.run({
|
|
9853
|
+
.map('enriched_data', rows)
|
|
9854
|
+
.run({
|
|
9855
|
+
key: ${rowKey},
|
|
9856
|
+
description: 'Enrich seeded rows.',
|
|
9857
|
+
});
|
|
9714
9858
|
|
|
9715
9859
|
return {
|
|
9716
9860
|
rows: enrichedData,
|
|
@@ -9740,7 +9884,7 @@ function buildToolExecuteBaseEnvelope(input) {
|
|
|
9740
9884
|
kind: summaryEntries.length > 0 ? "object" : "raw",
|
|
9741
9885
|
summary: input.summary
|
|
9742
9886
|
};
|
|
9743
|
-
const envelopeHasCanonicalOutput =
|
|
9887
|
+
const envelopeHasCanonicalOutput = isRecord4(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
|
|
9744
9888
|
const inspectCommand = `deepline tools execute ${input.toolId} --input ${shellQuote(JSON.stringify(input.params))} --json`;
|
|
9745
9889
|
const actions = input.listConversion ? [
|
|
9746
9890
|
{
|
|
@@ -9800,7 +9944,11 @@ async function executeTool(args) {
|
|
|
9800
9944
|
} catch (error) {
|
|
9801
9945
|
const play = await findPlayForToolId(client, parsed.toolId);
|
|
9802
9946
|
if (play) {
|
|
9803
|
-
|
|
9947
|
+
if (argsWantJson(args)) {
|
|
9948
|
+
printJsonError(new Error(playAliasToolErrorMessage(parsed.toolId, play)));
|
|
9949
|
+
} else {
|
|
9950
|
+
printPlayAliasToolError(parsed.toolId, play);
|
|
9951
|
+
}
|
|
9804
9952
|
return 2;
|
|
9805
9953
|
}
|
|
9806
9954
|
if (error instanceof DeeplineError) {
|
|
@@ -9808,6 +9956,14 @@ async function executeTool(args) {
|
|
|
9808
9956
|
}
|
|
9809
9957
|
throw error;
|
|
9810
9958
|
}
|
|
9959
|
+
if (isPlayLikeTool(metadata)) {
|
|
9960
|
+
if (argsWantJson(args)) {
|
|
9961
|
+
printJsonError(new Error(playLikeToolExecuteErrorMessage(parsed.toolId)));
|
|
9962
|
+
} else {
|
|
9963
|
+
printPlayLikeToolExecuteError(parsed.toolId);
|
|
9964
|
+
}
|
|
9965
|
+
return 2;
|
|
9966
|
+
}
|
|
9811
9967
|
const rawResponse = await client.executeTool(parsed.toolId, parsed.params);
|
|
9812
9968
|
const listConversion = tryConvertToList(rawResponse, {
|
|
9813
9969
|
listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
|
|
@@ -9830,7 +9986,7 @@ async function executeTool(args) {
|
|
|
9830
9986
|
{
|
|
9831
9987
|
...baseEnvelope,
|
|
9832
9988
|
local: {
|
|
9833
|
-
...
|
|
9989
|
+
...isRecord4(baseEnvelope.local) ? baseEnvelope.local : {},
|
|
9834
9990
|
payload_file: jsonPath
|
|
9835
9991
|
}
|
|
9836
9992
|
},
|
|
@@ -10428,9 +10584,15 @@ Notes:
|
|
|
10428
10584
|
|
|
10429
10585
|
Examples:
|
|
10430
10586
|
deepline version
|
|
10587
|
+
deepline version --json
|
|
10431
10588
|
deepline --version
|
|
10432
10589
|
`
|
|
10433
|
-
).action(() => {
|
|
10590
|
+
).option("--json", "Emit JSON output").action((options) => {
|
|
10591
|
+
if (options.json) {
|
|
10592
|
+
process.stdout.write(`${JSON.stringify({ version: SDK_VERSION })}
|
|
10593
|
+
`);
|
|
10594
|
+
return;
|
|
10595
|
+
}
|
|
10434
10596
|
process.stdout.write(`deepline ${SDK_VERSION}
|
|
10435
10597
|
`);
|
|
10436
10598
|
});
|
package/dist/index.d.mts
CHANGED
|
@@ -318,7 +318,25 @@ interface ToolSearchOptions {
|
|
|
318
318
|
}
|
|
319
319
|
interface ToolSearchResult {
|
|
320
320
|
tools: ToolDefinition[];
|
|
321
|
+
count?: number;
|
|
322
|
+
total?: number;
|
|
323
|
+
truncated?: boolean;
|
|
324
|
+
query?: string;
|
|
325
|
+
categories?: string[];
|
|
326
|
+
search_terms?: string[];
|
|
327
|
+
search_mode?: 'v1' | 'v2';
|
|
321
328
|
search_fallback_to_category?: boolean;
|
|
329
|
+
omitted_plays_hint?: string;
|
|
330
|
+
render?: {
|
|
331
|
+
sections?: Array<{
|
|
332
|
+
title: string;
|
|
333
|
+
lines: string[];
|
|
334
|
+
}>;
|
|
335
|
+
actions?: Array<{
|
|
336
|
+
label: string;
|
|
337
|
+
command: string;
|
|
338
|
+
}>;
|
|
339
|
+
};
|
|
322
340
|
}
|
|
323
341
|
/**
|
|
324
342
|
* Extended tool metadata including pricing, samples, and failure modes.
|
|
@@ -745,9 +763,25 @@ interface PlayCheckResult {
|
|
|
745
763
|
valid: boolean;
|
|
746
764
|
errors: string[];
|
|
747
765
|
staticPipeline?: Record<string, unknown> | null;
|
|
766
|
+
toolGetterHints?: PlayCheckToolGetterHint[];
|
|
748
767
|
artifactHash?: string | null;
|
|
749
768
|
graphHash?: string | null;
|
|
750
769
|
}
|
|
770
|
+
interface PlayCheckToolGetterHint {
|
|
771
|
+
toolId: string;
|
|
772
|
+
lists: Array<{
|
|
773
|
+
name: string;
|
|
774
|
+
expression: string;
|
|
775
|
+
raw?: string;
|
|
776
|
+
}>;
|
|
777
|
+
values: Array<{
|
|
778
|
+
name: string;
|
|
779
|
+
expression: string;
|
|
780
|
+
raw?: string;
|
|
781
|
+
}>;
|
|
782
|
+
raw?: string;
|
|
783
|
+
unavailable?: string;
|
|
784
|
+
}
|
|
751
785
|
/**
|
|
752
786
|
* Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
|
|
753
787
|
*
|
|
@@ -1477,8 +1511,8 @@ declare class DeeplineClient {
|
|
|
1477
1511
|
}>;
|
|
1478
1512
|
}
|
|
1479
1513
|
|
|
1480
|
-
declare const SDK_VERSION = "0.1.
|
|
1481
|
-
declare const SDK_API_CONTRACT = "2026-05-
|
|
1514
|
+
declare const SDK_VERSION = "0.1.45";
|
|
1515
|
+
declare const SDK_API_CONTRACT = "2026-05-promo-redemption-policy";
|
|
1482
1516
|
|
|
1483
1517
|
/**
|
|
1484
1518
|
* Base error class for all Deepline SDK errors.
|
|
@@ -1684,6 +1718,11 @@ type ToolResultListMetadata = {
|
|
|
1684
1718
|
count: number | null;
|
|
1685
1719
|
keys: Record<string, string>;
|
|
1686
1720
|
};
|
|
1721
|
+
type ToolResultExtractorDescriptor = {
|
|
1722
|
+
paths: readonly string[];
|
|
1723
|
+
transforms?: readonly string[];
|
|
1724
|
+
enum?: readonly string[];
|
|
1725
|
+
};
|
|
1687
1726
|
type ToolResultTargetAccessor<T = unknown> = ToolResultTargetMetadata & {
|
|
1688
1727
|
get(): T | null;
|
|
1689
1728
|
};
|
|
@@ -1711,6 +1750,7 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
|
|
|
1711
1750
|
value: unknown;
|
|
1712
1751
|
path: string;
|
|
1713
1752
|
}>;
|
|
1753
|
+
extractors?: Record<string, ToolResultExtractorDescriptor>;
|
|
1714
1754
|
lists: Record<string, {
|
|
1715
1755
|
path: string;
|
|
1716
1756
|
count: number | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -318,7 +318,25 @@ interface ToolSearchOptions {
|
|
|
318
318
|
}
|
|
319
319
|
interface ToolSearchResult {
|
|
320
320
|
tools: ToolDefinition[];
|
|
321
|
+
count?: number;
|
|
322
|
+
total?: number;
|
|
323
|
+
truncated?: boolean;
|
|
324
|
+
query?: string;
|
|
325
|
+
categories?: string[];
|
|
326
|
+
search_terms?: string[];
|
|
327
|
+
search_mode?: 'v1' | 'v2';
|
|
321
328
|
search_fallback_to_category?: boolean;
|
|
329
|
+
omitted_plays_hint?: string;
|
|
330
|
+
render?: {
|
|
331
|
+
sections?: Array<{
|
|
332
|
+
title: string;
|
|
333
|
+
lines: string[];
|
|
334
|
+
}>;
|
|
335
|
+
actions?: Array<{
|
|
336
|
+
label: string;
|
|
337
|
+
command: string;
|
|
338
|
+
}>;
|
|
339
|
+
};
|
|
322
340
|
}
|
|
323
341
|
/**
|
|
324
342
|
* Extended tool metadata including pricing, samples, and failure modes.
|
|
@@ -745,9 +763,25 @@ interface PlayCheckResult {
|
|
|
745
763
|
valid: boolean;
|
|
746
764
|
errors: string[];
|
|
747
765
|
staticPipeline?: Record<string, unknown> | null;
|
|
766
|
+
toolGetterHints?: PlayCheckToolGetterHint[];
|
|
748
767
|
artifactHash?: string | null;
|
|
749
768
|
graphHash?: string | null;
|
|
750
769
|
}
|
|
770
|
+
interface PlayCheckToolGetterHint {
|
|
771
|
+
toolId: string;
|
|
772
|
+
lists: Array<{
|
|
773
|
+
name: string;
|
|
774
|
+
expression: string;
|
|
775
|
+
raw?: string;
|
|
776
|
+
}>;
|
|
777
|
+
values: Array<{
|
|
778
|
+
name: string;
|
|
779
|
+
expression: string;
|
|
780
|
+
raw?: string;
|
|
781
|
+
}>;
|
|
782
|
+
raw?: string;
|
|
783
|
+
unavailable?: string;
|
|
784
|
+
}
|
|
751
785
|
/**
|
|
752
786
|
* Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
|
|
753
787
|
*
|
|
@@ -1477,8 +1511,8 @@ declare class DeeplineClient {
|
|
|
1477
1511
|
}>;
|
|
1478
1512
|
}
|
|
1479
1513
|
|
|
1480
|
-
declare const SDK_VERSION = "0.1.
|
|
1481
|
-
declare const SDK_API_CONTRACT = "2026-05-
|
|
1514
|
+
declare const SDK_VERSION = "0.1.45";
|
|
1515
|
+
declare const SDK_API_CONTRACT = "2026-05-promo-redemption-policy";
|
|
1482
1516
|
|
|
1483
1517
|
/**
|
|
1484
1518
|
* Base error class for all Deepline SDK errors.
|
|
@@ -1684,6 +1718,11 @@ type ToolResultListMetadata = {
|
|
|
1684
1718
|
count: number | null;
|
|
1685
1719
|
keys: Record<string, string>;
|
|
1686
1720
|
};
|
|
1721
|
+
type ToolResultExtractorDescriptor = {
|
|
1722
|
+
paths: readonly string[];
|
|
1723
|
+
transforms?: readonly string[];
|
|
1724
|
+
enum?: readonly string[];
|
|
1725
|
+
};
|
|
1687
1726
|
type ToolResultTargetAccessor<T = unknown> = ToolResultTargetMetadata & {
|
|
1688
1727
|
get(): T | null;
|
|
1689
1728
|
};
|
|
@@ -1711,6 +1750,7 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
|
|
|
1711
1750
|
value: unknown;
|
|
1712
1751
|
path: string;
|
|
1713
1752
|
}>;
|
|
1753
|
+
extractors?: Record<string, ToolResultExtractorDescriptor>;
|
|
1714
1754
|
lists: Record<string, {
|
|
1715
1755
|
path: string;
|
|
1716
1756
|
count: number | null;
|