deepline 0.2.74 → 0.3.1
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/client.ts +75 -4
- package/dist/bundling-sources/sdk/src/compat.ts +4 -0
- package/dist/bundling-sources/sdk/src/play.ts +7 -0
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +15 -1
- package/dist/bundling-sources/sdk/src/release.ts +12 -1
- package/dist/bundling-sources/sdk/src/types.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +146 -29
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +57 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +20 -19
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +100 -25
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +0 -9
- package/dist/bundling-sources/shared_libs/play-runtime/tool-response-contract.ts +89 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +29 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +203 -16
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +6 -5
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -0
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +5 -2
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +14 -0
- package/dist/cli/index.js +123 -47
- package/dist/cli/index.mjs +86 -10
- package/dist/{compiler-manifest-DFuz9-0_.d.mts → compiler-manifest-BX85pKXW.d.mts} +7 -2
- package/dist/{compiler-manifest-DFuz9-0_.d.ts → compiler-manifest-BX85pKXW.d.ts} +7 -2
- package/dist/index.d.mts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +85 -4
- package/dist/index.mjs +85 -4
- package/dist/install-integrity.json +3 -2
- package/dist/plays/bundle-play-file.d.mts +12 -2
- package/dist/plays/bundle-play-file.d.ts +12 -2
- package/dist/plays/bundle-play-file.mjs +20 -4
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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
|
|
137
|
-
|
|
138
|
-
|
|
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:
|
|
208
|
-
|
|
209
|
-
|
|
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:
|
|
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:
|
|
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 ===
|
|
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({
|
|
@@ -8,11 +8,12 @@ export function transientServiceUnavailableDetail(
|
|
|
8
8
|
if (error instanceof TypeError && /^fetch failed$/i.test(detail.trim())) {
|
|
9
9
|
return detail;
|
|
10
10
|
}
|
|
11
|
-
// Convex uses
|
|
12
|
-
// InternalServerError envelope for short control-plane
|
|
13
|
-
// text is intentionally exact: application exceptions
|
|
14
|
-
// retryable merely because they mention an internal-server
|
|
15
|
-
|
|
11
|
+
// Convex uses explicit ServiceUnavailable and ExpiredInQueue responses, as
|
|
12
|
+
// well as this generic InternalServerError envelope for short control-plane
|
|
13
|
+
// outages. The latter text is intentionally exact: application exceptions
|
|
14
|
+
// must not become retryable merely because they mention an internal-server
|
|
15
|
+
// error.
|
|
16
|
+
return /ServiceUnavailable|Service temporarily unavailable|temporarily unavailable \(Code:\s*\d+\)|"code"\s*:\s*"ExpiredInQueue"|"code"\s*:\s*"InternalServerError"[\s\S]*(?:Your request couldn't be completed\. Try again later\.|Your request timed out performing too many system operations\.)/i.test(
|
|
16
17
|
detail,
|
|
17
18
|
)
|
|
18
19
|
? detail
|
|
@@ -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. */
|
|
@@ -71,6 +71,7 @@ export const PLAY_AUTHORING_CONTRACT_ISSUE_CODES = [
|
|
|
71
71
|
'play_authoring_fetch_key_reused_in_loop',
|
|
72
72
|
'play_authoring_binding_invalid',
|
|
73
73
|
'play_authoring_input_schema_unresolved',
|
|
74
|
+
'tool_response_raw_access',
|
|
74
75
|
'check_error',
|
|
75
76
|
'docflow_compile_error',
|
|
76
77
|
'docflow_binding_drift',
|
|
@@ -223,9 +223,12 @@ function sourceIdentityPath(
|
|
|
223
223
|
): string {
|
|
224
224
|
if (!sourceIdentityRoot) return filePath;
|
|
225
225
|
const identityRoot = resolve(sourceIdentityRoot);
|
|
226
|
-
const
|
|
226
|
+
const resolvedFilePath = resolve(filePath);
|
|
227
|
+
const logicalPath = relative(identityRoot, resolvedFilePath);
|
|
228
|
+
if (!logicalPath) {
|
|
229
|
+
return basename(resolvedFilePath);
|
|
230
|
+
}
|
|
227
231
|
if (
|
|
228
|
-
!logicalPath ||
|
|
229
232
|
logicalPath === '..' ||
|
|
230
233
|
logicalPath.startsWith(`..${sep}`) ||
|
|
231
234
|
isAbsolute(logicalPath)
|
|
@@ -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
|
|