@odla-ai/cli 0.25.10 → 0.25.11

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/index.cjs CHANGED
@@ -8175,6 +8175,7 @@ function statusVerdict(reads) {
8175
8175
  sourceHttp(reasons, "canary", reads.canary);
8176
8176
  sourceHttp(reasons, "collector", reads.collector);
8177
8177
  sourceHttp(reasons, "provider", reads.provider);
8178
+ sourceHttp(reasons, "provider", reads.providerHistory, "provider_history_");
8178
8179
  const liveStatus = String(reads.liveSync.body.status ?? "");
8179
8180
  if (liveStatus === "partial") {
8180
8181
  reasons.push({
@@ -8246,6 +8247,14 @@ function statusVerdict(reads) {
8246
8247
  severity: "degraded"
8247
8248
  });
8248
8249
  }
8250
+ const providerHistoryStatus = String(reads.providerHistory.body.status ?? "");
8251
+ if (providerHistoryStatus && providerHistoryStatus !== "observed" && providerHistoryStatus !== "no_data") {
8252
+ reasons.push({
8253
+ source: "provider",
8254
+ code: `provider_history_${providerHistoryStatus}`,
8255
+ severity: "degraded"
8256
+ });
8257
+ }
8249
8258
  return {
8250
8259
  status: reasons.some((reason) => reason.severity === "unhealthy") ? "unhealthy" : reasons.length > 0 ? "degraded" : "healthy",
8251
8260
  reasons
@@ -8265,11 +8274,11 @@ function collectorReason(read3, fallback) {
8265
8274
  );
8266
8275
  return typeof first?.code === "string" && first.code ? first.code : fallback;
8267
8276
  }
8268
- function sourceHttp(reasons, source, read3) {
8277
+ function sourceHttp(reasons, source, read3, prefix = "") {
8269
8278
  if (read3.httpStatus >= 200 && read3.httpStatus < 300) return;
8270
8279
  reasons.push({
8271
8280
  source,
8272
- code: `http_${read3.httpStatus}`,
8281
+ code: `${prefix}http_${read3.httpStatus}`,
8273
8282
  severity: read3.httpStatus >= 500 && read3.httpStatus !== 501 ? "unhealthy" : "degraded"
8274
8283
  });
8275
8284
  }
@@ -8311,7 +8320,7 @@ async function o11yCommand(parsed, deps = {}) {
8311
8320
  const base = `${cfg.platformUrl}/o11y/${encodeURIComponent(appId)}`;
8312
8321
  const query = new URLSearchParams({ env, minutes: String(minutes) });
8313
8322
  const headers = { authorization: `Bearer ${token}` };
8314
- const [application, liveSync, canary, collector, provider] = await Promise.all([
8323
+ const [application, liveSync, canary, collector, provider, providerHistory] = await Promise.all([
8315
8324
  read2(`${base}/metrics/red?${query}`, headers, doFetch),
8316
8325
  read2(
8317
8326
  `${base}/live-sync/health?${query}`,
@@ -8324,17 +8333,19 @@ async function o11yCommand(parsed, deps = {}) {
8324
8333
  doFetch
8325
8334
  ),
8326
8335
  read2(`${base}/self-health?${query}`, headers, doFetch),
8327
- read2(`${base}/provider/cloudflare?${query}`, headers, doFetch)
8336
+ read2(`${base}/provider/cloudflare?${query}`, headers, doFetch),
8337
+ read2(`${base}/provider/cloudflare/history?${query}`, headers, doFetch)
8328
8338
  ]);
8329
8339
  const verdict = statusVerdict({
8330
8340
  application,
8331
8341
  liveSync,
8332
8342
  canary,
8333
8343
  collector,
8334
- provider
8344
+ provider,
8345
+ providerHistory
8335
8346
  });
8336
8347
  const status = {
8337
- schemaVersion: 4,
8348
+ schemaVersion: 5,
8338
8349
  scope: { appId, env, minutes },
8339
8350
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
8340
8351
  verdict,
@@ -8342,7 +8353,8 @@ async function o11yCommand(parsed, deps = {}) {
8342
8353
  liveSync,
8343
8354
  canary,
8344
8355
  collector,
8345
- provider
8356
+ provider,
8357
+ providerHistory
8346
8358
  };
8347
8359
  if (parsed.options.json === true) {
8348
8360
  out.log(JSON.stringify(status, null, 2));
@@ -8402,6 +8414,11 @@ function printStatus2(status, out) {
8402
8414
  out.log(
8403
8415
  `cloudflare ${status.provider.httpStatus} ${String(status.provider.body.status ?? status.provider.body.error ?? "unavailable")} ${numeric3(providerMetrics.requests)} invocations ${numeric3(providerMetrics.errors)} runtime errors`
8404
8416
  );
8417
+ const providerPoints = Array.isArray(status.providerHistory.body.points) ? status.providerHistory.body.points.length : 0;
8418
+ const providerFreshness = record6(status.providerHistory.body.freshness) ? status.providerHistory.body.freshness : {};
8419
+ out.log(
8420
+ `cloudflare-history ${status.providerHistory.httpStatus} ${String(status.providerHistory.body.status ?? status.providerHistory.body.error ?? "unavailable")} ${providerPoints} snapshots ${optionalAge(providerFreshness.ageMs)} old`
8421
+ );
8405
8422
  out.log(
8406
8423
  `verdict ${status.verdict.status} ${status.verdict.reasons.map((reason) => `${reason.source}:${reason.code}`).join(", ") || "all required signals healthy"}`
8407
8424
  );
@@ -8420,6 +8437,10 @@ function numeric3(value) {
8420
8437
  function optionalNumeric(value) {
8421
8438
  return typeof value === "number" && Number.isFinite(value) ? `${value} ms` : "\u2014";
8422
8439
  }
8440
+ function optionalAge(value) {
8441
+ if (typeof value !== "number" || !Number.isFinite(value)) return "unknown";
8442
+ return `${Math.max(0, Math.round(value / 1e3))}s`;
8443
+ }
8423
8444
 
8424
8445
  // src/provision.ts
8425
8446
  var import_apps5 = require("@odla-ai/apps");