niahere 0.5.9 → 0.5.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/package.json +1 -1
- package/src/agent/auth.ts +4 -1
- package/src/core/health.ts +5 -1
package/package.json
CHANGED
package/src/agent/auth.ts
CHANGED
|
@@ -144,7 +144,10 @@ export function codexAuthStatus(now: number = Date.now(), reader: AuthReader = d
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
const tokens = (auth.tokens ?? {}) as Record<string, unknown>;
|
|
147
|
-
|
|
147
|
+
// access_token is what authenticates. id_token is a short-lived OIDC identity
|
|
148
|
+
// token that lapses about an hour after every refresh, so reading it reports
|
|
149
|
+
// "lapsed" for any healthy install — a permanent false alarm.
|
|
150
|
+
const exp = jwtExpiry(typeof tokens.access_token === "string" ? tokens.access_token : undefined);
|
|
148
151
|
const mode = typeof auth.auth_mode === "string" ? auth.auth_mode : "oauth";
|
|
149
152
|
if (exp === undefined) return { ...base, state: "unknown", detail: `${mode} sign-in, no readable expiry` };
|
|
150
153
|
if (exp <= now) return { ...base, state: "stale", detail: `${mode} token lapsed ${ago(now - exp)} ago, renewable` };
|
package/src/core/health.ts
CHANGED
|
@@ -272,8 +272,12 @@ export async function runHealthChecks(): Promise<Check[]> {
|
|
|
272
272
|
// Replies written but never confirmed sent. 25 code paths write this column
|
|
273
273
|
// and, until now, nothing read it.
|
|
274
274
|
try {
|
|
275
|
+
// withDb, not a bare getSql(): the CLI must be able to exit afterwards, and
|
|
276
|
+
// a lazily-opened connection nobody closes keeps the event loop alive.
|
|
277
|
+
const { withDb } = await import("../db/with-db");
|
|
275
278
|
const { Message } = await import("../db/models");
|
|
276
|
-
|
|
279
|
+
const pending = await withDb(() => Message.listPendingDeliveries());
|
|
280
|
+
checks.push(auditDelivery(pending));
|
|
277
281
|
} catch (err) {
|
|
278
282
|
checks.push({ name: "delivery", status: "warn", detail: errMsg(err) });
|
|
279
283
|
}
|