deepline 0.3.328 → 0.3.329

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.
Files changed (122) hide show
  1. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  2. package/dist/bundling-sources/sdk/src/play.ts +55 -45
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +16 -0
  5. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
  6. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +31 -15
  8. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +22 -4
  9. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +29 -11
  10. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +145 -19
  11. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +37 -10
  12. package/dist/bundling-sources/shared_libs/plays/dataset.ts +3 -0
  13. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +59 -10
  14. package/dist/cli/{auth-ANHHABWT.mjs → auth-MFFVOITR.mjs} +4 -4
  15. package/dist/cli/auth-W2MQM6GQ.js +31 -0
  16. package/dist/cli/{billing-R6NYYO6G.mjs → billing-LRBHWLIQ.mjs} +4 -4
  17. package/dist/cli/{billing-GGVKLFE6.js → billing-V4Y4OVQ7.js} +70 -70
  18. package/dist/cli/{chunk-7MABE3ZK.mjs → chunk-3RZJ3GEG.mjs} +135 -5
  19. package/dist/cli/{chunk-UDIPEHNJ.js → chunk-4FLEXYUC.js} +141 -11
  20. package/dist/cli/{chunk-LJWC5HSO.js → chunk-75ZOTF3K.js} +15 -15
  21. package/dist/cli/{chunk-6ENR652E.mjs → chunk-7T6DX5RK.mjs} +21 -14
  22. package/dist/cli/{chunk-Y4LXIUHX.js → chunk-AD23W4S5.js} +1 -1
  23. package/dist/cli/{chunk-B2R66UTW.mjs → chunk-EROOAI5G.mjs} +1 -1
  24. package/dist/cli/{chunk-UM4ZE3P7.mjs → chunk-ERU2OR6F.mjs} +2 -2
  25. package/dist/cli/{chunk-YIY74KUF.mjs → chunk-EV4QJE4J.mjs} +1 -1
  26. package/dist/cli/{chunk-WWVE4HFN.mjs → chunk-FK7PW6BP.mjs} +1 -1
  27. package/dist/cli/{chunk-2HKPAZVJ.js → chunk-FKKNYKDY.js} +14 -3
  28. package/dist/cli/{chunk-YFCHBN3C.mjs → chunk-GCNER3HV.mjs} +1 -1
  29. package/dist/cli/{chunk-ITFUZEHE.js → chunk-GY2EEO2Y.js} +9 -9
  30. package/dist/cli/{chunk-GZV5F6CL.mjs → chunk-HI7TAWFS.mjs} +79 -26
  31. package/dist/cli/{chunk-AKKQ26RX.mjs → chunk-HVPRQGF4.mjs} +1 -1
  32. package/dist/cli/{chunk-ZFKUVDOM.js → chunk-J2E5R2VH.js} +60 -60
  33. package/dist/cli/{chunk-XVKQ6D4K.js → chunk-KHZQFFOQ.js} +2 -2
  34. package/dist/cli/{chunk-SMGNDW7O.mjs → chunk-MFQQINUY.mjs} +2 -2
  35. package/dist/cli/{chunk-ZND34HL7.mjs → chunk-MO2XSC5I.mjs} +4 -4
  36. package/dist/cli/{chunk-KP7W5NO6.mjs → chunk-NTVTZAVZ.mjs} +13 -2
  37. package/dist/cli/{chunk-7DDNACAQ.js → chunk-OUTIWGKY.js} +26 -26
  38. package/dist/cli/{chunk-7R6KQSFA.mjs → chunk-OZGU7P2S.mjs} +1 -1
  39. package/dist/cli/{chunk-BC7FMQ2G.mjs → chunk-SJV5MTOJ.mjs} +1 -1
  40. package/dist/cli/{chunk-DNMV2L7Q.js → chunk-U2N4CYT7.js} +6 -6
  41. package/dist/cli/{chunk-W6WV6UME.js → chunk-U4CTHVN7.js} +255 -248
  42. package/dist/cli/{chunk-AGH6YP2T.js → chunk-UQV5M6HN.js} +3 -3
  43. package/dist/cli/{chunk-O5GPNPOC.js → chunk-VDIHLKGG.js} +4 -4
  44. package/dist/cli/{chunk-DNYRAZSK.js → chunk-VLDLJZ75.js} +48 -48
  45. package/dist/cli/{chunk-2FPVWL4W.js → chunk-XRYKLK56.js} +119 -66
  46. package/dist/cli/{chunk-OOLIEDIJ.mjs → chunk-YNSCELIJ.mjs} +2 -2
  47. package/dist/cli/{chunk-LEEXRXQQ.js → chunk-ZXGUYTIT.js} +6 -6
  48. package/dist/cli/client-5AIFBLKQ.js +20 -0
  49. package/dist/cli/{client-ZABA5NMD.mjs → client-BNLD775D.mjs} +3 -3
  50. package/dist/cli/{csv-VECE3PWX.mjs → csv-7MVQECWG.mjs} +3 -3
  51. package/dist/cli/{csv-4ZK5ZJAJ.js → csv-ZT6ZRQ3Z.js} +12 -12
  52. package/dist/cli/{db-6VE4OEWW.mjs → db-ABLWLMX5.mjs} +4 -4
  53. package/dist/cli/{db-UJPCDBV7.js → db-C4BMZXJK.js} +29 -29
  54. package/dist/cli/{describe-W6X5G4JR.mjs → describe-XWOWAR32.mjs} +10 -10
  55. package/dist/cli/{describe-CFUZZ326.js → describe-YALVN4WH.js} +17 -17
  56. package/dist/cli/{executions-ZZWB75DF.mjs → executions-7IZVKQ3O.mjs} +4 -4
  57. package/dist/cli/{executions-AI4DTQQL.js → executions-U4TNRP26.js} +6 -6
  58. package/dist/cli/{feedback-IM5Z6T5K.mjs → feedback-GO5XPEKY.mjs} +3 -3
  59. package/dist/cli/{feedback-FYSNSYUU.js → feedback-NWMRT5W4.js} +6 -6
  60. package/dist/cli/{git-YNYTK3YW.mjs → git-R53WS4WA.mjs} +4 -4
  61. package/dist/cli/git-YWRLAOBY.js +23 -0
  62. package/dist/cli/index.js +79 -79
  63. package/dist/cli/index.mjs +31 -31
  64. package/dist/cli/{legacy-noops-4DTMYYUY.mjs → legacy-noops-6QAZW7WJ.mjs} +4 -4
  65. package/dist/cli/{legacy-noops-PHJE2XFK.js → legacy-noops-NJWM53DE.js} +7 -7
  66. package/dist/cli/{monitors-27JP76WE.js → monitors-2I2MYAPS.js} +85 -85
  67. package/dist/cli/{monitors-HUP4MVWJ.mjs → monitors-2N4BRU5M.mjs} +4 -4
  68. package/dist/cli/{org-L3B2RR4U.mjs → org-D3RHK2Q7.mjs} +4 -4
  69. package/dist/cli/{org-RHVDMUKN.js → org-XVNAE2JV.js} +60 -60
  70. package/dist/cli/{play-UXIJVYNF.mjs → play-L7MYJZ65.mjs} +9 -9
  71. package/dist/cli/play-OYRHI7G3.js +153 -0
  72. package/dist/cli/{providers-VL6VY56M.js → providers-5BTDAZHN.js} +7 -7
  73. package/dist/cli/{providers-FABWTNKR.mjs → providers-YM4E7WZD.mjs} +4 -4
  74. package/dist/cli/{quickstart-IIPZ6DSY.js → quickstart-5A3FHAH3.js} +5 -5
  75. package/dist/cli/{quickstart-OA54A4IE.mjs → quickstart-ARPLJOLH.mjs} +3 -3
  76. package/dist/cli/{search-YDK4V2EW.mjs → search-KKJEVV27.mjs} +5 -5
  77. package/dist/cli/search-VE3O3ZEM.js +26 -0
  78. package/dist/cli/{secrets-4MQF6RF6.mjs → secrets-DGRJ4DO5.mjs} +4 -4
  79. package/dist/cli/{secrets-JGU7ZRUW.js → secrets-DVPVCSZD.js} +13 -13
  80. package/dist/cli/{sessions-PTHOMSZ5.mjs → sessions-56EHXLZD.mjs} +4 -4
  81. package/dist/cli/{sessions-I7ZZYSYW.js → sessions-VG4ATQ5Y.js} +5 -5
  82. package/dist/cli/{settings-X4ENSGNK.mjs → settings-4U5XG7QI.mjs} +7 -7
  83. package/dist/cli/{settings-ZUUBKIG6.js → settings-BLOTIW2G.js} +74 -74
  84. package/dist/cli/{setup-6L576TQE.js → setup-L7AMAXCH.js} +41 -41
  85. package/dist/cli/{setup-4UM6FCZL.mjs → setup-RHJAHPOR.mjs} +6 -6
  86. package/dist/cli/skills-QB4OQGGP.js +28 -0
  87. package/dist/cli/{skills-U3BS5KUI.mjs → skills-VU55YFCI.mjs} +4 -4
  88. package/dist/cli/tools-2CPFYNK7.js +40 -0
  89. package/dist/cli/{tools-O4PX6UVB.mjs → tools-JS3YIDOH.mjs} +7 -6
  90. package/dist/cli/{update-OHWSK2WN.mjs → update-EHI5QUXM.mjs} +6 -6
  91. package/dist/cli/update-WXP24GU5.js +28 -0
  92. package/dist/cli/{workflow-RVMGBMLX.mjs → workflow-BITLTLRF.mjs} +5 -5
  93. package/dist/cli/{workflow-QWTZBLT3.js → workflow-NE4SYRAT.js} +15 -15
  94. package/dist/{client-wiWPZhnI.d.mts → client-D5XOQKsA.d.mts} +20 -1
  95. package/dist/{client-DHq8dJ56.d.ts → client-l-IoLh8Z.d.ts} +20 -1
  96. package/dist/{compiler-manifest-9TkZ_ykI.d.mts → compiler-manifest-82q4jtfQ.d.mts} +44 -17
  97. package/dist/{compiler-manifest-9TkZ_ykI.d.ts → compiler-manifest-82q4jtfQ.d.ts} +44 -17
  98. package/dist/{index-B-5_Xhud.d.mts → index-BPbW2XHF.d.mts} +1 -1
  99. package/dist/{index-ykksoEyR.d.ts → index-k0rquHIm.d.ts} +1 -1
  100. package/dist/index.d.mts +14 -8
  101. package/dist/index.d.ts +14 -8
  102. package/dist/index.js +194 -69
  103. package/dist/index.mjs +162 -37
  104. package/dist/install-integrity.json +84 -84
  105. package/dist/plays/bundle-play-file.d.mts +3 -3
  106. package/dist/plays/bundle-play-file.d.ts +3 -3
  107. package/dist/plays/bundle-play-file.mjs +2 -2
  108. package/dist/plays/run-request.d.mts +2 -2
  109. package/dist/plays/run-request.d.ts +2 -2
  110. package/dist/release.d.mts +1 -1
  111. package/dist/release.d.ts +1 -1
  112. package/dist/release.js +2 -2
  113. package/dist/release.mjs +1 -1
  114. package/package.json +2 -1
  115. package/dist/cli/auth-EKRB4GMP.js +0 -31
  116. package/dist/cli/client-55BDB4LE.js +0 -20
  117. package/dist/cli/git-VWXH6LCP.js +0 -23
  118. package/dist/cli/play-UKH4VFPF.js +0 -153
  119. package/dist/cli/search-JD2VTR4A.js +0 -26
  120. package/dist/cli/skills-TLPNCERR.js +0 -28
  121. package/dist/cli/tools-26JTFFU4.js +0 -39
  122. package/dist/cli/update-35RRCU2G.js +0 -28
