deepline 0.1.24 → 0.1.25

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
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
 
26
26
  // src/cli/index.ts
27
- var import_commander = require("commander");
27
+ var import_commander2 = require("commander");
28
28
 
29
29
  // src/config.ts
30
30
  var import_node_fs = require("fs");
@@ -266,7 +266,7 @@ function saveProjectDeeplineEnvValues(baseUrl, values, startDir = projectEnvStar
266
266
  }
267
267
 
268
268
  // src/version.ts
269
- var SDK_VERSION = "0.1.24";
269
+ var SDK_VERSION = "0.1.25";
270
270
  var SDK_API_CONTRACT = "2026-05-runs-v2";
271
271
 
272
272
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -548,7 +548,7 @@ function decodeSseFrame(frame) {
548
548
  return parsed;
549
549
  }
550
550
  function sleep(ms) {
551
- return new Promise((resolve8) => setTimeout(resolve8, ms));
551
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
552
552
  }
553
553
 
554
554
  // src/client.ts
@@ -556,7 +556,7 @@ var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "ca
556
556
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
557
557
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
558
558
  function sleep2(ms) {
559
- return new Promise((resolve8) => setTimeout(resolve8, ms));
559
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
560
560
  }
561
561
  function isTransientCompileManifestError(error) {
562
562
  if (error instanceof DeeplineError && typeof error.statusCode === "number") {
@@ -2041,7 +2041,7 @@ function buildCandidateUrls2(url) {
2041
2041
  }
2042
2042
  }
2043
2043
  function sleep3(ms) {
2044
- return new Promise((resolve8) => setTimeout(resolve8, ms));
2044
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
2045
2045
  }
2046
2046
  function printDeeplineLogo() {
2047
2047
  if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
@@ -2415,6 +2415,10 @@ Examples:
2415
2415
  }
2416
2416
 
2417
2417
  // src/cli/commands/billing.ts
2418
+ var import_commander = require("commander");
2419
+ var import_promises2 = require("fs/promises");
2420
+ var import_node_path4 = require("path");
2421
+ var import_sync3 = require("csv-stringify/sync");
2418
2422
  function humanize(value) {
2419
2423
  return String(value || "").split("_").filter(Boolean).map((token) => token[0]?.toUpperCase() + token.slice(1)).join(" ") || "Unknown";
2420
2424
  }
@@ -2432,6 +2436,54 @@ function printRecentUsage(entries) {
2432
2436
  `);
2433
2437
  }
2434
2438
  }
2439
+ function summarizeLedgerRows(summary, rows) {
2440
+ const netDelta = rows.reduce((sum, row) => {
2441
+ const value = Number.parseFloat(String(row.delta_credits ?? "").trim());
2442
+ return Number.isFinite(value) ? sum + value : sum;
2443
+ }, summary.net_delta_credits);
2444
+ return {
2445
+ row_count: summary.row_count + rows.length,
2446
+ net_delta_credits: Math.round((netDelta + Number.EPSILON) * 100) / 100
2447
+ };
2448
+ }
2449
+ function ledgerApiEntryToRow(entry) {
2450
+ const metadata = typeof entry.metadata === "object" && entry.metadata !== null ? entry.metadata : {};
2451
+ return {
2452
+ created_at: entry.created_at ?? "",
2453
+ delta_credits: entry.delta ?? "",
2454
+ reason: entry.reason ?? "",
2455
+ provider: metadata.provider ?? "",
2456
+ operation: metadata.operation ?? "",
2457
+ request_id: metadata.requestId ?? metadata.request_id ?? "",
2458
+ run_id: metadata.runId ?? metadata.run_id ?? "",
2459
+ api_key_id: entry.api_key_id ?? "",
2460
+ stripe_session_id: entry.stripe_session_id ?? ""
2461
+ };
2462
+ }
2463
+ function ledgerRowsToCsv(rows, header) {
2464
+ return (0, import_sync3.stringify)(rows, {
2465
+ header,
2466
+ columns: [
2467
+ "created_at",
2468
+ "delta_credits",
2469
+ "reason",
2470
+ "provider",
2471
+ "operation",
2472
+ "request_id",
2473
+ "run_id",
2474
+ "api_key_id",
2475
+ "stripe_session_id"
2476
+ ]
2477
+ });
2478
+ }
2479
+ function defaultLedgerExportPath() {
2480
+ return (0, import_node_path4.resolve)(
2481
+ process.cwd(),
2482
+ "deepline",
2483
+ "data",
2484
+ `billing-ledger-all-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.csv`
2485
+ );
2486
+ }
2435
2487
  async function handleBalance(options) {
2436
2488
  const { http } = getAuthedHttpClient();
2437
2489
  const payload = await http.get("/api/v2/billing/balance");
@@ -2520,6 +2572,51 @@ async function handleHistory(options) {
2520
2572
  process.stdout.write(`${rows.length} row(s) exported.
2521
2573
  `);
2522
2574
  }
2575
+ async function handleLedgerExportAll(options) {
2576
+ const { http } = getAuthedHttpClient();
2577
+ const outputPath = options.output ? (0, import_node_path4.resolve)(String(options.output)) : defaultLedgerExportPath();
2578
+ let summary = { row_count: 0, net_delta_credits: 0 };
2579
+ let cursor = null;
2580
+ let initializedOutput = false;
2581
+ for (; ; ) {
2582
+ const params = new URLSearchParams({ limit: "5000" });
2583
+ if (cursor !== null) params.set("cursor", cursor);
2584
+ const payload = await http.get(
2585
+ `/api/v2/billing/ledger?${params.toString()}`
2586
+ );
2587
+ const entries = Array.isArray(payload.entries) ? payload.entries : [];
2588
+ const rows = entries.map(ledgerApiEntryToRow);
2589
+ if (!initializedOutput) {
2590
+ await (0, import_promises2.mkdir)((0, import_node_path4.dirname)(outputPath), { recursive: true });
2591
+ await (0, import_promises2.writeFile)(outputPath, ledgerRowsToCsv([], true), "utf-8");
2592
+ initializedOutput = true;
2593
+ }
2594
+ if (rows.length > 0) {
2595
+ await (0, import_promises2.appendFile)(outputPath, ledgerRowsToCsv(rows, false), "utf-8");
2596
+ summary = summarizeLedgerRows(summary, rows);
2597
+ }
2598
+ const nextCursor = typeof payload.next_cursor === "string" && payload.next_cursor.length > 0 ? payload.next_cursor : null;
2599
+ if (rows.length === 0 || payload.has_more !== true || nextCursor === null) {
2600
+ break;
2601
+ }
2602
+ if (nextCursor === cursor) break;
2603
+ cursor = nextCursor;
2604
+ }
2605
+ if (shouldEmitJson(options.json)) {
2606
+ return printJson({
2607
+ output_path: outputPath,
2608
+ row_count: summary.row_count,
2609
+ net_delta_credits: summary.net_delta_credits,
2610
+ scope: "current_auth_context"
2611
+ });
2612
+ }
2613
+ process.stdout.write(`Billing ledger written to ${outputPath}
2614
+ `);
2615
+ process.stdout.write(`${summary.row_count} row(s) exported for the current auth context.
2616
+ `);
2617
+ process.stdout.write(`Net ledger delta: ${summary.net_delta_credits} Deepline Credits
2618
+ `);
2619
+ }
2523
2620
  async function handleCheckout(options) {
2524
2621
  const { http } = getAuthedHttpClient();
2525
2622
  const payload = await http.post("/api/v2/billing/checkout", {
@@ -2616,6 +2713,41 @@ Examples:
2616
2713
  deepline billing off --json
2617
2714
  `
2618
2715
  ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLimitOff);
2716
+ billing.command("ledger").description("Inspect and export billing ledger rows.").addHelpText(
2717
+ "after",
2718
+ `
2719
+ Notes:
2720
+ Read-only. Exports ledger rows for the current auth context. API-key auth is
2721
+ scoped by the server to that API key; session auth is scoped to the active
2722
+ workspace.
2723
+
2724
+ Examples:
2725
+ deepline billing ledger export all
2726
+ deepline billing ledger export all --output ./ledger.csv
2727
+ deepline billing ledger export all --json
2728
+ `
2729
+ ).addCommand(
2730
+ new import_commander.Command("export").description("Export billing ledger rows.").addHelpText(
2731
+ "after",
2732
+ `
2733
+ Examples:
2734
+ deepline billing ledger export all
2735
+ `
2736
+ ).addCommand(
2737
+ new import_commander.Command("all").description("Export all available billing ledger rows to CSV.").addHelpText(
2738
+ "after",
2739
+ `
2740
+ Notes:
2741
+ Pages through the ledger for the current auth context, writes CSV locally,
2742
+ then reports the row count and the net delta computed from delta_credits.
2743
+
2744
+ Examples:
2745
+ deepline billing ledger export all
2746
+ deepline billing ledger export all --json
2747
+ `
2748
+ ).option("--output <path>", "Write CSV to an explicit path").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLedgerExportAll)
2749
+ )
2750
+ );
2619
2751
  billing.command("history").description("Export billing ledger history to CSV.").addHelpText(
2620
2752
  "after",
2621
2753
  `
@@ -2657,7 +2789,7 @@ Examples:
2657
2789
 
2658
2790
  // src/cli/dataset-stats.ts
2659
2791
  var import_node_fs4 = require("fs");
2660
- var import_node_path4 = require("path");
2792
+ var import_node_path5 = require("path");
2661
2793
  var CSV_PROJECTED_FIELDS_KEY = "__deeplineCsvProjectedFields";
2662
2794
  function csvProjectedFields(row) {
2663
2795
  const serialized = row[CSV_PROJECTED_FIELDS_KEY];
@@ -2987,7 +3119,7 @@ function writeCanonicalRowsCsv(rowsInfo, outPath) {
2987
3119
  rows: rowsInfo.rows,
2988
3120
  columns: rowsInfo.columns
2989
3121
  });
2990
- const resolved = (0, import_node_path4.resolve)(outPath);
3122
+ const resolved = (0, import_node_path5.resolve)(outPath);
2991
3123
  (0, import_node_fs4.writeFileSync)(
2992
3124
  resolved,
2993
3125
  csvStringFromRows(sanitized.rows, sanitized.columns),
@@ -3382,19 +3514,19 @@ Examples:
3382
3514
  // src/cli/commands/play.ts
3383
3515
  var import_node_crypto3 = require("crypto");
3384
3516
  var import_node_fs6 = require("fs");
3385
- var import_node_path8 = require("path");
3517
+ var import_node_path9 = require("path");
3386
3518
 
3387
3519
  // src/plays/bundle-play-file.ts
3388
3520
  var import_node_os5 = require("os");
3389
- var import_node_path7 = require("path");
3521
+ var import_node_path8 = require("path");
3390
3522
  var import_node_url = require("url");
3391
3523
  var import_node_fs5 = require("fs");
3392
3524
 
3393
3525
  // ../shared_libs/plays/bundling/index.ts
3394
3526
  var import_node_crypto = require("crypto");
3395
- var import_promises2 = require("fs/promises");
3527
+ var import_promises3 = require("fs/promises");
3396
3528
  var import_node_os4 = require("os");
3397
- var import_node_path5 = require("path");
3529
+ var import_node_path6 = require("path");
3398
3530
  var import_node_module = require("module");
3399
3531
  var import_esbuild = require("esbuild");
3400
3532
 
@@ -3455,7 +3587,7 @@ var playArtifactRequire = (0, import_node_module.createRequire)(import_meta.url)
3455
3587
  var PLAY_BUNDLE_CACHE_VERSION = 24;
3456
3588
  var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
3457
3589
  var MAX_ESM_WORKERS_BUNDLE_BYTES = 115e4;
3458
- var PLAY_ARTIFACT_CACHE_DIR = (0, import_node_path5.join)(
3590
+ var PLAY_ARTIFACT_CACHE_DIR = (0, import_node_path6.join)(
3459
3591
  (0, import_node_os4.tmpdir)(),
3460
3592
  `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`
3461
3593
  );
@@ -3486,15 +3618,15 @@ function isLocalSpecifier(specifier) {
3486
3618
  }
3487
3619
  async function normalizeLocalPath(filePath) {
3488
3620
  try {
3489
- return await (0, import_promises2.realpath)(filePath);
3621
+ return await (0, import_promises3.realpath)(filePath);
3490
3622
  } catch {
3491
- return (0, import_node_path5.resolve)(filePath);
3623
+ return (0, import_node_path6.resolve)(filePath);
3492
3624
  }
3493
3625
  }
3494
3626
  function createPlayWorkspace(entryFile) {
3495
3627
  return {
3496
3628
  entryFile,
3497
- rootDir: (0, import_node_path5.dirname)(entryFile)
3629
+ rootDir: (0, import_node_path6.dirname)(entryFile)
3498
3630
  };
3499
3631
  }
3500
3632
  function isPathInsideDirectory(filePath, directory) {
@@ -3648,7 +3780,7 @@ function extractDefinedPlayName(sourceCode, _filePath) {
3648
3780
  function getPackageRequireCandidates(fromFile) {
3649
3781
  const candidates = [
3650
3782
  (0, import_node_module.createRequire)(fromFile),
3651
- (0, import_node_module.createRequire)((0, import_node_path5.join)(process.cwd(), "package.json")),
3783
+ (0, import_node_module.createRequire)((0, import_node_path6.join)(process.cwd(), "package.json")),
3652
3784
  playArtifactRequire
3653
3785
  ];
3654
3786
  return candidates;
@@ -3695,7 +3827,7 @@ function workersNamedPlayEntryAliasPlugin(playFilePath, exportName) {
3695
3827
  contents: `export { ${exportName} as default } from ${JSON.stringify(playFilePath)};
3696
3828
  `,
3697
3829
  loader: "ts",
3698
- resolveDir: (0, import_node_path5.dirname)(playFilePath)
3830
+ resolveDir: (0, import_node_path6.dirname)(playFilePath)
3699
3831
  })
3700
3832
  );
3701
3833
  }
@@ -3859,7 +3991,7 @@ function importedPlayProxyPlugin(importedPlayDependencies) {
3859
3991
  return {
3860
3992
  contents: buildImportedPlayProxyModule(dependency.playName),
3861
3993
  loader: "ts",
3862
- resolveDir: (0, import_node_path5.dirname)(args.path)
3994
+ resolveDir: (0, import_node_path6.dirname)(args.path)
3863
3995
  };
3864
3996
  });
3865
3997
  }
@@ -3867,7 +3999,7 @@ function importedPlayProxyPlugin(importedPlayDependencies) {
3867
3999
  }
3868
4000
  async function fileExists(filePath) {
3869
4001
  try {
3870
- await (0, import_promises2.stat)(filePath);
4002
+ await (0, import_promises3.stat)(filePath);
3871
4003
  return true;
3872
4004
  } catch {
3873
4005
  return false;
@@ -3877,12 +4009,12 @@ async function resolveLocalImport(fromFile, specifier) {
3877
4009
  if (specifier.startsWith("file:")) {
3878
4010
  return normalizeLocalPath(new URL(specifier).pathname);
3879
4011
  }
3880
- const base = (0, import_node_path5.isAbsolute)(specifier) ? (0, import_node_path5.resolve)(specifier) : (0, import_node_path5.resolve)((0, import_node_path5.dirname)(fromFile), specifier);
4012
+ const base = (0, import_node_path6.isAbsolute)(specifier) ? (0, import_node_path6.resolve)(specifier) : (0, import_node_path6.resolve)((0, import_node_path6.dirname)(fromFile), specifier);
3881
4013
  const candidates = [base];
3882
- const explicitExtension = (0, import_node_path5.extname)(base).toLowerCase();
4014
+ const explicitExtension = (0, import_node_path6.extname)(base).toLowerCase();
3883
4015
  if (!explicitExtension) {
3884
4016
  candidates.push(...SOURCE_EXTENSIONS.map((extension) => `${base}${extension}`));
3885
- candidates.push(...SOURCE_EXTENSIONS.map((extension) => (0, import_node_path5.join)(base, `index${extension}`)));
4017
+ candidates.push(...SOURCE_EXTENSIONS.map((extension) => (0, import_node_path6.join)(base, `index${extension}`)));
3886
4018
  } else if ([".js", ".jsx", ".mjs", ".cjs"].includes(explicitExtension)) {
3887
4019
  const stem = base.slice(0, -explicitExtension.length);
3888
4020
  candidates.push(...SOURCE_EXTENSIONS.map((extension) => `${stem}${extension}`));
@@ -3948,9 +4080,9 @@ async function analyzeSourceGraph(entryFile, adapter) {
3948
4080
  return;
3949
4081
  }
3950
4082
  visited.add(absolutePath);
3951
- const sourceCode2 = await (0, import_promises2.readFile)(absolutePath, "utf-8");
4083
+ const sourceCode2 = await (0, import_promises3.readFile)(absolutePath, "utf-8");
3952
4084
  localFiles.set(absolutePath, sourceCode2);
3953
- if ((0, import_node_path5.extname)(absolutePath).toLowerCase() === ".json") {
4085
+ if ((0, import_node_path6.extname)(absolutePath).toLowerCase() === ".json") {
3954
4086
  return;
3955
4087
  }
3956
4088
  const handleSpecifier = async (specifier, line, column, kind) => {
@@ -3974,7 +4106,7 @@ async function analyzeSourceGraph(entryFile, adapter) {
3974
4106
  column
3975
4107
  });
3976
4108
  if (resolved !== absoluteEntryFile && isPlaySourceFile(resolved)) {
3977
- const importedSource = await (0, import_promises2.readFile)(resolved, "utf-8");
4109
+ const importedSource = await (0, import_promises3.readFile)(resolved, "utf-8");
3978
4110
  const importedPlayName = extractDefinedPlayName(importedSource, resolved);
3979
4111
  if (!importedPlayName) {
3980
4112
  throw new Error(
@@ -4054,20 +4186,20 @@ async function computeWorkersHarnessFingerprintWithAdapter(adapter) {
4054
4186
  const tsFiles = entries.filter((e) => e.isFile() && /\.[cm]?ts$/.test(e.name)).map((e) => e.name).sort();
4055
4187
  const parts = [];
4056
4188
  for (const name of tsFiles) {
4057
- const contents = await (0, import_promises2.readFile)((0, import_node_path5.join)(adapter.workersHarnessFilesDir, name), "utf-8");
4189
+ const contents = await (0, import_promises3.readFile)((0, import_node_path6.join)(adapter.workersHarnessFilesDir, name), "utf-8");
4058
4190
  parts.push({ name, hash: sha256(contents) });
4059
4191
  }
4060
4192
  return sha256(JSON.stringify(parts));
4061
4193
  }
4062
4194
  function artifactCachePath(graphHash, artifactKind, adapter) {
4063
- return (0, import_node_path5.join)(
4195
+ return (0, import_node_path6.join)(
4064
4196
  adapter.cacheDir ?? PLAY_ARTIFACT_CACHE_DIR,
4065
4197
  `${graphHash}.${artifactKind}.json`
4066
4198
  );
4067
4199
  }
4068
4200
  async function readArtifactCache(graphHash, artifactKind, adapter) {
4069
4201
  try {
4070
- const serialized = await (0, import_promises2.readFile)(
4202
+ const serialized = await (0, import_promises3.readFile)(
4071
4203
  artifactCachePath(graphHash, artifactKind, adapter),
4072
4204
  "utf-8"
4073
4205
  );
@@ -4078,8 +4210,8 @@ async function readArtifactCache(graphHash, artifactKind, adapter) {
4078
4210
  }
4079
4211
  async function writeArtifactCache(artifact, adapter) {
4080
4212
  const cacheDir = adapter.cacheDir ?? PLAY_ARTIFACT_CACHE_DIR;
4081
- await (0, import_promises2.mkdir)(cacheDir, { recursive: true });
4082
- await (0, import_promises2.writeFile)(
4213
+ await (0, import_promises3.mkdir)(cacheDir, { recursive: true });
4214
+ await (0, import_promises3.writeFile)(
4083
4215
  artifactCachePath(
4084
4216
  artifact.graphHash,
4085
4217
  artifact.artifactKind ?? PLAY_ARTIFACT_KINDS.cjsNode20,
@@ -4095,7 +4227,7 @@ function normalizeSourceMapForRuntime(sourceMapText) {
4095
4227
  if (sourcePath.startsWith("data:") || sourcePath.startsWith("node:") || sourcePath.startsWith("/") || /^[a-zA-Z]+:\/\//.test(sourcePath)) {
4096
4228
  return sourcePath;
4097
4229
  }
4098
- return (0, import_node_path5.resolve)(process.cwd(), sourcePath);
4230
+ return (0, import_node_path6.resolve)(process.cwd(), sourcePath);
4099
4231
  });
4100
4232
  parsed.sourceRoot = void 0;
4101
4233
  return JSON.stringify(parsed);
@@ -4127,8 +4259,8 @@ async function runEsbuildForCjsNode(entryFile, importedPlayDependencies, adapter
4127
4259
  ...namedExportShim ? {
4128
4260
  stdin: {
4129
4261
  contents: namedExportShim,
4130
- resolveDir: (0, import_node_path5.dirname)(entryFile),
4131
- sourcefile: `${(0, import_node_path5.basename)(entryFile)}.${exportName}.entry.ts`,
4262
+ resolveDir: (0, import_node_path6.dirname)(entryFile),
4263
+ sourcefile: `${(0, import_node_path6.basename)(entryFile)}.${exportName}.entry.ts`,
4132
4264
  loader: "ts"
4133
4265
  }
4134
4266
  } : { entryPoints: [entryFile] },
@@ -4304,10 +4436,10 @@ workers-harness:${harnessFingerprint}`
4304
4436
  }
