deepline 0.1.24 → 0.1.26

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli/index.ts
4
- import { Command } from "commander";
4
+ import { Command as Command2 } from "commander";
5
5
 
6
6
  // src/config.ts
7
7
  import { readFileSync, existsSync, mkdirSync, writeFileSync } from "fs";
@@ -243,7 +243,7 @@ function saveProjectDeeplineEnvValues(baseUrl, values, startDir = projectEnvStar
243
243
  }
244
244
 
245
245
  // src/version.ts
246
- var SDK_VERSION = "0.1.24";
246
+ var SDK_VERSION = "0.1.26";
247
247
  var SDK_API_CONTRACT = "2026-05-runs-v2";
248
248
 
249
249
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -525,7 +525,7 @@ function decodeSseFrame(frame) {
525
525
  return parsed;
526
526
  }
527
527
  function sleep(ms) {
528
- return new Promise((resolve8) => setTimeout(resolve8, ms));
528
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
529
529
  }
530
530
 
531
531
  // src/client.ts
@@ -533,7 +533,7 @@ var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "ca
533
533
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
534
534
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
535
535
  function sleep2(ms) {
536
- return new Promise((resolve8) => setTimeout(resolve8, ms));
536
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
537
537
  }
538
538
  function isTransientCompileManifestError(error) {
539
539
  if (error instanceof DeeplineError && typeof error.statusCode === "number") {
@@ -588,7 +588,7 @@ function updatePlayLiveStatusState(state, event) {
588
588
  const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
589
589
  const status = normalizeLiveStatus(payload.status) ?? state.status;
590
590
  const logs = readStringArray(payload.logs);
591
- if (logs.length > 0 || event.type === "play.run.snapshot") {
591
+ if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
592
592
  state.logs = logs;
593
593
  }
594
594
  if ("result" in payload) {
@@ -2023,7 +2023,7 @@ function buildCandidateUrls2(url) {
2023
2023
  }
2024
2024
  }
2025
2025
  function sleep3(ms) {
2026
- return new Promise((resolve8) => setTimeout(resolve8, ms));
2026
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
2027
2027
  }
2028
2028
  function printDeeplineLogo() {
2029
2029
  if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
@@ -2397,6 +2397,10 @@ Examples:
2397
2397
  }
2398
2398
 
2399
2399
  // src/cli/commands/billing.ts
2400
+ import { Command } from "commander";
2401
+ import { appendFile, mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
2402
+ import { dirname as dirname4, resolve as resolve3 } from "path";
2403
+ import { stringify as stringify2 } from "csv-stringify/sync";
2400
2404
  function humanize(value) {
2401
2405
  return String(value || "").split("_").filter(Boolean).map((token) => token[0]?.toUpperCase() + token.slice(1)).join(" ") || "Unknown";
2402
2406
  }
@@ -2414,6 +2418,54 @@ function printRecentUsage(entries) {
2414
2418
  `);
2415
2419
  }
2416
2420
  }
2421
+ function summarizeLedgerRows(summary, rows) {
2422
+ const netDelta = rows.reduce((sum, row) => {
2423
+ const value = Number.parseFloat(String(row.delta_credits ?? "").trim());
2424
+ return Number.isFinite(value) ? sum + value : sum;
2425
+ }, summary.net_delta_credits);
2426
+ return {
2427
+ row_count: summary.row_count + rows.length,
2428
+ net_delta_credits: Math.round((netDelta + Number.EPSILON) * 100) / 100
2429
+ };
2430
+ }
2431
+ function ledgerApiEntryToRow(entry) {
2432
+ const metadata = typeof entry.metadata === "object" && entry.metadata !== null ? entry.metadata : {};
2433
+ return {
2434
+ created_at: entry.created_at ?? "",
2435
+ delta_credits: entry.delta ?? "",
2436
+ reason: entry.reason ?? "",
2437
+ provider: metadata.provider ?? "",
2438
+ operation: metadata.operation ?? "",
2439
+ request_id: metadata.requestId ?? metadata.request_id ?? "",
2440
+ run_id: metadata.runId ?? metadata.run_id ?? "",
2441
+ api_key_id: entry.api_key_id ?? "",
2442
+ stripe_session_id: entry.stripe_session_id ?? ""
2443
+ };
2444
+ }
2445
+ function ledgerRowsToCsv(rows, header) {
2446
+ return stringify2(rows, {
2447
+ header,
2448
+ columns: [
2449
+ "created_at",
2450
+ "delta_credits",
2451
+ "reason",
2452
+ "provider",
2453
+ "operation",
2454
+ "request_id",
2455
+ "run_id",
2456
+ "api_key_id",
2457
+ "stripe_session_id"
2458
+ ]
2459
+ });
2460
+ }
2461
+ function defaultLedgerExportPath() {
2462
+ return resolve3(
2463
+ process.cwd(),
2464
+ "deepline",
2465
+ "data",
2466
+ `billing-ledger-all-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.csv`
2467
+ );
2468
+ }
2417
2469
  async function handleBalance(options) {
2418
2470
  const { http } = getAuthedHttpClient();
2419
2471
  const payload = await http.get("/api/v2/billing/balance");
@@ -2502,6 +2554,51 @@ async function handleHistory(options) {
2502
2554
  process.stdout.write(`${rows.length} row(s) exported.
2503
2555
  `);
2504
2556
  }
2557
+ async function handleLedgerExportAll(options) {
2558
+ const { http } = getAuthedHttpClient();
2559
+ const outputPath = options.output ? resolve3(String(options.output)) : defaultLedgerExportPath();
2560
+ let summary = { row_count: 0, net_delta_credits: 0 };
2561
+ let cursor = null;
2562
+ let initializedOutput = false;
2563
+ for (; ; ) {
2564
+ const params = new URLSearchParams({ limit: "5000" });
2565
+ if (cursor !== null) params.set("cursor", cursor);
2566
+ const payload = await http.get(
2567
+ `/api/v2/billing/ledger?${params.toString()}`
2568
+ );
2569
+ const entries = Array.isArray(payload.entries) ? payload.entries : [];
2570
+ const rows = entries.map(ledgerApiEntryToRow);
2571
+ if (!initializedOutput) {
2572
+ await mkdir2(dirname4(outputPath), { recursive: true });
2573
+ await writeFile2(outputPath, ledgerRowsToCsv([], true), "utf-8");
2574
+ initializedOutput = true;
2575
+ }
2576
+ if (rows.length > 0) {
2577
+ await appendFile(outputPath, ledgerRowsToCsv(rows, false), "utf-8");
2578
+ summary = summarizeLedgerRows(summary, rows);
2579
+ }
2580
+ const nextCursor = typeof payload.next_cursor === "string" && payload.next_cursor.length > 0 ? payload.next_cursor : null;
2581
+ if (rows.length === 0 || payload.has_more !== true || nextCursor === null) {
2582
+ break;
2583
+ }
2584
+ if (nextCursor === cursor) break;
2585
+ cursor = nextCursor;
2586
+ }
2587
+ if (shouldEmitJson(options.json)) {
2588
+ return printJson({
2589
+ output_path: outputPath,
2590
+ row_count: summary.row_count,
2591
+ net_delta_credits: summary.net_delta_credits,
2592
+ scope: "current_auth_context"
2593
+ });
2594
+ }
2595
+ process.stdout.write(`Billing ledger written to ${outputPath}
2596
+ `);
2597
+ process.stdout.write(`${summary.row_count} row(s) exported for the current auth context.
2598
+ `);
2599
+ process.stdout.write(`Net ledger delta: ${summary.net_delta_credits} Deepline Credits
2600
+ `);
2601
+ }
2505
2602
  async function handleCheckout(options) {
2506
2603
  const { http } = getAuthedHttpClient();
2507
2604
  const payload = await http.post("/api/v2/billing/checkout", {
@@ -2598,6 +2695,41 @@ Examples:
2598
2695
  deepline billing off --json
2599
2696
  `
2600
2697
  ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLimitOff);
2698
+ billing.command("ledger").description("Inspect and export billing ledger rows.").addHelpText(
2699
+ "after",
2700
+ `
2701
+ Notes:
2702
+ Read-only. Exports ledger rows for the current auth context. API-key auth is
2703
+ scoped by the server to that API key; session auth is scoped to the active
2704
+ workspace.
2705
+
2706
+ Examples:
2707
+ deepline billing ledger export all
2708
+ deepline billing ledger export all --output ./ledger.csv
2709
+ deepline billing ledger export all --json
2710
+ `
2711
+ ).addCommand(
2712
+ new Command("export").description("Export billing ledger rows.").addHelpText(
2713
+ "after",
2714
+ `
2715
+ Examples:
2716
+ deepline billing ledger export all
2717
+ `
2718
+ ).addCommand(
2719
+ new Command("all").description("Export all available billing ledger rows to CSV.").addHelpText(
2720
+ "after",
2721
+ `
2722
+ Notes:
2723
+ Pages through the ledger for the current auth context, writes CSV locally,
2724
+ then reports the row count and the net delta computed from delta_credits.
2725
+
2726
+ Examples:
2727
+ deepline billing ledger export all
2728
+ deepline billing ledger export all --json
2729
+ `
2730
+ ).option("--output <path>", "Write CSV to an explicit path").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLedgerExportAll)
2731
+ )
2732
+ );
2601
2733
  billing.command("history").description("Export billing ledger history to CSV.").addHelpText(
2602
2734
  "after",
2603
2735
  `
@@ -2639,7 +2771,7 @@ Examples:
2639
2771
 
2640
2772
  // src/cli/dataset-stats.ts
2641
2773
  import { writeFileSync as writeFileSync4 } from "fs";
2642
- import { resolve as resolve3 } from "path";
2774
+ import { resolve as resolve4 } from "path";
2643
2775
  var CSV_PROJECTED_FIELDS_KEY = "__deeplineCsvProjectedFields";
2644
2776
  function csvProjectedFields(row) {
2645
2777
  const serialized = row[CSV_PROJECTED_FIELDS_KEY];
@@ -2969,7 +3101,7 @@ function writeCanonicalRowsCsv(rowsInfo, outPath) {
2969
3101
  rows: rowsInfo.rows,
2970
3102
  columns: rowsInfo.columns
2971
3103
  });
2972
- const resolved = resolve3(outPath);
3104
+ const resolved = resolve4(outPath);
2973
3105
  writeFileSync4(
2974
3106
  resolved,
2975
3107
  csvStringFromRows(sanitized.rows, sanitized.columns),
@@ -3364,26 +3496,27 @@ Examples:
3364
3496
  // src/cli/commands/play.ts
3365
3497
  import { createHash as createHash3 } from "crypto";
3366
3498
  import {
3367
- existsSync as existsSync5,
3368
- readFileSync as readFileSync3,
3499
+ existsSync as existsSync6,
3500
+ readFileSync as readFileSync4,
3369
3501
  readdirSync,
3370
3502
  realpathSync,
3371
3503
  writeFileSync as writeFileSync5
3372
3504
  } from "fs";
3373
- import { basename as basename3, dirname as dirname7, join as join6, resolve as resolve7 } from "path";
3505
+ import { basename as basename3, dirname as dirname8, join as join6, resolve as resolve8 } from "path";
3374
3506
 
3375
3507
  // src/plays/bundle-play-file.ts
3376
3508
  import { tmpdir as tmpdir2 } from "os";
3377
- import { dirname as dirname6, join as join5, resolve as resolve6 } from "path";
3509
+ import { dirname as dirname7, join as join5, resolve as resolve7 } from "path";
3378
3510
  import { fileURLToPath } from "url";
3379
- import { existsSync as existsSync4 } from "fs";
3511
+ import { existsSync as existsSync5 } from "fs";
3380
3512
 
3381
3513
  // ../shared_libs/plays/bundling/index.ts
3382
3514
  import { createHash } from "crypto";
3383
- import { mkdir as mkdir2, readFile, realpath, stat, writeFile as writeFile2 } from "fs/promises";
3515
+ import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
3516
+ import { mkdir as mkdir3, readFile, realpath, stat, writeFile as writeFile3 } from "fs/promises";
3384
3517
  import { tmpdir } from "os";
3385
- import { basename, dirname as dirname4, extname, isAbsolute, join as join3, resolve as resolve4 } from "path";
3386
- import { builtinModules, createRequire } from "module";
3518
+ import { basename, dirname as dirname5, extname, isAbsolute, join as join3, resolve as resolve5 } from "path";
3519
+ import { builtinModules } from "module";
3387
3520
  import { build } from "esbuild";
3388
3521
 
3389
3522
  // ../shared_libs/play-runtime/backend.ts
@@ -3438,7 +3571,6 @@ function buildPlayContractCompatibility(input) {
3438
3571
  }
3439
3572
 
3440
3573
  // ../shared_libs/plays/bundling/index.ts
3441
- var playArtifactRequire = createRequire(import.meta.url);
3442
3574
  var PLAY_BUNDLE_CACHE_VERSION = 24;
3443
3575
  var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
3444
3576
  var MAX_ESM_WORKERS_BUNDLE_BYTES = 115e4;
@@ -3475,13 +3607,13 @@ async function normalizeLocalPath(filePath) {
3475
3607
  try {
3476
3608
  return await realpath(filePath);
3477
3609
  } catch {
3478
- return resolve4(filePath);
3610
+ return resolve5(filePath);
3479
3611
  }
3480
3612
  }
3481
3613
  function createPlayWorkspace(entryFile) {
3482
3614
  return {
3483
3615
  entryFile,
3484
- rootDir: dirname4(entryFile)
3616
+ rootDir: dirname5(entryFile)
3485
3617
  };
3486
3618
  }
3487
3619
  function isPathInsideDirectory(filePath, directory) {
@@ -3605,7 +3737,7 @@ function findMatchingBrace(source, openIndex) {
3605
3737
  }
3606
3738
  return -1;
3607
3739
  }
3608
- function extractDefinedPlayName(sourceCode, _filePath) {
3740
+ function extractDefinedPlayName(sourceCode) {
3609
3741
  const source = stripCommentsToSpaces(sourceCode);
3610
3742
  const callPattern = /(?:\b[A-Za-z_$][\w$]*\s*\.\s*)?\b(?:definePlay|defineWorkflow)\s*\(/g;
3611
3743
  for (const match of source.matchAll(callPattern)) {
@@ -3632,17 +3764,61 @@ function extractDefinedPlayName(sourceCode, _filePath) {
3632
3764
  }
3633
3765
  return null;
3634
3766
  }
3635
- function getPackageRequireCandidates(fromFile) {
3636
- const candidates = [
3637
- createRequire(fromFile),
3638
- createRequire(join3(process.cwd(), "package.json")),
3639
- playArtifactRequire
3767
+ function readPackageVersionFromPackageJson(packageJsonPath, packageName) {
3768
+ try {
3769
+ const packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
3770
+ if (packageJson.name === packageName && typeof packageJson.version === "string") {
3771
+ return packageJson.version;
3772
+ }
3773
+ } catch {
3774
+ return null;
3775
+ }
3776
+ return null;
3777
+ }
3778
+ function findPackageJsonPathFrom(startDir, packageName) {
3779
+ let current = resolve5(startDir);
3780
+ while (true) {
3781
+ const packageJsonPath = join3(
3782
+ current,
3783
+ "node_modules",
3784
+ packageName,
3785
+ "package.json"
3786
+ );
3787
+ if (existsSync4(packageJsonPath)) {
3788
+ return packageJsonPath;
3789
+ }
3790
+ const parent = dirname5(current);
3791
+ if (parent === current) {
3792
+ return null;
3793
+ }
3794
+ current = parent;
3795
+ }
3796
+ }
3797
+ function findPackageJsonPath(packageName, fromFile, adapter) {
3798
+ const startDirs = [
3799
+ dirname5(fromFile),
3800
+ adapter.projectRoot,
3801
+ dirname5(adapter.sdkPackageJson),
3802
+ process.cwd()
3640
3803
  ];
3641
- return candidates;
3804
+ const seen = /* @__PURE__ */ new Set();
3805
+ for (const startDir of startDirs) {
3806
+ const normalized = resolve5(startDir);
3807
+ if (seen.has(normalized)) continue;
3808
+ seen.add(normalized);
3809
+ const packageJsonPath = findPackageJsonPathFrom(normalized, packageName);
3810
+ if (packageJsonPath) return packageJsonPath;
3811
+ }
3812
+ const adapterNodeModulesPackageJson = join3(
3813
+ adapter.nodeModulesDir,
3814
+ packageName,
3815
+ "package.json"
3816
+ );
3817
+ return existsSync4(adapterNodeModulesPackageJson) ? adapterNodeModulesPackageJson : null;
3642
3818
  }
3643
3819
  function localSdkAliasPlugin(adapter, options) {
3644
3820
  const entryFile = options?.workersRuntime ? adapter.sdkWorkersEntryFile : adapter.sdkEntryFile;
3645
- if (!playArtifactRequire("node:fs").existsSync(entryFile)) {
3821
+ if (!existsSync4(entryFile)) {
3646
3822
  return null;
3647
3823
  }
3648
3824
  return {
@@ -3682,7 +3858,7 @@ function workersNamedPlayEntryAliasPlugin(playFilePath, exportName) {
3682
3858
  contents: `export { ${exportName} as default } from ${JSON.stringify(playFilePath)};
3683
3859
  `,
3684
3860
  loader: "ts",
3685
- resolveDir: dirname4(playFilePath)
3861
+ resolveDir: dirname5(playFilePath)
3686
3862
  })
3687
3863
  );
3688
3864
  }
@@ -3846,7 +4022,7 @@ function importedPlayProxyPlugin(importedPlayDependencies) {
3846
4022
  return {
3847
4023
  contents: buildImportedPlayProxyModule(dependency.playName),
3848
4024
  loader: "ts",
3849
- resolveDir: dirname4(args.path)
4025
+ resolveDir: dirname5(args.path)
3850
4026
  };
3851
4027
  });
3852
4028
  }
@@ -3864,7 +4040,7 @@ async function resolveLocalImport(fromFile, specifier) {
3864
4040
  if (specifier.startsWith("file:")) {
3865
4041
  return normalizeLocalPath(new URL(specifier).pathname);
3866
4042
  }
3867
- const base = isAbsolute(specifier) ? resolve4(specifier) : resolve4(dirname4(fromFile), specifier);
4043
+ const base = isAbsolute(specifier) ? resolve5(specifier) : resolve5(dirname5(fromFile), specifier);
3868
4044
  const candidates = [base];
3869
4045
  const explicitExtension = extname(base).toLowerCase();
3870
4046
  if (!explicitExtension) {
@@ -3883,43 +4059,23 @@ async function resolveLocalImport(fromFile, specifier) {
3883
4059
  }
3884
4060
  function resolvePackageImport(specifier, fromFile, adapter) {
3885
4061
  const packageName = getPackageName(specifier);
3886
- if (packageName === "deepline" && playArtifactRequire("node:fs").existsSync(adapter.sdkPackageJson)) {
4062
+ if (packageName === "deepline" && existsSync4(adapter.sdkPackageJson)) {
3887
4063
  const packageJson = JSON.parse(
3888
- playArtifactRequire("node:fs").readFileSync(adapter.sdkPackageJson, "utf-8")
4064
+ readFileSync3(adapter.sdkPackageJson, "utf-8")
3889
4065
  );
3890
4066
  return {
3891
4067
  name: "deepline",
3892
4068
  version: packageJson.version ?? null
3893
4069
  };
3894
4070
  }
3895
- const candidateRequires = getPackageRequireCandidates(fromFile);
3896
- let resolved = false;
3897
- for (const candidateRequire of candidateRequires) {
3898
- try {
3899
- candidateRequire.resolve(specifier);
3900
- resolved = true;
3901
- break;
3902
- } catch {
3903
- continue;
3904
- }
3905
- }
3906
- if (!resolved) {
4071
+ const packageJsonPath = findPackageJsonPath(packageName, fromFile, adapter);
4072
+ if (!packageJsonPath) {
3907
4073
  throw new Error(`Could not resolve "${specifier}" from ${fromFile}`);
3908
4074
  }
3909
- let version = null;
3910
- for (const candidateRequire of candidateRequires) {
3911
- try {
3912
- const packageJsonPath = candidateRequire.resolve(`${packageName}/package.json`);
3913
- const packageJson = JSON.parse(
3914
- playArtifactRequire("node:fs").readFileSync(packageJsonPath, "utf-8")
3915
- );
3916
- version = packageJson.version ?? null;
3917
- break;
3918
- } catch {
3919
- continue;
3920
- }
3921
- }
3922
- return { name: packageName, version };
4075
+ return {
4076
+ name: packageName,
4077
+ version: readPackageVersionFromPackageJson(packageJsonPath, packageName)
4078
+ };
3923
4079
  }
3924
4080
  async function analyzeSourceGraph(entryFile, adapter) {
3925
4081
  const absoluteEntryFile = await normalizeLocalPath(entryFile);
@@ -3962,7 +4118,7 @@ async function analyzeSourceGraph(entryFile, adapter) {
3962
4118
  });
3963
4119
  if (resolved !== absoluteEntryFile && isPlaySourceFile(resolved)) {
3964
4120
  const importedSource = await readFile(resolved, "utf-8");
3965
- const importedPlayName = extractDefinedPlayName(importedSource, resolved);
4121
+ const importedPlayName = extractDefinedPlayName(importedSource);
3966
4122
  if (!importedPlayName) {
3967
4123
  throw new Error(
3968
4124
  `${absolutePath}:${line}:${column} Imported play file "${specifier}" must export definePlay(...) so it can be runtime-composed.`
@@ -4016,7 +4172,7 @@ async function analyzeSourceGraph(entryFile, adapter) {
4016
4172
  })).sort((left, right) => left.filePath.localeCompare(right.filePath))
4017
4173
  })
4018
4174
  );
4019
- const playName = extractDefinedPlayName(sourceCode, absoluteEntryFile);
4175
+ const playName = extractDefinedPlayName(sourceCode);
4020
4176
  return {
4021
4177
  sourceCode,
4022
4178
  sourceFiles: Object.fromEntries(
@@ -4065,8 +4221,8 @@ async function readArtifactCache(graphHash, artifactKind, adapter) {
4065
4221
  }
4066
4222
  async function writeArtifactCache(artifact, adapter) {
4067
4223
  const cacheDir = adapter.cacheDir ?? PLAY_ARTIFACT_CACHE_DIR;
4068
- await mkdir2(cacheDir, { recursive: true });
4069
- await writeFile2(
4224
+ await mkdir3(cacheDir, { recursive: true });
4225
+ await writeFile3(
4070
4226
  artifactCachePath(
4071
4227
  artifact.graphHash,
4072
4228
  artifact.artifactKind ?? PLAY_ARTIFACT_KINDS.cjsNode20,
@@ -4082,7 +4238,7 @@ function normalizeSourceMapForRuntime(sourceMapText) {
4082
4238
  if (sourcePath.startsWith("data:") || sourcePath.startsWith("node:") || sourcePath.startsWith("/") || /^[a-zA-Z]+:\/\//.test(sourcePath)) {
4083
4239
  return sourcePath;
4084
4240
  }
4085
- return resolve4(process.cwd(), sourcePath);
4241
+ return resolve5(process.cwd(), sourcePath);
4086
4242
  });
4087
4243
  parsed.sourceRoot = void 0;
4088
4244
  return JSON.stringify(parsed);
@@ -4114,7 +4270,7 @@ async function runEsbuildForCjsNode(entryFile, importedPlayDependencies, adapter
4114
4270
  ...namedExportShim ? {
4115
4271
  stdin: {
4116
4272
  contents: namedExportShim,
4117
- resolveDir: dirname4(entryFile),
4273
+ resolveDir: dirname5(entryFile),
4118
4274
  sourcefile: `${basename(entryFile)}.${exportName}.entry.ts`,
4119
4275
  loader: "ts"
4120
4276
  }
@@ -4404,7 +4560,7 @@ function resolveExecutionProfile(override) {
4404
4560
  // src/plays/local-file-discovery.ts
4405
4561
  import { createHash as createHash2 } from "crypto";
4406
4562
  import { readFile as readFile2, stat as stat2 } from "fs/promises";
4407
- import { basename as basename2, dirname as dirname5, extname as extname2, isAbsolute as isAbsolute2, join as join4, relative, resolve as resolve5 } from "path";
4563
+ import { basename as basename2, dirname as dirname6, extname as extname2, isAbsolute as isAbsolute2, join as join4, relative, resolve as resolve6 } from "path";
4408
4564
  var SOURCE_EXTENSIONS2 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs", ".json"];
4409
4565
  function sha2562(buffer) {
4410
4566
  return createHash2("sha256").update(buffer).digest("hex");
@@ -4605,7 +4761,7 @@ function isPathInsideDirectory2(filePath, directory) {
4605
4761
  return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute2(relativePath);
4606
4762
  }
4607
4763
  async function resolveLocalImport2(fromFile, specifier) {
4608
- const base = isAbsolute2(specifier) ? resolve5(specifier) : resolve5(dirname5(fromFile), specifier);
4764
+ const base = isAbsolute2(specifier) ? resolve6(specifier) : resolve6(dirname6(fromFile), specifier);
4609
4765
  const candidates = [base];
4610
4766
  const explicitExtension = extname2(base).toLowerCase();
4611
4767
  if (!explicitExtension) {
@@ -4623,13 +4779,13 @@ async function resolveLocalImport2(fromFile, specifier) {
4623
4779
  throw new Error(`Could not resolve local import "${specifier}" from ${fromFile}`);
4624
4780
  }
4625
4781
  async function discoverPackagedLocalFiles(entryFile) {
4626
- const absoluteEntryFile = resolve5(entryFile);
4627
- const packagingRoot = dirname5(absoluteEntryFile);
4782
+ const absoluteEntryFile = resolve6(entryFile);
4783
+ const packagingRoot = dirname6(absoluteEntryFile);
4628
4784
  const files = /* @__PURE__ */ new Map();
4629
4785
  const unresolved = [];
4630
4786
  const visitedFiles = /* @__PURE__ */ new Set();
4631
4787
  const visitSourceFile = async (filePath) => {
4632
- const absolutePath = resolve5(filePath);
4788
+ const absolutePath = resolve6(filePath);
4633
4789
  if (visitedFiles.has(absolutePath)) {
4634
4790
  return;
4635
4791
  }
@@ -4661,7 +4817,7 @@ async function discoverPackagedLocalFiles(entryFile) {
4661
4817
  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."
4662
4818
  });
4663
4819
  } else {
4664
- const absoluteCsvPath = resolve5(dirname5(absolutePath), resolvedPath);
4820
+ const absoluteCsvPath = resolve6(dirname6(absolutePath), resolvedPath);
4665
4821
  if (isAbsolute2(resolvedPath) || !isPathInsideDirectory2(absoluteCsvPath, packagingRoot)) {
4666
4822
  unresolved.push({
4667
4823
  sourceFragment: sourceCode.slice(argument.start, argument.end).trim(),
@@ -4699,25 +4855,25 @@ async function discoverPackagedLocalFiles(entryFile) {
4699
4855
  }
4700
4856
 
4701
4857
  // src/plays/bundle-play-file.ts
4702
- var PLAY_BUNDLE_CACHE_VERSION2 = 26;
4703
- var MODULE_DIR = dirname6(fileURLToPath(import.meta.url));
4704
- var SDK_PACKAGE_ROOT = resolve6(MODULE_DIR, "..", "..");
4705
- var SOURCE_REPO_ROOT = resolve6(SDK_PACKAGE_ROOT, "..");
4706
- var HAS_SOURCE_BUNDLING_SOURCES = existsSync4(
4707
- resolve6(SOURCE_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4858
+ var PLAY_BUNDLE_CACHE_VERSION2 = 30;
4859
+ var MODULE_DIR = dirname7(fileURLToPath(import.meta.url));
4860
+ var SDK_PACKAGE_ROOT = resolve7(MODULE_DIR, "..", "..");
4861
+ var SOURCE_REPO_ROOT = resolve7(SDK_PACKAGE_ROOT, "..");
4862
+ var HAS_SOURCE_BUNDLING_SOURCES = existsSync5(
4863
+ resolve7(SOURCE_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4708
4864
  );
4709
- var PACKAGED_REPO_ROOT = resolve6(SDK_PACKAGE_ROOT, "dist", "repo");
4710
- var HAS_PACKAGED_BUNDLING_SOURCES = existsSync4(
4711
- resolve6(PACKAGED_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4865
+ var PACKAGED_REPO_ROOT = resolve7(SDK_PACKAGE_ROOT, "dist", "repo");
4866
+ var HAS_PACKAGED_BUNDLING_SOURCES = existsSync5(
4867
+ resolve7(PACKAGED_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
4712
4868
  );
4713
- var PROJECT_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? SOURCE_REPO_ROOT : HAS_PACKAGED_BUNDLING_SOURCES ? PACKAGED_REPO_ROOT : resolve6(SDK_PACKAGE_ROOT, "..");
4714
- var SDK_SOURCE_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? resolve6(SOURCE_REPO_ROOT, "sdk", "src") : HAS_PACKAGED_BUNDLING_SOURCES ? resolve6(PACKAGED_REPO_ROOT, "sdk", "src") : resolve6(SDK_PACKAGE_ROOT, "src");
4715
- var SDK_PACKAGE_JSON = resolve6(SDK_PACKAGE_ROOT, "package.json");
4716
- var SDK_ENTRY_FILE = resolve6(SDK_SOURCE_ROOT, "index.ts");
4717
- var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : resolve6(SDK_PACKAGE_ROOT, "dist", "index.d.ts");
4718
- var SDK_WORKERS_ENTRY_FILE = resolve6(SDK_SOURCE_ROOT, "worker-play-entry.ts");
4719
- var WORKERS_HARNESS_ENTRY_FILE = resolve6(PROJECT_ROOT, "apps", "play-runner-workers", "src", "entry.ts");
4720
- var WORKERS_HARNESS_FILES_DIR = resolve6(PROJECT_ROOT, "apps", "play-runner-workers", "src");
4869
+ var PROJECT_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? SOURCE_REPO_ROOT : HAS_PACKAGED_BUNDLING_SOURCES ? PACKAGED_REPO_ROOT : resolve7(SDK_PACKAGE_ROOT, "..");
4870
+ var SDK_SOURCE_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? resolve7(SOURCE_REPO_ROOT, "sdk", "src") : HAS_PACKAGED_BUNDLING_SOURCES ? resolve7(PACKAGED_REPO_ROOT, "sdk", "src") : resolve7(SDK_PACKAGE_ROOT, "src");
4871
+ var SDK_PACKAGE_JSON = resolve7(SDK_PACKAGE_ROOT, "package.json");
4872
+ var SDK_ENTRY_FILE = resolve7(SDK_SOURCE_ROOT, "index.ts");
4873
+ var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : resolve7(SDK_PACKAGE_ROOT, "dist", "index.d.ts");
4874
+ var SDK_WORKERS_ENTRY_FILE = resolve7(SDK_SOURCE_ROOT, "worker-play-entry.ts");
4875
+ var WORKERS_HARNESS_ENTRY_FILE = resolve7(PROJECT_ROOT, "apps", "play-runner-workers", "src", "entry.ts");
4876
+ var WORKERS_HARNESS_FILES_DIR = resolve7(PROJECT_ROOT, "apps", "play-runner-workers", "src");
4721
4877
  var hasWarnedAboutNonDevelopmentBundling = false;
4722
4878
  function warnAboutNonDevelopmentBundling(filePath) {
4723
4879
  if (hasWarnedAboutNonDevelopmentBundling) {
@@ -4741,12 +4897,12 @@ function defaultPlayBundleTarget() {
4741
4897
  function createSdkPlayBundlingAdapter() {
4742
4898
  return {
4743
4899
  projectRoot: PROJECT_ROOT,
4744
- nodeModulesDir: resolve6(PROJECT_ROOT, "node_modules"),
4900
+ nodeModulesDir: resolve7(PROJECT_ROOT, "node_modules"),
4745
4901
  cacheDir: join5(tmpdir2(), `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION2}`),
4746
4902
  sdkSourceRoot: SDK_SOURCE_ROOT,
4747
4903
  sdkPackageJson: SDK_PACKAGE_JSON,
4748
4904
  sdkEntryFile: SDK_ENTRY_FILE,
4749
- sdkTypesEntryFile: HAS_SOURCE_BUNDLING_SOURCES || !existsSync4(SDK_TYPES_ENTRY_FILE) ? SDK_ENTRY_FILE : SDK_TYPES_ENTRY_FILE,
4905
+ sdkTypesEntryFile: HAS_SOURCE_BUNDLING_SOURCES || !existsSync5(SDK_TYPES_ENTRY_FILE) ? SDK_ENTRY_FILE : SDK_TYPES_ENTRY_FILE,
4750
4906
  sdkWorkersEntryFile: SDK_WORKERS_ENTRY_FILE,
4751
4907
  workersHarnessEntryFile: WORKERS_HARNESS_ENTRY_FILE,
4752
4908
  workersHarnessFilesDir: WORKERS_HARNESS_FILES_DIR,
@@ -5022,7 +5178,7 @@ function formatPlayListReference(play) {
5022
5178
  function defaultMaterializedPlayPath(reference) {
5023
5179
  const playName = parseReferencedPlayTarget(reference).unqualifiedPlayName;
5024
5180
  const safeName = playName.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
5025
- return resolve7(`${safeName || "play"}.play.ts`);
5181
+ return resolve8(`${safeName || "play"}.play.ts`);
5026
5182
  }
5027
5183
  function materializeRemotePlaySource(input) {
5028
5184
  if (isFileTarget(input.target)) {
@@ -5032,8 +5188,8 @@ function materializeRemotePlaySource(input) {
5032
5188
  return null;
5033
5189
  }
5034
5190
  const outputPath = input.outPath ?? defaultMaterializedPlayPath(input.playName);
5035
- if (existsSync5(outputPath)) {
5036
- const existingSource = readFileSync3(outputPath, "utf-8");
5191
+ if (existsSync6(outputPath)) {
5192
+ const existingSource = readFileSync4(outputPath, "utf-8");
5037
5193
  if (existingSource === input.sourceCode) {
5038
5194
  return { path: outputPath, status: "unchanged", created: false };
5039
5195
  }
@@ -5078,14 +5234,14 @@ function buildMissingDefinePlayError(filePath) {
5078
5234
  );
5079
5235
  }
5080
5236
  function extractPlayName(code, filePath) {
5081
- const definedPlayName = extractDefinedPlayName(code, filePath);
5237
+ const definedPlayName = extractDefinedPlayName(code);
5082
5238
  if (definedPlayName) {
5083
5239
  return definedPlayName;
5084
5240
  }
5085
5241
  throw buildMissingDefinePlayError(filePath);
5086
5242
  }
5087
5243
  function isFileTarget(target) {
5088
- return existsSync5(resolve7(target));
5244
+ return existsSync6(resolve8(target));
5089
5245
  }
5090
5246
  function looksLikeFilePath(target) {
5091
5247
  if (target.trim().toLowerCase().startsWith("prebuilt/")) {
@@ -5104,7 +5260,7 @@ function parsePositiveInteger2(value, flagName) {
5104
5260
  return parsed;
5105
5261
  }
5106
5262
  function parseJsonInput(raw) {
5107
- const source = raw.startsWith("@") ? readFileSync3(resolve7(raw.slice(1)), "utf-8") : raw;
5263
+ const source = raw.startsWith("@") ? readFileSync4(resolve8(raw.slice(1)), "utf-8") : raw;
5108
5264
  const parsed = JSON.parse(source);
5109
5265
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
5110
5266
  throw new Error("--input must be a JSON object.");
@@ -5214,7 +5370,7 @@ function applyCsvShortcutInput(input) {
5214
5370
  function isLocalFilePathValue(value) {
5215
5371
  if (typeof value !== "string" || !value.trim()) return false;
5216
5372
  if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value.trim())) return false;
5217
- return existsSync5(resolve7(value));
5373
+ return existsSync6(resolve8(value));
5218
5374
  }
5219
5375
  function inputContainsLocalFilePath(value) {
5220
5376
  if (isLocalFilePathValue(value)) {
@@ -5240,7 +5396,7 @@ async function stageFileInputArgs(input) {
5240
5396
  const localFiles = uniqueBindings.flatMap((binding) => {
5241
5397
  const value = getDottedInputValue(input.runtimeInput, binding.inputPath);
5242
5398
  if (!isLocalFilePathValue(value)) return [];
5243
- const absolutePath = resolve7(value);
5399
+ const absolutePath = resolve8(value);
5244
5400
  return [{ binding, absolutePath, logicalPath: basename3(absolutePath) }];
5245
5401
  });
5246
5402
  if (localFiles.length === 0) {
@@ -5265,7 +5421,7 @@ async function stageFileInputArgs(input) {
5265
5421
  };
5266
5422
  }
5267
5423
  function stageFile(logicalPath, absolutePath) {
5268
- const buffer = readFileSync3(absolutePath);
5424
+ const buffer = readFileSync4(absolutePath);
5269
5425
  return {
5270
5426
  logicalPath,
5271
5427
  contentBase64: buffer.toString("base64"),
@@ -5276,9 +5432,9 @@ function stageFile(logicalPath, absolutePath) {
5276
5432
  }
5277
5433
  function normalizePlayPath(filePath) {
5278
5434
  try {
5279
- return realpathSync.native(resolve7(filePath));
5435
+ return realpathSync.native(resolve8(filePath));
5280
5436
  } catch {
5281
- return resolve7(filePath);
5437
+ return resolve8(filePath);
5282
5438
  }
5283
5439
  }
5284
5440
  function formatBundlingErrors(filePath, errors) {
@@ -5363,7 +5519,10 @@ async function compileBundledPlayGraphManifests(client, graph) {
5363
5519
  `Missing compiler manifest for imported dependency ${dependency.filePath}.`
5364
5520
  );
5365
5521
  }
5366
- return child.compilerManifest;
5522
+ return {
5523
+ ...child.compilerManifest,
5524
+ filePath: dependency.filePath
5525
+ };
5367
5526
  }
5368
5527
  )
5369
5528
  });
@@ -5437,14 +5596,14 @@ function getEventPayload(event) {
5437
5596
  return event.payload && typeof event.payload === "object" ? event.payload : {};
5438
5597
  }
5439
5598
  function getStatusFromLiveEvent(event) {
5440
- if (event.type !== "play.run.status" && event.type !== "play.run.snapshot") {
5599
+ if (event.type !== "play.run.status" && event.type !== "play.run.snapshot" && event.type !== "play.run.final_status") {
5441
5600
  return null;
5442
5601
  }
5443
5602
  const status = getEventPayload(event).status;
5444
5603
  return status === "queued" || status === "running" || status === "waiting" || status === "completed" || status === "failed" || status === "cancelled" ? status : null;
5445
5604
  }
5446
5605
  function getFinalStatusFromLiveEvent(event) {
5447
- if (event.type !== "play.run.final_status") {
5606
+ if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
5448
5607
  return null;
5449
5608
  }
5450
5609
  const payload = getEventPayload(event);
@@ -5932,6 +6091,13 @@ function getStringField(value, key) {
5932
6091
  const field = getRecordField(value, key);
5933
6092
  return typeof field === "string" && field.trim() ? field : null;
5934
6093
  }
6094
+ function getTimestampField(value, key) {
6095
+ const field = getRecordField(value, key);
6096
+ if (typeof field === "number" && Number.isFinite(field)) {
6097
+ return field;
6098
+ }
6099
+ return typeof field === "string" && field.trim() ? field : null;
6100
+ }
5935
6101
  function normalizeRunStatusForEnvelope(status) {
5936
6102
  const run = status.run ?? null;
5937
6103
  return {
@@ -5939,9 +6105,9 @@ function normalizeRunStatusForEnvelope(status) {
5939
6105
  playName: status.playName ?? status.name ?? getStringField(run, "playName") ?? null,
5940
6106
  status: status.status,
5941
6107
  runtime: getStringField(status, "runtime") ?? getStringField(status, "runtimeBackend") ?? getStringField(run, "runtime") ?? null,
5942
- startedAt: getStringField(run, "startTime") ?? getStringField(run, "startedAt") ?? null,
5943
- updatedAt: getStringField(status, "updatedAt") ?? getStringField(run, "updatedAt") ?? null,
5944
- finishedAt: getStringField(run, "closeTime") ?? getStringField(run, "finishedAt") ?? null,
6108
+ startedAt: getTimestampField(status, "startedAt") ?? getTimestampField(run, "startTime") ?? getTimestampField(run, "startedAt") ?? null,
6109
+ updatedAt: getTimestampField(status, "updatedAt") ?? getTimestampField(run, "updatedAt") ?? null,
6110
+ finishedAt: getTimestampField(status, "finishedAt") ?? getTimestampField(run, "closeTime") ?? getTimestampField(run, "finishedAt") ?? null,
5945
6111
  source: getRecordField(status, "source") ?? getRecordField(status, "artifact") ?? null
5946
6112
  };
5947
6113
  }
@@ -6338,7 +6504,7 @@ function parsePlayRunOptions(args) {
6338
6504
  continue;
6339
6505
  }
6340
6506
  if (arg === "--out" && args[index + 1]) {
6341
- outPath = resolve7(args[++index]);
6507
+ outPath = resolve8(args[++index]);
6342
6508
  continue;
6343
6509
  }
6344
6510
  if (arg === "--poll-interval-ms" || arg === "--interval-ms") {
@@ -6438,12 +6604,12 @@ function shouldUseLocalOnlyPlayCheck() {
6438
6604
  async function handlePlayCheck(args) {
6439
6605
  const options = parsePlayCheckOptions(args);
6440
6606
  if (!isFileTarget(options.target)) {
6441
- const resolved = resolve7(options.target);
6607
+ const resolved = resolve8(options.target);
6442
6608
  console.error(`File not found: ${resolved}`);
6443
6609
  return 1;
6444
6610
  }
6445
- const absolutePlayPath = resolve7(options.target);
6446
- const sourceCode = readFileSync3(absolutePlayPath, "utf-8");
6611
+ const absolutePlayPath = resolve8(options.target);
6612
+ const sourceCode = readFileSync4(absolutePlayPath, "utf-8");
6447
6613
  let graph;
6448
6614
  try {
6449
6615
  graph = await collectBundledPlayGraph(absolutePlayPath);
@@ -6506,12 +6672,12 @@ async function handleFileBackedRun(options) {
6506
6672
  }
6507
6673
  const client = new DeeplineClient();
6508
6674
  const progress = getActiveCliProgress() ?? createCliProgress(!options.jsonOutput);
6509
- const absolutePlayPath = resolve7(options.target.path);
6675
+ const absolutePlayPath = resolve8(options.target.path);
6510
6676
  progress.phase("compiling play");
6511
6677
  const sourceCode = traceCliSync(
6512
6678
  "cli.play_file_read_source",
6513
6679
  { targetKind: "file" },
6514
- () => readFileSync3(absolutePlayPath, "utf-8")
6680
+ () => readFileSync4(absolutePlayPath, "utf-8")
6515
6681
  );
6516
6682
  const runtimeInput = options.input ? { ...options.input } : {};
6517
6683
  let graph;
@@ -6795,10 +6961,10 @@ async function handlePlayRun(args) {
6795
6961
  if (isFileTarget(options.target.path)) {
6796
6962
  return handleFileBackedRun(options);
6797
6963
  }
6798
- const resolved = resolve7(options.target.path);
6964
+ const resolved = resolve8(options.target.path);
6799
6965
  console.error(`File not found: ${resolved}`);
6800
- const dir = dirname7(resolved);
6801
- if (existsSync5(dir)) {
6966
+ const dir = dirname8(resolved);
6967
+ if (existsSync6(dir)) {
6802
6968
  const base = basename3(resolved);
6803
6969
  try {
6804
6970
  const siblings = readdirSync(dir).filter(
@@ -6953,7 +7119,7 @@ async function handleRunLogs(args) {
6953
7119
  continue;
6954
7120
  }
6955
7121
  if (arg === "--out" && args[index + 1]) {
6956
- outPath = resolve7(args[++index]);
7122
+ outPath = resolve8(args[++index]);
6957
7123
  }
6958
7124
  }
6959
7125
  const client = new DeeplineClient();
@@ -7040,7 +7206,7 @@ async function handleRunExport(args) {
7040
7206
  for (let index = 0; index < args.length; index += 1) {
7041
7207
  const arg = args[index];
7042
7208
  if (arg === "--out" && args[index + 1]) {
7043
- outPath = resolve7(args[++index]);
7209
+ outPath = resolve8(args[++index]);
7044
7210
  }
7045
7211
  }
7046
7212
  if (!outPath) {
@@ -7080,10 +7246,10 @@ async function handlePlayGet(args) {
7080
7246
  for (let index = 1; index < args.length; index += 1) {
7081
7247
  const arg = args[index];
7082
7248
  if (arg === "--out" && args[index + 1]) {
7083
- outPath = resolve7(args[++index]);
7249
+ outPath = resolve8(args[++index]);
7084
7250
  }
7085
7251
  }
7086
- const playName = isFileTarget(target) ? extractPlayName(readFileSync3(resolve7(target), "utf-8"), resolve7(target)) : parseReferencedPlayTarget(target).playName;
7252
+ const playName = isFileTarget(target) ? extractPlayName(readFileSync4(resolve8(target), "utf-8"), resolve8(target)) : parseReferencedPlayTarget(target).playName;
7087
7253
  const detail = isFileTarget(target) ? await client.getPlay(playName) : await assertCanonicalNamedPlayReference(client, target);
7088
7254
  const resolvedSource = detail.play.workingRevision?.sourceCode ?? detail.play.liveRevision?.sourceCode ?? detail.play.currentRevision?.sourceCode ?? detail.play.sourceCode ?? "";
7089
7255
  const materializedFile = outPath ? materializeRemotePlaySource({
@@ -7375,7 +7541,7 @@ async function handlePlayPublish(args) {
7375
7541
  }
7376
7542
  let graph;
7377
7543
  try {
7378
- graph = await collectBundledPlayGraph(resolve7(playName));
7544
+ graph = await collectBundledPlayGraph(resolve8(playName));
7379
7545
  await compileBundledPlayGraphManifests(client, graph);
7380
7546
  await publishImportedPlayDependencies(client, graph);
7381
7547
  } catch (error) {
@@ -8666,9 +8832,9 @@ async function executeTool(args) {
8666
8832
 
8667
8833
  // src/cli/skills-sync.ts
8668
8834
  import { spawn, spawnSync as spawnSync2 } from "child_process";
8669
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync8 } from "fs";
8835
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync8 } from "fs";
8670
8836
  import { homedir as homedir4 } from "os";
8671
- import { dirname as dirname8, join as join9 } from "path";
8837
+ import { dirname as dirname9, join as join9 } from "path";
8672
8838
  var CHECK_TIMEOUT_MS2 = 3e3;
8673
8839
  var SDK_SKILL_NAME = "deepline-sdk";
8674
8840
  var SKILL_AGENTS = ["codex", "claude-code", "cursor"];
@@ -8683,16 +8849,16 @@ function sdkSkillsVersionPath(baseUrl) {
8683
8849
  }
8684
8850
  function readLocalSkillsVersion(baseUrl) {
8685
8851
  const path = sdkSkillsVersionPath(baseUrl);
8686
- if (!existsSync6(path)) return "";
8852
+ if (!existsSync7(path)) return "";
8687
8853
  try {
8688
- return readFileSync4(path, "utf-8").trim();
8854
+ return readFileSync5(path, "utf-8").trim();
8689
8855
  } catch {
8690
8856
  return "";
8691
8857
  }
8692
8858
  }
8693
8859
  function writeLocalSkillsVersion(baseUrl, version) {
8694
8860
  const path = sdkSkillsVersionPath(baseUrl);
8695
- mkdirSync5(dirname8(path), { recursive: true });
8861
+ mkdirSync5(dirname9(path), { recursive: true });
8696
8862
  writeFileSync8(path, `${version}
8697
8863
  `, "utf-8");
8698
8864
  }
@@ -8787,7 +8953,7 @@ function resolveSkillsInstallCommands(baseUrl) {
8787
8953
  return [npxInstall];
8788
8954
  }
8789
8955
  function runOneSkillsInstall(install) {
8790
- return new Promise((resolve8) => {
8956
+ return new Promise((resolve9) => {
8791
8957
  const child = spawn(install.command, install.args, {
8792
8958
  stdio: ["ignore", "ignore", "pipe"],
8793
8959
  env: process.env
@@ -8797,7 +8963,7 @@ function runOneSkillsInstall(install) {
8797
8963
  stderr += chunk.toString("utf-8");
8798
8964
  });
8799
8965
  child.on("error", (error) => {
8800
- resolve8({
8966
+ resolve9({
8801
8967
  ok: false,
8802
8968
  detail: `failed to start ${install.command}: ${error.message}`,
8803
8969
  manualCommand: install.manualCommand
@@ -8805,11 +8971,11 @@ function runOneSkillsInstall(install) {
8805
8971
  });
8806
8972
  child.on("close", (code) => {
8807
8973
  if (code === 0) {
8808
- resolve8({ ok: true, detail: "", manualCommand: install.manualCommand });
8974
+ resolve9({ ok: true, detail: "", manualCommand: install.manualCommand });
8809
8975
  return;
8810
8976
  }
8811
8977
  const detail = stderr.trim();
8812
- resolve8({
8978
+ resolve9({
8813
8979
  ok: false,
8814
8980
  detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
8815
8981
  manualCommand: install.manualCommand
@@ -8886,7 +9052,7 @@ async function main() {
8886
9052
  if (printStartupPhase) {
8887
9053
  progress?.phase("loading deepline cli");
8888
9054
  }
8889
- const program = new Command();
9055
+ const program = new Command2();
8890
9056
  program.name("deepline").description("Deepline CLI (TypeScript SDK)").version(SDK_VERSION, "-v, --version", "Show version").showHelpAfterError().showSuggestionAfterError(true).addHelpText(
8891
9057
  "after",
8892
9058
  `