@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
@@ -3,14 +3,23 @@ import { lstat, mkdir, readFile, readdir, realpath, stat } from "node:fs/promise
3
3
  import path from "node:path";
4
4
  import { z } from "zod";
5
5
  import { logger } from "../logger.js";
6
- import { readProjectConfig } from "../project-config.js";
6
+ import { homeDir } from "../home-paths.js";
7
+ import { getMachineName } from "../machine-identity.js";
8
+ import { getProjectSourcePath } from "../project-config.js";
7
9
  import { computerName } from "./computers.js";
8
10
  import { dispatchParentSchema, validateDispatchParent } from "./dispatch-tree.js";
9
- import { grantLabel, listGrants, matchGrant } from "./grants.js";
11
+ import { findGrant, grantLabel, permissionModeAllowed, DEFAULT_MAX_PERMISSION_MODE } from "./grants.js";
12
+ import { checkAgentDispatch, projectAuthority, readAuthority, RELEASE_ACTIONS, releaseAction } from "./authority.js";
10
13
  import { hookPeers } from "./peers.js";
14
+ import { callerQuery, localCaller, oneWayHint } from "./conductor-group.js";
15
+ import { recordedConductor } from "./conductor-role.js";
16
+ import { linkedComputer } from "./computer-identity.js";
11
17
  import { isLocalComputer, localHost, peerHost } from "./dispatch-hosts.js";
12
- import { atomic, BridgeError, bridgeRoot, id, PROTOCOL, provider, serverName, startingTargetSchema, targetSchema } from "./protocol.js";
18
+ import { atomic, BridgeError, bridgeRoot, id, launchEfforts, PERMISSION_MODES, PROTOCOL, provider, serverName, startingTargetSchema, targetSchema } from "./protocol.js";
13
19
  import { phrenStoreRoot } from "./transcripts.js";
20
+ import { isAccountSlug } from "./claude-accounts.js";
21
+ import { hasUsable } from "./harnesses.js";
22
+ import { arrivalSchema } from "./launch-brief.js";
14
23
  const text = (max) => z.string().min(1).max(max).refine(value => !!value.trim() && !/[\x00-\x1f\x7f]/.test(value));
15
24
  export const projectName = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/);
