@indigoai-us/hq-cli 5.345.205 → 5.345.207
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 +39 -0
- package/assets/scaffold/core/scripts/checkpoint-stop-gate.sh +111 -15
- package/dist/command-catalog.generated.d.ts +14 -2
- package/dist/command-catalog.generated.js +17 -2
- package/dist/commands/bot.d.ts +6 -0
- package/dist/commands/bot.js +88 -12
- package/dist/commands/core-checkpoint-stop-gate-native.js +130 -25
- package/dist/commands/files.d.ts +36 -0
- package/dist/commands/files.js +80 -1
- package/dist/commands/lanes-shared.d.ts +13 -0
- package/dist/commands/lanes.d.ts +2 -0
- package/dist/commands/lanes.js +44 -4
- package/dist/commands/sources.js +1 -1
- package/dist/commands/storage-offload.d.ts +8 -1
- package/dist/commands/storage-offload.js +6 -1
- package/dist/commands/storage.js +4 -0
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +260 -250
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/bot/fleet-cron.js +4 -1
- package/dist/lib/bot/fleet-local.js +9 -9
- package/dist/lib/bot/fleet-owner-companies.d.ts +7 -0
- package/dist/lib/bot/fleet-owner-companies.js +16 -4
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +2 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +18 -1
- package/dist/lib/bot/jobs/meeting-detect.d.ts +41 -2
- package/dist/lib/bot/jobs/meeting-detect.js +280 -16
- package/dist/lib/bot/run.d.ts +1 -0
- package/dist/lib/bot/run.js +4 -2
- package/dist/lib/bot/runtime-failure.js +4 -2
- package/dist/lib/capacity/collect.d.ts +7 -0
- package/dist/lib/capacity/collect.js +22 -16
- package/dist/lib/capacity/route.d.ts +23 -0
- package/dist/lib/capacity/route.js +41 -2
- package/dist/lib/company-skill-wrapper.js +33 -4
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/hot-channels/alert.d.ts +4 -1
- package/dist/lib/hot-channels/alert.js +10 -4
- package/dist/lib/hot-channels/ledger.d.ts +4 -4
- package/dist/lib/hot-channels/ledger.js +2 -0
- package/dist/lib/hot-channels/run.d.ts +6 -0
- package/dist/lib/hot-channels/run.js +7 -2
- package/dist/lib/hot-channels/signals-pass.d.ts +11 -2
- package/dist/lib/hot-channels/signals-pass.js +129 -15
- package/dist/lib/lanes/links.d.ts +2 -0
- package/dist/lib/lanes/links.js +12 -1
- package/dist/lib/live-meetings.js +1 -1
- package/dist/lib/sync-core/release.d.ts +1 -1
- package/dist/lib/sync-core/release.js +1 -1
- package/dist/utils/redact-error-text.js +1 -0
- package/dist/utils/resident-package-preload.js +32 -4
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.345.207] — 2026-11-05
|
|
6
|
+
- `hq bot eb <name>` now restarts the running bots the change affects, the previous and the new Executive bot, each after its current reply (up to 2 minutes), so the daily Executive jobs move at once; it prints one line per bot, `--json` adds `restarted` and `skipped`, and `--no-restart` keeps the old behaviour.
|
|
7
|
+
|
|
8
|
+
- `hq files share <path> --with @all` no longer asks the server to notify every company member by default. Pass `--notify` to send the share notification to all active members. In a terminal, an `@all` share without `--notify` shows how many members would be notified and asks first. Without a terminal it grants access, requests no notifications, and prints a notice to stderr. Person, group and email shares still notify the grantee. `--no-notify` grants access without notifying anyone. The opt-in needs the paired hq-pro change; older servers ignore the flag and still notify, so the CLI says "No member notifications were sent" only when the server confirms it. `--no-notify` now also applies to `--channel <name> --mention <person>` shares without `--with`. An `@all --channel` share with neither flag prints one line saying members were not notified (channel post only) when the server confirms it. (feedback_a7f33826, DEV-5263)
|
|
9
|
+
- `hq lanes create --account auto` no longer refuses with `no_account_with_room` because an account has no reading in the last 24 hours. When a skipped account has a missing or day-old reading, it takes one fresh capacity reading of only those accounts (within `--provider` when given) and routes again, and refuses only if there is still no room. (feedback_94446741)
|
|
10
|
+
- Meeting detection no longer widens a company bot with no companies to the owner's memberships, and failure logs strip `sk-proj-` style keys and `hqk_` keys in any case.
|
|
11
|
+
- Meeting detection logs the company, failing step, and HTTP status or error class, limits logging of a repeated failure while polling continues, and polls only companies the bot is bound or entitled to.
|
|
12
|
+
- Run the HQ Grep discovery guard natively with pinned Bash diagnostics, malformed-input parity and captured Claude Code payload coverage.
|
|
13
|
+
- The hot-channel signal pass keeps its real failure class: a Claude usage limit is recorded as `claude-usage-limit` and other provider errors as `claude-provider-error`, not `claude-bad-output`, with the provider's reason in the job log. A failed pass no longer reads as ok in `hq sources sync` or the 06:30 Fleet job, and its documents stay queued for a later run.
|
|
14
|
+
- `hq skill create` no longer refuses to replace a company skill wrapper it generated itself (for example with `--surface-only`) as "not an HQ-generated skill wrapper" when a later run spells the HQ folder differently. On Windows the same folder can appear with a different case, an 8.3 short name, a mapped drive or a `\\?\` prefix. The wrapper check now also compares where the link really resolves. (feedback_58a0b0de)
|
|
15
|
+
- The checkpoint Stop gate now counts Codex code-mode tool calls. Codex Desktop (and often `codex exec`) runs tools from JavaScript inside one `exec` call, and the gate only read the `const r = await tools.exec_command({...});` shape, so `text(await tools.exec_command({...}));`, `Promise.allSettled([...])`, multi-line call objects and `tools.apply_patch(...)` or MCP calls dropped out of the turn and it was judged idle with no checkpoint. The gate now reads every `tools.exec_command` call in the exec in source order, so the last one is the turn's final action, and an exec with no readable command still counts as work. A `cmd` value written in single quotes or as a template literal without `${...}` is read too, and checkpoint text inside another key's string is not taken for a checkpoint. A Codex automation `<heartbeat>` turn that did work and ended with an empty answer is recorded out of band instead of re-prompted, and a non-empty `last_assistant_message` in the Codex Stop payload now counts as the delivered reply, as it already did for Claude. The 3-block cap is unchanged. The native port matches (feedback 5ecb672f).
|
|
16
|
+
- Machines on the new sync engine move to engine 0.1.25. Snapshots on slow
|
|
17
|
+
links use an idle timeout, gzip and resumable pages instead of failing at
|
|
18
|
+
60 seconds. Repeated failures back off up to 30 minutes, and a poll is skipped
|
|
19
|
+
when the vault's head has not changed. A held mass delete can be approved or
|
|
20
|
+
rejected with `hq-syncd holds approve|reject <vault>` instead of an
|
|
21
|
+
environment variable. A rejection applied once is not applied again after a
|
|
22
|
+
restart, and approvals carried over a restart are logged. A machine that
|
|
23
|
+
cannot download 0.1.25 keeps running its installed 0.1.23 on the new engine.
|
|
24
|
+
Windows stays on the current sync.
|
|
25
|
+
- hq rescue (and /update-hq) works on Windows with Git Bash only: the bundled hq-cloud engine (6.18.109) uses its built-in file copy when rsync is not on PATH instead of failing the preflight with ENOENT.
|
|
26
|
+
- HQ sync with an `.hqinclude` allowlist (hq-cloud #1079, shipped in 6.18.109): the server-owned company folders `sources/`, `signals/` and `ontology/` (except entity files), and `company-brief.md`, now download even if the allowlist does not list them. These paths are cloud-owned. If you edited one of these files locally, the edit is replaced by the cloud copy on the next sync. Copy any local edits you want to keep somewhere else first.
|
|
27
|
+
- `hq storage offload` refuses server-owned company paths (it checks hq-cloud `isLocallyIneligibleForPush`), so it never uploads into `sources/`, `signals/` or the other server-owned folders, with or without an allowlist.
|
|
28
|
+
|
|
29
|
+
## [5.345.206] — 2026-11-05
|
|
30
|
+
- Warm the fake hq CLI in command-guard parity tests so first-exec scanning on a loaded macOS host cannot trip the merge-hold timeout.
|
|
31
|
+
- `hq lanes link wait` now lets go of its hold on the installed HQ CLI while it
|
|
32
|
+
waits for a report. A conductor waiting up to 30 minutes no longer blocks the
|
|
33
|
+
desktop app's CLI update, which gives running commands 30 seconds to finish.
|
|
34
|
+
- Local bots now install HQ Fleet Local 0.4.28 on HQ Fleet Runtime main 1f8e7cb6.
|
|
35
|
+
A DM sent while the bot is busy reaches the running turn at once, so an answer
|
|
36
|
+
to the bot's own question no longer waits behind the turn that asked it. Turns
|
|
37
|
+
that carry a long prompt, such as a skill invocation, no longer stall for 25
|
|
38
|
+
seconds on HQ's policy hooks, and a bot asked for a skill by its plain name
|
|
39
|
+
(for example `deploy`) gets the core skill instead of an "ambiguous skill name"
|
|
40
|
+
error when HQ also has a personal or company copy. The runtime update also
|
|
41
|
+
brings the Claude sign-in and Slack send fixes from 0.4.27. Installed bots move
|
|
42
|
+
to 0.4.28 at the daemon's next update pass once the release is published.
|
|
43
|
+
|
|
5
44
|
## [5.345.205] — 2026-11-05
|
|
6
45
|
- Long-lived daemon helpers no longer open a Sentry transport. That covers `hq daemon run`, `hq mesh daemon run`, `hq bot run`, the agent-kit heartbeat and inbox, the outpost heartbeat and session host, and the remote-control hosts, including when the daemon starts them through the child bootstrap. A short daemon job, such as a reconcile pass or search indexing, still reports errors.
|
|
7
46
|
- A daemon child-bootstrap helper now exits when its parent exits or the owner pipe closes, and it stops the command it started, including one that ignores SIGTERM. A Linux handoff still leaves the named services running for the next daemon. On macOS a daemon restart now stops the helpers the daemon launched. stdin left on `/dev/null` is not treated as the parent leaving.
|
|
@@ -382,18 +382,94 @@ exec 3>&2
|
|
|
382
382
|
and ((.payload.content? | type) == "array")
|
|
383
383
|
and any(.payload.content[]?; .type == "input_text");
|
|
384
384
|
def real_user: claude_user or codex_user;
|
|
385
|
-
def
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
def codex_heartbeat_user:
|
|
386
|
+
# A Codex automation wake-up: the user row is a <heartbeat> prompt, and
|
|
387
|
+
# the agent may end the turn with an intentionally empty answer.
|
|
388
|
+
codex_user
|
|
389
|
+
and ([.payload.content[]? | select(.type == "input_text") | (.text? // "")] | join("")
|
|
390
|
+
| test("^\\s*<heartbeat[\\s>/]"));
|
|
391
|
+
# Codex code mode runs tools from JavaScript in one "exec" call, written as
|
|
392
|
+
# `const r = await tools.exec_command({...});`,
|
|
393
|
+
# `text(await tools.exec_command({...}));`, `Promise.allSettled([...])`,
|
|
394
|
+
# multi-line call objects, or calls to other tools such as
|
|
395
|
+
# `tools.apply_patch(...)`. The call object is matched as a JS object
|
|
396
|
+
# literal (string-aware, one level of nesting), so braces inside the
|
|
397
|
+
# command string and whatever follows the call do not matter.
|
|
398
|
+
def js_string_re:
|
|
399
|
+
"\"(?:\\\\.|[^\"\\\\])*\"|\u0027(?:\\\\.|[^\u0027\\\\])*\u0027|`(?:\\\\.|[^`\\\\])*`";
|
|
400
|
+
def js_flat_object_re:
|
|
401
|
+
"\\{(?:" + js_string_re + "|[^{}\"\u0027`])*\\}";
|
|
402
|
+
def js_object_re:
|
|
403
|
+
"\\{(?:" + js_string_re + "|" + js_flat_object_re + "|[^{}\"\u0027`])*\\}";
|
|
404
|
+
def js_decode_string:
|
|
405
|
+
# `.` is one JS string literal token, quotes included, in any of the
|
|
406
|
+
# three quote styles. Yields its value, or null when it cannot be read
|
|
407
|
+
# statically: a template literal with ${...}, or an escape JSON cannot
|
|
408
|
+
# decode. Mirrors jsDecodeString in core-checkpoint-stop-gate-native.ts.
|
|
409
|
+
.[0:1] as $q
|
|
410
|
+
| .[1:-1] as $body
|
|
411
|
+
| if $q == "`" and ($body | test("(^|[^\\\\])(\\\\\\\\)*\\$\\{")) then null
|
|
412
|
+
else
|
|
413
|
+
try (
|
|
414
|
+
"\"" + ($body | gsub("(?<e>\\\\[\\s\\S])|(?<q>\")|(?<nl>\n)|(?<cr>\r)|(?<tab>\t)";
|
|
415
|
+
if .e != null then
|
|
416
|
+
(if .e == "\\\u0027" or .e == "\\`" or .e == "\\$" then .e[1:] else .e end)
|
|
417
|
+
elif .q != null then "\\\""
|
|
418
|
+
elif .nl != null then "\\n"
|
|
419
|
+
elif .cr != null then "\\r"
|
|
420
|
+
else "\\t"
|
|
421
|
+
end)) + "\""
|
|
422
|
+
| fromjson
|
|
423
|
+
| if type == "string" then . else null end
|
|
424
|
+
) catch null
|
|
425
|
+
end;
|
|
426
|
+
def js_token_re:
|
|
427
|
+
js_string_re + "|[A-Za-z_$][A-Za-z0-9_$]*|\\S";
|
|
428
|
+
def js_top_level_cmd:
|
|
429
|
+
# `.` is one object literal `{...}`. Walk its tokens; a string literal
|
|
430
|
+
# is one token, so text inside a string (even `, cmd: "..."`) never reads
|
|
431
|
+
# as a key. Return the value of a top-level `cmd` key (bare or quoted)
|
|
432
|
+
# whose value is a static string literal in any quote style, the last
|
|
433
|
+
# one winning as in JavaScript; "" when absent or not a static string.
|
|
434
|
+
[scan(js_token_re)] as $t
|
|
435
|
+
| reduce range(0; $t | length) as $i ({depth: 0, key: false, cmd: null};
|
|
436
|
+
$t[$i] as $tok
|
|
437
|
+
| if $tok == "{" or $tok == "[" or $tok == "(" then
|
|
438
|
+
.depth += 1 | .key = ($tok == "{" and .depth == 1)
|
|
439
|
+
elif $tok == "}" or $tok == "]" or $tok == ")" then
|
|
440
|
+
.depth -= 1 | .key = false
|
|
441
|
+
elif .depth == 1 and $tok == "," then
|
|
442
|
+
.key = true
|
|
443
|
+
elif .depth == 1 and .key then
|
|
444
|
+
.key = false
|
|
445
|
+
| if ($tok == "cmd" or ($tok | test("^[\"\u0027]") and (js_decode_string == "cmd")))
|
|
446
|
+
and $t[$i + 1] == ":"
|
|
447
|
+
then
|
|
448
|
+
($t[$i + 2] // "") as $v
|
|
449
|
+
| .cmd = (if ($v | test("^[\"\u0027`]")) then ($v | js_decode_string // "") else "" end)
|
|
450
|
+
else . end
|
|
451
|
+
else . end)
|
|
452
|
+
| .cmd // "";
|
|
453
|
+
def code_mode_exec_cmd:
|
|
454
|
+
# `.` is the source text right after one `tools.exec_command(` opener.
|
|
455
|
+
# Never errors and always yields exactly one string ("" when unread).
|
|
456
|
+
([capture("^\\s*(?<args>" + js_object_re + ")") | .args] | first // "") as $args
|
|
457
|
+
| if $args == "" then ""
|
|
458
|
+
else
|
|
459
|
+
(try ($args | fromjson | .cmd | if type == "string" then . else "" end) catch null)
|
|
460
|
+
// ($args | try js_top_level_cmd catch "")
|
|
461
|
+
| if type == "string" then . else "" end
|
|
462
|
+
end;
|
|
389
463
|
def codex_command:
|
|
464
|
+
# A generator: one value per tools.exec_command call in a code-mode exec,
|
|
465
|
+
# in source order, so the gate sees each command and the last one is the
|
|
466
|
+
# final action. An exec with no readable exec_command call (apply_patch,
|
|
467
|
+
# MCP, other tools.* calls) still yields "" so it counts as a work tool.
|
|
468
|
+
# It must never yield nothing: an empty stream here drops the whole tool
|
|
469
|
+
# event and the turn is judged idle.
|
|
390
470
|
if .name? == "exec" and ((.input? | type) == "string") then
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
| capture("tools\\.exec_command\\((?<args>\\{.*\\})\\);")
|
|
394
|
-
| .args
|
|
395
|
-
| try (fromjson | .cmd // "") catch javascript_object_cmd
|
|
396
|
-
) catch ""
|
|
471
|
+
([.input | splits("tools\\.exec_command\\(")] | .[1:] | map(code_mode_exec_cmd))
|
|
472
|
+
| if length == 0 then "" else .[] end
|
|
397
473
|
elif (.name? == "exec_command" or .name? == "Bash") then
|
|
398
474
|
if ((.input? | type) == "object") then
|
|
399
475
|
.input.cmd? // .input.command? // ""
|
|
@@ -452,6 +528,7 @@ exec 3>&2
|
|
|
452
528
|
$user_indexes[-1] as $user_index
|
|
453
529
|
| ([$user_indexes[] | select(($rows[.].entry | gate_feedback_user) | not)]
|
|
454
530
|
| if length > 0 then .[-1] else $user_indexes[0] end) as $genuine_index
|
|
531
|
+
| (if ($rows[$genuine_index].entry | codex_heartbeat_user) then "0-heartbeat" else "0-unreplied" end) as $unreplied
|
|
455
532
|
| [
|
|
456
533
|
range($genuine_index + 1; $rows | length) as $ri
|
|
457
534
|
| $rows[$ri].entry
|
|
@@ -554,10 +631,10 @@ exec 3>&2
|
|
|
554
631
|
) as $reply_required
|
|
555
632
|
| "1\t\($last_tool.id)\t\($reply_chars)\t\(if $reply_required then 1 else 0 end)"
|
|
556
633
|
elif $last_tool.runtime == "codex" then "stamp"
|
|
557
|
-
else (if $seg_reply_chars > 0 then "0-replied" else
|
|
634
|
+
else (if $seg_reply_chars > 0 then "0-replied" else $unreplied end)
|
|
558
635
|
end
|
|
559
636
|
elif $work_tool_count == 0 then "idle"
|
|
560
|
-
else (if $seg_reply_chars > 0 then "0-replied" else
|
|
637
|
+
else (if $seg_reply_chars > 0 then "0-replied" else $unreplied end)
|
|
561
638
|
end
|
|
562
639
|
end
|
|
563
640
|
' 2>/dev/null)"
|
|
@@ -574,6 +651,7 @@ exec 3>&2
|
|
|
574
651
|
# already visible, so the block message never demands a duplicate.
|
|
575
652
|
satisfied="$parsed"
|
|
576
653
|
replied=0
|
|
654
|
+
heartbeat=0
|
|
577
655
|
reply_tool_id=""
|
|
578
656
|
reply_chars=""
|
|
579
657
|
reply_required=""
|
|
@@ -584,14 +662,18 @@ exec 3>&2
|
|
|
584
662
|
;;
|
|
585
663
|
0-replied) satisfied=0; replied=1 ;;
|
|
586
664
|
0-unreplied) satisfied=0 ;;
|
|
665
|
+
0-heartbeat) satisfied=0; heartbeat=1 ;;
|
|
587
666
|
esac
|
|
588
667
|
case "$satisfied" in
|
|
589
668
|
0|1|stamp|idle) ;;
|
|
590
669
|
*) exit 0 ;;
|
|
591
670
|
esac
|
|
592
671
|
|
|
593
|
-
#
|
|
594
|
-
#
|
|
672
|
+
# The Stop payload (Claude, and Codex when it sends one) carries the final
|
|
673
|
+
# assistant message independently of the transcript writer. A present
|
|
674
|
+
# payload reply counts the same way for both runtimes; only the
|
|
675
|
+
# absent/invalid ambiguity handling below stays Claude-only.
|
|
676
|
+
# Use the stronger of the two sources: the transcript
|
|
595
677
|
# can already contain a reply while the payload is empty, and the payload can
|
|
596
678
|
# arrive before the transcript writer flushes. If neither source can prove a
|
|
597
679
|
# reply, the evidence is ambiguous rather than proof that no reply exists.
|
|
@@ -607,7 +689,7 @@ exec 3>&2
|
|
|
607
689
|
case "$payload_reply_chars" in
|
|
608
690
|
''|*[!0-9]*) reply_evidence_ambiguous=1 ;;
|
|
609
691
|
*)
|
|
610
|
-
if [ "$runtime" = "claude" ]; then
|
|
692
|
+
if [ "$runtime" = "claude" ] || [ "$runtime" = "codex" ]; then
|
|
611
693
|
if [ "$satisfied" = "1" ]; then
|
|
612
694
|
if [ "$payload_reply_chars" -gt "$reply_chars" ]; then
|
|
613
695
|
reply_chars="$payload_reply_chars"
|
|
@@ -754,6 +836,20 @@ exec 3>&2
|
|
|
754
836
|
exit 0
|
|
755
837
|
fi
|
|
756
838
|
|
|
839
|
+
# A Codex automation <heartbeat> turn may end with an intentionally empty
|
|
840
|
+
# answer, so it owes no reply and a re-prompt would only add noise on every
|
|
841
|
+
# wake-up. Record its work out of band, the same way as a replied turn.
|
|
842
|
+
if [ "$heartbeat" = 1 ] && [ "$runtime" = "codex" ]; then
|
|
843
|
+
(nohup hq core checkpoint \
|
|
844
|
+
--session-id "$session_id" \
|
|
845
|
+
--trigger stop-gate-auto \
|
|
846
|
+
--transcript "$transcript_path" \
|
|
847
|
+
--summary "automation heartbeat turn ended without a user-facing reply" \
|
|
848
|
+
>/dev/null 2>&1 3>&- &)
|
|
849
|
+
rm -f "$block_count_file" 2>/dev/null || true
|
|
850
|
+
exit 0
|
|
851
|
+
fi
|
|
852
|
+
|
|
757
853
|
# Loop guard for the missing-checkpoint demand below: cap consecutive blocks
|
|
758
854
|
# per session, then fail open (see the counter's comment above).
|
|
759
855
|
if [ "$block_count" -ge 3 ]; then
|
|
@@ -3070,7 +3070,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
3070
3070
|
}];
|
|
3071
3071
|
readonly subcommands: readonly [{
|
|
3072
3072
|
readonly name: "share";
|
|
3073
|
-
readonly description: "Share file paths. foo/ is a private folder (children stay creator-only); quote the shared-folder glob 'foo/*', or a one-folder wildcard such as 'clients/*/reports', so the shell passes it literally. Without --with: mint a share-session URL and open it in the browser. With --with: grant access directly to a person, group, or @all.";
|
|
3073
|
+
readonly description: "Share file paths. foo/ is a private folder (children stay creator-only); quote the shared-folder glob 'foo/*', or a one-folder wildcard such as 'clients/*/reports', so the shell passes it literally. Without --with: mint a share-session URL and open it in the browser. With --with: grant access directly to a person, group, or @all. A new person, group or email grant notifies the grantee (DM, in-app notice, email) unless --no-notify. An @all grant notifies every active member only with --notify; in a terminal it asks first and shows the member count, and without a terminal it sends no notifications.";
|
|
3074
3074
|
readonly aliases: readonly [];
|
|
3075
3075
|
readonly hidden: false;
|
|
3076
3076
|
readonly helpOption: true;
|
|
@@ -3107,6 +3107,14 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
3107
3107
|
readonly flags: "--no-open";
|
|
3108
3108
|
readonly description: "Print the share-session URL but do not launch the browser";
|
|
3109
3109
|
readonly hidden: false;
|
|
3110
|
+
}, {
|
|
3111
|
+
readonly flags: "--notify";
|
|
3112
|
+
readonly description: "With --with: send the share notification (DM, in-app notice, email). Required to notify members on an @all grant; in a terminal, @all asks first and shows how many members would be notified.";
|
|
3113
|
+
readonly hidden: false;
|
|
3114
|
+
}, {
|
|
3115
|
+
readonly flags: "--no-notify";
|
|
3116
|
+
readonly description: "With --with: grant access without notifying anyone. Person, group and email grants notify by default; @all grants never notify without --notify.";
|
|
3117
|
+
readonly hidden: false;
|
|
3110
3118
|
}, {
|
|
3111
3119
|
readonly flags: "--channel <name>";
|
|
3112
3120
|
readonly description: "Post the share record to this named channel instead of a DM";
|
|
@@ -19735,7 +19743,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
19735
19743
|
readonly subcommands: readonly [];
|
|
19736
19744
|
}, {
|
|
19737
19745
|
readonly name: "eb";
|
|
19738
|
-
readonly description: "Executive bot (EB): the main personal bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions. With no name, show which bot it is and how that was decided; with a name, make that personal bot the Executive bot (its
|
|
19746
|
+
readonly description: "Executive bot (EB): the main personal bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions. With no name, show which bot it is and how that was decided; with a name, make that personal bot the Executive bot and restart the running bots the change affects (the old and new Executive bot, each after its current reply), so the daily jobs move now";
|
|
19739
19747
|
readonly aliases: readonly [];
|
|
19740
19748
|
readonly hidden: false;
|
|
19741
19749
|
readonly helpOption: true;
|
|
@@ -19749,6 +19757,10 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
19749
19757
|
readonly description: "";
|
|
19750
19758
|
}];
|
|
19751
19759
|
readonly options: readonly [{
|
|
19760
|
+
readonly flags: "--no-restart";
|
|
19761
|
+
readonly description: "Only save the choice; the bots pick it up on their next start";
|
|
19762
|
+
readonly hidden: false;
|
|
19763
|
+
}, {
|
|
19752
19764
|
readonly flags: "--json";
|
|
19753
19765
|
readonly description: "Print machine-readable JSON";
|
|
19754
19766
|
readonly hidden: false;
|
|
@@ -3697,7 +3697,7 @@ export const COMMAND_CATALOG = [
|
|
|
3697
3697
|
"subcommands": [
|
|
3698
3698
|
{
|
|
3699
3699
|
"name": "share",
|
|
3700
|
-
"description": "Share file paths. foo/ is a private folder (children stay creator-only); quote the shared-folder glob 'foo/*', or a one-folder wildcard such as 'clients/*/reports', so the shell passes it literally. Without --with: mint a share-session URL and open it in the browser. With --with: grant access directly to a person, group, or @all.",
|
|
3700
|
+
"description": "Share file paths. foo/ is a private folder (children stay creator-only); quote the shared-folder glob 'foo/*', or a one-folder wildcard such as 'clients/*/reports', so the shell passes it literally. Without --with: mint a share-session URL and open it in the browser. With --with: grant access directly to a person, group, or @all. A new person, group or email grant notifies the grantee (DM, in-app notice, email) unless --no-notify. An @all grant notifies every active member only with --notify; in a terminal it asks first and shows the member count, and without a terminal it sends no notifications.",
|
|
3701
3701
|
"aliases": [],
|
|
3702
3702
|
"hidden": false,
|
|
3703
3703
|
"helpOption": true,
|
|
@@ -3743,6 +3743,16 @@ export const COMMAND_CATALOG = [
|
|
|
3743
3743
|
"description": "Print the share-session URL but do not launch the browser",
|
|
3744
3744
|
"hidden": false
|
|
3745
3745
|
},
|
|
3746
|
+
{
|
|
3747
|
+
"flags": "--notify",
|
|
3748
|
+
"description": "With --with: send the share notification (DM, in-app notice, email). Required to notify members on an @all grant; in a terminal, @all asks first and shows how many members would be notified.",
|
|
3749
|
+
"hidden": false
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
"flags": "--no-notify",
|
|
3753
|
+
"description": "With --with: grant access without notifying anyone. Person, group and email grants notify by default; @all grants never notify without --notify.",
|
|
3754
|
+
"hidden": false
|
|
3755
|
+
},
|
|
3746
3756
|
{
|
|
3747
3757
|
"flags": "--channel <name>",
|
|
3748
3758
|
"description": "Post the share record to this named channel instead of a DM",
|
|
@@ -24064,7 +24074,7 @@ export const COMMAND_CATALOG = [
|
|
|
24064
24074
|
},
|
|
24065
24075
|
{
|
|
24066
24076
|
"name": "eb",
|
|
24067
|
-
"description": "Executive bot (EB): the main personal bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions. With no name, show which bot it is and how that was decided; with a name, make that personal bot the Executive bot (its
|
|
24077
|
+
"description": "Executive bot (EB): the main personal bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions. With no name, show which bot it is and how that was decided; with a name, make that personal bot the Executive bot and restart the running bots the change affects (the old and new Executive bot, each after its current reply), so the daily jobs move now",
|
|
24068
24078
|
"aliases": [],
|
|
24069
24079
|
"hidden": false,
|
|
24070
24080
|
"helpOption": true,
|
|
@@ -24080,6 +24090,11 @@ export const COMMAND_CATALOG = [
|
|
|
24080
24090
|
}
|
|
24081
24091
|
],
|
|
24082
24092
|
"options": [
|
|
24093
|
+
{
|
|
24094
|
+
"flags": "--no-restart",
|
|
24095
|
+
"description": "Only save the choice; the bots pick it up on their next start",
|
|
24096
|
+
"hidden": false
|
|
24097
|
+
},
|
|
24083
24098
|
{
|
|
24084
24099
|
"flags": "--json",
|
|
24085
24100
|
"description": "Print machine-readable JSON",
|
package/dist/commands/bot.d.ts
CHANGED
|
@@ -261,6 +261,12 @@ export declare function runBotCompanies(nameArg: string, opts: {
|
|
|
261
261
|
export declare function runBotWorkers(opts: {
|
|
262
262
|
json?: boolean;
|
|
263
263
|
}): Promise<void>;
|
|
264
|
+
export declare const botEbSeams: {
|
|
265
|
+
busyWaitMs: number;
|
|
266
|
+
pollMs: number;
|
|
267
|
+
now: () => number;
|
|
268
|
+
sleep: (ms: number) => Promise<void>;
|
|
269
|
+
};
|
|
264
270
|
/** The `legacy` object in `hq bot status --json` for a bot still on its legacy runner. */
|
|
265
271
|
export declare function legacyStatusJson(state: LegacyMoveState): Record<string, unknown>;
|
|
266
272
|
/** The `fleet move:` lines of `hq bot status` for a bot still on its legacy runner. */
|
package/dist/commands/bot.js
CHANGED
|
@@ -366,14 +366,15 @@ async function fleetGatewayComesUp(agentUid, waitMs, stepMs = 500) {
|
|
|
366
366
|
await new Promise((r) => setTimeout(r, stepMs));
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
function runFleetRuntimeControl(name, config, action,
|
|
369
|
+
function runFleetRuntimeControl(name, config, action, output) {
|
|
370
|
+
const json = output === true;
|
|
370
371
|
if ((action === "install" || action === "start" || action === "restart") && config.fleetAuthPending === true) {
|
|
371
372
|
const authCommand = fleetAuthCommand(name, config);
|
|
372
373
|
if (json)
|
|
373
374
|
console.log(JSON.stringify({ ok: false, name, running: false, state: "stopped", needsSignIn: true, authCommand }, null, 2));
|
|
374
375
|
else
|
|
375
376
|
throw Object.assign(new Error(`Sign this bot in first: ${authCommand}`), { expected: true });
|
|
376
|
-
return;
|
|
377
|
+
return { ok: false, needsSignIn: true, authCommand };
|
|
377
378
|
}
|
|
378
379
|
if (action === "install" || action === "start" || action === "restart") {
|
|
379
380
|
refreshFleetLocalInstructions(config.agentUid, fleetBotSystemPrompt(name, config));
|
|
@@ -383,12 +384,15 @@ function runFleetRuntimeControl(name, config, action, json) {
|
|
|
383
384
|
const result = controlFleetLocalBot(config.agentUid, installService ? "install" : action);
|
|
384
385
|
if (installService && result.ok)
|
|
385
386
|
patchBotConfig(botDir(name), { fleetServiceInstallPending: false, enabled: true });
|
|
387
|
+
if (output === "silent")
|
|
388
|
+
return result;
|
|
386
389
|
if (json) {
|
|
387
390
|
console.log(JSON.stringify({ name, runtime: HQ_FLEET_RUNTIME_ENGINE_ID, ...result }, null, 2));
|
|
388
|
-
return;
|
|
391
|
+
return result;
|
|
389
392
|
}
|
|
390
393
|
const summary = typeof result.summary === "string" ? result.summary : `${action} completed`;
|
|
391
394
|
console.log(chalk.green(`${name}: ${summary}`));
|
|
395
|
+
return result;
|
|
392
396
|
}
|
|
393
397
|
/** Bot-identity token supplier: per-bot creds + per-bot token cache dir. */
|
|
394
398
|
export function botTokenSupplier(dir) {
|
|
@@ -1922,11 +1926,71 @@ async function runBotList(opts) {
|
|
|
1922
1926
|
console.log(`${chalk.bold(r.name.padEnd(16))} ${r.agentUid} ${r.runtime.padEnd(6)} ${humanOnline(r).padEnd(8)} ${r.processAlive ? chalk.green(`pid ${r.pid}`) : chalk.gray(r.state)}${chalk.dim(` ${r.kind === "company" ? `company bot: ${r.companies.join(", ") || "no company"}` : "personal"}`)}${r.executive ? chalk.cyan(" (executive)") : ""}${r.daemonInstalled ? chalk.dim(" launchd") : ""}${r.daemonNodeMissing ? chalk.red(` node missing (hq bot start ${r.name})`) : ""}${r.workerId ? chalk.dim(` worker ${r.workerId}${r.companySlug ? ` (${r.companySlug})` : ""}`) : ""}`);
|
|
1923
1927
|
}
|
|
1924
1928
|
}
|
|
1929
|
+
export const botEbSeams = {
|
|
1930
|
+
busyWaitMs: 120_000,
|
|
1931
|
+
pollMs: 2_000,
|
|
1932
|
+
now: () => Date.now(),
|
|
1933
|
+
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
1934
|
+
};
|
|
1935
|
+
async function restartForExecutiveChange(previous, next) {
|
|
1936
|
+
const report = { restarted: [], skipped: [], lines: [] };
|
|
1937
|
+
const targets = [{ name: next, why: "so it sets up the daily Executive jobs" }];
|
|
1938
|
+
if (previous && previous !== next)
|
|
1939
|
+
targets.push({ name: previous, why: "so it stops running the daily Executive jobs" });
|
|
1940
|
+
for (const { name, why } of targets) {
|
|
1941
|
+
const skip = (reason) => {
|
|
1942
|
+
report.skipped.push({ name, reason });
|
|
1943
|
+
report.lines.push(`Left ${name} alone: ${reason}.`);
|
|
1944
|
+
};
|
|
1945
|
+
const dir = botDir(name);
|
|
1946
|
+
const config = readBotConfig(dir);
|
|
1947
|
+
if (!config) {
|
|
1948
|
+
skip("it is no longer set up on this computer");
|
|
1949
|
+
continue;
|
|
1950
|
+
}
|
|
1951
|
+
const listed = readBotListedProcess(dir, config);
|
|
1952
|
+
if (!listed.running) {
|
|
1953
|
+
skip("it is not running, and it picks up the change when it starts");
|
|
1954
|
+
continue;
|
|
1955
|
+
}
|
|
1956
|
+
if (listed.pid !== null && selfStopProbe(listed.pid)) {
|
|
1957
|
+
skip(`this command is running inside one of its own replies; restart it afterwards with hq bot restart ${name}`);
|
|
1958
|
+
continue;
|
|
1959
|
+
}
|
|
1960
|
+
const startedAt = botEbSeams.now();
|
|
1961
|
+
let waited = false;
|
|
1962
|
+
while (readInflightTurns(dir).length > 0 && botEbSeams.now() - startedAt < botEbSeams.busyWaitMs) {
|
|
1963
|
+
waited = true;
|
|
1964
|
+
await botEbSeams.sleep(botEbSeams.pollMs);
|
|
1965
|
+
}
|
|
1966
|
+
const stillAnswering = readInflightTurns(dir).length > 0;
|
|
1967
|
+
try {
|
|
1968
|
+
const result = await restartBot(name, { output: "silent" });
|
|
1969
|
+
if (!result.ok) {
|
|
1970
|
+
skip(`the restart did not go through${result.detail ? ` (${result.detail})` : ""}; try hq bot restart ${name}`);
|
|
1971
|
+
continue;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
catch (err) {
|
|
1975
|
+
skip(`the restart did not go through (${err instanceof Error ? err.message : String(err)}); try hq bot restart ${name}`);
|
|
1976
|
+
continue;
|
|
1977
|
+
}
|
|
1978
|
+
report.restarted.push(name);
|
|
1979
|
+
const minutes = Math.round(botEbSeams.busyWaitMs / 60_000);
|
|
1980
|
+
if (stillAnswering)
|
|
1981
|
+
report.lines.push(`${name} was still answering after ${minutes} minute${minutes === 1 ? "" : "s"}; restarted it anyway ${why}.`);
|
|
1982
|
+
else if (waited)
|
|
1983
|
+
report.lines.push(`Restarted ${name} after it finished its reply, ${why}.`);
|
|
1984
|
+
else
|
|
1985
|
+
report.lines.push(`Restarted ${name} ${why}.`);
|
|
1986
|
+
}
|
|
1987
|
+
return report;
|
|
1988
|
+
}
|
|
1925
1989
|
/**
|
|
1926
1990
|
* `hq bot eb [name]`: show or set the Executive bot (lib/bot/executive.ts).
|
|
1927
|
-
* Setting writes ~/.hq/executive.json
|
|
1928
|
-
*
|
|
1929
|
-
* removes its copies).
|
|
1991
|
+
* Setting writes ~/.hq/executive.json, then restarts the running bots the
|
|
1992
|
+
* change affects (the new Executive bot registers the daily jobs, the old one
|
|
1993
|
+
* removes its copies) unless --no-restart.
|
|
1930
1994
|
*/
|
|
1931
1995
|
async function runBotEb(nameArg, opts) {
|
|
1932
1996
|
if (nameArg === undefined) {
|
|
@@ -1938,9 +2002,11 @@ async function runBotEb(nameArg, opts) {
|
|
|
1938
2002
|
console.log(describeExecutiveBotSource(current));
|
|
1939
2003
|
return;
|
|
1940
2004
|
}
|
|
2005
|
+
const previous = resolveExecutiveBot()?.name ?? null;
|
|
1941
2006
|
const result = setExecutiveBot(nameArg);
|
|
2007
|
+
const restart = result.changed && opts.restart !== false ? await restartForExecutiveChange(previous, result.name) : null;
|
|
1942
2008
|
if (opts.json) {
|
|
1943
|
-
console.log(JSON.stringify(result, null, 2));
|
|
2009
|
+
console.log(JSON.stringify({ ...result, restarted: restart?.restarted ?? [], skipped: restart?.skipped ?? [] }, null, 2));
|
|
1944
2010
|
return;
|
|
1945
2011
|
}
|
|
1946
2012
|
if (!result.changed) {
|
|
@@ -1948,7 +2014,12 @@ async function runBotEb(nameArg, opts) {
|
|
|
1948
2014
|
return;
|
|
1949
2015
|
}
|
|
1950
2016
|
console.log(`${result.name} is the Executive bot now: it builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions.`);
|
|
1951
|
-
|
|
2017
|
+
if (!restart) {
|
|
2018
|
+
console.log(chalk.dim(`Running bots pick this up on their next start: restart them with hq bot restart <name>.`));
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
for (const line of restart.lines)
|
|
2022
|
+
console.log(line);
|
|
1952
2023
|
}
|
|
1953
2024
|
async function runBotStatus(nameArg, opts) {
|
|
1954
2025
|
const { name, dir, config } = requireBot(nameArg);
|
|
@@ -2853,12 +2924,15 @@ export async function updateFleetRuntimeBot(nameArg, opts = {}) {
|
|
|
2853
2924
|
}
|
|
2854
2925
|
/** `hq bot restart <name>`: stop, then start (launchd when installed). */
|
|
2855
2926
|
export async function runBotRestart(nameArg, opts = {}) {
|
|
2927
|
+
await restartBot(nameArg, opts);
|
|
2928
|
+
}
|
|
2929
|
+
async function restartBot(nameArg, opts = {}) {
|
|
2856
2930
|
const b = requireBot(nameArg);
|
|
2857
2931
|
if (isFleetRuntimeBot(b.config)) {
|
|
2858
2932
|
refuseHeldFleetBot(b.dir);
|
|
2859
2933
|
const adopted = await adoptFleetRuntimeProfile(b.name, b.dir, b.config);
|
|
2860
|
-
runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "restart", opts.json === true || opts.output === "json");
|
|
2861
|
-
return;
|
|
2934
|
+
const result = runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "restart", opts.output === "silent" ? "silent" : opts.json === true || opts.output === "json");
|
|
2935
|
+
return { ok: result.ok === true, detail: typeof result.summary === "string" && result.summary ? result.summary : null };
|
|
2862
2936
|
}
|
|
2863
2937
|
const running = readBotStatus(b.dir);
|
|
2864
2938
|
if (running && isPidAlive(running.pid) && selfStopProbe(running.pid)) {
|
|
@@ -2867,7 +2941,8 @@ export async function runBotRestart(nameArg, opts = {}) {
|
|
|
2867
2941
|
throw new Error(`${b.name} cannot restart itself from inside one of its own turns: the stop would end this turn before the start ran. Run \`hq bot restart ${b.name}\` from outside the bot, or \`hq bot stop ${b.name}\` to stop it after this turn.`);
|
|
2868
2942
|
}
|
|
2869
2943
|
await stopBot(b.name, b.dir, b.config, "silent");
|
|
2870
|
-
await startBot(b.name, b.dir, b.config, opts.output ?? (opts.json ? "json" : "text"));
|
|
2944
|
+
const started = await startBot(b.name, b.dir, b.config, opts.output ?? (opts.json ? "json" : "text"));
|
|
2945
|
+
return { ok: started.running, detail: started.how };
|
|
2871
2946
|
}
|
|
2872
2947
|
export async function runBotAuth(nameArg, opts) {
|
|
2873
2948
|
const b = requireBot(nameArg);
|
|
@@ -3702,7 +3777,8 @@ export function registerBotCommand(program) {
|
|
|
3702
3777
|
.action((name, opts) => wrap(() => runBotSwitchAccount(name, opts))());
|
|
3703
3778
|
bot
|
|
3704
3779
|
.command("eb [name]")
|
|
3705
|
-
.description("Executive bot (EB): the main personal bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions. With no name, show which bot it is and how that was decided; with a name, make that personal bot the Executive bot (its
|
|
3780
|
+
.description("Executive bot (EB): the main personal bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions. With no name, show which bot it is and how that was decided; with a name, make that personal bot the Executive bot and restart the running bots the change affects (the old and new Executive bot, each after its current reply), so the daily jobs move now")
|
|
3781
|
+
.option("--no-restart", "Only save the choice; the bots pick it up on their next start")
|
|
3706
3782
|
.option("--json", "Print machine-readable JSON")
|
|
3707
3783
|
.action((name, opts) => wrap(() => runBotEb(name, opts))());
|
|
3708
3784
|
bot
|