deepline 0.1.140 → 0.1.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +46 -22
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/live-progress.ts +4 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-http-errors.ts +7 -262
- package/dist/bundling-sources/sdk/src/client.ts +24 -0
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/sdk/src/types.ts +32 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +54 -34
- package/dist/bundling-sources/shared_libs/play-runtime/live-events.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +32 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +55 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +248 -0
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +4 -0
- package/dist/cli/index.js +165 -42
- package/dist/cli/index.mjs +165 -42
- package/dist/index.d.mts +44 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +36 -2
- package/dist/index.mjs +36 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -413,10 +413,10 @@ var SDK_RELEASE = {
|
|
|
413
413
|
// 0.1.108 ships explicit dataset column/tool recompute policy and removes
|
|
414
414
|
// the SDK enrich generator's one-second stale policy.
|
|
415
415
|
// 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
|
|
416
|
-
version: "0.1.
|
|
416
|
+
version: "0.1.141",
|
|
417
417
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
418
418
|
supportPolicy: {
|
|
419
|
-
latest: "0.1.
|
|
419
|
+
latest: "0.1.141",
|
|
420
420
|
minimumSupported: "0.1.53",
|
|
421
421
|
deprecatedBelow: "0.1.53",
|
|
422
422
|
commandMinimumSupported: [
|
|
@@ -1177,6 +1177,10 @@ function normalizeStepProgress(value) {
|
|
|
1177
1177
|
...optionalFiniteNumber(value.completed) !== void 0 ? { completed: optionalFiniteNumber(value.completed) } : {},
|
|
1178
1178
|
...optionalFiniteNumber(value.total) !== void 0 ? { total: optionalFiniteNumber(value.total) } : {},
|
|
1179
1179
|
...optionalFiniteNumber(value.failed) !== void 0 ? { failed: optionalFiniteNumber(value.failed) } : {},
|
|
1180
|
+
...optionalFiniteNumber(value.startedRows) !== void 0 ? { startedRows: optionalFiniteNumber(value.startedRows) } : {},
|
|
1181
|
+
...optionalFiniteNumber(value.activeRows) !== void 0 ? { activeRows: optionalFiniteNumber(value.activeRows) } : {},
|
|
1182
|
+
...optionalFiniteNumber(value.waitingRows) !== void 0 ? { waitingRows: optionalFiniteNumber(value.waitingRows) } : {},
|
|
1183
|
+
...optionalFiniteNumber(value.completedRows) !== void 0 ? { completedRows: optionalFiniteNumber(value.completedRows) } : {},
|
|
1180
1184
|
...optionalString(value.message) ? { message: optionalString(value.message) } : {},
|
|
1181
1185
|
...optionalNullableString(value.artifactTableNamespace) !== void 0 ? {
|
|
1182
1186
|
artifactTableNamespace: optionalNullableString(
|
|
@@ -1259,6 +1263,10 @@ function buildSnapshotFromLedger(snapshot) {
|
|
|
1259
1263
|
completed: step.progress.completed,
|
|
1260
1264
|
total: step.progress.total,
|
|
1261
1265
|
failed: step.progress.failed,
|
|
1266
|
+
startedRows: step.progress.startedRows,
|
|
1267
|
+
activeRows: step.progress.activeRows,
|
|
1268
|
+
waitingRows: step.progress.waitingRows,
|
|
1269
|
+
completedRows: step.progress.completedRows,
|
|
1262
1270
|
message: step.progress.message,
|
|
1263
1271
|
artifactTableNamespace: step.progress.artifactTableNamespace ?? step.artifactTableNamespace ?? null,
|
|
1264
1272
|
startedAt: step.startedAt ?? null,
|
|
@@ -1455,6 +1463,10 @@ function diffPlayRunStreamEvents(input2) {
|
|
|
1455
1463
|
completed: state.progress.completed,
|
|
1456
1464
|
total: state.progress.total,
|
|
1457
1465
|
failed: state.progress.failed,
|
|
1466
|
+
startedRows: state.progress.startedRows,
|
|
1467
|
+
activeRows: state.progress.activeRows,
|
|
1468
|
+
waitingRows: state.progress.waitingRows,
|
|
1469
|
+
completedRows: state.progress.completedRows,
|
|
1458
1470
|
message: state.progress.message,
|
|
1459
1471
|
artifactTableNamespace: state.progress.artifactTableNamespace ?? state.artifactTableNamespace ?? null,
|
|
1460
1472
|
...resolveTimingWindow({
|
|
@@ -2292,6 +2304,28 @@ var DeeplineClient = class {
|
|
|
2292
2304
|
}
|
|
2293
2305
|
);
|
|
2294
2306
|
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Describe a Deepline Agent model and its provider-specific option surface.
|
|
2309
|
+
*
|
|
2310
|
+
* Combines live AI Gateway model metadata with Deepline's generated AI SDK
|
|
2311
|
+
* provider option registry so agents can construct `providerOptions`
|
|
2312
|
+
* payloads before executing `deeplineagent`.
|
|
2313
|
+
*
|
|
2314
|
+
* The returned option schemas describe accepted provider option shapes, not
|
|
2315
|
+
* guaranteed support for every model. Runtime AI SDK/Gateway errors remain
|
|
2316
|
+
* authoritative for model-gated values.
|
|
2317
|
+
*
|
|
2318
|
+
* @param model - Gateway model id such as `"openai/gpt-5.5"`
|
|
2319
|
+
* @returns Model metadata, provider option shapes, and runnable examples
|
|
2320
|
+
*/
|
|
2321
|
+
async describeModel(model) {
|
|
2322
|
+
return this.http.request(
|
|
2323
|
+
`/api/v2/models/describe?model=${encodeURIComponent(model)}`,
|
|
2324
|
+
{
|
|
2325
|
+
method: "GET"
|
|
2326
|
+
}
|
|
2327
|
+
);
|
|
2328
|
+
}
|
|
2295
2329
|
/**
|
|
2296
2330
|
* Execute a tool and return the standard execution envelope.
|
|
2297
2331
|
*
|
|
@@ -19473,6 +19507,66 @@ function extractSummaryFields(payload) {
|
|
|
19473
19507
|
return {};
|
|
19474
19508
|
}
|
|
19475
19509
|
|
|
19510
|
+
// src/cli/commands/model-description.ts
|
|
19511
|
+
function formatModelDescription(description) {
|
|
19512
|
+
const lines = [];
|
|
19513
|
+
lines.push(description.model);
|
|
19514
|
+
lines.push(`Provider: ${description.provider}`);
|
|
19515
|
+
const name = stringField(description.modelMetadata, "name");
|
|
19516
|
+
if (name) lines.push(`Name: ${name}`);
|
|
19517
|
+
const contextWindow = numberField(
|
|
19518
|
+
description.modelMetadata,
|
|
19519
|
+
"context_window"
|
|
19520
|
+
);
|
|
19521
|
+
if (contextWindow !== null) lines.push(`Context: ${contextWindow}`);
|
|
19522
|
+
const tags = arrayField(description.modelMetadata, "tags").filter(
|
|
19523
|
+
(value) => typeof value === "string"
|
|
19524
|
+
);
|
|
19525
|
+
if (tags.length) lines.push(`Tags: ${tags.join(", ")}`);
|
|
19526
|
+
lines.push("");
|
|
19527
|
+
lines.push("Provider options:");
|
|
19528
|
+
appendNamespace(lines, description.providerOptions.gateway);
|
|
19529
|
+
if (description.providerOptions.selectedProvider) {
|
|
19530
|
+
appendNamespace(lines, description.providerOptions.selectedProvider);
|
|
19531
|
+
}
|
|
19532
|
+
lines.push("");
|
|
19533
|
+
lines.push("Example input:");
|
|
19534
|
+
lines.push(JSON.stringify(description.exampleInput, null, 2));
|
|
19535
|
+
if (description.caveats.length) {
|
|
19536
|
+
lines.push("");
|
|
19537
|
+
lines.push("Caveats:");
|
|
19538
|
+
for (const caveat of description.caveats) {
|
|
19539
|
+
lines.push(`- ${caveat}`);
|
|
19540
|
+
}
|
|
19541
|
+
}
|
|
19542
|
+
return `${lines.join("\n")}
|
|
19543
|
+
`;
|
|
19544
|
+
}
|
|
19545
|
+
function appendNamespace(lines, namespace) {
|
|
19546
|
+
lines.push(`- ${namespace.provider} (${namespace.sourceSymbol})`);
|
|
19547
|
+
for (const field of namespace.fields) {
|
|
19548
|
+
const values = field.enumValues?.length ? ` (${field.enumValues.map((value) => JSON.stringify(value)).join(" | ")})` : "";
|
|
19549
|
+
lines.push(
|
|
19550
|
+
` - ${field.name}: ${field.type}${values} - ${field.description}`
|
|
19551
|
+
);
|
|
19552
|
+
}
|
|
19553
|
+
}
|
|
19554
|
+
function stringField(value, key) {
|
|
19555
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
19556
|
+
const candidate = value[key];
|
|
19557
|
+
return typeof candidate === "string" && candidate.trim() ? candidate.trim() : null;
|
|
19558
|
+
}
|
|
19559
|
+
function numberField(value, key) {
|
|
19560
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
19561
|
+
const candidate = value[key];
|
|
19562
|
+
return typeof candidate === "number" ? candidate : null;
|
|
19563
|
+
}
|
|
19564
|
+
function arrayField(value, key) {
|
|
19565
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
19566
|
+
const candidate = value[key];
|
|
19567
|
+
return Array.isArray(candidate) ? candidate : [];
|
|
19568
|
+
}
|
|
19569
|
+
|
|
19476
19570
|
// src/cli/commands/tools.ts
|
|
19477
19571
|
var TOOL_COMMAND_TEMPLATES = {
|
|
19478
19572
|
describe: "deepline tools describe <toolId>",
|
|
@@ -19699,7 +19793,7 @@ function isPlayLikeTool(tool) {
|
|
|
19699
19793
|
}
|
|
19700
19794
|
function playReferenceForTool(tool) {
|
|
19701
19795
|
const record = tool;
|
|
19702
|
-
const declared =
|
|
19796
|
+
const declared = stringField2(record, "playReference", "play_reference");
|
|
19703
19797
|
if (declared.startsWith("prebuilt/")) {
|
|
19704
19798
|
return declared;
|
|
19705
19799
|
}
|
|
@@ -19842,9 +19936,13 @@ Examples:
|
|
|
19842
19936
|
deepline tools describe hunter_email_verifier --schema-only
|
|
19843
19937
|
deepline tools describe hunter_email_verifier --examples-only
|
|
19844
19938
|
deepline tools describe hunter_email_verifier --json
|
|
19939
|
+
deepline tools describe deeplineagent --model openai/gpt-5.5 --json
|
|
19845
19940
|
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
19846
19941
|
`
|
|
19847
|
-
).option("--json", "Emit JSON output. Also automatic when stdout is piped").option(
|
|
19942
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").option(
|
|
19943
|
+
"--model <model>",
|
|
19944
|
+
"For deeplineagent, include AI Gateway model/provider option metadata"
|
|
19945
|
+
).option("--pricing-only", "Only print pricing and billing semantics").option("--schema-only", "Only print input schema fields").option(
|
|
19848
19946
|
"--examples-only",
|
|
19849
19947
|
"Only print runnable examples and sample payloads"
|
|
19850
19948
|
).option("--getters-only", "Only print extracted list/value getters").addOption(
|
|
@@ -19865,7 +19963,8 @@ Examples:
|
|
|
19865
19963
|
pricingOnly: Boolean(options.pricingOnly),
|
|
19866
19964
|
schemaOnly: Boolean(options.schemaOnly),
|
|
19867
19965
|
examplesOnly: Boolean(options.examplesOnly),
|
|
19868
|
-
gettersOnly: Boolean(options.gettersOnly)
|
|
19966
|
+
gettersOnly: Boolean(options.gettersOnly),
|
|
19967
|
+
model: typeof options.model === "string" ? options.model : void 0
|
|
19869
19968
|
});
|
|
19870
19969
|
});
|
|
19871
19970
|
addToolMetadataCommand(tools.command("describe <toolId>").alias("get"));
|
|
@@ -19937,9 +20036,19 @@ async function getTool(toolId, options = {}) {
|
|
|
19937
20036
|
}
|
|
19938
20037
|
throw error;
|
|
19939
20038
|
}
|
|
20039
|
+
const modelDescription = options.model && (toolId === "deeplineagent" || toolId === "ai_inference") ? await client2.describeModel(options.model) : null;
|
|
20040
|
+
if (options.model && !modelDescription) {
|
|
20041
|
+
console.error(
|
|
20042
|
+
"--model is only supported for deeplineagent and ai_inference."
|
|
20043
|
+
);
|
|
20044
|
+
return 2;
|
|
20045
|
+
}
|
|
19940
20046
|
if (options.contractJson) {
|
|
19941
20047
|
process.stdout.write(
|
|
19942
|
-
`${JSON.stringify(
|
|
20048
|
+
`${JSON.stringify({
|
|
20049
|
+
...toolContractJsonForDescribe(tool, toolId),
|
|
20050
|
+
...modelDescription ? { modelOptions: modelDescription } : {}
|
|
20051
|
+
})}
|
|
19943
20052
|
`
|
|
19944
20053
|
);
|
|
19945
20054
|
return 0;
|
|
@@ -19947,7 +20056,10 @@ async function getTool(toolId, options = {}) {
|
|
|
19947
20056
|
const emitJson = options.json === true;
|
|
19948
20057
|
if (emitJson) {
|
|
19949
20058
|
process.stdout.write(
|
|
19950
|
-
`${JSON.stringify(
|
|
20059
|
+
`${JSON.stringify({
|
|
20060
|
+
...toolMetadataJsonForDescribe(tool, toolId),
|
|
20061
|
+
...modelDescription ? { modelOptions: modelDescription } : {}
|
|
20062
|
+
})}
|
|
19951
20063
|
`
|
|
19952
20064
|
);
|
|
19953
20065
|
return 0;
|
|
@@ -19982,16 +20094,27 @@ async function getTool(toolId, options = {}) {
|
|
|
19982
20094
|
}
|
|
19983
20095
|
if (options.compact) {
|
|
19984
20096
|
printCompactToolContract(tool, toolId);
|
|
20097
|
+
if (modelDescription) {
|
|
20098
|
+
process.stdout.write(`
|
|
20099
|
+
${formatModelDescription(modelDescription)}`);
|
|
20100
|
+
}
|
|
19985
20101
|
return 0;
|
|
19986
20102
|
}
|
|
19987
20103
|
if (shouldEmitJson()) {
|
|
19988
20104
|
process.stdout.write(
|
|
19989
|
-
`${JSON.stringify(
|
|
20105
|
+
`${JSON.stringify({
|
|
20106
|
+
...toolContractJsonForDescribe(tool, toolId),
|
|
20107
|
+
...modelDescription ? { modelOptions: modelDescription } : {}
|
|
20108
|
+
})}
|
|
19990
20109
|
`
|
|
19991
20110
|
);
|
|
19992
20111
|
return 0;
|
|
19993
20112
|
}
|
|
19994
20113
|
printCompactToolContract(tool, toolId);
|
|
20114
|
+
if (modelDescription) {
|
|
20115
|
+
process.stdout.write(`
|
|
20116
|
+
${formatModelDescription(modelDescription)}`);
|
|
20117
|
+
}
|
|
19995
20118
|
return 0;
|
|
19996
20119
|
}
|
|
19997
20120
|
function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
@@ -20006,18 +20129,18 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
|
20006
20129
|
"tool_execution_result"
|
|
20007
20130
|
);
|
|
20008
20131
|
const extractedLists = extractionContractEntries(
|
|
20009
|
-
|
|
20132
|
+
arrayField2(toolExecutionResult, "extractedLists", "extracted_lists")
|
|
20010
20133
|
);
|
|
20011
20134
|
const extractedValues = extractionContractEntries(
|
|
20012
|
-
|
|
20135
|
+
arrayField2(toolExecutionResult, "extractedValues", "extracted_values")
|
|
20013
20136
|
);
|
|
20014
20137
|
const cost = recordField2(tool, "cost");
|
|
20015
|
-
const deeplineCredits =
|
|
20138
|
+
const deeplineCredits = numberField2(
|
|
20016
20139
|
tool,
|
|
20017
20140
|
"deeplineCreditsPerPricingUnit",
|
|
20018
20141
|
"deepline_credits_per_pricing_unit"
|
|
20019
20142
|
);
|
|
20020
|
-
const deeplineUsdPerPricingUnit =
|
|
20143
|
+
const deeplineUsdPerPricingUnit = numberField2(
|
|
20021
20144
|
tool,
|
|
20022
20145
|
"deeplineUsdPerPricingUnit",
|
|
20023
20146
|
"deepline_usd_per_pricing_unit"
|
|
@@ -20045,8 +20168,8 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
|
20045
20168
|
...Object.prototype.hasOwnProperty.call(field, "default") ? { default: field.default } : {}
|
|
20046
20169
|
})),
|
|
20047
20170
|
cost: {
|
|
20048
|
-
pricingModel:
|
|
20049
|
-
billingMode:
|
|
20171
|
+
pricingModel: stringField2(cost, "pricingModel", "pricing_model") || null,
|
|
20172
|
+
billingMode: stringField2(cost, "billingMode", "billing_mode") || null,
|
|
20050
20173
|
deeplineCreditsPerPricingUnit: deeplineCredits,
|
|
20051
20174
|
deeplineUsdPerPricingUnit
|
|
20052
20175
|
},
|
|
@@ -20061,8 +20184,8 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
|
20061
20184
|
function extractionContractEntries(entries) {
|
|
20062
20185
|
return entries.flatMap((entry) => {
|
|
20063
20186
|
if (!isRecord8(entry)) return [];
|
|
20064
|
-
const name =
|
|
20065
|
-
const expression =
|
|
20187
|
+
const name = stringField2(entry, "name");
|
|
20188
|
+
const expression = stringField2(entry, "expression");
|
|
20066
20189
|
return name && expression ? [{ name, expression }] : [];
|
|
20067
20190
|
});
|
|
20068
20191
|
}
|
|
@@ -20087,11 +20210,11 @@ function printCompactToolContract(tool, requestedToolId) {
|
|
|
20087
20210
|
console.log("Inputs:");
|
|
20088
20211
|
for (const field of inputFields) {
|
|
20089
20212
|
if (!isRecord8(field)) continue;
|
|
20090
|
-
const name =
|
|
20213
|
+
const name = stringField2(field, "name");
|
|
20091
20214
|
if (!name) continue;
|
|
20092
20215
|
const required = field.required ? "*" : "";
|
|
20093
|
-
const type =
|
|
20094
|
-
const description =
|
|
20216
|
+
const type = stringField2(field, "type") || "unknown";
|
|
20217
|
+
const description = stringField2(field, "description");
|
|
20095
20218
|
console.log(
|
|
20096
20219
|
`- ${name}${required}: ${type}${description ? ` - ${description}` : ""}`
|
|
20097
20220
|
);
|
|
@@ -20100,7 +20223,7 @@ function printCompactToolContract(tool, requestedToolId) {
|
|
|
20100
20223
|
console.log("");
|
|
20101
20224
|
printToolExamplesOnly(tool, requestedToolId, { includeSamples: false });
|
|
20102
20225
|
const starterScript = isRecord8(contract.starterScript) ? contract.starterScript : {};
|
|
20103
|
-
const starterPath =
|
|
20226
|
+
const starterPath = stringField2(starterScript, "path");
|
|
20104
20227
|
if (starterPath) {
|
|
20105
20228
|
console.log("");
|
|
20106
20229
|
console.log(`Starter script: ${starterPath}`);
|
|
@@ -20115,14 +20238,14 @@ function printCompactToolContract(tool, requestedToolId) {
|
|
|
20115
20238
|
for (const entry of listGetters) {
|
|
20116
20239
|
if (isRecord8(entry))
|
|
20117
20240
|
console.log(
|
|
20118
|
-
`- ${
|
|
20241
|
+
`- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
|
|
20119
20242
|
);
|
|
20120
20243
|
}
|
|
20121
20244
|
if (valueGetters.length) console.log("Values:");
|
|
20122
20245
|
for (const entry of valueGetters) {
|
|
20123
20246
|
if (isRecord8(entry))
|
|
20124
20247
|
console.log(
|
|
20125
|
-
`- ${
|
|
20248
|
+
`- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
|
|
20126
20249
|
);
|
|
20127
20250
|
}
|
|
20128
20251
|
}
|
|
@@ -20134,11 +20257,11 @@ function printCompactToolContract(tool, requestedToolId) {
|
|
|
20134
20257
|
function printToolPricingOnly(tool, requestedToolId, options = {}) {
|
|
20135
20258
|
const contract = toolContractJsonForDescribe(tool, requestedToolId);
|
|
20136
20259
|
const cost = isRecord8(contract.cost) ? contract.cost : {};
|
|
20137
|
-
const pricingModel =
|
|
20138
|
-
const billingMode =
|
|
20260
|
+
const pricingModel = stringField2(cost, "pricingModel") || "unknown";
|
|
20261
|
+
const billingMode = stringField2(cost, "billingMode") || "unknown";
|
|
20139
20262
|
const unit = pricingModel === "per_page" ? "page" : pricingModel === "per_result" ? "result" : pricingModel === "fixed" ? "call" : pricingModel.replace(/^per_/, "") || "unit";
|
|
20140
|
-
const credits =
|
|
20141
|
-
const usd =
|
|
20263
|
+
const credits = numberField2(cost, "deeplineCreditsPerPricingUnit");
|
|
20264
|
+
const usd = numberField2(cost, "deeplineUsdPerPricingUnit");
|
|
20142
20265
|
const price = credits !== null ? `${formatDecimal(credits)} Deepline credits${usd !== null ? ` / ${formatUsd(usd)}` : ""} per ${unit}` : "pricing unavailable";
|
|
20143
20266
|
console.log(`${options.heading ?? `Pricing: ${contract.toolId}`}: ${price}`);
|
|
20144
20267
|
console.log(`Billing: ${billingMode}`);
|
|
@@ -20154,11 +20277,11 @@ function printToolSchemaOnly(tool, requestedToolId) {
|
|
|
20154
20277
|
console.log("Inputs:");
|
|
20155
20278
|
for (const field of inputFields) {
|
|
20156
20279
|
if (!isRecord8(field)) continue;
|
|
20157
|
-
const name =
|
|
20280
|
+
const name = stringField2(field, "name");
|
|
20158
20281
|
if (!name) continue;
|
|
20159
20282
|
const required = field.required ? "*" : "";
|
|
20160
|
-
const type =
|
|
20161
|
-
const description =
|
|
20283
|
+
const type = stringField2(field, "type") || "unknown";
|
|
20284
|
+
const description = stringField2(field, "description");
|
|
20162
20285
|
const defaultSuffix = Object.prototype.hasOwnProperty.call(field, "default") ? ` default=${JSON.stringify(field.default)}` : "";
|
|
20163
20286
|
console.log(
|
|
20164
20287
|
`- ${name}${required}: ${type}${defaultSuffix}${description ? ` - ${description}` : ""}`
|
|
@@ -20188,8 +20311,8 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
|
|
|
20188
20311
|
const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
|
|
20189
20312
|
const firstGetter = [...valueGetters, ...listGetters].find(isRecord8);
|
|
20190
20313
|
if (firstGetter) {
|
|
20191
|
-
const name =
|
|
20192
|
-
const expression =
|
|
20314
|
+
const name = stringField2(firstGetter, "name") || "value";
|
|
20315
|
+
const expression = stringField2(firstGetter, "expression");
|
|
20193
20316
|
if (expression)
|
|
20194
20317
|
console.log(
|
|
20195
20318
|
`const ${safeIdentifier2(name)} = ${expression.replace(/^toolExecutionResult\./, "result.")};`
|
|
@@ -20237,7 +20360,7 @@ function printToolGettersOnly(tool, requestedToolId) {
|
|
|
20237
20360
|
for (const entry of listGetters) {
|
|
20238
20361
|
if (isRecord8(entry))
|
|
20239
20362
|
console.log(
|
|
20240
|
-
`- ${
|
|
20363
|
+
`- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
|
|
20241
20364
|
);
|
|
20242
20365
|
}
|
|
20243
20366
|
}
|
|
@@ -20246,14 +20369,14 @@ function printToolGettersOnly(tool, requestedToolId) {
|
|
|
20246
20369
|
for (const entry of valueGetters) {
|
|
20247
20370
|
if (isRecord8(entry))
|
|
20248
20371
|
console.log(
|
|
20249
|
-
`- ${
|
|
20372
|
+
`- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
|
|
20250
20373
|
);
|
|
20251
20374
|
}
|
|
20252
20375
|
}
|
|
20253
20376
|
}
|
|
20254
20377
|
function sampleValueForField(field) {
|
|
20255
|
-
const name =
|
|
20256
|
-
const type =
|
|
20378
|
+
const name = stringField2(field, "name").toLowerCase();
|
|
20379
|
+
const type = stringField2(field, "type").toLowerCase();
|
|
20257
20380
|
if (Object.prototype.hasOwnProperty.call(field, "default"))
|
|
20258
20381
|
return field.default;
|
|
20259
20382
|
if (name.includes("email")) return "ada@example.com";
|
|
@@ -20271,7 +20394,7 @@ function samplePayloadForInputFields(fields) {
|
|
|
20271
20394
|
return Object.fromEntries(
|
|
20272
20395
|
fields.slice(0, 4).flatMap((field) => {
|
|
20273
20396
|
if (!isRecord8(field)) return [];
|
|
20274
|
-
const name =
|
|
20397
|
+
const name = stringField2(field, "name");
|
|
20275
20398
|
if (!name) return [];
|
|
20276
20399
|
return [[name, sampleValueForField(field)]];
|
|
20277
20400
|
})
|
|
@@ -20285,7 +20408,7 @@ function safeIdentifier2(name) {
|
|
|
20285
20408
|
return cleaned || "value";
|
|
20286
20409
|
}
|
|
20287
20410
|
function playResultExpression(entry) {
|
|
20288
|
-
return
|
|
20411
|
+
return stringField2(entry, "expression").replace(
|
|
20289
20412
|
/^toolExecutionResult\./,
|
|
20290
20413
|
"result."
|
|
20291
20414
|
);
|
|
@@ -20304,7 +20427,7 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
|
|
|
20304
20427
|
"tool_execution_result"
|
|
20305
20428
|
);
|
|
20306
20429
|
const extractedLists = extractionContractEntries(
|
|
20307
|
-
|
|
20430
|
+
arrayField2(toolExecutionResult, "extractedLists", "extracted_lists")
|
|
20308
20431
|
);
|
|
20309
20432
|
const starterScript = !isPlayLikeTool(tool) && extractedLists.length > 0 ? starterScriptJson(
|
|
20310
20433
|
seedToolListScript({
|
|
@@ -20383,7 +20506,7 @@ function listedToolDescription(tool) {
|
|
|
20383
20506
|
function formatListedToolCost(tool) {
|
|
20384
20507
|
const record = tool;
|
|
20385
20508
|
const pricing = recordField2(record, "pricing");
|
|
20386
|
-
const displayText =
|
|
20509
|
+
const displayText = stringField2(pricing, "displayText", "display_text");
|
|
20387
20510
|
return displayText ? `Cost: ${displayText}` : "";
|
|
20388
20511
|
}
|
|
20389
20512
|
function toolInputFieldsForDisplay(inputSchema) {
|
|
@@ -20449,21 +20572,21 @@ function formatUsd(value) {
|
|
|
20449
20572
|
function isRecord8(value) {
|
|
20450
20573
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
20451
20574
|
}
|
|
20452
|
-
function
|
|
20575
|
+
function stringField2(source, ...keys) {
|
|
20453
20576
|
for (const key of keys) {
|
|
20454
20577
|
const value = source[key];
|
|
20455
20578
|
if (typeof value === "string" && value.trim()) return value.trim();
|
|
20456
20579
|
}
|
|
20457
20580
|
return "";
|
|
20458
20581
|
}
|
|
20459
|
-
function
|
|
20582
|
+
function numberField2(source, ...keys) {
|
|
20460
20583
|
for (const key of keys) {
|
|
20461
20584
|
const value = source[key];
|
|
20462
20585
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
20463
20586
|
}
|
|
20464
20587
|
return null;
|
|
20465
20588
|
}
|
|
20466
|
-
function
|
|
20589
|
+
function arrayField2(source, ...keys) {
|
|
20467
20590
|
for (const key of keys) {
|
|
20468
20591
|
const value = source[key];
|
|
20469
20592
|
if (Array.isArray(value)) return value;
|