@phren/cli 0.3.36 → 0.3.37

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.
@@ -4,6 +4,7 @@ import { setTelemetryEnabled, getTelemetrySummary, resetTelemetry } from "../tel
4
4
  import { readInstallPreferences, updateInstallPreferences } from "../init/preferences.js";
5
5
  import { resolveMcpProfile } from "../mcp/profile.js";
6
6
  import { resolveClanker } from "../clanker.js";
7
+ import { resolveAccountFailover } from "../bridge/account-choice.js";
7
8
  import { parsePullInterval, resolvePullInterval, periodicPullEnabled } from "../sync/pull.js";
8
9
  import * as path from "path";
9
10
  import { buildConfigView } from "../config/resolve.js";
@@ -123,11 +124,15 @@ export async function handleConfig(args) {
123
124
  return handleConfigMcpProfile(rest);
124
125
  case "clanker":
125
126
  return handleConfigClanker(rest);
127
+ case "account-failover":
128
+ return handleConfigAccountFailover(rest);
126
129
  case "set":
127
- // `phren config set clanker on` reads naturally; clanker is the only key it takes.
130
+ // `phren config set clanker on` reads naturally.
128
131
  if (rest[0] === "clanker")
129
132
  return handleConfigClanker(rest.slice(1));
130
- console.error("phren config set takes: clanker on|off. Other settings have their own subcommand (phren config).");
133
+ if (rest[0] === "account-failover")
134
+ return handleConfigAccountFailover(rest.slice(1));
135
+ console.error("phren config set takes: clanker on|off, account-failover on|off. Other settings have their own subcommand (phren config).");
131
136
  process.exitCode = 1;
132
137
  return;
133
138
  case "pull-interval":
@@ -182,6 +187,9 @@ Subcommands:
182
187
  phren config profiles All profiles and their projects
183
188
  phren config clanker [on|off] Compact keyword-first retrieval: hook, search and
184
189
  lists return id/title/keyword rows; full text by id
190
+ phren config account-failover [on|off]
191
+ Continue on another signed-in account when a dispatched
192
+ Claude worker stops at its usage limit (default: off)
185
193
  phren config pull-interval [seconds|off]
186
194
  Periodic MCP remote checks (default: off)
187
195
  phren config telemetry [on|off|reset] Local usage stats (opt-in, no external reporting)`);
@@ -289,6 +297,24 @@ function handleConfigClanker(args) {
289
297
  ? "The prompt hook, search_knowledge, get_tasks and get_findings return id, title, keyword and score rows; get_memory_detail fetches an entry by id."
290
298
  : "The prompt hook and tools return text snippets. `phren config clanker on` for compact rows.");
291
299
  }
300
+ function handleConfigAccountFailover(args) {
301
+ const phrenPath = getPhrenPath();
302
+ const want = args[0]?.trim().toLowerCase();
303
+ if (want === "on" || want === "off") {
304
+ updateInstallPreferences(phrenPath, () => ({ accountFailover: want === "on" }));
305
+ console.log(`Account failover ${want}. The Hook reads it on its next returns poll.`);
306
+ }
307
+ else if (want) {
308
+ console.error(`Unknown value "${want}". Use on or off.`);
309
+ process.exitCode = 1;
310
+ return;
311
+ }
312
+ const { on, source } = resolveAccountFailover(process.env, phrenPath);
313
+ console.log(`Account failover: ${on ? "on" : "off"} (${source})`);
314
+ console.log(on
315
+ ? "A dispatched Claude worker that stops at its usage limit continues on another of your signed-in accounts with room, on its computer or another; never on the same login before its window resets."
316
+ : "A dispatched Claude worker that stops at its usage limit returns failed and stays stopped. `phren config account-failover on` continues it on another signed-in account.");
317
+ }
292
318
  function handleConfigTelemetry(args) {
293
319
  const action = args[0];
294
320
  switch (action) {
@@ -13,6 +13,12 @@ export interface InstallPreferences {
13
13
  * overrides it. See clanker.ts.
14
14
  */
15
15
  clanker?: boolean;
16
+ /**
17
+ * Whether a dispatched Claude worker that hits its usage limit continues on
18
+ * another signed-in account. Off when unset; PHREN_ACCOUNT_FAILOVER
19
+ * overrides it. See bridge/account-choice.ts.
20
+ */
21
+ accountFailover?: boolean;
16
22
  hooksEnabled?: boolean;
17
23
  skillsScope?: "global" | "project";
18
24
  projectOwnershipDefault?: "phren-managed" | "detached" | "repo-managed";
@@ -131,7 +131,7 @@ export const BUILTIN_MODULES = [
131
131
  {
132
132
  schemaVersion: 1, name: "conductor", version: VERSION, defaultEnabled: false, requires: ["memory", "hook"],
133
133
  tools: full(["dispatch", "dispatch_returns", "dispatch_approve", "hand_off", "live_sessions", "account_usage", "authority", "dispatch_report", "owner_inbox"]), cliCommands: ["dispatch", "dispatch status", "dispatch returns", "dispatch sessions", "dispatch usage", "dispatch report", "hand-off", "conductor", "conductor grants", "conductor status", "conductor make", "conductor stop", "conductor sets", "conductor integrator", "owner-inbox", "authority", "bridge enroll-computer"], agentHooks: [],
134
- hookRoutes: [...routes("GET", ["/v1/dispatch", "/v1/dispatch/capacity", "/v1/dispatch/arrival", "/v1/conductor", "/v1/conductor/grants", "/v1/computers", "/v1/sets", "/v1/authority", "/v1/owner-inbox", "/v1/conductor/integrator"]),
134
+ hookRoutes: [...routes("GET", ["/v1/dispatch", "/v1/dispatch/capacity", "/v1/dispatch/arrival", "/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/dispatch", "/v1/dispatch/workers", "/v1/dispatch/returns", "/v1/dispatch/approve", "/v1/dispatch/report", "/v1/dispatch/close", "/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/authority", "/v1/authority/confirm"]), ...routes("DELETE", ["/v1/conductor/grants", "/v1/authority"])],
136
136
  capabilities: ["dispatch", "conductorSets", "ownerInbox", "workerReports", "queuedHandOff"], storeFiles: ["global/skills/conductor/**"],
137
137
  localFiles: ["<bridge>/hooks.yaml", "<bridge>/conductor.yaml", "<bridge>/conductor-role.json", "<bridge>/conductor/brief.md", "<bridge>/authority.yaml", "<bridge>/authority-confirmations.json", "<bridge>/dispatches/*.json", "<bridge>/hand-offs/*.json", "<bridge>/worker-reports/*.json", "<bridge>/closed-workers/*.json", "<bridge>/owner-inbox.json", "<bridge>/integrator.json"], phoneScreens: [], skills: ["conductor"],
@@ -59,7 +59,7 @@ export function register(server) {
59
59
  });
60
60
  server.registerTool("dispatch_returns", {
61
61
  title: "◆ phren · dispatch returns",
62
- description: "List unread returns from dispatched workers and mark them read: the worker finished (done, with its final reply), finished by asking the owner something (needs-you, with the question), failed (the harness ended the turn on an error such as a usage limit, with the error), is blocked on terminal input, or its pane is gone. A blocked row with an `approval` field (actionId, tool, request) is a permission request the worker is waiting on, forwarded from its computer: answer it with dispatch_approve. A worker that ended its turn with background tasks pending is waited on for up to two hours; a row has `waited` (the most tasks it waited on) or, if some were still running after that, `background`. A stalled row flags an unchanged working screen and transcript. A done row can include structured prs and integratorDelivery. Reading a done return closes its finished pane unless closeOnFinish:false was specified, after rechecking new and queued work. Each row has the dispatch id, computer, project, label and the worker's target for hand_off.",
62
+ description: "List unread returns from dispatched workers and mark them read: the worker finished (done, with its final reply), finished by asking the owner something (needs-you, with the question), failed (the harness ended the turn on an error such as a usage limit, with the error), is blocked on terminal input, or its pane is gone. A blocked row with an `approval` field (actionId, tool, request) is a permission request the worker is waiting on, forwarded from its computer: answer it with dispatch_approve. A worker that ended its turn with background tasks pending is waited on for up to two hours; a row has `waited` (the most tasks it waited on) or, if some were still running after that, `background`. A stalled row flags an unchanged working screen and transcript. A done row can include structured prs and integratorDelivery. Reading a done return closes its finished pane unless closeOnFinish:false was specified, after rechecking new and queued work. Each row has the dispatch id, computer, project, label and the worker's target for hand_off. When the owner has turned on `phren config account-failover on` (off by default), a Claude worker that stopped at its usage limit is continued on another signed-in account with room (same computer first, never the same login before its window resets): its row comes back with continued (the new dispatch id, computer and account, or why none could) and the error says \"Continued on account X\".",
63
63
  inputSchema: {},
64
64
  }, async () => {
65
65
  try {
@@ -91,7 +91,7 @@ export function register(server) {
91
91
  });
92
92
  server.registerTool("live_sessions", {
93
93
  title: "◆ phren · live sessions",
94
- description: "List the live agent sessions on this computer and every enrolled computer: computer, project, harness, status (working, with backgroundTasks, while background work runs after the main turn ended), idleFor (seconds since the tab last changed), role and the target hand_off takes. Computers that could not be reached are listed separately, and computers registered in the store but not linked in hooks.yaml come back in notLinked: their sessions are unknown, not absent.",
94
+ description: "List the live agent sessions on this computer and every enrolled computer: computer, project, harness, status (working, with backgroundTasks, while background work runs after the main turn ended), idleFor (seconds since the tab last changed), role, the target hand_off takes, and for Claude sessions quota (the account's 5-hour and weekly percent left and reset time). claudeAccounts lists every signed-in Claude account per computer with the same room. Computers that could not be reached are listed separately, and computers registered in the store but not linked in hooks.yaml come back in notLinked: their sessions are unknown, not absent.",
95
95
  inputSchema: {},
96
96
  }, async () => {
97
97
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {