@indigoai-us/hq-cli 5.345.223 → 5.345.225
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 +66 -0
- package/assets/bot-workers/setup/context/quick-reference.md +2 -2
- package/assets/mesh-daemon/README.md +11 -12
- package/dist/command-catalog.generated.d.ts +78 -4
- package/dist/command-catalog.generated.js +94 -4
- package/dist/commands/cloud-provision.d.ts +4 -1
- package/dist/commands/cloud-provision.js +7 -3
- package/dist/commands/cloud-retire.js +1 -1
- package/dist/commands/core-delegate-w1b.js +3 -1
- package/dist/commands/core-delegate.d.ts +5 -0
- package/dist/commands/core-dm-bind-native.d.ts +5 -1
- package/dist/commands/core-dm-bind-native.js +4 -0
- package/dist/commands/core-job-notify-native.d.ts +5 -1
- package/dist/commands/core-job-notify-native.js +8 -2
- package/dist/commands/core-jobs-native.d.ts +27 -1
- package/dist/commands/core-jobs-native.js +49 -28
- package/dist/commands/core-pipeline-conductor-native.js +7 -7
- package/dist/commands/core-pipeline-driver-native.js +5 -5
- package/dist/commands/core-refresh-vault-access-native.d.ts +5 -0
- package/dist/commands/core-refresh-vault-access-native.js +3 -1
- package/dist/commands/core-work-mesh-bind-trusted-native.js +1 -1
- package/dist/commands/daemon.d.ts +2 -0
- package/dist/commands/daemon.js +67 -1
- package/dist/commands/lanes-hold.d.ts +2 -27
- package/dist/commands/lanes-hold.js +3 -75
- package/dist/commands/lanes-loop.js +1 -1
- package/dist/commands/lanes-session-start.js +2 -2
- package/dist/commands/mesh.d.ts +12 -0
- package/dist/commands/mesh.js +13 -4
- package/dist/commands/monitor.js +1 -1
- package/dist/commands/packs.js +1 -1
- package/dist/commands/whoami.d.ts +10 -17
- package/dist/commands/whoami.js +7 -79
- package/dist/data/command-states.json +13 -0
- package/dist/index.js +1 -1
- package/dist/lib/daemon/catalog.d.ts +8 -5
- package/dist/lib/daemon/catalog.js +13 -7
- package/dist/lib/daemon/config.d.ts +5 -0
- package/dist/lib/daemon/config.js +6 -0
- package/dist/lib/daemon/lanes-monitor-state.d.ts +55 -0
- package/dist/lib/daemon/lanes-monitor-state.js +129 -0
- package/dist/lib/daemon/lanes-reconcile-loader.d.ts +7 -0
- package/dist/lib/daemon/lanes-reconcile-loader.js +13 -0
- package/dist/lib/daemon/merge-sections.d.ts +165 -0
- package/dist/lib/daemon/merge-sections.js +556 -0
- package/dist/lib/daemon/ops/policy.d.ts +1 -1
- package/dist/lib/daemon/ops/policy.js +1 -1
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +0 -6
- package/dist/lib/daemon/run.js +73 -1
- package/dist/lib/daemon/selfcheck.js +2 -2
- package/dist/lib/daemon/server.d.ts +2 -4
- package/dist/lib/daemon/server.js +5 -48
- package/dist/lib/daemon/state-file.d.ts +74 -4
- package/dist/lib/daemon/state-file.js +159 -19
- package/dist/lib/daemon/supervisor.d.ts +1 -1
- package/dist/lib/daemon/updater.d.ts +2 -6
- package/dist/lib/daemon/updater.js +4 -11
- package/dist/lib/daemon/whoami-cache.d.ts +96 -0
- package/dist/lib/daemon/whoami-cache.js +244 -0
- package/dist/lib/hook-engine/coverage.d.ts +2 -0
- package/dist/lib/hook-engine/coverage.js +71 -0
- package/dist/lib/hook-engine/native-precompact-compatibility.json +449 -0
- package/dist/lib/hook-engine/reconcile.js +14 -8
- package/dist/lib/install/hook-target.d.ts +13 -3
- package/dist/lib/install/hook-target.js +14 -11
- package/dist/lib/lanes/envelope-repair-dispatch.js +1 -1
- package/dist/lib/lanes/monitor.d.ts +2 -0
- package/dist/lib/lanes/monitor.js +2 -1
- package/dist/lib/lanes/registry-flag.d.ts +6 -0
- package/dist/lib/lanes/registry-flag.js +3 -2
- package/dist/lib/lanes/repo-merge-hold.d.ts +39 -0
- package/dist/lib/lanes/repo-merge-hold.js +90 -0
- package/dist/lib/lanes/watcher-main.js +3 -3
- package/dist/lib/mesh/live/daemon/doctor.js +1 -1
- package/dist/lib/mesh/live/daemon/install.js +2 -2
- package/dist/lib/windows/install-followup.js +1 -1
- package/dist/utils/client-health-contract.d.ts +1 -0
- package/dist/utils/client-health-contract.js +5 -0
- package/dist/utils/client-health.d.ts +2 -0
- package/dist/utils/client-health.js +40 -0
- package/dist/utils/cognito-session.d.ts +2 -14
- package/dist/utils/cognito-session.js +2 -40
- package/dist/utils/daemon-cli-version.d.ts +13 -0
- package/dist/utils/daemon-cli-version.js +47 -0
- package/dist/utils/duplicate-command-usage.js +1 -1
- package/dist/utils/machine-token-cache.d.ts +21 -0
- package/dist/utils/machine-token-cache.js +49 -0
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/whoami-identity.d.ts +54 -0
- package/dist/utils/whoami-identity.js +108 -0
- package/package.json +7 -7
- package/dist/lib/daemon/ops/memory.d.ts +0 -18
- package/dist/lib/daemon/ops/memory.js +0 -65
- package/dist/lib/daemon/ops/mesh.d.ts +0 -38
- package/dist/lib/daemon/ops/mesh.js +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,72 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.345.225] — 2026-11-17
|
|
6
|
+
- The native agent-browser presence check stays silent while the daemon owns the machine checks, so a missing agent-browser is shown once by the machine-check notice instead of at every session start (and twice at the first).
|
|
7
|
+
- `hq install --global` and `hq reindex` register master-hook for the Claude Code user-scope hooks on a root the hq daemon serves, instead of the hqd shim, so tool calls in projects outside HQ get every PreToolUse hook master-hook runs. An existing shim registration is moved back on the next reindex.
|
|
8
|
+
- `hq cloud retire company --yes` and provision cleanup send the company slug as `confirmName` on `DELETE /entity/{uid}`, matching hq-pro's typed confirmation. `--yes` was skipping only the local prompt, so retire and the suffixed-slug cleanup both failed with `COMPANY_DELETE_CONFIRMATION_REQUIRED`.
|
|
9
|
+
- `hq install --global` and `hq reindex` register the Codex hook adapter on a root the hq daemon serves, instead of the hqd shim, so Codex tool calls get every PreToolUse hook master-hook runs. An existing shim registration is moved back to the adapter on the next reindex.
|
|
10
|
+
- Answer Codex PostToolUse natively for the policy gate, the screenshot counter and conduct-link delivery, as the hq-core v16.0.47 Codex adapter ran them; inputs the port does not model are refused instead of handed to bash.
|
|
11
|
+
- Keep heredoc data out of shell command rules while preserving checks on surrounding commands and unquoted expansions.
|
|
12
|
+
- The daemon no longer starts processes it does not need: the 15-second lane reconcile runs inside the daemon instead of starting `hq runners reconcile`, the hqd socket ops nothing called (`session.get`, `policy.index`, `memory.get`, `memory.put`, `mesh.presence`, `shutdown`) are removed and answer `unknown_op`, and CLI commands that ran `hq whoami` for the signed-in identity read the daemon's cached answer first, running `hq whoami` only when no daemon has one.
|
|
13
|
+
- The daemon's state file (`hq-state.json`) now carries two more sections for the native merge check: `merge_holds` (every repository merge hold with its company's `lanes.repo-merge-hold` flag) and `merge_approvals` (per session, the conduct decision queue, the session's company and whether `lanes.review-before-merge` applies, with the lane review records). Both are rebuilt every 15 seconds and expire after 60; a hold file `hq lanes hold` would refuse, an unreadable flag or an unreadable link folder leaves a section out, so the check refuses merges rather than allowing them.
|
|
14
|
+
- The native merge-state reader accepts a session the daemon writes with no conduct link when its queue is absent or unreadable, so a senior lane on no link gets its review gate instead of a "merge authority is unavailable" refusal.
|
|
15
|
+
- `hq daemon service` children, including the resident Work Mesh service, no longer run the slow install follow-up on their first start after an upgrade.
|
|
16
|
+
- Report the hq daemon's running CLI version in client health, so support can see machines whose daemon still runs a version from before the sync engine pin.
|
|
17
|
+
- The native hook engine can now carry text that only the person sees, separate from the context it adds for the model. On an allowed UserPromptSubmit it goes out as `systemMessage` on Claude Code and Codex; Grok Build and the Fleet runtime have no such channel, so the text is dropped there with a line on stderr and never becomes model context. No hook uses it yet.
|
|
18
|
+
- host-canary: the canary no longer copies, reads, hashes or stats any sign-in file on any platform. On Windows each host is pointed at its existing sign-in through its own variable (CLAUDE_CONFIG_DIR, CODEX_HOME or CODEX_API_KEY, GROK_AUTH_PATH or XAI_API_KEY) instead of a copy in the disposable home. It refuses a Codex folder that holds a hooks.json and any sign-in folder that overlaps the disposable base. On macOS, when a sign-in is a link or a chain of links, every folder on the chain is now write-denied by the sandbox.
|
|
19
|
+
- host-canary: on Windows, links in the snapshot whose target is a directory (for example `.codex/claude`) are re-created as directory links after `tar -xf`. bsdtar 3.8.9 on windows-latest extracted them as file links, realpath through them failed with EPERM, and the snapshot check refused every host.
|
|
20
|
+
- `hq-hook run --host` no longer fails open when a hook overflows its stack. The evaluation worker has a 64 MiB stack, and a stack overflow on a PreToolUse event is answered with a block (the same "fails closed" refusal a panic gets) where the process used to die and the host ran the tool call. On macOS and Linux this also covers other memory faults (SIGSEGV, SIGBUS); on Windows it covers the stack overflow. Not covered: a kill by the system (out of memory, SIGKILL).
|
|
21
|
+
- `hq core jobs reconcile` now reads PATH by the host's own rules when it writes a scheduled-job unit. On Windows it used the POSIX rules (`:` separator, leading `/`), so the unit's PATH line was empty and `hq` was never found. Linux and macOS output is unchanged.
|
|
22
|
+
- hq-hook claims the `.claude/settings.json` Stop entry `hq-monitor-session-hook.sh wait` by its exact command, because the Codex, Grok and fleet adapters skip it (`asyncRewake: true`). The native Stop on those hosts refuses that command when it is registered without the mark.
|
|
23
|
+
- On HQ Fleet hosts (fleet-local and agents-v2), `hq-hook run` sends an event to the host's shell adapter when the HQ root's registry lists a claimed hook that adapter skips, through its fixed list, `HQ_AGENTS_V2_HOOK_SKIP`, `HQ_FLEET_LOCAL_HOOK_SKIP` or the fleet-local helper-session rules, so a skipped hook never runs natively.
|
|
24
|
+
- hq-hook: the conduct-link UserPromptSubmit hook joins a session to its conduct link in-process instead of running `hq runners link join`, so no program starts on that hot path. It reads `lanes.session-links` from the local override, then the daemon state file, and joins unless the flag is explicitly off, as the CLI does (US-048 M4a).
|
|
25
|
+
- The hook engine can read `monitor.enabled` from the daemon state file for the person or company scope, so the native monitor drain needs no `hq` process to learn whether monitors are on. A missing, stale or other-scope value reads as unknown.
|
|
26
|
+
- The native hook engine now delivers queued `hq monitor` events itself on PreToolUse and UserPromptSubmit (the `hq-monitor-session-hook` drain rows), with no `hq` process: it reads `monitor.enabled` from the daemon state file and drains the session drop box in process, in the same file format as `hq monitor drain`. A missing or stale flag leaves the events queued.
|
|
27
|
+
- `scripts/machine-checks-side-by-side.mjs` resets the checks' show-once and cooldown stamp folders between the hook run and the doctor run. Both runs now start from the same stamps, so a check that writes a stamp no longer reads `different`.
|
|
28
|
+
- `scripts/machine-checks-e2e.mjs` installs the engine at the release-stable path and registers it as Claude Code's native SessionStart before it runs the daemon batch. The batch now runs only when a native SessionStart is registered.
|
|
29
|
+
- The native policy-enforcement gate recognises the next hq-core gate script (hq-core-staging #2018, SHA-256 `1bc4df8e`), which fixes a missed `delivery-forbid-regex` and a falsely missing `delivery-require-regex` on large or multi-line message bodies. Without this, a root that receives that gate has it left to bash by the bridge, and on the new core every tool call is refused until the engine knows the script.
|
|
30
|
+
- Register the native policy frontmatter validator on PreToolUse so policy Write, Edit, and MultiEdit calls retain trigger and lifecycle validation. Preserve the existing process-free validator and refuse unsupported policy patch shapes.
|
|
31
|
+
- Native PreToolUse refusals now end with the same "Blocked by hook <id>." line the shell dispatcher prints, naming the old hook (or the rule) that refused.
|
|
32
|
+
- The native hook engine now gives the senior-session lane Monitor reminder at UserPromptSubmit (`core/hooks/UserPromptSubmit/45-lanes-senior-monitor.sh`) without starting any program: the hq daemon writes each senior session's Monitor coverage into a new `lanes_monitor` section of its state file every 30 seconds, and the hook reads it. A missing or stale answer gives no reminder (the Stop gate still enforces coverage). The shared port calls `hq runners monitor-check` at SessionStart.
|
|
33
|
+
- The native hook engine now runs `auto-session-project` at UserPromptSubmit without starting any program: for a Work Mesh bound session it makes the company project folder, writes `prd.json` from the project cache or the session board, leaves the session-title marker, and returns the `<auto-session-project>` context, with parity tests against the released shell hook.
|
|
34
|
+
- The native hook engine now records the deep-plan session marker and adds the deep-plan routing context at UserPromptSubmit (`route-deep-plan-to-skill`), with parity tests against the released shell hook.
|
|
35
|
+
- Keep PreCompact on the legacy dispatcher when its installed files, registry, or session-reader generation cannot be reproduced by the native engine, using one shared compatibility policy for reindex and native checks.
|
|
36
|
+
- Register the three PreToolUse readiness evaluators (`merge-gates-ready`, `live-command-flags-ready`, `git-identity-authority-ready`) in the native hook core. Each refuses natively when it cannot read its merge-state, company flag or repository-identity input, and the command rules now follow those authorities instead of refusing every merge, secret reveal and Git mutation.
|
|
37
|
+
- Run the PreToolUse, released gate compatibility, and SessionStart setup regression suites in hook pull-request and release CI.
|
|
38
|
+
- Resolve standalone literal shell assignments before logical joins while retaining refusals for conditional or unresolved values.
|
|
39
|
+
- Keep variables declared read-only without a value uncertain when checking later shell assignments.
|
|
40
|
+
- Replay harness: neutralise recorder redaction markers before both cores run, copy the recorded root's workspace/ and personal/ folder layout, run Codex events' old side through the Codex adapter, report each side's reason class, and add a --sessions mode that replays a session's events in order. The recorder no longer redacts a `date -u +FORMAT` argument as a `-u user:pass` credential.
|
|
41
|
+
- hq-cli's own callers now run `hq runners ...` instead of the deprecated `hq lanes ...` alias: the native Stop, PostToolUse, prompt and SessionStart hooks, the native merge-hold guard, the pipeline conductor and driver, and the internal runner, watcher, monitor and session-start spawns. The `hq lanes` alias still works.
|
|
42
|
+
- The native repo merge-hold guard now blocks the merge when the `hq` it runs has no `hq runners hold check` command (exit 1 with `error: unknown command 'runners'`, `'hold'` or `'check'`), and says to update hq to the version core requires. Other check failures still allow the command with a notice, as before.
|
|
43
|
+
- The native SessionStart lanes hook now needs hq 5.345.210 or later (the first release with `hq runners`). An older hq on PATH takes the existing "too old" path and prints nothing.
|
|
44
|
+
- Allow metadata listings of the local HQ state folder while preserving protection of its owner-managed root list and refusing unresolved paths.
|
|
45
|
+
- The native company scope guard now reads a shell function's `$1`, `$2`, ... as the literal words its call sites pass, so `R() { cmd "$1"; }; R 25` is checked with `25` instead of being refused as an unknown value. A parameter stays unknown and refused when any call passes a computed, globbed or brace-expanded word, when the body uses `shift`, `set`, `eval` or `source`, when the function is exported, when the command may change directory after the definition (`cd`, `pushd`, `popd`, `chdir`, `source`, `.` or `eval`, or a `cd` in any function body), or when the function's name appears anywhere other than its definition and its literal call sites.
|
|
46
|
+
- Add `hq daemon pause sync-core` and `hq daemon resume sync-core`. A paused engine stays stopped, the heartbeat watchdog does not restart it, and the pause survives daemon restarts. `hq daemon status` shows when it was paused and by whom.
|
|
47
|
+
- Scheduled jobs now start with `hq core job run` instead of `core/scripts/hq-job-run.sh`. `hq core jobs reconcile` writes a systemd unit that runs the absolute `hq` found on the service PATH, or `/usr/bin/env hq` when none is found. Units written by older versions keep working until the next reconcile rewrites them, because `hq-job-run.sh` is still shipped.
|
|
48
|
+
- Base all 10 Claude Code and 8 Codex hook event fixtures on recorded payload shapes, with variants for subagents, MCP, compact startup, nullable transcripts and Codex's namespaced spawn tool, which now reads as Agent.
|
|
49
|
+
- Validate fixture fields, types, enumerated values, and main key order against the recording in Python and Rust contract checks.
|
|
50
|
+
- hq-hook: the native UserPromptSubmit now answers `30-ensure-hq-cli.sh` without installing anything, as Corey decided ("Never install from a hook"). It starts no process. It shows the daemon's ensure-hq-cli finding once, through the same shown-once ledger as the SessionStart machine-check notice, and leaves the restore to the daemon's schedule, or to `hq doctor` where there is no daemon. The hook is now claimed for UserPromptSubmit.
|
|
51
|
+
- hq-hook: the native UserPromptSubmit now also answers `31-ensure-hq-desktop.sh` without updating anything: it starts no process or update worker, shows the daemon's ensure-hq-desktop finding once, and honours the script's kill switches, `HQ_UPDATER_DISABLED` included. The update is left to the daemon's schedule. The hook is now claimed for UserPromptSubmit.
|
|
52
|
+
- hq-hook: the native SessionStart now answers the `desktop-memory-leak-check` and `check-stale-model-pin` machine checks. On Claude Code it skips them when the daemon owns them, as master-hook's machine-check helper does, so the daemon's finding is shown once through the machine-check notice; otherwise, and always on Codex and Grok Build, it runs an in-process port of each script. Both ids are now claimed for SessionStart.
|
|
53
|
+
- `hq daemon` now runs Work Mesh Live as its own `mesh` service and adds `hq daemon doctor` (spool, held, dead-letter and MQTT health). The `hq mesh daemon` verbs, the mesh thread verbs (`hq mesh start`, `progress`, `blocked`, `done`, `note`) and `hq bot set-model` are marked retiring in favour of `hq daemon ...`, `hq mesh session ...` and `hq bot set --model`. They still run exactly as before.
|
|
54
|
+
- Mark `hq auth status` and `hq packages update` retiring in the command states table and the function manifest (use `hq whoami --check` or `hq whoami --json`, and `hq packs update --registry`). They still run exactly as before. The `hq whoami --check` and `hq packs update --registry` help text no longer names the older commands.
|
|
55
|
+
- The native hook engine now answers block-on-active-run on PreToolUse (Bash, Edit, Write) and claims it in its coverage list: it reads the run registry, walks its own process ancestry and checks run liveness without starting a program, with parity tests against the hq-core-staging master-hook, block-on-active-run.sh and repo-run-registry.sh.
|
|
56
|
+
- The native hook engine now answers block-company-repo-creation on PreToolUse (Bash) and claims it in its coverage list, reading commands with the native shell lexer, with parity tests against the hq-core-staging master-hook and block-company-repo-creation.sh.
|
|
57
|
+
- The native hook engine now answers block-core-writes-bash on PreToolUse (Bash) and claims it in its coverage list, reading commands with the native shell lexer and hook-lib's always-writable path masking and sudo option rewrite, with parity tests against the hq-core-staging master-hook and block-core-writes-bash.sh.
|
|
58
|
+
- hq-hook's port of the legacy block-core-writes-bash guard (the one merged-write-guard-shadow records) reads commands with the shared shell lexer. A command that names a protected path and that the pinned hook library's reader would decide differently, or that the lexer does not model (a NUL byte, a locale-dependent space next to a heredoc), is refused natively instead of recorded.
|
|
59
|
+
- The native hook engine now answers the numbered-policy-sibling folder hook on PreToolUse (Edit, Write, MultiEdit) and claims it in its coverage list, with byte-for-byte parity tests against the hq-core-staging beta.109 script.
|
|
60
|
+
- The native hook engine now answers block-policy-writes-bash on PreToolUse (Bash) and claims it in its coverage list, reading commands with the native shell lexer, with parity tests against the hq-core-staging master-hook and block-policy-writes-bash.sh.
|
|
61
|
+
- The native hook engine now answers protect-core on PreToolUse (Edit, Write) and claims it in its coverage list, with parity tests against the hq-core-staging master-hook and protect-core.sh; where the script fails open on a missing yq or jq, the native check decides as with both installed.
|
|
62
|
+
- hq-hook has a native port of the hq-core-staging shell lexer `hq_shell_simple_commands` (default, raw and nl modes, with the flat reading for heredocs and open substitutions), checked byte for byte against the staging function. It starts no program and refuses NUL bytes, non-UTF-8 text and locale-dependent spaces.
|
|
63
|
+
- The native enforce-vault-write-access port now follows the current hq-core-staging guard (4c03a27c5): perl, ruby, gsed and gawk in-place edits, $'...' words and sed or awk scripts cut at ; | or & are checked as bash checks them. It is not claimed in the native coverage list, and an install whose arithmetic library differs from the pinned one hands Bash calls back to bash.
|
|
64
|
+
- The native policy injector now does the shell injector's SessionEnd work, removing the ending session's policy session index files and sweeping stale ones, and claims `inject-policy-on-trigger` for SessionEnd.
|
|
65
|
+
- The native policy injector now answers as the current release's shell injector on SessionStart and PostToolUse (timeout-journal metadata rewrite, awk diagnostics, text-tool evaluation on PostToolUse, gate-off rows) and claims `inject-policy-on-trigger` for both events.
|
|
66
|
+
- The native hook engine now appends the session journal's auto-capture line on Claude Code PostToolUse for Agent, AskUserQuestion, WebFetch and WebSearch calls, as `journal-autocapture.sh` did, without starting a program, and claims that hook in its PostToolUse cover list.
|
|
67
|
+
- The native hook engine now redacts credential values in Read and Bash tool output on Claude Code PostToolUse, as `redact-credential-output.sh` did, and claims that hook in its PostToolUse cover list.
|
|
68
|
+
- A redaction that fails or runs out of time blocks the call, and a block from another PostToolUse check keeps the redacted output.
|
|
69
|
+
- Let the Windows host canary resolve npm's native-executable shim, used by Claude Code 2.1.325, directly without a shell. Keep arbitrary batch commands refused.
|
|
70
|
+
|
|
5
71
|
## [5.345.223] — 2026-11-17
|
|
6
72
|
- Refresh person-scoped flags for agent callers even when the CLI runs in company context, so recorder overrides take effect and can be removed.
|
|
7
73
|
- hq-hook: the daemon state file reader now refuses what the CLI's own reader refuses. A file whose stated maximum age is under one second is no longer read as fresh for a whole second. A time at second 60 is not a time. A file is not trusted when a folder above the daemon folder can be written by group or others, or belongs to another user. In `HQ_FLAG_DAEMON_STATE_FILE`, U+FEFF around `false` now turns the state file off, and U+0085 around `true` no longer turns it on.
|
|
@@ -121,11 +121,11 @@ garden-scout, garden-auditor, garden-curator
|
|
|
121
121
|
|
|
122
122
|
## CLI: `hq mesh` (Work Mesh Live)
|
|
123
123
|
|
|
124
|
-
Presence and per-turn activity are automatic via hooks + `hq mesh
|
|
124
|
+
Presence and per-turn activity are automatic via hooks + `hq daemon` (its `mesh` service drains the spool). Manual verbs only: `task-status`, `blocked`, `note`. See `core/knowledge/public/hq-core/work-mesh-live.md` and `core/skills/work-mesh/`.
|
|
125
125
|
|
|
126
126
|
| Command | Use |
|
|
127
127
|
|---------|-----|
|
|
128
|
-
| `hq
|
|
128
|
+
| `hq daemon install\|status\|doctor` | Resident presence + spool flush (the daemon's `mesh` service) |
|
|
129
129
|
| `hq mesh context reconcile` (`--observation-file`/`--observation-json`) | Resolve company/project (no `--session`) |
|
|
130
130
|
| `hq mesh context organize\|correct\|untracked` (`--session` / sessionId arg) | Bind, correct, or mark untracked |
|
|
131
131
|
| `hq mesh context default get\|set\|clear` | Device default company |
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
# HQ mesh daemon service templates
|
|
1
|
+
# HQ mesh daemon service templates (older standalone units)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
`hq daemon` runs Work Mesh Live as its `mesh` service, so a machine needs no
|
|
4
|
+
unit of its own for it: install the daemon with `hq daemon install` and check
|
|
5
|
+
it with `hq daemon status` and `hq daemon doctor`.
|
|
6
|
+
|
|
7
|
+
These templates are the older standalone Work Mesh units, still rendered by
|
|
8
|
+
the retiring per-service installer for one release. `hq daemon install` takes
|
|
9
|
+
an existing one over.
|
|
5
10
|
|
|
6
11
|
| Platform | Unit | Label / name |
|
|
7
12
|
|----------|------|----------------|
|
|
@@ -9,15 +14,9 @@ and `node` binaries written into the unit.
|
|
|
9
14
|
| Linux (user) | systemd user unit | `hq-mesh-daemon.service` |
|
|
10
15
|
| Linux (agent box) | systemd system unit | `hq-mesh-daemon.service` as `ec2-user` |
|
|
11
16
|
|
|
12
|
-
## Agent
|
|
13
|
-
|
|
14
|
-
When no user session bus exists (typical EC2 agent boxes):
|
|
17
|
+
## Agent boxes
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
sudo cp ~/.hq/work-mesh/daemon/hq-mesh-daemon.service /etc/systemd/system/
|
|
19
|
-
sudo systemctl daemon-reload
|
|
20
|
-
sudo systemctl enable --now hq-mesh-daemon.service
|
|
21
|
-
```
|
|
19
|
+
Boxes run `hq daemon` as a system unit (see `hq daemon install --help`); its
|
|
20
|
+
`mesh` service replaces the standalone `hq-mesh-daemon.service` system unit.
|
|
22
21
|
|
|
23
22
|
Logs: `~/.hq/work-mesh/daemon/log` (rotated at 5MB by the daemon process).
|
|
@@ -541,7 +541,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
541
541
|
readonly hidden: false;
|
|
542
542
|
}, {
|
|
543
543
|
readonly flags: "--registry";
|
|
544
|
-
readonly description: "Update installed registry packages instead
|
|
544
|
+
readonly description: "Update installed registry packages instead of content packs ([name] is the package slug)";
|
|
545
545
|
readonly hidden: false;
|
|
546
546
|
}];
|
|
547
547
|
readonly subcommands: readonly [];
|
|
@@ -676,7 +676,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
676
676
|
readonly hidden: false;
|
|
677
677
|
}, {
|
|
678
678
|
readonly flags: "--registry";
|
|
679
|
-
readonly description: "Update installed registry packages instead
|
|
679
|
+
readonly description: "Update installed registry packages instead of content packs ([name] is the package slug)";
|
|
680
680
|
readonly hidden: false;
|
|
681
681
|
}];
|
|
682
682
|
readonly subcommands: readonly [];
|
|
@@ -1474,7 +1474,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
1474
1474
|
readonly hidden: false;
|
|
1475
1475
|
}, {
|
|
1476
1476
|
readonly flags: "--check";
|
|
1477
|
-
readonly description: "Exit 1 when there is no usable session,
|
|
1477
|
+
readonly description: "Exit 1 when there is no usable session, so a script can test the exit status";
|
|
1478
1478
|
readonly hidden: false;
|
|
1479
1479
|
}];
|
|
1480
1480
|
readonly subcommands: readonly [];
|
|
@@ -18996,7 +18996,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
18996
18996
|
readonly subcommands: readonly [];
|
|
18997
18997
|
}, {
|
|
18998
18998
|
readonly name: "call";
|
|
18999
|
-
readonly description: "Send one request to hqd (policy.check, journal.append,
|
|
18999
|
+
readonly description: "Send one request to hqd (policy.check, journal.append, mcp.call, …) and print the result as JSON";
|
|
19000
19000
|
readonly aliases: readonly [];
|
|
19001
19001
|
readonly hidden: false;
|
|
19002
19002
|
readonly helpOption: true;
|
|
@@ -19036,6 +19036,22 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
19036
19036
|
readonly hidden: false;
|
|
19037
19037
|
}];
|
|
19038
19038
|
readonly subcommands: readonly [];
|
|
19039
|
+
}, {
|
|
19040
|
+
readonly name: "doctor";
|
|
19041
|
+
readonly description: "Report Work Mesh health: running, MQTT, spool, held, dead-letter, outbox and flush (replaces the separate mesh daemon doctor)";
|
|
19042
|
+
readonly aliases: readonly [];
|
|
19043
|
+
readonly hidden: false;
|
|
19044
|
+
readonly helpOption: true;
|
|
19045
|
+
readonly helpCommand: false;
|
|
19046
|
+
readonly usage: "[options]";
|
|
19047
|
+
readonly helpText: readonly [];
|
|
19048
|
+
readonly arguments: readonly [];
|
|
19049
|
+
readonly options: readonly [{
|
|
19050
|
+
readonly flags: "--json";
|
|
19051
|
+
readonly description: "Print machine-readable JSON";
|
|
19052
|
+
readonly hidden: false;
|
|
19053
|
+
}];
|
|
19054
|
+
readonly subcommands: readonly [];
|
|
19039
19055
|
}, {
|
|
19040
19056
|
readonly name: "sync";
|
|
19041
19057
|
readonly description: "Inspect and control the daemon's company sync runner";
|
|
@@ -19387,6 +19403,48 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
19387
19403
|
}];
|
|
19388
19404
|
readonly options: readonly [];
|
|
19389
19405
|
readonly subcommands: readonly [];
|
|
19406
|
+
}, {
|
|
19407
|
+
readonly name: "pause";
|
|
19408
|
+
readonly description: "Stop sync-core and keep it stopped (watchdog and daemon restarts included) until resumed";
|
|
19409
|
+
readonly aliases: readonly [];
|
|
19410
|
+
readonly hidden: false;
|
|
19411
|
+
readonly helpOption: true;
|
|
19412
|
+
readonly helpCommand: false;
|
|
19413
|
+
readonly usage: "[options] <service>";
|
|
19414
|
+
readonly helpText: readonly [];
|
|
19415
|
+
readonly arguments: readonly [{
|
|
19416
|
+
readonly name: "service";
|
|
19417
|
+
readonly required: true;
|
|
19418
|
+
readonly variadic: false;
|
|
19419
|
+
readonly description: "";
|
|
19420
|
+
}];
|
|
19421
|
+
readonly options: readonly [{
|
|
19422
|
+
readonly flags: "--json";
|
|
19423
|
+
readonly description: "Print machine-readable JSON";
|
|
19424
|
+
readonly hidden: false;
|
|
19425
|
+
}];
|
|
19426
|
+
readonly subcommands: readonly [];
|
|
19427
|
+
}, {
|
|
19428
|
+
readonly name: "resume";
|
|
19429
|
+
readonly description: "Start a paused sync-core again";
|
|
19430
|
+
readonly aliases: readonly [];
|
|
19431
|
+
readonly hidden: false;
|
|
19432
|
+
readonly helpOption: true;
|
|
19433
|
+
readonly helpCommand: false;
|
|
19434
|
+
readonly usage: "[options] <service>";
|
|
19435
|
+
readonly helpText: readonly [];
|
|
19436
|
+
readonly arguments: readonly [{
|
|
19437
|
+
readonly name: "service";
|
|
19438
|
+
readonly required: true;
|
|
19439
|
+
readonly variadic: false;
|
|
19440
|
+
readonly description: "";
|
|
19441
|
+
}];
|
|
19442
|
+
readonly options: readonly [{
|
|
19443
|
+
readonly flags: "--json";
|
|
19444
|
+
readonly description: "Print machine-readable JSON";
|
|
19445
|
+
readonly hidden: false;
|
|
19446
|
+
}];
|
|
19447
|
+
readonly subcommands: readonly [];
|
|
19390
19448
|
}, {
|
|
19391
19449
|
readonly name: "pin-hq-cloud";
|
|
19392
19450
|
readonly description: "Pin hq-cloud to an exact version, or clear the pin";
|
|
@@ -19498,6 +19556,22 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
19498
19556
|
readonly arguments: readonly [];
|
|
19499
19557
|
readonly options: readonly [];
|
|
19500
19558
|
readonly subcommands: readonly [{
|
|
19559
|
+
readonly name: "mesh";
|
|
19560
|
+
readonly description: "Work Mesh Live: spool drain, MQTT presence and the live Board cache (the daemon's mesh service)";
|
|
19561
|
+
readonly aliases: readonly [];
|
|
19562
|
+
readonly hidden: false;
|
|
19563
|
+
readonly helpOption: true;
|
|
19564
|
+
readonly helpCommand: false;
|
|
19565
|
+
readonly usage: "[options]";
|
|
19566
|
+
readonly helpText: readonly [];
|
|
19567
|
+
readonly arguments: readonly [];
|
|
19568
|
+
readonly options: readonly [{
|
|
19569
|
+
readonly flags: "--hq-root <path>";
|
|
19570
|
+
readonly description: "HQ folder the service works against";
|
|
19571
|
+
readonly hidden: false;
|
|
19572
|
+
}];
|
|
19573
|
+
readonly subcommands: readonly [];
|
|
19574
|
+
}, {
|
|
19501
19575
|
readonly name: "self-update";
|
|
19502
19576
|
readonly description: "Update the hq CLI, Claude, Codex and Grok, then restart the daemon onto a new CLI";
|
|
19503
19577
|
readonly aliases: readonly [];
|
|
@@ -628,7 +628,7 @@ export const COMMAND_CATALOG = [
|
|
|
628
628
|
},
|
|
629
629
|
{
|
|
630
630
|
"flags": "--registry",
|
|
631
|
-
"description": "Update installed registry packages instead
|
|
631
|
+
"description": "Update installed registry packages instead of content packs ([name] is the package slug)",
|
|
632
632
|
"hidden": false
|
|
633
633
|
}
|
|
634
634
|
],
|
|
@@ -799,7 +799,7 @@ export const COMMAND_CATALOG = [
|
|
|
799
799
|
},
|
|
800
800
|
{
|
|
801
801
|
"flags": "--registry",
|
|
802
|
-
"description": "Update installed registry packages instead
|
|
802
|
+
"description": "Update installed registry packages instead of content packs ([name] is the package slug)",
|
|
803
803
|
"hidden": false
|
|
804
804
|
}
|
|
805
805
|
],
|
|
@@ -1772,7 +1772,7 @@ export const COMMAND_CATALOG = [
|
|
|
1772
1772
|
},
|
|
1773
1773
|
{
|
|
1774
1774
|
"flags": "--check",
|
|
1775
|
-
"description": "Exit 1 when there is no usable session,
|
|
1775
|
+
"description": "Exit 1 when there is no usable session, so a script can test the exit status",
|
|
1776
1776
|
"hidden": false
|
|
1777
1777
|
}
|
|
1778
1778
|
],
|
|
@@ -23188,7 +23188,7 @@ export const COMMAND_CATALOG = [
|
|
|
23188
23188
|
},
|
|
23189
23189
|
{
|
|
23190
23190
|
"name": "call",
|
|
23191
|
-
"description": "Send one request to hqd (policy.check, journal.append,
|
|
23191
|
+
"description": "Send one request to hqd (policy.check, journal.append, mcp.call, …) and print the result as JSON",
|
|
23192
23192
|
"aliases": [],
|
|
23193
23193
|
"hidden": false,
|
|
23194
23194
|
"helpOption": true,
|
|
@@ -23237,6 +23237,25 @@ export const COMMAND_CATALOG = [
|
|
|
23237
23237
|
],
|
|
23238
23238
|
"subcommands": []
|
|
23239
23239
|
},
|
|
23240
|
+
{
|
|
23241
|
+
"name": "doctor",
|
|
23242
|
+
"description": "Report Work Mesh health: running, MQTT, spool, held, dead-letter, outbox and flush (replaces the separate mesh daemon doctor)",
|
|
23243
|
+
"aliases": [],
|
|
23244
|
+
"hidden": false,
|
|
23245
|
+
"helpOption": true,
|
|
23246
|
+
"helpCommand": false,
|
|
23247
|
+
"usage": "[options]",
|
|
23248
|
+
"helpText": [],
|
|
23249
|
+
"arguments": [],
|
|
23250
|
+
"options": [
|
|
23251
|
+
{
|
|
23252
|
+
"flags": "--json",
|
|
23253
|
+
"description": "Print machine-readable JSON",
|
|
23254
|
+
"hidden": false
|
|
23255
|
+
}
|
|
23256
|
+
],
|
|
23257
|
+
"subcommands": []
|
|
23258
|
+
},
|
|
23240
23259
|
{
|
|
23241
23260
|
"name": "sync",
|
|
23242
23261
|
"description": "Inspect and control the daemon's company sync runner",
|
|
@@ -23659,6 +23678,58 @@ export const COMMAND_CATALOG = [
|
|
|
23659
23678
|
"options": [],
|
|
23660
23679
|
"subcommands": []
|
|
23661
23680
|
},
|
|
23681
|
+
{
|
|
23682
|
+
"name": "pause",
|
|
23683
|
+
"description": "Stop sync-core and keep it stopped (watchdog and daemon restarts included) until resumed",
|
|
23684
|
+
"aliases": [],
|
|
23685
|
+
"hidden": false,
|
|
23686
|
+
"helpOption": true,
|
|
23687
|
+
"helpCommand": false,
|
|
23688
|
+
"usage": "[options] <service>",
|
|
23689
|
+
"helpText": [],
|
|
23690
|
+
"arguments": [
|
|
23691
|
+
{
|
|
23692
|
+
"name": "service",
|
|
23693
|
+
"required": true,
|
|
23694
|
+
"variadic": false,
|
|
23695
|
+
"description": ""
|
|
23696
|
+
}
|
|
23697
|
+
],
|
|
23698
|
+
"options": [
|
|
23699
|
+
{
|
|
23700
|
+
"flags": "--json",
|
|
23701
|
+
"description": "Print machine-readable JSON",
|
|
23702
|
+
"hidden": false
|
|
23703
|
+
}
|
|
23704
|
+
],
|
|
23705
|
+
"subcommands": []
|
|
23706
|
+
},
|
|
23707
|
+
{
|
|
23708
|
+
"name": "resume",
|
|
23709
|
+
"description": "Start a paused sync-core again",
|
|
23710
|
+
"aliases": [],
|
|
23711
|
+
"hidden": false,
|
|
23712
|
+
"helpOption": true,
|
|
23713
|
+
"helpCommand": false,
|
|
23714
|
+
"usage": "[options] <service>",
|
|
23715
|
+
"helpText": [],
|
|
23716
|
+
"arguments": [
|
|
23717
|
+
{
|
|
23718
|
+
"name": "service",
|
|
23719
|
+
"required": true,
|
|
23720
|
+
"variadic": false,
|
|
23721
|
+
"description": ""
|
|
23722
|
+
}
|
|
23723
|
+
],
|
|
23724
|
+
"options": [
|
|
23725
|
+
{
|
|
23726
|
+
"flags": "--json",
|
|
23727
|
+
"description": "Print machine-readable JSON",
|
|
23728
|
+
"hidden": false
|
|
23729
|
+
}
|
|
23730
|
+
],
|
|
23731
|
+
"subcommands": []
|
|
23732
|
+
},
|
|
23662
23733
|
{
|
|
23663
23734
|
"name": "pin-hq-cloud",
|
|
23664
23735
|
"description": "Pin hq-cloud to an exact version, or clear the pin",
|
|
@@ -23789,6 +23860,25 @@ export const COMMAND_CATALOG = [
|
|
|
23789
23860
|
"arguments": [],
|
|
23790
23861
|
"options": [],
|
|
23791
23862
|
"subcommands": [
|
|
23863
|
+
{
|
|
23864
|
+
"name": "mesh",
|
|
23865
|
+
"description": "Work Mesh Live: spool drain, MQTT presence and the live Board cache (the daemon's mesh service)",
|
|
23866
|
+
"aliases": [],
|
|
23867
|
+
"hidden": false,
|
|
23868
|
+
"helpOption": true,
|
|
23869
|
+
"helpCommand": false,
|
|
23870
|
+
"usage": "[options]",
|
|
23871
|
+
"helpText": [],
|
|
23872
|
+
"arguments": [],
|
|
23873
|
+
"options": [
|
|
23874
|
+
{
|
|
23875
|
+
"flags": "--hq-root <path>",
|
|
23876
|
+
"description": "HQ folder the service works against",
|
|
23877
|
+
"hidden": false
|
|
23878
|
+
}
|
|
23879
|
+
],
|
|
23880
|
+
"subcommands": []
|
|
23881
|
+
},
|
|
23792
23882
|
{
|
|
23793
23883
|
"name": "self-update",
|
|
23794
23884
|
"description": "Update the hq CLI, Claude, Codex and Grok, then restart the daemon onto a new CLI",
|
|
@@ -153,8 +153,11 @@ export interface VaultClient {
|
|
|
153
153
|
* Soft-tombstone a company (`DELETE /entity/{uid}`). Owner-only. Leaves the
|
|
154
154
|
* row, S3 bucket, KMS key, and memberships intact. Idempotent on an already
|
|
155
155
|
* deleted company. Used by `hq cloud retire company`.
|
|
156
|
+
*
|
|
157
|
+
* hq-pro requires a JSON body `{ confirmName }` matching the company name
|
|
158
|
+
* or slug (`COMPANY_DELETE_CONFIRMATION_REQUIRED` otherwise).
|
|
156
159
|
*/
|
|
157
|
-
softDeleteCompany(uid: string): Promise<{
|
|
160
|
+
softDeleteCompany(uid: string, confirmName: string): Promise<{
|
|
158
161
|
deleted: true;
|
|
159
162
|
uid: string;
|
|
160
163
|
}>;
|
|
@@ -413,9 +413,13 @@ export function createDefaultVaultClient(apiUrl, accessToken) {
|
|
|
413
413
|
return data.entity;
|
|
414
414
|
});
|
|
415
415
|
},
|
|
416
|
-
async softDeleteCompany(uid) {
|
|
416
|
+
async softDeleteCompany(uid, confirmName) {
|
|
417
417
|
const url = `${apiUrl.replace(/\/$/, "")}/entity/${encodeURIComponent(uid)}`;
|
|
418
|
-
return withVaultRequest(url, {
|
|
418
|
+
return withVaultRequest(url, {
|
|
419
|
+
method: "DELETE",
|
|
420
|
+
headers,
|
|
421
|
+
body: JSON.stringify({ confirmName }),
|
|
422
|
+
}, async (res) => {
|
|
419
423
|
if (res.status === 403) {
|
|
420
424
|
const body = await safeBody(res);
|
|
421
425
|
throw new ProvisionError(2, `Refusing to retire '${uid}': only the company owner can soft-tombstone it. ${body}`);
|
|
@@ -628,7 +632,7 @@ export async function provisionCompany(options) {
|
|
|
628
632
|
let retired = false;
|
|
629
633
|
if (createdEntity) {
|
|
630
634
|
try {
|
|
631
|
-
await vaultClient.softDeleteCompany(entity.uid);
|
|
635
|
+
await vaultClient.softDeleteCompany(entity.uid, entity.slug || options.slug);
|
|
632
636
|
retired = true;
|
|
633
637
|
log(`retired vault entity uid=${entity.uid} — assigned slug ${assigned} differs from requested ${options.slug}`);
|
|
634
638
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Native implementations of the second Wave 1 delegate command family. */
|
|
2
|
+
import { daemonWhoamiOutput } from "../lib/daemon/whoami-cache.js";
|
|
2
3
|
import { createHash, randomInt } from "node:crypto";
|
|
3
4
|
import * as fs from "node:fs";
|
|
4
5
|
import * as os from "node:os";
|
|
@@ -292,7 +293,8 @@ function runBundle(args, context, onMalformedWhoami) {
|
|
|
292
293
|
const projectRelative = `companies/${company}/projects/${project}`;
|
|
293
294
|
const brainstormPath = path.join(projectDir, "brainstorm.md");
|
|
294
295
|
const brainstormRelative = `${projectRelative}/brainstorm.md`;
|
|
295
|
-
const
|
|
296
|
+
const cachedWho = (context.daemonWhoami ?? daemonWhoamiOutput)(true);
|
|
297
|
+
const who = cachedWho !== null ? { code: 0, stdout: cachedWho } : subprocess("hq", ["whoami", "--json"], context.cwd, { stdout: "capture" });
|
|
296
298
|
if (who.code !== 0)
|
|
297
299
|
return fail("bundle", "could not read sender identity; update hq-cli if --json is unsupported");
|
|
298
300
|
let identity;
|
|
@@ -6,6 +6,11 @@ export declare const CORE_NATIVE_DELEGATE_FLAG = "core-native-delegate";
|
|
|
6
6
|
export type DelegateContext = {
|
|
7
7
|
cwd: string;
|
|
8
8
|
root?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The daemon's cached `hq whoami` output (json or plain), or null to run
|
|
11
|
+
* `hq whoami` (hq-core-rust US-036). Default: src/lib/daemon/whoami-cache.ts.
|
|
12
|
+
*/
|
|
13
|
+
daemonWhoami?: (json: boolean) => string | null;
|
|
9
14
|
atomicWriteFileSystem?: DelegateAtomicWriteFileSystem;
|
|
10
15
|
bundleFileSystem?: DelegateBundleFileSystem;
|
|
11
16
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
/** Native implementation of core/scripts/hq-dm-bind.sh. */
|
|
2
1
|
import * as fs from "node:fs";
|
|
3
2
|
import type { Command } from "commander";
|
|
4
3
|
import { type UtilityOutput } from "./core-native-utilities.js";
|
|
5
4
|
export declare const DM_BIND_ASSET = "core/scripts/hq-dm-bind.sh";
|
|
6
5
|
export declare const DM_BIND_HELP = "# hq-dm-bind.sh \u2014 bind the current session to one HQ DM channel, post\n# structured updates to it, and listen for replies (feedback / requests).\n#\n# Usage:\n# core/scripts/hq-dm-bind.sh bind <channel> # bind + set the read cursor to \"now\"\n# core/scripts/hq-dm-bind.sh status # show the binding and cursor\n# core/scripts/hq-dm-bind.sh post --title <t> [--state <s>] [--line <l>]... [--next <l>]... [--ask <l>]... [--to <name>]... [--topic <t>] [--under <id>] [--new-thread]\n# core/scripts/hq-dm-bind.sh post --title <t> - < body.md # body from stdin (already structured)\n# core/scripts/hq-dm-bind.sh threads # list the channel's recent top-level threads (id, replies, author, text)\n# core/scripts/hq-dm-bind.sh roster # print the channel members a post will @-mention\n# core/scripts/hq-dm-bind.sh poll # print new messages since the cursor, advance it\n# core/scripts/hq-dm-bind.sh listen [--interval 60] [--timeout 1800]\n# # block until a new message arrives (or timeout)\n# core/scripts/hq-dm-bind.sh unbind\n#\n# The binding lives in the session's meta.yaml (`dm_channel`) via hq-session.sh;\n# the cursor is `workspace/sessions/<sid>/dm-bind.cursor` (the last seen sort\n# key from `hq dm channel --json`). `listen` is meant to run detached\n# (Bash run_in_background): it exits 0 and prints the new messages the moment\n# one lands, exits 3 on timeout with nothing new.\n#\n# Every post opens with an @-mention of every other member of the channel, so\n# the update reaches people (HQ mentions are structured: the `hq` CLI resolves\n# the `@\"Display Name\"` tokens against the roster and sends the real mention\n# list; an unresolvable name fails the post rather than posting text that looks\n# addressed but is not). The CLI rewrites a resolved `@\"Display Name\"` token to\n# `@Display Name`, so the room never shows the quotes.\n#\n# Posts thread by topic. The first post on a topic (`--topic`, else the title)\n# is a top-level root; every later post on the same topic in this session goes\n# out as a reply under it. `--under <id>` replies under an existing thread that\n# someone else (or an earlier session) started \u2014 a top-level post is only for a\n# subject the channel has no thread for yet. `--new-thread` starts a fresh root. The topic \u2192 root\n# map is `workspace/sessions/<sid>/dm-bind.threads`.\n#\n# A post ALWAYS mentions someone. `--to <name>` (repeatable) narrows the line to\n# the named members, for a reply to one person; without it the line names every\n# other human member (bots are left out unless named with --to, because a tagged\n# bot wakes and replies). There is no way to post unmentioned: an update nobody is\n# notified about does not get read. `post` refuses when the roster cannot be\n# read rather than sending a silent update.\n#\n# Post format (kept deliberately plain \u2014 see .claude/skills/dm-bind/SKILL.md):\n# @\"Ada Lovelace\" @\"Grace Hopper\"\n#\n# <title> \u2014 <state>\n#\n# \u2022 line\n# \u2022 line\n#\n# Next: line\n# Need from you: line\n";
|
|
7
6
|
export type DmBindDeps = {
|
|
7
|
+
/**
|
|
8
|
+
* The daemon's cached `hq whoami` output (json or plain), or null to run
|
|
9
|
+
* `hq whoami` (hq-core-rust US-036). Default: src/lib/daemon/whoami-cache.ts.
|
|
10
|
+
*/
|
|
11
|
+
daemonWhoami?: (json: boolean) => string | null;
|
|
8
12
|
root: string;
|
|
9
13
|
cwd: string;
|
|
10
14
|
env: NodeJS.ProcessEnv;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Native implementation of core/scripts/hq-dm-bind.sh. */
|
|
2
|
+
import { daemonWhoamiOutput } from "../lib/daemon/whoami-cache.js";
|
|
2
3
|
import * as fs from "node:fs";
|
|
3
4
|
import * as os from "node:os";
|
|
4
5
|
import * as path from "node:path";
|
|
@@ -177,6 +178,9 @@ function usesCliAuth(d) {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
function whoamiText(d, json = false) {
|
|
181
|
+
const cached = (d.daemonWhoami ?? ((asJson) => daemonWhoamiOutput(asJson, d.env)))(json);
|
|
182
|
+
if (cached !== null)
|
|
183
|
+
return cached;
|
|
180
184
|
const result = d.runHq(json ? ["whoami", "--json"] : ["whoami"], { ...d.env, HQ_ROOT: d.root });
|
|
181
185
|
return result.code === 0 ? result.stdout : "";
|
|
182
186
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Native TypeScript port of hq-job-notify.sh. */
|
|
2
1
|
import { Command } from "commander";
|
|
3
2
|
type Environment = Record<string, string | undefined>;
|
|
4
3
|
export type JobNotifyProcessResult = {
|
|
@@ -12,6 +11,11 @@ export type JobNotifyRunOptions = {
|
|
|
12
11
|
logPath?: string;
|
|
13
12
|
};
|
|
14
13
|
export type JobNotifyDependencies = {
|
|
14
|
+
/**
|
|
15
|
+
* The daemon's cached `hq whoami` output (json or plain), or null to run
|
|
16
|
+
* `hq whoami` (hq-core-rust US-036). Default: src/lib/daemon/whoami-cache.ts.
|
|
17
|
+
*/
|
|
18
|
+
daemonWhoami?: (json: boolean) => string | null;
|
|
15
19
|
env: Environment;
|
|
16
20
|
cwd: string;
|
|
17
21
|
now: () => Date;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Native TypeScript port of hq-job-notify.sh. */
|
|
2
|
+
import { daemonWhoamiOutput } from "../lib/daemon/whoami-cache.js";
|
|
1
3
|
import * as fs from "node:fs";
|
|
2
4
|
import * as os from "node:os";
|
|
3
5
|
import * as path from "node:path";
|
|
@@ -205,12 +207,16 @@ const COGNITO_SUB = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
|
|
|
205
207
|
* to the signed-in identity's email when `hq whoami --json` reports the same
|
|
206
208
|
* subject, directly or as the human an Outpost session acts for.
|
|
207
209
|
*/
|
|
210
|
+
function cachedWhoami(deps, json) {
|
|
211
|
+
return (deps.daemonWhoami ?? ((asJson) => daemonWhoamiOutput(asJson, deps.env)))(json);
|
|
212
|
+
}
|
|
208
213
|
function resolveCognitoOwner(owner, deps) {
|
|
209
214
|
if (!deps.commandExists("hq"))
|
|
210
215
|
return "";
|
|
211
216
|
let parsed;
|
|
212
217
|
try {
|
|
213
|
-
const raw =
|
|
218
|
+
const raw = cachedWhoami(deps, true)
|
|
219
|
+
?? deps.run("hq", ["whoami", "--json"], { cwd: deps.cwd, env: deps.env, captureStdout: true }).stdout;
|
|
214
220
|
const value = JSON.parse(raw);
|
|
215
221
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
216
222
|
return "";
|
|
@@ -285,7 +291,7 @@ export function runJobNotify(argv, options = {}) {
|
|
|
285
291
|
if (!owner || owner === "null") {
|
|
286
292
|
owner = "";
|
|
287
293
|
if (deps.commandExists("hq")) {
|
|
288
|
-
owner = emailFromWhoami(deps.run("hq", ["whoami"], {
|
|
294
|
+
owner = emailFromWhoami(cachedWhoami(deps, false) ?? deps.run("hq", ["whoami"], {
|
|
289
295
|
cwd: deps.cwd, env: deps.env, captureStdout: true,
|
|
290
296
|
}).stdout);
|
|
291
297
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Native TypeScript ports for the Wave 4a scheduled-jobs scaffold tools. */
|
|
2
1
|
import { Command } from "commander";
|
|
3
2
|
export { detectHostTimezone, runScheduleParse, type ScheduleParseWriters } from "./core-jobs-schedule.js";
|
|
4
3
|
export declare function validateJobs(args: string[]): number;
|
|
@@ -9,6 +8,11 @@ type ReconcileCommandResult = {
|
|
|
9
8
|
};
|
|
10
9
|
export type ReconcileRunner = (command: string, args: string[]) => ReconcileCommandResult;
|
|
11
10
|
export type ReconcileOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* The daemon's cached `hq whoami` output (json or plain), or null to run
|
|
13
|
+
* `hq whoami` (hq-core-rust US-036). Default: src/lib/daemon/whoami-cache.ts.
|
|
14
|
+
*/
|
|
15
|
+
daemonWhoami?: (json: boolean) => string | null;
|
|
12
16
|
schedulerRunner?: ReconcileRunner;
|
|
13
17
|
commandRunner?: ReconcileRunner;
|
|
14
18
|
identityFileReader?: (file: string) => string | undefined;
|
|
@@ -23,6 +27,28 @@ export type ReconcileOptions = {
|
|
|
23
27
|
* exists, point systemctl at it. Caller-provided values are kept.
|
|
24
28
|
*/
|
|
25
29
|
export declare function withUserBusEnvironment(env: NodeJS.ProcessEnv, uid: number | undefined, runtimeBase?: string, exists?: (file: string) => boolean): NodeJS.ProcessEnv;
|
|
30
|
+
/**
|
|
31
|
+
* How a PATH value is separated and which of its entries are absolute. The
|
|
32
|
+
* host's own rules by default: `:` and a leading `/` on POSIX, `;` and a drive
|
|
33
|
+
* or UNC root on Windows. Read with the POSIX rules, a Windows PATH has no
|
|
34
|
+
* entry left, so the service PATH was empty there and no `hq` was ever found.
|
|
35
|
+
*/
|
|
36
|
+
export type ServicePathRules = {
|
|
37
|
+
delimiter: string;
|
|
38
|
+
isAbsolute: (entry: string) => boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* One `hq` lookup for the service PATH and the unit's ExecStart. ExecStart
|
|
42
|
+
* uses the PATH entry as found (`hq`), not its realpath: mise and Volta
|
|
43
|
+
* install `hq` as a symlink to one multi-call shim that dispatches on argv[0],
|
|
44
|
+
* so exec'ing the symlink target would run the shim as itself instead of as
|
|
45
|
+
* `hq`. `servicePath` is the absolute, de-duplicated entries of `pathValue`,
|
|
46
|
+
* with the real directory of that `hq` in front when it is not already listed.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveServicePath(pathValue: string | undefined, rules?: ServicePathRules): {
|
|
49
|
+
servicePath: string;
|
|
50
|
+
hq: string | undefined;
|
|
51
|
+
};
|
|
26
52
|
export declare function runReconcile(argv: string[], rootArg?: string, options?: ReconcileOptions): Promise<number>;
|
|
27
53
|
export declare function registerCoreJobsNativeCommand(core: Command): void;
|
|
28
54
|
export declare function rawArgumentsForCommand(command: Command, fallback: string[], raw?: string[]): string[];
|