@indigoai-us/hq-cli 5.345.264 → 5.345.267
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 +61 -0
- package/assets/scaffold/core/scripts/hq-delegate-grant.sh +4 -48
- package/assets/scaffold/core/scripts/hq-delegate-secrets.sh +16 -10
- package/assets/scaffold/core/scripts/hq-delegate-send.sh +17 -1
- package/contracts/host-canary-release.json +7 -7
- package/dist/command-catalog.generated.d.ts +30 -1
- package/dist/command-catalog.generated.js +37 -1
- package/dist/commands/core-delegate-w1b.js +21 -40
- package/dist/commands/core-delegate.js +11 -8
- package/dist/commands/files-browse.d.ts +83 -4
- package/dist/commands/files-browse.js +404 -54
- package/dist/commands/groups.js +2 -2
- package/dist/commands/skill.js +15 -0
- package/dist/lib/agent-kit/mcp/tools.js +2 -2
- package/dist/lib/agent-kit/skills.js +12 -6
- package/dist/lib/daemon/merge-sections.d.ts +44 -9
- package/dist/lib/daemon/merge-sections.js +234 -37
- package/dist/lib/daemon/run.js +1 -0
- package/dist/lib/doctor/checks/antigravity-wiring.js +20 -4
- package/dist/lib/doctor/checks/host-core.js +9 -4
- package/dist/lib/doctor/fix/process-identity.d.ts +2 -0
- package/dist/lib/doctor/fix/process-identity.js +5 -2
- package/dist/lib/hook-engine/coverage.js +13 -1
- package/dist/lib/hook-engine/native-precompact-compatibility.json +1 -0
- package/dist/lib/hook-engine/reconcile.js +13 -3
- package/dist/lib/signals/reply.js +25 -5
- package/dist/lib/signals/steps/extract.d.ts +28 -4
- package/dist/lib/signals/steps/extract.js +124 -10
- package/dist/lib/sync-core/release.d.ts +1 -1
- package/dist/lib/sync-core/release.js +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.345.267] — 2026-11-29
|
|
6
|
+
- Speed up `scope_bash` tests on Windows by reusing the test binary when already outside an HQ tree and evaluating large spelling matrices in-process.
|
|
7
|
+
- Update the legacy journal gate test fixture to use the current sync-core release.
|
|
8
|
+
- Pin `hq-delegate-grant.sh` as `absent-in-staging` in the scaffold freshness test after staging retirement and #4187.
|
|
9
|
+
- Accept Antigravity `run_command` calls that carry `BypassSandbox` and `NotificationTimeoutSeconds` in `hq-hook` PreToolUse; HQ checks still inspect `CommandLine` and `Cwd` as before, and other unknown or case-variant argument keys are still refused.
|
|
10
|
+
- Cache prebuilt Windows `hq-hook` nextest archives on each Beaker runner keyed by commit SHA, run id, and archive SHA-256 so later shards and failed-job reruns on the same machine reuse the verified local archive instead of re-downloading it.
|
|
11
|
+
- Scale Linux `hq-hook PR tests` sharding in `scripts/ci/hq-hook-test-plan.mjs` to `PR_MAX_SHARDS=12`, `FULL_SHARDS=12`, and `PR_SECONDS_PER_SHARD=90` to match the prebuilt nextest archive and autoscaled AWS runner pool, and wire `./.github/actions/sccache-s3` (behind `HQ_BUILD_CACHE`) into the `hq-hook.yml` tag/release build matrix with job-scoped `id-token: write` permissions.
|
|
12
|
+
- hq-hook PR CI now ends with an `hq-hook failure class` job that says whether a red run failed in its tests or lost a runner or a setup step, in the job summary and as an annotation. It exits 1 whenever any other job is red, so it never reports a red run as green.
|
|
13
|
+
- Vendor `.github/actions/sccache-s3/action.yml` from `indigoai-us/hq-github-runners` and wire the shared OIDC-backed S3 `sccache` build cache (`hq-build-cache-804849608251-us-east-2`) into `hq-hook-pr.yml` build/clippy jobs (`build-archive`, `windows-beaker-build`, and `windows-beaker-clippy`) behind the `HQ_BUILD_CACHE` kill switch, keeping `id-token: write` isolated from test shard jobs and retaining the existing local `sccache` setup as a fallback.
|
|
14
|
+
- Run `hq-hook` Windows Beaker shard merging (`windows-beaker-merge`) on Linux (`hq-cli-main-priority` / `hq-hook-mac` / `ubuntu-latest`) instead of scarce Beaker Windows runners, and split train-push native Windows `cargo clippy` into a parallel `windows-beaker-clippy` job so `windows-beaker` shard 1/6 only runs prebuilt tests.
|
|
15
|
+
- Speed up the `hq-hook` Windows release workflow by compiling tests once without dev debug info, running compiled Windows test binaries in parallel with `--no-fail-fast`, preserving a per-runner Cargo target cache on Beaker outside `actions/checkout` cleanup, and resolving `pwsh` or Windows PowerShell with an early bounded preflight check.
|
|
16
|
+
- Record `block-credential-file-read` fail-closed `git -C <missing-dir> diff HEAD` replay differences (`evt-fd252a042132bc4a`, `evt-e81914a040832cb9`) in the `US-013` intended-differences ledger with a pinning test.
|
|
17
|
+
- Remove obsolete `grp_dlg*` delegation-group creation for `agt_*` recipients in `hq core delegate grant` and `hq core delegate secrets`: share file and secret grants directly to `agt_*` (`granteeType: "person"`, `granteeId: agt_*`) so non-owner admins and members can delegate to fleet agents without `manageGroups` permission; preserve legacy `grp_dlg*` secret-sharing compatibility for existing manifests, and surface the server's 403 error on `hq groups create`.
|
|
18
|
+
- Run personal, pack, and company folder hooks natively on `fleet-local` across `PreToolUse`, `PostToolUse`, `SessionStart`, `UserPromptSubmit`, and `SessionEnd` (item 908).
|
|
19
|
+
- Tell agents that `hq files search` lists the entire company vault and can take minutes on a large company, and point them at `hq files get <exact path>` or `hq files browse <narrow prefix>` instead, in the agent kit search skill and the `hq_search` MCP tool description. The `/delegate` pickup prompt now lists a `hq files get` line for the delegation brief, the manifest and every published dossier file, and tells the recipient not to search the vault for them.
|
|
20
|
+
- Speed up `hq files search`: it no longer fetches your grants (the ACL column is now opt-in with `--acl`). When you run it with your own HQ login and are a member of the company, it prints matches from your synced local copy first (`--local-only` skips the vault listing, `--no-local` skips the local copy); API keys, machine and agent identities never get local results. It also accepts `--prefix <path>` to list only one folder inside the company and shows paging progress on stderr when stderr is a terminal or `--progress` is set. Without a terminal it prints one stderr note that a whole-vault listing can take minutes (`--quiet` drops it). The remote listing is also parsed faster: only matching keys are turned into result rows.
|
|
21
|
+
- Stabilize `US-005` bounded-scan test `(j)` against the 5 s vitest timeout on CI by sizing the real-fsync backlog to 30 jobs across 5 batches of 6 (5x the batch bound) while preserving every cursor, partial-tail, batch-bound, and uniqueness assertion.
|
|
22
|
+
- Fix `stop_check::the_safety_budget_is_charged_for_ported_hooks_master_hook_runs_before_a_guard` control-case flake caused by `HQ_SAFETY_GUARD_TOTAL_BUDGET=1` crossing a whole-second `SECONDS` boundary during `master-hook.sh` startup, and tighten the native control assertion.
|
|
23
|
+
- Fixed: Gate Antigravity Stop hook registration in `hq reindex` and `hq doctor` on native Stop compatibility so HQ roots with an active Stop compatibility hold keep SessionStart, PreToolUse, and PostToolUse registered without registering a Stop hook that refuses every turn.
|
|
24
|
+
- Fixed: Allow Antigravity built-in UI and IPC tools (`update_focus`, `update_steps`, `ask_question`, `manage_task` for `list`/`status`/`kill`, `send_message`, `manage_subagents`, `list_plugin_accounts`, `search_marketplace`) in `hq-hook` PreToolUse while keeping `manage_task` `send_input` and opaque execution tools refused, and exclude `edit_file`'s replacement `Target` text from path extraction so multi-line edits no longer fail with a line-break path error.
|
|
25
|
+
- Fixed: The daemon's `merge_approvals` state section no longer copies each conduct link's decision queue into every session on that link (the merge check reads the queue file directly), omits closed or stale conduct-link pointers, and stays within the per-section byte limit, so merges are no longer blocked when many sessions share a conduct link.
|
|
26
|
+
- Internal: The fleet-local sensitive-read parity test no longer flakes on Linux. Its harness now wraps `grep` with `DRAIN_GREP` (matching the env-dump harness fix in #3632) so `printf` cannot take SIGPIPE under `pipefail` after `grep -Eq` exits on an early line and flip a multi-line row (`line-end-before-newline`) into an allow. The pinned adapter and corpus are unchanged; a 200-run loop of `line-end-before-newline` guards the fix.
|
|
27
|
+
- Reliability improvements for git push from HQ.
|
|
28
|
+
- Pin `lanes-repo-merge-hold.sh` (`462fd409`, `hq-core` 16.0.48–16.0.53) in the `hq-hook` bridge port (`ports.rs`) and remove the stale `462fd409` handbacks in `core-pins.json`.
|
|
29
|
+
- test(hq-hook): run `credential_entry::detached_binary_uses_the_explicit_registration_root` through `deterministic_host` (`RunClock::Deterministic`) on a detached copy of the test binary so `Host::Grok`'s 4000 ms `GetProcessTimes` budget does not race against Windows Defender scans of a freshly copied `.exe` under Beaker load (item 951)
|
|
30
|
+
- Fix Beaker Windows archive runner hanging until the 600s timeout (`exit 124`, `complete: false`) when a test binary exits cleanly while an orphaned descendant still holds inherited stdout/stderr handles, and stage `target/x86_64-pc-windows-msvc/tmp` for cross-host shards.
|
|
31
|
+
- Install `cargo-nextest` and `sccache` in Windows `hq-hook-pr` jobs via a checksum-verified Bash script so self-hosted Windows runners without `pwsh` succeed.
|
|
32
|
+
- Fixed: Capture the exit status of `scripts/release/check-verified-main-ci.mjs` in `.github/workflows/publish.yml` under `set -euo pipefail` so exit code `2` sets `verified=false` and falls through to waiting for the tag's CI run instead of aborting under GitHub Actions' default `bash -e`.
|
|
33
|
+
- Match the bash scope check for `hq` path arguments in `hq-hook`: check path-shaped and directory-level `hq` arguments against company folders whether or not the target file exists on disk (including date and arithmetic stand-ins, `--opt=` path flags, quoted attached short options, and Windows root-relative backslash paths), match bash's positional `hq dm` message allowance in Windows mode, refuse `{` in `date` splice bodies, and handle `/dev/stdin`, `/dev/fd/*`, `-`, and combined `-eo`/`-euo` shell options consistently.
|
|
34
|
+
- Ledgered the intended US-014 policy-injection difference when `block-hq-root-git-mutation` denies a `claude-code:PreToolUse:Bash` call (native `Chain` short-circuits on the first `Deny` before `injector::host::Policies` runs; item 869).
|
|
35
|
+
- Fix pre-release CI blockers on `main`: honor per-call `HQ_HOOK_BASH` in `run_bash_purge_with` so parallel `injector::host::tests::run_bash_purge_*` unit tests never race on process-wide `std::env`, replace process-wide `libc::umask` test guards in `injector::held::tests` and `tests/precompact_native.rs` with isolated child `pre_exec` umasks, add `hq-core` `v16.0.53` to `crates/hq-hook/core-pins.json`, update Windows child-count expectations in `src/commands/core-delegate-w1b.test.ts` after direct `agt_*` grants (`#4187`), and bound concurrent Windows MSYS2 `bash` spawns with job-object cleanup and a 90 s Windows per-case timeout in `merged_write_guard` tests.
|
|
36
|
+
- Fix `v5.345.266` release blockers: route claimed `fleet-local` and `agents-v2` PreToolUse events to `pre_tool_use_root` in `crates/hq-hook/tests/host_run.rs` so live-session isolation does not hit missing-registry refusals, query Windows process start times directly via `[System.Diagnostics.Process]::GetProcessById` with a 30 s timeout in `process-identity.ts`, and assert Windows `delegate grant` jq-absent parity tests do not invoke PowerShell lock probes.
|
|
37
|
+
- Changed: the host canary record shipped with the CLI is refreshed for this release build.
|
|
38
|
+
- Changed: the host canary record shipped with the CLI is refreshed for the 5.345.266 release build.
|
|
39
|
+
- Changed: the host canary record shipped with the CLI is refreshed for the 5.345.267 release build.
|
|
40
|
+
- Added: owner switch to relax a native hook check without a release.
|
|
41
|
+
- `scripts/replay-harness.mjs` can build lane 2's old-core results once and reuse them: `--baseline-out <file>` writes every event's old-core runs and noise verdict under a key (events, `--hq-root` tree and git HEAD, the harness, the toolchain on the cores' PATH including `refbin`, OS and every option that changes the old side), and `--baseline-in <file>` reuses them, refusing the run on any key difference or a missing, partial or corrupt file. The new core still runs on every kept event and every difference is still held to the ledger. `--checkpoint <file>` appends each finished event's lane 2 result so a stopped run resumes where it stopped. With a baseline, the 5,000-event hook-port proof drops from about 2 h 08 m to about 4 min. Without the new options the harness behaves as before.
|
|
42
|
+
- Fixed: native PreCompact accepts hq-core-staging #2092's updated purge hook (`825dd3fb`) and runs a hash-verified copy of the installed bash purge script for that revision instead of refusing compaction, and moves `native-precompact-compatibility.json` under `crates/hq-hook/src/` so `native-pin-check` reads the same allowlist.
|
|
43
|
+
- Added: native PreCompact policy-ledger purge support for hq-core-staging #2092 (`825dd3fb`), re-arming HARD rules from `<sid>.hard.txt` under `<ledger>.lock`, promoting soft rules from `<sid>.soft-paths.tsv`, writing `<sid>.in-force.tsv` and `<sid>.compacted`, and keeping the bash route for unmodeled revisions.
|
|
44
|
+
- Fixed: `hq skill create` no longer prints "Sync: complete" when the skill file was not uploaded to the company vault.
|
|
45
|
+
- `hq signals run`: on a Claude HQ Fleet Executive bot, the extract step now runs each source through the bot's `hq-fleet-local complete` helper on the bot's own login, as the signals pass already does, instead of `claude -p` on the personal Claude CLI login. It falls back to the Claude CLI only when the bot has no helper. A signed-out extract now tells you which coding-tool login to sign in again (`hq bot auth <bot> --provider claude`, or `claude auth login`) instead of saying you are signed out of HQ.
|
|
46
|
+
- Raise the built-in `hq-sync-core` fallback release (`SYNC_CORE_RELEASE`) and full-sync minimum floor (`SYNC_CORE_FULL_RELEASE`) to `v0.1.46` so unreachable `pin.json` lookups or stale local binaries cannot silently downgrade full sync to pre-adoption-safety releases.
|
|
47
|
+
- Refresh the unit test shard weights from three batch-train runs. The old weights (2026-11-19) had drifted so far that the slowest of the 16 unit shards ran about 1.6 times the median; in a held-out run the refreshed weights bring it to about 1.05 times.
|
|
48
|
+
- Run the `command_guards` bash-vs-native cases on up to four worker threads instead of two, run the forced hold-timeout locales at the same time, and run one lanes-repo-merge-hold case per answer with the hq-core 16.0.46 hook-lib instead of all of them (neither that guard's bash nor its port reads hook-lib; every secret-reveal case still runs on 16.0.46).
|
|
49
|
+
- Run the `company_git_metadata` path and observed-call parity checks on up to four worker threads, each with its own fixture root, and stop crossing every path spelling with every `tool_input` shape (each spelling still runs through `file_path`, each shape still runs on every path). The binary drops from about 16 s to under 4 s on macOS.
|
|
50
|
+
- Fix an intermittent failure in the Windows service worker test for a runner whose heartbeat goes stale: it ran on wall time against a 300 ms limit, so a slow CI runner saw the heartbeat already stale at submit and got a refusal instead of a lost runner. The test now drives the transport's clock.
|
|
51
|
+
- Split the native delegate differential e2e corpus (ten subcommands in one ~87 s test) into one test per subcommand over three files, so the e2e shards run its parts at once. Same corpora and assertions; the first file checks the parts cover every subcommand exactly once.
|
|
52
|
+
- Split the handoff-finalize shell-to-native differential e2e run (about 70 cases, the slowest test in `e2e/handoff-differential.test.ts`) into three files by sorted case id, so the e2e shards run its parts at once. Same cases and per-case checks; `handoff-differential.test.ts` checks the corpus still holds the required cases and that the parts cover every case exactly once.
|
|
53
|
+
- Fix an intermittent failure in the handoff live-route e2e test: its `hq` stand-in recorded each call line by line, so two calls running at once (the background `hq sync push` and the index rebuild call) could mix their argv. Each call is now appended in one write, with a test that runs 24 long calls at once.
|
|
54
|
+
- Split the torn-install recovery e2e file (32 lanes, about 53 s in CI) over two files with a shared harness in `e2e/helpers/install-tree-torn.ts`, so the e2e shards run the halves at once. Same lanes and assertions, moved unchanged.
|
|
55
|
+
- Deal the scaffold parity e2e matrices over five native and three shell files (were three and two), so no part runs much past the average e2e shard. Same routes and assertions; the coverage checks now expect the new part counts.
|
|
56
|
+
- Split the fast scaffold parity e2e matrices into one test per route, dealt over three native-route files and two shell-companion files, so the e2e shards run them at once instead of one ~159 s file setting a shard's wall time. Same routes, scenarios and assertions; the first file of each matrix checks that its parts cover every route exactly once.
|
|
57
|
+
- Speed up the hq-hook gate parity binaries: the delivery-regex corpus is compared with the platform grep once per run (`tests/gate_delivery_ere.rs`, every regex on every body), and each gate version now sends every regex through its bash gate on one body instead of six. Coverage of the compile check, the policy-line read and the block or allow branch per regex and gate version is unchanged.
|
|
58
|
+
- Speed up the `hq-hook` `image_context_guard` tests: the generated corpus runs in independent ledger parts on worker threads, samples the tool-name and `detail` matrix and starts the count-limit ledger near the limit; the helper-set, staging-suite and malformed-input loops run side by side; and two bash runs whose answers were never checked are gone.
|
|
59
|
+
- Run the `pre_tool_use_master` PreToolUse parity corpus through bash in full on one release per host and on a per-release sample elsewhere, with the native answer for every row still checked on every release, cutting the binary's bash spawns by about 40%.
|
|
60
|
+
- Build `sha2` at `opt-level = 3` in the dev profile so the native PowerShell scope check's script hash no longer dominates the `scope_powershell` differential tests, and stop running bash on the two POSIX differential rows whose bash answer is not asserted.
|
|
61
|
+
- Speed up `crates/hq-hook/tests/p4_master_hook_parity.rs`: cases run on up to four worker threads, each with its own fixture root; the four re-runs of the `sudo -D`/`--chdir` fix become block expectations on the corpus run; the five non-override `HQ_ALLOW_UNSAFE_INSTALL` values go through master-hook on a blocked and an allowed call per part instead of every install command (every value stays on every released-script case and host in `released_parity_package_install`).
|
|
62
|
+
- Avoid redundant double execution in `repo_worktree::paired_or_windows_refusal` and bound concurrent Windows MSYS2 `bash` reference spawns in `repo_worktree` tests to prevent fork-storm flakes on Windows runners.
|
|
63
|
+
- Drive `deadline_parity`'s known-block timeout cases in `stop_check` with `RunClock::Manual` (`deterministic_host::command_manual`) so `1-deny.sh` never races the 250 ms wall-clock headroom under parallel Mac CI load without raising any timeout or budget.
|
|
64
|
+
- Test reliability improvements for stop-job queue rotation.
|
|
65
|
+
|
|
5
66
|
## [5.345.264] — 2026-11-28
|
|
6
67
|
- The nightly fast-route benchmark now prints a timed progress line as it starts each case and phase, so the hour-long run no longer looks hung in the job log.
|
|
7
68
|
- The hq-hook Windows release job now finds the built engine on runners that set `CARGO_TARGET_DIR`.
|
|
@@ -96,35 +96,9 @@ MODE="$(jq -r '.mode // empty' "$MANIFEST" | tr -d '\r')"
|
|
|
96
96
|
[ -n "$PROJECT" ] || die "manifest has no project.name"
|
|
97
97
|
[ -n "$PRINCIPAL" ] || die "manifest has no to.principal"
|
|
98
98
|
|
|
99
|
-
# File-ACL principals
|
|
100
|
-
#
|
|
101
|
-
# a deterministic per-agent delegation group keyed by the full UID digest:
|
|
102
|
-
# grp_dlg<first 32 SHA-256 hex characters>, containing exactly that agent.
|
|
103
|
-
agent_group_id() {
|
|
104
|
-
local principal="$1" digest
|
|
105
|
-
if command -v sha256sum >/dev/null 2>&1; then
|
|
106
|
-
digest="$(printf '%s' "$principal" | sha256sum)"
|
|
107
|
-
elif command -v shasum >/dev/null 2>&1; then
|
|
108
|
-
digest="$(printf '%s' "$principal" | shasum -a 256)"
|
|
109
|
-
else
|
|
110
|
-
die "sha256 utility is required for agent delegation groups"
|
|
111
|
-
fi
|
|
112
|
-
printf 'grp_dlg%.32s' "$digest"
|
|
113
|
-
}
|
|
114
|
-
|
|
99
|
+
# File-ACL principals accept an email, agt_<id>, grp_<id>, or @all directly
|
|
100
|
+
# (agt_<id> stores granteeType="person", granteeId=agt_<id>).
|
|
115
101
|
GRANT_PRINCIPAL="$PRINCIPAL"
|
|
116
|
-
case "$PRINCIPAL" in
|
|
117
|
-
agt_*)
|
|
118
|
-
TAIL="$(printf '%s' "$PRINCIPAL" | tail -c 9 | tr '[:upper:]' '[:lower:]')"
|
|
119
|
-
LEGACY_GROUP="grp_dlg-$TAIL"
|
|
120
|
-
NEXT_GROUP="$(agent_group_id "$PRINCIPAL")"
|
|
121
|
-
RECORDED_GROUP="$(jq -r '.grantPrincipal // empty' "$MANIFEST" | tr -d '\r')"
|
|
122
|
-
case "$RECORDED_GROUP" in
|
|
123
|
-
"$LEGACY_GROUP"|"$NEXT_GROUP") GRANT_PRINCIPAL="$RECORDED_GROUP" ;;
|
|
124
|
-
*) GRANT_PRINCIPAL="$NEXT_GROUP" ;;
|
|
125
|
-
esac
|
|
126
|
-
;;
|
|
127
|
-
esac
|
|
128
102
|
|
|
129
103
|
case "$STATUS" in
|
|
130
104
|
building|granted) ;;
|
|
@@ -178,7 +152,7 @@ case "$PRINCIPAL" in
|
|
|
178
152
|
prs_*) echo " 0. Person recipient: personUid $PRINCIPAL maps to $GRANT_PRINCIPAL; grants are shared to that email" ;;
|
|
179
153
|
esac
|
|
180
154
|
if [ "${PRINCIPAL#agt_}" != "$PRINCIPAL" ]; then
|
|
181
|
-
echo " 0. Agent recipient: grants
|
|
155
|
+
echo " 0. Agent recipient: grants are shared directly to $PRINCIPAL ($DISPLAY)"
|
|
182
156
|
fi
|
|
183
157
|
echo " 1. Push companies/$COMPANY/projects/$PROJECT/ to the vault (on-conflict keep); where the sync engine owns the vault, pin it in .hq/pins.json and wait for its upload after the grants instead"
|
|
184
158
|
jq -r '.vaultPrefixes[] | " 2. Grant \(.permission) on \(.prefix) — \(.reason // "")"' "$MANIFEST" | tr -d '\r'
|
|
@@ -258,30 +232,12 @@ fi
|
|
|
258
232
|
fi
|
|
259
233
|
done
|
|
260
234
|
|
|
261
|
-
# --- 1b. agent recipients: ensure the delegation group exists + contains them
|
|
262
|
-
|
|
263
|
-
if [ "${PRINCIPAL#agt_}" != "$PRINCIPAL" ]; then
|
|
264
|
-
# Group creation and add are idempotent-tolerated; confirm that the complete
|
|
265
|
-
# member list is exactly this agent before any file ACL is shared.
|
|
266
|
-
hq groups create "$GRANT_PRINCIPAL" --name "Delegation: $DISPLAY" --company "$COMPANY" \
|
|
267
|
-
|| echo "hq-delegate-grant: group create reported an error (may already exist) — continuing" >&2
|
|
268
|
-
hq groups add "$GRANT_PRINCIPAL" "$PRINCIPAL" --company "$COMPANY" \
|
|
269
|
-
|| echo "hq-delegate-grant: group add reported an error (may already be a member) — continuing" >&2
|
|
270
|
-
GROUP_MEMBERS="$(NO_COLOR=1 FORCE_COLOR=0 hq groups members "$GRANT_PRINCIPAL" --company "$COMPANY")" \
|
|
271
|
-
|| die "could not verify delegation group membership"
|
|
272
|
-
MEMBER_IDS="$(printf '%s\n' "$GROUP_MEMBERS" | awk '
|
|
273
|
-
{ gsub(/\033\[[0-9;]*m/, "", $0) }
|
|
274
|
-
/^PERSON_UID([[:space:]]|$)/ { collecting = 1; next }
|
|
275
|
-
collecting && NF { print $1 }
|
|
276
|
-
')"
|
|
277
|
-
[ "$MEMBER_IDS" = "$PRINCIPAL" ] || die "delegation group membership does not exactly match recipient"
|
|
278
|
-
fi
|
|
279
|
-
|
|
280
235
|
# --- 2+3. exact structured read-back; never infer identity from a new row ---
|
|
281
236
|
# Requires the structured CLI contracts. Unsupported/failed reads stop the flow.
|
|
282
237
|
EXPECTED_TYPE="" EXPECTED_ID="" EXPECTED_COMPANY=""
|
|
283
238
|
case "$GRANT_PRINCIPAL" in
|
|
284
239
|
grp_*) EXPECTED_TYPE=group; EXPECTED_ID="$GRANT_PRINCIPAL" ;;
|
|
240
|
+
agt_*) EXPECTED_TYPE=person; EXPECTED_ID="$GRANT_PRINCIPAL" ;;
|
|
285
241
|
@all) EXPECTED_TYPE=company-wide; EXPECTED_ID="" ;;
|
|
286
242
|
*)
|
|
287
243
|
RESOLVE_RC=0
|
|
@@ -63,19 +63,25 @@ PROJECT="$(jq -r '.project.name // empty' "$MANIFEST")"
|
|
|
63
63
|
[ -n "$COMPANY" ] || die "manifest has no company"
|
|
64
64
|
[ -n "$PRINCIPAL" ] || die "manifest has no to.principal"
|
|
65
65
|
|
|
66
|
-
# Secret-ACL principals
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
66
|
+
# Secret-ACL principals accept an email, agt_<id>, grp_<id>, out_<id>, or @all.
|
|
67
|
+
# Only a person uid (prs_...) must share through the mapped email recorded in
|
|
68
|
+
# .grantPrincipal by the grant step. For an agent recipient, a legacy grp_dlg*
|
|
69
|
+
# recorded in an older manifest is still honored; otherwise agt_<id> is shared
|
|
70
|
+
# directly.
|
|
71
71
|
SHARE_PRINCIPAL="$PRINCIPAL"
|
|
72
72
|
case "$PRINCIPAL" in
|
|
73
|
-
agt_
|
|
73
|
+
agt_*)
|
|
74
74
|
RECORDED="$(jq -r '.grantPrincipal // empty' "$MANIFEST" | tr -d '\r')"
|
|
75
|
-
case "$
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
case "$RECORDED" in
|
|
76
|
+
grp_dlg*) SHARE_PRINCIPAL="$RECORDED" ;;
|
|
77
|
+
*) SHARE_PRINCIPAL="$PRINCIPAL" ;;
|
|
78
|
+
esac
|
|
79
|
+
;;
|
|
80
|
+
prs_*)
|
|
81
|
+
RECORDED="$(jq -r '.grantPrincipal // empty' "$MANIFEST" | tr -d '\r')"
|
|
82
|
+
case "$RECORDED" in
|
|
83
|
+
?*@?*) SHARE_PRINCIPAL="$RECORDED" ;;
|
|
84
|
+
*) SHARE_PRINCIPAL="" ;;
|
|
79
85
|
esac
|
|
80
86
|
;;
|
|
81
87
|
esac
|
|
@@ -161,7 +161,15 @@ elif [ -n "$PRD_ABS" ] && [ -f "$PRD_ABS" ] && jq -e . "$PRD_ABS" >/dev/null 2>&
|
|
|
161
161
|
fi
|
|
162
162
|
|
|
163
163
|
GET_LINES="$(jq -r --arg co "$COMPANY" \
|
|
164
|
-
'def bashq: if test("
|
|
164
|
+
'def bashq: if test("\\A[A-Za-z0-9_./:@+-]+\\z") then . else @sh end; .vaultPrefixes[] | "hq files get \(.prefix | bashq) --company \($co | bashq)"' "$MANIFEST")"
|
|
165
|
+
|
|
166
|
+
EXACT_LINES="$(jq -r --arg co "$COMPANY" --arg proj "$PROJECT" --arg id "$DELEGATION_ID" \
|
|
167
|
+
'def bashq: if test("\\A[A-Za-z0-9_./:@+-]+\\z") then . else @sh end;
|
|
168
|
+
("projects/" + $proj + "/delegation/" + $id + "/") as $d
|
|
169
|
+
| (if $id == "" then [] else [$d + "BRIEF.md", $d + "manifest.json"] end) as $fixed
|
|
170
|
+
| (.publication.files | if type == "object" then keys else [] end
|
|
171
|
+
| map(ltrimstr("companies/" + $co + "/")) | map(select(. as $f | $fixed | index($f) | not)) | sort) as $published
|
|
172
|
+
| ($fixed + $published)[] | "hq files get \(bashq) --company \($co | bashq)"' "$MANIFEST")"
|
|
165
173
|
|
|
166
174
|
REPO_IS_NULL="$(jq -r 'if .repo == null then "yes" else "no" end' "$MANIFEST")"
|
|
167
175
|
REPO_SECTION=""
|
|
@@ -240,6 +248,14 @@ trap 'rm -rf "$STAGE"; [ "$SEND" -eq 0 ] || rmdir "$LOCK"' EXIT
|
|
|
240
248
|
printf '%s\n' "$GET_LINES"
|
|
241
249
|
echo '```'
|
|
242
250
|
echo
|
|
251
|
+
if [ -n "$EXACT_LINES" ]; then
|
|
252
|
+
echo "The delegation brief, manifest and dossier files are at these exact vault paths. Fetch them directly; do not search the vault for them (\`hq files search\` lists the whole company vault and can take minutes):"
|
|
253
|
+
echo
|
|
254
|
+
echo '```bash'
|
|
255
|
+
printf '%s\n' "$EXACT_LINES"
|
|
256
|
+
echo '```'
|
|
257
|
+
echo
|
|
258
|
+
fi
|
|
243
259
|
echo "$DOSSIER_LINE"
|
|
244
260
|
echo
|
|
245
261
|
if [ -n "$REPO_SECTION" ]; then
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "hq.host-canary-release.v1",
|
|
3
|
-
"cliVersion": "5.345.
|
|
3
|
+
"cliVersion": "5.345.267",
|
|
4
4
|
"hosts": {
|
|
5
5
|
"claude": [
|
|
6
6
|
{
|
|
7
7
|
"passed": true,
|
|
8
|
-
"at": "2026-11-
|
|
9
|
-
"engineVersion": "0.3.1+hq.5.345.
|
|
8
|
+
"at": "2026-11-29T01:51:00.420Z",
|
|
9
|
+
"engineVersion": "0.3.1+hq.5.345.267.src.c375d0eb695aa9f21ff586e2e2ba338378e314b5403cca2f42a102a095ba2e48",
|
|
10
10
|
"gateSha256": "a2879dfe692233f5953bac86672947bbd82f3c5247292f3efcb80f16c3d2c6b1"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"passed": true,
|
|
14
|
-
"at": "2026-11-
|
|
15
|
-
"engineVersion": "0.3.1+hq.5.345.
|
|
14
|
+
"at": "2026-11-29T01:51:20.915Z",
|
|
15
|
+
"engineVersion": "0.3.1+hq.5.345.267.src.c375d0eb695aa9f21ff586e2e2ba338378e314b5403cca2f42a102a095ba2e48",
|
|
16
16
|
"gateSha256": "ca58a94859eae0a345c11c8d9c59303eb76350dc1cf223391037d21979c28718"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"passed": true,
|
|
20
|
-
"at": "2026-11-
|
|
21
|
-
"engineVersion": "0.3.1+hq.5.345.
|
|
20
|
+
"at": "2026-11-29T01:52:01.744Z",
|
|
21
|
+
"engineVersion": "0.3.1+hq.5.345.267.src.c375d0eb695aa9f21ff586e2e2ba338378e314b5403cca2f42a102a095ba2e48",
|
|
22
22
|
"gateSha256": "ecdbab7c2e0a1d94eb9c98f15e760390f215bc7115a217ded24b4275322722d2"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
@@ -3468,7 +3468,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
3468
3468
|
readonly subcommands: readonly [];
|
|
3469
3469
|
}, {
|
|
3470
3470
|
readonly name: "search";
|
|
3471
|
-
readonly description: "Search vault object keys (case-insensitive path/name match) under a company without downloading. Requires --company (or --personal). Content search is not supported in v1.";
|
|
3471
|
+
readonly description: "Search vault object keys (case-insensitive path/name match) under a company without downloading. Requires --company (or --personal). When you run it with your own HQ login, prints matches from your synced local copy first (labelled), then lists the vault, which pages through every object under the company (or --prefix) and can take minutes on large vaults. Content search is not supported in v1.";
|
|
3472
3472
|
readonly aliases: readonly [];
|
|
3473
3473
|
readonly hidden: false;
|
|
3474
3474
|
readonly helpOption: true;
|
|
@@ -3489,6 +3489,35 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
3489
3489
|
readonly flags: "--personal";
|
|
3490
3490
|
readonly description: "Search the caller's canonical personal vault. Mutually exclusive with --company.";
|
|
3491
3491
|
readonly hidden: false;
|
|
3492
|
+
}, {
|
|
3493
|
+
readonly flags: "--prefix <path>";
|
|
3494
|
+
readonly description: "Only list the vault under this folder inside companies/<slug>/ (e.g. knowledge/ or companies/<slug>/knowledge/).";
|
|
3495
|
+
readonly hidden: false;
|
|
3496
|
+
}, {
|
|
3497
|
+
readonly flags: "--local-only";
|
|
3498
|
+
readonly description: "Search only your synced local copy under <hq-root>/companies/<slug>/; skip the vault listing. Needs your own HQ login.";
|
|
3499
|
+
readonly hidden: false;
|
|
3500
|
+
}, {
|
|
3501
|
+
readonly flags: "--no-local";
|
|
3502
|
+
readonly description: "Skip the synced local copy; list the vault only.";
|
|
3503
|
+
readonly hidden: false;
|
|
3504
|
+
}, {
|
|
3505
|
+
readonly flags: "--quiet";
|
|
3506
|
+
readonly description: "Do not print the slow-listing note to stderr when stderr is not a terminal.";
|
|
3507
|
+
readonly hidden: false;
|
|
3508
|
+
}, {
|
|
3509
|
+
readonly flags: "--acl";
|
|
3510
|
+
readonly description: "Add the ACL column (fetches your explicit grants, like hq files browse).";
|
|
3511
|
+
readonly hidden: false;
|
|
3512
|
+
}, {
|
|
3513
|
+
readonly flags: "--progress";
|
|
3514
|
+
readonly description: "Print paging progress to stderr even when stderr is not a terminal.";
|
|
3515
|
+
readonly hidden: false;
|
|
3516
|
+
}, {
|
|
3517
|
+
readonly flags: "--hq-root <path>";
|
|
3518
|
+
readonly description: "Local HQ tree root (default: <runtime-path>)";
|
|
3519
|
+
readonly hidden: false;
|
|
3520
|
+
readonly defaultValue: "<runtime-path>";
|
|
3492
3521
|
}];
|
|
3493
3522
|
readonly subcommands: readonly [];
|
|
3494
3523
|
}, {
|
|
@@ -4188,7 +4188,7 @@ export const COMMAND_CATALOG = [
|
|
|
4188
4188
|
},
|
|
4189
4189
|
{
|
|
4190
4190
|
"name": "search",
|
|
4191
|
-
"description": "Search vault object keys (case-insensitive path/name match) under a company without downloading. Requires --company (or --personal). Content search is not supported in v1.",
|
|
4191
|
+
"description": "Search vault object keys (case-insensitive path/name match) under a company without downloading. Requires --company (or --personal). When you run it with your own HQ login, prints matches from your synced local copy first (labelled), then lists the vault, which pages through every object under the company (or --prefix) and can take minutes on large vaults. Content search is not supported in v1.",
|
|
4192
4192
|
"aliases": [],
|
|
4193
4193
|
"hidden": false,
|
|
4194
4194
|
"helpOption": true,
|
|
@@ -4213,6 +4213,42 @@ export const COMMAND_CATALOG = [
|
|
|
4213
4213
|
"flags": "--personal",
|
|
4214
4214
|
"description": "Search the caller's canonical personal vault. Mutually exclusive with --company.",
|
|
4215
4215
|
"hidden": false
|
|
4216
|
+
},
|
|
4217
|
+
{
|
|
4218
|
+
"flags": "--prefix <path>",
|
|
4219
|
+
"description": "Only list the vault under this folder inside companies/<slug>/ (e.g. knowledge/ or companies/<slug>/knowledge/).",
|
|
4220
|
+
"hidden": false
|
|
4221
|
+
},
|
|
4222
|
+
{
|
|
4223
|
+
"flags": "--local-only",
|
|
4224
|
+
"description": "Search only your synced local copy under <hq-root>/companies/<slug>/; skip the vault listing. Needs your own HQ login.",
|
|
4225
|
+
"hidden": false
|
|
4226
|
+
},
|
|
4227
|
+
{
|
|
4228
|
+
"flags": "--no-local",
|
|
4229
|
+
"description": "Skip the synced local copy; list the vault only.",
|
|
4230
|
+
"hidden": false
|
|
4231
|
+
},
|
|
4232
|
+
{
|
|
4233
|
+
"flags": "--quiet",
|
|
4234
|
+
"description": "Do not print the slow-listing note to stderr when stderr is not a terminal.",
|
|
4235
|
+
"hidden": false
|
|
4236
|
+
},
|
|
4237
|
+
{
|
|
4238
|
+
"flags": "--acl",
|
|
4239
|
+
"description": "Add the ACL column (fetches your explicit grants, like hq files browse).",
|
|
4240
|
+
"hidden": false
|
|
4241
|
+
},
|
|
4242
|
+
{
|
|
4243
|
+
"flags": "--progress",
|
|
4244
|
+
"description": "Print paging progress to stderr even when stderr is not a terminal.",
|
|
4245
|
+
"hidden": false
|
|
4246
|
+
},
|
|
4247
|
+
{
|
|
4248
|
+
"flags": "--hq-root <path>",
|
|
4249
|
+
"description": "Local HQ tree root (default: <runtime-path>)",
|
|
4250
|
+
"hidden": false,
|
|
4251
|
+
"defaultValue": "<runtime-path>"
|
|
4216
4252
|
}
|
|
4217
4253
|
],
|
|
4218
4254
|
"subcommands": []
|
|
@@ -162,22 +162,10 @@ function quoteBash(value) {
|
|
|
162
162
|
return value;
|
|
163
163
|
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
164
164
|
}
|
|
165
|
-
function delegationGroupId(principal) {
|
|
166
|
-
return "grp_dlg" + createHash("sha256").update(principal).digest("hex").slice(0, 32);
|
|
167
|
-
}
|
|
168
165
|
function stripAnsiSequences(value) {
|
|
169
166
|
const escape = String.fromCharCode(27);
|
|
170
167
|
return value.replace(new RegExp(`${escape}\\[[0-?]*[ -/]*[@-~]`, "g"), "");
|
|
171
168
|
}
|
|
172
|
-
function groupMemberIds(output) {
|
|
173
|
-
const plainOutput = stripAnsiSequences(output);
|
|
174
|
-
const lines = plainOutput.split(/\r?\n/);
|
|
175
|
-
const header = lines.findIndex((line) => /^PERSON_UID(?:\s|$)/.test(line.trimStart()));
|
|
176
|
-
if (header < 0)
|
|
177
|
-
return null;
|
|
178
|
-
return lines.slice(header + 1).filter((line) => line.trim() !== "")
|
|
179
|
-
.map((line) => line.trim().split(/\s{2,}/, 1)[0] ?? "");
|
|
180
|
-
}
|
|
181
169
|
/**
|
|
182
170
|
* Creator-row ACL label in any hq-cli wording: bare "creator access", the older
|
|
183
171
|
* "creator access — creator-only", or "creator access (<note>)". The listing
|
|
@@ -767,12 +755,6 @@ function runGrant(args, context) {
|
|
|
767
755
|
if (!principal)
|
|
768
756
|
return fail("grant", "manifest has no to.principal");
|
|
769
757
|
let grantPrincipal = principal;
|
|
770
|
-
if (principal.startsWith("agt_")) {
|
|
771
|
-
const legacyGroup = "grp_dlg-" + principal.slice(-9).toLowerCase();
|
|
772
|
-
const nextGroup = delegationGroupId(principal);
|
|
773
|
-
const recordedGroup = text(getPath(manifest, "grantPrincipal"));
|
|
774
|
-
grantPrincipal = recordedGroup === legacyGroup || recordedGroup === nextGroup ? recordedGroup : nextGroup;
|
|
775
|
-
}
|
|
776
758
|
if (status !== "building" && status !== "granted")
|
|
777
759
|
return fail("grant", `manifest status is '${status}' — grants run from 'building' (or re-run from 'granted'), not from there`);
|
|
778
760
|
const prefixes = list(getPath(manifest, "vaultPrefixes"));
|
|
@@ -800,7 +782,7 @@ function runGrant(args, context) {
|
|
|
800
782
|
if (principal.startsWith("prs_"))
|
|
801
783
|
out(` 0. Person recipient: personUid ${principal} maps to ${grantPrincipal}; grants are shared to that email\n`);
|
|
802
784
|
if (principal.startsWith("agt_"))
|
|
803
|
-
out(` 0. Agent recipient: grants
|
|
785
|
+
out(` 0. Agent recipient: grants are shared directly to ${principal} (${display})\n`);
|
|
804
786
|
out(` 1. Push companies/${company}/projects/${project}/ to the vault (on-conflict keep); where the sync engine owns the vault, pin it in .hq/pins.json and wait for its upload after the grants instead\n`);
|
|
805
787
|
for (const entry of prefixes)
|
|
806
788
|
out(` 2. Grant ${jqRawPath(entry, "permission")} on ${jqRawPath(entry, "prefix")} — ${jqRawPath(entry, "reason")}\n`);
|
|
@@ -860,25 +842,6 @@ function runGrant(args, context) {
|
|
|
860
842
|
}
|
|
861
843
|
}
|
|
862
844
|
}
|
|
863
|
-
if (principal.startsWith("agt_")) {
|
|
864
|
-
result = grantHq(["groups", "create", grantPrincipal, "--name", `Delegation: ${display}`, "--company", company], context, "inherit");
|
|
865
|
-
if (result.timedOut)
|
|
866
|
-
return fail("grant", "group creation timed out; retain this manifest and resume");
|
|
867
|
-
if (result.code !== 0)
|
|
868
|
-
err("hq-delegate-grant: group create reported an error (may already exist) — continuing\n");
|
|
869
|
-
result = grantHq(["groups", "add", grantPrincipal, principal, "--company", company], context, "inherit");
|
|
870
|
-
if (result.timedOut)
|
|
871
|
-
return fail("grant", "group membership update timed out; retain this manifest and resume");
|
|
872
|
-
if (result.code !== 0)
|
|
873
|
-
err("hq-delegate-grant: group add reported an error (may already be a member) — continuing\n");
|
|
874
|
-
const members = subprocess("hq", ["groups", "members", grantPrincipal, "--company", company], context.cwd, { env: { NO_COLOR: "1", FORCE_COLOR: "0" }, timeout: 120_000 });
|
|
875
|
-
if (members.code !== 0)
|
|
876
|
-
return fail("grant", "could not verify delegation group membership");
|
|
877
|
-
const memberIds = groupMemberIds(members.stdout ?? "");
|
|
878
|
-
if (memberIds === null || memberIds.length !== 1 || memberIds[0] !== principal) {
|
|
879
|
-
return fail("grant", "delegation group membership does not exactly match recipient");
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
845
|
let expectedType = "";
|
|
883
846
|
let expectedId = "";
|
|
884
847
|
let expectedCompany = "";
|
|
@@ -886,6 +849,10 @@ function runGrant(args, context) {
|
|
|
886
849
|
expectedType = "group";
|
|
887
850
|
expectedId = grantPrincipal;
|
|
888
851
|
}
|
|
852
|
+
else if (grantPrincipal.startsWith("agt_")) {
|
|
853
|
+
expectedType = "person";
|
|
854
|
+
expectedId = grantPrincipal;
|
|
855
|
+
}
|
|
889
856
|
else if (grantPrincipal === "@all") {
|
|
890
857
|
expectedType = "company-wide";
|
|
891
858
|
}
|
|
@@ -1404,7 +1371,18 @@ function runSend(args, context) {
|
|
|
1404
1371
|
.map((entry, index) => `${index + 1}. **${text(getPath(entry, "id"))}: ${text(getPath(entry, "title"))}** — ${text(getPath(entry, "description"))}`)
|
|
1405
1372
|
.join("\n");
|
|
1406
1373
|
}
|
|
1407
|
-
const getLines = list(getPath(manifest, "vaultPrefixes", [])).map((entry) => "hq files get " + quoteBash(jqRawPath(entry, "prefix")) + " --company " + quoteBash(company)).join("\n");
|
|
1374
|
+
const getLines = list(getPath(manifest, "vaultPrefixes", [])).map((entry) => "hq files get " + quoteBash(typeof getPath(entry, "prefix") === "string" ? text(getPath(entry, "prefix")) : jqRawPath(entry, "prefix")) + " --company " + quoteBash(company)).join("\n");
|
|
1375
|
+
const delegationDir = `projects/${project}/delegation/${delegationId}/`;
|
|
1376
|
+
const fixedPaths = delegationId ? [`${delegationDir}BRIEF.md`, `${delegationDir}manifest.json`] : [];
|
|
1377
|
+
const publishedFileMap = getPath(manifest, "publication.files");
|
|
1378
|
+
const companyPrefix = `companies/${company}/`;
|
|
1379
|
+
const publishedPaths = (isRecord(publishedFileMap) ? Object.keys(publishedFileMap) : [])
|
|
1380
|
+
.map((file) => file.startsWith(companyPrefix) ? file.slice(companyPrefix.length) : file)
|
|
1381
|
+
.filter((file) => !fixedPaths.includes(file))
|
|
1382
|
+
.sort((a, b) => Buffer.compare(Buffer.from(a), Buffer.from(b)));
|
|
1383
|
+
const exactLines = [...fixedPaths, ...publishedPaths]
|
|
1384
|
+
.map((file) => ["hq", "files", "get", quoteBash(file), "--company", quoteBash(company)].join(" "))
|
|
1385
|
+
.join("\n");
|
|
1408
1386
|
let repoSection = "";
|
|
1409
1387
|
const repoValue = getPath(manifest, "repo");
|
|
1410
1388
|
if (repoValue !== null && repoValue !== undefined) {
|
|
@@ -1434,7 +1412,10 @@ function runSend(args, context) {
|
|
|
1434
1412
|
body += `## The goal\n\n${goal}\n\n`;
|
|
1435
1413
|
if (stateLine)
|
|
1436
1414
|
body += `## Where things stand\n\n${stateLine}\n\n`;
|
|
1437
|
-
body += `## Pull the files (on demand — no sync)\n\nRun these from your HQ root; each materializes exactly that path locally:\n\n\`\`\`bash\n${getLines}\n\`\`\`\n\n
|
|
1415
|
+
body += `## Pull the files (on demand — no sync)\n\nRun these from your HQ root; each materializes exactly that path locally:\n\n\`\`\`bash\n${getLines}\n\`\`\`\n\n`;
|
|
1416
|
+
if (exactLines)
|
|
1417
|
+
body += `The delegation brief, manifest and dossier files are at these exact vault paths. Fetch them directly; do not search the vault for them (\`hq files search\` lists the whole company vault and can take minutes):\n\n\`\`\`bash\n${exactLines}\n\`\`\`\n\n`;
|
|
1418
|
+
body += `${dossierLine}\n\n`;
|
|
1438
1419
|
if (repoSection)
|
|
1439
1420
|
body += `${repoSection}\n\n`;
|
|
1440
1421
|
if (secretsSection)
|
|
@@ -794,18 +794,21 @@ export { delegateBoardPath, delegateRepoDirectory, secretsSourcePaths };
|
|
|
794
794
|
const SECRET_NAME_PATTERN = /^[A-Z][A-Z0-9_]*(\/[A-Z][A-Z0-9_]+)*$/;
|
|
795
795
|
/**
|
|
796
796
|
* The principal `hq secrets share` accepts for this recipient. Secret ACLs
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
797
|
+
* accept an email, agt_<id> (translated to its machine email on the wire),
|
|
798
|
+
* grp_<id>, out_<id> or @all. Only a person uid (prs_<id>) must share through
|
|
799
|
+
* the mapped email the grant step recorded in `grantPrincipal`. For an agent
|
|
800
|
+
* recipient, a legacy `grp_dlg*` recorded in an older manifest is still
|
|
801
|
+
* honored; otherwise the `agt_<id>` is shared directly.
|
|
801
802
|
*/
|
|
802
803
|
function secretSharePrincipal(principal, document) {
|
|
803
|
-
if (
|
|
804
|
+
if (principal.startsWith("agt_")) {
|
|
805
|
+
const recorded = jqRawPath(document, "grantPrincipal").replaceAll("\r", "");
|
|
806
|
+
return recorded.startsWith("grp_dlg") ? recorded : principal;
|
|
807
|
+
}
|
|
808
|
+
if (!principal.startsWith("prs_"))
|
|
804
809
|
return principal;
|
|
805
810
|
const recorded = jqRawPath(document, "grantPrincipal").replaceAll("\r", "");
|
|
806
|
-
if (
|
|
807
|
-
return recorded;
|
|
808
|
-
if (principal.startsWith("prs_") && /^.+@.+$/s.test(recorded))
|
|
811
|
+
if (/^.+@.+$/s.test(recorded))
|
|
809
812
|
return recorded;
|
|
810
813
|
return "";
|
|
811
814
|
}
|
|
@@ -193,6 +193,9 @@ export declare function assertOutPathOutsideCompanies(outPath: string, hqRoot: s
|
|
|
193
193
|
* stylistically consistent.
|
|
194
194
|
*/
|
|
195
195
|
export declare function formatBrowseTable(rows: BrowseRow[]): string;
|
|
196
|
+
export declare function formatSearchTable(rows: SearchRow[], acl: boolean): string;
|
|
197
|
+
export declare function formatSearchResults(rows: SearchRow[], query: string, acl?: boolean): string;
|
|
198
|
+
export declare function formatLocalSearchResults(found: LocalSearchResult, query: string): string;
|
|
196
199
|
export interface RunBrowseInput {
|
|
197
200
|
/**
|
|
198
201
|
* Vault path prefix.
|
|
@@ -344,6 +347,18 @@ export declare function runSharedWithMe(input: RunSharedWithMeInput): Promise<Sh
|
|
|
344
347
|
* Render `shared-with-me` rows as a padded table. Mirrors `formatBrowseTable`.
|
|
345
348
|
*/
|
|
346
349
|
export declare function formatSharedWithMeTable(rows: SharedWithMeRow[]): string;
|
|
350
|
+
export interface SearchRow {
|
|
351
|
+
key: string;
|
|
352
|
+
size: number;
|
|
353
|
+
lastModified: Date | undefined;
|
|
354
|
+
aclSource?: AclSource;
|
|
355
|
+
}
|
|
356
|
+
export interface SearchProgress {
|
|
357
|
+
pages: number;
|
|
358
|
+
objects: number;
|
|
359
|
+
matches: number;
|
|
360
|
+
elapsedMs: number;
|
|
361
|
+
}
|
|
347
362
|
export interface RunSearchInput {
|
|
348
363
|
/** Case-insensitive substring matched against each object's full key. */
|
|
349
364
|
query: string;
|
|
@@ -357,16 +372,80 @@ export interface RunSearchInput {
|
|
|
357
372
|
/** COMPANY mode (HQ-59): presign/list client factory. */
|
|
358
373
|
companyClient?: CompanyBrowseClientFactory;
|
|
359
374
|
region: string;
|
|
375
|
+
prefix?: string;
|
|
376
|
+
includeAcl?: boolean;
|
|
377
|
+
onPage?: (progress: SearchProgress) => void;
|
|
378
|
+
now?: () => number;
|
|
360
379
|
}
|
|
380
|
+
export declare function createSearchMatcher(query: string): (lowerKey: string) => boolean;
|
|
361
381
|
/**
|
|
362
382
|
* `hq files search <query>` orchestrator. Lists the company (or personal)
|
|
363
|
-
* vault under its root
|
|
383
|
+
* vault under its root, then filters to keys containing the
|
|
364
384
|
* query (case-insensitive). v1 is a name/path search over the listing — no
|
|
365
|
-
* content search.
|
|
385
|
+
* content search.
|
|
366
386
|
*
|
|
367
|
-
* Pure-ish: no console output. The caller renders with `
|
|
387
|
+
* Pure-ish: no console output. The caller renders with `formatSearchResults`.
|
|
368
388
|
*/
|
|
369
|
-
export declare function runSearch(input: RunSearchInput): Promise<
|
|
389
|
+
export declare function runSearch(input: RunSearchInput): Promise<SearchRow[]>;
|
|
390
|
+
export declare function assertSafeCompanySlug(slug: string): void;
|
|
391
|
+
export declare function resolveSearchPrefix(raw: string | undefined, companySlug: string): string;
|
|
392
|
+
export interface LocalSearchResult {
|
|
393
|
+
root: string;
|
|
394
|
+
available: boolean;
|
|
395
|
+
rows: SearchRow[];
|
|
396
|
+
warning?: string;
|
|
397
|
+
}
|
|
398
|
+
export declare function searchLocalCompanyFiles(input: {
|
|
399
|
+
hqRoot: string;
|
|
400
|
+
companySlug: string;
|
|
401
|
+
prefix: string;
|
|
402
|
+
query: string;
|
|
403
|
+
shouldSync?: (absPath: string, isDir?: boolean) => boolean;
|
|
404
|
+
}): LocalSearchResult;
|
|
405
|
+
export interface SearchProgressStream {
|
|
406
|
+
write(chunk: string): unknown;
|
|
407
|
+
isTTY?: boolean;
|
|
408
|
+
}
|
|
409
|
+
export interface SearchProgressReporter {
|
|
410
|
+
start(scope: string): void;
|
|
411
|
+
page(progress: SearchProgress): void;
|
|
412
|
+
done(): void;
|
|
413
|
+
}
|
|
414
|
+
export declare function createSearchProgressReporter(input: {
|
|
415
|
+
stream: SearchProgressStream;
|
|
416
|
+
force?: boolean;
|
|
417
|
+
quiet?: boolean;
|
|
418
|
+
}): SearchProgressReporter;
|
|
419
|
+
export declare function personLocalSearchAllowed(input: {
|
|
420
|
+
credentialKind: "api-key" | "cognito";
|
|
421
|
+
vars?: NodeJS.ProcessEnv;
|
|
422
|
+
describeIdentity?: (vars: NodeJS.ProcessEnv) => {
|
|
423
|
+
tokenSource: string;
|
|
424
|
+
actorKind: string;
|
|
425
|
+
};
|
|
426
|
+
}): boolean;
|
|
427
|
+
export interface RunCompanySearchCommandInput {
|
|
428
|
+
query: string;
|
|
429
|
+
companySlug: string;
|
|
430
|
+
hqRoot: string;
|
|
431
|
+
prefix?: string;
|
|
432
|
+
local?: boolean;
|
|
433
|
+
localOnly?: boolean;
|
|
434
|
+
acl?: boolean;
|
|
435
|
+
progress?: boolean;
|
|
436
|
+
quiet?: boolean;
|
|
437
|
+
region: string;
|
|
438
|
+
connect: () => Promise<{
|
|
439
|
+
vaultClient: FilesBrowseVaultClient;
|
|
440
|
+
companyClient: CompanyBrowseClientFactory;
|
|
441
|
+
localAllowed: boolean;
|
|
442
|
+
}>;
|
|
443
|
+
stdout: (text: string) => void;
|
|
444
|
+
stderr: SearchProgressStream;
|
|
445
|
+
now?: () => number;
|
|
446
|
+
shouldSync?: (absPath: string, isDir?: boolean) => boolean;
|
|
447
|
+
}
|
|
448
|
+
export declare function runCompanySearchCommand(input: RunCompanySearchCommandInput): Promise<void>;
|
|
370
449
|
interface PinFile {
|
|
371
450
|
version: number;
|
|
372
451
|
/** companySlug → sorted list of company-relative pinned prefixes. */
|