deepline 0.3.48 → 0.3.50
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 +6 -36
- package/dist/bundling-sources/sdk/src/http.ts +1 -4
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +2 -61
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +25 -69
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +0 -2
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +45 -5
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +11 -3
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +0 -2
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +11 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +0 -26
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +1 -14
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/contract.ts +17 -7
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +0 -1
- package/dist/cli/index.js +739 -457
- package/dist/cli/index.mjs +709 -422
- package/dist/index.d.mts +2 -8
- package/dist/index.d.ts +2 -8
- package/dist/index.js +9 -24
- package/dist/index.mjs +9 -24
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -186,7 +186,7 @@ configureProxyFromEnv();
|
|
|
186
186
|
|
|
187
187
|
// src/cli/index.ts
|
|
188
188
|
var import_promises10 = require("fs/promises");
|
|
189
|
-
var
|
|
189
|
+
var import_node_path27 = require("path");
|
|
190
190
|
var import_node_os18 = require("os");
|
|
191
191
|
var import_commander4 = require("commander");
|
|
192
192
|
|
|
@@ -1079,7 +1079,7 @@ var SDK_RELEASE = {
|
|
|
1079
1079
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
1080
1080
|
// getters keep their established compatibility behavior.
|
|
1081
1081
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
1082
|
-
version: "0.3.
|
|
1082
|
+
version: "0.3.50",
|
|
1083
1083
|
updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
|
|
1084
1084
|
packageCapabilities: {
|
|
1085
1085
|
updatePreferences: 1
|
|
@@ -1968,7 +1968,7 @@ var HttpClient = class {
|
|
|
1968
1968
|
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
1969
1969
|
signal: options?.signal
|
|
1970
1970
|
});
|
|
1971
|
-
if (!response.ok
|
|
1971
|
+
if (!response.ok) {
|
|
1972
1972
|
const body = await response.text();
|
|
1973
1973
|
const parsed = parseResponseBody(body);
|
|
1974
1974
|
if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
|
|
@@ -2216,7 +2216,7 @@ function decodeSseFrame(frame) {
|
|
|
2216
2216
|
return parsed;
|
|
2217
2217
|
}
|
|
2218
2218
|
function sleep(ms) {
|
|
2219
|
-
return new Promise((
|
|
2219
|
+
return new Promise((resolve20) => setTimeout(resolve20, ms));
|
|
2220
2220
|
}
|
|
2221
2221
|
function withCoworkNetworkHint(message) {
|
|
2222
2222
|
if (!isCoworkLikeSandbox2() || message.includes(COWORK_NETWORK_HINT)) {
|
|
@@ -3981,14 +3981,14 @@ async function* observeRunEvents(options) {
|
|
|
3981
3981
|
try {
|
|
3982
3982
|
for (; ; ) {
|
|
3983
3983
|
if (queue.length === 0) {
|
|
3984
|
-
const waitForItem = new Promise((
|
|
3985
|
-
wake =
|
|
3984
|
+
const waitForItem = new Promise((resolve20) => {
|
|
3985
|
+
wake = resolve20;
|
|
3986
3986
|
});
|
|
3987
3987
|
if (!sawFirstSnapshot) {
|
|
3988
3988
|
const timedOut = await Promise.race([
|
|
3989
3989
|
waitForItem.then(() => false),
|
|
3990
3990
|
new Promise(
|
|
3991
|
-
(
|
|
3991
|
+
(resolve20) => setTimeout(() => resolve20(true), OBSERVE_BOOTSTRAP_TIMEOUT_MS)
|
|
3992
3992
|
)
|
|
3993
3993
|
]);
|
|
3994
3994
|
if (timedOut && queue.length === 0) {
|
|
@@ -4347,7 +4347,7 @@ function parseEnvTestPolicyOverrides() {
|
|
|
4347
4347
|
return normalizeTestPolicyOverrides(parsed, "DEEPLINE_TEST_POLICY_OVERRIDES");
|
|
4348
4348
|
}
|
|
4349
4349
|
function sleep2(ms) {
|
|
4350
|
-
return new Promise((
|
|
4350
|
+
return new Promise((resolve20) => setTimeout(resolve20, ms));
|
|
4351
4351
|
}
|
|
4352
4352
|
function isTransientCompileManifestError(error) {
|
|
4353
4353
|
if (error instanceof DeeplineError && typeof error.statusCode === "number") {
|
|
@@ -5697,26 +5697,12 @@ var DeeplineClient = class {
|
|
|
5697
5697
|
const headers = options?.lastEventId && options.lastEventId.trim() ? { "Last-Event-ID": options.lastEventId.trim() } : void 0;
|
|
5698
5698
|
const params = new URLSearchParams();
|
|
5699
5699
|
params.set("mode", options?.mode ?? "cli");
|
|
5700
|
-
const
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
`/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
|
|
5707
|
-
{ signal: options?.signal, headers }
|
|
5708
|
-
)) {
|
|
5709
|
-
sawEvent = true;
|
|
5710
|
-
if (event.scope === "play") {
|
|
5711
|
-
yield event;
|
|
5712
|
-
}
|
|
5713
|
-
}
|
|
5714
|
-
return;
|
|
5715
|
-
} catch (error) {
|
|
5716
|
-
const projectionPending = options?.waitForProjection === true && !sawEvent && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 202 && error.code === "RUN_PROJECTION_PENDING") && Date.now() < projectionDeadline;
|
|
5717
|
-
if (!projectionPending) throw error;
|
|
5718
|
-
await sleep2(streamReconnectDelayMs(projectionAttempt));
|
|
5719
|
-
projectionAttempt += 1;
|
|
5700
|
+
for await (const event of this.http.streamSse(
|
|
5701
|
+
`/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
|
|
5702
|
+
{ signal: options?.signal, headers }
|
|
5703
|
+
)) {
|
|
5704
|
+
if (event.scope === "play") {
|
|
5705
|
+
yield event;
|
|
5720
5706
|
}
|
|
5721
5707
|
}
|
|
5722
5708
|
}
|
|
@@ -6745,8 +6731,7 @@ var DeeplineClient = class {
|
|
|
6745
6731
|
}
|
|
6746
6732
|
for await (const event of this.streamPlayRunEvents(workflowId, {
|
|
6747
6733
|
mode: "cli",
|
|
6748
|
-
signal: options?.signal
|
|
6749
|
-
waitForProjection: true
|
|
6734
|
+
signal: options?.signal
|
|
6750
6735
|
})) {
|
|
6751
6736
|
if (options?.signal?.aborted) {
|
|
6752
6737
|
await this.cancelPlay(workflowId);
|
|
@@ -7769,6 +7754,10 @@ function flattenObjectColumns(row, options = {}) {
|
|
|
7769
7754
|
}
|
|
7770
7755
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
7771
7756
|
const record = value;
|
|
7757
|
+
if (options.objectColumns === "json") {
|
|
7758
|
+
flattened[key] = csvSafeJsonString(record);
|
|
7759
|
+
continue;
|
|
7760
|
+
}
|
|
7772
7761
|
const hasMatchedEnvelope = Object.prototype.hasOwnProperty.call(record, "matched_result") || Object.prototype.hasOwnProperty.call(record, "matchedResult");
|
|
7773
7762
|
if (hasMatchedEnvelope) {
|
|
7774
7763
|
flattened[key] = csvSafeJsonString(record);
|
|
@@ -8093,6 +8082,8 @@ async function httpJson(method, url, apiKey, body) {
|
|
|
8093
8082
|
"X-Deepline-API-Contract": SDK_API_CONTRACT
|
|
8094
8083
|
};
|
|
8095
8084
|
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
|
8085
|
+
const bypassToken = process.env.VERCEL_PROTECTION_BYPASS_TOKEN?.trim();
|
|
8086
|
+
if (bypassToken) headers["x-vercel-protection-bypass"] = bypassToken;
|
|
8096
8087
|
let response = null;
|
|
8097
8088
|
let lastError = null;
|
|
8098
8089
|
for (const candidateUrl of buildCandidateUrls2(url)) {
|
|
@@ -8159,7 +8150,7 @@ function buildCandidateUrls2(url) {
|
|
|
8159
8150
|
}
|
|
8160
8151
|
}
|
|
8161
8152
|
function sleep4(ms) {
|
|
8162
|
-
return new Promise((
|
|
8153
|
+
return new Promise((resolve20) => setTimeout(resolve20, ms));
|
|
8163
8154
|
}
|
|
8164
8155
|
function printDeeplineLogo() {
|
|
8165
8156
|
if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
|
|
@@ -10122,10 +10113,6 @@ var import_node_fs7 = require("fs");
|
|
|
10122
10113
|
var import_node_os6 = require("os");
|
|
10123
10114
|
var import_node_path8 = require("path");
|
|
10124
10115
|
|
|
10125
|
-
// src/cli/dataset-stats.ts
|
|
10126
|
-
var import_node_fs6 = require("fs");
|
|
10127
|
-
var import_node_path7 = require("path");
|
|
10128
|
-
|
|
10129
10116
|
// ../plays/dataset-summary.ts
|
|
10130
10117
|
function formatDatasetRowCountsLine(counts) {
|
|
10131
10118
|
const { persisted, succeeded, failed } = counts;
|
|
@@ -10179,6 +10166,103 @@ function formatDatasetExecutionStats(raw, _persistedRowTotal) {
|
|
|
10179
10166
|
return stats;
|
|
10180
10167
|
}
|
|
10181
10168
|
|
|
10169
|
+
// src/cli/run-dataset-csv.ts
|
|
10170
|
+
var import_node_fs6 = require("fs");
|
|
10171
|
+
var import_node_path7 = require("path");
|
|
10172
|
+
var RunDatasetCsv = class _RunDatasetCsv {
|
|
10173
|
+
#projection;
|
|
10174
|
+
constructor(input2) {
|
|
10175
|
+
const rows = input2.rows.map(projectRunDatasetRow);
|
|
10176
|
+
this.#projection = {
|
|
10177
|
+
rows,
|
|
10178
|
+
columns: runDatasetCsvColumns(rows, input2.columns)
|
|
10179
|
+
};
|
|
10180
|
+
}
|
|
10181
|
+
static from(input2) {
|
|
10182
|
+
return new _RunDatasetCsv(input2);
|
|
10183
|
+
}
|
|
10184
|
+
projection() {
|
|
10185
|
+
return this.#projection;
|
|
10186
|
+
}
|
|
10187
|
+
write(outPath) {
|
|
10188
|
+
const absolutePath = (0, import_node_path7.resolve)(outPath);
|
|
10189
|
+
(0, import_node_fs6.writeFileSync)(
|
|
10190
|
+
absolutePath,
|
|
10191
|
+
csvStringFromRows(this.#projection.rows, this.#projection.columns),
|
|
10192
|
+
"utf-8"
|
|
10193
|
+
);
|
|
10194
|
+
return absolutePath;
|
|
10195
|
+
}
|
|
10196
|
+
};
|
|
10197
|
+
function writeRunDatasetCsv(input2) {
|
|
10198
|
+
return RunDatasetCsv.from(input2).write(input2.outPath);
|
|
10199
|
+
}
|
|
10200
|
+
function projectRunDatasetRow(row) {
|
|
10201
|
+
return Object.fromEntries(
|
|
10202
|
+
Object.entries(row).map(([column, value]) => [
|
|
10203
|
+
column,
|
|
10204
|
+
projectRunDatasetCell(value)
|
|
10205
|
+
])
|
|
10206
|
+
);
|
|
10207
|
+
}
|
|
10208
|
+
function projectRunDatasetCell(value) {
|
|
10209
|
+
const logicalValue = parseSerializedDatasetValue(value);
|
|
10210
|
+
if (logicalValue === null || logicalValue === void 0) return logicalValue;
|
|
10211
|
+
if (typeof logicalValue === "object") {
|
|
10212
|
+
return csvSafeJsonString(canonicalDatasetJson(logicalValue));
|
|
10213
|
+
}
|
|
10214
|
+
return logicalValue;
|
|
10215
|
+
}
|
|
10216
|
+
function canonicalDatasetJson(value) {
|
|
10217
|
+
return canonicalDatasetJsonValue(value, /* @__PURE__ */ new WeakSet());
|
|
10218
|
+
}
|
|
10219
|
+
function canonicalDatasetJsonValue(value, ancestors) {
|
|
10220
|
+
if (Array.isArray(value)) {
|
|
10221
|
+
if (ancestors.has(value)) return value;
|
|
10222
|
+
ancestors.add(value);
|
|
10223
|
+
const normalized2 = value.map(
|
|
10224
|
+
(item) => canonicalDatasetJsonValue(item, ancestors)
|
|
10225
|
+
);
|
|
10226
|
+
ancestors.delete(value);
|
|
10227
|
+
return normalized2;
|
|
10228
|
+
}
|
|
10229
|
+
if (!value || typeof value !== "object" || value instanceof Date) {
|
|
10230
|
+
return value;
|
|
10231
|
+
}
|
|
10232
|
+
if (ancestors.has(value)) return value;
|
|
10233
|
+
ancestors.add(value);
|
|
10234
|
+
const record = value;
|
|
10235
|
+
const normalized = Object.fromEntries(
|
|
10236
|
+
Object.keys(record).sort((left, right) => left.localeCompare(right)).map((key) => [key, canonicalDatasetJsonValue(record[key], ancestors)])
|
|
10237
|
+
);
|
|
10238
|
+
ancestors.delete(value);
|
|
10239
|
+
return normalized;
|
|
10240
|
+
}
|
|
10241
|
+
function parseSerializedDatasetValue(value) {
|
|
10242
|
+
if (typeof value !== "string") return value;
|
|
10243
|
+
const text = value.trim();
|
|
10244
|
+
if (!text || !["{", "["].includes(text[0] ?? "")) return value;
|
|
10245
|
+
try {
|
|
10246
|
+
return JSON.parse(text);
|
|
10247
|
+
} catch {
|
|
10248
|
+
return value;
|
|
10249
|
+
}
|
|
10250
|
+
}
|
|
10251
|
+
function runDatasetCsvColumns(rows, declaredColumns) {
|
|
10252
|
+
const columns = [];
|
|
10253
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10254
|
+
const add = (column) => {
|
|
10255
|
+
if (!column || seen.has(column)) return;
|
|
10256
|
+
seen.add(column);
|
|
10257
|
+
columns.push(column);
|
|
10258
|
+
};
|
|
10259
|
+
for (const column of declaredColumns) add(column);
|
|
10260
|
+
for (const row of rows) {
|
|
10261
|
+
for (const column of Object.keys(row)) add(column);
|
|
10262
|
+
}
|
|
10263
|
+
return columns;
|
|
10264
|
+
}
|
|
10265
|
+
|
|
10182
10266
|
// src/cli/dataset-stats.ts
|
|
10183
10267
|
function mergeCanonicalRowsInfo(left, right) {
|
|
10184
10268
|
const preferred = right.rows.length > left.rows.length || right.complete && !left.complete && right.rows.length === left.rows.length ? right : left;
|
|
@@ -10596,6 +10680,11 @@ function collectSerializedDatasetRowsInfos(statusOrResult) {
|
|
|
10596
10680
|
}
|
|
10597
10681
|
return infos;
|
|
10598
10682
|
}
|
|
10683
|
+
var LegacyRunDatasetCatalogAdapter = class {
|
|
10684
|
+
static datasets(statusOrResult) {
|
|
10685
|
+
return collectSerializedDatasetRowsInfos(statusOrResult);
|
|
10686
|
+
}
|
|
10687
|
+
};
|
|
10599
10688
|
function extractCanonicalRowsInfo(statusOrResult) {
|
|
10600
10689
|
return collectCanonicalRowsInfos(statusOrResult)[0] ?? null;
|
|
10601
10690
|
}
|
|
@@ -10765,22 +10854,6 @@ function buildDatasetStats(rows, totalRows = rows.length, columns = inferColumns
|
|
|
10765
10854
|
columnStats
|
|
10766
10855
|
};
|
|
10767
10856
|
}
|
|
10768
|
-
function writeCanonicalRowsCsv(rowsInfo, outPath) {
|
|
10769
|
-
if (!rowsInfo.complete) {
|
|
10770
|
-
throw new Error(
|
|
10771
|
-
`Run output only includes ${rowsInfo.rows.length} preview row(s) of ${rowsInfo.totalRows}; cannot export a complete CSV from this status payload yet.`
|
|
10772
|
-
);
|
|
10773
|
-
}
|
|
10774
|
-
const sanitized = sanitizeCsvProjectionInfo({
|
|
10775
|
-
rows: rowsInfo.rows,
|
|
10776
|
-
columns: rowsInfo.columns
|
|
10777
|
-
});
|
|
10778
|
-
const rows = dataExportRows(sanitized.rows);
|
|
10779
|
-
const columns = dataExportColumns(rows, sanitized.columns);
|
|
10780
|
-
const resolved = (0, import_node_path7.resolve)(outPath);
|
|
10781
|
-
(0, import_node_fs6.writeFileSync)(resolved, csvStringFromRows(rows, columns), "utf-8");
|
|
10782
|
-
return resolved;
|
|
10783
|
-
}
|
|
10784
10857
|
|
|
10785
10858
|
// src/cli/commands/csv.ts
|
|
10786
10859
|
function parseRowRange(raw) {
|
|
@@ -18261,6 +18334,207 @@ var SDK_PACKAGE_JSON = (0, import_node_path13.resolve)(SDK_PACKAGE_ROOT, "packag
|
|
|
18261
18334
|
var SDK_ENTRY_FILE = (0, import_node_path13.resolve)(SDK_SOURCE_ROOT, "index.ts");
|
|
18262
18335
|
var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : (0, import_node_path13.resolve)(SDK_PACKAGE_ROOT, "dist", "index.d.ts");
|
|
18263
18336
|
|
|
18337
|
+
// src/cli/run-dataset-selection.ts
|
|
18338
|
+
var Run = class _Run {
|
|
18339
|
+
#datasets;
|
|
18340
|
+
constructor(input2) {
|
|
18341
|
+
this.#datasets = RunDatasetCatalog.from({
|
|
18342
|
+
runPackage: input2.runPackage,
|
|
18343
|
+
datasets: input2.datasets
|
|
18344
|
+
});
|
|
18345
|
+
}
|
|
18346
|
+
static open(input2) {
|
|
18347
|
+
return new _Run(input2);
|
|
18348
|
+
}
|
|
18349
|
+
datasets() {
|
|
18350
|
+
return this.#datasets;
|
|
18351
|
+
}
|
|
18352
|
+
/** Select the Dataset a caller wants to export; enumerate with datasets(). */
|
|
18353
|
+
dataset(path) {
|
|
18354
|
+
return this.#datasets.choose(path);
|
|
18355
|
+
}
|
|
18356
|
+
};
|
|
18357
|
+
var RunDatasetCatalog = class _RunDatasetCatalog {
|
|
18358
|
+
#available;
|
|
18359
|
+
#returned;
|
|
18360
|
+
#recovered;
|
|
18361
|
+
constructor(input2) {
|
|
18362
|
+
this.#available = input2.available.map((info) => RunDataset.from(info));
|
|
18363
|
+
this.#returned = input2.returned.map((info) => RunDataset.from(info));
|
|
18364
|
+
this.#recovered = input2.available.filter((info) => info.recovered).map((info) => RunDataset.from(info));
|
|
18365
|
+
}
|
|
18366
|
+
static from(input2) {
|
|
18367
|
+
const available = withReturnedDatasetAliases(
|
|
18368
|
+
input2.runPackage,
|
|
18369
|
+
distinctRunDatasets(input2.datasets)
|
|
18370
|
+
);
|
|
18371
|
+
return new _RunDatasetCatalog({
|
|
18372
|
+
available,
|
|
18373
|
+
returned: returnedRunDatasets(input2.runPackage, available)
|
|
18374
|
+
});
|
|
18375
|
+
}
|
|
18376
|
+
available() {
|
|
18377
|
+
return this.#available;
|
|
18378
|
+
}
|
|
18379
|
+
returned() {
|
|
18380
|
+
return this.#returned;
|
|
18381
|
+
}
|
|
18382
|
+
recovered() {
|
|
18383
|
+
return this.#recovered;
|
|
18384
|
+
}
|
|
18385
|
+
/**
|
|
18386
|
+
* Select an exact public Dataset path/id/namespace. With no requested path,
|
|
18387
|
+
* a Run returns its sole returned Dataset, or its sole recovered Dataset.
|
|
18388
|
+
*/
|
|
18389
|
+
choose(path) {
|
|
18390
|
+
const requested = path?.trim();
|
|
18391
|
+
if (requested) {
|
|
18392
|
+
return this.#available.find((dataset) => dataset.matches(requested)) ?? null;
|
|
18393
|
+
}
|
|
18394
|
+
if (this.#returned.length === 1) return this.#returned[0];
|
|
18395
|
+
return this.#returned.length === 0 && this.#recovered.length === 1 ? this.#recovered[0] : null;
|
|
18396
|
+
}
|
|
18397
|
+
};
|
|
18398
|
+
var RunDataset = class _RunDataset {
|
|
18399
|
+
#info;
|
|
18400
|
+
constructor(info) {
|
|
18401
|
+
this.#info = info;
|
|
18402
|
+
}
|
|
18403
|
+
static from(info) {
|
|
18404
|
+
return new _RunDataset(info);
|
|
18405
|
+
}
|
|
18406
|
+
get source() {
|
|
18407
|
+
return this.#info.source;
|
|
18408
|
+
}
|
|
18409
|
+
get datasetId() {
|
|
18410
|
+
return this.#info.datasetId;
|
|
18411
|
+
}
|
|
18412
|
+
get tableNamespace() {
|
|
18413
|
+
return this.#info.tableNamespace;
|
|
18414
|
+
}
|
|
18415
|
+
get rows() {
|
|
18416
|
+
return this.#info.rows;
|
|
18417
|
+
}
|
|
18418
|
+
get totalRows() {
|
|
18419
|
+
return this.#info.totalRows;
|
|
18420
|
+
}
|
|
18421
|
+
get complete() {
|
|
18422
|
+
return this.#info.complete;
|
|
18423
|
+
}
|
|
18424
|
+
get recovered() {
|
|
18425
|
+
return this.#info.recovered;
|
|
18426
|
+
}
|
|
18427
|
+
get exportUnavailableReason() {
|
|
18428
|
+
return this.#info.exportUnavailableReason;
|
|
18429
|
+
}
|
|
18430
|
+
get exportUnavailableMessage() {
|
|
18431
|
+
return this.#info.exportUnavailableMessage;
|
|
18432
|
+
}
|
|
18433
|
+
matches(path) {
|
|
18434
|
+
return this.source === path || this.datasetId === path || this.tableNamespace === path;
|
|
18435
|
+
}
|
|
18436
|
+
/** Return a new Handle when its preview has been replaced by fetched rows. */
|
|
18437
|
+
withRows(info) {
|
|
18438
|
+
return _RunDataset.from(info);
|
|
18439
|
+
}
|
|
18440
|
+
/** Write this Dataset's stable, non-flattening CSV Projection. */
|
|
18441
|
+
exportCsv(outPath) {
|
|
18442
|
+
if (!this.complete) {
|
|
18443
|
+
throw new Error(
|
|
18444
|
+
`Run Dataset '${this.source ?? this.tableNamespace ?? "dataset"}' only includes ${this.rows.length} preview row(s) of ${this.totalRows}; cannot export a complete CSV yet.`
|
|
18445
|
+
);
|
|
18446
|
+
}
|
|
18447
|
+
return writeRunDatasetCsv({
|
|
18448
|
+
rows: this.rows,
|
|
18449
|
+
columns: this.#info.columns,
|
|
18450
|
+
outPath
|
|
18451
|
+
});
|
|
18452
|
+
}
|
|
18453
|
+
/** Compatibility seam for callers which still return CanonicalRowsInfo. */
|
|
18454
|
+
info() {
|
|
18455
|
+
return this.#info;
|
|
18456
|
+
}
|
|
18457
|
+
};
|
|
18458
|
+
function distinctRunDatasets(infos) {
|
|
18459
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
18460
|
+
for (const info of infos) {
|
|
18461
|
+
const identity = info.datasetId?.trim() ? `id:${info.datasetId.trim()}` : `path:${info.source ?? info.tableNamespace ?? "dataset"}`;
|
|
18462
|
+
const existing = byIdentity.get(identity);
|
|
18463
|
+
byIdentity.set(
|
|
18464
|
+
identity,
|
|
18465
|
+
existing ? mergeCanonicalRowsInfo(existing, info) : info
|
|
18466
|
+
);
|
|
18467
|
+
}
|
|
18468
|
+
return [...byIdentity.values()];
|
|
18469
|
+
}
|
|
18470
|
+
function packageForDatasetSelection(runPackage) {
|
|
18471
|
+
const root = recordValue(runPackage);
|
|
18472
|
+
const nested = recordValue(root.package);
|
|
18473
|
+
if (nested?.kind === "play_run") return nested;
|
|
18474
|
+
return root.kind === "play_run" ? root : null;
|
|
18475
|
+
}
|
|
18476
|
+
function withReturnedDatasetAliases(runPackage, available) {
|
|
18477
|
+
const outputs = recordValue(packageForDatasetSelection(runPackage)?.outputs);
|
|
18478
|
+
if (Object.keys(outputs).length === 0) return available;
|
|
18479
|
+
const expanded = [...available];
|
|
18480
|
+
for (const outputValue of Object.values(outputs)) {
|
|
18481
|
+
const output2 = recordValue(outputValue);
|
|
18482
|
+
if (output2.kind !== "dataset") continue;
|
|
18483
|
+
const alias = stringValue2(output2.path);
|
|
18484
|
+
if (!alias) continue;
|
|
18485
|
+
const datasetId = stringValue2(output2.datasetId);
|
|
18486
|
+
const canonicalPath2 = stringValue2(output2.dataset);
|
|
18487
|
+
const canonical = available.find(
|
|
18488
|
+
(info) => datasetId && info.datasetId === datasetId || canonicalPath2 && info.source === canonicalPath2
|
|
18489
|
+
);
|
|
18490
|
+
if (!canonical) continue;
|
|
18491
|
+
const aliasIndex = expanded.findIndex((info) => info.source === alias);
|
|
18492
|
+
if (aliasIndex >= 0) {
|
|
18493
|
+
expanded[aliasIndex] = {
|
|
18494
|
+
...mergeCanonicalRowsInfo(expanded[aliasIndex], canonical),
|
|
18495
|
+
source: alias
|
|
18496
|
+
};
|
|
18497
|
+
} else {
|
|
18498
|
+
expanded.push({ ...canonical, source: alias });
|
|
18499
|
+
}
|
|
18500
|
+
}
|
|
18501
|
+
return expanded;
|
|
18502
|
+
}
|
|
18503
|
+
function returnedRunDatasets(runPackage, available) {
|
|
18504
|
+
const outputs = recordValue(packageForDatasetSelection(runPackage)?.outputs);
|
|
18505
|
+
if (Object.keys(outputs).length > 0) {
|
|
18506
|
+
const selected = /* @__PURE__ */ new Map();
|
|
18507
|
+
for (const outputValue of Object.values(outputs)) {
|
|
18508
|
+
const output2 = recordValue(outputValue);
|
|
18509
|
+
if (output2.kind !== "dataset") continue;
|
|
18510
|
+
const datasetId = stringValue2(output2.datasetId);
|
|
18511
|
+
const alias = stringValue2(output2.path);
|
|
18512
|
+
const canonicalPath2 = stringValue2(output2.dataset);
|
|
18513
|
+
const info = (alias ? available.find((candidate) => candidate.source === alias) : null) ?? (datasetId ? available.find((candidate) => candidate.datasetId === datasetId) : null) ?? (canonicalPath2 ? available.find((candidate) => candidate.source === canonicalPath2) : null);
|
|
18514
|
+
if (!info) continue;
|
|
18515
|
+
const identity = datasetId ? `id:${datasetId}` : `path:${canonicalPath2 ?? alias ?? info.source ?? "dataset"}`;
|
|
18516
|
+
const aliased = { ...info, source: alias ?? info.source };
|
|
18517
|
+
const existing = selected.get(identity);
|
|
18518
|
+
selected.set(
|
|
18519
|
+
identity,
|
|
18520
|
+
existing ? mergeCanonicalRowsInfo(existing, aliased) : aliased
|
|
18521
|
+
);
|
|
18522
|
+
}
|
|
18523
|
+
if (selected.size > 0) return [...selected.values()];
|
|
18524
|
+
}
|
|
18525
|
+
return distinctRunDatasets(
|
|
18526
|
+
available.filter(
|
|
18527
|
+
(info) => Boolean(info.source?.startsWith("result.")) && !info.recovered
|
|
18528
|
+
)
|
|
18529
|
+
);
|
|
18530
|
+
}
|
|
18531
|
+
function recordValue(value) {
|
|
18532
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
18533
|
+
}
|
|
18534
|
+
function stringValue2(value) {
|
|
18535
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
18536
|
+
}
|
|
18537
|
+
|
|
18264
18538
|
// src/cli/progress.ts
|
|
18265
18539
|
var import_node_worker_threads = require("worker_threads");
|
|
18266
18540
|
var CliProgress = class {
|
|
@@ -18530,7 +18804,7 @@ ${hint}`;
|
|
|
18530
18804
|
|
|
18531
18805
|
// ../play-runtime/governor/policy.ts
|
|
18532
18806
|
var DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS = 64;
|
|
18533
|
-
var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS =
|
|
18807
|
+
var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS = 1e3;
|
|
18534
18808
|
var MAX_CONFIGURABLE_CONCURRENT_ROWS = 1e3;
|
|
18535
18809
|
function resolveMaxConcurrentExternalCalls(requested) {
|
|
18536
18810
|
if (requested === void 0 || requested === null) {
|
|
@@ -19072,8 +19346,7 @@ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
19072
19346
|
"--force",
|
|
19073
19347
|
"--force-tool-refresh",
|
|
19074
19348
|
"--open",
|
|
19075
|
-
"--debug-map-latency"
|
|
19076
|
-
"--debug-fixture-provider-pacing"
|
|
19349
|
+
"--debug-map-latency"
|
|
19077
19350
|
]);
|
|
19078
19351
|
async function pathExistsIncludingSymlink(path) {
|
|
19079
19352
|
try {
|
|
@@ -19208,7 +19481,7 @@ function traceCliSync(phase, fields, run) {
|
|
|
19208
19481
|
}
|
|
19209
19482
|
}
|
|
19210
19483
|
function sleep5(ms) {
|
|
19211
|
-
return new Promise((
|
|
19484
|
+
return new Promise((resolve20) => setTimeout(resolve20, ms));
|
|
19212
19485
|
}
|
|
19213
19486
|
function parseReferencedPlayTarget2(target) {
|
|
19214
19487
|
const trimmed = target.trim();
|
|
@@ -20779,7 +21052,7 @@ async function waitForPlayCompletionByStream(input2) {
|
|
|
20779
21052
|
try {
|
|
20780
21053
|
for await (const event of input2.client.streamPlayRunEvents(
|
|
20781
21054
|
input2.workflowId,
|
|
20782
|
-
{ signal: controller.signal
|
|
21055
|
+
{ signal: controller.signal }
|
|
20783
21056
|
)) {
|
|
20784
21057
|
sawEvent = true;
|
|
20785
21058
|
const terminal = await handleLiveEvent(event);
|
|
@@ -22521,103 +22794,6 @@ async function fetchBackingDatasetRows(input2) {
|
|
|
22521
22794
|
source: `${input2.rowsInfo.source ?? "result.rows"} -> /api/v2/plays/${playName}/sheet?tableNamespace=${tableNamespace}`
|
|
22522
22795
|
};
|
|
22523
22796
|
}
|
|
22524
|
-
function resolveDatasetByName(available, datasetPath) {
|
|
22525
|
-
const target = datasetPath.trim();
|
|
22526
|
-
const exact = available.find((info) => info.source === target);
|
|
22527
|
-
if (exact) {
|
|
22528
|
-
return exact;
|
|
22529
|
-
}
|
|
22530
|
-
const byDatasetId = available.find((info) => info.datasetId === target);
|
|
22531
|
-
if (byDatasetId) {
|
|
22532
|
-
return byDatasetId;
|
|
22533
|
-
}
|
|
22534
|
-
const byNamespace = available.find(
|
|
22535
|
-
(info) => info.tableNamespace && info.tableNamespace === target
|
|
22536
|
-
);
|
|
22537
|
-
if (byNamespace) {
|
|
22538
|
-
return byNamespace;
|
|
22539
|
-
}
|
|
22540
|
-
return null;
|
|
22541
|
-
}
|
|
22542
|
-
function canonicalRowsIdentity(info) {
|
|
22543
|
-
return info.datasetId?.trim() ? `id:${info.datasetId.trim()}` : `path:${info.source ?? info.tableNamespace ?? "dataset"}`;
|
|
22544
|
-
}
|
|
22545
|
-
function distinctCanonicalRowsInfos(infos) {
|
|
22546
|
-
const byIdentity = /* @__PURE__ */ new Map();
|
|
22547
|
-
for (const info of infos) {
|
|
22548
|
-
const identity = canonicalRowsIdentity(info);
|
|
22549
|
-
const existing = byIdentity.get(identity);
|
|
22550
|
-
byIdentity.set(
|
|
22551
|
-
identity,
|
|
22552
|
-
existing ? mergeCanonicalRowsInfo(existing, info) : info
|
|
22553
|
-
);
|
|
22554
|
-
}
|
|
22555
|
-
return [...byIdentity.values()];
|
|
22556
|
-
}
|
|
22557
|
-
function packageForExportSelection(status) {
|
|
22558
|
-
const root = status;
|
|
22559
|
-
const nested = readRecord(root.package);
|
|
22560
|
-
if (nested?.kind === "play_run") return nested;
|
|
22561
|
-
return root.kind === "play_run" ? root : null;
|
|
22562
|
-
}
|
|
22563
|
-
function withReturnedDatasetAliases(status, available) {
|
|
22564
|
-
const packaged = packageForExportSelection(status);
|
|
22565
|
-
const outputs = readRecord(packaged?.outputs);
|
|
22566
|
-
if (!outputs) return available;
|
|
22567
|
-
const expanded = [...available];
|
|
22568
|
-
for (const outputValue of Object.values(outputs)) {
|
|
22569
|
-
const output2 = readRecord(outputValue);
|
|
22570
|
-
if (output2?.kind !== "dataset") continue;
|
|
22571
|
-
const alias = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
|
|
22572
|
-
if (!alias) continue;
|
|
22573
|
-
const datasetId = typeof output2.datasetId === "string" && output2.datasetId.trim() ? output2.datasetId.trim() : null;
|
|
22574
|
-
const canonicalPath2 = typeof output2.dataset === "string" && output2.dataset.trim() ? output2.dataset.trim() : null;
|
|
22575
|
-
const canonical = available.find(
|
|
22576
|
-
(info) => datasetId && info.datasetId === datasetId || canonicalPath2 && info.source === canonicalPath2
|
|
22577
|
-
);
|
|
22578
|
-
if (canonical) {
|
|
22579
|
-
const aliasIndex = expanded.findIndex((info) => info.source === alias);
|
|
22580
|
-
if (aliasIndex >= 0) {
|
|
22581
|
-
expanded[aliasIndex] = {
|
|
22582
|
-
...mergeCanonicalRowsInfo(expanded[aliasIndex], canonical),
|
|
22583
|
-
source: alias
|
|
22584
|
-
};
|
|
22585
|
-
} else {
|
|
22586
|
-
expanded.push({ ...canonical, source: alias });
|
|
22587
|
-
}
|
|
22588
|
-
}
|
|
22589
|
-
}
|
|
22590
|
-
return expanded;
|
|
22591
|
-
}
|
|
22592
|
-
function returnedRowsInfos(status, available) {
|
|
22593
|
-
const packaged = packageForExportSelection(status);
|
|
22594
|
-
const outputs = readRecord(packaged?.outputs);
|
|
22595
|
-
if (outputs) {
|
|
22596
|
-
const selected = /* @__PURE__ */ new Map();
|
|
22597
|
-
for (const outputValue of Object.values(outputs)) {
|
|
22598
|
-
const output2 = readRecord(outputValue);
|
|
22599
|
-
if (output2?.kind !== "dataset") continue;
|
|
22600
|
-
const datasetId = typeof output2.datasetId === "string" && output2.datasetId.trim() ? output2.datasetId.trim() : null;
|
|
22601
|
-
const alias = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
|
|
22602
|
-
const canonicalPath2 = typeof output2.dataset === "string" && output2.dataset.trim() ? output2.dataset.trim() : null;
|
|
22603
|
-
const info = (alias ? available.find((candidate) => candidate.source === alias) : null) ?? (datasetId ? available.find((candidate) => candidate.datasetId === datasetId) : null) ?? (canonicalPath2 ? available.find((candidate) => candidate.source === canonicalPath2) : null);
|
|
22604
|
-
if (!info) continue;
|
|
22605
|
-
const identity = datasetId ? `id:${datasetId}` : `path:${canonicalPath2 ?? alias ?? info.source ?? "dataset"}`;
|
|
22606
|
-
const aliased = { ...info, source: alias ?? info.source };
|
|
22607
|
-
const existing = selected.get(identity);
|
|
22608
|
-
selected.set(
|
|
22609
|
-
identity,
|
|
22610
|
-
existing ? mergeCanonicalRowsInfo(existing, aliased) : aliased
|
|
22611
|
-
);
|
|
22612
|
-
}
|
|
22613
|
-
if (selected.size > 0) return [...selected.values()];
|
|
22614
|
-
}
|
|
22615
|
-
return distinctCanonicalRowsInfos(
|
|
22616
|
-
available.filter(
|
|
22617
|
-
(info) => Boolean(info.source?.startsWith("result.")) && !info.recovered
|
|
22618
|
-
)
|
|
22619
|
-
);
|
|
22620
|
-
}
|
|
22621
22797
|
function exportDatasetCommand(input2) {
|
|
22622
22798
|
return `deepline runs export ${input2.runId} --dataset ${shellSingleQuote(
|
|
22623
22799
|
input2.datasetPath
|
|
@@ -22676,16 +22852,17 @@ async function exportPlayStatusRows(client2, status, outPath, options = {}) {
|
|
|
22676
22852
|
if (!outPath) {
|
|
22677
22853
|
return null;
|
|
22678
22854
|
}
|
|
22679
|
-
const
|
|
22680
|
-
status,
|
|
22681
|
-
|
|
22682
|
-
);
|
|
22683
|
-
const
|
|
22684
|
-
const
|
|
22685
|
-
|
|
22686
|
-
);
|
|
22687
|
-
const
|
|
22688
|
-
|
|
22855
|
+
const run = Run.open({
|
|
22856
|
+
runPackage: status,
|
|
22857
|
+
datasets: LegacyRunDatasetCatalogAdapter.datasets(status)
|
|
22858
|
+
});
|
|
22859
|
+
const datasets = run.datasets();
|
|
22860
|
+
const availableRows = datasets.available().map((dataset) => dataset.info());
|
|
22861
|
+
const returnedRows = datasets.returned().map((dataset) => dataset.info());
|
|
22862
|
+
const recoveredRows = datasets.recovered().map((dataset) => dataset.info());
|
|
22863
|
+
const selectedDataset = run.dataset(options.datasetPath);
|
|
22864
|
+
const rowsInfo = selectedDataset?.info() ?? null;
|
|
22865
|
+
if (!selectedDataset && options.datasetPath) {
|
|
22689
22866
|
const available = availableRows.map((info) => info.source).filter((source) => typeof source === "string");
|
|
22690
22867
|
const commands = datasetChoiceLines({
|
|
22691
22868
|
runId: status.runId,
|
|
@@ -22776,7 +22953,7 @@ ${commands.join("\n")}`,
|
|
|
22776
22953
|
datasetPath: options.datasetPath
|
|
22777
22954
|
});
|
|
22778
22955
|
return {
|
|
22779
|
-
path:
|
|
22956
|
+
path: RunDataset.from(guarded2).exportCsv(outPath),
|
|
22780
22957
|
rowsInfo: guarded2
|
|
22781
22958
|
};
|
|
22782
22959
|
}
|
|
@@ -22788,7 +22965,7 @@ ${commands.join("\n")}`,
|
|
|
22788
22965
|
datasetPath: options.datasetPath
|
|
22789
22966
|
});
|
|
22790
22967
|
return {
|
|
22791
|
-
path:
|
|
22968
|
+
path: RunDataset.from(guarded2).exportCsv(outPath),
|
|
22792
22969
|
rowsInfo: guarded2
|
|
22793
22970
|
};
|
|
22794
22971
|
}
|
|
@@ -22822,7 +22999,10 @@ ${commands.join("\n")}`,
|
|
|
22822
22999
|
availableRows,
|
|
22823
23000
|
datasetPath: options.datasetPath
|
|
22824
23001
|
});
|
|
22825
|
-
return {
|
|
23002
|
+
return {
|
|
23003
|
+
path: RunDataset.from(guarded).exportCsv(outPath),
|
|
23004
|
+
rowsInfo: guarded
|
|
23005
|
+
};
|
|
22826
23006
|
}
|
|
22827
23007
|
function extractActiveRunsFromError(error) {
|
|
22828
23008
|
if (!(error instanceof DeeplineError)) {
|
|
@@ -23116,9 +23296,6 @@ function parsePlayRunOptions(args) {
|
|
|
23116
23296
|
const forceToolRefresh = args.includes("--force-tool-refresh");
|
|
23117
23297
|
const open2 = args.includes("--open");
|
|
23118
23298
|
const debugMapLatency = args.includes("--debug-map-latency");
|
|
23119
|
-
const debugFixtureProviderPacing = args.includes(
|
|
23120
|
-
"--debug-fixture-provider-pacing"
|
|
23121
|
-
);
|
|
23122
23299
|
const verboseLogs = args.includes("--logs") || debugMapLatency;
|
|
23123
23300
|
let waitTimeoutMs = null;
|
|
23124
23301
|
let maxConcurrentExternalCalls = null;
|
|
@@ -23322,7 +23499,6 @@ function parsePlayRunOptions(args) {
|
|
|
23322
23499
|
open: open2,
|
|
23323
23500
|
profile,
|
|
23324
23501
|
debugMapLatency,
|
|
23325
|
-
debugFixtureProviderPacing,
|
|
23326
23502
|
fixtureBehavior,
|
|
23327
23503
|
runIdFile
|
|
23328
23504
|
};
|
|
@@ -23488,7 +23664,7 @@ function formatPlayRuntimeLimit(runtimeLimit) {
|
|
|
23488
23664
|
function isRecord10(value) {
|
|
23489
23665
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
23490
23666
|
}
|
|
23491
|
-
function
|
|
23667
|
+
function stringValue3(value) {
|
|
23492
23668
|
return typeof value === "string" ? value.trim() : "";
|
|
23493
23669
|
}
|
|
23494
23670
|
function asArray(value) {
|
|
@@ -23508,11 +23684,11 @@ function firstRawPath(entry) {
|
|
|
23508
23684
|
...asArray(details.raw_tool_output_paths),
|
|
23509
23685
|
...asArray(details.candidatePaths),
|
|
23510
23686
|
...asArray(details.candidate_paths)
|
|
23511
|
-
].map(
|
|
23687
|
+
].map(stringValue3).filter(Boolean);
|
|
23512
23688
|
return paths[0];
|
|
23513
23689
|
}
|
|
23514
23690
|
function checkHintExpression(value) {
|
|
23515
|
-
return
|
|
23691
|
+
return stringValue3(value).replace(/^toolExecutionResult\./, "result.");
|
|
23516
23692
|
}
|
|
23517
23693
|
function checkHintRawPath(value) {
|
|
23518
23694
|
return value?.replace(/^toolResponse\./, "result.toolResponse.");
|
|
@@ -23527,7 +23703,7 @@ function collectStaticPipelineToolIds(staticPipeline) {
|
|
|
23527
23703
|
]) {
|
|
23528
23704
|
if (!isRecord10(step)) continue;
|
|
23529
23705
|
if (step.type === "tool") {
|
|
23530
|
-
const toolId =
|
|
23706
|
+
const toolId = stringValue3(step.toolId) || stringValue3(step.tool);
|
|
23531
23707
|
if (toolId) seen.add(toolId);
|
|
23532
23708
|
}
|
|
23533
23709
|
if (step.type === "play_call") {
|
|
@@ -23545,14 +23721,14 @@ function toolGetterHintFromMetadata(toolId, tool) {
|
|
|
23545
23721
|
const lists = extractionEntries2(
|
|
23546
23722
|
resultGuidance.extractedLists ?? resultGuidance.extracted_lists
|
|
23547
23723
|
).map((entry) => ({
|
|
23548
|
-
name:
|
|
23724
|
+
name: stringValue3(entry.name),
|
|
23549
23725
|
expression: checkHintExpression(entry.expression),
|
|
23550
23726
|
raw: checkHintRawPath(firstRawPath(entry))
|
|
23551
23727
|
})).filter((entry) => entry.name && entry.expression);
|
|
23552
23728
|
const values = extractionEntries2(
|
|
23553
23729
|
resultGuidance.extractedValues ?? resultGuidance.extracted_values
|
|
23554
23730
|
).map((entry) => ({
|
|
23555
|
-
name:
|
|
23731
|
+
name: stringValue3(entry.name),
|
|
23556
23732
|
expression: checkHintExpression(entry.expression),
|
|
23557
23733
|
raw: checkHintRawPath(firstRawPath(entry))
|
|
23558
23734
|
})).filter((entry) => entry.name && entry.expression);
|
|
@@ -24113,14 +24289,8 @@ async function handleFileBackedRun(options, hooks) {
|
|
|
24113
24289
|
"--fixture-behavior requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
|
|
24114
24290
|
);
|
|
24115
24291
|
}
|
|
24116
|
-
if (options.debugFixtureProviderPacing && integrationMode !== "fixture") {
|
|
24117
|
-
throw new Error(
|
|
24118
|
-
"--debug-fixture-provider-pacing requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
|
|
24119
|
-
);
|
|
24120
|
-
}
|
|
24121
24292
|
const testPolicyOverrides = {
|
|
24122
|
-
...options.debugMapLatency ? { mapLatencyProfile: true } : {}
|
|
24123
|
-
...options.debugFixtureProviderPacing ? { enforceFixtureProviderPacing: true } : {}
|
|
24293
|
+
...options.debugMapLatency ? { mapLatencyProfile: true } : {}
|
|
24124
24294
|
};
|
|
24125
24295
|
const startRequest = {
|
|
24126
24296
|
name: playName,
|
|
@@ -24302,14 +24472,8 @@ async function handleNamedRun(options, hooks) {
|
|
|
24302
24472
|
"--fixture-behavior requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
|
|
24303
24473
|
);
|
|
24304
24474
|
}
|
|
24305
|
-
if (options.debugFixtureProviderPacing && integrationMode !== "fixture") {
|
|
24306
|
-
throw new Error(
|
|
24307
|
-
"--debug-fixture-provider-pacing requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
|
|
24308
|
-
);
|
|
24309
|
-
}
|
|
24310
24475
|
const testPolicyOverrides = {
|
|
24311
|
-
...options.debugMapLatency ? { mapLatencyProfile: true } : {}
|
|
24312
|
-
...options.debugFixtureProviderPacing ? { enforceFixtureProviderPacing: true } : {}
|
|
24476
|
+
...options.debugMapLatency ? { mapLatencyProfile: true } : {}
|
|
24313
24477
|
};
|
|
24314
24478
|
const startRequest = {
|
|
24315
24479
|
name: playName,
|
|
@@ -26194,9 +26358,6 @@ Examples:
|
|
|
26194
26358
|
).option("--open", "Open the play page in a browser after the run starts").option(
|
|
26195
26359
|
"--debug-map-latency",
|
|
26196
26360
|
"Internal diagnostics: emit one aggregate latency profile per dataset map"
|
|
26197
|
-
).option(
|
|
26198
|
-
"--debug-fixture-provider-pacing",
|
|
26199
|
-
"Internal diagnostics: retain provider pacing while fixture mode is active"
|
|
26200
26361
|
).option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
|
|
26201
26362
|
"afterAll",
|
|
26202
26363
|
`
|
|
@@ -26243,7 +26404,6 @@ Pass-through input flags:
|
|
|
26243
26404
|
...options.maxConcurrentRows ? ["--max-concurrent-rows", options.maxConcurrentRows] : [],
|
|
26244
26405
|
...options.open ? ["--open"] : [],
|
|
26245
26406
|
...options.debugMapLatency ? ["--debug-map-latency"] : [],
|
|
26246
|
-
...options.debugFixtureProviderPacing ? ["--debug-fixture-provider-pacing"] : [],
|
|
26247
26407
|
...options.json ? ["--json"] : [],
|
|
26248
26408
|
...options.full ? ["--full"] : [],
|
|
26249
26409
|
...passthroughArgs
|
|
@@ -28665,7 +28825,7 @@ function emitEnrichDebug(message) {
|
|
|
28665
28825
|
);
|
|
28666
28826
|
}
|
|
28667
28827
|
function sleep6(ms) {
|
|
28668
|
-
return new Promise((
|
|
28828
|
+
return new Promise((resolve20) => setTimeout(resolve20, ms));
|
|
28669
28829
|
}
|
|
28670
28830
|
function enrichExportBackingRowsWaitMs() {
|
|
28671
28831
|
const raw = process.env.DEEPLINE_ENRICH_EXPORT_BACKING_ROWS_WAIT_MS?.trim();
|
|
@@ -35098,7 +35258,7 @@ async function readHiddenLine(prompt, streams = {}) {
|
|
|
35098
35258
|
}
|
|
35099
35259
|
let value = "";
|
|
35100
35260
|
inputStream.resume();
|
|
35101
|
-
return await new Promise((
|
|
35261
|
+
return await new Promise((resolve20, reject) => {
|
|
35102
35262
|
let settled = false;
|
|
35103
35263
|
const cleanup = () => {
|
|
35104
35264
|
inputStream.off("data", onData);
|
|
@@ -35116,7 +35276,7 @@ async function readHiddenLine(prompt, streams = {}) {
|
|
|
35116
35276
|
settled = true;
|
|
35117
35277
|
outputStream.write("\n");
|
|
35118
35278
|
cleanup();
|
|
35119
|
-
|
|
35279
|
+
resolve20(line);
|
|
35120
35280
|
};
|
|
35121
35281
|
const fail = (error) => {
|
|
35122
35282
|
if (settled) return;
|
|
@@ -35288,15 +35448,137 @@ Examples:
|
|
|
35288
35448
|
|
|
35289
35449
|
// src/cli/commands/setup.ts
|
|
35290
35450
|
var import_node_child_process4 = require("child_process");
|
|
35291
|
-
var
|
|
35451
|
+
var import_node_fs18 = require("fs");
|
|
35292
35452
|
var import_node_os12 = require("os");
|
|
35293
|
-
var
|
|
35453
|
+
var import_node_path20 = require("path");
|
|
35454
|
+
|
|
35455
|
+
// src/cli/installation-lifecycle.ts
|
|
35456
|
+
var import_node_fs15 = require("fs");
|
|
35457
|
+
var import_node_path17 = require("path");
|
|
35458
|
+
var nodeFileSystem = {
|
|
35459
|
+
exists: import_node_fs15.existsSync,
|
|
35460
|
+
isSymbolicLink(path) {
|
|
35461
|
+
try {
|
|
35462
|
+
return (0, import_node_fs15.lstatSync)(path).isSymbolicLink();
|
|
35463
|
+
} catch {
|
|
35464
|
+
return false;
|
|
35465
|
+
}
|
|
35466
|
+
},
|
|
35467
|
+
read(path) {
|
|
35468
|
+
try {
|
|
35469
|
+
return (0, import_node_fs15.readFileSync)(path, "utf8");
|
|
35470
|
+
} catch {
|
|
35471
|
+
return "";
|
|
35472
|
+
}
|
|
35473
|
+
},
|
|
35474
|
+
realpath(path) {
|
|
35475
|
+
try {
|
|
35476
|
+
return (0, import_node_fs15.realpathSync)(path);
|
|
35477
|
+
} catch {
|
|
35478
|
+
return null;
|
|
35479
|
+
}
|
|
35480
|
+
},
|
|
35481
|
+
remove(path) {
|
|
35482
|
+
(0, import_node_fs15.rmSync)(path, { force: true });
|
|
35483
|
+
}
|
|
35484
|
+
};
|
|
35485
|
+
function inspectLauncher(path, fileSystem = nodeFileSystem) {
|
|
35486
|
+
if (!fileSystem.exists(path)) {
|
|
35487
|
+
return { ownership: "missing", resolvedPath: null };
|
|
35488
|
+
}
|
|
35489
|
+
const resolvedPath = fileSystem.realpath(path);
|
|
35490
|
+
if (CliInstallation.isNpmPackagePath(resolvedPath)) {
|
|
35491
|
+
return { ownership: "npm", resolvedPath };
|
|
35492
|
+
}
|
|
35493
|
+
if (fileSystem.isSymbolicLink(path)) {
|
|
35494
|
+
return { ownership: "symlink", resolvedPath };
|
|
35495
|
+
}
|
|
35496
|
+
const content = fileSystem.read(path);
|
|
35497
|
+
if (content.includes("DEEPLINE_REAL_BINARY") && content.includes("DEEPLINE_ACTIVE_FILE")) {
|
|
35498
|
+
return { ownership: "installer_legacy", resolvedPath };
|
|
35499
|
+
}
|
|
35500
|
+
return { ownership: "user", resolvedPath };
|
|
35501
|
+
}
|
|
35502
|
+
var CliInstallation = class _CliInstallation {
|
|
35503
|
+
constructor(input2) {
|
|
35504
|
+
this.input = input2;
|
|
35505
|
+
}
|
|
35506
|
+
static forUser(input2) {
|
|
35507
|
+
return new _CliInstallation({
|
|
35508
|
+
...input2,
|
|
35509
|
+
fileSystem: input2.fileSystem ?? nodeFileSystem
|
|
35510
|
+
});
|
|
35511
|
+
}
|
|
35512
|
+
static isNpmPackagePath(path) {
|
|
35513
|
+
return path?.includes(`${(0, import_node_path17.join)("node_modules", "deepline")}`) ?? false;
|
|
35514
|
+
}
|
|
35515
|
+
launcher(path) {
|
|
35516
|
+
return inspectLauncher(path, this.input.fileSystem);
|
|
35517
|
+
}
|
|
35518
|
+
retiredArtifacts() {
|
|
35519
|
+
const hostDir = (0, import_node_path17.join)(
|
|
35520
|
+
this.input.home,
|
|
35521
|
+
".local",
|
|
35522
|
+
"deepline",
|
|
35523
|
+
this.input.baseUrlSlug
|
|
35524
|
+
);
|
|
35525
|
+
const legacyLauncherPath = (0, import_node_path17.join)(
|
|
35526
|
+
this.input.home,
|
|
35527
|
+
".local",
|
|
35528
|
+
"bin",
|
|
35529
|
+
"deepline"
|
|
35530
|
+
);
|
|
35531
|
+
const installerCommandPath = this.input.fileSystem.read((0, import_node_path17.join)(hostDir, "sdk", ".command-path")).trim();
|
|
35532
|
+
const ownedInstallerCommand = isOwnedInstallerCommandPath({
|
|
35533
|
+
hostDir,
|
|
35534
|
+
commandPath: installerCommandPath
|
|
35535
|
+
});
|
|
35536
|
+
const legacyLauncher = this.launcher(legacyLauncherPath);
|
|
35537
|
+
const candidates = [
|
|
35538
|
+
...legacyLauncher.ownership === "installer_legacy" ? [legacyLauncherPath] : [],
|
|
35539
|
+
(0, import_node_path17.join)(this.input.home, ".local", "bin", "deepline-real"),
|
|
35540
|
+
(0, import_node_path17.join)(hostDir, "bin", "deepline"),
|
|
35541
|
+
(0, import_node_path17.join)(hostDir, "bin", "deepline-real"),
|
|
35542
|
+
(0, import_node_path17.join)(hostDir, "cli", ".install-method"),
|
|
35543
|
+
(0, import_node_path17.join)(hostDir, "cli", ".version"),
|
|
35544
|
+
(0, import_node_path17.join)(hostDir, "sdk", ".install-method"),
|
|
35545
|
+
(0, import_node_path17.join)(hostDir, "sdk", ".command-path"),
|
|
35546
|
+
...ownedInstallerCommand ? [
|
|
35547
|
+
installerCommandPath,
|
|
35548
|
+
(0, import_node_path17.join)((0, import_node_path17.dirname)(installerCommandPath), "deepline-sdk")
|
|
35549
|
+
] : []
|
|
35550
|
+
];
|
|
35551
|
+
return {
|
|
35552
|
+
paths: candidates.filter((path) => {
|
|
35553
|
+
if (!this.input.fileSystem.exists(path)) return false;
|
|
35554
|
+
return this.launcher(path).ownership !== "npm";
|
|
35555
|
+
})
|
|
35556
|
+
};
|
|
35557
|
+
}
|
|
35558
|
+
removeRetiredArtifacts() {
|
|
35559
|
+
return removeArtifacts(this.retiredArtifacts(), this.input.fileSystem);
|
|
35560
|
+
}
|
|
35561
|
+
};
|
|
35562
|
+
function removeArtifacts(plan, fileSystem) {
|
|
35563
|
+
for (const path of plan.paths) {
|
|
35564
|
+
fileSystem.remove(path);
|
|
35565
|
+
}
|
|
35566
|
+
return plan.paths;
|
|
35567
|
+
}
|
|
35568
|
+
function isOwnedInstallerCommandPath(input2) {
|
|
35569
|
+
if (!input2.commandPath || (0, import_node_path17.basename)(input2.commandPath) !== "deepline") {
|
|
35570
|
+
return false;
|
|
35571
|
+
}
|
|
35572
|
+
const commandPath = (0, import_node_path17.resolve)(input2.commandPath);
|
|
35573
|
+
const fromHost = (0, import_node_path17.relative)((0, import_node_path17.resolve)(input2.hostDir), commandPath);
|
|
35574
|
+
return fromHost !== "" && fromHost !== ".." && !fromHost.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`);
|
|
35575
|
+
}
|
|
35294
35576
|
|
|
35295
35577
|
// src/cli/commands/skills.ts
|
|
35296
35578
|
var import_node_child_process3 = require("child_process");
|
|
35297
|
-
var
|
|
35579
|
+
var import_node_fs17 = require("fs");
|
|
35298
35580
|
var import_node_os11 = require("os");
|
|
35299
|
-
var
|
|
35581
|
+
var import_node_path19 = require("path");
|
|
35300
35582
|
|
|
35301
35583
|
// ../../shared_libs/cli/install-commands.json
|
|
35302
35584
|
var install_commands_default = {
|
|
@@ -35400,8 +35682,8 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
|
35400
35682
|
|
|
35401
35683
|
// src/cli/skills-sync.ts
|
|
35402
35684
|
var import_node_child_process2 = require("child_process");
|
|
35403
|
-
var
|
|
35404
|
-
var
|
|
35685
|
+
var import_node_fs16 = require("fs");
|
|
35686
|
+
var import_node_path18 = require("path");
|
|
35405
35687
|
|
|
35406
35688
|
// src/cli/windows-arg-escape.ts
|
|
35407
35689
|
var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
|
|
@@ -35436,10 +35718,10 @@ function shouldSkipSkillsSync() {
|
|
|
35436
35718
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
35437
35719
|
}
|
|
35438
35720
|
function unavailableSkillsNoticePath(baseUrl) {
|
|
35439
|
-
return (0,
|
|
35721
|
+
return (0, import_node_path18.join)(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
|
|
35440
35722
|
}
|
|
35441
35723
|
function failedSkillsSyncPath(baseUrl, agents) {
|
|
35442
|
-
return (0,
|
|
35724
|
+
return (0, import_node_path18.join)(
|
|
35443
35725
|
sdkCliStateDirPath(baseUrl),
|
|
35444
35726
|
`skills-sync-failed-${agents.join("-")}-version`
|
|
35445
35727
|
);
|
|
@@ -35449,15 +35731,15 @@ function hasMarkedSkillsSyncVersion(path, version) {
|
|
|
35449
35731
|
}
|
|
35450
35732
|
function readMarkedSkillsSyncVersion(path) {
|
|
35451
35733
|
try {
|
|
35452
|
-
return (0,
|
|
35734
|
+
return (0, import_node_fs16.existsSync)(path) ? (0, import_node_fs16.readFileSync)(path, "utf-8").trim() : "";
|
|
35453
35735
|
} catch {
|
|
35454
35736
|
return "";
|
|
35455
35737
|
}
|
|
35456
35738
|
}
|
|
35457
35739
|
function writeMarkedSkillsSyncVersion(path, version) {
|
|
35458
35740
|
try {
|
|
35459
|
-
(0,
|
|
35460
|
-
(0,
|
|
35741
|
+
(0, import_node_fs16.mkdirSync)((0, import_node_path18.dirname)(path), { recursive: true });
|
|
35742
|
+
(0, import_node_fs16.writeFileSync)(path, `${version}
|
|
35461
35743
|
`, "utf-8");
|
|
35462
35744
|
} catch {
|
|
35463
35745
|
}
|
|
@@ -35474,7 +35756,7 @@ ${manualCommand}`
|
|
|
35474
35756
|
}
|
|
35475
35757
|
function clearUnavailableSkillsNotice(baseUrl) {
|
|
35476
35758
|
try {
|
|
35477
|
-
(0,
|
|
35759
|
+
(0, import_node_fs16.unlinkSync)(unavailableSkillsNoticePath(baseUrl));
|
|
35478
35760
|
} catch {
|
|
35479
35761
|
}
|
|
35480
35762
|
}
|
|
@@ -35485,7 +35767,7 @@ function hasFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
|
35485
35767
|
);
|
|
35486
35768
|
}
|
|
35487
35769
|
function hasFailedAutomaticSkillsSync(baseUrl, agents) {
|
|
35488
|
-
return (0,
|
|
35770
|
+
return (0, import_node_fs16.existsSync)(failedSkillsSyncPath(baseUrl, agents));
|
|
35489
35771
|
}
|
|
35490
35772
|
function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
35491
35773
|
writeMarkedSkillsSyncVersion(
|
|
@@ -35495,7 +35777,7 @@ function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
|
35495
35777
|
}
|
|
35496
35778
|
function clearFailedSkillsSync(baseUrl, agents) {
|
|
35497
35779
|
try {
|
|
35498
|
-
(0,
|
|
35780
|
+
(0, import_node_fs16.unlinkSync)(failedSkillsSyncPath(baseUrl, agents));
|
|
35499
35781
|
} catch {
|
|
35500
35782
|
}
|
|
35501
35783
|
}
|
|
@@ -35610,7 +35892,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
35610
35892
|
return commands;
|
|
35611
35893
|
}
|
|
35612
35894
|
function runOneSkillsInstall(install) {
|
|
35613
|
-
return new Promise((
|
|
35895
|
+
return new Promise((resolve20) => {
|
|
35614
35896
|
const plan = resolveSkillsInstallSpawn(install);
|
|
35615
35897
|
const child = (0, import_node_child_process2.spawn)(plan.command, plan.args, {
|
|
35616
35898
|
stdio: ["ignore", "ignore", "pipe"],
|
|
@@ -35622,7 +35904,7 @@ function runOneSkillsInstall(install) {
|
|
|
35622
35904
|
stderr += chunk.toString("utf-8");
|
|
35623
35905
|
});
|
|
35624
35906
|
child.on("error", (error) => {
|
|
35625
|
-
|
|
35907
|
+
resolve20({
|
|
35626
35908
|
ok: false,
|
|
35627
35909
|
detail: `failed to start ${install.command}: ${error.message}`,
|
|
35628
35910
|
manualCommand: install.manualCommand
|
|
@@ -35630,11 +35912,11 @@ function runOneSkillsInstall(install) {
|
|
|
35630
35912
|
});
|
|
35631
35913
|
child.on("close", (code) => {
|
|
35632
35914
|
if (code === 0) {
|
|
35633
|
-
|
|
35915
|
+
resolve20({ ok: true, detail: "", manualCommand: install.manualCommand });
|
|
35634
35916
|
return;
|
|
35635
35917
|
}
|
|
35636
35918
|
const detail = stderr.trim();
|
|
35637
|
-
|
|
35919
|
+
resolve20({
|
|
35638
35920
|
ok: false,
|
|
35639
35921
|
detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
|
|
35640
35922
|
manualCommand: install.manualCommand
|
|
@@ -35836,13 +36118,13 @@ function detectSkillsAgents(input2) {
|
|
|
35836
36118
|
];
|
|
35837
36119
|
const detected = AGENT_MARKERS.filter(
|
|
35838
36120
|
(marker) => roots.some(
|
|
35839
|
-
(root) => marker.paths.some((path) => (0,
|
|
36121
|
+
(root) => marker.paths.some((path) => (0, import_node_fs17.existsSync)((0, import_node_path19.join)(root, path)))
|
|
35840
36122
|
)
|
|
35841
36123
|
).map((marker) => marker.agent);
|
|
35842
36124
|
return detected.length > 0 ? detected : ["*"];
|
|
35843
36125
|
}
|
|
35844
36126
|
function skillsStatePathForScope(baseUrl, scope, root) {
|
|
35845
|
-
return scope === "local" && root ? (0,
|
|
36127
|
+
return scope === "local" && root ? (0, import_node_path19.join)(root, ".deepline", "setup", "skills.json") : (0, import_node_path19.join)(sdkCliStateDirPath(baseUrl), "skills-install.json");
|
|
35846
36128
|
}
|
|
35847
36129
|
function buildSkillsPlan(input2) {
|
|
35848
36130
|
const scopeArgs = input2.scope === "global" ? ["--global"] : [];
|
|
@@ -35909,14 +36191,14 @@ function isSkillsPlanCurrent(plan, state) {
|
|
|
35909
36191
|
}
|
|
35910
36192
|
function readSkillsInstallState(path) {
|
|
35911
36193
|
try {
|
|
35912
|
-
const parsed = JSON.parse((0,
|
|
36194
|
+
const parsed = JSON.parse((0, import_node_fs17.readFileSync)(path, "utf8"));
|
|
35913
36195
|
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
35914
36196
|
} catch {
|
|
35915
36197
|
return null;
|
|
35916
36198
|
}
|
|
35917
36199
|
}
|
|
35918
36200
|
function runProcess(command, args, cwd) {
|
|
35919
|
-
return new Promise((
|
|
36201
|
+
return new Promise((resolve20, reject) => {
|
|
35920
36202
|
const plan = resolveShellSpawn(command, args);
|
|
35921
36203
|
const child = (0, import_node_child_process3.spawn)(plan.command, plan.args, {
|
|
35922
36204
|
cwd,
|
|
@@ -35935,7 +36217,7 @@ function runProcess(command, args, cwd) {
|
|
|
35935
36217
|
process.stderr.write(`${SKILLS_NPX_PACKAGE} exited ${code}.
|
|
35936
36218
|
`);
|
|
35937
36219
|
}
|
|
35938
|
-
|
|
36220
|
+
resolve20(code ?? 1);
|
|
35939
36221
|
});
|
|
35940
36222
|
});
|
|
35941
36223
|
}
|
|
@@ -36053,8 +36335,8 @@ async function runSkillsCommand(options, dependencies = {}) {
|
|
|
36053
36335
|
);
|
|
36054
36336
|
return 5;
|
|
36055
36337
|
}
|
|
36056
|
-
(0,
|
|
36057
|
-
(0,
|
|
36338
|
+
(0, import_node_fs17.mkdirSync)((0, import_node_path19.dirname)(plan.statePath), { recursive: true });
|
|
36339
|
+
(0, import_node_fs17.writeFileSync)(
|
|
36058
36340
|
plan.statePath,
|
|
36059
36341
|
`${JSON.stringify(
|
|
36060
36342
|
{
|
|
@@ -36191,7 +36473,7 @@ function phasesFromLegacyStatus(status) {
|
|
|
36191
36473
|
function readSetupState(input2) {
|
|
36192
36474
|
try {
|
|
36193
36475
|
const parsed = JSON.parse(
|
|
36194
|
-
(0,
|
|
36476
|
+
(0, import_node_fs18.readFileSync)(
|
|
36195
36477
|
setupStatePath(input2.baseUrl, input2.scope, input2.root),
|
|
36196
36478
|
"utf8"
|
|
36197
36479
|
)
|
|
@@ -36267,7 +36549,7 @@ function buildPendingAuthorizationOutput(input2) {
|
|
|
36267
36549
|
};
|
|
36268
36550
|
}
|
|
36269
36551
|
function setupStatePath(baseUrl, scope, root) {
|
|
36270
|
-
return scope === "local" && root ? (0,
|
|
36552
|
+
return scope === "local" && root ? (0, import_node_path20.join)(root, ".deepline", "setup", "state.json") : (0, import_node_path20.join)(sdkCliStateDirPath(baseUrl), "setup.json");
|
|
36271
36553
|
}
|
|
36272
36554
|
async function captureStdout2(run) {
|
|
36273
36555
|
let stdout = "";
|
|
@@ -36296,57 +36578,16 @@ function asRecord3(value) {
|
|
|
36296
36578
|
}
|
|
36297
36579
|
function safeRead(path) {
|
|
36298
36580
|
try {
|
|
36299
|
-
return (0,
|
|
36581
|
+
return (0, import_node_fs18.readFileSync)(path, "utf8");
|
|
36300
36582
|
} catch {
|
|
36301
36583
|
return "";
|
|
36302
36584
|
}
|
|
36303
36585
|
}
|
|
36304
|
-
function isNpmManagedDeeplinePath(path) {
|
|
36305
|
-
try {
|
|
36306
|
-
return (0, import_node_fs17.realpathSync)(path).includes(`${(0, import_node_path19.join)("node_modules", "deepline")}`);
|
|
36307
|
-
} catch {
|
|
36308
|
-
return false;
|
|
36309
|
-
}
|
|
36310
|
-
}
|
|
36311
|
-
function isInstallerManagedLegacyLauncher(path) {
|
|
36312
|
-
const content = safeRead(path);
|
|
36313
|
-
return content.includes("DEEPLINE_REAL_BINARY") && content.includes("DEEPLINE_ACTIVE_FILE");
|
|
36314
|
-
}
|
|
36315
36586
|
function removeKnownLegacyPaths(baseUrl) {
|
|
36316
|
-
|
|
36317
|
-
|
|
36318
|
-
|
|
36319
|
-
|
|
36320
|
-
(0, import_node_path19.join)(hostDir, "sdk", ".command-path")
|
|
36321
|
-
).trim();
|
|
36322
|
-
const relativeInstallerCommandPath = installerCommandPath ? (0, import_node_path19.relative)((0, import_node_path19.resolve)(hostDir), (0, import_node_path19.resolve)(installerCommandPath)) : "";
|
|
36323
|
-
const isOwnedInstallerCommand = Boolean(installerCommandPath) && relativeInstallerCommandPath !== "" && !relativeInstallerCommandPath.startsWith(
|
|
36324
|
-
`..${process.platform === "win32" ? "\\" : "/"}`
|
|
36325
|
-
) && relativeInstallerCommandPath !== ".." && (0, import_node_path19.basename)(installerCommandPath) === "deepline";
|
|
36326
|
-
const candidates = [
|
|
36327
|
-
...isInstallerManagedLegacyLauncher(legacyLauncherPath) ? [legacyLauncherPath] : [],
|
|
36328
|
-
(0, import_node_path19.join)(home, ".local", "bin", "deepline-real"),
|
|
36329
|
-
(0, import_node_path19.join)(hostDir, "bin", "deepline"),
|
|
36330
|
-
(0, import_node_path19.join)(hostDir, "bin", "deepline-real"),
|
|
36331
|
-
(0, import_node_path19.join)(hostDir, "cli", ".install-method"),
|
|
36332
|
-
(0, import_node_path19.join)(hostDir, "cli", ".version"),
|
|
36333
|
-
(0, import_node_path19.join)(hostDir, "sdk", ".install-method"),
|
|
36334
|
-
(0, import_node_path19.join)(hostDir, "sdk", ".command-path"),
|
|
36335
|
-
...isOwnedInstallerCommand ? [
|
|
36336
|
-
installerCommandPath,
|
|
36337
|
-
(0, import_node_path19.join)((0, import_node_path19.dirname)(installerCommandPath), "deepline-sdk")
|
|
36338
|
-
] : []
|
|
36339
|
-
];
|
|
36340
|
-
const removed = [];
|
|
36341
|
-
for (const path of candidates) {
|
|
36342
|
-
if (!(0, import_node_fs17.existsSync)(path)) continue;
|
|
36343
|
-
if (path === installerCommandPath && isNpmManagedDeeplinePath(path)) {
|
|
36344
|
-
continue;
|
|
36345
|
-
}
|
|
36346
|
-
(0, import_node_fs17.rmSync)(path, { force: true });
|
|
36347
|
-
removed.push(path);
|
|
36348
|
-
}
|
|
36349
|
-
return removed;
|
|
36587
|
+
return CliInstallation.forUser({
|
|
36588
|
+
baseUrlSlug: baseUrlSlug(baseUrl),
|
|
36589
|
+
home: (0, import_node_os12.homedir)()
|
|
36590
|
+
}).removeRetiredArtifacts();
|
|
36350
36591
|
}
|
|
36351
36592
|
function resolvePathCommands(command) {
|
|
36352
36593
|
const lookup = (0, import_node_child_process4.spawnSync)(
|
|
@@ -36356,7 +36597,7 @@ function resolvePathCommands(command) {
|
|
|
36356
36597
|
);
|
|
36357
36598
|
return [
|
|
36358
36599
|
...new Set(
|
|
36359
|
-
String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) => (0,
|
|
36600
|
+
String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) => (0, import_node_path20.resolve)(path))
|
|
36360
36601
|
)
|
|
36361
36602
|
];
|
|
36362
36603
|
}
|
|
@@ -36366,7 +36607,7 @@ function resolvePathCommand(command) {
|
|
|
36366
36607
|
function isHomebrewFormulaCommand(path) {
|
|
36367
36608
|
let resolvedPath = path;
|
|
36368
36609
|
try {
|
|
36369
|
-
resolvedPath = (0,
|
|
36610
|
+
resolvedPath = (0, import_node_fs18.realpathSync)(path);
|
|
36370
36611
|
} catch {
|
|
36371
36612
|
return false;
|
|
36372
36613
|
}
|
|
@@ -36377,7 +36618,7 @@ function isHomebrewFormulaCommand(path) {
|
|
|
36377
36618
|
function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
36378
36619
|
const platform3 = dependencies.platform ?? process.platform;
|
|
36379
36620
|
const run = dependencies.spawn ?? import_node_child_process4.spawnSync;
|
|
36380
|
-
const pathExists = dependencies.exists ??
|
|
36621
|
+
const pathExists = dependencies.exists ?? import_node_fs18.existsSync;
|
|
36381
36622
|
const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
|
|
36382
36623
|
const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
|
|
36383
36624
|
if (homebrewCommand) return homebrewCommand;
|
|
@@ -36389,7 +36630,7 @@ function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
|
36389
36630
|
if (prefix.status !== 0) return null;
|
|
36390
36631
|
const root = String(prefix.stdout ?? "").trim();
|
|
36391
36632
|
if (!root) return null;
|
|
36392
|
-
const candidates = platform3 === "win32" ? [(0,
|
|
36633
|
+
const candidates = platform3 === "win32" ? [(0, import_node_path20.join)(root, "deepline.cmd"), (0, import_node_path20.join)(root, "deepline")] : [(0, import_node_path20.join)(root, "bin", "deepline")];
|
|
36393
36634
|
return candidates.find((candidate) => pathExists(candidate)) ?? null;
|
|
36394
36635
|
}
|
|
36395
36636
|
function inspectGlobalCliAvailability(input2) {
|
|
@@ -36402,20 +36643,20 @@ function inspectGlobalCliAvailability(input2) {
|
|
|
36402
36643
|
}
|
|
36403
36644
|
function pathsResolveToSameFile(left, right) {
|
|
36404
36645
|
try {
|
|
36405
|
-
return (0,
|
|
36646
|
+
return (0, import_node_fs18.realpathSync)(left) === (0, import_node_fs18.realpathSync)(right);
|
|
36406
36647
|
} catch {
|
|
36407
|
-
return (0,
|
|
36648
|
+
return (0, import_node_path20.resolve)(left) === (0, import_node_path20.resolve)(right);
|
|
36408
36649
|
}
|
|
36409
36650
|
}
|
|
36410
36651
|
function isKnownDeeplineCommand(path) {
|
|
36411
|
-
const entrypoint = process.argv[1] ? (0,
|
|
36652
|
+
const entrypoint = process.argv[1] ? (0, import_node_path20.resolve)(process.argv[1]) : "";
|
|
36412
36653
|
let resolvedPath = path;
|
|
36413
36654
|
try {
|
|
36414
|
-
resolvedPath = (0,
|
|
36655
|
+
resolvedPath = (0, import_node_fs18.realpathSync)(path);
|
|
36415
36656
|
} catch {
|
|
36416
36657
|
}
|
|
36417
36658
|
if (entrypoint && resolvedPath === entrypoint) return true;
|
|
36418
|
-
if (resolvedPath.includes(`${(0,
|
|
36659
|
+
if (resolvedPath.includes(`${(0, import_node_path20.join)("node_modules", "deepline")}`)) return true;
|
|
36419
36660
|
const content = safeRead(path);
|
|
36420
36661
|
return content.includes("node_modules/deepline") || content.includes("node_modules\\deepline") || content.includes("DEEPLINE_CONFIG_SCOPE") || content.includes("deepline-real");
|
|
36421
36662
|
}
|
|
@@ -36423,9 +36664,9 @@ function inspectPathConflict() {
|
|
|
36423
36664
|
const commandPath = resolvePathCommand("deepline");
|
|
36424
36665
|
if (!commandPath || isKnownDeeplineCommand(commandPath)) return null;
|
|
36425
36666
|
try {
|
|
36426
|
-
if ((0,
|
|
36427
|
-
const target = (0,
|
|
36428
|
-
if (target.includes(`${(0,
|
|
36667
|
+
if ((0, import_node_fs18.lstatSync)(commandPath).isSymbolicLink()) {
|
|
36668
|
+
const target = (0, import_node_fs18.realpathSync)(commandPath);
|
|
36669
|
+
if (target.includes(`${(0, import_node_path20.join)("node_modules", "deepline")}`)) return null;
|
|
36429
36670
|
}
|
|
36430
36671
|
} catch {
|
|
36431
36672
|
}
|
|
@@ -36433,8 +36674,8 @@ function inspectPathConflict() {
|
|
|
36433
36674
|
}
|
|
36434
36675
|
function writeSetupState(input2) {
|
|
36435
36676
|
const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
|
|
36436
|
-
(0,
|
|
36437
|
-
(0,
|
|
36677
|
+
(0, import_node_fs18.mkdirSync)((0, import_node_path20.dirname)(path), { recursive: true });
|
|
36678
|
+
(0, import_node_fs18.writeFileSync)(
|
|
36438
36679
|
path,
|
|
36439
36680
|
`${JSON.stringify(
|
|
36440
36681
|
{
|
|
@@ -36474,7 +36715,7 @@ function failSetupPhase(phases, phase, code) {
|
|
|
36474
36715
|
phases[phase] = { status: "failed", code };
|
|
36475
36716
|
}
|
|
36476
36717
|
function rollbackCommand(scope, root) {
|
|
36477
|
-
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify((0,
|
|
36718
|
+
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify((0, import_node_path20.join)(root, ".deepline", "runtime"))}` : "";
|
|
36478
36719
|
return `npm install -g${prefix} --no-audit --no-fund --include=optional --allow-scripts=esbuild deepline@${SDK_VERSION}`;
|
|
36479
36720
|
}
|
|
36480
36721
|
function setupResumeCommand(baseUrl, scope) {
|
|
@@ -36561,12 +36802,12 @@ function buildDoctorAssessment(input2) {
|
|
|
36561
36802
|
const connected = input2.authStatus.payload?.connected === true;
|
|
36562
36803
|
const authScopeOk = input2.scope === "local" ? Boolean(projectAuth) : Boolean(apiKey && !projectAuth);
|
|
36563
36804
|
const skillsOk = skillsState?.scope === input2.scope && typeof skillsState.skillsVersion === "string" && Array.isArray(skillsState.agents) && skillsState.agents.length > 0;
|
|
36564
|
-
const runningCliPath = process.argv[1] ? (0,
|
|
36805
|
+
const runningCliPath = process.argv[1] ? (0, import_node_path20.resolve)(process.argv[1]) : null;
|
|
36565
36806
|
const globalCli = input2.scope === "global" ? inspectGlobalCliAvailability() : null;
|
|
36566
36807
|
const pathGlobalCli = globalCli?.path ?? null;
|
|
36567
36808
|
const cliPath = input2.scope === "global" ? pathGlobalCli : runningCliPath;
|
|
36568
36809
|
const cliScopeOk = input2.scope === "global" ? Boolean(pathGlobalCli) : Boolean(
|
|
36569
|
-
input2.root && runningCliPath?.includes((0,
|
|
36810
|
+
input2.root && runningCliPath?.includes((0, import_node_path20.join)(input2.root, ".deepline", "runtime"))
|
|
36570
36811
|
);
|
|
36571
36812
|
const checks = {
|
|
36572
36813
|
cli: {
|
|
@@ -37093,9 +37334,9 @@ Examples:
|
|
|
37093
37334
|
}
|
|
37094
37335
|
|
|
37095
37336
|
// src/cli/update-preferences.ts
|
|
37096
|
-
var
|
|
37337
|
+
var import_node_fs19 = require("fs");
|
|
37097
37338
|
var import_node_os13 = require("os");
|
|
37098
|
-
var
|
|
37339
|
+
var import_node_path21 = require("path");
|
|
37099
37340
|
var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
|
|
37100
37341
|
var CLI_UPDATE_MESSAGES = [
|
|
37101
37342
|
{
|
|
@@ -37124,7 +37365,7 @@ function unreadablePreferences(path, error) {
|
|
|
37124
37365
|
};
|
|
37125
37366
|
}
|
|
37126
37367
|
function cliUpdatePreferencesPath(homeDir2 = (0, import_node_os13.homedir)()) {
|
|
37127
|
-
return (0,
|
|
37368
|
+
return (0, import_node_path21.join)(
|
|
37128
37369
|
homeDir2,
|
|
37129
37370
|
".local",
|
|
37130
37371
|
"deepline",
|
|
@@ -37134,9 +37375,9 @@ function cliUpdatePreferencesPath(homeDir2 = (0, import_node_os13.homedir)()) {
|
|
|
37134
37375
|
}
|
|
37135
37376
|
function readCliUpdatePreferences(homeDir2 = (0, import_node_os13.homedir)()) {
|
|
37136
37377
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
37137
|
-
if (!(0,
|
|
37378
|
+
if (!(0, import_node_fs19.existsSync)(path)) return defaultPreferences();
|
|
37138
37379
|
try {
|
|
37139
|
-
const parsed = JSON.parse((0,
|
|
37380
|
+
const parsed = JSON.parse((0, import_node_fs19.readFileSync)(path, "utf8"));
|
|
37140
37381
|
return {
|
|
37141
37382
|
schemaVersion: UPDATE_PREFERENCES_SCHEMA_VERSION,
|
|
37142
37383
|
autoUpdateEnabled: typeof parsed.autoUpdateEnabled === "boolean" ? parsed.autoUpdateEnabled : true,
|
|
@@ -37152,16 +37393,16 @@ function readCliUpdatePreferences(homeDir2 = (0, import_node_os13.homedir)()) {
|
|
|
37152
37393
|
function writeCliUpdatePreferences(preferences, homeDir2 = (0, import_node_os13.homedir)()) {
|
|
37153
37394
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
37154
37395
|
const tempPath = `${path}.${process.pid}.tmp`;
|
|
37155
|
-
(0,
|
|
37396
|
+
(0, import_node_fs19.mkdirSync)((0, import_node_path21.dirname)(path), { recursive: true });
|
|
37156
37397
|
try {
|
|
37157
|
-
(0,
|
|
37398
|
+
(0, import_node_fs19.writeFileSync)(tempPath, `${JSON.stringify(preferences, null, 2)}
|
|
37158
37399
|
`, {
|
|
37159
37400
|
encoding: "utf8",
|
|
37160
37401
|
mode: 384
|
|
37161
37402
|
});
|
|
37162
|
-
(0,
|
|
37403
|
+
(0, import_node_fs19.renameSync)(tempPath, path);
|
|
37163
37404
|
} finally {
|
|
37164
|
-
(0,
|
|
37405
|
+
(0, import_node_fs19.rmSync)(tempPath, { force: true });
|
|
37165
37406
|
}
|
|
37166
37407
|
}
|
|
37167
37408
|
function setCliAutoUpdateEnabled(enabled, homeDir2 = (0, import_node_os13.homedir)()) {
|
|
@@ -37211,14 +37452,14 @@ function consumePendingCliUpdateMessages(homeDir2 = (0, import_node_os13.homedir
|
|
|
37211
37452
|
|
|
37212
37453
|
// src/cli/commands/update.ts
|
|
37213
37454
|
var import_node_child_process5 = require("child_process");
|
|
37214
|
-
var
|
|
37455
|
+
var import_node_fs21 = require("fs");
|
|
37215
37456
|
var import_node_os14 = require("os");
|
|
37216
|
-
var
|
|
37457
|
+
var import_node_path23 = require("path");
|
|
37217
37458
|
|
|
37218
37459
|
// src/cli/install-integrity.ts
|
|
37219
37460
|
var import_node_module2 = require("module");
|
|
37220
|
-
var
|
|
37221
|
-
var
|
|
37461
|
+
var import_node_fs20 = require("fs");
|
|
37462
|
+
var import_node_path22 = require("path");
|
|
37222
37463
|
var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
|
|
37223
37464
|
"dist/cli/index.mjs",
|
|
37224
37465
|
"dist/index.mjs",
|
|
@@ -37235,7 +37476,7 @@ var SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES = [
|
|
|
37235
37476
|
"esbuild/lib/main.js"
|
|
37236
37477
|
];
|
|
37237
37478
|
function safeRelativePath(value) {
|
|
37238
|
-
if (typeof value !== "string" || !value || (0,
|
|
37479
|
+
if (typeof value !== "string" || !value || (0, import_node_path22.isAbsolute)(value)) return false;
|
|
37239
37480
|
const segments = value.split(/[\\/]+/);
|
|
37240
37481
|
return segments.every(
|
|
37241
37482
|
(segment) => Boolean(segment) && segment !== "." && segment !== ".."
|
|
@@ -37243,25 +37484,25 @@ function safeRelativePath(value) {
|
|
|
37243
37484
|
}
|
|
37244
37485
|
function resolveContainedPath(root, value) {
|
|
37245
37486
|
if (!safeRelativePath(value)) return null;
|
|
37246
|
-
const target = (0,
|
|
37247
|
-
const relativeTarget = (0,
|
|
37248
|
-
if (!relativeTarget || relativeTarget.startsWith("..") || (0,
|
|
37487
|
+
const target = (0, import_node_path22.resolve)(root, value);
|
|
37488
|
+
const relativeTarget = (0, import_node_path22.relative)((0, import_node_path22.resolve)(root), target);
|
|
37489
|
+
if (!relativeTarget || relativeTarget.startsWith("..") || (0, import_node_path22.isAbsolute)(relativeTarget)) {
|
|
37249
37490
|
return null;
|
|
37250
37491
|
}
|
|
37251
37492
|
return target;
|
|
37252
37493
|
}
|
|
37253
37494
|
function parseJson(path) {
|
|
37254
|
-
return JSON.parse((0,
|
|
37495
|
+
return JSON.parse((0, import_node_fs20.readFileSync)(path, "utf8"));
|
|
37255
37496
|
}
|
|
37256
37497
|
function isFile(path) {
|
|
37257
37498
|
try {
|
|
37258
|
-
return (0,
|
|
37499
|
+
return (0, import_node_fs20.statSync)(path).isFile();
|
|
37259
37500
|
} catch {
|
|
37260
37501
|
return false;
|
|
37261
37502
|
}
|
|
37262
37503
|
}
|
|
37263
37504
|
function readManifest(packageRoot) {
|
|
37264
|
-
const packageJsonPath = (0,
|
|
37505
|
+
const packageJsonPath = (0, import_node_path22.join)(packageRoot, "package.json");
|
|
37265
37506
|
let packageJson;
|
|
37266
37507
|
try {
|
|
37267
37508
|
packageJson = parseJson(packageJsonPath);
|
|
@@ -37269,7 +37510,7 @@ function readManifest(packageRoot) {
|
|
|
37269
37510
|
return {
|
|
37270
37511
|
mode: "manifest",
|
|
37271
37512
|
invalidReason: `invalid Deepline package metadata: ${error.message}`,
|
|
37272
|
-
missing: (0,
|
|
37513
|
+
missing: (0, import_node_fs20.existsSync)(packageJsonPath) ? [] : ["deepline/package.json"]
|
|
37273
37514
|
};
|
|
37274
37515
|
}
|
|
37275
37516
|
if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
|
|
@@ -37335,8 +37576,8 @@ function readManifest(packageRoot) {
|
|
|
37335
37576
|
return { mode: "manifest", manifest };
|
|
37336
37577
|
}
|
|
37337
37578
|
function inspectSdkSidecarInstall(versionDir) {
|
|
37338
|
-
const nodeModulesRoot = (0,
|
|
37339
|
-
const packageRoot = (0,
|
|
37579
|
+
const nodeModulesRoot = (0, import_node_path22.join)(versionDir, "node_modules");
|
|
37580
|
+
const packageRoot = (0, import_node_path22.join)(nodeModulesRoot, "deepline");
|
|
37340
37581
|
const manifestResult = readManifest(packageRoot);
|
|
37341
37582
|
if ("invalidReason" in manifestResult) {
|
|
37342
37583
|
return {
|
|
@@ -37347,8 +37588,8 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
37347
37588
|
};
|
|
37348
37589
|
}
|
|
37349
37590
|
const missing = [
|
|
37350
|
-
...manifestResult.manifest.packageFiles.filter((path) => !isFile((0,
|
|
37351
|
-
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile((0,
|
|
37591
|
+
...manifestResult.manifest.packageFiles.filter((path) => !isFile((0, import_node_path22.join)(packageRoot, path))).map((path) => `deepline/${path}`),
|
|
37592
|
+
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile((0, import_node_path22.join)(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
|
|
37352
37593
|
];
|
|
37353
37594
|
return {
|
|
37354
37595
|
ok: missing.length === 0,
|
|
@@ -37359,7 +37600,7 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
37359
37600
|
}
|
|
37360
37601
|
function probeSdkSidecarEsbuild(versionDir) {
|
|
37361
37602
|
try {
|
|
37362
|
-
const requireFromInstall = (0, import_node_module2.createRequire)((0,
|
|
37603
|
+
const requireFromInstall = (0, import_node_module2.createRequire)((0, import_node_path22.join)(versionDir, "package.json"));
|
|
37363
37604
|
const esbuild = requireFromInstall("esbuild");
|
|
37364
37605
|
if (typeof esbuild.transformSync !== "function") {
|
|
37365
37606
|
return "esbuild does not export transformSync";
|
|
@@ -37434,7 +37675,7 @@ function sidecarStateDir(input2) {
|
|
|
37434
37675
|
if (!scope || scope.includes("/") || scope.includes("\\")) {
|
|
37435
37676
|
return null;
|
|
37436
37677
|
}
|
|
37437
|
-
return (0,
|
|
37678
|
+
return (0, import_node_path23.join)(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
|
|
37438
37679
|
}
|
|
37439
37680
|
function sidecarRegistryUrl(hostUrl) {
|
|
37440
37681
|
let url;
|
|
@@ -37461,7 +37702,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
|
|
|
37461
37702
|
}
|
|
37462
37703
|
function readOptionalText(path) {
|
|
37463
37704
|
try {
|
|
37464
|
-
return (0,
|
|
37705
|
+
return (0, import_node_fs21.readFileSync)(path, "utf8").trim();
|
|
37465
37706
|
} catch {
|
|
37466
37707
|
return "";
|
|
37467
37708
|
}
|
|
@@ -37469,19 +37710,19 @@ function readOptionalText(path) {
|
|
|
37469
37710
|
function resolvePythonSidecarUpdatePlan(options) {
|
|
37470
37711
|
const stateDir = sidecarStateDir(options);
|
|
37471
37712
|
if (!stateDir) return null;
|
|
37472
|
-
const relativeEntrypoint = (0,
|
|
37473
|
-
(0,
|
|
37474
|
-
(0,
|
|
37713
|
+
const relativeEntrypoint = (0, import_node_path23.relative)(
|
|
37714
|
+
(0, import_node_path23.resolve)(stateDir),
|
|
37715
|
+
(0, import_node_path23.resolve)(options.entrypoint)
|
|
37475
37716
|
);
|
|
37476
|
-
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || (0,
|
|
37717
|
+
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || (0, import_node_path23.isAbsolute)(relativeEntrypoint)) {
|
|
37477
37718
|
return null;
|
|
37478
37719
|
}
|
|
37479
|
-
const installMethod = readOptionalText((0,
|
|
37720
|
+
const installMethod = readOptionalText((0, import_node_path23.join)(stateDir, ".install-method"));
|
|
37480
37721
|
if (installMethod !== "python-sidecar") return null;
|
|
37481
37722
|
const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
|
|
37482
37723
|
const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
|
|
37483
|
-
const nodeBin = readOptionalText((0,
|
|
37484
|
-
const sidecarPath = readOptionalText((0,
|
|
37724
|
+
const nodeBin = readOptionalText((0, import_node_path23.join)(stateDir, ".node-bin")) || process.execPath;
|
|
37725
|
+
const sidecarPath = readOptionalText((0, import_node_path23.join)(stateDir, ".command-path")) || (0, import_node_path23.join)(
|
|
37485
37726
|
stateDir,
|
|
37486
37727
|
"bin",
|
|
37487
37728
|
process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
|
|
@@ -37489,7 +37730,7 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
37489
37730
|
const packageSpec = options.packageSpec || "deepline@latest";
|
|
37490
37731
|
const npmCommand = "npm";
|
|
37491
37732
|
const registryUrl = sidecarRegistryUrl(hostUrl);
|
|
37492
|
-
const versionDir = (0,
|
|
37733
|
+
const versionDir = (0, import_node_path23.join)(stateDir, "versions", "<version>");
|
|
37493
37734
|
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote4(versionDir)} --registry ${shellQuote4(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote4).join(" ")} ${shellQuote4(packageSpec)}`;
|
|
37494
37735
|
return {
|
|
37495
37736
|
kind: "python-sidecar",
|
|
@@ -37505,16 +37746,16 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
37505
37746
|
};
|
|
37506
37747
|
}
|
|
37507
37748
|
function findRepoBackedSdkRoot(startPath) {
|
|
37508
|
-
let current = (0,
|
|
37749
|
+
let current = (0, import_node_path23.resolve)(startPath);
|
|
37509
37750
|
while (true) {
|
|
37510
|
-
if ((0,
|
|
37511
|
-
const parent2 = (0,
|
|
37512
|
-
return (0,
|
|
37751
|
+
if ((0, import_node_fs21.existsSync)((0, import_node_path23.join)(current, "package.json")) && (0, import_node_fs21.existsSync)((0, import_node_path23.join)(current, "bin", "deepline-dev.ts"))) {
|
|
37752
|
+
const parent2 = (0, import_node_path23.dirname)(current);
|
|
37753
|
+
return (0, import_node_path23.basename)(parent2) === "packages" && (0, import_node_path23.basename)(current) === "sdk" ? (0, import_node_path23.dirname)(parent2) : parent2;
|
|
37513
37754
|
}
|
|
37514
|
-
if ((0,
|
|
37755
|
+
if ((0, import_node_fs21.existsSync)((0, import_node_path23.join)(current, "sdk", "package.json")) && (0, import_node_fs21.existsSync)((0, import_node_path23.join)(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
37515
37756
|
return current;
|
|
37516
37757
|
}
|
|
37517
|
-
const parent = (0,
|
|
37758
|
+
const parent = (0, import_node_path23.dirname)(current);
|
|
37518
37759
|
if (parent === current) return null;
|
|
37519
37760
|
current = parent;
|
|
37520
37761
|
}
|
|
@@ -37522,9 +37763,9 @@ function findRepoBackedSdkRoot(startPath) {
|
|
|
37522
37763
|
function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
|
|
37523
37764
|
const normalized = (() => {
|
|
37524
37765
|
try {
|
|
37525
|
-
return (0,
|
|
37766
|
+
return (0, import_node_fs21.realpathSync)(entrypoint);
|
|
37526
37767
|
} catch {
|
|
37527
|
-
return (0,
|
|
37768
|
+
return (0, import_node_path23.resolve)(entrypoint);
|
|
37528
37769
|
}
|
|
37529
37770
|
})();
|
|
37530
37771
|
const parts = normalized.split(/[\\/]+/);
|
|
@@ -37539,10 +37780,10 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
|
|
|
37539
37780
|
const directPrefix = prefixParts.join("/").toLowerCase();
|
|
37540
37781
|
const knownWindowsPrefixes = [
|
|
37541
37782
|
env.npm_config_prefix,
|
|
37542
|
-
env.APPDATA ? (0,
|
|
37543
|
-
].filter((value) => Boolean(value)).map((value) => (0,
|
|
37783
|
+
env.APPDATA ? (0, import_node_path23.join)(env.APPDATA, "npm") : void 0
|
|
37784
|
+
].filter((value) => Boolean(value)).map((value) => (0, import_node_path23.resolve)(value).replace(/\\/g, "/").toLowerCase());
|
|
37544
37785
|
if (!knownWindowsPrefixes.includes(
|
|
37545
|
-
(0,
|
|
37786
|
+
(0, import_node_path23.resolve)(directPrefix).replace(/\\/g, "/").toLowerCase()
|
|
37546
37787
|
)) {
|
|
37547
37788
|
return null;
|
|
37548
37789
|
}
|
|
@@ -37555,9 +37796,9 @@ function normalizedNpmPrefix(value) {
|
|
|
37555
37796
|
if (!trimmed) return null;
|
|
37556
37797
|
const normalized = (() => {
|
|
37557
37798
|
try {
|
|
37558
|
-
return (0,
|
|
37799
|
+
return (0, import_node_fs21.realpathSync)((0, import_node_path23.resolve)(trimmed));
|
|
37559
37800
|
} catch {
|
|
37560
|
-
return (0,
|
|
37801
|
+
return (0, import_node_path23.resolve)(trimmed);
|
|
37561
37802
|
}
|
|
37562
37803
|
})().replace(/\\/g, "/");
|
|
37563
37804
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
@@ -37580,9 +37821,9 @@ function resolveNpmGlobalPrefix(env) {
|
|
|
37580
37821
|
function isHomebrewFormulaEntrypoint(entrypoint) {
|
|
37581
37822
|
const normalized = (() => {
|
|
37582
37823
|
try {
|
|
37583
|
-
return (0,
|
|
37824
|
+
return (0, import_node_fs21.realpathSync)(entrypoint);
|
|
37584
37825
|
} catch {
|
|
37585
|
-
return (0,
|
|
37826
|
+
return (0, import_node_path23.resolve)(entrypoint);
|
|
37586
37827
|
}
|
|
37587
37828
|
})();
|
|
37588
37829
|
const parts = normalized.split(/[\\/]+/);
|
|
@@ -37592,8 +37833,8 @@ function isHomebrewFormulaEntrypoint(entrypoint) {
|
|
|
37592
37833
|
function resolveUpdatePlan(options = {}) {
|
|
37593
37834
|
const env = options.env ?? process.env;
|
|
37594
37835
|
const homeDir2 = options.homeDir ?? (0, import_node_os14.homedir)();
|
|
37595
|
-
const entrypoint = options.entrypoint ?? (process.argv[1] ? (0,
|
|
37596
|
-
const sourceRoot = entrypoint ? findRepoBackedSdkRoot((0,
|
|
37836
|
+
const entrypoint = options.entrypoint ?? (process.argv[1] ? (0, import_node_path23.resolve)(process.argv[1]) : "");
|
|
37837
|
+
const sourceRoot = entrypoint ? findRepoBackedSdkRoot((0, import_node_path23.dirname)(entrypoint)) : null;
|
|
37597
37838
|
if (sourceRoot) {
|
|
37598
37839
|
return {
|
|
37599
37840
|
kind: "source",
|
|
@@ -37644,9 +37885,9 @@ var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
|
|
|
37644
37885
|
function autoUpdateFailurePath(plan) {
|
|
37645
37886
|
if (plan.kind === "source" || plan.kind === "homebrew") return null;
|
|
37646
37887
|
if (plan.kind === "python-sidecar") {
|
|
37647
|
-
return (0,
|
|
37888
|
+
return (0, import_node_path23.join)(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
|
|
37648
37889
|
}
|
|
37649
|
-
return (0,
|
|
37890
|
+
return (0, import_node_path23.join)(
|
|
37650
37891
|
(0, import_node_os14.homedir)(),
|
|
37651
37892
|
".local",
|
|
37652
37893
|
"deepline",
|
|
@@ -37664,7 +37905,7 @@ function readAutoUpdateFailure(plan) {
|
|
|
37664
37905
|
if (!path) return null;
|
|
37665
37906
|
try {
|
|
37666
37907
|
const parsed = JSON.parse(
|
|
37667
|
-
(0,
|
|
37908
|
+
(0, import_node_fs21.readFileSync)(path, "utf8")
|
|
37668
37909
|
);
|
|
37669
37910
|
if ((parsed.kind === "npm-global" || parsed.kind === "python-sidecar") && typeof parsed.packageSpec === "string" && typeof parsed.failedAt === "string" && typeof parsed.exitCode === "number" && typeof parsed.manualCommand === "string") {
|
|
37670
37911
|
return parsed;
|
|
@@ -37685,8 +37926,8 @@ function writeAutoUpdateFailure(plan, exitCode) {
|
|
|
37685
37926
|
manualCommand: plan.manualCommand
|
|
37686
37927
|
};
|
|
37687
37928
|
try {
|
|
37688
|
-
(0,
|
|
37689
|
-
(0,
|
|
37929
|
+
(0, import_node_fs21.mkdirSync)((0, import_node_path23.dirname)(path), { recursive: true });
|
|
37930
|
+
(0, import_node_fs21.writeFileSync)(path, `${JSON.stringify(marker, null, 2)}
|
|
37690
37931
|
`, "utf8");
|
|
37691
37932
|
} catch {
|
|
37692
37933
|
}
|
|
@@ -37695,7 +37936,7 @@ function clearAutoUpdateFailure(plan) {
|
|
|
37695
37936
|
const path = autoUpdateFailurePath(plan);
|
|
37696
37937
|
if (!path) return;
|
|
37697
37938
|
try {
|
|
37698
|
-
(0,
|
|
37939
|
+
(0, import_node_fs21.unlinkSync)(path);
|
|
37699
37940
|
} catch {
|
|
37700
37941
|
}
|
|
37701
37942
|
}
|
|
@@ -37733,7 +37974,7 @@ function safeVersionSegment(value) {
|
|
|
37733
37974
|
return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
|
|
37734
37975
|
}
|
|
37735
37976
|
function entryPathInVersionDir(versionDir) {
|
|
37736
|
-
return (0,
|
|
37977
|
+
return (0, import_node_path23.join)(
|
|
37737
37978
|
versionDir,
|
|
37738
37979
|
"node_modules",
|
|
37739
37980
|
"deepline",
|
|
@@ -37743,14 +37984,14 @@ function entryPathInVersionDir(versionDir) {
|
|
|
37743
37984
|
);
|
|
37744
37985
|
}
|
|
37745
37986
|
function installedPackageVersion(versionDir) {
|
|
37746
|
-
const packageJsonPath = (0,
|
|
37987
|
+
const packageJsonPath = (0, import_node_path23.join)(
|
|
37747
37988
|
versionDir,
|
|
37748
37989
|
"node_modules",
|
|
37749
37990
|
"deepline",
|
|
37750
37991
|
"package.json"
|
|
37751
37992
|
);
|
|
37752
37993
|
try {
|
|
37753
|
-
const parsed = JSON.parse((0,
|
|
37994
|
+
const parsed = JSON.parse((0, import_node_fs21.readFileSync)(packageJsonPath, "utf8"));
|
|
37754
37995
|
return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
|
|
37755
37996
|
} catch {
|
|
37756
37997
|
return "";
|
|
@@ -37865,20 +38106,20 @@ async function runNpmInstallWithRegistryFallback(input2) {
|
|
|
37865
38106
|
return first.exitCode;
|
|
37866
38107
|
}
|
|
37867
38108
|
function writeSidecarLauncher(input2) {
|
|
37868
|
-
(0,
|
|
37869
|
-
const packageRoot = (0,
|
|
37870
|
-
const versionDir = (0,
|
|
38109
|
+
(0, import_node_fs21.mkdirSync)((0, import_node_path23.dirname)(input2.path), { recursive: true });
|
|
38110
|
+
const packageRoot = (0, import_node_path23.dirname)((0, import_node_path23.dirname)((0, import_node_path23.dirname)(input2.entryPath)));
|
|
38111
|
+
const versionDir = (0, import_node_path23.dirname)((0, import_node_path23.dirname)(packageRoot));
|
|
37871
38112
|
const esbuildProbe = "const {createRequire}=require('node:module');const path=require('node:path');const req=createRequire(path.join(process.argv[1],'package.json'));const result=req('esbuild').transformSync('const value: number = 1;',{loader:'ts'});if(!result||typeof result.code!=='string')process.exit(3);";
|
|
37872
38113
|
const criticalPaths = [
|
|
37873
38114
|
...SDK_SIDECAR_CRITICAL_PACKAGE_FILES.map(
|
|
37874
|
-
(path) => (0,
|
|
38115
|
+
(path) => (0, import_node_path23.join)(packageRoot, path)
|
|
37875
38116
|
),
|
|
37876
38117
|
...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES.map(
|
|
37877
|
-
(path) => (0,
|
|
38118
|
+
(path) => (0, import_node_path23.join)(versionDir, "node_modules", path)
|
|
37878
38119
|
)
|
|
37879
38120
|
];
|
|
37880
38121
|
if (process.platform === "win32") {
|
|
37881
|
-
(0,
|
|
38122
|
+
(0, import_node_fs21.writeFileSync)(
|
|
37882
38123
|
input2.path,
|
|
37883
38124
|
[
|
|
37884
38125
|
`@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
|
|
@@ -37901,7 +38142,7 @@ function writeSidecarLauncher(input2) {
|
|
|
37901
38142
|
);
|
|
37902
38143
|
return;
|
|
37903
38144
|
}
|
|
37904
|
-
(0,
|
|
38145
|
+
(0, import_node_fs21.writeFileSync)(
|
|
37905
38146
|
input2.path,
|
|
37906
38147
|
[
|
|
37907
38148
|
"#!/usr/bin/env sh",
|
|
@@ -37928,17 +38169,17 @@ function writeSidecarLauncher(input2) {
|
|
|
37928
38169
|
);
|
|
37929
38170
|
}
|
|
37930
38171
|
async function runPythonSidecarUpdatePlan(plan) {
|
|
37931
|
-
const versionsDir = (0,
|
|
37932
|
-
const tempDir = (0,
|
|
38172
|
+
const versionsDir = (0, import_node_path23.join)(plan.stateDir, "versions");
|
|
38173
|
+
const tempDir = (0, import_node_path23.join)(
|
|
37933
38174
|
versionsDir,
|
|
37934
38175
|
`.tmp-sdk-update-${process.pid}-${Date.now()}`
|
|
37935
38176
|
);
|
|
37936
|
-
(0,
|
|
37937
|
-
(0,
|
|
37938
|
-
(0,
|
|
38177
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
38178
|
+
(0, import_node_fs21.mkdirSync)(tempDir, { recursive: true });
|
|
38179
|
+
(0, import_node_fs21.writeFileSync)((0, import_node_path23.join)(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
|
|
37939
38180
|
const env = {
|
|
37940
38181
|
...process.env,
|
|
37941
|
-
PATH: `${(0,
|
|
38182
|
+
PATH: `${(0, import_node_path23.dirname)(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
|
|
37942
38183
|
};
|
|
37943
38184
|
const installResult = await runCommand(
|
|
37944
38185
|
plan.npmCommand,
|
|
@@ -37955,7 +38196,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37955
38196
|
);
|
|
37956
38197
|
const installExitCode = installResult.exitCode;
|
|
37957
38198
|
if (installExitCode !== 0) {
|
|
37958
|
-
(0,
|
|
38199
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
37959
38200
|
return installExitCode;
|
|
37960
38201
|
}
|
|
37961
38202
|
const installedVersion = installedPackageVersion(tempDir);
|
|
@@ -37963,7 +38204,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37963
38204
|
process.stderr.write(
|
|
37964
38205
|
"Updated Deepline SDK package did not report a version.\n"
|
|
37965
38206
|
);
|
|
37966
|
-
(0,
|
|
38207
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
37967
38208
|
return 1;
|
|
37968
38209
|
}
|
|
37969
38210
|
const stagedFailure = sidecarInstallFailure(tempDir);
|
|
@@ -37972,32 +38213,32 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37972
38213
|
`Updated Deepline SDK package is incomplete: ${stagedFailure}.
|
|
37973
38214
|
`
|
|
37974
38215
|
);
|
|
37975
|
-
(0,
|
|
38216
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
37976
38217
|
return 1;
|
|
37977
38218
|
}
|
|
37978
|
-
const finalDir = (0,
|
|
38219
|
+
const finalDir = (0, import_node_path23.join)(versionsDir, installedVersion);
|
|
37979
38220
|
const finalEntryPath = entryPathInVersionDir(finalDir);
|
|
37980
38221
|
const finalFailure = sidecarInstallFailure(finalDir);
|
|
37981
38222
|
let backupDir = null;
|
|
37982
38223
|
if (!finalFailure) {
|
|
37983
|
-
(0,
|
|
38224
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
37984
38225
|
} else {
|
|
37985
38226
|
let shouldPublishTemp = true;
|
|
37986
|
-
if ((0,
|
|
37987
|
-
backupDir = (0,
|
|
38227
|
+
if ((0, import_node_fs21.existsSync)(finalDir)) {
|
|
38228
|
+
backupDir = (0, import_node_path23.join)(
|
|
37988
38229
|
versionsDir,
|
|
37989
38230
|
`.backup-${installedVersion}-${process.pid}-${Date.now()}`
|
|
37990
38231
|
);
|
|
37991
38232
|
try {
|
|
37992
|
-
(0,
|
|
38233
|
+
(0, import_node_fs21.renameSync)(finalDir, backupDir);
|
|
37993
38234
|
} catch (error) {
|
|
37994
38235
|
const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
|
|
37995
38236
|
if (!concurrentlyPublishedFailure) {
|
|
37996
|
-
(0,
|
|
38237
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
37997
38238
|
backupDir = null;
|
|
37998
38239
|
shouldPublishTemp = false;
|
|
37999
38240
|
} else {
|
|
38000
|
-
(0,
|
|
38241
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
38001
38242
|
process.stderr.write(
|
|
38002
38243
|
`Failed to preserve the incomplete Deepline SDK sidecar before repair: ${error.message}.
|
|
38003
38244
|
`
|
|
@@ -38008,18 +38249,18 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38008
38249
|
}
|
|
38009
38250
|
if (shouldPublishTemp) {
|
|
38010
38251
|
try {
|
|
38011
|
-
(0,
|
|
38252
|
+
(0, import_node_fs21.renameSync)(tempDir, finalDir);
|
|
38012
38253
|
} catch (error) {
|
|
38013
|
-
(0,
|
|
38254
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
38014
38255
|
const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
|
|
38015
38256
|
if (!concurrentlyPublishedFailure) {
|
|
38016
|
-
if (backupDir) (0,
|
|
38257
|
+
if (backupDir) (0, import_node_fs21.rmSync)(backupDir, { recursive: true, force: true });
|
|
38017
38258
|
backupDir = null;
|
|
38018
38259
|
} else {
|
|
38019
38260
|
let restoreFailure = "";
|
|
38020
|
-
if (backupDir && (0,
|
|
38261
|
+
if (backupDir && (0, import_node_fs21.existsSync)(backupDir) && !(0, import_node_fs21.existsSync)(finalDir)) {
|
|
38021
38262
|
try {
|
|
38022
|
-
(0,
|
|
38263
|
+
(0, import_node_fs21.renameSync)(backupDir, finalDir);
|
|
38023
38264
|
backupDir = null;
|
|
38024
38265
|
} catch (restoreError) {
|
|
38025
38266
|
restoreFailure = `; failed to restore previous install: ${restoreError.message}`;
|
|
@@ -38036,10 +38277,10 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38036
38277
|
}
|
|
38037
38278
|
const publishedFailure = sidecarStructureFailure(finalDir);
|
|
38038
38279
|
if (publishedFailure) {
|
|
38039
|
-
if (backupDir && (0,
|
|
38040
|
-
(0,
|
|
38280
|
+
if (backupDir && (0, import_node_fs21.existsSync)(backupDir)) {
|
|
38281
|
+
(0, import_node_fs21.rmSync)(finalDir, { recursive: true, force: true });
|
|
38041
38282
|
try {
|
|
38042
|
-
(0,
|
|
38283
|
+
(0, import_node_fs21.renameSync)(backupDir, finalDir);
|
|
38043
38284
|
backupDir = null;
|
|
38044
38285
|
} catch {
|
|
38045
38286
|
}
|
|
@@ -38050,7 +38291,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38050
38291
|
);
|
|
38051
38292
|
return 1;
|
|
38052
38293
|
}
|
|
38053
|
-
if (backupDir) (0,
|
|
38294
|
+
if (backupDir) (0, import_node_fs21.rmSync)(backupDir, { recursive: true, force: true });
|
|
38054
38295
|
writeSidecarLauncher({
|
|
38055
38296
|
path: plan.sidecarPath,
|
|
38056
38297
|
hostUrl: plan.hostUrl,
|
|
@@ -38058,28 +38299,28 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38058
38299
|
nodeBin: plan.nodeBin,
|
|
38059
38300
|
entryPath: finalEntryPath
|
|
38060
38301
|
});
|
|
38061
|
-
(0,
|
|
38062
|
-
(0,
|
|
38302
|
+
(0, import_node_fs21.writeFileSync)(
|
|
38303
|
+
(0, import_node_path23.join)(plan.stateDir, ".version"),
|
|
38063
38304
|
`${installedVersion}
|
|
38064
38305
|
`,
|
|
38065
38306
|
"utf8"
|
|
38066
38307
|
);
|
|
38067
|
-
(0,
|
|
38068
|
-
(0,
|
|
38308
|
+
(0, import_node_fs21.writeFileSync)(
|
|
38309
|
+
(0, import_node_path23.join)(plan.stateDir, ".install-method"),
|
|
38069
38310
|
"python-sidecar\n",
|
|
38070
38311
|
"utf8"
|
|
38071
38312
|
);
|
|
38072
|
-
(0,
|
|
38073
|
-
(0,
|
|
38313
|
+
(0, import_node_fs21.writeFileSync)(
|
|
38314
|
+
(0, import_node_path23.join)(plan.stateDir, ".command-path"),
|
|
38074
38315
|
`${plan.sidecarPath}
|
|
38075
38316
|
`,
|
|
38076
38317
|
"utf8"
|
|
38077
38318
|
);
|
|
38078
|
-
(0,
|
|
38079
|
-
(0,
|
|
38319
|
+
(0, import_node_fs21.writeFileSync)((0, import_node_path23.join)(plan.stateDir, ".runner"), "node\n", "utf8");
|
|
38320
|
+
(0, import_node_fs21.writeFileSync)((0, import_node_path23.join)(plan.stateDir, ".node-bin"), `${plan.nodeBin}
|
|
38080
38321
|
`, "utf8");
|
|
38081
|
-
(0,
|
|
38082
|
-
(0,
|
|
38322
|
+
(0, import_node_fs21.writeFileSync)(
|
|
38323
|
+
(0, import_node_path23.join)(plan.stateDir, ".entry-path"),
|
|
38083
38324
|
`${finalEntryPath}
|
|
38084
38325
|
`,
|
|
38085
38326
|
"utf8"
|
|
@@ -39006,14 +39247,14 @@ chooses the connected Slack channel or member and the events it receives.
|
|
|
39006
39247
|
|
|
39007
39248
|
// src/cli/commands/tools.ts
|
|
39008
39249
|
var import_commander3 = require("commander");
|
|
39009
|
-
var
|
|
39250
|
+
var import_node_fs23 = require("fs");
|
|
39010
39251
|
var import_node_os16 = require("os");
|
|
39011
|
-
var
|
|
39252
|
+
var import_node_path25 = require("path");
|
|
39012
39253
|
|
|
39013
39254
|
// src/tool-output.ts
|
|
39014
|
-
var
|
|
39255
|
+
var import_node_fs22 = require("fs");
|
|
39015
39256
|
var import_node_os15 = require("os");
|
|
39016
|
-
var
|
|
39257
|
+
var import_node_path24 = require("path");
|
|
39017
39258
|
function isPlainObject(value) {
|
|
39018
39259
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
39019
39260
|
}
|
|
@@ -39140,19 +39381,19 @@ function projectRowOutput(conversion) {
|
|
|
39140
39381
|
};
|
|
39141
39382
|
}
|
|
39142
39383
|
function ensureOutputDir() {
|
|
39143
|
-
const outputDir = (0,
|
|
39144
|
-
(0,
|
|
39384
|
+
const outputDir = (0, import_node_path24.join)((0, import_node_os15.homedir)(), ".local", "share", "deepline", "data");
|
|
39385
|
+
(0, import_node_fs22.mkdirSync)(outputDir, { recursive: true });
|
|
39145
39386
|
return outputDir;
|
|
39146
39387
|
}
|
|
39147
39388
|
function writeJsonOutputFile(payload, stem) {
|
|
39148
39389
|
const outputDir = ensureOutputDir();
|
|
39149
|
-
const outputPath = (0,
|
|
39150
|
-
(0,
|
|
39390
|
+
const outputPath = (0, import_node_path24.join)(outputDir, `${stem}_${Date.now()}.json`);
|
|
39391
|
+
(0, import_node_fs22.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
39151
39392
|
return outputPath;
|
|
39152
39393
|
}
|
|
39153
39394
|
function writeCsvOutputFile(rows, stem, options) {
|
|
39154
|
-
const outputPath = options?.outPath ? options.outPath : (0,
|
|
39155
|
-
(0,
|
|
39395
|
+
const outputPath = options?.outPath ? options.outPath : (0, import_node_path24.join)(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
|
|
39396
|
+
(0, import_node_fs22.mkdirSync)((0, import_node_path24.dirname)(outputPath), { recursive: true });
|
|
39156
39397
|
const columns = columnsForRows(rows);
|
|
39157
39398
|
const escapeCell = (value) => {
|
|
39158
39399
|
const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
|
|
@@ -39161,19 +39402,19 @@ function writeCsvOutputFile(rows, stem, options) {
|
|
|
39161
39402
|
}
|
|
39162
39403
|
return normalized;
|
|
39163
39404
|
};
|
|
39164
|
-
const fd = (0,
|
|
39405
|
+
const fd = (0, import_node_fs22.openSync)(outputPath, "w");
|
|
39165
39406
|
try {
|
|
39166
|
-
(0,
|
|
39407
|
+
(0, import_node_fs22.writeSync)(fd, `${columns.map(escapeCell).join(",")}
|
|
39167
39408
|
`);
|
|
39168
39409
|
for (const row of rows) {
|
|
39169
|
-
(0,
|
|
39410
|
+
(0, import_node_fs22.writeSync)(
|
|
39170
39411
|
fd,
|
|
39171
39412
|
`${columns.map((column) => escapeCell(row[column])).join(",")}
|
|
39172
39413
|
`
|
|
39173
39414
|
);
|
|
39174
39415
|
}
|
|
39175
39416
|
} finally {
|
|
39176
|
-
(0,
|
|
39417
|
+
(0, import_node_fs22.closeSync)(fd);
|
|
39177
39418
|
}
|
|
39178
39419
|
const previewRows = rows.slice(0, 5);
|
|
39179
39420
|
const previewColumns = columns.slice(0, 5);
|
|
@@ -39295,6 +39536,78 @@ function arrayField(value, key) {
|
|
|
39295
39536
|
return Array.isArray(candidate) ? candidate : [];
|
|
39296
39537
|
}
|
|
39297
39538
|
|
|
39539
|
+
// src/cli/tool-description.ts
|
|
39540
|
+
var Capability = class _Capability {
|
|
39541
|
+
#catalogEntry;
|
|
39542
|
+
constructor(catalogEntry) {
|
|
39543
|
+
this.#catalogEntry = catalogEntry;
|
|
39544
|
+
}
|
|
39545
|
+
static fromCatalogEntry(catalogEntry) {
|
|
39546
|
+
return new _Capability(catalogEntry);
|
|
39547
|
+
}
|
|
39548
|
+
describe() {
|
|
39549
|
+
return CapabilityDescription.fromCatalogEntry(this.#catalogEntry);
|
|
39550
|
+
}
|
|
39551
|
+
};
|
|
39552
|
+
var CapabilityDescription = class _CapabilityDescription {
|
|
39553
|
+
#catalogEntry;
|
|
39554
|
+
constructor(catalogEntry) {
|
|
39555
|
+
this.#catalogEntry = catalogEntry;
|
|
39556
|
+
}
|
|
39557
|
+
static fromCatalogEntry(catalogEntry) {
|
|
39558
|
+
return new _CapabilityDescription(catalogEntry);
|
|
39559
|
+
}
|
|
39560
|
+
/**
|
|
39561
|
+
* The customer price already resolved by the catalog. This intentionally
|
|
39562
|
+
* omits provider-price fields, even when a catalog Adapter carried them.
|
|
39563
|
+
*/
|
|
39564
|
+
customerCost() {
|
|
39565
|
+
const legacyCost = recordValue2(this.#catalogEntry.cost);
|
|
39566
|
+
const pricing = recordValue2(this.#catalogEntry.pricing);
|
|
39567
|
+
const unit = stringValue4(pricing.unit);
|
|
39568
|
+
const legacyPricingModel = stringValue4(
|
|
39569
|
+
legacyCost.pricingModel ?? legacyCost.pricing_model
|
|
39570
|
+
);
|
|
39571
|
+
const pricingModel = unit === "call" ? "fixed" : unit === "result" || unit === "page" ? `per_${unit}` : unit === "usage" ? "provider_usage" : legacyPricingModel;
|
|
39572
|
+
const canonicalCredits = numberValue(
|
|
39573
|
+
pricing.creditsPerUnit ?? pricing.credits_per_unit
|
|
39574
|
+
);
|
|
39575
|
+
const canonicalUsd = numberValue(
|
|
39576
|
+
pricing.usdPerUnit ?? pricing.usd_per_unit
|
|
39577
|
+
);
|
|
39578
|
+
return {
|
|
39579
|
+
pricingModel: pricingModel || null,
|
|
39580
|
+
unit: unit || null,
|
|
39581
|
+
displayText: stringValue4(pricing.displayText ?? pricing.display_text),
|
|
39582
|
+
summary: stringValue4(pricing.summary),
|
|
39583
|
+
billingMode: stringValue4(
|
|
39584
|
+
legacyCost.billingMode ?? legacyCost.billing_mode
|
|
39585
|
+
),
|
|
39586
|
+
billingSource: stringValue4(
|
|
39587
|
+
this.#catalogEntry.billingSource ?? this.#catalogEntry.billing_source
|
|
39588
|
+
),
|
|
39589
|
+
billingSourceLabel: stringValue4(
|
|
39590
|
+
this.#catalogEntry.billingSourceLabel ?? this.#catalogEntry.billing_source_label
|
|
39591
|
+
),
|
|
39592
|
+
deeplineCreditsPerPricingUnit: canonicalCredits ?? numberValue(
|
|
39593
|
+
this.#catalogEntry.deeplineCreditsPerPricingUnit ?? this.#catalogEntry.deepline_credits_per_pricing_unit
|
|
39594
|
+
),
|
|
39595
|
+
deeplineUsdPerPricingUnit: canonicalUsd ?? numberValue(
|
|
39596
|
+
this.#catalogEntry.deeplineUsdPerPricingUnit ?? this.#catalogEntry.deepline_usd_per_pricing_unit
|
|
39597
|
+
)
|
|
39598
|
+
};
|
|
39599
|
+
}
|
|
39600
|
+
};
|
|
39601
|
+
function recordValue2(value) {
|
|
39602
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
39603
|
+
}
|
|
39604
|
+
function stringValue4(value) {
|
|
39605
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
39606
|
+
}
|
|
39607
|
+
function numberValue(value) {
|
|
39608
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
39609
|
+
}
|
|
39610
|
+
|
|
39298
39611
|
// src/cli/commands/tools.ts
|
|
39299
39612
|
var TOOL_COMMAND_TEMPLATES = {
|
|
39300
39613
|
describe: "deepline tools describe <toolId>",
|
|
@@ -40215,7 +40528,7 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
|
40215
40528
|
const extractedValues = extractionContractEntries(
|
|
40216
40529
|
arrayField2(toolExecutionResult, "extractedValues", "extracted_values")
|
|
40217
40530
|
);
|
|
40218
|
-
const pricing =
|
|
40531
|
+
const pricing = Capability.fromCatalogEntry(tool).describe().customerCost();
|
|
40219
40532
|
const deprecation = recordField2(tool, "deprecation");
|
|
40220
40533
|
const replacementToolId = stringField2(
|
|
40221
40534
|
deprecation,
|
|
@@ -40266,38 +40579,6 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
|
40266
40579
|
...starterScript ? { starterScript } : {}
|
|
40267
40580
|
};
|
|
40268
40581
|
}
|
|
40269
|
-
function toolPricingContractForDescribe(tool) {
|
|
40270
|
-
const legacyCost = recordField2(tool, "cost");
|
|
40271
|
-
const pricingValue = tool.pricing;
|
|
40272
|
-
const hasCanonicalPricing = isRecord12(pricingValue);
|
|
40273
|
-
const canonicalPricing = hasCanonicalPricing ? pricingValue : {};
|
|
40274
|
-
const unit = stringField2(canonicalPricing, "unit");
|
|
40275
|
-
const legacyPricingModel = stringField2(
|
|
40276
|
-
legacyCost,
|
|
40277
|
-
"pricingModel",
|
|
40278
|
-
"pricing_model"
|
|
40279
|
-
);
|
|
40280
|
-
const pricingModel = unit === "call" ? "fixed" : unit === "result" || unit === "page" ? `per_${unit}` : unit === "usage" ? "provider_usage" : legacyPricingModel;
|
|
40281
|
-
return {
|
|
40282
|
-
pricingModel: pricingModel || null,
|
|
40283
|
-
unit: unit || null,
|
|
40284
|
-
displayText: stringField2(canonicalPricing, "displayText", "display_text") || null,
|
|
40285
|
-
summary: stringField2(canonicalPricing, "summary") || null,
|
|
40286
|
-
billingMode: stringField2(legacyCost, "billingMode", "billing_mode") || null,
|
|
40287
|
-
billingSource: stringField2(tool, "billingSource", "billing_source") || null,
|
|
40288
|
-
billingSourceLabel: stringField2(tool, "billingSourceLabel", "billing_source_label") || null,
|
|
40289
|
-
deeplineCreditsPerPricingUnit: hasCanonicalPricing ? numberField2(canonicalPricing, "creditsPerUnit", "credits_per_unit") : numberField2(
|
|
40290
|
-
tool,
|
|
40291
|
-
"deeplineCreditsPerPricingUnit",
|
|
40292
|
-
"deepline_credits_per_pricing_unit"
|
|
40293
|
-
),
|
|
40294
|
-
deeplineUsdPerPricingUnit: hasCanonicalPricing ? numberField2(canonicalPricing, "usdPerUnit", "usd_per_unit") : numberField2(
|
|
40295
|
-
tool,
|
|
40296
|
-
"deeplineUsdPerPricingUnit",
|
|
40297
|
-
"deepline_usd_per_pricing_unit"
|
|
40298
|
-
)
|
|
40299
|
-
};
|
|
40300
|
-
}
|
|
40301
40582
|
function extractionContractEntries(entries) {
|
|
40302
40583
|
return entries.flatMap((entry) => {
|
|
40303
40584
|
if (!isRecord12(entry)) return [];
|
|
@@ -40750,6 +41031,7 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
|
|
|
40750
41031
|
toolId,
|
|
40751
41032
|
provider: tool.provider,
|
|
40752
41033
|
displayName: tool.displayName,
|
|
41034
|
+
cost: Capability.fromCatalogEntry(tool).describe().customerCost(),
|
|
40753
41035
|
usageGuidance,
|
|
40754
41036
|
runtimeOutputHelp: {
|
|
40755
41037
|
contract: "tools describe shows declared schema and Deepline getters; it is not an observed provider response.",
|
|
@@ -41080,11 +41362,11 @@ function normalizeOutputFormat(raw) {
|
|
|
41080
41362
|
}
|
|
41081
41363
|
function resolveAtFilePath(rawPath) {
|
|
41082
41364
|
const trimmed = rawPath.trim();
|
|
41083
|
-
const resolved = (0,
|
|
41084
|
-
if ((0,
|
|
41365
|
+
const resolved = (0, import_node_path25.resolve)(trimmed);
|
|
41366
|
+
if ((0, import_node_fs23.existsSync)(resolved)) return resolved;
|
|
41085
41367
|
if (process.platform !== "win32" && trimmed.includes("\\")) {
|
|
41086
|
-
const normalized = (0,
|
|
41087
|
-
if ((0,
|
|
41368
|
+
const normalized = (0, import_node_path25.resolve)(trimmed.replace(/\\/g, "/"));
|
|
41369
|
+
if ((0, import_node_fs23.existsSync)(normalized)) return normalized;
|
|
41088
41370
|
}
|
|
41089
41371
|
return resolved;
|
|
41090
41372
|
}
|
|
@@ -41095,7 +41377,7 @@ function readJsonArgument(raw, flagName) {
|
|
|
41095
41377
|
throw new Error(`Invalid ${flagName} value: empty @file path.`);
|
|
41096
41378
|
}
|
|
41097
41379
|
try {
|
|
41098
|
-
return (0,
|
|
41380
|
+
return (0, import_node_fs23.readFileSync)(resolveAtFilePath(filePath), "utf8").replace(
|
|
41099
41381
|
/^\uFEFF/,
|
|
41100
41382
|
""
|
|
41101
41383
|
);
|
|
@@ -41172,7 +41454,7 @@ function parseExecuteOptions(args) {
|
|
|
41172
41454
|
continue;
|
|
41173
41455
|
}
|
|
41174
41456
|
if ((arg === "--out" || arg === "-o") && args[index + 1]) {
|
|
41175
|
-
outPath = (0,
|
|
41457
|
+
outPath = (0, import_node_path25.resolve)(args[++index]);
|
|
41176
41458
|
continue;
|
|
41177
41459
|
}
|
|
41178
41460
|
throw new Error(`Unknown option: ${arg}`);
|
|
@@ -41202,9 +41484,9 @@ function starterScriptJson(script) {
|
|
|
41202
41484
|
function seedToolListScript(input2) {
|
|
41203
41485
|
const stem = safeFileStem(input2.toolId);
|
|
41204
41486
|
const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
|
|
41205
|
-
const scriptDir = (0,
|
|
41206
|
-
(0,
|
|
41207
|
-
const scriptPath = (0,
|
|
41487
|
+
const scriptDir = (0, import_node_fs23.mkdtempSync)((0, import_node_path25.join)((0, import_node_os16.tmpdir)(), "deepline-workflow-seed-"));
|
|
41488
|
+
(0, import_node_fs23.chmodSync)(scriptDir, 448);
|
|
41489
|
+
const scriptPath = (0, import_node_path25.join)(scriptDir, fileName);
|
|
41208
41490
|
const projectDir = `deepline/projects/${stem}-workflow`;
|
|
41209
41491
|
const playName = `${stem}-workflow`;
|
|
41210
41492
|
const sampleRows = input2.rows.length > 0 ? `${JSON.stringify(input2.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
|
|
@@ -41247,7 +41529,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
41247
41529
|
description: ${JSON.stringify(`Seed ${input2.toolId} rows into a Deepline workflow-ready dataset.`)},
|
|
41248
41530
|
});
|
|
41249
41531
|
`;
|
|
41250
|
-
(0,
|
|
41532
|
+
(0, import_node_fs23.writeFileSync)(scriptPath, script, { encoding: "utf-8", mode: 384 });
|
|
41251
41533
|
return {
|
|
41252
41534
|
path: scriptPath,
|
|
41253
41535
|
sourceCode: script,
|
|
@@ -41673,7 +41955,7 @@ Examples:
|
|
|
41673
41955
|
|
|
41674
41956
|
// src/cli/commands/workflow.ts
|
|
41675
41957
|
var import_promises9 = require("fs/promises");
|
|
41676
|
-
var
|
|
41958
|
+
var import_node_path26 = require("path");
|
|
41677
41959
|
|
|
41678
41960
|
// src/cli/workflow-to-play.ts
|
|
41679
41961
|
var import_node_crypto8 = require("crypto");
|
|
@@ -41890,7 +42172,7 @@ function readStatus(payload) {
|
|
|
41890
42172
|
}
|
|
41891
42173
|
async function readJsonOption(payload, file) {
|
|
41892
42174
|
if (file) {
|
|
41893
|
-
const raw = await (0, import_promises9.readFile)((0,
|
|
42175
|
+
const raw = await (0, import_promises9.readFile)((0, import_node_path26.resolve)(file), "utf8");
|
|
41894
42176
|
return JSON.parse(raw);
|
|
41895
42177
|
}
|
|
41896
42178
|
if (payload) {
|
|
@@ -41924,8 +42206,8 @@ async function transformOne(api, workflowId, outDir, publish) {
|
|
|
41924
42206
|
revision.config,
|
|
41925
42207
|
{ workflowName: workflow.name, version: revision.version }
|
|
41926
42208
|
);
|
|
41927
|
-
const file = (0,
|
|
41928
|
-
await (0, import_promises9.mkdir)((0,
|
|
42209
|
+
const file = (0, import_node_path26.join)((0, import_node_path26.resolve)(outDir), `${compiled.playName}.play.ts`);
|
|
42210
|
+
await (0, import_promises9.mkdir)((0, import_node_path26.dirname)(file), { recursive: true });
|
|
41929
42211
|
await (0, import_promises9.writeFile)(file, compiled.sourceCode, "utf8");
|
|
41930
42212
|
let published = false;
|
|
41931
42213
|
if (publish) {
|
|
@@ -42300,7 +42582,7 @@ function isDowngradeAutoUpdateResponse(response) {
|
|
|
42300
42582
|
return compareSemver(target, current) < 0;
|
|
42301
42583
|
}
|
|
42302
42584
|
function relaunchCurrentCommand(plan) {
|
|
42303
|
-
return new Promise((
|
|
42585
|
+
return new Promise((resolve20) => {
|
|
42304
42586
|
const command = plan.kind === "python-sidecar" ? plan.sidecarPath : process.execPath;
|
|
42305
42587
|
const args = plan.kind === "python-sidecar" ? process.argv.slice(2) : process.argv.slice(1);
|
|
42306
42588
|
const child = (0, import_node_child_process6.spawn)(command, args, {
|
|
@@ -42316,9 +42598,9 @@ function relaunchCurrentCommand(plan) {
|
|
|
42316
42598
|
`Deepline SDK/CLI updated, but relaunch failed: ${error.message}
|
|
42317
42599
|
`
|
|
42318
42600
|
);
|
|
42319
|
-
|
|
42601
|
+
resolve20(1);
|
|
42320
42602
|
});
|
|
42321
|
-
child.on("close", (code) =>
|
|
42603
|
+
child.on("close", (code) => resolve20(code ?? 1));
|
|
42322
42604
|
});
|
|
42323
42605
|
}
|
|
42324
42606
|
async function maybeAutoUpdateAndRelaunch(response, baseUrl) {
|
|
@@ -42709,8 +42991,8 @@ function topLevelCommandKnown(program, commandName) {
|
|
|
42709
42991
|
);
|
|
42710
42992
|
}
|
|
42711
42993
|
async function runPlayRunnerHealthCheck() {
|
|
42712
|
-
const dir = await (0, import_promises10.mkdtemp)((0,
|
|
42713
|
-
const file = (0,
|
|
42994
|
+
const dir = await (0, import_promises10.mkdtemp)((0, import_node_path27.join)((0, import_node_os18.tmpdir)(), "deepline-health-play-"));
|
|
42995
|
+
const file = (0, import_node_path27.join)(dir, "health-check.play.ts");
|
|
42714
42996
|
try {
|
|
42715
42997
|
await (0, import_promises10.writeFile)(
|
|
42716
42998
|
file,
|