@phren/cli 0.3.11 → 0.3.13

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 (182) hide show
  1. package/dist/bridge/account-usage.d.ts +124 -0
  2. package/dist/bridge/account-usage.js +258 -0
  3. package/dist/bridge/agent-hook-stores.d.ts +3 -0
  4. package/dist/bridge/agent-hook-stores.js +5 -0
  5. package/dist/bridge/agent-hooks.d.ts +162 -5
  6. package/dist/bridge/agent-hooks.js +682 -49
  7. package/dist/bridge/approval-summary.d.ts +16 -0
  8. package/dist/bridge/approval-summary.js +133 -0
  9. package/dist/bridge/authority-command.d.ts +20 -0
  10. package/dist/bridge/authority-command.js +120 -0
  11. package/dist/bridge/authority.d.ts +223 -0
  12. package/dist/bridge/authority.js +231 -0
  13. package/dist/bridge/claude-account-setup.d.ts +14 -0
  14. package/dist/bridge/claude-account-setup.js +69 -0
  15. package/dist/bridge/claude-accounts.d.ts +49 -0
  16. package/dist/bridge/claude-accounts.js +195 -0
  17. package/dist/bridge/code-routes.js +2 -2
  18. package/dist/bridge/codex-app-server.d.ts +144 -0
  19. package/dist/bridge/codex-app-server.js +319 -0
  20. package/dist/bridge/codex-auth-refresh.d.ts +33 -0
  21. package/dist/bridge/codex-auth-refresh.js +71 -0
  22. package/dist/bridge/codex-hook-trust.d.ts +27 -0
  23. package/dist/bridge/codex-hook-trust.js +237 -0
  24. package/dist/bridge/codex-question-reply.d.ts +16 -0
  25. package/dist/bridge/codex-question-reply.js +57 -0
  26. package/dist/bridge/codex-review-mode.d.ts +10 -0
  27. package/dist/bridge/codex-review-mode.js +74 -0
  28. package/dist/bridge/codex-servers.d.ts +217 -0
  29. package/dist/bridge/codex-servers.js +636 -0
  30. package/dist/bridge/command.js +97 -4
  31. package/dist/bridge/computer-identity.d.ts +75 -0
  32. package/dist/bridge/computer-identity.js +166 -0
  33. package/dist/bridge/conductor-group.d.ts +91 -8
  34. package/dist/bridge/conductor-group.js +105 -9
  35. package/dist/bridge/conductor-role.d.ts +94 -0
  36. package/dist/bridge/conductor-role.js +176 -0
  37. package/dist/bridge/conductor-sets.d.ts +20 -0
  38. package/dist/bridge/conductor-sets.js +59 -0
  39. package/dist/bridge/dispatch-command.d.ts +3 -0
  40. package/dist/bridge/dispatch-command.js +82 -12
  41. package/dist/bridge/dispatch-returns.d.ts +128 -19
  42. package/dist/bridge/dispatch-returns.js +371 -54
  43. package/dist/bridge/dispatch.d.ts +128 -3
  44. package/dist/bridge/dispatch.js +303 -42
  45. package/dist/bridge/fanouts.d.ts +7 -1
  46. package/dist/bridge/fanouts.js +39 -4
  47. package/dist/bridge/folder-trust.d.ts +56 -0
  48. package/dist/bridge/folder-trust.js +195 -0
  49. package/dist/bridge/grants.d.ts +22 -1
  50. package/dist/bridge/grants.js +57 -9
  51. package/dist/bridge/hand-off-queue.d.ts +74 -0
  52. package/dist/bridge/hand-off-queue.js +235 -0
  53. package/dist/bridge/hand-off.d.ts +30 -10
  54. package/dist/bridge/hand-off.js +79 -46
  55. package/dist/bridge/harness-status.d.ts +11 -0
  56. package/dist/bridge/harness-status.js +32 -0
  57. package/dist/bridge/harnesses.d.ts +39 -0
  58. package/dist/bridge/harnesses.js +65 -0
  59. package/dist/bridge/health.d.ts +2 -0
  60. package/dist/bridge/health.js +1 -1
  61. package/dist/bridge/herdr.d.ts +11 -2
  62. package/dist/bridge/herdr.js +98 -23
  63. package/dist/bridge/hook-fast.d.ts +4 -0
  64. package/dist/bridge/hook-fast.js +68 -0
  65. package/dist/bridge/install.d.ts +16 -1
  66. package/dist/bridge/install.js +102 -21
  67. package/dist/bridge/launch-brief.d.ts +96 -0
  68. package/dist/bridge/launch-brief.js +164 -0
  69. package/dist/bridge/model-switch.d.ts +3 -0
  70. package/dist/bridge/model-switch.js +17 -1
  71. package/dist/bridge/models.d.ts +8 -4
  72. package/dist/bridge/models.js +24 -8
  73. package/dist/bridge/mux-wire.d.ts +9 -0
  74. package/dist/bridge/mux-wire.js +19 -0
  75. package/dist/bridge/opencode-pane-server.d.ts +113 -0
  76. package/dist/bridge/opencode-pane-server.js +332 -0
  77. package/dist/bridge/opencode-panes.d.ts +111 -0
  78. package/dist/bridge/opencode-panes.js +295 -0
  79. package/dist/bridge/pane-accounts.d.ts +8 -0
  80. package/dist/bridge/pane-accounts.js +46 -0
  81. package/dist/bridge/pane-status.d.ts +12 -0
  82. package/dist/bridge/pane-status.js +50 -1
  83. package/dist/bridge/prompt-startup.d.ts +5 -0
  84. package/dist/bridge/prompt-startup.js +24 -0
  85. package/dist/bridge/protocol.d.ts +5 -0
  86. package/dist/bridge/protocol.js +4 -0
  87. package/dist/bridge/push.d.ts +11 -4
  88. package/dist/bridge/push.js +27 -4
  89. package/dist/bridge/questions.d.ts +37 -2
  90. package/dist/bridge/questions.js +158 -15
  91. package/dist/bridge/resources.d.ts +9 -3
  92. package/dist/bridge/resources.js +24 -8
  93. package/dist/bridge/schedule-format.d.ts +2 -0
  94. package/dist/bridge/schedule-format.js +3 -0
  95. package/dist/bridge/schedule-launch.d.ts +2 -1
  96. package/dist/bridge/schedule-launch.js +27 -53
  97. package/dist/bridge/schedule-watch.d.ts +24 -1
  98. package/dist/bridge/schedule-watch.js +89 -2
  99. package/dist/bridge/server-launch.d.ts +22 -5
  100. package/dist/bridge/server-launch.js +238 -32
  101. package/dist/bridge/server-overview.d.ts +10 -3
  102. package/dist/bridge/server-overview.js +32 -15
  103. package/dist/bridge/server-pane-routes.d.ts +3 -0
  104. package/dist/bridge/server-pane-routes.js +150 -18
  105. package/dist/bridge/server-routes.d.ts +11 -0
  106. package/dist/bridge/server-routes.js +214 -36
  107. package/dist/bridge/server-stream.d.ts +2 -0
  108. package/dist/bridge/server-stream.js +22 -8
  109. package/dist/bridge/server.d.ts +6 -1
  110. package/dist/bridge/server.js +58 -13
  111. package/dist/bridge/session-activity.d.ts +93 -0
  112. package/dist/bridge/session-activity.js +139 -0
  113. package/dist/bridge/session-rename.d.ts +48 -0
  114. package/dist/bridge/session-rename.js +190 -0
  115. package/dist/bridge/session-servers.js +2 -2
  116. package/dist/bridge/settings-switch.d.ts +60 -0
  117. package/dist/bridge/settings-switch.js +287 -0
  118. package/dist/bridge/speech-voice.d.ts +55 -0
  119. package/dist/bridge/speech-voice.js +132 -0
  120. package/dist/bridge/speech.d.ts +70 -11
  121. package/dist/bridge/speech.js +169 -41
  122. package/dist/bridge/stalls.d.ts +22 -0
  123. package/dist/bridge/stalls.js +57 -0
  124. package/dist/bridge/sudo.d.ts +209 -0
  125. package/dist/bridge/sudo.js +501 -0
  126. package/dist/bridge/terminal-herdr.js +9 -3
  127. package/dist/bridge/terminal-tmux.d.ts +15 -3
  128. package/dist/bridge/terminal-tmux.js +103 -13
  129. package/dist/bridge/terminal.d.ts +27 -4
  130. package/dist/bridge/terminal.js +8 -1
  131. package/dist/bridge/transcript-claude.d.ts +4 -0
  132. package/dist/bridge/transcript-claude.js +186 -16
  133. package/dist/bridge/transcript-codex.d.ts +0 -2
  134. package/dist/bridge/transcript-codex.js +29 -4
  135. package/dist/bridge/transcript-preview.d.ts +1 -0
  136. package/dist/bridge/transcript-preview.js +24 -4
  137. package/dist/bridge/transcripts.d.ts +15 -2
  138. package/dist/bridge/transcripts.js +47 -16
  139. package/dist/bridge/turn-records.d.ts +85 -0
  140. package/dist/bridge/turn-records.js +143 -0
  141. package/dist/bridge/uploads.d.ts +3 -0
  142. package/dist/bridge/uploads.js +14 -0
  143. package/dist/bridge/usage.d.ts +56 -10
  144. package/dist/bridge/usage.js +190 -45
  145. package/dist/bridge-hook.mjs +27975 -20636
  146. package/dist/cli/claude-unmanaged.d.ts +12 -0
  147. package/dist/cli/claude-unmanaged.js +105 -0
  148. package/dist/cli/schedules.js +2 -1
  149. package/dist/cli/session-start.js +10 -1
  150. package/dist/cli/session-stop.js +9 -1
  151. package/dist/cli-registry.js +31 -6
  152. package/dist/data/task-receipts.d.ts +19 -0
  153. package/dist/data/task-receipts.js +68 -0
  154. package/dist/data/tasks.js +4 -1
  155. package/dist/generated/memory-ui-graph.browser.js +63 -63
  156. package/dist/graph-core/model.js +24 -3
  157. package/dist/graph-core/types.d.ts +4 -1
  158. package/dist/graph-core/types.js +1 -0
  159. package/dist/init/init-preset.js +7 -3
  160. package/dist/init/init-uninstall.js +2 -11
  161. package/dist/init/teardown.d.ts +3 -0
  162. package/dist/init/teardown.js +47 -0
  163. package/dist/link/context.js +21 -9
  164. package/dist/mcp/plugin-mode.js +1 -1
  165. package/dist/memory-ui-graph.runtime.js +63 -63
  166. package/dist/modules/code-package.d.ts +1 -0
  167. package/dist/modules/code-package.js +36 -7
  168. package/dist/modules/registry.js +17 -16
  169. package/dist/profile-store.d.ts +6 -0
  170. package/dist/profile-store.js +25 -1
  171. package/dist/shell/graph/glyphs.js +4 -0
  172. package/dist/shell/graph/graph-view.js +2 -0
  173. package/dist/status.js +7 -1
  174. package/dist/sync/task-claim.js +3 -2
  175. package/dist/task/lifecycle.js +25 -4
  176. package/dist/test-global-setup.js +5 -0
  177. package/dist/tools/dispatch.js +52 -4
  178. package/dist/tools/tasks.js +10 -1
  179. package/package.json +1 -1
  180. package/plugins/opencode/phren-transcript.js +87 -4
  181. package/starter/global/AGENTS.md +4 -0
  182. package/starter/global/skills/conductor/SKILL.md +51 -4
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { type DispatchHost } from "./dispatch-hosts.js";
3
3
  import { type Json, type Provider, type Target } from "./protocol.js";
