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.
@@ -701,8 +701,10 @@ var SDK_RELEASE = {
701
701
  // Deepline-native radars. Older clients must update before discovering,
702
702
  // checking, or deploying an unlaunched monitor integration.
703
703
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
704
- version: "0.1.262",
705
- apiContract: "2026-07-native-monitor-launch-hard-cutover",
704
+ // 0.1.254 removes the internal operations tree from the published SDK CLI.
705
+ // Operators use the checkout-local deepline-admin binary instead.
706
+ version: "0.1.264",
707
+ apiContract: "2026-07-admin-cli-local-cutover",
706
708
  supportPolicy: {
707
709
  minimumSupported: "0.1.53",
708
710
  deprecatedBelow: "0.1.219",
@@ -2168,10 +2170,10 @@ var OBSERVER_LOG_PAGE_QUERY = "runObservers:getRunLogPageForObserver";
2168
2170
  function errorText(error) {
2169
2171
  return error instanceof Error ? error.message : String(error);
2170
2172
  }
2171
- async function mintRunObserveGrant(http2, runId) {
2173
+ async function mintRunObserveGrant(http, runId) {
2172
2174
  let response;
2173
2175
  try {
2174
- response = await http2.post(
2176
+ response = await http.post(
2175
2177
  `/api/v2/runs/${encodeURIComponent(runId)}/observe-grant`,
2176
2178
  {}
2177
2179
  );
@@ -2235,8 +2237,8 @@ async function backfillLogGap(input2) {
2235
2237
  return lines;
2236
2238
  }
2237
2239
  async function* observeRunEvents(options) {
2238
- const { http: http2, runId } = options;
2239
- let grant = await mintRunObserveGrant(http2, runId);
2240
+ const { http, runId } = options;
2241
+ let grant = await mintRunObserveGrant(http, runId);
2240
2242
  let convexBrowser;
2241
2243
  let convexServer;
2242
2244
  try {
@@ -2299,7 +2301,7 @@ async function* observeRunEvents(options) {
2299
2301
  lastForcedRefreshAt = now;
2300
2302
  }
2301
2303
  try {
2302
- grant = await mintRunObserveGrant(http2, runId);
2304
+ grant = await mintRunObserveGrant(http, runId);
2303
2305
  return grant.token;
2304
2306
  } catch (error) {
2305
2307
  push({ kind: "error", error });
@@ -3051,6 +3053,9 @@ var DeeplineClient = class {
3051
3053
  if (options?.categories?.trim()) {
3052
3054
  params.set("categories", options.categories.trim());
3053
3055
  }
3056
+ if (options?.tags?.trim()) {
3057
+ params.set("tags", options.tags.trim());
3058
+ }
3054
3059
  if (options?.grep?.trim()) {
3055
3060
  params.set("grep", options.grep.trim());
3056
3061
  params.set("grep_mode", options.grepMode ?? "all");
@@ -4930,6 +4935,17 @@ function enforceSdkCompatibilityResponse(response) {
4930
4935
  }
4931
4936
  }
4932
4937
 
4938
+ // src/cli/commands/auth.ts
4939
+ import {
4940
+ existsSync as existsSync5,
4941
+ mkdirSync as mkdirSync4,
4942
+ readFileSync as readFileSync5,
4943
+ rmSync as rmSync2,
4944
+ writeFileSync as writeFileSync4
4945
+ } from "fs";
4946
+ import { hostname } from "os";
4947
+ import { dirname as dirname4, join as join5 } from "path";
4948
+
4933
4949
  // src/cli/utils.ts
4934
4950
  import { createHash } from "crypto";
4935
4951
  import {
@@ -5534,6 +5550,7 @@ function errorToJsonPayload(error) {
5534
5550
  const maybeRecord = error && typeof error === "object" ? error : null;
5535
5551
  const code = typeof maybeRecord?.code === "string" ? maybeRecord.code : error instanceof SyntaxError ? "INVALID_JSON" : "CLI_ERROR";
5536
5552
  const details = {};
5553
+ const exitCode = typeof maybeRecord?.exitCode === "number" ? maybeRecord.exitCode : void 0;
5537
5554
  if (typeof maybeRecord?.statusCode === "number") {
5538
5555
  details.statusCode = maybeRecord.statusCode;
5539
5556
  }
@@ -5548,6 +5565,7 @@ function errorToJsonPayload(error) {
5548
5565
  }
5549
5566
  return {
5550
5567
  ok: false,
5568
+ ...exitCode !== void 0 ? { exitCode } : {},
5551
5569
  error: {
5552
5570
  message,
5553
5571
  code,
@@ -5611,145 +5629,7 @@ function printCommandEnvelope(envelope, options = {}) {
5611
5629
  process.stdout.write(options.text ?? renderCommandEnvelopeText(envelope));
5612
5630
  }
5613
5631
 
5614
- // src/cli/commands/admin.ts
5615
- function laneStatusLine(input2) {
5616
- if (input2.lane) {
5617
- return `status: ${input2.lane.status}${input2.lane.active ? " (active)" : ""}`;
5618
- }
5619
- return input2.registration ? `status: ${input2.registration.status}` : "status: (not in registry)";
5620
- }
5621
- function normalizeEnvironment(value) {
5622
- const trimmed = value?.trim().toLowerCase();
5623
- if (!trimmed || trimmed === "production" || trimmed === "prod") {
5624
- return "production";
5625
- }
5626
- if (trimmed === "preview") return "preview";
5627
- throw new Error(
5628
- `Invalid --environment "${value}". Expected production or preview.`
5629
- );
5630
- }
5631
- function http() {
5632
- return new HttpClient(resolveConfig());
5633
- }
5634
- function laneLine(lane) {
5635
- const flag = lane.active ? "* " : " ";
5636
- const depth = lane.queueDepth.empty ? "empty" : `${lane.queueDepth.queuedTasks} tasks / ${lane.queueDepth.nonTerminalRuns} runs`;
5637
- return `${flag}${lane.releaseId} [${lane.status}] queue=${lane.queue} depth=${depth}`;
5638
- }
5639
- async function handleLanesList(options) {
5640
- const environment = normalizeEnvironment(options.environment);
5641
- const payload = await http().get(
5642
- `/api/v2/admin/runtime/lanes?environment=${environment}`
5643
- );
5644
- printCommandEnvelope(
5645
- {
5646
- ...payload,
5647
- render: {
5648
- sections: [
5649
- {
5650
- title: `Absurd lanes (${environment}):`,
5651
- lines: payload.lanes.length > 0 ? payload.lanes.map(laneLine) : ["(no registered lanes)"]
5652
- }
5653
- ]
5654
- }
5655
- },
5656
- { json: options.json }
5657
- );
5658
- }
5659
- async function handleLanesShow(releaseId, options) {
5660
- const environment = normalizeEnvironment(options.environment);
5661
- const payload = await http().get(
5662
- `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5663
- );
5664
- printCommandEnvelope(
5665
- {
5666
- ...payload,
5667
- render: {
5668
- sections: [
5669
- {
5670
- title: `Lane ${releaseId} (${environment}):`,
5671
- lines: [
5672
- `registered: ${payload.registered}`,
5673
- laneStatusLine(payload),
5674
- `queue: ${payload.retireCheck.queue}`,
5675
- `queued tasks: ${payload.retireCheck.queuedTasks}`,
5676
- `non-terminal runs: ${payload.retireCheck.nonTerminalRuns}`,
5677
- `retirable: ${payload.retireCheck.retirable}`
5678
- ]
5679
- }
5680
- ]
5681
- }
5682
- },
5683
- { json: options.json }
5684
- );
5685
- }
5686
- async function handleLanesRetireCheck(releaseId, options) {
5687
- const environment = normalizeEnvironment(options.environment);
5688
- const payload = await http().get(
5689
- `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5690
- );
5691
- printCommandEnvelope(
5692
- {
5693
- ...payload,
5694
- render: {
5695
- sections: [
5696
- {
5697
- title: `Retire check ${releaseId} (${environment}):`,
5698
- lines: [
5699
- payload.retireCheck.retirable ? "retirable: yes (lane queue empty)" : `retirable: no (${payload.retireCheck.queuedTasks} tasks, ${payload.retireCheck.nonTerminalRuns} runs pending)`
5700
- ]
5701
- }
5702
- ]
5703
- }
5704
- },
5705
- { json: options.json }
5706
- );
5707
- }
5708
- async function handleReleasesActivate(releaseId, options) {
5709
- const environment = normalizeEnvironment(options.environment);
5710
- const payload = await http().post(
5711
- "/api/v2/admin/runtime/releases",
5712
- {
5713
- releaseId,
5714
- environment,
5715
- schedulerBackend: options.schedulerBackend ?? "absurd"
5716
- }
5717
- );
5718
- printCommandEnvelope(
5719
- {
5720
- ...payload,
5721
- render: {
5722
- sections: [
5723
- {
5724
- title: `Activated release ${releaseId} (${environment}).`,
5725
- lines: ["Runtime release pointer flipped to this lane."]
5726
- }
5727
- ]
5728
- }
5729
- },
5730
- { json: options.json }
5731
- );
5732
- }
5733
- function registerAdminCommands(program) {
5734
- const admin = program.command("admin").description("Platform-admin operations (runtime lanes, releases).");
5735
- const lanes = admin.command("lanes").description("Inspect Absurd runtime release lanes.");
5736
- 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);
5737
- 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);
5738
- 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);
5739
- const releases = admin.command("releases").description("Manage the active runtime release pointer.");
5740
- 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);
5741
- }
5742
-
5743
5632
  // src/cli/commands/auth.ts
5744
- import {
5745
- existsSync as existsSync5,
5746
- mkdirSync as mkdirSync4,
5747
- readFileSync as readFileSync5,
5748
- rmSync as rmSync2,
5749
- writeFileSync as writeFileSync4
5750
- } from "fs";
5751
- import { hostname } from "os";
5752
- import { dirname as dirname4, join as join5 } from "path";
5753
5633
  var EXIT_OK = 0;
5754
5634
  var EXIT_AUTH = 3;
5755
5635
  var EXIT_SERVER = 5;
@@ -6728,8 +6608,8 @@ function defaultLedgerExportPath() {
6728
6608
  );
6729
6609
  }
6730
6610
  async function handleBalance(options) {
6731
- const { http: http2 } = getAuthedHttpClient();
6732
- const payload = await http2.get(
6611
+ const { http } = getAuthedHttpClient();
6612
+ const payload = await http.get(
6733
6613
  "/api/v2/billing/balance"
6734
6614
  );
6735
6615
  const status = String(payload.balance_status || "");
@@ -6763,13 +6643,13 @@ async function handleBalance(options) {
6763
6643
  return;
6764
6644
  }
6765
6645
  async function handleUsage(options) {
6766
- const { http: http2 } = getAuthedHttpClient();
6646
+ const { http } = getAuthedHttpClient();
6767
6647
  const params = new URLSearchParams();
6768
6648
  if (options.limit) params.set("recent_limit", options.limit);
6769
6649
  if (options.offset) params.set("recent_offset", options.offset);
6770
6650
  if (options.runId) params.set("run_id", options.runId);
6771
6651
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
6772
- const payload = await http2.get(
6652
+ const payload = await http.get(
6773
6653
  `/api/v2/billing/usage${suffix}`
6774
6654
  );
6775
6655
  const usage = payload.usage ?? {};
@@ -6795,8 +6675,8 @@ async function handleUsage(options) {
6795
6675
  );
6796
6676
  }
6797
6677
  async function handleLimit(options) {
6798
- const { http: http2 } = getAuthedHttpClient();
6799
- const payload = await http2.get(
6678
+ const { http } = getAuthedHttpClient();
6679
+ const payload = await http.get(
6800
6680
  "/api/v2/billing/limit"
6801
6681
  );
6802
6682
  const lines = payload.enabled ? [
@@ -6812,8 +6692,8 @@ async function handleLimit(options) {
6812
6692
  );
6813
6693
  }
6814
6694
  async function handleSetLimit(credits, options) {
6815
- const { http: http2 } = getAuthedHttpClient();
6816
- const payload = await http2.request("/api/v2/billing/limit", {
6695
+ const { http } = getAuthedHttpClient();
6696
+ const payload = await http.request("/api/v2/billing/limit", {
6817
6697
  method: "PUT",
6818
6698
  body: { monthly_credits_limit: Number.parseInt(credits, 10) }
6819
6699
  });
@@ -6833,8 +6713,8 @@ async function handleSetLimit(credits, options) {
6833
6713
  );
6834
6714
  }
6835
6715
  async function handleLimitOff(options) {
6836
- const { http: http2 } = getAuthedHttpClient();
6837
- const payload = await http2.request("/api/v2/billing/limit", {
6716
+ const { http } = getAuthedHttpClient();
6717
+ const payload = await http.request("/api/v2/billing/limit", {
6838
6718
  method: "DELETE"
6839
6719
  });
6840
6720
  printCommandEnvelope(
@@ -6853,7 +6733,7 @@ async function handleLimitOff(options) {
6853
6733
  );
6854
6734
  }
6855
6735
  async function handleHistory(options) {
6856
- const { http: http2 } = getAuthedHttpClient();
6736
+ const { http } = getAuthedHttpClient();
6857
6737
  const windows = {
6858
6738
  "1d": 86400,
6859
6739
  "1w": 604800,
@@ -6869,7 +6749,7 @@ async function handleHistory(options) {
6869
6749
  limit: String(BILLING_HISTORY_EXPORT_LIMIT - entries.length)
6870
6750
  });
6871
6751
  if (cursor !== null) params.set("cursor", cursor);
6872
- const payload = await http2.get(
6752
+ const payload = await http.get(
6873
6753
  `/api/v2/billing/ledger?${params.toString()}`
6874
6754
  );
6875
6755
  if (Array.isArray(payload.entries)) {
@@ -6914,7 +6794,7 @@ async function handleHistory(options) {
6914
6794
  );
6915
6795
  }
6916
6796
  async function handleLedgerExportAll(options) {
6917
- const { http: http2 } = getAuthedHttpClient();
6797
+ const { http } = getAuthedHttpClient();
6918
6798
  const outputPath = options.output ? resolve3(String(options.output)) : defaultLedgerExportPath();
6919
6799
  let summary = { row_count: 0, net_delta_credits: 0 };
6920
6800
  let cursor = null;
@@ -6923,7 +6803,7 @@ async function handleLedgerExportAll(options) {
6923
6803
  const params = new URLSearchParams({ limit: "5000" });
6924
6804
  if (cursor !== null) params.set("cursor", cursor);
6925
6805
  if (options.runId) params.set("run_id", options.runId);
6926
- const payload = await http2.get(
6806
+ const payload = await http.get(
6927
6807
  `/api/v2/billing/ledger?${params.toString()}`
6928
6808
  );
6929
6809
  const entries = Array.isArray(payload.entries) ? payload.entries : [];
@@ -6983,8 +6863,8 @@ function planRolloverText(rollover) {
6983
6863
  return `rollover ${mode}`;
6984
6864
  }
6985
6865
  async function handlePlans(options) {
6986
- const { http: http2 } = getAuthedHttpClient();
6987
- const payload = await http2.get(
6866
+ const { http } = getAuthedHttpClient();
6867
+ const payload = await http.get(
6988
6868
  "/api/v2/billing/catalog/current"
6989
6869
  );
6990
6870
  const activePlan = payload.active_plan ?? {};
@@ -7016,8 +6896,8 @@ async function handlePlans(options) {
7016
6896
  );
7017
6897
  }
7018
6898
  async function handleSubscribe(planVersionId, options) {
7019
- const { http: http2 } = getAuthedHttpClient();
7020
- const payload = await http2.request(
6899
+ const { http } = getAuthedHttpClient();
6900
+ const payload = await http.request(
7021
6901
  "/api/v2/billing/subscription/checkout",
7022
6902
  {
7023
6903
  method: "POST",
@@ -7236,8 +7116,8 @@ async function handleInvoices(options) {
7236
7116
  );
7237
7117
  }
7238
7118
  async function handleCheckout(options) {
7239
- const { http: http2 } = getAuthedHttpClient();
7240
- const payload = await http2.post(
7119
+ const { http } = getAuthedHttpClient();
7120
+ const payload = await http.post(
7241
7121
  "/api/v2/billing/checkout",
7242
7122
  {
7243
7123
  ...options.tier ? { tierId: options.tier } : {},
@@ -7356,8 +7236,8 @@ async function handleTopUp(creditsRaw, options) {
7356
7236
  });
7357
7237
  }
7358
7238
  async function handleRedeemCode(code, options) {
7359
- const { http: http2 } = getAuthedHttpClient();
7360
- const payload = await http2.post(
7239
+ const { http } = getAuthedHttpClient();
7240
+ const payload = await http.post(
7361
7241
  "/api/v2/billing/checkout",
7362
7242
  {
7363
7243
  discountCode: code
@@ -12494,13 +12374,21 @@ function getStatusFromLiveEvent(event) {
12494
12374
  const payload = getEventPayload(event);
12495
12375
  return playStatusValue(payload.status) ?? playStatusValue(getRunRecordFromPackage(payload)?.status);
12496
12376
  }
12377
+ function getWaitKindFromLiveEvent(event) {
12378
+ const payload = getEventPayload(event);
12379
+ const progress = payload.progress && typeof payload.progress === "object" ? payload.progress : null;
12380
+ const waitKind = payload.waitKind ?? progress?.waitKind;
12381
+ return typeof waitKind === "string" && waitKind.trim() ? waitKind.trim() : null;
12382
+ }
12497
12383
  function writePlayWaitingHint(input2) {
12498
12384
  if (getStatusFromLiveEvent(input2.event) !== "waiting") return;
12499
12385
  const runId = getRunIdFromLiveEvent(input2.event);
12500
12386
  if (!runId || input2.state.waitingRunId === runId) return;
12501
12387
  input2.state.waitingRunId = runId;
12388
+ const waitKind = getWaitKindFromLiveEvent(input2.event);
12389
+ 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.";
12502
12390
  input2.progress.writeLine(
12503
- `[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'.`
12391
+ `[play waiting] ${runId} ${message} The command will continue watching; inspect it with 'deepline runs get ${runId} --full --json'.`
12504
12392
  );
12505
12393
  }
12506
12394
  function getFinalStatusFromLiveEvent(event) {
@@ -12763,6 +12651,9 @@ function getRunningHeartbeatLine(input2) {
12763
12651
  return `queued ${target}: waiting for worker capacity`;
12764
12652
  }
12765
12653
  if (status === "waiting") {
12654
+ if (getWaitKindFromLiveEvent(input2.event) === "detached_runner") {
12655
+ return `running ${target}: executing in detached runtime`;
12656
+ }
12766
12657
  return `waiting ${target}: waiting on external work`;
12767
12658
  }
12768
12659
  return `running ${target}: still processing`;
@@ -23495,8 +23386,8 @@ function registerEnrichCommand(program) {
23495
23386
 
23496
23387
  // src/cli/commands/feedback.ts
23497
23388
  async function handleFeedback(text, options) {
23498
- const { http: http2 } = getAuthedHttpClient();
23499
- const response = await http2.post("/api/v2/cli/feedback", {
23389
+ const { http } = getAuthedHttpClient();
23390
+ const response = await http.post("/api/v2/cli/feedback", {
23500
23391
  text,
23501
23392
  environment: collectLocalEnvInfo(),
23502
23393
  ...options.command ? { command: options.command } : {},
@@ -23907,8 +23798,8 @@ function buildSessionUploadContent(raw) {
23907
23798
  return { encodedContent: encoded, needsChunking: true };
23908
23799
  }
23909
23800
  async function uploadPayload(path, payload) {
23910
- const { http: http2 } = getAuthedHttpClient();
23911
- return await http2.post(path, payload);
23801
+ const { http } = getAuthedHttpClient();
23802
+ return await http.post(path, payload);
23912
23803
  }
23913
23804
  async function uploadChunkedSessions(sessions, options) {
23914
23805
  const uploadId = randomUUID3();
@@ -24694,8 +24585,8 @@ Preview the plan first with:
24694
24585
  );
24695
24586
  }
24696
24587
  async function handleMonitorsStatus(options) {
24697
- const http2 = buildHttpClient();
24698
- const payload = await http2.request(
24588
+ const http = buildHttpClient();
24589
+ const payload = await http.request(
24699
24590
  "/api/v2/monitors/access",
24700
24591
  { method: "GET" }
24701
24592
  );
@@ -24768,7 +24659,7 @@ async function handleMonitorsAvailable(toolId, options) {
24768
24659
  }
24769
24660
  }
24770
24661
  const tool = toolId ?? options.tool;
24771
- const http2 = buildHttpClient();
24662
+ const http = buildHttpClient();
24772
24663
  const params = new URLSearchParams();
24773
24664
  if (options.provider) params.set("provider", options.provider);
24774
24665
  if (tool) params.set("tool", tool);
@@ -24777,7 +24668,7 @@ async function handleMonitorsAvailable(toolId, options) {
24777
24668
  const compactList = !tool && !options.full;
24778
24669
  if (compactList || options.compact) params.set("compact", "true");
24779
24670
  const query = params.toString();
24780
- const payload = await http2.request(
24671
+ const payload = await http.request(
24781
24672
  `/api/v2/monitors/tools${query ? `?${query}` : ""}`,
24782
24673
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24783
24674
  );
@@ -24817,13 +24708,13 @@ function renderDeployedListText(payload, requestedStatus) {
24817
24708
  `;
24818
24709
  }
24819
24710
  async function handleMonitorsList(options) {
24820
- const http2 = buildHttpClient();
24711
+ const http = buildHttpClient();
24821
24712
  const params = new URLSearchParams();
24822
24713
  if (options.status) params.set("status", options.status);
24823
24714
  if (options.limit) params.set("limit", options.limit);
24824
24715
  if (options.compact) params.set("compact", "true");
24825
24716
  const query = params.toString();
24826
- const payload = await http2.request(
24717
+ const payload = await http.request(
24827
24718
  `/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
24828
24719
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24829
24720
  );
@@ -24833,21 +24724,21 @@ async function handleMonitorsList(options) {
24833
24724
  });
24834
24725
  }
24835
24726
  async function handleMonitorsCheck(definition, options) {
24836
- const http2 = buildHttpClient();
24727
+ const http = buildHttpClient();
24837
24728
  const body = resolveMonitorJsonBody({
24838
24729
  positional: definition,
24839
24730
  file: options.file,
24840
24731
  argLabel: "<definition>",
24841
24732
  command: "deepline monitors check"
24842
24733
  });
24843
- const payload = await http2.request(
24734
+ const payload = await http.request(
24844
24735
  "/api/v2/monitors/check",
24845
24736
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24846
24737
  );
24847
24738
  printCommandEnvelope(payload, { json: options.json });
24848
24739
  }
24849
24740
  async function handleMonitorsDeploy(definition, options) {
24850
- const http2 = buildHttpClient();
24741
+ const http = buildHttpClient();
24851
24742
  const body = resolveMonitorJsonBody({
24852
24743
  positional: definition,
24853
24744
  file: options.file,
@@ -24855,7 +24746,7 @@ async function handleMonitorsDeploy(definition, options) {
24855
24746
  command: "deepline monitors deploy"
24856
24747
  });
24857
24748
  if (options.dryRun) {
24858
- const payload2 = await http2.request(
24749
+ const payload2 = await http.request(
24859
24750
  "/api/v2/monitors/check",
24860
24751
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24861
24752
  );
@@ -24869,7 +24760,7 @@ async function handleMonitorsDeploy(definition, options) {
24869
24760
  }
24870
24761
  return;
24871
24762
  }
24872
- const payload = await http2.request(
24763
+ const payload = await http.request(
24873
24764
  "/api/v2/monitors/deploy",
24874
24765
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24875
24766
  );
@@ -24921,12 +24812,12 @@ function renderMonitorGet(payload) {
24921
24812
  `;
24922
24813
  }
24923
24814
  async function handleMonitorsGet(key, options) {
24924
- const http2 = buildHttpClient();
24925
- const payload = await http2.request(
24815
+ const http = buildHttpClient();
24816
+ const payload = await http.request(
24926
24817
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
24927
24818
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24928
24819
  );
24929
- const dependents = await http2.request(
24820
+ const dependents = await http.request(
24930
24821
  `/api/v2/monitors/deployed/${encodeKey(key)}/dependents`,
24931
24822
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24932
24823
  );
@@ -24952,12 +24843,12 @@ async function confirmMonitorDelete(key, options) {
24952
24843
  }
24953
24844
  }
24954
24845
  async function handleMonitorsDelete(key, options) {
24955
- const http2 = buildHttpClient();
24846
+ const http = buildHttpClient();
24956
24847
  const params = new URLSearchParams();
24957
24848
  if (options.localOnly) params.set("local_only", "true");
24958
24849
  if (options.dryRun) {
24959
24850
  params.set("dry_run", "true");
24960
- const payload2 = await http2.request(
24851
+ const payload2 = await http.request(
24961
24852
  `/api/v2/monitors/deployed/${encodeKey(key)}?${params.toString()}`,
24962
24853
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
24963
24854
  );
@@ -24989,30 +24880,30 @@ async function handleMonitorsDelete(key, options) {
24989
24880
  }
24990
24881
  }
24991
24882
  const query = params.toString();
24992
- const payload = await http2.request(
24883
+ const payload = await http.request(
24993
24884
  `/api/v2/monitors/deployed/${encodeKey(key)}${query ? `?${query}` : ""}`,
24994
24885
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
24995
24886
  );
24996
24887
  printCommandEnvelope(payload, { json: options.json });
24997
24888
  }
24998
24889
  async function handleMonitorsUpdate(key, patch, options) {
24999
- const http2 = buildHttpClient();
24890
+ const http = buildHttpClient();
25000
24891
  const body = resolveMonitorJsonBody({
25001
24892
  positional: patch,
25002
24893
  file: options.file,
25003
24894
  argLabel: "<patch>",
25004
24895
  command: `deepline monitors update ${key}`
25005
24896
  });
25006
- const payload = await http2.request(
24897
+ const payload = await http.request(
25007
24898
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
25008
24899
  { method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
25009
24900
  );
25010
24901
  printCommandEnvelope(payload, { json: options.json });
25011
24902
  }
25012
24903
  async function handleMonitorsReactivate(key, options) {
25013
- const http2 = buildHttpClient();
24904
+ const http = buildHttpClient();
25014
24905
  if (options.dryRun) {
25015
- const payload2 = await http2.request(
24906
+ const payload2 = await http.request(
25016
24907
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate?dry_run=true`,
25017
24908
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
25018
24909
  );
@@ -25026,7 +24917,7 @@ async function handleMonitorsReactivate(key, options) {
25026
24917
  });
25027
24918
  return;
25028
24919
  }
25029
- const payload = await http2.request(
24920
+ const payload = await http.request(
25030
24921
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
25031
24922
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
25032
24923
  );
@@ -25272,8 +25163,8 @@ Examples:
25272
25163
  }
25273
25164
 
25274
25165
  // src/cli/commands/org.ts
25275
- async function fetchOrganizations(http2, apiKey) {
25276
- return http2.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
25166
+ async function fetchOrganizations(http, apiKey) {
25167
+ return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
25277
25168
  }
25278
25169
  function normalizeAuthScope2(value) {
25279
25170
  if (!value) return "auto";
@@ -25377,8 +25268,8 @@ function resolveOrgSwitchAuthTarget(scope, config) {
25377
25268
  }
25378
25269
  async function handleOrgList(options) {
25379
25270
  const config = resolveConfig();
25380
- const http2 = new HttpClient(config);
25381
- const payload = await fetchOrganizations(http2, config.apiKey);
25271
+ const http = new HttpClient(config);
25272
+ const payload = await fetchOrganizations(http, config.apiKey);
25382
25273
  printCommandEnvelope(
25383
25274
  {
25384
25275
  ...payload,
@@ -25396,8 +25287,8 @@ async function handleOrgList(options) {
25396
25287
  }
25397
25288
  async function handleOrgStatus(options) {
25398
25289
  const config = resolveConfig();
25399
- const http2 = new HttpClient(config);
25400
- const payload = await fetchOrganizations(http2, config.apiKey);
25290
+ const http = new HttpClient(config);
25291
+ const payload = await fetchOrganizations(http, config.apiKey);
25401
25292
  const current = payload.organizations.find((org) => org.is_current) ?? payload.organizations.find(
25402
25293
  (org) => org.org_id === payload.current_org_id
25403
25294
  ) ?? null;
@@ -25480,8 +25371,8 @@ async function handleOrgStatus(options) {
25480
25371
  async function handleOrgSwitch(selection, options) {
25481
25372
  const authScope = normalizeAuthScope2(options.authScope);
25482
25373
  const config = resolveConfig();
25483
- const http2 = new HttpClient(config);
25484
- const payload = await fetchOrganizations(http2, config.apiKey);
25374
+ const http = new HttpClient(config);
25375
+ const payload = await fetchOrganizations(http, config.apiKey);
25485
25376
  if (!selection && !options.orgId) {
25486
25377
  printCommandEnvelope(
25487
25378
  {
@@ -25576,7 +25467,7 @@ async function handleOrgSwitch(selection, options) {
25576
25467
  );
25577
25468
  return;
25578
25469
  }
25579
- const switched = await http2.post("/api/v2/auth/cli/switch", {
25470
+ const switched = await http.post("/api/v2/auth/cli/switch", {
25580
25471
  api_key: config.apiKey,
25581
25472
  org_id: target.org_id
25582
25473
  });
@@ -25644,8 +25535,8 @@ async function handleOrgSwitch(selection, options) {
25644
25535
  }
25645
25536
  async function handleOrgCreate(name, options) {
25646
25537
  const config = resolveConfig();
25647
- const http2 = new HttpClient(config);
25648
- const created = await http2.post("/api/v2/auth/cli/org-create", {
25538
+ const http = new HttpClient(config);
25539
+ const created = await http.post("/api/v2/auth/cli/org-create", {
25649
25540
  api_key: config.apiKey,
25650
25541
  name
25651
25542
  });
@@ -26237,8 +26128,8 @@ async function handleSet(nameInput, forbidden, options) {
26237
26128
  throw new Error("--play <name> is required when --scope play is used.");
26238
26129
  }
26239
26130
  const value = await readSecretValue();
26240
- const { http: http2 } = getAuthedHttpClient();
26241
- const response = await http2.post(
26131
+ const { http } = getAuthedHttpClient();
26132
+ const response = await http.post(
26242
26133
  "/api/v2/secrets",
26243
26134
  {
26244
26135
  name,
@@ -32066,7 +31957,7 @@ async function runPreflightCheck() {
32066
31957
  };
32067
31958
  }).catch(() => ({ status: "unreachable", version: null })).finally(() => clearTimeout(healthTimeout));
32068
31959
  const apiKey = resolveApiKeyForBaseUrl(baseUrl);
32069
- const http2 = apiKey ? new HttpClient(
31960
+ const http = apiKey ? new HttpClient(
32070
31961
  resolveConfig({
32071
31962
  baseUrl,
32072
31963
  apiKey,
@@ -32074,8 +31965,8 @@ async function runPreflightCheck() {
32074
31965
  maxRetries: 0
32075
31966
  })
32076
31967
  ) : null;
32077
- const [auth, billing] = http2 ? await Promise.all([
32078
- http2.post("/api/v2/auth/cli/status", {
31968
+ const [auth, billing] = http ? await Promise.all([
31969
+ http.post("/api/v2/auth/cli/status", {
32079
31970
  api_key: apiKey,
32080
31971
  reveal: false
32081
31972
  }).catch((error) => ({
@@ -32083,7 +31974,7 @@ async function runPreflightCheck() {
32083
31974
  connected: false,
32084
31975
  error: preflightErrorMessage(error)
32085
31976
  })),
32086
- http2.get("/api/v2/billing/balance").catch((error) => ({
31977
+ http.get("/api/v2/billing/balance").catch((error) => ({
32087
31978
  balance: null,
32088
31979
  balance_display: "unavailable",
32089
31980
  balance_status: "unknown",
@@ -32266,7 +32157,6 @@ Exit codes:
32266
32157
  registerBillingCommands(program);
32267
32158
  registerMonitorsCommands(program);
32268
32159
  registerOrgCommands(program);
32269
- registerAdminCommands(program);
32270
32160
  registerEnrichCommand(program);
32271
32161
  registerCsvCommands(program);
32272
32162
  registerDbCommands(program);
@@ -32436,7 +32326,8 @@ Examples:
32436
32326
  } else {
32437
32327
  console.error(`Error: ${String(error)}`);
32438
32328
  }
32439
- const failureExitCode = resolveSdkCliFailureExitCode(error);
32329
+ const explicitExitCode = error && typeof error === "object" && typeof error.exitCode === "number" ? error.exitCode : void 0;
32330
+ const failureExitCode = explicitExitCode ?? resolveSdkCliFailureExitCode(error);
32440
32331
  process.exitCode = failureExitCode;
32441
32332
  await maybeReportSdkCliFailure({
32442
32333
  argv: process.argv.slice(2),