deepline 0.3.396 → 0.3.398
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/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +50 -26
- package/dist/cli/auth-3GA2ASQF.js +40 -0
- package/dist/cli/{auth-3LTD62VL.mjs → auth-7ZBPAAZU.mjs} +5 -4
- package/dist/cli/{billing-DP7ZAJBO.mjs → billing-QTWEEL27.mjs} +5 -4
- package/dist/cli/{billing-PA5OXEM5.js → billing-WHP3YMNQ.js} +76 -75
- package/dist/cli/{chunk-I4T4XAA2.mjs → chunk-2QC2T7E3.mjs} +4 -4
- package/dist/cli/{chunk-3T4MCB5R.mjs → chunk-52HHMLRM.mjs} +89 -969
- package/dist/cli/{chunk-ME6XRFLY.js → chunk-6CBU7W56.js} +15 -15
- package/dist/cli/{chunk-LOGGNW4H.mjs → chunk-6DVXLWPB.mjs} +2 -2
- package/dist/cli/{chunk-AUYXWELC.mjs → chunk-6HXULNTW.mjs} +2 -2
- package/dist/cli/chunk-7DRPTGCK.js +930 -0
- package/dist/cli/{chunk-TLQ3FZOC.mjs → chunk-ATDUVJCW.mjs} +3 -3
- package/dist/cli/{chunk-23GAA3YO.mjs → chunk-AWQNG55D.mjs} +1 -1
- package/dist/cli/{chunk-NSOTASOP.js → chunk-BQR6UN3C.js} +1 -83
- package/dist/cli/{chunk-XKZXO7D3.mjs → chunk-CH6EFAJ3.mjs} +1 -1
- package/dist/cli/{chunk-KAEZNPUM.js → chunk-CTZJLQ7A.js} +13 -115
- package/dist/cli/{chunk-AVHLATII.js → chunk-FDAMQFQ7.js} +50 -50
- package/dist/cli/chunk-FIVKWNMT.mjs +210 -0
- package/dist/cli/{chunk-7Z66NHUC.js → chunk-G6BP55EP.js} +26 -26
- package/dist/cli/{chunk-GNN4MY5X.js → chunk-HFDBZXMV.js} +1 -1
- package/dist/cli/{describe-6O2ENKTP.mjs → chunk-HFYQBC2D.mjs} +22 -160
- package/dist/cli/chunk-HGFFYVXN.js +210 -0
- package/dist/cli/{chunk-5WNJF2T3.mjs → chunk-IHG7UAHD.mjs} +1 -83
- package/dist/cli/{chunk-QHGPA362.mjs → chunk-IJU5YQSF.mjs} +6 -108
- package/dist/cli/{chunk-772W2SAU.js → chunk-J4WYPANC.js} +8 -8
- package/dist/cli/{chunk-V7UP2F4U.js → chunk-JU3PF7WM.js} +21 -121
- package/dist/cli/{chunk-MR6XCBQJ.mjs → chunk-LCRQKI7D.mjs} +4 -2
- package/dist/cli/chunk-LJ5747UC.mjs +107 -0
- package/dist/cli/{chunk-LWERJUKN.js → chunk-NA4T3B62.js} +7 -215
- package/dist/cli/{chunk-WQJJNIMQ.js → chunk-NUBIAJI2.js} +11 -9
- package/dist/cli/chunk-OSDXE27V.mjs +88 -0
- package/dist/cli/{chunk-RMTASUAK.js → chunk-OU2RZYVS.js} +65 -65
- package/dist/cli/{chunk-JCN4DHF7.mjs → chunk-OVUFHUMG.mjs} +2 -2
- package/dist/cli/chunk-Q2E4E4FJ.js +112 -0
- package/dist/cli/{chunk-2VOLOWYZ.js → chunk-Q3FNSWJG.js} +293 -1173
- package/dist/cli/{chunk-NHB5YUCS.mjs → chunk-QP2TRM7M.mjs} +1 -1
- package/dist/cli/{describe-EFWNECHI.js → chunk-RFG3MRAC.js} +37 -175
- package/dist/cli/{chunk-RTO5QZWT.js → chunk-S22ZQZMU.js} +6 -6
- package/dist/cli/{chunk-H5KLUGY7.mjs → chunk-TXZVVBQZ.mjs} +1 -209
- package/dist/cli/{chunk-DC6LTULT.js → chunk-U46S43LV.js} +2 -2
- package/dist/cli/chunk-YHPYUZZX.mjs +112 -0
- package/dist/cli/chunk-YHZUZO3U.mjs +930 -0
- package/dist/cli/chunk-ZAAKSJAS.js +88 -0
- package/dist/cli/{chunk-VE3U3SQC.mjs → chunk-ZJ7HLJRF.mjs} +7 -107
- package/dist/cli/chunk-ZM2YPJQJ.js +107 -0
- package/dist/cli/{csv-TF576S77.js → csv-NM25BBX7.js} +13 -12
- package/dist/cli/{csv-RLRR74RQ.mjs → csv-TSBHKVNU.mjs} +4 -3
- package/dist/cli/{db-FDBJUTFO.js → db-GBDNQJF3.js} +30 -29
- package/dist/cli/{db-XORGNBIC.mjs → db-JQN6SYLK.mjs} +5 -4
- package/dist/cli/describe-ETTGW5LT.mjs +164 -0
- package/dist/cli/describe-NVLINP5A.js +164 -0
- package/dist/cli/describe-core.d.mts +100 -0
- package/dist/cli/describe-core.d.ts +100 -0
- package/dist/cli/describe-core.js +18 -0
- package/dist/cli/describe-core.mjs +18 -0
- package/dist/cli/{executions-YPP7WR77.mjs → executions-6S4KIVEY.mjs} +5 -4
- package/dist/cli/{executions-SFYAXPF4.js → executions-IH5JUPIT.js} +7 -6
- package/dist/cli/{feedback-5UZFYMGB.js → feedback-ER375ZCB.js} +8 -7
- package/dist/cli/{feedback-RBGA5ARU.mjs → feedback-PGOZLNXU.mjs} +4 -3
- package/dist/cli/{git-IRSAJEK2.mjs → git-7SBFCM52.mjs} +5 -4
- package/dist/cli/git-W6DBPLZO.js +24 -0
- package/dist/cli/index.js +93 -91
- package/dist/cli/index.mjs +35 -33
- package/dist/cli/{legacy-noops-CVAOQY2F.js → legacy-noops-IOEF2SB7.js} +8 -7
- package/dist/cli/{legacy-noops-NA7N6ZOU.mjs → legacy-noops-Q4UQIOQN.mjs} +5 -4
- package/dist/cli/{monitors-4OMRXCXP.js → monitors-NZ2J4YGD.js} +86 -85
- package/dist/cli/{monitors-ILZ2XHYG.mjs → monitors-RZYBFY3Z.mjs} +5 -4
- package/dist/cli/{org-YGNJDD2X.js → org-ERUOT4B2.js} +65 -64
- package/dist/cli/{org-QDDXAE3J.mjs → org-JLSEM6GG.mjs} +5 -4
- package/dist/cli/{play-L535H26U.js → play-7TUO7YNG.js} +251 -247
- package/dist/cli/{play-VT6OHB2D.mjs → play-Z73VC7YR.mjs} +19 -15
- package/dist/cli/{providers-KG4W5MPK.mjs → providers-7HIII2PW.mjs} +5 -4
- package/dist/cli/{providers-GPZ6PQAL.js → providers-ABKBK2C7.js} +8 -7
- package/dist/cli/{quickstart-UI27S5LO.js → quickstart-JBG5RTFZ.js} +6 -5
- package/dist/cli/{quickstart-2JDGTXIG.mjs → quickstart-QQAOCPCZ.mjs} +4 -3
- package/dist/cli/{search-PW3RAUX7.mjs → search-MT2Q64WC.mjs} +7 -5
- package/dist/cli/search-QMQBC6SV.js +30 -0
- package/dist/cli/{secrets-WFAXOUZE.js → secrets-MEW6LLU5.js} +14 -13
- package/dist/cli/{secrets-HNOMK5A2.mjs → secrets-ZFJPIT6B.mjs} +5 -4
- package/dist/cli/{sessions-XLX3E5UO.mjs → sessions-F2KVVZ2Z.mjs} +5 -4
- package/dist/cli/sessions-TBPU4S6M.js +16 -0
- package/dist/cli/{settings-GADAG2UK.js → settings-6VDZ6G5V.js} +75 -74
- package/dist/cli/{settings-YNZ4YKCH.mjs → settings-LUDDM7HO.mjs} +8 -7
- package/dist/cli/{setup-R5YO7GT6.js → setup-IP2KTFYO.js} +42 -41
- package/dist/cli/{setup-PSEHIUXO.mjs → setup-MCEY473G.mjs} +7 -6
- package/dist/cli/skills-EVIIEX6N.js +29 -0
- package/dist/cli/{skills-LTQBP6CZ.mjs → skills-KMJ3CY4O.mjs} +5 -4
- package/dist/cli/tools-KNLHQ3L6.js +39 -0
- package/dist/cli/{tools-UAXDWU63.mjs → tools-WY3PLUA7.mjs} +13 -8
- package/dist/cli/update-LVADY5YE.js +29 -0
- package/dist/cli/{update-SMNIBIMS.mjs → update-XBV52OFM.mjs} +7 -6
- package/dist/cli/{workflow-IKGMBGF6.mjs → workflow-5N5HMYDY.mjs} +6 -5
- package/dist/cli/{workflow-AOQVZHMD.js → workflow-CO7XWS4D.js} +16 -15
- package/dist/{client-DiGl8ska.d.mts → client-D0j-_aaa.d.mts} +1 -1
- package/dist/{client-Bgis7F6-.d.ts → client-DflfVyj6.d.ts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -10
- package/dist/index.mjs +19 -15
- package/dist/install-integrity.json +92 -76
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/package.json +6 -1
- package/dist/cli/auth-562JPKOM.js +0 -39
- package/dist/cli/git-5LDY5ZID.js +0 -23
- package/dist/cli/search-MGWROZ33.js +0 -28
- package/dist/cli/sessions-366KROUA.js +0 -15
- package/dist/cli/skills-JF2LPEGM.js +0 -28
- package/dist/cli/tools-CP2PEFRN.js +0 -34
- package/dist/cli/update-HZHZOU6C.js +0 -28
|
@@ -0,0 +1,930 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkBQR6UN3Cjs = require('./chunk-BQR6UN3C.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkZM2YPJQJjs = require('./chunk-ZM2YPJQJ.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkNA4T3B62js = require('./chunk-NA4T3B62.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkKB4SDX5Sjs = require('./chunk-KB4SDX5S.js');
|
|
19
|
+
|
|
20
|
+
// ../plays/field-catalog.ts
|
|
21
|
+
var value = (description) => ({ type: "string", description });
|
|
22
|
+
var SOURCE = {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "The provider or step that found it."
|
|
25
|
+
};
|
|
26
|
+
var FIELD_CATALOG = {
|
|
27
|
+
person: {
|
|
28
|
+
name: {
|
|
29
|
+
description: "The person's name.",
|
|
30
|
+
leaves: {
|
|
31
|
+
value: value("Full name."),
|
|
32
|
+
first: value("First (given) name."),
|
|
33
|
+
last: value("Last (family) name.")
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
email: {
|
|
37
|
+
description: "An email address for the person.",
|
|
38
|
+
leaves: {
|
|
39
|
+
value: value("The address."),
|
|
40
|
+
validated: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
description: "Whether the address passed validation."
|
|
43
|
+
},
|
|
44
|
+
status: {
|
|
45
|
+
type: "EmailStatus",
|
|
46
|
+
description: "The validation verdict and its signals."
|
|
47
|
+
},
|
|
48
|
+
source: SOURCE
|
|
49
|
+
},
|
|
50
|
+
kinds: {
|
|
51
|
+
work: "At their employer.",
|
|
52
|
+
personal: "Their own, not tied to an employer."
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
phone: {
|
|
56
|
+
description: "A phone number for the person.",
|
|
57
|
+
leaves: {
|
|
58
|
+
value: value("The number."),
|
|
59
|
+
validated: {
|
|
60
|
+
type: "boolean",
|
|
61
|
+
description: "Whether the number passed validation."
|
|
62
|
+
},
|
|
63
|
+
status: {
|
|
64
|
+
type: '"valid" | "invalid" | "unknown"',
|
|
65
|
+
description: "The validation verdict."
|
|
66
|
+
},
|
|
67
|
+
line_type: value("Mobile, landline, VoIP and so on."),
|
|
68
|
+
carrier: value("The carrier serving the number."),
|
|
69
|
+
source: SOURCE
|
|
70
|
+
},
|
|
71
|
+
kinds: {
|
|
72
|
+
mobile: "Their mobile.",
|
|
73
|
+
work: "A direct line at their employer."
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
linkedin: {
|
|
77
|
+
description: "The person's LinkedIn profile.",
|
|
78
|
+
leaves: { url: value("The profile URL.") }
|
|
79
|
+
},
|
|
80
|
+
job: {
|
|
81
|
+
description: "The person's current role.",
|
|
82
|
+
leaves: {
|
|
83
|
+
title: value("Job title."),
|
|
84
|
+
change: {
|
|
85
|
+
type: "JobChange",
|
|
86
|
+
description: "Whether they changed jobs, and to what."
|
|
87
|
+
},
|
|
88
|
+
change_status: {
|
|
89
|
+
type: "JobChangeStatus",
|
|
90
|
+
description: "The job-change verdict alone."
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
record: {
|
|
95
|
+
description: "A provider's own record of the person.",
|
|
96
|
+
leaves: { id: value("The provider's id for the person.") }
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
company: {
|
|
100
|
+
name: {
|
|
101
|
+
description: "The company's name.",
|
|
102
|
+
leaves: { value: value("The name.") },
|
|
103
|
+
kinds: { legal: "As registered with a government." }
|
|
104
|
+
},
|
|
105
|
+
domain: {
|
|
106
|
+
description: "The company's web domain.",
|
|
107
|
+
leaves: { value: value("The bare domain, such as example.com.") }
|
|
108
|
+
},
|
|
109
|
+
website: {
|
|
110
|
+
description: "The company's website.",
|
|
111
|
+
leaves: { url: value("The site URL.") }
|
|
112
|
+
},
|
|
113
|
+
linkedin: {
|
|
114
|
+
description: "The company's LinkedIn page.",
|
|
115
|
+
leaves: { url: value("The page URL.") }
|
|
116
|
+
},
|
|
117
|
+
phone: {
|
|
118
|
+
description: "A phone number for the company.",
|
|
119
|
+
leaves: { value: value("The number.") }
|
|
120
|
+
},
|
|
121
|
+
industry: {
|
|
122
|
+
description: "The industry the company is in.",
|
|
123
|
+
leaves: { value: value("The industry.") }
|
|
124
|
+
},
|
|
125
|
+
record: {
|
|
126
|
+
description: "A provider's own record of the company.",
|
|
127
|
+
leaves: { id: value("The provider's id for the company.") }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
function catalogFields() {
|
|
132
|
+
return Object.entries(FIELD_CATALOG).flatMap(
|
|
133
|
+
([entity, groups]) => Object.entries(groups).flatMap(
|
|
134
|
+
([group, definition]) => [void 0, ...Object.keys(_nullishCoalesce(definition.kinds, () => ( {})))].flatMap(
|
|
135
|
+
(kind) => Object.entries(definition.leaves).map(([leaf, described]) => ({
|
|
136
|
+
...described,
|
|
137
|
+
id: [entity, group, kind, leaf].filter(Boolean).join("."),
|
|
138
|
+
entity,
|
|
139
|
+
group,
|
|
140
|
+
...kind ? { kind } : {},
|
|
141
|
+
leaf
|
|
142
|
+
}))
|
|
143
|
+
)
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
var FIELDS_BY_ID = new Map(catalogFields().map((field) => [field.id, field]));
|
|
148
|
+
function generalField(id) {
|
|
149
|
+
const field = FIELDS_BY_ID.get(id);
|
|
150
|
+
return _optionalChain([field, 'optionalAccess', _ => _.kind]) ? [field.entity, field.group, field.leaf].join(".") : null;
|
|
151
|
+
}
|
|
152
|
+
function fieldSatisfies(offered, wanted) {
|
|
153
|
+
return offered === wanted || generalField(offered) === wanted;
|
|
154
|
+
}
|
|
155
|
+
var EXTRACTOR_TARGET_FIELDS = {
|
|
156
|
+
email: ["person.email.value"],
|
|
157
|
+
personal_email: ["person.email.personal.value"],
|
|
158
|
+
email_status: ["person.email.status"],
|
|
159
|
+
phone: ["person.phone.value", "company.phone.value"],
|
|
160
|
+
phone_status: ["person.phone.status"],
|
|
161
|
+
first_name: ["person.name.first"],
|
|
162
|
+
last_name: ["person.name.last"],
|
|
163
|
+
full_name: ["person.name.value"],
|
|
164
|
+
// Also used for a list name, a channel title and a search suggestion.
|
|
165
|
+
name: ["person.name.value", "company.name.value"],
|
|
166
|
+
linkedin: ["person.linkedin.url", "company.linkedin.url"],
|
|
167
|
+
linkedin_url: ["person.linkedin.url"],
|
|
168
|
+
title: ["person.job.title"],
|
|
169
|
+
job_change: ["person.job.change"],
|
|
170
|
+
job_change_status: ["person.job.change_status"],
|
|
171
|
+
company: ["company.name.value"],
|
|
172
|
+
company_name: ["company.name.value"],
|
|
173
|
+
organization_name: ["company.name.value"],
|
|
174
|
+
company_domain: ["company.domain.value"],
|
|
175
|
+
domain: ["company.domain.value"],
|
|
176
|
+
company_website: ["company.website.url"],
|
|
177
|
+
// Also used for a podcast URL.
|
|
178
|
+
website: ["company.website.url"],
|
|
179
|
+
company_linkedin_url: ["company.linkedin.url"],
|
|
180
|
+
industry: ["company.industry.value"],
|
|
181
|
+
id: ["person.record.id", "company.record.id"],
|
|
182
|
+
// Used for unrelated provider statuses; none is a catalog field.
|
|
183
|
+
status: []
|
|
184
|
+
};
|
|
185
|
+
function fieldOfName(name, declared) {
|
|
186
|
+
const meanings = _nullishCoalesce(EXTRACTOR_TARGET_FIELDS[name], () => ( []));
|
|
187
|
+
if (declared === void 0) {
|
|
188
|
+
return meanings.length === 1 ? meanings[0] : void 0;
|
|
189
|
+
}
|
|
190
|
+
return meanings.some((meaning) => fieldSatisfies(declared, meaning)) ? declared : void 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/cli/described-tool.ts
|
|
194
|
+
function isPlayLikeTool(tool) {
|
|
195
|
+
const record = tool;
|
|
196
|
+
if (record.isPlay === true || record.is_play === true) return true;
|
|
197
|
+
const playExpansion = recordField(record, "playExpansion", "play_expansion");
|
|
198
|
+
if (Object.keys(playExpansion).length > 0) return true;
|
|
199
|
+
const toolId = typeof record.toolId === "string" ? record.toolId : "";
|
|
200
|
+
return toolId.endsWith("_waterfall");
|
|
201
|
+
}
|
|
202
|
+
function isMonitorTypeTool(tool) {
|
|
203
|
+
return stringField(tool, "kind") === "monitor_type";
|
|
204
|
+
}
|
|
205
|
+
function playReferenceForTool(tool) {
|
|
206
|
+
const record = tool;
|
|
207
|
+
const declared = stringField(record, "playReference", "play_reference");
|
|
208
|
+
if (declared.startsWith("prebuilt/")) {
|
|
209
|
+
return declared;
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
function playSearchCommandForToolId(toolId) {
|
|
214
|
+
return `deepline search --type prebuilts ${JSON.stringify(toolId.replace(/_/g, " "))}`;
|
|
215
|
+
}
|
|
216
|
+
function playRunCommandForTool(tool, toolId, input) {
|
|
217
|
+
const playReference = playReferenceForTool(tool);
|
|
218
|
+
if (!playReference) return playSearchCommandForToolId(toolId);
|
|
219
|
+
const inputArg = input === void 0 ? "'{...}'" : `'${JSON.stringify(input)}'`;
|
|
220
|
+
return `deepline plays run ${playReference} --input ${inputArg}`;
|
|
221
|
+
}
|
|
222
|
+
function toolContractJsonForDescribe(tool, requestedToolId, authoringContractEdition, seedStarterScript) {
|
|
223
|
+
const toolId = String(tool.toolId || requestedToolId);
|
|
224
|
+
const inputFields = toolInputFieldsForDisplay(
|
|
225
|
+
recordField(tool, "inputSchema", "input_schema")
|
|
226
|
+
);
|
|
227
|
+
const inputSchema = publicToolInputSchemaForDescribe(
|
|
228
|
+
recordField(tool, "inputSchema", "input_schema")
|
|
229
|
+
);
|
|
230
|
+
const outputSchemaRecord = recordField(tool, "outputSchema", "output_schema");
|
|
231
|
+
const outputFields = toolOutputFieldsForDisplay(outputSchemaRecord);
|
|
232
|
+
const usageGuidance = recordField(tool, "usageGuidance", "usage_guidance");
|
|
233
|
+
const guidance = recordField(tool, "guidance");
|
|
234
|
+
const toolExecutionResult = recordField(
|
|
235
|
+
usageGuidance,
|
|
236
|
+
"toolExecutionResult",
|
|
237
|
+
"tool_execution_result"
|
|
238
|
+
);
|
|
239
|
+
const extractedLists = extractionContractEntries(
|
|
240
|
+
arrayField(toolExecutionResult, "extractedLists", "extracted_lists")
|
|
241
|
+
).map((entry) => ({
|
|
242
|
+
...entry,
|
|
243
|
+
returnType: _chunkKB4SDX5Sjs.playToolListGetterMode.call(void 0, authoringContractEdition) === "array" ? "Array" : "PlayDataset",
|
|
244
|
+
rowsExpression: _chunkKB4SDX5Sjs.playToolListGetterMode.call(void 0, authoringContractEdition) === "array" ? entry.expression : `await ${entry.expression}.materialize()`
|
|
245
|
+
}));
|
|
246
|
+
const extractedValues = extractionContractEntries(
|
|
247
|
+
arrayField(toolExecutionResult, "extractedValues", "extracted_values")
|
|
248
|
+
);
|
|
249
|
+
const pricing = _chunkZM2YPJQJjs.Capability.fromCatalogEntry(tool).describe().customerCost();
|
|
250
|
+
const executionMetadataRecord = recordField(
|
|
251
|
+
tool,
|
|
252
|
+
"executionMetadata",
|
|
253
|
+
"execution_metadata"
|
|
254
|
+
);
|
|
255
|
+
const executionMetadata = Object.keys(executionMetadataRecord).length > 0 ? executionMetadataRecord : null;
|
|
256
|
+
const batchCapabilityRecord = recordField(
|
|
257
|
+
tool,
|
|
258
|
+
"batchCapability",
|
|
259
|
+
"batch_capability"
|
|
260
|
+
);
|
|
261
|
+
const batchCapability = Object.keys(batchCapabilityRecord).length > 0 ? batchCapabilityRecord : null;
|
|
262
|
+
const deprecation = recordField(tool, "deprecation");
|
|
263
|
+
const replacementToolId = stringField(
|
|
264
|
+
deprecation,
|
|
265
|
+
"replacementToolId",
|
|
266
|
+
"replacement_tool_id"
|
|
267
|
+
);
|
|
268
|
+
const deprecationMessage = stringField(deprecation, "message");
|
|
269
|
+
const deprecationExecution = stringField(deprecation, "execution");
|
|
270
|
+
const deprecated = tool.deprecated === true || stringField(tool, "credentialStatus", "credential_status") === "deprecated";
|
|
271
|
+
const starterScript = seedStarterScript && !deprecated && !isPlayLikeTool(tool) && extractedLists.length > 0 ? starterScriptJson(
|
|
272
|
+
seedStarterScript({
|
|
273
|
+
toolId,
|
|
274
|
+
payload: samplePayloadForInputFields(inputFields),
|
|
275
|
+
rows: []
|
|
276
|
+
})
|
|
277
|
+
) : null;
|
|
278
|
+
const executeCommand = deprecated && replacementToolId ? `deepline tools execute ${replacementToolId} --input '{...}'` : isPlayLikeTool(tool) ? playRunCommandForTool(tool, toolId) : `deepline tools execute ${toolId} --input '{...}'`;
|
|
279
|
+
return {
|
|
280
|
+
schemaVersion: 1,
|
|
281
|
+
toolId,
|
|
282
|
+
provider: tool.provider,
|
|
283
|
+
displayName: tool.displayName,
|
|
284
|
+
cost: pricing,
|
|
285
|
+
description: tool.description,
|
|
286
|
+
...Object.keys(guidance).length > 0 ? { guidance } : {},
|
|
287
|
+
categories: tool.categories,
|
|
288
|
+
...Array.isArray(tool.requestWarnings) ? { requestWarnings: tool.requestWarnings } : {},
|
|
289
|
+
...deprecated ? {
|
|
290
|
+
deprecated: true,
|
|
291
|
+
callable: tool.callable !== false,
|
|
292
|
+
deprecation: {
|
|
293
|
+
replacementToolId,
|
|
294
|
+
message: deprecationMessage,
|
|
295
|
+
...deprecationExecution ? { execution: deprecationExecution } : {}
|
|
296
|
+
}
|
|
297
|
+
} : {},
|
|
298
|
+
inputFields: inputFields.map(inputFieldJsonForDescribe),
|
|
299
|
+
inputSchema,
|
|
300
|
+
...isRecord(tool.responseSchema) ? { responseSchema: tool.responseSchema } : {},
|
|
301
|
+
...Array.isArray(tool.examples) ? { examples: tool.examples } : {},
|
|
302
|
+
responseAccess: "result.toolResponse.rawV2",
|
|
303
|
+
...Object.keys(outputSchemaRecord).length > 0 ? {
|
|
304
|
+
outputSchema: publicToolInputSchemaForDescribe(outputSchemaRecord),
|
|
305
|
+
outputFields: outputFields.map(inputFieldJsonForDescribe)
|
|
306
|
+
} : {},
|
|
307
|
+
...executionMetadata ? { executionMetadata } : {},
|
|
308
|
+
...batchCapability ? { batchCapability } : {},
|
|
309
|
+
getters: {
|
|
310
|
+
extractedLists,
|
|
311
|
+
extractedValues
|
|
312
|
+
},
|
|
313
|
+
executeCommand,
|
|
314
|
+
...starterScript ? { starterScript } : {}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function extractionContractEntries(entries) {
|
|
318
|
+
return entries.flatMap((entry) => {
|
|
319
|
+
if (!isRecord(entry)) return [];
|
|
320
|
+
const name = stringField(entry, "name");
|
|
321
|
+
const expression = stringField(entry, "expression");
|
|
322
|
+
return name && expression ? [{ name, expression }] : [];
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function schemaNodeAt(schema, path) {
|
|
326
|
+
let node = schema;
|
|
327
|
+
for (const part of path.split(".").filter(Boolean)) {
|
|
328
|
+
const [key, ...indexes] = part.split("[");
|
|
329
|
+
node = recordField(isRecord(node) ? node : {}, "properties")[key];
|
|
330
|
+
for (const _index of indexes)
|
|
331
|
+
node = isRecord(node) ? node.items : void 0;
|
|
332
|
+
}
|
|
333
|
+
return node;
|
|
334
|
+
}
|
|
335
|
+
var NAMED_VALUE_SHAPES = {
|
|
336
|
+
email_status: { shape: "EmailStatus", schema: _chunkNA4T3B62js.EMAIL_STATUS_JSON_SCHEMA },
|
|
337
|
+
job_change: { shape: "JobChange", schema: _chunkNA4T3B62js.JOB_CHANGE_JSON_SCHEMA }
|
|
338
|
+
};
|
|
339
|
+
function extractorValueType(name) {
|
|
340
|
+
if (!_chunkNA4T3B62js.isDeeplineExtractorTarget.call(void 0, name)) return void 0;
|
|
341
|
+
const definition = _chunkNA4T3B62js.DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS[name];
|
|
342
|
+
if (definition.enum) {
|
|
343
|
+
return {
|
|
344
|
+
type: definition.enum.map((value2) => JSON.stringify(value2)).join(" | ")
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
const named = NAMED_VALUE_SHAPES[definition.valueKind];
|
|
348
|
+
if (!named) return { type: "string" };
|
|
349
|
+
const { type, fields } = _chunkBQR6UN3Cjs.schemaField.call(void 0, name, named.schema, true);
|
|
350
|
+
return { type, ...fields ? { fields } : {}, shape: named.shape };
|
|
351
|
+
}
|
|
352
|
+
function jsonSchemaOf(wrapper) {
|
|
353
|
+
return isRecord(wrapper.jsonSchema) ? wrapper.jsonSchema : wrapper;
|
|
354
|
+
}
|
|
355
|
+
function publicToolSchemas(tool) {
|
|
356
|
+
const scrubbed = (...keys) => {
|
|
357
|
+
const schema = recordField(tool, ...keys);
|
|
358
|
+
if (Object.keys(schema).length === 0) return null;
|
|
359
|
+
const cleaned = publicToolInputSchemaForDescribe(schema);
|
|
360
|
+
return isRecord(cleaned.jsonSchema) ? cleaned.jsonSchema : cleaned;
|
|
361
|
+
};
|
|
362
|
+
const responseSchema = scrubbed("responseSchema", "response_schema");
|
|
363
|
+
return {
|
|
364
|
+
inputSchema: scrubbed(
|
|
365
|
+
"inputSchema",
|
|
366
|
+
"input_schema",
|
|
367
|
+
"payload_schema",
|
|
368
|
+
"payloadSchema"
|
|
369
|
+
),
|
|
370
|
+
outputSchema: scrubbed("outputSchema", "output_schema"),
|
|
371
|
+
...responseSchema ? { responseSchema } : {}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function describedTool(tool, requestedToolId) {
|
|
375
|
+
const id = stringField(tool, "toolId") || requestedToolId;
|
|
376
|
+
const displayName = stringField(tool, "displayName") || void 0;
|
|
377
|
+
const description = stringField(tool, "bestFor", "best_for") || stringField(tool, "description") || void 0;
|
|
378
|
+
if (isMonitorTypeTool(tool)) {
|
|
379
|
+
return {
|
|
380
|
+
kind: "monitor_type",
|
|
381
|
+
id,
|
|
382
|
+
displayName,
|
|
383
|
+
description,
|
|
384
|
+
cost: stringField(recordField(tool, "pricing"), "displayText") || void 0,
|
|
385
|
+
guidance: [],
|
|
386
|
+
inputs: _chunkBQR6UN3Cjs.schemaFields.call(void 0,
|
|
387
|
+
recordField(tool, "payload_schema", "payloadSchema")
|
|
388
|
+
),
|
|
389
|
+
outputs: [],
|
|
390
|
+
runner: {
|
|
391
|
+
via: "monitor",
|
|
392
|
+
deploy: stringField(recordField(tool, "deploy"), "example") || `deepline monitors deploy '{"key":"...","tool":"${id}","payload":{...}}'`
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
const contract = toolContractJsonForDescribe(tool, requestedToolId);
|
|
397
|
+
const cost = recordField(contract, "cost");
|
|
398
|
+
const billing = stringField(cost, "billingSourceLabel");
|
|
399
|
+
const deprecation = recordField(contract, "deprecation");
|
|
400
|
+
const getters = recordField(contract, "getters");
|
|
401
|
+
const outputSchema = jsonSchemaOf(recordField(contract, "outputSchema"));
|
|
402
|
+
const toolResult = recordField(tool, "toolResult", "tool_result");
|
|
403
|
+
const getterDetails = (kind) => new Map(
|
|
404
|
+
arrayField(toolResult, kind).filter(isRecord).map((item) => [
|
|
405
|
+
stringField(item, "name"),
|
|
406
|
+
recordField(item, "details")
|
|
407
|
+
])
|
|
408
|
+
);
|
|
409
|
+
const declared = recordField(tool, "extractors");
|
|
410
|
+
const getterOutputs = (kind, roots) => {
|
|
411
|
+
const details = getterDetails(kind);
|
|
412
|
+
return arrayField(getters, kind).filter(isRecord).map((entry) => {
|
|
413
|
+
const name = stringField(entry, "name");
|
|
414
|
+
const rawPaths = arrayField(
|
|
415
|
+
_nullishCoalesce(details.get(name), () => ( {})),
|
|
416
|
+
"rawToolOutputPaths"
|
|
417
|
+
).map(String);
|
|
418
|
+
const paths = rawPaths.map(
|
|
419
|
+
(path) => path.replace(/^toolResponse\.raw\./, "")
|
|
420
|
+
);
|
|
421
|
+
const node = roots.flatMap((root) => paths.map((path) => schemaNodeAt(root, path))).find(isRecord);
|
|
422
|
+
const { fields, ...typed } = _chunkBQR6UN3Cjs.schemaField.call(void 0, name, node, true);
|
|
423
|
+
const valueType = stringField(_nullishCoalesce(details.get(name), () => ( {})), "valueType");
|
|
424
|
+
const deepline = kind === "extractedValues" ? extractorValueType(name) : void 0;
|
|
425
|
+
const known = typed.type !== "unknown" ? void 0 : kind === "extractedLists" ? { type: "object[]" } : deepline;
|
|
426
|
+
const means = kind === "extractedValues" ? fieldOfName(
|
|
427
|
+
name,
|
|
428
|
+
stringField(_nullishCoalesce(declared[name], () => ( {})), "means") || void 0
|
|
429
|
+
) : void 0;
|
|
430
|
+
const field = {
|
|
431
|
+
...typed,
|
|
432
|
+
...means ? { means } : {},
|
|
433
|
+
// A normalized value has a named type instead of the response's
|
|
434
|
+
// shape; a normalized object is spelled out once under Types.
|
|
435
|
+
..._optionalChain([deepline, 'optionalAccess', _2 => _2.shape]) ? deepline : valueType ? { type: valueType } : known ? known : fields ? { fields } : {},
|
|
436
|
+
// A list's row columns that matter are value getters of their own.
|
|
437
|
+
...kind === "extractedLists" && fields ? { summarized: true } : {},
|
|
438
|
+
read: playResultExpression(entry),
|
|
439
|
+
...rawPaths.length ? { paths: rawPaths } : {}
|
|
440
|
+
};
|
|
441
|
+
return { field, node };
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
const declaredLists = getterOutputs("extractedLists", [outputSchema]);
|
|
445
|
+
const lists = declaredLists.some(({ node }) => node) ? declaredLists.filter(({ node }) => node) : declaredLists;
|
|
446
|
+
const values = getterOutputs("extractedValues", [
|
|
447
|
+
outputSchema,
|
|
448
|
+
...lists.map(({ node }) => _optionalChain([node, 'optionalAccess', _3 => _3.items]))
|
|
449
|
+
]).map((value2) => {
|
|
450
|
+
if (!lists.length || !value2.field.paths) return value2;
|
|
451
|
+
const within = value2.field.paths.map(
|
|
452
|
+
(path) => path.replace(/^toolResponse\.raw\./, "")
|
|
453
|
+
);
|
|
454
|
+
const list = _nullishCoalesce(lists.find(
|
|
455
|
+
({ node }) => within.some((path) => isRecord(schemaNodeAt(_optionalChain([node, 'optionalAccess', _4 => _4.items]), path)))
|
|
456
|
+
), () => ( lists[0]));
|
|
457
|
+
return {
|
|
458
|
+
...value2,
|
|
459
|
+
field: { ...value2.field, in: list.field.name, paths: within }
|
|
460
|
+
};
|
|
461
|
+
});
|
|
462
|
+
const playReference = isPlayLikeTool(tool) ? playReferenceForTool(tool) : null;
|
|
463
|
+
return {
|
|
464
|
+
kind: "tool",
|
|
465
|
+
id: String(contract.toolId),
|
|
466
|
+
displayName,
|
|
467
|
+
description,
|
|
468
|
+
cost: [
|
|
469
|
+
stringField(cost, "displayText"),
|
|
470
|
+
// "Free (free)" says the same thing twice.
|
|
471
|
+
billing.toLowerCase() === stringField(cost, "displayText").toLowerCase() ? "" : billing && `(${billing})`,
|
|
472
|
+
_chunkZM2YPJQJjs.observedMaxText.call(void 0, cost) && `\u2014 ${_chunkZM2YPJQJjs.observedMaxText.call(void 0, cost)}`
|
|
473
|
+
].filter(Boolean).join(" ") || void 0,
|
|
474
|
+
guidance: [
|
|
475
|
+
...contract.deprecated === true ? [`Deprecated. ${stringField(deprecation, "message")}`.trim()] : [],
|
|
476
|
+
...Object.values(recordField(contract, "guidance")).filter(
|
|
477
|
+
(line) => typeof line === "string" && /[a-z0-9]/i.test(line)
|
|
478
|
+
)
|
|
479
|
+
],
|
|
480
|
+
rateLimit: _chunkBQR6UN3Cjs.rateLimitSummary.call(void 0,
|
|
481
|
+
recordField(contract, "executionMetadata").configuredRateLimits
|
|
482
|
+
),
|
|
483
|
+
inputs: _chunkBQR6UN3Cjs.schemaFields.call(void 0, jsonSchemaOf(recordField(contract, "inputSchema"))),
|
|
484
|
+
outputs: [...lists, ...values].map(({ field }) => field),
|
|
485
|
+
rawResponse: _chunkBQR6UN3Cjs.schemaFields.call(void 0, outputSchema),
|
|
486
|
+
runner: playReference ? { via: "play", reference: playReference } : { via: "tool", toolId: String(contract.toolId) }
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function sampleValueForField(field) {
|
|
490
|
+
const name = stringField(field, "name").toLowerCase();
|
|
491
|
+
const type = stringField(field, "type").toLowerCase();
|
|
492
|
+
if (Object.prototype.hasOwnProperty.call(field, "default"))
|
|
493
|
+
return field.default;
|
|
494
|
+
if (name.includes("email")) return "ada@example.com";
|
|
495
|
+
if (name.includes("domain") || name.includes("website")) return "example.com";
|
|
496
|
+
if (name.includes("first")) return "Ada";
|
|
497
|
+
if (name.includes("last")) return "Lovelace";
|
|
498
|
+
if (name.includes("name")) return "Ada Lovelace";
|
|
499
|
+
if (type === "integer" || type === "number") return 1;
|
|
500
|
+
if (type === "boolean") return true;
|
|
501
|
+
if (type === "array") return [];
|
|
502
|
+
if (type === "object") return {};
|
|
503
|
+
return "...";
|
|
504
|
+
}
|
|
505
|
+
function samplePayloadForInputFields(fields) {
|
|
506
|
+
return Object.fromEntries(
|
|
507
|
+
fields.slice(0, 4).flatMap((field) => {
|
|
508
|
+
if (!isRecord(field)) return [];
|
|
509
|
+
const name = stringField(field, "name");
|
|
510
|
+
if (!name) return [];
|
|
511
|
+
return [[name, sampleValueForField(field)]];
|
|
512
|
+
})
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
function playResultExpression(entry) {
|
|
516
|
+
return stringField(entry, "expression").replace(
|
|
517
|
+
/^toolExecutionResult\./,
|
|
518
|
+
"result."
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
function toolMetadataJsonForDescribe(tool, requestedToolId, seedStarterScript) {
|
|
522
|
+
const toolId = String(tool.toolId || requestedToolId);
|
|
523
|
+
const inputFields = toolInputFieldsForDisplay(
|
|
524
|
+
recordField(tool, "inputSchema", "input_schema")
|
|
525
|
+
);
|
|
526
|
+
const usageGuidance = usageGuidanceWithAccessDefaults(
|
|
527
|
+
recordField(tool, "usageGuidance", "usage_guidance")
|
|
528
|
+
);
|
|
529
|
+
const toolExecutionResult = recordField(
|
|
530
|
+
usageGuidance,
|
|
531
|
+
"toolExecutionResult",
|
|
532
|
+
"tool_execution_result"
|
|
533
|
+
);
|
|
534
|
+
const extractedLists = extractionContractEntries(
|
|
535
|
+
arrayField(toolExecutionResult, "extractedLists", "extracted_lists")
|
|
536
|
+
);
|
|
537
|
+
const starterScript = seedStarterScript && !isPlayLikeTool(tool) && extractedLists.length > 0 ? starterScriptJson(
|
|
538
|
+
seedStarterScript({
|
|
539
|
+
toolId,
|
|
540
|
+
payload: samplePayloadForInputFields(inputFields),
|
|
541
|
+
rows: []
|
|
542
|
+
})
|
|
543
|
+
) : null;
|
|
544
|
+
const observedOutputCommand = isPlayLikeTool(tool) ? playRunCommandForTool(tool, toolId) : `deepline tools execute ${toolId} --input '{...}'`;
|
|
545
|
+
const {
|
|
546
|
+
cost: _cost,
|
|
547
|
+
deeplineCreditsPerPricingUnit: _deeplineCreditsPerPricingUnit,
|
|
548
|
+
deeplineUsdPerPricingUnit: _deeplineUsdPerPricingUnit,
|
|
549
|
+
deeplineUsdPerCredit: _deeplineUsdPerCredit,
|
|
550
|
+
deeplinePricingSummary: _deeplinePricingSummary,
|
|
551
|
+
deeplinePricingDetails: _deeplinePricingDetails,
|
|
552
|
+
deepline_credits_per_pricing_unit: _snakeDeeplineCreditsPerPricingUnit,
|
|
553
|
+
deepline_usd_per_pricing_unit: _snakeDeeplineUsdPerPricingUnit,
|
|
554
|
+
deepline_usd_per_credit: _snakeDeeplineUsdPerCredit,
|
|
555
|
+
deepline_pricing_summary: _snakeDeeplinePricingSummary,
|
|
556
|
+
deepline_pricing_details: _snakeDeeplinePricingDetails,
|
|
557
|
+
// BYOK is shown only on request, via describe --feature byok.
|
|
558
|
+
byok: _byok,
|
|
559
|
+
...publicTool
|
|
560
|
+
} = tool;
|
|
561
|
+
const outputSchemaRecord = recordField(tool, "outputSchema", "output_schema");
|
|
562
|
+
return {
|
|
563
|
+
cost: _chunkZM2YPJQJjs.Capability.fromCatalogEntry(tool).describe().customerCost(),
|
|
564
|
+
...publicTool,
|
|
565
|
+
toolId,
|
|
566
|
+
provider: tool.provider,
|
|
567
|
+
displayName: tool.displayName,
|
|
568
|
+
...Object.keys(outputSchemaRecord).length > 0 ? {
|
|
569
|
+
outputSchema: publicToolInputSchemaForDescribe(outputSchemaRecord),
|
|
570
|
+
outputFields: toolOutputFieldsForDisplay(outputSchemaRecord).map(
|
|
571
|
+
inputFieldJsonForDescribe
|
|
572
|
+
)
|
|
573
|
+
} : {},
|
|
574
|
+
inputFields: inputFields.map(inputFieldJsonForDescribe),
|
|
575
|
+
usageGuidance,
|
|
576
|
+
runtimeOutputHelp: {
|
|
577
|
+
contract: "Schemas declare field shapes. Examples illustrate input payloads and full Deepline execution responses; they are not observed responses from this call.",
|
|
578
|
+
getterScope: "extractedValues/extractedLists .get() only works for declared Deepline getters listed in usageGuidance.toolExecutionResult.",
|
|
579
|
+
rawToolResponse: "Use toolExecutionResult.toolResponse.rawV2 for the complete tool response. Preserve its nesting and sibling fields as shown in examples; use declared getters for extracted values and lists.",
|
|
580
|
+
invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter.",
|
|
581
|
+
observeActualShape: observedOutputCommand,
|
|
582
|
+
observedOutput: observedOutputCommand,
|
|
583
|
+
forPlayGetterBugs: "Run a tiny play, inspect returned handles with `deepline runs get <run-id> --full`, then export row datasets with `deepline runs export`.",
|
|
584
|
+
executeOutputFields: "tools execute JSON may include output_preview for this direct probe only; play debugging uses run output and returned dataset handles."
|
|
585
|
+
},
|
|
586
|
+
...starterScript ? { starterScript } : {}
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function usageGuidanceWithAccessDefaults(usageGuidance) {
|
|
590
|
+
if (Object.keys(usageGuidance).length === 0) return usageGuidance;
|
|
591
|
+
const existingAccess = recordField(usageGuidance, "access");
|
|
592
|
+
return {
|
|
593
|
+
...usageGuidance,
|
|
594
|
+
prefer: [
|
|
595
|
+
"Use only the declared extractedLists and extractedValues getters listed below.",
|
|
596
|
+
"Use toolExecutionResult.toolResponse.rawV2 for the complete tool response, preserving the nesting shown in the response example.",
|
|
597
|
+
"Schemas declare field shapes; examples illustrate input values and full Deepline execution responses."
|
|
598
|
+
],
|
|
599
|
+
toolExecutionResult: {
|
|
600
|
+
...recordField(
|
|
601
|
+
usageGuidance,
|
|
602
|
+
"toolExecutionResult",
|
|
603
|
+
"tool_execution_result"
|
|
604
|
+
),
|
|
605
|
+
toolResponse: {
|
|
606
|
+
rawV2: "toolResponse.rawV2",
|
|
607
|
+
view: "toolResponse.view",
|
|
608
|
+
responseMeta: "toolResponse.responseMeta"
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
access: {
|
|
612
|
+
...existingAccess,
|
|
613
|
+
extractedValues: {
|
|
614
|
+
expression: "toolExecutionResult.extractedValues.<name>.get()",
|
|
615
|
+
meaning: "Declared Deepline scalar or normalized object extractors only."
|
|
616
|
+
},
|
|
617
|
+
...existingAccess,
|
|
618
|
+
extractedLists: {
|
|
619
|
+
...recordField(existingAccess, "extractedLists"),
|
|
620
|
+
expression: "toolExecutionResult.extractedLists.<name>.get()",
|
|
621
|
+
meaning: _chunkKB4SDX5Sjs.playToolListGetterMode.call(void 0, ) === "array" ? "Returns an ordinary array from this response. Use array methods directly or pass it to ctx.dataset to persist row work. Lazy or incomplete lists throw; use readList for an explicit dataset read. It does not fetch provider pages." : "Returns a PlayDataset, not a JavaScript array. Pass the handle to ctx.dataset, use first(), async iteration, or await handle.materialize() for the complete current list within the memory cap. materialize(n) and peek(n) return a prefix; none fetch additional provider pages. A missing getter is not an empty list."
|
|
622
|
+
},
|
|
623
|
+
rawToolResponse: {
|
|
624
|
+
expression: "toolExecutionResult.toolResponse.rawV2",
|
|
625
|
+
meaning: "Complete tool response with its original nesting. Read tool-specific fields here; use declared getters for extracted values and lists."
|
|
626
|
+
},
|
|
627
|
+
canonicalToolResponse: {
|
|
628
|
+
expression: "toolExecutionResult.toolResponse.rawV2",
|
|
629
|
+
meaning: "Complete tool response with its original nesting and sibling fields."
|
|
630
|
+
},
|
|
631
|
+
invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter; read it from toolResponse.rawV2 using the nesting shown in the response example."
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
function toolInputFieldsForDisplay(inputSchema) {
|
|
636
|
+
if (Array.isArray(inputSchema.fields)) {
|
|
637
|
+
const fields = inputSchema.fields.filter(isRecord);
|
|
638
|
+
if (!isRecord(inputSchema.jsonSchema)) return fields;
|
|
639
|
+
const jsonSchemaFields = new Map(
|
|
640
|
+
recursiveToolInputFieldsForDisplay({
|
|
641
|
+
jsonSchema: inputSchema.jsonSchema
|
|
642
|
+
}).flatMap(
|
|
643
|
+
(field) => typeof field.name === "string" ? [[field.name, field]] : []
|
|
644
|
+
)
|
|
645
|
+
);
|
|
646
|
+
return fields.map((field) => {
|
|
647
|
+
const jsonSchemaField = typeof field.name === "string" ? jsonSchemaFields.get(field.name) : void 0;
|
|
648
|
+
const minItems = typeof field.minItems === "number" ? field.minItems : _optionalChain([jsonSchemaField, 'optionalAccess', _5 => _5.minItems]);
|
|
649
|
+
const maxItems = typeof field.maxItems === "number" ? field.maxItems : _optionalChain([jsonSchemaField, 'optionalAccess', _6 => _6.maxItems]);
|
|
650
|
+
const items = isRecord(field.items) ? field.items : _optionalChain([jsonSchemaField, 'optionalAccess', _7 => _7.items]);
|
|
651
|
+
return {
|
|
652
|
+
...field,
|
|
653
|
+
...isRecord(items) ? { items } : {},
|
|
654
|
+
...typeof minItems === "number" ? { minItems } : {},
|
|
655
|
+
...typeof maxItems === "number" ? { maxItems } : {}
|
|
656
|
+
};
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
const jsonSchema = isRecord(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
|
|
660
|
+
const properties = isRecord(jsonSchema.properties) ? jsonSchema.properties : {};
|
|
661
|
+
const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
|
|
662
|
+
return Object.entries(properties).map(([name, value2]) => {
|
|
663
|
+
const property = isRecord(value2) ? value2 : {};
|
|
664
|
+
return {
|
|
665
|
+
name,
|
|
666
|
+
type: typeof property.type === "string" ? property.type : "unknown",
|
|
667
|
+
required: required.has(name),
|
|
668
|
+
description: property.description,
|
|
669
|
+
...isRecord(property.items) ? { items: property.items } : {},
|
|
670
|
+
...typeof property.minItems === "number" ? { minItems: property.minItems } : {},
|
|
671
|
+
...typeof property.maxItems === "number" ? { maxItems: property.maxItems } : {},
|
|
672
|
+
...Object.prototype.hasOwnProperty.call(property, "default") ? { default: property.default } : {}
|
|
673
|
+
};
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function toolOutputFieldsForDisplay(outputSchema) {
|
|
677
|
+
if (Object.keys(outputSchema).length === 0) return [];
|
|
678
|
+
return recursiveToolInputFieldsForDisplay({
|
|
679
|
+
jsonSchema: outputSchema
|
|
680
|
+
}).filter(
|
|
681
|
+
(field) => typeof field.name === "string" && field.name.includes("[]")
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
function canonicalToolJsonSchema(inputSchema) {
|
|
685
|
+
return isRecord(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
|
|
686
|
+
}
|
|
687
|
+
function publicToolInputSchemaForDescribe(inputSchema) {
|
|
688
|
+
const exposesProviderSpend = (description) => {
|
|
689
|
+
const withoutDeeplineCredits = description.replace(
|
|
690
|
+
/\bdeepline(?:-facing)?\s+credits?\b/gi,
|
|
691
|
+
""
|
|
692
|
+
);
|
|
693
|
+
return /\bcredits?\b/i.test(withoutDeeplineCredits) || /\bprovider\s+(?:cost|spend|price|pricing|usage)\b/i.test(
|
|
694
|
+
withoutDeeplineCredits
|
|
695
|
+
) || /\b(?:costs?|charges?|priced at)\s+[$€£]\s*\d/i.test(
|
|
696
|
+
withoutDeeplineCredits
|
|
697
|
+
) || /\b(?:costs?|charges?|priced at)\s+\d+(?:\.\d+)?\s*(?:usd|eur|gbp)\b/i.test(
|
|
698
|
+
withoutDeeplineCredits
|
|
699
|
+
) || /\battribute-priced\b/i.test(withoutDeeplineCredits) || /\b(?:cost|price|pricing)\s+(?:grows?|increases?|scales?|varies?)\b/i.test(
|
|
700
|
+
withoutDeeplineCredits
|
|
701
|
+
) || /\b(?:will be|are|is|be)\s+(?:billed|charged)\b/i.test(
|
|
702
|
+
withoutDeeplineCredits
|
|
703
|
+
) || /\b(?:additional|extra)\s+charges?\b/i.test(withoutDeeplineCredits) || /\bcharg(?:e|ed)\s+(?:double|per)\b/i.test(withoutDeeplineCredits) || /\bpricing page\b/i.test(withoutDeeplineCredits);
|
|
704
|
+
};
|
|
705
|
+
const stripDescriptions = (value2) => {
|
|
706
|
+
if (Array.isArray(value2)) return value2.map(stripDescriptions);
|
|
707
|
+
if (!isRecord(value2)) return value2;
|
|
708
|
+
return Object.fromEntries(
|
|
709
|
+
Object.entries(value2).flatMap(([key, nested]) => {
|
|
710
|
+
if (key === "description" && typeof nested === "string" && exposesProviderSpend(nested)) {
|
|
711
|
+
return [];
|
|
712
|
+
}
|
|
713
|
+
return [[key, stripDescriptions(nested)]];
|
|
714
|
+
})
|
|
715
|
+
);
|
|
716
|
+
};
|
|
717
|
+
return stripDescriptions(inputSchema);
|
|
718
|
+
}
|
|
719
|
+
function recursiveToolInputFieldsForDisplay(inputSchema) {
|
|
720
|
+
const root = canonicalToolJsonSchema(inputSchema);
|
|
721
|
+
const fields = /* @__PURE__ */ new Map();
|
|
722
|
+
const schemasById = /* @__PURE__ */ new Map();
|
|
723
|
+
const collectSchemaIds = (value2) => {
|
|
724
|
+
if (Array.isArray(value2)) {
|
|
725
|
+
for (const item of value2) collectSchemaIds(item);
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
if (!isRecord(value2)) return;
|
|
729
|
+
if (typeof value2.$id === "string" && value2.$id.trim()) {
|
|
730
|
+
schemasById.set(value2.$id.trim(), value2);
|
|
731
|
+
}
|
|
732
|
+
for (const nested of Object.values(value2)) collectSchemaIds(nested);
|
|
733
|
+
};
|
|
734
|
+
collectSchemaIds(root);
|
|
735
|
+
const resolveRef = (schema) => {
|
|
736
|
+
const ref = typeof schema.$ref === "string" ? schema.$ref : "";
|
|
737
|
+
if (!ref.startsWith("#/")) return _nullishCoalesce(schemasById.get(ref), () => ( schema));
|
|
738
|
+
let current = root;
|
|
739
|
+
for (const rawSegment of ref.slice(2).split("/")) {
|
|
740
|
+
const segment = rawSegment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
741
|
+
if (!isRecord(current)) return schema;
|
|
742
|
+
current = current[segment];
|
|
743
|
+
}
|
|
744
|
+
return isRecord(current) ? current : schema;
|
|
745
|
+
};
|
|
746
|
+
const addField = (field) => {
|
|
747
|
+
const name = typeof field.name === "string" ? field.name : "";
|
|
748
|
+
if (!name) return;
|
|
749
|
+
const existing = fields.get(name);
|
|
750
|
+
if (!existing || existing.type === "unknown") {
|
|
751
|
+
fields.set(name, field);
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
const visit = (unresolvedSchema, path, required, activeRefs = /* @__PURE__ */ new Set()) => {
|
|
755
|
+
const ref = typeof unresolvedSchema.$ref === "string" ? unresolvedSchema.$ref : "";
|
|
756
|
+
if (ref && activeRefs.has(ref)) return;
|
|
757
|
+
const schema = resolveRef(unresolvedSchema);
|
|
758
|
+
const nextActiveRefs = ref ? /* @__PURE__ */ new Set([...activeRefs, ref]) : activeRefs;
|
|
759
|
+
const type = Array.isArray(schema.type) ? schema.type.map(String).join("|") : typeof schema.type === "string" ? schema.type : isRecord(schema.properties) ? "object" : schema.items ? "array" : "unknown";
|
|
760
|
+
if (path) {
|
|
761
|
+
addField({
|
|
762
|
+
name: path,
|
|
763
|
+
type,
|
|
764
|
+
required,
|
|
765
|
+
description: schema.description,
|
|
766
|
+
...Array.isArray(schema.enum) ? { enum: schema.enum } : {},
|
|
767
|
+
...isRecord(schema.items) ? { items: schema.items } : {},
|
|
768
|
+
...typeof schema.minItems === "number" ? { minItems: schema.minItems } : {},
|
|
769
|
+
...typeof schema.maxItems === "number" ? { maxItems: schema.maxItems } : {},
|
|
770
|
+
...Object.prototype.hasOwnProperty.call(schema, "default") ? { default: schema.default } : {}
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
const properties = isRecord(schema.properties) ? schema.properties : {};
|
|
774
|
+
const requiredNames = new Set(
|
|
775
|
+
Array.isArray(schema.required) ? schema.required.map(String) : []
|
|
776
|
+
);
|
|
777
|
+
for (const [name, value2] of Object.entries(properties)) {
|
|
778
|
+
if (!isRecord(value2)) continue;
|
|
779
|
+
visit(
|
|
780
|
+
value2,
|
|
781
|
+
path ? `${path}.${name}` : name,
|
|
782
|
+
requiredNames.has(name),
|
|
783
|
+
nextActiveRefs
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
if (isRecord(schema.items)) {
|
|
787
|
+
visit(schema.items, `${path}[]`, false, nextActiveRefs);
|
|
788
|
+
}
|
|
789
|
+
for (const keyword of ["anyOf", "oneOf", "allOf"]) {
|
|
790
|
+
const branches = Array.isArray(schema[keyword]) ? schema[keyword] : [];
|
|
791
|
+
for (const branch of branches) {
|
|
792
|
+
if (isRecord(branch)) {
|
|
793
|
+
visit(branch, path, required, nextActiveRefs);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
visit(root, "", false);
|
|
799
|
+
return fields.size ? [...fields.values()] : toolInputFieldsForDisplay(inputSchema);
|
|
800
|
+
}
|
|
801
|
+
function inputFieldJsonForDescribe(field) {
|
|
802
|
+
const publicItems = isRecord(field.items) ? publicToolInputSchemaForDescribe({ items: field.items }).items : void 0;
|
|
803
|
+
return {
|
|
804
|
+
name: field.name,
|
|
805
|
+
type: _nullishCoalesce(field.type, () => ( "unknown")),
|
|
806
|
+
required: Boolean(field.required),
|
|
807
|
+
...field.description ? { description: field.description } : {},
|
|
808
|
+
...isRecord(publicItems) ? { items: publicItems } : {},
|
|
809
|
+
...typeof field.minItems === "number" ? { minItems: field.minItems } : {},
|
|
810
|
+
...typeof field.maxItems === "number" ? { maxItems: field.maxItems } : {},
|
|
811
|
+
...Object.prototype.hasOwnProperty.call(field, "default") ? { default: field.default } : {}
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
function isRecord(value2) {
|
|
815
|
+
return Boolean(value2 && typeof value2 === "object" && !Array.isArray(value2));
|
|
816
|
+
}
|
|
817
|
+
function stringField(source, ...keys) {
|
|
818
|
+
for (const key of keys) {
|
|
819
|
+
const value2 = source[key];
|
|
820
|
+
if (typeof value2 === "string" && value2.trim()) return value2.trim();
|
|
821
|
+
}
|
|
822
|
+
return "";
|
|
823
|
+
}
|
|
824
|
+
function arrayField(source, ...keys) {
|
|
825
|
+
for (const key of keys) {
|
|
826
|
+
const value2 = source[key];
|
|
827
|
+
if (Array.isArray(value2)) return value2;
|
|
828
|
+
}
|
|
829
|
+
return [];
|
|
830
|
+
}
|
|
831
|
+
function recordField(source, ...keys) {
|
|
832
|
+
for (const key of keys) {
|
|
833
|
+
const value2 = source[key];
|
|
834
|
+
if (isRecord(value2)) return value2;
|
|
835
|
+
}
|
|
836
|
+
return {};
|
|
837
|
+
}
|
|
838
|
+
function starterScriptJson(script) {
|
|
839
|
+
return {
|
|
840
|
+
path: script.path,
|
|
841
|
+
sourceCode: script.sourceCode,
|
|
842
|
+
projectDir: script.projectDir,
|
|
843
|
+
copyToProject: {
|
|
844
|
+
macosLinux: script.macCopyCommand,
|
|
845
|
+
windowsPowerShell: script.windowsCopyCommand
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// src/cli/commands/model-description.ts
|
|
851
|
+
function formatModelDescription(description) {
|
|
852
|
+
const lines = [];
|
|
853
|
+
lines.push(description.model);
|
|
854
|
+
lines.push(`Provider: ${description.provider}`);
|
|
855
|
+
const name = stringField2(description.modelMetadata, "name");
|
|
856
|
+
if (name) lines.push(`Name: ${name}`);
|
|
857
|
+
const contextWindow = numberField(
|
|
858
|
+
description.modelMetadata,
|
|
859
|
+
"context_window"
|
|
860
|
+
);
|
|
861
|
+
if (contextWindow !== null) lines.push(`Context: ${contextWindow}`);
|
|
862
|
+
const tags = arrayField2(description.modelMetadata, "tags").filter(
|
|
863
|
+
(value2) => typeof value2 === "string"
|
|
864
|
+
);
|
|
865
|
+
if (tags.length) lines.push(`Tags: ${tags.join(", ")}`);
|
|
866
|
+
lines.push("");
|
|
867
|
+
lines.push("Provider options:");
|
|
868
|
+
appendNamespace(lines, description.providerOptions.gateway);
|
|
869
|
+
if (description.providerOptions.selectedProvider) {
|
|
870
|
+
appendNamespace(lines, description.providerOptions.selectedProvider);
|
|
871
|
+
}
|
|
872
|
+
lines.push("");
|
|
873
|
+
lines.push("Example input:");
|
|
874
|
+
lines.push(JSON.stringify(description.exampleInput, null, 2));
|
|
875
|
+
if (description.caveats.length) {
|
|
876
|
+
lines.push("");
|
|
877
|
+
lines.push("Caveats:");
|
|
878
|
+
for (const caveat of description.caveats) {
|
|
879
|
+
lines.push(`- ${caveat}`);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return `${lines.join("\n")}
|
|
883
|
+
`;
|
|
884
|
+
}
|
|
885
|
+
function appendNamespace(lines, namespace) {
|
|
886
|
+
lines.push(`- ${namespace.provider} (${namespace.sourceSymbol})`);
|
|
887
|
+
for (const field of namespace.fields) {
|
|
888
|
+
const values = _optionalChain([field, 'access', _8 => _8.enumValues, 'optionalAccess', _9 => _9.length]) ? ` (${field.enumValues.map((value2) => JSON.stringify(value2)).join(" | ")})` : "";
|
|
889
|
+
lines.push(
|
|
890
|
+
` - ${field.name}: ${field.type}${values} - ${field.description}`
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
function stringField2(value2, key) {
|
|
895
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return null;
|
|
896
|
+
const candidate = value2[key];
|
|
897
|
+
return typeof candidate === "string" && candidate.trim() ? candidate.trim() : null;
|
|
898
|
+
}
|
|
899
|
+
function numberField(value2, key) {
|
|
900
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return null;
|
|
901
|
+
const candidate = value2[key];
|
|
902
|
+
return typeof candidate === "number" ? candidate : null;
|
|
903
|
+
}
|
|
904
|
+
function arrayField2(value2, key) {
|
|
905
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return [];
|
|
906
|
+
const candidate = value2[key];
|
|
907
|
+
return Array.isArray(candidate) ? candidate : [];
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
exports.isPlayLikeTool = isPlayLikeTool; exports.isMonitorTypeTool = isMonitorTypeTool; exports.playReferenceForTool = playReferenceForTool; exports.playSearchCommandForToolId = playSearchCommandForToolId; exports.playRunCommandForTool = playRunCommandForTool; exports.toolContractJsonForDescribe = toolContractJsonForDescribe; exports.publicToolSchemas = publicToolSchemas; exports.describedTool = describedTool; exports.samplePayloadForInputFields = samplePayloadForInputFields; exports.playResultExpression = playResultExpression; exports.toolMetadataJsonForDescribe = toolMetadataJsonForDescribe; exports.toolInputFieldsForDisplay = toolInputFieldsForDisplay; exports.toolOutputFieldsForDisplay = toolOutputFieldsForDisplay; exports.recursiveToolInputFieldsForDisplay = recursiveToolInputFieldsForDisplay; exports.isRecord = isRecord; exports.stringField = stringField; exports.arrayField = arrayField; exports.recordField = recordField; exports.formatModelDescription = formatModelDescription;
|