@indigoai-us/hq-cli 5.345.254 → 5.345.257
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 +68 -0
- package/README.md +29 -0
- package/assets/scaffold/core/scripts/handoff-finalize.sh +981 -46
- package/assets/scaffold/core/scripts/hq-delegate-bundle.sh +51 -2
- package/assets/scaffold/core/scripts/hq-delegate-send.sh +49 -6
- package/assets/scaffold/core/scripts/hq-delegate-transfer.sh +20 -0
- package/assets/scaffold/core/scripts/hq-delegate-verify.sh +56 -10
- package/assets/scaffold/core/scripts/lib/fingerprint.sh +423 -0
- package/assets/scaffold/core/scripts/rebuild-companies-index.sh +10 -1
- package/assets/scaffold/core/scripts/rebuild-company-knowledge-index.sh +10 -1
- package/assets/scaffold/core/scripts/rebuild-projects-index.sh +10 -1
- package/assets/scaffold/core/scripts/register-project.sh +110 -19
- package/contracts/host-canary-release.json +7 -7
- package/dist/command-catalog.generated.d.ts +1 -1
- package/dist/command-catalog.generated.js +1 -1
- package/dist/commands/core-delegate-w1b.js +107 -16
- package/dist/commands/core-delegate.d.ts +7 -0
- package/dist/commands/core-delegate.js +66 -2
- package/dist/commands/core-handoff-fast.d.ts +1 -1
- package/dist/commands/core-handoff-fast.js +2 -2
- package/dist/commands/core-handoff.d.ts +3 -1
- package/dist/commands/core-handoff.js +1407 -177
- package/dist/commands/core-register-project-native.js +1 -1
- package/dist/commands/core.js +2 -2
- package/dist/commands/files.d.ts +2 -0
- package/dist/commands/files.js +34 -5
- package/dist/commands/team-sync.js +1 -1
- package/dist/lib/company-skill-wrapper.js +72 -4
- package/dist/lib/daemon/requests.d.ts +14 -1
- package/dist/lib/daemon/requests.js +17 -3
- package/dist/lib/daemon/run.js +44 -2
- package/dist/lib/daemon/supervisor.d.ts +11 -0
- package/dist/lib/daemon/supervisor.js +33 -0
- package/dist/lib/daemon/sync-perf-telemetry.d.ts +85 -0
- package/dist/lib/daemon/sync-perf-telemetry.js +206 -0
- package/dist/lib/daemon/windows-relaunch.d.ts +55 -0
- package/dist/lib/daemon/windows-relaunch.js +72 -0
- package/dist/lib/hook-engine/coverage.d.ts +10 -1
- package/dist/lib/hook-engine/coverage.js +41 -5
- package/dist/lib/index-render/companies.js +3 -2
- package/dist/lib/index-render/index.js +2 -1
- package/dist/lib/index-render/session-scope.d.ts +2 -3
- package/dist/lib/index-render/session-scope.js +2 -5
- package/dist/lib/index-render/shared.d.ts +7 -0
- package/dist/lib/index-render/shared.js +9 -0
- package/dist/lib/work-context/windows-acl.d.ts +14 -0
- package/dist/lib/work-context/windows-acl.js +26 -0
- package/dist/utils/cli-telemetry.d.ts +26 -7
- package/dist/utils/cli-telemetry.js +70 -13
- package/dist/utils/git.js +1 -1
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/sync-perf-telemetry-flag.d.ts +26 -0
- package/dist/utils/sync-perf-telemetry-flag.js +32 -0
- package/dist/utils/telemetry-opt-out.d.ts +13 -0
- package/dist/utils/telemetry-opt-out.js +19 -0
- package/package.json +8 -8
|
@@ -10,12 +10,68 @@ die() {
|
|
|
10
10
|
exit 1
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
# The named company's own record decides its uid (.company-uid, then the
|
|
14
|
+
# manifest cloud_uid). HQ_COMPANY_UID is accepted only when it matches that
|
|
15
|
+
# record: a session may export it for another company, and trusting it would
|
|
16
|
+
# register this company's project in that company's Work Mesh.
|
|
17
|
+
# A company with no recorded uid can still register with HQ_COMPANY_UID when
|
|
18
|
+
# the active company (HQ_COMPANY_SLUG, else the session's bound company_slug)
|
|
19
|
+
# is the named company and no other company records that uid.
|
|
13
20
|
resolve_uid() {
|
|
14
|
-
local company="$1"
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
local company="$1" uid
|
|
22
|
+
uid="$(recorded_uid "$company")"
|
|
23
|
+
if [ -z "$uid" ]; then
|
|
24
|
+
uid="$(active_company_env_uid "$company")"
|
|
25
|
+
[ -n "$uid" ] || die "no company uid for $company (set companies/$company/.company-uid or manifest cloud_uid, or run with HQ_COMPANY_UID while $company is the active company)"
|
|
26
|
+
printf '%s\n' "$uid"
|
|
17
27
|
return
|
|
18
28
|
fi
|
|
29
|
+
if [ -n "${HQ_COMPANY_UID:-}" ] && [ "$HQ_COMPANY_UID" != "$uid" ]; then
|
|
30
|
+
die "HQ_COMPANY_UID does not match $company's recorded uid; refusing to register into another company's Work Mesh"
|
|
31
|
+
fi
|
|
32
|
+
printf '%s\n' "$uid"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# --- active-company HQ_COMPANY_UID check (shared shape with
|
|
36
|
+
# work-mesh-project-registration-offer.sh) ---
|
|
37
|
+
active_company_slug() {
|
|
38
|
+
local slug="${HQ_COMPANY_SLUG:-}"
|
|
39
|
+
if [ -z "$slug" ] && [ -f "$ROOT/core/scripts/hq-session.sh" ]; then
|
|
40
|
+
slug="$(env HQ_ROOT="$ROOT" HQ_HQ_SESSION_NO_CLI=1 \
|
|
41
|
+
bash "$ROOT/core/scripts/hq-session.sh" get company_slug 2>/dev/null | tr -d '[:space:]' || true)"
|
|
42
|
+
fi
|
|
43
|
+
printf '%s\n' "$slug"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Prints HQ_COMPANY_UID only when it is well formed, the active company is the
|
|
47
|
+
# named company, and no other company records that uid. Prints nothing
|
|
48
|
+
# otherwise.
|
|
49
|
+
active_company_env_uid() {
|
|
50
|
+
local company="$1" env_uid="${HQ_COMPANY_UID:-}" active
|
|
51
|
+
[[ "$env_uid" =~ ^cmp_[A-Za-z0-9]{3,128}$ ]] || return 0
|
|
52
|
+
active="$(active_company_slug)"
|
|
53
|
+
[ -n "$active" ] && [ "$active" = "$company" ] || return 0
|
|
54
|
+
if uid_recorded_elsewhere "$company" "$env_uid"; then
|
|
55
|
+
return 0
|
|
56
|
+
fi
|
|
57
|
+
printf '%s\n' "$env_uid"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
uid_recorded_elsewhere() {
|
|
61
|
+
local company="$1" uid="$2" f manifest="$ROOT/companies/manifest.yaml"
|
|
62
|
+
for f in "$ROOT"/companies/*/.company-uid; do
|
|
63
|
+
[ -f "$f" ] || continue
|
|
64
|
+
[ "$(basename "$(dirname "$f")")" = "$company" ] && continue
|
|
65
|
+
[ "$(tr -d '[:space:]' < "$f")" = "$uid" ] && return 0
|
|
66
|
+
done
|
|
67
|
+
[ -f "$manifest" ] || return 1
|
|
68
|
+
tr -d '\r' < "$manifest" | awk -v uid="$uid" '
|
|
69
|
+
$1 == "cloud_uid:" { v=$2; gsub(/["\047]/, "", v); if (v == uid) found=1 }
|
|
70
|
+
END { exit !found }'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
recorded_uid() {
|
|
74
|
+
local company="$1"
|
|
19
75
|
local file="$ROOT/companies/$company/.company-uid"
|
|
20
76
|
if [ -f "$file" ]; then
|
|
21
77
|
tr -d '[:space:]' < "$file"
|
|
@@ -37,7 +93,6 @@ resolve_uid() {
|
|
|
37
93
|
return
|
|
38
94
|
fi
|
|
39
95
|
fi
|
|
40
|
-
die "no company uid for $company (set HQ_COMPANY_UID, companies/$company/.company-uid, or manifest cloud_uid)"
|
|
41
96
|
}
|
|
42
97
|
|
|
43
98
|
mesh_project_id_for_prd() {
|
|
@@ -93,6 +148,22 @@ board_path() {
|
|
|
93
148
|
printf '%s\n' "$ROOT/companies/$1/board.json"
|
|
94
149
|
}
|
|
95
150
|
|
|
151
|
+
# Refuse when more than one Board entry matches the project being registered.
|
|
152
|
+
# Updating every match used to keep a duplicate id alive on the board
|
|
153
|
+
# (feedback_2b8e4bc8). $3 is the jq select() filter; extra args are jq --arg
|
|
154
|
+
# pairs it uses. The hq-cli native port prints the same message.
|
|
155
|
+
refuse_ambiguous_board_match() {
|
|
156
|
+
local company="$1" project="$2" filter="$3" board ids count list
|
|
157
|
+
shift 3
|
|
158
|
+
board="$(board_path "$company")"
|
|
159
|
+
[ -f "$board" ] || return 0
|
|
160
|
+
ids="$(jq -r "$@" "[.projects[]? | select($filter) | (.id // \"(no id)\" | tostring)] | .[]" "$board" 2>/dev/null | tr -d '\r')" || return 0
|
|
161
|
+
count="$(printf '%s\n' "$ids" | grep -c . || true)"
|
|
162
|
+
[ "${count:-0}" -gt 1 ] || return 0
|
|
163
|
+
list="$(printf '%s\n' "$ids" | grep . | paste -s -d ',' - | sed 's/,/, /g')"
|
|
164
|
+
die "registration refused: $count Board entries in companies/$company/board.json match $project (ids: $list). Remove or renumber the duplicates so one entry remains, then re-run. \`bash core/scripts/board-project-id.sh check $company\` lists every duplicate id."
|
|
165
|
+
}
|
|
166
|
+
|
|
96
167
|
mark_pending() {
|
|
97
168
|
local company="$1" project="$2"
|
|
98
169
|
local board prd rel now title tmp
|
|
@@ -142,12 +213,17 @@ register_one() {
|
|
|
142
213
|
local mesh_project
|
|
143
214
|
mesh_project="$(mesh_project_id_for_prd "$company" "$project")"
|
|
144
215
|
[ -f "$prd" ] || die "registration incomplete: missing $prd"
|
|
216
|
+
refuse_ambiguous_board_match "$company" "$project" \
|
|
217
|
+
'.id == $mesh or .id == $project or .prd_path == $path or .mesh_project_id == $mesh or .mesh_project_id == $project' \
|
|
218
|
+
--arg mesh "$mesh_project" --arg project "$project" --arg path "companies/$company/projects/$project/prd.json"
|
|
219
|
+
local uid
|
|
220
|
+
uid="$(resolve_uid "$company")"
|
|
145
221
|
if ! cli_has_project_ensure; then
|
|
146
222
|
mark_pending "$company" "$project"
|
|
147
223
|
die "hq-cli ${MIN_HQ_CLI} or newer is required; ${company}/${project} stays local until then"
|
|
148
224
|
fi
|
|
149
225
|
local ensure_json
|
|
150
|
-
if ! ensure_json="$(hq mesh project ensure "$mesh_project" --company "$company" --stories-file "$prd" --json)"; then
|
|
226
|
+
if ! ensure_json="$(HQ_COMPANY_UID="$uid" hq mesh project ensure "$mesh_project" --company "$company" --stories-file "$prd" --json)"; then
|
|
151
227
|
echo "registration incomplete: hq mesh project ensure failed for $company/$project" >&2
|
|
152
228
|
exit 1
|
|
153
229
|
fi
|
|
@@ -213,33 +289,46 @@ register_one() {
|
|
|
213
289
|
}
|
|
214
290
|
|
|
215
291
|
register_brainstorm() {
|
|
216
|
-
local company="$1" project="$2" board title description ensure_json thread channel tmp
|
|
217
|
-
|
|
292
|
+
local company="$1" project="$2" board title description ensure_json thread channel tmp uid
|
|
293
|
+
# Pin the child CLI to the named company's uid so an ambient or cached
|
|
294
|
+
# company context cannot send this Board entry to another company's mesh.
|
|
295
|
+
uid="$(resolve_uid "$company")"
|
|
218
296
|
board="$(board_path "$company")"
|
|
219
297
|
[ -f "$board" ] || die "registration incomplete: missing $board"
|
|
298
|
+
refuse_ambiguous_board_match "$company" "$project" '.id == $id or .mesh_project_id == $id' --arg id "$project"
|
|
220
299
|
title="$(jq -r --arg id "$project" '[.projects[]? | select(.id == $id or .mesh_project_id == $id)] | first | .title // empty' "$board" | tr -d '\r')"
|
|
221
300
|
description="$(jq -r --arg id "$project" '[.projects[]? | select(.id == $id or .mesh_project_id == $id)] | first | .description // empty' "$board" | tr -d '\r')"
|
|
222
301
|
[ -n "$title" ] || die "registration incomplete: missing local Board project $company/$project"
|
|
223
|
-
if ! ensure_json="$(hq mesh project set "$project" --company "$company" --name "$title" --description "$description" --create --json)"; then
|
|
302
|
+
if ! ensure_json="$(HQ_COMPANY_UID="$uid" hq mesh project set "$project" --company "$company" --name "$title" --description "$description" --create --json)"; then
|
|
224
303
|
die "registration incomplete: hq mesh project set failed for $company/$project"
|
|
225
304
|
fi
|
|
226
|
-
thread="$(printf '%s' "$ensure_json" | jq -
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
[ -
|
|
305
|
+
thread="$(printf '%s' "$ensure_json" | jq -r '.registration.threadId // .threadId // empty' 2>/dev/null | tr -d '\r')" || thread=""
|
|
306
|
+
channel="$(printf '%s' "$ensure_json" | jq -r '.registration.channelId // .channelId // empty' 2>/dev/null | tr -d '\r')" || channel=""
|
|
307
|
+
# `project set` on an already-registered project can return no thread or
|
|
308
|
+
# channel. Fall back to the ids the local Board entry already records.
|
|
309
|
+
if [ -z "$thread" ]; then
|
|
310
|
+
thread="$(jq -r --arg id "$project" '[.projects[]? | select(.id == $id or .mesh_project_id == $id)] | first | .threadId // empty' "$board" | tr -d '\r')"
|
|
311
|
+
fi
|
|
312
|
+
if [ -z "$channel" ]; then
|
|
313
|
+
channel="$(jq -r --arg id "$project" '[.projects[]? | select(.id == $id or .mesh_project_id == $id)] | first | .channelId // empty' "$board" | tr -d '\r')"
|
|
314
|
+
fi
|
|
315
|
+
[ -n "$thread" ] || die "registration incomplete: project set output missing threadId"
|
|
316
|
+
[ -n "$channel" ] || die "registration incomplete: project set output missing channelId"
|
|
231
317
|
tmp="$(mktemp)"
|
|
232
318
|
jq --arg id "$project" --arg thread "$thread" --arg channel "$channel" --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" '
|
|
233
319
|
.projects |= map(if .id == $id or .mesh_project_id == $id then . + {
|
|
234
|
-
threadId:$thread, channelId:$channel, mesh_project_id:$id,
|
|
235
|
-
|
|
236
|
-
} | del(.pending_registration) else . end)
|
|
320
|
+
threadId:$thread, channelId:$channel, mesh_project_id:$id, updated_at:$now
|
|
321
|
+
} | del(.pending_registration, .mesh_registration_prompt_state) else . end)
|
|
237
322
|
' "$board" > "$tmp"
|
|
238
323
|
mv "$tmp" "$board"
|
|
239
324
|
jq -e --arg id "$project" --arg thread "$thread" --arg channel "$channel" \
|
|
240
325
|
'any(.projects[]?; (.id == $id or .mesh_project_id == $id) and .threadId == $thread and .channelId == $channel)' \
|
|
241
326
|
"$board" >/dev/null || die "registration incomplete: local Board registration did not verify"
|
|
242
327
|
echo "registered $company/$project thread=$thread channel=$channel"
|
|
328
|
+
# Once the project has a prd.json, --board also syncs its stories.
|
|
329
|
+
if [ -f "$ROOT/companies/$company/projects/$project/prd.json" ]; then
|
|
330
|
+
register_one "$company" "$project"
|
|
331
|
+
fi
|
|
243
332
|
}
|
|
244
333
|
|
|
245
334
|
audit() {
|
|
@@ -313,8 +402,10 @@ retry_pending() {
|
|
|
313
402
|
done < <(jq -r '[.projects[]? | select(.pending_registration == true) | .id // empty] | .[]' "$board" 2>/dev/null | tr -d '\r' || true)
|
|
314
403
|
}
|
|
315
404
|
|
|
316
|
-
if [ "${1:-}" = "--brainstorm" ]; then
|
|
317
|
-
|
|
405
|
+
if [ "${1:-}" = "--board" ] || [ "${1:-}" = "--brainstorm" ]; then
|
|
406
|
+
# --board registers a Board entry that has no prd.json yet (a brainstorm or
|
|
407
|
+
# PRD that just started). --brainstorm is the older spelling of the same mode.
|
|
408
|
+
[ "$#" -eq 3 ] || die "usage: register-project.sh --board <company> <board-project-id>"
|
|
318
409
|
register_brainstorm "$2" "$3"
|
|
319
410
|
elif [ "${1:-}" = "--audit" ]; then
|
|
320
411
|
audit "${2:-}"
|
|
@@ -326,5 +417,5 @@ elif [ "${1:-}" = "--retry-pending" ]; then
|
|
|
326
417
|
elif [ $# -eq 2 ]; then
|
|
327
418
|
register_one "$1" "$2"
|
|
328
419
|
else
|
|
329
|
-
die "usage: register-project.sh <company> <project> | --
|
|
420
|
+
die "usage: register-project.sh <company> <project> | --board <company> <board-project-id> | --audit <company> | --backfill <company> --only-active [--yes] | --retry-pending <company>"
|
|
330
421
|
fi
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "hq.host-canary-release.v1",
|
|
3
|
-
"cliVersion": "5.345.
|
|
3
|
+
"cliVersion": "5.345.257",
|
|
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-25T20:07:54.394Z",
|
|
9
|
+
"engineVersion": "0.3.1+hq.5.345.257.src.c469d58a7b027d94faefc6a1d4b18ffed5c6a52cdcf89f7c9158542d4e2527dc",
|
|
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-25T20:08:38.408Z",
|
|
15
|
+
"engineVersion": "0.3.1+hq.5.345.257.src.c469d58a7b027d94faefc6a1d4b18ffed5c6a52cdcf89f7c9158542d4e2527dc",
|
|
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-25T20:09:12.395Z",
|
|
21
|
+
"engineVersion": "0.3.1+hq.5.345.257.src.c469d58a7b027d94faefc6a1d4b18ffed5c6a52cdcf89f7c9158542d4e2527dc",
|
|
22
22
|
"gateSha256": "ecdbab7c2e0a1d94eb9c98f15e760390f215bc7115a217ded24b4275322722d2"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
@@ -3239,7 +3239,7 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
3239
3239
|
}, {
|
|
3240
3240
|
readonly flags: "--confirmation <token>";
|
|
3241
3241
|
readonly description: "Send an hqdc_ delete confirmation token with a real company-vault delete; asks you to type the confirmation in a terminal first (not with --dry-run or --personal)";
|
|
3242
|
-
readonly hidden:
|
|
3242
|
+
readonly hidden: true;
|
|
3243
3243
|
}];
|
|
3244
3244
|
readonly subcommands: readonly [];
|
|
3245
3245
|
}, {
|
|
@@ -3905,7 +3905,7 @@ export const COMMAND_CATALOG = [
|
|
|
3905
3905
|
{
|
|
3906
3906
|
"flags": "--confirmation <token>",
|
|
3907
3907
|
"description": "Send an hqdc_ delete confirmation token with a real company-vault delete; asks you to type the confirmation in a terminal first (not with --dry-run or --personal)",
|
|
3908
|
-
"hidden":
|
|
3908
|
+
"hidden": true
|
|
3909
3909
|
}
|
|
3910
3910
|
],
|
|
3911
3911
|
"subcommands": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Native implementations of the second Wave 1 delegate command family. */
|
|
2
2
|
import { daemonWhoamiOutput } from "../lib/daemon/whoami-cache.js";
|
|
3
|
-
import { createHash, randomInt } from "node:crypto";
|
|
3
|
+
import { createHash, randomBytes, randomInt } from "node:crypto";
|
|
4
4
|
import { acquireDelegateLock } from "../utils/delegate-lock.js";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as os from "node:os";
|
|
@@ -10,7 +10,7 @@ import { serializeJqJson } from "../lib/core-utils/jq-json-serializer.js";
|
|
|
10
10
|
import { shellDisplayPath } from "../lib/core-utils/shell-display-path.js";
|
|
11
11
|
import { matchingSecretPatterns } from "../lib/core-utils/secret-patterns.js";
|
|
12
12
|
import { describeCoreCommand } from "./core-command-catalog.js";
|
|
13
|
-
import { commandExists, delegateDiagnosticPath, isRecord, jsonAt, jqFallback, jqRawPath, jqRawPaths, moveFile, readJsonFile, subprocess, writeJsonAtomically, } from "./core-delegate.js";
|
|
13
|
+
import { commandExists, delegateDiagnosticPath, delegateRepoDirectory, isRecord, jsonAt, jqFallback, jqRawPath, jqRawPaths, moveFile, readJsonFile, subprocess, writeJsonAtomically, } from "./core-delegate.js";
|
|
14
14
|
import { resolveLiveRoot } from "../utils/hq-roots.js";
|
|
15
15
|
import { engineOwnedVaultsFromState } from "../lib/sync-core/engine-owned.js";
|
|
16
16
|
import { ACL_SOURCE_DISPLAY_LABELS } from "../utils/files-browse-acl.js";
|
|
@@ -38,7 +38,7 @@ const DESCRIPTIONS = {
|
|
|
38
38
|
const USAGE = {
|
|
39
39
|
bundle: "hq-delegate-bundle.sh — freeze a project into a portable delegation bundle.\n\nUsage:\n core/scripts/hq-delegate-bundle.sh build \\\n --company <slug> --project <name> --to <principal> \\\n [--to-kind person|agent] [--to-name <display name>] \\\n [--mode transfer|share] [--dry-run]\n\n--dry-run prints the manifest JSON to stdout and writes nothing.\n\nWrites workspace/delegations/<delegationId>/{manifest.json,BRIEF.md} and\n",
|
|
40
40
|
grant: "hq-delegate-grant.sh — materialize a delegation's dossier in the vault and\nwrite the ACL grants its manifest declares, verifying each one landed.\n\nUsage:\n core/scripts/hq-delegate-grant.sh --manifest <path> [--yes]\n\nWithout --yes: prints the full grant plan (prefix, principal, permission —\nthe write grant is a privilege escalation and needs explicit confirmation)\nand exits 2 without mutating anything. The caller (the /delegate skill)\nconfirms with the user, then re-invokes with --yes.\n\nWith --yes:\n 1. hq sync push the project directory so the vault prefix exists\n 2. hq files share each manifest vaultPrefix to the recipient\n 3. read each grant back with hq files acl and match grantee + permission\n 4. advance manifest status building -> granted, stamping verifiedAt\n\nWhen the new sync engine owns the company vault on this machine, the CLI\nrefuses `hq sync push`. Step 1 is then skipped, and after the grants the\nhelper waits for the engine to upload the dossier and referenced files\n(lib/delegate-engine.sh) before it advances the status.\n\nDirect ACL grants ONLY — this helper never mints a share-session URL\n(policy hq-delegate-never-inlines-secrets-or-share-urls).\n\nIdempotent: a prefix whose grant already exists is reported, not an error.\nA failed read-back exits non-zero and leaves manifest status unchanged.\n\n",
|
|
41
|
-
send: "hq-delegate-send.sh — generate the self-sufficient pickup prompt for a\ndelegation and deliver it by DM. The prompt IS the handoff: pasted into a\nfresh agent session on a clean HQ install, it pulls every file on demand\n(hq files get per prefix — no /hq-sync run) and reaches the first\nnext-step with no follow-up question to the delegator.\n\nUsage:\n core/scripts/hq-delegate-send.sh --manifest <path> [--send]\n [--headline <text>] [--note <text>]\n\nWithout --send: (re)generates PICKUP-PROMPT.md next to the manifest and\nprints its path — inspectable, idempotent, sends nothing.\nWith --send: requires manifest status \"verified\" (the US-008 probe must\nhave passed), then delivers ONE `hq dm` with --prompt-file/--details-file\nand advances status to \"sent\", recording the DM eventId.\n\nThe caller (the /delegate skill) humanizes --headline / --note per\ncore/knowledge/public/hq-core/humanize-before-send.md (channel dm, light)\nBEFORE invoking; this helper never rewrites recipients, flags, or the\ngenerated command lines.\n\nFail-closed: the generated prompt is scanned for secret-shaped content and\nshare-session URLs; a match aborts before anything is written or sent\n(policy hq-delegate-never-inlines-secrets-or-share-urls).\n\n",
|
|
41
|
+
send: "hq-delegate-send.sh — generate the self-sufficient pickup prompt for a\ndelegation and deliver it by DM. The prompt IS the handoff: pasted into a\nfresh agent session on a clean HQ install, it pulls every file on demand\n(hq files get per prefix — no /hq-sync run) and reaches the first\nnext-step with no follow-up question to the delegator.\n\nUsage:\n core/scripts/hq-delegate-send.sh --manifest <path> [--send]\n [--headline <text>] [--note <text>]\n core/scripts/hq-delegate-send.sh --manifest <path> --reconcile <eventId>\n\n--reconcile records an already-delivered handoff DM (sent outside this\nhelper) by eventId: status granted|verified|sending -> sent, so\nhq-delegate-pickup.sh can --check it. Sends nothing.\n\nWithout --send: (re)generates PICKUP-PROMPT.md next to the manifest and\nprints its path — inspectable, idempotent, sends nothing.\nWith --send: requires manifest status \"verified\" (the US-008 probe must\nhave passed), then delivers ONE `hq dm` with --prompt-file/--details-file\nand advances status to \"sent\", recording the DM eventId. An explicit hq dm\nrefusal returns status to \"verified\" (nothing was delivered); other\nfailures leave it \"sending\" for --reconcile.\n\nThe caller (the /delegate skill) humanizes --headline / --note per\ncore/knowledge/public/hq-core/humanize-before-send.md (channel dm, light)\nBEFORE invoking; this helper never rewrites recipients, flags, or the\ngenerated command lines.\n\nFail-closed: the generated prompt is scanned for secret-shaped content and\nshare-session URLs; a match aborts before anything is written or sent\n(policy hq-delegate-never-inlines-secrets-or-share-urls).\n\nEnv: HQ_ROOT — HQ root override (default: resolved from script location)\n",
|
|
42
42
|
verify: "hq-delegate-verify.sh — prove a delegation can actually be picked up\nbefore anyone is told it is theirs, or print the full plan without\ntouching anything.\n\nUsage (probe mode — after grants, before the DM):\n core/scripts/hq-delegate-verify.sh --manifest <path>\n\nProbes every manifest vaultPrefix with `hq files browse` and requires it\nreachable AND non-empty. All pass -> manifest advances granted -> verified\n(send is gated on this). Any failure -> non-zero, the failing prefix and\nlikely cause named, status left at its last successful value so a re-run\nresumes without re-granting.\n\nUsage (dry-run mode — full plan, zero mutation):\n core/scripts/hq-delegate-verify.sh --dry-run \\\n --company <slug> --project <name> --to <principal> [--mode transfer|share]\n\nPrints recipient, mode, project stage (prd, or brainstorm with the dossier\nfiles and the /plan next step), every prefix with its permission, the secret\nnames an .env.schema would grant, repo + branch, and the DM headline that\nwould be sent. Exits 0. Creates nothing under workspace/delegations/ and\ninvokes no mutating command.\n\n",
|
|
43
43
|
publish: "usage: --manifest <path>",
|
|
44
44
|
};
|
|
@@ -88,19 +88,54 @@ function jsonText(value) { return serializeJqJson(value, "pretty"); }
|
|
|
88
88
|
function checksum(file) {
|
|
89
89
|
return createHash("sha256").update(fs.readFileSync(file)).digest("hex");
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const CHECKSUM_CAP = 200;
|
|
92
|
+
const CHECKSUM_PRUNED_NAMES = new Set([
|
|
93
|
+
"node_modules",
|
|
94
|
+
".git",
|
|
95
|
+
".venv",
|
|
96
|
+
"venv",
|
|
97
|
+
"__pycache__",
|
|
98
|
+
".next",
|
|
99
|
+
".turbo",
|
|
100
|
+
".cache",
|
|
101
|
+
]);
|
|
102
|
+
const CLOUD_PLACEHOLDER_PREFIX = Buffer.from("HQ-CLOUD-FILE v1", "utf8");
|
|
103
|
+
function isOffloadedCloudPlaceholder(file) {
|
|
104
|
+
let fd;
|
|
105
|
+
try {
|
|
106
|
+
fd = fs.openSync(file, "r");
|
|
107
|
+
const header = Buffer.alloc(CLOUD_PLACEHOLDER_PREFIX.length);
|
|
108
|
+
const bytesRead = fs.readSync(fd, header, 0, header.length, 0);
|
|
109
|
+
return bytesRead === header.length && header.equals(CLOUD_PLACEHOLDER_PREFIX);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
if (fd !== undefined)
|
|
116
|
+
fs.closeSync(fd);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function collectProjectChecksums(root, projectDir) {
|
|
120
|
+
// Shell `find <projectDir> \( -name ... \) -prune` prunes at depth 0 if the project folder name itself matches.
|
|
121
|
+
if (CHECKSUM_PRUNED_NAMES.has(path.basename(projectDir)))
|
|
122
|
+
return { files: [], total: 0 };
|
|
123
|
+
const relativePaths = [];
|
|
93
124
|
const visit = (directory) => {
|
|
94
125
|
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
126
|
+
if (CHECKSUM_PRUNED_NAMES.has(entry.name))
|
|
127
|
+
continue;
|
|
95
128
|
const file = path.join(directory, entry.name);
|
|
96
129
|
if (entry.isDirectory())
|
|
97
130
|
visit(file);
|
|
98
|
-
else if (entry.isFile() && entry.name !== ".DS_Store")
|
|
99
|
-
|
|
131
|
+
else if (entry.isFile() && entry.name !== ".DS_Store") {
|
|
132
|
+
relativePaths.push(path.relative(root, file).split(path.sep).join("/"));
|
|
133
|
+
}
|
|
100
134
|
}
|
|
101
135
|
};
|
|
102
|
-
visit(
|
|
103
|
-
|
|
136
|
+
visit(projectDir);
|
|
137
|
+
relativePaths.sort((left, right) => Buffer.compare(Buffer.from(left, "utf8"), Buffer.from(right, "utf8")));
|
|
138
|
+
return { total: relativePaths.length, files: relativePaths.slice(0, CHECKSUM_CAP) };
|
|
104
139
|
}
|
|
105
140
|
function secretScan(name, files) {
|
|
106
141
|
let bad = false;
|
|
@@ -316,6 +351,18 @@ function runBundle(args, context, onMalformedWhoami) {
|
|
|
316
351
|
const fromUid = text(identityValue.personUid) || text(identityValue.agentUid) || null;
|
|
317
352
|
const knowledge = (stage === "prd" ? list(getPath(prd, "metadata.knowledge", [])) : [])
|
|
318
353
|
.filter((entry) => typeof entry === "string").map(String);
|
|
354
|
+
const companyPrefix = `companies/${company}/`;
|
|
355
|
+
for (const kpath of knowledge) {
|
|
356
|
+
if (!kpath || !kpath.startsWith(companyPrefix) || kpath.endsWith("/"))
|
|
357
|
+
continue;
|
|
358
|
+
const kfile = `${root}/${kpath}`;
|
|
359
|
+
if (!fs.existsSync(kfile)) {
|
|
360
|
+
err(`hq-delegate-bundle: WARNING knowledge entry not found locally, so it was probably never uploaded: ${kpath} (hq sync push it or drop it from metadata.knowledge)\n`);
|
|
361
|
+
}
|
|
362
|
+
else if (isRegularFile(kfile) && isOffloadedCloudPlaceholder(kfile)) {
|
|
363
|
+
err(`hq-delegate-bundle: WARNING knowledge entry is an offloaded placeholder, not file content: ${kpath} (restore it before delegating)\n`);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
319
366
|
const readPrefixes = [...new Set(knowledge.filter((entry) => entry.startsWith(`companies/${company}/`)).map((entry) => {
|
|
320
367
|
const relative = entry.slice(`companies/${company}/`.length);
|
|
321
368
|
if (relative.endsWith("/"))
|
|
@@ -350,12 +397,17 @@ function runBundle(args, context, onMalformedWhoami) {
|
|
|
350
397
|
if (isRecord(boardEntry) && jqTrue(boardEntry.id))
|
|
351
398
|
boardId = boardEntry.id;
|
|
352
399
|
}
|
|
400
|
+
const collectedChecksums = collectProjectChecksums(root, projectDir);
|
|
401
|
+
if (collectedChecksums.total > CHECKSUM_CAP) {
|
|
402
|
+
err(`hq-delegate-bundle: project has ${collectedChecksums.total} files; checksummed the first ${CHECKSUM_CAP}\n`);
|
|
403
|
+
}
|
|
353
404
|
const checksums = {};
|
|
354
|
-
for (const
|
|
355
|
-
checksums[path.
|
|
405
|
+
for (const relativeFile of collectedChecksums.files)
|
|
406
|
+
checksums[relativeFile] = checksum(path.join(root, relativeFile));
|
|
356
407
|
const createdAt = currentTime();
|
|
357
408
|
const idTime = createdAt.replace(/[-:TZ]/g, "").slice(0, 8) + "-" + createdAt.slice(11, 19).replaceAll(":", "");
|
|
358
|
-
const
|
|
409
|
+
const delegationSuffix = randomBytes(3).toString("hex");
|
|
410
|
+
const delegationId = `dlg-${idTime}-${delegationSuffix}-${project}`;
|
|
359
411
|
const policies = knowledge.filter((entry) => entry.startsWith(`companies/${company}/policies/`));
|
|
360
412
|
const projectManifest = stage === "prd"
|
|
361
413
|
? { name: project, stage, prdPath: `${projectRelative}/prd.json`, sourcePath: `${projectRelative}/prd.json`, boardId }
|
|
@@ -1445,9 +1497,25 @@ function runSend(args, context) {
|
|
|
1445
1497
|
// The pickup DM is read by the person and acted on by their agent. Only an
|
|
1446
1498
|
// agent or bot may tag it `both`; a person login sends `human`.
|
|
1447
1499
|
const audience = callerIsMachinePrincipal() ? "both" : "human";
|
|
1448
|
-
const dm =
|
|
1449
|
-
if (dm.
|
|
1500
|
+
const dm = subprocess("hq", ["dm", principal, headline, "--audience", audience, "--prompt-file", prompt, "--details-file", brief], context.cwd, { stdout: "capture", stderr: "pipe" });
|
|
1501
|
+
if (dm.stderrBytes?.length)
|
|
1502
|
+
err(dm.stderrBytes);
|
|
1503
|
+
else if (dm.stderr)
|
|
1504
|
+
err(dm.stderr);
|
|
1505
|
+
if (dm.code !== 0) {
|
|
1506
|
+
const dmStderr = dm.stderr ?? dm.stderrBytes?.toString("utf8") ?? "";
|
|
1507
|
+
if (/People can only send human messages|is for agents and bots only/.test(dmStderr)) {
|
|
1508
|
+
manifest.status = "verified";
|
|
1509
|
+
try {
|
|
1510
|
+
writeJsonAtomically(manifestPath, manifest, true, context.atomicWriteFileSystem);
|
|
1511
|
+
}
|
|
1512
|
+
catch {
|
|
1513
|
+
return fail("send", "hq dm refused the pickup DM (nothing sent) but status could not be restored; it reads sending");
|
|
1514
|
+
}
|
|
1515
|
+
return fail("send", "hq dm refused the pickup DM; nothing was sent and status is back to verified, so a retry is safe");
|
|
1516
|
+
}
|
|
1450
1517
|
return fail("send", "hq dm delivery outcome is uncertain; status is sending, inspect DM history before retrying");
|
|
1518
|
+
}
|
|
1451
1519
|
const event = /eventId[: ]+([A-Za-z0-9_-]+)/.exec(dm.stdout ?? "")?.[1] ?? "";
|
|
1452
1520
|
if (!event)
|
|
1453
1521
|
return fail("send", "DM response has no receipt; status is sending, reconcile DM history before retrying");
|
|
@@ -1532,7 +1600,11 @@ function runVerify(args, context) {
|
|
|
1532
1600
|
return fail("verify", "could not derive the delegation plan (see builder error above)");
|
|
1533
1601
|
}
|
|
1534
1602
|
const repoRelative = jqRawPath(manifest, "repo.path");
|
|
1535
|
-
const
|
|
1603
|
+
const repoAbs = repoRelative ? delegateRepoDirectory(root, repoRelative) : "";
|
|
1604
|
+
const candidates = [
|
|
1605
|
+
path.join(root, "companies", company, "projects", project, ".env.schema"),
|
|
1606
|
+
...(repoAbs ? [`${repoAbs}/.env.schema`] : []),
|
|
1607
|
+
];
|
|
1536
1608
|
const schema = candidates.find((candidate) => fs.existsSync(candidate) && fs.statSync(candidate).isFile());
|
|
1537
1609
|
let secretNames = "(none — no .env.schema found)";
|
|
1538
1610
|
if (schema) {
|
|
@@ -1634,11 +1706,30 @@ function runVerify(args, context) {
|
|
|
1634
1706
|
out(`hq-delegate-verify: probing ${refs.length} referenced knowledge/policy file(s)\n`);
|
|
1635
1707
|
for (const reference of refs) {
|
|
1636
1708
|
const relative = reference.slice(`companies/${company}/`.length);
|
|
1709
|
+
if (relative.endsWith("/")) {
|
|
1710
|
+
const listing = browseParent(relative);
|
|
1711
|
+
const compact = listing.replace(/\s/g, "");
|
|
1712
|
+
if (!compact || compact === "Noobjectsunderthatprefix.") {
|
|
1713
|
+
out(` FAIL ${relative} — referenced folder is EMPTY or not in the vault (likely cause: its files were never pushed — hq sync push ${reference} --company ${company} and re-run)\n`);
|
|
1714
|
+
failed = true;
|
|
1715
|
+
}
|
|
1716
|
+
else {
|
|
1717
|
+
out(` pass ${relative} (folder)\n`);
|
|
1718
|
+
}
|
|
1719
|
+
continue;
|
|
1720
|
+
}
|
|
1637
1721
|
const separator = relative.lastIndexOf("/");
|
|
1638
1722
|
const parent = `${separator < 0 ? "." : relative.slice(0, separator)}/`;
|
|
1639
1723
|
const listing = browseParent(parent);
|
|
1640
|
-
if (browseContainsExactKey(listing, reference))
|
|
1724
|
+
if (browseContainsExactKey(listing, reference)) {
|
|
1641
1725
|
out(` pass ${relative}\n`);
|
|
1726
|
+
}
|
|
1727
|
+
else if (browseParent(`${relative}/`).includes(`${reference}/`)) {
|
|
1728
|
+
out(` pass ${relative} (folder)\n`);
|
|
1729
|
+
}
|
|
1730
|
+
else if (subprocess("hq", ["files", "cat", relative, "--company", company], context.cwd, { stdout: "ignore", stderr: "ignore" }).code === 0) {
|
|
1731
|
+
out(` pass ${relative} (read back)\n`);
|
|
1732
|
+
}
|
|
1642
1733
|
else {
|
|
1643
1734
|
out(` FAIL ${relative} — granted prefix is reachable but this referenced file is NOT in the vault (likely cause: it was never pushed — hq sync push ${reference} --company ${company} and re-run)\n`);
|
|
1644
1735
|
failed = true;
|
|
@@ -57,6 +57,13 @@ export declare function writeJsonAtomically(target: string, value: unknown, sibl
|
|
|
57
57
|
export declare function delegateDiagnosticPath(argument: string): string;
|
|
58
58
|
export declare function scanSecretFiles(file: string): string[] | undefined;
|
|
59
59
|
export { delegateBoardPath, delegateRepoDirectory, secretsSourcePaths };
|
|
60
|
+
/**
|
|
61
|
+
* Move Work Mesh project ownership and the delegator's open stories to the
|
|
62
|
+
* recipient with `hq mesh project reassign`. "confirmed" only when the server
|
|
63
|
+
* names the recipient as owner; "not-registered" when the project has no
|
|
64
|
+
* board; otherwise "unconfirmed" and the transfer continues.
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveBoardMeshProjectId(boardDocument: JsonRecord, project: string, prdPath: string): string;
|
|
60
67
|
export declare function runNative(name: DelegateName, args: string[], context: DelegateContext): number;
|
|
61
68
|
/** Fast-entry adapter; family gating and shell fallback happen before import. */
|
|
62
69
|
export declare function runDelegateFast(args: readonly string[], _stdin: string, cwd: string, hqRoot: string | undefined, commandName: string): number;
|
|
@@ -1003,7 +1003,58 @@ function runSecrets(args, context) {
|
|
|
1003
1003
|
* names the recipient as owner; "not-registered" when the project has no
|
|
1004
1004
|
* board; otherwise "unconfirmed" and the transfer continues.
|
|
1005
1005
|
*/
|
|
1006
|
-
function
|
|
1006
|
+
export function resolveBoardMeshProjectId(boardDocument, project, prdPath) {
|
|
1007
|
+
const projectsValue = boardDocument.projects;
|
|
1008
|
+
const projects = Array.isArray(projectsValue)
|
|
1009
|
+
? projectsValue
|
|
1010
|
+
: isRecord(projectsValue) ? Object.values(projectsValue) : [];
|
|
1011
|
+
// Match jq `[.projects[]? | select(...)] | first`: any non-null, non-object entry errors out to empty string.
|
|
1012
|
+
if (projects.some((entry) => entry !== null && !isRecord(entry)))
|
|
1013
|
+
return "";
|
|
1014
|
+
const match = projects.find((entry) => isRecord(entry)
|
|
1015
|
+
&& (entry.id === project || entry.mesh_project_id === project || (prdPath !== "" && entry.prd_path === prdPath)));
|
|
1016
|
+
if (!isRecord(match) || !jqTruthy(match.mesh_project_id))
|
|
1017
|
+
return "";
|
|
1018
|
+
return rawJsonValue(match.mesh_project_id).replaceAll("\r", "");
|
|
1019
|
+
}
|
|
1020
|
+
function resolveCachedMeshProjectId(root, company, project) {
|
|
1021
|
+
let companyUid;
|
|
1022
|
+
try {
|
|
1023
|
+
companyUid = fs.readFileSync(path.join(root, "companies", company, ".company-uid"), "utf8").replace(/\s+/g, "");
|
|
1024
|
+
}
|
|
1025
|
+
catch {
|
|
1026
|
+
return "";
|
|
1027
|
+
}
|
|
1028
|
+
if (!companyUid)
|
|
1029
|
+
return "";
|
|
1030
|
+
const cacheBase = process.env.HQ_WORK_MESH_CACHE_DIR
|
|
1031
|
+
|| path.join(process.env.HOME || os.homedir(), ".hq", "work-mesh", "cache", "projects");
|
|
1032
|
+
const cacheDir = path.join(cacheBase, companyUid);
|
|
1033
|
+
let entries;
|
|
1034
|
+
try {
|
|
1035
|
+
entries = fs.readdirSync(cacheDir).sort((left, right) => (left < right ? -1 : left > right ? 1 : 0));
|
|
1036
|
+
}
|
|
1037
|
+
catch {
|
|
1038
|
+
return "";
|
|
1039
|
+
}
|
|
1040
|
+
for (const entry of entries) {
|
|
1041
|
+
if (!entry.startsWith(`${project}-`) || !entry.endsWith(".json"))
|
|
1042
|
+
continue;
|
|
1043
|
+
const suffix = entry.slice(project.length + 1, -".json".length);
|
|
1044
|
+
if (!/^[0-9a-f]{12}$/.test(suffix))
|
|
1045
|
+
continue;
|
|
1046
|
+
try {
|
|
1047
|
+
if (!fs.statSync(path.join(cacheDir, entry)).isFile())
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
catch {
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
return entry.slice(0, -".json".length);
|
|
1054
|
+
}
|
|
1055
|
+
return "";
|
|
1056
|
+
}
|
|
1057
|
+
function reassignMeshProject(document, prd, boardDocument, root, company, project, prdPath, delegationId, context, prefix) {
|
|
1007
1058
|
let toUid = jqRawPaths(document, ["to.uid", "to.personUid", "to.agentUid", "to.principal"]);
|
|
1008
1059
|
let meshProject = project;
|
|
1009
1060
|
if (prd !== undefined) {
|
|
@@ -1015,6 +1066,19 @@ function reassignMeshProject(document, prd, company, project, delegationId, cont
|
|
|
1015
1066
|
}
|
|
1016
1067
|
}
|
|
1017
1068
|
}
|
|
1069
|
+
// Without an explicit metadata id, resolve the board of record: the board.json
|
|
1070
|
+
// entry mesh_project_id, then a suffixed cache slug (<project>-<12 hex>).
|
|
1071
|
+
if (meshProject === project) {
|
|
1072
|
+
const boardMesh = resolveBoardMeshProjectId(boardDocument, project, prdPath);
|
|
1073
|
+
if (boardMesh) {
|
|
1074
|
+
meshProject = boardMesh;
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
const cachedMesh = resolveCachedMeshProjectId(root, company, project);
|
|
1078
|
+
if (cachedMesh)
|
|
1079
|
+
meshProject = cachedMesh;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1018
1082
|
// The mesh directory matches uids, not emails: look up the personUid from
|
|
1019
1083
|
// company membership first, and pass the email through if that fails.
|
|
1020
1084
|
if (toUid.includes("@")) {
|
|
@@ -1178,7 +1242,7 @@ function runTransfer(args, context) {
|
|
|
1178
1242
|
const mesh = subprocess("hq", ["mesh", "session", "note", "--enqueue", "--session-id", sessionId, "--seq", "1", "--harness", "claude-code", "--adapter-version", "1.0.0", "--company-slug", company, "--project", project, "--summary", `Delegated to ${display} (${principal}) — delegation ${delegationId}; ownership transferred`], context.cwd, { stdout: "inherit" });
|
|
1179
1243
|
if (mesh.code !== 0)
|
|
1180
1244
|
writeErr(`${prefix} mesh note failed; authoritative mesh ownership remains unconfirmed\n`);
|
|
1181
|
-
meshOwnership = reassignMeshProject(document, stage === "prd" ? prd : undefined, company, project, delegationId, context, prefix);
|
|
1245
|
+
meshOwnership = reassignMeshProject(document, stage === "prd" ? prd : undefined, boardDocument, root, company, project, prdPath, delegationId, context, prefix);
|
|
1182
1246
|
}
|
|
1183
1247
|
const journalDir = path.join(projectDir, "journal");
|
|
1184
1248
|
const journal = path.join(journalDir, "delegations.md");
|
|
@@ -13,6 +13,6 @@ export declare function handoffFinalizeHelpResult(args: readonly string[], root:
|
|
|
13
13
|
* Keep cheap help/launch paths in this small module. Commands that do the
|
|
14
14
|
* actual handoff work load the existing implementation only when invoked.
|
|
15
15
|
*/
|
|
16
|
-
export declare function runHandoffFastEntry(args: readonly string[], stdin: string, cwd: string, hqRoot: string | undefined, commandName: string): Promise<number>;
|
|
16
|
+
export declare function runHandoffFastEntry(args: readonly string[], stdin: string, cwd: string, hqRoot: string | undefined, commandName: string, hqRootArg?: string): Promise<number>;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=core-handoff-fast.d.ts.map
|
|
@@ -88,7 +88,7 @@ async function launchHandoffPost(args, root) {
|
|
|
88
88
|
* Keep cheap help/launch paths in this small module. Commands that do the
|
|
89
89
|
* actual handoff work load the existing implementation only when invoked.
|
|
90
90
|
*/
|
|
91
|
-
export async function runHandoffFastEntry(args, stdin, cwd, hqRoot, commandName) {
|
|
91
|
+
export async function runHandoffFastEntry(args, stdin, cwd, hqRoot, commandName, hqRootArg) {
|
|
92
92
|
const root = hqRoot ?? cwd;
|
|
93
93
|
if (commandName === "post" && process.env.HQ_NATIVE_HANDOFF_POST_CHILD !== "1") {
|
|
94
94
|
return await launchHandoffPost(args, root);
|
|
@@ -104,6 +104,6 @@ export async function runHandoffFastEntry(args, stdin, cwd, hqRoot, commandName)
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
const handoff = await import("./core-handoff.js");
|
|
107
|
-
return await handoff.runHandoffFast(args, stdin, cwd, root, commandName);
|
|
107
|
+
return await handoff.runHandoffFast(args, stdin, cwd, root, commandName, hqRootArg);
|
|
108
108
|
}
|
|
109
109
|
//# sourceMappingURL=core-handoff-fast.js.map
|
|
@@ -10,6 +10,8 @@ type RunResult = {
|
|
|
10
10
|
type HandoffContext = {
|
|
11
11
|
root: string;
|
|
12
12
|
cwd: string;
|
|
13
|
+
/** Unresolved logical root (symlink alias) when distinct from physical root. */
|
|
14
|
+
logicalRoot?: string;
|
|
13
15
|
now?: () => Date;
|
|
14
16
|
/** Test-only override for the finalizer's historical fixed /tmp paths. */
|
|
15
17
|
tmpDir?: string;
|
|
@@ -26,7 +28,7 @@ export declare function runHandoffAutofile(args: string[], context: HandoffConte
|
|
|
26
28
|
export declare function runHandoffArchiveDecision(args: string[], context: HandoffContext): RunResult;
|
|
27
29
|
export declare function runHandoffFlow(args: string[], context: HandoffContext): Promise<RunResult>;
|
|
28
30
|
/** Fast-entry adapter; the shared family flag is resolved before this module loads. */
|
|
29
|
-
export declare function runHandoffFast(args: readonly string[], _stdin: string, _cwd: string, hqRoot: string | undefined, commandName: string): Promise<number>;
|
|
31
|
+
export declare function runHandoffFast(args: readonly string[], _stdin: string, _cwd: string, hqRoot: string | undefined, commandName: string, hqRootArg?: string): Promise<number>;
|
|
30
32
|
/** Register native handoff commands behind the shared default-off flag. */
|
|
31
33
|
export declare function registerCoreHandoffCommand(core: Command): void;
|
|
32
34
|
//# sourceMappingURL=core-handoff.d.ts.map
|