4
+ import { type BriefArrival } from "./launch-brief.js";
4
5
  export declare const projectName: z.ZodString;
5
6
  export declare const dispatchSchema: z.ZodObject<{
6
7
  computer: z.ZodUnion<readonly [z.ZodLiteral<"anywhere">, z.ZodString]>;
@@ -11,6 +12,28 @@ export declare const dispatchSchema: z.ZodObject<{
11
12
  opencode: "opencode";
12
13
  }>;
13
14
  model: z.ZodOptional<z.ZodString>;
15
+ effort: z.ZodOptional<z.ZodEnum<{
16
+ high: "high";
17
+ low: "low";
18
+ max: "max";
19
+ medium: "medium";
20
+ minimal: "minimal";
21
+ xhigh: "xhigh";
22
+ }>>;
23
+ account: z.ZodOptional<z.ZodString>;
24
+ permissionMode: z.ZodOptional<z.ZodEnum<{
25
+ auto: "auto";
26
+ "auto-edits": "auto-edits";
27
+ "full-access": "full-access";
28
+ supervised: "supervised";
29
+ }>>;
30
+ releaseActions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
31
+ "app-store": "app-store";
32
+ deploy: "deploy";
33
+ "github-admin": "github-admin";
34
+ merge: "merge";
35
+ publish: "publish";
36
+ }>>>;
14
37
  prompt: z.ZodString;
