@odla-ai/cli 0.26.1 → 0.26.2
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/README.md +0 -19
- package/dist/bin.cjs +58 -216
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-ZAZBUURZ.js → chunk-MBZXWPZP.js} +57 -215
- package/dist/chunk-MBZXWPZP.js.map +1 -0
- package/dist/index.cjs +58 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZAZBUURZ.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -439,7 +439,6 @@ function audienceBoundEnvToken(token, platform) {
|
|
|
439
439
|
}
|
|
440
440
|
var SCOPE_PURPOSE = {
|
|
441
441
|
"platform:status:read": "read the platform fleet health and deployment snapshot",
|
|
442
|
-
"platform:chat:credential:write": "rotate the built-in Discussion responder credential",
|
|
443
442
|
"app:config:read": "compare checked-in intent with an exact-id app Registry configuration",
|
|
444
443
|
"app:config:write": "apply or inspect one revision-bound configuration operation for an app you own",
|
|
445
444
|
"platform:runbook:write": "add or edit odla's operational runbooks",
|
|
@@ -1837,9 +1836,9 @@ function canonicalValue(value2) {
|
|
|
1837
1836
|
}
|
|
1838
1837
|
if (Array.isArray(value2)) return value2.map(canonicalValue);
|
|
1839
1838
|
if (value2 && typeof value2 === "object") {
|
|
1840
|
-
const
|
|
1839
|
+
const record10 = value2;
|
|
1841
1840
|
return Object.fromEntries(
|
|
1842
|
-
Object.keys(
|
|
1841
|
+
Object.keys(record10).filter((key) => record10[key] !== void 0).sort().map((key) => [key, canonicalValue(record10[key])])
|
|
1843
1842
|
);
|
|
1844
1843
|
}
|
|
1845
1844
|
throw new TypeError("canonical JSON rejects unsupported values");
|
|
@@ -4397,8 +4396,8 @@ async function materializeGitTree(source, commitSha, options = {}) {
|
|
|
4397
4396
|
const maxFiles = options.maxFiles ?? 2e4;
|
|
4398
4397
|
const maxBytes = options.maxBytes ?? 512 * 1024 * 1024;
|
|
4399
4398
|
const inventory = (await gitOutput(sourceDir, ["ls-tree", "-rz", commitSha], 16 * 1024 * 1024)).toString("utf8").split("\0").filter(Boolean);
|
|
4400
|
-
const entries = inventory.flatMap((
|
|
4401
|
-
const match = /^(100644|100755) blob ([0-9a-f]{40,64})\t([\s\S]+)$/.exec(
|
|
4399
|
+
const entries = inventory.flatMap((record10) => {
|
|
4400
|
+
const match = /^(100644|100755) blob ([0-9a-f]{40,64})\t([\s\S]+)$/.exec(record10);
|
|
4402
4401
|
return match && allowedWorkspacePath(match[3]) ? [{ mode: match[1], hash: match[2], path: match[3] }] : [];
|
|
4403
4402
|
});
|
|
4404
4403
|
if (entries.length > maxFiles) throw new Error(`workspace exceeds ${maxFiles} files`);
|
|
@@ -4646,8 +4645,8 @@ function normalize(value2) {
|
|
|
4646
4645
|
if (Array.isArray(value2)) return value2.map(normalize);
|
|
4647
4646
|
if (value2 instanceof Uint8Array) return { $bytes: [...value2] };
|
|
4648
4647
|
if (typeof value2 === "object") {
|
|
4649
|
-
const
|
|
4650
|
-
return Object.fromEntries(Object.keys(
|
|
4648
|
+
const record10 = value2;
|
|
4649
|
+
return Object.fromEntries(Object.keys(record10).filter((key) => record10[key] !== void 0).sort().map((key) => [key, normalize(record10[key])]));
|
|
4651
4650
|
}
|
|
4652
4651
|
throw new CamelError("state_conflict", "Canonical JSON rejects unsupported values.");
|
|
4653
4652
|
}
|
|
@@ -7537,8 +7536,7 @@ var COMMAND_SURFACE = {
|
|
|
7537
7536
|
o11y: { status: {} },
|
|
7538
7537
|
operations: { get: {}, wait: {} },
|
|
7539
7538
|
platform: {
|
|
7540
|
-
status: {}
|
|
7541
|
-
"chat-credentials": { rotate: {} }
|
|
7539
|
+
status: {}
|
|
7542
7540
|
},
|
|
7543
7541
|
pm: {
|
|
7544
7542
|
...PM_ENTITIES,
|
|
@@ -9329,7 +9327,6 @@ Usage:
|
|
|
9329
9327
|
odla-ai context remove <name> --yes [--json]
|
|
9330
9328
|
odla-ai o11y status [--app <id>] [--context <name>] [--platform https://odla.ai] [--env prod] [--minutes 60] [--json]
|
|
9331
9329
|
odla-ai platform status [--context <name>] [--platform https://odla.ai] [--email <odla-account>] [--json]
|
|
9332
|
-
odla-ai platform chat-credentials rotate [--context <name>] [--email <odla-account>] [--wrangler-config <path>] [--expected-version <id>] [--json] --yes
|
|
9333
9330
|
odla-ai whoami [--context <name>] [--platform https://odla.ai] [--json]
|
|
9334
9331
|
odla-ai runbook ask "<question>" [--app <id>] [--all] [--json]
|
|
9335
9332
|
odla-ai runbook search "<question>" [--app <id>] [--all] [--limit <n>] [--json]
|
|
@@ -10162,8 +10159,8 @@ async function pmAdd(ctx, entity, parsed) {
|
|
|
10162
10159
|
emit2(ctx, res, () => ctx.out.log(`created ${entity} ${res.id}`));
|
|
10163
10160
|
}
|
|
10164
10161
|
async function pmGet(ctx, entity, id) {
|
|
10165
|
-
const { record:
|
|
10166
|
-
emit2(ctx,
|
|
10162
|
+
const { record: record10 } = await pmRequest(ctx, "GET", `/${entity}/${encodeURIComponent(id)}`);
|
|
10163
|
+
emit2(ctx, record10, () => printRecord(ctx, entity, record10));
|
|
10167
10164
|
}
|
|
10168
10165
|
async function pmSet(ctx, entity, id, parsed) {
|
|
10169
10166
|
const patch2 = collectEntityFields(entity, parsed, true);
|
|
@@ -10208,9 +10205,9 @@ async function pmHandoff(ctx, parsed) {
|
|
|
10208
10205
|
]);
|
|
10209
10206
|
const handoff = {
|
|
10210
10207
|
appId,
|
|
10211
|
-
unmetGoals: goals.filter((
|
|
10212
|
-
activeTasks: tasks.filter((
|
|
10213
|
-
openBugs: bugs.filter((
|
|
10208
|
+
unmetGoals: goals.filter((record10) => record10.status !== "met"),
|
|
10209
|
+
activeTasks: tasks.filter((record10) => record10.column !== "done"),
|
|
10210
|
+
openBugs: bugs.filter((record10) => record10.status !== "fixed" && record10.status !== "wontfix")
|
|
10214
10211
|
};
|
|
10215
10212
|
const result = {
|
|
10216
10213
|
...handoff,
|
|
@@ -10229,10 +10226,10 @@ async function pmHandoff(ctx, parsed) {
|
|
|
10229
10226
|
]) {
|
|
10230
10227
|
ctx.out.log(`${label}:`);
|
|
10231
10228
|
if (!records.length) ctx.out.log("- (none)");
|
|
10232
|
-
else for (const
|
|
10229
|
+
else for (const record10 of records) printRecord(
|
|
10233
10230
|
ctx,
|
|
10234
10231
|
label === "unmet goals" ? "goal" : label === "active tasks" ? "task" : "bug",
|
|
10235
|
-
|
|
10232
|
+
record10
|
|
10236
10233
|
);
|
|
10237
10234
|
}
|
|
10238
10235
|
});
|
|
@@ -10423,167 +10420,12 @@ function age(input) {
|
|
|
10423
10420
|
return `${Math.round(input / 6e4)}m`;
|
|
10424
10421
|
}
|
|
10425
10422
|
|
|
10426
|
-
// src/platform-chat-credential-command.ts
|
|
10427
|
-
import process12 from "process";
|
|
10428
|
-
async function rotatePlatformChatCredential(parsed, deps) {
|
|
10429
|
-
assertArgs(
|
|
10430
|
-
parsed,
|
|
10431
|
-
[
|
|
10432
|
-
"config",
|
|
10433
|
-
"context",
|
|
10434
|
-
"platform",
|
|
10435
|
-
"token",
|
|
10436
|
-
"email",
|
|
10437
|
-
"open",
|
|
10438
|
-
"json",
|
|
10439
|
-
"yes",
|
|
10440
|
-
"wrangler-config",
|
|
10441
|
-
"expected-version"
|
|
10442
|
-
],
|
|
10443
|
-
3
|
|
10444
|
-
);
|
|
10445
|
-
if (parsed.options.yes !== true) {
|
|
10446
|
-
throw new Error(
|
|
10447
|
-
"platform chat-credentials rotate changes the production chat secret; pass --yes"
|
|
10448
|
-
);
|
|
10449
|
-
}
|
|
10450
|
-
const context = await resolveOperatorContext(parsed, {
|
|
10451
|
-
allowMissingConfig: true
|
|
10452
|
-
});
|
|
10453
|
-
const platform = context.platform.value;
|
|
10454
|
-
const doFetch = deps.fetch ?? fetch;
|
|
10455
|
-
const out = deps.stdout ?? console;
|
|
10456
|
-
const run = deps.runner ?? defaultRunner;
|
|
10457
|
-
const cwd = process12.cwd();
|
|
10458
|
-
const wranglerConfig = stringOpt(parsed.options["wrangler-config"]) ?? "packages/chat-agent/wrangler.jsonc";
|
|
10459
|
-
if (!await wranglerLoggedIn(run, cwd)) {
|
|
10460
|
-
throw new Error(
|
|
10461
|
-
'Wrangler is not authenticated; run "npx wrangler login" and retry'
|
|
10462
|
-
);
|
|
10463
|
-
}
|
|
10464
|
-
const priorHealth = await doFetch(`${platform}/health/services/chat`);
|
|
10465
|
-
const priorVersion = priorHealth.headers.get("x-odla-worker-version-id");
|
|
10466
|
-
await priorHealth.body?.cancel().catch(() => {
|
|
10467
|
-
});
|
|
10468
|
-
if (!priorVersion) {
|
|
10469
|
-
throw new Error(
|
|
10470
|
-
"chat health did not identify its current Worker version; refusing to rotate"
|
|
10471
|
-
);
|
|
10472
|
-
}
|
|
10473
|
-
const expectedVersion = stringOpt(parsed.options["expected-version"]);
|
|
10474
|
-
if (expectedVersion && priorVersion !== expectedVersion) {
|
|
10475
|
-
throw new Error(
|
|
10476
|
-
`chat health answered from version ${priorVersion}; expected ${expectedVersion}`
|
|
10477
|
-
);
|
|
10478
|
-
}
|
|
10479
|
-
const token = await resolveAdminPlatformToken({
|
|
10480
|
-
platform,
|
|
10481
|
-
scope: "platform:chat:credential:write",
|
|
10482
|
-
token: stringOpt(parsed.options.token),
|
|
10483
|
-
tokenFile: context.credentials.scopedTokenFile,
|
|
10484
|
-
email: stringOpt(parsed.options.email),
|
|
10485
|
-
open: parsed.options.open === false ? false : parsed.options.open === true ? true : void 0,
|
|
10486
|
-
fetch: doFetch,
|
|
10487
|
-
stdout: out,
|
|
10488
|
-
openApprovalUrl: deps.openUrl,
|
|
10489
|
-
label: "odla CLI (rotate built-in Discussion responder)"
|
|
10490
|
-
});
|
|
10491
|
-
const mintedResponse = await doFetch(
|
|
10492
|
-
`${platform}/registry/platform/chat-credentials/rotate`,
|
|
10493
|
-
{
|
|
10494
|
-
method: "POST",
|
|
10495
|
-
headers: { authorization: `Bearer ${token}` }
|
|
10496
|
-
}
|
|
10497
|
-
);
|
|
10498
|
-
const minted = await mintedResponse.json().catch(() => null);
|
|
10499
|
-
if (!mintedResponse.ok) {
|
|
10500
|
-
throw new Error(
|
|
10501
|
-
`mint Discussion credential failed (HTTP ${mintedResponse.status}): ${apiMessage(minted)}`
|
|
10502
|
-
);
|
|
10503
|
-
}
|
|
10504
|
-
if (!isPlatformChatCredential(minted)) {
|
|
10505
|
-
throw new Error(
|
|
10506
|
-
"platform returned an invalid odla.platform-chat-credential/v1 envelope"
|
|
10507
|
-
);
|
|
10508
|
-
}
|
|
10509
|
-
const put = await wranglerPutSecret(run, {
|
|
10510
|
-
name: "ODLA_BOT_TOKENS",
|
|
10511
|
-
value: JSON.stringify({
|
|
10512
|
-
[minted.appId]: { [minted.principalId]: minted.key }
|
|
10513
|
-
}),
|
|
10514
|
-
configPath: wranglerConfig,
|
|
10515
|
-
cwd
|
|
10516
|
-
});
|
|
10517
|
-
if (put.code !== 0) {
|
|
10518
|
-
throw new Error(
|
|
10519
|
-
"Wrangler could not replace ODLA_BOT_TOKENS; the new scoped key was not activated"
|
|
10520
|
-
);
|
|
10521
|
-
}
|
|
10522
|
-
const version = await waitForRotatedChatHealth({
|
|
10523
|
-
fetch: doFetch,
|
|
10524
|
-
platform,
|
|
10525
|
-
priorVersion,
|
|
10526
|
-
wait: deps.pollWait
|
|
10527
|
-
});
|
|
10528
|
-
const result = {
|
|
10529
|
-
schemaVersion: "odla.platform-chat-credential-rotation/v1",
|
|
10530
|
-
appId: minted.appId,
|
|
10531
|
-
appIncarnation: minted.appIncarnation,
|
|
10532
|
-
principalId: minted.principalId,
|
|
10533
|
-
health: { ok: true, service: "odla-chat-agent", version }
|
|
10534
|
-
};
|
|
10535
|
-
if (parsed.options.json === true) {
|
|
10536
|
-
out.log(JSON.stringify(result, null, 2));
|
|
10537
|
-
} else {
|
|
10538
|
-
out.log(
|
|
10539
|
-
`rotated ${result.appId} ${result.principalId} ${result.health.version}`
|
|
10540
|
-
);
|
|
10541
|
-
}
|
|
10542
|
-
}
|
|
10543
|
-
async function waitForRotatedChatHealth(opts) {
|
|
10544
|
-
const wait2 = opts.wait ?? ((milliseconds) => new Promise((resolve12) => setTimeout(resolve12, milliseconds)));
|
|
10545
|
-
let lastStatus = 0;
|
|
10546
|
-
let lastVersion = null;
|
|
10547
|
-
let lastError = "private_service_unready";
|
|
10548
|
-
for (let attempt = 0; attempt < 60; attempt++) {
|
|
10549
|
-
const response2 = await opts.fetch(
|
|
10550
|
-
`${opts.platform}/health/services/chat`
|
|
10551
|
-
);
|
|
10552
|
-
const body = await response2.json().catch(() => null);
|
|
10553
|
-
const version = response2.headers.get("x-odla-worker-version-id");
|
|
10554
|
-
if (response2.ok && record7(body) && body.ok === true && body.service === "odla-chat-agent" && version && version !== opts.priorVersion) {
|
|
10555
|
-
return version;
|
|
10556
|
-
}
|
|
10557
|
-
lastStatus = response2.status;
|
|
10558
|
-
lastVersion = version;
|
|
10559
|
-
lastError = record7(body) && typeof body.error === "string" ? body.error : "private_service_unready";
|
|
10560
|
-
if (attempt < 59) await wait2(5e3);
|
|
10561
|
-
}
|
|
10562
|
-
throw new Error(
|
|
10563
|
-
`chat health did not converge on the rotated Worker deployment (HTTP ${lastStatus}, version ${lastVersion ?? "unknown"}, ${lastError})`
|
|
10564
|
-
);
|
|
10565
|
-
}
|
|
10566
|
-
function isPlatformChatCredential(value2) {
|
|
10567
|
-
return record7(value2) && value2.schemaVersion === "odla.platform-chat-credential/v1" && value2.appId === "odla-pm" && typeof value2.appIncarnation === "string" && value2.appIncarnation.length > 0 && value2.principalId === "agent_odla" && typeof value2.key === "string" && value2.key.startsWith("odla_sk_");
|
|
10568
|
-
}
|
|
10569
|
-
function apiMessage(value2) {
|
|
10570
|
-
if (!record7(value2)) return "request failed";
|
|
10571
|
-
const error = record7(value2.error) ? value2.error : value2;
|
|
10572
|
-
return typeof error.message === "string" ? error.message : typeof error.code === "string" ? error.code : "request failed";
|
|
10573
|
-
}
|
|
10574
|
-
function record7(value2) {
|
|
10575
|
-
return !!value2 && typeof value2 === "object" && !Array.isArray(value2);
|
|
10576
|
-
}
|
|
10577
|
-
|
|
10578
10423
|
// src/platform-command.ts
|
|
10579
10424
|
async function platformCommand(parsed, deps = {}) {
|
|
10580
10425
|
const action2 = parsed.positionals[1];
|
|
10581
10426
|
if (action2 === "status") {
|
|
10582
10427
|
return platformStatus(parsed, deps);
|
|
10583
10428
|
}
|
|
10584
|
-
if (action2 === "chat-credentials" && parsed.positionals[2] === "rotate") {
|
|
10585
|
-
return rotatePlatformChatCredential(parsed, deps);
|
|
10586
|
-
}
|
|
10587
10429
|
throw new Error(
|
|
10588
10430
|
`unknown platform action "${[
|
|
10589
10431
|
action2,
|
|
@@ -10621,7 +10463,7 @@ async function platformStatus(parsed, deps) {
|
|
|
10621
10463
|
const body = await response2.json().catch(() => null);
|
|
10622
10464
|
if (!response2.ok) {
|
|
10623
10465
|
throw new Error(
|
|
10624
|
-
`read platform status failed (HTTP ${response2.status}): ${
|
|
10466
|
+
`read platform status failed (HTTP ${response2.status}): ${apiMessage(body)}`
|
|
10625
10467
|
);
|
|
10626
10468
|
}
|
|
10627
10469
|
if (!isPlatformStatus(body)) {
|
|
@@ -10634,17 +10476,17 @@ async function platformStatus(parsed, deps) {
|
|
|
10634
10476
|
}
|
|
10635
10477
|
}
|
|
10636
10478
|
function isPlatformStatus(value2) {
|
|
10637
|
-
if (!
|
|
10638
|
-
if (!
|
|
10639
|
-
if (!
|
|
10479
|
+
if (!record7(value2) || value2.schemaVersion !== "odla.platform-status/v1") return false;
|
|
10480
|
+
if (!record7(value2.verdict) || !Array.isArray(value2.verdict.reasons)) return false;
|
|
10481
|
+
if (!record7(value2.catalog) || !record7(value2.summary)) return false;
|
|
10640
10482
|
return Array.isArray(value2.services) && Array.isArray(value2.nextActions);
|
|
10641
10483
|
}
|
|
10642
|
-
function
|
|
10643
|
-
if (!
|
|
10644
|
-
const error =
|
|
10484
|
+
function apiMessage(value2) {
|
|
10485
|
+
if (!record7(value2)) return "request failed";
|
|
10486
|
+
const error = record7(value2.error) ? value2.error : value2;
|
|
10645
10487
|
return typeof error.message === "string" ? error.message : typeof error.code === "string" ? error.code : "request failed";
|
|
10646
10488
|
}
|
|
10647
|
-
function
|
|
10489
|
+
function record7(value2) {
|
|
10648
10490
|
return !!value2 && typeof value2 === "object" && !Array.isArray(value2);
|
|
10649
10491
|
}
|
|
10650
10492
|
|
|
@@ -10685,7 +10527,7 @@ function statusVerdict(reads) {
|
|
|
10685
10527
|
severity: "degraded"
|
|
10686
10528
|
});
|
|
10687
10529
|
}
|
|
10688
|
-
const performance =
|
|
10530
|
+
const performance = record8(reads.liveSync.body.performance) ? reads.liveSync.body.performance : null;
|
|
10689
10531
|
if (performance?.status === "unavailable") {
|
|
10690
10532
|
reasons.push({
|
|
10691
10533
|
source: "liveSync",
|
|
@@ -10766,7 +10608,7 @@ function statusVerdict(reads) {
|
|
|
10766
10608
|
reasons
|
|
10767
10609
|
};
|
|
10768
10610
|
}
|
|
10769
|
-
function
|
|
10611
|
+
function record8(value2) {
|
|
10770
10612
|
return Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
|
|
10771
10613
|
}
|
|
10772
10614
|
function numeric2(value2) {
|
|
@@ -10794,7 +10636,7 @@ function printO11yStatus(status, out) {
|
|
|
10794
10636
|
out.log(
|
|
10795
10637
|
`o11y status ${status.scope.appId}/${status.scope.env} (${status.scope.minutes}m)`
|
|
10796
10638
|
);
|
|
10797
|
-
const routes = Array.isArray(status.application.body.routes) ? status.application.body.routes.filter(
|
|
10639
|
+
const routes = Array.isArray(status.application.body.routes) ? status.application.body.routes.filter(record9) : [];
|
|
10798
10640
|
const requests = routes.reduce(
|
|
10799
10641
|
(total, row) => total + numeric3(row.requests),
|
|
10800
10642
|
0
|
|
@@ -10806,39 +10648,39 @@ function printO11yStatus(status, out) {
|
|
|
10806
10648
|
out.log(
|
|
10807
10649
|
`application ${status.application.httpStatus} ${requests} requests ${errors} errors`
|
|
10808
10650
|
);
|
|
10809
|
-
const versions = Array.isArray(status.applicationVersions.body.rows) ? status.applicationVersions.body.rows.filter(
|
|
10651
|
+
const versions = Array.isArray(status.applicationVersions.body.rows) ? status.applicationVersions.body.rows.filter(record9) : [];
|
|
10810
10652
|
out.log(
|
|
10811
10653
|
`application-versions ${status.applicationVersions.httpStatus} ${versions.length ? versions.slice(0, 5).map(
|
|
10812
10654
|
(row) => `${String(row.value || "(unattributed)")}:${numeric3(row.requests)}`
|
|
10813
10655
|
).join(", ") : "none observed"}`
|
|
10814
10656
|
);
|
|
10815
10657
|
out.log(liveSyncLine(status.liveSync));
|
|
10816
|
-
const canaryDurations =
|
|
10658
|
+
const canaryDurations = record9(status.canary.body.durationsMs) ? status.canary.body.durationsMs : {};
|
|
10817
10659
|
out.log(
|
|
10818
10660
|
`canary ${status.canary.httpStatus} ${String(status.canary.body.status ?? status.canary.body.error ?? "unavailable")} ${optionalNumeric(canaryDurations.publishToVisibleMs)} publish-to-visible`
|
|
10819
10661
|
);
|
|
10820
|
-
const collectorIngest =
|
|
10821
|
-
const collectorStorage =
|
|
10662
|
+
const collectorIngest = record9(status.collector.body.ingest) ? status.collector.body.ingest : {};
|
|
10663
|
+
const collectorStorage = record9(collectorIngest.storage) ? collectorIngest.storage : {};
|
|
10822
10664
|
out.log(
|
|
10823
10665
|
`collector ${status.collector.httpStatus} ${String(status.collector.body.status ?? status.collector.body.error ?? "unavailable")} ${numeric3(collectorStorage.affectedPoints)} affected points`
|
|
10824
10666
|
);
|
|
10825
|
-
const providerMetrics =
|
|
10826
|
-
const providerCapacity =
|
|
10827
|
-
const workerMemory =
|
|
10667
|
+
const providerMetrics = record9(status.provider.body.metrics) ? status.provider.body.metrics : {};
|
|
10668
|
+
const providerCapacity = record9(status.provider.body.capacity) ? status.provider.body.capacity : {};
|
|
10669
|
+
const workerMemory = record9(providerCapacity.memory) ? providerCapacity.memory : {};
|
|
10828
10670
|
out.log(
|
|
10829
10671
|
`cloudflare ${status.provider.httpStatus} ${String(status.provider.body.status ?? status.provider.body.error ?? "unavailable")} ${numeric3(providerMetrics.requests)} invocations ${numeric3(providerMetrics.errors)} runtime errors ${optionalBytes(workerMemory.headroomBytes)} isolate memory headroom`
|
|
10830
10672
|
);
|
|
10831
10673
|
for (const line of providerCapacityLines(status.providerCapacity)) {
|
|
10832
10674
|
out.log(line);
|
|
10833
10675
|
}
|
|
10834
|
-
const coverage =
|
|
10835
|
-
const coverageCounts =
|
|
10836
|
-
const coverageBudget =
|
|
10676
|
+
const coverage = record9(status.providerReconciliation.body.comparison) ? status.providerReconciliation.body.comparison : {};
|
|
10677
|
+
const coverageCounts = record9(status.providerReconciliation.body.counts) ? status.providerReconciliation.body.counts : {};
|
|
10678
|
+
const coverageBudget = record9(status.providerReconciliation.body.budget) ? status.providerReconciliation.body.budget : {};
|
|
10837
10679
|
out.log(
|
|
10838
10680
|
`request-coverage ${status.providerReconciliation.httpStatus} ${String(status.providerReconciliation.body.status ?? status.providerReconciliation.body.error ?? "unavailable")} ${optionalPercent(coverage.applicationCoverage)} application/provider ${numeric3(coverageCounts.applicationRequests)}/${numeric3(coverageCounts.providerRequests)} requests \xB1${optionalPercent(coverageBudget.maxRelativeError)} budget`
|
|
10839
10681
|
);
|
|
10840
10682
|
const providerPoints = Array.isArray(status.providerHistory.body.points) ? status.providerHistory.body.points.length : 0;
|
|
10841
|
-
const providerFreshness =
|
|
10683
|
+
const providerFreshness = record9(status.providerHistory.body.freshness) ? status.providerHistory.body.freshness : {};
|
|
10842
10684
|
out.log(
|
|
10843
10685
|
`cloudflare-history ${status.providerHistory.httpStatus} ${String(status.providerHistory.body.status ?? status.providerHistory.body.error ?? "unavailable")} ${providerPoints} snapshots ${optionalAge(providerFreshness.ageMs)} old`
|
|
10844
10686
|
);
|
|
@@ -10847,17 +10689,17 @@ function printO11yStatus(status, out) {
|
|
|
10847
10689
|
);
|
|
10848
10690
|
}
|
|
10849
10691
|
function providerCapacityLines(read3) {
|
|
10850
|
-
const resources =
|
|
10851
|
-
const durableObjects =
|
|
10852
|
-
const periodic =
|
|
10853
|
-
const storage =
|
|
10854
|
-
const d1 =
|
|
10855
|
-
const d1Activity =
|
|
10856
|
-
const d1Storage =
|
|
10857
|
-
const d1Latency =
|
|
10858
|
-
const r2 =
|
|
10859
|
-
const r2Operations =
|
|
10860
|
-
const r2Storage =
|
|
10692
|
+
const resources = record9(read3.body.resources) ? read3.body.resources : {};
|
|
10693
|
+
const durableObjects = record9(resources.durableObjects) ? resources.durableObjects : {};
|
|
10694
|
+
const periodic = record9(durableObjects.periodic) ? durableObjects.periodic : {};
|
|
10695
|
+
const storage = record9(durableObjects.sqliteStorage) ? durableObjects.sqliteStorage : {};
|
|
10696
|
+
const d1 = record9(resources.d1) ? resources.d1 : {};
|
|
10697
|
+
const d1Activity = record9(d1.activity) ? d1.activity : {};
|
|
10698
|
+
const d1Storage = record9(d1.storage) ? d1.storage : {};
|
|
10699
|
+
const d1Latency = record9(d1Activity.latency) ? d1Activity.latency : {};
|
|
10700
|
+
const r2 = record9(resources.r2) ? resources.r2 : {};
|
|
10701
|
+
const r2Operations = record9(r2.operations) ? r2.operations : {};
|
|
10702
|
+
const r2Storage = record9(r2.storage) ? r2.storage : {};
|
|
10861
10703
|
const status = String(
|
|
10862
10704
|
read3.body.status ?? read3.body.error ?? "unavailable"
|
|
10863
10705
|
);
|
|
@@ -10868,11 +10710,11 @@ function providerCapacityLines(read3) {
|
|
|
10868
10710
|
];
|
|
10869
10711
|
}
|
|
10870
10712
|
function liveSyncLine(read3) {
|
|
10871
|
-
const performance =
|
|
10872
|
-
const commitToSend =
|
|
10713
|
+
const performance = record9(read3.body.performance) ? read3.body.performance : {};
|
|
10714
|
+
const commitToSend = record9(performance.commitToSend) ? performance.commitToSend : {};
|
|
10873
10715
|
return `live-sync ${read3.httpStatus} ${String(read3.body.status ?? read3.body.error ?? "unavailable")} ${numeric3(read3.body.activeConnections)} active ${optionalNumeric(commitToSend.p95)} commit-to-send p95 ${numeric3(performance.sendFailures)} send failures`;
|
|
10874
10716
|
}
|
|
10875
|
-
function
|
|
10717
|
+
function record9(value2) {
|
|
10876
10718
|
return Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
|
|
10877
10719
|
}
|
|
10878
10720
|
function numeric3(value2) {
|
|
@@ -11056,9 +10898,9 @@ async function read2(url, headers, doFetch) {
|
|
|
11056
10898
|
|
|
11057
10899
|
// src/record.ts
|
|
11058
10900
|
import { appendFileSync } from "fs";
|
|
11059
|
-
import
|
|
10901
|
+
import process12 from "process";
|
|
11060
10902
|
function recordInvocation(parsed) {
|
|
11061
|
-
const file =
|
|
10903
|
+
const file = process12.env.ODLA_CLI_RECORD;
|
|
11062
10904
|
if (!file) return;
|
|
11063
10905
|
try {
|
|
11064
10906
|
const entry = {
|
|
@@ -11730,9 +11572,9 @@ import { spawnSync } from "child_process";
|
|
|
11730
11572
|
import { mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
11731
11573
|
import { tmpdir as tmpdir4 } from "os";
|
|
11732
11574
|
import { join as join15 } from "path";
|
|
11733
|
-
import
|
|
11575
|
+
import process13 from "process";
|
|
11734
11576
|
var EDITOR_ENV = ["ODLA_EDITOR", "VISUAL", "EDITOR"];
|
|
11735
|
-
function resolveEditor(env =
|
|
11577
|
+
function resolveEditor(env = process13.env) {
|
|
11736
11578
|
for (const name of EDITOR_ENV) {
|
|
11737
11579
|
const value2 = env[name];
|
|
11738
11580
|
if (value2 && value2.trim()) return value2.trim();
|
|
@@ -11746,8 +11588,8 @@ function defaultRun(command, path) {
|
|
|
11746
11588
|
return result.status ?? 0;
|
|
11747
11589
|
}
|
|
11748
11590
|
function editText(initial, slug, deps = {}) {
|
|
11749
|
-
const env = deps.env ??
|
|
11750
|
-
const interactive = deps.interactive ?? (() => Boolean(
|
|
11591
|
+
const env = deps.env ?? process13.env;
|
|
11592
|
+
const interactive = deps.interactive ?? (() => Boolean(process13.stdin.isTTY));
|
|
11751
11593
|
const editor = resolveEditor(env);
|
|
11752
11594
|
if (!editor)
|
|
11753
11595
|
throw new Error(
|
|
@@ -12734,4 +12576,4 @@ export {
|
|
|
12734
12576
|
exitCodeFor,
|
|
12735
12577
|
runCli
|
|
12736
12578
|
};
|
|
12737
|
-
//# sourceMappingURL=chunk-
|
|
12579
|
+
//# sourceMappingURL=chunk-MBZXWPZP.js.map
|