deepline 0.3.22 → 0.3.24

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/index.d.mts CHANGED
@@ -1385,6 +1385,17 @@ interface PlayCheckResult {
1385
1385
  valid: boolean;
1386
1386
  errors: string[];
1387
1387
  warnings?: string[];
1388
+ /**
1389
+ * Effective sandbox limits selected for this Play when authoring-contract
1390
+ * preflight succeeded. A valid modern check includes the default 30-minute
1391
+ * timeout when the author did not declare `runtime`.
1392
+ */
1393
+ runtimeLimit?: {
1394
+ timeoutSeconds: number;
1395
+ memoryGiB: number;
1396
+ cpu: number;
1397
+ diskGiB: number;
1398
+ } | null;
1388
1399
  staticPipeline?: Record<string, unknown> | null;
1389
1400
  toolGetterHints?: PlayCheckToolGetterHint[];
1390
1401
  /**
@@ -1413,6 +1424,11 @@ interface PlayCheckResult {
1413
1424
  * `1 trigger · 2 tools · 1 dataset · 14 columns`.
1414
1425
  */
1415
1426
  summary?: string;
1427
+ /**
1428
+ * Feature-gated validation paths that were enabled for this exact cloud
1429
+ * check. Present as an empty array when no feature gate affected the result.
1430
+ */
1431
+ featureFlags?: PlayCheckFeatureFlag[];
1416
1432
  artifactHash?: string | null;
1417
1433
  graphHash?: string | null;
1418
1434
  /** SHA-256 of the exact source bytes checked by Deepline. */
@@ -1443,8 +1459,22 @@ interface PlayCheckResult {
1443
1459
  limitBytes: number;
1444
1460
  withinLimit: boolean;
1445
1461
  };
1462
+ /** Present when this Play declares a cron binding. Advisory only; publish reserves capacity. */
1463
+ activeScheduledPlays?: {
1464
+ used: number;
1465
+ limit: number;
1466
+ remaining: number;
1467
+ approachingLimit: boolean;
1468
+ };
1446
1469
  };
1447
1470
  }
1471
+ /** An enabled server-side feature flag that affected a Play check. */
1472
+ interface PlayCheckFeatureFlag {
1473
+ id: string;
1474
+ label: string;
1475
+ enabled: true;
1476
+ reason: string;
1477
+ }
1448
1478
  /**
1449
1479
  * One exported play's check result inside a multi-play file. Carries the same
1450
1480
  * per-play fields as {@link PlayCheckResult}, unprefixed and unaggregated, so a
@@ -1464,6 +1494,7 @@ interface PlayCheckExportResult {
1464
1494
  graphHash?: string | null;
1465
1495
  sourceHash?: string | null;
1466
1496
  summary?: string;
1497
+ featureFlags?: PlayCheckFeatureFlag[];
1467
1498
  recognized?: PlayCheckRecognizedSummary;
1468
1499
  triggers?: PlayCheckTriggersSummary | null;
1469
1500
  }
@@ -2498,6 +2529,24 @@ type TargetBillingStatusResult = {
2498
2529
  pending_plan_sku: string | null;
2499
2530
  as_of: string | null;
2500
2531
  };
2532
+ type TargetAutoRechargeResult = {
2533
+ org_id: string;
2534
+ enabled: boolean;
2535
+ available: boolean;
2536
+ reason: string | null;
2537
+ threshold_credits: number | null;
2538
+ refill_to_credits: number | null;
2539
+ rolling_limit_cents: null;
2540
+ };
2541
+ type TargetAutoRechargeUpdateOptions = {
2542
+ enabled: false;
2543
+ idempotencyKey: string;
2544
+ } | {
2545
+ enabled: true;
2546
+ thresholdCredits: number;
2547
+ refillToCredits: number;
2548
+ idempotencyKey: string;
2549
+ };
2501
2550
  type TargetBillingMutationResult = {
2502
2551
  data: Record<string, unknown>;
2503
2552
  operation: TargetBillingOperation;
@@ -2617,6 +2666,11 @@ type BillingNamespace = {
2617
2666
  targetPlans: () => Promise<TargetBillingPlansResult>;
2618
2667
  /** Normalized target billing state. */
2619
2668
  targetStatus: () => Promise<TargetBillingStatusResult>;
