@indigoai-us/hq-cli 5.345.214 → 5.345.215

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 (200) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/assets/scaffold/core/scripts/hq-delegate-verify.sh +5 -2
  3. package/dist/command-catalog.generated.d.ts +180 -13
  4. package/dist/command-catalog.generated.js +221 -13
  5. package/dist/commands/agents.d.ts +51 -1
  6. package/dist/commands/agents.js +154 -2
  7. package/dist/commands/bot-jobs.d.ts +2 -15
  8. package/dist/commands/bot-jobs.js +2 -94
  9. package/dist/commands/bot-runtime.d.ts +46 -5
  10. package/dist/commands/bot-runtime.js +228 -18
  11. package/dist/commands/bot.d.ts +16 -9
  12. package/dist/commands/bot.js +231 -55
  13. package/dist/commands/capacity.d.ts +4 -1
  14. package/dist/commands/capacity.js +46 -10
  15. package/dist/commands/cloud.d.ts +66 -13
  16. package/dist/commands/cloud.js +121 -40
  17. package/dist/commands/company-restore.d.ts +23 -0
  18. package/dist/commands/company-restore.js +128 -0
  19. package/dist/commands/company.js +2 -0
  20. package/dist/commands/core-delegate-w1b.js +15 -1
  21. package/dist/commands/core-policy.js +67 -8
  22. package/dist/commands/daemon.js +5 -0
  23. package/dist/commands/files-browse.d.ts +11 -4
  24. package/dist/commands/files-browse.js +21 -4
  25. package/dist/commands/files.d.ts +1 -1
  26. package/dist/commands/files.js +25 -11
  27. package/dist/commands/integrations-auth-rules.d.ts +27 -0
  28. package/dist/commands/integrations-auth-rules.js +79 -0
  29. package/dist/commands/integrations-connect.d.ts +10 -3
  30. package/dist/commands/integrations-connect.js +87 -13
  31. package/dist/commands/integrations-import.js +124 -12
  32. package/dist/commands/lanes.js +28 -11
  33. package/dist/commands/mesh.d.ts +2 -0
  34. package/dist/commands/mesh.js +60 -35
  35. package/dist/commands/sources.js +6 -0
  36. package/dist/commands/storage-offload.d.ts +12 -0
  37. package/dist/commands/storage-offload.js +41 -3
  38. package/dist/commands/sync-held.js +5 -2
  39. package/dist/commands/sync-mode.js +5 -0
  40. package/dist/commands/whoami.js +4 -0
  41. package/dist/lazy-commands.js +3 -5
  42. package/dist/lib/bot/config.d.ts +1 -0
  43. package/dist/lib/bot/config.js +10 -0
  44. package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
  45. package/dist/lib/bot/eventbridge-cron.js +104 -0
  46. package/dist/lib/bot/fleet-cron.d.ts +8 -0
  47. package/dist/lib/bot/fleet-cron.js +35 -3
  48. package/dist/lib/bot/fleet-daemon.d.ts +46 -0
  49. package/dist/lib/bot/fleet-daemon.js +99 -1
  50. package/dist/lib/bot/fleet-local.d.ts +33 -1
  51. package/dist/lib/bot/fleet-local.js +215 -31
  52. package/dist/lib/bot/fleet-python.d.ts +3 -0
  53. package/dist/lib/bot/fleet-python.js +34 -4
  54. package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
  55. package/dist/lib/bot/fleet-runtime-sources.js +30 -0
  56. package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
  57. package/dist/lib/bot/legacy-provider-login.js +19 -2
  58. package/dist/lib/bot/probe.js +7 -1
  59. package/dist/lib/bot/prompt.js +1 -1
  60. package/dist/lib/bot/readiness.d.ts +8 -0
  61. package/dist/lib/bot/readiness.js +17 -3
  62. package/dist/lib/bot/run.js +20 -1
  63. package/dist/lib/bot/runtime/codex.js +1 -1
  64. package/dist/lib/bot/runtime/grok-acp.d.ts +5 -1
  65. package/dist/lib/bot/runtime/grok-acp.js +6 -3
  66. package/dist/lib/bot/runtime/index.js +19 -9
  67. package/dist/lib/bot/runtime/messages-stream.js +2 -2
  68. package/dist/lib/bot/runtime/types.d.ts +15 -0
  69. package/dist/lib/bot/runtime/types.js +9 -0
  70. package/dist/lib/bot/runtime-auth.d.ts +30 -0
  71. package/dist/lib/bot/runtime-auth.js +94 -3
  72. package/dist/lib/bot/runtime-failure.d.ts +23 -0
  73. package/dist/lib/bot/runtime-failure.js +43 -1
  74. package/dist/lib/bot/status.d.ts +2 -0
  75. package/dist/lib/capacity/accounts.d.ts +8 -0
  76. package/dist/lib/capacity/accounts.js +19 -0
  77. package/dist/lib/capacity/available.d.ts +154 -0
  78. package/dist/lib/capacity/available.js +905 -0
  79. package/dist/lib/capacity/codex-availability.d.ts +14 -1
  80. package/dist/lib/capacity/codex-availability.js +26 -1
  81. package/dist/lib/capacity/collectors/claude-oauth.d.ts +29 -2
  82. package/dist/lib/capacity/collectors/claude-oauth.js +104 -7
  83. package/dist/lib/capacity/collectors/codex.js +10 -7
  84. package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
  85. package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
  86. package/dist/lib/capacity/collectors/grok.d.ts +5 -0
  87. package/dist/lib/capacity/collectors/grok.js +56 -5
  88. package/dist/lib/capacity/ledger.d.ts +37 -1
  89. package/dist/lib/capacity/ledger.js +207 -30
  90. package/dist/lib/capacity/project.d.ts +26 -0
  91. package/dist/lib/capacity/project.js +137 -8
  92. package/dist/lib/capacity/refusal-rows.d.ts +31 -0
  93. package/dist/lib/capacity/refusal-rows.js +61 -0
  94. package/dist/lib/capacity/refusal.d.ts +53 -2
  95. package/dist/lib/capacity/refusal.js +284 -65
  96. package/dist/lib/capacity/route.js +46 -11
  97. package/dist/lib/capacity/widget.d.ts +12 -1
  98. package/dist/lib/capacity/widget.js +91 -3
  99. package/dist/lib/daemon/catalog.js +11 -1
  100. package/dist/lib/daemon/resolver.d.ts +2 -0
  101. package/dist/lib/daemon/resolver.js +3 -0
  102. package/dist/lib/daemon/run.d.ts +9 -0
  103. package/dist/lib/daemon/run.js +54 -1
  104. package/dist/lib/daemon/server.d.ts +2 -0
  105. package/dist/lib/daemon/server.js +10 -1
  106. package/dist/lib/daemon/tcc-eperm.d.ts +153 -0
  107. package/dist/lib/daemon/tcc-eperm.js +310 -0
  108. package/dist/lib/db/sqlite-binding.d.ts +1 -0
  109. package/dist/lib/db/sqlite-binding.js +1 -1
  110. package/dist/lib/delivery/admission.d.ts +86 -0
  111. package/dist/lib/delivery/admission.js +148 -0
  112. package/dist/lib/delivery/artifacts.d.ts +105 -0
  113. package/dist/lib/delivery/artifacts.js +567 -0
  114. package/dist/lib/delivery/attempt-id.d.ts +13 -0
  115. package/dist/lib/delivery/attempt-id.js +16 -0
  116. package/dist/lib/delivery/backup.d.ts +78 -0
  117. package/dist/lib/delivery/backup.js +343 -0
  118. package/dist/lib/delivery/cache.d.ts +29 -0
  119. package/dist/lib/delivery/cache.js +33 -0
  120. package/dist/lib/delivery/contracts.d.ts +142 -0
  121. package/dist/lib/delivery/contracts.js +289 -0
  122. package/dist/lib/delivery/credentials.d.ts +54 -0
  123. package/dist/lib/delivery/credentials.js +119 -0
  124. package/dist/lib/delivery/disposable-target.d.ts +42 -0
  125. package/dist/lib/delivery/disposable-target.js +111 -0
  126. package/dist/lib/delivery/effects.d.ts +136 -0
  127. package/dist/lib/delivery/effects.js +541 -0
  128. package/dist/lib/delivery/enrollment.d.ts +146 -0
  129. package/dist/lib/delivery/enrollment.js +460 -0
  130. package/dist/lib/delivery/escalations.d.ts +51 -0
  131. package/dist/lib/delivery/escalations.js +60 -0
  132. package/dist/lib/delivery/identity.d.ts +25 -0
  133. package/dist/lib/delivery/identity.js +82 -0
  134. package/dist/lib/delivery/inbox.d.ts +116 -0
  135. package/dist/lib/delivery/inbox.js +260 -0
  136. package/dist/lib/delivery/lease.d.ts +80 -0
  137. package/dist/lib/delivery/lease.js +134 -0
  138. package/dist/lib/delivery/migrations.d.ts +255 -0
  139. package/dist/lib/delivery/migrations.js +823 -0
  140. package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
  141. package/dist/lib/delivery/mqtt-adapter.js +242 -0
  142. package/dist/lib/delivery/mqtt.d.ts +63 -0
  143. package/dist/lib/delivery/mqtt.js +119 -0
  144. package/dist/lib/delivery/outbox.d.ts +95 -0
  145. package/dist/lib/delivery/outbox.js +187 -0
  146. package/dist/lib/delivery/provenance.d.ts +129 -0
  147. package/dist/lib/delivery/provenance.js +93 -0
  148. package/dist/lib/delivery/reconciler.d.ts +215 -0
  149. package/dist/lib/delivery/reconciler.js +703 -0
  150. package/dist/lib/delivery/restore.d.ts +35 -0
  151. package/dist/lib/delivery/restore.js +134 -0
  152. package/dist/lib/delivery/rpc/client.d.ts +22 -0
  153. package/dist/lib/delivery/rpc/client.js +159 -0
  154. package/dist/lib/delivery/rpc/port.d.ts +40 -0
  155. package/dist/lib/delivery/rpc/port.js +16 -0
  156. package/dist/lib/delivery/rpc/server.d.ts +30 -0
  157. package/dist/lib/delivery/rpc/server.js +205 -0
  158. package/dist/lib/delivery/rpc/wire.d.ts +85 -0
  159. package/dist/lib/delivery/rpc/wire.js +143 -0
  160. package/dist/lib/delivery/store.d.ts +163 -0
  161. package/dist/lib/delivery/store.js +944 -0
  162. package/dist/lib/delivery/windows-service-install.d.ts +262 -0
  163. package/dist/lib/delivery/windows-service-install.js +892 -0
  164. package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
  165. package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
  166. package/dist/lib/delivery/workers/macos.d.ts +191 -0
  167. package/dist/lib/delivery/workers/macos.js +943 -0
  168. package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
  169. package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
  170. package/dist/lib/delivery/workers/windows-service-live.d.ts +121 -0
  171. package/dist/lib/delivery/workers/windows-service-live.js +711 -0
  172. package/dist/lib/delivery/workers/windows-service-runner.d.ts +33 -0
  173. package/dist/lib/delivery/workers/windows-service-runner.js +82 -0
  174. package/dist/lib/delivery/workers/windows-service.d.ts +140 -0
  175. package/dist/lib/delivery/workers/windows-service.js +584 -0
  176. package/dist/lib/delivery/workers/windows.d.ts +251 -0
  177. package/dist/lib/delivery/workers/windows.js +594 -0
  178. package/dist/lib/hot-channels/adapters/meetings.d.ts +15 -0
  179. package/dist/lib/hot-channels/adapters/meetings.js +36 -3
  180. package/dist/lib/hot-channels/signals-pass.d.ts +10 -0
  181. package/dist/lib/hot-channels/signals-pass.js +71 -2
  182. package/dist/lib/hot-channels/signals-redo.js +10 -2
  183. package/dist/lib/install/provider-wrappers.d.ts +2 -0
  184. package/dist/lib/install/provider-wrappers.js +68 -3
  185. package/dist/lib/lanes/watcher.js +35 -0
  186. package/dist/lib/signals/steps/extract.js +40 -4
  187. package/dist/schemas/hq-available-ai.v1.schema.json +76 -0
  188. package/dist/utils/catalog-runtime-paths.d.ts +34 -0
  189. package/dist/utils/catalog-runtime-paths.js +53 -0
  190. package/dist/utils/cognito-callback-port.d.ts +14 -0
  191. package/dist/utils/cognito-callback-port.js +24 -0
  192. package/dist/utils/cognito-session.js +3 -3
  193. package/dist/utils/deleted-company-notice.d.ts +59 -0
  194. package/dist/utils/deleted-company-notice.js +156 -0
  195. package/dist/utils/files-browse-acl.js +1 -1
  196. package/dist/utils/login-browser.d.ts +1 -1
  197. package/dist/utils/login-browser.js +7 -5
  198. package/dist/utils/resident-package-preload.js +30 -15
  199. package/dist/utils/vault-api.js +7 -0
  200. package/package.json +7 -7
