@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/bin.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  exitCodeFor,
4
4
  redactSecrets,
5
5
  runCli
6
- } from "./chunk-335ODYSF.js";
6
+ } from "./chunk-FYSV7POZ.js";
7
7
 
8
8
  // src/bin.ts
9
9
  runCli().catch((err) => {
@@ -8914,6 +8914,7 @@ function statusVerdict(reads) {
8914
8914
  sourceHttp(reasons, "canary", reads.canary);
8915
8915
  sourceHttp(reasons, "collector", reads.collector);
8916
8916
  sourceHttp(reasons, "provider", reads.provider);
8917
+ sourceHttp(reasons, "provider", reads.providerHistory, "provider_history_");
8917
8918
  const liveStatus = String(reads.liveSync.body.status ?? "");
8918
8919
  if (liveStatus === "partial") {
8919
8920
  reasons.push({
@@ -8985,6 +8986,14 @@ function statusVerdict(reads) {
8985
8986
  severity: "degraded"
8986
8987
  });
8987
8988
  }
8989
+ const providerHistoryStatus = String(reads.providerHistory.body.status ?? "");
8990
+ if (providerHistoryStatus && providerHistoryStatus !== "observed" && providerHistoryStatus !== "no_data") {
8991
+ reasons.push({
8992
+ source: "provider",
8993
+ code: `provider_history_${providerHistoryStatus}`,
8994
+ severity: "degraded"
8995
+ });
8996
+ }
8988
8997
  return {
8989
8998
  status: reasons.some((reason) => reason.severity === "unhealthy") ? "unhealthy" : reasons.length > 0 ? "degraded" : "healthy",
8990
8999
  reasons
@@ -9004,11 +9013,11 @@ function collectorReason(read3, fallback) {
9004
9013
  );
9005
9014
  return typeof first?.code === "string" && first.code ? first.code : fallback;
9006
9015
  }
9007
- function sourceHttp(reasons, source, read3) {
9016
+ function sourceHttp(reasons, source, read3, prefix = "") {
9008
9017
  if (read3.httpStatus >= 200 && read3.httpStatus < 300) return;
9009
9018
  reasons.push({
9010
9019
  source,
9011
- code: `http_${read3.httpStatus}`,
9020
+ code: `${prefix}http_${read3.httpStatus}`,
9012
9021
  severity: read3.httpStatus >= 500 && read3.httpStatus !== 501 ? "unhealthy" : "degraded"
9013
9022
  });
9014
9023
  }
@@ -9050,7 +9059,7 @@ async function o11yCommand(parsed, deps = {}) {
9050
9059
  const base = `${cfg.platformUrl}/o11y/${encodeURIComponent(appId)}`;
9051
9060
  const query = new URLSearchParams({ env, minutes: String(minutes) });
9052
9061
  const headers = { authorization: `Bearer ${token}` };
9053
- const [application, liveSync, canary, collector, provider] = await Promise.all([
9062
+ const [application, liveSync, canary, collector, provider, providerHistory] = await Promise.all([
9054
9063
  read2(`${base}/metrics/red?${query}`, headers, doFetch),
9055
9064
  read2(
9056
9065
  `${base}/live-sync/health?${query}`,
@@ -9063,17 +9072,19 @@ async function o11yCommand(parsed, deps = {}) {
9063
9072
  doFetch
9064
9073
  ),
9065
9074
  read2(`${base}/self-health?${query}`, headers, doFetch),
9066
- read2(`${base}/provider/cloudflare?${query}`, headers, doFetch)
9075
+ read2(`${base}/provider/cloudflare?${query}`, headers, doFetch),
9076
+ read2(`${base}/provider/cloudflare/history?${query}`, headers, doFetch)
9067
9077
  ]);
9068
9078
  const verdict = statusVerdict({
9069
9079
  application,
9070
9080
  liveSync,
9071
9081
  canary,
9072
9082
  collector,
9073
- provider
9083
+ provider,
9084
+ providerHistory
9074
9085
  });
9075
9086
  const status = {
9076
- schemaVersion: 4,
9087
+ schemaVersion: 5,
9077
9088
  scope: { appId, env, minutes },
9078
9089
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
9079
9090
  verdict,
@@ -9081,7 +9092,8 @@ async function o11yCommand(parsed, deps = {}) {
9081
9092
  liveSync,
9082
9093
  canary,
9083
9094
  collector,
9084
- provider
9095
+ provider,
9096
+ providerHistory
9085
9097
  };
9086
9098
  if (parsed.options.json === true) {
9087
9099
  out.log(JSON.stringify(status, null, 2));
@@ -9141,6 +9153,11 @@ function printStatus2(status, out) {
9141
9153
  out.log(
9142
9154
  `cloudflare ${status.provider.httpStatus} ${String(status.provider.body.status ?? status.provider.body.error ?? "unavailable")} ${numeric3(providerMetrics.requests)} invocations ${numeric3(providerMetrics.errors)} runtime errors`
9143
9155
  );
9156
+ const providerPoints = Array.isArray(status.providerHistory.body.points) ? status.providerHistory.body.points.length : 0;
9157
+ const providerFreshness = record6(status.providerHistory.body.freshness) ? status.providerHistory.body.freshness : {};
9158
+ out.log(
9159
+ `cloudflare-history ${status.providerHistory.httpStatus} ${String(status.providerHistory.body.status ?? status.providerHistory.body.error ?? "unavailable")} ${providerPoints} snapshots ${optionalAge(providerFreshness.ageMs)} old`
9160
+ );
9144
9161
  out.log(
9145
9162
  `verdict ${status.verdict.status} ${status.verdict.reasons.map((reason) => `${reason.source}:${reason.code}`).join(", ") || "all required signals healthy"}`
9146
9163
  );
@@ -9159,6 +9176,10 @@ function numeric3(value) {
9159
9176
  function optionalNumeric(value) {
9160
9177
  return typeof value === "number" && Number.isFinite(value) ? `${value} ms` : "\u2014";
9161
9178
  }
9179
+ function optionalAge(value) {
9180
+ if (typeof value !== "number" || !Number.isFinite(value)) return "unknown";
9181
+ return `${Math.max(0, Math.round(value / 1e3))}s`;
9182
+ }
9162
9183
 
9163
9184
  // src/record.ts
9164
9185
  import { appendFileSync } from "fs";
@@ -10750,4 +10771,4 @@ export {
10750
10771
  exitCodeFor,
10751
10772
  runCli
10752
10773
  };
10753
- //# sourceMappingURL=chunk-335ODYSF.js.map
10774
+ //# sourceMappingURL=chunk-FYSV7POZ.js.map