@indigoai-us/hq-cli 5.345.238 → 5.345.242

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.
Files changed (206) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/assets/scaffold/core/scripts/hq-delegate-grant.sh +170 -8
  3. package/assets/scaffold/core/scripts/hq-delegate-publish.sh +21 -1
  4. package/assets/scaffold/core/scripts/hq-delegate-repo.sh +7 -1
  5. package/assets/scaffold/core/scripts/hq-delegate-secrets.sh +95 -20
  6. package/assets/scaffold/core/scripts/hq-delegate-transfer.sh +57 -9
  7. package/assets/scaffold/core/scripts/lib/delegate-engine.sh +77 -0
  8. package/dist/command-catalog.generated.d.ts +212 -10
  9. package/dist/command-catalog.generated.js +260 -10
  10. package/dist/command-registration-plan.d.ts +6 -0
  11. package/dist/command-registration-plan.js +1 -0
  12. package/dist/commands/cloud-off-gate.d.ts +9 -8
  13. package/dist/commands/cloud-off-gate.js +41 -40
  14. package/dist/commands/cloud.d.ts +17 -2
  15. package/dist/commands/cloud.js +126 -24
  16. package/dist/commands/core-delegate-w1b.js +333 -27
  17. package/dist/commands/core-delegate.d.ts +2 -1
  18. package/dist/commands/core-delegate.js +209 -48
  19. package/dist/commands/core-handoff.js +1 -1
  20. package/dist/commands/core-job-model-auth.d.ts +95 -0
  21. package/dist/commands/core-job-model-auth.js +247 -0
  22. package/dist/commands/core-job-run-native.js +280 -12
  23. package/dist/commands/core.js +1 -0
  24. package/dist/commands/deploy-comments.js +8 -2
  25. package/dist/commands/deploy-events.d.ts +40 -0
  26. package/dist/commands/deploy-events.js +300 -0
  27. package/dist/commands/doctor.d.ts +4 -4
  28. package/dist/commands/doctor.js +2 -2
  29. package/dist/commands/feedback.js +2 -3
  30. package/dist/commands/files-browse.js +2 -0
  31. package/dist/commands/files.js +4 -0
  32. package/dist/commands/integrations-core.d.ts +11 -0
  33. package/dist/commands/integrations-core.js +15 -1
  34. package/dist/commands/keyed-sync-pull.d.ts +12 -0
  35. package/dist/commands/keyed-sync-pull.js +151 -0
  36. package/dist/commands/lanes-link.js +2 -2
  37. package/dist/commands/lanes-loop.d.ts +2 -2
  38. package/dist/commands/lanes-loop.js +5 -5
  39. package/dist/commands/lanes-questions.js +1 -1
  40. package/dist/commands/lanes-stories.js +1 -1
  41. package/dist/commands/lanes.js +80 -14
  42. package/dist/commands/library-add.d.ts +5 -2
  43. package/dist/commands/library-add.js +22 -9
  44. package/dist/commands/mcp-registration.d.ts +4 -18
  45. package/dist/commands/mcp-registration.js +9 -29
  46. package/dist/commands/mesh.d.ts +4 -0
  47. package/dist/commands/mesh.js +25 -5
  48. package/dist/commands/pack-install.d.ts +2 -3
  49. package/dist/commands/pack-install.js +6 -8
  50. package/dist/commands/rescue.d.ts +3 -2
  51. package/dist/commands/rescue.js +48 -34
  52. package/dist/commands/search.d.ts +6 -0
  53. package/dist/commands/search.js +24 -4
  54. package/dist/commands/secrets.d.ts +3 -4
  55. package/dist/commands/secrets.js +3 -20
  56. package/dist/commands/sources.js +6 -2
  57. package/dist/commands/sync-core.d.ts +8 -0
  58. package/dist/commands/sync-core.js +43 -0
  59. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +1830 -1468
  60. package/dist/hq-cloud-sync-runner/package.json +1 -1
  61. package/dist/lib/bot/api.d.ts +2 -1
  62. package/dist/lib/bot/api.js +2 -15
  63. package/dist/lib/capacity/accounts.d.ts +1 -1
  64. package/dist/lib/capacity/accounts.js +1 -1
  65. package/dist/lib/capacity/collectors/claude-oauth.d.ts +0 -2
  66. package/dist/lib/capacity/collectors/claude-oauth.js +0 -5
  67. package/dist/lib/capacity/freshness.d.ts +1 -1
  68. package/dist/lib/capacity/freshness.js +1 -1
  69. package/dist/lib/capacity/route.js +1 -1
  70. package/dist/lib/core-utils/delegate-helper-paths.d.ts +26 -0
  71. package/dist/lib/core-utils/delegate-helper-paths.js +33 -0
  72. package/dist/lib/daemon/catalog.d.ts +3 -0
  73. package/dist/lib/daemon/hook-requests.d.ts +1 -1
  74. package/dist/lib/daemon/hook-requests.js +4 -2
  75. package/dist/lib/daemon/jq-provision.d.ts +63 -0
  76. package/dist/lib/daemon/jq-provision.js +155 -0
  77. package/dist/lib/daemon/lanes-reconcile-guard.d.ts +4 -3
  78. package/dist/lib/daemon/lanes-reconcile-guard.js +4 -4
  79. package/dist/lib/daemon/mesh-owner.d.ts +4 -0
  80. package/dist/lib/daemon/mesh-owner.js +20 -0
  81. package/dist/lib/daemon/ops/policy.d.ts +3 -0
  82. package/dist/lib/daemon/ops/policy.js +32 -4
  83. package/dist/lib/daemon/run.js +17 -22
  84. package/dist/lib/daemon/server.d.ts +6 -0
  85. package/dist/lib/daemon/server.js +5 -0
  86. package/dist/lib/daemon/verified-jq.d.ts +96 -0
  87. package/dist/lib/daemon/verified-jq.js +337 -0
  88. package/dist/lib/doctor/checks/jq.js +16 -0
  89. package/dist/lib/doctor/deep/executor.d.ts +7 -0
  90. package/dist/lib/doctor/deep/executor.js +1 -1
  91. package/dist/lib/doctor/deep/parity.js +1 -27
  92. package/dist/lib/doctor/deep/sandbox.d.ts +2 -2
  93. package/dist/lib/doctor/deep/sandbox.js +3 -19
  94. package/dist/lib/doctor/fix/refresh-sync-handoff.js +52 -21
  95. package/dist/lib/doctor/fixtures/discover.d.ts +2 -0
  96. package/dist/lib/doctor/fixtures/discover.js +1 -1
  97. package/dist/lib/doctor/json-output.d.ts +1 -1
  98. package/dist/lib/doctor/registry.d.ts +6 -7
  99. package/dist/lib/doctor/registry.js +6 -7
  100. package/dist/lib/doctor/report.d.ts +9 -10
  101. package/dist/lib/doctor/report.js +4 -4
  102. package/dist/lib/environment/work-requirements.d.ts +1 -1
  103. package/dist/lib/environment/work-requirements.js +1 -1
  104. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  105. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  106. package/dist/lib/hook-engine/coverage.js +11 -3
  107. package/dist/lib/hook-engine/git-stop-config.json +510 -510
  108. package/dist/lib/hook-engine/native-precompact-compatibility.json +443 -443
  109. package/dist/lib/hook-engine/native-stop-compatibility.json +359 -359
  110. package/dist/lib/hot-channels/adapters/meetings.d.ts +1 -16
  111. package/dist/lib/hot-channels/adapters/meetings.js +3 -28
  112. package/dist/lib/hot-channels/adapters/slack.d.ts +3 -1
  113. package/dist/lib/hot-channels/adapters/slack.js +4 -1
  114. package/dist/lib/hot-channels/contract.d.ts +14 -0
  115. package/dist/lib/hot-channels/fleet-complete.d.ts +18 -2
  116. package/dist/lib/hot-channels/fleet-complete.js +29 -4
  117. package/dist/lib/hot-channels/meeting-source-ref.d.ts +17 -0
  118. package/dist/lib/hot-channels/meeting-source-ref.js +32 -0
  119. package/dist/lib/hot-channels/prompts/signals-pass.md +6 -1
  120. package/dist/lib/hot-channels/run.d.ts +10 -0
  121. package/dist/lib/hot-channels/run.js +34 -0
  122. package/dist/lib/hot-channels/signals-pass.d.ts +27 -0
  123. package/dist/lib/hot-channels/signals-pass.js +57 -2
  124. package/dist/lib/hot-channels/signals-runtime.js +3 -2
  125. package/dist/lib/jq/install.d.ts +27 -0
  126. package/dist/lib/jq/install.js +156 -0
  127. package/dist/lib/lanes/accounts.js +2 -2
  128. package/dist/lib/lanes/claude-balance.d.ts +6 -0
  129. package/dist/lib/lanes/claude-balance.js +124 -0
  130. package/dist/lib/lanes/grants.js +15 -2
  131. package/dist/lib/lanes/hq-root.d.ts +1 -1
  132. package/dist/lib/lanes/hq-root.js +1 -1
  133. package/dist/lib/lanes/links.d.ts +1 -1
  134. package/dist/lib/lanes/liveness.d.ts +3 -0
  135. package/dist/lib/lanes/liveness.js +61 -7
  136. package/dist/lib/lanes/models.d.ts +1 -1
  137. package/dist/lib/lanes/models.js +1 -1
  138. package/dist/lib/lanes/outpost-dispatch.d.ts +1 -1
  139. package/dist/lib/lanes/outpost-dispatch.js +13 -13
  140. package/dist/lib/lanes/outpost-pruner-install.js +1 -1
  141. package/dist/lib/lanes/questions.d.ts +1 -1
  142. package/dist/lib/lanes/questions.js +2 -2
  143. package/dist/lib/lanes/spawn.js +4 -6
  144. package/dist/lib/lanes/store.d.ts +13 -2
  145. package/dist/lib/lanes/store.js +13 -5
  146. package/dist/lib/lanes/types.d.ts +7 -7
  147. package/dist/lib/lanes/types.js +1 -1
  148. package/dist/lib/lanes/watcher-main.js +1 -1
  149. package/dist/lib/lanes/watcher.d.ts +1 -1
  150. package/dist/lib/lanes/watcher.js +1 -1
  151. package/dist/lib/mesh/live/daemon/doctor.js +7 -1
  152. package/dist/lib/mesh/live/daemon/install.d.ts +4 -0
  153. package/dist/lib/mesh/live/daemon/install.js +10 -0
  154. package/dist/lib/mesh/live/daemon/run.js +17 -0
  155. package/dist/lib/mesh/live/emit-retry.d.ts +20 -2
  156. package/dist/lib/mesh/live/emit-retry.js +57 -4
  157. package/dist/lib/mesh/live/emit.js +25 -4
  158. package/dist/lib/mesh/live/flush.d.ts +2 -0
  159. package/dist/lib/mesh/live/flush.js +21 -8
  160. package/dist/lib/mesh/live/spool.d.ts +9 -1
  161. package/dist/lib/mesh/live/spool.js +41 -29
  162. package/dist/lib/onboarding/cli/onboard.js +5 -0
  163. package/dist/lib/signals/sanitize.d.ts +19 -0
  164. package/dist/lib/signals/sanitize.js +103 -7
  165. package/dist/lib/signals/steps/upload.d.ts +40 -1
  166. package/dist/lib/signals/steps/upload.js +122 -6
  167. package/dist/lib/sync-core/access-refresh.d.ts +29 -0
  168. package/dist/lib/sync-core/access-refresh.js +97 -0
  169. package/dist/lib/sync-core/company-adoption.d.ts +33 -0
  170. package/dist/lib/sync-core/company-adoption.js +223 -0
  171. package/dist/lib/sync-core/engine-home.d.ts +1 -0
  172. package/dist/lib/sync-core/engine-owned.d.ts +13 -0
  173. package/dist/lib/sync-core/engine-owned.js +38 -0
  174. package/dist/lib/sync-core/hand-back.d.ts +17 -0
  175. package/dist/lib/sync-core/hand-back.js +23 -0
  176. package/dist/lib/sync-core/post-apply-reindex.d.ts +33 -0
  177. package/dist/lib/sync-core/post-apply-reindex.js +149 -0
  178. package/dist/lib/sync-core/reconcile.d.ts +10 -0
  179. package/dist/lib/sync-core/reconcile.js +117 -12
  180. package/dist/lib/sync-core/rollout-state.d.ts +11 -1
  181. package/dist/lib/sync-core/rollout-state.js +40 -4
  182. package/dist/lib/vault-sync-switches.d.ts +14 -0
  183. package/dist/lib/vault-sync-switches.js +22 -0
  184. package/dist/lib/windows/jq.d.ts +4 -0
  185. package/dist/lib/windows/jq.js +10 -39
  186. package/dist/lib/workers-registry/index.d.ts +1 -1
  187. package/dist/lib/workers-registry/index.js +8 -12
  188. package/dist/utils/callback-port-busy.d.ts +2 -2
  189. package/dist/utils/callback-port-busy.js +2 -2
  190. package/dist/utils/cli-network-lifecycle.js +1 -0
  191. package/dist/utils/client-health-contract.d.ts +2 -0
  192. package/dist/utils/client-health-contract.js +1 -1
  193. package/dist/utils/client-health.js +1 -9
  194. package/dist/utils/cognito-config.js +5 -0
  195. package/dist/utils/cognito-session.d.ts +4 -6
  196. package/dist/utils/cognito-session.js +4 -24
  197. package/dist/utils/github-tag-fallback.d.ts +16 -0
  198. package/dist/utils/github-tag-fallback.js +126 -0
  199. package/dist/utils/incomplete-install-error.js +1 -11
  200. package/dist/utils/install-tree-torn.d.ts +11 -0
  201. package/dist/utils/install-tree-torn.js +1 -1
  202. package/dist/utils/resident-package-preload.js +2 -1
  203. package/dist/utils/version-report.d.ts +2 -1
  204. package/dist/utils/version-report.js +40 -27
  205. package/docs/anywhere-runtime.md +8 -0
  206. package/package.json +9 -9