@@ -0,0 +1,154 @@
1
+ import type { LaneProvider } from "../lanes/types.js";
2
+ import type { CapacityAccount } from "./accounts.js";
3
+ import { type LedgerOptions, type NowView } from "./ledger.js";
4
+ export declare const AVAILABLE_SCHEMA_VERSION = "hq-available-ai.v1";
5
+ export declare const AVAILABLE_FILE_NAME = "available.json";
6
+ export declare const FRESH_WAIT_MS = 3000;
7
+ export declare const STATUS_PROBE_TIMEOUT_MS = 2500;
8
+ export declare const COLLECT_MARK = ".available-collect.lock";
9
+ export declare const COLLECT_MARK_TTL_MS = 60000;
10
+ export type AvailableFreshness = "fresh" | "refreshing" | "stale";
11
+ export type Availability = "ready" | "likely_ready" | "low" | "used_up" | "needs_sign_in" | "not_installed";
12
+ export type TrancheKind = "plan" | "scoped_model" | "extra_usage" | "credits" | "api_key";
13
+ export type AvailableEngine = "model_cli" | "lane" | "fleet";
14
+ export type AvailableHolder = "cli_home" | "bot_own" | "none";
15
+ export type AvailableConfidence = "fetched" | "observed" | "inferred" | "unknown";
16
+ export interface AvailableOption {
17
+ optionId: string;
18
+ provider: LaneProvider;
19
+ account: {
20
+ id: string;
21
+ label: string;
22
+ organization: string | null;
23
+ };
24
+ tranche: {
25
+ kind: TrancheKind;
26
+ scope: string | null;
27
+ paid: boolean;
28
+ };
29
+ availability: Availability;
30
+ leftPercent: number | null;
31
+ backAt: string | null;
32
+ reading: {
33
+ ageSeconds: number | null;
34
+ confidence: AvailableConfidence;
35
+ };
36
+ usableBy: AvailableEngine[];
37
+ holder: AvailableHolder;
38
+ models: string[];
39
+ reason: string;
40
+ nextStep: {
41
+ kind: "use" | "sign_in" | "wait" | "install";
42
+ label: string;
43
+ };
44
+ }
45
+ export interface AvailableDocument {
46
+ schemaVersion: typeof AVAILABLE_SCHEMA_VERSION;
47
+ generatedAt: string;
48
+ freshness: AvailableFreshness;
49
+ best: string | null;
50
+ nextBackAt: string | null;
51
+ options: AvailableOption[];
52
+ }
53
+ /**
54
+ * Which engines may run a tranche. model_cli follows `hq bot switch-account`,
55
+ * which takes all three runtimes. Fleet excludes Grok, because switch-account
56
+ * refuses it there, and Claude plan logins, which the owner parked on
57
+ * 2026-11-05: no new offer, no removal, a running Fleet Claude bot is untouched.
58
+ * `lane` is added per account, when a lane account is enabled on its home.
59
+ */
60
+ export declare const USABLE_BY: Record<LaneProvider, Record<TrancheKind, readonly AvailableEngine[]>>;
61
+ export interface BuildAvailableInput {
62
+ view: NowView;
63
+ accounts: readonly CapacityAccount[];
64
+ now: Date;
65
+ collectorEnabled: boolean | null;
66
+ includeOther?: boolean;
67
+ freshness?: AvailableFreshness;
68
+ }
69
+ export declare function buildAvailableDocument(input: BuildAvailableInput): AvailableDocument;
70
+ /** The bytes for available.json. Refuses any value shaped like a provider token. */
71
+ export declare function serializeAvailable(document: AvailableDocument): string;
72
+ /**
73
+ * Raised by a rebuild that cannot read the account registry or the HQ root. Its
74
+ * message is fixed text: no path, no config content.
75
+ */
76
+ export declare class RosterUnavailable extends Error {
77
+ constructor();
78
+ }
79
+ /**
80
+ * The HQ tree whose registry a resolved root reads. Walks up from the root and
81
+ * returns the nearest folder that has a lanes config, so an explicit root with
82
+ * a lanes config always wins. A folder that only looks like an HQ tree
83
+ * (`isHqRoot`) is not enough to stop the walk: a copy of the hq-core template
84
+ * inside HQ (repos/public/hq-core, an hq-core-staging worktree) or a route
85
+ * folder named companies/ has the same markers but no registry, and reading it
86
+ * would drop the registry accounts and bring back a default home the registry
87
+ * turned off. When no folder on the way has a lanes config, the outermost HQ
88
+ * tree on the path is used (a fresh install, an empty registry). Null when no
89
+ * folder on the way is an HQ tree.
90
+ */
91
+ export declare function registryHqRoot(resolved: string): string | null;
92
+ /**
93
+ * The account roster from the registry, or null when the HQ root cannot be
94
+ * found or the registry cannot be read. Null is not "no registry": a resolved
95
+ * HQ root with no lanes config is a known, empty registry and returns the
96
+ * default homes. Callers must not stand the default homes in for null, because
97
+ * that drops registry accounts on custom homes and brings back a default home
98
+ * the registry turned off for work.
99
+ *
100
+ * HQ_ROOT or CLAUDE_PROJECT_DIR is trusted when it names any existing folder.
101
+ * A folder with no lanes config is often a subfolder of an HQ tree (a session
102
+ * opened in `repos/...`, `companies/x` or a template copy such as
103
+ * `repos/public/hq-core`), so the registry is read from the nearest enclosing
104
+ * folder with a lanes config, else the outermost enclosing HQ tree
105
+ * (registryHqRoot). A folder with no enclosing HQ tree is a wrong root, not an
106
+ * empty registry, so it is null too.
107
+ */
108
+ export declare function registryRoster(options?: LedgerOptions): CapacityAccount[] | null;
109
+ /**
110
+ * The document a rebuild writes. Called under the now.json lock. Throws
111
+ * RosterUnavailable when the registry or HQ root cannot be read: a writer that
112
+ * cannot see the registry would write a partial roster marked fresh, so it
113
+ * keeps the last file instead. Readers rebuild from a newer now.json when they
114
+ * can read the registry themselves (readAvailable).
115
+ */
116
+ export declare function availableForRebuild(view: NowView, root: string, now: Date, options?: LedgerOptions): string;
117
+ export type SignInAnswer = "signed_in" | "signed_out" | "not_installed" | "no_answer";
118
+ /** Asks a tool's own status command. Keeps only the answer, never its output. */
119
+ export type StatusProbe = (provider: LaneProvider, home: string) => Promise<SignInAnswer>;
120
+ export declare const defaultStatusProbe: StatusProbe;
121
+ /** Rows with no ledger at all, from each tool's status command. */
122
+ export declare function buildAvailableFromStatus(input: {
123
+ accounts: readonly CapacityAccount[];
124
+ now: Date;
125
+ probe: StatusProbe;
126
+ includeOther?: boolean;
127
+ }): Promise<AvailableDocument>;
128
+ export interface AvailableDeps {
129
+ probe?: StatusProbe;
130
+ /** Starts one background collect that owns the mark holding the token. Tests replace it. */
131
+ startCollect?: (options: LedgerOptions, token: string) => void;
132
+ sleep?: (ms: number) => Promise<void>;
133
+ /** Wall clock for the --fresh budget. */
134
+ clock?: () => number;
135
+ }
136
+ export declare const defaultStartCollect: (options: LedgerOptions, token: string) => void;
137
+ /** The env variable that hands a collect its mark's token, so it frees only its own mark. */
138
+ export declare const COLLECT_TOKEN_ENV = "HQ_CAPACITY_COLLECT_TOKEN";
139
+ /**
140
+ * Remove the single-flight mark once a collect finishes, so the next read need
141
+ * not wait out the TTL. The collect subprocess calls this with the token it was
142
+ * started with. A mark with another token belongs to a later collect (this one
143
+ * outlived the TTL and was reclaimed), so it is left alone. With no token
144
+ * nothing is removed.
145
+ */
146
+ export declare function releaseCollectMark(options: LedgerOptions, token: string | undefined): void;
147
+ /** What `hq capacity available` prints. Never throws for a bad or missing ledger. */
148
+ export declare function readAvailable(input: {
149
+ options: LedgerOptions;
150
+ includeOther?: boolean;
151
+ fresh?: boolean;
152
+ }, deps?: AvailableDeps): Promise<AvailableDocument>;
153
+ export declare function formatAvailableText(document: AvailableDocument): string;
154
+ //# sourceMappingURL=available.d.ts.map