@phren/cli 0.3.66 → 0.3.67
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/bridge/account-choice.d.ts +12 -3
- package/dist/bridge/account-choice.js +133 -19
- package/dist/bridge/account-last-known.d.ts +27 -0
- package/dist/bridge/account-last-known.js +124 -0
- package/dist/bridge/claude-accounts.d.ts +27 -0
- package/dist/bridge/claude-accounts.js +63 -8
- package/dist/bridge/dispatch-returns.d.ts +8 -0
- package/dist/bridge/dispatch-returns.js +20 -2
- package/dist/bridge/files.d.ts +1 -1
- package/dist/bridge/harnesses.js +8 -2
- package/dist/bridge/helper.d.ts +3 -2
- package/dist/bridge/helper.js +5 -4
- package/dist/bridge/machine-health-alerts.d.ts +20 -0
- package/dist/bridge/machine-health-alerts.js +47 -0
- package/dist/bridge/machine-health.d.ts +42 -0
- package/dist/bridge/machine-health.js +124 -0
- package/dist/bridge/machine-probes.d.ts +58 -0
- package/dist/bridge/machine-probes.js +306 -0
- package/dist/bridge/push.d.ts +10 -0
- package/dist/bridge/push.js +15 -0
- package/dist/bridge/resources.d.ts +5 -0
- package/dist/bridge/resources.js +16 -2
- package/dist/bridge/schedule-launch.js +2 -2
- package/dist/bridge/server-launch.js +3 -1
- package/dist/bridge/server.js +5 -1
- package/dist/bridge-hook.mjs +29054 -28107
- package/dist/computers/read.d.ts +18 -0
- package/dist/computers/read.js +18 -0
- package/dist/modules/registry.js +1 -1
- package/dist/tools/dispatch.js +16 -0
- package/dist/tools/helper.js +1 -1
- package/package.json +1 -1
- package/starter/global/skills/conductor/SKILL.md +6 -0
package/dist/computers/read.d.ts
CHANGED
|
@@ -85,4 +85,22 @@ export declare function readUsage(options?: {
|
|
|
85
85
|
hookError?: string;
|
|
86
86
|
peerError?: string;
|
|
87
87
|
}>;
|
|
88
|
+
export interface MachineHealthRow {
|
|
89
|
+
name: string;
|
|
90
|
+
local: boolean;
|
|
91
|
+
online: boolean;
|
|
92
|
+
/** Worst severity on this computer, `ok` when it reported none. */
|
|
93
|
+
worst?: "high" | "warn" | "info" | "ok";
|
|
94
|
+
findings?: NonNullable<ComputerResources["health"]>;
|
|
95
|
+
/** The computer's Hook predates health findings; nothing is known about it. */
|
|
96
|
+
unsupported?: true;
|
|
97
|
+
error?: string;
|
|
98
|
+
}
|
|
99
|
+
/** Each computer's health findings, worst computer first, and a one-line summary. */
|
|
100
|
+
export declare function machineHealthReport(computers: ComputerReport[]): {
|
|
101
|
+
computers: MachineHealthRow[];
|
|
102
|
+
high: number;
|
|
103
|
+
warn: number;
|
|
104
|
+
message: string;
|
|
105
|
+
};
|
|
88
106
|
export {};
|
package/dist/computers/read.js
CHANGED
|
@@ -181,3 +181,21 @@ export async function readUsage(options = {}) {
|
|
|
181
181
|
const combined = combineUsage(computers.flatMap(c => c.harnesses ? [c.harnesses] : []));
|
|
182
182
|
return { computers, combined, ...(typeof answer.peerError === "string" ? { peerError: answer.peerError } : {}) };
|
|
183
183
|
}
|
|
184
|
+
/** Each computer's health findings, worst computer first, and a one-line summary. */
|
|
185
|
+
export function machineHealthReport(computers) {
|
|
186
|
+
const order = { high: 0, warn: 1, info: 2, ok: 3 };
|
|
187
|
+
const rows = computers.map(c => {
|
|
188
|
+
if (!c.online || !c.resources)
|
|
189
|
+
return { name: c.name, local: c.local, online: false, error: c.error ?? "Unavailable" };
|
|
190
|
+
const findings = c.resources.health;
|
|
191
|
+
if (!findings)
|
|
192
|
+
return { name: c.name, local: c.local, online: true, unsupported: true };
|
|
193
|
+
return { name: c.name, local: c.local, online: true, worst: findings[0]?.severity ?? "ok", findings };
|
|
194
|
+
});
|
|
195
|
+
rows.sort((a, b) => (a.worst ? order[a.worst] : 4) - (b.worst ? order[b.worst] : 4));
|
|
196
|
+
const count = (s) => rows.reduce((n, r) => n + (r.findings?.filter(f => f.severity === s).length ?? 0), 0);
|
|
197
|
+
const high = count("high"), warn = count("warn");
|
|
198
|
+
const parts = rows.map(r => !r.online ? `${r.name} offline` : r.unsupported ? `${r.name} no health (older Hook)`
|
|
199
|
+
: r.worst === "ok" ? `${r.name} ok` : `${r.name}: ${r.findings.filter(f => f.severity !== "info").map(f => `${f.severity} ${f.title}`).join("; ") || "info only"}`);
|
|
200
|
+
return { computers: rows, high, warn, message: `${high} high, ${warn} warn across ${rows.length} computers. ${parts.join(". ")}.` };
|
|
201
|
+
}
|
package/dist/modules/registry.js
CHANGED
|
@@ -130,7 +130,7 @@ export const BUILTIN_MODULES = [
|
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
schemaVersion: 1, name: "conductor", version: VERSION, defaultEnabled: false, requires: ["memory", "hook"],
|
|
133
|
-
tools: full(["dispatch", "dispatch_returns", "dispatch_approve", "hand_off", "live_sessions", "account_usage", "authority", "dispatch_report", "owner_inbox", "move_session", "helper"]), cliCommands: ["dispatch", "dispatch status", "dispatch returns", "dispatch sessions", "dispatch usage", "dispatch report", "hand-off", "move", "conductor", "conductor grants", "conductor status", "conductor make", "conductor stop", "conductor sets", "conductor integrator", "owner-inbox", "authority", "bridge enroll-computer"], agentHooks: [],
|
|
133
|
+
tools: full(["dispatch", "dispatch_returns", "dispatch_approve", "hand_off", "live_sessions", "account_usage", "machine_health", "authority", "dispatch_report", "owner_inbox", "move_session", "helper"]), cliCommands: ["dispatch", "dispatch status", "dispatch returns", "dispatch sessions", "dispatch usage", "dispatch report", "hand-off", "move", "conductor", "conductor grants", "conductor status", "conductor make", "conductor stop", "conductor sets", "conductor integrator", "owner-inbox", "authority", "bridge enroll-computer"], agentHooks: [],
|
|
134
134
|
hookRoutes: [...routes("GET", ["/v1/dispatch", "/v1/dispatch/capacity", "/v1/conductor/move/status", "/v1/conductor/move/launch", "/v1/conductor/move/operation", "/v1/conductor/move/notification", "/v1/dispatch/brief", "/v1/conductor", "/v1/conductor/grants", "/v1/computers", "/v1/sets", "/v1/authority", "/v1/owner-inbox", "/v1/conductor/integrator"]),
|
|
135
135
|
...routes("POST", ["/v1/conductor/call", "/v1/conductor/move/prepare", "/v1/conductor/move/commit", "/v1/conductor/move/operate", "/v1/conductor/move/ack", "/v1/conductor/move/notice", "/v1/dispatch", "/v1/dispatch/workers", "/v1/dispatch/returns", "/v1/dispatch/approve", "/v1/dispatch/report", "/v1/dispatch/close", "/v1/dispatch/close-self", "/v1/owner-inbox", "/v1/conductor/integrator", "/v1/hand-off", "/v1/hand-off/status", "/v1/conductor/grants", "/v1/conductor/make", "/v1/conductor/stop", "/v1/sets/name", "/v1/sets/link", "/v1/authority", "/v1/authority/confirm"]), ...routes("DELETE", ["/v1/conductor/grants", "/v1/authority"])],
|
|
136
136
|
capabilities: ["dispatch", "moveConductorToComputer", "conductorSets", "setLink", "ownerInbox", "workerReports", "queuedHandOff"], storeFiles: ["global/skills/conductor/**"],
|
package/dist/tools/dispatch.js
CHANGED
|
@@ -5,6 +5,7 @@ import { hookRequest } from "../bridge/client.js";
|
|
|
5
5
|
import { dispatchSchema } from "../bridge/dispatch.js";
|
|
6
6
|
import { handOff, handOffSchema, listLiveSessions, moveSession, moveSessionSchema } from "../bridge/hand-off.js";
|
|
7
7
|
import { readAccountUsage, usageSummary } from "../bridge/account-usage.js";
|
|
8
|
+
import { machineHealthReport, readComputers } from "../computers/read.js";
|
|
8
9
|
import { terminalPaneFromEnv } from "../bridge/terminal.js";
|
|
9
10
|
import { dispatchIdFromEnv } from "../bridge/launch-brief.js";
|
|
10
11
|
import { approvalDecisions } from "../bridge/protocol.js";
|
|
@@ -122,6 +123,21 @@ export function register(server) {
|
|
|
122
123
|
return mcpResponse({ ok: false, error: error instanceof Error ? error.message : "Could not read account usage." });
|
|
123
124
|
}
|
|
124
125
|
});
|
|
126
|
+
server.registerTool("machine_health", {
|
|
127
|
+
title: "◆ phren · machine health",
|
|
128
|
+
description: "Named health findings for this computer and every linked computer, worst computer first: swap, disk, load pileups, memory hogs and leaks, orphaned processes, simulator clones, restart loops, failed units, backup age, pending updates, crashes, OOM kills, GPU errors and stale locks. Each finding has id, check, severity (high, warn, info), title, detail and fix. A computer whose Hook predates health findings says unsupported; an unreachable one says offline. For the conductor's watchdog: act on or report high findings; warn is worth a mention. Read-only.",
|
|
129
|
+
inputSchema: {},
|
|
130
|
+
}, async () => {
|
|
131
|
+
try {
|
|
132
|
+
const read = await readComputers();
|
|
133
|
+
const report = machineHealthReport(read.computers);
|
|
134
|
+
const note = read.hookError ? ` ${read.hookError}` : read.peerError ? ` Linked computers were skipped: ${read.peerError}` : "";
|
|
135
|
+
return mcpResponse({ ok: true, data: report, message: `${report.message}${note}` });
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
return mcpResponse({ ok: false, error: error instanceof Error ? error.message : "Could not read machine health." });
|
|
139
|
+
}
|
|
140
|
+
});
|
|
125
141
|
server.registerTool("authority", {
|
|
126
142
|
title: "◆ phren · release authority",
|
|
127
143
|
description: "Read the owner's release authority policy: per project, which release-type actions (merge, publish, deploy, app-store, github-admin) are go and which are ask-first, and the highest permission mode an agent may start a worker in there. Quote the project's `line` in a brief that asks for release work, and declare those actions in dispatch's releaseActions. An ask-first action needs the owner's confirmation first; ask the owner, never try to confirm it yourself. Read-only: only the owner changes the policy. Without project, lists every project the policy names.",
|
package/dist/tools/helper.js
CHANGED
|
@@ -7,7 +7,7 @@ import { mcpResponse, resolveStoreForProject } from "./types.js";
|
|
|
7
7
|
export function register(server, ctx) {
|
|
8
8
|
server.registerTool("helper", {
|
|
9
9
|
title: "◆ phren · helper",
|
|
10
|
-
description: `Run one small, self-contained task as a headless Claude Code run (claude -p) under the project's helper account and model (phren.project.yaml helper: { account, model }, model haiku by default), in your folder (a project checkout or worktree), and return its reply. Use it for narrow work you can describe fully in one prompt (summarize a file, draft a test, look something up); the helper sees no conversation, only the prompt and the folder. It bills the helper account, not yours: Claude Code's own subagents always run under your login. Read-only unless allowEdits (Bash and the edit tools are refused); no MCP servers. Stops after timeoutSeconds (default ${HELPER_TIMEOUT_DEFAULT_S}, at most ${HELPER_TIMEOUT_MAX_S}). Refused when the project has no helper account, the account's role is
|
|
10
|
+
description: `Run one small, self-contained task as a headless Claude Code run (claude -p) under the project's helper account and model (phren.project.yaml helper: { account, model }, model haiku by default), in your folder (a project checkout or worktree), and return its reply. Use it for narrow work you can describe fully in one prompt (summarize a file, draft a test, look something up); the helper sees no conversation, only the prompt and the folder. It bills the helper account, not yours: Claude Code's own subagents always run under your login. Read-only unless allowEdits (Bash and the edit tools are refused); no MCP servers. Stops after timeoutSeconds (default ${HELPER_TIMEOUT_DEFAULT_S}, at most ${HELPER_TIMEOUT_MAX_S}). Refused when the project has no helper account, the account's role is not helpers, or its pool is not allowed for the project or this computer.`,
|
|
11
11
|
inputSchema: {
|
|
12
12
|
prompt: z.string().min(1).max(100_000).describe("The whole task: what to do, which files, what to return."),
|
|
13
13
|
project: z.string().optional().describe("Expected project; it must be the project cwd belongs to, whose helper setting applies."),
|
package/package.json
CHANGED
|
@@ -50,6 +50,12 @@ Your tools, use these instead of exploring the CLI or the Hook's files:
|
|
|
50
50
|
optional resolution. In core use `phren_admin(action: "owner_inbox", ...)`.
|
|
51
51
|
Use an item's `inboxComputer` as `computer` when resolving a remote item;
|
|
52
52
|
omit it for `local`. Say which computers were unreachable.
|
|
53
|
+
- `machine_health`: named health findings for this computer and every linked
|
|
54
|
+
one, worst first, each with severity (high, warn, info), detail and fix.
|
|
55
|
+
Your hourly watchdog calls it first, acts on or reports each high finding
|
|
56
|
+
(clear clearly orphaned, regenerable strays; ask about anything else) and
|
|
57
|
+
mentions warn ones. Say which computers were offline or unsupported. In core
|
|
58
|
+
use `phren_admin(action: "machine_health")`.
|
|
53
59
|
- `phren dispatch status`: receipts of what you dispatched.
|
|
54
60
|
- `get_tasks`, `get_project_summary`, `search_knowledge`: the store's memory.
|
|
55
61
|
|