feat: add factory status check
This commit is contained in:
parent
daead5e957
commit
4b19e7f518
|
|
@ -36,6 +36,7 @@ fable-agent plinius godmode "improve explanation quality"
|
||||||
| `demo` | Demo mode |
|
| `demo` | Demo mode |
|
||||||
| `learned` | Summaries of learned material |
|
| `learned` | Summaries of learned material |
|
||||||
| `familiar` | Note capture and health graph |
|
| `familiar` | Note capture and health graph |
|
||||||
|
| `factory` | Factory/VPS status and deployment guards |
|
||||||
| `pai-pi` | PI integration mode |
|
| `pai-pi` | PI integration mode |
|
||||||
| `daemon` | Long-running mode queue/monitor |
|
| `daemon` | Long-running mode queue/monitor |
|
||||||
| `fable5` | Upgraded execution stack |
|
| `fable5` | Upgraded execution stack |
|
||||||
|
|
@ -150,6 +151,10 @@ fable-agent plinius godmode "improve explanation quality"
|
||||||
- `learned`
|
- `learned`
|
||||||
- `-v, --verbose`
|
- `-v, --verbose`
|
||||||
|
|
||||||
|
### `factory`
|
||||||
|
|
||||||
|
- `factory check`
|
||||||
|
|
||||||
### `familiar`
|
### `familiar`
|
||||||
|
|
||||||
- `familiar capture <note>`
|
- `familiar capture <note>`
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { formatFactoryCheck } from "./factory-status.js";
|
||||||
|
|
||||||
|
describe("factory check formatting", () => {
|
||||||
|
it("prints live counts from response data", () => {
|
||||||
|
const out = formatFactoryCheck(
|
||||||
|
{ status: "ok", phase: 4, containers: 24, agents: 6, infra: 14, monitoring: 5, skills: 63 },
|
||||||
|
{ status: "ok", service: "deploy-webhook", phase: 4 },
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(out).toContain("Containers: 24");
|
||||||
|
expect(out).toContain("Deploy webhook: ok (deploy-webhook)");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
export interface FactoryStatus {
|
||||||
|
status?: string;
|
||||||
|
phase?: number;
|
||||||
|
containers?: number;
|
||||||
|
agents?: number;
|
||||||
|
infra?: number;
|
||||||
|
monitoring?: number;
|
||||||
|
skills?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeployHealth {
|
||||||
|
status?: string;
|
||||||
|
service?: string;
|
||||||
|
phase?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatFactoryCheck(factory: FactoryStatus, deploy: DeployHealth): string {
|
||||||
|
return [
|
||||||
|
"",
|
||||||
|
" Factory Check",
|
||||||
|
" ─────────────────────────────",
|
||||||
|
` Factory: ${factory.status ?? "unknown"}`,
|
||||||
|
` Phase: ${factory.phase ?? "unknown"}`,
|
||||||
|
` Containers: ${factory.containers ?? "unknown"}`,
|
||||||
|
` Agents: ${factory.agents ?? "unknown"}`,
|
||||||
|
` Infra: ${factory.infra ?? "unknown"}`,
|
||||||
|
` Monitoring: ${factory.monitoring ?? "unknown"}`,
|
||||||
|
` Skills: ${factory.skills ?? "unknown"}`,
|
||||||
|
` Deploy webhook: ${deploy.status ?? "unknown"}${deploy.service ? ` (${deploy.service})` : ""}`,
|
||||||
|
"",
|
||||||
|
].join("\n");
|
||||||
|
}
|
||||||
25
src/index.ts
25
src/index.ts
|
|
@ -1420,6 +1420,31 @@ daemon
|
||||||
console.log(` Queue: ${stats.queued} pending, ${stats.completed} completed\n`);
|
console.log(` Queue: ${stats.queued} pending, ${stats.completed} completed\n`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ── Factory ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const factory = program
|
||||||
|
.command("factory")
|
||||||
|
.description("Factory/VPS status and deployment guards");
|
||||||
|
|
||||||
|
factory
|
||||||
|
.command("check")
|
||||||
|
.description("Check factory status and deploy-webhook health")
|
||||||
|
.action(async () => {
|
||||||
|
const { formatFactoryCheck } = await import("./fable5/factory-status.js");
|
||||||
|
const getJson = async (url: string) => {
|
||||||
|
const res = await fetch(url);
|
||||||
|
if (!res.ok) throw new Error(url + " returned " + res.status);
|
||||||
|
return res.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
const [factoryStatus, deployHealth] = await Promise.all([
|
||||||
|
getJson("http://77.42.112.29:8099/factory-status"),
|
||||||
|
getJson("http://77.42.112.29:8098/health"),
|
||||||
|
]);
|
||||||
|
|
||||||
|
console.log(formatFactoryCheck(factoryStatus, deployHealth));
|
||||||
|
});
|
||||||
|
|
||||||
// ── Fable 5 ─────────────────────────────────────────────────
|
// ── Fable 5 ─────────────────────────────────────────────────
|
||||||
|
|
||||||
const fable = program
|
const fable = program
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue