@phren/cli 0.3.30 → 0.3.32

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.
Files changed (81) hide show
  1. package/dist/bridge/agent-hooks.d.ts +5 -55
  2. package/dist/bridge/agent-hooks.js +45 -162
  3. package/dist/bridge/approval-rules.d.ts +70 -0
  4. package/dist/bridge/approval-rules.js +231 -0
  5. package/dist/bridge/authority.d.ts +1 -2
  6. package/dist/bridge/authority.js +2 -7
  7. package/dist/bridge/changes.d.ts +4 -0
  8. package/dist/bridge/changes.js +47 -33
  9. package/dist/bridge/claude-suggestion.js +1 -1
  10. package/dist/bridge/codex-servers.d.ts +12 -0
  11. package/dist/bridge/codex-servers.js +35 -3
  12. package/dist/bridge/codex-thread-origin.d.ts +12 -0
  13. package/dist/bridge/codex-thread-origin.js +31 -0
  14. package/dist/bridge/dispatch.js +1 -1
  15. package/dist/bridge/enroll.d.ts +6 -0
  16. package/dist/bridge/enroll.js +10 -4
  17. package/dist/bridge/git-worktrees.js +14 -17
  18. package/dist/bridge/git.d.ts +10 -2
  19. package/dist/bridge/git.js +148 -107
  20. package/dist/bridge/hand-off-queue.d.ts +10 -0
  21. package/dist/bridge/hand-off-queue.js +33 -10
  22. package/dist/bridge/health.js +9 -5
  23. package/dist/bridge/herdr.js +6 -1
  24. package/dist/bridge/hook-main.js +12 -2
  25. package/dist/bridge/locate.js +14 -1
  26. package/dist/bridge/projects.d.ts +8 -0
  27. package/dist/bridge/projects.js +142 -24
  28. package/dist/bridge/prompt-deliveries.d.ts +99 -0
  29. package/dist/bridge/prompt-deliveries.js +327 -0
  30. package/dist/bridge/prompt-once.d.ts +2 -0
  31. package/dist/bridge/prompt-once.js +2 -0
  32. package/dist/bridge/schedule-format.d.ts +10 -0
  33. package/dist/bridge/schedule-format.js +24 -1
  34. package/dist/bridge/schedules.d.ts +3 -1
  35. package/dist/bridge/schedules.js +96 -40
  36. package/dist/bridge/server-launch.js +39 -15
  37. package/dist/bridge/server-pane-routes.js +91 -45
  38. package/dist/bridge/server-routes.d.ts +3 -0
  39. package/dist/bridge/server-routes.js +36 -8
  40. package/dist/bridge/server-stream.js +4 -2
  41. package/dist/bridge/server.js +12 -3
  42. package/dist/bridge/speech-key.d.ts +2 -9
  43. package/dist/bridge/speech-key.js +4 -37
  44. package/dist/bridge/sudo.d.ts +1 -1
  45. package/dist/bridge/sudo.js +51 -17
  46. package/dist/bridge/terminal-tmux.js +22 -4
  47. package/dist/bridge/tmux-test-server.d.ts +13 -0
  48. package/dist/bridge/tmux-test-server.js +103 -0
  49. package/dist/bridge/transcript-claude.d.ts +3 -3
  50. package/dist/bridge/transcript-claude.js +7 -7
  51. package/dist/bridge/transcript-codex.js +6 -4
  52. package/dist/bridge/transcript-preview.js +1 -1
  53. package/dist/bridge/transcripts.js +14 -3
  54. package/dist/bridge-hook.mjs +16011 -14121
  55. package/dist/cli/schedules.js +8 -2
  56. package/dist/cli/session-stop.js +9 -1
  57. package/dist/cli-registry.js +1 -1
  58. package/dist/core/project-registry.d.ts +1 -0
  59. package/dist/core/project-registry.js +6 -2
  60. package/dist/core/project.d.ts +1 -0
  61. package/dist/core/project.js +5 -0
  62. package/dist/generated/memory-ui-graph.browser.js +328 -333
  63. package/dist/init/setup.js +2 -2
  64. package/dist/memory-ui-graph.runtime.js +328 -333
  65. package/dist/modules/registry.js +9 -7
  66. package/dist/phren-core.js +1 -1
  67. package/dist/phren-paths.d.ts +2 -2
  68. package/dist/phren-paths.js +2 -2
  69. package/dist/store-routing.d.ts +2 -2
  70. package/dist/store-routing.js +2 -2
  71. package/dist/sync/git-state.d.ts +13 -0
  72. package/dist/sync/git-state.js +22 -0
  73. package/dist/sync/store-merge.d.ts +2 -0
  74. package/dist/sync/store-merge.js +6 -1
  75. package/dist/test-global-setup.js +7 -0
  76. package/dist/tools/data.js +1 -1
  77. package/dist/tools/finding.js +1 -1
  78. package/dist/tools/search.js +1 -1
  79. package/dist/tools/tasks.js +1 -1
  80. package/package.json +8 -8
  81. package/starter/global/skills/conductor/SKILL.md +2 -2
@@ -47,9 +47,9 @@ async function claudeChildModel(file) {
47
47
  }
