@phren/cli 0.3.11 → 0.3.12

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 (168) hide show
  1. package/dist/bridge/agent-hook-stores.d.ts +3 -0
  2. package/dist/bridge/agent-hook-stores.js +5 -0
  3. package/dist/bridge/agent-hooks.d.ts +159 -5
  4. package/dist/bridge/agent-hooks.js +663 -49
  5. package/dist/bridge/approval-summary.d.ts +16 -0
  6. package/dist/bridge/approval-summary.js +133 -0
  7. package/dist/bridge/authority-command.d.ts +20 -0
  8. package/dist/bridge/authority-command.js +120 -0
  9. package/dist/bridge/authority.d.ts +223 -0
  10. package/dist/bridge/authority.js +231 -0
  11. package/dist/bridge/claude-account-setup.d.ts +14 -0
  12. package/dist/bridge/claude-account-setup.js +69 -0
  13. package/dist/bridge/claude-accounts.d.ts +49 -0
  14. package/dist/bridge/claude-accounts.js +195 -0
  15. package/dist/bridge/code-routes.js +2 -2
  16. package/dist/bridge/codex-app-server.d.ts +144 -0
  17. package/dist/bridge/codex-app-server.js +319 -0
  18. package/dist/bridge/codex-auth-refresh.d.ts +33 -0
  19. package/dist/bridge/codex-auth-refresh.js +71 -0
  20. package/dist/bridge/codex-question-reply.d.ts +16 -0
  21. package/dist/bridge/codex-question-reply.js +57 -0
  22. package/dist/bridge/codex-review-mode.d.ts +10 -0
  23. package/dist/bridge/codex-review-mode.js +74 -0
  24. package/dist/bridge/codex-servers.d.ts +217 -0
  25. package/dist/bridge/codex-servers.js +636 -0
  26. package/dist/bridge/command.js +94 -4
  27. package/dist/bridge/computer-identity.d.ts +75 -0
  28. package/dist/bridge/computer-identity.js +166 -0
  29. package/dist/bridge/conductor-group.d.ts +91 -8
  30. package/dist/bridge/conductor-group.js +105 -9
  31. package/dist/bridge/conductor-role.d.ts +94 -0
  32. package/dist/bridge/conductor-role.js +176 -0
  33. package/dist/bridge/conductor-sets.d.ts +20 -0
  34. package/dist/bridge/conductor-sets.js +59 -0
  35. package/dist/bridge/dispatch-command.d.ts +3 -0
  36. package/dist/bridge/dispatch-command.js +75 -11
  37. package/dist/bridge/dispatch-returns.d.ts +123 -19
  38. package/dist/bridge/dispatch-returns.js +357 -50
  39. package/dist/bridge/dispatch.d.ts +103 -2
  40. package/dist/bridge/dispatch.js +272 -40
  41. package/dist/bridge/fanouts.d.ts +7 -1
  42. package/dist/bridge/fanouts.js +39 -4
  43. package/dist/bridge/folder-trust.d.ts +56 -0
  44. package/dist/bridge/folder-trust.js +195 -0
  45. package/dist/bridge/grants.d.ts +22 -1
  46. package/dist/bridge/grants.js +57 -9
  47. package/dist/bridge/hand-off.d.ts +21 -9
  48. package/dist/bridge/hand-off.js +58 -45
  49. package/dist/bridge/harness-status.d.ts +11 -0
  50. package/dist/bridge/harness-status.js +32 -0
  51. package/dist/bridge/harnesses.d.ts +39 -0
  52. package/dist/bridge/harnesses.js +65 -0
  53. package/dist/bridge/health.d.ts +2 -0
  54. package/dist/bridge/health.js +1 -1
  55. package/dist/bridge/herdr.d.ts +11 -2
  56. package/dist/bridge/herdr.js +98 -23
  57. package/dist/bridge/hook-fast.d.ts +4 -0
  58. package/dist/bridge/hook-fast.js +68 -0
  59. package/dist/bridge/install.d.ts +16 -1
  60. package/dist/bridge/install.js +88 -21
  61. package/dist/bridge/launch-brief.d.ts +96 -0
  62. package/dist/bridge/launch-brief.js +164 -0
  63. package/dist/bridge/model-switch.d.ts +3 -0
  64. package/dist/bridge/model-switch.js +17 -1
  65. package/dist/bridge/models.d.ts +8 -4
  66. package/dist/bridge/models.js +24 -8
  67. package/dist/bridge/mux-wire.d.ts +9 -0
  68. package/dist/bridge/mux-wire.js +19 -0
  69. package/dist/bridge/opencode-pane-server.d.ts +113 -0
  70. package/dist/bridge/opencode-pane-server.js +332 -0
  71. package/dist/bridge/opencode-panes.d.ts +111 -0
  72. package/dist/bridge/opencode-panes.js +295 -0
  73. package/dist/bridge/pane-accounts.d.ts +8 -0
  74. package/dist/bridge/pane-accounts.js +46 -0
  75. package/dist/bridge/prompt-startup.d.ts +5 -0
  76. package/dist/bridge/prompt-startup.js +24 -0
  77. package/dist/bridge/protocol.d.ts +5 -0
  78. package/dist/bridge/protocol.js +4 -0
  79. package/dist/bridge/push.d.ts +5 -4
  80. package/dist/bridge/push.js +6 -4
  81. package/dist/bridge/questions.d.ts +37 -2
  82. package/dist/bridge/questions.js +158 -15
  83. package/dist/bridge/resources.d.ts +9 -3
  84. package/dist/bridge/resources.js +24 -8
  85. package/dist/bridge/schedule-format.d.ts +2 -0
  86. package/dist/bridge/schedule-format.js +3 -0
  87. package/dist/bridge/schedule-launch.d.ts +2 -1
  88. package/dist/bridge/schedule-launch.js +23 -53
  89. package/dist/bridge/schedule-watch.d.ts +10 -1
  90. package/dist/bridge/schedule-watch.js +54 -2
  91. package/dist/bridge/server-launch.d.ts +22 -5
  92. package/dist/bridge/server-launch.js +225 -29
  93. package/dist/bridge/server-overview.d.ts +3 -3
  94. package/dist/bridge/server-overview.js +22 -14
  95. package/dist/bridge/server-pane-routes.d.ts +2 -0
  96. package/dist/bridge/server-pane-routes.js +145 -15
  97. package/dist/bridge/server-routes.d.ts +7 -0
  98. package/dist/bridge/server-routes.js +163 -35
  99. package/dist/bridge/server-stream.d.ts +2 -0
  100. package/dist/bridge/server-stream.js +22 -8
  101. package/dist/bridge/server.d.ts +6 -1
  102. package/dist/bridge/server.js +44 -12
  103. package/dist/bridge/session-activity.d.ts +81 -0
  104. package/dist/bridge/session-activity.js +117 -0
  105. package/dist/bridge/session-rename.d.ts +48 -0
  106. package/dist/bridge/session-rename.js +190 -0
  107. package/dist/bridge/session-servers.js +2 -2
  108. package/dist/bridge/settings-switch.d.ts +60 -0
  109. package/dist/bridge/settings-switch.js +287 -0
  110. package/dist/bridge/speech-voice.d.ts +55 -0
  111. package/dist/bridge/speech-voice.js +132 -0
  112. package/dist/bridge/speech.d.ts +70 -11
  113. package/dist/bridge/speech.js +169 -41
  114. package/dist/bridge/terminal-herdr.js +9 -3
  115. package/dist/bridge/terminal-tmux.d.ts +3 -3
  116. package/dist/bridge/terminal-tmux.js +24 -9
  117. package/dist/bridge/terminal.d.ts +27 -4
  118. package/dist/bridge/terminal.js +8 -1
  119. package/dist/bridge/transcript-claude.js +57 -12
  120. package/dist/bridge/transcript-codex.d.ts +0 -2
  121. package/dist/bridge/transcript-codex.js +29 -4
  122. package/dist/bridge/transcript-preview.d.ts +1 -0
  123. package/dist/bridge/transcript-preview.js +24 -4
  124. package/dist/bridge/transcripts.d.ts +15 -2
  125. package/dist/bridge/transcripts.js +47 -16
  126. package/dist/bridge/turn-records.d.ts +85 -0
  127. package/dist/bridge/turn-records.js +143 -0
  128. package/dist/bridge/uploads.d.ts +3 -0
  129. package/dist/bridge/uploads.js +14 -0
  130. package/dist/bridge/usage.d.ts +39 -10
  131. package/dist/bridge/usage.js +155 -44
  132. package/dist/bridge-hook.mjs +19169 -13176
  133. package/dist/cli/claude-unmanaged.d.ts +12 -0
  134. package/dist/cli/claude-unmanaged.js +105 -0
  135. package/dist/cli/schedules.js +2 -1
  136. package/dist/cli/session-start.js +10 -1
  137. package/dist/cli/session-stop.js +9 -1
  138. package/dist/cli-registry.js +24 -5
  139. package/dist/data/task-receipts.d.ts +19 -0
  140. package/dist/data/task-receipts.js +68 -0
  141. package/dist/data/tasks.js +4 -1
  142. package/dist/generated/memory-ui-graph.browser.js +63 -63
  143. package/dist/graph-core/model.js +24 -3
  144. package/dist/graph-core/types.d.ts +4 -1
  145. package/dist/graph-core/types.js +1 -0
  146. package/dist/init/init-preset.js +7 -3
  147. package/dist/init/init-uninstall.js +2 -11
  148. package/dist/init/teardown.d.ts +3 -0
  149. package/dist/init/teardown.js +47 -0
  150. package/dist/link/context.js +21 -9
  151. package/dist/mcp/plugin-mode.js +1 -1
  152. package/dist/memory-ui-graph.runtime.js +63 -63
  153. package/dist/modules/code-package.d.ts +1 -0
  154. package/dist/modules/code-package.js +36 -7
  155. package/dist/modules/registry.js +14 -13
  156. package/dist/profile-store.d.ts +6 -0
  157. package/dist/profile-store.js +25 -1
  158. package/dist/shell/graph/glyphs.js +4 -0
  159. package/dist/shell/graph/graph-view.js +2 -0
  160. package/dist/status.js +7 -1
  161. package/dist/sync/task-claim.js +3 -2
  162. package/dist/task/lifecycle.js +25 -4
  163. package/dist/test-global-setup.js +5 -0
  164. package/dist/tools/dispatch.js +35 -2
  165. package/dist/tools/tasks.js +10 -1
  166. package/package.json +1 -1
  167. package/plugins/opencode/phren-transcript.js +87 -4
  168. package/starter/global/skills/conductor/SKILL.md +17 -2
