@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/index.cjs
CHANGED
|
@@ -560,7 +560,6 @@ function audienceBoundEnvToken(token, platform) {
|
|
|
560
560
|
}
|
|
561
561
|
var SCOPE_PURPOSE = {
|
|
562
562
|
"platform:status:read": "read the platform fleet health and deployment snapshot",
|
|
563
|
-
"platform:chat:credential:write": "rotate the built-in Discussion responder credential",
|
|
564
563
|
"app:config:read": "compare checked-in intent with an exact-id app Registry configuration",
|
|
565
564
|
"app:config:write": "apply or inspect one revision-bound configuration operation for an app you own",
|
|
566
565
|
"platform:runbook:write": "add or edit odla's operational runbooks",
|
|
@@ -2811,9 +2810,9 @@ function canonicalValue(value2) {
|
|
|
2811
2810
|
}
|
|
2812
2811
|
if (Array.isArray(value2)) return value2.map(canonicalValue);
|
|
2813
2812
|
if (value2 && typeof value2 === "object") {
|
|
2814
|
-
const
|
|
2813
|
+
const record10 = value2;
|
|
2815
2814
|
return Object.fromEntries(
|
|
2816
|
-
Object.keys(
|
|
2815
|
+
Object.keys(record10).filter((key) => record10[key] !== void 0).sort().map((key) => [key, canonicalValue(record10[key])])
|
|
2817
2816
|
);
|
|
2818
2817
|
}
|
|
2819
2818
|
throw new TypeError("canonical JSON rejects unsupported values");
|
|
@@ -5330,8 +5329,8 @@ async function materializeGitTree(source, commitSha, options = {}) {
|
|
|
5330
5329
|
const maxFiles = options.maxFiles ?? 2e4;
|
|
5331
5330
|
const maxBytes = options.maxBytes ?? 512 * 1024 * 1024;
|
|
5332
5331
|
const inventory = (await gitOutput(sourceDir, ["ls-tree", "-rz", commitSha], 16 * 1024 * 1024)).toString("utf8").split("\0").filter(Boolean);
|
|
5333
|
-
const entries = inventory.flatMap((
|
|
5334
|
-
const match = /^(100644|100755) blob ([0-9a-f]{40,64})\t([\s\S]+)$/.exec(
|
|
5332
|
+
const entries = inventory.flatMap((record10) => {
|
|
5333
|
+
const match = /^(100644|100755) blob ([0-9a-f]{40,64})\t([\s\S]+)$/.exec(record10);
|
|
5335
5334
|
return match && allowedWorkspacePath(match[3]) ? [{ mode: match[1], hash: match[2], path: match[3] }] : [];
|
|
5336
5335
|
});
|
|
5337
5336
|
if (entries.length > maxFiles) throw new Error(`workspace exceeds ${maxFiles} files`);
|
|
@@ -5579,8 +5578,8 @@ function normalize(value2) {
|
|
|
5579
5578
|
if (Array.isArray(value2)) return value2.map(normalize);
|
|
5580
5579
|
if (value2 instanceof Uint8Array) return { $bytes: [...value2] };
|
|
5581
5580
|
if (typeof value2 === "object") {
|
|
5582
|
-
const
|
|
5583
|
-
return Object.fromEntries(Object.keys(
|
|
5581
|
+
const record10 = value2;
|
|
5582
|
+
return Object.fromEntries(Object.keys(record10).filter((key) => record10[key] !== void 0).sort().map((key) => [key, normalize(record10[key])]));
|
|
5584
5583
|
}
|
|
5585
5584
|
throw new CamelError("state_conflict", "Canonical JSON rejects unsupported values.");
|
|
5586
5585
|
}
|
|
@@ -8640,7 +8639,6 @@ Usage:
|
|
|
8640
8639
|
odla-ai context remove <name> --yes [--json]
|
|
8641
8640
|
odla-ai o11y status [--app <id>] [--context <name>] [--platform https://odla.ai] [--env prod] [--minutes 60] [--json]
|
|
8642
8641
|
odla-ai platform status [--context <name>] [--platform https://odla.ai] [--email <odla-account>] [--json]
|
|
8643
|
-
odla-ai platform chat-credentials rotate [--context <name>] [--email <odla-account>] [--wrangler-config <path>] [--expected-version <id>] [--json] --yes
|
|
8644
8642
|
odla-ai whoami [--context <name>] [--platform https://odla.ai] [--json]
|
|
8645
8643
|
odla-ai runbook ask "<question>" [--app <id>] [--all] [--json]
|
|
8646
8644
|
odla-ai runbook search "<question>" [--app <id>] [--all] [--limit <n>] [--json]
|
|
@@ -9473,8 +9471,8 @@ async function pmAdd(ctx, entity, parsed) {
|
|
|
9473
9471
|
emit2(ctx, res, () => ctx.out.log(`created ${entity} ${res.id}`));
|
|
9474
9472
|
}
|
|
9475
9473
|
async function pmGet(ctx, entity, id) {
|
|
9476
|
-
const { record:
|
|
9477
|
-
emit2(ctx,
|
|
9474
|
+
const { record: record10 } = await pmRequest(ctx, "GET", `/${entity}/${encodeURIComponent(id)}`);
|
|
9475
|
+
emit2(ctx, record10, () => printRecord(ctx, entity, record10));
|
|
9478
9476
|
}
|
|
9479
9477
|
async function pmSet(ctx, entity, id, parsed) {
|
|
9480
9478
|
const patch2 = collectEntityFields(entity, parsed, true);
|
|
@@ -9519,9 +9517,9 @@ async function pmHandoff(ctx, parsed) {
|
|
|
9519
9517
|
]);
|
|
9520
9518
|
const handoff = {
|
|
9521
9519
|
appId,
|
|
9522
|
-
unmetGoals: goals.filter((
|
|
9523
|
-
activeTasks: tasks.filter((
|
|
9524
|
-
openBugs: bugs.filter((
|
|
9520
|
+
unmetGoals: goals.filter((record10) => record10.status !== "met"),
|
|
9521
|
+
activeTasks: tasks.filter((record10) => record10.column !== "done"),
|
|
9522
|
+
openBugs: bugs.filter((record10) => record10.status !== "fixed" && record10.status !== "wontfix")
|
|
9525
9523
|
};
|
|
9526
9524
|
const result = {
|
|
9527
9525
|
...handoff,
|
|
@@ -9540,10 +9538,10 @@ async function pmHandoff(ctx, parsed) {
|
|
|
9540
9538
|
]) {
|
|
9541
9539
|
ctx.out.log(`${label}:`);
|
|
9542
9540
|
if (!records.length) ctx.out.log("- (none)");
|
|
9543
|
-
else for (const
|
|
9541
|
+
else for (const record10 of records) printRecord(
|
|
9544
9542
|
ctx,
|
|
9545
9543
|
label === "unmet goals" ? "goal" : label === "active tasks" ? "task" : "bug",
|
|
9546
|
-
|
|
9544
|
+
record10
|
|
9547
9545
|
);
|
|
9548
9546
|
}
|
|
9549
9547
|
});
|
|
@@ -9734,167 +9732,12 @@ function age(input) {
|
|
|
9734
9732
|
return `${Math.round(input / 6e4)}m`;
|
|
9735
9733
|
}
|
|
9736
9734
|
|
|
9737
|
-
// src/platform-chat-credential-command.ts
|
|
9738
|
-
var import_node_process10 = __toESM(require("process"), 1);
|
|
9739
|
-
async function rotatePlatformChatCredential(parsed, deps) {
|
|
9740
|
-
assertArgs(
|
|
9741
|
-
parsed,
|
|
9742
|
-
[
|
|
9743
|
-
"config",
|
|
9744
|
-
"context",
|
|
9745
|
-
"platform",
|
|
9746
|
-
"token",
|
|
9747
|
-
"email",
|
|
9748
|
-
"open",
|
|
9749
|
-
"json",
|
|
9750
|
-
"yes",
|
|
9751
|
-
"wrangler-config",
|
|
9752
|
-
"expected-version"
|
|
9753
|
-
],
|
|
9754
|
-
3
|
|
9755
|
-
);
|
|
9756
|
-
if (parsed.options.yes !== true) {
|
|
9757
|
-
throw new Error(
|
|
9758
|
-
"platform chat-credentials rotate changes the production chat secret; pass --yes"
|
|
9759
|
-
);
|
|
9760
|
-
}
|
|
9761
|
-
const context = await resolveOperatorContext(parsed, {
|
|
9762
|
-
allowMissingConfig: true
|
|
9763
|
-
});
|
|
9764
|
-
const platform = context.platform.value;
|
|
9765
|
-
const doFetch = deps.fetch ?? fetch;
|
|
9766
|
-
const out = deps.stdout ?? console;
|
|
9767
|
-
const run = deps.runner ?? defaultRunner;
|
|
9768
|
-
const cwd = import_node_process10.default.cwd();
|
|
9769
|
-
const wranglerConfig = stringOpt(parsed.options["wrangler-config"]) ?? "packages/chat-agent/wrangler.jsonc";
|
|
9770
|
-
if (!await wranglerLoggedIn(run, cwd)) {
|
|
9771
|
-
throw new Error(
|
|
9772
|
-
'Wrangler is not authenticated; run "npx wrangler login" and retry'
|
|
9773
|
-
);
|
|
9774
|
-
}
|
|
9775
|
-
const priorHealth = await doFetch(`${platform}/health/services/chat`);
|
|
9776
|
-
const priorVersion = priorHealth.headers.get("x-odla-worker-version-id");
|
|
9777
|
-
await priorHealth.body?.cancel().catch(() => {
|
|
9778
|
-
});
|
|
9779
|
-
if (!priorVersion) {
|
|
9780
|
-
throw new Error(
|
|
9781
|
-
"chat health did not identify its current Worker version; refusing to rotate"
|
|
9782
|
-
);
|
|
9783
|
-
}
|
|
9784
|
-
const expectedVersion = stringOpt(parsed.options["expected-version"]);
|
|
9785
|
-
if (expectedVersion && priorVersion !== expectedVersion) {
|
|
9786
|
-
throw new Error(
|
|
9787
|
-
`chat health answered from version ${priorVersion}; expected ${expectedVersion}`
|
|
9788
|
-
);
|
|
9789
|
-
}
|
|
9790
|
-
const token = await resolveAdminPlatformToken({
|
|
9791
|
-
platform,
|
|
9792
|
-
scope: "platform:chat:credential:write",
|
|
9793
|
-
token: stringOpt(parsed.options.token),
|
|
9794
|
-
tokenFile: context.credentials.scopedTokenFile,
|
|
9795
|
-
email: stringOpt(parsed.options.email),
|
|
9796
|
-
open: parsed.options.open === false ? false : parsed.options.open === true ? true : void 0,
|
|
9797
|
-
fetch: doFetch,
|
|
9798
|
-
stdout: out,
|
|
9799
|
-
openApprovalUrl: deps.openUrl,
|
|
9800
|
-
label: "odla CLI (rotate built-in Discussion responder)"
|
|
9801
|
-
});
|
|
9802
|
-
const mintedResponse = await doFetch(
|
|
9803
|
-
`${platform}/registry/platform/chat-credentials/rotate`,
|
|
9804
|
-
{
|
|
9805
|
-
method: "POST",
|
|
9806
|
-
headers: { authorization: `Bearer ${token}` }
|
|
9807
|
-
}
|
|
9808
|
-
);
|
|
9809
|
-
const minted = await mintedResponse.json().catch(() => null);
|
|
9810
|
-
if (!mintedResponse.ok) {
|
|
9811
|
-
throw new Error(
|
|
9812
|
-
`mint Discussion credential failed (HTTP ${mintedResponse.status}): ${apiMessage(minted)}`
|
|
9813
|
-
);
|
|
9814
|
-
}
|
|
9815
|
-
if (!isPlatformChatCredential(minted)) {
|
|
9816
|
-
throw new Error(
|
|
9817
|
-
"platform returned an invalid odla.platform-chat-credential/v1 envelope"
|
|
9818
|
-
);
|
|
9819
|
-
}
|
|
9820
|
-
const put = await wranglerPutSecret(run, {
|
|
9821
|
-
name: "ODLA_BOT_TOKENS",
|
|
9822
|
-
value: JSON.stringify({
|
|
9823
|
-
[minted.appId]: { [minted.principalId]: minted.key }
|
|
9824
|
-
}),
|
|
9825
|
-
configPath: wranglerConfig,
|
|
9826
|
-
cwd
|
|
9827
|
-
});
|
|
9828
|
-
if (put.code !== 0) {
|
|
9829
|
-
throw new Error(
|
|
9830
|
-
"Wrangler could not replace ODLA_BOT_TOKENS; the new scoped key was not activated"
|
|
9831
|
-
);
|
|
9832
|
-
}
|
|
9833
|
-
const version = await waitForRotatedChatHealth({
|
|
9834
|
-
fetch: doFetch,
|
|
9835
|
-
platform,
|
|
9836
|
-
priorVersion,
|
|
9837
|
-
wait: deps.pollWait
|
|
9838
|
-
});
|
|
9839
|
-
const result = {
|
|
9840
|
-
schemaVersion: "odla.platform-chat-credential-rotation/v1",
|
|
9841
|
-
appId: minted.appId,
|
|
9842
|
-
appIncarnation: minted.appIncarnation,
|
|
9843
|
-
principalId: minted.principalId,
|
|
9844
|
-
health: { ok: true, service: "odla-chat-agent", version }
|
|
9845
|
-
};
|
|
9846
|
-
if (parsed.options.json === true) {
|
|
9847
|
-
out.log(JSON.stringify(result, null, 2));
|
|
9848
|
-
} else {
|
|
9849
|
-
out.log(
|
|
9850
|
-
`rotated ${result.appId} ${result.principalId} ${result.health.version}`
|
|
9851
|
-
);
|
|
9852
|
-
}
|
|
9853
|
-
}
|
|
9854
|
-
async function waitForRotatedChatHealth(opts) {
|
|
9855
|
-
const wait2 = opts.wait ?? ((milliseconds) => new Promise((resolve12) => setTimeout(resolve12, milliseconds)));
|
|
9856
|
-
let lastStatus = 0;
|
|
9857
|
-
let lastVersion = null;
|
|
9858
|
-
let lastError = "private_service_unready";
|
|
9859
|
-
for (let attempt = 0; attempt < 60; attempt++) {
|
|
9860
|
-
const response2 = await opts.fetch(
|
|
9861
|
-
`${opts.platform}/health/services/chat`
|
|
9862
|
-
);
|
|
9863
|
-
const body = await response2.json().catch(() => null);
|
|
9864
|
-
const version = response2.headers.get("x-odla-worker-version-id");
|
|
9865
|
-
if (response2.ok && record7(body) && body.ok === true && body.service === "odla-chat-agent" && version && version !== opts.priorVersion) {
|
|
9866
|
-
return version;
|
|
9867
|
-
}
|
|
9868
|
-
lastStatus = response2.status;
|
|
9869
|
-
lastVersion = version;
|
|
9870
|
-
lastError = record7(body) && typeof body.error === "string" ? body.error : "private_service_unready";
|
|
9871
|
-
if (attempt < 59) await wait2(5e3);
|
|
9872
|
-
}
|
|
9873
|
-
throw new Error(
|
|
9874
|
-
`chat health did not converge on the rotated Worker deployment (HTTP ${lastStatus}, version ${lastVersion ?? "unknown"}, ${lastError})`
|
|
9875
|
-
);
|
|
9876
|
-
}
|
|
9877
|
-
function isPlatformChatCredential(value2) {
|
|
9878
|
-
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_");
|
|
9879
|
-
}
|
|
9880
|
-
function apiMessage(value2) {
|
|
9881
|
-
if (!record7(value2)) return "request failed";
|
|
9882
|
-
const error = record7(value2.error) ? value2.error : value2;
|
|
9883
|
-
return typeof error.message === "string" ? error.message : typeof error.code === "string" ? error.code : "request failed";
|
|
9884
|
-
}
|
|
9885
|
-
function record7(value2) {
|
|
9886
|
-
return !!value2 && typeof value2 === "object" && !Array.isArray(value2);
|
|
9887
|
-
}
|
|
9888
|
-
|
|
9889
9735
|
// src/platform-command.ts
|
|
9890
9736
|
async function platformCommand(parsed, deps = {}) {
|
|
9891
9737
|
const action2 = parsed.positionals[1];
|
|
9892
9738
|
if (action2 === "status") {
|
|
9893
9739
|
return platformStatus(parsed, deps);
|
|
9894
9740
|
}
|
|
9895
|
-
if (action2 === "chat-credentials" && parsed.positionals[2] === "rotate") {
|
|
9896
|
-
return rotatePlatformChatCredential(parsed, deps);
|
|
9897
|
-
}
|
|
9898
9741
|
throw new Error(
|
|
9899
9742
|
`unknown platform action "${[
|
|
9900
9743
|
action2,
|
|
@@ -9932,7 +9775,7 @@ async function platformStatus(parsed, deps) {
|
|
|
9932
9775
|
const body = await response2.json().catch(() => null);
|
|
9933
9776
|
if (!response2.ok) {
|
|
9934
9777
|
throw new Error(
|
|
9935
|
-
`read platform status failed (HTTP ${response2.status}): ${
|
|
9778
|
+
`read platform status failed (HTTP ${response2.status}): ${apiMessage(body)}`
|
|
9936
9779
|
);
|
|
9937
9780
|
}
|
|
9938
9781
|
if (!isPlatformStatus(body)) {
|
|
@@ -9945,17 +9788,17 @@ async function platformStatus(parsed, deps) {
|
|
|
9945
9788
|
}
|
|
9946
9789
|
}
|
|
9947
9790
|
function isPlatformStatus(value2) {
|
|
9948
|
-
if (!
|
|
9949
|
-
if (!
|
|
9950
|
-
if (!
|
|
9791
|
+
if (!record7(value2) || value2.schemaVersion !== "odla.platform-status/v1") return false;
|
|
9792
|
+
if (!record7(value2.verdict) || !Array.isArray(value2.verdict.reasons)) return false;
|
|
9793
|
+
if (!record7(value2.catalog) || !record7(value2.summary)) return false;
|
|
9951
9794
|
return Array.isArray(value2.services) && Array.isArray(value2.nextActions);
|
|
9952
9795
|
}
|
|
9953
|
-
function
|
|
9954
|
-
if (!
|
|
9955
|
-
const error =
|
|
9796
|
+
function apiMessage(value2) {
|
|
9797
|
+
if (!record7(value2)) return "request failed";
|
|
9798
|
+
const error = record7(value2.error) ? value2.error : value2;
|
|
9956
9799
|
return typeof error.message === "string" ? error.message : typeof error.code === "string" ? error.code : "request failed";
|
|
9957
9800
|
}
|
|
9958
|
-
function
|
|
9801
|
+
function record7(value2) {
|
|
9959
9802
|
return !!value2 && typeof value2 === "object" && !Array.isArray(value2);
|
|
9960
9803
|
}
|
|
9961
9804
|
|
|
@@ -9996,7 +9839,7 @@ function statusVerdict(reads) {
|
|
|
9996
9839
|
severity: "degraded"
|
|
9997
9840
|
});
|
|
9998
9841
|
}
|
|
9999
|
-
const performance =
|
|
9842
|
+
const performance = record8(reads.liveSync.body.performance) ? reads.liveSync.body.performance : null;
|
|
10000
9843
|
if (performance?.status === "unavailable") {
|
|
10001
9844
|
reasons.push({
|
|
10002
9845
|
source: "liveSync",
|
|
@@ -10077,7 +9920,7 @@ function statusVerdict(reads) {
|
|
|
10077
9920
|
reasons
|
|
10078
9921
|
};
|
|
10079
9922
|
}
|
|
10080
|
-
function
|
|
9923
|
+
function record8(value2) {
|
|
10081
9924
|
return Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
|
|
10082
9925
|
}
|
|
10083
9926
|
function numeric2(value2) {
|
|
@@ -10105,7 +9948,7 @@ function printO11yStatus(status, out) {
|
|
|
10105
9948
|
out.log(
|
|
10106
9949
|
`o11y status ${status.scope.appId}/${status.scope.env} (${status.scope.minutes}m)`
|
|
10107
9950
|
);
|
|
10108
|
-
const routes = Array.isArray(status.application.body.routes) ? status.application.body.routes.filter(
|
|
9951
|
+
const routes = Array.isArray(status.application.body.routes) ? status.application.body.routes.filter(record9) : [];
|
|
10109
9952
|
const requests = routes.reduce(
|
|
10110
9953
|
(total, row) => total + numeric3(row.requests),
|
|
10111
9954
|
0
|
|
@@ -10117,39 +9960,39 @@ function printO11yStatus(status, out) {
|
|
|
10117
9960
|
out.log(
|
|
10118
9961
|
`application ${status.application.httpStatus} ${requests} requests ${errors} errors`
|
|
10119
9962
|
);
|
|
10120
|
-
const versions = Array.isArray(status.applicationVersions.body.rows) ? status.applicationVersions.body.rows.filter(
|
|
9963
|
+
const versions = Array.isArray(status.applicationVersions.body.rows) ? status.applicationVersions.body.rows.filter(record9) : [];
|
|
10121
9964
|
out.log(
|
|
10122
9965
|
`application-versions ${status.applicationVersions.httpStatus} ${versions.length ? versions.slice(0, 5).map(
|
|
10123
9966
|
(row) => `${String(row.value || "(unattributed)")}:${numeric3(row.requests)}`
|
|
10124
9967
|
).join(", ") : "none observed"}`
|
|
10125
9968
|
);
|
|
10126
9969
|
out.log(liveSyncLine(status.liveSync));
|
|
10127
|
-
const canaryDurations =
|
|
9970
|
+
const canaryDurations = record9(status.canary.body.durationsMs) ? status.canary.body.durationsMs : {};
|
|
10128
9971
|
out.log(
|
|
10129
9972
|
`canary ${status.canary.httpStatus} ${String(status.canary.body.status ?? status.canary.body.error ?? "unavailable")} ${optionalNumeric(canaryDurations.publishToVisibleMs)} publish-to-visible`
|
|
10130
9973
|
);
|
|
10131
|
-
const collectorIngest =
|
|
10132
|
-
const collectorStorage =
|
|
9974
|
+
const collectorIngest = record9(status.collector.body.ingest) ? status.collector.body.ingest : {};
|
|
9975
|
+
const collectorStorage = record9(collectorIngest.storage) ? collectorIngest.storage : {};
|
|
10133
9976
|
out.log(
|
|
10134
9977
|
`collector ${status.collector.httpStatus} ${String(status.collector.body.status ?? status.collector.body.error ?? "unavailable")} ${numeric3(collectorStorage.affectedPoints)} affected points`
|
|
10135
9978
|
);
|
|
10136
|
-
const providerMetrics =
|
|
10137
|
-
const providerCapacity =
|
|
10138
|
-
const workerMemory =
|
|
9979
|
+
const providerMetrics = record9(status.provider.body.metrics) ? status.provider.body.metrics : {};
|
|
9980
|
+
const providerCapacity = record9(status.provider.body.capacity) ? status.provider.body.capacity : {};
|
|
9981
|
+
const workerMemory = record9(providerCapacity.memory) ? providerCapacity.memory : {};
|
|
10139
9982
|
out.log(
|
|
10140
9983
|
`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`
|
|
10141
9984
|
);
|
|
10142
9985
|
for (const line of providerCapacityLines(status.providerCapacity)) {
|
|
10143
9986
|
out.log(line);
|
|
10144
9987
|
}
|
|
10145
|
-
const coverage =
|
|
10146
|
-
const coverageCounts =
|
|
10147
|
-
const coverageBudget =
|
|
9988
|
+
const coverage = record9(status.providerReconciliation.body.comparison) ? status.providerReconciliation.body.comparison : {};
|
|
9989
|
+
const coverageCounts = record9(status.providerReconciliation.body.counts) ? status.providerReconciliation.body.counts : {};
|
|
9990
|
+
const coverageBudget = record9(status.providerReconciliation.body.budget) ? status.providerReconciliation.body.budget : {};
|
|
10148
9991
|
out.log(
|
|
10149
9992
|
`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`
|
|
10150
9993
|
);
|
|
10151
9994
|
const providerPoints = Array.isArray(status.providerHistory.body.points) ? status.providerHistory.body.points.length : 0;
|
|
10152
|
-
const providerFreshness =
|
|
9995
|
+
const providerFreshness = record9(status.providerHistory.body.freshness) ? status.providerHistory.body.freshness : {};
|
|
10153
9996
|
out.log(
|
|
10154
9997
|
`cloudflare-history ${status.providerHistory.httpStatus} ${String(status.providerHistory.body.status ?? status.providerHistory.body.error ?? "unavailable")} ${providerPoints} snapshots ${optionalAge(providerFreshness.ageMs)} old`
|
|
10155
9998
|
);
|
|
@@ -10158,17 +10001,17 @@ function printO11yStatus(status, out) {
|
|
|
10158
10001
|
);
|
|
10159
10002
|
}
|
|
10160
10003
|
function providerCapacityLines(read3) {
|
|
10161
|
-
const resources =
|
|
10162
|
-
const durableObjects =
|
|
10163
|
-
const periodic =
|
|
10164
|
-
const storage =
|
|
10165
|
-
const d1 =
|
|
10166
|
-
const d1Activity =
|
|
10167
|
-
const d1Storage =
|
|
10168
|
-
const d1Latency =
|
|
10169
|
-
const r2 =
|
|
10170
|
-
const r2Operations =
|
|
10171
|
-
const r2Storage =
|
|
10004
|
+
const resources = record9(read3.body.resources) ? read3.body.resources : {};
|
|
10005
|
+
const durableObjects = record9(resources.durableObjects) ? resources.durableObjects : {};
|
|
10006
|
+
const periodic = record9(durableObjects.periodic) ? durableObjects.periodic : {};
|
|
10007
|
+
const storage = record9(durableObjects.sqliteStorage) ? durableObjects.sqliteStorage : {};
|
|
10008
|
+
const d1 = record9(resources.d1) ? resources.d1 : {};
|
|
10009
|
+
const d1Activity = record9(d1.activity) ? d1.activity : {};
|
|
10010
|
+
const d1Storage = record9(d1.storage) ? d1.storage : {};
|
|
10011
|
+
const d1Latency = record9(d1Activity.latency) ? d1Activity.latency : {};
|
|
10012
|
+
const r2 = record9(resources.r2) ? resources.r2 : {};
|
|
10013
|
+
const r2Operations = record9(r2.operations) ? r2.operations : {};
|
|
10014
|
+
const r2Storage = record9(r2.storage) ? r2.storage : {};
|
|
10172
10015
|
const status = String(
|
|
10173
10016
|
read3.body.status ?? read3.body.error ?? "unavailable"
|
|
10174
10017
|
);
|
|
@@ -10179,11 +10022,11 @@ function providerCapacityLines(read3) {
|
|
|
10179
10022
|
];
|
|
10180
10023
|
}
|
|
10181
10024
|
function liveSyncLine(read3) {
|
|
10182
|
-
const performance =
|
|
10183
|
-
const commitToSend =
|
|
10025
|
+
const performance = record9(read3.body.performance) ? read3.body.performance : {};
|
|
10026
|
+
const commitToSend = record9(performance.commitToSend) ? performance.commitToSend : {};
|
|
10184
10027
|
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`;
|
|
10185
10028
|
}
|
|
10186
|
-
function
|
|
10029
|
+
function record9(value2) {
|
|
10187
10030
|
return Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
|
|
10188
10031
|
}
|
|
10189
10032
|
function numeric3(value2) {
|
|
@@ -10368,7 +10211,7 @@ async function read2(url, headers, doFetch) {
|
|
|
10368
10211
|
// src/provision.ts
|
|
10369
10212
|
var import_apps12 = require("@odla-ai/apps");
|
|
10370
10213
|
var import_ai3 = require("@odla-ai/ai");
|
|
10371
|
-
var
|
|
10214
|
+
var import_node_process10 = __toESM(require("process"), 1);
|
|
10372
10215
|
|
|
10373
10216
|
// src/integration-provision.ts
|
|
10374
10217
|
var import_db3 = require("@odla-ai/db");
|
|
@@ -10675,7 +10518,7 @@ ${env}: credentials are already saved; retry "odla-ai secrets push --env ${env}$
|
|
|
10675
10518
|
await provisionIntegrationSeeds(doFetch, cfg.dbEndpoint, tenantId, dbKey, database.integrations, env, out);
|
|
10676
10519
|
}
|
|
10677
10520
|
if (cfg.services.includes("ai") && cfg.ai?.provider && cfg.ai.keyEnv) {
|
|
10678
|
-
const key =
|
|
10521
|
+
const key = import_node_process10.default.env[cfg.ai.keyEnv];
|
|
10679
10522
|
if (key) {
|
|
10680
10523
|
const secretName = cfg.ai.secretName ?? defaultSecretName(cfg.ai.provider);
|
|
10681
10524
|
await (0, import_ai3.putSecret)({ endpoint: cfg.dbEndpoint, token, fetch: doFetch }, tenantId, secretName, key);
|
|
@@ -10717,7 +10560,7 @@ ${env}: credentials are already saved; retry "odla-ai secrets push --env ${env}$
|
|
|
10717
10560
|
|
|
10718
10561
|
// src/record.ts
|
|
10719
10562
|
var import_node_fs16 = require("fs");
|
|
10720
|
-
var
|
|
10563
|
+
var import_node_process11 = __toESM(require("process"), 1);
|
|
10721
10564
|
|
|
10722
10565
|
// src/surface.ts
|
|
10723
10566
|
var PM_ACTIONS = {
|
|
@@ -10785,8 +10628,7 @@ var COMMAND_SURFACE = {
|
|
|
10785
10628
|
o11y: { status: {} },
|
|
10786
10629
|
operations: { get: {}, wait: {} },
|
|
10787
10630
|
platform: {
|
|
10788
|
-
status: {}
|
|
10789
|
-
"chat-credentials": { rotate: {} }
|
|
10631
|
+
status: {}
|
|
10790
10632
|
},
|
|
10791
10633
|
pm: {
|
|
10792
10634
|
...PM_ENTITIES,
|
|
@@ -10875,7 +10717,7 @@ function surfacePaths(node = COMMAND_SURFACE, prefix = []) {
|
|
|
10875
10717
|
|
|
10876
10718
|
// src/record.ts
|
|
10877
10719
|
function recordInvocation(parsed) {
|
|
10878
|
-
const file =
|
|
10720
|
+
const file = import_node_process11.default.env.ODLA_CLI_RECORD;
|
|
10879
10721
|
if (!file) return;
|
|
10880
10722
|
try {
|
|
10881
10723
|
const entry = {
|
|
@@ -11547,9 +11389,9 @@ var import_node_child_process8 = require("child_process");
|
|
|
11547
11389
|
var import_node_fs20 = require("fs");
|
|
11548
11390
|
var import_node_os5 = require("os");
|
|
11549
11391
|
var import_node_path17 = require("path");
|
|
11550
|
-
var
|
|
11392
|
+
var import_node_process12 = __toESM(require("process"), 1);
|
|
11551
11393
|
var EDITOR_ENV = ["ODLA_EDITOR", "VISUAL", "EDITOR"];
|
|
11552
|
-
function resolveEditor(env =
|
|
11394
|
+
function resolveEditor(env = import_node_process12.default.env) {
|
|
11553
11395
|
for (const name of EDITOR_ENV) {
|
|
11554
11396
|
const value2 = env[name];
|
|
11555
11397
|
if (value2 && value2.trim()) return value2.trim();
|
|
@@ -11563,8 +11405,8 @@ function defaultRun(command, path) {
|
|
|
11563
11405
|
return result.status ?? 0;
|
|
11564
11406
|
}
|
|
11565
11407
|
function editText(initial, slug, deps = {}) {
|
|
11566
|
-
const env = deps.env ??
|
|
11567
|
-
const interactive = deps.interactive ?? (() => Boolean(
|
|
11408
|
+
const env = deps.env ?? import_node_process12.default.env;
|
|
11409
|
+
const interactive = deps.interactive ?? (() => Boolean(import_node_process12.default.stdin.isTTY));
|
|
11568
11410
|
const editor = resolveEditor(env);
|
|
11569
11411
|
if (!editor)
|
|
11570
11412
|
throw new Error(
|