@@ -14,9 +14,11 @@
14
14
  # 2. prd.json metadata gains owner, delegatedFrom, delegatedAt; for a
15
15
  # brainstorm-stage project the same three keys land in the
16
16
  # brainstorm.md frontmatter (owner, delegated_from, delegated_at)
17
- # 3. work-mesh: `done` event closes the delegator's in-progress thread and
18
- # broadcasts the reassignment; silently skipped when the helper is
19
- # unavailable (local/offline installs) — the transfer still succeeds
17
+ # 3. work-mesh: a thread note broadcasts the reassignment and
18
+ # `hq mesh project reassign` transfers project ownership and the
19
+ # delegator's open stories; manifest workMeshOwnership becomes
20
+ # "confirmed" only on a server receipt naming the recipient. Silently
21
+ # skipped when hq is unavailable — the transfer still succeeds
20
22
  # 4. a dated "Delegated" stanza is appended to the project journal naming
21
23
  # the recipient, delegation id, and transferred scope
22
24
  #
@@ -166,17 +168,63 @@ else
166
168
  fi
167
169
 
168
170
  # --- 3. work mesh: close the delegator's thread, broadcast reassignment ------
171
+ MESH_OWNERSHIP="unconfirmed"
172
+ TO_UID="$(jq -r '.to.uid // .to.personUid // .to.agentUid // .to.principal // empty' "$MANIFEST")"
173
+ MESH_PROJECT="$PROJECT"
174
+ if [ "$STAGE" = prd ]; then
175
+ MESH_PROJECT="$(jq -r --arg p "$PROJECT" '.metadata.workMeshProjectId // .metadata.projectId // $p' "$PRD_ABS" 2>/dev/null || printf '%s' "$PROJECT")"
176
+ fi
169
177
  # Silently tolerated when unavailable (local/offline installs no-op).