15
38
  label: z.ZodString;
16
39
  parent: z.ZodOptional<z.ZodObject<{
@@ -48,7 +71,7 @@ export declare const originPaneSchema: z.ZodObject<{
48
71
  pane: z.ZodString;
49
72
  }, z.core.$strict>;
50
73
  export type OriginPane = z.infer<typeof originPaneSchema>;
51
- export declare const workerStates: readonly ["working", "done", "needs-you", "failed", "blocked", "gone"];
74
+ export declare const workerStates: readonly ["working", "done", "needs-you", "failed", "blocked", "stalled", "gone"];
52
75
  export type WorkerState = typeof workerStates[number];
53
76
  declare const receiptSchema: z.ZodObject<{
54
77
  computer: z.ZodUnion<readonly [z.ZodLiteral<"anywhere">, z.ZodString]>;
@@ -59,6 +82,28 @@ declare const receiptSchema: z.ZodObject<{
59
82
  opencode: "opencode";
60
83
  }>;
61
84
  model: z.ZodOptional<z.ZodString>;
85
+ effort: z.ZodOptional<z.ZodEnum<{
86
+ high: "high";
87
+ low: "low";
88
+ max: "max";
89
+ medium: "medium";
90
+ minimal: "minimal";
91
+ xhigh: "xhigh";
92
+ }>>;
93
+ account: z.ZodOptional<z.ZodString>;
94
+ permissionMode: z.ZodOptional<z.ZodEnum<{
95
+ auto: "auto";
96
+ "auto-edits": "auto-edits";
97
+ "full-access": "full-access";
98
+ supervised: "supervised";
99
+ }>>;
100
+ releaseActions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
101
+ "app-store": "app-store";
102
+ deploy: "deploy";
103
+ "github-admin": "github-admin";
104
+ merge: "merge";
105
+ publish: "publish";
106
+ }>>>;
62
107
  label: z.ZodString;
63
108
  parent: z.ZodOptional<z.ZodObject<{
64
109
  provider: z.ZodEnum<{
@@ -125,7 +170,13 @@ declare const receiptSchema: z.ZodObject<{
125
170
  startingToken: z.ZodString;
126
171
  }, z.core.$strip>]>>;
127
172
  error: z.ZodOptional<z.ZodString>;
173
+ brief: z.ZodOptional<z.ZodEnum<{
174
+ launch: "launch";
175
+ typed: "typed";
176
+ }>>;
128
177
  granted: z.ZodOptional<z.ZodString>;
178
+ authority: z.ZodOptional<z.ZodString>;
179
+ authorityConfirmed: z.ZodOptional<z.ZodString>;
129
180
  skipped: z.ZodOptional<z.ZodArray<z.ZodObject<{
130
181
  computer: z.ZodString;
131
182
  reason: z.ZodString;
@@ -151,11 +202,14 @@ declare const receiptSchema: z.ZodObject<{
151
202
  failed: "failed";
152
203
  gone: "gone";
153
204
  "needs-you": "needs-you";
205
+ stalled: "stalled";
154
206
  working: "working";
155
207
  }>;
156
208
  since: z.ZodString;
157
209
  checkedAt: z.ZodString;
158
210
  sawWorking: z.ZodBoolean;
211
+ background: z.ZodOptional<z.ZodNumber>;
212
+ waitingSince: z.ZodOptional<z.ZodString>;
159
213
  }, z.core.$strict>>;
160
214
  returned: z.ZodOptional<z.ZodObject<{
161
215
  state: z.ZodEnum<{
@@ -164,19 +218,56 @@ declare const receiptSchema: z.ZodObject<{
164
218
  failed: "failed";
165
219
  gone: "gone";
166
220
  "needs-you": "needs-you";
221
+ stalled: "stalled";
167
222
  }>;
168
223
  at: z.ZodString;
169
224
  reply: z.ZodOptional<z.ZodString>;
170
225
  error: z.ZodOptional<z.ZodString>;
171
226
  truncated: z.ZodOptional<z.ZodBoolean>;
172
227
  question: z.ZodOptional<z.ZodString>;
228
+ stalledSince: z.ZodOptional<z.ZodString>;
229
+ stallFor: z.ZodOptional<z.ZodNumber>;
173
230
  turn: z.ZodOptional<z.ZodString>;
174
231
  read: z.ZodBoolean;
175
232
  notifiedAt: z.ZodOptional<z.ZodString>;
233
+ background: z.ZodOptional<z.ZodNumber>;
234
+ waited: z.ZodOptional<z.ZodNumber>;
235
+ }, z.core.$strict>>;
236
+ approval: z.ZodOptional<z.ZodObject<{
237
+ actionId: z.ZodString;
238
+ tool: z.ZodString;
239
+ title: z.ZodOptional<z.ZodString>;
240
+ request: z.ZodOptional<z.ZodString>;
241
+ requestKind: z.ZodOptional<z.ZodEnum<{
242
+ command: "command";
243
+ edit: "edit";
244
+ other: "other";
245
+ question: "question";
246
+ tool: "tool";
247
+ }>>;
248
+ terminal: z.ZodOptional<z.ZodBoolean>;
249
+ conductor: z.ZodOptional<z.ZodObject<{
250
+ action: z.ZodEnum<{
251
+ dispatch: "dispatch";
252
+ hand_off: "hand_off";
253
+ }>;
254
+ project: z.ZodOptional<z.ZodString>;
255
+ computer: z.ZodOptional<z.ZodString>;
256
+ }, z.core.$strict>>;
257
+ expiresAt: z.ZodOptional<z.ZodString>;
258
+ at: z.ZodString;
259
+ pushed: z.ZodOptional<z.ZodBoolean>;
176
260
  }, z.core.$strict>>;
177
261
  }, z.core.$strict>;
178
262
  export type Receipt = z.infer<typeof receiptSchema>;
179
- export declare function dispatchProjectDirectory(project: unknown): Promise<string>;
263
+ /**
264
+ * The project's folder on this computer. The store syncs between computers,
265
+ * so its shared `sourcePath` is often another machine's folder: this
266
+ * machine's `sourcePaths` entry wins, as everywhere else in phren. With
267
+ * neither here, a git checkout named after the project in a usual project
268
+ * root is taken (the owner's layout is `~/Projects/<name>` on every computer).
269
+ */
270
+ export declare function dispatchProjectDirectory(project: unknown, home?: string): Promise<string>;
180
271
  /**
181
272
  * Change one settled receipt: read it, let `change` edit it, and write it back
182
273
  * when `change` returns true. Updates run one at a time in this process, and a
@@ -186,6 +277,29 @@ export declare function updateReceipt(receiptID: string, change: (receipt: Recei
186
277
  /** One bounded line for a log or a receipt: a Bridge message, an errno code, or the error's first line. */
187
278
  export declare function failureReason(error: unknown): string;
188
279
  export declare function dispatchStatus(): Promise<Receipt[]>;
280
+ /** `caller` (a conductor's name and host key) asks a peer whether it links this computer back:
281
+ * `outside` is a peer in another set, which a conductor does not dispatch to. */
282
+ type Room = {
283
+ source: string;
284
+ account?: string;
285
+ leftPercent?: number;
286
+ exhausted?: boolean;
287
+ until?: string;
288
+ };
289
+ /** The account this dispatch would run under there, as its capacity probe reports it: Codex's one, or the named Claude home. */
290
+ export declare function roomFor(data: {
291
+ harness: string;
292
+ account?: string;
293
+ }, usage: readonly Room[] | undefined): Room | undefined;
294
+ /** Why `anywhere` must not pick a computer for quota: only an account with none left (at 100% or refusing requests).
295
+ * Low quota is not a reason; the owner often wants it used before it resets. */
296
+ export declare function outOfQuota(data: {
297
+ harness: string;
298
+ account?: string;
299
+ }, usage: readonly Room[] | undefined, now?: number): string | undefined;
300
+ /** What the worker's own hooks reported for a brief that went with its
301
+ * launch, or undefined when the receiving Hook has no such brief. */
302
+ export declare function arrivalOf(peer: Pick<DispatchHost, "request">, id: string): Promise<BriefArrival | undefined>;
189
303
  export interface DispatchIdentity {
190
304
  computerID: string;
191
305
  validateParentTarget: (target: Target) => Promise<unknown>;
@@ -198,13 +312,24 @@ export interface DispatchIdentity {
198
312
  export declare class DispatchService {
199
313
  private readonly identity?;
200
314
  private readonly local;
315
+ private readonly settleIntervalMs;
201
316
  private active;
202
317
  /** `local` is this computer as a dispatch destination (its own Hook's
203
318
  * socket); tests replace it so they never reach a real Hook. */
204
- constructor(identity?: DispatchIdentity | undefined, local?: () => DispatchHost);
319
+ constructor(identity?: DispatchIdentity | undefined, local?: () => DispatchHost, settleIntervalMs?: number);
205
320
  /** `originValue` is the local pane the request came from, as its agent's
206
321
  * Herdr variables name it; a pane without a running agent is left out. */
207
322
  dispatch(input: unknown, originValue?: unknown): Promise<Json>;
323
+ /**
324
+ * A brief that went with the launch: wait for the worker's hook to confirm
325
+ * it by dispatch id. A startup screen (folder trust, sign-in) holds the
326
+ * prompt until the owner answers it, and the harness then submits it by
327
+ * itself, so that is not a failure. Neither confirmed nor held reads
328
+ * uncertain, and the returns loop keeps asking.
329
+ */
330
+ private confirmLaunched;
331
+ /** The query a conductor's dispatch sends with each capacity probe; undefined for any other caller. */
332
+ private conductorCaller;
208
333
  private origin;
209
334
  }
210
335
  export {};