@indigoai-us/hq-cli 5.345.220 → 5.345.222

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 (184) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/dist/command-catalog.generated.d.ts +175 -2
  3. package/dist/command-catalog.generated.js +213 -2
  4. package/dist/commands/auth.js +6 -2
  5. package/dist/commands/bot-runtime.d.ts +18 -5
  6. package/dist/commands/bot-runtime.js +29 -12
  7. package/dist/commands/bot.d.ts +39 -2
  8. package/dist/commands/bot.js +140 -11
  9. package/dist/commands/core-delegate-w1b.js +9 -3
  10. package/dist/commands/core-stop-autosave.d.ts +21 -0
  11. package/dist/commands/core-stop-autosave.js +300 -0
  12. package/dist/commands/core.js +2 -0
  13. package/dist/commands/daemon.d.ts +6 -0
  14. package/dist/commands/daemon.js +46 -8
  15. package/dist/commands/doctor-usage.d.ts +5 -0
  16. package/dist/commands/doctor-usage.js +25 -0
  17. package/dist/commands/env.d.ts +49 -4
  18. package/dist/commands/env.js +355 -5
  19. package/dist/commands/lanes-shared.d.ts +3 -0
  20. package/dist/commands/lanes.d.ts +3 -0
  21. package/dist/commands/lanes.js +87 -3
  22. package/dist/commands/link.d.ts +2 -0
  23. package/dist/commands/link.js +14 -2
  24. package/dist/commands/mesh.js +23 -3
  25. package/dist/commands/sources.js +3 -3
  26. package/dist/commands/sync-core.d.ts +7 -0
  27. package/dist/commands/sync-core.js +132 -3
  28. package/dist/commands/whoami.js +96 -80
  29. package/dist/data/command-states.json +3 -0
  30. package/dist/lib/bot/config.d.ts +17 -0
  31. package/dist/lib/bot/config.js +13 -0
  32. package/dist/lib/bot/fleet-cron.js +24 -2
  33. package/dist/lib/bot/fleet-local.d.ts +30 -2
  34. package/dist/lib/bot/fleet-local.js +60 -1
  35. package/dist/lib/bot/grok-login-scope.d.ts +36 -0
  36. package/dist/lib/bot/grok-login-scope.js +93 -0
  37. package/dist/lib/bot/legacy-provider-login.d.ts +32 -9
  38. package/dist/lib/bot/legacy-provider-login.js +28 -22
  39. package/dist/lib/bot/runtime-sign-in-check.js +6 -1
  40. package/dist/lib/bot/runtime-sign-in.d.ts +2 -0
  41. package/dist/lib/core-utils/sentry-report.js +2 -0
  42. package/dist/lib/daemon/catalog.js +2 -0
  43. package/dist/lib/daemon/install.d.ts +2 -1
  44. package/dist/lib/daemon/install.js +9 -0
  45. package/dist/lib/daemon/legacy.d.ts +1 -0
  46. package/dist/lib/daemon/legacy.js +5 -2
  47. package/dist/lib/daemon/machine-check-owner.d.ts +2 -0
  48. package/dist/lib/daemon/machine-check-owner.js +6 -1
  49. package/dist/lib/daemon/machine-checks.d.ts +29 -2
  50. package/dist/lib/daemon/machine-checks.js +64 -13
  51. package/dist/lib/daemon/mesh-owner.d.ts +45 -0
  52. package/dist/lib/daemon/mesh-owner.js +166 -0
  53. package/dist/lib/daemon/native-notice-ledger.d.ts +27 -0
  54. package/dist/lib/daemon/native-notice-ledger.js +113 -0
  55. package/dist/lib/daemon/run.d.ts +15 -0
  56. package/dist/lib/daemon/run.js +137 -11
  57. package/dist/lib/daemon/selfcheck.d.ts +35 -2
  58. package/dist/lib/daemon/selfcheck.js +118 -9
  59. package/dist/lib/daemon/stop-autosave-lock.d.ts +19 -0
  60. package/dist/lib/daemon/stop-autosave-lock.js +166 -0
  61. package/dist/lib/daemon/stop-autosave.d.ts +28 -0
  62. package/dist/lib/daemon/stop-autosave.js +111 -0
  63. package/dist/lib/daemon/stop-diagnostics.d.ts +11 -0
  64. package/dist/lib/daemon/stop-diagnostics.js +136 -0
  65. package/dist/lib/daemon/stop-job-executor.d.ts +19 -0
  66. package/dist/lib/daemon/stop-job-executor.js +126 -0
  67. package/dist/lib/daemon/stop-jobs.d.ts +93 -0
  68. package/dist/lib/daemon/stop-jobs.js +599 -0
  69. package/dist/lib/doctor/checks/fleet-hook-core.js +1 -1
  70. package/dist/lib/doctor/checks/host-core.js +1 -1
  71. package/dist/lib/environment/access-probes.d.ts +234 -0
  72. package/dist/lib/environment/access-probes.js +918 -0
  73. package/dist/lib/environment/profile.d.ts +15 -2
  74. package/dist/lib/environment/profile.js +55 -20
  75. package/dist/lib/environment/rfc3339.d.ts +8 -0
  76. package/dist/lib/environment/rfc3339.js +26 -0
  77. package/dist/lib/environment/work-requirements.d.ts +169 -0
  78. package/dist/lib/environment/work-requirements.js +389 -0
  79. package/dist/lib/hook-engine/coverage.d.ts +146 -7
  80. package/dist/lib/hook-engine/coverage.js +1480 -4
  81. package/dist/lib/hook-engine/fleet-registration.js +2 -2
  82. package/dist/lib/hook-engine/git-stop-config.json +513 -0
  83. package/dist/lib/hook-engine/native-stop-compatibility.json +362 -0
  84. package/dist/lib/hook-engine/reconcile.js +2 -2
  85. package/dist/lib/hot-channels/alert.d.ts +2 -2
  86. package/dist/lib/hot-channels/alert.js +8 -5
  87. package/dist/lib/hot-channels/signals-pass.d.ts +126 -17
  88. package/dist/lib/hot-channels/signals-pass.js +296 -17
  89. package/dist/lib/hot-channels/signals-runtime.d.ts +30 -0
  90. package/dist/lib/hot-channels/signals-runtime.js +82 -0
  91. package/dist/lib/install/hook-target.js +1 -1
  92. package/dist/lib/lanes/host-capacity.d.ts +26 -2
  93. package/dist/lib/lanes/host-capacity.js +17 -2
  94. package/dist/lib/lanes/host-compute.d.ts +90 -0
  95. package/dist/lib/lanes/host-compute.js +185 -0
  96. package/dist/lib/lanes/index.d.ts +2 -0
  97. package/dist/lib/lanes/index.js +1 -0
  98. package/dist/lib/lanes/reconcile.js +22 -1
  99. package/dist/lib/lanes/resource-usage.d.ts +155 -0
  100. package/dist/lib/lanes/resource-usage.js +589 -0
  101. package/dist/lib/lanes/run-size.d.ts +46 -0
  102. package/dist/lib/lanes/run-size.js +197 -0
  103. package/dist/lib/lanes/store.js +27 -0
  104. package/dist/lib/lanes/throttle.d.ts +36 -1
  105. package/dist/lib/lanes/throttle.js +47 -10
  106. package/dist/lib/lanes/types.d.ts +40 -0
  107. package/dist/lib/lanes/types.js +2 -2
  108. package/dist/lib/lanes/watcher.js +13 -4
  109. package/dist/lib/lanes/worker-process.d.ts +25 -2
  110. package/dist/lib/lanes/worker-process.js +71 -19
  111. package/dist/lib/mesh/live/daemon/config.d.ts +8 -1
  112. package/dist/lib/mesh/live/daemon/config.js +16 -0
  113. package/dist/lib/mesh/live/daemon/install.d.ts +31 -2
  114. package/dist/lib/mesh/live/daemon/install.js +142 -1
  115. package/dist/lib/mesh/live/daemon/login-home.d.ts +5 -0
  116. package/dist/lib/mesh/live/daemon/login-home.js +27 -0
  117. package/dist/lib/mesh/live/daemon/unit-home.d.ts +49 -0
  118. package/dist/lib/mesh/live/daemon/unit-home.js +134 -0
  119. package/dist/lib/placement/match.d.ts +192 -0
  120. package/dist/lib/placement/match.js +667 -0
  121. package/dist/lib/registry/registry.d.ts +35 -7
  122. package/dist/lib/registry/registry.js +88 -13
  123. package/dist/lib/safe-store.d.ts +14 -0
  124. package/dist/lib/safe-store.js +77 -4
  125. package/dist/lib/scan-packages/index.js +24 -2
  126. package/dist/lib/search-index/index.d.ts +88 -4
  127. package/dist/lib/search-index/index.js +288 -24
  128. package/dist/lib/search-index/max-doc-bytes.d.ts +17 -6
  129. package/dist/lib/search-index/max-doc-bytes.js +49 -23
  130. package/dist/lib/service-manager/startup-migration.d.ts +1 -0
  131. package/dist/lib/service-manager/startup-migration.js +3 -0
  132. package/dist/lib/signals/codex-lockdown.d.ts +79 -0
  133. package/dist/lib/signals/codex-lockdown.js +271 -0
  134. package/dist/lib/signals/codex-login.d.ts +37 -0
  135. package/dist/lib/signals/codex-login.js +83 -0
  136. package/dist/lib/signals/engine.d.ts +27 -0
  137. package/dist/lib/signals/engine.js +70 -0
  138. package/dist/lib/signals/reply.js +22 -1
  139. package/dist/lib/signals/run-record.js +6 -1
  140. package/dist/lib/signals/settings.d.ts +5 -0
  141. package/dist/lib/signals/settings.js +2 -0
  142. package/dist/lib/signals/steps/extract.d.ts +85 -9
  143. package/dist/lib/signals/steps/extract.js +317 -68
  144. package/dist/lib/signals/steps/types.d.ts +2 -0
  145. package/dist/lib/sync-core/engine-holds.d.ts +14 -0
  146. package/dist/lib/sync-core/engine-holds.js +60 -0
  147. package/dist/lib/sync-core/engine-home.d.ts +37 -1
  148. package/dist/lib/sync-core/engine-home.js +119 -16
  149. package/dist/lib/sync-core/reconcile.js +8 -0
  150. package/dist/lib/sync-core/rollout-state.d.ts +2 -1
  151. package/dist/lib/sync-core/rollout-state.js +5 -2
  152. package/dist/lib/sync-core/vault-settings.d.ts +21 -0
  153. package/dist/lib/sync-core/vault-settings.js +131 -0
  154. package/dist/lib/sync-core/vault-uid.d.ts +2 -0
  155. package/dist/lib/sync-core/vault-uid.js +4 -0
  156. package/dist/lib/windows/install-followup.d.ts +2 -0
  157. package/dist/lib/windows/install-followup.js +4 -1
  158. package/dist/schemas/hq-work-requirements.v1.schema.json +145 -0
  159. package/dist/utils/auth-session-check.d.ts +16 -0
  160. package/dist/utils/auth-session-check.js +16 -0
  161. package/dist/utils/client-health-contract.d.ts +6 -0
  162. package/dist/utils/client-health-contract.js +13 -0
  163. package/dist/utils/client-health.d.ts +7 -0
  164. package/dist/utils/client-health.js +22 -1
  165. package/dist/utils/command-usage.d.ts +40 -0
  166. package/dist/utils/command-usage.js +61 -0
  167. package/dist/utils/duplicate-command-usage.d.ts +72 -0
  168. package/dist/utils/duplicate-command-usage.js +125 -0
  169. package/dist/utils/host-registration.js +5 -2
  170. package/dist/utils/pack-contributions.d.ts +3 -0
  171. package/dist/utils/pack-contributions.js +110 -23
  172. package/dist/utils/resident-package-preload.js +4 -0
  173. package/dist/utils/self-update.d.ts +3 -1
  174. package/dist/utils/self-update.js +56 -11
  175. package/dist/utils/sentry-fingerprint.js +9 -0
  176. package/dist/utils/update-lock.d.ts +151 -14
  177. package/dist/utils/update-lock.js +782 -46
  178. package/dist/utils/version-gate.js +12 -2
  179. package/dist/utils/windows-bash.d.ts +2 -0
  180. package/dist/utils/windows-bash.js +2 -1
  181. package/package.json +9 -8
  182. package/scripts/bench-core-compare.mjs +313 -0
  183. package/scripts/bench-core.mjs +399 -12
  184. package/scripts/check-function-manifest.mjs +116 -3