16
25
  export const dispatchSchema = z.object({
@@ -18,6 +27,12 @@ export const dispatchSchema = z.object({
18
27
  project: projectName.describe("Project slug registered on the receiving computer."),
19
28
  harness: z.enum(["codex", "claude", "opencode"]).describe("Agent harness on the receiving computer."),
20
29
  model: text(200).optional().describe("Explicit model, otherwise the remote harness default."),
30
+ effort: z.enum(launchEfforts).optional().describe("Reasoning effort for the worker (minimal, low, medium, high, xhigh, max), otherwise the harness default."),
31
+ account: z.string().refine(isAccountSlug, "Account must be default or a lowercase slug.").optional()
32
+ .describe("Claude account id to run the worker under (default, or a slug from `phren bridge accounts`). anywhere only picks computers where that account is signed in; a named computer without it fails."),
33
+ permissionMode: z.enum(PERMISSION_MODES).optional().describe("Permission mode the worker starts in: supervised, auto-edits, auto or full-access (Claude and Codex only); otherwise the receiving computer's own default."),
34
+ releaseActions: z.array(releaseAction).min(1).max(RELEASE_ACTIONS.length).optional()
35
+ .describe("Release-type actions the brief asks the worker to do (merge, publish, deploy, app-store, github-admin). Ask-first projects refuse them from an agent unless the owner confirmed."),
21
36
  prompt: z.string().min(1).max(32768).refine(value => !/[\x00-\x08\x0b-\x1f\x7f]/.test(value)).describe("Worker brief, at most 32768 characters."),
22
37
  label: text(200).describe("Short task label."),
23
38
  parent: dispatchParentSchema.optional().describe("Explicit local conversation parent for work-tree attachment."),
@@ -26,41 +41,74 @@ export const dispatchSchema = z.object({
26
41
  const remoteTarget = z.union([targetSchema, startingTargetSchema]);
27
42
  /** The local pane that asked for the dispatch, where return notices go. */
28
43
  export const originPaneSchema = z.object({ server: serverName, workspace: id, tab: id, pane: id }).strict();
29
- export const workerStates = ["working", "done", "needs-you", "failed", "blocked", "gone"];
44
+ export const workerStates = ["working", "done", "needs-you", "failed", "blocked", "stalled", "gone"];
30
45
  const timestamp = z.string().datetime();
31
46
  const receiptSchema = dispatchSchema.omit({ prompt: true }).extend({
32
47
  id: z.string().uuid(), createdAt: z.string().datetime(), updatedAt: z.string().datetime(),
33
48
  computerId: z.string().uuid().optional(),
34
49
  state: z.enum(["launching", "sending", "accepted", "uncertain", "failed"]),
35
50
  target: remoteTarget.optional(), error: z.string().max(500).optional(),
51
+ brief: z.enum(["launch", "typed"]).optional()
52
+ .describe("How the brief reached the worker: as its first prompt at launch (confirmed by the worker's hook), or typed into its pane."),
36
53
  granted: z.string().max(200).optional().describe("Scope of the conductor grant that allowed this call."),
54
+ authority: z.string().max(600).optional().describe("The release authority policy's line for this project, as a conductor quotes it."),
55
+ authorityConfirmed: z.string().datetime().optional().describe("When the owner confirmed the ask-first release actions this agent dispatch used."),
37
56
  skipped: z.array(z.object({ computer: computerName, reason: z.string().max(200) }).strict()).max(32).optional()
38
57
  .describe("Computers left out of anywhere placement, with the reason each could not report capacity."),
39
58
  origin: originPaneSchema.extend({ agent: provider, terminal: z.string().min(1).max(200) }).strict().optional()
40
59
  .describe("The local agent pane that placed this dispatch; return notices go there."),
41
- worker: z.object({ state: z.enum(workerStates), since: timestamp, checkedAt: timestamp, sawWorking: z.boolean() }).strict().optional()
60
+ worker: z.object({ state: z.enum(workerStates), since: timestamp, checkedAt: timestamp, sawWorking: z.boolean(),
61
+ background: z.number().int().min(0).max(999).optional().describe("The most background tasks seen running while the worker was working."),
62
+ waitingSince: timestamp.optional().describe("When the dispatching Hook first saw the worker's finished turn waiting on background tasks; bounds that wait.") }).strict().optional()
42
63
  .describe("The worker pane's last observed state."),
43
64
  returned: z.object({
44
- state: z.enum(["done", "needs-you", "failed", "blocked", "gone"]), at: timestamp,
65
+ state: z.enum(["done", "needs-you", "failed", "blocked", "stalled", "gone"]), at: timestamp,
45
66
  reply: z.string().max(4000).optional(), error: z.string().max(500).optional(), truncated: z.boolean().optional(), question: z.string().max(200).optional(),
67
+ stalledSince: timestamp.optional(), stallFor: z.number().nonnegative().optional(),
46
68
  turn: z.string().regex(/^[a-f0-9]{16}$/).optional(), read: z.boolean(), notifiedAt: timestamp.optional(),
69
+ background: z.number().int().min(1).max(999).optional().describe("Background tasks the worker left running when it was counted done."),
70
+ waited: z.number().int().min(1).max(999).optional().describe("The most background tasks the worker waited on before it finished."),
47
71
  }).strict().optional().describe("The latest return: the worker finished, needs the owner, failed, is blocked or is gone."),
72
+ approval: z.object({
73
+ actionId: z.string().min(1).max(200), tool: z.string().max(200), title: z.string().max(200).optional(), request: z.string().max(500).optional(),
74
+ requestKind: z.enum(["command", "tool", "edit", "question", "other"]).optional(), terminal: z.boolean().optional(),
75
+ conductor: z.object({ action: z.enum(["dispatch", "hand_off"]), project: z.string().max(200).optional(), computer: z.string().max(200).optional() }).strict().optional(),
76
+ expiresAt: z.string().max(40).optional(), at: timestamp, pushed: z.boolean().optional(),
77
+ }).strict().optional().describe("A permission request the worker is waiting on, forwarded by its Hook; answer it with dispatch_approve."),
48
78
  });
49
- export async function dispatchProjectDirectory(project) {
50
- const name = projectName.parse(project);
51
- const source = readProjectConfig(phrenStoreRoot(), name).sourcePath;
79
+ /** Where a checkout usually sits when the store names none for this computer. */
80
+ const CHECKOUT_ROOTS = ["Projects", "projects", "Sites", "Code", "code", "dev", "src", "repos"];
81
+ async function directoryAt(source) {
52
82
  if (typeof source !== "string" || !path.isAbsolute(source) || /[\x00-\x1f\x7f]/.test(source))
53
- throw new BridgeError(404, "Project has no absolute sourcePath on this computer.");
83
+ return undefined;
54
84
  const directory = await realpath(source).catch(() => undefined);
55
- if (!directory || !(await stat(directory)).isDirectory())
56
- throw new BridgeError(404, "Project is not on this computer.");
57
- return directory;
85
+ return directory && (await stat(directory)).isDirectory() ? directory : undefined;
86
+ }
87
+ /**
88
+ * The project's folder on this computer. The store syncs between computers,
89
+ * so its shared `sourcePath` is often another machine's folder: this
90
+ * machine's `sourcePaths` entry wins, as everywhere else in phren. With
91
+ * neither here, a git checkout named after the project in a usual project
92
+ * root is taken (the owner's layout is `~/Projects/<name>` on every computer).
93
+ */
94
+ export async function dispatchProjectDirectory(project, home = homeDir()) {
95
+ const name = projectName.parse(project);
96
+ const configured = await directoryAt(getProjectSourcePath(phrenStoreRoot(), name));
97
+ if (configured)
98
+ return configured;
99
+ for (const root of [...(process.env.PROJECTS_DIR ? [process.env.PROJECTS_DIR] : []), ...CHECKOUT_ROOTS.map(folder => path.join(home, folder))]) {
100
+ const checkout = await directoryAt(path.join(root, name));
101
+ if (checkout && await stat(path.join(checkout, ".git")).catch(() => undefined))
102
+ return checkout;
103
+ }
104
+ throw new BridgeError(404, `Project ${name} is not on this computer: the store names no folder for ${getMachineName()} that exists here, and there is no ~/Projects/${name} checkout.`);
58
105
  }
59
106
  async function save(receipt) {
60
107
  const root = path.join(bridgeRoot(), "dispatches");
61
108
  await mkdir(root, { recursive: true, mode: 0o700 });
62
109
  await atomic(path.join(root, `${receipt.id}.json`), receipt);
63
110
  }
111
+ const IGNORED_MODE = "The receiving Hook is older and ignored permissionMode; the worker runs in that computer's default mode. Update its Hook.";
64
112
  const MAX_RECEIPT_BYTES = 65_536;
65
113
  let receiptUpdates = Promise.resolve();
66
114
  /**
@@ -125,39 +173,89 @@ export async function dispatchStatus() {
125
173
  }
126
174
  return receipts.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
127
175
  }
128
- async function capacity(host) {
129
- const value = await host.request("/v1/dispatch/capacity");
176
+ async function capacity(host, caller) {
177
+ const value = await host.request(caller && !host.local ? `/v1/dispatch/capacity?${caller}` : "/v1/dispatch/capacity");
130
178
  const result = z.object({ product: z.literal("phren-hook"), protocol: z.literal(PROTOCOL), working: z.number().int().nonnegative(),
131
- servers: z.array(z.string()), computer: z.object({ id: z.string().uuid() }).passthrough() }).parse(value);
179
+ servers: z.array(z.string()), computer: z.object({ id: z.string().uuid() }).passthrough(),
180
+ // Missing from an older Hook, or when its inventory was not ready in time: unknown, not unavailable.
181
+ harnesses: z.array(z.object({ source: z.string(), installed: z.boolean(), usable: z.boolean(), reason: z.string().optional(),
182
+ accounts: z.array(z.object({ id: z.string(), usable: z.boolean(), reason: z.string().optional() }).passthrough()).optional() }).passthrough()).optional(),
183
+ // Missing from an older Hook or a slow read: that computer's quota is unknown, so it is never ruled out by it.
184
+ usage: z.array(z.object({ source: z.string(), account: z.string().optional(), leftPercent: z.number().min(0).max(100).optional(),
185
+ exhausted: z.boolean().optional(), until: z.string().max(40).optional() }).passthrough()).max(64).optional(),
186
+ knowsCaller: z.boolean().optional() }).parse(value);
132
187
  // This computer places on whichever Herdr server its own Hook runs.
133
188
  if (host.local && !result.servers.includes(host.server) && result.servers[0])
134
189
  host.server = result.servers[0];
135
190
  if (!result.servers.includes(host.server))
136
191
  throw new BridgeError(503, "Herdr is not running on the selected computer. Headless dispatch is not installed yet.");
137
- return { working: result.working, computerId: result.computer.id };
192
+ return { working: result.working, computerId: result.computer.id, ...(result.harnesses ? { harnesses: result.harnesses } : {}),
193
+ ...(result.usage ? { usage: result.usage } : {}),
194
+ ...(caller && result.knowsCaller === false ? { outside: true } : {}) };
195
+ }
196
+ /** The account this dispatch would run under there, as its capacity probe reports it: Codex's one, or the named Claude home. */
197
+ export function roomFor(data, usage) {
198
+ const account = data.account ?? "default";
199
+ return usage?.find(item => item.source === data.harness && (data.harness !== "claude" || (item.account ?? "default") === account));
200
+ }
201
+ /** Why `anywhere` must not pick a computer for quota: only an account with none left (at 100% or refusing requests).
202
+ * Low quota is not a reason; the owner often wants it used before it resets. */
203
+ export function outOfQuota(data, usage, now = Date.now()) {
204
+ const room = roomFor(data, usage);
205
+ if (!room?.exhausted)
206
+ return undefined;
207
+ const until = room.until ? Date.parse(room.until) : NaN;
208
+ const minutes = Number.isFinite(until) ? Math.max(1, Math.round((until - now) / 60_000)) : undefined;
209
+ const back = minutes === undefined ? "" : minutes >= 1440 ? ` for about ${Math.round(minutes / 1440)} more days` : minutes >= 60 ? ` for about ${Math.round(minutes / 60)} more hours` : ` for about ${minutes} more minutes`;
210
+ return `Its ${data.harness}${data.harness === "claude" ? ` account ${data.account ?? "default"}` : ""} has no quota left${back}.`;
211
+ }
212
+ /** Why a computer cannot run this dispatch's harness and account, or undefined when it can or cannot yet be told.
213
+ * `unknown` (no `harnesses`) only counts against a computer when a non-default account was asked for. */
214
+ function unusable(data, harnesses, strictUnknown) {
215
+ if (!harnesses)
216
+ return strictUnknown && data.account && data.account !== "default" ? "Its Hook does not report harnesses or accounts (update it)." : undefined;
217
+ const availability = hasUsable({ harnesses }, data.harness, data.account);
218
+ return availability.ok ? undefined : availability.reason;
138
219
  }
139
220
  /**
140
221
  * A freshly started agent may not have written its session yet when the launch
141
- * returns, so the launch carries no target. Ask the remote pane for its session
142
- * for a few seconds before giving up; the pane ids from the launch are enough
143
- * to find it.
222
+ * returns, so the launch carries no target. Ask the remote pane for a few
223
+ * seconds; the pane ids from the launch are enough to find it. Until its first
224
+ * prompt a new Codex or Claude has no conversation at all, only a starting
225
+ * binding, and that is the target its brief goes to (as the phone's first
226
+ * message does). `status` is the pane's last status when neither appeared.
144
227
  */
145
- async function settledTarget(peer, launched, harness) {
228
+ async function settledTarget(peer, launched, harness, intervalMs = 1_000) {
146
229
  const workspace = launched.workspaceId, tab = launched.tabId, pane = launched.paneId;
147
230
  if (typeof workspace !== "string" || typeof tab !== "string" || typeof pane !== "string")
148
- return undefined;
231
+ return {};
232
+ let status;
149
233
  for (let attempt = 0; attempt < 15; attempt++) {
150
- await new Promise(resolve => setTimeout(resolve, 1_000));
234
+ await new Promise(resolve => setTimeout(resolve, intervalMs));
151
235
  try {
152
236
  const result = await peer.request(`/v1/workspaces/panes?server=${encodeURIComponent(peer.server)}&groupId=${encodeURIComponent(workspace)}&childId=${encodeURIComponent(tab)}`);
153
237
  const found = (Array.isArray(result.panes) ? result.panes : []).find((p) => p && typeof p === "object" && p.id === pane);
238
+ if (typeof found?.agentStatus === "string")
239
+ status = found.agentStatus;
240
+ const binding = { server: peer.server, workspace, tab, pane, source: harness };
154
241
  const session = found?.sessionId;
155
242
  if (typeof session === "string" && session)
156
- return { server: peer.server, workspace, tab, pane, source: harness, session };
243
+ return { target: { ...binding, session } };
244
+ if (found?.starting === true && typeof found.startingToken === "string")
245
+ return { target: { ...binding, starting: true, startingToken: found.startingToken } };
157
246
  }
158
247
  catch { /* The pane list can lag the launch; try again. */ }
159
248
  }
160
- return undefined;
249
+ return { status };
250
+ }
251
+ /** The new agent is holding a screen of its own before it takes any prompt:
252
+ * Claude's folder trust or a sign-in. Only the owner answers those. */
253
+ class StartupScreen extends Error {
254
+ status;
255
+ constructor(status) {
256
+ super(`The agent is ${status} on a startup screen.`);
257
+ this.status = status;
258
+ }
161
259
  }
162
260
  /**
163
261
  * Sends the brief. A fresh agent can read `unknown` to Herdr for a while (long
@@ -166,10 +264,11 @@ async function settledTarget(peer, launched, harness) {
166
264
  * unclassified; a pane that is blocked or waiting really needs its terminal,
167
265
  * and that refusal stands.
168
266
  */
169
- async function sendBrief(peer, target, text) {
267
+ async function sendBrief(peer, target, text, deliveryId) {
170
268
  for (let attempt = 0;; attempt++) {
269
+ // One delivery id for every attempt: the receiving Hook types it once.
171
270
  try {
172
- return await peer.request("/v1/prompt", { target, text });
271
+ return await peer.request("/v1/prompt", { target, text, deliveryId });
173
272
  }
174
273
  catch (error) {
175
274
  const unsettled = error instanceof BridgeError && error.status === 409 && /needs input in the terminal first/.test(error.message);
@@ -178,26 +277,61 @@ async function sendBrief(peer, target, text) {
178
277
  const panes = await peer.request(`/v1/workspaces/panes?server=${encodeURIComponent(peer.server)}&groupId=${encodeURIComponent(String(target.workspace))}&childId=${encodeURIComponent(String(target.tab))}`).catch(() => undefined);
179
278
  const pane = (Array.isArray(panes?.panes) ? panes.panes : []).find((p) => p && typeof p === "object" && p.id === target.pane);
180
279
  const status = pane?.agentStatus;
280
+ // Nothing was typed: the refusal came before any text reached the pane.
181
281
  if (typeof status === "string" && ["blocked", "waiting"].includes(status))
182
- throw error;
282
+ throw new StartupScreen(status);
183
283
  await new Promise(resolve => setTimeout(resolve, 1_000));
184
284
  }
185
285
  }
186
286
  }
287
+ /** What the worker's own hooks reported for a brief that went with its
288
+ * launch, or undefined when the receiving Hook has no such brief. */
289
+ export async function arrivalOf(peer, id) {
290
+ const answer = await peer.request(`/v1/dispatch/arrival?id=${encodeURIComponent(id)}`);
291
+ const arrival = answer.arrival === null ? undefined : arrivalSchema.parse(answer.arrival);
292
+ return arrival;
293
+ }
294
+ /**
295
+ * A brief that went with the launch is the new agent's first prompt; its
296
+ * UserPromptSubmit hook echoes the dispatch id when the harness submits it.
297
+ * Waits for that echo, and returns the conversation it named.
298
+ */
299
+ async function awaitArrival(peer, id, intervalMs) {
300
+ let last = {};
301
+ for (let attempt = 0; attempt < ARRIVAL_ATTEMPTS; attempt++) {
302
+ await new Promise(resolve => setTimeout(resolve, intervalMs));
303
+ last = await arrivalOf(peer, id).catch(() => undefined) ?? last;
304
+ if (last.accepted)
305
+ break;
306
+ }
307
+ return last;
308
+ }
309
+ /** Claude and Codex take a few seconds to start, load their MCP servers and submit the prompt. */
310
+ const ARRIVAL_ATTEMPTS = 30;
311
+ /** The pane's status as the remote Hook lists it now. */
312
+ async function paneStatus(peer, launched) {
313
+ const panes = await peer.request(`/v1/workspaces/panes?server=${encodeURIComponent(peer.server)}&groupId=${encodeURIComponent(String(launched.workspaceId))}&childId=${encodeURIComponent(String(launched.tabId))}`).catch(() => undefined);
314
+ const pane = (Array.isArray(panes?.panes) ? panes.panes : []).find((p) => p && typeof p === "object" && p.id === launched.paneId);
315
+ return typeof pane?.agentStatus === "string" ? pane.agentStatus : undefined;
316
+ }
187
317
  export class DispatchService {
188
318
  identity;
189
319
  local;
320
+ settleIntervalMs;
190
321
  active = false;
191
322
  /** `local` is this computer as a dispatch destination (its own Hook's
192
323
  * socket); tests replace it so they never reach a real Hook. */
193
- constructor(identity, local = () => localHost()) {
324
+ constructor(identity, local = () => localHost(), settleIntervalMs = 1_000) {
194
325
  this.identity = identity;
195
326
  this.local = local;
327
+ this.settleIntervalMs = settleIntervalMs;
196
328
  }
197
329
  /** `originValue` is the local pane the request came from, as its agent's
198
330
  * Herdr variables name it; a pane without a running agent is left out. */
199
331
  async dispatch(input, originValue) {
200
332
  const data = dispatchSchema.parse(input);
333
+ if (data.permissionMode && data.harness === "opencode")
334
+ throw new BridgeError(400, "OpenCode takes its permissions from its own config; permissionMode is for Claude and Codex workers.");
201
335
  if (this.active)
202
336
  throw new BridgeError(429, "A dispatch is already being placed. Try again after its receipt arrives.");
203
337
  this.active = true;
@@ -212,17 +346,23 @@ export class DispatchService {
212
346
  // This computer needs no hooks.yaml entry, so a missing file only
213
347
  // matters when the dispatch names another computer.
214
348
  const here = this.local();
215
- const toLocal = data.computer !== "anywhere" && isLocalComputer(data.computer, here.names);
349
+ // An alias or hostname (`Mac`, `Squids-Mac-mini.local`) names the same computer as its hooks.yaml name.
350
+ const named = data.computer === "anywhere" || isLocalComputer(data.computer, here.names) ? undefined : await linkedComputer(data.computer).catch(() => undefined);
351
+ const toLocal = data.computer !== "anywhere" && (isLocalComputer(data.computer, here.names) || (named !== undefined && "local" in named));
352
+ const peerName = named && "peer" in named ? named.peer : data.computer;
216
353
  const enrolled = await hookPeers().catch(error => { if (toLocal || data.computer === "anywhere")
217
354
  return []; throw error; });
355
+ // A conductor dispatches only within its set: each peer says whether it links this computer back.
356
+ const caller = await this.conductorCaller(originValue);
218
357
  const peers = [...enrolled.map(candidate => peerHost(candidate)), here];
219
358
  let peer;
220
359
  let remoteComputerID;
221
360
  const skipped = [];
361
+ let incapable = false, spentSeen = false;
222
362
  if (data.computer === "anywhere") {
223
363
  const available = await Promise.all(peers.map(async (candidate) => {
224
364
  try {
225
- return { peer: candidate, ...await capacity(candidate) };
365
+ return { peer: candidate, ...await capacity(candidate, caller) };
226
366
  }
227
367
  catch (error) {
228
368
  // A peer that cannot report capacity sits out this placement, and the receipt says why.
@@ -231,42 +371,119 @@ export class DispatchService {
231
371
  }
232
372
  }));
233
373
  skipped.sort((a, b) => a.computer.localeCompare(b.computer));
234
- const selected = available.filter((item) => !!item)
374
+ const capable = available.filter((item) => !!item).filter(item => {
375
+ if (item.outside) {
376
+ skipped.push({ computer: item.peer.name, reason: oneWayHint(item.peer.name) });
377
+ return false;
378
+ }
379
+ const reason = unusable(data, item.harnesses, true);
380
+ if (reason)
381
+ incapable = true;
382
+ if (reason)
383
+ skipped.push({ computer: item.peer.name, reason: reason.slice(0, 200) });
384
+ if (reason)
385
+ return false;
386
+ // The one quota rule: never place a worker on an account with none left. Low quota still counts as room.
387
+ const spent = outOfQuota(data, item.usage);
388
+ if (spent) {
389
+ spentSeen = true;
390
+ skipped.push({ computer: item.peer.name, reason: spent });
391
+ }
392
+ return !spent;
393
+ });
394
+ skipped.sort((a, b) => a.computer.localeCompare(b.computer));
395
+ const selected = capable
235
396
  .sort((a, b) => a.working - b.working || a.peer.name.localeCompare(b.peer.name))[0];
236
397
  peer = selected?.peer;
237
398
  remoteComputerID = selected?.computerId;
399
+ if (!peer && spentSeen)
400
+ throw new BridgeError(503, `No connected computer has ${data.harness}${data.harness === "claude" ? ` account ${data.account ?? "default"}` : ""} quota left right now.`, { code: "out_of_quota", skipped });
238
401
  if (!peer)
239
- throw new BridgeError(503, "No enrolled computer with a running Herdr is connected.", skipped.length ? { skipped } : undefined);
402
+ throw new BridgeError(503, incapable ? `No enrolled computer with a running Herdr can run ${data.harness}${data.account ? ` account ${data.account}` : ""}.` : "No enrolled computer with a running Herdr is connected.", skipped.length ? { skipped } : undefined);
240
403
  }
241
404
  else {
242
- peer = toLocal ? peers.find(candidate => candidate.local) : peers.find(candidate => !candidate.local && candidate.name === data.computer);
405
+ peer = toLocal ? peers.find(candidate => candidate.local) : peers.find(candidate => !candidate.local && candidate.name === peerName);
243
406
  if (!peer)
244
407
  throw new BridgeError(404, "Unknown computer. Add its verified connection to hooks.yaml.");
245
- remoteComputerID = (await capacity(peer)).computerId;
408
+ const reported = await capacity(peer, caller);
409
+ if (reported.outside)
410
+ throw new BridgeError(409, `${peer.name} is not in this conductor's set. ${oneWayHint(peer.name)}`, { code: "outside_set" });
411
+ remoteComputerID = reported.computerId;
412
+ // A Hook that reports what it can run is believed. An older one that does not is left to answer the launch
413
+ // itself, except for a non-default account: it would ignore `account` and launch under its default login.
414
+ const reason = unusable(data, reported.harnesses, true);
415
+ if (reason)
416
+ throw new BridgeError(409, `${peer.name} cannot run ${data.harness}${data.account ? ` account ${data.account}` : ""}: ${reason}`);
417
+ }
418
+ const grant = await findGrant({ action: "dispatch", project: data.project, computer: peer.name });
419
+ // An agent (a call that names its pane) may start a worker only up to its grant's
420
+ // permission ceiling; the owner, calling from the phone or the CLI without a pane, is not capped.
421
+ const agent = originPaneSchema.safeParse(originValue).success;
422
+ if (data.permissionMode && agent && !permissionModeAllowed(data.permissionMode, grant)) {
423
+ throw new BridgeError(403, `No standing grant lets an agent start a worker in ${data.permissionMode} on ${peer.name}. Add maxPermissionMode: ${data.permissionMode} to a grant in conductor.yaml, or dispatch it yourself.`);
246
424
  }
247
- const grant = matchGrant(await listGrants(), { action: "dispatch", project: data.project, computer: peer.name });
425
+ // The owner's release authority policy binds an agent's dispatch (and may
426
+ // lower its mode); the owner's own dispatch only carries the policy's line.
427
+ const checked = agent ? await checkAgentDispatch(data, grant?.maxPermissionMode ?? DEFAULT_MAX_PERMISSION_MODE) : undefined;
428
+ if (checked?.permissionMode)
429
+ data.permissionMode = checked.permissionMode;
430
+ const authority = checked?.authority ?? await readAuthority().then(policy => projectAuthority(policy, data.project)).catch(() => undefined);
248
431
  const origin = await this.origin(originValue);
249
432
  // Prompts are sent over the pipe, never stored in the dispatch ledger.
250
433
  const { prompt, ...metadata } = data;
251
434
  const receipt = { ...metadata, computer: peer.name, computerId: remoteComputerID, id: randomUUID(),
252
435
  createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), state: "launching",
253
- ...(grant ? { granted: grantLabel(grant) } : {}), ...(skipped.length ? { skipped } : {}), ...(origin ? { origin } : {}) };
436
+ ...(grant ? { granted: grantLabel(grant) } : {}), ...(authority?.listed ? { authority: authority.line.slice(0, 600) } : {}),
437
+ ...(checked?.confirmation ? { authorityConfirmed: checked.confirmation.confirmedAt } : {}),
438
+ ...(skipped.length ? { skipped } : {}), ...(origin ? { origin } : {}) };
254
439
  await save(receipt);
255
440
  try {
256
- const launched = await peer.request(`/v1/workspaces/launch?server=${encodeURIComponent(peer.server)}`, { project: data.project, kind: data.harness, model: data.model, label: data.label });
257
- const target = remoteTarget.parse(launched.target ?? await settledTarget(peer, launched, data.harness));
441
+ // The brief goes with the launch: a Hook that can start the harness
442
+ // with it says so, and any other types it below.
443
+ const launched = await peer.request(`/v1/workspaces/launch?server=${encodeURIComponent(peer.server)}`, { project: data.project, kind: data.harness, model: data.model, ...(data.effort ? { effort: data.effort } : {}), ...(data.account ? { account: data.account } : {}), ...(data.permissionMode ? { permissionMode: data.permissionMode } : {}), label: data.label, brief: { id: receipt.id, text: prompt } });
444
+ // An older Hook ignores the field and starts the worker in its own default mode.
445
+ const ignored = data.permissionMode && launched.permissionMode !== data.permissionMode ? IGNORED_MODE : undefined;
446
+ if (launched.briefLaunched === true) {
447
+ receipt.brief = "launch";
448
+ await this.confirmLaunched(peer, receipt, launched);
449
+ if (ignored)
450
+ receipt.error = [receipt.error, ignored].filter(Boolean).join(" ").slice(0, 500);
451
+ receipt.updatedAt = new Date().toISOString();
452
+ await save(receipt);
453
+ return { ok: receipt.state === "accepted", ...receipt };
454
+ }
455
+ receipt.brief = "typed";
456
+ const settled = launched.target ? { target: launched.target } : await settledTarget(peer, launched, data.harness, this.settleIntervalMs);
457
+ if (!settled.target) {
458
+ if (["blocked", "waiting"].includes(String(settled.status ?? launched.agentStatus)))
459
+ throw new StartupScreen(String(settled.status ?? launched.agentStatus));
460
+ throw new BridgeError(504, `${data.harness} started in the new "${data.label}" pane on ${peer.name} but never showed a conversation or a starting pane (last status ${settled.status ?? "unknown"}), so the brief was not sent. The pane is still open.`);
461
+ }
462
+ const target = remoteTarget.parse(settled.target);
258
463
  if (target.source !== data.harness || target.server !== peer.server)
259
464
  throw new BridgeError(502, "The remote Hook returned a different launch target.");
260
465
  receipt.target = target;
261
466
  receipt.state = "sending";
262
467
  receipt.updatedAt = new Date().toISOString();
263
468
  await save(receipt);
264
- const result = await sendBrief(peer, receipt.target, prompt);
469
+ const result = await sendBrief(peer, receipt.target, prompt, `dispatch-${receipt.id}`);
265
470
  receipt.state = result.ok === true && result.deliveryUncertain !== true ? "accepted" : "uncertain";
471
+ if (ignored)
472
+ receipt.error = ignored;
266
473
  }
267
474
  catch (error) {
268
- receipt.state = receipt.state === "launching" && error instanceof BridgeError && [400, 404, 429].includes(error.status) ? "failed" : "uncertain";
269
- receipt.error = error instanceof BridgeError ? error.message.slice(0, 500) : "Remote delivery was not confirmed. Inspect this dispatch before retrying.";
475
+ if (error instanceof StartupScreen) {
476
+ // Known, not uncertain: the brief never reached the pane. Say where
477
+ // the owner answers, and let the returns loop tell the conductor once.
478
+ const question = `${data.harness} in "${data.label}" on ${peer.name} is waiting on a startup screen (folder trust or sign-in).`.slice(0, 200);
479
+ receipt.state = "failed";
480
+ receipt.error = `${question} The brief was not sent. Answer that screen in the pane (the phone can), then hand the brief off to the new session.`.slice(0, 500);
481
+ receipt.returned = { state: "needs-you", at: new Date().toISOString(), question, read: false };
482
+ }
483
+ else {
484
+ receipt.state = receipt.state === "launching" && error instanceof BridgeError && [400, 404, 429, 504].includes(error.status) ? "failed" : "uncertain";
485
+ receipt.error = error instanceof BridgeError ? error.message.slice(0, 500) : "Remote delivery was not confirmed. Inspect this dispatch before retrying.";
486
+ }
270
487
  }
271
488
  receipt.updatedAt = new Date().toISOString();
272
489
  await save(receipt);
@@ -276,6 +493,50 @@ export class DispatchService {
276
493
  this.active = false;
277
494
  }
278
495
  }
496
+ /**
497
+ * A brief that went with the launch: wait for the worker's hook to confirm
498
+ * it by dispatch id. A startup screen (folder trust, sign-in) holds the
499
+ * prompt until the owner answers it, and the harness then submits it by
500
+ * itself, so that is not a failure. Neither confirmed nor held reads
501
+ * uncertain, and the returns loop keeps asking.
502
+ */
503
+ async confirmLaunched(peer, receipt, launched) {
504
+ const known = remoteTarget.safeParse(launched.target);
505
+ if (known.success && known.data.source === receipt.harness && known.data.server === peer.server)
506
+ receipt.target = known.data;
507
+ receipt.state = "sending";
508
+ receipt.updatedAt = new Date().toISOString();
509
+ await save(receipt);
510
+ const held = (status) => ["blocked", "waiting"].includes(String(status));
511
+ const arrival = held(launched.agentStatus) ? await arrivalOf(peer, receipt.id).catch(() => undefined) ?? {}
512
+ : await awaitArrival(peer, receipt.id, this.settleIntervalMs);
513
+ const named = arrival.accepted?.target ?? arrival.started?.target;
514
+ if (named && named.source === receipt.harness && named.server === peer.server)
515
+ receipt.target = named;
516
+ if (arrival.accepted) {
517
+ receipt.state = "accepted";
518
+ return;
519
+ }
520
+ const status = held(launched.agentStatus) ? String(launched.agentStatus) : await paneStatus(peer, launched);
521
+ receipt.state = "uncertain";
522
+ if (held(status)) {
523
+ const question = `${receipt.harness} in "${receipt.label}" on ${receipt.computer} is waiting on a startup screen (folder trust or sign-in).`.slice(0, 200);
524
+ receipt.error = `${question} The brief is queued as its first prompt and starts once that screen is answered in the pane (the phone can).`.slice(0, 500);
525
+ receipt.returned = { state: "needs-you", at: new Date().toISOString(), question, read: false };
526
+ return;
527
+ }
528
+ receipt.error = `${receipt.harness} started with the brief on ${receipt.computer} but has not confirmed it yet (last status ${status ?? "unknown"}). The Hook keeps checking.`.slice(0, 500);
529
+ }
530
+ /** The query a conductor's dispatch sends with each capacity probe; undefined for any other caller. */
531
+ async conductorCaller(value) {
532
+ const pane = originPaneSchema.safeParse(value);
533
+ if (!pane.success)
534
+ return undefined;
535
+ const conductor = await recordedConductor().catch(() => undefined);
536
+ if (!conductor || conductor.server !== pane.data.server || conductor.pane !== pane.data.pane)
537
+ return undefined;
538
+ return callerQuery(await localCaller());
539
+ }
279
540
  async origin(value) {
280
541
  const pane = originPaneSchema.safeParse(value);
281
542
  if (!pane.success || !this.identity?.originAgent)
@@ -27,6 +27,8 @@ export declare const manifestSchema: z.ZodObject<{
27
27
  worktree: z.ZodString;
28
28
  model: z.ZodOptional<z.ZodString>;
29
29
  eventLog: z.ZodString;
30
+ nativeTranscript: z.ZodOptional<z.ZodString>;
31
+ unmanagedPid: z.ZodOptional<z.ZodNumber>;
30
32
  createdAt: z.ZodString;
31
33
  startedAt: z.ZodString;
32
34
  updatedAt: z.ZodString;
@@ -60,9 +62,11 @@ export interface FanoutChild {
60
62
  cwd: string;
61
63
  path: string;
62
64
  callId: string;
63
- state: "running" | "completed" | "failed";
65
+ state: "running" | "completed" | "failed" | "gone";
64
66
  /** `blocked: <type> <pattern>` when the plugin refused a permission. */
65
67
  reason?: string;
68
+ /** Actual launch time from a validated manifest; queued jobs omit it. */
69
+ startedAt?: string;
66
70
  finishedAt?: string;
67
71
  transcript: string;
68
72
  fanout: {
@@ -75,6 +79,7 @@ export declare function fanoutRoot(env?: NodeJS.ProcessEnv): string;
75
79
  /** Bind public worker identities to the canonical store as well as their parent. */
76
80
  export declare function fanoutChildID(root: string, manifest: FanoutManifest): string;
77
81
  export declare function containedFanoutRoot(env: NodeJS.ProcessEnv): Promise<string | undefined>;
82
+ export declare function nativeClaudeTranscript(candidate: string, session: string): Promise<string | undefined>;
78
83
  /** Read only manifests explicitly bound to the already validated parent. */
79
84
  export declare function fanoutChildren(parentProvider: Provider, parentSession: string, env?: NodeJS.ProcessEnv, parentComputer?: string): Promise<FanoutChild[]>;
80
85
  /** Every fan-out job's worktree with its task label and harness, whatever
@@ -107,6 +112,7 @@ export declare function blockedFanouts(env?: NodeJS.ProcessEnv): Promise<Blocked
107
112
  export declare function fanoutAsking(job: unknown, session: string, env?: NodeJS.ProcessEnv): Promise<{
108
113
  id: string;
109
114
  label: string;
115
+ worktree: string;
110
116
  parent: NonNullable<FanoutManifest["parent"]>;
111
117
  } | undefined>;
112
118
  export interface FanoutArchiveResult {