170
178
 
171
179
  if command -v hq >/dev/null 2>&1; then
172
180
  # `--session-id` is the CLI option (hq-cli 5.157+ rejects `--session` with
173
181
  # "unknown option"); --company-slug/--project attribute the note to the
174
182
  # delegated project.
175
- hq mesh session note --enqueue --session-id "${HQ_SESSION_ID:-delegate}" --seq 1 \
183
+ #
184
+ # The session id must be unique per delegation. The mesh keys session
185
+ # ownership on (company, sessionId): a shared literal such as "delegate" is
186
+ # owned by whoever ran the first delegation in the company, and every later
187
+ # delegator is rejected with SESSION_OWNER_MISMATCH even as company owner.
188
+ MESH_SESSION_ID="${HQ_SESSION_ID:-$DELEGATION_ID}"
189
+ hq mesh session note --enqueue --session-id "$MESH_SESSION_ID" --seq 1 \
176
190
  --harness claude-code --adapter-version 1.0.0 \
177
191
  --company-slug "$COMPANY" --project "$PROJECT" \
178
192
  --summary "Delegated to $DISPLAY ($PRINCIPAL) — delegation $DELEGATION_ID; ownership transferred" \
179
193
  || echo "hq-delegate-transfer: mesh note failed; authoritative mesh ownership remains unconfirmed" >&2
