deepline 0.3.49 → 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/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 import_node_path26 = require("path");
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.49",
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
@@ -2216,7 +2216,7 @@ function decodeSseFrame(frame) {
2216
2216
  return parsed;
2217
2217
  }
2218
2218
  function sleep(ms) {
2219
- return new Promise((resolve19) => setTimeout(resolve19, ms));
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((resolve19) => {
3985
- wake = resolve19;
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
- (resolve19) => setTimeout(() => resolve19(true), OBSERVE_BOOTSTRAP_TIMEOUT_MS)
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((resolve19) => setTimeout(resolve19, ms));
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") {
@@ -7754,6 +7754,10 @@ function flattenObjectColumns(row, options = {}) {
7754
7754
  }
7755
7755
  if (value && typeof value === "object" && !Array.isArray(value)) {
7756
7756
  const record = value;
7757
+ if (options.objectColumns === "json") {
7758
+ flattened[key] = csvSafeJsonString(record);
7759
+ continue;
7760
+ }
7757
7761
  const hasMatchedEnvelope = Object.prototype.hasOwnProperty.call(record, "matched_result") || Object.prototype.hasOwnProperty.call(record, "matchedResult");
7758
7762
  if (hasMatchedEnvelope) {
7759
7763
  flattened[key] = csvSafeJsonString(record);
@@ -8078,6 +8082,8 @@ async function httpJson(method, url, apiKey, body) {
8078
8082
  "X-Deepline-API-Contract": SDK_API_CONTRACT
8079
8083
  };
8080
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;
8081
8087
  let response = null;
8082
8088
  let lastError = null;
8083
8089
  for (const candidateUrl of buildCandidateUrls2(url)) {
@@ -8144,7 +8150,7 @@ function buildCandidateUrls2(url) {
8144
8150
  }
8145
8151
  }
8146
8152
  function sleep4(ms) {
8147
- return new Promise((resolve19) => setTimeout(resolve19, ms));
8153
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
8148
8154
  }
8149
8155
  function printDeeplineLogo() {
8150
8156
  if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
@@ -10107,10 +10113,6 @@ var import_node_fs7 = require("fs");
10107
10113
  var import_node_os6 = require("os");
10108
10114
  var import_node_path8 = require("path");
10109
10115
 
10110
- // src/cli/dataset-stats.ts
10111
- var import_node_fs6 = require("fs");
10112
- var import_node_path7 = require("path");
10113
-
10114
10116
  // ../plays/dataset-summary.ts
10115
10117
  function formatDatasetRowCountsLine(counts) {
10116
10118
  const { persisted, succeeded, failed } = counts;
@@ -10164,6 +10166,103 @@ function formatDatasetExecutionStats(raw, _persistedRowTotal) {
10164
10166
  return stats;
10165
10167
  }
10166
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
+
10167
10266
  // src/cli/dataset-stats.ts
10168
10267
  function mergeCanonicalRowsInfo(left, right) {
10169
10268
  const preferred = right.rows.length > left.rows.length || right.complete && !left.complete && right.rows.length === left.rows.length ? right : left;
@@ -10581,6 +10680,11 @@ function collectSerializedDatasetRowsInfos(statusOrResult) {
10581
10680
  }
10582
10681
  return infos;
10583
10682
  }
10683
+ var LegacyRunDatasetCatalogAdapter = class {
10684
+ static datasets(statusOrResult) {
10685
+ return collectSerializedDatasetRowsInfos(statusOrResult);
10686
+ }
10687
+ };
10584
10688
  function extractCanonicalRowsInfo(statusOrResult) {
10585
10689
  return collectCanonicalRowsInfos(statusOrResult)[0] ?? null;
10586
10690
  }
@@ -10750,22 +10854,6 @@ function buildDatasetStats(rows, totalRows = rows.length, columns = inferColumns
10750
10854
  columnStats
10751
10855
  };
10752
10856
  }
10753
- function writeCanonicalRowsCsv(rowsInfo, outPath) {
10754
- if (!rowsInfo.complete) {
10755
- throw new Error(
10756
- `Run output only includes ${rowsInfo.rows.length} preview row(s) of ${rowsInfo.totalRows}; cannot export a complete CSV from this status payload yet.`
10757
- );
10758
- }
10759
- const sanitized = sanitizeCsvProjectionInfo({
10760
- rows: rowsInfo.rows,
10761
- columns: rowsInfo.columns
10762
- });
10763
- const rows = dataExportRows(sanitized.rows);
10764
- const columns = dataExportColumns(rows, sanitized.columns);
10765
- const resolved = (0, import_node_path7.resolve)(outPath);
10766
- (0, import_node_fs6.writeFileSync)(resolved, csvStringFromRows(rows, columns), "utf-8");
10767
- return resolved;
10768
- }
10769
10857
 
10770
10858
  // src/cli/commands/csv.ts
10771
10859
  function parseRowRange(raw) {
@@ -18246,6 +18334,207 @@ var SDK_PACKAGE_JSON = (0, import_node_path13.resolve)(SDK_PACKAGE_ROOT, "packag
18246
18334
  var SDK_ENTRY_FILE = (0, import_node_path13.resolve)(SDK_SOURCE_ROOT, "index.ts");
18247
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");
18248
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
+
18249
18538
  // src/cli/progress.ts
18250
18539
  var import_node_worker_threads = require("worker_threads");
18251
18540
  var CliProgress = class {
@@ -18515,7 +18804,7 @@ ${hint}`;
18515
18804
 
18516
18805
  // ../play-runtime/governor/policy.ts
18517
18806
  var DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS = 64;
18518
- var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS = 256;
18807
+ var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS = 1e3;
18519
18808
  var MAX_CONFIGURABLE_CONCURRENT_ROWS = 1e3;
18520
18809
  function resolveMaxConcurrentExternalCalls(requested) {
18521
18810
  if (requested === void 0 || requested === null) {
@@ -19057,8 +19346,7 @@ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
19057
19346
  "--force",
19058
19347
  "--force-tool-refresh",
19059
19348
  "--open",
19060
- "--debug-map-latency",
19061
- "--debug-fixture-provider-pacing"
19349
+ "--debug-map-latency"
19062
19350
  ]);
19063
19351
  async function pathExistsIncludingSymlink(path) {
19064
19352
  try {
@@ -19193,7 +19481,7 @@ function traceCliSync(phase, fields, run) {
19193
19481
  }
19194
19482
  }
19195
19483
  function sleep5(ms) {
19196
- return new Promise((resolve19) => setTimeout(resolve19, ms));
19484
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
19197
19485
  }
19198
19486
  function parseReferencedPlayTarget2(target) {
19199
19487
  const trimmed = target.trim();
@@ -22506,103 +22794,6 @@ async function fetchBackingDatasetRows(input2) {
22506
22794
  source: `${input2.rowsInfo.source ?? "result.rows"} -> /api/v2/plays/${playName}/sheet?tableNamespace=${tableNamespace}`
22507
22795
  };
22508
22796
  }
22509
- function resolveDatasetByName(available, datasetPath) {
22510
- const target = datasetPath.trim();
22511
- const exact = available.find((info) => info.source === target);
22512
- if (exact) {
22513
- return exact;
22514
- }
22515
- const byDatasetId = available.find((info) => info.datasetId === target);
22516
- if (byDatasetId) {
22517
- return byDatasetId;
22518
- }
22519
- const byNamespace = available.find(
22520
- (info) => info.tableNamespace && info.tableNamespace === target
22521
- );
22522
- if (byNamespace) {
22523
- return byNamespace;
22524
- }
22525
- return null;
22526
- }
22527
- function canonicalRowsIdentity(info) {
22528
- return info.datasetId?.trim() ? `id:${info.datasetId.trim()}` : `path:${info.source ?? info.tableNamespace ?? "dataset"}`;
22529
- }
22530
- function distinctCanonicalRowsInfos(infos) {
22531
- const byIdentity = /* @__PURE__ */ new Map();
22532
- for (const info of infos) {
22533
- const identity = canonicalRowsIdentity(info);
22534
- const existing = byIdentity.get(identity);
22535
- byIdentity.set(
22536
- identity,
22537
- existing ? mergeCanonicalRowsInfo(existing, info) : info
22538
- );
22539
- }
22540
- return [...byIdentity.values()];
22541
- }
22542
- function packageForExportSelection(status) {
22543
- const root = status;
22544
- const nested = readRecord(root.package);
22545
- if (nested?.kind === "play_run") return nested;
22546
- return root.kind === "play_run" ? root : null;
22547
- }
22548
- function withReturnedDatasetAliases(status, available) {
22549
- const packaged = packageForExportSelection(status);
22550
- const outputs = readRecord(packaged?.outputs);
22551
- if (!outputs) return available;
22552
- const expanded = [...available];
22553
- for (const outputValue of Object.values(outputs)) {
22554
- const output2 = readRecord(outputValue);
22555
- if (output2?.kind !== "dataset") continue;
22556
- const alias = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
22557
- if (!alias) continue;
22558
- const datasetId = typeof output2.datasetId === "string" && output2.datasetId.trim() ? output2.datasetId.trim() : null;
22559
- const canonicalPath2 = typeof output2.dataset === "string" && output2.dataset.trim() ? output2.dataset.trim() : null;
22560
- const canonical = available.find(
22561
- (info) => datasetId && info.datasetId === datasetId || canonicalPath2 && info.source === canonicalPath2
22562
- );
22563
- if (canonical) {
22564
- const aliasIndex = expanded.findIndex((info) => info.source === alias);
22565
- if (aliasIndex >= 0) {
22566
- expanded[aliasIndex] = {
22567
- ...mergeCanonicalRowsInfo(expanded[aliasIndex], canonical),
22568
- source: alias
22569
- };
22570
- } else {
22571
- expanded.push({ ...canonical, source: alias });
22572
- }
22573
- }
22574
- }
22575
- return expanded;
22576
- }
22577
- function returnedRowsInfos(status, available) {
22578
- const packaged = packageForExportSelection(status);
22579
- const outputs = readRecord(packaged?.outputs);
22580
- if (outputs) {
22581
- const selected = /* @__PURE__ */ new Map();
22582
- for (const outputValue of Object.values(outputs)) {
22583
- const output2 = readRecord(outputValue);
22584
- if (output2?.kind !== "dataset") continue;
22585
- const datasetId = typeof output2.datasetId === "string" && output2.datasetId.trim() ? output2.datasetId.trim() : null;
22586
- const alias = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
22587
- const canonicalPath2 = typeof output2.dataset === "string" && output2.dataset.trim() ? output2.dataset.trim() : null;
22588
- 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);
22589
- if (!info) continue;
22590
- const identity = datasetId ? `id:${datasetId}` : `path:${canonicalPath2 ?? alias ?? info.source ?? "dataset"}`;
22591
- const aliased = { ...info, source: alias ?? info.source };
22592
- const existing = selected.get(identity);
22593
- selected.set(
22594
- identity,
22595
- existing ? mergeCanonicalRowsInfo(existing, aliased) : aliased
22596
- );
22597
- }
22598
- if (selected.size > 0) return [...selected.values()];
22599
- }
22600
- return distinctCanonicalRowsInfos(
22601
- available.filter(
22602
- (info) => Boolean(info.source?.startsWith("result.")) && !info.recovered
22603
- )
22604
- );
22605
- }
22606
22797
  function exportDatasetCommand(input2) {
22607
22798
  return `deepline runs export ${input2.runId} --dataset ${shellSingleQuote(
22608
22799
  input2.datasetPath
@@ -22661,16 +22852,17 @@ async function exportPlayStatusRows(client2, status, outPath, options = {}) {
22661
22852
  if (!outPath) {
22662
22853
  return null;
22663
22854
  }
22664
- const availableRows = withReturnedDatasetAliases(
22665
- status,
22666
- distinctCanonicalRowsInfos(collectSerializedDatasetRowsInfos(status))
22667
- );
22668
- const returnedRows = returnedRowsInfos(status, availableRows);
22669
- const recoveredRows = distinctCanonicalRowsInfos(
22670
- availableRows.filter((info) => info.recovered)
22671
- );
22672
- const rowsInfo = options.datasetPath ? resolveDatasetByName(availableRows, options.datasetPath) ?? null : returnedRows.length === 1 ? returnedRows[0] : returnedRows.length === 0 && recoveredRows.length === 1 ? recoveredRows[0] : null;
22673
- if (!rowsInfo && options.datasetPath) {
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) {
22674
22866
  const available = availableRows.map((info) => info.source).filter((source) => typeof source === "string");
22675
22867
  const commands = datasetChoiceLines({
22676
22868
  runId: status.runId,
@@ -22761,7 +22953,7 @@ ${commands.join("\n")}`,
22761
22953
  datasetPath: options.datasetPath
22762
22954
  });
22763
22955
  return {
22764
- path: writeCanonicalRowsCsv(guarded2, outPath),
22956
+ path: RunDataset.from(guarded2).exportCsv(outPath),
22765
22957
  rowsInfo: guarded2
22766
22958
  };
22767
22959
  }
@@ -22773,7 +22965,7 @@ ${commands.join("\n")}`,
22773
22965
  datasetPath: options.datasetPath
22774
22966
  });
22775
22967
  return {
22776
- path: writeCanonicalRowsCsv(guarded2, outPath),
22968
+ path: RunDataset.from(guarded2).exportCsv(outPath),
22777
22969
  rowsInfo: guarded2
22778
22970
  };
22779
22971
  }
@@ -22807,7 +22999,10 @@ ${commands.join("\n")}`,
22807
22999
  availableRows,
22808
23000
  datasetPath: options.datasetPath
22809
23001
  });
22810
- return { path: writeCanonicalRowsCsv(guarded, outPath), rowsInfo: guarded };
23002
+ return {
23003
+ path: RunDataset.from(guarded).exportCsv(outPath),
23004
+ rowsInfo: guarded
23005
+ };
22811
23006
  }
22812
23007
  function extractActiveRunsFromError(error) {
22813
23008
  if (!(error instanceof DeeplineError)) {
@@ -23101,9 +23296,6 @@ function parsePlayRunOptions(args) {
23101
23296
  const forceToolRefresh = args.includes("--force-tool-refresh");
23102
23297
  const open2 = args.includes("--open");
23103
23298
  const debugMapLatency = args.includes("--debug-map-latency");
23104
- const debugFixtureProviderPacing = args.includes(
23105
- "--debug-fixture-provider-pacing"
23106
- );
23107
23299
  const verboseLogs = args.includes("--logs") || debugMapLatency;
23108
23300
  let waitTimeoutMs = null;
23109
23301
  let maxConcurrentExternalCalls = null;
@@ -23307,7 +23499,6 @@ function parsePlayRunOptions(args) {
23307
23499
  open: open2,
23308
23500
  profile,
23309
23501
  debugMapLatency,
23310
- debugFixtureProviderPacing,
23311
23502
  fixtureBehavior,
23312
23503
  runIdFile
23313
23504
  };
@@ -23473,7 +23664,7 @@ function formatPlayRuntimeLimit(runtimeLimit) {
23473
23664
  function isRecord10(value) {
23474
23665
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
23475
23666
  }
23476
- function stringValue2(value) {
23667
+ function stringValue3(value) {
23477
23668
  return typeof value === "string" ? value.trim() : "";
23478
23669
  }
23479
23670
  function asArray(value) {
@@ -23493,11 +23684,11 @@ function firstRawPath(entry) {
23493
23684
  ...asArray(details.raw_tool_output_paths),
23494
23685
  ...asArray(details.candidatePaths),
23495
23686
  ...asArray(details.candidate_paths)
23496
- ].map(stringValue2).filter(Boolean);
23687
+ ].map(stringValue3).filter(Boolean);
23497
23688
  return paths[0];
23498
23689
  }
23499
23690
  function checkHintExpression(value) {
23500
- return stringValue2(value).replace(/^toolExecutionResult\./, "result.");
23691
+ return stringValue3(value).replace(/^toolExecutionResult\./, "result.");
23501
23692
  }
23502
23693
  function checkHintRawPath(value) {
23503
23694
  return value?.replace(/^toolResponse\./, "result.toolResponse.");
@@ -23512,7 +23703,7 @@ function collectStaticPipelineToolIds(staticPipeline) {
23512
23703
  ]) {
23513
23704
  if (!isRecord10(step)) continue;
23514
23705
  if (step.type === "tool") {
23515
- const toolId = stringValue2(step.toolId) || stringValue2(step.tool);
23706
+ const toolId = stringValue3(step.toolId) || stringValue3(step.tool);
23516
23707
  if (toolId) seen.add(toolId);
23517
23708
  }
23518
23709
  if (step.type === "play_call") {
@@ -23530,14 +23721,14 @@ function toolGetterHintFromMetadata(toolId, tool) {
23530
23721
  const lists = extractionEntries2(
23531
23722
  resultGuidance.extractedLists ?? resultGuidance.extracted_lists
23532
23723
  ).map((entry) => ({
23533
- name: stringValue2(entry.name),
23724
+ name: stringValue3(entry.name),
23534
23725
  expression: checkHintExpression(entry.expression),
23535
23726
  raw: checkHintRawPath(firstRawPath(entry))
23536
23727
  })).filter((entry) => entry.name && entry.expression);
23537
23728
  const values = extractionEntries2(
23538
23729
  resultGuidance.extractedValues ?? resultGuidance.extracted_values
23539
23730
  ).map((entry) => ({
23540
- name: stringValue2(entry.name),
23731
+ name: stringValue3(entry.name),
23541
23732
  expression: checkHintExpression(entry.expression),
23542
23733
  raw: checkHintRawPath(firstRawPath(entry))
23543
23734
  })).filter((entry) => entry.name && entry.expression);
@@ -24098,14 +24289,8 @@ async function handleFileBackedRun(options, hooks) {
24098
24289
  "--fixture-behavior requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24099
24290
  );
24100
24291
  }
24101
- if (options.debugFixtureProviderPacing && integrationMode !== "fixture") {
24102
- throw new Error(
24103
- "--debug-fixture-provider-pacing requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24104
- );
24105
- }
24106
24292
  const testPolicyOverrides = {
24107
- ...options.debugMapLatency ? { mapLatencyProfile: true } : {},
24108
- ...options.debugFixtureProviderPacing ? { enforceFixtureProviderPacing: true } : {}
24293
+ ...options.debugMapLatency ? { mapLatencyProfile: true } : {}
24109
24294
  };
24110
24295
  const startRequest = {
24111
24296
  name: playName,
@@ -24287,14 +24472,8 @@ async function handleNamedRun(options, hooks) {
24287
24472
  "--fixture-behavior requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24288
24473
  );
24289
24474
  }
24290
- if (options.debugFixtureProviderPacing && integrationMode !== "fixture") {
24291
- throw new Error(
24292
- "--debug-fixture-provider-pacing requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24293
- );
24294
- }
24295
24475
  const testPolicyOverrides = {
24296
- ...options.debugMapLatency ? { mapLatencyProfile: true } : {},
24297
- ...options.debugFixtureProviderPacing ? { enforceFixtureProviderPacing: true } : {}
24476
+ ...options.debugMapLatency ? { mapLatencyProfile: true } : {}
24298
24477
  };
24299
24478
  const startRequest = {
24300
24479
  name: playName,
@@ -26179,9 +26358,6 @@ Examples:
26179
26358
  ).option("--open", "Open the play page in a browser after the run starts").option(
26180
26359
  "--debug-map-latency",
26181
26360
  "Internal diagnostics: emit one aggregate latency profile per dataset map"
26182
- ).option(
26183
- "--debug-fixture-provider-pacing",
26184
- "Internal diagnostics: retain provider pacing while fixture mode is active"
26185
26361
  ).option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
26186
26362
  "afterAll",
26187
26363
  `
@@ -26228,7 +26404,6 @@ Pass-through input flags:
26228
26404
  ...options.maxConcurrentRows ? ["--max-concurrent-rows", options.maxConcurrentRows] : [],
26229
26405
  ...options.open ? ["--open"] : [],
26230
26406
  ...options.debugMapLatency ? ["--debug-map-latency"] : [],
26231
- ...options.debugFixtureProviderPacing ? ["--debug-fixture-provider-pacing"] : [],
26232
26407
  ...options.json ? ["--json"] : [],
26233
26408
  ...options.full ? ["--full"] : [],
26234
26409
  ...passthroughArgs
@@ -28650,7 +28825,7 @@ function emitEnrichDebug(message) {
28650
28825
  );
28651
28826
  }
28652
28827
  function sleep6(ms) {
28653
- return new Promise((resolve19) => setTimeout(resolve19, ms));
28828
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
28654
28829
  }
28655
28830
  function enrichExportBackingRowsWaitMs() {
28656
28831
  const raw = process.env.DEEPLINE_ENRICH_EXPORT_BACKING_ROWS_WAIT_MS?.trim();
@@ -35083,7 +35258,7 @@ async function readHiddenLine(prompt, streams = {}) {
35083
35258
  }
35084
35259
  let value = "";
35085
35260
  inputStream.resume();
35086
- return await new Promise((resolve19, reject) => {
35261
+ return await new Promise((resolve20, reject) => {
35087
35262
  let settled = false;
35088
35263
  const cleanup = () => {
35089
35264
  inputStream.off("data", onData);
@@ -35101,7 +35276,7 @@ async function readHiddenLine(prompt, streams = {}) {
35101
35276
  settled = true;
35102
35277
  outputStream.write("\n");
35103
35278
  cleanup();
35104
- resolve19(line);
35279
+ resolve20(line);
35105
35280
  };
35106
35281
  const fail = (error) => {
35107
35282
  if (settled) return;
@@ -35273,15 +35448,137 @@ Examples:
35273
35448
 
35274
35449
  // src/cli/commands/setup.ts
35275
35450
  var import_node_child_process4 = require("child_process");
35276
- var import_node_fs17 = require("fs");
35451
+ var import_node_fs18 = require("fs");
35277
35452
  var import_node_os12 = require("os");
35278
- var import_node_path19 = require("path");
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
+ }
35279
35576
 
35280
35577
  // src/cli/commands/skills.ts
35281
35578
  var import_node_child_process3 = require("child_process");
35282
- var import_node_fs16 = require("fs");
35579
+ var import_node_fs17 = require("fs");
35283
35580
  var import_node_os11 = require("os");
35284
- var import_node_path18 = require("path");
35581
+ var import_node_path19 = require("path");
35285
35582
 
35286
35583
  // ../../shared_libs/cli/install-commands.json
35287
35584
  var install_commands_default = {
@@ -35385,8 +35682,8 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
35385
35682
 
35386
35683
  // src/cli/skills-sync.ts
35387
35684
  var import_node_child_process2 = require("child_process");
35388
- var import_node_fs15 = require("fs");
35389
- var import_node_path17 = require("path");
35685
+ var import_node_fs16 = require("fs");
35686
+ var import_node_path18 = require("path");
35390
35687
 
35391
35688
  // src/cli/windows-arg-escape.ts
35392
35689
  var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
@@ -35421,10 +35718,10 @@ function shouldSkipSkillsSync() {
35421
35718
  return value === "1" || value === "true" || value === "yes" || value === "on";
35422
35719
  }
35423
35720
  function unavailableSkillsNoticePath(baseUrl) {
35424
- return (0, import_node_path17.join)(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
35721
+ return (0, import_node_path18.join)(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
35425
35722
  }
35426
35723
  function failedSkillsSyncPath(baseUrl, agents) {
35427
- return (0, import_node_path17.join)(
35724
+ return (0, import_node_path18.join)(
35428
35725
  sdkCliStateDirPath(baseUrl),
35429
35726
  `skills-sync-failed-${agents.join("-")}-version`
35430
35727
  );
@@ -35434,15 +35731,15 @@ function hasMarkedSkillsSyncVersion(path, version) {
35434
35731
  }
35435
35732
  function readMarkedSkillsSyncVersion(path) {
35436
35733
  try {
35437
- return (0, import_node_fs15.existsSync)(path) ? (0, import_node_fs15.readFileSync)(path, "utf-8").trim() : "";
35734
+ return (0, import_node_fs16.existsSync)(path) ? (0, import_node_fs16.readFileSync)(path, "utf-8").trim() : "";
35438
35735
  } catch {
35439
35736
  return "";
35440
35737
  }
35441
35738
  }
35442
35739
  function writeMarkedSkillsSyncVersion(path, version) {
35443
35740
  try {
35444
- (0, import_node_fs15.mkdirSync)((0, import_node_path17.dirname)(path), { recursive: true });
35445
- (0, import_node_fs15.writeFileSync)(path, `${version}
35741
+ (0, import_node_fs16.mkdirSync)((0, import_node_path18.dirname)(path), { recursive: true });
35742
+ (0, import_node_fs16.writeFileSync)(path, `${version}
35446
35743
  `, "utf-8");
35447
35744
  } catch {
35448
35745
  }
@@ -35459,7 +35756,7 @@ ${manualCommand}`
35459
35756
  }
35460
35757
  function clearUnavailableSkillsNotice(baseUrl) {
35461
35758
  try {
35462
- (0, import_node_fs15.unlinkSync)(unavailableSkillsNoticePath(baseUrl));
35759
+ (0, import_node_fs16.unlinkSync)(unavailableSkillsNoticePath(baseUrl));
35463
35760
  } catch {
35464
35761
  }
35465
35762
  }
@@ -35470,7 +35767,7 @@ function hasFailedSkillsSync(baseUrl, remoteVersion, agents) {
35470
35767
  );
35471
35768
  }
35472
35769
  function hasFailedAutomaticSkillsSync(baseUrl, agents) {
35473
- return (0, import_node_fs15.existsSync)(failedSkillsSyncPath(baseUrl, agents));
35770
+ return (0, import_node_fs16.existsSync)(failedSkillsSyncPath(baseUrl, agents));
35474
35771
  }
35475
35772
  function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
35476
35773
  writeMarkedSkillsSyncVersion(
@@ -35480,7 +35777,7 @@ function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
35480
35777
  }
35481
35778
  function clearFailedSkillsSync(baseUrl, agents) {
35482
35779
  try {
35483
- (0, import_node_fs15.unlinkSync)(failedSkillsSyncPath(baseUrl, agents));
35780
+ (0, import_node_fs16.unlinkSync)(failedSkillsSyncPath(baseUrl, agents));
35484
35781
  } catch {
35485
35782
  }
35486
35783
  }
@@ -35595,7 +35892,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
35595
35892
  return commands;
35596
35893
  }
35597
35894
  function runOneSkillsInstall(install) {
35598
- return new Promise((resolve19) => {
35895
+ return new Promise((resolve20) => {
35599
35896
  const plan = resolveSkillsInstallSpawn(install);
35600
35897
  const child = (0, import_node_child_process2.spawn)(plan.command, plan.args, {
35601
35898
  stdio: ["ignore", "ignore", "pipe"],
@@ -35607,7 +35904,7 @@ function runOneSkillsInstall(install) {
35607
35904
  stderr += chunk.toString("utf-8");
35608
35905
  });
35609
35906
  child.on("error", (error) => {
35610
- resolve19({
35907
+ resolve20({
35611
35908
  ok: false,
35612
35909
  detail: `failed to start ${install.command}: ${error.message}`,
35613
35910
  manualCommand: install.manualCommand
@@ -35615,11 +35912,11 @@ function runOneSkillsInstall(install) {
35615
35912
  });
35616
35913
  child.on("close", (code) => {
35617
35914
  if (code === 0) {
35618
- resolve19({ ok: true, detail: "", manualCommand: install.manualCommand });
35915
+ resolve20({ ok: true, detail: "", manualCommand: install.manualCommand });
35619
35916
  return;
35620
35917
  }
35621
35918
  const detail = stderr.trim();
35622
- resolve19({
35919
+ resolve20({
35623
35920
  ok: false,
35624
35921
  detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
35625
35922
  manualCommand: install.manualCommand
@@ -35821,13 +36118,13 @@ function detectSkillsAgents(input2) {
35821
36118
  ];
35822
36119
  const detected = AGENT_MARKERS.filter(
35823
36120
  (marker) => roots.some(
35824
- (root) => marker.paths.some((path) => (0, import_node_fs16.existsSync)((0, import_node_path18.join)(root, path)))
36121
+ (root) => marker.paths.some((path) => (0, import_node_fs17.existsSync)((0, import_node_path19.join)(root, path)))
35825
36122
  )
35826
36123
  ).map((marker) => marker.agent);
35827
36124
  return detected.length > 0 ? detected : ["*"];
35828
36125
  }
35829
36126
  function skillsStatePathForScope(baseUrl, scope, root) {
35830
- return scope === "local" && root ? (0, import_node_path18.join)(root, ".deepline", "setup", "skills.json") : (0, import_node_path18.join)(sdkCliStateDirPath(baseUrl), "skills-install.json");
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");
35831
36128
  }
35832
36129
  function buildSkillsPlan(input2) {
35833
36130
  const scopeArgs = input2.scope === "global" ? ["--global"] : [];
@@ -35894,14 +36191,14 @@ function isSkillsPlanCurrent(plan, state) {
35894
36191
  }
35895
36192
  function readSkillsInstallState(path) {
35896
36193
  try {
35897
- const parsed = JSON.parse((0, import_node_fs16.readFileSync)(path, "utf8"));
36194
+ const parsed = JSON.parse((0, import_node_fs17.readFileSync)(path, "utf8"));
35898
36195
  return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
35899
36196
  } catch {
35900
36197
  return null;
35901
36198
  }
35902
36199
  }
35903
36200
  function runProcess(command, args, cwd) {
35904
- return new Promise((resolve19, reject) => {
36201
+ return new Promise((resolve20, reject) => {
35905
36202
  const plan = resolveShellSpawn(command, args);
35906
36203
  const child = (0, import_node_child_process3.spawn)(plan.command, plan.args, {
35907
36204
  cwd,
@@ -35920,7 +36217,7 @@ function runProcess(command, args, cwd) {
35920
36217
  process.stderr.write(`${SKILLS_NPX_PACKAGE} exited ${code}.
35921
36218
  `);
35922
36219
  }
35923
- resolve19(code ?? 1);
36220
+ resolve20(code ?? 1);
35924
36221
  });
35925
36222
  });
35926
36223
  }
@@ -36038,8 +36335,8 @@ async function runSkillsCommand(options, dependencies = {}) {
36038
36335
  );
36039
36336
  return 5;
36040
36337
  }
36041
- (0, import_node_fs16.mkdirSync)((0, import_node_path18.dirname)(plan.statePath), { recursive: true });
36042
- (0, import_node_fs16.writeFileSync)(
36338
+ (0, import_node_fs17.mkdirSync)((0, import_node_path19.dirname)(plan.statePath), { recursive: true });
36339
+ (0, import_node_fs17.writeFileSync)(
36043
36340
  plan.statePath,
36044
36341
  `${JSON.stringify(
36045
36342
  {
@@ -36176,7 +36473,7 @@ function phasesFromLegacyStatus(status) {
36176
36473
  function readSetupState(input2) {
36177
36474
  try {
36178
36475
  const parsed = JSON.parse(
36179
- (0, import_node_fs17.readFileSync)(
36476
+ (0, import_node_fs18.readFileSync)(
36180
36477
  setupStatePath(input2.baseUrl, input2.scope, input2.root),
36181
36478
  "utf8"
36182
36479
  )
@@ -36252,7 +36549,7 @@ function buildPendingAuthorizationOutput(input2) {
36252
36549
  };
36253
36550
  }
36254
36551
  function setupStatePath(baseUrl, scope, root) {
36255
- return scope === "local" && root ? (0, import_node_path19.join)(root, ".deepline", "setup", "state.json") : (0, import_node_path19.join)(sdkCliStateDirPath(baseUrl), "setup.json");
36552
+ return scope === "local" && root ? (0, import_node_path20.join)(root, ".deepline", "setup", "state.json") : (0, import_node_path20.join)(sdkCliStateDirPath(baseUrl), "setup.json");
36256
36553
  }
36257
36554
  async function captureStdout2(run) {
36258
36555
  let stdout = "";
@@ -36281,57 +36578,16 @@ function asRecord3(value) {
36281
36578
  }
36282
36579
  function safeRead(path) {
36283
36580
  try {
36284
- return (0, import_node_fs17.readFileSync)(path, "utf8");
36581
+ return (0, import_node_fs18.readFileSync)(path, "utf8");
36285
36582
  } catch {
36286
36583
  return "";
36287
36584
  }
36288
36585
  }
36289
- function isNpmManagedDeeplinePath(path) {
36290
- try {
36291
- return (0, import_node_fs17.realpathSync)(path).includes(`${(0, import_node_path19.join)("node_modules", "deepline")}`);
36292
- } catch {
36293
- return false;
36294
- }
36295
- }
36296
- function isInstallerManagedLegacyLauncher(path) {
36297
- const content = safeRead(path);
36298
- return content.includes("DEEPLINE_REAL_BINARY") && content.includes("DEEPLINE_ACTIVE_FILE");
36299
- }
36300
36586
  function removeKnownLegacyPaths(baseUrl) {
36301
- const home = (0, import_node_os12.homedir)();
36302
- const hostDir = (0, import_node_path19.join)(home, ".local", "deepline", baseUrlSlug(baseUrl));
36303
- const legacyLauncherPath = (0, import_node_path19.join)(home, ".local", "bin", "deepline");
36304
- const installerCommandPath = safeRead(
36305
- (0, import_node_path19.join)(hostDir, "sdk", ".command-path")
36306
- ).trim();
36307
- const relativeInstallerCommandPath = installerCommandPath ? (0, import_node_path19.relative)((0, import_node_path19.resolve)(hostDir), (0, import_node_path19.resolve)(installerCommandPath)) : "";
36308
- const isOwnedInstallerCommand = Boolean(installerCommandPath) && relativeInstallerCommandPath !== "" && !relativeInstallerCommandPath.startsWith(
36309
- `..${process.platform === "win32" ? "\\" : "/"}`
36310
- ) && relativeInstallerCommandPath !== ".." && (0, import_node_path19.basename)(installerCommandPath) === "deepline";
36311
- const candidates = [
36312
- ...isInstallerManagedLegacyLauncher(legacyLauncherPath) ? [legacyLauncherPath] : [],
36313
- (0, import_node_path19.join)(home, ".local", "bin", "deepline-real"),
36314
- (0, import_node_path19.join)(hostDir, "bin", "deepline"),
36315
- (0, import_node_path19.join)(hostDir, "bin", "deepline-real"),
36316
- (0, import_node_path19.join)(hostDir, "cli", ".install-method"),
36317
- (0, import_node_path19.join)(hostDir, "cli", ".version"),
36318
- (0, import_node_path19.join)(hostDir, "sdk", ".install-method"),
36319
- (0, import_node_path19.join)(hostDir, "sdk", ".command-path"),
36320
- ...isOwnedInstallerCommand ? [
36321
- installerCommandPath,
36322
- (0, import_node_path19.join)((0, import_node_path19.dirname)(installerCommandPath), "deepline-sdk")
36323
- ] : []
36324
- ];
36325
- const removed = [];
36326
- for (const path of candidates) {
36327
- if (!(0, import_node_fs17.existsSync)(path)) continue;
36328
- if (path === installerCommandPath && isNpmManagedDeeplinePath(path)) {
36329
- continue;
36330
- }
36331
- (0, import_node_fs17.rmSync)(path, { force: true });
36332
- removed.push(path);
36333
- }
36334
- return removed;
36587
+ return CliInstallation.forUser({
36588
+ baseUrlSlug: baseUrlSlug(baseUrl),
36589
+ home: (0, import_node_os12.homedir)()
36590
+ }).removeRetiredArtifacts();
36335
36591
  }
36336
36592
  function resolvePathCommands(command) {
36337
36593
  const lookup = (0, import_node_child_process4.spawnSync)(
@@ -36341,7 +36597,7 @@ function resolvePathCommands(command) {
36341
36597
  );
36342
36598
  return [
36343
36599
  ...new Set(
36344
- String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) => (0, import_node_path19.resolve)(path))
36600
+ String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) => (0, import_node_path20.resolve)(path))
36345
36601
  )
36346
36602
  ];
36347
36603
  }
@@ -36351,7 +36607,7 @@ function resolvePathCommand(command) {
36351
36607
  function isHomebrewFormulaCommand(path) {
36352
36608
  let resolvedPath = path;
36353
36609
  try {
36354
- resolvedPath = (0, import_node_fs17.realpathSync)(path);
36610
+ resolvedPath = (0, import_node_fs18.realpathSync)(path);
36355
36611
  } catch {
36356
36612
  return false;
36357
36613
  }
@@ -36362,7 +36618,7 @@ function isHomebrewFormulaCommand(path) {
36362
36618
  function resolvePersistentGlobalCommand(dependencies = {}) {
36363
36619
  const platform3 = dependencies.platform ?? process.platform;
36364
36620
  const run = dependencies.spawn ?? import_node_child_process4.spawnSync;
36365
- const pathExists = dependencies.exists ?? import_node_fs17.existsSync;
36621
+ const pathExists = dependencies.exists ?? import_node_fs18.existsSync;
36366
36622
  const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
36367
36623
  const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
36368
36624
  if (homebrewCommand) return homebrewCommand;
@@ -36374,7 +36630,7 @@ function resolvePersistentGlobalCommand(dependencies = {}) {
36374
36630
  if (prefix.status !== 0) return null;
36375
36631
  const root = String(prefix.stdout ?? "").trim();
36376
36632
  if (!root) return null;
36377
- const candidates = platform3 === "win32" ? [(0, import_node_path19.join)(root, "deepline.cmd"), (0, import_node_path19.join)(root, "deepline")] : [(0, import_node_path19.join)(root, "bin", "deepline")];
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")];
36378
36634
  return candidates.find((candidate) => pathExists(candidate)) ?? null;
36379
36635
  }
36380
36636
  function inspectGlobalCliAvailability(input2) {
@@ -36387,20 +36643,20 @@ function inspectGlobalCliAvailability(input2) {
36387
36643
  }
36388
36644
  function pathsResolveToSameFile(left, right) {
36389
36645
  try {
36390
- return (0, import_node_fs17.realpathSync)(left) === (0, import_node_fs17.realpathSync)(right);
36646
+ return (0, import_node_fs18.realpathSync)(left) === (0, import_node_fs18.realpathSync)(right);
36391
36647
  } catch {
36392
- return (0, import_node_path19.resolve)(left) === (0, import_node_path19.resolve)(right);
36648
+ return (0, import_node_path20.resolve)(left) === (0, import_node_path20.resolve)(right);
36393
36649
  }
36394
36650
  }
36395
36651
  function isKnownDeeplineCommand(path) {
36396
- const entrypoint = process.argv[1] ? (0, import_node_path19.resolve)(process.argv[1]) : "";
36652
+ const entrypoint = process.argv[1] ? (0, import_node_path20.resolve)(process.argv[1]) : "";
36397
36653
  let resolvedPath = path;
36398
36654
  try {
36399
- resolvedPath = (0, import_node_fs17.realpathSync)(path);
36655
+ resolvedPath = (0, import_node_fs18.realpathSync)(path);
36400
36656
  } catch {
36401
36657
  }
36402
36658
  if (entrypoint && resolvedPath === entrypoint) return true;
36403
- if (resolvedPath.includes(`${(0, import_node_path19.join)("node_modules", "deepline")}`)) return true;
36659
+ if (resolvedPath.includes(`${(0, import_node_path20.join)("node_modules", "deepline")}`)) return true;
36404
36660
  const content = safeRead(path);
36405
36661
  return content.includes("node_modules/deepline") || content.includes("node_modules\\deepline") || content.includes("DEEPLINE_CONFIG_SCOPE") || content.includes("deepline-real");
36406
36662
  }
@@ -36408,9 +36664,9 @@ function inspectPathConflict() {
36408
36664
  const commandPath = resolvePathCommand("deepline");
36409
36665
  if (!commandPath || isKnownDeeplineCommand(commandPath)) return null;
36410
36666
  try {
36411
- if ((0, import_node_fs17.lstatSync)(commandPath).isSymbolicLink()) {
36412
- const target = (0, import_node_fs17.realpathSync)(commandPath);
36413
- if (target.includes(`${(0, import_node_path19.join)("node_modules", "deepline")}`)) return null;
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;
36414
36670
  }
36415
36671
  } catch {
36416
36672
  }
@@ -36418,8 +36674,8 @@ function inspectPathConflict() {
36418
36674
  }
36419
36675
  function writeSetupState(input2) {
36420
36676
  const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
36421
- (0, import_node_fs17.mkdirSync)((0, import_node_path19.dirname)(path), { recursive: true });
36422
- (0, import_node_fs17.writeFileSync)(
36677
+ (0, import_node_fs18.mkdirSync)((0, import_node_path20.dirname)(path), { recursive: true });
36678
+ (0, import_node_fs18.writeFileSync)(
36423
36679
  path,
36424
36680
  `${JSON.stringify(
36425
36681
  {
@@ -36459,7 +36715,7 @@ function failSetupPhase(phases, phase, code) {
36459
36715
  phases[phase] = { status: "failed", code };
36460
36716
  }
36461
36717
  function rollbackCommand(scope, root) {
36462
- const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify((0, import_node_path19.join)(root, ".deepline", "runtime"))}` : "";
36718
+ const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify((0, import_node_path20.join)(root, ".deepline", "runtime"))}` : "";
36463
36719
  return `npm install -g${prefix} --no-audit --no-fund --include=optional --allow-scripts=esbuild deepline@${SDK_VERSION}`;
36464
36720
  }
36465
36721
  function setupResumeCommand(baseUrl, scope) {
@@ -36546,12 +36802,12 @@ function buildDoctorAssessment(input2) {
36546
36802
  const connected = input2.authStatus.payload?.connected === true;
36547
36803
  const authScopeOk = input2.scope === "local" ? Boolean(projectAuth) : Boolean(apiKey && !projectAuth);
36548
36804
  const skillsOk = skillsState?.scope === input2.scope && typeof skillsState.skillsVersion === "string" && Array.isArray(skillsState.agents) && skillsState.agents.length > 0;
36549
- const runningCliPath = process.argv[1] ? (0, import_node_path19.resolve)(process.argv[1]) : null;
36805
+ const runningCliPath = process.argv[1] ? (0, import_node_path20.resolve)(process.argv[1]) : null;
36550
36806
  const globalCli = input2.scope === "global" ? inspectGlobalCliAvailability() : null;
36551
36807
  const pathGlobalCli = globalCli?.path ?? null;
36552
36808
  const cliPath = input2.scope === "global" ? pathGlobalCli : runningCliPath;
36553
36809
  const cliScopeOk = input2.scope === "global" ? Boolean(pathGlobalCli) : Boolean(
36554
- input2.root && runningCliPath?.includes((0, import_node_path19.join)(input2.root, ".deepline", "runtime"))
36810
+ input2.root && runningCliPath?.includes((0, import_node_path20.join)(input2.root, ".deepline", "runtime"))
36555
36811
  );
36556
36812
  const checks = {
36557
36813
  cli: {
@@ -37078,9 +37334,9 @@ Examples:
37078
37334
  }
37079
37335
 
37080
37336
  // src/cli/update-preferences.ts
37081
- var import_node_fs18 = require("fs");
37337
+ var import_node_fs19 = require("fs");
37082
37338
  var import_node_os13 = require("os");
37083
- var import_node_path20 = require("path");
37339
+ var import_node_path21 = require("path");
37084
37340
  var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
37085
37341
  var CLI_UPDATE_MESSAGES = [
37086
37342
  {
@@ -37109,7 +37365,7 @@ function unreadablePreferences(path, error) {
37109
37365
  };
37110
37366
  }
37111
37367
  function cliUpdatePreferencesPath(homeDir2 = (0, import_node_os13.homedir)()) {
37112
- return (0, import_node_path20.join)(
37368
+ return (0, import_node_path21.join)(
37113
37369
  homeDir2,
37114
37370
  ".local",
37115
37371
  "deepline",
@@ -37119,9 +37375,9 @@ function cliUpdatePreferencesPath(homeDir2 = (0, import_node_os13.homedir)()) {
37119
37375
  }
37120
37376
  function readCliUpdatePreferences(homeDir2 = (0, import_node_os13.homedir)()) {
37121
37377
  const path = cliUpdatePreferencesPath(homeDir2);
37122
- if (!(0, import_node_fs18.existsSync)(path)) return defaultPreferences();
37378
+ if (!(0, import_node_fs19.existsSync)(path)) return defaultPreferences();
37123
37379
  try {
37124
- const parsed = JSON.parse((0, import_node_fs18.readFileSync)(path, "utf8"));
37380
+ const parsed = JSON.parse((0, import_node_fs19.readFileSync)(path, "utf8"));
37125
37381
  return {
37126
37382
  schemaVersion: UPDATE_PREFERENCES_SCHEMA_VERSION,
37127
37383
  autoUpdateEnabled: typeof parsed.autoUpdateEnabled === "boolean" ? parsed.autoUpdateEnabled : true,
@@ -37137,16 +37393,16 @@ function readCliUpdatePreferences(homeDir2 = (0, import_node_os13.homedir)()) {
37137
37393
  function writeCliUpdatePreferences(preferences, homeDir2 = (0, import_node_os13.homedir)()) {
37138
37394
  const path = cliUpdatePreferencesPath(homeDir2);
37139
37395
  const tempPath = `${path}.${process.pid}.tmp`;
37140
- (0, import_node_fs18.mkdirSync)((0, import_node_path20.dirname)(path), { recursive: true });
37396
+ (0, import_node_fs19.mkdirSync)((0, import_node_path21.dirname)(path), { recursive: true });
37141
37397
  try {
37142
- (0, import_node_fs18.writeFileSync)(tempPath, `${JSON.stringify(preferences, null, 2)}
37398
+ (0, import_node_fs19.writeFileSync)(tempPath, `${JSON.stringify(preferences, null, 2)}
37143
37399
  `, {
37144
37400
  encoding: "utf8",
37145
37401
  mode: 384
37146
37402
  });
37147
- (0, import_node_fs18.renameSync)(tempPath, path);
37403
+ (0, import_node_fs19.renameSync)(tempPath, path);
37148
37404
  } finally {
37149
- (0, import_node_fs18.rmSync)(tempPath, { force: true });
37405
+ (0, import_node_fs19.rmSync)(tempPath, { force: true });
37150
37406
  }
37151
37407
  }
37152
37408
  function setCliAutoUpdateEnabled(enabled, homeDir2 = (0, import_node_os13.homedir)()) {
@@ -37196,14 +37452,14 @@ function consumePendingCliUpdateMessages(homeDir2 = (0, import_node_os13.homedir
37196
37452
 
37197
37453
  // src/cli/commands/update.ts
37198
37454
  var import_node_child_process5 = require("child_process");
37199
- var import_node_fs20 = require("fs");
37455
+ var import_node_fs21 = require("fs");
37200
37456
  var import_node_os14 = require("os");
37201
- var import_node_path22 = require("path");
37457
+ var import_node_path23 = require("path");
37202
37458
 
37203
37459
  // src/cli/install-integrity.ts
37204
37460
  var import_node_module2 = require("module");
37205
- var import_node_fs19 = require("fs");
37206
- var import_node_path21 = require("path");
37461
+ var import_node_fs20 = require("fs");
37462
+ var import_node_path22 = require("path");
37207
37463
  var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
37208
37464
  "dist/cli/index.mjs",
37209
37465
  "dist/index.mjs",
@@ -37220,7 +37476,7 @@ var SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES = [
37220
37476
  "esbuild/lib/main.js"
37221
37477
  ];
37222
37478
  function safeRelativePath(value) {
37223
- if (typeof value !== "string" || !value || (0, import_node_path21.isAbsolute)(value)) return false;
37479
+ if (typeof value !== "string" || !value || (0, import_node_path22.isAbsolute)(value)) return false;
37224
37480
  const segments = value.split(/[\\/]+/);
37225
37481
  return segments.every(
37226
37482
  (segment) => Boolean(segment) && segment !== "." && segment !== ".."
@@ -37228,25 +37484,25 @@ function safeRelativePath(value) {
37228
37484
  }
37229
37485
  function resolveContainedPath(root, value) {
37230
37486
  if (!safeRelativePath(value)) return null;
37231
- const target = (0, import_node_path21.resolve)(root, value);
37232
- const relativeTarget = (0, import_node_path21.relative)((0, import_node_path21.resolve)(root), target);
37233
- if (!relativeTarget || relativeTarget.startsWith("..") || (0, import_node_path21.isAbsolute)(relativeTarget)) {
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)) {
37234
37490
  return null;
37235
37491
  }
37236
37492
  return target;
37237
37493
  }
37238
37494
  function parseJson(path) {
37239
- return JSON.parse((0, import_node_fs19.readFileSync)(path, "utf8"));
37495
+ return JSON.parse((0, import_node_fs20.readFileSync)(path, "utf8"));
37240
37496
  }
37241
37497
  function isFile(path) {
37242
37498
  try {
37243
- return (0, import_node_fs19.statSync)(path).isFile();
37499
+ return (0, import_node_fs20.statSync)(path).isFile();
37244
37500
  } catch {
37245
37501
  return false;
37246
37502
  }
37247
37503
  }
37248
37504
  function readManifest(packageRoot) {
37249
- const packageJsonPath = (0, import_node_path21.join)(packageRoot, "package.json");
37505
+ const packageJsonPath = (0, import_node_path22.join)(packageRoot, "package.json");
37250
37506
  let packageJson;
37251
37507
  try {
37252
37508
  packageJson = parseJson(packageJsonPath);
@@ -37254,7 +37510,7 @@ function readManifest(packageRoot) {
37254
37510
  return {
37255
37511
  mode: "manifest",
37256
37512
  invalidReason: `invalid Deepline package metadata: ${error.message}`,
37257
- missing: (0, import_node_fs19.existsSync)(packageJsonPath) ? [] : ["deepline/package.json"]
37513
+ missing: (0, import_node_fs20.existsSync)(packageJsonPath) ? [] : ["deepline/package.json"]
37258
37514
  };
37259
37515
  }
37260
37516
  if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
@@ -37320,8 +37576,8 @@ function readManifest(packageRoot) {
37320
37576
  return { mode: "manifest", manifest };
37321
37577
  }
37322
37578
  function inspectSdkSidecarInstall(versionDir) {
37323
- const nodeModulesRoot = (0, import_node_path21.join)(versionDir, "node_modules");
37324
- const packageRoot = (0, import_node_path21.join)(nodeModulesRoot, "deepline");
37579
+ const nodeModulesRoot = (0, import_node_path22.join)(versionDir, "node_modules");
37580
+ const packageRoot = (0, import_node_path22.join)(nodeModulesRoot, "deepline");
37325
37581
  const manifestResult = readManifest(packageRoot);
37326
37582
  if ("invalidReason" in manifestResult) {
37327
37583
  return {
@@ -37332,8 +37588,8 @@ function inspectSdkSidecarInstall(versionDir) {
37332
37588
  };
37333
37589
  }
37334
37590
  const missing = [
37335
- ...manifestResult.manifest.packageFiles.filter((path) => !isFile((0, import_node_path21.join)(packageRoot, path))).map((path) => `deepline/${path}`),
37336
- ...manifestResult.manifest.dependencyFiles.filter((path) => !isFile((0, import_node_path21.join)(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
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}`)
37337
37593
  ];
37338
37594
  return {
37339
37595
  ok: missing.length === 0,
@@ -37344,7 +37600,7 @@ function inspectSdkSidecarInstall(versionDir) {
37344
37600
  }
37345
37601
  function probeSdkSidecarEsbuild(versionDir) {
37346
37602
  try {
37347
- const requireFromInstall = (0, import_node_module2.createRequire)((0, import_node_path21.join)(versionDir, "package.json"));
37603
+ const requireFromInstall = (0, import_node_module2.createRequire)((0, import_node_path22.join)(versionDir, "package.json"));
37348
37604
  const esbuild = requireFromInstall("esbuild");
37349
37605
  if (typeof esbuild.transformSync !== "function") {
37350
37606
  return "esbuild does not export transformSync";
@@ -37419,7 +37675,7 @@ function sidecarStateDir(input2) {
37419
37675
  if (!scope || scope.includes("/") || scope.includes("\\")) {
37420
37676
  return null;
37421
37677
  }
37422
- return (0, import_node_path22.join)(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
37678
+ return (0, import_node_path23.join)(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
37423
37679
  }
37424
37680
  function sidecarRegistryUrl(hostUrl) {
37425
37681
  let url;
@@ -37446,7 +37702,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
37446
37702
  }
37447
37703
  function readOptionalText(path) {
37448
37704
  try {
37449
- return (0, import_node_fs20.readFileSync)(path, "utf8").trim();
37705
+ return (0, import_node_fs21.readFileSync)(path, "utf8").trim();
37450
37706
  } catch {
37451
37707
  return "";
37452
37708
  }
@@ -37454,19 +37710,19 @@ function readOptionalText(path) {
37454
37710
  function resolvePythonSidecarUpdatePlan(options) {
37455
37711
  const stateDir = sidecarStateDir(options);
37456
37712
  if (!stateDir) return null;
37457
- const relativeEntrypoint = (0, import_node_path22.relative)(
37458
- (0, import_node_path22.resolve)(stateDir),
37459
- (0, import_node_path22.resolve)(options.entrypoint)
37713
+ const relativeEntrypoint = (0, import_node_path23.relative)(
37714
+ (0, import_node_path23.resolve)(stateDir),
37715
+ (0, import_node_path23.resolve)(options.entrypoint)
37460
37716
  );
37461
- if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || (0, import_node_path22.isAbsolute)(relativeEntrypoint)) {
37717
+ if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || (0, import_node_path23.isAbsolute)(relativeEntrypoint)) {
37462
37718
  return null;
37463
37719
  }
37464
- const installMethod = readOptionalText((0, import_node_path22.join)(stateDir, ".install-method"));
37720
+ const installMethod = readOptionalText((0, import_node_path23.join)(stateDir, ".install-method"));
37465
37721
  if (installMethod !== "python-sidecar") return null;
37466
37722
  const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
37467
37723
  const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
37468
- const nodeBin = readOptionalText((0, import_node_path22.join)(stateDir, ".node-bin")) || process.execPath;
37469
- const sidecarPath = readOptionalText((0, import_node_path22.join)(stateDir, ".command-path")) || (0, import_node_path22.join)(
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)(
37470
37726
  stateDir,
37471
37727
  "bin",
37472
37728
  process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
@@ -37474,7 +37730,7 @@ function resolvePythonSidecarUpdatePlan(options) {
37474
37730
  const packageSpec = options.packageSpec || "deepline@latest";
37475
37731
  const npmCommand = "npm";
37476
37732
  const registryUrl = sidecarRegistryUrl(hostUrl);
37477
- const versionDir = (0, import_node_path22.join)(stateDir, "versions", "<version>");
37733
+ const versionDir = (0, import_node_path23.join)(stateDir, "versions", "<version>");
37478
37734
  const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote4(versionDir)} --registry ${shellQuote4(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote4).join(" ")} ${shellQuote4(packageSpec)}`;
37479
37735
  return {
37480
37736
  kind: "python-sidecar",
@@ -37490,16 +37746,16 @@ function resolvePythonSidecarUpdatePlan(options) {
37490
37746
  };
37491
37747
  }
37492
37748
  function findRepoBackedSdkRoot(startPath) {
37493
- let current = (0, import_node_path22.resolve)(startPath);
37749
+ let current = (0, import_node_path23.resolve)(startPath);
37494
37750
  while (true) {
37495
- if ((0, import_node_fs20.existsSync)((0, import_node_path22.join)(current, "package.json")) && (0, import_node_fs20.existsSync)((0, import_node_path22.join)(current, "bin", "deepline-dev.ts"))) {
37496
- const parent2 = (0, import_node_path22.dirname)(current);
37497
- return (0, import_node_path22.basename)(parent2) === "packages" && (0, import_node_path22.basename)(current) === "sdk" ? (0, import_node_path22.dirname)(parent2) : parent2;
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;
37498
37754
  }
37499
- if ((0, import_node_fs20.existsSync)((0, import_node_path22.join)(current, "sdk", "package.json")) && (0, import_node_fs20.existsSync)((0, import_node_path22.join)(current, "sdk", "bin", "deepline-dev.ts"))) {
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"))) {
37500
37756
  return current;
37501
37757
  }
37502
- const parent = (0, import_node_path22.dirname)(current);
37758
+ const parent = (0, import_node_path23.dirname)(current);
37503
37759
  if (parent === current) return null;
37504
37760
  current = parent;
37505
37761
  }
@@ -37507,9 +37763,9 @@ function findRepoBackedSdkRoot(startPath) {
37507
37763
  function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
37508
37764
  const normalized = (() => {
37509
37765
  try {
37510
- return (0, import_node_fs20.realpathSync)(entrypoint);
37766
+ return (0, import_node_fs21.realpathSync)(entrypoint);
37511
37767
  } catch {
37512
- return (0, import_node_path22.resolve)(entrypoint);
37768
+ return (0, import_node_path23.resolve)(entrypoint);
37513
37769
  }
37514
37770
  })();
37515
37771
  const parts = normalized.split(/[\\/]+/);
@@ -37524,10 +37780,10 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
37524
37780
  const directPrefix = prefixParts.join("/").toLowerCase();
37525
37781
  const knownWindowsPrefixes = [
37526
37782
  env.npm_config_prefix,
37527
- env.APPDATA ? (0, import_node_path22.join)(env.APPDATA, "npm") : void 0
37528
- ].filter((value) => Boolean(value)).map((value) => (0, import_node_path22.resolve)(value).replace(/\\/g, "/").toLowerCase());
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());
37529
37785
  if (!knownWindowsPrefixes.includes(
37530
- (0, import_node_path22.resolve)(directPrefix).replace(/\\/g, "/").toLowerCase()
37786
+ (0, import_node_path23.resolve)(directPrefix).replace(/\\/g, "/").toLowerCase()
37531
37787
  )) {
37532
37788
  return null;
37533
37789
  }
@@ -37540,9 +37796,9 @@ function normalizedNpmPrefix(value) {
37540
37796
  if (!trimmed) return null;
37541
37797
  const normalized = (() => {
37542
37798
  try {
37543
- return (0, import_node_fs20.realpathSync)((0, import_node_path22.resolve)(trimmed));
37799
+ return (0, import_node_fs21.realpathSync)((0, import_node_path23.resolve)(trimmed));
37544
37800
  } catch {
37545
- return (0, import_node_path22.resolve)(trimmed);
37801
+ return (0, import_node_path23.resolve)(trimmed);
37546
37802
  }
37547
37803
  })().replace(/\\/g, "/");
37548
37804
  return process.platform === "win32" ? normalized.toLowerCase() : normalized;
@@ -37565,9 +37821,9 @@ function resolveNpmGlobalPrefix(env) {
37565
37821
  function isHomebrewFormulaEntrypoint(entrypoint) {
37566
37822
  const normalized = (() => {
37567
37823
  try {
37568
- return (0, import_node_fs20.realpathSync)(entrypoint);
37824
+ return (0, import_node_fs21.realpathSync)(entrypoint);
37569
37825
  } catch {
37570
- return (0, import_node_path22.resolve)(entrypoint);
37826
+ return (0, import_node_path23.resolve)(entrypoint);
37571
37827
  }
37572
37828
  })();
37573
37829
  const parts = normalized.split(/[\\/]+/);
@@ -37577,8 +37833,8 @@ function isHomebrewFormulaEntrypoint(entrypoint) {
37577
37833
  function resolveUpdatePlan(options = {}) {
37578
37834
  const env = options.env ?? process.env;
37579
37835
  const homeDir2 = options.homeDir ?? (0, import_node_os14.homedir)();
37580
- const entrypoint = options.entrypoint ?? (process.argv[1] ? (0, import_node_path22.resolve)(process.argv[1]) : "");
37581
- const sourceRoot = entrypoint ? findRepoBackedSdkRoot((0, import_node_path22.dirname)(entrypoint)) : null;
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;
37582
37838
  if (sourceRoot) {
37583
37839
  return {
37584
37840
  kind: "source",
@@ -37629,9 +37885,9 @@ var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
37629
37885
  function autoUpdateFailurePath(plan) {
37630
37886
  if (plan.kind === "source" || plan.kind === "homebrew") return null;
37631
37887
  if (plan.kind === "python-sidecar") {
37632
- return (0, import_node_path22.join)(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
37888
+ return (0, import_node_path23.join)(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
37633
37889
  }
37634
- return (0, import_node_path22.join)(
37890
+ return (0, import_node_path23.join)(
37635
37891
  (0, import_node_os14.homedir)(),
37636
37892
  ".local",
37637
37893
  "deepline",
@@ -37649,7 +37905,7 @@ function readAutoUpdateFailure(plan) {
37649
37905
  if (!path) return null;
37650
37906
  try {
37651
37907
  const parsed = JSON.parse(
37652
- (0, import_node_fs20.readFileSync)(path, "utf8")
37908
+ (0, import_node_fs21.readFileSync)(path, "utf8")
37653
37909
  );
37654
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") {
37655
37911
  return parsed;
@@ -37670,8 +37926,8 @@ function writeAutoUpdateFailure(plan, exitCode) {
37670
37926
  manualCommand: plan.manualCommand
37671
37927
  };
37672
37928
  try {
37673
- (0, import_node_fs20.mkdirSync)((0, import_node_path22.dirname)(path), { recursive: true });
37674
- (0, import_node_fs20.writeFileSync)(path, `${JSON.stringify(marker, null, 2)}
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)}
37675
37931
  `, "utf8");
37676
37932
  } catch {
37677
37933
  }
@@ -37680,7 +37936,7 @@ function clearAutoUpdateFailure(plan) {
37680
37936
  const path = autoUpdateFailurePath(plan);
37681
37937
  if (!path) return;
37682
37938
  try {
37683
- (0, import_node_fs20.unlinkSync)(path);
37939
+ (0, import_node_fs21.unlinkSync)(path);
37684
37940
  } catch {
37685
37941
  }
37686
37942
  }
@@ -37718,7 +37974,7 @@ function safeVersionSegment(value) {
37718
37974
  return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
37719
37975
  }
37720
37976
  function entryPathInVersionDir(versionDir) {
37721
- return (0, import_node_path22.join)(
37977
+ return (0, import_node_path23.join)(
37722
37978
  versionDir,
37723
37979
  "node_modules",
37724
37980
  "deepline",
@@ -37728,14 +37984,14 @@ function entryPathInVersionDir(versionDir) {
37728
37984
  );
37729
37985
  }
37730
37986
  function installedPackageVersion(versionDir) {
37731
- const packageJsonPath = (0, import_node_path22.join)(
37987
+ const packageJsonPath = (0, import_node_path23.join)(
37732
37988
  versionDir,
37733
37989
  "node_modules",
37734
37990
  "deepline",
37735
37991
  "package.json"
37736
37992
  );
37737
37993
  try {
37738
- const parsed = JSON.parse((0, import_node_fs20.readFileSync)(packageJsonPath, "utf8"));
37994
+ const parsed = JSON.parse((0, import_node_fs21.readFileSync)(packageJsonPath, "utf8"));
37739
37995
  return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
37740
37996
  } catch {
37741
37997
  return "";
@@ -37850,20 +38106,20 @@ async function runNpmInstallWithRegistryFallback(input2) {
37850
38106
  return first.exitCode;
37851
38107
  }
37852
38108
  function writeSidecarLauncher(input2) {
37853
- (0, import_node_fs20.mkdirSync)((0, import_node_path22.dirname)(input2.path), { recursive: true });
37854
- const packageRoot = (0, import_node_path22.dirname)((0, import_node_path22.dirname)((0, import_node_path22.dirname)(input2.entryPath)));
37855
- const versionDir = (0, import_node_path22.dirname)((0, import_node_path22.dirname)(packageRoot));
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));
37856
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);";
37857
38113
  const criticalPaths = [
37858
38114
  ...SDK_SIDECAR_CRITICAL_PACKAGE_FILES.map(
37859
- (path) => (0, import_node_path22.join)(packageRoot, path)
38115
+ (path) => (0, import_node_path23.join)(packageRoot, path)
37860
38116
  ),
37861
38117
  ...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES.map(
37862
- (path) => (0, import_node_path22.join)(versionDir, "node_modules", path)
38118
+ (path) => (0, import_node_path23.join)(versionDir, "node_modules", path)
37863
38119
  )
37864
38120
  ];
37865
38121
  if (process.platform === "win32") {
37866
- (0, import_node_fs20.writeFileSync)(
38122
+ (0, import_node_fs21.writeFileSync)(
37867
38123
  input2.path,
37868
38124
  [
37869
38125
  `@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
@@ -37886,7 +38142,7 @@ function writeSidecarLauncher(input2) {
37886
38142
  );
37887
38143
  return;
37888
38144
  }
37889
- (0, import_node_fs20.writeFileSync)(
38145
+ (0, import_node_fs21.writeFileSync)(
37890
38146
  input2.path,
37891
38147
  [
37892
38148
  "#!/usr/bin/env sh",
@@ -37913,17 +38169,17 @@ function writeSidecarLauncher(input2) {
37913
38169
  );
37914
38170
  }
37915
38171
  async function runPythonSidecarUpdatePlan(plan) {
37916
- const versionsDir = (0, import_node_path22.join)(plan.stateDir, "versions");
37917
- const tempDir = (0, import_node_path22.join)(
38172
+ const versionsDir = (0, import_node_path23.join)(plan.stateDir, "versions");
38173
+ const tempDir = (0, import_node_path23.join)(
37918
38174
  versionsDir,
37919
38175
  `.tmp-sdk-update-${process.pid}-${Date.now()}`
37920
38176
  );
37921
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
37922
- (0, import_node_fs20.mkdirSync)(tempDir, { recursive: true });
37923
- (0, import_node_fs20.writeFileSync)((0, import_node_path22.join)(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
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);
37924
38180
  const env = {
37925
38181
  ...process.env,
37926
- PATH: `${(0, import_node_path22.dirname)(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
38182
+ PATH: `${(0, import_node_path23.dirname)(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
37927
38183
  };
37928
38184
  const installResult = await runCommand(
37929
38185
  plan.npmCommand,
@@ -37940,7 +38196,7 @@ async function runPythonSidecarUpdatePlan(plan) {
37940
38196
  );
37941
38197
  const installExitCode = installResult.exitCode;
37942
38198
  if (installExitCode !== 0) {
37943
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
38199
+ (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37944
38200
  return installExitCode;
37945
38201
  }
37946
38202
  const installedVersion = installedPackageVersion(tempDir);
@@ -37948,7 +38204,7 @@ async function runPythonSidecarUpdatePlan(plan) {
37948
38204
  process.stderr.write(
37949
38205
  "Updated Deepline SDK package did not report a version.\n"
37950
38206
  );
37951
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
38207
+ (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37952
38208
  return 1;
37953
38209
  }
37954
38210
  const stagedFailure = sidecarInstallFailure(tempDir);
@@ -37957,32 +38213,32 @@ async function runPythonSidecarUpdatePlan(plan) {
37957
38213
  `Updated Deepline SDK package is incomplete: ${stagedFailure}.
37958
38214
  `
37959
38215
  );
37960
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
38216
+ (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37961
38217
  return 1;
37962
38218
  }
37963
- const finalDir = (0, import_node_path22.join)(versionsDir, installedVersion);
38219
+ const finalDir = (0, import_node_path23.join)(versionsDir, installedVersion);
37964
38220
  const finalEntryPath = entryPathInVersionDir(finalDir);
37965
38221
  const finalFailure = sidecarInstallFailure(finalDir);
37966
38222
  let backupDir = null;
37967
38223
  if (!finalFailure) {
37968
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
38224
+ (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37969
38225
  } else {
37970
38226
  let shouldPublishTemp = true;
37971
- if ((0, import_node_fs20.existsSync)(finalDir)) {
37972
- backupDir = (0, import_node_path22.join)(
38227
+ if ((0, import_node_fs21.existsSync)(finalDir)) {
38228
+ backupDir = (0, import_node_path23.join)(
37973
38229
  versionsDir,
37974
38230
  `.backup-${installedVersion}-${process.pid}-${Date.now()}`
37975
38231
  );
37976
38232
  try {
37977
- (0, import_node_fs20.renameSync)(finalDir, backupDir);
38233
+ (0, import_node_fs21.renameSync)(finalDir, backupDir);
37978
38234
  } catch (error) {
37979
38235
  const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
37980
38236
  if (!concurrentlyPublishedFailure) {
37981
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
38237
+ (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37982
38238
  backupDir = null;
37983
38239
  shouldPublishTemp = false;
37984
38240
  } else {
37985
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
38241
+ (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37986
38242
  process.stderr.write(
37987
38243
  `Failed to preserve the incomplete Deepline SDK sidecar before repair: ${error.message}.
37988
38244
  `
@@ -37993,18 +38249,18 @@ async function runPythonSidecarUpdatePlan(plan) {
37993
38249
  }
37994
38250
  if (shouldPublishTemp) {
37995
38251
  try {
37996
- (0, import_node_fs20.renameSync)(tempDir, finalDir);
38252
+ (0, import_node_fs21.renameSync)(tempDir, finalDir);
37997
38253
  } catch (error) {
37998
- (0, import_node_fs20.rmSync)(tempDir, { recursive: true, force: true });
38254
+ (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37999
38255
  const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
38000
38256
  if (!concurrentlyPublishedFailure) {
38001
- if (backupDir) (0, import_node_fs20.rmSync)(backupDir, { recursive: true, force: true });
38257
+ if (backupDir) (0, import_node_fs21.rmSync)(backupDir, { recursive: true, force: true });
38002
38258
  backupDir = null;
38003
38259
  } else {
38004
38260
  let restoreFailure = "";
38005
- if (backupDir && (0, import_node_fs20.existsSync)(backupDir) && !(0, import_node_fs20.existsSync)(finalDir)) {
38261
+ if (backupDir && (0, import_node_fs21.existsSync)(backupDir) && !(0, import_node_fs21.existsSync)(finalDir)) {
38006
38262
  try {
38007
- (0, import_node_fs20.renameSync)(backupDir, finalDir);
38263
+ (0, import_node_fs21.renameSync)(backupDir, finalDir);
38008
38264
  backupDir = null;
38009
38265
  } catch (restoreError) {
38010
38266
  restoreFailure = `; failed to restore previous install: ${restoreError.message}`;
@@ -38021,10 +38277,10 @@ async function runPythonSidecarUpdatePlan(plan) {
38021
38277
  }
38022
38278
  const publishedFailure = sidecarStructureFailure(finalDir);
38023
38279
  if (publishedFailure) {
38024
- if (backupDir && (0, import_node_fs20.existsSync)(backupDir)) {
38025
- (0, import_node_fs20.rmSync)(finalDir, { recursive: true, force: true });
38280
+ if (backupDir && (0, import_node_fs21.existsSync)(backupDir)) {
38281
+ (0, import_node_fs21.rmSync)(finalDir, { recursive: true, force: true });
38026
38282
  try {
38027
- (0, import_node_fs20.renameSync)(backupDir, finalDir);
38283
+ (0, import_node_fs21.renameSync)(backupDir, finalDir);
38028
38284
  backupDir = null;
38029
38285
  } catch {
38030
38286
  }
@@ -38035,7 +38291,7 @@ async function runPythonSidecarUpdatePlan(plan) {
38035
38291
  );
38036
38292
  return 1;
38037
38293
  }
38038
- if (backupDir) (0, import_node_fs20.rmSync)(backupDir, { recursive: true, force: true });
38294
+ if (backupDir) (0, import_node_fs21.rmSync)(backupDir, { recursive: true, force: true });
38039
38295
  writeSidecarLauncher({
38040
38296
  path: plan.sidecarPath,
38041
38297
  hostUrl: plan.hostUrl,
@@ -38043,28 +38299,28 @@ async function runPythonSidecarUpdatePlan(plan) {
38043
38299
  nodeBin: plan.nodeBin,
38044
38300
  entryPath: finalEntryPath
38045
38301
  });
38046
- (0, import_node_fs20.writeFileSync)(
38047
- (0, import_node_path22.join)(plan.stateDir, ".version"),
38302
+ (0, import_node_fs21.writeFileSync)(
38303
+ (0, import_node_path23.join)(plan.stateDir, ".version"),
38048
38304
  `${installedVersion}
38049
38305
  `,
38050
38306
  "utf8"
38051
38307
  );
38052
- (0, import_node_fs20.writeFileSync)(
38053
- (0, import_node_path22.join)(plan.stateDir, ".install-method"),
38308
+ (0, import_node_fs21.writeFileSync)(
38309
+ (0, import_node_path23.join)(plan.stateDir, ".install-method"),
38054
38310
  "python-sidecar\n",
38055
38311
  "utf8"
38056
38312
  );
38057
- (0, import_node_fs20.writeFileSync)(
38058
- (0, import_node_path22.join)(plan.stateDir, ".command-path"),
38313
+ (0, import_node_fs21.writeFileSync)(
38314
+ (0, import_node_path23.join)(plan.stateDir, ".command-path"),
38059
38315
  `${plan.sidecarPath}
38060
38316
  `,
38061
38317
  "utf8"
38062
38318
  );
38063
- (0, import_node_fs20.writeFileSync)((0, import_node_path22.join)(plan.stateDir, ".runner"), "node\n", "utf8");
38064
- (0, import_node_fs20.writeFileSync)((0, import_node_path22.join)(plan.stateDir, ".node-bin"), `${plan.nodeBin}
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}
38065
38321
  `, "utf8");
38066
- (0, import_node_fs20.writeFileSync)(
38067
- (0, import_node_path22.join)(plan.stateDir, ".entry-path"),
38322
+ (0, import_node_fs21.writeFileSync)(
38323
+ (0, import_node_path23.join)(plan.stateDir, ".entry-path"),
38068
38324
  `${finalEntryPath}
38069
38325
  `,
38070
38326
  "utf8"
@@ -38991,14 +39247,14 @@ chooses the connected Slack channel or member and the events it receives.
38991
39247
 
38992
39248
  // src/cli/commands/tools.ts
38993
39249
  var import_commander3 = require("commander");
38994
- var import_node_fs22 = require("fs");
39250
+ var import_node_fs23 = require("fs");
38995
39251
  var import_node_os16 = require("os");
38996
- var import_node_path24 = require("path");
39252
+ var import_node_path25 = require("path");
38997
39253
 
38998
39254
  // src/tool-output.ts
38999
- var import_node_fs21 = require("fs");
39255
+ var import_node_fs22 = require("fs");
39000
39256
  var import_node_os15 = require("os");
39001
- var import_node_path23 = require("path");
39257
+ var import_node_path24 = require("path");
39002
39258
  function isPlainObject(value) {
39003
39259
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
39004
39260
  }
@@ -39125,19 +39381,19 @@ function projectRowOutput(conversion) {
39125
39381
  };
39126
39382
  }
39127
39383
  function ensureOutputDir() {
39128
- const outputDir = (0, import_node_path23.join)((0, import_node_os15.homedir)(), ".local", "share", "deepline", "data");
39129
- (0, import_node_fs21.mkdirSync)(outputDir, { recursive: true });
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 });
39130
39386
  return outputDir;
39131
39387
  }
39132
39388
  function writeJsonOutputFile(payload, stem) {
39133
39389
  const outputDir = ensureOutputDir();
39134
- const outputPath = (0, import_node_path23.join)(outputDir, `${stem}_${Date.now()}.json`);
39135
- (0, import_node_fs21.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
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");
39136
39392
  return outputPath;
39137
39393
  }
39138
39394
  function writeCsvOutputFile(rows, stem, options) {
39139
- const outputPath = options?.outPath ? options.outPath : (0, import_node_path23.join)(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
39140
- (0, import_node_fs21.mkdirSync)((0, import_node_path23.dirname)(outputPath), { recursive: true });
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 });
39141
39397
  const columns = columnsForRows(rows);
39142
39398
  const escapeCell = (value) => {
39143
39399
  const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
@@ -39146,19 +39402,19 @@ function writeCsvOutputFile(rows, stem, options) {
39146
39402
  }
39147
39403
  return normalized;
39148
39404
  };
39149
- const fd = (0, import_node_fs21.openSync)(outputPath, "w");
39405
+ const fd = (0, import_node_fs22.openSync)(outputPath, "w");
39150
39406
  try {
39151
- (0, import_node_fs21.writeSync)(fd, `${columns.map(escapeCell).join(",")}
39407
+ (0, import_node_fs22.writeSync)(fd, `${columns.map(escapeCell).join(",")}
39152
39408
  `);
39153
39409
  for (const row of rows) {
39154
- (0, import_node_fs21.writeSync)(
39410
+ (0, import_node_fs22.writeSync)(
39155
39411
  fd,
39156
39412
  `${columns.map((column) => escapeCell(row[column])).join(",")}
39157
39413
  `
39158
39414
  );
39159
39415
  }
39160
39416
  } finally {
39161
- (0, import_node_fs21.closeSync)(fd);
39417
+ (0, import_node_fs22.closeSync)(fd);
39162
39418
  }
39163
39419
  const previewRows = rows.slice(0, 5);
39164
39420
  const previewColumns = columns.slice(0, 5);
@@ -39280,6 +39536,78 @@ function arrayField(value, key) {
39280
39536
  return Array.isArray(candidate) ? candidate : [];
39281
39537
  }
39282
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
+
39283
39611
  // src/cli/commands/tools.ts
39284
39612
  var TOOL_COMMAND_TEMPLATES = {
39285
39613
  describe: "deepline tools describe <toolId>",
@@ -40200,7 +40528,7 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
40200
40528
  const extractedValues = extractionContractEntries(
40201
40529
  arrayField2(toolExecutionResult, "extractedValues", "extracted_values")
40202
40530
  );
40203
- const pricing = toolPricingContractForDescribe(tool);
40531
+ const pricing = Capability.fromCatalogEntry(tool).describe().customerCost();
40204
40532
  const deprecation = recordField2(tool, "deprecation");
40205
40533
  const replacementToolId = stringField2(
40206
40534
  deprecation,
@@ -40251,38 +40579,6 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
40251
40579
  ...starterScript ? { starterScript } : {}
40252
40580
  };
40253
40581
  }
40254
- function toolPricingContractForDescribe(tool) {
40255
- const legacyCost = recordField2(tool, "cost");
40256
- const pricingValue = tool.pricing;
40257
- const hasCanonicalPricing = isRecord12(pricingValue);
40258
- const canonicalPricing = hasCanonicalPricing ? pricingValue : {};
40259
- const unit = stringField2(canonicalPricing, "unit");
40260
- const legacyPricingModel = stringField2(
40261
- legacyCost,
40262
- "pricingModel",
40263
- "pricing_model"
40264
- );
40265
- const pricingModel = unit === "call" ? "fixed" : unit === "result" || unit === "page" ? `per_${unit}` : unit === "usage" ? "provider_usage" : legacyPricingModel;
40266
- return {
40267
- pricingModel: pricingModel || null,
40268
- unit: unit || null,
40269
- displayText: stringField2(canonicalPricing, "displayText", "display_text") || null,
40270
- summary: stringField2(canonicalPricing, "summary") || null,
40271
- billingMode: stringField2(legacyCost, "billingMode", "billing_mode") || null,
40272
- billingSource: stringField2(tool, "billingSource", "billing_source") || null,
40273
- billingSourceLabel: stringField2(tool, "billingSourceLabel", "billing_source_label") || null,
40274
- deeplineCreditsPerPricingUnit: hasCanonicalPricing ? numberField2(canonicalPricing, "creditsPerUnit", "credits_per_unit") : numberField2(
40275
- tool,
40276
- "deeplineCreditsPerPricingUnit",
40277
- "deepline_credits_per_pricing_unit"
40278
- ),
40279
- deeplineUsdPerPricingUnit: hasCanonicalPricing ? numberField2(canonicalPricing, "usdPerUnit", "usd_per_unit") : numberField2(
40280
- tool,
40281
- "deeplineUsdPerPricingUnit",
40282
- "deepline_usd_per_pricing_unit"
40283
- )
40284
- };
40285
- }
40286
40582
  function extractionContractEntries(entries) {
40287
40583
  return entries.flatMap((entry) => {
40288
40584
  if (!isRecord12(entry)) return [];
@@ -40735,6 +41031,7 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
40735
41031
  toolId,
40736
41032
  provider: tool.provider,
40737
41033
  displayName: tool.displayName,
41034
+ cost: Capability.fromCatalogEntry(tool).describe().customerCost(),
40738
41035
  usageGuidance,
40739
41036
  runtimeOutputHelp: {
40740
41037
  contract: "tools describe shows declared schema and Deepline getters; it is not an observed provider response.",
@@ -41065,11 +41362,11 @@ function normalizeOutputFormat(raw) {
41065
41362
  }
41066
41363
  function resolveAtFilePath(rawPath) {
41067
41364
  const trimmed = rawPath.trim();
41068
- const resolved = (0, import_node_path24.resolve)(trimmed);
41069
- if ((0, import_node_fs22.existsSync)(resolved)) return resolved;
41365
+ const resolved = (0, import_node_path25.resolve)(trimmed);
41366
+ if ((0, import_node_fs23.existsSync)(resolved)) return resolved;
41070
41367
  if (process.platform !== "win32" && trimmed.includes("\\")) {
41071
- const normalized = (0, import_node_path24.resolve)(trimmed.replace(/\\/g, "/"));
41072
- if ((0, import_node_fs22.existsSync)(normalized)) return normalized;
41368
+ const normalized = (0, import_node_path25.resolve)(trimmed.replace(/\\/g, "/"));
41369
+ if ((0, import_node_fs23.existsSync)(normalized)) return normalized;
41073
41370
  }
41074
41371
  return resolved;
41075
41372
  }
@@ -41080,7 +41377,7 @@ function readJsonArgument(raw, flagName) {
41080
41377
  throw new Error(`Invalid ${flagName} value: empty @file path.`);
41081
41378
  }
41082
41379
  try {
41083
- return (0, import_node_fs22.readFileSync)(resolveAtFilePath(filePath), "utf8").replace(
41380
+ return (0, import_node_fs23.readFileSync)(resolveAtFilePath(filePath), "utf8").replace(
41084
41381
  /^\uFEFF/,
41085
41382
  ""
41086
41383
  );
@@ -41157,7 +41454,7 @@ function parseExecuteOptions(args) {
41157
41454
  continue;
41158
41455
  }
41159
41456
  if ((arg === "--out" || arg === "-o") && args[index + 1]) {
41160
- outPath = (0, import_node_path24.resolve)(args[++index]);
41457
+ outPath = (0, import_node_path25.resolve)(args[++index]);
41161
41458
  continue;
41162
41459
  }
41163
41460
  throw new Error(`Unknown option: ${arg}`);
@@ -41187,9 +41484,9 @@ function starterScriptJson(script) {
41187
41484
  function seedToolListScript(input2) {
41188
41485
  const stem = safeFileStem(input2.toolId);
41189
41486
  const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
41190
- const scriptDir = (0, import_node_fs22.mkdtempSync)((0, import_node_path24.join)((0, import_node_os16.tmpdir)(), "deepline-workflow-seed-"));
41191
- (0, import_node_fs22.chmodSync)(scriptDir, 448);
41192
- const scriptPath = (0, import_node_path24.join)(scriptDir, fileName);
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);
41193
41490
  const projectDir = `deepline/projects/${stem}-workflow`;
41194
41491
  const playName = `${stem}-workflow`;
41195
41492
  const sampleRows = input2.rows.length > 0 ? `${JSON.stringify(input2.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
@@ -41232,7 +41529,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
41232
41529
  description: ${JSON.stringify(`Seed ${input2.toolId} rows into a Deepline workflow-ready dataset.`)},
41233
41530
  });
41234
41531
  `;
41235
- (0, import_node_fs22.writeFileSync)(scriptPath, script, { encoding: "utf-8", mode: 384 });
41532
+ (0, import_node_fs23.writeFileSync)(scriptPath, script, { encoding: "utf-8", mode: 384 });
41236
41533
  return {
41237
41534
  path: scriptPath,
41238
41535
  sourceCode: script,
@@ -41658,7 +41955,7 @@ Examples:
41658
41955
 
41659
41956
  // src/cli/commands/workflow.ts
41660
41957
  var import_promises9 = require("fs/promises");
41661
- var import_node_path25 = require("path");
41958
+ var import_node_path26 = require("path");
41662
41959
 
41663
41960
  // src/cli/workflow-to-play.ts
41664
41961
  var import_node_crypto8 = require("crypto");
@@ -41875,7 +42172,7 @@ function readStatus(payload) {
41875
42172
  }
41876
42173
  async function readJsonOption(payload, file) {
41877
42174
  if (file) {
41878
- const raw = await (0, import_promises9.readFile)((0, import_node_path25.resolve)(file), "utf8");
42175
+ const raw = await (0, import_promises9.readFile)((0, import_node_path26.resolve)(file), "utf8");
41879
42176
  return JSON.parse(raw);
41880
42177
  }
41881
42178
  if (payload) {
@@ -41909,8 +42206,8 @@ async function transformOne(api, workflowId, outDir, publish) {
41909
42206
  revision.config,
41910
42207
  { workflowName: workflow.name, version: revision.version }
41911
42208
  );
41912
- const file = (0, import_node_path25.join)((0, import_node_path25.resolve)(outDir), `${compiled.playName}.play.ts`);
41913
- await (0, import_promises9.mkdir)((0, import_node_path25.dirname)(file), { recursive: true });
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 });
41914
42211
  await (0, import_promises9.writeFile)(file, compiled.sourceCode, "utf8");
41915
42212
  let published = false;
41916
42213
  if (publish) {
@@ -42285,7 +42582,7 @@ function isDowngradeAutoUpdateResponse(response) {
42285
42582
  return compareSemver(target, current) < 0;
42286
42583
  }
42287
42584
  function relaunchCurrentCommand(plan) {
42288
- return new Promise((resolve19) => {
42585
+ return new Promise((resolve20) => {
42289
42586
  const command = plan.kind === "python-sidecar" ? plan.sidecarPath : process.execPath;
42290
42587
  const args = plan.kind === "python-sidecar" ? process.argv.slice(2) : process.argv.slice(1);
42291
42588
  const child = (0, import_node_child_process6.spawn)(command, args, {
@@ -42301,9 +42598,9 @@ function relaunchCurrentCommand(plan) {
42301
42598
  `Deepline SDK/CLI updated, but relaunch failed: ${error.message}
42302
42599
  `
42303
42600
  );
42304
- resolve19(1);
42601
+ resolve20(1);
42305
42602
  });
42306
- child.on("close", (code) => resolve19(code ?? 1));
42603
+ child.on("close", (code) => resolve20(code ?? 1));
42307
42604
  });
42308
42605
  }
42309
42606
  async function maybeAutoUpdateAndRelaunch(response, baseUrl) {
@@ -42694,8 +42991,8 @@ function topLevelCommandKnown(program, commandName) {
42694
42991
  );
42695
42992
  }
42696
42993
  async function runPlayRunnerHealthCheck() {
42697
- const dir = await (0, import_promises10.mkdtemp)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "deepline-health-play-"));
42698
- const file = (0, import_node_path26.join)(dir, "health-check.play.ts");
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");
42699
42996
  try {
42700
42997
  await (0, import_promises10.writeFile)(
42701
42998
  file,