@@ -32,6 +32,8 @@ import {
32
32
  type JobChangeStatus,
33
33
  } from '../plays/extractor-targets';
34
34
  import type {
35
+ BasicToolExecuteResult,
36
+ BasicToolResultListAccessor,
35
37
  SerializedToolExecuteResult,
36
38
  ToolExecuteResult,
37
39
  ToolResultBilling,
@@ -47,6 +49,7 @@ import type {
47
49
  import {
48
50
  createDeferredPlayDataset,
49
51
  createPlayDataset,
52
+ isPlayDataset,
50
53
  isSerializedPlayDataset,
51
54
  residentPlayDatasetRows,
52
55
  trimSerializedPlayDatasetPreview,
@@ -75,6 +78,116 @@ const SERIALIZED_TOOL_RESULT_LIST_PREVIEW_LIMIT = 5;
75
78
  const LIVE_TOOL_RESULT_LIST_DATASET_REGISTRY_LIMIT = 256;
76
79
  const SERIALIZED_TOOL_LIST_ROWS = Symbol('deepline.serialized_tool_list_rows');
77
80
 
81
+ // Artifact-specific array getters must not change the receipt's dataset
82
+ // descriptor or call a getter while serializing. Keep their backing private.
83
+ // The runner and customer SDK can be independently bundled copies. A module-
84
+ // local WeakMap cannot cross that boundary; a non-enumerable shared symbol can.
85
+ const ARRAY_GETTER_DATASET = Symbol.for('deepline.list_dataset');
86
+
87
+ function listAccessorDataset(
88
+ accessor: ToolResultListAccessor | BasicToolResultListAccessor,
89
+ ): PlayDataset<Record<string, unknown>> {
90
+ const dataset =
91
+ (
92
+ accessor as typeof accessor & {
93
+ [ARRAY_GETTER_DATASET]?: PlayDataset<Record<string, unknown>>;
94
+ }
95
+ )[ARRAY_GETTER_DATASET] ?? accessor.get();
96
+ if (!isPlayDataset(dataset)) {
97
+ throw new Error(
98
+ 'List accessor has no backing dataset for an explicit read.',
99
+ );
100
+ }
101
+ return dataset;
102
+ }
103
+
104
+ /**
105
+ * Reader-first policy selected at the Play boundary, not by the provider.
106
+ * The canonical receipt and editions 1–9 retain their dataset projection.
107
+ * Edition 10 exposes complete resident response lists as ordinary arrays.
108
+ */
109
+ export function projectToolResultListGetters(
110
+ result: ToolExecuteResult,
111
+ policy: 'array',
112
+ ): BasicToolExecuteResult;
113
+ export function projectToolResultListGetters(
114
+ result: ToolExecuteResult,
115
+ policy: 'dataset' | 'array',
116
+ ): ToolExecuteResult;
117
+ export function projectToolResultListGetters(
118
+ result: ToolExecuteResult,
119
+ policy: 'dataset' | 'array',
120
+ ): ToolExecuteResult | BasicToolExecuteResult {
121
+ if (policy === 'dataset') return result;
122
+ const extractedLists = Object.fromEntries(
123
+ Object.entries(result.extractedLists).map(([name, original]) => {
124
+ const dataset = listAccessorDataset(original);
125
+ const accessor = {
126
+ path: original.path,
127
+ count: original.count,
128
+ keys: original.keys,
129
+ };
130
+ Object.defineProperty(accessor, 'get', {
131
+ enumerable: false,
132
+ value() {
133
+ const rows = residentPlayDatasetRows(dataset);
134
+ if (
135
+ !rows ||
136
+ (original.count !== null && rows.length < original.count)
137
+ ) {
138
+ throw new Error(
139
+ `List getter ${name} cannot return a complete array: its rows are lazy or the retained response is incomplete. Use readList(result, ${JSON.stringify(original.path)}) to read the explicit dataset; never treat its preview as complete.`,
140
+ );
141
+ }
142
+ // Legacy dataset rows wrap scalar list items as {value}. A basic
143
+ // getter preserves the provider's array items, including primitives.
144
+ const canonicalRaw = Object.hasOwn(result.toolResponse, 'rawV2')
145
+ ? legacyRawFromToolResponseRawV2(
146
+ result.toolResponse.rawV2,
147
+ result.toolResponse.view ?? 'rawV2',
148
+ )
149
+ : result.toolResponse.raw;
150
+ for (const raw of [canonicalRaw, result.toolResponse.raw]) {
151
+ const originalRows = getAtPath(
152
+ { toolResponse: { raw } },
153
+ original.path,
154
+ );
155
+ if (
156
+ Array.isArray(originalRows) &&
157
+ originalRows.length === rows.length
158
+ ) {
159
+ return [...originalRows];
160
+ }
161
+ }
162
+ return [...rows];
163
+ },
164
+ });
165
+ Object.defineProperty(accessor, ARRAY_GETTER_DATASET, {
166
+ value: dataset,
167
+ enumerable: false,
168
+ });
169
+ return [name, accessor];
170
+ }),
171
+ );
172
+ // This descriptor map builds a different public view; it is not the
173
+ // canonical dataset-valued ToolExecuteResult descriptor type.
174
+ const descriptors: PropertyDescriptorMap =
175
+ Object.getOwnPropertyDescriptors(result);
176
+ descriptors.extractedLists = {
177
+ ...descriptors.extractedLists,
178
+ value: extractedLists,
179
+ };
180
+ // Canonical receipt construction stays dataset-valued. Public source types and
181
+ // cloud declarations describe the edition-selected view, not this storage form.
182
+ const projected = Object.create(Object.getPrototypeOf(result), descriptors);
183
+ const evidence = savedToolCallEvidence.get(result);
184
+ if (evidence !== undefined) savedToolCallEvidence.set(projected, evidence);
185
+ const relayReference = relayPublishedResultReferences.get(result);
186
+ if (relayReference)
187
+ relayPublishedResultReferences.set(projected, relayReference);
188
+ return projected;
189
+ }
190
+
78
191
  /**
79
192
  * A live tool result may have been durably published by the execution relay
80
193
  * before the runner sees its provider body. Keep that transport-only fact out
@@ -1260,7 +1373,7 @@ function buildExtractedAccessors(
1260
1373
  }
1261
1374
 
1262
1375
  function serializedTargetValuesFromResult(
1263
- value: ToolExecuteResult,
1376
+ value: ToolExecuteResult | BasicToolExecuteResult,
1264
1377
  ): Record<string, ToolResultTargetMetadata> | undefined {
1265
1378
  const targets = value._metadata.targets;
1266
1379
  return Object.keys(targets).length > 0 ? targets : undefined;
@@ -1452,7 +1565,9 @@ export function isToolExecuteResult(
1452
1565
  );
1453
1566
  }
1454
1567
 
1455
- function resultRootOf(result: ToolExecuteResult): unknown {
1568
+ function resultRootOf(
1569
+ result: ToolExecuteResult | BasicToolExecuteResult,
1570
+ ): unknown {
1456
1571
  return { toolResponse: result.toolOutput };
1457
1572
  }
1458
1573
 
@@ -1461,7 +1576,7 @@ function resultRootOf(result: ToolExecuteResult): unknown {
1461
1576
  * selector paths, then by key. Used by SDK play helpers (`extractValue`).
1462
1577
  */
1463
1578
  export function readValue(
1464
- result: ToolExecuteResult,
1579
+ result: ToolExecuteResult | BasicToolExecuteResult,
1465
1580
  selector: readonly string[] | string,
1466
1581
  ): unknown {
1467
1582
  if (typeof selector === 'string') {
@@ -1484,14 +1599,14 @@ export function readValue(
1484
1599
  * declared list accessor. Companion to {@link readValue} for `extractList`.
1485
1600
  */
1486
1601
  export function readList(
1487
- result: ToolExecuteResult,
1602
+ result: ToolExecuteResult | BasicToolExecuteResult,
1488
1603
  selector?: readonly string[] | string,
1489
1604
  ): PlayDataset<Record<string, unknown>> | Record<string, unknown>[] {
1490
1605
  if (selector) {
1491
1606
  const paths = Array.isArray(selector) ? selector : [selector];
1492
1607
  const declaredList = findDeclaredListAccessor(result, paths);
1493
1608
  if (declaredList && preservedSerializedListRows(result)) {
1494
- return declaredList.get();
1609
+ return listAccessorDataset(declaredList);
1495
1610
  }
1496
1611
  const found = findFirstTargetByPath(resultRootOf(result), paths)?.value;
1497
1612
  const rows = normalizeRows(found);
@@ -1501,13 +1616,14 @@ export function readList(
1501
1616
  typeof declaredList.count === 'number' &&
1502
1617
  declaredList.count > rows.length
1503
1618
  ) {
1504
- return declaredList.get();
1619
+ return listAccessorDataset(declaredList);
1505
1620
  }
1506
1621
  return rows;
1507
1622
  }
1508
- if (declaredList) return declaredList.get();
1623
+ if (declaredList) return listAccessorDataset(declaredList);
1509
1624
  }
1510
- return Object.values(result.extractedLists)[0]?.get() ?? [];
1625
+ const first = Object.values(result.extractedLists)[0];
1626
+ return first ? listAccessorDataset(first) : [];
1511
1627
  }
1512
1628
 
1513
1629
  export function attachToolResultListDataset<T extends Record<string, unknown>>(
@@ -1579,9 +1695,9 @@ function normalizeListPathForMatch(path: string): string {
1579
1695
  }
1580
1696
 
1581
1697
  function findDeclaredListAccessor(
1582
- result: ToolExecuteResult,
1698
+ result: ToolExecuteResult | BasicToolExecuteResult,
1583
1699
  paths: readonly string[],
1584
- ): ToolResultListAccessor | undefined {
1700
+ ): ToolResultListAccessor | BasicToolResultListAccessor | undefined {
1585
1701
  const candidates = new Set(
1586
1702
  paths.flatMap((path) =>
1587
1703
  candidateResultPaths(path).flatMap((candidate) => [
@@ -1591,7 +1707,9 @@ function findDeclaredListAccessor(
1591
1707
  ),
1592
1708
  );
1593
1709
  return Object.values(result.extractedLists).find((list) =>
1594
- candidates.has(normalizeListPathForMatch(list.path)),
1710
+ candidateResultPaths(list.path).some((path) =>
1711
+ candidates.has(normalizeListPathForMatch(path)),
1712
+ ),
1595
1713
  );
1596
1714
  }
1597
1715
 
@@ -1621,11 +1739,11 @@ function replaceAtPath(
1621
1739
  }
1622
1740
 
1623
1741
  function serializedListDatasetsFromResult(
1624
- value: ToolExecuteResult,
1742
+ value: ToolExecuteResult | BasicToolExecuteResult,
1625
1743
  ): Record<string, SerializedPlayDataset<Record<string, unknown>>> | undefined {
1626
1744
  const entries = Object.entries(value.extractedLists).flatMap(
1627
1745
  ([name, accessor]) => {
1628
- const dataset = accessor.get();
1746
+ const dataset = listAccessorDataset(accessor);
1629
1747
  const serialized = dataset.toJSON();
1630
1748
  if (!isSerializedPlayDataset<Record<string, unknown>>(serialized)) {
1631
1749
  return [];
@@ -1710,7 +1828,7 @@ function serializedListRowsFromRawV2(input: {
1710
1828
  }
1711
1829
 
1712
1830
  function preservedSerializedListRows(
1713
- value: ToolExecuteResult,
1831
+ value: ToolExecuteResult | BasicToolExecuteResult,
1714
1832
  ): Record<string, Array<Record<string, unknown>>> | undefined {
1715
1833
  const rows = (
1716
1834
  value as ToolExecuteResult & {
@@ -1723,7 +1841,7 @@ function preservedSerializedListRows(
1723
1841
  }
1724
1842
 
1725
1843
  function serializedListRowsFromResult(input: {
1726
- value: ToolExecuteResult;
1844
+ value: ToolExecuteResult | BasicToolExecuteResult;
1727
1845
  metadata: ToolResultMetadataInput;
1728
1846
  listDatasets:
1729
1847
  | Record<string, SerializedPlayDataset<Record<string, unknown>>>
@@ -1741,7 +1859,8 @@ function serializedListRowsFromResult(input: {
1741
1859
  ]);
1742
1860
  const entries = [...names].flatMap((name) => {
1743
1861
  const dataset = input.listDatasets?.[name];
1744
- const liveDataset = input.value.extractedLists[name]?.get();
1862
+ const accessor = input.value.extractedLists[name];
1863
+ const liveDataset = accessor ? listAccessorDataset(accessor) : undefined;
1745
1864
  const residentRows = liveDataset
1746
1865
  ? residentPlayDatasetRows(liveDataset)
1747
1866
  : null;
@@ -1806,6 +1925,7 @@ function rawWithSerializedListRows(input: {
1806
1925
  | Record<string, SerializedPlayDataset<Record<string, unknown>>>
1807
1926
  | undefined;
1808
1927
  listRows: Record<string, Array<Record<string, unknown>>> | undefined;
1928
+ preserveComplete?: boolean;
1809
1929
  }): unknown {
1810
1930
  if (!input.listRows || Object.keys(input.listRows).length === 0) {
1811
1931
  return input.raw;
@@ -1821,7 +1941,11 @@ function rawWithSerializedListRows(input: {
1821
1941
  (candidate, index, all) => all.indexOf(candidate) === index,
1822
1942
  );
1823
1943
  for (const candidate of candidates) {
1824
- if (!Array.isArray(getAtPath(root, candidate))) continue;
1944
+ const existing = getAtPath(root, candidate);
1945
+ if (!Array.isArray(existing)) continue;
1946
+ // Compatibility dataset rows wrap primitives; never substitute those
1947
+ // wrappers for an already-complete canonical provider response.
1948
+ if (input.preserveComplete && existing.length >= rows.length) break;
1825
1949
  root = replaceAtPath(root, candidate, rows);
1826
1950
  break;
1827
1951
  }
@@ -1948,7 +2072,7 @@ function applySerializedListDatasets(
1948
2072
  }
1949
2073
 
1950
2074
  function metadataInputFromToolExecuteResult(
1951
- value: ToolExecuteResult,
2075
+ value: ToolExecuteResult | BasicToolExecuteResult,
1952
2076
  ): ToolResultMetadataInput {
1953
2077
  return {
1954
2078
  toolId: value._metadata.toolId,
@@ -2062,6 +2186,7 @@ function rawV2WithSerializedListRows(input: {
2062
2186
  ...input.rawV2,
2063
2187
  data: rawWithSerializedListRows({
2064
2188
  raw: input.rawV2.data,
2189
+ preserveComplete: true,
2065
2190
  lists: input.lists,
2066
2191
  listDatasets: input.listDatasets,
2067
2192
  listRows: input.listRows,
@@ -2070,6 +2195,7 @@ function rawV2WithSerializedListRows(input: {
2070
2195
  }
2071
2196
  return rawWithSerializedListRows({
2072
2197
  raw: input.rawV2,
2198
+ preserveComplete: true,
2073
2199
  lists: input.lists,
2074
2200
  listDatasets: input.listDatasets,
2075
2201
  listRows: input.listRows,
@@ -2111,7 +2237,7 @@ function fitSavedCallEvidence(
2111
2237
  }
2112
2238
 
2113
2239
  export function serializeToolExecuteResult(
2114
- value: ToolExecuteResult,
2240
+ value: ToolExecuteResult | BasicToolExecuteResult,
2115
2241
  options?: { includeCallEvidence?: boolean },
2116
2242
  ): SerializedToolExecuteResult {
2117
2243
  const callEvidence =
@@ -2,17 +2,20 @@ import { Type, type Static, type TSchema } from '@sinclair/typebox';
2
2
  import { Value } from '@sinclair/typebox/value';
3
3
  import type { PreviousCell } from './cell-staleness';
4
4
  import type { PlaySandboxRuntimeLimits } from './sandbox-runtime-limits';
5
- import type { ToolExecuteResult } from './tool-result-types';
5
+ import type {
6
+ BasicToolExecuteResult,
7
+ ToolExecuteResult,
8
+ } from './tool-result-types';
6
9
  import type { ToolExecutionErrorSchemaVersion } from './tool-execution-error';
7
10
  import type { PlayDataset, PlayDatasetInput, PlayDatasetRow } from './dataset';
8
11
 
9
12
  export const LEGACY_PLAY_AUTHORING_CONTRACT_EDITION = 1 as const;
10
- // Reader-first rollout: accept edition 9, but keep new bundles on edition 8
11
- // until the edition-9 runtime reader has completed deployment.
12
- export const PLAY_AUTHORING_CONTRACT_EDITION = 8 as const;
13
+ // New source uses ordinary list values. Historical artifacts keep their pinned
14
+ // edition; deploy the edition-10 reader before promoting this writer.
15
+ export const PLAY_AUTHORING_CONTRACT_EDITION = 10 as const;
13
16
  export const PLAY_AUTHORING_INPUT_SCHEMA_SNAPSHOT_EDITION = 3 as const;
14
17
  export const SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS = [
15
- 1, 2, 3, 4, 5, 6, 7, 8, 9,
18
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
16
19
  ] as const;
17
20
 
18
21
  export type PlayAuthoringContractEdition =
@@ -84,8 +87,22 @@ const PLAY_AUTHORING_CONTRACT_CHANGELOG_DETAILS = [
84
87
  newWritesEnd: null,
85
88
  readerRemoval: null,
86
89
  },
90
+ {
91
+ changed:
92
+ 'List getters return ordinary arrays from the complete resident tool response. Lazy database datasets require an explicit dataset read; incomplete historical previews fail rather than masquerade as complete arrays. Editions 1–9 retain dataset-valued getters; stored tool receipts are unchanged.',
93
+ compatibilityOwner: 'Plays Runtime',
94
+ newWritesEnd: null,
95
+ readerRemoval: null,
96
+ },
87
97
  ] as const;
88
98
 
99
+ /** Authoring types and runtime projection must select the same getter contract. */
100
+ export function playToolListGetterMode(
101
+ edition: PlayAuthoringContractEdition = PLAY_AUTHORING_CONTRACT_EDITION,
102
+ ): 'dataset' | 'array' {
103
+ return edition >= 10 ? 'array' : 'dataset';
104
+ }
105
+
89
106
  export const PLAY_AUTHORING_CONTRACT_CHANGELOG =
90
107
  SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS.map((edition, index) => ({
91
108
  edition,
@@ -1461,7 +1478,9 @@ export const PLAY_AUTHORING_STATIC_FETCH_KEY_HINT =
1461
1478
  `${PLAY_AUTHORING_DOCUMENTATION.staticCallKeys.workaround} Do not compute the key.` as const;
1462
1479
 
1463
1480
  /** The complete customer-authored `ctx` Interface shared by every Adapter. */
1464
- export interface PlayAuthoringRuntimeContext {
1481
+ export interface PlayAuthoringRuntimeContext<
1482
+ TListGetter extends 'dataset' | 'array' = 'dataset',
1483
+ > {
1465
1484
  /**
1466
1485
  * Load a staged CSV file as a durable dataset handle.
1467
1486
  * @sdkReference runtime 040 ctx.csv(path, options)
@@ -1481,7 +1500,7 @@ export interface PlayAuthoringRuntimeContext {
1481
1500
  ): PlayAuthoringDatasetBuilder<
1482
1501
  PlayDatasetRow<TSource> & object,
1483
1502
  PlayDatasetRow<TSource> & object,
1484
- PlayAuthoringRuntimeContext
1503
+ PlayAuthoringRuntimeContext<TListGetter>
1485
1504
  >;
1486
1505
 
1487
1506
  /** @deprecated `ctx.map(...)` was replaced by `ctx.dataset(...)`. */
@@ -1506,7 +1525,11 @@ export interface PlayAuthoringRuntimeContext {
1506
1525
  */
1507
1526
  execute<TOutput = PlayLooseObject>(
1508
1527
  request: PlayToolExecutionRequest,
1509
- ): Promise<ToolExecuteResult<TOutput>>;
1528
+ ): Promise<
1529
+ TListGetter extends 'array'
1530
+ ? BasicToolExecuteResult<TOutput>
1531
+ : ToolExecuteResult<TOutput>
1532
+ >;
1510
1533
  };
1511
1534
 
1512
1535
  customerDb: {
@@ -1522,7 +1545,11 @@ export interface PlayAuthoringRuntimeContext {
1522
1545
  toolId: string,
1523
1546
  input: Record<string, unknown>,
1524
1547
  options?: { description?: string },
1525
- ): Promise<ToolExecuteResult<TOutput>>;
1548
+ ): Promise<
1549
+ TListGetter extends 'array'
1550
+ ? BasicToolExecuteResult<TOutput>
1551
+ : ToolExecuteResult<TOutput>
1552
+ >;
1526
1553
 
1527
1554
  /**
1528
1555
  * Execute one reusable step program against a scalar input.
@@ -1531,7 +1558,7 @@ export interface PlayAuthoringRuntimeContext {
1531
1558
  runSteps<TInput extends Record<string, unknown>, TOutput>(
1532
1559
  program: PlayAuthoringRunnableStepProgram<
1533
1560
  TOutput,
1534
- PlayAuthoringRuntimeContext
1561
+ PlayAuthoringRuntimeContext<TListGetter>
1535
1562
  > & { readonly __inputType?: (input: TInput) => void },
1536
1563
  input: TInput,
1537
1564
  options?: PlayAuthoringRunStepsOptions,
@@ -153,6 +153,9 @@ export interface PlayDataset<T> extends AsyncIterable<T> {
153
153
  * Explicit escape hatch for bounded result sets.
154
154
  * Large datasets should flow by handle through Neon-backed storage, not
155
155
  * through worker memory as giant arrays.
156
+ * No argument loads the complete current handle within the memory cap or
157
+ * throws. A numeric limit loads only a prefix, not proof of completeness.
158
+ * Materializing a tool-result list does not fetch more provider pages.
156
159
  */
157
160
  materialize(options?: number | PlayDatasetMaterializeOptions): Promise<T[]>;
158
161
  toJSON(): {
@@ -86,9 +86,59 @@ export type ToolResultListAccessor<
86
86
  TKey extends string = string,
87
87
  > = Omit<ToolResultListMetadata, 'keys'> & {
88
88
  keys: Partial<Record<TKey, string>> & Record<string, string>;
89
+ /**
90
+ * Editions 1–9: dataset handle, not a JavaScript array. Edition 10 uses
91
+ * BasicToolResultListAccessor instead; its .get() returns an ordinary array.
92
+ * Pass it to ctx.dataset, use first() or async iteration, or await
93
+ * get().materialize() for the complete current list within the memory cap.
94
+ * materialize(n) and peek(n) return a prefix; none fetch provider pages.
95
+ */
89
96
  get(): PlayDataset<T>;
90
97
  };
91
98
 
99
+ /** Edition-10 getter: ordinary data, not a dataset or a promise. */
100
+ export type BasicToolResultListAccessor<
101
+ T = Record<string, unknown>,
102
+ TKey extends string = string,
103
+ > = Omit<ToolResultListAccessor<T, TKey>, 'get'> & {
104
+ /** Complete resident response list. Throws for a lazy or incomplete list. */
105
+ get(): T[];
106
+ };
107
+
108
+ export type BasicToolExecuteResultBase<
109
+ TResult = unknown,
110
+ TMeta = Record<string, unknown>,
111
+ > = Omit<ToolExecuteResultBase<TResult, TMeta>, 'extractedLists'> & {
112
+ extractedLists: Record<string, BasicToolResultListAccessor>;
113
+ };
114
+
115
+ export type BasicToolExecuteResultAccessors<
116
+ TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>,
117
+ TLists extends Record<string, Record<string, unknown>> = Record<
118
+ string,
119
+ Record<string, unknown>
120
+ >,
121
+ > = {
122
+ extractedValues: {
123
+ [K in keyof TExtracted]: ToolResultTargetAccessor<TExtracted[K]>;
124
+ };
125
+ extractedLists: {
126
+ [K in keyof TLists]: BasicToolResultListAccessor<TLists[K]>;
127
+ };
128
+ };
129
+
130
+ /** Public source-SDK result for new Plays; receipts retain the canonical form. */
131
+ export type BasicToolExecuteResult<
132
+ TResult = unknown,
133
+ TMeta = Record<string, unknown>,
134
+ TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>,
135
+ TLists extends Record<string, Record<string, unknown>> = Record<
136
+ string,
137
+ Record<string, unknown>
138
+ >,
139
+ > = BasicToolExecuteResultBase<TResult, TMeta> &
140
+ BasicToolExecuteResultAccessors<TExtracted, TLists>;
141
+
92
142
  export type ToolResultMetadataInput = {
93
143
  toolId: string;
94
144
  extractors?: Record<string, ToolResultExtractorDescriptor>;
@@ -220,17 +270,16 @@ export type ToolExecuteResultAccessors<
220
270
  /**
221
271
  * Canonical result returned by Deepline tool execution.
222
272
  *
223
- * The top-level object is Deepline-owned execution metadata and semantic
224
- * extraction state. The canonical provider response lives under
225
- * `toolResponse.rawV2`. Response metadata lives under `toolResponse.meta`. Semantic single-value
226
- * getters live under `extractedValues.<name>.get()`, and list getters live
227
- * under `extractedLists.<name>.get()`.
273
+ * Provider data: `toolResponse.rawV2`; metadata: `toolResponse.meta`.
274
+ * Single-value getters: `extractedValues.<name>.get()`; lists: `extractedLists.<name>.get()`.
228
275
  *
229
- * Use extractors first when a tool contract exposes them. Use list getters for
230
- * row-shaped data. Use `toolResponse.rawV2` for provider-specific fields or
231
- * debugging. Inspect the observed response before selecting a nested field;
232
- * provider envelopes are preserved, including pagination and sibling resources.
233
- * This is parsed, scrubbed data, not the original HTTP bytes or headers.
276
+ * Prefer declared getters. New Plays (edition 10) receive ordinary arrays from
277
+ * list `.get()` synchronously; persist explicitly with ctx.dataset. Lazy or
278
+ * incomplete lists throw: use readList(result, path) for explicit dataset access.
279
+ * Provider pagination requires a separate request; getters never fetch it.
280
+ * Historical editions 1–9 retain PlayDataset getters and async materialize/peek;
281
+ * missing getters never mean empty results. Inspect rawV2 for debugging: parsed,
282
+ * scrubbed envelopes, pagination and siblings, not HTTP bytes or headers.
234
283
  *
235
284
  * @sdkReference runtime 200
236
285
  */
@@ -9,11 +9,11 @@ import {
9
9
  registerAuthCommands,
10
10
  reportSetupCompleted,
11
11
  resolvePendingAuthClaimForResume
12
- } from "./chunk-SMGNDW7O.mjs";
13
- import "./chunk-B2R66UTW.mjs";
14
- import "./chunk-WWVE4HFN.mjs";
12
+ } from "./chunk-MFQQINUY.mjs";
13
+ import "./chunk-EROOAI5G.mjs";
14
+ import "./chunk-FK7PW6BP.mjs";
15
15
  import "./chunk-DLIRSHV6.mjs";
16
- import "./chunk-YFCHBN3C.mjs";
16
+ import "./chunk-GCNER3HV.mjs";
17
17
  import "./chunk-NXGCO4JB.mjs";
18
18
  import "./chunk-WZYKRD7T.mjs";
19
19
  import "./chunk-KRD6H754.mjs";
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkVLDLJZ75js = require('./chunk-VLDLJZ75.js');
13
+ require('./chunk-U2N4CYT7.js');
14
+ require('./chunk-VDIHLKGG.js');
15
+ require('./chunk-XNYIZMNQ.js');
16
+ require('./chunk-AD23W4S5.js');
17
+ require('./chunk-7P5AA3SN.js');
18
+ require('./chunk-OG64RBAC.js');
19
+ require('./chunk-COGTRVWW.js');
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkVLDLJZ75js.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunkVLDLJZ75js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkVLDLJZ75js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkVLDLJZ75js.handleRegister; exports.handleStatus = _chunkVLDLJZ75js.handleStatus; exports.handleWait = _chunkVLDLJZ75js.handleWait; exports.readPendingAuthClaim = _chunkVLDLJZ75js.readPendingAuthClaim; exports.registerAuthCommands = _chunkVLDLJZ75js.registerAuthCommands; exports.reportSetupCompleted = _chunkVLDLJZ75js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkVLDLJZ75js.resolvePendingAuthClaimForResume;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DeeplineClient,
3
3
  iterateCursorPages
4
- } from "./chunk-7R6KQSFA.mjs";
4
+ } from "./chunk-OZGU7P2S.mjs";
5
5
  import "./chunk-CBVIJSHF.mjs";
6
6
  import {
7
7
  createTimestampedName,
@@ -9,13 +9,13 @@ import {
9
9
  openInBrowser,
10
10
  printCommandEnvelope,
11
11
  shouldEmitJson
12
- } from "./chunk-B2R66UTW.mjs";
12
+ } from "./chunk-EROOAI5G.mjs";
13
13
  import {
14
14
  AuthError,
15
15
  ConfigError
16
- } from "./chunk-WWVE4HFN.mjs";
16
+ } from "./chunk-FK7PW6BP.mjs";
17
17
  import "./chunk-DLIRSHV6.mjs";
18
- import "./chunk-YFCHBN3C.mjs";
18
+ import "./chunk-GCNER3HV.mjs";
19
19
  import "./chunk-6IKARAYD.mjs";
20
20
  import {
21
21
  DeeplineError