@@ -0,0 +1,74 @@
1
+ import { open } from "node:fs/promises";
2
+ import path from "node:path";
3
+ // How far back from the end of a rollout to look for the session's settings.
4
+ // A long Codex session writes tens of megabytes; one turn rarely spans more.
5
+ const SCAN_LIMIT = 64 * 1_048_576;
6
+ const CHUNK = 1_048_576;
7
+ /** Whether Codex's automatic reviewer, not the owner, decides this session's
8
+ * approval requests. Codex runs the PermissionRequest hook before its reviewer
9
+ * and the payload does not say which one will decide (permission_mode is
10
+ * "default" either way), so read the settings the session itself recorded: the
11
+ * latest turn_context or thread_settings_applied line in its rollout, which
12
+ * follows /approvals changes mid-session. Codex routes a request to the
13
+ * reviewer only with approvals_reviewer "auto_review" and an on-request or
14
+ * granular approval policy; anything else, or a rollout that can't be read,
15
+ * keeps the owner as the approver. */
16
+ export async function codexAutoReview(transcriptPath) {
17
+ if (typeof transcriptPath !== "string" || !path.isAbsolute(transcriptPath)
18
+ || !/^rollout-.*\.jsonl$/.test(path.basename(transcriptPath)))
19
+ return false;
20
+ const file = await open(transcriptPath, "r").catch(() => undefined);
21
+ if (!file)
22
+ return false;
23
+ try {
24
+ const size = (await file.stat()).size;
25
+ let end = size, carry = Buffer.alloc(0);
26
+ while (end > 0 && size - end < SCAN_LIMIT) {
27
+ const start = Math.max(0, end - CHUNK), buffer = Buffer.alloc(end - start);
28
+ await file.read(buffer, 0, buffer.length, start);
29
+ const bytes = Buffer.concat([buffer, carry]);
30
+ // Lines newest first; the bytes before the first newline may continue
31
+ // a line that began in an earlier chunk, so they carry over.
32
+ let lineEnd = bytes.length;
33
+ for (let at = bytes.lastIndexOf(10, lineEnd - 1); at >= 0; at = bytes.lastIndexOf(10, lineEnd - 1)) {
34
+ const settings = reviewSettings(bytes.subarray(at + 1, lineEnd).toString("utf8"));
35
+ if (settings)
36
+ return autoReviewed(settings);
37
+ lineEnd = at;
38
+ if (at === 0)
39
+ break;
40
+ }
41
+ carry = bytes.subarray(0, lineEnd);
42
+ end = start;
43
+ }
44
+ const settings = end === 0 ? reviewSettings(carry.toString("utf8")) : undefined;
45
+ return !!settings && autoReviewed(settings);
46
+ }
47
+ catch {
48
+ return false;
49
+ }
50
+ finally {
51
+ await file.close().catch(() => { });
52
+ }
53
+ }
54
+ function reviewSettings(line) {
55
+ if (!line.includes("\"approvals_reviewer\"")
56
+ || !(line.includes("\"type\":\"turn_context\"") || line.includes("\"type\":\"thread_settings_applied\"")))
57
+ return undefined;
58
+ try {
59
+ const entry = JSON.parse(line);
60
+ const payload = entry?.payload;
61
+ const settings = entry?.type === "turn_context" ? payload
62
+ : entry?.type === "event_msg" && payload?.type === "thread_settings_applied" ? payload.thread_settings : undefined;
63
+ if (!settings || !("approvals_reviewer" in settings))
64
+ return undefined;
65
+ return { reviewer: settings.approvals_reviewer, policy: settings.approval_policy };
66
+ }
67
+ catch {
68
+ return undefined;
69
+ }
70
+ }
71
+ function autoReviewed({ reviewer, policy }) {
72
+ return reviewer === "auto_review"
73
+ && (policy === "on-request" || (!!policy && typeof policy === "object" && "granular" in policy));
74
+ }
@@ -0,0 +1,217 @@
1
+ import { z } from "zod";
2
+ import { type AppServerRequestId, type AppServerTurnInput, connectAppServer, type PendingServerRequest, spawnAppServer } from "./codex-app-server.js";
3
+ import { type Json, type Target } from "./protocol.js";
4
+ declare const entrySchema: z.ZodObject<{
5
+ id: z.ZodString;
6
+ server: z.ZodString;
7
+ workspace: z.ZodString;
8
+ tab: z.ZodString;
9
+ pane: z.ZodString;
10
+ socket: z.ZodString;
11
+ pid: z.ZodNumber;
12
+ threadId: z.ZodOptional<z.ZodString>;
13
+ cwd: z.ZodString;
14
+ startedAt: z.ZodString;
15
+ dispatchId: z.ZodOptional<z.ZodString>;
16
+ activeTurn: z.ZodOptional<z.ZodString>;
17
+ lastTurn: z.ZodOptional<z.ZodObject<{
18
+ id: z.ZodString;
19
+ status: z.ZodString;
20
+ at: z.ZodString;
21
+ }, z.core.$strip>>;
22
+ nextTurn: z.ZodOptional<z.ZodObject<{
23
+ model: z.ZodOptional<z.ZodString>;
24
+ effort: z.ZodOptional<z.ZodString>;
25
+ approvalPolicy: z.ZodOptional<z.ZodEnum<{
26
+ never: "never";
27
+ "on-request": "on-request";
28
+ untrusted: "untrusted";
29
+ }>>;
30
+ approvalsReviewer: z.ZodOptional<z.ZodEnum<{
31
+ auto_review: "auto_review";
32
+ user: "user";
33
+ }>>;
34
+ sandboxPolicy: z.ZodOptional<z.ZodObject<{
35
+ type: z.ZodEnum<{
36
+ dangerFullAccess: "dangerFullAccess";
37
+ readOnly: "readOnly";
38
+ workspaceWrite: "workspaceWrite";
39
+ }>;
40
+ }, z.core.$strict>>;
41
+ collaborationMode: z.ZodOptional<z.ZodObject<{
42
+ mode: z.ZodEnum<{
43
+ default: "default";
44
+ plan: "plan";
45
+ }>;
46
+ }, z.core.$strict>>;
47
+ }, z.core.$strict>>;
48
+ }, z.core.$strict>;
49
+ export type CodexServerEntry = z.infer<typeof entrySchema>;
50
+ export type CodexNextTurn = NonNullable<CodexServerEntry["nextTurn"]>;
51
+ /** Where the Hook's approval cards come from and go: every server request of
52
+ * a registered thread is offered here with the function that answers it, and
53
+ * withdrawn once any client (the pane's TUI, or this one) answered it. */
54
+ export interface CodexApprovalSink {
55
+ request(target: Target, request: PendingServerRequest, answer: (result: Json) => void): void;
56
+ resolved(target: Target, requestId: AppServerRequestId): void;
57
+ }
58
+ export interface CodexServerDeps {
59
+ spawn: typeof spawnAppServer;
60
+ connect: typeof connectAppServer;
61
+ /** True while `pid` is a running process. */
62
+ alive(pid: number): boolean;
63
+ kill(pid: number): void;
64
+ }
65
+ /** `PHREN_CODEX_APP_SERVER=off` keeps every Codex launch on the typed path. */
66
+ export declare function codexAppServerEnabled(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
67
+ /** A question on a Hook-run pane reaches the phone as a card either way, but
68
+ * only the blocking `request_user_input` holds the turn until someone answers:
69
+ * an async question (`request_user_input_async`) lets the worker carry on
70
+ * without the answer, and a plain-text question never becomes a card at all.
71
+ * Codex 0.157 offers the blocking tool outside plan mode only behind
72
+ * `features.default_mode_request_user_input`, and a short developer
73
+ * instruction steers the model to it (as T3 Code's CodexDeveloperInstructions
74
+ * does). `PHREN_CODEX_BLOCKING_QUESTIONS=off` leaves both out. */
75
+ export declare const BLOCKING_QUESTION_INSTRUCTIONS: string;
76
+ export declare function serverConfig(env?: NodeJS.ProcessEnv): string[];
77
+ /** The variable that tells a hook it runs inside the Hook's own app-server
78
+ * for one pane, so the pane variables it carries are that pane's. */
79
+ export declare const CODEX_SERVER_ENV = "PHREN_CODEX_SERVER";
80
+ export declare const codexServerId: z.ZodString;
81
+ /** The server's environment: the Hook's own, minus the variables that name
82
+ * the Hook's terminal, plus the pane's (so the hooks Codex runs inside the
83
+ * server report this pane) and the caller's. */
84
+ export declare function serverEnvironment(base: NodeJS.ProcessEnv, extra: Record<string, string>): NodeJS.ProcessEnv;
85
+ export declare function codexServersRoot(): string;
86
+ /** Nothing was sent: the server could not be reached. */
87
+ export declare class CodexServerUnavailable extends Error {
88
+ constructor(message: string);
89
+ }
90
+ export interface LaunchPlace {
91
+ server: string;
92
+ workspace: string;
93
+ tab: string;
94
+ pane: string;
95
+ }
96
+ export interface LaunchOptions {
97
+ cwd: string;
98
+ model?: string;
99
+ effort?: string;
100
+ /** Extra flags for a pane whose TUI starts the thread (no brief), such as a permission mode. */
101
+ remoteArgs?: string[];
102
+ /** Layered over the Hook's environment for the server and its hooks. */
103
+ env?: Record<string, string>;
104
+ dispatchId?: string;
105
+ }
106
+ export declare class CodexServers {
107
+ private deps;
108
+ private live;
109
+ private sink?;
110
+ private closed;
111
+ constructor(deps?: CodexServerDeps);
112
+ setDeps(deps: Partial<CodexServerDeps>): () => void;
113
+ private readonly saving;
114
+ setSink(sink: CodexApprovalSink | undefined): void;
115
+ entries(): CodexServerEntry[];
116
+ forPane(server: string, pane: string): CodexServerEntry | undefined;
117
+ forThread(threadId: string): CodexServerEntry | undefined;
118
+ /** The server behind a Codex target, when the target is exactly its pane and thread. */
119
+ forTarget(target: Target): CodexServerEntry | undefined;
120
+ /** A new server for a pane the Hook just created, and the arguments the
121
+ * pane's `codex` joins it with. With `startThread` (a launch that carries a
122
+ * brief) the Hook starts the thread and the pane resumes it:
123
+ * `codex resume <threadId> --remote unix://<socket>`. Codex cannot resume a
124
+ * thread with no turn yet, so without one the pane's TUI starts the thread
125
+ * (`codex --remote unix://<socket>`, with the model and effort as its own
126
+ * flags) and the Hook learns it from `thread/started` (`awaitThread`). The
127
+ * caller `stop`s the server if the pane cannot start. */
128
+ launch(place: LaunchPlace, options: LaunchOptions & {
129
+ startThread?: boolean;
130
+ }): Promise<{
131
+ entry: CodexServerEntry;
132
+ args: string[];
133
+ }>;
134
+ /** The pane's thread once its TUI has started it; undefined after `timeoutMs`. */
135
+ awaitThread(entry: CodexServerEntry, timeoutMs?: number): Promise<string | undefined>;
136
+ /** On Hook start: every registered server still running is reconnected
137
+ * and its thread followed again (its pending approvals are replayed to
138
+ * the new client); the rest are forgotten. */
139
+ adopt(): Promise<void>;
140
+ /** `turn/start` on the pane's thread; resolves with the turn id the server
141
+ * acknowledged. Nothing is typed into the pane. */
142
+ prompt(entry: CodexServerEntry, text: string): Promise<{
143
+ turnId: string;
144
+ }>;
145
+ /** `thread/name/set` on the pane's thread: Codex's own rename, which its TUI
146
+ * shows and `session_index.jsonl` keeps. Allowed while a turn runs. */
147
+ renameThread(entry: CodexServerEntry, name: string): Promise<void>;
148
+ /** Holds a model and effort for the pane's next Hook-sent turn. Nothing is
149
+ * typed into the TUI and a running turn is not disturbed. */
150
+ setNextTurn(entry: CodexServerEntry, model: string, effort?: string): void;
151
+ /** Holds permission and plan settings the same way, next to a pending model. */
152
+ holdSettings(entry: CodexServerEntry, settings: Omit<CodexNextTurn, "model" | "effort">): void;
153
+ /** Merges into what is pending: a later choice replaces its own fields only. */
154
+ private hold;
155
+ /** Input for the thread's running turn (`turn/steer`, as the TUI sends an
156
+ * async question's answer), or a new turn when none is running or the one
157
+ * it knew has ended. A refused steer sent nothing, so starting is safe. */
158
+ steer(entry: CodexServerEntry, text: string, extra?: AppServerTurnInput[]): Promise<{
159
+ turnId: string;
160
+ }>;
161
+ /** The thread's parked questions: `item/tool/requestUserInput` and MCP
162
+ * elicitations, which wait for an answer from any client. */
163
+ questions(entry: CodexServerEntry): PendingServerRequest[];
164
+ /** Answers one parked question; false when no client still waits on it. */
165
+ answerQuestion(entry: CodexServerEntry, requestId: AppServerRequestId, result: Json): boolean;
166
+ /** One proactive refresh of the shared Codex sign-in (codex-auth-refresh.ts)
167
+ * through Codex's own flow: on a running server's connection, or on a
168
+ * short-lived server when none runs. */
169
+ refreshAuth(): Promise<void>;
170
+ /** Interrupt the running turn, declining the thread's parked server
171
+ * requests first. False when no turn is known to be running. */
172
+ interrupt(entry: CodexServerEntry): Promise<boolean>;
173
+ /** The last finished turn of a registered thread and the running one, for
174
+ * the returns loop. */
175
+ turnState(threadId: string): {
176
+ activeTurn?: string;
177
+ lastTurn?: CodexServerEntry["lastTurn"];
178
+ } | undefined;
179
+ /** One Hook tick for `server`: forget servers whose process ended, stop
180
+ * servers whose pane closed (or has shown no Codex for two minutes), and
181
+ * reconnect a client that dropped. */
182
+ reap(server: string, snapshot: Json, now?: number): Promise<void>;
183
+ /** Servers whose terminal server is no longer running at all (a stopped
184
+ * Herdr session takes its panes with it): forgotten once dead, stopped
185
+ * after the same two minutes a pane without Codex gets. */
186
+ sweep(running: string[], now?: number): Promise<void>;
187
+ /** The pane's TUI moved to `threadId` (`/new`, `/resume`), as its
188
+ * SessionStart hook reports: follow it, so prompts, approvals and Escape
189
+ * go where the TUI is. False when the pane has no registered server. */
190
+ follow(server: string, pane: string, threadId: string): boolean;
191
+ private rebind;
192
+ /** Ends the server and forgets it. */
193
+ stop(entry: CodexServerEntry): Promise<void>;
194
+ /** Close every client; the servers keep running for the next Hook. */
195
+ close(): void;
196
+ /** For tests: forget everything without touching processes. */
197
+ reset(): void;
198
+ /** Resolves once every registry write started so far has finished. */
199
+ saved(): Promise<void>;
200
+ private target;
201
+ /** Rejoin the thread: its history is skipped, its pending server requests
202
+ * come again as requests. */
203
+ private subscribe;
204
+ private client;
205
+ private connect;
206
+ private listen;
207
+ private drop;
208
+ private forget;
209
+ private read;
210
+ /** One server's registry writes run in order, each with the entry as it is
211
+ * then, so an earlier write that finishes late never lands over a newer one. */
212
+ private save;
213
+ }
214
+ /** The Hook's servers: launch, prompt and keys routes, identity and the
215
+ * approval store all see the same registry. */
216
+ export declare const codexServers: CodexServers;
217
+ export {};