194
+
195
+ # Authoritative transfer: `hq mesh project reassign` moves project thread
196
+ # ownership and the delegator's open stories to the recipient. Confirmed only
197
+ # when the server answers with the recipient as owner; an older CLI or server
198
+ # (unknown command, 404) leaves ownership "unconfirmed" and the run continues.
199
+ # PROJECT_VIEW_NOT_FOUND or PROJECT_THREAD_NOT_FOUND (any stage, PRD or
200
+ # brainstorm) means the project was never registered on the board:
201
+ # there is nothing to reassign, so that is "not-registered", not "unconfirmed".
202
+ # The mesh directory matches uids, not emails. A recipient resolved by
203
+ # hq-delegate-resolve.sh is often known only by email, so look up the
204
+ # personUid from company membership first. If that fails, the email is
205
+ # passed through and the reassign reports unconfirmed as before.
206
+ case "$TO_UID" in
207
+ *@*)
208
+ RESOLVED_UID="$(hq people resolve "$TO_UID" --company "$COMPANY" --membership-only --json 2>/dev/null \
209
+ | jq -r 'select(.status == "found") | .person.personUid // empty' 2>/dev/null || true)"
210
+ case "$RESOLVED_UID" in prs_*) TO_UID="$RESOLVED_UID" ;; esac
211
+ ;;
212
+ esac
213
+ REASSIGN_ERR="$(mktemp)"
214
+ REASSIGN_OUT="$(hq mesh project reassign "$MESH_PROJECT" --company "$COMPANY" \
215
+ --to "$TO_UID" --include-open-stories \
216
+ --note "Delegated via /delegate ($DELEGATION_ID)" --json 2>"$REASSIGN_ERR" || true)"
217
+ REASSIGN_ERR_TEXT="$(cat "$REASSIGN_ERR" 2>/dev/null || true)"
218
+ rm -f "$REASSIGN_ERR"
219
+ if printf '%s' "$REASSIGN_OUT" | jq -e --arg to "$TO_UID" \
220
+ '(.ok != false) and ((.ownerUid // "") != "") and ((.ownerUid == $to) or ($to | test("@")))' >/dev/null 2>&1; then
221
+ MESH_OWNERSHIP="confirmed"
222
+ elif printf '%s\n%s' "$REASSIGN_OUT" "$REASSIGN_ERR_TEXT" | grep -Eq 'PROJECT_(VIEW|THREAD)_NOT_FOUND'; then
223
+ MESH_OWNERSHIP="not-registered"
224
+ echo "hq-delegate-transfer: project $MESH_PROJECT has no Work Mesh board; local ownership is authoritative; nothing to reassign. To track it on the board, register it with \`hq mesh project register\` (see \`hq mesh project --help\`)" >&2
225
+ else
226
+ echo "hq-delegate-transfer: hq mesh project reassign did not confirm; Work Mesh ownership remains unconfirmed" >&2
227
+ fi
180
228
  fi
181
229
 
182
230
  # --- 4. journal: one dated stanza per delegation id --------------------------
@@ -203,9 +251,9 @@ if ! grep -qF "$DELEGATION_ID" "$JOURNAL_FILE"; then
203
251
  echo "- To: $DISPLAY ($PRINCIPAL)"
204
252
  echo "- Transferred scope: $SCOPE"
205
253
  if [ "$STAGE" = prd ]; then
206
- echo "- Local board and PRD ownership updated; Work Mesh ownership is unconfirmed. Existing delegator access is unchanged."
254
+ echo "- Local board and PRD ownership updated; Work Mesh ownership is $MESH_OWNERSHIP. Existing delegator access is unchanged."
207
255
  else
208
- echo "- Brainstorm-stage project (no PRD yet). Local board and brainstorm.md ownership updated; Work Mesh ownership is unconfirmed. Existing delegator access is unchanged."
256
+ echo "- Brainstorm-stage project (no PRD yet). Local board and brainstorm.md ownership updated; Work Mesh ownership is $MESH_OWNERSHIP. Existing delegator access is unchanged."
209
257
  fi
210
258
  } >> "$JOURNAL_FILE"
211
259
  fi
@@ -213,11 +261,11 @@ fi
213
261
  # --- record on the manifest ---------------------------------------------------
214
262
 
215
263
  TMP_MANIFEST="$(mktemp)"
216
- jq --arg now "$NOW" '.ownershipTransferredAt = $now | .workMeshOwnership = "unconfirmed"' "$MANIFEST" > "$TMP_MANIFEST" \
264
+ jq --arg now "$NOW" --arg mesh "$MESH_OWNERSHIP" '.ownershipTransferredAt = $now | .workMeshOwnership = $mesh' "$MANIFEST" > "$TMP_MANIFEST" \
217
265
  && mv "$TMP_MANIFEST" "$MANIFEST"
