@indigoai-us/hq-cli 5.345.214 → 5.345.215-beta.0

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 (103) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/command-catalog.generated.d.ts +134 -7
  3. package/dist/command-catalog.generated.js +168 -7
  4. package/dist/commands/agents.d.ts +51 -1
  5. package/dist/commands/agents.js +154 -2
  6. package/dist/commands/bot-jobs.d.ts +2 -15
  7. package/dist/commands/bot-jobs.js +2 -94
  8. package/dist/commands/bot-runtime.d.ts +46 -5
  9. package/dist/commands/bot-runtime.js +228 -18
  10. package/dist/commands/bot.d.ts +16 -9
  11. package/dist/commands/bot.js +169 -51
  12. package/dist/commands/cloud.d.ts +66 -13
  13. package/dist/commands/cloud.js +120 -39
  14. package/dist/commands/company-restore.d.ts +23 -0
  15. package/dist/commands/company-restore.js +128 -0
  16. package/dist/commands/company.js +2 -0
  17. package/dist/commands/integrations-connect.d.ts +10 -3
  18. package/dist/commands/integrations-connect.js +87 -13
  19. package/dist/commands/lanes.js +26 -9
  20. package/dist/commands/sources.js +6 -0
  21. package/dist/commands/storage-offload.d.ts +12 -0
  22. package/dist/commands/storage-offload.js +41 -3
  23. package/dist/commands/sync-mode.js +5 -0
  24. package/dist/commands/whoami.js +4 -0
  25. package/dist/lib/bot/config.d.ts +1 -0
  26. package/dist/lib/bot/config.js +10 -0
  27. package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
  28. package/dist/lib/bot/eventbridge-cron.js +104 -0
  29. package/dist/lib/bot/fleet-local.d.ts +33 -1
  30. package/dist/lib/bot/fleet-local.js +215 -31
  31. package/dist/lib/bot/fleet-python.d.ts +3 -0
  32. package/dist/lib/bot/fleet-python.js +34 -4
  33. package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
  34. package/dist/lib/bot/fleet-runtime-sources.js +30 -0
  35. package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
  36. package/dist/lib/bot/legacy-provider-login.js +19 -2
  37. package/dist/lib/bot/prompt.js +1 -1
  38. package/dist/lib/bot/readiness.d.ts +8 -0
  39. package/dist/lib/bot/readiness.js +17 -3
  40. package/dist/lib/bot/runtime-auth.d.ts +30 -0
  41. package/dist/lib/bot/runtime-auth.js +94 -3
  42. package/dist/lib/bot/status.d.ts +2 -0
  43. package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
  44. package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
  45. package/dist/lib/capacity/collectors/grok.d.ts +5 -0
  46. package/dist/lib/capacity/collectors/grok.js +56 -5
  47. package/dist/lib/daemon/catalog.js +11 -1
  48. package/dist/lib/db/sqlite-binding.d.ts +1 -0
  49. package/dist/lib/db/sqlite-binding.js +1 -1
  50. package/dist/lib/delivery/artifacts.d.ts +99 -0
  51. package/dist/lib/delivery/artifacts.js +548 -0
  52. package/dist/lib/delivery/backup.d.ts +78 -0
  53. package/dist/lib/delivery/backup.js +343 -0
  54. package/dist/lib/delivery/cache.d.ts +29 -0
  55. package/dist/lib/delivery/cache.js +33 -0
  56. package/dist/lib/delivery/contracts.d.ts +142 -0
  57. package/dist/lib/delivery/contracts.js +289 -0
  58. package/dist/lib/delivery/credentials.d.ts +54 -0
  59. package/dist/lib/delivery/credentials.js +119 -0
  60. package/dist/lib/delivery/enrollment.d.ts +142 -0
  61. package/dist/lib/delivery/enrollment.js +382 -0
  62. package/dist/lib/delivery/identity.d.ts +25 -0
  63. package/dist/lib/delivery/identity.js +82 -0
  64. package/dist/lib/delivery/inbox.d.ts +116 -0
  65. package/dist/lib/delivery/inbox.js +260 -0
  66. package/dist/lib/delivery/migrations.d.ts +139 -0
  67. package/dist/lib/delivery/migrations.js +623 -0
  68. package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
  69. package/dist/lib/delivery/mqtt-adapter.js +242 -0
  70. package/dist/lib/delivery/mqtt.d.ts +61 -0
  71. package/dist/lib/delivery/mqtt.js +112 -0
  72. package/dist/lib/delivery/outbox.d.ts +95 -0
  73. package/dist/lib/delivery/outbox.js +187 -0
  74. package/dist/lib/delivery/provenance.d.ts +129 -0
  75. package/dist/lib/delivery/provenance.js +93 -0
  76. package/dist/lib/delivery/reconciler.d.ts +151 -0
  77. package/dist/lib/delivery/reconciler.js +492 -0
  78. package/dist/lib/delivery/restore.d.ts +35 -0
  79. package/dist/lib/delivery/restore.js +134 -0
  80. package/dist/lib/delivery/store.d.ts +161 -0
  81. package/dist/lib/delivery/store.js +940 -0
  82. package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
  83. package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
  84. package/dist/lib/delivery/workers/macos.d.ts +176 -0
  85. package/dist/lib/delivery/workers/macos.js +901 -0
  86. package/dist/lib/delivery/workers/windows-boundary.d.ts +453 -0
  87. package/dist/lib/delivery/workers/windows-boundary.js +693 -0
  88. package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
  89. package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
  90. package/dist/lib/delivery/workers/windows.d.ts +241 -0
  91. package/dist/lib/delivery/workers/windows.js +608 -0
  92. package/dist/lib/install/provider-wrappers.d.ts +2 -0
  93. package/dist/lib/install/provider-wrappers.js +68 -3
  94. package/dist/utils/cognito-callback-port.d.ts +14 -0
  95. package/dist/utils/cognito-callback-port.js +24 -0
  96. package/dist/utils/cognito-session.js +3 -3
  97. package/dist/utils/deleted-company-notice.d.ts +59 -0
  98. package/dist/utils/deleted-company-notice.js +156 -0
  99. package/dist/utils/login-browser.d.ts +1 -1
  100. package/dist/utils/login-browser.js +7 -5
  101. package/dist/utils/resident-package-preload.js +30 -15
  102. package/dist/utils/vault-api.js +7 -0
  103. package/package.json +7 -7
