@indigoai-us/hq-cli 5.345.199 → 5.345.201
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 +40 -0
- package/assets/scaffold/core/scripts/lib/session-scope-capability.sh +6 -4
- package/dist/command-catalog.generated.d.ts +44 -0
- package/dist/command-catalog.generated.js +52 -0
- package/dist/commands/bot-runtime.d.ts +35 -0
- package/dist/commands/bot-runtime.js +115 -0
- package/dist/commands/bot.d.ts +53 -0
- package/dist/commands/bot.js +239 -30
- package/dist/commands/cloud.d.ts +39 -0
- package/dist/commands/cloud.js +173 -82
- package/dist/commands/creators.js +2 -1
- package/dist/commands/deploy-domains.js +8 -4
- package/dist/commands/library-remove.js +2 -1
- package/dist/commands/library.js +5 -4
- package/dist/commands/mesh.d.ts +0 -7
- package/dist/commands/mesh.js +5 -1
- package/dist/commands/sync-held.js +2 -2
- package/dist/lib/bot/api.d.ts +8 -0
- package/dist/lib/bot/api.js +9 -0
- package/dist/lib/bot/fleet-download.d.ts +27 -0
- package/dist/lib/bot/fleet-download.js +162 -0
- package/dist/lib/bot/fleet-local.d.ts +79 -2
- package/dist/lib/bot/fleet-local.js +246 -74
- package/dist/lib/bot/fleet-python.d.ts +2 -0
- package/dist/lib/bot/fleet-python.js +29 -0
- package/dist/lib/bot/jobs/source-report.d.ts +31 -0
- package/dist/lib/bot/jobs/source-report.js +276 -0
- package/dist/lib/bot/legacy-convert.d.ts +107 -4
- package/dist/lib/bot/legacy-convert.js +159 -13
- package/dist/lib/bot/legacy-provider-login.d.ts +34 -0
- package/dist/lib/bot/legacy-provider-login.js +144 -0
- package/dist/lib/bot/run.js +20 -1
- package/dist/lib/doctor/checks/bots.d.ts +4 -0
- package/dist/lib/doctor/checks/bots.js +33 -0
- package/dist/lib/lanes/mesh-events.js +3 -1
- package/dist/lib/lanes/store.js +7 -0
- package/dist/lib/lanes/types.d.ts +2 -0
- package/dist/lib/lanes/types.js +1 -0
- package/dist/lib/lanes/watcher.d.ts +0 -33
- package/dist/lib/lanes/watcher.js +7 -0
- package/dist/lib/mesh/api.js +2 -1
- package/dist/lib/mesh/live/daemon/run.d.ts +0 -10
- package/dist/lib/mesh/live/daemon/run.js +3 -0
- package/dist/lib/mesh/live/emit.d.ts +2 -11
- package/dist/lib/mesh/live/emit.js +20 -2
- package/dist/lib/mesh/live/flush.d.ts +2 -0
- package/dist/lib/mesh/live/flush.js +34 -3
- package/dist/lib/mesh/live/reporting-privacy.d.ts +7 -0
- package/dist/lib/mesh/live/reporting-privacy.js +47 -0
- package/dist/lib/work-context/company.d.ts +2 -3
- package/dist/lib/work-context/company.js +4 -22
- package/dist/secrets-env-action.js +5 -2
- package/dist/utils/cognito-callback-port.d.ts +2 -0
- package/dist/utils/cognito-callback-port.js +10 -5
- package/dist/utils/cognito-config.js +6 -1
- package/dist/utils/cognito-session.js +6 -1
- package/dist/utils/interactive-caller.d.ts +8 -0
- package/dist/utils/interactive-caller.js +10 -0
- package/dist/utils/login-browser.js +2 -1
- package/dist/utils/resident-package-preload.js +57 -4
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.345.201] — 2026-11-04
|
|
6
|
+
- `hq deploy domains buy` accepts a registrar price in `usd` or `USD`. Search shows that price as US dollars, and renew accepts the same code. A price in another currency is still refused, and the message shows the currency code the server sent.
|
|
7
|
+
- The Executive sends source reports to its owner when a meeting ends and one final threaded report after all source lanes finish. Delivery receipts suppress normal duplicates and retain reports during the ten-minute cooldown. Recovery retries an intent without a sent receipt; a crash after sending but before recording the receipt can resend that report.
|
|
8
|
+
- Re-pin native policy enforcement to the corrected staging gate, including keyed host approvals and consumed fact proofs. Fix CRLF transport in Windows answer rows, receipt names and required fact names. Recognize drive-qualified and MSYS absolute read paths while preserving exact receipt names. The port remains opt-in and requires the matching core script.
|
|
9
|
+
- `hq-hook`: `block-agent-secrets-reveal` has a full native port (US-011). `hq-hook bridge block-agent-secrets-reveal` answers every call of the hq-core-staging guard (sha256 `e1a1b05d`) itself, including denies, and matches the bash guard byte for byte on macOS and Windows. It runs the flag reader with node only when the command is a secret reveal, as the guard does. The flag `hook-engine-port-block-agent-secrets-reveal` stays off, so nothing changes until it is turned on.
|
|
10
|
+
- `hq-hook`: port `lanes-repo-merge-hold` payload validation, merge prefilter, dependency checks and hold-response formatting to native Rust. Preserve the bounded CLI call and its failure notices, including timeouts without a hold record. Convert Git Bash TMPDIR drive paths through the shared MSYS converter. Capture CLI output in private files so inherited child handles cannot extend the timeout wait. The port flag stays off.
|
|
11
|
+
- Older local bots on the Codex or Grok runner now move to the HQ Fleet Runtime at their next start when their provider sign-in is readable on the computer: the Codex CLI login (or the bot's own Codex login) is imported, and a Grok login is copied from another Fleet bot on the same computer. A bot whose sign-in is not readable stays on its legacy runner, records why, files one failure report with HQ per reason (the same route a Fleet bot reports a failed turn through), and DMs its owner once per reason with the `hq bot auth <name> --provider <chatgpt|grok>` fix. A Claude bot with its own Claude account stays and tells the owner that `hq bot auth <name> --provider claude` moves it onto the owner's Claude Code login. `hq bot list --json`, `hq bot status --json` and `hq bot start --json` now carry `brainSignIn` (the provider a bot of any engine must sign in to before it can run, with the command) and, for a legacy bot, `legacy` (whether it moves at its next start, the hold reason, the last failed move, the owner DM and the report id); `hq bot status` and `hq doctor --only bots` say the same in words. `HQ_BOT_KEEP_LEGACY_RUNTIME=1` still keeps any bot legacy.
|
|
12
|
+
- Local bots now install HQ Fleet Local 0.4.26 on HQ Fleet Runtime main d257fdd1
|
|
13
|
+
(same gzip runtime archive as 0.4.25). A bot whose turn failed no longer counts its
|
|
14
|
+
own "I'm away for a bit" reply as a worked turn, so `hq bot status` and `hq doctor`
|
|
15
|
+
keep showing the failure and its fix until the bot really answers. Installed bots
|
|
16
|
+
move to 0.4.26 at the daemon's next update pass.
|
|
17
|
+
- `hq sync pull` now recovers when the HQ server rejects a sign-in that still looks valid on your machine (`hq auth status` and `hq auth refresh` only check the saved expiry): it refreshes the saved session once and retries, and if the server still rejects it the message tells you to run `hq login` instead of printing a bare "Unauthorized". Waiting on the sign-in service during a sync now stops after 45 seconds with a clear message.
|
|
18
|
+
|
|
19
|
+
## [5.345.200] — 2026-11-04
|
|
20
|
+
- `hq creators apply`, `hq library` (search, add, describe, link, rm),
|
|
21
|
+
`hq sync held`, and `hq lanes` no longer open a browser sign-in when no
|
|
22
|
+
person is at a terminal (a lane worker, daemon, bot, launchd task, or piped
|
|
23
|
+
child). They print the `hq login` remedy instead. The headless `hq login`
|
|
24
|
+
URL path now uses a registered callback port, and a stray
|
|
25
|
+
`HQ_COGNITO_CALLBACK_PORT` warning prints once per process.
|
|
26
|
+
- The stray callback-port warning no longer prints on commands that never
|
|
27
|
+
sign in; the port is read when a sign-in starts. `hq bot` and `hq secrets`
|
|
28
|
+
sign-ins now go through the same interactive-caller gate.
|
|
29
|
+
- `hq bot runtime install` downloads and builds the HQ Fleet Runtime once for
|
|
30
|
+
this computer, with progress, so `hq bot create` afterwards takes seconds.
|
|
31
|
+
`hq bot runtime status` says which of the three steps (download, Python,
|
|
32
|
+
environment) are done. `--json` prints one event per line for the desktop app.
|
|
33
|
+
- The runtime download streams to disk, continues where it stopped after a
|
|
34
|
+
stall or a dropped connection, and no longer has a 20 minute cap. Creates and
|
|
35
|
+
adopts started at the same time share one download through a machine-wide
|
|
36
|
+
lock instead of each fetching the same archive. A gzip runtime archive is
|
|
37
|
+
accepted alongside the plain tar, and a matching archive from any installed
|
|
38
|
+
release is reused without a download.
|
|
39
|
+
- `hq bot create`, `hq bot adopt` and `hq bot restore` print what the runtime
|
|
40
|
+
install is doing on stderr (download percentage, then each build step)
|
|
41
|
+
unless `--json` is given.
|
|
42
|
+
- Personal and unattributed conversations are no longer assigned from a device default company or sent as Work Mesh summaries. Reporting respects the HQ Anywhere off setting.
|
|
43
|
+
- Validate session capability documents before reading company grants.
|
|
44
|
+
|
|
5
45
|
## [5.345.199] — 2026-11-04
|
|
6
46
|
- `hq bot status <name>` shows the bot's last reported failure: when, the
|
|
7
47
|
failure class, the plain-language cause and fix the owner was sent, the HQ
|
|
@@ -53,8 +53,8 @@ session_scope_read() {
|
|
|
53
53
|
local root="${1:-}" sid="${2:-}" aid="${3:-}" cap
|
|
54
54
|
cap="$(session_scope_capability_path "$root" "$sid" "$aid")" || return 0
|
|
55
55
|
[ -f "$cap" ] || return 0
|
|
56
|
-
jq -
|
|
57
|
-
'select(.session_id == $sid and (.agent_id // "") == $aid) | .company_slug // empty' \
|
|
56
|
+
jq -sr --arg sid "$sid" --arg aid "$aid" \
|
|
57
|
+
'if length == 1 and (.[0] | type) == "object" then .[0] else error("capability must contain one object") end | select(.session_id == $sid and (.agent_id // "") == $aid) | .company_slug // empty' \
|
|
58
58
|
"$cap" 2>/dev/null || true
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -66,8 +66,10 @@ session_scope_read_companies() {
|
|
|
66
66
|
local -a slugs
|
|
67
67
|
cap="$(session_scope_capability_path "$root" "$sid" "$aid")" || return 0
|
|
68
68
|
[ -f "$cap" ] || return 0
|
|
69
|
-
lock_info="$(jq -
|
|
70
|
-
|
|
69
|
+
lock_info="$(jq -ser --arg sid "$sid" --arg aid "$aid" '
|
|
70
|
+
if length == 1 and (.[0] | type) == "object" then .[0]
|
|
71
|
+
else error("capability must contain one object") end
|
|
72
|
+
| select(.session_id == $sid and (.agent_id // "") == $aid)
|
|
71
73
|
| if (.company_slug | type) != "string" or (.company_slug | test("^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$") | not) then error("invalid primary")
|
|
72
74
|
elif has("company_slugs") then
|
|
73
75
|
if (.company_slugs | type) == "array" and all(.company_slugs[]; type == "string" and test("^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"))
|
|
@@ -19810,6 +19810,50 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
19810
19810
|
}];
|
|
19811
19811
|
readonly options: readonly [];
|
|
19812
19812
|
readonly subcommands: readonly [];
|
|
19813
|
+
}, {
|
|
19814
|
+
readonly name: "runtime";
|
|
19815
|
+
readonly description: "The HQ Fleet Runtime every local bot on this computer shares";
|
|
19816
|
+
readonly aliases: readonly [];
|
|
19817
|
+
readonly hidden: false;
|
|
19818
|
+
readonly helpOption: true;
|
|
19819
|
+
readonly helpCommand: true;
|
|
19820
|
+
readonly usage: "[options] [command]";
|
|
19821
|
+
readonly helpText: readonly [];
|
|
19822
|
+
readonly arguments: readonly [];
|
|
19823
|
+
readonly options: readonly [];
|
|
19824
|
+
readonly subcommands: readonly [{
|
|
19825
|
+
readonly name: "install";
|
|
19826
|
+
readonly description: "Download and build the runtime once for this computer, with progress, so creating a bot takes seconds. Safe to run again: a finished install returns at once, an interrupted download continues where it stopped";
|
|
19827
|
+
readonly aliases: readonly [];
|
|
19828
|
+
readonly hidden: false;
|
|
19829
|
+
readonly helpOption: true;
|
|
19830
|
+
readonly helpCommand: false;
|
|
19831
|
+
readonly usage: "[options]";
|
|
19832
|
+
readonly helpText: readonly [];
|
|
19833
|
+
readonly arguments: readonly [];
|
|
19834
|
+
readonly options: readonly [{
|
|
19835
|
+
readonly flags: "--json";
|
|
19836
|
+
readonly description: "Print one JSON object per line: progress events, then { ok, event: \"done\", release, runtimeDir }";
|
|
19837
|
+
readonly hidden: false;
|
|
19838
|
+
}];
|
|
19839
|
+
readonly subcommands: readonly [];
|
|
19840
|
+
}, {
|
|
19841
|
+
readonly name: "status";
|
|
19842
|
+
readonly description: "Say whether the runtime is installed on this computer, step by step";
|
|
19843
|
+
readonly aliases: readonly [];
|
|
19844
|
+
readonly hidden: false;
|
|
19845
|
+
readonly helpOption: true;
|
|
19846
|
+
readonly helpCommand: false;
|
|
19847
|
+
readonly usage: "[options]";
|
|
19848
|
+
readonly helpText: readonly [];
|
|
19849
|
+
readonly arguments: readonly [];
|
|
19850
|
+
readonly options: readonly [{
|
|
19851
|
+
readonly flags: "--json";
|
|
19852
|
+
readonly description: "Print machine-readable JSON";
|
|
19853
|
+
readonly hidden: false;
|
|
19854
|
+
}];
|
|
19855
|
+
readonly subcommands: readonly [];
|
|
19856
|
+
}];
|
|
19813
19857
|
}, {
|
|
19814
19858
|
readonly name: "daemon";
|
|
19815
19859
|
readonly description: "Manage the bot's launchd user agent (macOS)";
|
|
@@ -24159,6 +24159,58 @@ export const COMMAND_CATALOG = [
|
|
|
24159
24159
|
"options": [],
|
|
24160
24160
|
"subcommands": []
|
|
24161
24161
|
},
|
|
24162
|
+
{
|
|
24163
|
+
"name": "runtime",
|
|
24164
|
+
"description": "The HQ Fleet Runtime every local bot on this computer shares",
|
|
24165
|
+
"aliases": [],
|
|
24166
|
+
"hidden": false,
|
|
24167
|
+
"helpOption": true,
|
|
24168
|
+
"helpCommand": true,
|
|
24169
|
+
"usage": "[options] [command]",
|
|
24170
|
+
"helpText": [],
|
|
24171
|
+
"arguments": [],
|
|
24172
|
+
"options": [],
|
|
24173
|
+
"subcommands": [
|
|
24174
|
+
{
|
|
24175
|
+
"name": "install",
|
|
24176
|
+
"description": "Download and build the runtime once for this computer, with progress, so creating a bot takes seconds. Safe to run again: a finished install returns at once, an interrupted download continues where it stopped",
|
|
24177
|
+
"aliases": [],
|
|
24178
|
+
"hidden": false,
|
|
24179
|
+
"helpOption": true,
|
|
24180
|
+
"helpCommand": false,
|
|
24181
|
+
"usage": "[options]",
|
|
24182
|
+
"helpText": [],
|
|
24183
|
+
"arguments": [],
|
|
24184
|
+
"options": [
|
|
24185
|
+
{
|
|
24186
|
+
"flags": "--json",
|
|
24187
|
+
"description": "Print one JSON object per line: progress events, then { ok, event: \"done\", release, runtimeDir }",
|
|
24188
|
+
"hidden": false
|
|
24189
|
+
}
|
|
24190
|
+
],
|
|
24191
|
+
"subcommands": []
|
|
24192
|
+
},
|
|
24193
|
+
{
|
|
24194
|
+
"name": "status",
|
|
24195
|
+
"description": "Say whether the runtime is installed on this computer, step by step",
|
|
24196
|
+
"aliases": [],
|
|
24197
|
+
"hidden": false,
|
|
24198
|
+
"helpOption": true,
|
|
24199
|
+
"helpCommand": false,
|
|
24200
|
+
"usage": "[options]",
|
|
24201
|
+
"helpText": [],
|
|
24202
|
+
"arguments": [],
|
|
24203
|
+
"options": [
|
|
24204
|
+
{
|
|
24205
|
+
"flags": "--json",
|
|
24206
|
+
"description": "Print machine-readable JSON",
|
|
24207
|
+
"hidden": false
|
|
24208
|
+
}
|
|
24209
|
+
],
|
|
24210
|
+
"subcommands": []
|
|
24211
|
+
}
|
|
24212
|
+
]
|
|
24213
|
+
},
|
|
24162
24214
|
{
|
|
24163
24215
|
"name": "daemon",
|
|
24164
24216
|
"description": "Manage the bot's launchd user agent (macOS)",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type FleetInstallProgress, type FleetInstallProgressListener, type FleetLocalTargetRelease } from "../lib/bot/fleet-local.js";
|
|
2
|
+
export type FleetProgressMode = "text" | "json" | "silent";
|
|
3
|
+
interface ProgressOutput {
|
|
4
|
+
write(text: string): void;
|
|
5
|
+
isTTY: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** The sentence for a phase, for people. */
|
|
8
|
+
export declare function describeFleetInstallPhase(event: FleetInstallProgress): string;
|
|
9
|
+
/**
|
|
10
|
+
* Progress for a terminal (stderr, one line that rewrites itself on a TTY and
|
|
11
|
+
* prints at each tenth otherwise), for a program (one JSON object per line on
|
|
12
|
+
* stdout), or nothing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function fleetInstallProgressReporter(mode: FleetProgressMode, output?: ProgressOutput, stdout?: (line: string) => void): FleetInstallProgressListener;
|
|
15
|
+
export interface FleetRuntimeStatus {
|
|
16
|
+
ready: boolean;
|
|
17
|
+
release: {
|
|
18
|
+
version: string;
|
|
19
|
+
source: FleetLocalTargetRelease["source"];
|
|
20
|
+
};
|
|
21
|
+
steps: {
|
|
22
|
+
distribution: boolean;
|
|
23
|
+
python: boolean;
|
|
24
|
+
runtime: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function fleetRuntimeStatus(): Promise<FleetRuntimeStatus>;
|
|
28
|
+
export declare function runBotRuntimeInstall(opts: {
|
|
29
|
+
json?: boolean;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
export declare function runBotRuntimeStatus(opts: {
|
|
32
|
+
json?: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=bot-runtime.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { ensureFleetRuntimeInstalled, fleetLocalDistributionInstalled, fleetRuntimeReady, installTargetFleetLocalDistribution, resolveFleetLocalTargetRelease, } from "../lib/bot/fleet-local.js";
|
|
3
|
+
import { installedFleetPython } from "../lib/bot/fleet-python.js";
|
|
4
|
+
function megabytes(bytes) {
|
|
5
|
+
return `${(bytes / 1_048_576).toFixed(1)} MB`;
|
|
6
|
+
}
|
|
7
|
+
/** The sentence for a phase, for people. */
|
|
8
|
+
export function describeFleetInstallPhase(event) {
|
|
9
|
+
switch (event.phase) {
|
|
10
|
+
case "download": {
|
|
11
|
+
const name = event.file.startsWith("hq-fleet-runtime-") ? "the HQ Fleet Runtime" : event.file;
|
|
12
|
+
if (event.total === null)
|
|
13
|
+
return `Downloading ${name}: ${megabytes(event.received)}`;
|
|
14
|
+
const percent = Math.min(100, Math.floor((event.received / Math.max(event.total, 1)) * 100));
|
|
15
|
+
return `Downloading ${name}: ${megabytes(event.received)} of ${megabytes(event.total)} (${percent}%)`;
|
|
16
|
+
}
|
|
17
|
+
case "verify":
|
|
18
|
+
return "Checking the download against its signed release";
|
|
19
|
+
case "python":
|
|
20
|
+
return "Preparing the runtime's private Python";
|
|
21
|
+
case "extract":
|
|
22
|
+
return "Unpacking the runtime";
|
|
23
|
+
case "environment":
|
|
24
|
+
return "Creating the runtime environment";
|
|
25
|
+
case "packages":
|
|
26
|
+
return "Installing the runtime's packages (a minute or two)";
|
|
27
|
+
case "ready":
|
|
28
|
+
if (event.step === "download")
|
|
29
|
+
return event.cached ? "The runtime download is already on this computer" : "The runtime download is complete";
|
|
30
|
+
return event.cached ? "The runtime is already installed on this computer" : "The runtime is ready";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Progress for a terminal (stderr, one line that rewrites itself on a TTY and
|
|
35
|
+
* prints at each tenth otherwise), for a program (one JSON object per line on
|
|
36
|
+
* stdout), or nothing.
|
|
37
|
+
*/
|
|
38
|
+
export function fleetInstallProgressReporter(mode, output = { write: (text) => { process.stderr.write(text); }, isTTY: process.stderr.isTTY === true }, stdout = (line) => { process.stdout.write(`${line}\n`); }) {
|
|
39
|
+
if (mode === "silent")
|
|
40
|
+
return () => undefined;
|
|
41
|
+
if (mode === "json") {
|
|
42
|
+
return (event) => {
|
|
43
|
+
const percent = event.phase === "download" && event.total !== null
|
|
44
|
+
? Math.min(100, Math.floor((event.received / Math.max(event.total, 1)) * 100))
|
|
45
|
+
: null;
|
|
46
|
+
stdout(JSON.stringify({ event: "progress", ...event, percent, message: describeFleetInstallPhase(event) }));
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
let lastTenth = -1;
|
|
50
|
+
let lineOpen = false;
|
|
51
|
+
return (event) => {
|
|
52
|
+
const text = describeFleetInstallPhase(event);
|
|
53
|
+
if (event.phase === "download" && event.total !== null) {
|
|
54
|
+
const tenth = Math.floor((event.received / Math.max(event.total, 1)) * 10);
|
|
55
|
+
if (output.isTTY) {
|
|
56
|
+
output.write(`\r${text}${event.received >= event.total ? "\n" : ""}`);
|
|
57
|
+
lineOpen = event.received < event.total;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (tenth === lastTenth && event.received < event.total)
|
|
61
|
+
return;
|
|
62
|
+
lastTenth = tenth;
|
|
63
|
+
output.write(`${text}\n`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (lineOpen) {
|
|
67
|
+
output.write("\n");
|
|
68
|
+
lineOpen = false;
|
|
69
|
+
}
|
|
70
|
+
output.write(`${text}\n`);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export async function fleetRuntimeStatus() {
|
|
74
|
+
const target = await resolveFleetLocalTargetRelease();
|
|
75
|
+
const distribution = fleetLocalDistributionInstalled(target.release);
|
|
76
|
+
const python = installedFleetPython();
|
|
77
|
+
const runtime = distribution && python ? fleetRuntimeReady({ release: target.release }, { python }) : false;
|
|
78
|
+
return {
|
|
79
|
+
ready: distribution && python !== null && runtime,
|
|
80
|
+
release: { version: target.release.version, source: target.source },
|
|
81
|
+
steps: { distribution, python: python !== null, runtime },
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export async function runBotRuntimeInstall(opts) {
|
|
85
|
+
const report = fleetInstallProgressReporter(opts.json ? "json" : "text");
|
|
86
|
+
const target = await resolveFleetLocalTargetRelease();
|
|
87
|
+
const installation = await installTargetFleetLocalDistribution({ target, onProgress: report });
|
|
88
|
+
const result = await ensureFleetRuntimeInstalled(installation, { onProgress: report });
|
|
89
|
+
if (opts.json) {
|
|
90
|
+
console.log(JSON.stringify({
|
|
91
|
+
ok: true,
|
|
92
|
+
event: "done",
|
|
93
|
+
release: { version: result.release.version, source: target.source },
|
|
94
|
+
distributionDir: result.distributionDir,
|
|
95
|
+
runtimeDir: result.runtimeDir,
|
|
96
|
+
}));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
console.log(`${chalk.green("HQ Fleet Runtime " + result.release.version + " is ready on this computer.")} ${chalk.dim(result.runtimeDir)}`);
|
|
100
|
+
}
|
|
101
|
+
export async function runBotRuntimeStatus(opts) {
|
|
102
|
+
const current = await fleetRuntimeStatus();
|
|
103
|
+
if (opts.json) {
|
|
104
|
+
console.log(JSON.stringify({ ok: true, ...current }, null, 2));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const mark = (done) => (done ? chalk.green("ready") : chalk.yellow("missing"));
|
|
108
|
+
console.log(`HQ Fleet Runtime ${current.release.version} ${current.ready ? chalk.green("ready") : chalk.yellow("not installed yet")}`);
|
|
109
|
+
console.log(` download: ${mark(current.steps.distribution)}`);
|
|
110
|
+
console.log(` python: ${mark(current.steps.python)}`);
|
|
111
|
+
console.log(` environment: ${mark(current.steps.runtime)}`);
|
|
112
|
+
if (!current.ready)
|
|
113
|
+
console.log(chalk.dim(" Run `hq bot runtime install` to get it ready before creating a bot."));
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=bot-runtime.js.map
|
package/dist/commands/bot.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LegacyMoveState, type LegacyProviderLoginProbe } from "../lib/bot/legacy-convert.js";
|
|
1
2
|
import { Command } from "commander";
|
|
2
3
|
import { type RuntimeSignInCheck, type RuntimeSignInIssue } from "../lib/bot/runtime-sign-in.js";
|
|
3
4
|
import { type ClaudeLoginCheck } from "../lib/bot/claude-login.js";
|
|
@@ -62,6 +63,16 @@ export interface BotRow {
|
|
|
62
63
|
runtimeSignedIn: boolean | null;
|
|
63
64
|
/** The terminal command that signs the bot's coding tool in on this computer. */
|
|
64
65
|
signInCommand: string;
|
|
66
|
+
/**
|
|
67
|
+
* Set when the bot cannot run until its model provider is signed in, on any
|
|
68
|
+
* engine: a Fleet bot never signed in or whose last turn failed on auth, a
|
|
69
|
+
* legacy bot held for a sign-in it cannot import, or a legacy runner that
|
|
70
|
+
* found its tool signed out. `command` signs the bot in (and moves a legacy
|
|
71
|
+
* bot to the HQ Fleet Runtime); null when no sign-in is needed.
|
|
72
|
+
*/
|
|
73
|
+
brainSignIn: BrainSignIn | null;
|
|
74
|
+
/** A bot still on its legacy runner: whether and why it moves at its next start. Absent for a Fleet bot. */
|
|
75
|
+
legacy?: Record<string, unknown>;
|
|
65
76
|
/**
|
|
66
77
|
* The coding tool crashed before its turn started since the bot last
|
|
67
78
|
* started, and no turn has worked since; null otherwise. A restart clears it.
|
|
@@ -101,14 +112,52 @@ export interface BotRow {
|
|
|
101
112
|
export declare function listBotNames(root: string): string[];
|
|
102
113
|
/** Bot-identity token supplier: per-bot creds + per-bot token cache dir. */
|
|
103
114
|
export declare function botTokenSupplier(dir: string): () => Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Whether `hq bot` may open a browser sign-in for its owner: a TTY on stdin,
|
|
117
|
+
* and the shared interactive-caller gate (no lane, daemon, bot runtime, or
|
|
118
|
+
* HQ_NO_BROWSER_LOGIN child).
|
|
119
|
+
*/
|
|
120
|
+
export declare function ownerSignInAllowed(): boolean;
|
|
104
121
|
/**
|
|
105
122
|
* The bot's word on its coding tool's sign-in. Only a running bot's report
|
|
106
123
|
* counts: a stopped bot's last check may be from before a sign-in or a
|
|
107
124
|
* sign-out, and the next start checks afresh.
|
|
108
125
|
*/
|
|
109
126
|
export declare function runtimeSignedIn(status: Pick<BotStatusFile, "runtimeSignIn" | "runtimeSignInCheck"> | null | undefined, processAlive: boolean): boolean | null;
|
|
127
|
+
export interface BrainSignIn {
|
|
128
|
+
provider: BotRuntimeId;
|
|
129
|
+
needed: true;
|
|
130
|
+
reason: string;
|
|
131
|
+
command: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Whether the bot's model provider must be signed in before it can run, from
|
|
135
|
+
* what this computer knows: the bot's settings, its last reported failure or
|
|
136
|
+
* sign-in check, and (legacy) why it has not moved to the HQ Fleet Runtime.
|
|
137
|
+
*/
|
|
138
|
+
export declare function brainSignInFor(name: string, config: BotConfig, status: BotStatusFile | null, legacy: LegacyMoveState | null): BrainSignIn | null;
|
|
110
139
|
/** Spawn `hq bot run <name>` detached (no launchd). */
|
|
111
140
|
export declare function spawnDetachedRun(name: string, dir: string): number;
|
|
141
|
+
/**
|
|
142
|
+
* Move a legacy bot onto the HQ Fleet Runtime under the same identity.
|
|
143
|
+
* Returns the bot's new settings, or null when it stays on the legacy runner
|
|
144
|
+
* (it needs its own sign-in, the move is turned off, or the move failed, in
|
|
145
|
+
* which case the next start tries again).
|
|
146
|
+
*
|
|
147
|
+
* bot.json switches to Fleet only after the Fleet service is installed, so a
|
|
148
|
+
* failure or a kill at any earlier step leaves a legacy bot that starts as
|
|
149
|
+
* before. Legacy jobs move and the legacy startup agent goes after that.
|
|
150
|
+
*
|
|
151
|
+
* `from: "start"` stops the legacy runner first; a failed move leaves it
|
|
152
|
+
* stopped and the caller starts it again. `from: "run"` is the legacy runner
|
|
153
|
+
* itself starting (launchd, hq daemon or a detached run), before it polls:
|
|
154
|
+
* its own startup agent is booted out last, detached.
|
|
155
|
+
*/
|
|
156
|
+
/** Seams for the legacy move, replaced in tests. */
|
|
157
|
+
export declare const legacyConvertSeams: {
|
|
158
|
+
/** Whether the provider sign-in a Codex or Grok legacy bot needs is readable here, as HQ Fleet Local imports it. */
|
|
159
|
+
providerLogin: (dir: string, config: BotConfig) => LegacyProviderLoginProbe;
|
|
160
|
+
};
|
|
112
161
|
/**
|
|
113
162
|
* `output`: "json" | "text" print a result; "silent" prints nothing — used
|
|
114
163
|
* when stop is a step inside rm/restart, whose own JSON must be the only
|
|
@@ -182,6 +231,10 @@ export declare function runBotCompanies(nameArg: string, opts: {
|
|
|
182
231
|
export declare function runBotWorkers(opts: {
|
|
183
232
|
json?: boolean;
|
|
184
233
|
}): Promise<void>;
|
|
234
|
+
/** The `legacy` object in `hq bot status --json` for a bot still on its legacy runner. */
|
|
235
|
+
export declare function legacyStatusJson(state: LegacyMoveState): Record<string, unknown>;
|
|
236
|
+
/** The `fleet move:` lines of `hq bot status` for a bot still on its legacy runner. */
|
|
237
|
+
export declare function legacyStatusLines(name: string, state: LegacyMoveState): string[];
|
|
185
238
|
/**
|
|
186
239
|
* `hq bot set <name> [--model <id|default>] [--effort <level|default>]
|
|
187
240
|
* [--display-name <name>]`: change what the bot thinks with, or the name
|