@phren/cli 0.3.19 → 0.3.21

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 (76) hide show
  1. package/dist/bridge/agent-hooks.d.ts +38 -20
  2. package/dist/bridge/agent-hooks.js +100 -37
  3. package/dist/bridge/approval-summary.d.ts +4 -0
  4. package/dist/bridge/approval-summary.js +12 -1
  5. package/dist/bridge/changes.d.ts +4 -0
  6. package/dist/bridge/changes.js +25 -2
  7. package/dist/bridge/code-note.d.ts +1 -0
  8. package/dist/bridge/code-note.js +2 -2
  9. package/dist/bridge/codex-binary.d.ts +5 -0
  10. package/dist/bridge/codex-binary.js +7 -0
  11. package/dist/bridge/command.js +24 -6
  12. package/dist/bridge/dispatch-command.js +1 -1
  13. package/dist/bridge/dispatch-returns.d.ts +14 -2
  14. package/dist/bridge/dispatch-returns.js +72 -16
  15. package/dist/bridge/dispatch.d.ts +23 -0
  16. package/dist/bridge/dispatch.js +169 -8
  17. package/dist/bridge/folder-trust.d.ts +13 -3
  18. package/dist/bridge/folder-trust.js +42 -4
  19. package/dist/bridge/hand-off.js +2 -1
  20. package/dist/bridge/herdr.js +6 -5
  21. package/dist/bridge/hook-fast.d.ts +13 -1
  22. package/dist/bridge/hook-fast.js +17 -2
  23. package/dist/bridge/launch-brief.d.ts +3 -1
  24. package/dist/bridge/launch-brief.js +3 -1
  25. package/dist/bridge/memory-store.d.ts +7 -0
  26. package/dist/bridge/memory-store.js +37 -1
  27. package/dist/bridge/models.d.ts +11 -1
  28. package/dist/bridge/models.js +47 -2
  29. package/dist/bridge/schedule-format.d.ts +1 -1
  30. package/dist/bridge/schedule-format.js +1 -1
  31. package/dist/bridge/schedule-launch.js +5 -0
  32. package/dist/bridge/schedule-watch.d.ts +5 -2
  33. package/dist/bridge/schedule-watch.js +59 -20
  34. package/dist/bridge/server-launch.d.ts +26 -0
  35. package/dist/bridge/server-launch.js +122 -12
  36. package/dist/bridge/server-pane-routes.js +20 -13
  37. package/dist/bridge/server-routes.d.ts +5 -0
  38. package/dist/bridge/server-routes.js +2 -2
  39. package/dist/bridge/server-stream.js +12 -0
  40. package/dist/bridge/server.js +8 -3
  41. package/dist/bridge/session-activity.d.ts +6 -0
  42. package/dist/bridge/session-activity.js +16 -0
  43. package/dist/bridge/settings-switch.d.ts +7 -0
  44. package/dist/bridge/settings-switch.js +15 -0
  45. package/dist/bridge/speech-live.d.ts +45 -0
  46. package/dist/bridge/speech-live.js +413 -0
  47. package/dist/bridge/speech-transcribe.d.ts +13 -3
  48. package/dist/bridge/speech-transcribe.js +26 -8
  49. package/dist/bridge/speech-voice.d.ts +22 -1
  50. package/dist/bridge/speech-voice.js +20 -2
  51. package/dist/bridge/speech.d.ts +24 -4
  52. package/dist/bridge/speech.js +115 -14
  53. package/dist/bridge/stalls.d.ts +9 -2
  54. package/dist/bridge/stalls.js +20 -4
  55. package/dist/bridge/transcript-claude.js +39 -10
  56. package/dist/bridge/transcript-preview.d.ts +11 -1
  57. package/dist/bridge/transcript-preview.js +37 -11
  58. package/dist/bridge/transcripts.d.ts +2 -1
  59. package/dist/bridge/transcripts.js +7 -3
  60. package/dist/bridge/turn-records.d.ts +6 -3
  61. package/dist/bridge/turn-records.js +9 -4
  62. package/dist/bridge/usage.d.ts +1 -1
  63. package/dist/bridge/usage.js +4 -3
  64. package/dist/bridge/worker-close.js +3 -1
  65. package/dist/bridge/worker-unfinished.d.ts +43 -0
  66. package/dist/bridge/worker-unfinished.js +178 -0
  67. package/dist/bridge-hook.mjs +2458 -1351
  68. package/dist/cli-registry.js +3 -2
  69. package/dist/home-paths.d.ts +2 -0
  70. package/dist/home-paths.js +4 -0
  71. package/dist/modules/registry.js +2 -2
  72. package/dist/test-global-setup.js +2 -1
  73. package/dist/test-sandbox.d.ts +15 -0
  74. package/dist/test-sandbox.js +36 -0
  75. package/package.json +1 -1
  76. package/starter/global/skills/conductor/SKILL.md +2 -1
@@ -141,7 +141,7 @@ export const REGISTRY = [
141
141
  },
142
142
  },