218
266
 
219
267
  if [ "$STAGE" = prd ]; then
220
- echo "hq-delegate-transfer: ownership of '$PROJECT' transferred to $DISPLAY ($PRINCIPAL) — local board, PRD, and journal updated; Work Mesh ownership unconfirmed"
268
+ echo "hq-delegate-transfer: ownership of '$PROJECT' transferred to $DISPLAY ($PRINCIPAL) — local board, PRD, and journal updated; Work Mesh ownership $MESH_OWNERSHIP"
221
269
  else
222
- echo "hq-delegate-transfer: ownership of '$PROJECT' (brainstorm stage) transferred to $DISPLAY ($PRINCIPAL) — local board, brainstorm.md, and journal updated; Work Mesh ownership unconfirmed"
270
+ echo "hq-delegate-transfer: ownership of '$PROJECT' (brainstorm stage) transferred to $DISPLAY ($PRINCIPAL) — local board, brainstorm.md, and journal updated; Work Mesh ownership $MESH_OWNERSHIP"
223
271
  fi
@@ -0,0 +1,77 @@
1
+ # shellcheck shell=bash
2
+ # hq-core: public
3
+ # delegate-engine.sh — /delegate helpers for a company vault that the new sync
4
+ # engine (hq-syncd) owns on this machine. The CLI refuses `hq sync push` for
5
+ # such a vault, so the helpers share the folder and wait for the engine to
6
+ # upload the files instead of pushing them.
7
+ #
8
+ # Env: HQ_DELEGATE_ENGINE_WAIT_SECONDS (default 180) bounds each wait;
9
+ # HQ_DELEGATE_ENGINE_POLL_SECONDS (default 5) is the read-back interval.
10
+
11
+ hq_delegate_sha256() {
12
+ if command -v sha256sum >/dev/null 2>&1; then sha256sum | cut -d ' ' -f1; else shasum -a 256 | cut -d ' ' -f1; fi
13
+ }
14
+
15
+ # True when `hq sync-core status --json` lists <company> in full mode and not
16
+ # in `held` (the CLI's own ownership rule). A CLI without the command, or any
17
+ # read error, counts as not engine-owned, which keeps the `hq sync push` path.
18
+ hq_delegate_engine_owns_vault() {
19
+ local status
20
+ status="$(hq sync-core status --json 2>/dev/null)" || return 1
21
+ printf '%s' "$status" | jq -e --arg co "$1" \
22
+ '[(.held // [])[] | .uid | ascii_downcase] as $held
23
+ | any(.vaults[]? | select(. != null);
24
+ .kind == "company" and .phase == "full"
25
+ and ((.slug // "") | ascii_downcase) == ($co | ascii_downcase)
26
+ and ((.uid | ascii_downcase) as $uid | $held | index([$uid]) | not))' >/dev/null 2>&1
27
+ }
28
+
29
+ # HQ_DELEGATE_ENGINE_WAIT_SECONDS as whole seconds; 180 when unset or not a
30
+ # whole number.
31
+ hq_delegate_engine_wait_seconds() {
32
+ case "${HQ_DELEGATE_ENGINE_WAIT_SECONDS:-}" in
33
+ ''|*[!0-9]*) echo 180 ;;
34
+ *) echo "$((10#$HQ_DELEGATE_ENGINE_WAIT_SECONDS))" ;;
35
+ esac
36
+ }
37
+
38
+ # Why the engine may never upload a file, for the wait-failure messages.
39
+ HQ_DELEGATE_ENGINE_WAIT_CAUSES='the engine skips a file an ignore rule matches, a symlink, or a path this machine is not granted'
40
+
41
+ # hq_delegate_wait_for_cloud <company> <company-relative vault path> <sha256>
42
+ # Polls `hq files cat` until it succeeds and the vault holds exactly those
43
+ # bytes. A failed read never matches, even the hash of an empty file.
44
+ hq_delegate_wait_for_cloud() {
45
+ local company="$1" path="$2" expected="$3" got deadline tmp
46
+ deadline=$((SECONDS + $(hq_delegate_engine_wait_seconds)))
47
+ tmp="$(mktemp "${TMPDIR:-/tmp}/hq-delegate-cat.XXXXXX")" || return 1
48
+ while :; do
49
+ if hq files cat "$path" --company "$company" > "$tmp" 2>/dev/null; then
50
+ got="$(hq_delegate_sha256 < "$tmp")"
51
+ if [ "$got" = "$expected" ]; then rm -f "$tmp"; return 0; fi
52
+ fi
53
+ if [ "$SECONDS" -ge "$deadline" ]; then rm -f "$tmp"; return 1; fi
54
+ sleep "${HQ_DELEGATE_ENGINE_POLL_SECONDS:-5}"
55
+ done
56
+ }
57
+
58
+ # hq_delegate_engine_pin <hq root> <company> <company-relative path>...
59
+ # Adds the paths to <hq root>/.hq/pins.json. A member in `shared` or `custom`
60
+ # sync mode has a pull scope of explicit grants plus these pins, and the engine
61
+ # never uploads a local file outside that scope. The engine re-reads the pins
62
+ # on every cycle.
63
+ hq_delegate_engine_pin() {
64
+ local root="$1" company="$2" file tmp
65
+ shift 2
66
+ file="$root/.hq/pins.json"
67
+ mkdir -p "$root/.hq" || return 1
68
+ [ -s "$file" ] || printf '{"version":1,"pins":{}}\n' > "$file" || return 1
69
+ tmp="$(mktemp "$file.tmp.XXXXXX")" || return 1
70
+ if jq --arg co "$company" \
71
+ '.pins[$co] = (((.pins[$co] // []) + $ARGS.positional) | unique)' "$file" --args "$@" > "$tmp"; then
72
+ mv -f "$tmp" "$file"
73
+ else
74
+ rm -f "$tmp"
75
+ return 1
76
+ fi
77
+ }
@@ -943,6 +943,10 @@ export declare const COMMAND_CATALOG: readonly [{
943
943
  readonly helpText: readonly [];
944
944
  readonly arguments: readonly [];
945
945
  readonly options: readonly [{
946
+ readonly flags: "--company-slug <slug>";
947
+ readonly description: "Trusted local layout slug; required with HQ_API_KEY and --company cmp_…";
948
+ readonly hidden: false;
949
+ }, {
946
950
  readonly flags: "--hq-root <path>";
947
951
  readonly description: "Local HQ tree root (default: <runtime-path>)";
948
952
  readonly hidden: false;
@@ -6907,6 +6911,10 @@ export declare const COMMAND_CATALOG: readonly [{
6907
6911
  readonly flags: "--cloud-update";
6908
6912
  readonly description: "Cloud-update mode";
6909
6913
  readonly hidden: false;
6914
+ }, {
6915
+ readonly flags: "--verbose";
6916
+ readonly description: "Show diagnostic details when recovery fails";
6917
+ readonly hidden: false;
6910
6918
  }];
6911
6919
  readonly subcommands: readonly [];
6912
6920
  }, {
@@ -8620,7 +8628,7 @@ export declare const COMMAND_CATALOG: readonly [{
8620
8628
  readonly arguments: readonly [];
8621
8629
  readonly options: readonly [{
8622
8630
  readonly flags: "--size <size>";
8623
- readonly description: "Outpost size: small | medium | large | xlarge. Without it, a terminal shows a menu with prices and medium preselected; a script gets the default, $100/month";
8631
+ readonly description: "Outpost size: small | medium | large | xlarge. Without it, a terminal shows a menu with prices and small ($100/month) preselected; a script sends no size and is billed the small price";
8624
8632
  readonly hidden: false;
8625
8633
  }, {
8626
8634
  readonly flags: "--runtime <runtime>";
@@ -8696,7 +8704,7 @@ export declare const COMMAND_CATALOG: readonly [{
8696
8704
  readonly hidden: false;
8697
8705
  }, {
8698
8706
  readonly flags: "--size <size>";
8699
- readonly description: "small, medium, large or xlarge (the server default is medium)";
8707
+ readonly description: "small, medium, large or xlarge (default medium; the request shows its price)";
8700
8708
  readonly hidden: false;
8701
8709
  }, {
8702
8710
  readonly flags: "--note <text>";
@@ -8882,7 +8890,7 @@ export declare const COMMAND_CATALOG: readonly [{
8882
8890
  }];
8883
8891
  }, {
8884
8892
  readonly name: "list";
8885
- readonly description: "List every Outpost you own, or a company's Outposts with --company";
8893
+ readonly description: "List your personal Outposts and, grouped by company, the company Outposts you can use. --company lists one company's Outposts";
8886
8894
  readonly aliases: readonly [];
8887
8895
  readonly hidden: false;
8888
8896
  readonly helpOption: true;
@@ -8892,11 +8900,11 @@ export declare const COMMAND_CATALOG: readonly [{
8892
8900
  readonly arguments: readonly [];
8893
8901
  readonly options: readonly [{
8894
8902
  readonly flags: "--company <slug>";
8895
- readonly description: "List the company's Outposts";
8903
+ readonly description: "List only this company's Outposts";
8896
8904
  readonly hidden: false;
8897
8905
  }, {
8898
8906
  readonly flags: "--json";
8899
- readonly description: "Emit raw JSON";
8907
+ readonly description: "Emit raw JSON (without --company: your personal Outposts only, as before)";
8900
8908
  readonly hidden: false;
8901
8909
  }];
8902
8910
  readonly subcommands: readonly [];
@@ -9382,21 +9390,21 @@ export declare const COMMAND_CATALOG: readonly [{
9382
9390
  readonly subcommands: readonly [];
9383
9391
  }, {
9384
9392
  readonly name: "pull";
9385
- readonly description: "Download one file from an Outpost through a short-lived download link (for files too large for exec output). <outpost> is the Outpost id (`primary` for your first box). The remote path must be inside the Outpost user's home or HQ dir; relative and ~ paths start at the home dir. The file is saved to [local-path], or to the remote file name in the current directory.";
9393
+ readonly description: "Download one file from an Outpost through a short-lived download link (for files too large for exec output). <outpost> is your personal Outpost id (`primary` for your first box); for a company Outpost pass --company (and --outpost when the company has more than one) instead. The remote path must be inside the Outpost user's home or HQ dir; relative and ~ paths start at the home dir. The file is saved to [local-path], or to the remote file name in the current directory.";
9386
9394
  readonly aliases: readonly [];
9387
9395
  readonly hidden: false;
9388
9396
  readonly helpOption: true;
9389
9397
  readonly helpCommand: false;
9390
- readonly usage: "[options] <outpost> <remote-path> [local-path]";
9398
+ readonly usage: "<outpost> <remote-path> [local-path] | --company <slug> [--outpost <name|id>] <remote-path> [local-path]";
9391
9399
  readonly helpText: readonly [];
9392
9400
  readonly arguments: readonly [{
9393
- readonly name: "outpost";
9401
+ readonly name: "outpost-or-path";
9394
9402
  readonly required: true;
9395
9403
  readonly variadic: false;
9396
9404
  readonly description: "";
9397
9405
  }, {
9398
9406
  readonly name: "remote-path";
9399
- readonly required: true;
9407
+ readonly required: false;
9400
9408
  readonly variadic: false;
9401
9409
  readonly description: "";
9402
9410
  }, {
@@ -9406,6 +9414,14 @@ export declare const COMMAND_CATALOG: readonly [{
9406
9414
  readonly description: "";
9407
9415
  }];
9408
9416
  readonly options: readonly [{
9417
+ readonly flags: "--company <slug>";
9418
+ readonly description: "Run on this company's Outpost (owners, admins, and members approved for it; others: hq outposts request-access)";
9419
+ readonly hidden: false;
9420
+ }, {
9421
+ readonly flags: "--outpost <name|id>";
9422
+ readonly description: "Which company Outpost, when the company has more than one";
9423
+ readonly hidden: false;
9424
+ }, {
9409
9425
  readonly flags: "--force";
9410
9426
  readonly description: "Replace the local file if it already exists";
9411
9427
  readonly hidden: false;
@@ -9546,6 +9562,10 @@ export declare const COMMAND_CATALOG: readonly [{
9546
9562
  readonly flags: "--outpost <name|id>";
9547
9563
  readonly description: "Which company Outpost, when the company has more than one";
9548
9564
  readonly hidden: false;
9565
+ }, {
9566
+ readonly flags: "--no-wait";
9567
+ readonly description: "With --company: return once HQ has the code, without waiting for the Outpost to confirm sign-in";
9568
+ readonly hidden: false;
9549
9569
  }, {
9550
9570
  readonly flags: "--json";
9551
9571
  readonly description: "Emit raw JSON";
@@ -17468,6 +17488,10 @@ export declare const COMMAND_CATALOG: readonly [{
17468
17488
  readonly flags: "--outpost <id>";
17469
17489
  readonly description: "Confirm the registered Outpost hosting a native lane";
17470
17490
  readonly hidden: false;
17491
+ }, {
17492
+ readonly flags: "--company <slug>";
17493
+ readonly description: "Company that owns the --outpost company Outpost";
17494
+ readonly hidden: false;
17471
17495
  }, {
17472
17496
  readonly flags: "--json";
17473
17497
  readonly description: "JSON on stdout (always)";
@@ -21626,7 +21650,7 @@ export declare const COMMAND_CATALOG: readonly [{
21626
21650
  readonly options: readonly [];
21627
21651
  readonly subcommands: readonly [{
21628
21652
  readonly name: "list";
21629
- readonly description: "List comments on an app in your org";
21653
+ readonly description: "List comments on an app in your org, or on a personal app with --personal";
21630
21654
  readonly aliases: readonly [];
21631
21655
  readonly hidden: false;
21632
21656
  readonly helpOption: true;
@@ -21643,6 +21667,10 @@ export declare const COMMAND_CATALOG: readonly [{
21643
21667
  readonly flags: "--company <slug>";
21644
21668
  readonly description: "use this company instead of the active company";
21645
21669
  readonly hidden: false;
21670
+ }, {
21671
+ readonly flags: "--personal";
21672
+ readonly description: "read a personal app (personal deploy scope) instead of a company app";
21673
+ readonly hidden: false;
21646
21674
  }, {
21647
21675
  readonly flags: "--json";
21648
21676
  readonly description: "print the API comment array as JSON";
@@ -21715,6 +21743,180 @@ export declare const COMMAND_CATALOG: readonly [{
21715
21743
  }];
21716
21744
  readonly subcommands: readonly [];
21717
21745
  }];
21746
+ }, {
21747
+ readonly name: "events";
21748
+ readonly description: "Read and answer site events that visitors send from your deployed apps";
21749
+ readonly aliases: readonly [];
21750
+ readonly hidden: false;
21751
+ readonly helpOption: true;
21752
+ readonly helpCommand: true;
21753
+ readonly usage: "[options] [command]";
21754
+ readonly helpText: readonly [];
21755
+ readonly arguments: readonly [];
21756
+ readonly options: readonly [];
21757
+ readonly subcommands: readonly [{
21758
+ readonly name: "enable";
21759
+ readonly description: "Turn site events on (or off with --off) for an app";
21760
+ readonly aliases: readonly [];
21761
+ readonly hidden: false;
21762
+ readonly helpOption: true;
21763
+ readonly helpCommand: false;
21764
+ readonly usage: "[options] <app-id>";
21765
+ readonly helpText: readonly [];
21766
+ readonly arguments: readonly [{
21767
+ readonly name: "app-id";
21768
+ readonly required: true;
21769
+ readonly variadic: false;
21770
+ readonly description: "";
21771
+ }];
21772
+ readonly options: readonly [{
21773
+ readonly flags: "--company <slug>";
21774
+ readonly description: "company owning the app";
21775
+ readonly hidden: false;
21776
+ }, {
21777
+ readonly flags: "--personal";
21778
+ readonly description: "use personal scope";
21779
+ readonly hidden: false;
21780
+ }, {
21781
+ readonly flags: "--off";
21782
+ readonly description: "turn site events off; stored events are kept";
21783
+ readonly hidden: false;
21784
+ }, {
21785
+ readonly flags: "--json";
21786
+ readonly description: "print {ok, appId, eventsEnabled} as JSON";
21787
+ readonly hidden: false;
21788
+ }];
21789
+ readonly subcommands: readonly [];
21790
+ }, {
21791
+ readonly name: "list";
21792
+ readonly description: "List site events on an app";
21793
+ readonly aliases: readonly [];
21794
+ readonly hidden: false;
21795
+ readonly helpOption: true;
21796
+ readonly helpCommand: false;
21797
+ readonly usage: "[options] <app-id>";
21798
+ readonly helpText: readonly [];
21799
+ readonly arguments: readonly [{
21800
+ readonly name: "app-id";
21801
+ readonly required: true;
21802
+ readonly variadic: false;
21803
+ readonly description: "";
21804
+ }];
21805
+ readonly options: readonly [{
21806
+ readonly flags: "--company <slug>";
21807
+ readonly description: "company owning the app";
21808
+ readonly hidden: false;
21809
+ }, {
21810
+ readonly flags: "--personal";
21811
+ readonly description: "use personal scope";
21812
+ readonly hidden: false;
21813
+ }, {
21814
+ readonly flags: "--after <event-id>";
21815
+ readonly description: "only events after this event id";
21816
+ readonly hidden: false;
21817
+ }, {
21818
+ readonly flags: "--status <status>";
21819
+ readonly description: "new or handled";
21820
+ readonly hidden: false;
21821
+ }, {
21822
+ readonly flags: "--limit <n>";
21823
+ readonly description: "maximum number of events";
21824
+ readonly hidden: false;
21825
+ }, {
21826
+ readonly flags: "--json";
21827
+ readonly description: "print the API response ({events, nextAfter}) as JSON";
21828
+ readonly hidden: false;
21829
+ }];
21830
+ readonly subcommands: readonly [];
21831
+ }, {
21832
+ readonly name: "reply";
21833
+ readonly description: "Reply to a site event and/or set its status";
21834
+ readonly aliases: readonly [];
21835
+ readonly hidden: false;
21836
+ readonly helpOption: true;
21837
+ readonly helpCommand: false;
21838
+ readonly usage: "[options] <app-id> <event-id>";
21839
+ readonly helpText: readonly [];
21840
+ readonly arguments: readonly [{
21841
+ readonly name: "app-id";
21842
+ readonly required: true;
21843
+ readonly variadic: false;
21844
+ readonly description: "";
21845
+ }, {
21846
+ readonly name: "event-id";
21847
+ readonly required: true;
21848
+ readonly variadic: false;
21849
+ readonly description: "";
21850
+ }];
21851
+ readonly options: readonly [{
21852
+ readonly flags: "--company <slug>";
21853
+ readonly description: "company owning the app";
21854
+ readonly hidden: false;
21855
+ }, {
21856
+ readonly flags: "--personal";
21857
+ readonly description: "use personal scope";
21858
+ readonly hidden: false;
21859
+ }, {
21860
+ readonly flags: "--text <reply>";
21861
+ readonly description: "reply text the page shows";
21862
+ readonly hidden: false;
21863
+ }, {
21864
+ readonly flags: "--status <status>";
21865
+ readonly description: "new or handled";
21866
+ readonly hidden: false;
21867
+ }, {
21868
+ readonly flags: "--json";
21869
+ readonly description: "print {ok, id, status, reply} as JSON";
21870
+ readonly hidden: false;
21871
+ }];
21872
+ readonly subcommands: readonly [];
21873
+ }, {
21874
+ readonly name: "watch";
21875
+ readonly description: "Poll for new site events and print one JSON line per event";
21876
+ readonly aliases: readonly [];
21877
+ readonly hidden: false;
21878
+ readonly helpOption: true;
21879
+ readonly helpCommand: false;
21880
+ readonly usage: "[options] <app-id>";
21881
+ readonly helpText: readonly [];
21882
+ readonly arguments: readonly [{
21883
+ readonly name: "app-id";
21884
+ readonly required: true;
21885
+ readonly variadic: false;
21886
+ readonly description: "";
21887
+ }];
21888
+ readonly options: readonly [{
21889
+ readonly flags: "--company <slug>";
21890
+ readonly description: "company owning the app";
21891
+ readonly hidden: false;
21892
+ }, {
21893
+ readonly flags: "--personal";
21894
+ readonly description: "use personal scope";
21895
+ readonly hidden: false;
21896
+ }, {
21897
+ readonly flags: "--cursor-file <path>";
21898
+ readonly description: "file that stores the last reported event id";
21899
+ readonly hidden: false;
21900
+ }, {
21901
+ readonly flags: "--label <name>";
21902
+ readonly description: "name used in the output lines (default: the app id)";
21903
+ readonly hidden: false;
21904
+ }, {
21905
+ readonly flags: "--interval <seconds>";
21906
+ readonly description: "seconds between polls, at least 30";
21907
+ readonly hidden: false;
21908
+ readonly defaultValue: "30";
21909
+ }, {
21910
+ readonly flags: "--status <status>";
21911
+ readonly description: "new or handled (default: new)";
21912
+ readonly hidden: false;
21913
+ }, {
21914
+ readonly flags: "--once";
21915
+ readonly description: "poll once and exit";
21916
+ readonly hidden: false;
21917
+ }];
21918
+ readonly subcommands: readonly [];
21919
+ }];
21718
21920
  }, {
21719
21921
  readonly name: "list";
21720
21922
  readonly description: "List deploy apps in your company, optionally filtered by name or subdomain";