@phren/cli 0.3.20 → 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 (53) hide show
  1. package/dist/bridge/agent-hooks.d.ts +22 -19
  2. package/dist/bridge/agent-hooks.js +49 -33
  3. package/dist/bridge/approval-summary.d.ts +4 -0
  4. package/dist/bridge/approval-summary.js +12 -1
  5. package/dist/bridge/code-note.d.ts +1 -0
  6. package/dist/bridge/code-note.js +2 -2
  7. package/dist/bridge/codex-binary.d.ts +5 -0
  8. package/dist/bridge/codex-binary.js +7 -0
  9. package/dist/bridge/dispatch-command.js +1 -1
  10. package/dist/bridge/dispatch-returns.d.ts +3 -2
  11. package/dist/bridge/dispatch-returns.js +27 -11
  12. package/dist/bridge/dispatch.d.ts +4 -0
  13. package/dist/bridge/dispatch.js +5 -3
  14. package/dist/bridge/folder-trust.d.ts +13 -3
  15. package/dist/bridge/folder-trust.js +42 -4
  16. package/dist/bridge/hand-off.js +2 -1
  17. package/dist/bridge/herdr.js +6 -5
  18. package/dist/bridge/launch-brief.d.ts +3 -1
  19. package/dist/bridge/launch-brief.js +3 -1
  20. package/dist/bridge/memory-store.d.ts +7 -0
  21. package/dist/bridge/memory-store.js +37 -1
  22. package/dist/bridge/schedule-format.d.ts +1 -1
  23. package/dist/bridge/schedule-format.js +1 -1
  24. package/dist/bridge/schedule-launch.js +5 -0
  25. package/dist/bridge/schedule-watch.d.ts +5 -2
  26. package/dist/bridge/schedule-watch.js +59 -20
  27. package/dist/bridge/server-launch.d.ts +6 -0
  28. package/dist/bridge/server-launch.js +59 -11
  29. package/dist/bridge/server-pane-routes.js +20 -13
  30. package/dist/bridge/server-routes.d.ts +1 -0
  31. package/dist/bridge/server-routes.js +1 -1
  32. package/dist/bridge/server-stream.js +12 -0
  33. package/dist/bridge/server.js +2 -2
  34. package/dist/bridge/session-activity.d.ts +6 -0
  35. package/dist/bridge/session-activity.js +16 -0
  36. package/dist/bridge/settings-switch.d.ts +7 -0
  37. package/dist/bridge/settings-switch.js +15 -0
  38. package/dist/bridge/speech-transcribe.d.ts +8 -1
  39. package/dist/bridge/speech-transcribe.js +18 -3
  40. package/dist/bridge/transcript-claude.js +39 -10
  41. package/dist/bridge/worker-close.js +3 -2
  42. package/dist/bridge/worker-unfinished.d.ts +8 -2
  43. package/dist/bridge/worker-unfinished.js +57 -24
  44. package/dist/bridge-hook.mjs +513 -277
  45. package/dist/cli-registry.js +1 -1
  46. package/dist/home-paths.d.ts +2 -0
  47. package/dist/home-paths.js +4 -0
  48. package/dist/modules/registry.js +1 -1
  49. package/dist/test-global-setup.js +2 -1
  50. package/dist/test-sandbox.d.ts +15 -0
  51. package/dist/test-sandbox.js +36 -0
  52. package/package.json +1 -1
  53. package/starter/global/skills/conductor/SKILL.md +2 -1
@@ -161,7 +161,7 @@ export const REGISTRY = [
161
161
  },
162
162
  },
163
163
  {
164
- 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]",
165
165
  summary: "Dispatch a worker brief through Phren Hook",
166
166
  subcommands: [{ name: "status", usage: "phren dispatch status", summary: "List local dispatch receipts" },
167
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
+ }
@@ -96,7 +96,7 @@ export const BUILTIN_MODULES = [
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", "speechTimestampStream", "speechLive", "speechVoices", "speechFormats", "transcribe", "promptOnce", "promptStatus", "resources", "sessionRename", "sudo", "sudoOutcome", "previewDeltas", "quickChat",
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.20",
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