deepline 0.1.263 → 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/bundling-sources/sdk/src/client.ts +4 -0
- package/dist/bundling-sources/sdk/src/release.ts +4 -2
- package/dist/bundling-sources/sdk/src/types.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +9 -0
- package/dist/cli/index.js +86 -206
- package/dist/cli/index.mjs +92 -212
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +2 -2
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
|
-
|
|
720
|
-
|
|
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(
|
|
2188
|
+
async function mintRunObserveGrant(http, runId) {
|
|
2187
2189
|
let response;
|
|
2188
2190
|
try {
|
|
2189
|
-
response = await
|
|
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
|
|
2254
|
-
let grant = await mintRunObserveGrant(
|
|
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(
|
|
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
|
|
6735
|
-
const payload = await
|
|
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
|
|
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
|
|
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
|
|
6802
|
-
const payload = await
|
|
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
|
|
6819
|
-
const payload = await
|
|
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
|
|
6840
|
-
const payload = await
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
6990
|
-
const payload = await
|
|
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
|
|
7023
|
-
const payload = await
|
|
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
|
|
7243
|
-
const payload = await
|
|
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
|
|
7363
|
-
const payload = await
|
|
7242
|
+
const { http } = getAuthedHttpClient();
|
|
7243
|
+
const payload = await http.post(
|
|
7364
7244
|
"/api/v2/billing/checkout",
|
|
7365
7245
|
{
|
|
7366
7246
|
discountCode: code
|
|
@@ -23477,8 +23357,8 @@ function registerEnrichCommand(program) {
|
|
|
23477
23357
|
|
|
23478
23358
|
// src/cli/commands/feedback.ts
|
|
23479
23359
|
async function handleFeedback(text, options) {
|
|
23480
|
-
const { http
|
|
23481
|
-
const response = await
|
|
23360
|
+
const { http } = getAuthedHttpClient();
|
|
23361
|
+
const response = await http.post("/api/v2/cli/feedback", {
|
|
23482
23362
|
text,
|
|
23483
23363
|
environment: collectLocalEnvInfo(),
|
|
23484
23364
|
...options.command ? { command: options.command } : {},
|
|
@@ -23882,8 +23762,8 @@ function buildSessionUploadContent(raw) {
|
|
|
23882
23762
|
return { encodedContent: encoded, needsChunking: true };
|
|
23883
23763
|
}
|
|
23884
23764
|
async function uploadPayload(path, payload) {
|
|
23885
|
-
const { http
|
|
23886
|
-
return await
|
|
23765
|
+
const { http } = getAuthedHttpClient();
|
|
23766
|
+
return await http.post(path, payload);
|
|
23887
23767
|
}
|
|
23888
23768
|
async function uploadChunkedSessions(sessions, options) {
|
|
23889
23769
|
const uploadId = (0, import_node_crypto5.randomUUID)();
|
|
@@ -24669,8 +24549,8 @@ Preview the plan first with:
|
|
|
24669
24549
|
);
|
|
24670
24550
|
}
|
|
24671
24551
|
async function handleMonitorsStatus(options) {
|
|
24672
|
-
const
|
|
24673
|
-
const payload = await
|
|
24552
|
+
const http = buildHttpClient();
|
|
24553
|
+
const payload = await http.request(
|
|
24674
24554
|
"/api/v2/monitors/access",
|
|
24675
24555
|
{ method: "GET" }
|
|
24676
24556
|
);
|
|
@@ -24743,7 +24623,7 @@ async function handleMonitorsAvailable(toolId, options) {
|
|
|
24743
24623
|
}
|
|
24744
24624
|
}
|
|
24745
24625
|
const tool = toolId ?? options.tool;
|
|
24746
|
-
const
|
|
24626
|
+
const http = buildHttpClient();
|
|
24747
24627
|
const params = new URLSearchParams();
|
|
24748
24628
|
if (options.provider) params.set("provider", options.provider);
|
|
24749
24629
|
if (tool) params.set("tool", tool);
|
|
@@ -24752,7 +24632,7 @@ async function handleMonitorsAvailable(toolId, options) {
|
|
|
24752
24632
|
const compactList = !tool && !options.full;
|
|
24753
24633
|
if (compactList || options.compact) params.set("compact", "true");
|
|
24754
24634
|
const query = params.toString();
|
|
24755
|
-
const payload = await
|
|
24635
|
+
const payload = await http.request(
|
|
24756
24636
|
`/api/v2/monitors/tools${query ? `?${query}` : ""}`,
|
|
24757
24637
|
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24758
24638
|
);
|
|
@@ -24792,13 +24672,13 @@ function renderDeployedListText(payload, requestedStatus) {
|
|
|
24792
24672
|
`;
|
|
24793
24673
|
}
|
|
24794
24674
|
async function handleMonitorsList(options) {
|
|
24795
|
-
const
|
|
24675
|
+
const http = buildHttpClient();
|
|
24796
24676
|
const params = new URLSearchParams();
|
|
24797
24677
|
if (options.status) params.set("status", options.status);
|
|
24798
24678
|
if (options.limit) params.set("limit", options.limit);
|
|
24799
24679
|
if (options.compact) params.set("compact", "true");
|
|
24800
24680
|
const query = params.toString();
|
|
24801
|
-
const payload = await
|
|
24681
|
+
const payload = await http.request(
|
|
24802
24682
|
`/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
|
|
24803
24683
|
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24804
24684
|
);
|
|
@@ -24808,21 +24688,21 @@ async function handleMonitorsList(options) {
|
|
|
24808
24688
|
});
|
|
24809
24689
|
}
|
|
24810
24690
|
async function handleMonitorsCheck(definition, options) {
|
|
24811
|
-
const
|
|
24691
|
+
const http = buildHttpClient();
|
|
24812
24692
|
const body = resolveMonitorJsonBody({
|
|
24813
24693
|
positional: definition,
|
|
24814
24694
|
file: options.file,
|
|
24815
24695
|
argLabel: "<definition>",
|
|
24816
24696
|
command: "deepline monitors check"
|
|
24817
24697
|
});
|
|
24818
|
-
const payload = await
|
|
24698
|
+
const payload = await http.request(
|
|
24819
24699
|
"/api/v2/monitors/check",
|
|
24820
24700
|
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24821
24701
|
);
|
|
24822
24702
|
printCommandEnvelope(payload, { json: options.json });
|
|
24823
24703
|
}
|
|
24824
24704
|
async function handleMonitorsDeploy(definition, options) {
|
|
24825
|
-
const
|
|
24705
|
+
const http = buildHttpClient();
|
|
24826
24706
|
const body = resolveMonitorJsonBody({
|
|
24827
24707
|
positional: definition,
|
|
24828
24708
|
file: options.file,
|
|
@@ -24830,7 +24710,7 @@ async function handleMonitorsDeploy(definition, options) {
|
|
|
24830
24710
|
command: "deepline monitors deploy"
|
|
24831
24711
|
});
|
|
24832
24712
|
if (options.dryRun) {
|
|
24833
|
-
const payload2 = await
|
|
24713
|
+
const payload2 = await http.request(
|
|
24834
24714
|
"/api/v2/monitors/check",
|
|
24835
24715
|
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24836
24716
|
);
|
|
@@ -24844,7 +24724,7 @@ async function handleMonitorsDeploy(definition, options) {
|
|
|
24844
24724
|
}
|
|
24845
24725
|
return;
|
|
24846
24726
|
}
|
|
24847
|
-
const payload = await
|
|
24727
|
+
const payload = await http.request(
|
|
24848
24728
|
"/api/v2/monitors/deploy",
|
|
24849
24729
|
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24850
24730
|
);
|
|
@@ -24896,12 +24776,12 @@ function renderMonitorGet(payload) {
|
|
|
24896
24776
|
`;
|
|
24897
24777
|
}
|
|
24898
24778
|
async function handleMonitorsGet(key, options) {
|
|
24899
|
-
const
|
|
24900
|
-
const payload = await
|
|
24779
|
+
const http = buildHttpClient();
|
|
24780
|
+
const payload = await http.request(
|
|
24901
24781
|
`/api/v2/monitors/deployed/${encodeKey(key)}`,
|
|
24902
24782
|
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24903
24783
|
);
|
|
24904
|
-
const dependents = await
|
|
24784
|
+
const dependents = await http.request(
|
|
24905
24785
|
`/api/v2/monitors/deployed/${encodeKey(key)}/dependents`,
|
|
24906
24786
|
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24907
24787
|
);
|
|
@@ -24927,12 +24807,12 @@ async function confirmMonitorDelete(key, options) {
|
|
|
24927
24807
|
}
|
|
24928
24808
|
}
|
|
24929
24809
|
async function handleMonitorsDelete(key, options) {
|
|
24930
|
-
const
|
|
24810
|
+
const http = buildHttpClient();
|
|
24931
24811
|
const params = new URLSearchParams();
|
|
24932
24812
|
if (options.localOnly) params.set("local_only", "true");
|
|
24933
24813
|
if (options.dryRun) {
|
|
24934
24814
|
params.set("dry_run", "true");
|
|
24935
|
-
const payload2 = await
|
|
24815
|
+
const payload2 = await http.request(
|
|
24936
24816
|
`/api/v2/monitors/deployed/${encodeKey(key)}?${params.toString()}`,
|
|
24937
24817
|
{ method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
|
|
24938
24818
|
);
|
|
@@ -24964,30 +24844,30 @@ async function handleMonitorsDelete(key, options) {
|
|
|
24964
24844
|
}
|
|
24965
24845
|
}
|
|
24966
24846
|
const query = params.toString();
|
|
24967
|
-
const payload = await
|
|
24847
|
+
const payload = await http.request(
|
|
24968
24848
|
`/api/v2/monitors/deployed/${encodeKey(key)}${query ? `?${query}` : ""}`,
|
|
24969
24849
|
{ method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
|
|
24970
24850
|
);
|
|
24971
24851
|
printCommandEnvelope(payload, { json: options.json });
|
|
24972
24852
|
}
|
|
24973
24853
|
async function handleMonitorsUpdate(key, patch, options) {
|
|
24974
|
-
const
|
|
24854
|
+
const http = buildHttpClient();
|
|
24975
24855
|
const body = resolveMonitorJsonBody({
|
|
24976
24856
|
positional: patch,
|
|
24977
24857
|
file: options.file,
|
|
24978
24858
|
argLabel: "<patch>",
|
|
24979
24859
|
command: `deepline monitors update ${key}`
|
|
24980
24860
|
});
|
|
24981
|
-
const payload = await
|
|
24861
|
+
const payload = await http.request(
|
|
24982
24862
|
`/api/v2/monitors/deployed/${encodeKey(key)}`,
|
|
24983
24863
|
{ method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24984
24864
|
);
|
|
24985
24865
|
printCommandEnvelope(payload, { json: options.json });
|
|
24986
24866
|
}
|
|
24987
24867
|
async function handleMonitorsReactivate(key, options) {
|
|
24988
|
-
const
|
|
24868
|
+
const http = buildHttpClient();
|
|
24989
24869
|
if (options.dryRun) {
|
|
24990
|
-
const payload2 = await
|
|
24870
|
+
const payload2 = await http.request(
|
|
24991
24871
|
`/api/v2/monitors/deployed/${encodeKey(key)}/reactivate?dry_run=true`,
|
|
24992
24872
|
{ method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
|
|
24993
24873
|
);
|
|
@@ -25001,7 +24881,7 @@ async function handleMonitorsReactivate(key, options) {
|
|
|
25001
24881
|
});
|
|
25002
24882
|
return;
|
|
25003
24883
|
}
|
|
25004
|
-
const payload = await
|
|
24884
|
+
const payload = await http.request(
|
|
25005
24885
|
`/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
|
|
25006
24886
|
{ method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
|
|
25007
24887
|
);
|
|
@@ -25247,8 +25127,8 @@ Examples:
|
|
|
25247
25127
|
}
|
|
25248
25128
|
|
|
25249
25129
|
// src/cli/commands/org.ts
|
|
25250
|
-
async function fetchOrganizations(
|
|
25251
|
-
return
|
|
25130
|
+
async function fetchOrganizations(http, apiKey) {
|
|
25131
|
+
return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
|
|
25252
25132
|
}
|
|
25253
25133
|
function normalizeAuthScope2(value) {
|
|
25254
25134
|
if (!value) return "auto";
|
|
@@ -25352,8 +25232,8 @@ function resolveOrgSwitchAuthTarget(scope, config) {
|
|
|
25352
25232
|
}
|
|
25353
25233
|
async function handleOrgList(options) {
|
|
25354
25234
|
const config = resolveConfig();
|
|
25355
|
-
const
|
|
25356
|
-
const payload = await fetchOrganizations(
|
|
25235
|
+
const http = new HttpClient(config);
|
|
25236
|
+
const payload = await fetchOrganizations(http, config.apiKey);
|
|
25357
25237
|
printCommandEnvelope(
|
|
25358
25238
|
{
|
|
25359
25239
|
...payload,
|
|
@@ -25371,8 +25251,8 @@ async function handleOrgList(options) {
|
|
|
25371
25251
|
}
|
|
25372
25252
|
async function handleOrgStatus(options) {
|
|
25373
25253
|
const config = resolveConfig();
|
|
25374
|
-
const
|
|
25375
|
-
const payload = await fetchOrganizations(
|
|
25254
|
+
const http = new HttpClient(config);
|
|
25255
|
+
const payload = await fetchOrganizations(http, config.apiKey);
|
|
25376
25256
|
const current = payload.organizations.find((org) => org.is_current) ?? payload.organizations.find(
|
|
25377
25257
|
(org) => org.org_id === payload.current_org_id
|
|
25378
25258
|
) ?? null;
|
|
@@ -25455,8 +25335,8 @@ async function handleOrgStatus(options) {
|
|
|
25455
25335
|
async function handleOrgSwitch(selection, options) {
|
|
25456
25336
|
const authScope = normalizeAuthScope2(options.authScope);
|
|
25457
25337
|
const config = resolveConfig();
|
|
25458
|
-
const
|
|
25459
|
-
const payload = await fetchOrganizations(
|
|
25338
|
+
const http = new HttpClient(config);
|
|
25339
|
+
const payload = await fetchOrganizations(http, config.apiKey);
|
|
25460
25340
|
if (!selection && !options.orgId) {
|
|
25461
25341
|
printCommandEnvelope(
|
|
25462
25342
|
{
|
|
@@ -25551,7 +25431,7 @@ async function handleOrgSwitch(selection, options) {
|
|
|
25551
25431
|
);
|
|
25552
25432
|
return;
|
|
25553
25433
|
}
|
|
25554
|
-
const switched = await
|
|
25434
|
+
const switched = await http.post("/api/v2/auth/cli/switch", {
|
|
25555
25435
|
api_key: config.apiKey,
|
|
25556
25436
|
org_id: target.org_id
|
|
25557
25437
|
});
|
|
@@ -25619,8 +25499,8 @@ async function handleOrgSwitch(selection, options) {
|
|
|
25619
25499
|
}
|
|
25620
25500
|
async function handleOrgCreate(name, options) {
|
|
25621
25501
|
const config = resolveConfig();
|
|
25622
|
-
const
|
|
25623
|
-
const created = await
|
|
25502
|
+
const http = new HttpClient(config);
|
|
25503
|
+
const created = await http.post("/api/v2/auth/cli/org-create", {
|
|
25624
25504
|
api_key: config.apiKey,
|
|
25625
25505
|
name
|
|
25626
25506
|
});
|
|
@@ -26212,8 +26092,8 @@ async function handleSet(nameInput, forbidden, options) {
|
|
|
26212
26092
|
throw new Error("--play <name> is required when --scope play is used.");
|
|
26213
26093
|
}
|
|
26214
26094
|
const value = await readSecretValue();
|
|
26215
|
-
const { http
|
|
26216
|
-
const response = await
|
|
26095
|
+
const { http } = getAuthedHttpClient();
|
|
26096
|
+
const response = await http.post(
|
|
26217
26097
|
"/api/v2/secrets",
|
|
26218
26098
|
{
|
|
26219
26099
|
name,
|
|
@@ -32006,7 +31886,7 @@ async function runPreflightCheck() {
|
|
|
32006
31886
|
};
|
|
32007
31887
|
}).catch(() => ({ status: "unreachable", version: null })).finally(() => clearTimeout(healthTimeout));
|
|
32008
31888
|
const apiKey = resolveApiKeyForBaseUrl(baseUrl);
|
|
32009
|
-
const
|
|
31889
|
+
const http = apiKey ? new HttpClient(
|
|
32010
31890
|
resolveConfig({
|
|
32011
31891
|
baseUrl,
|
|
32012
31892
|
apiKey,
|
|
@@ -32014,8 +31894,8 @@ async function runPreflightCheck() {
|
|
|
32014
31894
|
maxRetries: 0
|
|
32015
31895
|
})
|
|
32016
31896
|
) : null;
|
|
32017
|
-
const [auth, billing] =
|
|
32018
|
-
|
|
31897
|
+
const [auth, billing] = http ? await Promise.all([
|
|
31898
|
+
http.post("/api/v2/auth/cli/status", {
|
|
32019
31899
|
api_key: apiKey,
|
|
32020
31900
|
reveal: false
|
|
32021
31901
|
}).catch((error) => ({
|
|
@@ -32023,7 +31903,7 @@ async function runPreflightCheck() {
|
|
|
32023
31903
|
connected: false,
|
|
32024
31904
|
error: preflightErrorMessage(error)
|
|
32025
31905
|
})),
|
|
32026
|
-
|
|
31906
|
+
http.get("/api/v2/billing/balance").catch((error) => ({
|
|
32027
31907
|
balance: null,
|
|
32028
31908
|
balance_display: "unavailable",
|
|
32029
31909
|
balance_status: "unknown",
|
|
@@ -32206,7 +32086,6 @@ Exit codes:
|
|
|
32206
32086
|
registerBillingCommands(program);
|
|
32207
32087
|
registerMonitorsCommands(program);
|
|
32208
32088
|
registerOrgCommands(program);
|
|
32209
|
-
registerAdminCommands(program);
|
|
32210
32089
|
registerEnrichCommand(program);
|
|
32211
32090
|
registerCsvCommands(program);
|
|
32212
32091
|
registerDbCommands(program);
|
|
@@ -32376,7 +32255,8 @@ Examples:
|
|
|
32376
32255
|
} else {
|
|
32377
32256
|
console.error(`Error: ${String(error)}`);
|
|
32378
32257
|
}
|
|
32379
|
-
const
|
|
32258
|
+
const explicitExitCode = error && typeof error === "object" && typeof error.exitCode === "number" ? error.exitCode : void 0;
|
|
32259
|
+
const failureExitCode = explicitExitCode ?? resolveSdkCliFailureExitCode(error);
|
|
32380
32260
|
process.exitCode = failureExitCode;
|
|
32381
32261
|
await maybeReportSdkCliFailure({
|
|
32382
32262
|
argv: process.argv.slice(2),
|