deepline 0.1.262 → 0.1.264

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
@@ -716,8 +716,10 @@ var SDK_RELEASE = {
716
716
  // Deepline-native radars. Older clients must update before discovering,
717
717
  // checking, or deploying an unlaunched monitor integration.
718
718
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
719
- version: "0.1.262",
720
- apiContract: "2026-07-native-monitor-launch-hard-cutover",
719
+ // 0.1.254 removes the internal operations tree from the published SDK CLI.
720
+ // Operators use the checkout-local deepline-admin binary instead.
721
+ version: "0.1.264",
722
+ apiContract: "2026-07-admin-cli-local-cutover",
721
723
  supportPolicy: {
722
724
  minimumSupported: "0.1.53",
723
725
  deprecatedBelow: "0.1.219",
@@ -2183,10 +2185,10 @@ var OBSERVER_LOG_PAGE_QUERY = "runObservers:getRunLogPageForObserver";
2183
2185
  function errorText(error) {
2184
2186
  return error instanceof Error ? error.message : String(error);
2185
2187
  }
2186
- async function mintRunObserveGrant(http2, runId) {
2188
+ async function mintRunObserveGrant(http, runId) {
2187
2189
  let response;
2188
2190
  try {
2189
- response = await http2.post(
2191
+ response = await http.post(
2190
2192
  `/api/v2/runs/${encodeURIComponent(runId)}/observe-grant`,
2191
2193
  {}
2192
2194
  );
@@ -2250,8 +2252,8 @@ async function backfillLogGap(input2) {
2250
2252
  return lines;
2251
2253
  }
2252
2254
  async function* observeRunEvents(options) {
2253
- const { http: http2, runId } = options;
2254
- let grant = await mintRunObserveGrant(http2, runId);
2255
+ const { http, runId } = options;
2256
+ let grant = await mintRunObserveGrant(http, runId);
2255
2257
  let convexBrowser;
2256
2258
  let convexServer;
2257
2259
  try {
@@ -2314,7 +2316,7 @@ async function* observeRunEvents(options) {
2314
2316
  lastForcedRefreshAt = now;
2315
2317
  }
2316
2318
  try {
2317
- grant = await mintRunObserveGrant(http2, runId);
2319
+ grant = await mintRunObserveGrant(http, runId);
2318
2320
  return grant.token;
2319
2321
  } catch (error) {
2320
2322
  push({ kind: "error", error });
@@ -3066,6 +3068,9 @@ var DeeplineClient = class {
3066
3068
  if (options?.categories?.trim()) {
3067
3069
  params.set("categories", options.categories.trim());
3068
3070
  }
3071
+ if (options?.tags?.trim()) {
3072
+ params.set("tags", options.tags.trim());
3073
+ }
3069
3074
  if (options?.grep?.trim()) {
3070
3075
  params.set("grep", options.grep.trim());
3071
3076
  params.set("grep_mode", options.grepMode ?? "all");
@@ -4945,6 +4950,11 @@ function enforceSdkCompatibilityResponse(response) {
4945
4950
  }
4946
4951
  }
4947
4952
 
4953
+ // src/cli/commands/auth.ts
4954
+ var import_node_fs5 = require("fs");
4955
+ var import_node_os6 = require("os");
4956
+ var import_node_path5 = require("path");
4957
+
4948
4958
  // src/cli/utils.ts
4949
4959
  var import_node_crypto = require("crypto");
4950
4960
  var import_node_fs4 = require("fs");
@@ -5543,6 +5553,7 @@ function errorToJsonPayload(error) {
5543
5553
  const maybeRecord = error && typeof error === "object" ? error : null;
5544
5554
  const code = typeof maybeRecord?.code === "string" ? maybeRecord.code : error instanceof SyntaxError ? "INVALID_JSON" : "CLI_ERROR";
5545
5555
  const details = {};
5556
+ const exitCode = typeof maybeRecord?.exitCode === "number" ? maybeRecord.exitCode : void 0;
5546
5557
  if (typeof maybeRecord?.statusCode === "number") {
5547
5558
  details.statusCode = maybeRecord.statusCode;
5548
5559
  }
@@ -5557,6 +5568,7 @@ function errorToJsonPayload(error) {
5557
5568
  }
5558
5569
  return {
5559
5570
  ok: false,
5571
+ ...exitCode !== void 0 ? { exitCode } : {},
5560
5572
  error: {
5561
5573
  message,
5562
5574
  code,
@@ -5620,139 +5632,7 @@ function printCommandEnvelope(envelope, options = {}) {
5620
5632
  process.stdout.write(options.text ?? renderCommandEnvelopeText(envelope));
5621
5633
  }
5622
5634
 
5623
- // src/cli/commands/admin.ts
5624
- function laneStatusLine(input2) {
5625
- if (input2.lane) {
5626
- return `status: ${input2.lane.status}${input2.lane.active ? " (active)" : ""}`;
5627
- }
5628
- return input2.registration ? `status: ${input2.registration.status}` : "status: (not in registry)";
5629
- }
5630
- function normalizeEnvironment(value) {
5631
- const trimmed = value?.trim().toLowerCase();
5632
- if (!trimmed || trimmed === "production" || trimmed === "prod") {
5633
- return "production";
5634
- }
5635
- if (trimmed === "preview") return "preview";
5636
- throw new Error(
5637
- `Invalid --environment "${value}". Expected production or preview.`
5638
- );
5639
- }
5640
- function http() {
5641
- return new HttpClient(resolveConfig());
5642
- }
5643
- function laneLine(lane) {
5644
- const flag = lane.active ? "* " : " ";
5645
- const depth = lane.queueDepth.empty ? "empty" : `${lane.queueDepth.queuedTasks} tasks / ${lane.queueDepth.nonTerminalRuns} runs`;
5646
- return `${flag}${lane.releaseId} [${lane.status}] queue=${lane.queue} depth=${depth}`;
5647
- }
5648
- async function handleLanesList(options) {
5649
- const environment = normalizeEnvironment(options.environment);
5650
- const payload = await http().get(
5651
- `/api/v2/admin/runtime/lanes?environment=${environment}`
5652
- );
5653
- printCommandEnvelope(
5654
- {
5655
- ...payload,
5656
- render: {
5657
- sections: [
5658
- {
5659
- title: `Absurd lanes (${environment}):`,
5660
- lines: payload.lanes.length > 0 ? payload.lanes.map(laneLine) : ["(no registered lanes)"]
5661
- }
5662
- ]
5663
- }
5664
- },
5665
- { json: options.json }
5666
- );
5667
- }
5668
- async function handleLanesShow(releaseId, options) {
5669
- const environment = normalizeEnvironment(options.environment);
5670
- const payload = await http().get(
5671
- `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5672
- );
5673
- printCommandEnvelope(
5674
- {
5675
- ...payload,
5676
- render: {
5677
- sections: [
5678
- {
5679
- title: `Lane ${releaseId} (${environment}):`,
5680
- lines: [
5681
- `registered: ${payload.registered}`,
5682
- laneStatusLine(payload),
5683
- `queue: ${payload.retireCheck.queue}`,
5684
- `queued tasks: ${payload.retireCheck.queuedTasks}`,
5685
- `non-terminal runs: ${payload.retireCheck.nonTerminalRuns}`,
5686
- `retirable: ${payload.retireCheck.retirable}`
5687
- ]
5688
- }
5689
- ]
5690
- }
5691
- },
5692
- { json: options.json }
5693
- );
5694
- }
5695
- async function handleLanesRetireCheck(releaseId, options) {
5696
- const environment = normalizeEnvironment(options.environment);
5697
- const payload = await http().get(
5698
- `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5699
- );
5700
- printCommandEnvelope(
5701
- {
5702
- ...payload,
5703
- render: {
5704
- sections: [
5705
- {
5706
- title: `Retire check ${releaseId} (${environment}):`,
5707
- lines: [
5708
- payload.retireCheck.retirable ? "retirable: yes (lane queue empty)" : `retirable: no (${payload.retireCheck.queuedTasks} tasks, ${payload.retireCheck.nonTerminalRuns} runs pending)`
5709
- ]
5710
- }
5711
- ]
5712
- }
5713
- },
5714
- { json: options.json }
5715
- );
5716
- }
5717
- async function handleReleasesActivate(releaseId, options) {
5718
- const environment = normalizeEnvironment(options.environment);
5719
- const payload = await http().post(
5720
- "/api/v2/admin/runtime/releases",
5721
- {
5722
- releaseId,
5723
- environment,
5724
- schedulerBackend: options.schedulerBackend ?? "absurd"
5725
- }
5726
- );
5727
- printCommandEnvelope(
5728
- {
5729
- ...payload,
5730
- render: {
5731
- sections: [
5732
- {
5733
- title: `Activated release ${releaseId} (${environment}).`,
5734
- lines: ["Runtime release pointer flipped to this lane."]
5735
- }
5736
- ]
5737
- }
5738
- },
5739
- { json: options.json }
5740
- );
5741
- }
5742
- function registerAdminCommands(program) {
5743
- const admin = program.command("admin").description("Platform-admin operations (runtime lanes, releases).");
5744
- const lanes = admin.command("lanes").description("Inspect Absurd runtime release lanes.");
5745
- lanes.command("list").description("List all registered Absurd lanes with queue depth.").option("--environment <env>", "production (default) or preview").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLanesList);
5746
- lanes.command("show <releaseId>").description("Show one lane and its retire-gate depth.").option("--environment <env>", "production (default) or preview").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLanesShow);
5747
- lanes.command("retire-check <releaseId>").description("Check whether a lane is safe to retire (queue empty).").option("--environment <env>", "production (default) or preview").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLanesRetireCheck);
5748
- const releases = admin.command("releases").description("Manage the active runtime release pointer.");
5749
- releases.command("activate <releaseId>").description("Activate a prior registered Absurd release lane.").option("--environment <env>", "production (default) or preview").option("--scheduler-backend <backend>", "runtime scheduler (absurd only)").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleReleasesActivate);
5750
- }
5751
-
5752
5635
  // src/cli/commands/auth.ts
5753
- var import_node_fs5 = require("fs");
5754
- var import_node_os6 = require("os");
5755
- var import_node_path5 = require("path");
5756
5636
  var EXIT_OK = 0;
5757
5637
  var EXIT_AUTH = 3;
5758
5638
  var EXIT_SERVER = 5;
@@ -6731,8 +6611,8 @@ function defaultLedgerExportPath() {
6731
6611
  );
6732
6612
  }
6733
6613
  async function handleBalance(options) {
6734
- const { http: http2 } = getAuthedHttpClient();
6735
- const payload = await http2.get(
6614
+ const { http } = getAuthedHttpClient();
6615
+ const payload = await http.get(
6736
6616
  "/api/v2/billing/balance"
6737
6617
  );
6738
6618
  const status = String(payload.balance_status || "");
@@ -6766,13 +6646,13 @@ async function handleBalance(options) {
6766
6646
  return;
6767
6647
  }
6768
6648
  async function handleUsage(options) {
6769
- const { http: http2 } = getAuthedHttpClient();
6649
+ const { http } = getAuthedHttpClient();
6770
6650
  const params = new URLSearchParams();
6771
6651
  if (options.limit) params.set("recent_limit", options.limit);
6772
6652
  if (options.offset) params.set("recent_offset", options.offset);
6773
6653
  if (options.runId) params.set("run_id", options.runId);
6774
6654
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
6775
- const payload = await http2.get(
6655
+ const payload = await http.get(
6776
6656
  `/api/v2/billing/usage${suffix}`
6777
6657
  );
6778
6658
  const usage = payload.usage ?? {};
@@ -6798,8 +6678,8 @@ async function handleUsage(options) {
6798
6678
  );
6799
6679
  }
6800
6680
  async function handleLimit(options) {
6801
- const { http: http2 } = getAuthedHttpClient();
6802
- const payload = await http2.get(
6681
+ const { http } = getAuthedHttpClient();
6682
+ const payload = await http.get(
6803
6683
  "/api/v2/billing/limit"
6804
6684
  );
6805
6685
  const lines = payload.enabled ? [
@@ -6815,8 +6695,8 @@ async function handleLimit(options) {
6815
6695
  );
6816
6696
  }
6817
6697
  async function handleSetLimit(credits, options) {
6818
- const { http: http2 } = getAuthedHttpClient();
6819
- const payload = await http2.request("/api/v2/billing/limit", {
6698
+ const { http } = getAuthedHttpClient();
6699
+ const payload = await http.request("/api/v2/billing/limit", {
6820
6700
  method: "PUT",
6821
6701
  body: { monthly_credits_limit: Number.parseInt(credits, 10) }
6822
6702
  });
@@ -6836,8 +6716,8 @@ async function handleSetLimit(credits, options) {
6836
6716
  );
6837
6717
  }
6838
6718
  async function handleLimitOff(options) {
6839
- const { http: http2 } = getAuthedHttpClient();
6840
- const payload = await http2.request("/api/v2/billing/limit", {
6719
+ const { http } = getAuthedHttpClient();
6720
+ const payload = await http.request("/api/v2/billing/limit", {
6841
6721
  method: "DELETE"
6842
6722
  });
6843
6723
  printCommandEnvelope(
@@ -6856,7 +6736,7 @@ async function handleLimitOff(options) {
6856
6736
  );
6857
6737
  }
6858
6738
  async function handleHistory(options) {
6859
- const { http: http2 } = getAuthedHttpClient();
6739
+ const { http } = getAuthedHttpClient();
6860
6740
  const windows = {
6861
6741
  "1d": 86400,
6862
6742
  "1w": 604800,
@@ -6872,7 +6752,7 @@ async function handleHistory(options) {
6872
6752
  limit: String(BILLING_HISTORY_EXPORT_LIMIT - entries.length)
6873
6753
  });
6874
6754
  if (cursor !== null) params.set("cursor", cursor);
6875
- const payload = await http2.get(
6755
+ const payload = await http.get(
6876
6756
  `/api/v2/billing/ledger?${params.toString()}`
6877
6757
  );
6878
6758
  if (Array.isArray(payload.entries)) {
@@ -6917,7 +6797,7 @@ async function handleHistory(options) {
6917
6797
  );
6918
6798
  }
6919
6799
  async function handleLedgerExportAll(options) {
6920
- const { http: http2 } = getAuthedHttpClient();
6800
+ const { http } = getAuthedHttpClient();
6921
6801
  const outputPath = options.output ? (0, import_node_path6.resolve)(String(options.output)) : defaultLedgerExportPath();
6922
6802
  let summary = { row_count: 0, net_delta_credits: 0 };
6923
6803
  let cursor = null;
@@ -6926,7 +6806,7 @@ async function handleLedgerExportAll(options) {
6926
6806
  const params = new URLSearchParams({ limit: "5000" });
6927
6807
  if (cursor !== null) params.set("cursor", cursor);
6928
6808
  if (options.runId) params.set("run_id", options.runId);
6929
- const payload = await http2.get(
6809
+ const payload = await http.get(
6930
6810
  `/api/v2/billing/ledger?${params.toString()}`
6931
6811
  );
6932
6812
  const entries = Array.isArray(payload.entries) ? payload.entries : [];
@@ -6986,8 +6866,8 @@ function planRolloverText(rollover) {
6986
6866
  return `rollover ${mode}`;
6987
6867
  }
6988
6868
  async function handlePlans(options) {
6989
- const { http: http2 } = getAuthedHttpClient();
6990
- const payload = await http2.get(
6869
+ const { http } = getAuthedHttpClient();
6870
+ const payload = await http.get(
6991
6871
  "/api/v2/billing/catalog/current"
6992
6872
  );
6993
6873
  const activePlan = payload.active_plan ?? {};
@@ -7019,8 +6899,8 @@ async function handlePlans(options) {
7019
6899
  );
7020
6900
  }
7021
6901
  async function handleSubscribe(planVersionId, options) {
7022
- const { http: http2 } = getAuthedHttpClient();
7023
- const payload = await http2.request(
6902
+ const { http } = getAuthedHttpClient();
6903
+ const payload = await http.request(
7024
6904
  "/api/v2/billing/subscription/checkout",
7025
6905
  {
7026
6906
  method: "POST",
@@ -7239,8 +7119,8 @@ async function handleInvoices(options) {
7239
7119
  );
7240
7120
  }
7241
7121
  async function handleCheckout(options) {
7242
- const { http: http2 } = getAuthedHttpClient();
7243
- const payload = await http2.post(
7122
+ const { http } = getAuthedHttpClient();
7123
+ const payload = await http.post(
7244
7124
  "/api/v2/billing/checkout",
7245
7125
  {
7246
7126
  ...options.tier ? { tierId: options.tier } : {},
@@ -7359,8 +7239,8 @@ async function handleTopUp(creditsRaw, options) {
7359
7239
  });
7360
7240
  }
7361
7241
  async function handleRedeemCode(code, options) {
7362
- const { http: http2 } = getAuthedHttpClient();
7363
- const payload = await http2.post(
7242
+ const { http } = getAuthedHttpClient();
7243
+ const payload = await http.post(
7364
7244
  "/api/v2/billing/checkout",
7365
7245
  {
7366
7246
  discountCode: code
@@ -12465,13 +12345,21 @@ function getStatusFromLiveEvent(event) {
12465
12345
  const payload = getEventPayload(event);
12466
12346
  return playStatusValue(payload.status) ?? playStatusValue(getRunRecordFromPackage(payload)?.status);
12467
12347
  }
12348
+ function getWaitKindFromLiveEvent(event) {
12349
+ const payload = getEventPayload(event);
12350
+ const progress = payload.progress && typeof payload.progress === "object" ? payload.progress : null;
12351
+ const waitKind = payload.waitKind ?? progress?.waitKind;
12352
+ return typeof waitKind === "string" && waitKind.trim() ? waitKind.trim() : null;
12353
+ }
12468
12354
  function writePlayWaitingHint(input2) {
12469
12355
  if (getStatusFromLiveEvent(input2.event) !== "waiting") return;
12470
12356
  const runId = getRunIdFromLiveEvent(input2.event);
12471
12357
  if (!runId || input2.state.waitingRunId === runId) return;
12472
12358
  input2.state.waitingRunId = runId;
12359
+ const waitKind = getWaitKindFromLiveEvent(input2.event);
12360
+ const message = waitKind === "integration_event" || waitKind === "integration_event_batch" ? "is waiting for an external event." : waitKind === "sleep" ? "is waiting for its scheduled resume." : waitKind === "detached_runner" ? "is executing in the runtime." : "is waiting on a durable runtime boundary.";
12473
12361
  input2.progress.writeLine(
12474
- `[play waiting] ${runId} is waiting for an external approval or event. The command will continue watching; inspect it with 'deepline runs get ${runId} --full --json'.`
12362
+ `[play waiting] ${runId} ${message} The command will continue watching; inspect it with 'deepline runs get ${runId} --full --json'.`
12475
12363
  );
12476
12364
  }
12477
12365
  function getFinalStatusFromLiveEvent(event) {
@@ -12734,6 +12622,9 @@ function getRunningHeartbeatLine(input2) {
12734
12622
  return `queued ${target}: waiting for worker capacity`;
12735
12623
  }
12736
12624
  if (status === "waiting") {
12625
+ if (getWaitKindFromLiveEvent(input2.event) === "detached_runner") {
12626
+ return `running ${target}: executing in detached runtime`;
12627
+ }
12737
12628
  return `waiting ${target}: waiting on external work`;
12738
12629
  }
12739
12630
  return `running ${target}: still processing`;
@@ -23466,8 +23357,8 @@ function registerEnrichCommand(program) {
23466
23357
 
23467
23358
  // src/cli/commands/feedback.ts
23468
23359
  async function handleFeedback(text, options) {
23469
- const { http: http2 } = getAuthedHttpClient();
23470
- const response = await http2.post("/api/v2/cli/feedback", {
23360
+ const { http } = getAuthedHttpClient();
23361
+ const response = await http.post("/api/v2/cli/feedback", {
23471
23362
  text,
23472
23363
  environment: collectLocalEnvInfo(),
23473
23364
  ...options.command ? { command: options.command } : {},
@@ -23871,8 +23762,8 @@ function buildSessionUploadContent(raw) {
23871
23762
  return { encodedContent: encoded, needsChunking: true };
23872
23763
  }
23873
23764
  async function uploadPayload(path, payload) {
23874
- const { http: http2 } = getAuthedHttpClient();
23875
- return await http2.post(path, payload);
23765
+ const { http } = getAuthedHttpClient();
23766
+ return await http.post(path, payload);
23876
23767
  }
23877
23768
  async function uploadChunkedSessions(sessions, options) {
23878
23769
  const uploadId = (0, import_node_crypto5.randomUUID)();
@@ -24658,8 +24549,8 @@ Preview the plan first with:
24658
24549
  );
24659
24550
  }
24660
24551
  async function handleMonitorsStatus(options) {
24661
- const http2 = buildHttpClient();
24662
- const payload = await http2.request(
24552
+ const http = buildHttpClient();
24553
+ const payload = await http.request(
24663
24554
  "/api/v2/monitors/access",
24664
24555
  { method: "GET" }
24665
24556
  );
@@ -24732,7 +24623,7 @@ async function handleMonitorsAvailable(toolId, options) {
24732
24623
  }
24733
24624
  }
24734
24625
  const tool = toolId ?? options.tool;
24735
- const http2 = buildHttpClient();
24626
+ const http = buildHttpClient();
24736
24627
  const params = new URLSearchParams();
24737
24628
  if (options.provider) params.set("provider", options.provider);
24738
24629
  if (tool) params.set("tool", tool);
@@ -24741,7 +24632,7 @@ async function handleMonitorsAvailable(toolId, options) {
24741
24632
  const compactList = !tool && !options.full;
24742
24633
  if (compactList || options.compact) params.set("compact", "true");
24743
24634
  const query = params.toString();
24744
- const payload = await http2.request(
24635
+ const payload = await http.request(
24745
24636
  `/api/v2/monitors/tools${query ? `?${query}` : ""}`,
24746
24637
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24747
24638
  );
@@ -24781,13 +24672,13 @@ function renderDeployedListText(payload, requestedStatus) {
24781
24672
  `;
24782
24673
  }
24783
24674
  async function handleMonitorsList(options) {
24784
- const http2 = buildHttpClient();
24675
+ const http = buildHttpClient();
24785
24676
  const params = new URLSearchParams();
24786
24677
  if (options.status) params.set("status", options.status);
24787
24678
  if (options.limit) params.set("limit", options.limit);
24788
24679
  if (options.compact) params.set("compact", "true");
24789
24680
  const query = params.toString();
24790
- const payload = await http2.request(
24681
+ const payload = await http.request(
24791
24682
  `/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
24792
24683
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24793
24684
  );
@@ -24797,21 +24688,21 @@ async function handleMonitorsList(options) {
24797
24688
  });
24798
24689
  }
24799
24690
  async function handleMonitorsCheck(definition, options) {
24800
- const http2 = buildHttpClient();
24691
+ const http = buildHttpClient();
24801
24692
  const body = resolveMonitorJsonBody({
24802
24693
  positional: definition,
24803
24694
  file: options.file,
24804
24695
  argLabel: "<definition>",
24805
24696
  command: "deepline monitors check"
24806
24697
  });
24807
- const payload = await http2.request(
24698
+ const payload = await http.request(
24808
24699
  "/api/v2/monitors/check",
24809
24700
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24810
24701
  );
24811
24702
  printCommandEnvelope(payload, { json: options.json });
24812
24703
  }
24813
24704
  async function handleMonitorsDeploy(definition, options) {
24814
- const http2 = buildHttpClient();
24705
+ const http = buildHttpClient();
24815
24706
  const body = resolveMonitorJsonBody({
24816
24707
  positional: definition,
24817
24708
  file: options.file,
@@ -24819,7 +24710,7 @@ async function handleMonitorsDeploy(definition, options) {
24819
24710
  command: "deepline monitors deploy"
24820
24711
  });
24821
24712
  if (options.dryRun) {
24822
- const payload2 = await http2.request(
24713
+ const payload2 = await http.request(
24823
24714
  "/api/v2/monitors/check",
24824
24715
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24825
24716
  );
@@ -24833,7 +24724,7 @@ async function handleMonitorsDeploy(definition, options) {
24833
24724
  }
24834
24725
  return;
24835
24726
  }
24836
- const payload = await http2.request(
24727
+ const payload = await http.request(
24837
24728
  "/api/v2/monitors/deploy",
24838
24729
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24839
24730
  );
@@ -24885,12 +24776,12 @@ function renderMonitorGet(payload) {
24885
24776
  `;
24886
24777
  }
24887
24778
  async function handleMonitorsGet(key, options) {
24888
- const http2 = buildHttpClient();
24889
- const payload = await http2.request(
24779
+ const http = buildHttpClient();
24780
+ const payload = await http.request(
24890
24781
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
24891
24782
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24892
24783
  );
24893
- const dependents = await http2.request(
24784
+ const dependents = await http.request(
24894
24785
  `/api/v2/monitors/deployed/${encodeKey(key)}/dependents`,
24895
24786
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24896
24787
  );
@@ -24916,12 +24807,12 @@ async function confirmMonitorDelete(key, options) {
24916
24807
  }
24917
24808
  }
24918
24809
  async function handleMonitorsDelete(key, options) {
24919
- const http2 = buildHttpClient();
24810
+ const http = buildHttpClient();
24920
24811
  const params = new URLSearchParams();
24921
24812
  if (options.localOnly) params.set("local_only", "true");
24922
24813
  if (options.dryRun) {
24923
24814
  params.set("dry_run", "true");
24924
- const payload2 = await http2.request(
24815
+ const payload2 = await http.request(
24925
24816
  `/api/v2/monitors/deployed/${encodeKey(key)}?${params.toString()}`,
24926
24817
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
24927
24818
  );
@@ -24953,30 +24844,30 @@ async function handleMonitorsDelete(key, options) {
24953
24844
  }
24954
24845
  }
24955
24846
  const query = params.toString();
24956
- const payload = await http2.request(
24847
+ const payload = await http.request(
24957
24848
  `/api/v2/monitors/deployed/${encodeKey(key)}${query ? `?${query}` : ""}`,
24958
24849
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
24959
24850
  );
24960
24851
  printCommandEnvelope(payload, { json: options.json });
24961
24852
  }
24962
24853
  async function handleMonitorsUpdate(key, patch, options) {
24963
- const http2 = buildHttpClient();
24854
+ const http = buildHttpClient();
24964
24855
  const body = resolveMonitorJsonBody({
24965
24856
  positional: patch,
24966
24857
  file: options.file,
24967
24858
  argLabel: "<patch>",
24968
24859
  command: `deepline monitors update ${key}`
24969
24860
  });
24970
- const payload = await http2.request(
24861
+ const payload = await http.request(
24971
24862
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
24972
24863
  { method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
24973
24864
  );
24974
24865
  printCommandEnvelope(payload, { json: options.json });
24975
24866
  }
24976
24867
  async function handleMonitorsReactivate(key, options) {
24977
- const http2 = buildHttpClient();
24868
+ const http = buildHttpClient();
24978
24869
  if (options.dryRun) {
24979
- const payload2 = await http2.request(
24870
+ const payload2 = await http.request(
24980
24871
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate?dry_run=true`,
24981
24872
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
24982
24873
  );
@@ -24990,7 +24881,7 @@ async function handleMonitorsReactivate(key, options) {
24990
24881
  });
24991
24882
  return;
24992
24883
  }
24993
- const payload = await http2.request(
24884
+ const payload = await http.request(
24994
24885
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
24995
24886
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
24996
24887
  );
@@ -25236,8 +25127,8 @@ Examples:
25236
25127
  }
25237
25128
 
25238
25129
  // src/cli/commands/org.ts
25239
- async function fetchOrganizations(http2, apiKey) {
25240
- return http2.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
25130
+ async function fetchOrganizations(http, apiKey) {
25131
+ return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
25241
25132
  }
25242
25133
  function normalizeAuthScope2(value) {
25243
25134
  if (!value) return "auto";
@@ -25341,8 +25232,8 @@ function resolveOrgSwitchAuthTarget(scope, config) {
25341
25232
  }
25342
25233
  async function handleOrgList(options) {
25343
25234
  const config = resolveConfig();
25344
- const http2 = new HttpClient(config);
25345
- const payload = await fetchOrganizations(http2, config.apiKey);
25235
+ const http = new HttpClient(config);
25236
+ const payload = await fetchOrganizations(http, config.apiKey);
25346
25237
  printCommandEnvelope(
25347
25238
  {
25348
25239
  ...payload,
@@ -25360,8 +25251,8 @@ async function handleOrgList(options) {
25360
25251
  }
25361
25252
  async function handleOrgStatus(options) {
25362
25253
  const config = resolveConfig();
25363
- const http2 = new HttpClient(config);
25364
- const payload = await fetchOrganizations(http2, config.apiKey);
25254
+ const http = new HttpClient(config);
25255
+ const payload = await fetchOrganizations(http, config.apiKey);
25365
25256
  const current = payload.organizations.find((org) => org.is_current) ?? payload.organizations.find(
25366
25257
  (org) => org.org_id === payload.current_org_id
25367
25258
  ) ?? null;
@@ -25444,8 +25335,8 @@ async function handleOrgStatus(options) {
25444
25335
  async function handleOrgSwitch(selection, options) {
25445
25336
  const authScope = normalizeAuthScope2(options.authScope);
25446
25337
  const config = resolveConfig();
25447
- const http2 = new HttpClient(config);
25448
- const payload = await fetchOrganizations(http2, config.apiKey);
25338
+ const http = new HttpClient(config);
25339
+ const payload = await fetchOrganizations(http, config.apiKey);
25449
25340
  if (!selection && !options.orgId) {
25450
25341
  printCommandEnvelope(
25451
25342
  {
@@ -25540,7 +25431,7 @@ async function handleOrgSwitch(selection, options) {
25540
25431
  );
25541
25432
  return;
25542
25433
  }
25543
- const switched = await http2.post("/api/v2/auth/cli/switch", {
25434
+ const switched = await http.post("/api/v2/auth/cli/switch", {
25544
25435
  api_key: config.apiKey,
25545
25436
  org_id: target.org_id
25546
25437
  });
@@ -25608,8 +25499,8 @@ async function handleOrgSwitch(selection, options) {
25608
25499
  }
25609
25500
  async function handleOrgCreate(name, options) {
25610
25501
  const config = resolveConfig();
25611
- const http2 = new HttpClient(config);
25612
- const created = await http2.post("/api/v2/auth/cli/org-create", {
25502
+ const http = new HttpClient(config);
25503
+ const created = await http.post("/api/v2/auth/cli/org-create", {
25613
25504
  api_key: config.apiKey,
25614
25505
  name
25615
25506
  });
@@ -26201,8 +26092,8 @@ async function handleSet(nameInput, forbidden, options) {
26201
26092
  throw new Error("--play <name> is required when --scope play is used.");
26202
26093
  }
26203
26094
  const value = await readSecretValue();
26204
- const { http: http2 } = getAuthedHttpClient();
26205
- const response = await http2.post(
26095
+ const { http } = getAuthedHttpClient();
26096
+ const response = await http.post(
26206
26097
  "/api/v2/secrets",
26207
26098
  {
26208
26099
  name,
@@ -31995,7 +31886,7 @@ async function runPreflightCheck() {
31995
31886
  };
31996
31887
  }).catch(() => ({ status: "unreachable", version: null })).finally(() => clearTimeout(healthTimeout));
31997
31888
  const apiKey = resolveApiKeyForBaseUrl(baseUrl);
31998
- const http2 = apiKey ? new HttpClient(
31889
+ const http = apiKey ? new HttpClient(
31999
31890
  resolveConfig({
32000
31891
  baseUrl,
32001
31892
  apiKey,
@@ -32003,8 +31894,8 @@ async function runPreflightCheck() {
32003
31894
  maxRetries: 0
32004
31895
  })
32005
31896
  ) : null;
32006
- const [auth, billing] = http2 ? await Promise.all([
32007
- http2.post("/api/v2/auth/cli/status", {
31897
+ const [auth, billing] = http ? await Promise.all([
31898
+ http.post("/api/v2/auth/cli/status", {
32008
31899
  api_key: apiKey,
32009
31900
  reveal: false
32010
31901
  }).catch((error) => ({
@@ -32012,7 +31903,7 @@ async function runPreflightCheck() {
32012
31903
  connected: false,
32013
31904
  error: preflightErrorMessage(error)
32014
31905
  })),
32015
- http2.get("/api/v2/billing/balance").catch((error) => ({
31906
+ http.get("/api/v2/billing/balance").catch((error) => ({
32016
31907
  balance: null,
32017
31908
  balance_display: "unavailable",
32018
31909
  balance_status: "unknown",
@@ -32195,7 +32086,6 @@ Exit codes:
32195
32086
  registerBillingCommands(program);
32196
32087
  registerMonitorsCommands(program);
32197
32088
  registerOrgCommands(program);
32198
- registerAdminCommands(program);
32199
32089
  registerEnrichCommand(program);
32200
32090
  registerCsvCommands(program);
32201
32091
  registerDbCommands(program);
@@ -32365,7 +32255,8 @@ Examples:
32365
32255
  } else {
32366
32256
  console.error(`Error: ${String(error)}`);
32367
32257
  }
32368
- const failureExitCode = resolveSdkCliFailureExitCode(error);
32258
+ const explicitExitCode = error && typeof error === "object" && typeof error.exitCode === "number" ? error.exitCode : void 0;
32259
+ const failureExitCode = explicitExitCode ?? resolveSdkCliFailureExitCode(error);
32369
32260
  process.exitCode = failureExitCode;
32370
32261
  await maybeReportSdkCliFailure({
32371
32262
  argv: process.argv.slice(2),