48
48
  /** The checkout a Claude sub-agent edits in. Claude Code writes the isolated
49
49
  * worktree into the child's `.meta.json`; an older child falls back to the
50
- * `cwd` its own first rows record when that folder is a linked worktree (its
51
- * `.git` is a file). A child working in the parent's checkout gets nothing,
52
- * and a worktree already removed is not offered. */
50
+ * `cwd` its own first rows record. Preserve shared and missing checkout paths
51
+ * too: Git routes must fail explicitly when a checkout disappears, never
52
+ * substitute the parent repository. */
53
53
  export async function claudeChildCheckout(file) {
54
54
  const meta = await readFile(file.slice(0, -".jsonl".length) + ".meta.json", "utf8").then(v => object(JSON.parse(v))).catch(() => ({}));
55
55
  let cwd = typeof meta.worktreePath === "string" && path.isAbsolute(meta.worktreePath) ? meta.worktreePath : undefined;
@@ -61,8 +61,7 @@ export async function claudeChildCheckout(file) {
61
61
  try {
62
62
  const value = object(JSON.parse(line)).cwd;
63
63
  if (typeof value === "string" && path.isAbsolute(value)) {
64
- if ((await stat(path.join(value, ".git")).catch(() => undefined))?.isFile())
65
- cwd = value;
64
+ cwd = value;
66
65
  break;
67
66
  }
68
67
  }
@@ -73,9 +72,10 @@ export async function claudeChildCheckout(file) {
73
72
  input.close();
74
73
  branch = undefined;
75
74
  }
76
- if (!cwd || !(await stat(cwd).catch(() => undefined))?.isDirectory())
75
+ if (!cwd)
77
76
  return {};
78
- return { cwd, worktreeName: path.basename(cwd).slice(0, 200), ...(branch ? { branch } : {}) };
77
+ const linked = typeof meta.worktreePath === "string" || (await stat(path.join(cwd, ".git")).catch(() => undefined))?.isFile();
78
+ return { cwd, ...(linked ? { worktreeName: path.basename(cwd).slice(0, 200) } : {}), ...(branch ? { branch } : {}) };
79
79
  }
80
80
  async function withClaudeChildModels(relations) {
81
81
  return Promise.all(relations.map(async (relation) => {
@@ -453,10 +453,12 @@ function rememberProjectedCodeCall(callId) {
453
453
  projectedCodeCalls.delete(projectedCodeCalls.values().next().value);
454
454
  }
455
455
  function renameProjectedChanges(raw, base) {
456
- const changes = object(raw.phren_changes);
457
- if (!Object.keys(changes).length)
458
- return raw;
459
- return { ...raw, phren_changes: Object.fromEntries(Object.entries(changes).map(([key, value]) => [key === base ? `${base}:1` : key, value])) };
456
+ for (const field of ["phren_changes", "phren_change_errors"]) {
457
+ const changes = object(raw[field]);
458
+ if (Object.keys(changes).length)
459
+ raw = { ...raw, [field]: Object.fromEntries(Object.entries(changes).map(([key, value]) => [key === base ? `${base}:1` : key, value])) };
460
+ }
461
+ return raw;
460
462
  }
461
463
  /** Expand one Codex row: a code-mode call becomes one ordinary call per
462
464
  * invocation, each carrying the original source under `input.source`, and the
@@ -20,7 +20,7 @@ export function claudePanePreview(rendered, prompt, previous = "") {
20
20
  // below reads the plain line.
21
21
  const marked = screen.map(line => claudeBoldMarkdown(line).replace(/[\u2500-\u257f]/g, "").trimEnd());
22
22
  // The rule above the input box can carry the session title
23
- // ("───── Claude sesh ─"); it ends the reply, it is never part of it.
23
+ // ("───── Docs refresh ─"); it ends the reply, it is never part of it.
24
24
  // A narrow pane leaves the titled rule a single dash ("…title… ─"), so a
25
25
  // line that ends in a rule dash right above the input prompt ends it too.
26
26
  const lines = raw.map((line, index) => (/[─━═]{3,}/.test(line) && !/^\s*[│┃║]/.test(line))
@@ -343,11 +343,22 @@ export class TranscriptReader {
343
343
  continue;
344
344
  }
345
345
  const attached = {};
346
+ const failures = {};
346
347
  for (const id of ids) {
347
- const files = await this.changes.changes(id);
348
- if (files)
349
- attached[id] = files;
348
+ try {
349
+ const files = await this.changes.changes(id);
350
+ if (files)
351
+ attached[id] = files;
352
+ }
353
+ catch (error) {
354
+ // Keep the tool output visible; the outer malformed-row guard
355
+ // must never hide it just because Git could not collect changes.
356
+ failures[id] = { error: error instanceof BridgeError ? error.message : "Git change capture failed.",
357
+ code: error instanceof BridgeError ? error.details?.code ?? "git-capture-failed" : "git-capture-failed" };
358
+ }
350
359
  }
360
+ if (Object.keys(failures).length)
361
+ raw = { ...raw, phren_change_errors: failures };
351
362
  // A row that already carries a worker's own diff (OpenCode edit,
352
363
  // write or patch) keeps it; the shell lookup only fills in the rest.
353
364
  if (Object.keys(attached).length)