@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.
- package/CHANGELOG.md +20 -0
- package/dist/command-catalog.generated.d.ts +28 -0
- package/dist/command-catalog.generated.js +34 -0
- package/dist/commands/bot-runtime.d.ts +21 -2
- package/dist/commands/bot-runtime.js +54 -9
- package/dist/commands/bot.d.ts +13 -0
- package/dist/commands/bot.js +142 -12
- package/dist/commands/daemon.js +3 -0
- package/dist/commands/whoami.js +7 -6
- package/dist/lib/bot/api.d.ts +1 -1
- package/dist/lib/bot/config.js +2 -1
- package/dist/lib/bot/fleet-daemon.d.ts +4 -0
- package/dist/lib/bot/fleet-daemon.js +12 -1
- package/dist/lib/bot/fleet-download.d.ts +6 -0
- package/dist/lib/bot/fleet-download.js +128 -3
- package/dist/lib/bot/fleet-local.d.ts +38 -1
- package/dist/lib/bot/fleet-local.js +239 -26
- package/dist/lib/bot/install-progress.d.ts +28 -0
- package/dist/lib/bot/install-progress.js +185 -0
- package/dist/lib/bot/legacy-provider-login.d.ts +22 -1
- package/dist/lib/bot/legacy-provider-login.js +67 -9
- package/dist/lib/bot/prompt.d.ts +1 -0
- package/dist/lib/bot/prompt.js +3 -2
- package/dist/lib/bot/readiness.d.ts +68 -0
- package/dist/lib/bot/readiness.js +145 -0
- package/dist/lib/bot/run.d.ts +2 -0
- package/dist/lib/bot/run.js +6 -3
- package/dist/lib/bot/scaffold.d.ts +6 -3
- package/dist/lib/bot/scaffold.js +18 -12
- package/dist/lib/daemon/run.d.ts +1 -0
- package/dist/lib/daemon/run.js +6 -1
- package/dist/lib/daemon/supervisor.d.ts +1 -0
- package/dist/lib/daemon/supervisor.js +5 -3
- package/package.json +7 -7
package/dist/lib/bot/scaffold.js
CHANGED
|
@@ -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
|
|
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:
|
|
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
|
-
|
|
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 ${
|
|
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
|
-
|
|
53
|
+
export function renderMemoryReadme(name, displayName) {
|
|
54
|
+
const spoken = botSpokenName(name, displayName);
|
|
55
|
+
return `# ${spoken} memory
|
|
50
56
|
|
|
51
|
-
Short markdown notes ${
|
|
52
|
-
context, and things the owner asked it to remember. ${
|
|
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
|
package/dist/lib/daemon/run.d.ts
CHANGED
|
@@ -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
|
package/dist/lib/daemon/run.js
CHANGED
|
@@ -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 ??
|
|
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
|
-
|
|
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.
|
|
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.
|
|
121
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
122
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
123
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
124
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
125
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
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
|
}
|