@@ -1,19 +1,33 @@
1
+ import { spawn } from "node:child_process";
2
+ import * as fs from "node:fs";
3
+ import * as os from "node:os";
4
+ import * as path from "node:path";
5
+ import { stripVTControlCharacters } from "node:util";
1
6
  import chalk from "chalk";
2
- import { ensureFleetRuntimeInstalled, fleetLocalDistributionInstalled, fleetReleaseImportsGrokCli, fleetRuntimeReady, installTargetFleetLocalDistribution, resolveFleetLocalTargetRelease, } from "../lib/bot/fleet-local.js";
7
+ import { checkClaudeCodeLogin } from "../lib/bot/claude-login.js";
8
+ import { botRuntimeFromBrainName } from "../lib/bot/config.js";
9
+ import { installFleetRuntimeSources } from "../lib/bot/fleet-runtime-sources.js";
10
+ import { cachedFleetLocalTargetRelease, ensureFleetRuntimeInstalled, fleetLocalDistributionInstalled, fleetReleaseImportsGrokCli, fleetRuntimeReady, installTargetFleetLocalDistribution, resolveFleetLocalTargetRelease, } from "../lib/bot/fleet-local.js";
3
11
  import { installedFleetPython } from "../lib/bot/fleet-python.js";
4
12
  import { createInstallProgressTracker } from "../lib/bot/install-progress.js";
5
13
  import { botCreateEstimate } from "../lib/bot/readiness.js";
