@indigoai-us/hq-cli 5.116.0 → 5.117.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,103 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.117.0] — 2026-09-16
6
+
7
+ ### Added
8
+
9
+ - Your local bots can come back after a reinstall. A bot is an identity HQ
10
+ keeps for you plus the state that runs it on one computer; wiping that
11
+ computer's HQ folder, or moving to a new Mac, used to leave every bot dead
12
+ with no way back — making a new one was refused, because the old one still
13
+ existed. Now `hq bot restore` brings back every bot you own that is missing
14
+ from this computer, with its own settings, memory folder and startup agent,
15
+ keeping the same identity and the same conversation. `hq bot adopt <name>`
16
+ does one bot, `hq bot list --remote` shows every bot you own and which of
17
+ them are set up here, and trying to create a bot you already own now says so
18
+ and points at adopting it instead. Bots made before this shipped come back on
19
+ sensible defaults, and HQ tells you it did that.
20
+
21
+ ### Fixed
22
+
23
+ - `hq bot restore` no longer brings back a bot this Mac cannot run. A company
24
+ bot — one that acts for a company rather than as you — was being set up here
25
+ as a personal bot: it got credentials, a folder, a memory folder and a startup
26
+ entry, was counted as restored with nothing reported as failed, and then died
27
+ at every start and at every login, while the Mac offered "check that Claude
28
+ Code is signed in" as the remedy, which could never help. Restore, `hq bot
29
+ adopt` and `hq bot list --remote` now ask exactly the question the bot's own
30
+ startup asks, before anything is written or any password is rotated. A bot
31
+ that cannot run here is listed plainly, counted as skipped rather than
32
+ restored, and refused by adopt with one sentence saying where it does run —
33
+ and nothing is left behind on this computer.
34
+ - Bringing a bot back no longer leaves a second copy of it. A bot you created
35
+ here as `qa-x` is `qa-x-<your suffix>` in HQ, and bringing it back built a
36
+ whole second folder under that longer name: a second startup entry, a second
37
+ memory folder, and the original folder left behind holding the live password
38
+ of a bot nothing could reach any more. HQ now recognises the folder a bot
39
+ already has on this computer — by the identity inside it, even when a wipe
40
+ left only its credentials — and repairs that one in place. A bot that is not
41
+ here at all comes back under the name you created it with. If that name
42
+ already belongs to a different bot, both are kept, under names that tell them
43
+ apart.
44
+ - `hq bot list --remote --json` now says `ok: true` when it worked. Every
45
+ failure said `ok: false`, and the success document had no `ok` at all, so
46
+ anything that learned to check it read a good listing as a failure.
47
+ - A bot's long answer now reaches you, in several messages. HQ Cloud refuses any
48
+ single message over 4000 characters, and nothing split one up: an answer over
49
+ that length was refused, saved, and sent again unchanged on every check — a
50
+ test machine recorded the same rejection 231 times in eight minutes while the
51
+ person saw no reply and no error at all, and the bot's 44 seconds of work was
52
+ thrown away. A reply that is too long is now cut into numbered parts — on
53
+ paragraph breaks where it can, on sentences otherwise, and never leaving a
54
+ block of code half-open — and posted in order. If something goes wrong partway
55
+ through, only the parts you have not seen are sent again. And if a message
56
+ truly cannot be delivered, the bot stops after five tries and tells you so in
57
+ one short line, instead of asking the server to do the impossible for as long
58
+ as it runs.
59
+ - A bot's startup entry no longer outlives the bot. When a bot's local setup was
60
+ gone, the startup entry macOS keeps for it relaunched it every five seconds,
61
+ forever, filling its log with the same failure (one test machine recorded 267
62
+ of them in a row). HQ now says once what happened, tells you how to bring the
63
+ bot back, removes the startup entry it no longer needs, and stops cleanly so
64
+ nothing relaunches it. This works when macOS itself is the one running the
65
+ bot, which is the case that matters: the first version did its tidying in an
66
+ order that had macOS shut the bot down before it could finish, so the startup
67
+ entry survived and brought the same dead bot back at every login, and the
68
+ explanation never reached the bot's log. HQ now writes the explanation and
69
+ removes the entry first, and lets go of itself last.
70
+
71
+ - You can remove a bot whose settings this computer has already lost. A wiped
72
+ HQ folder could leave a bot half-here — a folder and a startup entry, no
73
+ settings — and nothing could clear it: removing it said there was no such
74
+ bot and suggested creating one, and creating one said you already had it.
75
+ `hq bot rm <name>` now clears whatever is actually left on this computer, and
76
+ `hq bot rm <name> --remote` also removes the bot HQ still holds under that
77
+ name. It checks with HQ before it deletes anything local, so a service that
78
+ cannot answer leaves nothing half-done.
79
+
80
+ - Removing a bot now tells the truth when HQ only gets part of the way. When
81
+ HQ's own teardown of a bot's cloud identity stopped half-way, the
82
+ machine-readable form said the removal had failed but gave no reason and no
83
+ explanation, reported success to anything checking the exit code, and printed
84
+ the raw cloud error — including internal infrastructure addresses — straight
85
+ at you. It now says one plain sentence, names the reason in the same
86
+ vocabulary as everything else, and exits non-zero, and no internal detail is
87
+ repeated anywhere. It also stops making you run the command twice for
88
+ nothing: when the part HQ could not finish would fail the same way every
89
+ time, the bot is removed from this computer and you are told the leftover is
90
+ HQ's to clear; when it is something HQ may yet finish, your settings are kept
91
+ exactly as they were so running the same command again picks the job back up.
92
+
93
+ - Bringing bots back now fails in plain language when HQ Cloud is too old for
94
+ it. `hq bot adopt`, `hq bot restore`, and `hq bot list --remote` all ask HQ
95
+ which bots you own; against an HQ Cloud without that capability, the raw
96
+ network error was printed at you, and the machine-readable form printed
97
+ nothing at all — so the desktop app had nothing it could read. Each now says
98
+ one plain sentence, and `--json` always returns a result naming the reason,
99
+ so the app can quietly fall back to showing the bots that are on this
100
+ computer.
101
+
5
102
  ## [5.116.0] — 2026-09-16
6
103
 
7
104
  ### Added
@@ -6374,6 +6374,61 @@ export declare const COMMAND_CATALOG: readonly [{
6374
6374
  readonly usage: "[options]";
6375
6375
  readonly arguments: readonly [];
6376
6376
  readonly options: readonly [{
6377
+ readonly flags: "--remote";
6378
+ readonly description: "List the local bots your HQ account owns instead, with a here column saying which are set up on this computer";
6379
+ }, {
6380
+ readonly flags: "--json";
6381
+ readonly description: "Print machine-readable JSON";
6382
+ }];
6383
+ readonly subcommands: readonly [];
6384
+ }, {
6385
+ readonly name: "adopt";
6386
+ readonly description: "Bring a bot you already own back to this computer: new machine credentials, its saved settings, worker folder, and startup agent";
6387
+ readonly aliases: readonly [];
6388
+ readonly hidden: false;
6389
+ readonly usage: "[options] <name>";
6390
+ readonly arguments: readonly [{
6391
+ readonly name: "name";
6392
+ readonly required: true;
6393
+ readonly variadic: false;
6394
+ }];
6395
+ readonly options: readonly [{
6396
+ readonly flags: "--runtime <runtime>";
6397
+ readonly description: "Model CLI to run it with, overriding its saved one: claude|codex|grok";
6398
+ }, {
6399
+ readonly flags: "--model <model>";
6400
+ readonly description: "Model override passed to the runtime CLI, replacing its saved one";
6401
+ }, {
6402
+ readonly flags: "--no-daemon";
6403
+ readonly description: "Do not install the launchd agent (macOS)";
6404
+ }, {
6405
+ readonly flags: "--no-start";
6406
+ readonly description: "Bring it back without starting it";
6407
+ }, {
6408
+ readonly flags: "--json";
6409
+ readonly description: "Print machine-readable JSON";
6410
+ }];
6411
+ readonly subcommands: readonly [];
6412
+ }, {
6413
+ readonly name: "restore";
6414
+ readonly description: "Bring back every local bot your HQ account owns that is not set up on this computer (after a reinstall, or on a new Mac)";
6415
+ readonly aliases: readonly [];
6416
+ readonly hidden: false;
6417
+ readonly usage: "[options]";
6418
+ readonly arguments: readonly [];
6419
+ readonly options: readonly [{
6420
+ readonly flags: "--all";
6421
+ readonly description: "Also re-issue credentials and reinstall the startup agent for the bots already set up here";
6422
+ }, {
6423
+ readonly flags: "--dry-run";
6424
+ readonly description: "Show what would be brought back, change nothing";
6425
+ }, {
6426
+ readonly flags: "--no-daemon";
6427
+ readonly description: "Do not install the launchd agents (macOS)";
6428
+ }, {
6429
+ readonly flags: "--no-start";
6430
+ readonly description: "Bring them back without starting them";
6431
+ }, {
6377
6432
  readonly flags: "--json";
6378
6433
  readonly description: "Print machine-readable JSON";
6379
6434
  }];
@@ -6488,6 +6543,9 @@ export declare const COMMAND_CATALOG: readonly [{
6488
6543
  readonly options: readonly [{
6489
6544
  readonly flags: "-y, --yes";
6490
6545
  readonly description: "Skip the confirmation prompt";
6546
+ }, {
6547
+ readonly flags: "--remote";
6548
+ readonly description: "When the bot's local settings are already gone, also delete the bot HQ still has under that name";
6491
6549
  }, {
6492
6550
  readonly flags: "--json";
6493
6551
  readonly description: "Print machine-readable JSON";
@@ -8237,6 +8237,78 @@ export const COMMAND_CATALOG = [
8237
8237
  "usage": "[options]",
8238
8238
  "arguments": [],
8239
8239
  "options": [
8240
+ {
8241
+ "flags": "--remote",
8242
+ "description": "List the local bots your HQ account owns instead, with a here column saying which are set up on this computer"
8243
+ },
8244
+ {
8245
+ "flags": "--json",
8246
+ "description": "Print machine-readable JSON"
8247
+ }
8248
+ ],
8249
+ "subcommands": []
8250
+ },
8251
+ {
8252
+ "name": "adopt",
8253
+ "description": "Bring a bot you already own back to this computer: new machine credentials, its saved settings, worker folder, and startup agent",
8254
+ "aliases": [],
8255
+ "hidden": false,
8256
+ "usage": "[options] <name>",
8257
+ "arguments": [
8258
+ {
8259
+ "name": "name",
8260
+ "required": true,
8261
+ "variadic": false
8262
+ }
8263
+ ],
8264
+ "options": [
8265
+ {
8266
+ "flags": "--runtime <runtime>",
8267
+ "description": "Model CLI to run it with, overriding its saved one: claude|codex|grok"
8268
+ },
8269
+ {
8270
+ "flags": "--model <model>",
8271
+ "description": "Model override passed to the runtime CLI, replacing its saved one"
8272
+ },
8273
+ {
8274
+ "flags": "--no-daemon",
8275
+ "description": "Do not install the launchd agent (macOS)"
8276
+ },
8277
+ {
8278
+ "flags": "--no-start",
8279
+ "description": "Bring it back without starting it"
8280
+ },
8281
+ {
8282
+ "flags": "--json",
8283
+ "description": "Print machine-readable JSON"
8284
+ }
8285
+ ],
8286
+ "subcommands": []
8287
+ },
8288
+ {
8289
+ "name": "restore",
8290
+ "description": "Bring back every local bot your HQ account owns that is not set up on this computer (after a reinstall, or on a new Mac)",
8291
+ "aliases": [],
8292
+ "hidden": false,
8293
+ "usage": "[options]",
8294
+ "arguments": [],
8295
+ "options": [
8296
+ {
8297
+ "flags": "--all",
8298
+ "description": "Also re-issue credentials and reinstall the startup agent for the bots already set up here"
8299
+ },
8300
+ {
8301
+ "flags": "--dry-run",
8302
+ "description": "Show what would be brought back, change nothing"
8303
+ },
8304
+ {
8305
+ "flags": "--no-daemon",
8306
+ "description": "Do not install the launchd agents (macOS)"
8307
+ },
8308
+ {
8309
+ "flags": "--no-start",
8310
+ "description": "Bring them back without starting them"
8311
+ },
8240
8312
  {
8241
8313
  "flags": "--json",
8242
8314
  "description": "Print machine-readable JSON"
@@ -8387,6 +8459,10 @@ export const COMMAND_CATALOG = [
8387
8459
  "flags": "-y, --yes",
8388
8460
  "description": "Skip the confirmation prompt"
8389
8461
  },
8462
+ {
8463
+ "flags": "--remote",
8464
+ "description": "When the bot's local settings are already gone, also delete the bot HQ still has under that name"
8465
+ },
8390
8466
  {
8391
8467
  "flags": "--json",
8392
8468
  "description": "Print machine-readable JSON"
@@ -1,6 +1,6 @@
1
1
  import { Command } from "commander";
2
2
  import { type RuntimeSignInIssue } from "../lib/bot/runtime-sign-in.js";
3
- import { type BotKind, type BotMemoryMode, type BotRuntimeId, type LaunchctlExec } from "../lib/bot/index.js";
3
+ import { type BotLocalConfig, type MyLocalBot, type BotKind, type BotMemoryMode, type BotNotRunnableReason, type BotConfig, type BotRuntimeId, type LaunchctlExec } from "../lib/bot/index.js";
4
4
  /** Real launchctl; every failure is a non-ok result, never a throw. */
5
5
  export declare const defaultLaunchctl: LaunchctlExec;
6
6
  /** The desktop app creates HQ's setup bot under this name, always from the `setup` worker. */
@@ -101,5 +101,144 @@ export declare function runBotSet(nameArg: string, opts: {
101
101
  effort?: string;
102
102
  json?: boolean;
103
103
  }): Promise<void>;
104
+ /**
105
+ * The one bot the caller means. Matches the local folder name, the cloud slug,
106
+ * the display name, or the agt_ uid; an ambiguous name is refused rather than
107
+ * guessed at.
108
+ */
109
+ export declare function matchRemoteBots(bots: readonly MyLocalBot[], wanted: string): MyLocalBot[];
110
+ export declare function resolveRemoteBot(bots: readonly MyLocalBot[], wanted: string): MyLocalBot;
111
+ /**
112
+ * Why HQ could not say which bots the account owns. The desktop app switches
113
+ * on these values, so they are contract, not prose:
114
+ *
115
+ * server-unsupported the HQ Cloud in front of us has no listing route
116
+ * auth the sign-in was refused
117
+ * network HQ could not be reached at all
118
+ * server-error HQ answered 5xx
119
+ * error anything else
120
+ */
121
+ export type RemoteBotsUnavailableReason = "server-unsupported" | "auth" | "network" | "server-error" | "error";
122
+ export interface RemoteBotsUnavailable {
123
+ reason: RemoteBotsUnavailableReason;
124
+ message: string;
125
+ }
126
+ /**
127
+ * Turn any failure of `GET /v1/agents/mine` into one plain sentence plus a
128
+ * stable reason. Production HQ Cloud does not serve that route yet, and an
129
+ * uncaught 404 reached the person verbatim as "HQ API /v1/agents/mine → 404:
130
+ * Not found" — and, under --json, as no document at all.
131
+ */
132
+ export declare function remoteBotsUnavailable(err: unknown): RemoteBotsUnavailable;
133
+ /**
134
+ * A cloud teardown that only got part of the way, said in the same vocabulary
135
+ * the desktop switches on, plus the one decision that follows from it.
136
+ *
137
+ * `DELETE /v1/agents/{uid}` answers 200 with `terminal:false` and a per-step
138
+ * `failures` map when it could do only part of the job. Those strings are raw
139
+ * infrastructure: one real answer carried the AWS account id, an assumed-role
140
+ * ARN and a DynamoDB table ARN. They are classified here and never repeated —
141
+ * `detail` is a plain clause, `steps` is the server's own step names and
142
+ * nothing of what they said.
143
+ *
144
+ * `retryable` is the local-state decision. Running `hq bot rm` again can only
145
+ * finish the job when the step that failed might behave differently next time.
146
+ * A refusal, or a step whose target was already gone, answers the same way
147
+ * forever, so the local copy goes and the message says the leftover is HQ's.
148
+ *
149
+ * `reason` reuses {@link RemoteBotsUnavailableReason}: `auth` for a refused
150
+ * step (a permission problem, on either side of the call), `error` for a step
151
+ * whose target was already gone, `server-error` for anything HQ may yet
152
+ * finish.
153
+ */
154
+ export interface BotRemovalIncomplete {
155
+ reason: RemoteBotsUnavailableReason;
156
+ /** One plain clause naming what stopped. Never a transport string. */
157
+ detail: string;
158
+ /** Whether running the same command again can still finish the removal. */
159
+ retryable: boolean;
160
+ /** The server's step names only — no ids, ARNs or messages. */
161
+ steps: string[];
162
+ }
163
+ export declare function botRemovalIncomplete(failures?: Record<string, string>): BotRemovalIncomplete;
164
+ /**
165
+ * Rebuild a bot.json from the settings the cloud kept for it. A bot created
166
+ * before HQ saved settings comes back on defaults, and anything this HQ can no
167
+ * longer provide (a worker that is not here, a thinking level the chosen
168
+ * runtime does not accept) is reported rather than silently kept.
169
+ */
170
+ export declare function configFromLocalConfig(input: {
171
+ name: string;
172
+ agentUid: string;
173
+ ownerUid: string;
174
+ hqRoot: string;
175
+ dir: string;
176
+ local: BotLocalConfig | null;
177
+ overrides?: {
178
+ runtime?: BotRuntimeId;
179
+ model?: string;
180
+ };
181
+ now?: () => Date;
182
+ }): {
183
+ config: BotConfig;
184
+ notes: string[];
185
+ };
186
+ export interface BotAdoptResult {
187
+ name: string;
188
+ agentUid: string;
189
+ runtime: BotRuntimeId;
190
+ kind: BotKind;
191
+ companies: string[];
192
+ dir: string;
193
+ worker: string;
194
+ memory: BotMemoryMode;
195
+ memoryDir: string;
196
+ /** True when the cloud had no saved settings and defaults were used. */
197
+ defaulted: boolean;
198
+ notes: string[];
199
+ daemon: string | null;
200
+ }
201
+ export declare function runBotAdopt(nameArg: string, opts: {
202
+ runtime?: string;
203
+ model?: string;
204
+ daemon?: boolean;
205
+ start?: boolean;
206
+ json?: boolean;
207
+ }): Promise<void>;
208
+ export interface BotRestoreRow {
209
+ name: string;
210
+ agentUid: string;
211
+ /** restored = brought back here; repaired = new credentials for one already here. */
212
+ action: "restored" | "repaired" | "skipped" | "failed" | "would-restore" | "would-repair" | "would-skip";
213
+ detail: string;
214
+ /** Present only on a bot skipped because this computer cannot run it. */
215
+ reason?: BotNotRunnableReason;
216
+ }
217
+ /**
218
+ * `hq bot restore` — every local bot this account owns that is not set up on
219
+ * this computer comes back. This is what the desktop app and a post-install
220
+ * hook call after a reinstall or on a new Mac.
221
+ */
222
+ export declare function runBotRestore(opts: {
223
+ all?: boolean;
224
+ dryRun?: boolean;
225
+ daemon?: boolean;
226
+ start?: boolean;
227
+ json?: boolean;
228
+ }): Promise<void>;
229
+ export interface RemoteBotRow {
230
+ name: string;
231
+ agentUid: string;
232
+ kind: string;
233
+ online: boolean;
234
+ lastHeartbeatAt: string | null;
235
+ /** True when this bot is set up on this computer. */
236
+ here: boolean;
237
+ settings: string;
238
+ /** False when this computer cannot run it, whatever the listing says. */
239
+ runnable: boolean;
240
+ /** Why not, when `runnable` is false: the same vocabulary adopt and restore use. */
241
+ reason: BotNotRunnableReason | null;
242
+ }
104
243
  export declare function registerBotCommand(program: Command): void;
105
244
  //# sourceMappingURL=bot.d.ts.map