deepline 0.2.74 → 0.3.0

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.
@@ -75,7 +75,7 @@ export type ToolResultEnvelope<
75
75
  meta?: TMeta;
76
76
  };
77
77
 
78
- export type SerializedToolExecuteResult = {
78
+ export type SerializedToolExecuteResultV1 = {
79
79
  __kind: 'deepline.tool_execute_result.v1';
80
80
  status: string;
81
81
  job_id?: string;
@@ -98,11 +98,36 @@ export type SerializedToolExecuteResult = {
98
98
  execution: ToolResultExecutionMetadata;
99
99
  };
100
100
 
101
+ /**
102
+ * Canonical receipt form. Provider data is stored once as `rawV2`; the legacy
103
+ * raw/meta view is recreated from the payload-free projection descriptor.
104
+ */
105
+ export type SerializedToolExecuteResultV2 = Omit<
106
+ SerializedToolExecuteResultV1,
107
+ '__kind' | 'toolResponse'
108
+ > & {
109
+ __kind: 'deepline.tool_execute_result.v2';
110
+ toolResponse: {
111
+ rawV2: unknown;
112
+ view: 'data' | 'rawV2';
113
+ /** Deepline-owned additions not already represented in `rawV2.meta`. */
114
+ responseMeta?: Record<string, unknown>;
115
+ };
116
+ };
117
+
118
+ export type SerializedToolExecuteResult =
119
+ | SerializedToolExecuteResultV1
120
+ | SerializedToolExecuteResultV2;
121
+
101
122
  export type ToolResponseEnvelope<
102
123
  TData = unknown,
103
124
  TMeta = Record<string, unknown>,
104
125
  > = {
105
126
  raw: TData;
127
+ /** Complete parsed and scrubbed provider response, materialized from raw-v2. */
128
+ rawV2?: unknown;
129
+ /** Durable descriptor for deriving the legacy raw view from `rawV2`. */
130
+ view?: 'data' | 'rawV2';
106
131
  meta?: TMeta;
107
132
  };
108
133
 
@@ -156,8 +181,9 @@ export type ToolExecuteResultAccessors<
156
181
  * Canonical result returned by Deepline tool execution.
157
182
  *
158
183
  * The top-level object is Deepline-owned execution metadata and semantic
159
- * extraction state. Raw tool/provider data lives under `toolResponse.raw`;
160
- * response metadata lives under `toolResponse.meta`. Semantic single-value
184
+ * extraction state. The canonical provider response lives under
185
+ * `toolResponse.rawV2`; `toolResponse.raw` remains the legacy compatibility
186
+ * projection. Response metadata lives under `toolResponse.meta`. Semantic single-value
161
187
  * getters live under `extractedValues.<name>.get()`, and list getters live
162
188
  * under `extractedLists.<name>.get()`.
163
189
  *
@@ -49,10 +49,18 @@ import {
49
49
  } from '../plays/dataset';
50
50
  import { normalizeTableNamespace, sha256Hex } from '../plays/row-identity';
51
51
  import { listNameFromDeclaredPath } from './tool-result-paths';
52
+ import {
53
+ legacyRawFromToolResponseRawV2,
54
+ providerMetaFromToolResponseRawV2,
55
+ type ToolResponseView,
56
+ } from './tool-response-contract';
52
57
 
53
58
  type PathSegment = string | number | '*';
54
59
 
55
- const SERIALIZED_TOOL_EXECUTE_RESULT_KIND = 'deepline.tool_execute_result.v1';
60
+ const SERIALIZED_TOOL_EXECUTE_RESULT_V1_KIND =
61
+ 'deepline.tool_execute_result.v1';
62
+ const SERIALIZED_TOOL_EXECUTE_RESULT_V2_KIND =
63
+ 'deepline.tool_execute_result.v2';
56
64
  const SERIALIZED_TOOL_RESULT_LIST_PREVIEW_LIMIT = 5;
57
65
  const LIVE_TOOL_RESULT_LIST_DATASET_REGISTRY_LIMIT = 256;
58
66
  const SERIALIZED_TOOL_LIST_ROWS = Symbol('deepline.serialized_tool_list_rows');
@@ -123,6 +131,8 @@ function isRecord(value: unknown): value is Record<string, unknown> {
123
131
 
124
132
  type V2ToolExecuteOutput = {
125
133
  raw: unknown;
134
+ rawV2?: unknown;
135
+ view?: ToolResponseView;
126
136
  meta?: Record<string, unknown>;
127
137
  };
128
138
 
@@ -131,12 +141,35 @@ function parseV2ToolExecuteOutput(
131
141
  ): V2ToolExecuteOutput | null {
132
142
  const toolResponse = data.toolResponse;
133
143
  if (isRecord(toolResponse)) {
134
- const meta = isRecord(toolResponse.meta) ? toolResponse.meta : undefined;
144
+ const rawV2 = Object.prototype.hasOwnProperty.call(toolResponse, 'rawV2')
145
+ ? toolResponse.rawV2
146
+ : undefined;
147
+ const view =
148
+ toolResponse.view === 'data' || toolResponse.view === 'rawV2'
149
+ ? toolResponse.view
150
+ : undefined;
151
+ const providerMeta = providerMetaFromToolResponseRawV2(
152
+ rawV2,
153
+ view ?? 'rawV2',
154
+ );
155
+ const responseMeta = isRecord(toolResponse.responseMeta)
156
+ ? toolResponse.responseMeta
157
+ : undefined;
158
+ const meta = {
159
+ ...(isRecord(toolResponse.meta) ? toolResponse.meta : {}),
160
+ ...(providerMeta ?? {}),
161
+ ...(responseMeta ?? {}),
162
+ };
163
+ const raw = Object.prototype.hasOwnProperty.call(toolResponse, 'raw')
164
+ ? toolResponse.raw
165
+ : rawV2 === undefined
166
+ ? null
167
+ : legacyRawFromToolResponseRawV2(rawV2, view ?? 'rawV2', responseMeta);
135
168
  return {
136
- raw: Object.prototype.hasOwnProperty.call(toolResponse, 'raw')
137
- ? toolResponse.raw
138
- : null,
139
- ...(meta ? { meta } : {}),
169
+ raw,
170
+ ...(rawV2 !== undefined ? { rawV2 } : {}),
171
+ ...(view ? { view } : {}),
172
+ ...(Object.keys(meta).length > 0 ? { meta } : {}),
140
173
  };
141
174
  }
142
175
  return null;
@@ -181,7 +214,10 @@ export type ParsedToolExecuteResponse = {
181
214
  meta?: Record<string, unknown>;
182
215
  toolResponse?: {
183
216
  raw?: unknown;
217
+ rawV2?: unknown;
218
+ view?: 'data' | 'rawV2';
184
219
  meta?: Record<string, unknown>;
220
+ responseMeta?: Record<string, unknown>;
185
221
  };
186
222
  /** Legacy `{ data, meta }` envelope consumed by createToolExecuteResult. */
187
223
  result: unknown;
@@ -204,9 +240,17 @@ export function parseToolExecuteResponse(
204
240
  status,
205
241
  jobId: typeof body.job_id === 'string' ? body.job_id : undefined,
206
242
  meta: isRecord(body.meta) ? body.meta : undefined,
207
- toolResponse: isRecord(body.toolResponse)
208
- ? (body.toolResponse as ParsedToolExecuteResponse['toolResponse'])
209
- : undefined,
243
+ toolResponse: (() => {
244
+ const output = parseV2ToolExecuteOutput(body);
245
+ return output
246
+ ? {
247
+ raw: output.raw,
248
+ ...(output.rawV2 !== undefined ? { rawV2: output.rawV2 } : {}),
249
+ ...(output.view ? { view: output.view } : {}),
250
+ ...(output.meta ? { meta: output.meta } : {}),
251
+ }
252
+ : undefined;
253
+ })(),
210
254
  result,
211
255
  metadata: parseExecuteToolMetadata(toolId, body),
212
256
  };
@@ -1135,11 +1179,20 @@ export function createToolExecuteResult<TResult = unknown>(input: {
1135
1179
  metadata: ToolResultMetadataInput;
1136
1180
  execution: ToolResultExecutionMetadata;
1137
1181
  meta?: Record<string, unknown>;
1182
+ response?: {
1183
+ rawV2?: unknown;
1184
+ view?: 'data' | 'rawV2';
1185
+ meta?: Record<string, unknown>;
1186
+ };
1138
1187
  }): ToolExecuteResult<TResult> {
1139
1188
  const result = toResultEnvelope(input.result);
1140
1189
  const resultRoot = {
1141
1190
  toolResponse: {
1142
1191
  raw: result.data,
1192
+ ...(input.response && 'rawV2' in input.response
1193
+ ? { rawV2: input.response.rawV2 }
1194
+ : {}),
1195
+ ...(input.response?.view ? { view: input.response.view } : {}),
1143
1196
  ...(result.meta ? { meta: result.meta } : {}),
1144
1197
  },
1145
1198
  };
@@ -1165,6 +1218,10 @@ export function createToolExecuteResult<TResult = unknown>(input: {
1165
1218
  };
1166
1219
  const toolResponse = {
1167
1220
  raw: result.data,
1221
+ ...(input.response && 'rawV2' in input.response
1222
+ ? { rawV2: input.response.rawV2 }
1223
+ : {}),
1224
+ ...(input.response?.view ? { view: input.response.view } : {}),
1168
1225
  ...(result.meta ? { meta: result.meta } : {}),
1169
1226
  };
1170
1227
  const extractedValues = buildExtractedAccessors(targets);
@@ -1634,6 +1691,17 @@ function applySerializedListDatasets(
1634
1691
  listDatasets,
1635
1692
  listRows,
1636
1693
  });
1694
+ if (Object.prototype.hasOwnProperty.call(result.toolResponse, 'rawV2')) {
1695
+ const view = result.toolResponse.view ?? 'rawV2';
1696
+ if (view === 'data' && isRecord(result.toolResponse.rawV2)) {
1697
+ result.toolResponse.rawV2 = {
1698
+ ...result.toolResponse.rawV2,
1699
+ data: result.toolResponse.raw,
1700
+ };
1701
+ } else {
1702
+ result.toolResponse.rawV2 = result.toolResponse.raw;
1703
+ }
1704
+ }
1637
1705
  Object.defineProperty(result, SERIALIZED_TOOL_LIST_ROWS, {
1638
1706
  value: listRows,
1639
1707
  enumerable: false,
@@ -1695,6 +1763,47 @@ function metadataInputFromToolExecuteResult(
1695
1763
  };
1696
1764
  }
1697
1765
 
1766
+ function sameJsonValue(left: unknown, right: unknown): boolean {
1767
+ if (left === right) return true;
1768
+ try {
1769
+ return JSON.stringify(left) === JSON.stringify(right);
1770
+ } catch {
1771
+ return false;
1772
+ }
1773
+ }
1774
+
1775
+ function responseMetaOutsideRawV2(input: {
1776
+ rawV2: unknown;
1777
+ view: 'data' | 'rawV2';
1778
+ meta: Record<string, unknown> | undefined;
1779
+ }): Record<string, unknown> | undefined {
1780
+ if (!input.meta) return undefined;
1781
+ const providerMeta =
1782
+ input.view === 'data' && isRecord(input.rawV2) && isRecord(input.rawV2.meta)
1783
+ ? input.rawV2.meta
1784
+ : undefined;
1785
+ if (!providerMeta) return input.meta;
1786
+ const responseMeta = Object.fromEntries(
1787
+ Object.entries(input.meta).filter(
1788
+ ([key, value]) =>
1789
+ !Object.prototype.hasOwnProperty.call(providerMeta, key) ||
1790
+ !sameJsonValue(providerMeta[key], value),
1791
+ ),
1792
+ );
1793
+ return Object.keys(responseMeta).length > 0 ? responseMeta : undefined;
1794
+ }
1795
+
1796
+ function rawV2WithSerializedRawPreview(input: {
1797
+ rawV2: unknown;
1798
+ view: 'data' | 'rawV2';
1799
+ raw: unknown;
1800
+ }): unknown {
1801
+ if (input.view === 'data' && isRecord(input.rawV2)) {
1802
+ return { ...input.rawV2, data: input.raw };
1803
+ }
1804
+ return input.raw;
1805
+ }
1806
+
1698
1807
  export function serializeToolExecuteResult(
1699
1808
  value: ToolExecuteResult,
1700
1809
  ): SerializedToolExecuteResult {
@@ -1706,17 +1815,54 @@ export function serializeToolExecuteResult(
1706
1815
  metadata,
1707
1816
  });
1708
1817
  const targetValues = serializedTargetValuesFromResult(value);
1818
+ const serializedRaw = serializedRawWithListPreviews({
1819
+ raw: value.toolResponse.raw,
1820
+ metadata,
1821
+ listDatasets,
1822
+ });
1823
+ if (Object.prototype.hasOwnProperty.call(value.toolResponse, 'rawV2')) {
1824
+ const view = value.toolResponse.view ?? 'rawV2';
1825
+ const rawV2 = rawV2WithSerializedRawPreview({
1826
+ rawV2: value.toolResponse.rawV2,
1827
+ view,
1828
+ raw:
1829
+ view === 'data'
1830
+ ? serializedRaw
1831
+ : serializedRawWithListPreviews({
1832
+ raw: value.toolResponse.rawV2,
1833
+ metadata,
1834
+ listDatasets,
1835
+ }),
1836
+ });
1837
+ const responseMeta = responseMetaOutsideRawV2({
1838
+ rawV2: value.toolResponse.rawV2,
1839
+ view,
1840
+ meta: value.toolResponse.meta,
1841
+ });
1842
+ return {
1843
+ __kind: SERIALIZED_TOOL_EXECUTE_RESULT_V2_KIND,
1844
+ status: value.status,
1845
+ ...(typeof value.job_id === 'string' ? { job_id: value.job_id } : {}),
1846
+ ...(isRecord(value.meta) ? { meta: value.meta } : {}),
1847
+ toolResponse: {
1848
+ rawV2,
1849
+ view,
1850
+ ...(responseMeta ? { responseMeta } : {}),
1851
+ },
1852
+ ...(listDatasets ? { listDatasets } : {}),
1853
+ ...(listRows ? { listRows } : {}),
1854
+ ...(targetValues ? { targetValues } : {}),
1855
+ metadata,
1856
+ execution: value._metadata.execution,
1857
+ };
1858
+ }
1709
1859
  return {
1710
- __kind: SERIALIZED_TOOL_EXECUTE_RESULT_KIND,
1860
+ __kind: SERIALIZED_TOOL_EXECUTE_RESULT_V1_KIND,
1711
1861
  status: value.status,
1712
1862
  ...(typeof value.job_id === 'string' ? { job_id: value.job_id } : {}),
1713
1863
  ...(isRecord(value.meta) ? { meta: value.meta } : {}),
1714
1864
  toolResponse: {
1715
- raw: serializedRawWithListPreviews({
1716
- raw: value.toolResponse.raw,
1717
- metadata,
1718
- listDatasets,
1719
- }),
1865
+ raw: serializedRaw,
1720
1866
  ...(value.toolResponse.meta ? { meta: value.toolResponse.meta } : {}),
1721
1867
  },
1722
1868
  ...(listDatasets ? { listDatasets } : {}),
@@ -1732,7 +1878,8 @@ export function isSerializedToolExecuteResult(
1732
1878
  ): value is SerializedToolExecuteResult {
1733
1879
  return (
1734
1880
  isRecord(value) &&
1735
- value.__kind === SERIALIZED_TOOL_EXECUTE_RESULT_KIND &&
1881
+ (value.__kind === SERIALIZED_TOOL_EXECUTE_RESULT_V1_KIND ||
1882
+ value.__kind === SERIALIZED_TOOL_EXECUTE_RESULT_V2_KIND) &&
1736
1883
  typeof value.status === 'string' &&
1737
1884
  isRecord(value.toolResponse) &&
1738
1885
  isRecord(value.metadata) &&
@@ -1743,6 +1890,46 @@ export function isSerializedToolExecuteResult(
1743
1890
  export function deserializeToolExecuteResult(
1744
1891
  value: SerializedToolExecuteResult,
1745
1892
  ): ToolExecuteResult {
1893
+ if (value.__kind === SERIALIZED_TOOL_EXECUTE_RESULT_V2_KIND) {
1894
+ const view = value.toolResponse.view;
1895
+ const rawV2 = value.toolResponse.rawV2;
1896
+ const providerMeta =
1897
+ view === 'data' && isRecord(rawV2) && isRecord(rawV2.meta)
1898
+ ? rawV2.meta
1899
+ : undefined;
1900
+ const meta = {
1901
+ ...(providerMeta ?? {}),
1902
+ ...(value.toolResponse.responseMeta ?? {}),
1903
+ };
1904
+ const raw = legacyRawFromToolResponseRawV2(
1905
+ rawV2,
1906
+ view,
1907
+ value.toolResponse.responseMeta,
1908
+ );
1909
+ return applySerializedListDatasets(
1910
+ applySerializedTargetValues(
1911
+ createToolExecuteResult({
1912
+ status: value.status,
1913
+ jobId: value.job_id,
1914
+ result: {
1915
+ data: raw,
1916
+ ...(Object.keys(meta).length > 0 ? { meta } : {}),
1917
+ },
1918
+ response: {
1919
+ rawV2,
1920
+ view,
1921
+ ...(Object.keys(meta).length > 0 ? { meta } : {}),
1922
+ },
1923
+ metadata: value.metadata,
1924
+ execution: value.execution,
1925
+ meta: value.meta,
1926
+ }),
1927
+ value.targetValues,
1928
+ ),
1929
+ value.listDatasets,
1930
+ value.listRows,
1931
+ );
1932
+ }
1746
1933
  return applySerializedListDatasets(
1747
1934
  applySerializedTargetValues(
1748
1935
  createToolExecuteResult({
@@ -1,4 +1,5 @@
1
1
  import type { ToolExecutionErrorSchemaVersion } from '../tool-execution-error';
2
+ import type { ToolResponseContract } from '../play-runtime/tool-response-contract';
2
3
  import type { PlayAuthoringContractEdition } from './authoring-contract';
3
4
 
4
5
  export type PlayPackageImport = {
@@ -28,6 +29,8 @@ export type PlayArtifactCompatibility = {
28
29
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
29
30
  /** Missing preserves edition 1 for artifacts created before authoring contracts were pinned. */
30
31
  authoringContractEdition?: PlayAuthoringContractEdition;
32
+ /** Missing preserves the raw-only V2 execute response contract. */
33
+ toolResponseContract?: ToolResponseContract;
31
34
  };
32
35
 
33
36
  /** The only executable Play artifact contract. */
@@ -10,6 +10,11 @@ import {
10
10
  type PlayAuthoringContractEdition,
11
11
  type AdmittedPlayAuthoringContract,
12
12
  } from './authoring-contract';
13
+ import {
14
+ normalizeToolResponseContract,
15
+ RAW_V2_TOOL_RESPONSE_CONTRACT,
16
+ type ToolResponseContract,
17
+ } from '../play-runtime/tool-response-contract';
13
18
 
14
19
  export type PlayContractSource = 'ad_hoc' | 'draft' | 'published';
15
20
 
@@ -39,12 +44,15 @@ export type PlayContractCompatibilitySnapshot = {
39
44
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
40
45
  /** Missing preserves edition 1 for artifacts stored before authoring contracts were pinned. */
41
46
  authoringContractEdition?: PlayAuthoringContractEdition;
47
+ /** Immutable execute-result transport selected when the artifact is built. */
48
+ toolResponseContract?: ToolResponseContract;
42
49
  };
43
50
 
44
51
  export type NormalizedPlayContractCompatibilitySnapshot =
45
52
  PlayContractCompatibilitySnapshot & {
46
53
  toolErrorSchemaVersion: ToolExecutionErrorSchemaVersion;
47
54
  authoringContractEdition: PlayAuthoringContractEdition;
55
+ toolResponseContract: ToolResponseContract;
48
56
  };
49
57
 
50
58
  export class UnsupportedPlayToolErrorSchemaVersionError extends Error {
@@ -94,6 +102,9 @@ export function normalizePlayContractCompatibility(
94
102
  return {
95
103
  ...compatibility,
96
104
  toolErrorSchemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
105
+ toolResponseContract: normalizeToolResponseContract(
106
+ compatibility.toolResponseContract,
107
+ ),
97
108
  authoringContractEdition: normalizePlayAuthoringContractEdition(
98
109
  compatibility.authoringContractEdition,
99
110
  ),
@@ -104,6 +115,7 @@ export function buildPlayContractCompatibility(input?: {
104
115
  runtimeBackend?: string | null;
105
116
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
106
117
  authoringContractEdition?: PlayAuthoringContractEdition;
118
+ toolResponseContract?: ToolResponseContract;
107
119
  }): PlayContractCompatibilitySnapshot {
108
120
  return {
109
121
  apiVersion: PLAY_PUBLIC_API_VERSION,
@@ -115,6 +127,8 @@ export function buildPlayContractCompatibility(input?: {
115
127
  input?.toolErrorSchemaVersion ?? TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
116
128
  authoringContractEdition:
117
129
  input?.authoringContractEdition ?? PLAY_AUTHORING_CONTRACT_EDITION,
130
+ toolResponseContract:
131
+ input?.toolResponseContract ?? RAW_V2_TOOL_RESPONSE_CONTRACT,
118
132
  };
119
133
  }
120
134
 
package/dist/cli/index.js CHANGED
@@ -1044,7 +1044,11 @@ var SDK_RELEASE = {
1044
1044
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1045
1045
  // exposed storage-dependent synchronous access. This deliberate minor
1046
1046
  // release keeps lazy paging semantics independent of row residency.
1047
- version: "0.2.74",
1047
+ // 0.3.0 introduces raw-v2: complete scrubbed provider responses are
1048
+ // available at toolResponse.rawV2 while toolResponse.raw and all declared
1049
+ // getters keep their established compatibility behavior.
1050
+ version: "0.3.0",
1051
+ updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
1048
1052
  contracts: {
1049
1053
  api: {
1050
1054
  name: "sdk-http-api",
@@ -3759,12 +3763,33 @@ function normalizePlayRuntimeEnvironment(value) {
3759
3763
  return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
3760
3764
  }
3761
3765
 
3766
+ // ../shared_libs/play-runtime/tool-response-contract.ts
3767
+ var RAW_V2_TOOL_RESPONSE_CONTRACT = "raw-v2";
3768
+ function legacyRawFromToolResponseRawV2(rawV2, view, responseMeta) {
3769
+ const legacyRaw = view === "data" && rawV2 && typeof rawV2 === "object" && !Array.isArray(rawV2) ? rawV2.data : rawV2;
3770
+ const deeplineBilling = responseMeta?.deepline_billing;
3771
+ if (view === "rawV2" && deeplineBilling !== void 0 && legacyRaw && typeof legacyRaw === "object" && !Array.isArray(legacyRaw)) {
3772
+ return {
3773
+ ...legacyRaw,
3774
+ deepline_billing: deeplineBilling
3775
+ };
3776
+ }
3777
+ return legacyRaw;
3778
+ }
3779
+ function providerMetaFromToolResponseRawV2(rawV2, view) {
3780
+ if (view !== "data" || !rawV2 || typeof rawV2 !== "object" || Array.isArray(rawV2)) {
3781
+ return void 0;
3782
+ }
3783
+ const meta = rawV2.meta;
3784
+ return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : void 0;
3785
+ }
3786
+
3762
3787
  // src/client.ts
3763
3788
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
3764
3789
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
3765
3790
  var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
3766
3791
  var EXECUTE_RESPONSE_INTENT_HEADER = "x-deepline-execute-response-intent";
3767
- var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
3792
+ var RAW_V2_EXECUTE_RESPONSE_CONTRACT = RAW_V2_TOOL_RESPONSE_CONTRACT;
3768
3793
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
3769
3794
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
3770
3795
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
@@ -3979,6 +4004,50 @@ function requireTargetBillingIdempotencyKey(value) {
3979
4004
  function isRecord7(value) {
3980
4005
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3981
4006
  }
4007
+ function materializeToolExecutionResponse(response) {
4008
+ const toolResponse = response.toolResponse;
4009
+ if (!toolResponse && isRecord7(response.result)) {
4010
+ const legacyResult = response.result;
4011
+ if (Object.prototype.hasOwnProperty.call(legacyResult, "data")) {
4012
+ const legacyMeta = isRecord7(legacyResult.meta) ? legacyResult.meta : void 0;
4013
+ return {
4014
+ ...response,
4015
+ toolResponse: {
4016
+ raw: legacyResult.data,
4017
+ ...legacyMeta ? { meta: legacyMeta } : {}
4018
+ }
4019
+ };
4020
+ }
4021
+ }
4022
+ if (!toolResponse || Object.prototype.hasOwnProperty.call(toolResponse, "raw")) {
4023
+ return response;
4024
+ }
4025
+ const rawV2 = toolResponse.rawV2;
4026
+ const view = toolResponse.view;
4027
+ const providerMeta = providerMetaFromToolResponseRawV2(
4028
+ rawV2,
4029
+ view ?? "rawV2"
4030
+ );
4031
+ const responseMeta = isRecord7(toolResponse.responseMeta) ? toolResponse.responseMeta : void 0;
4032
+ return {
4033
+ ...response,
4034
+ toolResponse: {
4035
+ ...toolResponse,
4036
+ raw: legacyRawFromToolResponseRawV2(
4037
+ rawV2,
4038
+ view ?? "rawV2",
4039
+ responseMeta
4040
+ ),
4041
+ ...toolResponse.meta || providerMeta || responseMeta ? {
4042
+ meta: {
4043
+ ...toolResponse.meta ?? {},
4044
+ ...providerMeta ?? {},
4045
+ ...responseMeta ?? {}
4046
+ }
4047
+ } : {}
4048
+ }
4049
+ };
4050
+ }
3982
4051
  function isPrebuiltPlayDescription(play) {
3983
4052
  return play.origin === "prebuilt" || play.ownerType === "deepline";
3984
4053
  }
@@ -4528,14 +4597,14 @@ var DeeplineClient = class {
4528
4597
  */
4529
4598
  async executeTool(toolId, input2, options) {
4530
4599
  const headers = {
4531
- [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
4600
+ [EXECUTE_RESPONSE_CONTRACT_HEADER]: RAW_V2_EXECUTE_RESPONSE_CONTRACT,
4532
4601
  [TOOL_EXECUTION_ERROR_SCHEMA_HEADER]: String(
4533
4602
  TOOL_EXECUTION_ERROR_SCHEMA_VERSION
4534
4603
  ),
4535
4604
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
4536
4605
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw"
4537
4606
  };
4538
- return this.http.post(
4607
+ const response = await this.http.post(
4539
4608
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
4540
4609
  {
4541
4610
  payload: input2,
@@ -4549,6 +4618,7 @@ var DeeplineClient = class {
4549
4618
  toolId
4550
4619
  }
4551
4620
  );
4621
+ return materializeToolExecutionResponse(response);
4552
4622
  }
4553
4623
  /**
4554
4624
  * Back-compatible alias for {@link executeTool}.
@@ -40754,9 +40824,7 @@ function shouldSkipSelfUpdate() {
40754
40824
  function parseSemver(version) {
40755
40825
  const trimmed = version?.trim();
40756
40826
  if (!trimmed) return null;
40757
- const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(
40758
- trimmed
40759
- );
40827
+ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(trimmed);
40760
40828
  if (!match) return null;
40761
40829
  return {
40762
40830
  major: Number(match[1]),
@@ -40847,7 +40915,12 @@ async function maybeAutoUpdateAndRelaunch(response) {
40847
40915
  );
40848
40916
  return false;
40849
40917
  }
40850
- process.stderr.write("Deepline SDK/CLI updated; rerunning command.\n");
40918
+ const updateSummary = response.update_summary ? `
40919
+ What changed in ${response.update_summary.version}: ${response.update_summary.summary}` : "";
40920
+ process.stderr.write(
40921
+ `Deepline SDK/CLI updated; rerunning command.${updateSummary}
40922
+ `
40923
+ );
40851
40924
  const exitCode = await relaunchCurrentCommand(plan);
40852
40925
  process.exit(exitCode);
40853
40926
  return true;