deepline 0.1.38 → 0.1.40
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 +43 -237
- package/dist/cli/index.mjs +43 -237
- package/dist/index.d.mts +2 -18
- package/dist/index.d.ts +2 -18
- package/dist/index.js +17 -29
- package/dist/index.mjs +17 -29
- package/dist/repo/apps/play-runner-workers/src/entry.ts +17 -89
- package/dist/repo/sdk/src/client.ts +9 -22
- 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.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.40";
|
|
197
|
+
var SDK_API_CONTRACT = "2026-05-cloud-play-search";
|
|
198
198
|
|
|
199
199
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
200
200
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -1357,23 +1357,15 @@ var DeeplineClient = class {
|
|
|
1357
1357
|
return response.plays ?? [];
|
|
1358
1358
|
}
|
|
1359
1359
|
async searchPlays(options) {
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
play.reference,
|
|
1370
|
-
play.displayName,
|
|
1371
|
-
play.origin,
|
|
1372
|
-
...play.aliases ?? [],
|
|
1373
|
-
play.inputSchema ? JSON.stringify(play.inputSchema) : ""
|
|
1374
|
-
].filter(Boolean).join(" ").toLowerCase();
|
|
1375
|
-
return terms.every((term) => haystack.includes(term));
|
|
1376
|
-
}).map((play) => this.summarizePlayListItem(play, options));
|
|
1360
|
+
const params = new URLSearchParams();
|
|
1361
|
+
params.set("search", options.query.trim());
|
|
1362
|
+
if (options.origin) params.set("origin", options.origin);
|
|
1363
|
+
const response = await this.http.get(
|
|
1364
|
+
`/api/v2/plays?${params.toString()}`
|
|
1365
|
+
);
|
|
1366
|
+
return (response.plays ?? []).map(
|
|
1367
|
+
(play) => this.summarizePlayListItem(play, options)
|
|
1368
|
+
);
|
|
1377
1369
|
}
|
|
1378
1370
|
/**
|
|
1379
1371
|
* Get the full definition and state of a named play.
|
|
@@ -7478,126 +7470,6 @@ function shouldUseLocalOnlyPlayCheck() {
|
|
|
7478
7470
|
const value = process.env.DEEPLINE_PLAY_CHECK_LOCAL_ONLY?.trim().toLowerCase();
|
|
7479
7471
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
7480
7472
|
}
|
|
7481
|
-
function isRecord3(value) {
|
|
7482
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
7483
|
-
}
|
|
7484
|
-
function stringValue(value) {
|
|
7485
|
-
return typeof value === "string" ? value.trim() : "";
|
|
7486
|
-
}
|
|
7487
|
-
function asArray(value) {
|
|
7488
|
-
return Array.isArray(value) ? value : [];
|
|
7489
|
-
}
|
|
7490
|
-
function extractionEntries(value) {
|
|
7491
|
-
if (Array.isArray(value)) return value.filter(isRecord3);
|
|
7492
|
-
if (!isRecord3(value)) return [];
|
|
7493
|
-
return Object.entries(value).map(
|
|
7494
|
-
([name, entry]) => isRecord3(entry) ? { name, ...entry } : { name }
|
|
7495
|
-
);
|
|
7496
|
-
}
|
|
7497
|
-
function firstRawPath(entry) {
|
|
7498
|
-
const details = isRecord3(entry.details) ? entry.details : {};
|
|
7499
|
-
const paths = [
|
|
7500
|
-
...asArray(details.rawToolOutputPaths),
|
|
7501
|
-
...asArray(details.raw_tool_output_paths),
|
|
7502
|
-
...asArray(details.candidatePaths),
|
|
7503
|
-
...asArray(details.candidate_paths)
|
|
7504
|
-
].map(stringValue).filter(Boolean);
|
|
7505
|
-
return paths[0];
|
|
7506
|
-
}
|
|
7507
|
-
function checkHintExpression(value) {
|
|
7508
|
-
return stringValue(value).replace(/^toolExecutionResult\./, "result.");
|
|
7509
|
-
}
|
|
7510
|
-
function checkHintRawPath(value) {
|
|
7511
|
-
return value?.replace(/^toolResponse\./, "result.toolResponse.");
|
|
7512
|
-
}
|
|
7513
|
-
function collectStaticPipelineToolIds(staticPipeline) {
|
|
7514
|
-
const seen = /* @__PURE__ */ new Set();
|
|
7515
|
-
const visitPipeline = (pipeline) => {
|
|
7516
|
-
if (!isRecord3(pipeline)) return;
|
|
7517
|
-
for (const step of [
|
|
7518
|
-
...asArray(pipeline.stages),
|
|
7519
|
-
...asArray(pipeline.substeps)
|
|
7520
|
-
]) {
|
|
7521
|
-
if (!isRecord3(step)) continue;
|
|
7522
|
-
if (step.type === "tool") {
|
|
7523
|
-
const toolId = stringValue(step.toolId) || stringValue(step.tool);
|
|
7524
|
-
if (toolId) seen.add(toolId);
|
|
7525
|
-
}
|
|
7526
|
-
if (step.type === "play_call") {
|
|
7527
|
-
visitPipeline(step.pipeline);
|
|
7528
|
-
}
|
|
7529
|
-
}
|
|
7530
|
-
};
|
|
7531
|
-
visitPipeline(staticPipeline);
|
|
7532
|
-
return [...seen].sort();
|
|
7533
|
-
}
|
|
7534
|
-
function toolGetterHintFromMetadata(toolId, tool) {
|
|
7535
|
-
const usageGuidance = isRecord3(tool.usageGuidance) ? tool.usageGuidance : {};
|
|
7536
|
-
const resultGuidance = isRecord3(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord3(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
|
|
7537
|
-
const toolResponse = isRecord3(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord3(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
|
|
7538
|
-
const lists = extractionEntries(
|
|
7539
|
-
resultGuidance.extractedLists ?? resultGuidance.extracted_lists
|
|
7540
|
-
).map((entry) => ({
|
|
7541
|
-
name: stringValue(entry.name),
|
|
7542
|
-
expression: checkHintExpression(entry.expression),
|
|
7543
|
-
raw: checkHintRawPath(firstRawPath(entry))
|
|
7544
|
-
})).filter((entry) => entry.name && entry.expression);
|
|
7545
|
-
const values = extractionEntries(
|
|
7546
|
-
resultGuidance.extractedValues ?? resultGuidance.extracted_values
|
|
7547
|
-
).map((entry) => ({
|
|
7548
|
-
name: stringValue(entry.name),
|
|
7549
|
-
expression: checkHintExpression(entry.expression),
|
|
7550
|
-
raw: checkHintRawPath(firstRawPath(entry))
|
|
7551
|
-
})).filter((entry) => entry.name && entry.expression);
|
|
7552
|
-
return {
|
|
7553
|
-
toolId,
|
|
7554
|
-
lists,
|
|
7555
|
-
values,
|
|
7556
|
-
raw: checkHintExpression(toolResponse.raw) || "result.toolResponse.raw"
|
|
7557
|
-
};
|
|
7558
|
-
}
|
|
7559
|
-
async function buildToolGetterHints(client, staticPipeline) {
|
|
7560
|
-
const toolIds = collectStaticPipelineToolIds(staticPipeline);
|
|
7561
|
-
return Promise.all(
|
|
7562
|
-
toolIds.map(async (toolId) => {
|
|
7563
|
-
try {
|
|
7564
|
-
const tool = await client.getTool(toolId);
|
|
7565
|
-
return toolGetterHintFromMetadata(toolId, tool);
|
|
7566
|
-
} catch (error) {
|
|
7567
|
-
return {
|
|
7568
|
-
toolId,
|
|
7569
|
-
lists: [],
|
|
7570
|
-
values: [],
|
|
7571
|
-
raw: "result.toolResponse.raw",
|
|
7572
|
-
unavailable: error instanceof Error ? error.message : String(error)
|
|
7573
|
-
};
|
|
7574
|
-
}
|
|
7575
|
-
})
|
|
7576
|
-
);
|
|
7577
|
-
}
|
|
7578
|
-
function printToolGetterHints(hints) {
|
|
7579
|
-
if (!hints?.length) return;
|
|
7580
|
-
console.log(" Tool result getter hints:");
|
|
7581
|
-
for (const hint of hints) {
|
|
7582
|
-
console.log(` ${hint.toolId} output:`);
|
|
7583
|
-
if (hint.lists.length) {
|
|
7584
|
-
for (const entry of hint.lists) {
|
|
7585
|
-
const raw = entry.raw ? ` (raw: ${entry.raw})` : "";
|
|
7586
|
-
console.log(` - list ${entry.name}: ${entry.expression}${raw}`);
|
|
7587
|
-
}
|
|
7588
|
-
}
|
|
7589
|
-
if (hint.values.length) {
|
|
7590
|
-
const valueNames = hint.values.map((entry) => entry.name).join(", ");
|
|
7591
|
-
console.log(` - values: ${valueNames}`);
|
|
7592
|
-
for (const entry of hint.values) {
|
|
7593
|
-
const raw = entry.raw ? ` (raw: ${entry.raw})` : "";
|
|
7594
|
-
console.log(` ${entry.name}: ${entry.expression}${raw}`);
|
|
7595
|
-
}
|
|
7596
|
-
}
|
|
7597
|
-
if (hint.raw) console.log(` - raw: ${hint.raw}`);
|
|
7598
|
-
if (hint.unavailable) console.log(` - warning: ${hint.unavailable}`);
|
|
7599
|
-
}
|
|
7600
|
-
}
|
|
7601
7473
|
async function handlePlayCheck(args) {
|
|
7602
7474
|
const options = parsePlayCheckOptions(args);
|
|
7603
7475
|
if (!isFileTarget(options.target)) {
|
|
@@ -7628,7 +7500,6 @@ async function handlePlayCheck(args) {
|
|
|
7628
7500
|
valid: true,
|
|
7629
7501
|
errors: [],
|
|
7630
7502
|
staticPipeline: graph.root.compilerManifest?.staticPipeline ?? null,
|
|
7631
|
-
toolGetterHints: [],
|
|
7632
7503
|
artifactHash: graph.root.artifact.artifactHash,
|
|
7633
7504
|
graphHash: graph.root.artifact.graphHash
|
|
7634
7505
|
};
|
|
@@ -7638,7 +7509,6 @@ async function handlePlayCheck(args) {
|
|
|
7638
7509
|
} else {
|
|
7639
7510
|
console.log(`\u2713 ${playName} passed local play check`);
|
|
7640
7511
|
console.log(` artifact: ${result2.artifactHash.slice(0, 12)}`);
|
|
7641
|
-
printToolGetterHints(result2.toolGetterHints);
|
|
7642
7512
|
}
|
|
7643
7513
|
return 0;
|
|
7644
7514
|
}
|
|
@@ -7649,27 +7519,21 @@ async function handlePlayCheck(args) {
|
|
|
7649
7519
|
sourceFiles: graph.root.sourceFiles,
|
|
7650
7520
|
artifact: graph.root.artifact
|
|
7651
7521
|
});
|
|
7652
|
-
const enrichedResult = {
|
|
7653
|
-
...result,
|
|
7654
|
-
toolGetterHints: result.toolGetterHints ?? await buildToolGetterHints(client, result.staticPipeline)
|
|
7655
|
-
};
|
|
7656
7522
|
if (options.jsonOutput) {
|
|
7657
|
-
process.stdout.write(`${JSON.stringify({ name: playName, ...
|
|
7523
|
+
process.stdout.write(`${JSON.stringify({ name: playName, ...result })}
|
|
7658
7524
|
`);
|
|
7659
|
-
} else if (
|
|
7525
|
+
} else if (result.valid) {
|
|
7660
7526
|
console.log(`\u2713 ${playName} passed cloud play check`);
|
|
7661
|
-
if (
|
|
7662
|
-
console.log(` artifact: ${
|
|
7527
|
+
if (result.artifactHash) {
|
|
7528
|
+
console.log(` artifact: ${result.artifactHash.slice(0, 12)}`);
|
|
7663
7529
|
}
|
|
7664
|
-
printToolGetterHints(enrichedResult.toolGetterHints);
|
|
7665
7530
|
} else {
|
|
7666
7531
|
console.error(`\u2717 ${playName} failed cloud play check`);
|
|
7667
|
-
for (const error of
|
|
7532
|
+
for (const error of result.errors) {
|
|
7668
7533
|
console.error(` ${error}`);
|
|
7669
7534
|
}
|
|
7670
|
-
printToolGetterHints(enrichedResult.toolGetterHints);
|
|
7671
7535
|
}
|
|
7672
|
-
return
|
|
7536
|
+
return result.valid ? 0 : 1;
|
|
7673
7537
|
}
|
|
7674
7538
|
async function handleFileBackedRun(options) {
|
|
7675
7539
|
if (options.target.kind !== "file") {
|
|
@@ -8772,7 +8636,7 @@ Pass-through input flags:
|
|
|
8772
8636
|
...options.logs ? ["--logs"] : [],
|
|
8773
8637
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
|
8774
8638
|
...options.force ? ["--force"] : [],
|
|
8775
|
-
...options.
|
|
8639
|
+
...options.open === false ? ["--no-open"] : [],
|
|
8776
8640
|
...options.json ? ["--json"] : [],
|
|
8777
8641
|
...passthroughArgs
|
|
8778
8642
|
]);
|
|
@@ -9228,15 +9092,6 @@ function extractSummaryFields(payload) {
|
|
|
9228
9092
|
|
|
9229
9093
|
// src/cli/commands/tools.ts
|
|
9230
9094
|
function toListedTool(tool) {
|
|
9231
|
-
if (isPlayLikeTool(tool)) {
|
|
9232
|
-
const playReference = playReferenceForTool(tool);
|
|
9233
|
-
return {
|
|
9234
|
-
...tool,
|
|
9235
|
-
id: tool.toolId,
|
|
9236
|
-
type: "play",
|
|
9237
|
-
executeCommand: `deepline plays run ${playReference} --input '{...}' --watch`
|
|
9238
|
-
};
|
|
9239
|
-
}
|
|
9240
9095
|
return {
|
|
9241
9096
|
...tool,
|
|
9242
9097
|
id: tool.toolId,
|
|
@@ -9275,12 +9130,11 @@ async function searchTools(queryInput, options = {}) {
|
|
|
9275
9130
|
searchMode: options.searchMode,
|
|
9276
9131
|
includeSearchDebug: options.includeSearchDebug
|
|
9277
9132
|
});
|
|
9278
|
-
const items = result.tools.
|
|
9133
|
+
const items = result.tools.map(toListedTool);
|
|
9279
9134
|
const envelope = {
|
|
9280
9135
|
...result,
|
|
9281
9136
|
tools: items,
|
|
9282
9137
|
count: items.length,
|
|
9283
|
-
omitted_plays_hint: "Use `deepline plays search <query> --json` for prebuilt and org-owned plays.",
|
|
9284
9138
|
render: {
|
|
9285
9139
|
sections: [
|
|
9286
9140
|
{
|
|
@@ -9293,10 +9147,6 @@ async function searchTools(queryInput, options = {}) {
|
|
|
9293
9147
|
...item.inputSchema ? [" inputSchema: yes"] : []
|
|
9294
9148
|
];
|
|
9295
9149
|
})
|
|
9296
|
-
},
|
|
9297
|
-
{
|
|
9298
|
-
title: "plays",
|
|
9299
|
-
lines: ["For prebuilt or org-owned workflows, run: deepline plays search <query>"]
|
|
9300
9150
|
}
|
|
9301
9151
|
]
|
|
9302
9152
|
}
|
|
@@ -9315,36 +9165,13 @@ async function findPlayForToolId(client, toolId) {
|
|
|
9315
9165
|
const plays = await client.searchPlays({ query: requested, compact: true });
|
|
9316
9166
|
return plays.find((play) => playIdentifiers(play).includes(requested)) ?? null;
|
|
9317
9167
|
}
|
|
9318
|
-
function
|
|
9168
|
+
function printPlayAliasToolError(toolId, play) {
|
|
9319
9169
|
const playName = play.reference ?? play.name;
|
|
9320
|
-
|
|
9170
|
+
console.error(
|
|
9171
|
+
`${toolId} is a play, not a tool.
|
|
9321
9172
|
Use: deepline plays run ${playName} --input '{...}' --watch
|
|
9322
|
-
Inspect its schema with: deepline plays describe ${playName} --json
|
|
9323
|
-
|
|
9324
|
-
function printPlayAliasToolError(toolId, play) {
|
|
9325
|
-
console.error(playAliasToolErrorMessage(toolId, play));
|
|
9326
|
-
}
|
|
9327
|
-
function isPlayLikeTool(tool) {
|
|
9328
|
-
const record = tool;
|
|
9329
|
-
if (record.isPlay === true || record.is_play === true) return true;
|
|
9330
|
-
const playExpansion = recordField(record, "playExpansion", "play_expansion");
|
|
9331
|
-
if (Object.keys(playExpansion).length > 0) return true;
|
|
9332
|
-
const toolId = typeof record.toolId === "string" ? record.toolId : "";
|
|
9333
|
-
return toolId.endsWith("_waterfall");
|
|
9334
|
-
}
|
|
9335
|
-
function playReferenceForTool(tool) {
|
|
9336
|
-
const record = tool;
|
|
9337
|
-
const toolId = typeof record.toolId === "string" ? record.toolId : "play";
|
|
9338
|
-
return `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9339
|
-
}
|
|
9340
|
-
function playLikeToolExecuteErrorMessage(toolId) {
|
|
9341
|
-
const playReference = `prebuilt/${toolId.replace(/_/g, "-")}`;
|
|
9342
|
-
return `${toolId} is a workflow/play entry, not an atomic provider tool.
|
|
9343
|
-
Use: deepline plays run ${playReference} --input '{...}' --watch
|
|
9344
|
-
Or search provider tools only with: deepline tools search "<query>" --json`;
|
|
9345
|
-
}
|
|
9346
|
-
function printPlayLikeToolExecuteError(toolId) {
|
|
9347
|
-
console.error(playLikeToolExecuteErrorMessage(toolId));
|
|
9173
|
+
Inspect its schema with: deepline plays describe ${playName} --json`
|
|
9174
|
+
);
|
|
9348
9175
|
}
|
|
9349
9176
|
function registerToolsCommands(program) {
|
|
9350
9177
|
const tools = program.command("tools").description("Search, describe, and execute atomic provider tools.").addHelpText(
|
|
@@ -9519,7 +9346,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9519
9346
|
const operation = typeof tool.operation === "string" ? tool.operation : "";
|
|
9520
9347
|
const displayBase = operation && operation.startsWith(`${tool.provider}_`) ? operation.slice(String(tool.provider).length + 1) : operation ? `${tool.provider} ${operation}`.trim() : toolId;
|
|
9521
9348
|
const displayName = titleCase(displayBase || String(tool.displayName || toolId));
|
|
9522
|
-
const cost =
|
|
9349
|
+
const cost = isRecord3(tool.cost) ? tool.cost : null;
|
|
9523
9350
|
const deeplineCredits = numberField(tool, "deeplineCreditsPerPricingUnit", "deepline_credits_per_pricing_unit");
|
|
9524
9351
|
const deeplineUsdPerPricingUnit = numberField(tool, "deeplineUsdPerPricingUnit", "deepline_usd_per_pricing_unit");
|
|
9525
9352
|
const deeplineUsdPerCredit = numberField(tool, "deeplineUsdPerCredit", "deepline_usd_per_credit");
|
|
@@ -9569,7 +9396,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9569
9396
|
if (stepContributions.length) {
|
|
9570
9397
|
console.log(" step contributions:");
|
|
9571
9398
|
for (const item of stepContributions) {
|
|
9572
|
-
if (!
|
|
9399
|
+
if (!isRecord3(item)) continue;
|
|
9573
9400
|
const stepTool = typeof item.tool === "string" ? item.tool.trim() : "";
|
|
9574
9401
|
const low = typeof item.lowCredits === "number" ? item.lowCredits : null;
|
|
9575
9402
|
const high = typeof item.highCredits === "number" ? item.highCredits : null;
|
|
@@ -9609,7 +9436,7 @@ function printToolDetails(tool, requestedToolId) {
|
|
|
9609
9436
|
}
|
|
9610
9437
|
const toolExecutionResult = recordField(usageGuidance, "toolExecutionResult");
|
|
9611
9438
|
const extractedValues = arrayField(toolExecutionResult, "extractedValues", "extracted_values");
|
|
9612
|
-
const targets = extractedValues.map((entry) =>
|
|
9439
|
+
const targets = extractedValues.map((entry) => isRecord3(entry) && typeof entry.name === "string" ? entry.name : "").filter(Boolean).sort();
|
|
9613
9440
|
if (targets.length) {
|
|
9614
9441
|
console.log(` - Built-in extract targets: ${targets.join(", ")}`);
|
|
9615
9442
|
}
|
|
@@ -9650,7 +9477,7 @@ function printExtractions(label, entries) {
|
|
|
9650
9477
|
if (!entries.length) return;
|
|
9651
9478
|
console.log(` ${label}:`);
|
|
9652
9479
|
for (const entry of entries) {
|
|
9653
|
-
if (!
|
|
9480
|
+
if (!isRecord3(entry)) continue;
|
|
9654
9481
|
const name = stringField(entry, "name");
|
|
9655
9482
|
const expression = stringField(entry, "expression");
|
|
9656
9483
|
const details = recordField(entry, "details");
|
|
@@ -9690,12 +9517,12 @@ function printToolCost(input) {
|
|
|
9690
9517
|
return false;
|
|
9691
9518
|
}
|
|
9692
9519
|
function toolInputFieldsForDisplay(inputSchema) {
|
|
9693
|
-
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(
|
|
9694
|
-
const jsonSchema =
|
|
9695
|
-
const properties =
|
|
9520
|
+
if (Array.isArray(inputSchema.fields)) return inputSchema.fields.filter(isRecord3);
|
|
9521
|
+
const jsonSchema = isRecord3(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
|
|
9522
|
+
const properties = isRecord3(jsonSchema.properties) ? jsonSchema.properties : {};
|
|
9696
9523
|
const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
|
|
9697
9524
|
return Object.entries(properties).map(([name, value]) => {
|
|
9698
|
-
const property =
|
|
9525
|
+
const property = isRecord3(value) ? value : {};
|
|
9699
9526
|
return {
|
|
9700
9527
|
name,
|
|
9701
9528
|
type: typeof property.type === "string" ? property.type : "unknown",
|
|
@@ -9722,15 +9549,15 @@ function printJsonPreview(label, payload) {
|
|
|
9722
9549
|
}
|
|
9723
9550
|
function samplePayload(samples, key) {
|
|
9724
9551
|
const entry = samples[key];
|
|
9725
|
-
if (!
|
|
9552
|
+
if (!isRecord3(entry)) return void 0;
|
|
9726
9553
|
return Object.prototype.hasOwnProperty.call(entry, "payload") ? entry.payload : entry;
|
|
9727
9554
|
}
|
|
9728
9555
|
function commandEnvelopeFromRawResponse(rawResponse) {
|
|
9729
|
-
return
|
|
9556
|
+
return isRecord3(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
|
|
9730
9557
|
}
|
|
9731
9558
|
function listExtractorPathsFromUsageGuidance(tool) {
|
|
9732
9559
|
const toolExecutionResult = tool.usageGuidance?.toolExecutionResult;
|
|
9733
|
-
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists :
|
|
9560
|
+
const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord3(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
|
|
9734
9561
|
return extractedLists.flatMap((entry) => {
|
|
9735
9562
|
const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
|
|
9736
9563
|
if (!Array.isArray(paths)) return [];
|
|
@@ -9757,7 +9584,7 @@ function formatDecimal(value) {
|
|
|
9757
9584
|
function formatUsd(value) {
|
|
9758
9585
|
return `$${formatDecimal(value)}`;
|
|
9759
9586
|
}
|
|
9760
|
-
function
|
|
9587
|
+
function isRecord3(value) {
|
|
9761
9588
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
9762
9589
|
}
|
|
9763
9590
|
function stringField(source, ...keys) {
|
|
@@ -9784,7 +9611,7 @@ function arrayField(source, ...keys) {
|
|
|
9784
9611
|
function recordField(source, ...keys) {
|
|
9785
9612
|
for (const key of keys) {
|
|
9786
9613
|
const value = source[key];
|
|
9787
|
-
if (
|
|
9614
|
+
if (isRecord3(value)) return value;
|
|
9788
9615
|
}
|
|
9789
9616
|
return {};
|
|
9790
9617
|
}
|
|
@@ -9882,11 +9709,8 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
9882
9709
|
// .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.' }))
|
|
9883
9710
|
// ctx.map is idempotent by map key + row key; reruns reuse completed rows.
|
|
9884
9711
|
const enrichedData = await ctx
|
|
9885
|
-
.map('enriched_data', rows)
|
|
9886
|
-
.run({
|
|
9887
|
-
key: ${rowKey},
|
|
9888
|
-
description: 'Enrich seeded rows.',
|
|
9889
|
-
});
|
|
9712
|
+
.map('enriched_data', rows, { key: ${rowKey} })
|
|
9713
|
+
.run({ description: 'Enrich seeded rows.' });
|
|
9890
9714
|
|
|
9891
9715
|
return {
|
|
9892
9716
|
rows: enrichedData,
|
|
@@ -9916,7 +9740,7 @@ function buildToolExecuteBaseEnvelope(input) {
|
|
|
9916
9740
|
kind: summaryEntries.length > 0 ? "object" : "raw",
|
|
9917
9741
|
summary: input.summary
|
|
9918
9742
|
};
|
|
9919
|
-
const envelopeHasCanonicalOutput =
|
|
9743
|
+
const envelopeHasCanonicalOutput = isRecord3(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
|
|
9920
9744
|
const inspectCommand = `deepline tools execute ${input.toolId} --input ${shellQuote(JSON.stringify(input.params))} --json`;
|
|
9921
9745
|
const actions = input.listConversion ? [
|
|
9922
9746
|
{
|
|
@@ -9976,11 +9800,7 @@ async function executeTool(args) {
|
|
|
9976
9800
|
} catch (error) {
|
|
9977
9801
|
const play = await findPlayForToolId(client, parsed.toolId);
|
|
9978
9802
|
if (play) {
|
|
9979
|
-
|
|
9980
|
-
printJsonError(new Error(playAliasToolErrorMessage(parsed.toolId, play)));
|
|
9981
|
-
} else {
|
|
9982
|
-
printPlayAliasToolError(parsed.toolId, play);
|
|
9983
|
-
}
|
|
9803
|
+
printPlayAliasToolError(parsed.toolId, play);
|
|
9984
9804
|
return 2;
|
|
9985
9805
|
}
|
|
9986
9806
|
if (error instanceof DeeplineError) {
|
|
@@ -9988,14 +9808,6 @@ async function executeTool(args) {
|
|
|
9988
9808
|
}
|
|
9989
9809
|
throw error;
|
|
9990
9810
|
}
|
|
9991
|
-
if (isPlayLikeTool(metadata)) {
|
|
9992
|
-
if (argsWantJson(args)) {
|
|
9993
|
-
printJsonError(new Error(playLikeToolExecuteErrorMessage(parsed.toolId)));
|
|
9994
|
-
} else {
|
|
9995
|
-
printPlayLikeToolExecuteError(parsed.toolId);
|
|
9996
|
-
}
|
|
9997
|
-
return 2;
|
|
9998
|
-
}
|
|
9999
9811
|
const rawResponse = await client.executeTool(parsed.toolId, parsed.params);
|
|
10000
9812
|
const listConversion = tryConvertToList(rawResponse, {
|
|
10001
9813
|
listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
|
|
@@ -10018,7 +9830,7 @@ async function executeTool(args) {
|
|
|
10018
9830
|
{
|
|
10019
9831
|
...baseEnvelope,
|
|
10020
9832
|
local: {
|
|
10021
|
-
...
|
|
9833
|
+
...isRecord3(baseEnvelope.local) ? baseEnvelope.local : {},
|
|
10022
9834
|
payload_file: jsonPath
|
|
10023
9835
|
}
|
|
10024
9836
|
},
|
|
@@ -10616,15 +10428,9 @@ Notes:
|
|
|
10616
10428
|
|
|
10617
10429
|
Examples:
|
|
10618
10430
|
deepline version
|
|
10619
|
-
deepline version --json
|
|
10620
10431
|
deepline --version
|
|
10621
10432
|
`
|
|
10622
|
-
).
|
|
10623
|
-
if (options.json) {
|
|
10624
|
-
process.stdout.write(`${JSON.stringify({ version: SDK_VERSION })}
|
|
10625
|
-
`);
|
|
10626
|
-
return;
|
|
10627
|
-
}
|
|
10433
|
+
).action(() => {
|
|
10628
10434
|
process.stdout.write(`deepline ${SDK_VERSION}
|
|
10629
10435
|
`);
|
|
10630
10436
|
});
|
package/dist/index.d.mts
CHANGED
|
@@ -745,25 +745,9 @@ interface PlayCheckResult {
|
|
|
745
745
|
valid: boolean;
|
|
746
746
|
errors: string[];
|
|
747
747
|
staticPipeline?: Record<string, unknown> | null;
|
|
748
|
-
toolGetterHints?: PlayCheckToolGetterHint[];
|
|
749
748
|
artifactHash?: string | null;
|
|
750
749
|
graphHash?: string | null;
|
|
751
750
|
}
|
|
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
|
-
}
|
|
767
751
|
/**
|
|
768
752
|
* Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
|
|
769
753
|
*
|
|
@@ -1493,8 +1477,8 @@ declare class DeeplineClient {
|
|
|
1493
1477
|
}>;
|
|
1494
1478
|
}
|
|
1495
1479
|
|
|
1496
|
-
declare const SDK_VERSION = "0.1.
|
|
1497
|
-
declare const SDK_API_CONTRACT = "2026-05-
|
|
1480
|
+
declare const SDK_VERSION = "0.1.40";
|
|
1481
|
+
declare const SDK_API_CONTRACT = "2026-05-cloud-play-search";
|
|
1498
1482
|
|
|
1499
1483
|
/**
|
|
1500
1484
|
* Base error class for all Deepline SDK errors.
|
package/dist/index.d.ts
CHANGED
|
@@ -745,25 +745,9 @@ interface PlayCheckResult {
|
|
|
745
745
|
valid: boolean;
|
|
746
746
|
errors: string[];
|
|
747
747
|
staticPipeline?: Record<string, unknown> | null;
|
|
748
|
-
toolGetterHints?: PlayCheckToolGetterHint[];
|
|
749
748
|
artifactHash?: string | null;
|
|
750
749
|
graphHash?: string | null;
|
|
751
750
|
}
|
|
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
|
-
}
|
|
767
751
|
/**
|
|
768
752
|
* Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
|
|
769
753
|
*
|
|
@@ -1493,8 +1477,8 @@ declare class DeeplineClient {
|
|
|
1493
1477
|
}>;
|
|
1494
1478
|
}
|
|
1495
1479
|
|
|
1496
|
-
declare const SDK_VERSION = "0.1.
|
|
1497
|
-
declare const SDK_API_CONTRACT = "2026-05-
|
|
1480
|
+
declare const SDK_VERSION = "0.1.40";
|
|
1481
|
+
declare const SDK_API_CONTRACT = "2026-05-cloud-play-search";
|
|
1498
1482
|
|
|
1499
1483
|
/**
|
|
1500
1484
|
* 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.40";
|
|
219
|
+
var SDK_API_CONTRACT = "2026-05-cloud-play-search";
|
|
220
220
|
|
|
221
221
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
222
222
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -1379,23 +1379,15 @@ var DeeplineClient = class {
|
|
|
1379
1379
|
return response.plays ?? [];
|
|
1380
1380
|
}
|
|
1381
1381
|
async searchPlays(options) {
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
play.reference,
|
|
1392
|
-
play.displayName,
|
|
1393
|
-
play.origin,
|
|
1394
|
-
...play.aliases ?? [],
|
|
1395
|
-
play.inputSchema ? JSON.stringify(play.inputSchema) : ""
|
|
1396
|
-
].filter(Boolean).join(" ").toLowerCase();
|
|
1397
|
-
return terms.every((term) => haystack.includes(term));
|
|
1398
|
-
}).map((play) => this.summarizePlayListItem(play, options));
|
|
1382
|
+
const params = new URLSearchParams();
|
|
1383
|
+
params.set("search", options.query.trim());
|
|
1384
|
+
if (options.origin) params.set("origin", options.origin);
|
|
1385
|
+
const response = await this.http.get(
|
|
1386
|
+
`/api/v2/plays?${params.toString()}`
|
|
1387
|
+
);
|
|
1388
|
+
return (response.plays ?? []).map(
|
|
1389
|
+
(play) => this.summarizePlayListItem(play, options)
|
|
1390
|
+
);
|
|
1399
1391
|
}
|
|
1400
1392
|
/**
|
|
1401
1393
|
* Get the full definition and state of a named play.
|
|
@@ -1891,8 +1883,9 @@ function buildTargets(result, resultIdentityGetters) {
|
|
|
1891
1883
|
}
|
|
1892
1884
|
return targets;
|
|
1893
1885
|
}
|
|
1894
|
-
function buildLists(
|
|
1886
|
+
function buildLists(result, metadata) {
|
|
1895
1887
|
const lists = {};
|
|
1888
|
+
const resolved = resolveListRows(result, metadata.listExtractorPaths);
|
|
1896
1889
|
for (const [name, list] of Object.entries(resolved)) {
|
|
1897
1890
|
lists[name] = {
|
|
1898
1891
|
path: list.path,
|
|
@@ -1927,10 +1920,9 @@ function buildExtractedAccessors(targets) {
|
|
|
1927
1920
|
})
|
|
1928
1921
|
);
|
|
1929
1922
|
}
|
|
1930
|
-
function buildListAccessors(
|
|
1923
|
+
function buildListAccessors(result, lists) {
|
|
1931
1924
|
return Object.fromEntries(
|
|
1932
1925
|
Object.entries(lists).map(([name, metadata]) => {
|
|
1933
|
-
const rows = resolved[name]?.rows ?? [];
|
|
1934
1926
|
const accessor = {
|
|
1935
1927
|
path: metadata.path,
|
|
1936
1928
|
count: metadata.count,
|
|
@@ -1938,7 +1930,7 @@ function buildListAccessors(resolved, lists) {
|
|
|
1938
1930
|
};
|
|
1939
1931
|
Object.defineProperty(accessor, "get", {
|
|
1940
1932
|
value() {
|
|
1941
|
-
return
|
|
1933
|
+
return normalizeRows(getAtPath(result, metadata.path)) ?? [];
|
|
1942
1934
|
},
|
|
1943
1935
|
enumerable: false
|
|
1944
1936
|
});
|
|
@@ -1958,11 +1950,7 @@ function createToolExecuteResult(input) {
|
|
|
1958
1950
|
resultRoot,
|
|
1959
1951
|
input.metadata.resultIdentityGetters
|
|
1960
1952
|
);
|
|
1961
|
-
const
|
|
1962
|
-
resultRoot,
|
|
1963
|
-
input.metadata.listExtractorPaths
|
|
1964
|
-
);
|
|
1965
|
-
const lists = buildLists(resolvedLists, input.metadata);
|
|
1953
|
+
const lists = buildLists(resultRoot, input.metadata);
|
|
1966
1954
|
const metadata = {
|
|
1967
1955
|
toolId: input.metadata.toolId,
|
|
1968
1956
|
execution: input.execution,
|
|
@@ -1974,7 +1962,7 @@ function createToolExecuteResult(input) {
|
|
|
1974
1962
|
...result.meta ? { meta: result.meta } : {}
|
|
1975
1963
|
};
|
|
1976
1964
|
const extractedValues = buildExtractedAccessors(targets);
|
|
1977
|
-
const extractedLists = buildListAccessors(
|
|
1965
|
+
const extractedLists = buildListAccessors(resultRoot, lists);
|
|
1978
1966
|
const wrapper = {
|
|
1979
1967
|
status: input.status,
|
|
1980
1968
|
...input.jobId ? { job_id: input.jobId } : {},
|