@moor-sh/mcp 0.14.0 → 0.15.0
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/index.ts +73 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -598,6 +598,79 @@ server.registerTool(
|
|
|
598
598
|
},
|
|
599
599
|
);
|
|
600
600
|
|
|
601
|
+
server.registerTool(
|
|
602
|
+
"moor_update_status",
|
|
603
|
+
{
|
|
604
|
+
title: "Update status / preflight",
|
|
605
|
+
description:
|
|
606
|
+
"Report moor's current version + image digest, the latest available digest on GHCR, active in-flight work counts, DB backup recency, and a safe_to_update boolean. update_available is null (not false) when either the local repo_digest or the registry digest is unknown — never lies by comparing across identifier spaces. unsafe_reasons is a human-readable array; render inline rather than re-deriving from booleans. Read-only diagnostic — does NOT perform any update.",
|
|
607
|
+
},
|
|
608
|
+
async () => {
|
|
609
|
+
const res = await apiGet("/api/server/update-status");
|
|
610
|
+
if (!res.ok) throw new Error(`Failed: ${res.status} ${await res.text()}`);
|
|
611
|
+
const s = (await res.json()) as {
|
|
612
|
+
current: {
|
|
613
|
+
version: string;
|
|
614
|
+
image_id: string | null;
|
|
615
|
+
repo_digest: string | null;
|
|
616
|
+
started_at: string;
|
|
617
|
+
};
|
|
618
|
+
available: {
|
|
619
|
+
latest_tag: string;
|
|
620
|
+
latest_digest: string | null;
|
|
621
|
+
update_available: boolean | null;
|
|
622
|
+
registry_error: string | null;
|
|
623
|
+
};
|
|
624
|
+
active_work: {
|
|
625
|
+
builds_in_flight: number;
|
|
626
|
+
execs_in_flight: number;
|
|
627
|
+
crons_in_flight: number;
|
|
628
|
+
terminals_open: number;
|
|
629
|
+
};
|
|
630
|
+
db_backup: {
|
|
631
|
+
last_backup_at: string | null;
|
|
632
|
+
age_seconds: number | null;
|
|
633
|
+
location: string | null;
|
|
634
|
+
};
|
|
635
|
+
safe_to_update: boolean;
|
|
636
|
+
unsafe_reasons: string[];
|
|
637
|
+
recommended_command: string;
|
|
638
|
+
};
|
|
639
|
+
const lines: string[] = [];
|
|
640
|
+
lines.push(`moor ${s.current.version} (image_id: ${s.current.image_id ?? "unknown"})`);
|
|
641
|
+
lines.push(
|
|
642
|
+
`repo_digest: ${s.current.repo_digest ?? "(none — locally built or stale inspect)"}`,
|
|
643
|
+
);
|
|
644
|
+
|
|
645
|
+
if (s.available.update_available === true) {
|
|
646
|
+
lines.push(`update AVAILABLE → latest: ${s.available.latest_digest}`);
|
|
647
|
+
} else if (s.available.update_available === false) {
|
|
648
|
+
lines.push(`up to date (latest: ${s.available.latest_digest})`);
|
|
649
|
+
} else {
|
|
650
|
+
// null — explain WHICH side is unknown.
|
|
651
|
+
const why = s.available.registry_error
|
|
652
|
+
? `registry unreachable: ${s.available.registry_error}`
|
|
653
|
+
: s.current.repo_digest === null
|
|
654
|
+
? "no local repo_digest (built locally?)"
|
|
655
|
+
: "comparison unavailable";
|
|
656
|
+
lines.push(`update availability unknown — ${why}`);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
lines.push(
|
|
660
|
+
`active: builds=${s.active_work.builds_in_flight} execs=${s.active_work.execs_in_flight} crons=${s.active_work.crons_in_flight} terminals=${s.active_work.terminals_open}`,
|
|
661
|
+
);
|
|
662
|
+
|
|
663
|
+
if (s.safe_to_update) {
|
|
664
|
+
lines.push("safe_to_update: YES");
|
|
665
|
+
} else {
|
|
666
|
+
lines.push("safe_to_update: NO");
|
|
667
|
+
for (const r of s.unsafe_reasons) lines.push(` - ${r}`);
|
|
668
|
+
}
|
|
669
|
+
lines.push(`recommended: ${s.recommended_command}`);
|
|
670
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
671
|
+
},
|
|
672
|
+
);
|
|
673
|
+
|
|
601
674
|
server.registerTool(
|
|
602
675
|
"moor_cleanup_plan",
|
|
603
676
|
{
|