143
143
  {
144
- name: "bridge", topic: "setup", usage: "phren bridge <install|status|doctor|update|rollback|uninstall|enroll-computer|accounts|discover|link|fanouts archive|speech-key set|speech-voice|speech-model>",
144
+ name: "bridge", topic: "setup", usage: "phren bridge <install|status|doctor|update|rollback|uninstall|enroll-computer|accounts|discover|link|fanouts archive|speech-key set|speech-voice|speech-model|speech-region>",
145
145
  summary: "Install Phren Hook and enroll phone or computer connections",
146
146
  subcommands: [
147
147
  { name: "enroll-computer", usage: "phren bridge enroll-computer <name> [--accept <public-key-file>]", summary: "Print or accept a restricted computer dispatch key" },
@@ -152,6 +152,7 @@ export const REGISTRY = [
152
152
  { name: "speech-key set", usage: "phren bridge speech-key set", summary: "Store this computer's ElevenLabs key for spoken replies and dictation (read from stdin, mode 600)" },
153
153
  { name: "speech-voice", usage: "phren bridge speech-voice [show | set <voice-id> | clear]", summary: "Show or set the ElevenLabs voice talk mode speaks with; kept across install and update" },
154
154
  { name: "speech-model", usage: "phren bridge speech-model [show | set <model-id> | clear]", summary: "Show or set the ElevenLabs model talk mode speaks with (default eleven_v4_turbo); kept across install and update" },
155
+ { name: "speech-region", usage: "phren bridge speech-region [show | us | global]", summary: "Show or set where talk mode reaches ElevenLabs: global (default) or the US-only endpoint; kept across install and update" },
155
156
  ],
156
157
  run: async (args) => {
157
158
  const { runBridge } = await import("./bridge/command.js");
@@ -160,7 +161,7 @@ export const REGISTRY = [
160
161
  },
161
162
  },
162
163
  {
163
- name: "dispatch", topic: "core", usage: "phren dispatch <computer|anywhere> <project> --label <label> --prompt <brief> [--harness codex|claude|opencode] [--model <model>] [--effort <effort>] [--account <id>] [--permission-mode <mode>] [--keep-open]",
164
+ name: "dispatch", topic: "core", usage: "phren dispatch <computer|anywhere> <project> --label <label> --prompt <brief> [--harness codex|claude|opencode|copilot] [--model <model>] [--effort <effort>] [--account <id>] [--permission-mode <mode>] [--keep-open]",
164
165
  summary: "Dispatch a worker brief through Phren Hook",
165
166
  subcommands: [{ name: "status", usage: "phren dispatch status", summary: "List local dispatch receipts" },
166
167
  { name: "returns", usage: "phren dispatch returns", summary: "List unread worker returns (done, needs you, blocked, gone) and mark them read" },
@@ -5,3 +5,5 @@ export declare function homeDir(env?: NodeJS.ProcessEnv): string;
5
5
  export declare function claudeConfigDir(env?: NodeJS.ProcessEnv): string;
6
6
  /** Codex's home: `CODEX_HOME`, else `~/.codex`. */
7
7
  export declare function codexHome(env?: NodeJS.ProcessEnv): string;
8
+ /** Copilot CLI's home: `COPILOT_HOME`, else `~/.copilot`. */
9
+ export declare function copilotHome(env?: NodeJS.ProcessEnv): string;
@@ -19,3 +19,7 @@ export function claudeConfigDir(env = process.env) {
19
19
  export function codexHome(env = process.env) {
20
20
  return configuredDir(env.CODEX_HOME, env, ".codex");
21
21
  }
22
+ /** Copilot CLI's home: `COPILOT_HOME`, else `~/.copilot`. */
23
+ export function copilotHome(env = process.env) {
24
+ return configuredDir(env.COPILOT_HOME, env, ".copilot");
25
+ }
@@ -91,12 +91,12 @@ export const BUILTIN_MODULES = [
91
91
  "/v1/approvals/answer", "/v1/questions/answer", "/v1/subagents/resume", "/v1/subagents/archive-finished", "/v1/canary",
92
92
  "/v1/speech", "/v1/sudo/answer", "/v1/jobs/cleanup",
93
93
  ]),
94
- ...routes("WS", ["/v1/transcripts", "/v1/status", "/v1/overview", "/v1/speech/transcribe"]),
94
+ ...routes("WS", ["/v1/transcripts", "/v1/status", "/v1/overview", "/v1/speech/transcribe", "/v1/speech/live"]),
95
95
  ],
96
96
  capabilities: [
97
97
  "hook", "transcript", "progress", "images", "prompt", "stop", "terminal", "shell", "herdr",
98
98
  "webServers", "webPreview", "activity", "approvals", "questions", "accountUsage", "providers",
99
- "files", "repositoryFiles", "subagents", "sideQuestions", "approvalPush", "simulators", "overviewStream", "speech", "speechTimestamps", "speechVoices", "speechFormats", "transcribe", "promptOnce", "promptStatus", "resources", "sessionRename", "sudo", "sudoOutcome",
99
+ "files", "repositoryFiles", "subagents", "sideQuestions", "approvalPush", "simulators", "overviewStream", "speech", "speechTimestamps", "speechTimestampStream", "speechLive", "speechVoices", "speechFormats", "transcribe", "promptOnce", "promptStatus", "deliveryFrames", "resources", "sessionRename", "sudo", "sudoOutcome", "previewDeltas", "quickChat",
100
100
  ],
101
101
  storeFiles: [".runtime/sessions/opencode-*.events.jsonl", ".runtime/approvals/opencode-*.json"],
102
102
  localFiles: ["<bridge>/installed.json", "<bridge>/versions/**", "<bridge>/current", "<bridge>/dispatch", "<bridge>/askpass", "<bridge>/computer-id", "<bridge>/canary.json", "<bridge>/canary-daily"],
@@ -16,6 +16,7 @@ import * as fs from "fs";
16
16
  import * as os from "os";
17
17
  import * as path from "path";
18
18
  import { fileURLToPath } from "url";
19
+ import { removeSandboxHome } from "./test-sandbox.js";
19
20
  const __filename = fileURLToPath(import.meta.url);
20
21
  const __dirname = path.dirname(__filename);
21
22
  const REPO_ROOT = path.resolve(__dirname, "../../..");
@@ -57,7 +58,7 @@ function sandboxHomeDir() {
57
58
  }
58
59
  export async function teardown() {
59
60
  if (sandboxHome)
60
- fs.rmSync(sandboxHome, { recursive: true, force: true });
61
+ removeSandboxHome(sandboxHome);
61
62
  }
62
63
  export async function setup() {
63
64
  sandboxHomeDir();
@@ -0,0 +1,15 @@
1
+ export interface SandboxDeps {
2
+ /** Run one command; throws on failure. */
3
+ run: (file: string, args: string[], env: NodeJS.ProcessEnv) => void;
4
+ /** `ps` rows: pid and full command line. */
5
+ processes: () => {
6
+ pid: number;
7
+ command: string;
8
+ }[];
9
+ kill: (pid: number) => void;
10
+ }
11
+ /** Codex 0.158 leaves a detached `app-server --managed-daemon` (and its
12
+ * `pid-update-loop`) per HOME, reparented to init. Stop whatever a run left
13
+ * under `home`, then delete it. `codex app-server daemon stop` is the
14
+ * graceful path; processes whose command line names the home are the net. */
15
+ export declare function removeSandboxHome(home: string, deps?: SandboxDeps): void;
@@ -0,0 +1,36 @@
1
+ import { execFileSync } from "child_process";
2
+ import * as fs from "fs";
3
+ const real = {
4
+ run: (file, args, env) => { execFileSync(file, args, { env, stdio: "ignore", timeout: 15_000 }); },
5
+ processes: () => {
6
+ try {
7
+ return execFileSync("ps", ["-Aww", "-o", "pid=,command="], { encoding: "utf8", maxBuffer: 8_388_608 }).split("\n").flatMap(line => {
8
+ const match = /^\s*(\d+)\s+(.*)$/.exec(line);
9
+ return match ? [{ pid: Number(match[1]), command: match[2] }] : [];
10
+ });
11
+ }
12
+ catch {
13
+ return [];
14
+ }
15
+ },
16
+ kill: pid => { try {
17
+ process.kill(pid, "SIGKILL");
18
+ }
19
+ catch { /* already gone */ } },
20
+ };
21
+ /** Codex 0.158 leaves a detached `app-server --managed-daemon` (and its
22
+ * `pid-update-loop`) per HOME, reparented to init. Stop whatever a run left
23
+ * under `home`, then delete it. `codex app-server daemon stop` is the
24
+ * graceful path; processes whose command line names the home are the net. */
25
+ export function removeSandboxHome(home, deps = real) {
26
+ const env = { ...process.env, HOME: home, USERPROFILE: home, CODEX_HOME: undefined };
27
+ try {
28
+ deps.run("codex", ["app-server", "daemon", "stop"], env);
29
+ }
30
+ catch { /* no codex, or no daemon */ }
31
+ for (const { pid, command } of deps.processes()) {
32
+ if (pid !== process.pid && command.includes(home) && /app-server|pid-update-loop/.test(command))
33
+ deps.kill(pid);
34
+ }
35
+ fs.rmSync(home, { recursive: true, force: true });
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -144,7 +144,8 @@ Write one short line either way. Call `dispatch` in full or
144
144
  in core. The CLI equivalent is `phren dispatch <computer|anywhere> <project>
145
145
  --harness <harness> --label <label> --prompt <brief> [--model <model>] [--effort <effort>]
146
146
  [--permission-mode supervised|auto-edits|auto|full-access]`. `permissionMode` sets how the
147
- worker starts (Claude and Codex only).
147
+ worker starts (Claude, Codex and Copilot; not OpenCode). `harness` is codex,
148
+ claude, opencode or copilot.
148
149
  For release work (merge, publish, deploy, app-store, github-admin), read the
149
150
  owner's release authority policy first with `authority` in full or
150
151
  `phren_admin(action: "authority", project)` in core (CLI: `phren authority show