2669
+ /** Read and manage the Metronome-backed automatic recharge configuration. */
2670
+ autoRecharge: {
2671
+ get: () => Promise<TargetAutoRechargeResult>;
2672
+ update: (options: TargetAutoRechargeUpdateOptions) => Promise<TargetAutoRechargeResult>;
2673
+ };
2620
2674
  /** Buy Deepline credits through a payment-gated Metronome commit. */
2621
2675
  purchaseCredits: (options: {
2622
2676
  credits: number;
@@ -3662,6 +3716,10 @@ declare class DeeplineClient {
3662
3716
  getTargetBillingPlans(): Promise<TargetBillingPlansResult>;
3663
3717
  /** Read the workspace's normalized target plan, payment, and balance state. */
3664
3718
  getTargetBillingStatus(): Promise<TargetBillingStatusResult>;
3719
+ /** Read the canonical Metronome automatic recharge configuration. */
3720
+ getTargetAutoRecharge(): Promise<TargetAutoRechargeResult>;
3721
+ /** Update automatic recharge and return the server-verified configuration. */
3722
+ updateTargetAutoRecharge(options: TargetAutoRechargeUpdateOptions): Promise<TargetAutoRechargeResult>;
3665
3723
  /**
3666
3724
  * Purchase target-billing credits through the durable commercial operation
3667
3725
  * flow. The caller supplies an idempotency key for safe retries.
package/dist/index.d.ts CHANGED
@@ -1385,6 +1385,17 @@ interface PlayCheckResult {
1385
1385
  valid: boolean;
1386
1386
  errors: string[];
1387
1387
  warnings?: string[];
1388
+ /**
1389
+ * Effective sandbox limits selected for this Play when authoring-contract
1390
+ * preflight succeeded. A valid modern check includes the default 30-minute
1391
+ * timeout when the author did not declare `runtime`.
1392
+ */
1393
+ runtimeLimit?: {
1394
+ timeoutSeconds: number;
1395
+ memoryGiB: number;
1396
+ cpu: number;
1397
+ diskGiB: number;
1398
+ } | null;
1388
1399
  staticPipeline?: Record<string, unknown> | null;
1389
1400
  toolGetterHints?: PlayCheckToolGetterHint[];
1390
1401
  /**
@@ -1413,6 +1424,11 @@ interface PlayCheckResult {
1413
1424
  * `1 trigger · 2 tools · 1 dataset · 14 columns`.
1414
1425
  */
1415
1426
  summary?: string;
1427
+ /**
1428
+ * Feature-gated validation paths that were enabled for this exact cloud
1429
+ * check. Present as an empty array when no feature gate affected the result.
1430
+ */
1431
+ featureFlags?: PlayCheckFeatureFlag[];
1416
1432
  artifactHash?: string | null;
1417
1433
  graphHash?: string | null;
1418
1434
  /** SHA-256 of the exact source bytes checked by Deepline. */
@@ -1443,8 +1459,22 @@ interface PlayCheckResult {
1443
1459
  limitBytes: number;
1444
1460
  withinLimit: boolean;
1445
1461
  };
1462
+ /** Present when this Play declares a cron binding. Advisory only; publish reserves capacity. */
1463
+ activeScheduledPlays?: {
1464
+ used: number;
1465
+ limit: number;
1466
+ remaining: number;
1467
+ approachingLimit: boolean;
1468
+ };
1446
1469
  };
1447
1470
  }
1471
+ /** An enabled server-side feature flag that affected a Play check. */
1472
+ interface PlayCheckFeatureFlag {
1473
+ id: string;
1474
+ label: string;
1475
+ enabled: true;
1476
+ reason: string;
1477
+ }
1448
1478
  /**
1449
1479
  * One exported play's check result inside a multi-play file. Carries the same
1450
1480
  * per-play fields as {@link PlayCheckResult}, unprefixed and unaggregated, so a
@@ -1464,6 +1494,7 @@ interface PlayCheckExportResult {
1464
1494
  graphHash?: string | null;
1465
1495
  sourceHash?: string | null;
1466
1496
  summary?: string;
1497
+ featureFlags?: PlayCheckFeatureFlag[];
1467
1498
  recognized?: PlayCheckRecognizedSummary;
1468
1499
  triggers?: PlayCheckTriggersSummary | null;
1469
1500
  }
@@ -2498,6 +2529,24 @@ type TargetBillingStatusResult = {
2498
2529
  pending_plan_sku: string | null;
2499
2530
  as_of: string | null;
2500
2531
  };
2532
+ type TargetAutoRechargeResult = {
2533
+ org_id: string;
2534
+ enabled: boolean;
2535
+ available: boolean;
2536
+ reason: string | null;
2537
+ threshold_credits: number | null;
2538
+ refill_to_credits: number | null;
2539
+ rolling_limit_cents: null;
2540
+ };
2541
+ type TargetAutoRechargeUpdateOptions = {
2542
+ enabled: false;
2543
+ idempotencyKey: string;
2544
+ } | {
2545
+ enabled: true;
2546
+ thresholdCredits: number;
2547
+ refillToCredits: number;
2548
+ idempotencyKey: string;
2549
+ };
2501
2550
  type TargetBillingMutationResult = {
2502
2551
  data: Record<string, unknown>;
2503
2552
  operation: TargetBillingOperation;
@@ -2617,6 +2666,11 @@ type BillingNamespace = {
2617
2666
  targetPlans: () => Promise<TargetBillingPlansResult>;
2618
2667
  /** Normalized target billing state. */
2619
2668
  targetStatus: () => Promise<TargetBillingStatusResult>;
2669
+ /** Read and manage the Metronome-backed automatic recharge configuration. */
2670
+ autoRecharge: {
2671
+ get: () => Promise<TargetAutoRechargeResult>;
2672
+ update: (options: TargetAutoRechargeUpdateOptions) => Promise<TargetAutoRechargeResult>;
2673
+ };
2620
2674
  /** Buy Deepline credits through a payment-gated Metronome commit. */
2621
2675
  purchaseCredits: (options: {
2622
2676
  credits: number;
@@ -3662,6 +3716,10 @@ declare class DeeplineClient {
3662
3716
  getTargetBillingPlans(): Promise<TargetBillingPlansResult>;
3663
3717
  /** Read the workspace's normalized target plan, payment, and balance state. */
3664
3718
  getTargetBillingStatus(): Promise<TargetBillingStatusResult>;
3719
+ /** Read the canonical Metronome automatic recharge configuration. */
3720
+ getTargetAutoRecharge(): Promise<TargetAutoRechargeResult>;
3721
+ /** Update automatic recharge and return the server-verified configuration. */
3722
+ updateTargetAutoRecharge(options: TargetAutoRechargeUpdateOptions): Promise<TargetAutoRechargeResult>;
3665
3723
  /**
3666
3724
  * Purchase target-billing credits through the durable commercial operation
3667
3725
  * flow. The caller supplies an idempotency key for safe retries.
package/dist/index.js CHANGED
@@ -730,11 +730,6 @@ function resolveConfig(options) {
730
730
  };
731
731
  }
732
732
 
733
- // src/http.ts
734
- var import_node_fs2 = require("fs");
735
- var import_node_os3 = require("os");
736
- var import_node_path2 = require("path");
737
-
738
733
  // ../shared_libs/plays/artifact-contract-version.ts
739
734
  var CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION = 2;
740
735
 
@@ -783,7 +778,7 @@ var SDK_RELEASE = {
783
778
  // 0.3.0 introduces raw-v2: complete scrubbed provider responses are
784
779
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
785
780
  // getters keep their established compatibility behavior.
786
- version: "0.3.22",
781
+ version: "0.3.24",
787
782
  updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
788
783
  contracts: {
789
784
  api: {
@@ -972,6 +967,79 @@ function detectAgentRuntime(options = {}) {
972
967
  return options.defaultRuntime ?? "unknown";
973
968
  }
974
969
 
970
+ // src/skills-version.ts
971
+ var import_node_fs2 = require("fs");
972
+ var import_node_path2 = require("path");
973
+ function activePluginSkillsDir() {
974
+ const pluginMode = process.env.DEEPLINE_PLUGIN_MODE?.trim().toLowerCase();
975
+ if (pluginMode !== "true" && pluginMode !== "1" && pluginMode !== "yes" && pluginMode !== "on") {
976
+ return "";
977
+ }
978
+ const dir = process.env.DEEPLINE_PLUGIN_SKILLS_DIR?.trim() ?? "";
979
+ return dir && (0, import_node_fs2.existsSync)(dir) ? dir : "";
980
+ }
981
+ function readPluginSkillsVersion() {
982
+ const dir = activePluginSkillsDir();
983
+ if (!dir) return "";
984
+ try {
985
+ return (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(dir, ".version"), "utf-8").trim();
986
+ } catch {
987
+ return "";
988
+ }
989
+ }
990
+ function sdkSkillsVersionPath(baseUrl, agents = []) {
991
+ const suffix = agents.length > 0 ? `-${agents.join("-")}` : "";
992
+ return (0, import_node_path2.join)(sdkCliStateDirPath(baseUrl), `skills${suffix}-version`);
993
+ }
994
+ function legacySdkSkillsVersionPath(baseUrl) {
995
+ return (0, import_node_path2.join)((0, import_node_path2.dirname)(sdkCliStateDirPath(baseUrl)), "sdk-skills", ".version");
996
+ }
997
+ function resolveAutoSyncSkillAgents() {
998
+ switch (detectAgentRuntime()) {
999
+ case "codex":
1000
+ return ["codex"];
1001
+ case "claude_code":
1002
+ return ["claude-code"];
1003
+ case "cursor":
1004
+ return ["cursor"];
1005
+ case "gemini":
1006
+ return ["gemini-cli"];
1007
+ case "antigravity":
1008
+ return ["antigravity"];
1009
+ default:
1010
+ return [];
1011
+ }
1012
+ }
1013
+ function readSdkSkillsLocalVersion(baseUrl) {
1014
+ const pluginVersion = readPluginSkillsVersion();
1015
+ if (pluginVersion) return pluginVersion;
1016
+ const agents = resolveAutoSyncSkillAgents();
1017
+ const scopedPath = sdkSkillsVersionPath(baseUrl, agents);
1018
+ if (agents.length > 0 && (0, import_node_fs2.existsSync)(scopedPath)) {
1019
+ try {
1020
+ return (0, import_node_fs2.readFileSync)(scopedPath, "utf-8").trim();
1021
+ } catch {
1022
+ return "";
1023
+ }
1024
+ }
1025
+ if (agents.length > 0) {
1026
+ const legacyPath = legacySdkSkillsVersionPath(baseUrl);
1027
+ if (!(0, import_node_fs2.existsSync)(legacyPath)) return "";
1028
+ try {
1029
+ return (0, import_node_fs2.readFileSync)(legacyPath, "utf-8").trim();
1030
+ } catch {
1031
+ return "";
1032
+ }
1033
+ }
1034
+ const path = (0, import_node_fs2.existsSync)(sdkSkillsVersionPath(baseUrl)) ? sdkSkillsVersionPath(baseUrl) : legacySdkSkillsVersionPath(baseUrl);
1035
+ if (!(0, import_node_fs2.existsSync)(path)) return "";
1036
+ try {
1037
+ return (0, import_node_fs2.readFileSync)(path, "utf-8").trim();
1038
+ } catch {
1039
+ return "";
1040
+ }
1041
+ }
1042
+
975
1043
  // ../shared_libs/play-runtime/coordinator-headers.ts
976
1044
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
977
1045
  var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
@@ -1308,21 +1376,9 @@ var HttpClient = class {
1308
1376
  );
1309
1377
  if (explicit) return explicit;
1310
1378
  try {
1311
- const versionPath = (0, import_node_path2.join)(
1312
- sdkCliStateDirPath(this.config.baseUrl),
1313
- "skills-version"
1314
- );
1315
- const legacyVersionPath = (0, import_node_path2.join)(
1316
- process.env.HOME?.trim() || (0, import_node_os3.homedir)(),
1317
- ".local",
1318
- "deepline",
1319
- baseUrlSlug(this.config.baseUrl),
1320
- "sdk-skills",
1321
- ".version"
1379
+ return this.cleanDiagnosticHeader(
1380
+ readSdkSkillsLocalVersion(this.config.baseUrl)
1322
1381
  );
1323
- const resolvedPath = (0, import_node_fs2.existsSync)(versionPath) ? versionPath : legacyVersionPath;
1324
- if (!(0, import_node_fs2.existsSync)(resolvedPath)) return null;
1325
- return this.cleanDiagnosticHeader((0, import_node_fs2.readFileSync)(resolvedPath, "utf-8"));
1326
1382
  } catch {
1327
1383
  return null;
1328
1384
  }
@@ -4358,6 +4414,10 @@ var DeeplineClient = class {
4358
4414
  },
4359
4415
  targetPlans: () => this.getTargetBillingPlans(),
4360
4416
  targetStatus: () => this.getTargetBillingStatus(),
4417
+ autoRecharge: {
4418
+ get: () => this.getTargetAutoRecharge(),
4419
+ update: (options2) => this.updateTargetAutoRecharge(options2)
4420
+ },
4361
4421
  purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
4362
4422
  transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
4363
4423
  portalSession: () => this.createTargetBillingPortalSession()
@@ -6443,6 +6503,28 @@ var DeeplineClient = class {
6443
6503
  async getTargetBillingStatus() {
6444
6504
  return this.http.get("/api/v2/billing/status");
6445
6505
  }
6506
+ /** Read the canonical Metronome automatic recharge configuration. */
6507
+ async getTargetAutoRecharge() {
6508
+ return this.http.get(
6509
+ "/api/v2/billing/auto-recharge"
6510
+ );
6511
+ }
6512
+ /** Update automatic recharge and return the server-verified configuration. */
6513
+ async updateTargetAutoRecharge(options) {
6514
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
6515
+ options.idempotencyKey
6516
+ );
6517
+ const response = await this.http.put(
6518
+ "/api/v2/billing/auto-recharge",
6519
+ options.enabled ? {
6520
+ enabled: true,
6521
+ threshold_credits: options.thresholdCredits,
6522
+ refill_to_credits: options.refillToCredits
6523
+ } : { enabled: false },
6524
+ { "Idempotency-Key": idempotencyKey }
6525
+ );
6526
+ return response.data;
6527
+ }
6446
6528
  /**
6447
6529
  * Purchase target-billing credits through the durable commercial operation
6448
6530
  * flow. The caller supplies an idempotency key for safe retries.
@@ -8935,7 +9017,7 @@ function getDefinedPlayMetadata(value) {
8935
9017
 
8936
9018
  // src/tool-output.ts
8937
9019
  var import_node_fs3 = require("fs");
8938
- var import_node_os4 = require("os");
9020
+ var import_node_os3 = require("os");
8939
9021
  var import_node_path3 = require("path");
8940
9022
  function isPlainObject(value) {
8941
9023
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -9053,7 +9135,7 @@ function tryConvertToList(payload, options) {
9053
9135
  return null;
9054
9136
  }
9055
9137
  function ensureOutputDir() {
9056
- const outputDir = (0, import_node_path3.join)((0, import_node_os4.homedir)(), ".local", "share", "deepline", "data");
9138
+ const outputDir = (0, import_node_path3.join)((0, import_node_os3.homedir)(), ".local", "share", "deepline", "data");
9057
9139
  (0, import_node_fs3.mkdirSync)(outputDir, { recursive: true });
9058
9140
  return outputDir;
9059
9141
  }
package/dist/index.mjs CHANGED
@@ -653,11 +653,6 @@ function resolveConfig(options) {
653
653
  };
654
654
  }
655
655
 
656
- // src/http.ts
657
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
658
- import { homedir as homedir3 } from "os";
659
- import { join as join2 } from "path";
660
-
661
656
  // ../shared_libs/plays/artifact-contract-version.ts
662
657
  var CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION = 2;
663
658
 
@@ -706,7 +701,7 @@ var SDK_RELEASE = {
706
701
  // 0.3.0 introduces raw-v2: complete scrubbed provider responses are
707
702
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
708
703
  // getters keep their established compatibility behavior.
709
- version: "0.3.22",
704
+ version: "0.3.24",
710
705
  updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
711
706
  contracts: {
712
707
  api: {
@@ -895,6 +890,79 @@ function detectAgentRuntime(options = {}) {
895
890
  return options.defaultRuntime ?? "unknown";
896
891
  }
897
892
 
893
+ // src/skills-version.ts
894
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
895
+ import { dirname as dirname2, join as join2 } from "path";
896
+ function activePluginSkillsDir() {
897
+ const pluginMode = process.env.DEEPLINE_PLUGIN_MODE?.trim().toLowerCase();
898
+ if (pluginMode !== "true" && pluginMode !== "1" && pluginMode !== "yes" && pluginMode !== "on") {
899
+ return "";
900
+ }
901
+ const dir = process.env.DEEPLINE_PLUGIN_SKILLS_DIR?.trim() ?? "";
902
+ return dir && existsSync2(dir) ? dir : "";
903
+ }
904
+ function readPluginSkillsVersion() {
905
+ const dir = activePluginSkillsDir();
906
+ if (!dir) return "";
907
+ try {
908
+ return readFileSync2(join2(dir, ".version"), "utf-8").trim();
909
+ } catch {
910
+ return "";
911
+ }
912
+ }
913
+ function sdkSkillsVersionPath(baseUrl, agents = []) {
914
+ const suffix = agents.length > 0 ? `-${agents.join("-")}` : "";
915
+ return join2(sdkCliStateDirPath(baseUrl), `skills${suffix}-version`);
916
+ }
917
+ function legacySdkSkillsVersionPath(baseUrl) {
918
+ return join2(dirname2(sdkCliStateDirPath(baseUrl)), "sdk-skills", ".version");
919
+ }
920
+ function resolveAutoSyncSkillAgents() {
921
+ switch (detectAgentRuntime()) {
922
+ case "codex":
923
+ return ["codex"];
924
+ case "claude_code":
925
+ return ["claude-code"];
926
+ case "cursor":
927
+ return ["cursor"];
928
+ case "gemini":
929
+ return ["gemini-cli"];
930
+ case "antigravity":
931
+ return ["antigravity"];
932
+ default:
933
+ return [];
934
+ }
935
+ }
936
+ function readSdkSkillsLocalVersion(baseUrl) {
937
+ const pluginVersion = readPluginSkillsVersion();
938
+ if (pluginVersion) return pluginVersion;
939
+ const agents = resolveAutoSyncSkillAgents();
940
+ const scopedPath = sdkSkillsVersionPath(baseUrl, agents);
941
+ if (agents.length > 0 && existsSync2(scopedPath)) {
942
+ try {
943
+ return readFileSync2(scopedPath, "utf-8").trim();
944
+ } catch {
945
+ return "";
946
+ }
947
+ }
948
+ if (agents.length > 0) {
949
+ const legacyPath = legacySdkSkillsVersionPath(baseUrl);
950
+ if (!existsSync2(legacyPath)) return "";
951
+ try {
952
+ return readFileSync2(legacyPath, "utf-8").trim();
953
+ } catch {
954
+ return "";
955
+ }
956
+ }
957
+ const path = existsSync2(sdkSkillsVersionPath(baseUrl)) ? sdkSkillsVersionPath(baseUrl) : legacySdkSkillsVersionPath(baseUrl);
958
+ if (!existsSync2(path)) return "";
959
+ try {
960
+ return readFileSync2(path, "utf-8").trim();
961
+ } catch {
962
+ return "";
963
+ }
964
+ }
965
+
898
966
  // ../shared_libs/play-runtime/coordinator-headers.ts
899
967
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
900
968
  var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
@@ -1231,21 +1299,9 @@ var HttpClient = class {
1231
1299
  );
1232
1300
  if (explicit) return explicit;
1233
1301
  try {
1234
- const versionPath = join2(
1235
- sdkCliStateDirPath(this.config.baseUrl),
1236
- "skills-version"
1302
+ return this.cleanDiagnosticHeader(
1303
+ readSdkSkillsLocalVersion(this.config.baseUrl)
1237
1304
  );
1238
- const legacyVersionPath = join2(
1239
- process.env.HOME?.trim() || homedir3(),
1240
- ".local",
1241
- "deepline",
1242
- baseUrlSlug(this.config.baseUrl),
1243
- "sdk-skills",
1244
- ".version"
1245
- );
1246
- const resolvedPath = existsSync2(versionPath) ? versionPath : legacyVersionPath;
1247
- if (!existsSync2(resolvedPath)) return null;
1248
- return this.cleanDiagnosticHeader(readFileSync2(resolvedPath, "utf-8"));
1249
1305
  } catch {
1250
1306
  return null;
1251
1307
  }
@@ -4281,6 +4337,10 @@ var DeeplineClient = class {
4281
4337
  },
4282
4338
  targetPlans: () => this.getTargetBillingPlans(),
4283
4339
  targetStatus: () => this.getTargetBillingStatus(),
4340
+ autoRecharge: {
4341
+ get: () => this.getTargetAutoRecharge(),
4342
+ update: (options2) => this.updateTargetAutoRecharge(options2)
4343
+ },
4284
4344
  purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
4285
4345
  transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
4286
4346
  portalSession: () => this.createTargetBillingPortalSession()
@@ -6366,6 +6426,28 @@ var DeeplineClient = class {
6366
6426
  async getTargetBillingStatus() {
6367
6427
  return this.http.get("/api/v2/billing/status");
6368
6428
  }
6429
+ /** Read the canonical Metronome automatic recharge configuration. */
6430
+ async getTargetAutoRecharge() {
6431
+ return this.http.get(
6432
+ "/api/v2/billing/auto-recharge"
6433
+ );
6434
+ }
6435
+ /** Update automatic recharge and return the server-verified configuration. */
6436
+ async updateTargetAutoRecharge(options) {
6437
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
6438
+ options.idempotencyKey
6439
+ );
6440
+ const response = await this.http.put(
6441
+ "/api/v2/billing/auto-recharge",
6442
+ options.enabled ? {
6443
+ enabled: true,
6444
+ threshold_credits: options.thresholdCredits,
6445
+ refill_to_credits: options.refillToCredits
6446
+ } : { enabled: false },
6447
+ { "Idempotency-Key": idempotencyKey }
6448
+ );
6449
+ return response.data;
6450
+ }
6369
6451
  /**
6370
6452
  * Purchase target-billing credits through the durable commercial operation
6371
6453
  * flow. The caller supplies an idempotency key for safe retries.
@@ -8859,13 +8941,13 @@ function getDefinedPlayMetadata(value) {
8859
8941
  // src/tool-output.ts
8860
8942
  import {
8861
8943
  closeSync,
8862
- mkdirSync as mkdirSync2,
8944
+ mkdirSync as mkdirSync3,
8863
8945
  openSync,
8864
- writeFileSync as writeFileSync2,
8946
+ writeFileSync as writeFileSync3,
8865
8947
  writeSync
8866
8948
  } from "fs";
8867
- import { homedir as homedir4 } from "os";
8868
- import { dirname as dirname2, join as join3 } from "path";
8949
+ import { homedir as homedir3 } from "os";
8950
+ import { dirname as dirname3, join as join3 } from "path";
8869
8951
  function isPlainObject(value) {
8870
8952
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
8871
8953
  }
@@ -8982,19 +9064,19 @@ function tryConvertToList(payload, options) {
8982
9064
  return null;
8983
9065
  }
8984
9066
  function ensureOutputDir() {
8985
- const outputDir = join3(homedir4(), ".local", "share", "deepline", "data");
8986
- mkdirSync2(outputDir, { recursive: true });
9067
+ const outputDir = join3(homedir3(), ".local", "share", "deepline", "data");
9068
+ mkdirSync3(outputDir, { recursive: true });
8987
9069
  return outputDir;
8988
9070
  }
8989
9071
  function writeJsonOutputFile(payload, stem) {
8990
9072
  const outputDir = ensureOutputDir();
8991
9073
  const outputPath = join3(outputDir, `${stem}_${Date.now()}.json`);
8992
- writeFileSync2(outputPath, JSON.stringify(payload, null, 2), "utf-8");
9074
+ writeFileSync3(outputPath, JSON.stringify(payload, null, 2), "utf-8");
8993
9075
  return outputPath;
8994
9076
  }
8995
9077
  function writeCsvOutputFile(rows, stem, options) {
8996
9078
  const outputPath = options?.outPath ? options.outPath : join3(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
8997
- mkdirSync2(dirname2(outputPath), { recursive: true });
9079
+ mkdirSync3(dirname3(outputPath), { recursive: true });
8998
9080
  const columns = columnsForRows(rows);
8999
9081
  const escapeCell = (value) => {
9000
9082
  const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
@@ -16,6 +16,7 @@
16
16
  "dist/bundling-sources/sdk/src/plays/local-file-discovery.ts",
17
17
  "dist/bundling-sources/sdk/src/release.ts",
18
18
  "dist/bundling-sources/sdk/src/runs/observe-transport.ts",
19
+ "dist/bundling-sources/sdk/src/skills-version.ts",
19
20
  "dist/bundling-sources/sdk/src/stream-reconnect.ts",
20
21
  "dist/bundling-sources/sdk/src/tool-output.ts",
21
22
  "dist/bundling-sources/sdk/src/types.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",