@indigoai-us/hq-cli 5.341.1 → 5.341.3

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 (42) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/assets/hqd/windows-pipe-host.ps1 +282 -0
  3. package/dist/bin/hq-auth-refresh.d.ts +1 -1
  4. package/dist/bin/hq-auth-refresh.js +11 -2
  5. package/dist/commands/billing-sponsor.js +20 -1
  6. package/dist/commands/core-derive-trigger-facts-native.d.ts +2 -0
  7. package/dist/commands/core-derive-trigger-facts-native.js +92 -25
  8. package/dist/commands/core-migrate-policy-triggers-native.d.ts +1 -0
  9. package/dist/commands/core-migrate-policy-triggers-native.js +26 -12
  10. package/dist/commands/doctor.js +2 -2
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +17 -1
  13. package/dist/lib/aws-sdk-node-warning-output.js +2 -3
  14. package/dist/lib/billing/plan-lock.js +19 -2
  15. package/dist/lib/bot/owner-context.d.ts +2 -0
  16. package/dist/lib/bot/owner-context.js +19 -1
  17. package/dist/lib/daemon/flag-monitor.d.ts +23 -0
  18. package/dist/lib/daemon/flag-monitor.js +99 -0
  19. package/dist/lib/daemon/flag.d.ts +2 -0
  20. package/dist/lib/daemon/flag.js +10 -1
  21. package/dist/lib/daemon/protocol.d.ts +26 -3
  22. package/dist/lib/daemon/protocol.js +9 -5
  23. package/dist/lib/daemon/run.js +14 -16
  24. package/dist/lib/daemon/server.d.ts +23 -2
  25. package/dist/lib/daemon/server.js +397 -52
  26. package/dist/lib/daemon/windows-pipe-host.d.ts +17 -0
  27. package/dist/lib/daemon/windows-pipe-host.js +218 -0
  28. package/dist/lib/diagnostics.d.ts +9 -0
  29. package/dist/lib/diagnostics.js +12 -0
  30. package/dist/lib/doctor/checks/anywhere.d.ts +6 -1
  31. package/dist/lib/doctor/checks/anywhere.js +131 -13
  32. package/dist/lib/doctor/json-output.d.ts +2 -0
  33. package/dist/lib/doctor/json-output.js +1 -0
  34. package/dist/lib/doctor/registry.js +1 -3
  35. package/dist/lib/doctor/types.d.ts +4 -0
  36. package/dist/utils/package-use-lease.d.ts +4 -0
  37. package/dist/utils/package-use-lease.js +28 -0
  38. package/dist/utils/run-bundled-script.d.ts +2 -0
  39. package/dist/utils/run-bundled-script.js +10 -1
  40. package/dist/utils/vault-api.js +12 -12
  41. package/docs/anywhere-runtime.md +49 -5
  42. package/package.json +2 -1
@@ -1,8 +1,9 @@
1
1
  # HQ Anywhere runtime
2
2
 
3
3
  HQ Anywhere installs global hooks for supported agent runtimes and uses the
4
- local hqd daemon on macOS and Linux. Windows does not currently start hqd, so
5
- the daemon-backed routing described here is unavailable there. A per-user
4
+ local hqd daemon on macOS, Linux, and Windows. On Windows, hqd uses a bundled
5
+ PowerShell pipe host that applies and verifies a user-only named-pipe DACL
6
+ before becoming ready. A per-user
6
7
  registry links repositories to HQ companies. The `hq-anywhere-runtime` flag
7
8
  controls these features and is off by default.
8
9
 
@@ -26,14 +27,57 @@ The CLI stores the HQ root at `~/.hq/root` and keeps the folder registry in
26
27
  `~/.hq/registry.json`. These files belong to the current host. They are not
27
28
  stored in a repository or synced HQ folder.
28
29
 
29
- On Windows, `hq daemon install` reports that hqd cannot start because its
30
- named-pipe ACL is not supported. Global hook installation may still configure
31
- local runtime hooks, but it does not provide the hqd routing described below.
30
+ Windows requires Windows PowerShell 5.1 or PowerShell 7 for the bundled pipe
31
+ host. If it is unavailable, the pipe cannot be created with a verified
32
+ current-user-only DACL, or another process already owns the pipe name, hqd
33
+ refuses to start. The `hq-anywhere-runtime` flag remains off by default on all
34
+ platforms.
35
+
36
+ On macOS and Linux, hqd checks the socket directory and socket path with
37
+ `lstat` before serving. It refuses symlinked, shared, or foreign-owned paths.
38
+ The default socket is under `~/.hq/daemon/`, separate from the registry directory;
39
+ a directory created for the socket is set to `0700`. hqd replaces a stale
40
+ socket only when the current user owns it, then verifies the listening socket
41
+ is `0600`. If a check fails, hqd reports the path and stops without removing an
42
+ unexpected file.
32
43
 
33
44
  When the flag is enabled, the global hook uses hqd for events outside the HQ
34
45
  root. Inside the root, the project hook routes through hqd when it is running
35
46
  and uses the direct master hook when it is stopped.
36
47
 
48
+ ## Flag revocation
49
+
50
+ While hqd is running, it refreshes `hq-anywhere-runtime` every 30 seconds.
51
+ Successful reads are never trusted for more than 60 seconds. This gives a
52
+ healthy flag service a 30-second revocation window while limiting reads to two
53
+ per minute per daemon; the five-second flag request timeout bounds the work
54
+ when the service is slow. Staleness uses elapsed monotonic time, so wall-clock
55
+ corrections cannot extend an ON decision.
56
+
57
+ When a read fails, hqd keeps the last successful value only until it is 60
58
+ seconds old. After that, it fails closed. An OFF decision refuses new daemon
59
+ login and hosted MCP calls with `anywhere_disabled` and clears any stdin machine
60
+ token held in memory. `auth.status` remains available and reports signed out.
61
+ An authentication still in progress when revocation arrives fails cleanly;
62
+ hosted MCP calls already forwarded are allowed to finish or return their normal
63
+ request error. The daemon process itself does not terminate.
64
+
65
+ ## Diagnose the runtime
66
+
67
+ `hq doctor` reports hqd reachability, version and uptime, the last successful
68
+ runtime-flag read and its age, and whether hqd is holding that decision after a
69
+ read error. It also reports the company selected for the current directory or
70
+ the reason it fell back to personal context. On Unix, the socket line includes
71
+ its permission mode, owner check and whether it is user-only. Windows reports
72
+ the named-pipe transport without Unix mode or owner fields. Use `hq doctor
73
+ --json` for the same fields as structured details. The hqd health operation is
74
+ read-only and available while the runtime flag is off; it reports only the
75
+ current directory's binding and never returns authentication tokens. A Unix
76
+ socket that cannot be verified as user-only produces a warning. If an older
77
+ resident daemon does not support the health operation, doctor falls back to
78
+ `ping` for reachability, version and uptime, then warns that a restart is needed
79
+ for full diagnostics.
80
+
37
81
  ## Link a repository
38
82
 
39
83
  Run `hq link <company>` from a repository to associate it with a company. The
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.341.1",
3
+ "version": "5.341.3",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -13,6 +13,7 @@
13
13
  "assets/scaffold",
14
14
  "assets/bot-workers",
15
15
  "assets/mesh-daemon",
16
+ "assets/hqd",
16
17
  "assets/lanes-reconcile",
17
18
  "assets/lanes-hooks",
18
19
  "templates",