@indigoai-us/hq-cli 5.345.211 → 5.345.212-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.
@@ -5,11 +5,14 @@
5
5
  import * as fs from "node:fs";
6
6
  import * as path from "node:path";
7
7
  import { botWorkerRelDir } from "./paths.js";
8
- export function renderWorkerYaml(name, agentUid, runtime, memoryDir) {
8
+ export function botSpokenName(name, displayName) {
9
+ return displayName?.trim() || name;
10
+ }
11
+ export function renderWorkerYaml(name, agentUid, runtime, memoryDir, displayName) {
9
12
  const memory = (memoryDir?.trim() || `personal/workers/${name}/memory`).replace(/\/+$/, "");
10
13
  return `worker:
11
14
  id: ${name}
12
- name: "${name}"
15
+ name: ${JSON.stringify(botSpokenName(name, displayName))}
13
16
  description: "Personal local HQ bot (${runtime}) — runs on this computer with the owner's permissions"
14
17
  type: PersonalBot
15
18
  version: "1.0"
@@ -27,10 +30,12 @@ context:
27
30
  - ${memory}/
28
31
  `;
29
32
  }
30
- export function renderPersonaMd(name) {
31
- return `# ${name}
33
+ export function renderPersonaMd(name, displayName) {
34
+ const spoken = botSpokenName(name, displayName);
35
+ const handle = spoken === name ? "" : ` Your hq bot handle is \`${name}\`; use it only in \`hq bot\` commands.`;
36
+ return `# ${spoken}
32
37
 
33
- You are ${name}, a personal assistant bot that lives in this HQ.
38
+ You are ${spoken}, a personal assistant bot that lives in this HQ.${handle}
34
39
 
35
40
  ## Voice
36
41
 
@@ -45,11 +50,12 @@ You are ${name}, a personal assistant bot that lives in this HQ.
45
50
  - Keep durable facts about your owner in \`memory/\` (short markdown notes).
46
51
  `;
47
52
  }
48
- export function renderMemoryReadme(name) {
49
- return `# ${name} memory
53
+ export function renderMemoryReadme(name, displayName) {
54
+ const spoken = botSpokenName(name, displayName);
55
+ return `# ${spoken} memory
50
56
 
51
- Short markdown notes ${name} keeps between conversations: preferences, recurring
52
- context, and things the owner asked it to remember. ${name} may edit these files;
57
+ Short markdown notes ${spoken} keeps between conversations: preferences, recurring
58
+ context, and things the owner asked it to remember. ${spoken} may edit these files;
53
59
  you can too. Never store secrets here.
54
60
  `;
55
61
  }
@@ -80,15 +86,15 @@ export function scaffoldBotMemory(hqRoot, name, io = fs, opts = {}) {
80
86
  const memoryDir = resolveScaffoldMemoryDir(hqRoot, name, opts.memoryDir);
81
87
  const result = { dir, memoryDir, created: [], kept: [] };
82
88
  io.mkdirSync(memoryDir, { recursive: true });
83
- writeIfMissing(io, path.join(memoryDir, "README.md"), renderMemoryReadme(name), result);
89
+ writeIfMissing(io, path.join(memoryDir, "README.md"), renderMemoryReadme(name, opts.displayName), result);
84
90
  return result;
85
91
  }
86
92
  export function scaffoldBotWorker(hqRoot, name, agentUid, runtime, io = fs, opts = {}) {
87
93
  const result = scaffoldBotMemory(hqRoot, name, io, opts);
88
94
  const { dir } = result;
89
95
  io.mkdirSync(dir, { recursive: true });
90
- writeIfMissing(io, path.join(dir, "worker.yaml"), renderWorkerYaml(name, agentUid, runtime, opts.memoryDir), result);
91
- writeIfMissing(io, path.join(dir, "persona.md"), renderPersonaMd(name), result);
96
+ writeIfMissing(io, path.join(dir, "worker.yaml"), renderWorkerYaml(name, agentUid, runtime, opts.memoryDir, opts.displayName), result);
97
+ writeIfMissing(io, path.join(dir, "persona.md"), renderPersonaMd(name, opts.displayName), result);
92
98
  return result;
93
99
  }
94
100
  //# sourceMappingURL=scaffold.js.map
@@ -135,6 +135,7 @@ export declare function desktopAppManagesSync(opts: {
135
135
  }): boolean;
136
136
  /** Copy-and-truncate, so children appending with O_APPEND keep writing to the live file. */
137
137
  export declare function rotateLogs(logsDir: string, maxBytes?: number): number;
138
+ export declare function prepareUnitStart(unit: Pick<UnitPlan, "id" | "env">, log: (level: "info" | "warn" | "error", msg: string) => void, alive?: (pid: number) => boolean): void;
138
139
  /**
139
140
  * Environment for one service process. The CLI's own update check is off:
140
141
  * a child that updates itself exits 0 and asks to be rerun, which would leave
@@ -19,7 +19,7 @@ import { currentPackageUseLeaseInstall, currentPackageUseUpdateRequested } from
19
19
  import { isLocalDependencyInstall, resolveRunningInstall } from "../../utils/version-gate.js";
20
20
  import { agentKitPaths } from "../agent-kit/paths.js";
21
21
  import { HQ_FLEET_RUNTIME_ENGINE_ID, readBotConfig } from "../bot/config.js";
22
- import { planFleetBots } from "../bot/fleet-daemon.js";
22
+ import { clearStaleReadyBeforeGatewayStart, planFleetBots } from "../bot/fleet-daemon.js";
23
23
  import { botsRoot } from "../bot/paths.js";
24
24
  import { CLAUDE_RUNNER_SCRIPT, CODEX_RUNNER_SCRIPT, enabledServices, planUnits } from "./catalog.js";
25
25
  import { effectiveSyncOwner, readDaemonConfig } from "./config.js";
@@ -565,6 +565,10 @@ const DAEMON_CHILD_ONE_SHOT_KEYS = [
565
565
  "HQ_DAEMON_OWNER_CONTROL_FD",
566
566
  "HQ_DAEMON_HANDOFF_PATH",
567
567
  ];
568
+ export function prepareUnitStart(unit, log, alive) {
569
+ if (clearStaleReadyBeforeGatewayStart(unit, alive))
570
+ log("info", `${unit.id}: cleared the ready signal its previous gateway left before starting a new one`);
571
+ }
568
572
  /**
569
573
  * Environment for one service process. The CLI's own update check is off:
570
574
  * a child that updates itself exits 0 and asks to be rerun, which would leave
@@ -1213,6 +1217,7 @@ export async function runDaemon(opts) {
1213
1217
  const command = unit.command;
1214
1218
  if (!command || command.type === "internal")
1215
1219
  throw new Error(`${unit.id} has no process to start`);
1220
+ prepareUnitStart(unit, log);
1216
1221
  unitLogOffsets.set(unit.id, logOffset(paths.unitLogPath(unit.id)));
1217
1222
  let [file, args] = command.type === "hq"
1218
1223
  ? daemonHqChildCommand(opts.nodeBinary, opts.hqBinary, command.args, stagedHqChildBootstrap?.bootstrapPath ?? null, cliPackagePrefix, childBootstrapHandoffWatchFlag.status().enabled)
@@ -225,6 +225,7 @@ export interface Supervisor {
225
225
  * `keepAcrossCliUpdates` running.
226
226
  */
227
227
  export declare function planKey(plan: UnitPlan, cliVersion?: string): string;
228
+ export declare const DAEMON_REQUEST_POLL_MS = 250;
228
229
  export declare function createSupervisor(deps: SupervisorDeps): Supervisor;
229
230
  export {};
230
231
  //# sourceMappingURL=supervisor.d.ts.map
@@ -170,12 +170,13 @@ function lastProtocolHint(slot) {
170
170
  return ` (last protocol line: ${slot.lastProtocolLine})`;
171
171
  return "";
172
172
  }
173
+ export const DAEMON_REQUEST_POLL_MS = 250;
173
174
  export function createSupervisor(deps) {
174
175
  const now = deps.now ?? Date.now;
175
176
  const setT = deps.setTimeout ?? ((fn, ms) => setTimeout(fn, ms));
176
177
  const clearT = deps.clearTimeout ?? ((h) => clearTimeout(h));
177
178
  const reconcileMs = deps.reconcileMs ?? 15_000;
178
- const requestPollMs = deps.requestPollMs ?? 1_000;
179
+ const requestPollMs = deps.requestPollMs ?? DAEMON_REQUEST_POLL_MS;
179
180
  const startedAt = now();
180
181
  let persistedHolds = {};
181
182
  /** Holds dropped at plan time (a changed command) that holds.json still lists. */
@@ -1399,10 +1400,11 @@ export function createSupervisor(deps) {
1399
1400
  // A bot created since the last plan read is asked for before the timer
1400
1401
  // would pick it up; read the plan now rather than dropping the request.
1401
1402
  const unplanned = req.unit !== undefined && !slots.has(req.unit);
1402
- if (unplanned)
1403
+ const heldInPlan = req.unit !== undefined && req.action === "restart" && Boolean(slots.get(req.unit)?.plan.blocked);
1404
+ if (unplanned || heldInPlan)
1403
1405
  reconcile();
1404
1406
  // The re-read already started a new long-running unit; restarting it would only bounce it.
1405
- if (unplanned && req.action === "restart" && slots.get(req.unit)?.child) {
1407
+ if ((unplanned || heldInPlan) && req.action === "restart" && slots.get(req.unit)?.child) {
1406
1408
  emit();
1407
1409
  return;
1408
1410
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.211",
3
+ "version": "5.345.212-beta.0",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -117,11 +117,11 @@
117
117
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
118
118
  },
119
119
  "optionalDependencies": {
120
- "@indigoai-us/hq-hook-win32-x64": "5.345.211",
121
- "@indigoai-us/hq-hook-win32-arm64": "5.345.211",
122
- "@indigoai-us/hq-hook-darwin-x64": "5.345.211",
123
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.211",
124
- "@indigoai-us/hq-hook-linux-x64": "5.345.211",
125
- "@indigoai-us/hq-hook-linux-arm64": "5.345.211"
120
+ "@indigoai-us/hq-hook-win32-x64": "5.345.212-beta.0",
121
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.212-beta.0",
122
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.212-beta.0",
123
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.212-beta.0",
124
+ "@indigoai-us/hq-hook-linux-x64": "5.345.212-beta.0",
125
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.212-beta.0"
126
126
  }
127
127
  }