6
- import { fleetSignInReusableHere } from "../lib/bot/legacy-provider-login.js";
14
+ import { fleetSignInReusableHere, grokCliLoginReadable, grokLoginReadableHereAsync, } from "../lib/bot/legacy-provider-login.js";
7
15
  function megabytes(bytes) {
8
16
  return `${(bytes / 1_048_576).toFixed(1)} MB`;
9
17
  }
10
18
  /** The sentence for a phase, for people. */
19
+ const FLEET_WHEELHOUSE_PREFIX = "hq-fleet-local-wheels-";
20
+ function shownInTerminal(file) {
21
+ return file.startsWith("hq-fleet-runtime-") || file.startsWith(FLEET_WHEELHOUSE_PREFIX);
22
+ }
11
23
  export function describeFleetInstallPhase(event) {
12
24
  switch (event.phase) {
13
25
  case "download-start":
14
26
  return "Downloading the HQ Fleet Runtime";
15
27
  case "download": {
16
- const name = event.file.startsWith("hq-fleet-runtime-") ? "the HQ Fleet Runtime" : "the HQ Fleet Runtime's release files";
28
+ const name = event.file.startsWith("hq-fleet-runtime-")
29
+ ? "the HQ Fleet Runtime"
30
+ : event.file.startsWith(FLEET_WHEELHOUSE_PREFIX) ? "the HQ Fleet Runtime's packages" : "the HQ Fleet Runtime's release files";
17
31
  if (event.total === null)
18
32
  return `Downloading ${name}: ${megabytes(event.received)}`;
19
33
  const percent = Math.min(100, Math.floor((event.received / Math.max(event.total, 1)) * 100));
@@ -57,11 +71,20 @@ export function fleetInstallProgressReporter(mode, output = { write: (text) => {
57
71
  }
58
72
  let lastTenth = -1;
59
73
  let lineOpen = false;
60
- return (event) => {
61
- if (event.phase === "download-start")
74
+ const shown = new Map();
75
+ return (incoming) => {
76
+ if (incoming.phase === "download-start")
62
77
  return;
63
- if (event.phase === "download" && !event.file.startsWith("hq-fleet-runtime-"))
78
+ if (incoming.phase === "download" && !shownInTerminal(incoming.file))
64
79
  return;
80
+ let event = incoming;
81
+ if (incoming.phase === "download") {
82
+ shown.set(incoming.file, { received: incoming.received, total: incoming.total });
83
+ const files = [...shown.values()];
84
+ const received = files.reduce((sum, file) => sum + file.received, 0);
85
+ const total = files.every((file) => file.total !== null) ? files.reduce((sum, file) => sum + (file.total ?? 0), 0) : null;
86
+ event = { phase: "download", file: "hq-fleet-runtime-", received, total };
87
+ }
65
88
  const text = describeFleetInstallPhase(event);
66
89
  if (event.phase === "download" && event.total !== null) {
67
90
  const tenth = Math.floor((event.received / Math.max(event.total, 1)) * 10);
@@ -100,8 +123,8 @@ export async function fleetRuntimeStatus(deps = {}) {
100
123
  export async function runBotRuntimeInstall(opts) {
101
124
  const report = fleetInstallProgressReporter(opts.json ? "json" : "text");
102
125
  const target = await resolveFleetLocalTargetRelease();
103
- const installation = await installTargetFleetLocalDistribution({ target, onProgress: report });
104
- const result = await ensureFleetRuntimeInstalled(installation, { onProgress: report });
126
+ const { installation, python } = await installFleetRuntimeSources(() => installTargetFleetLocalDistribution({ target, onProgress: report }), { onProgress: report });
127
+ const result = await ensureFleetRuntimeInstalled(installation, { python, onProgress: report });
105
128
  if (opts.json) {
106
129
  console.log(JSON.stringify({
107
130
  ok: true,
@@ -129,32 +152,219 @@ export async function runBotRuntimeStatus(opts) {
129
152
  if (!current.ready)
130
153
  console.log(chalk.dim(" Run `hq bot runtime install` to get it ready before creating a bot."));
131
154
  }
155
+ export function parseBrainProvider(value) {
156
+ const runtime = botRuntimeFromBrainName(value);
157
+ if (runtime === "claude" || runtime === "grok")
158
+ return runtime;
159
+ if (runtime === "codex")
160
+ return "chatgpt";
161
+ throw Object.assign(new Error(`--provider must be claude, codex (or chatgpt) or grok, not ${value}.`), { expected: true });
162
+ }
132
163
  export function parseFleetSignInProvider(value) {
133
164
  const provider = value.trim().toLowerCase();
134
165
  if (provider === "chatgpt" || provider === "grok")
135
166
  return provider;
136
167
  throw Object.assign(new Error(`--provider must be chatgpt or grok, not ${value}.`), { expected: true });
137
168
  }
138
- export async function runBotAuthStatus(opts, deps = {}) {
139
- const provider = parseFleetSignInProvider(opts.provider);
169
+ export async function brainSignInStatus(provider, deps = {}) {
170
+ if (provider === "claude") {
171
+ const signedIn = (deps.claudeLogin ?? (() => checkClaudeCodeLogin()))().signedIn;
172
+ return { provider, signedIn, source: signedIn ? "claude-code" : null };
173
+ }
140
174
  let grokCliImport = deps.grokCliImport;
141
175
  if (provider === "grok" && grokCliImport === undefined) {
142
176
  try {
143
- grokCliImport = fleetReleaseImportsGrokCli((await (deps.target ?? (() => resolveFleetLocalTargetRelease()))()).release.version);
177
+ grokCliImport = fleetReleaseImportsGrokCli((await (deps.target ?? (async () => cachedFleetLocalTargetRelease()))()).release.version);
144
178
  }
145
179
  catch {
146
180
  grokCliImport = false;
147
181
  }
148
182
  }
149
- const signedIn = fleetSignInReusableHere(provider, { ...deps, ...(grokCliImport !== undefined ? { grokCliImport } : {}) }).readable;
183
+ let grok = deps.grok;
184
+ if (provider === "grok" && !grok) {
185
+ const cli = (deps.grokCli ?? (() => grokCliLoginReadable(deps.homedir ?? os.homedir(), deps.env ?? process.env)))();
186
+ if (!(grokCliImport && cli.readable)) {
187
+ const siblings = await (deps.grokSiblings ?? (() => grokLoginReadableHereAsync("")))();
188
+ grok = () => siblings;
189
+ }
190
+ }
191
+ const { target: _target, claudeLogin: _claudeLogin, grokSiblings: _grokSiblings, ...hereDeps } = deps;
192
+ const login = fleetSignInReusableHere(provider, { ...hereDeps, ...(grok ? { grok } : {}), ...(grokCliImport !== undefined ? { grokCliImport } : {}) });
193
+ if (!login.readable)
194
+ return { provider, signedIn: false, source: null };
195
+ const source = provider === "chatgpt" ? "codex-cli" : login.detail.startsWith("Grok CLI login") ? "grok-cli" : "fleet-bot";
196
+ return { provider, signedIn: true, source };
197
+ }
198
+ const BRAIN_NAMES = { claude: "Claude", chatgpt: "ChatGPT", grok: "Grok" };
199
+ export async function runBotAuthStatus(opts, deps = {}) {
200
+ let provider;
201
+ try {
202
+ provider = parseBrainProvider(opts.provider);
203
+ }
204
+ catch (error) {
205
+ if (!opts.json)
206
+ throw error;
207
+ const failure = { ok: false, provider: opts.provider, reason: "unknown-provider" };
208
+ console.log(JSON.stringify(failure));
209
+ process.exitCode = 1;
210
+ return failure;
211
+ }
212
+ const status = { ...(await brainSignInStatus(provider, deps)), ok: true };
150
213
  if (opts.json) {
151
- console.log(JSON.stringify({ signedIn }));
152
- return { signedIn };
214
+ console.log(JSON.stringify(status));
215
+ return status;
153
216
  }
154
- const name = provider === "grok" ? "Grok" : "ChatGPT";
155
- console.log(signedIn
217
+ const name = BRAIN_NAMES[status.provider];
218
+ console.log(status.signedIn
156
219
  ? `A new ${name} bot signs in with the ${name} login already on this computer.`
157
- : `A new ${name} bot needs its own ${name} sign-in (hq bot auth).`);
158
- return { signedIn };
220
+ : `A new ${name} bot needs a ${name} sign-in first (hq bot sign-in --provider ${status.provider}).`);
221
+ return status;
222
+ }
223
+ function onTerminate(cancel) {
224
+ process.once("SIGTERM", cancel);
225
+ process.once("SIGINT", cancel);
226
+ return () => {
227
+ process.off("SIGTERM", cancel);
228
+ process.off("SIGINT", cancel);
229
+ };
230
+ }
231
+ const BRAIN_SIGN_IN_CLI = {
232
+ chatgpt: { cli: "codex", browser: ["login"], device: ["login", "--device-auth"] },
233
+ grok: { cli: "grok", browser: ["login", "--oauth"], device: ["login", "--device-auth"] },
234
+ };
235
+ export const BRAIN_SIGN_IN_KILL_AFTER_MS = 1_500;
236
+ export function findCliOnPath(name, env = process.env) {
237
+ for (const dir of (env.PATH ?? "").split(path.delimiter).filter(Boolean)) {
238
+ const file = path.join(dir, name);
239
+ try {
240
+ if (fs.statSync(file).isFile()) {
241
+ fs.accessSync(file, fs.constants.X_OK);
242
+ return file;
243
+ }
244
+ }
245
+ catch {
246
+ continue;
247
+ }
248
+ }
249
+ return null;
250
+ }
251
+ function runCli(cli, args) {
252
+ const child = spawn(cli, args, { stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
253
+ return {
254
+ stdout: child.stdout,
255
+ stderr: child.stderr,
256
+ exit: new Promise((resolve) => {
257
+ child.once("error", () => resolve(null));
258
+ child.once("close", (code) => resolve(code));
259
+ }),
260
+ kill: (signal = "SIGTERM") => {
261
+ child.kill(signal);
262
+ },
263
+ };
264
+ }
265
+ const DEVICE_URL_RE = /https:\/\/[^\s"'<>)]+/;
266
+ const DEVICE_CODE_RE = /\b[A-Z0-9]{4,5}-[A-Z0-9]{4,5}\b/;
267
+ export function deviceCodeTracker(emit) {
268
+ let verificationUri = null;
269
+ let userCode = null;
270
+ let sent = false;
271
+ return (raw) => {
272
+ const line = stripVTControlCharacters(raw).trim();
273
+ if (!line)
274
+ return;
275
+ verificationUri ??= DEVICE_URL_RE.exec(line)?.[0] ?? null;
276
+ userCode ??= DEVICE_CODE_RE.exec(line)?.[0] ?? null;
277
+ if (!sent && verificationUri && userCode) {
278
+ sent = true;
279
+ emit({ event: "auth", phase: "device-code", verificationUri, userCode });
280
+ return;
281
+ }
282
+ emit({ event: "auth", phase: "message", text: line });
283
+ };
284
+ }
285
+ function forEachLine(stream, onLine) {
286
+ if (!stream)
287
+ return Promise.resolve();
288
+ return new Promise((resolve) => {
289
+ let buffered = "";
290
+ stream.on("data", (chunk) => {
291
+ buffered += chunk.toString();
292
+ const lines = buffered.split(/\r?\n/);
293
+ buffered = lines.pop() ?? "";
294
+ for (const line of lines)
295
+ onLine(line);
296
+ });
297
+ stream.on("end", () => {
298
+ if (buffered)
299
+ onLine(buffered);
300
+ resolve();
301
+ });
302
+ stream.on("error", () => resolve());
303
+ });
304
+ }
305
+ export async function runBotSignIn(opts, deps = {}) {
306
+ const brain = parseBrainProvider(opts.provider);
307
+ const emit = deps.emit ?? ((line) => { process.stdout.write(`${line}\n`); });
308
+ const write = deps.write ?? ((text) => { process.stderr.write(text); });
309
+ const finish = (result) => {
310
+ if (opts.json)
311
+ emit(JSON.stringify(result));
312
+ else
313
+ write(result.ok
314
+ ? `${BRAIN_NAMES[result.provider]} is signed in on this computer; new ${BRAIN_NAMES[result.provider]} bots use this login.\n`
315
+ : `${BRAIN_NAMES[result.provider]} is not signed in on this computer${result.reason ? ` (${result.reason})` : ""}.\n`);
316
+ return result;
317
+ };
318
+ if (brain === "claude") {
319
+ throw Object.assign(new Error("hq bot sign-in covers codex (or chatgpt) and grok; sign in to Claude with claude /login."), { expected: true });
320
+ }
321
+ const before = await brainSignInStatus(brain, deps);
322
+ if (before.signedIn)
323
+ return finish({ ...before, ok: true });
324
+ const { cli, browser, device } = BRAIN_SIGN_IN_CLI[brain];
325
+ const args = opts.browser === false ? device : browser;
326
+ const executable = (deps.findCli ?? ((name) => findCliOnPath(name)))(cli);
327
+ if (!executable) {
328
+ process.exitCode = 1;
329
+ return finish({ ...before, ok: false, reason: "cli-missing" });
330
+ }
331
+ const track = deviceCodeTracker((event) => {
332
+ if (opts.json)
333
+ emit(JSON.stringify(event));
334
+ else
335
+ write(`${event.phase === "device-code" ? `Open ${String(event.verificationUri)} and enter ${String(event.userCode)}` : String(event.text)}\n`);
336
+ });
337
+ const child = (deps.run ?? runCli)(executable, args);
338
+ let cancelled = false;
339
+ let forceKill = null;
340
+ const cancel = () => {
341
+ if (cancelled)
342
+ return;
343
+ cancelled = true;
344
+ child.kill("SIGTERM");
345
+ forceKill = setTimeout(() => child.kill("SIGKILL"), BRAIN_SIGN_IN_KILL_AFTER_MS);
346
+ forceKill.unref?.();
347
+ };
348
+ const release = (deps.onCancel ?? onTerminate)(cancel);
349
+ const reading = Promise.all([forEachLine(child.stdout, track), forEachLine(child.stderr, track)]);
350
+ try {
351
+ const code = await child.exit;
352
+ if (!cancelled)
353
+ await reading;
354
+ if (cancelled) {
355
+ process.exitCode = 1;
356
+ return finish({ ...before, ok: false, reason: "cancelled" });
357
+ }
358
+ const after = await brainSignInStatus(brain, deps);
359
+ if (code === 0 && after.signedIn)
360
+ return finish({ ...after, ok: true });
361
+ process.exitCode = 1;
362
+ return finish({ ...after, ok: false, reason: code === 0 ? "login-not-reusable" : "sign-in-failed" });
363
+ }
364
+ finally {
365
+ if (forceKill)
366
+ clearTimeout(forceKill);
367
+ release();
368
+ }
159
369
  }
160
370
  //# sourceMappingURL=bot-runtime.js.map
@@ -6,9 +6,9 @@ import { type RuntimeSignInCheck, type RuntimeSignInIssue } from "../lib/bot/run
6
6
  import { type ClaudeLoginCheck } from "../lib/bot/claude-login.js";
7
7
  import type { BotStatusFile } from "../lib/bot/status.js";
8
8
  import { probeBotRuntime, type RuntimeProbeResult } from "../lib/bot/probe.js";
9
- import { type SpawnInteractive } from "../lib/bot/runtime-auth.js";
9
+ import { type BotLoginRuntime, type SpawnInteractive } from "../lib/bot/runtime-auth.js";
10
10
  import { type BotLocalConfig, type MyLocalBot, type BotKind, type BotMemoryMode, type BotNotRunnableReason, type RuntimeCrash, type BotConfig, type BotRuntimeId, type LaunchctlExec, HQ_FLEET_RUNTIME_ENGINE_ID, type BotRole } from "../lib/bot/index.js";
11
- import { fleetRuntimeStatus } from "./bot-runtime.js";
11
+ import { brainSignInStatus, fleetRuntimeStatus } from "./bot-runtime.js";
12
12
  import { ensureFleetRuntimeInstalled } from "../lib/bot/fleet-local.js";
13
13
  /** Real launchctl; every failure is a non-ok result, never a throw. */
14
14
  export declare const defaultLaunchctl: LaunchctlExec;
@@ -202,19 +202,16 @@ export declare const legacyConvertSeams: {
202
202
  /** Whether the provider sign-in a Codex or Grok legacy bot needs is readable here, as HQ Fleet Local imports it. */
203
203
  providerLogin: (dir: string, config: BotConfig) => LegacyProviderLoginProbe;
204
204
  };
205
- /**
206
- * `output`: "json" | "text" print a result; "silent" prints nothing — used
207
- * when stop is a step inside rm/restart, whose own JSON must be the only
208
- * document on stdout (the desktop app parses it; a second object made it
209
- * "unreadable output: trailing characters").
210
- */
211
- /** Seams for the self-stop path, replaced in tests. */
205
+ export declare const FLEET_SIGN_IN_PICKUP_WAIT_MS = 20000;
212
206
  export declare const botCreateSeams: {
213
207
  /** The Claude Code login read the way the HQ Fleet Runtime reads it. */
214
208
  claudeLogin: () => ClaudeLoginCheck;
209
+ brainSignIn: typeof brainSignInStatus;
210
+ importBrainLogin: (agentUid: string, runtime: "codex" | "grok") => void;
215
211
  runtimeStatus: typeof fleetRuntimeStatus;
216
212
  installRuntime: typeof ensureFleetRuntimeInstalled;
217
213
  waitForReady: typeof waitForGatewayReady;
214
+ greetingSentAt: (agentUid: string) => string | null;
218
215
  };
219
216
  export declare const botStopSeams: {
220
217
  /** True when this process runs inside the bot process `botPid` (one of its turns). */
@@ -318,6 +315,10 @@ export interface BotSetOptions {
318
315
  }
319
316
  export interface BotSetDeps {
320
317
  probe?: typeof probeBotRuntime;
318
+ /** Test seam: the bot's own browser sign-in that `switch-account --sign-in` runs. */
319
+ botSignIn?: (dir: string, runtime: BotLoginRuntime) => unknown;
320
+ /** Test seam: every vendor login/logout command `switch-account --sign-in` spawns. */
321
+ authSpawn?: SpawnInteractive;
321
322
  /** Test seam: the Fleet sign-in (`hq bot auth`) switch-account runs for a Fleet bot. */
322
323
  fleetAuth?: (name: string, opts: {
323
324
  provider: string;
@@ -336,6 +337,12 @@ export declare function runBotSet(nameArg: string, opts: BotSetOptions, deps?: B
336
337
  /** switch-account's test turn: short, so probe, stop, start and a rollback fit the desktop's 5-minute budget. */
337
338
  export declare const SWITCH_ACCOUNT_PROBE_TIMEOUT_MS = 60000;
338
339
  export interface BotSwitchAccountOptions {
340
+ /**
341
+ * Sign the bot in with a login of its own for `runtime` first (claude, codex):
342
+ * a browser sign-in into ~/.hq/bots/<name>/auth/<runtime>. Without it the
343
+ * bot moves onto the owner's own sign-in.
344
+ */
345
+ signIn?: boolean;
339
346
  /** The runtime the owner just signed in to (the Create-bot account switcher's runtime). */
340
347
  runtime: string;
341
348
  json?: boolean;