deepline 0.3.463 → 0.3.464
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/play.ts +3 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +16 -2
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +98 -0
- package/dist/bundling-sources/shared_libs/plays/field-catalog.ts +353 -52
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +63 -3
- package/dist/cli/{auth-LZLBR4C3.mjs → auth-GMSI6QWR.mjs} +5 -5
- package/dist/cli/auth-P4E7M3AV.js +41 -0
- package/dist/cli/{billing-OTOP5RE4.mjs → billing-6G2RFLM7.mjs} +6 -6
- package/dist/cli/{billing-6TJPNJQD.js → billing-MGH36CNP.js} +77 -77
- package/dist/cli/{chunk-5DRNNC72.js → chunk-2RFTOESC.js} +5 -5
- package/dist/cli/{chunk-NDHJR2WZ.js → chunk-3AIMFE3Z.js} +36 -36
- package/dist/cli/{chunk-S4XQCFES.mjs → chunk-3MKRAI6R.mjs} +5 -5
- package/dist/cli/{chunk-NTLI6P6Y.mjs → chunk-44BEFU62.mjs} +2 -2
- package/dist/cli/{chunk-3BOIOCNX.js → chunk-4XNXFHG6.js} +1 -1
- package/dist/cli/{chunk-F2RHUPVH.mjs → chunk-5CKIO7KA.mjs} +1 -1
- package/dist/cli/{chunk-2ZIRCBYG.js → chunk-5XIGEYYK.js} +6 -6
- package/dist/cli/{chunk-WUMIYOXQ.mjs → chunk-6A7OH2PV.mjs} +2 -2
- package/dist/cli/{chunk-3BVLLJ3H.mjs → chunk-6COF5LIE.mjs} +2 -2
- package/dist/cli/{chunk-O3BJYD6D.mjs → chunk-6E2KNNTD.mjs} +2 -2
- package/dist/cli/{chunk-UIURR26V.mjs → chunk-6KDOO7IM.mjs} +4 -4
- package/dist/cli/{chunk-5LEAXRHV.js → chunk-6P4OYABU.js} +54 -226
- package/dist/cli/chunk-7YDN6AEK.mjs +649 -0
- package/dist/cli/{chunk-UROQDCVW.js → chunk-ACZLDP7L.js} +3 -3
- package/dist/cli/{chunk-UC4SFYNU.js → chunk-BMUDQMYE.js} +6 -6
- package/dist/cli/{chunk-DHXCBITQ.mjs → chunk-CUZVOPPY.mjs} +3 -3
- package/dist/cli/{chunk-CTQ56DXP.mjs → chunk-DO3FSI4C.mjs} +1 -1
- package/dist/cli/{chunk-2NISBXMN.js → chunk-E4QJKJH6.js} +51 -51
- package/dist/cli/{chunk-WUZS2HK6.js → chunk-EQNJUG3N.js} +53 -53
- package/dist/cli/{chunk-CBZP6J3V.js → chunk-FEWZT4RV.js} +21 -21
- package/dist/cli/{chunk-NAPTMYTY.js → chunk-FVAB2JRO.js} +8 -8
- package/dist/cli/{chunk-BGNWI3KH.js → chunk-GVJVBBGV.js} +3 -3
- package/dist/cli/{chunk-GUT7CLOL.mjs → chunk-HGUHBLX5.mjs} +3 -3
- package/dist/cli/{chunk-6PMCRYDA.js → chunk-HIMV32ZX.js} +6 -4
- package/dist/cli/{chunk-MSY22NQW.mjs → chunk-I2TCWIW2.mjs} +44 -216
- package/dist/cli/{chunk-XDWS2JJT.mjs → chunk-J327QVQV.mjs} +1 -1
- package/dist/cli/chunk-JLZKF7EY.js +649 -0
- package/dist/cli/{chunk-FK2HNDCN.js → chunk-K3BARC72.js} +2 -2
- package/dist/cli/{chunk-TIRBDQ3W.js → chunk-K4DVRQTY.js} +16 -16
- package/dist/cli/{chunk-XQCTG5OO.js → chunk-L3U44YVO.js} +5 -5
- package/dist/cli/{chunk-XW2JIYG7.mjs → chunk-M4QVY6RW.mjs} +2 -2
- package/dist/cli/{chunk-I624J4H5.mjs → chunk-MP3O4ISC.mjs} +1 -1
- package/dist/cli/{chunk-3U5EAP6E.mjs → chunk-MQNBOSQP.mjs} +5 -5
- package/dist/cli/{chunk-TKAQR3IB.mjs → chunk-MUQAKLBP.mjs} +1 -1
- package/dist/cli/{chunk-YGGIZ3VT.js → chunk-NI3QFUK7.js} +4 -4
- package/dist/cli/{chunk-BAPTQDLF.mjs → chunk-O4AOYLZE.mjs} +2 -2
- package/dist/cli/{chunk-5LHXOIPT.js → chunk-O4ZMADW4.js} +7 -7
- package/dist/cli/{chunk-7D6X7IXW.mjs → chunk-OA7IIOLW.mjs} +4 -4
- package/dist/cli/{chunk-VPHN2HAL.mjs → chunk-OGCAGZXO.mjs} +6 -4
- package/dist/cli/{chunk-C25QE4CH.mjs → chunk-PPQL5F4P.mjs} +1 -1
- package/dist/cli/{chunk-4YZKBBLZ.mjs → chunk-RFOQRCMW.mjs} +5 -5
- package/dist/cli/{chunk-LYFKBLJI.mjs → chunk-TMVBBGSK.mjs} +1 -1
- package/dist/cli/{chunk-PVY4DPPF.js → chunk-TU3M7UXJ.js} +13 -13
- package/dist/cli/{chunk-VDGTTH7K.mjs → chunk-UM363DQF.mjs} +2 -2
- package/dist/cli/{chunk-VY2GBNTX.js → chunk-UOAHDEAI.js} +9 -9
- package/dist/cli/{chunk-RD6IQ2JY.mjs → chunk-VQHEMZ33.mjs} +1 -1
- package/dist/cli/{chunk-IKWRUNAP.mjs → chunk-VYDOPASG.mjs} +1 -1
- package/dist/cli/{chunk-JVDKZJUH.js → chunk-VZX4P5FT.js} +258 -258
- package/dist/cli/{chunk-ALZBANZI.js → chunk-WLIFUH6W.js} +8 -8
- package/dist/cli/{chunk-7FCYPAPP.js → chunk-X3XJ6ZSJ.js} +2 -2
- package/dist/cli/{chunk-CVQ7N5CV.mjs → chunk-XMDBN2K7.mjs} +11 -11
- package/dist/cli/{chunk-RGOUCIIZ.js → chunk-ZAB6KCZW.js} +3 -3
- package/dist/cli/{chunk-SKU6ECIY.js → chunk-ZIMCLWEW.js} +5 -5
- package/dist/cli/{chunk-7XYDDCQ2.js → chunk-ZQERHPZA.js} +26 -26
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-OK45Z5XQ.mjs → csv-4ZVMBOCK.mjs} +4 -4
- package/dist/cli/{csv-EH5QWR4O.js → csv-W2JPV57R.js} +13 -13
- package/dist/cli/{db-3ESJKETS.js → db-6YNFDHEW.js} +27 -27
- package/dist/cli/{db-6Z5E4HKN.mjs → db-TVK6BLRB.mjs} +6 -6
- package/dist/cli/describe-APW5TWBT.js +48 -0
- package/dist/cli/{describe-PNDQB7YS.mjs → describe-JFN4ECPO.mjs} +20 -20
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-2NTWQFEG.mjs → executions-2FK4FFKE.mjs} +6 -6
- package/dist/cli/{executions-KUOBRX5V.js → executions-J4CAN7RB.js} +8 -8
- package/dist/cli/{feedback-7RPRMSGY.mjs → feedback-EYRRLA2P.mjs} +4 -4
- package/dist/cli/{feedback-UPHAZJ4C.js → feedback-NOO4OM4U.js} +8 -8
- package/dist/cli/{git-SCYP6WSZ.mjs → git-D3Q4JKBC.mjs} +5 -5
- package/dist/cli/git-FPF6DT43.js +25 -0
- package/dist/cli/index.js +139 -139
- package/dist/cli/index.mjs +41 -41
- package/dist/cli/{legacy-noops-7XMFCVRG.js → legacy-noops-5ZGRKSN3.js} +8 -8
- package/dist/cli/{legacy-noops-A4KYAGI6.mjs → legacy-noops-SUFJWBLZ.mjs} +5 -5
- package/dist/cli/{monitors-NZV6IX5H.js → monitors-3QFJZA6Z.js} +91 -91
- package/dist/cli/{monitors-FLC5J7RI.mjs → monitors-IRDIIR6J.mjs} +7 -7
- package/dist/cli/{org-IZ7UP3XF.js → org-275OJJ7W.js} +68 -68
- package/dist/cli/{org-LUETJ7Z5.mjs → org-2VA2FSMG.mjs} +6 -6
- package/dist/cli/{pages-22ML3O7O.js → pages-SPRBOZRA.js} +17 -17
- package/dist/cli/{pages-EUX5EAGF.mjs → pages-WCUEBFYU.mjs} +6 -6
- package/dist/cli/{play-CDHPAKKM.mjs → play-7UL5H6QU.mjs} +18 -18
- package/dist/cli/{play-USJBQADG.js → play-NMHUWBET.js} +305 -305
- package/dist/cli/{providers-WFEUNPGC.js → providers-72LUJEAT.js} +9 -9
- package/dist/cli/{providers-CCXZ3SQF.mjs → providers-WSCKV557.mjs} +6 -6
- package/dist/cli/{quickstart-ZUULI635.mjs → quickstart-K4LAKJKJ.mjs} +4 -4
- package/dist/cli/{quickstart-O4JSUORZ.js → quickstart-XSUUAE2Y.js} +6 -6
- package/dist/cli/{run-ISDJYJMU.js → run-MLV2CLW7.js} +40 -40
- package/dist/cli/{run-QJ4NX5F5.mjs → run-R2MOXXHH.mjs} +25 -25
- package/dist/cli/search-AYFUV6YV.js +32 -0
- package/dist/cli/{search-IX3XKZJ3.mjs → search-WHJZNWKE.mjs} +7 -7
- package/dist/cli/{secrets-ELQSNCTR.js → secrets-7PXFBOFY.js} +15 -15
- package/dist/cli/{secrets-7VUDXTUZ.mjs → secrets-YGVOFLI5.mjs} +6 -6
- package/dist/cli/{sessions-A3FG3AZX.js → sessions-ASXXZI42.js} +6 -6
- package/dist/cli/{sessions-VOIQ62GB.mjs → sessions-G7I54W4L.mjs} +5 -5
- package/dist/cli/{settings-S6N6EFBG.mjs → settings-4GFO6JYO.mjs} +11 -11
- package/dist/cli/{settings-ZTXQEMZI.js → settings-RTEBMDPC.js} +78 -78
- package/dist/cli/{setup-AYPIK4JE.mjs → setup-4RJGKSDC.mjs} +9 -9
- package/dist/cli/{setup-Y3WOIFLS.js → setup-A6V2MJK7.js} +44 -44
- package/dist/cli/{skills-5SF5QWNI.mjs → skills-432W6EGS.mjs} +7 -7
- package/dist/cli/skills-GOQECD7H.js +31 -0
- package/dist/cli/tools-JXYN7WOE.js +55 -0
- package/dist/cli/{tools-3XNZ4J64.mjs → tools-SABREK3C.mjs} +18 -18
- package/dist/cli/update-BSB4TJER.js +33 -0
- package/dist/cli/{update-3U4OVX5R.mjs → update-F7NO5RDW.mjs} +9 -9
- package/dist/cli/{workflow-2M5JP7SA.mjs → workflow-F4N7CFUX.mjs} +7 -7
- package/dist/cli/{workflow-RM7H7555.js → workflow-TF6YDWTM.js} +17 -17
- package/dist/{client-DTwnz_AW.d.mts → client-ADFHNtFM.d.mts} +1 -1
- package/dist/{client-DS2IWYZF.d.ts → client-BClp2yrq.d.ts} +1 -1
- package/dist/{client-core-B_6HAIBy.d.ts → client-core-BFU73Ttw.d.ts} +1 -1
- package/dist/{client-core-DzBSlY1U.d.mts → client-core-DWLmmJWo.d.mts} +1 -1
- package/dist/{compiler-manifest-Dcyd3-Zd.d.ts → compiler-manifest-Cs17yO-H.d.mts} +321 -3
- package/dist/{compiler-manifest-Dcyd3-Zd.d.mts → compiler-manifest-Cs17yO-H.d.ts} +321 -3
- package/dist/{errors-yQwfgrcX.d.ts → errors-Dee-QpVS.d.ts} +1 -1
- package/dist/{errors-d-sTrZhe.d.mts → errors-qNfvQuRB.d.mts} +1 -1
- package/dist/{index-C6oXchjN.d.mts → index-BTqNNXmC.d.mts} +1 -1
- package/dist/{index-P56zy_z5.d.ts → index-DXTh1Lxe.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +80 -13
- package/dist/index.mjs +76 -9
- package/dist/install-integrity.json +114 -114
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- 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/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-XPGKBJKB.js +0 -41
- package/dist/cli/chunk-NA4T3B62.js +0 -286
- package/dist/cli/chunk-TXZVVBQZ.mjs +0 -286
- package/dist/cli/describe-QUF7VTTR.js +0 -48
- package/dist/cli/git-UH653WHV.js +0 -25
- package/dist/cli/search-TIFNLRPM.js +0 -32
- package/dist/cli/skills-MWFRMG3H.js +0 -31
- package/dist/cli/tools-XEC4OD3R.js +0 -55
- package/dist/cli/update-DWYEYTZE.js +0 -33
|
@@ -1498,6 +1498,8 @@ function extractorDescriptorRecord(
|
|
|
1498
1498
|
.map((entry) => entry.trim())
|
|
1499
1499
|
.filter(Boolean);
|
|
1500
1500
|
const emailStatus = emailStatusExtractorConfig(descriptor.emailStatus);
|
|
1501
|
+
const means =
|
|
1502
|
+
typeof descriptor.means === 'string' ? descriptor.means : undefined;
|
|
1501
1503
|
return [
|
|
1502
1504
|
[
|
|
1503
1505
|
key,
|
|
@@ -1506,6 +1508,7 @@ function extractorDescriptorRecord(
|
|
|
1506
1508
|
...(transforms.length > 0 ? { transforms } : {}),
|
|
1507
1509
|
...(enumValues.length > 0 ? { enum: enumValues } : {}),
|
|
1508
1510
|
...(emailStatus ? { emailStatus } : {}),
|
|
1511
|
+
...(means !== undefined ? { means } : {}),
|
|
1509
1512
|
},
|
|
1510
1513
|
],
|
|
1511
1514
|
];
|
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.464',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -705,7 +705,9 @@ const TOOL_RETRY_AFTER_FALLBACK_MS = 1_000;
|
|
|
705
705
|
// broken gateway-to-runner connection, not slow provider work.
|
|
706
706
|
export const TOOL_EXECUTE_RESPONSE_BODY_TIMEOUT_MS = 30_000;
|
|
707
707
|
const TOOL_RETRY_HEARTBEAT_INTERVAL_MS = 30_000;
|
|
708
|
-
|
|
708
|
+
// Avoid paying sandbox startup and checkpoint replay for ordinary provider
|
|
709
|
+
// holds. Bound cumulative residency so sustained holds still park durably.
|
|
710
|
+
const TOOL_PROVIDER_RESIDENT_WAIT_BUDGET_MS = 10 * 60_000;
|
|
709
711
|
// The call already waited its whole admission budget in this sandbox, so it
|
|
710
712
|
// rejoins the shared lane promptly instead of adding a fixed delay of its own.
|
|
711
713
|
const PROVIDER_ADMISSION_REQUEUE_DELAY_MS = 1_000;
|
|
@@ -4932,6 +4932,20 @@ async function buildRuntimeSheetDatasetStartResult(
|
|
|
4932
4932
|
);
|
|
4933
4933
|
return Object.keys(cells).length ? [{ key, cells }] : [];
|
|
4934
4934
|
});
|
|
4935
|
+
// History readers (`datasetRowInput: current_run`) seed rows from authored
|
|
4936
|
+
// input plus `__deepline*` runtime fields only and read stored output through
|
|
4937
|
+
// `previousCells`. Merging that output into the rows too would send every
|
|
4938
|
+
// completed cell twice and can push a resume admission past its byte budget.
|
|
4939
|
+
const rowFieldsForReader = (
|
|
4940
|
+
data: Record<string, unknown>,
|
|
4941
|
+
): Record<string, unknown> =>
|
|
4942
|
+
input.includePreviousCells
|
|
4943
|
+
? Object.fromEntries(
|
|
4944
|
+
Object.entries(data).filter(([field]) =>
|
|
4945
|
+
field.startsWith('__deepline'),
|
|
4946
|
+
),
|
|
4947
|
+
)
|
|
4948
|
+
: data;
|
|
4935
4949
|
const buildFreshRow = (entry: RuntimeDatasetRowEntry) => {
|
|
4936
4950
|
const row: Record<string, unknown> = {
|
|
4937
4951
|
...sanitizePostgresJsonValue(entry.row),
|
|
@@ -5024,7 +5038,7 @@ async function buildRuntimeSheetDatasetStartResult(
|
|
|
5024
5038
|
}
|
|
5025
5039
|
completedRows.push({
|
|
5026
5040
|
...entry.row,
|
|
5027
|
-
...stored,
|
|
5041
|
+
...rowFieldsForReader(stored),
|
|
5028
5042
|
__deeplineRowKey: entry.key,
|
|
5029
5043
|
});
|
|
5030
5044
|
} else if (disposition === 'blocked') {
|
|
@@ -5056,7 +5070,7 @@ async function buildRuntimeSheetDatasetStartResult(
|
|
|
5056
5070
|
const buildMergedRow = (entry: RuntimeDatasetRowEntry) => {
|
|
5057
5071
|
const merged = { ...entry.row };
|
|
5058
5072
|
for (const [field, value] of Object.entries(
|
|
5059
|
-
persistedRowsByKey.get(entry.key) ?? {},
|
|
5073
|
+
rowFieldsForReader(persistedRowsByKey.get(entry.key) ?? {}),
|
|
5060
5074
|
)) {
|
|
5061
5075
|
if (
|
|
5062
5076
|
value !== null ||
|
|
@@ -32,6 +32,12 @@ import {
|
|
|
32
32
|
type JobChangeGetterValue,
|
|
33
33
|
type JobChangeStatus,
|
|
34
34
|
} from '../plays/extractor-targets';
|
|
35
|
+
import {
|
|
36
|
+
fieldOfName,
|
|
37
|
+
fieldPaths,
|
|
38
|
+
resolveFieldName,
|
|
39
|
+
type FieldBinding,
|
|
40
|
+
} from '../plays/field-catalog';
|
|
35
41
|
import type {
|
|
36
42
|
BasicToolExecuteResult,
|
|
37
43
|
BasicToolResultListAccessor,
|
|
@@ -520,6 +526,10 @@ function parseExecuteToolMetadata(
|
|
|
520
526
|
!Array.isArray(recordEntry.emailStatus)
|
|
521
527
|
? (recordEntry.emailStatus as EmailStatusExtractorConfig)
|
|
522
528
|
: undefined;
|
|
529
|
+
const means =
|
|
530
|
+
typeof recordEntry.means === 'string'
|
|
531
|
+
? recordEntry.means
|
|
532
|
+
: undefined;
|
|
523
533
|
return [
|
|
524
534
|
[
|
|
525
535
|
key,
|
|
@@ -544,6 +554,7 @@ function parseExecuteToolMetadata(
|
|
|
544
554
|
: {}),
|
|
545
555
|
...(overrides.length > 0 ? { overrides } : {}),
|
|
546
556
|
...(emailStatus ? { emailStatus } : {}),
|
|
557
|
+
...(means !== undefined ? { means } : {}),
|
|
547
558
|
},
|
|
548
559
|
],
|
|
549
560
|
];
|
|
@@ -1540,6 +1551,71 @@ function listTableNamespace(
|
|
|
1540
1551
|
}
|
|
1541
1552
|
}
|
|
1542
1553
|
|
|
1554
|
+
/**
|
|
1555
|
+
* The outputs of a result that are catalog fields: declared extractors whose
|
|
1556
|
+
* meaning is known, from the tool's own `means` or the name's one meaning.
|
|
1557
|
+
* Values found by guessing at keys are never bindings.
|
|
1558
|
+
*/
|
|
1559
|
+
function resultFieldBindings(
|
|
1560
|
+
result: ToolExecuteResult | BasicToolExecuteResult,
|
|
1561
|
+
): FieldBinding[] {
|
|
1562
|
+
const extractors = result._metadata.extractors ?? {};
|
|
1563
|
+
return Object.entries(extractors).flatMap(([name, descriptor]) => {
|
|
1564
|
+
if (!result.extractedValues[name]) return [];
|
|
1565
|
+
const id = fieldOfName(name, descriptor.means);
|
|
1566
|
+
return id ? [{ name, id }] : [];
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
function resultOutputNames(
|
|
1571
|
+
result: ToolExecuteResult | BasicToolExecuteResult,
|
|
1572
|
+
): string[] {
|
|
1573
|
+
return [
|
|
1574
|
+
...Object.keys(result._metadata.extractors ?? {}),
|
|
1575
|
+
...Object.keys(result.extractedLists),
|
|
1576
|
+
];
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
function readResultField(
|
|
1580
|
+
result: ToolExecuteResult | BasicToolExecuteResult,
|
|
1581
|
+
name: string,
|
|
1582
|
+
): unknown {
|
|
1583
|
+
const bindings = resultFieldBindings(result);
|
|
1584
|
+
const binding = resolveFieldName(name, bindings, resultOutputNames(result));
|
|
1585
|
+
if (!binding) {
|
|
1586
|
+
const ids = [...new Set(bindings.map((known) => known.id))];
|
|
1587
|
+
throw new Error(
|
|
1588
|
+
`${result._metadata.toolId} has no field "${name}". ${ids.length > 0 ? `Its fields: ${ids.join(', ')}.` : 'It declares no catalog fields.'} Other values are in result.response.`,
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
return result.extractedValues[binding.name]!.get();
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
/** `result.fields`, laid out by `fieldPaths`; each value reads on access. */
|
|
1595
|
+
function buildResultFields(
|
|
1596
|
+
result: ToolExecuteResult | BasicToolExecuteResult,
|
|
1597
|
+
): Record<string, unknown> {
|
|
1598
|
+
const tree: Record<string, unknown> = {};
|
|
1599
|
+
const lists = Object.keys(result.extractedLists);
|
|
1600
|
+
for (const entry of fieldPaths(
|
|
1601
|
+
resultFieldBindings(result),
|
|
1602
|
+
resultOutputNames(result),
|
|
1603
|
+
lists,
|
|
1604
|
+
)) {
|
|
1605
|
+
let node = tree;
|
|
1606
|
+
for (const key of entry.path.slice(0, -1)) {
|
|
1607
|
+
node = (node[key] ??= {}) as Record<string, unknown>;
|
|
1608
|
+
}
|
|
1609
|
+
Object.defineProperty(node, entry.path[entry.path.length - 1]!, {
|
|
1610
|
+
get: entry.list
|
|
1611
|
+
? () => result.extractedLists[entry.name]!.get()
|
|
1612
|
+
: () => readResultField(result, entry.name),
|
|
1613
|
+
enumerable: true,
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
return tree;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1543
1619
|
export function createToolExecuteResult<TResult = unknown>(input: {
|
|
1544
1620
|
status: string;
|
|
1545
1621
|
jobId?: string;
|
|
@@ -1614,11 +1690,33 @@ export function createToolExecuteResult<TResult = unknown>(input: {
|
|
|
1614
1690
|
extractedValues,
|
|
1615
1691
|
extractedLists,
|
|
1616
1692
|
} as ToolExecuteResult<TResult>;
|
|
1693
|
+
// Read through `this`, so copies made from these descriptors (the edition
|
|
1694
|
+
// projection, native batch views) read their own values.
|
|
1617
1695
|
Object.defineProperties(wrapper, {
|
|
1618
1696
|
toolOutput: {
|
|
1619
1697
|
value: toolResponse,
|
|
1620
1698
|
enumerable: false,
|
|
1621
1699
|
},
|
|
1700
|
+
response: {
|
|
1701
|
+
get(this: ToolExecuteResult) {
|
|
1702
|
+
return Object.hasOwn(this.toolResponse, 'rawV2')
|
|
1703
|
+
? this.toolResponse.rawV2
|
|
1704
|
+
: this.toolResponse.raw;
|
|
1705
|
+
},
|
|
1706
|
+
enumerable: false,
|
|
1707
|
+
},
|
|
1708
|
+
fields: {
|
|
1709
|
+
get(this: ToolExecuteResult) {
|
|
1710
|
+
return buildResultFields(this);
|
|
1711
|
+
},
|
|
1712
|
+
enumerable: false,
|
|
1713
|
+
},
|
|
1714
|
+
field: {
|
|
1715
|
+
value(this: ToolExecuteResult, name: string) {
|
|
1716
|
+
return readResultField(this, name);
|
|
1717
|
+
},
|
|
1718
|
+
enumerable: false,
|
|
1719
|
+
},
|
|
1622
1720
|
});
|
|
1623
1721
|
Object.defineProperty(wrapper, '_metadata', {
|
|
1624
1722
|
value: metadata,
|