deepline 0.1.200 → 0.1.202

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.
Files changed (33) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +49 -13
  2. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +25 -0
  3. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +139 -124
  4. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  5. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +17 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/bounded-dispatch.ts +52 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +152 -23
  8. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +10 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +11 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +121 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/governor/adaptive-admission.ts +6 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-budget-state-backend.ts +22 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +86 -19
  14. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +141 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/governor/budget-state-backend.ts +43 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +129 -41
  17. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +40 -2
  18. package/dist/bundling-sources/shared_libs/play-runtime/receipt-completion-sink.ts +92 -33
  19. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +13 -5
  20. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +43 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +122 -120
  22. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +10 -8
  23. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +140 -32
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +327 -31
  25. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +26 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +21 -0
  27. package/dist/bundling-sources/shared_libs/plays/dataset.ts +32 -10
  28. package/dist/cli/index.js +198 -76
  29. package/dist/cli/index.mjs +204 -82
  30. package/dist/index.js +3 -2
  31. package/dist/index.mjs +3 -2
  32. package/package.json +1 -1
  33. package/dist/bundling-sources/shared_libs/play-runtime/adaptive-tool-dispatcher.ts +0 -355
package/dist/cli/index.js CHANGED
@@ -623,10 +623,10 @@ var SDK_RELEASE = {
623
623
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
624
624
  // fields shipped in 0.1.153.
625
625
  // 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
626
- version: "0.1.200",
626
+ version: "0.1.202",
627
627
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
628
628
  supportPolicy: {
629
- latest: "0.1.200",
629
+ latest: "0.1.202",
630
630
  minimumSupported: "0.1.53",
631
631
  deprecatedBelow: "0.1.53",
632
632
  commandMinimumSupported: [
@@ -1907,10 +1907,10 @@ var OBSERVER_LOG_PAGE_QUERY = "runObservers:getRunLogPageForObserver";
1907
1907
  function errorText(error) {
1908
1908
  return error instanceof Error ? error.message : String(error);
1909
1909
  }
1910
- async function mintRunObserveGrant(http, runId) {
1910
+ async function mintRunObserveGrant(http2, runId) {
1911
1911
  let response;
1912
1912
  try {
1913
- response = await http.post(
1913
+ response = await http2.post(
1914
1914
  `/api/v2/runs/${encodeURIComponent(runId)}/observe-grant`,
1915
1915
  {}
1916
1916
  );
@@ -1974,8 +1974,8 @@ async function backfillLogGap(input2) {
1974
1974
  return lines;
1975
1975
  }
1976
1976
  async function* observeRunEvents(options) {
1977
- const { http, runId } = options;
1978
- let grant = await mintRunObserveGrant(http, runId);
1977
+ const { http: http2, runId } = options;
1978
+ let grant = await mintRunObserveGrant(http2, runId);
1979
1979
  let convexBrowser;
1980
1980
  let convexServer;
1981
1981
  try {
@@ -2038,7 +2038,7 @@ async function* observeRunEvents(options) {
2038
2038
  lastForcedRefreshAt = now;
2039
2039
  }
2040
2040
  try {
2041
- grant = await mintRunObserveGrant(http, runId);
2041
+ grant = await mintRunObserveGrant(http2, runId);
2042
2042
  return grant.token;
2043
2043
  } catch (error) {
2044
2044
  push({ kind: "error", error });
@@ -4457,11 +4457,6 @@ function enforceSdkCompatibilityResponse(response) {
4457
4457
  }
4458
4458
  }
4459
4459
 
4460
- // src/cli/commands/auth.ts
4461
- var import_node_fs5 = require("fs");
4462
- var import_node_os6 = require("os");
4463
- var import_node_path5 = require("path");
4464
-
4465
4460
  // src/cli/utils.ts
4466
4461
  var import_node_crypto = require("crypto");
4467
4462
  var import_node_fs4 = require("fs");
@@ -5137,7 +5132,133 @@ function printCommandEnvelope(envelope, options = {}) {
5137
5132
  process.stdout.write(options.text ?? renderCommandEnvelopeText(envelope));
5138
5133
  }
5139
5134
 
5135
+ // src/cli/commands/admin.ts
5136
+ function normalizeEnvironment(value) {
5137
+ const trimmed = value?.trim().toLowerCase();
5138
+ if (!trimmed || trimmed === "production" || trimmed === "prod") {
5139
+ return "production";
5140
+ }
5141
+ if (trimmed === "preview") return "preview";
5142
+ throw new Error(
5143
+ `Invalid --environment "${value}". Expected production or preview.`
5144
+ );
5145
+ }
5146
+ function http() {
5147
+ return new HttpClient(resolveConfig());
5148
+ }
5149
+ function laneLine(lane) {
5150
+ const flag = lane.active ? "* " : " ";
5151
+ const depth = lane.queueDepth.empty ? "empty" : `${lane.queueDepth.queuedTasks} tasks / ${lane.queueDepth.nonTerminalRuns} runs`;
5152
+ return `${flag}${lane.releaseId} [${lane.status}] queue=${lane.queue} depth=${depth}`;
5153
+ }
5154
+ async function handleLanesList(options) {
5155
+ const environment = normalizeEnvironment(options.environment);
5156
+ const payload = await http().get(
5157
+ `/api/v2/admin/runtime/lanes?environment=${environment}`
5158
+ );
5159
+ printCommandEnvelope(
5160
+ {
5161
+ ...payload,
5162
+ render: {
5163
+ sections: [
5164
+ {
5165
+ title: `Absurd lanes (${environment}):`,
5166
+ lines: payload.lanes.length > 0 ? payload.lanes.map(laneLine) : ["(no registered lanes)"]
5167
+ }
5168
+ ]
5169
+ }
5170
+ },
5171
+ { json: options.json }
5172
+ );
5173
+ }
5174
+ async function handleLanesShow(releaseId, options) {
5175
+ const environment = normalizeEnvironment(options.environment);
5176
+ const payload = await http().get(
5177
+ `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5178
+ );
5179
+ printCommandEnvelope(
5180
+ {
5181
+ ...payload,
5182
+ render: {
5183
+ sections: [
5184
+ {
5185
+ title: `Lane ${releaseId} (${environment}):`,
5186
+ lines: [
5187
+ `registered: ${payload.registered}`,
5188
+ payload.lane ? `status: ${payload.lane.status}${payload.lane.active ? " (active)" : ""}` : "status: (not in registry)",
5189
+ `queue: ${payload.retireCheck.queue}`,
5190
+ `queued tasks: ${payload.retireCheck.queuedTasks}`,
5191
+ `non-terminal runs: ${payload.retireCheck.nonTerminalRuns}`,
5192
+ `retirable: ${payload.retireCheck.retirable}`
5193
+ ]
5194
+ }
5195
+ ]
5196
+ }
5197
+ },
5198
+ { json: options.json }
5199
+ );
5200
+ }
5201
+ async function handleLanesRetireCheck(releaseId, options) {
5202
+ const environment = normalizeEnvironment(options.environment);
5203
+ const payload = await http().get(
5204
+ `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5205
+ );
5206
+ printCommandEnvelope(
5207
+ {
5208
+ ...payload,
5209
+ render: {
5210
+ sections: [
5211
+ {
5212
+ title: `Retire check ${releaseId} (${environment}):`,
5213
+ lines: [
5214
+ payload.retireCheck.retirable ? "retirable: yes (lane queue empty)" : `retirable: no (${payload.retireCheck.queuedTasks} tasks, ${payload.retireCheck.nonTerminalRuns} runs pending)`
5215
+ ]
5216
+ }
5217
+ ]
5218
+ }
5219
+ },
5220
+ { json: options.json }
5221
+ );
5222
+ }
5223
+ async function handleReleasesActivate(releaseId, options) {
5224
+ const environment = normalizeEnvironment(options.environment);
5225
+ const payload = await http().post(
5226
+ "/api/v2/admin/runtime/releases",
5227
+ {
5228
+ releaseId,
5229
+ environment,
5230
+ ...options.schedulerBackend ? { schedulerBackend: options.schedulerBackend } : {}
5231
+ }
5232
+ );
5233
+ printCommandEnvelope(
5234
+ {
5235
+ ...payload,
5236
+ render: {
5237
+ sections: [
5238
+ {
5239
+ title: `Activated release ${releaseId} (${environment}).`,
5240
+ lines: ["Runtime release pointer flipped to this lane."]
5241
+ }
5242
+ ]
5243
+ }
5244
+ },
5245
+ { json: options.json }
5246
+ );
5247
+ }
5248
+ function registerAdminCommands(program) {
5249
+ const admin = program.command("admin").description("Platform-admin operations (runtime lanes, releases).");
5250
+ const lanes = admin.command("lanes").description("Inspect Absurd runtime release lanes.");
5251
+ 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);
5252
+ 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);
5253
+ 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);
5254
+ const releases = admin.command("releases").description("Manage the active runtime release pointer.");
5255
+ releases.command("activate <releaseId>").description("Flip the active runtime release to a prior registered lane.").option("--environment <env>", "production (default) or preview").option("--scheduler-backend <backend>", "absurd or workers_edge").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleReleasesActivate);
5256
+ }
5257
+
5140
5258
  // src/cli/commands/auth.ts
5259
+ var import_node_fs5 = require("fs");
5260
+ var import_node_os6 = require("os");
5261
+ var import_node_path5 = require("path");
5141
5262
  var EXIT_OK = 0;
5142
5263
  var EXIT_AUTH = 3;
5143
5264
  var EXIT_SERVER = 5;
@@ -6000,8 +6121,8 @@ function defaultLedgerExportPath() {
6000
6121
  );
6001
6122
  }
6002
6123
  async function handleBalance(options) {
6003
- const { http } = getAuthedHttpClient();
6004
- const payload = await http.get(
6124
+ const { http: http2 } = getAuthedHttpClient();
6125
+ const payload = await http2.get(
6005
6126
  "/api/v2/billing/balance"
6006
6127
  );
6007
6128
  const status = String(payload.balance_status || "");
@@ -6035,13 +6156,13 @@ async function handleBalance(options) {
6035
6156
  return;
6036
6157
  }
6037
6158
  async function handleUsage(options) {
6038
- const { http } = getAuthedHttpClient();
6159
+ const { http: http2 } = getAuthedHttpClient();
6039
6160
  const params = new URLSearchParams();
6040
6161
  if (options.limit) params.set("recent_limit", options.limit);
6041
6162
  if (options.offset) params.set("recent_offset", options.offset);
6042
6163
  if (options.runId) params.set("run_id", options.runId);
6043
6164
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
6044
- const payload = await http.get(
6165
+ const payload = await http2.get(
6045
6166
  `/api/v2/billing/usage${suffix}`
6046
6167
  );
6047
6168
  const usage = payload.usage ?? {};
@@ -6067,8 +6188,8 @@ async function handleUsage(options) {
6067
6188
  );
6068
6189
  }
6069
6190
  async function handleLimit(options) {
6070
- const { http } = getAuthedHttpClient();
6071
- const payload = await http.get(
6191
+ const { http: http2 } = getAuthedHttpClient();
6192
+ const payload = await http2.get(
6072
6193
  "/api/v2/billing/limit"
6073
6194
  );
6074
6195
  const lines = payload.enabled ? [
@@ -6084,8 +6205,8 @@ async function handleLimit(options) {
6084
6205
  );
6085
6206
  }
6086
6207
  async function handleSetLimit(credits, options) {
6087
- const { http } = getAuthedHttpClient();
6088
- const payload = await http.request("/api/v2/billing/limit", {
6208
+ const { http: http2 } = getAuthedHttpClient();
6209
+ const payload = await http2.request("/api/v2/billing/limit", {
6089
6210
  method: "PUT",
6090
6211
  body: { monthly_credits_limit: Number.parseInt(credits, 10) }
6091
6212
  });
@@ -6105,8 +6226,8 @@ async function handleSetLimit(credits, options) {
6105
6226
  );
6106
6227
  }
6107
6228
  async function handleLimitOff(options) {
6108
- const { http } = getAuthedHttpClient();
6109
- const payload = await http.request("/api/v2/billing/limit", {
6229
+ const { http: http2 } = getAuthedHttpClient();
6230
+ const payload = await http2.request("/api/v2/billing/limit", {
6110
6231
  method: "DELETE"
6111
6232
  });
6112
6233
  printCommandEnvelope(
@@ -6125,7 +6246,7 @@ async function handleLimitOff(options) {
6125
6246
  );
6126
6247
  }
6127
6248
  async function handleHistory(options) {
6128
- const { http } = getAuthedHttpClient();
6249
+ const { http: http2 } = getAuthedHttpClient();
6129
6250
  const windows = {
6130
6251
  "1d": 86400,
6131
6252
  "1w": 604800,
@@ -6133,7 +6254,7 @@ async function handleHistory(options) {
6133
6254
  "1y": 31536e3
6134
6255
  };
6135
6256
  const sinceAt = Math.max(0, Math.floor(Date.now() / 1e3) - windows[options.time]) * 1e3;
6136
- const payload = await http.get(
6257
+ const payload = await http2.get(
6137
6258
  `/api/v2/billing/ledger?since_at=${sinceAt}&limit=5000`
6138
6259
  );
6139
6260
  const entries = Array.isArray(payload.entries) ? payload.entries : [];
@@ -6164,7 +6285,7 @@ async function handleHistory(options) {
6164
6285
  );
6165
6286
  }
6166
6287
  async function handleLedgerExportAll(options) {
6167
- const { http } = getAuthedHttpClient();
6288
+ const { http: http2 } = getAuthedHttpClient();
6168
6289
  const outputPath = options.output ? (0, import_node_path6.resolve)(String(options.output)) : defaultLedgerExportPath();
6169
6290
  let summary = { row_count: 0, net_delta_credits: 0 };
6170
6291
  let cursor = null;
@@ -6173,7 +6294,7 @@ async function handleLedgerExportAll(options) {
6173
6294
  const params = new URLSearchParams({ limit: "5000" });
6174
6295
  if (cursor !== null) params.set("cursor", cursor);
6175
6296
  if (options.runId) params.set("run_id", options.runId);
6176
- const payload = await http.get(
6297
+ const payload = await http2.get(
6177
6298
  `/api/v2/billing/ledger?${params.toString()}`
6178
6299
  );
6179
6300
  const entries = Array.isArray(payload.entries) ? payload.entries : [];
@@ -6233,8 +6354,8 @@ function planRolloverText(rollover) {
6233
6354
  return `rollover ${mode}`;
6234
6355
  }
6235
6356
  async function handlePlans(options) {
6236
- const { http } = getAuthedHttpClient();
6237
- const payload = await http.get(
6357
+ const { http: http2 } = getAuthedHttpClient();
6358
+ const payload = await http2.get(
6238
6359
  "/api/v2/billing/catalog/current"
6239
6360
  );
6240
6361
  const activePlan = payload.active_plan ?? {};
@@ -6266,8 +6387,8 @@ async function handlePlans(options) {
6266
6387
  );
6267
6388
  }
6268
6389
  async function handleSubscribe(planVersionId, options) {
6269
- const { http } = getAuthedHttpClient();
6270
- const payload = await http.request(
6390
+ const { http: http2 } = getAuthedHttpClient();
6391
+ const payload = await http2.request(
6271
6392
  "/api/v2/billing/subscription/checkout",
6272
6393
  {
6273
6394
  method: "POST",
@@ -6486,8 +6607,8 @@ async function handleInvoices(options) {
6486
6607
  );
6487
6608
  }
6488
6609
  async function handleCheckout(options) {
6489
- const { http } = getAuthedHttpClient();
6490
- const payload = await http.post(
6610
+ const { http: http2 } = getAuthedHttpClient();
6611
+ const payload = await http2.post(
6491
6612
  "/api/v2/billing/checkout",
6492
6613
  {
6493
6614
  ...options.tier ? { tierId: options.tier } : {},
@@ -6606,8 +6727,8 @@ async function handleTopUp(creditsRaw, options) {
6606
6727
  });
6607
6728
  }
6608
6729
  async function handleRedeemCode(code, options) {
6609
- const { http } = getAuthedHttpClient();
6610
- const payload = await http.post(
6730
+ const { http: http2 } = getAuthedHttpClient();
6731
+ const payload = await http2.post(
6611
6732
  "/api/v2/billing/checkout",
6612
6733
  {
6613
6734
  discountCode: code
@@ -22112,8 +22233,8 @@ function registerEnrichCommand(program) {
22112
22233
 
22113
22234
  // src/cli/commands/feedback.ts
22114
22235
  async function handleFeedback(text, options) {
22115
- const { http } = getAuthedHttpClient();
22116
- const response = await http.post("/api/v2/cli/feedback", {
22236
+ const { http: http2 } = getAuthedHttpClient();
22237
+ const response = await http2.post("/api/v2/cli/feedback", {
22117
22238
  text,
22118
22239
  environment: collectLocalEnvInfo(),
22119
22240
  ...options.command ? { command: options.command } : {},
@@ -22517,8 +22638,8 @@ function buildSessionUploadContent(raw) {
22517
22638
  return { encodedContent: encoded, needsChunking: true };
22518
22639
  }
22519
22640
  async function uploadPayload(path, payload) {
22520
- const { http } = getAuthedHttpClient();
22521
- return await http.post(path, payload);
22641
+ const { http: http2 } = getAuthedHttpClient();
22642
+ return await http2.post(path, payload);
22522
22643
  }
22523
22644
  async function uploadChunkedSessions(sessions, options) {
22524
22645
  const uploadId = (0, import_node_crypto5.randomUUID)();
@@ -23278,8 +23399,8 @@ Preview the plan first with:
23278
23399
  );
23279
23400
  }
23280
23401
  async function handleMonitorsStatus(options) {
23281
- const http = buildHttpClient();
23282
- const payload = await http.request(
23402
+ const http2 = buildHttpClient();
23403
+ const payload = await http2.request(
23283
23404
  "/api/v2/monitors/access",
23284
23405
  { method: "GET" }
23285
23406
  );
@@ -23334,7 +23455,7 @@ async function handleMonitorsAvailable(toolId, options) {
23334
23455
  }
23335
23456
  }
23336
23457
  const tool = toolId ?? options.tool;
23337
- const http = buildHttpClient();
23458
+ const http2 = buildHttpClient();
23338
23459
  const params = new URLSearchParams();
23339
23460
  if (options.provider) params.set("provider", options.provider);
23340
23461
  if (tool) params.set("tool", tool);
@@ -23343,7 +23464,7 @@ async function handleMonitorsAvailable(toolId, options) {
23343
23464
  const compactList = !tool && !options.full;
23344
23465
  if (compactList || options.compact) params.set("compact", "true");
23345
23466
  const query = params.toString();
23346
- const payload = await http.request(
23467
+ const payload = await http2.request(
23347
23468
  `/api/v2/monitors/tools${query ? `?${query}` : ""}`,
23348
23469
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
23349
23470
  );
@@ -23383,13 +23504,13 @@ function renderDeployedListText(payload, requestedStatus) {
23383
23504
  `;
23384
23505
  }
23385
23506
  async function handleMonitorsList(options) {
23386
- const http = buildHttpClient();
23507
+ const http2 = buildHttpClient();
23387
23508
  const params = new URLSearchParams();
23388
23509
  if (options.status) params.set("status", options.status);
23389
23510
  if (options.limit) params.set("limit", options.limit);
23390
23511
  if (options.compact) params.set("compact", "true");
23391
23512
  const query = params.toString();
23392
- const payload = await http.request(
23513
+ const payload = await http2.request(
23393
23514
  `/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
23394
23515
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
23395
23516
  );
@@ -23399,21 +23520,21 @@ async function handleMonitorsList(options) {
23399
23520
  });
23400
23521
  }
23401
23522
  async function handleMonitorsCheck(definition, options) {
23402
- const http = buildHttpClient();
23523
+ const http2 = buildHttpClient();
23403
23524
  const body = resolveMonitorJsonBody({
23404
23525
  positional: definition,
23405
23526
  file: options.file,
23406
23527
  argLabel: "<definition>",
23407
23528
  command: "deepline monitors check"
23408
23529
  });
23409
- const payload = await http.request(
23530
+ const payload = await http2.request(
23410
23531
  "/api/v2/monitors/check",
23411
23532
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
23412
23533
  );
23413
23534
  printCommandEnvelope(payload, { json: options.json });
23414
23535
  }
23415
23536
  async function handleMonitorsDeploy(definition, options) {
23416
- const http = buildHttpClient();
23537
+ const http2 = buildHttpClient();
23417
23538
  const body = resolveMonitorJsonBody({
23418
23539
  positional: definition,
23419
23540
  file: options.file,
@@ -23421,7 +23542,7 @@ async function handleMonitorsDeploy(definition, options) {
23421
23542
  command: "deepline monitors deploy"
23422
23543
  });
23423
23544
  if (options.dryRun) {
23424
- const payload2 = await http.request(
23545
+ const payload2 = await http2.request(
23425
23546
  "/api/v2/monitors/check",
23426
23547
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
23427
23548
  );
@@ -23435,7 +23556,7 @@ async function handleMonitorsDeploy(definition, options) {
23435
23556
  }
23436
23557
  return;
23437
23558
  }
23438
- const payload = await http.request(
23559
+ const payload = await http2.request(
23439
23560
  "/api/v2/monitors/deploy",
23440
23561
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
23441
23562
  );
@@ -23445,8 +23566,8 @@ async function handleMonitorsDeploy(definition, options) {
23445
23566
  });
23446
23567
  }
23447
23568
  async function handleMonitorsGet(key, options) {
23448
- const http = buildHttpClient();
23449
- const payload = await http.request(
23569
+ const http2 = buildHttpClient();
23570
+ const payload = await http2.request(
23450
23571
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
23451
23572
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
23452
23573
  );
@@ -23468,12 +23589,12 @@ async function confirmMonitorDelete(key, options) {
23468
23589
  }
23469
23590
  }
23470
23591
  async function handleMonitorsDelete(key, options) {
23471
- const http = buildHttpClient();
23592
+ const http2 = buildHttpClient();
23472
23593
  const params = new URLSearchParams();
23473
23594
  if (options.localOnly) params.set("local_only", "true");
23474
23595
  if (options.dryRun) {
23475
23596
  params.set("dry_run", "true");
23476
- const payload2 = await http.request(
23597
+ const payload2 = await http2.request(
23477
23598
  `/api/v2/monitors/deployed/${encodeKey(key)}?${params.toString()}`,
23478
23599
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
23479
23600
  );
@@ -23505,30 +23626,30 @@ async function handleMonitorsDelete(key, options) {
23505
23626
  }
23506
23627
  }
23507
23628
  const query = params.toString();
23508
- const payload = await http.request(
23629
+ const payload = await http2.request(
23509
23630
  `/api/v2/monitors/deployed/${encodeKey(key)}${query ? `?${query}` : ""}`,
23510
23631
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
23511
23632
  );
23512
23633
  printCommandEnvelope(payload, { json: options.json });
23513
23634
  }
23514
23635
  async function handleMonitorsUpdate(key, patch, options) {
23515
- const http = buildHttpClient();
23636
+ const http2 = buildHttpClient();
23516
23637
  const body = resolveMonitorJsonBody({
23517
23638
  positional: patch,
23518
23639
  file: options.file,
23519
23640
  argLabel: "<patch>",
23520
23641
  command: `deepline monitors update ${key}`
23521
23642
  });
23522
- const payload = await http.request(
23643
+ const payload = await http2.request(
23523
23644
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
23524
23645
  { method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
23525
23646
  );
23526
23647
  printCommandEnvelope(payload, { json: options.json });
23527
23648
  }
23528
23649
  async function handleMonitorsReactivate(key, options) {
23529
- const http = buildHttpClient();
23650
+ const http2 = buildHttpClient();
23530
23651
  if (options.dryRun) {
23531
- const payload2 = await http.request(
23652
+ const payload2 = await http2.request(
23532
23653
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate?dry_run=true`,
23533
23654
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
23534
23655
  );
@@ -23542,7 +23663,7 @@ async function handleMonitorsReactivate(key, options) {
23542
23663
  });
23543
23664
  return;
23544
23665
  }
23545
- const payload = await http.request(
23666
+ const payload = await http2.request(
23546
23667
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
23547
23668
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
23548
23669
  );
@@ -23786,8 +23907,8 @@ Examples:
23786
23907
  }
23787
23908
 
23788
23909
  // src/cli/commands/org.ts
23789
- async function fetchOrganizations(http, apiKey) {
23790
- return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
23910
+ async function fetchOrganizations(http2, apiKey) {
23911
+ return http2.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
23791
23912
  }
23792
23913
  function normalizeAuthScope(value) {
23793
23914
  if (!value) return "auto";
@@ -23891,8 +24012,8 @@ function resolveOrgSwitchAuthTarget(scope, config) {
23891
24012
  }
23892
24013
  async function handleOrgList(options) {
23893
24014
  const config = resolveConfig();
23894
- const http = new HttpClient(config);
23895
- const payload = await fetchOrganizations(http, config.apiKey);
24015
+ const http2 = new HttpClient(config);
24016
+ const payload = await fetchOrganizations(http2, config.apiKey);
23896
24017
  printCommandEnvelope(
23897
24018
  {
23898
24019
  ...payload,
@@ -23910,8 +24031,8 @@ async function handleOrgList(options) {
23910
24031
  }
23911
24032
  async function handleOrgStatus(options) {
23912
24033
  const config = resolveConfig();
23913
- const http = new HttpClient(config);
23914
- const payload = await fetchOrganizations(http, config.apiKey);
24034
+ const http2 = new HttpClient(config);
24035
+ const payload = await fetchOrganizations(http2, config.apiKey);
23915
24036
  const current = payload.organizations.find((org) => org.is_current) ?? payload.organizations.find(
23916
24037
  (org) => org.org_id === payload.current_org_id
23917
24038
  ) ?? null;
@@ -23994,8 +24115,8 @@ async function handleOrgStatus(options) {
23994
24115
  async function handleOrgSwitch(selection, options) {
23995
24116
  const authScope = normalizeAuthScope(options.authScope);
23996
24117
  const config = resolveConfig();
23997
- const http = new HttpClient(config);
23998
- const payload = await fetchOrganizations(http, config.apiKey);
24118
+ const http2 = new HttpClient(config);
24119
+ const payload = await fetchOrganizations(http2, config.apiKey);
23999
24120
  if (!selection && !options.orgId) {
24000
24121
  printCommandEnvelope(
24001
24122
  {
@@ -24090,7 +24211,7 @@ async function handleOrgSwitch(selection, options) {
24090
24211
  );
24091
24212
  return;
24092
24213
  }
24093
- const switched = await http.post("/api/v2/auth/cli/switch", {
24214
+ const switched = await http2.post("/api/v2/auth/cli/switch", {
24094
24215
  api_key: config.apiKey,
24095
24216
  org_id: target.org_id
24096
24217
  });
@@ -24158,8 +24279,8 @@ async function handleOrgSwitch(selection, options) {
24158
24279
  }
24159
24280
  async function handleOrgCreate(name, options) {
24160
24281
  const config = resolveConfig();
24161
- const http = new HttpClient(config);
24162
- const created = await http.post("/api/v2/auth/cli/org-create", {
24282
+ const http2 = new HttpClient(config);
24283
+ const created = await http2.post("/api/v2/auth/cli/org-create", {
24163
24284
  api_key: config.apiKey,
24164
24285
  name
24165
24286
  });
@@ -24751,8 +24872,8 @@ async function handleSet(nameInput, forbidden, options) {
24751
24872
  throw new Error("--play <name> is required when --scope play is used.");
24752
24873
  }
24753
24874
  const value = await readSecretValue();
24754
- const { http } = getAuthedHttpClient();
24755
- const response = await http.post(
24875
+ const { http: http2 } = getAuthedHttpClient();
24876
+ const response = await http2.post(
24756
24877
  "/api/v2/secrets",
24757
24878
  {
24758
24879
  name,
@@ -28878,7 +28999,7 @@ async function runPreflightCheck() {
28878
28999
  };
28879
29000
  }).catch(() => ({ status: "unreachable", version: null })).finally(() => clearTimeout(healthTimeout));
28880
29001
  const apiKey = resolveApiKeyForBaseUrl(baseUrl);
28881
- const http = apiKey ? new HttpClient(
29002
+ const http2 = apiKey ? new HttpClient(
28882
29003
  resolveConfig({
28883
29004
  baseUrl,
28884
29005
  apiKey,
@@ -28886,8 +29007,8 @@ async function runPreflightCheck() {
28886
29007
  maxRetries: 0
28887
29008
  })
28888
29009
  ) : null;
28889
- const [auth, billing] = http ? await Promise.all([
28890
- http.post("/api/v2/auth/cli/status", {
29010
+ const [auth, billing] = http2 ? await Promise.all([
29011
+ http2.post("/api/v2/auth/cli/status", {
28891
29012
  api_key: apiKey,
28892
29013
  reveal: false
28893
29014
  }).catch((error) => ({
@@ -28895,7 +29016,7 @@ async function runPreflightCheck() {
28895
29016
  connected: false,
28896
29017
  error: preflightErrorMessage(error)
28897
29018
  })),
28898
- http.get("/api/v2/billing/balance").catch((error) => ({
29019
+ http2.get("/api/v2/billing/balance").catch((error) => ({
28899
29020
  balance: null,
28900
29021
  balance_display: "unavailable",
28901
29022
  balance_status: "unknown",
@@ -29078,6 +29199,7 @@ Exit codes:
29078
29199
  registerBillingCommands(program);
29079
29200
  registerMonitorsCommands(program);
29080
29201
  registerOrgCommands(program);
29202
+ registerAdminCommands(program);
29081
29203
  registerEnrichCommand(program);
29082
29204
  registerCsvCommands(program);
29083
29205
  registerDbCommands(program);