4305
4437
  const { bundledCode, sourceMapText, outputExtension } = buildOutcome;
4306
4438
  const normalizedSourceMap = normalizeSourceMapForRuntime(sourceMapText);
4307
- const virtualBaseName = exportName === "default" ? (0, import_node_path5.basename)(absolutePath).replace(/\.[^.]+$/, "") : `${(0, import_node_path5.basename)(absolutePath).replace(/\.[^.]+$/, "")}.${exportName}`;
4439
+ const virtualBaseName = exportName === "default" ? (0, import_node_path6.basename)(absolutePath).replace(/\.[^.]+$/, "") : `${(0, import_node_path6.basename)(absolutePath).replace(/\.[^.]+$/, "")}.${exportName}`;
4308
4440
  const virtualFilename = `/virtual/deepline-plays/${analysis.graphHash}/${virtualBaseName}.${outputExtension}`;
4309
4441
  const executableCode = `${bundledCode}
4310
- //# sourceMappingURL=${(0, import_node_path5.basename)(virtualFilename)}.map
4442
+ //# sourceMappingURL=${(0, import_node_path6.basename)(virtualFilename)}.map
4311
4443
  `;
4312
4444
  const bundleSizeError = getBundleSizeError(
4313
4445
  absolutePath,
@@ -4416,14 +4548,14 @@ function resolveExecutionProfile(override) {
4416
4548
 
4417
4549
  // src/plays/local-file-discovery.ts
4418
4550
  var import_node_crypto2 = require("crypto");
4419
- var import_promises3 = require("fs/promises");
4420
- var import_node_path6 = require("path");
4551
+ var import_promises4 = require("fs/promises");
4552
+ var import_node_path7 = require("path");
4421
4553
  var SOURCE_EXTENSIONS2 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs", ".json"];
4422
4554
  function sha2562(buffer) {
4423
4555
  return (0, import_node_crypto2.createHash)("sha256").update(buffer).digest("hex");
4424
4556
  }
4425
4557
  function contentTypeForFile(filePath) {
4426
- const extension = (0, import_node_path6.extname)(filePath).toLowerCase();
4558
+ const extension = (0, import_node_path7.extname)(filePath).toLowerCase();
4427
4559
  if (extension === ".csv") return "text/csv";
4428
4560
  if (extension === ".json") return "application/json";
4429
4561
  if (extension === ".txt") return "text/plain";
@@ -4607,23 +4739,23 @@ function localImportSpecifiers(sourceCode) {
4607
4739
  }
4608
4740
  async function fileExists2(filePath) {
4609
4741
  try {
4610
- await (0, import_promises3.stat)(filePath);
4742
+ await (0, import_promises4.stat)(filePath);
4611
4743
  return true;
4612
4744
  } catch {
4613
4745
  return false;
4614
4746
  }
4615
4747
  }
4616
4748
  function isPathInsideDirectory2(filePath, directory) {
4617
- const relativePath = (0, import_node_path6.relative)(directory, filePath);
4618
- return relativePath === "" || !relativePath.startsWith("..") && !(0, import_node_path6.isAbsolute)(relativePath);
4749
+ const relativePath = (0, import_node_path7.relative)(directory, filePath);
4750
+ return relativePath === "" || !relativePath.startsWith("..") && !(0, import_node_path7.isAbsolute)(relativePath);
4619
4751
  }
4620
4752
  async function resolveLocalImport2(fromFile, specifier) {
4621
- const base = (0, import_node_path6.isAbsolute)(specifier) ? (0, import_node_path6.resolve)(specifier) : (0, import_node_path6.resolve)((0, import_node_path6.dirname)(fromFile), specifier);
4753
+ const base = (0, import_node_path7.isAbsolute)(specifier) ? (0, import_node_path7.resolve)(specifier) : (0, import_node_path7.resolve)((0, import_node_path7.dirname)(fromFile), specifier);
4622
4754
  const candidates = [base];
4623
- const explicitExtension = (0, import_node_path6.extname)(base).toLowerCase();
4755
+ const explicitExtension = (0, import_node_path7.extname)(base).toLowerCase();
4624
4756
  if (!explicitExtension) {
4625
4757
  candidates.push(...SOURCE_EXTENSIONS2.map((extension) => `${base}${extension}`));
4626
- candidates.push(...SOURCE_EXTENSIONS2.map((extension) => (0, import_node_path6.join)(base, `index${extension}`)));
4758
+ candidates.push(...SOURCE_EXTENSIONS2.map((extension) => (0, import_node_path7.join)(base, `index${extension}`)));
4627
4759
  } else if ([".js", ".jsx", ".mjs", ".cjs"].includes(explicitExtension)) {
4628
4760
  const stem = base.slice(0, -explicitExtension.length);
4629
4761
  candidates.push(...SOURCE_EXTENSIONS2.map((extension) => `${stem}${extension}`));
@@ -4636,18 +4768,18 @@ async function resolveLocalImport2(fromFile, specifier) {
4636
4768
  throw new Error(`Could not resolve local import "${specifier}" from ${fromFile}`);
4637
4769
  }
4638
4770
  async function discoverPackagedLocalFiles(entryFile) {
4639
- const absoluteEntryFile = (0, import_node_path6.resolve)(entryFile);
4640
- const packagingRoot = (0, import_node_path6.dirname)(absoluteEntryFile);
4771
+ const absoluteEntryFile = (0, import_node_path7.resolve)(entryFile);
4772
+ const packagingRoot = (0, import_node_path7.dirname)(absoluteEntryFile);
4641
4773
  const files = /* @__PURE__ */ new Map();
4642
4774
  const unresolved = [];
4643
4775
  const visitedFiles = /* @__PURE__ */ new Set();
4644
4776
  const visitSourceFile = async (filePath) => {
4645
- const absolutePath = (0, import_node_path6.resolve)(filePath);
4777
+ const absolutePath = (0, import_node_path7.resolve)(filePath);
4646
4778
  if (visitedFiles.has(absolutePath)) {
4647
4779
  return;
4648
4780
  }
4649
4781
  visitedFiles.add(absolutePath);
4650
- const sourceCode = await (0, import_promises3.readFile)(absolutePath, "utf-8");
4782
+ const sourceCode = await (0, import_promises4.readFile)(absolutePath, "utf-8");
4651
4783
  const scanSource = stripCommentsToSpaces2(sourceCode);
4652
4784
  const constants = collectTopLevelStringConstants(sourceCode);
4653
4785
  const childVisits = [];
@@ -4674,16 +4806,16 @@ async function discoverPackagedLocalFiles(entryFile) {
4674
4806
  message: "Could not resolve this ctx.csv(...) path at submit time. Use a string literal, a top-level const string, or pass a runtime input like input.file."
4675
4807
  });
4676
4808
  } else {
4677
- const absoluteCsvPath = (0, import_node_path6.resolve)((0, import_node_path6.dirname)(absolutePath), resolvedPath);
4678
- if ((0, import_node_path6.isAbsolute)(resolvedPath) || !isPathInsideDirectory2(absoluteCsvPath, packagingRoot)) {
4809
+ const absoluteCsvPath = (0, import_node_path7.resolve)((0, import_node_path7.dirname)(absolutePath), resolvedPath);
4810
+ if ((0, import_node_path7.isAbsolute)(resolvedPath) || !isPathInsideDirectory2(absoluteCsvPath, packagingRoot)) {
4679
4811
  unresolved.push({
4680
4812
  sourceFragment: sourceCode.slice(argument.start, argument.end).trim(),
4681
4813
  message: "ctx.csv(...) packaged file paths must be relative paths inside the play directory. Pass external files at runtime with input.file instead."
4682
4814
  });
4683
4815
  continue;
4684
4816
  }
4685
- const buffer = await (0, import_promises3.readFile)(absoluteCsvPath);
4686
- const stats = await (0, import_promises3.stat)(absoluteCsvPath);
4817
+ const buffer = await (0, import_promises4.readFile)(absoluteCsvPath);
4818
+ const stats = await (0, import_promises4.stat)(absoluteCsvPath);
4687
4819
  files.set(absoluteCsvPath, {
4688
4820
  sourceFragment: sourceCode.slice(argument.start, argument.end).trim(),
4689
4821
  logicalPath: resolvedPath,
@@ -4714,24 +4846,24 @@ async function discoverPackagedLocalFiles(entryFile) {
4714
4846
  // src/plays/bundle-play-file.ts
4715
4847
  var import_meta2 = {};
4716
4848
  var PLAY_BUNDLE_CACHE_VERSION2 = 26;
4717
- var MODULE_DIR = (0, import_node_path7.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url));
4718
- var SDK_PACKAGE_ROOT = (0, import_node_path7.resolve)(MODULE_DIR, "..", "..");
4719
- var SOURCE_REPO_ROOT = (0, import_node_path7.resolve)(SDK_PACKAGE_ROOT, "..");
4849
+ var MODULE_DIR = (0, import_node_path8.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url));
4850
+ var SDK_PACKAGE_ROOT = (0, import_node_path8.resolve)(MODULE_DIR, "..", "..");
4851
+ var SOURCE_REPO_ROOT = (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "..");
4720
4852
  var HAS_SOURCE_BUNDLING_SOURCES = (0, import_node_fs5.existsSync)(
4721
- (0, import_node_path7.resolve)(SOURCE_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4853
+ (0, import_node_path8.resolve)(SOURCE_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4722
4854
  );
4723
- var PACKAGED_REPO_ROOT = (0, import_node_path7.resolve)(SDK_PACKAGE_ROOT, "dist", "repo");
4855
+ var PACKAGED_REPO_ROOT = (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "dist", "repo");
4724
4856
  var HAS_PACKAGED_BUNDLING_SOURCES = (0, import_node_fs5.existsSync)(
4725
- (0, import_node_path7.resolve)(PACKAGED_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4857
+ (0, import_node_path8.resolve)(PACKAGED_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4726
4858
  );
4727
- var PROJECT_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? SOURCE_REPO_ROOT : HAS_PACKAGED_BUNDLING_SOURCES ? PACKAGED_REPO_ROOT : (0, import_node_path7.resolve)(SDK_PACKAGE_ROOT, "..");
4728
- var SDK_SOURCE_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? (0, import_node_path7.resolve)(SOURCE_REPO_ROOT, "sdk", "src") : HAS_PACKAGED_BUNDLING_SOURCES ? (0, import_node_path7.resolve)(PACKAGED_REPO_ROOT, "sdk", "src") : (0, import_node_path7.resolve)(SDK_PACKAGE_ROOT, "src");
4729
- var SDK_PACKAGE_JSON = (0, import_node_path7.resolve)(SDK_PACKAGE_ROOT, "package.json");
4730
- var SDK_ENTRY_FILE = (0, import_node_path7.resolve)(SDK_SOURCE_ROOT, "index.ts");
4731
- var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : (0, import_node_path7.resolve)(SDK_PACKAGE_ROOT, "dist", "index.d.ts");
4732
- var SDK_WORKERS_ENTRY_FILE = (0, import_node_path7.resolve)(SDK_SOURCE_ROOT, "worker-play-entry.ts");
4733
- var WORKERS_HARNESS_ENTRY_FILE = (0, import_node_path7.resolve)(PROJECT_ROOT, "apps", "play-runner-workers", "src", "entry.ts");
4734
- var WORKERS_HARNESS_FILES_DIR = (0, import_node_path7.resolve)(PROJECT_ROOT, "apps", "play-runner-workers", "src");
4859
+ var PROJECT_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? SOURCE_REPO_ROOT : HAS_PACKAGED_BUNDLING_SOURCES ? PACKAGED_REPO_ROOT : (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "..");
4860
+ var SDK_SOURCE_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? (0, import_node_path8.resolve)(SOURCE_REPO_ROOT, "sdk", "src") : HAS_PACKAGED_BUNDLING_SOURCES ? (0, import_node_path8.resolve)(PACKAGED_REPO_ROOT, "sdk", "src") : (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "src");
4861
+ var SDK_PACKAGE_JSON = (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "package.json");
4862
+ var SDK_ENTRY_FILE = (0, import_node_path8.resolve)(SDK_SOURCE_ROOT, "index.ts");
4863
+ var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "dist", "index.d.ts");
4864
+ var SDK_WORKERS_ENTRY_FILE = (0, import_node_path8.resolve)(SDK_SOURCE_ROOT, "worker-play-entry.ts");
4865
+ var WORKERS_HARNESS_ENTRY_FILE = (0, import_node_path8.resolve)(PROJECT_ROOT, "apps", "play-runner-workers", "src", "entry.ts");
4866
+ var WORKERS_HARNESS_FILES_DIR = (0, import_node_path8.resolve)(PROJECT_ROOT, "apps", "play-runner-workers", "src");
4735
4867
  var hasWarnedAboutNonDevelopmentBundling = false;
4736
4868
  function warnAboutNonDevelopmentBundling(filePath) {
4737
4869
  if (hasWarnedAboutNonDevelopmentBundling) {
@@ -4755,8 +4887,8 @@ function defaultPlayBundleTarget() {
4755
4887
  function createSdkPlayBundlingAdapter() {
4756
4888
  return {
4757
4889
  projectRoot: PROJECT_ROOT,
4758
- nodeModulesDir: (0, import_node_path7.resolve)(PROJECT_ROOT, "node_modules"),
4759
- cacheDir: (0, import_node_path7.join)((0, import_node_os5.tmpdir)(), `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION2}`),
4890
+ nodeModulesDir: (0, import_node_path8.resolve)(PROJECT_ROOT, "node_modules"),
4891
+ cacheDir: (0, import_node_path8.join)((0, import_node_os5.tmpdir)(), `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION2}`),
4760
4892
  sdkSourceRoot: SDK_SOURCE_ROOT,
4761
4893
  sdkPackageJson: SDK_PACKAGE_JSON,
4762
4894
  sdkEntryFile: SDK_ENTRY_FILE,
@@ -5036,7 +5168,7 @@ function formatPlayListReference(play) {
5036
5168
  function defaultMaterializedPlayPath(reference) {
5037
5169
  const playName = parseReferencedPlayTarget(reference).unqualifiedPlayName;
5038
5170
  const safeName = playName.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
5039
- return (0, import_node_path8.resolve)(`${safeName || "play"}.play.ts`);
5171
+ return (0, import_node_path9.resolve)(`${safeName || "play"}.play.ts`);
5040
5172
  }
5041
5173
  function materializeRemotePlaySource(input) {
5042
5174
  if (isFileTarget(input.target)) {
@@ -5099,7 +5231,7 @@ function extractPlayName(code, filePath) {
5099
5231
  throw buildMissingDefinePlayError(filePath);
5100
5232
  }
5101
5233
  function isFileTarget(target) {
5102
- return (0, import_node_fs6.existsSync)((0, import_node_path8.resolve)(target));
5234
+ return (0, import_node_fs6.existsSync)((0, import_node_path9.resolve)(target));
5103
5235
  }
5104
5236
  function looksLikeFilePath(target) {
5105
5237
  if (target.trim().toLowerCase().startsWith("prebuilt/")) {
@@ -5118,7 +5250,7 @@ function parsePositiveInteger2(value, flagName) {
5118
5250
  return parsed;
5119
5251
  }
5120
5252
  function parseJsonInput(raw) {
5121
- const source = raw.startsWith("@") ? (0, import_node_fs6.readFileSync)((0, import_node_path8.resolve)(raw.slice(1)), "utf-8") : raw;
5253
+ const source = raw.startsWith("@") ? (0, import_node_fs6.readFileSync)((0, import_node_path9.resolve)(raw.slice(1)), "utf-8") : raw;
5122
5254
  const parsed = JSON.parse(source);
5123
5255
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
5124
5256
  throw new Error("--input must be a JSON object.");
@@ -5228,7 +5360,7 @@ function applyCsvShortcutInput(input) {
5228
5360
  function isLocalFilePathValue(value) {
5229
5361
  if (typeof value !== "string" || !value.trim()) return false;
5230
5362
  if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value.trim())) return false;
5231
- return (0, import_node_fs6.existsSync)((0, import_node_path8.resolve)(value));
5363
+ return (0, import_node_fs6.existsSync)((0, import_node_path9.resolve)(value));
5232
5364
  }
5233
5365
  function inputContainsLocalFilePath(value) {
5234
5366
  if (isLocalFilePathValue(value)) {
@@ -5254,8 +5386,8 @@ async function stageFileInputArgs(input) {
5254
5386
  const localFiles = uniqueBindings.flatMap((binding) => {
5255
5387
  const value = getDottedInputValue(input.runtimeInput, binding.inputPath);
5256
5388
  if (!isLocalFilePathValue(value)) return [];
5257
- const absolutePath = (0, import_node_path8.resolve)(value);
5258
- return [{ binding, absolutePath, logicalPath: (0, import_node_path8.basename)(absolutePath) }];
5389
+ const absolutePath = (0, import_node_path9.resolve)(value);
5390
+ return [{ binding, absolutePath, logicalPath: (0, import_node_path9.basename)(absolutePath) }];
5259
5391
  });
5260
5392
  if (localFiles.length === 0) {
5261
5393
  return { inputFile: null, packagedFiles: [] };
@@ -5290,9 +5422,9 @@ function stageFile(logicalPath, absolutePath) {
5290
5422
  }
5291
5423
  function normalizePlayPath(filePath) {
5292
5424
  try {
5293
- return import_node_fs6.realpathSync.native((0, import_node_path8.resolve)(filePath));
5425
+ return import_node_fs6.realpathSync.native((0, import_node_path9.resolve)(filePath));
5294
5426
  } catch {
5295
- return (0, import_node_path8.resolve)(filePath);
5427
+ return (0, import_node_path9.resolve)(filePath);
5296
5428
  }
5297
5429
  }
5298
5430
  function formatBundlingErrors(filePath, errors) {
@@ -6352,7 +6484,7 @@ function parsePlayRunOptions(args) {
6352
6484
  continue;
6353
6485
  }
6354
6486
  if (arg === "--out" && args[index + 1]) {
6355
- outPath = (0, import_node_path8.resolve)(args[++index]);
6487
+ outPath = (0, import_node_path9.resolve)(args[++index]);
6356
6488
  continue;
6357
6489
  }
6358
6490
  if (arg === "--poll-interval-ms" || arg === "--interval-ms") {
@@ -6452,11 +6584,11 @@ function shouldUseLocalOnlyPlayCheck() {
6452
6584
  async function handlePlayCheck(args) {
6453
6585
  const options = parsePlayCheckOptions(args);
6454
6586
  if (!isFileTarget(options.target)) {
6455
- const resolved = (0, import_node_path8.resolve)(options.target);
6587
+ const resolved = (0, import_node_path9.resolve)(options.target);
6456
6588
  console.error(`File not found: ${resolved}`);
6457
6589
  return 1;
6458
6590
  }
6459
- const absolutePlayPath = (0, import_node_path8.resolve)(options.target);
6591
+ const absolutePlayPath = (0, import_node_path9.resolve)(options.target);
6460
6592
  const sourceCode = (0, import_node_fs6.readFileSync)(absolutePlayPath, "utf-8");
6461
6593
  let graph;
6462
6594
  try {
@@ -6520,7 +6652,7 @@ async function handleFileBackedRun(options) {
6520
6652
  }
6521
6653
  const client = new DeeplineClient();
6522
6654
  const progress = getActiveCliProgress() ?? createCliProgress(!options.jsonOutput);
6523
- const absolutePlayPath = (0, import_node_path8.resolve)(options.target.path);
6655
+ const absolutePlayPath = (0, import_node_path9.resolve)(options.target.path);
6524
6656
  progress.phase("compiling play");
6525
6657
  const sourceCode = traceCliSync(
6526
6658
  "cli.play_file_read_source",
@@ -6809,11 +6941,11 @@ async function handlePlayRun(args) {
6809
6941
  if (isFileTarget(options.target.path)) {
6810
6942
  return handleFileBackedRun(options);
6811
6943
  }
6812
- const resolved = (0, import_node_path8.resolve)(options.target.path);
6944
+ const resolved = (0, import_node_path9.resolve)(options.target.path);
6813
6945
  console.error(`File not found: ${resolved}`);
6814
- const dir = (0, import_node_path8.dirname)(resolved);
6946
+ const dir = (0, import_node_path9.dirname)(resolved);
6815
6947
  if ((0, import_node_fs6.existsSync)(dir)) {
6816
- const base = (0, import_node_path8.basename)(resolved);
6948
+ const base = (0, import_node_path9.basename)(resolved);
6817
6949
  try {
6818
6950
  const siblings = (0, import_node_fs6.readdirSync)(dir).filter(
6819
6951
  (f) => f.includes(base.replace(/\.(play\.)?ts$/, "")) || f.endsWith(".play.ts")
@@ -6821,7 +6953,7 @@ async function handlePlayRun(args) {
6821
6953
  if (siblings.length > 0) {
6822
6954
  console.error(`Did you mean one of these?`);
6823
6955
  for (const s of siblings.slice(0, 5)) {
6824
- console.error(` ${(0, import_node_path8.join)(dir, s)}`);
6956
+ console.error(` ${(0, import_node_path9.join)(dir, s)}`);
6825
6957
  }
6826
6958
  }
6827
6959
  } catch {
@@ -6967,7 +7099,7 @@ async function handleRunLogs(args) {
6967
7099
  continue;
6968
7100
  }
6969
7101
  if (arg === "--out" && args[index + 1]) {
6970
- outPath = (0, import_node_path8.resolve)(args[++index]);
7102
+ outPath = (0, import_node_path9.resolve)(args[++index]);
6971
7103
  }
6972
7104
  }
6973
7105
  const client = new DeeplineClient();
@@ -7054,7 +7186,7 @@ async function handleRunExport(args) {
7054
7186
  for (let index = 0; index < args.length; index += 1) {
7055
7187
  const arg = args[index];
7056
7188
  if (arg === "--out" && args[index + 1]) {
7057
- outPath = (0, import_node_path8.resolve)(args[++index]);
7189
+ outPath = (0, import_node_path9.resolve)(args[++index]);
7058
7190
  }
7059
7191
  }
7060
7192
  if (!outPath) {
@@ -7094,10 +7226,10 @@ async function handlePlayGet(args) {
7094
7226
  for (let index = 1; index < args.length; index += 1) {
7095
7227
  const arg = args[index];
7096
7228
  if (arg === "--out" && args[index + 1]) {
7097
- outPath = (0, import_node_path8.resolve)(args[++index]);
7229
+ outPath = (0, import_node_path9.resolve)(args[++index]);
7098
7230
  }
7099
7231
  }
7100
- const playName = isFileTarget(target) ? extractPlayName((0, import_node_fs6.readFileSync)((0, import_node_path8.resolve)(target), "utf-8"), (0, import_node_path8.resolve)(target)) : parseReferencedPlayTarget(target).playName;
7232
+ const playName = isFileTarget(target) ? extractPlayName((0, import_node_fs6.readFileSync)((0, import_node_path9.resolve)(target), "utf-8"), (0, import_node_path9.resolve)(target)) : parseReferencedPlayTarget(target).playName;
7101
7233
  const detail = isFileTarget(target) ? await client.getPlay(playName) : await assertCanonicalNamedPlayReference(client, target);
7102
7234
  const resolvedSource = detail.play.workingRevision?.sourceCode ?? detail.play.liveRevision?.sourceCode ?? detail.play.currentRevision?.sourceCode ?? detail.play.sourceCode ?? "";
7103
7235
  const materializedFile = outPath ? materializeRemotePlaySource({
@@ -7389,7 +7521,7 @@ async function handlePlayPublish(args) {
7389
7521
  }
7390
7522
  let graph;
7391
7523
  try {
7392
- graph = await collectBundledPlayGraph((0, import_node_path8.resolve)(playName));
7524
+ graph = await collectBundledPlayGraph((0, import_node_path9.resolve)(playName));
7393
7525
  await compileBundledPlayGraphManifests(client, graph);
7394
7526
  await publishImportedPlayDependencies(client, graph);
7395
7527
  } catch (error) {
@@ -7885,12 +8017,12 @@ Examples:
7885
8017
  // src/cli/commands/tools.ts
7886
8018
  var import_node_fs8 = require("fs");
7887
8019
  var import_node_os7 = require("os");
7888
- var import_node_path10 = require("path");
8020
+ var import_node_path11 = require("path");
7889
8021
 
7890
8022
  // src/tool-output.ts
7891
8023
  var import_node_fs7 = require("fs");
7892
8024
  var import_node_os6 = require("os");
7893
- var import_node_path9 = require("path");
8025
+ var import_node_path10 = require("path");
7894
8026
  function isPlainObject(value) {
7895
8027
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
7896
8028
  }
@@ -7965,19 +8097,19 @@ function tryConvertToList(payload, options) {
7965
8097
  return null;
7966
8098
  }
7967
8099
  function ensureOutputDir() {
7968
- const outputDir = (0, import_node_path9.join)((0, import_node_os6.homedir)(), ".local", "share", "deepline", "data");
8100
+ const outputDir = (0, import_node_path10.join)((0, import_node_os6.homedir)(), ".local", "share", "deepline", "data");
7969
8101
  (0, import_node_fs7.mkdirSync)(outputDir, { recursive: true });
7970
8102
  return outputDir;
7971
8103
  }
7972
8104
  function writeJsonOutputFile(payload, stem) {
7973
8105
  const outputDir = ensureOutputDir();
7974
- const outputPath = (0, import_node_path9.join)(outputDir, `${stem}_${Date.now()}.json`);
8106
+ const outputPath = (0, import_node_path10.join)(outputDir, `${stem}_${Date.now()}.json`);
7975
8107
  (0, import_node_fs7.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
7976
8108
  return outputPath;
7977
8109
  }
7978
8110
  function writeCsvOutputFile(rows, stem) {
7979
8111
  const outputDir = ensureOutputDir();
7980
- const outputPath = (0, import_node_path9.join)(outputDir, `${stem}_${Date.now()}.csv`);
8112
+ const outputPath = (0, import_node_path10.join)(outputDir, `${stem}_${Date.now()}.csv`);
7981
8113
  const seen = /* @__PURE__ */ new Set();
7982
8114
  const columns = [];
7983
8115
  for (const row of rows) {
@@ -8537,9 +8669,9 @@ function powerShellQuote(value) {
8537
8669
  function seedToolListScript(input) {
8538
8670
  const stem = safeFileStem(input.toolId);
8539
8671
  const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
8540
- const scriptDir = (0, import_node_fs8.mkdtempSync)((0, import_node_path10.join)((0, import_node_os7.tmpdir)(), "deepline-workflow-seed-"));
8672
+ const scriptDir = (0, import_node_fs8.mkdtempSync)((0, import_node_path11.join)((0, import_node_os7.tmpdir)(), "deepline-workflow-seed-"));
8541
8673
  (0, import_node_fs8.chmodSync)(scriptDir, 448);
8542
- const scriptPath = (0, import_node_path10.join)(scriptDir, fileName);
8674
+ const scriptPath = (0, import_node_path11.join)(scriptDir, fileName);
8543
8675
  const projectDir = `deepline/projects/${stem}-workflow`;
8544
8676
  const playName = `${stem}-workflow`;
8545
8677
  const sampleRows = input.rows.length > 0 ? `${JSON.stringify(input.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
@@ -8682,7 +8814,7 @@ async function executeTool(args) {
8682
8814
  var import_node_child_process2 = require("child_process");
8683
8815
  var import_node_fs9 = require("fs");
8684
8816
  var import_node_os8 = require("os");
8685
- var import_node_path11 = require("path");
8817
+ var import_node_path12 = require("path");
8686
8818
  var CHECK_TIMEOUT_MS2 = 3e3;
8687
8819
  var SDK_SKILL_NAME = "deepline-sdk";
8688
8820
  var SKILL_AGENTS = ["codex", "claude-code", "cursor"];
@@ -8693,7 +8825,7 @@ function shouldSkipSkillsSync() {
8693
8825
  }
8694
8826
  function sdkSkillsVersionPath(baseUrl) {
8695
8827
  const home = process.env.HOME?.trim() || (0, import_node_os8.homedir)();
8696
- return (0, import_node_path11.join)(home, ".local", "deepline", baseUrlSlug(baseUrl), "sdk-skills", ".version");
8828
+ return (0, import_node_path12.join)(home, ".local", "deepline", baseUrlSlug(baseUrl), "sdk-skills", ".version");
8697
8829
  }
8698
8830
  function readLocalSkillsVersion(baseUrl) {
8699
8831
  const path = sdkSkillsVersionPath(baseUrl);
@@ -8706,7 +8838,7 @@ function readLocalSkillsVersion(baseUrl) {
8706
8838
  }
8707
8839
  function writeLocalSkillsVersion(baseUrl, version) {
8708
8840
  const path = sdkSkillsVersionPath(baseUrl);
8709
- (0, import_node_fs9.mkdirSync)((0, import_node_path11.dirname)(path), { recursive: true });
8841
+ (0, import_node_fs9.mkdirSync)((0, import_node_path12.dirname)(path), { recursive: true });
8710
8842
  (0, import_node_fs9.writeFileSync)(path, `${version}
8711
8843
  `, "utf-8");
8712
8844
  }
@@ -8801,7 +8933,7 @@ function resolveSkillsInstallCommands(baseUrl) {
8801
8933
  return [npxInstall];
8802
8934
  }
8803
8935
  function runOneSkillsInstall(install) {
8804
- return new Promise((resolve8) => {
8936
+ return new Promise((resolve9) => {
8805
8937
  const child = (0, import_node_child_process2.spawn)(install.command, install.args, {
8806
8938
  stdio: ["ignore", "ignore", "pipe"],
8807
8939
  env: process.env
@@ -8811,7 +8943,7 @@ function runOneSkillsInstall(install) {
8811
8943
  stderr += chunk.toString("utf-8");
8812
8944
  });
8813
8945
  child.on("error", (error) => {
8814
- resolve8({
8946
+ resolve9({
8815
8947
  ok: false,
8816
8948
  detail: `failed to start ${install.command}: ${error.message}`,
8817
8949
  manualCommand: install.manualCommand
@@ -8819,11 +8951,11 @@ function runOneSkillsInstall(install) {
8819
8951
  });
8820
8952
  child.on("close", (code) => {
8821
8953
  if (code === 0) {
8822
- resolve8({ ok: true, detail: "", manualCommand: install.manualCommand });
8954
+ resolve9({ ok: true, detail: "", manualCommand: install.manualCommand });
8823
8955
  return;
8824
8956
  }
8825
8957
  const detail = stderr.trim();
8826
- resolve8({
8958
+ resolve9({
8827
8959
  ok: false,
8828
8960
  detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
8829
8961
  manualCommand: install.manualCommand
@@ -8900,7 +9032,7 @@ async function main() {
8900
9032
  if (printStartupPhase) {
8901
9033
  progress?.phase("loading deepline cli");
8902
9034
  }
8903
- const program = new import_commander.Command();
9035
+ const program = new import_commander2.Command();
8904
9036
  program.name("deepline").description("Deepline CLI (TypeScript SDK)").version(SDK_VERSION, "-v, --version", "Show version").showHelpAfterError().showSuggestionAfterError(true).addHelpText(
8905
9037
  "after",
8906
9038
  `