@@ -0,0 +1,192 @@
1
+ /**
2
+ * The matcher: which environments can do one piece of work, and a first
3
+ * ranking of the (environment, login) pairs that can.
4
+ *
5
+ * match(requirements, profiles, { now }) -> { feasible, rejected, ranked }
6
+ *
7
+ * Pass 1 applies rules R1 to R9 from the HQ Everywhere match walkthrough
8
+ * (research/environment-profile-v1/match-walkthrough.md). An environment is
9
+ * rejected at the first rule it fails, and a pair at the first account check
10
+ * it fails; each rejection carries exactly one reason naming the rule and the
11
+ * field. Pass 2 scores every feasible pair with the weights in MATCH_WEIGHTS.
12
+ *
13
+ * This is a tool for the conductor engine (owner decision 1): it filters and
14
+ * gives a first ranking. It does not choose; the conductor makes and records
15
+ * the choice.
16
+ *
17
+ * Login policy (owner decision 5): a login held by the owner pairs with work
18
+ * for any of his businesses. owning_company is shown on the ranked pair and
19
+ * breaks ties; it never filters the owner's logins. A login held by another
20
+ * person (readings.foreign_accounts) never pairs.
21
+ *
22
+ * Freshness: every reading is aged against the one `now` passed in. A reading
23
+ * is fresh when it was observed at most ttl_seconds before now (exactly at the
24
+ * ttl is still fresh). A reading with no observed_at, or one observed more than
25
+ * clock_skew_seconds after now, is unknown; one older than its ttl is stale.
26
+ * Stale or unknown room counts as a quarter of the room points, never as fresh
27
+ * room. Stale or unknown compute counts as unknown compute and is not used for
28
+ * the live size check. An access probe that is not fresh fails R5.
29
+ *
30
+ * Company isolation: a profile is a company-scoped view, so it ranks only for
31
+ * the company whose view it is (R1 on view.company).
32
+ *
33
+ * Input: the documents must already be valid (parseEnvironmentProfile and
34
+ * parseWorkRequirements). A missing required array throws an Error that names
35
+ * it. Duplicate environment ids are settled under R0 (input), field
36
+ * declared.id, after the company filter and whatever the input order:
37
+ * identical copies collapse to one, an undated or future-dated copy is
38
+ * rejected without hiding the others, the copy with the latest
39
+ * view.generated_at is kept, and when no single copy is latest every copy is
40
+ * rejected.
41
+ *
42
+ * The module has no I/O. It imports types only, reads no file, environment
43
+ * variable, clock or network, and runs without an HQ root.
44
+ */
45
+ import type { EnvironmentProfile } from "../environment/profile.js";
46
+ import type { WorkRequirements } from "../environment/work-requirements.js";
47
+ export declare const MATCH_RESULT_SCHEMA_VERSION = "hq-env-match.v1";
48
+ /** Printed with every result: this is not a placement. */
49
+ export declare const MATCH_FIRST_RANKING_NOTICE = "First ranking from the matcher, not a placement. The conductor engine makes and records the choice.";
50
+ /**
51
+ * Pass-2 weights: the scoring table from the match walkthrough, as one config
52
+ * table. A total is out of about 100.
53
+ */
54
+ export interface MatchWeights {
55
+ /** Room: room_max x left_percent / 100 for a fresh reading. */
56
+ room_max: number;
57
+ /** Share of room_max given to unknown or stale room (0.25 -> 8.75 points). */
58
+ room_unknown_share: number;
59
+ /** Compute: compute_max x clamp(1 - load_per_vcpu, 0, 1) for a fresh reading. */
60
+ compute_max: number;
61
+ /** Compute with no reading, a stale reading or a template. */
62
+ compute_unknown_points: number;
63
+ /** Every repo and data need already has a passing probe here. Template: 0. */
64
+ locality_points: number;
65
+ /** Locality for work with no repo or data needs: the same for every environment, template or not. */
66
+ locality_no_needs_points: number;
67
+ /** soft_labels_max x share of prefers.labels present. */
68
+ soft_labels_max: number;
69
+ /** engine_order_max x (n - i) / n for the engine's place i in engines.any_of. */
70
+ engine_order_max: number;
71
+ /** Minus cost_per_usd x estimated run cost in USD (metered environments only). */
72
+ cost_per_usd: number;
73
+ /** Cost penalty cap; also the penalty when a metered price is unknown. */
74
+ cost_cap: number;
75
+ /** Minus start_per_minute x start_seconds_estimate / 60 for an environment that is not running. */
76
+ start_per_minute: number;
77
+ /** Start penalty cap. */
78
+ start_cap: number;
79
+ /** Start penalty when the estimate is unknown. */
80
+ start_unknown_penalty: number;
81
+ /** Minus this for each untolerated prefer-not taint. */
82
+ taint_prefer_not_penalty: number;
83
+ /**
84
+ * Clock-skew allowance: a reading observed up to this many seconds after
85
+ * now is aged as if observed at now; one observed later is unknown, not fresh.
86
+ */
87
+ clock_skew_seconds: number;
88
+ }
89
+ /** The config table: pass-2 weights and the clock-skew allowance. */
90
+ export declare const MATCH_WEIGHTS: Readonly<MatchWeights>;
91
+ /** R1..R9 are the walkthrough rules. R0 is input integrity: a duplicate environment id. */
92
+ export type MatchRule = "R0" | "R1" | "R2" | "R3" | "R4" | "R5" | "R6" | "R7" | "R8" | "R9";
93
+ export interface MatchReason {
94
+ rule: MatchRule;
95
+ /** The field that failed: a work field (needs.labels) or a profile field (readings.accounts[2].enabled). */
96
+ field: string;
97
+ detail: string;
98
+ }
99
+ export interface MatchRejection {
100
+ subject: "environment" | "pair";
101
+ environment_id: string;
102
+ /** Pairs only. */
103
+ engine?: string;
104
+ /** Pairs only; null for a login held by another person, which has no account id. */
105
+ account_id?: string | null;
106
+ holder?: string | null;
107
+ owning_company?: string | null;
108
+ /** Exactly one reason. */
109
+ reason: MatchReason;
110
+ }
111
+ export interface MatchFeasibleEnvironment {
112
+ environment_id: string;
113
+ kind: string;
114
+ state: string;
115
+ /** Conditions the dispatcher must still meet, e.g. a post-start preflight. */
116
+ flags: string[];
117
+ pairs: number;
118
+ }
119
+ export type RoomBasis = "fresh" | "stale" | "unknown";
120
+ export type ComputeBasis = "fresh" | "stale" | "unknown" | "template";
121
+ export interface MatchScoreTerms {
122
+ room: number;
123
+ compute: number;
124
+ locality: number;
125
+ soft_labels: number;
126
+ engine_order: number;
127
+ cost: number;
128
+ start_time: number;
129
+ taints: number;
130
+ }
131
+ export interface MatchRankedPair {
132
+ rank: number;
133
+ environment_id: string;
134
+ kind: string;
135
+ engine: string;
136
+ /** null for a template, which pairs through its engine label. */
137
+ account_id: string | null;
138
+ pairing: "account" | "template-label";
139
+ holder: string | null;
140
+ /** The login's business. A ranking (tie-break) and reporting input, never a filter for the owner's logins. */
141
+ owning_company: string | null;
142
+ score: number;
143
+ terms: MatchScoreTerms;
144
+ room: {
145
+ basis: RoomBasis;
146
+ left_percent: number | null;
147
+ observed_at: string | null;
148
+ };
149
+ compute: {
150
+ basis: ComputeBasis;
151
+ load_per_vcpu: number | null;
152
+ };
153
+ flags: string[];
154
+ }
155
+ export interface MatchResult {
156
+ schema_version: typeof MATCH_RESULT_SCHEMA_VERSION;
157
+ /** Always "first-ranking": the conductor makes the choice. */
158
+ output: "first-ranking";
159
+ notice: string;
160
+ work_id: string;
161
+ company: string;
162
+ now: string;
163
+ weights: MatchWeights;
164
+ feasible: MatchFeasibleEnvironment[];
165
+ rejected: MatchRejection[];
166
+ ranked: MatchRankedPair[];
167
+ }
168
+ export interface MatchOptions {
169
+ /** The match time. Every reading is aged against it. Required: the library reads no clock. */
170
+ now: Date | string;
171
+ weights?: Partial<MatchWeights>;
172
+ }
173
+ export type Freshness = "fresh" | "stale" | "future" | "missing";
174
+ /** The clock the readings are aged against: now and the skew allowance, in ms. */
175
+ interface Clock {
176
+ nowMs: number;
177
+ skewMs: number;
178
+ }
179
+ /**
180
+ * fresh: observed at most ttl_seconds before now (a reading up to the skew
181
+ * allowance after now counts as observed at now). stale: older than its ttl.
182
+ * future: observed more than the skew allowance after now. missing: no
183
+ * observed_at, or one that is not a date-time.
184
+ */
185
+ export declare function readingFreshness(observedAt: string | null | undefined, ttlSeconds: number, clock: Clock): Freshness;
186
+ /**
187
+ * Filter environments for one piece of work and rank the pairs that remain.
188
+ * Pure: the same inputs and `now` always give the same result.
189
+ */
190
+ export declare function match(requirements: WorkRequirements, profiles: readonly EnvironmentProfile[], options: MatchOptions): MatchResult;
191
+ export {};
192
+ //# sourceMappingURL=match.d.ts.map