@phren/cli 0.3.24 → 0.3.26

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.
@@ -9,6 +9,18 @@ export declare function resolveCodeStore(base: string, value?: string | null, wr
9
9
  export declare class CodeRoutes {
10
10
  private readonly store;
11
11
  constructor(store: string);
12
+ /** A filename need not resemble a symbol declared inside it. Query the
13
+ * index's files table through @phren/code's existing public read API so
14
+ * installed optional packages need no new export to serve this route. */
15
+ files(projectValue: string | null, nameValue: string | null, limitValue?: string | null): Promise<{
16
+ project: string;
17
+ name: string;
18
+ files: {
19
+ path: string;
20
+ language: string;
21
+ }[];
22
+ truncated: boolean;
23
+ }>;
12
24
  status(projectValue: string | null): Promise<CodeStatus>;
13
25
  search(projectValue: string | null, queryValue: string | null, kindValue: string | null, limitValue: string | null, directoryValue?: string | null): Promise<{
14
26
  project: string;
@@ -69,6 +69,29 @@ export class CodeRoutes {
69
69
  constructor(store) {
70
70
  this.store = store;
71
71
  }
72
+ /** A filename need not resemble a symbol declared inside it. Query the
73
+ * index's files table through @phren/code's existing public read API so
74
+ * installed optional packages need no new export to serve this route. */
75
+ async files(projectValue, nameValue, limitValue) {
76
+ const project = projectSchema.parse(projectValue ?? "");
77
+ const name = relativePathSchema.refine(value => !/[\x00-\x1f\x7f]/.test(value)
78
+ && !value.split("/").includes(".git")).parse(nameValue ?? "");
79
+ const limit = limitValue ? topSchema.parse(limitValue) : 20;
80
+ const code = await requireCodePackage(this.store);
81
+ const database = await code.openCodeDatabase(this.store, project, false);
82
+ if (!database)
83
+ throw noIndex(project);
84
+ try {
85
+ const suffix = "/" + name;
86
+ const rows = code.rowsOf(database.db, `SELECT path, language FROM files WHERE path = ? OR substr(path, -?) = ?
87
+ ORDER BY CASE WHEN path = ? THEN 0 ELSE 1 END, length(path), path LIMIT ?`, [name, [...suffix].length, suffix, name, limit + 1]);
88
+ return { project, name, files: rows.slice(0, limit).map(row => ({ path: code.stringAt(row, 0), language: code.stringAt(row, 1) })),
89
+ truncated: rows.length > limit };
90
+ }
91
+ finally {
92
+ database.close();
93
+ }
94
+ }
72
95
  async status(projectValue) {
73
96
  const project = projectSchema.parse(projectValue ?? "");
74
97
  const result = await (await requireCodePackage(this.store)).codeIndexStatus(this.store, project);
@@ -20,6 +20,9 @@ export declare function processTable(now?: number): Promise<ProcessRow[]>;
20
20
  export declare function isCodexDaemon(command: string): boolean;
21
21
  /** When a pane's agent started: its oldest foreground process. */
22
22
  export declare function startedAt(rows: ProcessRow[], pids: number[]): number | undefined;
23
+ /** A direct `codex resume <id>` launch, including its shell/npm wrapper.
24
+ * This is only a hint: the command line survives later /new and /resume. */
25
+ export declare function resumedConversation(rows: ProcessRow[], pids: number[]): string | undefined;
23
26
  /** True when this process runs under a Codex app-server daemon: a hook the
24
27
  * daemon ran carries the environment of the pane that started the daemon,
25
28
  * which is not the pane of the conversation it reports. */
@@ -55,5 +58,6 @@ export declare function sameDirectory(a: unknown, b: unknown): Promise<boolean>;
55
58
  export interface CodexPaneStart {
56
59
  key: string;
57
60
  start: number;
61
+ resumed?: string;
58
62
  }
59
63
  export declare function assignDaemonConversation(here: DaemonRollout[], self: CodexPaneStart, claimed: Set<string>, rivals: CodexPaneStart[], now?: number): string | undefined;
@@ -51,6 +51,15 @@ export function startedAt(rows, pids) {
51
51
  const times = rows.filter(row => pids.includes(row.pid)).map(row => row.startedAt);
52
52
  return times.length ? Math.min(...times) : undefined;
53
53
  }
54
+ /** A direct `codex resume <id>` launch, including its shell/npm wrapper.
55
+ * This is only a hint: the command line survives later /new and /resume. */
56
+ export function resumedConversation(rows, pids) {
57
+ const ids = new Set(rows.filter(row => pids.includes(row.pid)).flatMap(row => {
58
+ const match = /^(?:(?:\S*\/)?(?:sh|bash|zsh|node)\s+)?(?:\S*\/)?codex\s+resume\s+([a-f0-9-]{36})(?:\s|$)/i.exec(row.command);
59
+ return match && sessionId.safeParse(match[1]).success ? [match[1]] : [];
60
+ }));
61
+ return ids.size === 1 ? [...ids][0] : undefined;
62
+ }
54
63
  /** True when this process runs under a Codex app-server daemon: a hook the
55
64
  * daemon ran carries the environment of the pane that started the daemon,
56
65
  * which is not the pane of the conversation it reports. */
@@ -179,7 +188,15 @@ export function assignDaemonConversation(here, self, claimed, rivals, now = Date
179
188
  if (!rivals.length) {
180
189
  const pool = after(self.start);
181
190
  const held = pool.filter(r => r.held);
182
- return (held.length ? held : pool).sort((a, b) => b.activeAt - a.activeAt)[0]?.id;
191
+ const current = (held.length ? held : pool).sort((a, b) => b.activeAt - a.activeAt)[0]?.id;
192
+ if (current)
193
+ return current;
194
+ // An explicit resume may name a conversation older than this TUI. Only
195
+ // use it when the daemon holds exactly one unclaimed conversation that
196
+ // has advanced since launch, and no other pane in this folder competes.
197
+ // A later /new above takes precedence over the stale launch arguments.
198
+ const resumed = open.filter(r => r.held && r.activeAt >= self.start && r.activeAt <= now + 60_000);
199
+ return resumed.length === 1 && resumed[0].id === self.resumed ? self.resumed : undefined;
183
200
  }
184
201
  const order = [...rivals, self].sort((a, b) => b.start - a.start || (a.key < b.key ? 1 : a.key > b.key ? -1 : 0));
185
202
  const taken = new Set();
@@ -0,0 +1,10 @@
1
+ /** Resolve a chat reference in a server-selected repository. Cwd-relative
2
+ * names win over root-relative ones. Never turn an outside absolute path
3
+ * into an unrelated in-repository suffix match. Metadata is checked by the
4
+ * same no-symlink reader that will subsequently serve the file's bytes. */
5
+ export declare function resolveFilePath(root: string, cwd: string, requested: string): Promise<{
6
+ path: string;
7
+ size: number;
8
+ contentType: string;
9
+ version: string;
10
+ }>;
@@ -0,0 +1,63 @@
1
+ import { lstat, realpath } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { readFileRange } from "./file-range.js";
4
+ import { BridgeError } from "./protocol.js";
5
+ function beneath(root, file) {
6
+ const relative = path.relative(root, file);
7
+ return relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
8
+ }
9
+ /** Resolve a chat reference in a server-selected repository. Cwd-relative
10
+ * names win over root-relative ones. Never turn an outside absolute path
11
+ * into an unrelated in-repository suffix match. Metadata is checked by the
12
+ * same no-symlink reader that will subsequently serve the file's bytes. */
13
+ export async function resolveFilePath(root, cwd, requested) {
14
+ // Native Windows references use backslashes; walk the same components as
15
+ // slash-form chat links. On POSIX a backslash remains an invalid reference.
16
+ if (process.platform === "win32")
17
+ requested = requested.replaceAll("\\", "/");
18
+ if (!requested || requested.length > 4096 || /[\x00-\x1f\x7f\\]/.test(requested)
19
+ || /^[A-Za-z]:[^/]/.test(requested)
20
+ || requested.split("/").includes(".git") || path.win32.isAbsolute(requested) && !path.isAbsolute(requested)) {
21
+ throw new BridgeError(400, "Invalid file path.");
22
+ }
23
+ const base = await realpath(root), folder = await realpath(cwd);
24
+ if (!beneath(base, folder))
25
+ throw new BridgeError(403, "This folder is outside the repository.");
26
+ // macOS /tmp is an alias of /private/tmp. Preserve a trusted cwd's root
27
+ // spelling without resolving any client-supplied symlink beneath it.
28
+ const roots = [base, path.resolve(root), path.resolve(cwd, path.relative(folder, base))]
29
+ .map(value => value.split(path.sep).join("/"));
30
+ const absolute = path.isAbsolute(requested);
31
+ const alias = roots.find(candidate => requested === candidate || requested.startsWith(candidate + "/"));
32
+ if (absolute && !alias)
33
+ throw new BridgeError(403, "This file is outside the repository.");
34
+ const candidates = absolute ? [{ start: base, name: requested.slice(alias.length) }]
35
+ : [...new Set([folder, base])].map(start => ({ start, name: requested }));
36
+ for (const candidate of candidates) {
37
+ try {
38
+ let file = candidate.start;
39
+ // Walk before normalizing '..': link/../file must not hide a symlink,
40
+ // nor may a path leave the repository and then come back into it.
41
+ for (const part of candidate.name.split("/").filter(part => part && part !== ".")) {
42
+ file = path.resolve(file, part);
43
+ if (!beneath(base, file))
44
+ throw new BridgeError(403, "This file is outside the repository.");
45
+ if ((await lstat(file)).isSymbolicLink())
46
+ throw new BridgeError(403, "Symbolic links cannot be opened.");
47
+ }
48
+ const relative = path.relative(base, file).split(path.sep).join("/");
49
+ const metadata = await readFileRange(base, relative, 0, 0);
50
+ return { path: relative, size: metadata.total, contentType: metadata.contentType, version: metadata.version };
51
+ }
52
+ catch (error) {
53
+ // Only a missing name permits a root-relative fallback. A symlink or
54
+ // other rejected cwd candidate must not silently select another file.
55
+ if (error instanceof BridgeError && error.status === 404)
56
+ continue;
57
+ if (["ENOENT", "ENOTDIR"].includes(error.code ?? ""))
58
+ continue;
59
+ throw error;
60
+ }
61
+ }
62
+ throw new BridgeError(404, "This file is no longer available.");
63
+ }
@@ -14,7 +14,7 @@ import { tabActivityKey } from "./tab-activity.js";
14
14
  import { intervalFromEnv } from "./limits.js";
15
15
  import { countHerdr, countIdentity } from "./metrics.js";
16
16
  import { phrenStoreRoot } from "./transcripts.js";
17
- import { assignDaemonConversation, daemonRollouts, processTable, sameDirectory, startedAt } from "./codex-daemon.js";
17
+ import { assignDaemonConversation, daemonRollouts, processTable, resumedConversation, sameDirectory, startedAt } from "./codex-daemon.js";
18
18
  import { codexServers } from "./codex-servers.js";
19
19
  // terminal.ts and terminal-tmux.ts import this module, so it reaches them at
20
20
  // call time; a static import back would be an import cycle.
@@ -503,7 +503,7 @@ async function codexDaemonIdentity(server, pane, pids) {
503
503
  if (peerStart !== undefined)
504
504
  rivals.push({ key: String(peer.pane_id), start: peerStart });
505
505
  }
506
- return { sessionId: assignDaemonConversation(here, { key: String(pane.pane_id), start }, claimed, rivals), known };
506
+ return { sessionId: assignDaemonConversation(here, { key: String(pane.pane_id), start, resumed: resumedConversation(rows, pids) }, claimed, rivals), known };
507
507
  }
508
508
  /** The Codex pane that shows `session`, for a lifecycle callback that ran
509
509
  * inside a Codex daemon and so cannot name its pane. Falls back to the only
@@ -95,6 +95,7 @@ export declare const capabilities: {
95
95
  providers: string[];
96
96
  files: boolean;
97
97
  repositoryFiles: boolean;
98
+ fileResolution: boolean;
98
99
  subagents: boolean;
99
100
  sideQuestions: boolean;
100
101
  dispatch: boolean;
@@ -105,6 +106,7 @@ export declare const capabilities: {
105
106
  approvalPush: string;
106
107
  simulators: boolean;
107
108
  code: boolean;
109
+ codeFiles: boolean;
108
110
  overviewStream: boolean;
109
111
  speech: boolean;
110
112
  speechTimestamps: boolean;
@@ -22,6 +22,7 @@ import { optionalHookPeers, peerRequest } from "./peers.js";
22
22
  import { candidateRepos, enrollProject } from "./enroll.js";
23
23
  import { browseFiles } from "./files.js";
24
24
  import { MAX_FILE_RANGE, rangeInteger, readFileRange } from "./file-range.js";
25
+ import { resolveFilePath } from "./file-resolve.js";
25
26
  import { storeRoute } from "./memory-store.js";
26
27
  import { liveBackground, markBackground, paneRecord, recordTitle } from "./session-activity.js";
27
28
  import { paneAccountField, paneChatState, panes, servers, snapshot, validateTarget, workspaceSnapshot } from "./herdr.js";
@@ -72,7 +73,7 @@ async function childActivity(source, session) {
72
73
  export const capabilities = { transcript: true, progress: true, images: true, prompt: true, stop: true,
73
74
  terminal: "ssh-pty", shell: "ssh-pty", herdr: true, sessionRename: true, diff: true, webServers: true, webPreview: "ssh-exec", activity: true,
74
75
  approvals: true, questions: false, accountUsage: true, providers: ["codex", "claude", "copilot", "opencode"],
75
- files: true, repositoryFiles: true, subagents: true, sideQuestions: true, dispatch: true, conductorSets: true, ownerInbox: true, workerReports: true, queuedHandOff: true, approvalPush: "direct-apns", simulators: process.platform === "darwin", code: true, overviewStream: true, speech: true, speechTimestamps: true, speechTimestampStream: true, speechLive: true, speechVoices: true, speechFormats: [...SPEECH_FORMATS], transcribe: true, memoryStore: true, promptOnce: true, promptStatus: true, deliveryFrames: true, resources: true, sudo: true, sudoOutcome: true, previewDeltas: true, quickChat: true };
76
+ files: true, repositoryFiles: true, fileResolution: true, subagents: true, sideQuestions: true, dispatch: true, conductorSets: true, ownerInbox: true, workerReports: true, queuedHandOff: true, approvalPush: "direct-apns", simulators: process.platform === "darwin", code: true, codeFiles: true, overviewStream: true, speech: true, speechTimestamps: true, speechTimestampStream: true, speechLive: true, speechVoices: true, speechFormats: [...SPEECH_FORMATS], transcribe: true, memoryStore: true, promptOnce: true, promptStatus: true, deliveryFrames: true, resources: true, sudo: true, sudoOutcome: true, previewDeltas: true, quickChat: true };
76
77
  export function capabilitiesForModules(snapshot) {
77
78
  const allowed = new Set(snapshot.modules.flatMap(module => module.capabilities));
78
79
  const result = Object.fromEntries(Object.entries(capabilities).filter(([name]) => allowed.has(name)));
@@ -403,6 +404,15 @@ export function createRouteHandler(ctx) {
403
404
  case "/v1/files":
404
405
  result = { files: await listUploads("files") };
405
406
  break;
407
+ case "/v1/files/resolve": {
408
+ const target = targetFromURL(url), pane = await validateTarget(target);
409
+ const cwd = await gitRepository(pane, target, url.searchParams.get("child") ?? undefined, url.searchParams.get("worktree") ?? undefined);
410
+ const repository = await gitRoot(cwd);
411
+ if (!repository)
412
+ throw new BridgeError(409, "This pane is not in a project repository.");
413
+ result = await resolveFilePath(repository, cwd, url.searchParams.get("path") ?? "");
414
+ break;
415
+ }
406
416
  case "/v1/files/range": {
407
417
  let root;
408
418
  if (url.searchParams.get("scope") === "uploads") {
@@ -587,6 +597,9 @@ export function createRouteHandler(ctx) {
587
597
  case "/v1/code/search":
588
598
  result = await (new CodeRoutes(await resolveCodeStore(scheduleStore, url.searchParams.get("store")))).search(url.searchParams.get("project"), url.searchParams.get("q"), url.searchParams.get("kind"), url.searchParams.get("limit"), url.searchParams.get("directory"));
589
599
  break;
600
+ case "/v1/code/files":
601
+ result = await (new CodeRoutes(await resolveCodeStore(scheduleStore, url.searchParams.get("store")))).files(url.searchParams.get("project"), url.searchParams.get("name"), url.searchParams.get("limit"));
602
+ break;
590
603
  case "/v1/code/outline-summary":
591
604
  result = await (new CodeRoutes(await resolveCodeStore(scheduleStore, url.searchParams.get("store")))).outlineSummary(url.searchParams.get("project"), url.searchParams.get("paths"));
592
605
  break;
@@ -268,10 +268,10 @@ function mergeDefs(...defs) {
268
268
  function cloneDef(schema) {
269
269
  return mergeDefs(schema._zod.def);
270
270
  }
271
- function getElementAtPath(obj, path116) {
272
- if (!path116)
271
+ function getElementAtPath(obj, path117) {
272
+ if (!path117)
273
273
  return obj;
274
- return path116.reduce((acc, key3) => acc?.[key3], obj);
274
+ return path117.reduce((acc, key3) => acc?.[key3], obj);
275
275
  }
276
276
  function promiseAllObject(promisesObj) {
277
277
  const keys = Object.keys(promisesObj);
@@ -530,11 +530,11 @@ function explicitlyAborted(x, startIndex = 0) {
530
530
  }
531
531
  return false;
532
532
  }
533
- function prefixIssues(path116, issues) {
533
+ function prefixIssues(path117, issues) {
534
534
  return issues.map((iss) => {
535
535
  var _a3;
536
536
  (_a3 = iss).path ?? (_a3.path = []);
537
- iss.path.unshift(path116);
537
+ iss.path.unshift(path117);
538
538
  return iss;
539
539
  });
540
540
  }
@@ -1055,16 +1055,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
1055
1055
  }
1056
1056
  function formatError(error62, mapper = (issue2) => issue2.message) {
1057
1057
  const fieldErrors = { _errors: [] };
1058
- const processError = (error63, path116 = []) => {
1058
+ const processError = (error63, path117 = []) => {
1059
1059
  for (const issue2 of error63.issues) {
1060
1060
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1061
- issue2.errors.map((issues) => processError({ issues }, [...path116, ...issue2.path]));
1061
+ issue2.errors.map((issues) => processError({ issues }, [...path117, ...issue2.path]));
1062
1062
  } else if (issue2.code === "invalid_key") {
1063
- processError({ issues: issue2.issues }, [...path116, ...issue2.path]);
1063
+ processError({ issues: issue2.issues }, [...path117, ...issue2.path]);
1064
1064
  } else if (issue2.code === "invalid_element") {
1065
- processError({ issues: issue2.issues }, [...path116, ...issue2.path]);
1065
+ processError({ issues: issue2.issues }, [...path117, ...issue2.path]);
1066
1066
  } else {
1067
- const fullpath = [...path116, ...issue2.path];
1067
+ const fullpath = [...path117, ...issue2.path];
1068
1068
  if (fullpath.length === 0) {
1069
1069
  fieldErrors._errors.push(mapper(issue2));
1070
1070
  } else {
@@ -1103,17 +1103,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
1103
1103
  }
1104
1104
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
1105
1105
  const result = { errors: [] };
1106
- const processError = (error63, path116 = []) => {
1106
+ const processError = (error63, path117 = []) => {
1107
1107
  var _a3;
1108
1108
  for (const issue2 of error63.issues) {
1109
1109
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1110
- issue2.errors.map((issues) => processError({ issues }, [...path116, ...issue2.path]));
1110
+ issue2.errors.map((issues) => processError({ issues }, [...path117, ...issue2.path]));
1111
1111
  } else if (issue2.code === "invalid_key") {
1112
- processError({ issues: issue2.issues }, [...path116, ...issue2.path]);
1112
+ processError({ issues: issue2.issues }, [...path117, ...issue2.path]);
1113
1113
  } else if (issue2.code === "invalid_element") {
1114
- processError({ issues: issue2.issues }, [...path116, ...issue2.path]);
1114
+ processError({ issues: issue2.issues }, [...path117, ...issue2.path]);
1115
1115
  } else {
1116
- const fullpath = [...path116, ...issue2.path];
1116
+ const fullpath = [...path117, ...issue2.path];
1117
1117
  if (fullpath.length === 0) {
1118
1118
  result.errors.push(mapper(issue2));
1119
1119
  continue;
@@ -1152,8 +1152,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1152
1152
  }
1153
1153
  function toDotPath(_path) {
1154
1154
  const segs = [];
1155
- const path116 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1156
- for (const seg of path116) {
1155
+ const path117 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1156
+ for (const seg of path117) {
1157
1157
  if (typeof seg === "number")
1158
1158
  segs.push(`[${seg}]`);
1159
1159
  else if (typeof seg === "symbol")
@@ -19149,13 +19149,13 @@ function resolveRef(ref, ctx) {
19149
19149
  if (!ref.startsWith("#")) {
19150
19150
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19151
19151
  }
19152
- const path116 = ref.slice(1).split("/").filter(Boolean);
19153
- if (path116.length === 0) {
19152
+ const path117 = ref.slice(1).split("/").filter(Boolean);
19153
+ if (path117.length === 0) {
19154
19154
  return ctx.rootSchema;
19155
19155
  }
19156
19156
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19157
- if (path116[0] === defsKey) {
19158
- const key3 = path116[1] === void 0 ? void 0 : decodeJSONPointerSegment(path116[1]);
19157
+ if (path117[0] === defsKey) {
19158
+ const key3 = path117[1] === void 0 ? void 0 : decodeJSONPointerSegment(path117[1]);
19159
19159
  if (!key3 || !ctx.defs[key3]) {
19160
19160
  throw new Error(`Reference not found: ${ref}`);
19161
19161
  }
@@ -25352,7 +25352,7 @@ var init_package_metadata = __esm({
25352
25352
  __dirname = path15.dirname(fileURLToPath2(import.meta.url));
25353
25353
  ROOT = path15.join(__dirname, "..");
25354
25354
  PACKAGE_JSON_PATH = path15.join(ROOT, "package.json");
25355
- BUNDLED_VERSION = true ? "0.3.24" : "0.0.0";
25355
+ BUNDLED_VERSION = true ? "0.3.26" : "0.0.0";
25356
25356
  PACKAGE_JSON = readPackageJson();
25357
25357
  PACKAGE_NAME = PACKAGE_JSON.name || "phren";
25358
25358
  VERSION = PACKAGE_JSON.version || BUNDLED_VERSION;
@@ -29492,6 +29492,13 @@ function startedAt(rows, pids) {
29492
29492
  const times = rows.filter((row) => pids.includes(row.pid)).map((row) => row.startedAt);
29493
29493
  return times.length ? Math.min(...times) : void 0;
29494
29494
  }
29495
+ function resumedConversation(rows, pids) {
29496
+ const ids = new Set(rows.filter((row) => pids.includes(row.pid)).flatMap((row) => {
29497
+ const match = /^(?:(?:\S*\/)?(?:sh|bash|zsh|node)\s+)?(?:\S*\/)?codex\s+resume\s+([a-f0-9-]{36})(?:\s|$)/i.exec(row.command);
29498
+ return match && sessionId.safeParse(match[1]).success ? [match[1]] : [];
29499
+ }));
29500
+ return ids.size === 1 ? [...ids][0] : void 0;
29501
+ }
29495
29502
  async function underCodexDaemon(env = process.env, pid = process.pid) {
29496
29503
  if (env.CODEX_INTERNAL_APP_SERVER_REMOTE_CONTROL_DISABLED !== void 0) return true;
29497
29504
  if (process.platform === "win32") return false;
@@ -29585,7 +29592,10 @@ function assignDaemonConversation(here, self, claimed, rivals, now = Date.now())
29585
29592
  if (!rivals.length) {
29586
29593
  const pool2 = after(self.start);
29587
29594
  const held = pool2.filter((r) => r.held);
29588
- return (held.length ? held : pool2).sort((a, b) => b.activeAt - a.activeAt)[0]?.id;
29595
+ const current2 = (held.length ? held : pool2).sort((a, b) => b.activeAt - a.activeAt)[0]?.id;
29596
+ if (current2) return current2;
29597
+ const resumed = open25.filter((r) => r.held && r.activeAt >= self.start && r.activeAt <= now + 6e4);
29598
+ return resumed.length === 1 && resumed[0].id === self.resumed ? self.resumed : void 0;
29589
29599
  }
29590
29600
  const order = [...rivals, self].sort((a, b) => b.start - a.start || (a.key < b.key ? 1 : a.key > b.key ? -1 : 0));
29591
29601
  const taken = /* @__PURE__ */ new Set();
@@ -36018,7 +36028,7 @@ async function codexDaemonIdentity(server, pane, pids) {
36018
36028
  const peerStart = startedAt(rows, peerPids);
36019
36029
  if (peerStart !== void 0) rivals.push({ key: String(peer.pane_id), start: peerStart });
36020
36030
  }
36021
- return { sessionId: assignDaemonConversation(here, { key: String(pane.pane_id), start }, claimed, rivals), known: known2 };
36031
+ return { sessionId: assignDaemonConversation(here, { key: String(pane.pane_id), start, resumed: resumedConversation(rows, pids) }, claimed, rivals), known: known2 };
36022
36032
  }
36023
36033
  async function paneForCodexSession(server, session, cwd) {
36024
36034
  const s = await snapshot(server);
@@ -37556,7 +37566,7 @@ import * as fs17 from "node:fs";
37556
37566
  import * as path16 from "node:path";
37557
37567
  var core = (names) => names.map((name) => ({ name, profiles: ["core", "full"] }));
37558
37568
  var full = (names) => names.map((name) => ({ name, profiles: ["full"] }));
37559
- var routes = (method, paths) => paths.map((path116) => ({ method, path: path116 }));
37569
+ var routes = (method, paths) => paths.map((path117) => ({ method, path: path117 }));
37560
37570
  var BUILTIN_MODULES = [
37561
37571
  {
37562
37572
  schemaVersion: 1,
@@ -37784,6 +37794,7 @@ var BUILTIN_MODULES = [
37784
37794
  "/v1/projects/files",
37785
37795
  "/v1/uploads/image",
37786
37796
  "/v1/files/range",
37797
+ "/v1/files/resolve",
37787
37798
  "/v1/usage",
37788
37799
  "/v1/resources",
37789
37800
  "/v1/speech/voices",
@@ -37851,6 +37862,7 @@ var BUILTIN_MODULES = [
37851
37862
  "providers",
37852
37863
  "files",
37853
37864
  "repositoryFiles",
37865
+ "fileResolution",
37854
37866
  "subagents",
37855
37867
  "sideQuestions",
37856
37868
  "approvalPush",
@@ -37973,8 +37985,8 @@ var BUILTIN_MODULES = [
37973
37985
  tools: full(["code_search", "code_definition", "code_references", "code_outline", "code_usage"]),
37974
37986
  cliCommands: ["code index", "code status", "code search", "code outline", "code refs", "code def", "code usage"],
37975
37987
  agentHooks: [],
37976
- hookRoutes: [...routes("GET", ["/v1/code/tree", "/v1/code/usage-page", "/v1/code/changed", "/v1/code/change-counts", "/v1/code/status", "/v1/code/search", "/v1/code/outline", "/v1/code/outline-summary", "/v1/code/file-references", "/v1/code/definition", "/v1/code/references", "/v1/code/usage"]), ...routes("POST", ["/v1/code/note", "/v1/code/reindex", "/v1/code/disable"])],
37977
- capabilities: ["code"],
37988
+ hookRoutes: [...routes("GET", ["/v1/code/tree", "/v1/code/usage-page", "/v1/code/changed", "/v1/code/change-counts", "/v1/code/status", "/v1/code/search", "/v1/code/files", "/v1/code/outline", "/v1/code/outline-summary", "/v1/code/file-references", "/v1/code/definition", "/v1/code/references", "/v1/code/usage"]), ...routes("POST", ["/v1/code/note", "/v1/code/reindex", "/v1/code/disable"])],
37989
+ capabilities: ["code", "codeFiles"],
37978
37990
  storeFiles: [],
37979
37991
  localFiles: ["<store>/.runtime/code/*.sqlite"],
37980
37992
  phoneScreens: [{ screen: "CodeView", capability: "code" }],
@@ -41154,10 +41166,10 @@ function projectAgents(values, parent, receipt, fallbackComputer, fallbackTarget
41154
41166
  for (const value2 of values.slice(0, 128)) {
41155
41167
  if (state.count >= 128) break;
41156
41168
  const raw = object2(value2), id2 = childID.safeParse(raw.id), source = provider.safeParse(raw.provider);
41157
- const path116 = publicLabel(raw.path);
41169
+ const path117 = publicLabel(raw.path);
41158
41170
  const callId = typeof raw.callId === "string" && raw.callId.length > 0 && raw.callId.length <= 200 ? raw.callId : void 0;
41159
41171
  const routed = destination(raw, fallbackComputer, fallbackTarget);
41160
- if (!id2.success || !source.success || !path116 || !callId || !routed) continue;
41172
+ if (!id2.success || !source.success || !path117 || !callId || !routed) continue;
41161
41173
  const descendant = lineage ? `${lineage}/${id2.data}` : id2.data;
41162
41174
  const nestedSession = sessionId.safeParse(raw.session);
41163
41175
  const cycleIdentity = nestedSession.success ? nestedSession.data : routed.remote.child ?? routed.remote.target.session;
@@ -41170,7 +41182,7 @@ function projectAgents(values, parent, receipt, fallbackComputer, fallbackTarget
41170
41182
  projected.push({
41171
41183
  id: publicID(parent, routed.computer.id, receipt.id, descendant),
41172
41184
  provider: source.data,
41173
- path: path116,
41185
+ path: path117,
41174
41186
  callId,
41175
41187
  state: raw.failed === true ? "failed" : childState,
41176
41188
  ...typeof raw.finishedAt === "string" && Number.isFinite(Date.parse(raw.finishedAt)) ? { finishedAt: raw.finishedAt } : {},
@@ -51164,11 +51176,11 @@ var FanoutMessages = class {
51164
51176
  // src/bridge/server.ts
51165
51177
  init_wrapper();
51166
51178
  import { randomUUID as randomUUID26 } from "node:crypto";
51167
- import { chmod as chmod6, lstat as lstat32, mkdir as mkdir30, readFile as readFile52, rm as rm15, unlink as unlink10, writeFile as writeFile12 } from "node:fs/promises";
51179
+ import { chmod as chmod6, lstat as lstat33, mkdir as mkdir30, readFile as readFile52, rm as rm15, unlink as unlink10, writeFile as writeFile12 } from "node:fs/promises";
51168
51180
  import { readFileSync as readFileSync37 } from "node:fs";
51169
51181
  import { createServer as createServer3 } from "node:http";
51170
51182
  import { cpus as cpus2, hostname as hostname12, loadavg as loadavg2 } from "node:os";
51171
- import path114 from "node:path";
51183
+ import path115 from "node:path";
51172
51184
 
51173
51185
  // src/bridge/speech-live.ts
51174
51186
  init_wrapper();
@@ -51631,8 +51643,8 @@ function relayLiveSpeech(client, query, options = {}) {
51631
51643
  params.set("auto_mode", "true");
51632
51644
  params.set("inactivity_timeout", "180");
51633
51645
  }
51634
- const path116 = endpoint === "dialogue" ? "/v1/text-to-dialogue/stream-input" : `/v1/text-to-speech/${encodeURIComponent(voice)}/stream-input`;
51635
- const socket = connect4(`${origin}${path116}?${params}`, key3);
51646
+ const path117 = endpoint === "dialogue" ? "/v1/text-to-dialogue/stream-input" : `/v1/text-to-speech/${encodeURIComponent(voice)}/stream-input`;
51647
+ const socket = connect4(`${origin}${path117}?${params}`, key3);
51636
51648
  upstream = socket;
51637
51649
  const current2 = () => upstream === socket && !closed;
51638
51650
  let voiced = false, firstAudio;
@@ -52149,6 +52161,34 @@ var CodeRoutes = class {
52149
52161
  this.store = store;
52150
52162
  }
52151
52163
  store;
52164
+ /** A filename need not resemble a symbol declared inside it. Query the
52165
+ * index's files table through @phren/code's existing public read API so
52166
+ * installed optional packages need no new export to serve this route. */
52167
+ async files(projectValue, nameValue, limitValue) {
52168
+ const project = projectSchema.parse(projectValue ?? "");
52169
+ const name = relativePathSchema.refine((value2) => !/[\x00-\x1f\x7f]/.test(value2) && !value2.split("/").includes(".git")).parse(nameValue ?? "");
52170
+ const limit = limitValue ? topSchema.parse(limitValue) : 20;
52171
+ const code = await requireCodePackage(this.store);
52172
+ const database = await code.openCodeDatabase(this.store, project, false);
52173
+ if (!database) throw noIndex(project);
52174
+ try {
52175
+ const suffix = "/" + name;
52176
+ const rows = code.rowsOf(
52177
+ database.db,
52178
+ `SELECT path, language FROM files WHERE path = ? OR substr(path, -?) = ?
52179
+ ORDER BY CASE WHEN path = ? THEN 0 ELSE 1 END, length(path), path LIMIT ?`,
52180
+ [name, [...suffix].length, suffix, name, limit + 1]
52181
+ );
52182
+ return {
52183
+ project,
52184
+ name,
52185
+ files: rows.slice(0, limit).map((row) => ({ path: code.stringAt(row, 0), language: code.stringAt(row, 1) })),
52186
+ truncated: rows.length > limit
52187
+ };
52188
+ } finally {
52189
+ database.close();
52190
+ }
52191
+ }
52152
52192
  async status(projectValue) {
52153
52193
  const project = projectSchema.parse(projectValue ?? "");
52154
52194
  const result = await (await requireCodePackage(this.store)).codeIndexStatus(this.store, project);
@@ -52316,7 +52356,7 @@ var CodeRoutes = class {
52316
52356
  const project = projectSchema.parse(projectValue ?? "");
52317
52357
  const { codeDatabasePath } = await requireCodePackage(this.store);
52318
52358
  const file3 = codeDatabasePath(this.store, project);
52319
- await Promise.all([file3, `${file3}-journal`, `${file3}-wal`, `${file3}-shm`].map((path116) => rm11(path116, { force: true })));
52359
+ await Promise.all([file3, `${file3}-journal`, `${file3}-wal`, `${file3}-shm`].map((path117) => rm11(path117, { force: true })));
52320
52360
  return { project, disabled: true };
52321
52361
  }
52322
52362
  async reindex(projectValue) {
@@ -53925,7 +53965,7 @@ async function ownerInboxView(inbox, input2, localOnly = false) {
53925
53965
 
53926
53966
  // src/bridge/server-routes.ts
53927
53967
  init_zod();
53928
- import path112 from "node:path";
53968
+ import path113 from "node:path";
53929
53969
 
53930
53970
  // src/bridge/code-note.ts
53931
53971
  init_zod();
@@ -57522,13 +57562,53 @@ async function readFileRange(root, requested, offset, length, expectedVersion) {
57522
57562
  }
57523
57563
  }
57524
57564
 
57565
+ // src/bridge/file-resolve.ts
57566
+ import { lstat as lstat31, realpath as realpath18 } from "node:fs/promises";
57567
+ import path106 from "node:path";
57568
+ init_protocol();
57569
+ function beneath(root, file3) {
57570
+ const relative3 = path106.relative(root, file3);
57571
+ return relative3 !== ".." && !relative3.startsWith(`..${path106.sep}`) && !path106.isAbsolute(relative3);
57572
+ }
57573
+ async function resolveFilePath(root, cwd, requested) {
57574
+ if (process.platform === "win32") requested = requested.replaceAll("\\", "/");
57575
+ if (!requested || requested.length > 4096 || /[\x00-\x1f\x7f\\]/.test(requested) || /^[A-Za-z]:[^/]/.test(requested) || requested.split("/").includes(".git") || path106.win32.isAbsolute(requested) && !path106.isAbsolute(requested)) {
57576
+ throw new BridgeError(400, "Invalid file path.");
57577
+ }
57578
+ const base = await realpath18(root), folder = await realpath18(cwd);
57579
+ if (!beneath(base, folder)) throw new BridgeError(403, "This folder is outside the repository.");
57580
+ const roots = [base, path106.resolve(root), path106.resolve(cwd, path106.relative(folder, base))].map((value2) => value2.split(path106.sep).join("/"));
57581
+ const absolute = path106.isAbsolute(requested);
57582
+ const alias = roots.find((candidate) => requested === candidate || requested.startsWith(candidate + "/"));
57583
+ if (absolute && !alias) throw new BridgeError(403, "This file is outside the repository.");
57584
+ const candidates = absolute ? [{ start: base, name: requested.slice(alias.length) }] : [.../* @__PURE__ */ new Set([folder, base])].map((start) => ({ start, name: requested }));
57585
+ for (const candidate of candidates) {
57586
+ try {
57587
+ let file3 = candidate.start;
57588
+ for (const part of candidate.name.split("/").filter((part2) => part2 && part2 !== ".")) {
57589
+ file3 = path106.resolve(file3, part);
57590
+ if (!beneath(base, file3)) throw new BridgeError(403, "This file is outside the repository.");
57591
+ if ((await lstat31(file3)).isSymbolicLink()) throw new BridgeError(403, "Symbolic links cannot be opened.");
57592
+ }
57593
+ const relative3 = path106.relative(base, file3).split(path106.sep).join("/");
57594
+ const metadata = await readFileRange(base, relative3, 0, 0);
57595
+ return { path: relative3, size: metadata.total, contentType: metadata.contentType, version: metadata.version };
57596
+ } catch (error62) {
57597
+ if (error62 instanceof BridgeError && error62.status === 404) continue;
57598
+ if (["ENOENT", "ENOTDIR"].includes(error62.code ?? "")) continue;
57599
+ throw error62;
57600
+ }
57601
+ }
57602
+ throw new BridgeError(404, "This file is no longer available.");
57603
+ }
57604
+
57525
57605
  // src/bridge/memory-store.ts
57526
57606
  init_zod();
57527
57607
  init_protocol();
57528
57608
  import { execFile as execFile20 } from "node:child_process";
57529
57609
  import { createHash as createHash26 } from "node:crypto";
57530
- import { lstat as lstat31, mkdir as mkdir26, readFile as readFile48, realpath as realpath18, rename as rename9, rm as rm13, writeFile as writeFile10 } from "node:fs/promises";
57531
- import path106 from "node:path";
57610
+ import { lstat as lstat32, mkdir as mkdir26, readFile as readFile48, realpath as realpath19, rename as rename9, rm as rm13, writeFile as writeFile10 } from "node:fs/promises";
57611
+ import path107 from "node:path";
57532
57612
  import { promisify as promisify19 } from "node:util";
57533
57613
  var exec19 = promisify19(execFile20);
57534
57614
  var SHA = /^[0-9a-f]{40}$/;
@@ -57556,7 +57636,7 @@ function blobSha(content) {
57556
57636
  return createHash26("sha1").update(`blob ${content.length}\0`).update(content).digest("hex");
57557
57637
  }
57558
57638
  async function isRepository2(store) {
57559
- return await lstat31(path106.join(store, ".git")).catch(() => void 0) !== void 0;
57639
+ return await lstat32(path107.join(store, ".git")).catch(() => void 0) !== void 0;
57560
57640
  }
57561
57641
  function githubStoreRepository(remote) {
57562
57642
  let host, pathname;
@@ -57586,12 +57666,12 @@ async function storeRepositoryIdentity(store) {
57586
57666
  const repository3 = githubStoreRepository(remote);
57587
57667
  return repository3 && branch.trim() ? { repository: repository3, branch: branch.trim() } : void 0;
57588
57668
  }
57589
- function storeHead(store, indexFile = path106.join(bridgeRoot(), "store-snapshot.index")) {
57669
+ function storeHead(store, indexFile = path107.join(bridgeRoot(), "store-snapshot.index")) {
57590
57670
  return serialized2(async () => {
57591
57671
  if (!await isRepository2(store)) throw new BridgeError(409, "This computer's phren store is not a git repository. Run phren init.");
57592
- await mkdir26(path106.dirname(indexFile), { recursive: true, mode: 448 });
57672
+ await mkdir26(path107.dirname(indexFile), { recursive: true, mode: 448 });
57593
57673
  const env = { GIT_INDEX_FILE: indexFile };
57594
- if (!await lstat31(indexFile).catch(() => void 0)) {
57674
+ if (!await lstat32(indexFile).catch(() => void 0)) {
57595
57675
  const head = await git5(store, ["rev-parse", "--verify", "--quiet", "HEAD"]).catch(() => "");
57596
57676
  await git5(store, head.trim() ? ["read-tree", "HEAD"] : ["read-tree", "--empty"], env);
57597
57677
  }
@@ -57624,22 +57704,22 @@ async function storeBlob(store, sha) {
57624
57704
  return { sha, encoding: "base64", content: stdout.toString("base64") };
57625
57705
  }
57626
57706
  async function storeFile(store, relative3) {
57627
- const normalized = path106.posix.normalize(relative3);
57628
- if (!relative3 || relative3 !== normalized || normalized.startsWith("../") || normalized === ".." || path106.posix.isAbsolute(normalized) || normalized.split("/").some((part) => part === ".git" || part === "" || part === ".") || /[\0\r\n]/.test(normalized)) {
57707
+ const normalized = path107.posix.normalize(relative3);
57708
+ if (!relative3 || relative3 !== normalized || normalized.startsWith("../") || normalized === ".." || path107.posix.isAbsolute(normalized) || normalized.split("/").some((part) => part === ".git" || part === "" || part === ".") || /[\0\r\n]/.test(normalized)) {
57629
57709
  throw new BridgeError(400, "Invalid store path.");
57630
57710
  }
57631
- const root = await realpath18(store);
57632
- let parent = path106.dirname(path106.join(root, normalized));
57711
+ const root = await realpath19(store);
57712
+ let parent = path107.dirname(path107.join(root, normalized));
57633
57713
  for (; ; ) {
57634
- const real2 = await realpath18(parent).catch(() => void 0);
57714
+ const real2 = await realpath19(parent).catch(() => void 0);
57635
57715
  if (real2) {
57636
- if (real2 !== root && !real2.startsWith(root + path106.sep)) throw new BridgeError(400, "Invalid store path.");
57716
+ if (real2 !== root && !real2.startsWith(root + path107.sep)) throw new BridgeError(400, "Invalid store path.");
57637
57717
  break;
57638
57718
  }
57639
- parent = path106.dirname(parent);
57719
+ parent = path107.dirname(parent);
57640
57720
  }
57641
- const file3 = path106.join(root, normalized);
57642
- const info = await lstat31(file3).catch(() => void 0);
57721
+ const file3 = path107.join(root, normalized);
57722
+ const info = await lstat32(file3).catch(() => void 0);
57643
57723
  if (info && !info.isFile()) throw new BridgeError(400, "Invalid store path.");
57644
57724
  return file3;
57645
57725
  }
@@ -57659,7 +57739,7 @@ function putStoreFile(store, data) {
57659
57739
  return serialized2(async () => {
57660
57740
  const file3 = await storeFile(store, input2.path);
57661
57741
  if (await currentSha(file3) !== (input2.sha ?? null)) throw new BridgeError(409, `${input2.path} changed on this computer.`);
57662
- await mkdir26(path106.dirname(file3), { recursive: true });
57742
+ await mkdir26(path107.dirname(file3), { recursive: true });
57663
57743
  const temporary = `${file3}.phren-${process.pid}-${Date.now()}`;
57664
57744
  await writeFile10(temporary, content, { flag: "wx" });
57665
57745
  await rename9(temporary, file3);
@@ -57695,7 +57775,7 @@ init_protocol();
57695
57775
  import { execFile as execFile21 } from "node:child_process";
57696
57776
  import { chmod as chmod5, mkdir as mkdir27, readFile as readFile49, rename as rename10, stat as stat27, unlink as unlink9, writeFile as writeFile11 } from "node:fs/promises";
57697
57777
  import { tmpdir as tmpdir4 } from "node:os";
57698
- import path107 from "node:path";
57778
+ import path108 from "node:path";
57699
57779
  import { createHash as createHash27, randomUUID as randomUUID25 } from "node:crypto";
57700
57780
  import { promisify as promisify20 } from "node:util";
57701
57781
  var exec20 = promisify20(execFile21);
@@ -57723,7 +57803,7 @@ async function bootedSimulators() {
57723
57803
  async function simulatorScreenshot(udid) {
57724
57804
  if (!UDID.test(udid)) throw new BridgeError(400, "Invalid simulator identifier.");
57725
57805
  if (process.platform !== "darwin") throw new BridgeError(404, "Simulators run on macOS only.");
57726
- const file3 = path107.join(tmpdir4(), `phren-sim-${randomUUID25()}.png`);
57806
+ const file3 = path108.join(tmpdir4(), `phren-sim-${randomUUID25()}.png`);
57727
57807
  try {
57728
57808
  await exec20("/usr/bin/xcrun", ["simctl", "io", udid, "screenshot", "--type=png", file3], { timeout: 15e3 });
57729
57809
  return await readFile49(file3);
@@ -57742,14 +57822,14 @@ function helper() {
57742
57822
  return building;
57743
57823
  }
57744
57824
  async function buildHelper() {
57745
- const dir = path107.join(bridgeRoot(), "native");
57746
- const binary = path107.join(dir, "simtap");
57825
+ const dir = path108.join(bridgeRoot(), "native");
57826
+ const binary = path108.join(dir, "simtap");
57747
57827
  const code = true ? '// Touches and keys for the iOS Simulator, without AppleScript: the window\n// is found through the Accessibility API and events are posted with CGEvent,\n// so one Accessibility grant for this helper is all macOS asks for.\n// Built on demand by Phren Hook with swiftc; see simulators.ts.\nimport ApplicationServices\nimport Cocoa\n\nfunc fail(_ code: Int32, _ message: String) -> Never { FileHandle.standardError.write((message + "\\n").data(using: .utf8)!); exit(code) }\n\nlet args = CommandLine.arguments\nguard args.count >= 3 else { fail(2, "usage: simtap <window-title-prefix> tap <fx> <fy> | key <keycode> [cmd] [shift] | type <text> | raise") }\nlet prefix = args[1], command = args[2]\n\nguard AXIsProcessTrusted() else { fail(3, "accessibility") }\nguard let app = NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.iphonesimulator").first else { fail(4, "Simulator is not running") }\nlet element = AXUIElementCreateApplication(app.processIdentifier)\nvar windowsRef: CFTypeRef?\nAXUIElementCopyAttributeValue(element, kAXWindowsAttribute as CFString, &windowsRef)\nlet windows = (windowsRef as? [AXUIElement]) ?? []\nvar target: AXUIElement?\nfor window in windows {\n var titleRef: CFTypeRef?\n AXUIElementCopyAttributeValue(window, kAXTitleAttribute as CFString, &titleRef)\n if let title = titleRef as? String, title.hasPrefix(prefix + " ") || title == prefix { target = window; break }\n}\nguard let window = target else { fail(5, "no window for \\(prefix)") }\n\nfunc frame(_ window: AXUIElement) -> CGRect {\n var posRef: CFTypeRef?, sizeRef: CFTypeRef?\n AXUIElementCopyAttributeValue(window, kAXPositionAttribute as CFString, &posRef)\n AXUIElementCopyAttributeValue(window, kAXSizeAttribute as CFString, &sizeRef)\n var pos = CGPoint.zero, size = CGSize.zero\n if let p = posRef { AXValueGetValue(p as! AXValue, .cgPoint, &pos) }\n if let s = sizeRef { AXValueGetValue(s as! AXValue, .cgSize, &size) }\n return CGRect(origin: pos, size: size)\n}\nfunc raise() {\n app.activate(options: [])\n AXUIElementPerformAction(window, kAXRaiseAction as CFString)\n usleep(120_000)\n}\nfunc post(_ event: CGEvent?) {\n guard NSWorkspace.shared.frontmostApplication?.processIdentifier == app.processIdentifier else { fail(6, "focus lost") }\n event?.postToPid(app.processIdentifier)\n usleep(40_000)\n}\n\nswitch command {\ncase "raise": raise()\ncase "tap":\n guard args.count >= 5, let fx = Double(args[3]), let fy = Double(args[4]) else { fail(2, "tap needs fx fy") }\n raise()\n let f = frame(window)\n // The device screen fills the window below its title bar.\n let titleBar: CGFloat = 28\n let point = CGPoint(x: f.origin.x + CGFloat(fx) * f.width, y: f.origin.y + titleBar + CGFloat(fy) * (f.height - titleBar))\n post(CGEvent(mouseEventSource: nil, mouseType: .mouseMoved, mouseCursorPosition: point, mouseButton: .left))\n post(CGEvent(mouseEventSource: nil, mouseType: .leftMouseDown, mouseCursorPosition: point, mouseButton: .left))\n post(CGEvent(mouseEventSource: nil, mouseType: .leftMouseUp, mouseCursorPosition: point, mouseButton: .left))\ncase "key":\n guard args.count >= 4, let code = UInt16(args[3]) else { fail(2, "key needs a keycode") }\n raise()\n var flags: CGEventFlags = []\n if args.contains("cmd") { flags.insert(.maskCommand) }\n if args.contains("shift") { flags.insert(.maskShift) }\n let down = CGEvent(keyboardEventSource: nil, virtualKey: code, keyDown: true), up = CGEvent(keyboardEventSource: nil, virtualKey: code, keyDown: false)\n down?.flags = flags; up?.flags = flags\n post(down); post(up)\ncase "type":\n guard args.count >= 4, !args[3].isEmpty, args[3].utf16.count <= 500 else { fail(2, "type needs at most 500 characters") }\n let submit = args.count == 5 && args[4] == "submit"\n guard args[3].unicodeScalars.allSatisfy({ scalar in\n (scalar.value >= 32 && scalar.value != 127) || (scalar.value == 10 && submit)\n }) else { fail(2, "invalid type controls; newline needs submit") }\n raise()\n for scalar in args[3].unicodeScalars {\n var chars = Array(String(scalar).utf16)\n let down = CGEvent(keyboardEventSource: nil, virtualKey: 0, keyDown: true), up = CGEvent(keyboardEventSource: nil, virtualKey: 0, keyDown: false)\n down?.keyboardSetUnicodeString(stringLength: chars.count, unicodeString: &chars)\n up?.keyboardSetUnicodeString(stringLength: chars.count, unicodeString: &chars)\n post(down); post(up)\n }\ndefault: fail(2, "unknown command \\(command)")\n}\n' : await readFile49(new URL("./native/simtap.swift", import.meta.url), "utf8");
57748
57828
  const digest2 = createHash27("sha256").update(code).digest("hex");
57749
57829
  const saved = await readFile49(binary + ".sha256", "utf8").then(JSON.parse).catch(() => void 0);
57750
57830
  if (await stat27(binary).catch(() => void 0) && saved?.sourceSha === digest2) return binary;
57751
57831
  await mkdir27(dir, { recursive: true, mode: 448 });
57752
- const temporary = path107.join(dir, `simtap.${randomUUID25()}`), source = temporary + ".swift";
57832
+ const temporary = path108.join(dir, `simtap.${randomUUID25()}`), source = temporary + ".swift";
57753
57833
  const sidecar = temporary + ".sha256";
57754
57834
  try {
57755
57835
  await writeFile11(source, code, { mode: 384, flag: "wx" });
@@ -57862,7 +57942,7 @@ init_transcripts();
57862
57942
  init_transcript_index();
57863
57943
  init_transcripts();
57864
57944
  import { homedir as homedir20, tmpdir as tmpdir5 } from "node:os";
57865
- import path108 from "node:path";
57945
+ import path109 from "node:path";
57866
57946
  init_protocol();
57867
57947
  var cache = /* @__PURE__ */ new Map();
57868
57948
  var modelCache = /* @__PURE__ */ new Map();
@@ -58000,7 +58080,7 @@ function describe3(tool, args) {
58000
58080
  return "";
58001
58081
  };
58002
58082
  const firstLine = (v) => v.split(/\r?\n/).map((l) => l.trim()).find((l) => l) ?? "";
58003
- const base = (v) => path108.basename(v.split(" \xB7 ")[0].trim()) || "file";
58083
+ const base = (v) => path109.basename(v.split(" \xB7 ")[0].trim()) || "file";
58004
58084
  const name = tool.toLowerCase();
58005
58085
  let value2;
58006
58086
  if (["bash", "shell", "exec_command", "exec", "parallel", "tools", "write_stdin", "container.exec"].includes(name)) {
@@ -58040,7 +58120,7 @@ init_terminal_text();
58040
58120
  init_codex_servers();
58041
58121
  init_herdr();
58042
58122
  import { open as open23 } from "node:fs/promises";
58043
- import path109 from "node:path";
58123
+ import path110 from "node:path";
58044
58124
  init_protocol();
58045
58125
  init_terminal();
58046
58126
  init_terminal_choice();
@@ -58101,7 +58181,7 @@ var defaultRenameDeps = {
58101
58181
  return text4 === void 0 ? void 0 : lastCustomTitle(text4);
58102
58182
  },
58103
58183
  async codexIndexTitle(thread) {
58104
- const text4 = await tail(path109.join(codexHome(), "session_index.jsonl"));
58184
+ const text4 = await tail(path110.join(codexHome(), "session_index.jsonl"));
58105
58185
  return text4 === void 0 ? void 0 : lastIndexedName(text4, thread);
58106
58186
  },
58107
58187
  sleep: (ms) => new Promise((resolve11) => setTimeout(resolve11, ms)),
@@ -58195,15 +58275,15 @@ init_terminal();
58195
58275
  init_terminal_tmux();
58196
58276
  init_limits();
58197
58277
  import { mkdir as mkdir29, readFile as readFile50 } from "node:fs/promises";
58198
- import path111 from "node:path";
58278
+ import path112 from "node:path";
58199
58279
 
58200
58280
  // src/bridge/launch-worktree.ts
58201
58281
  init_zod();
58202
58282
  init_utils_helpers();
58203
58283
  init_metrics();
58204
58284
  import { execFile as execFile22 } from "node:child_process";
58205
- import { mkdir as mkdir28, realpath as realpath19, rm as rm14, stat as stat28 } from "node:fs/promises";
58206
- import path110 from "node:path";
58285
+ import { mkdir as mkdir28, realpath as realpath20, rm as rm14, stat as stat28 } from "node:fs/promises";
58286
+ import path111 from "node:path";
58207
58287
  import { promisify as promisify21 } from "node:util";
58208
58288
  init_protocol();
58209
58289
  var exec21 = promisify21(execFile22);
@@ -58232,20 +58312,20 @@ async function createLaunchWorktree(cwd, request9) {
58232
58312
  if (await git6(root, "show-ref", "--verify", "--quiet", `refs/heads/${branch}`).then(() => true, () => false)) {
58233
58313
  throw new BridgeError(409, `A branch named "${branch}" already exists in this repository. Choose another branch name.`);
58234
58314
  }
58235
- const worktree = path110.join(root, ".claude", "worktrees", worktreeFolderName(branch));
58315
+ const worktree = path111.join(root, ".claude", "worktrees", worktreeFolderName(branch));
58236
58316
  if (await stat28(worktree).then(() => true, () => false)) {
58237
58317
  throw new BridgeError(409, `The folder .claude/worktrees/${worktreeFolderName(branch)} already exists. Choose another branch name.`);
58238
58318
  }
58239
- await mkdir28(path110.dirname(worktree), { recursive: true });
58319
+ await mkdir28(path111.dirname(worktree), { recursive: true });
58240
58320
  try {
58241
58321
  await git6(root, "worktree", "add", "-b", branch, worktree, head);
58242
58322
  } catch (error62) {
58243
58323
  const detail = error62 instanceof Error && "stderr" in error62 ? String(error62.stderr ?? "").trim().split("\n").at(-1) : "";
58244
58324
  throw new BridgeError(409, `Git could not create the worktree${detail ? `: ${detail.replace(/^fatal:\s*/, "")}` : "."}`);
58245
58325
  }
58246
- const abs = await realpath19(worktree);
58247
- const inside = path110.relative(root, await realpath19(cwd));
58248
- const start = inside && !inside.startsWith("..") ? path110.join(abs, inside) : abs;
58326
+ const abs = await realpath20(worktree);
58327
+ const inside = path111.relative(root, await realpath20(cwd));
58328
+ const start = inside && !inside.startsWith("..") ? path111.join(abs, inside) : abs;
58249
58329
  const startDir = await stat28(start).then((value2) => value2.isDirectory(), () => false) ? start : abs;
58250
58330
  return {
58251
58331
  cwd: startDir,
@@ -58288,7 +58368,7 @@ async function phrenLaunchArgs(kind, data, store = phrenStoreRoot()) {
58288
58368
  return [...mode === "chat" ? ["--mode", "chat"] : [], ...resume ? ["--session", resume] : []];
58289
58369
  }
58290
58370
  async function sessionUsedTools(session, store = phrenStoreRoot()) {
58291
- const raw = await readFile50(path111.join(store, ".sessions", `session-${session}.events.jsonl`), "utf8").catch(() => "");
58371
+ const raw = await readFile50(path112.join(store, ".sessions", `session-${session}.events.jsonl`), "utf8").catch(() => "");
58292
58372
  const withTools = (message) => {
58293
58373
  const content = message?.content;
58294
58374
  return Array.isArray(content) && content.some((block) => ["tool_use", "tool_result"].includes(String(block?.type)));
@@ -58320,8 +58400,8 @@ async function prepareConductor(kind, effort, model) {
58320
58400
  if (kind === "claude") return [...model ? ["--model", model] : [], "--append-system-prompt-file", briefFile, "--effort", effort];
58321
58401
  if (kind === "codex") return [...model ? ["--model", model] : [], "-c", `model_reasoning_effort=${effort}`, "-c", `developer_instructions=${JSON.stringify(brief)}`];
58322
58402
  if (kind === "opencode") {
58323
- const directory = path111.join(process.env.XDG_CONFIG_HOME || path111.join(homeDir(), ".config"), "opencode", "agents");
58324
- const file3 = path111.join(directory, "conductor.md");
58403
+ const directory = path112.join(process.env.XDG_CONFIG_HOME || path112.join(homeDir(), ".config"), "opencode", "agents");
58404
+ const file3 = path112.join(directory, "conductor.md");
58325
58405
  const definition = `---
58326
58406
  description: Coordinate the owner's work across agent sessions.
58327
58407
  mode: primary
@@ -58457,7 +58537,7 @@ async function stillListed(server, result) {
58457
58537
  }
58458
58538
  async function startSession(server, data, options) {
58459
58539
  const role = external_exports.enum(["agent", "conductor"]).default("agent").parse(data.role);
58460
- const projectDirectory = external_exports.string().min(1).max(4096).refine((t) => path111.isAbsolute(t) && !/[\x00-\x1f\x7f]/.test(t)).parse(data.cwd);
58540
+ const projectDirectory = external_exports.string().min(1).max(4096).refine((t) => path112.isAbsolute(t) && !/[\x00-\x1f\x7f]/.test(t)).parse(data.cwd);
58461
58541
  const worktreeRequest = data.worktree === void 0 || data.worktree === null ? void 0 : launchWorktreeSchema.parse(data.worktree);
58462
58542
  if (worktreeRequest && role === "conductor") throw new BridgeError(400, "A conductor works across projects, so it cannot start in a worktree.");
58463
58543
  const label2 = plainText(200).parse(data.label);
@@ -58643,7 +58723,7 @@ async function workspaceAction(server, operation, data) {
58643
58723
  if (tab && !objects(s.tabs).some((t) => t.tab_id === tab && (!workspace || t.workspace_id === workspace))) throw new BridgeError(409, "The tab changed.");
58644
58724
  if (pane && !objects(s.panes).some((p) => p.pane_id === pane && (!tab || p.tab_id === tab) && (!workspace || p.workspace_id === workspace))) throw new BridgeError(409, "The pane changed.");
58645
58725
  const label2 = data.label === void 0 ? void 0 : external_exports.string().min(1).max(200).refine((t) => !/[\x00-\x1f\x7f]/.test(t)).parse(data.label);
58646
- const cwd = data.cwd === void 0 ? void 0 : external_exports.string().max(4096).refine((t) => path111.isAbsolute(t) && !/[\x00-\x1f\x7f]/.test(t)).parse(data.cwd);
58726
+ const cwd = data.cwd === void 0 ? void 0 : external_exports.string().max(4096).refine((t) => path112.isAbsolute(t) && !/[\x00-\x1f\x7f]/.test(t)).parse(data.cwd);
58647
58727
  if (operation === "create") await terminalProvider().create(server, { workspace, label: label2, cwd });
58648
58728
  else if (!workspace && !tab && !pane) throw new BridgeError(400, "Choose a Herdr destination.");
58649
58729
  else if (pane && operation === "focus") await terminalProvider().focusPane(server, pane);
@@ -58798,6 +58878,7 @@ var capabilities = {
58798
58878
  providers: ["codex", "claude", "copilot", "opencode"],
58799
58879
  files: true,
58800
58880
  repositoryFiles: true,
58881
+ fileResolution: true,
58801
58882
  subagents: true,
58802
58883
  sideQuestions: true,
58803
58884
  dispatch: true,
@@ -58808,6 +58889,7 @@ var capabilities = {
58808
58889
  approvalPush: "direct-apns",
58809
58890
  simulators: process.platform === "darwin",
58810
58891
  code: true,
58892
+ codeFiles: true,
58811
58893
  overviewStream: true,
58812
58894
  speech: true,
58813
58895
  speechTimestamps: true,
@@ -59135,10 +59217,18 @@ function createRouteHandler(ctx) {
59135
59217
  case "/v1/files":
59136
59218
  result = { files: await listUploads("files") };
59137
59219
  break;
59220
+ case "/v1/files/resolve": {
59221
+ const target = targetFromURL(url2), pane = await validateTarget(target);
59222
+ const cwd = await gitRepository(pane, target, url2.searchParams.get("child") ?? void 0, url2.searchParams.get("worktree") ?? void 0);
59223
+ const repository3 = await gitRoot(cwd);
59224
+ if (!repository3) throw new BridgeError(409, "This pane is not in a project repository.");
59225
+ result = await resolveFilePath(repository3, cwd, url2.searchParams.get("path") ?? "");
59226
+ break;
59227
+ }
59138
59228
  case "/v1/files/range": {
59139
59229
  let root;
59140
59230
  if (url2.searchParams.get("scope") === "uploads") {
59141
- root = path112.join(bridgeRoot(), "uploads");
59231
+ root = path113.join(bridgeRoot(), "uploads");
59142
59232
  } else if (url2.searchParams.has("session")) {
59143
59233
  const target = targetFromURL(url2), pane = await validateTarget(target);
59144
59234
  const cwd = await gitRepository(pane, target, url2.searchParams.get("child") ?? void 0, url2.searchParams.get("worktree") ?? void 0);
@@ -59318,6 +59408,9 @@ function createRouteHandler(ctx) {
59318
59408
  case "/v1/code/search":
59319
59409
  result = await new CodeRoutes(await resolveCodeStore(scheduleStore, url2.searchParams.get("store"))).search(url2.searchParams.get("project"), url2.searchParams.get("q"), url2.searchParams.get("kind"), url2.searchParams.get("limit"), url2.searchParams.get("directory"));
59320
59410
  break;
59411
+ case "/v1/code/files":
59412
+ result = await new CodeRoutes(await resolveCodeStore(scheduleStore, url2.searchParams.get("store"))).files(url2.searchParams.get("project"), url2.searchParams.get("name"), url2.searchParams.get("limit"));
59413
+ break;
59321
59414
  case "/v1/code/outline-summary":
59322
59415
  result = await new CodeRoutes(await resolveCodeStore(scheduleStore, url2.searchParams.get("store"))).outlineSummary(url2.searchParams.get("project"), url2.searchParams.get("paths"));
59323
59416
  break;
@@ -60259,9 +60352,9 @@ init_home_paths();
60259
60352
  init_logger();
60260
60353
  init_protocol();
60261
60354
  import { readFile as readFile51 } from "node:fs/promises";
60262
- import path113 from "node:path";
60355
+ import path114 from "node:path";
60263
60356
  var REFRESH_AFTER_MS = 6 * 864e5;
60264
- async function lastCodexRefresh(file3 = path113.join(codexHome(), "auth.json")) {
60357
+ async function lastCodexRefresh(file3 = path114.join(codexHome(), "auth.json")) {
60265
60358
  try {
60266
60359
  const auth = object2(JSON.parse(await readFile51(file3, "utf8")));
60267
60360
  if (!object2(auth.tokens).refresh_token) return void 0;
@@ -60317,7 +60410,7 @@ async function serve(version3, options = {}) {
60317
60410
  await mkdir30(root, { recursive: true, mode: 448 });
60318
60411
  await chmod6(root, 448);
60319
60412
  let computerID2;
60320
- const identityFile = path114.join(root, "computer-id");
60413
+ const identityFile = path115.join(root, "computer-id");
60321
60414
  try {
60322
60415
  computerID2 = (await readFile52(identityFile, "utf8")).trim();
60323
60416
  } catch {
@@ -60437,7 +60530,7 @@ async function serve(version3, options = {}) {
60437
60530
  if (codeReindexer) agentHooks.changes.onRecord = (files) => codeReindexer.record(files);
60438
60531
  function gatewayTiming() {
60439
60532
  try {
60440
- const parsed = JSON.parse(readFileSync37(path114.join(root, "gateway.json"), "utf8"));
60533
+ const parsed = JSON.parse(readFileSync37(path115.join(root, "gateway.json"), "utf8"));
60441
60534
  if (typeof parsed.ms === "number" && Number.isFinite(parsed.ms) && parsed.ms >= 0) return Math.round(parsed.ms);
60442
60535
  } catch {
60443
60536
  }
@@ -60466,7 +60559,7 @@ async function serve(version3, options = {}) {
60466
60559
  launch: (server, data) => launches.run(() => launchSession(server, data, { canary: true })),
60467
60560
  scheduler
60468
60561
  });
60469
- const old = await lstat32(socketPath()).catch(() => null);
60562
+ const old = await lstat33(socketPath()).catch(() => null);
60470
60563
  if (old) {
60471
60564
  if (!old.isSocket() || process.getuid && old.uid !== process.getuid()) throw new Error("Refusing to replace an unexpected hook socket.");
60472
60565
  const { connect: connect4 } = await import("node:net");
@@ -60483,7 +60576,7 @@ async function serve(version3, options = {}) {
60483
60576
  }
60484
60577
  const stopRetention = modules.has("git") ? await startChangeRetention() : () => {
60485
60578
  };
60486
- if (modules.has("git")) await rm15(path114.join(root, "changes-scratch"), { recursive: true, force: true });
60579
+ if (modules.has("git")) await rm15(path115.join(root, "changes-scratch"), { recursive: true, force: true });
60487
60580
  const streams = transcriptStreams({ modules, agentHooks, codexQuestions, sideQuestions, settingsSwitcher, info, activeCapabilities });
60488
60581
  const { stream } = streams;
60489
60582
  const overview = overviewStream({
@@ -60671,7 +60764,7 @@ init_phren_paths();
60671
60764
  import { execFile as execFile23 } from "node:child_process";
60672
60765
  import { readFile as readFile53 } from "node:fs/promises";
60673
60766
  import { homedir as homedir21, hostname as hostname13, userInfo as userInfo5 } from "node:os";
60674
- import path115 from "node:path";
60767
+ import path116 from "node:path";
60675
60768
  import { promisify as promisify22 } from "node:util";
60676
60769
  init_protocol();
60677
60770
  var exec22 = promisify22(execFile23);
@@ -60718,11 +60811,11 @@ async function probe2(host) {
60718
60811
  return computerId ? { host, computerId, user: field("user") ?? "", client: field("client") } : void 0;
60719
60812
  }
60720
60813
  async function discoverComputers(options = {}) {
60721
- const config3 = options.sshConfig ?? await readFile53(path115.join(homedir21(), ".ssh", "config"), "utf8").catch(() => "");
60814
+ const config3 = options.sshConfig ?? await readFile53(path116.join(homedir21(), ".ssh", "config"), "utf8").catch(() => "");
60722
60815
  const store = options.store !== void 0 ? options.store : findPhrenPath();
60723
60816
  const machines = store ? listMachines(store) : void 0;
60724
60817
  const { peers } = await optionalHookPeers();
60725
- const own2 = (await readFile53(path115.join(bridgeRoot(), "computer-id"), "utf8").catch(() => "")).trim();
60818
+ const own2 = (await readFile53(path116.join(bridgeRoot(), "computer-id"), "utf8").catch(() => "")).trim();
60726
60819
  const known2 = new Set([...localNames(), ...peers.flatMap((peer) => [peer.name, peer.address])].map(computerLabel));
60727
60820
  const candidates = [.../* @__PURE__ */ new Set([...sshConfigHosts(config3), ...machines?.ok ? Object.keys(machines.data) : []])].filter((host) => !known2.has(computerLabel(host))).slice(0, 32);
60728
60821
  const [found, peerIds] = await Promise.all([
@@ -60744,7 +60837,7 @@ function slugName(value2) {
60744
60837
  async function linkComputer(host, options = {}) {
60745
60838
  const remote = await probe2(host);
60746
60839
  if (!remote) throw new BridgeError(409, `${host} answers over ssh but Phren Hook is not installed there. Run phren bridge install on it first.`);
60747
- const own2 = (await readFile53(path115.join(bridgeRoot(), "computer-id"), "utf8").catch(() => "")).trim();
60840
+ const own2 = (await readFile53(path116.join(bridgeRoot(), "computer-id"), "utf8").catch(() => "")).trim();
60748
60841
  if (remote.computerId === own2) throw new BridgeError(409, `${host} is this computer.`);
60749
60842
  const name = computerName.parse(options.name ?? slugName(host));
60750
60843
  const as = computerName.parse(options.as ?? slugName(hostname13()));
@@ -61037,7 +61130,7 @@ async function readSecret(prompt) {
61037
61130
  // src/bridge/hook-main.ts
61038
61131
  init_utils_helpers();
61039
61132
  Object.assign(process.env, nonInteractiveGitEnv());
61040
- runBridge(process.argv.slice(2), "0.3.24").then((code) => {
61133
+ runBridge(process.argv.slice(2), "0.3.26").then((code) => {
61041
61134
  process.exitCode = code;
61042
61135
  }).catch((error62) => {
61043
61136
  console.error(error62 instanceof Error ? error62.message : "Phren Hook failed.");
@@ -80,7 +80,7 @@ export const BUILTIN_MODULES = [
80
80
  ...routes("GET", [
81
81
  "/v1/health", "/v1/health/details", "/v1/health/peers", "/v1/muxes", "/v1/activity", "/v1/metrics", "/v1/web-servers", "/v1/simulators",
82
82
  "/v1/simulators/screenshot", "/v1/simulators/apps", "/v1/files", "/v1/models", "/v1/harnesses", "/v1/projects/files",
83
- "/v1/uploads/image", "/v1/files/range", "/v1/usage", "/v1/resources", "/v1/speech/voices", "/v1/push/status", "/v1/projects/locate", "/v1/projects/repos",
83
+ "/v1/uploads/image", "/v1/files/range", "/v1/files/resolve", "/v1/usage", "/v1/resources", "/v1/speech/voices", "/v1/push/status", "/v1/projects/locate", "/v1/projects/repos",
84
84
  "/v1/workspaces", "/v1/workspaces/panes", "/v1/transcripts/blob", "/v1/transcripts/history", "/v1/sudo",
85
85
  "/v1/subagents", "/v1/subagents/transcript", "/v1/subagents/messages",
86
86
  ]),
@@ -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", "deliveryFrames", "resources", "sessionRename", "sudo", "sudoOutcome", "previewDeltas", "quickChat",
99
+ "files", "repositoryFiles", "fileResolution", "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"],
@@ -145,8 +145,8 @@ export const BUILTIN_MODULES = [
145
145
  tools: full(["code_search", "code_definition", "code_references", "code_outline", "code_usage"]),
146
146
  cliCommands: ["code index", "code status", "code search", "code outline", "code refs", "code def", "code usage"],
147
147
  agentHooks: [],
148
- hookRoutes: [...routes("GET", ["/v1/code/tree", "/v1/code/usage-page", "/v1/code/changed", "/v1/code/change-counts", "/v1/code/status", "/v1/code/search", "/v1/code/outline", "/v1/code/outline-summary", "/v1/code/file-references", "/v1/code/definition", "/v1/code/references", "/v1/code/usage"]), ...routes("POST", ["/v1/code/note", "/v1/code/reindex", "/v1/code/disable"])],
149
- capabilities: ["code"],
148
+ hookRoutes: [...routes("GET", ["/v1/code/tree", "/v1/code/usage-page", "/v1/code/changed", "/v1/code/change-counts", "/v1/code/status", "/v1/code/search", "/v1/code/files", "/v1/code/outline", "/v1/code/outline-summary", "/v1/code/file-references", "/v1/code/definition", "/v1/code/references", "/v1/code/usage"]), ...routes("POST", ["/v1/code/note", "/v1/code/reindex", "/v1/code/disable"])],
149
+ capabilities: ["code", "codeFiles"],
150
150
  storeFiles: [], localFiles: ["<store>/.runtime/code/*.sqlite"],
151
151
  phoneScreens: [{ screen: "CodeView", capability: "code" }], skills: ["code"],
152
152
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {