@indigoai-us/hq-cli 5.345.251 → 5.345.252

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 (160) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/assets/scaffold/core/scripts/hq-session.sh +9 -0
  3. package/contracts/host-canary-release.json +9 -3
  4. package/dist/command-catalog.generated.d.ts +121 -1
  5. package/dist/command-catalog.generated.js +148 -1
  6. package/dist/commands/bot.js +7 -2
  7. package/dist/commands/core-bucket-c-work-mesh-offer-native.js +1 -1
  8. package/dist/commands/core-hq-session-binding.d.ts +140 -0
  9. package/dist/commands/core-hq-session-binding.js +363 -0
  10. package/dist/commands/core-hq-session-native.d.ts +23 -0
  11. package/dist/commands/core-hq-session-native.js +59 -9
  12. package/dist/commands/core-stop-autosave.js +1 -1
  13. package/dist/commands/core.js +10 -0
  14. package/dist/commands/doctor.d.ts +5 -1
  15. package/dist/commands/doctor.js +42 -5
  16. package/dist/commands/files.js +1 -1
  17. package/dist/commands/install-global.js +4 -2
  18. package/dist/commands/logout.js +4 -0
  19. package/dist/commands/ontology-graph.d.ts +2 -0
  20. package/dist/commands/ontology-graph.js +33 -0
  21. package/dist/commands/report.js +35 -2
  22. package/dist/commands/storage-gate.js +1 -1
  23. package/dist/commands/vault-retention-flag.js +2 -1
  24. package/dist/commands/whoami.js +1 -1
  25. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +238 -221
  26. package/dist/hq-cloud-sync-runner/package.json +1 -1
  27. package/dist/index.js +3 -1
  28. package/dist/lib/agent-kit/inbox-poll-backoff-flag.js +1 -1
  29. package/dist/lib/agent-kit/mcp/tools.js +48 -0
  30. package/dist/lib/bot/fleet-bots-update-pass.js +1 -1
  31. package/dist/lib/bot/fleet-cron.d.ts +35 -0
  32. package/dist/lib/bot/fleet-cron.js +54 -12
  33. package/dist/lib/bot/fleet-local.d.ts +18 -0
  34. package/dist/lib/bot/fleet-local.js +51 -5
  35. package/dist/lib/bot/inbox-poll-backoff-flag.js +1 -1
  36. package/dist/lib/bot/signals-engine-flag.d.ts +1 -1
  37. package/dist/lib/bot/signals-engine-flag.js +1 -1
  38. package/dist/lib/cli-invite-nudge.js +1 -1
  39. package/dist/lib/client-version.d.ts +2 -0
  40. package/dist/lib/client-version.js +24 -0
  41. package/dist/lib/company-flag-gate.d.ts +30 -0
  42. package/dist/lib/company-flag-gate.js +104 -0
  43. package/dist/lib/core-utils/hook-timeout-debug-context-flag.js +1 -1
  44. package/dist/lib/daemon/flag.js +2 -1
  45. package/dist/lib/daemon/legacy-journal-gate.js +3 -1
  46. package/dist/lib/daemon/shared-flag-reads.js +1 -1
  47. package/dist/lib/doctor/checks/host-core.js +22 -4
  48. package/dist/lib/doctor/checks/jq.d.ts +27 -6
  49. package/dist/lib/doctor/checks/jq.js +46 -8
  50. package/dist/lib/doctor/client-health-reason-codes-flag.js +1 -1
  51. package/dist/lib/doctor/fix/refresh-sync-handoff.d.ts +1 -1
  52. package/dist/lib/doctor/fix/refresh-sync-handoff.js +1 -1
  53. package/dist/lib/flag-client-gate-headers.d.ts +38 -0
  54. package/dist/lib/flag-client-gate-headers.js +62 -0
  55. package/dist/lib/flag-client-headers.d.ts +15 -0
  56. package/dist/lib/flag-client-headers.js +25 -0
  57. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  58. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  59. package/dist/lib/flag-registry-worker.js +35 -0
  60. package/dist/lib/flag-registry.d.ts +1 -20
  61. package/dist/lib/flag-registry.js +5 -81
  62. package/dist/lib/hook-engine/adapter-core-pin.d.ts +29 -0
  63. package/dist/lib/hook-engine/adapter-core-pin.js +29 -0
  64. package/dist/lib/hook-engine/coverage.d.ts +50 -1
  65. package/dist/lib/hook-engine/coverage.js +111 -7
  66. package/dist/lib/hook-engine/reconcile.js +3 -2
  67. package/dist/lib/hot-channels/prompts/signals-pass.md +20 -0
  68. package/dist/lib/hot-channels/signal-changes.d.ts +228 -0
  69. package/dist/lib/hot-channels/signal-changes.js +683 -0
  70. package/dist/lib/hot-channels/signals-pass.d.ts +24 -0
  71. package/dist/lib/hot-channels/signals-pass.js +232 -12
  72. package/dist/lib/lanes/outpost-worktree-pruner-flag.d.ts +1 -1
  73. package/dist/lib/lanes/outpost-worktree-pruner-flag.js +1 -1
  74. package/dist/lib/lanes/registry-flag.js +2 -1
  75. package/dist/lib/lanes/spawn.js +11 -1
  76. package/dist/lib/mesh/live/binding-intent.d.ts +61 -0
  77. package/dist/lib/mesh/live/binding-intent.js +201 -0
  78. package/dist/lib/mesh/live/binding-receipt.d.ts +157 -0
  79. package/dist/lib/mesh/live/binding-receipt.js +365 -0
  80. package/dist/lib/mesh/live/company-flag-refresh.js +1 -1
  81. package/dist/lib/mesh/live/daemon/doctor-telemetry.d.ts +39 -0
  82. package/dist/lib/mesh/live/daemon/doctor-telemetry.js +58 -0
  83. package/dist/lib/mesh/live/daemon/install.js +2 -1
  84. package/dist/lib/mesh/live/daemon/presence.js +9 -0
  85. package/dist/lib/mesh/live/daemon/run.d.ts +3 -0
  86. package/dist/lib/mesh/live/daemon/run.js +33 -1
  87. package/dist/lib/ontology-graph/lineage/index.d.ts +401 -0
  88. package/dist/lib/ontology-graph/lineage/index.js +1027 -0
  89. package/dist/lib/ontology-graph/model/index.d.ts +54 -0
  90. package/dist/lib/ontology-graph/model/index.js +112 -0
  91. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +75 -0
  92. package/dist/lib/ontology-graph/model/pass-tasks.js +166 -0
  93. package/dist/lib/ontology-graph/model/pass.d.ts +6 -0
  94. package/dist/lib/ontology-graph/model/pass.js +9 -2
  95. package/dist/lib/ontology-graph/model/pending-items.d.ts +8 -0
  96. package/dist/lib/ontology-graph/model/pending-items.js +24 -1
  97. package/dist/lib/ontology-graph/model/step.d.ts +1 -1
  98. package/dist/lib/ontology-graph/model/tasks.d.ts +11 -3
  99. package/dist/lib/ontology-graph/model/tasks.js +20 -7
  100. package/dist/lib/ontology-graph/read/brief.js +41 -6
  101. package/dist/lib/ontology-graph/read/index.d.ts +4 -0
  102. package/dist/lib/ontology-graph/read/index.js +173 -29
  103. package/dist/lib/ontology-graph/read/lineage.d.ts +101 -0
  104. package/dist/lib/ontology-graph/read/lineage.js +262 -0
  105. package/dist/lib/ontology-graph/replay/buffered-store.js +17 -0
  106. package/dist/lib/ontology-graph/replay/engine.d.ts +32 -1
  107. package/dist/lib/ontology-graph/replay/engine.js +213 -8
  108. package/dist/lib/ontology-graph/replay/extractors.d.ts +26 -0
  109. package/dist/lib/ontology-graph/replay/extractors.js +25 -1
  110. package/dist/lib/ontology-graph/replay/index.d.ts +2 -0
  111. package/dist/lib/ontology-graph/replay/index.js +9 -3
  112. package/dist/lib/ontology-graph/replay/signal-changes.d.ts +118 -0
  113. package/dist/lib/ontology-graph/replay/signal-changes.js +687 -0
  114. package/dist/lib/ontology-graph/schema/decision-status.d.ts +18 -0
  115. package/dist/lib/ontology-graph/schema/decision-status.js +20 -0
  116. package/dist/lib/ontology-graph/schema/index.d.ts +1 -0
  117. package/dist/lib/ontology-graph/schema/index.js +1 -0
  118. package/dist/lib/ontology-graph/setup/index.js +13 -3
  119. package/dist/lib/search-index/index.d.ts +33 -1
  120. package/dist/lib/search-index/index.js +180 -25
  121. package/dist/lib/search-index/qmd-exit-diagnostics.d.ts +7 -0
  122. package/dist/lib/search-index/qmd-exit-diagnostics.js +25 -1
  123. package/dist/lib/signals/adapters-catalog.js +1 -1
  124. package/dist/lib/sync-core/engine-holds.d.ts +1 -0
  125. package/dist/lib/sync-core/engine-holds.js +26 -0
  126. package/dist/lib/sync-core/engine-home.d.ts +3 -0
  127. package/dist/lib/sync-core/engine-home.js +41 -1
  128. package/dist/lib/sync-core/flag.js +2 -1
  129. package/dist/lib/sync-core/legacy-journal-export-child.js +5 -3
  130. package/dist/lib/sync-core/legacy-journal-export.d.ts +23 -4
  131. package/dist/lib/sync-core/legacy-journal-export.js +120 -55
  132. package/dist/lib/sync-core/reconcile.d.ts +2 -1
  133. package/dist/lib/sync-core/reconcile.js +30 -5
  134. package/dist/lib/sync-invalid-entity-warning.js +2 -1
  135. package/dist/lib/windows/install-followup.d.ts +41 -0
  136. package/dist/lib/windows/install-followup.js +87 -0
  137. package/dist/lib/windows/jq.d.ts +59 -0
  138. package/dist/lib/windows/jq.js +154 -3
  139. package/dist/lib/windows/user-path.d.ts +5 -0
  140. package/dist/lib/windows/user-path.js +1 -1
  141. package/dist/lib/work-context/auto-bind.d.ts +12 -0
  142. package/dist/lib/work-context/auto-bind.js +49 -3
  143. package/dist/lib/work-context/organize.d.ts +4 -2
  144. package/dist/lib/work-context/organize.js +18 -8
  145. package/dist/lib/work-context/reconcile.js +16 -1
  146. package/dist/main.js +12 -1
  147. package/dist/utils/client-health-contract.d.ts +30 -0
  148. package/dist/utils/client-health-contract.js +111 -0
  149. package/dist/utils/client-health.d.ts +5 -2
  150. package/dist/utils/client-health.js +74 -5
  151. package/dist/utils/exclusive-lock.d.ts +5 -1
  152. package/dist/utils/exclusive-lock.js +9 -2
  153. package/dist/utils/host-registration.d.ts +7 -0
  154. package/dist/utils/host-registration.js +10 -1
  155. package/dist/utils/pid.d.ts +31 -0
  156. package/dist/utils/pid.js +65 -0
  157. package/dist/utils/resident-package-preload.js +12 -4
  158. package/dist/utils/sentry-fingerprint.js +3 -0
  159. package/package.json +8 -8
  160. package/scripts/install-hook-engine.mjs +5 -3
@@ -0,0 +1,228 @@
1
+ export declare const CHANGE_KINDS: readonly ["replaces", "reverses", "completes", "withdraws"];
2
+ export type ChangeKind = (typeof CHANGE_KINDS)[number];
3
+ /** Signal types that can change an earlier item, and that can be changed. */
4
+ export declare const CHANGE_SIGNAL_TYPES: readonly ["decision", "action_item", "commitment", "risk"];
5
+ export type ChangeSignalType = (typeof CHANGE_SIGNAL_TYPES)[number];
6
+ /** Earlier items shown to the model per document, at most. */
7
+ export declare const MAX_CHANGE_CANDIDATES = 12;
8
+ /** `changes` entries kept per signal, at most. */
9
+ export declare const MAX_CHANGES_PER_SIGNAL = 4;
10
+ /**
11
+ * Signal files read per audience when the earlier items are listed. Over it,
12
+ * the newest files are read, whatever their type.
13
+ */
14
+ export declare const CANDIDATE_SCAN_LIMIT = 20000;
15
+ /** Source dates looked up per document while its items are picked, at most. */
16
+ export declare const MAX_TIME_LOOKUPS = 36;
17
+ /**
18
+ * Head sizes tried in turn for a source document, whose block can be long (a
19
+ * meeting's list of people and entities). A larger one is read only when the
20
+ * smaller one was cut short and held no closed block.
21
+ */
22
+ export declare const SOURCE_HEAD_BYTES: readonly number[];
23
+ /** Characters of an earlier item's sentence shown to the model. */
24
+ export declare const CANDIDATE_TITLE_MAX_CHARS = 240;
25
+ /** An item is listed on word overlap alone at or above this share of its words. */
26
+ export declare const STRONG_OVERLAP = 0.6;
27
+ /** With a shared entity, this share of its words is enough. */
28
+ export declare const ENTITY_OVERLAP = 0.34;
29
+ /** A quote needs this many words and characters, and may have at most this many words. */
30
+ export declare const QUOTE_MIN_WORDS = 4;
31
+ export declare const QUOTE_MIN_CHARS = 20;
32
+ export declare const QUOTE_MAX_WORDS = 30;
33
+ /** Words of two or more letters or digits a quote needs. */
34
+ export declare const QUOTE_MIN_REAL_WORDS = 3;
35
+ /** Content words the quote's paragraph must share with the target's sentence, without a shared entity. */
36
+ export declare const QUOTE_SHARED_WORDS = 2;
37
+ /** The first line of the block for one turn. `nonce` is made for that turn. */
38
+ export declare function earlierOpenLine(nonce: string): string;
39
+ /** The last line of the block for one turn. */
40
+ export declare function earlierCloseLine(nonce: string): string;
41
+ export declare function changeKindAllowed(targetType: string, kind: string): boolean;
42
+ /** An earlier signal a document may change. */
43
+ export interface EarlierItem {
44
+ /** 64-hex signal id. */
45
+ id: string;
46
+ type: ChangeSignalType;
47
+ /** The signal's one-line sentence (`canonical_content`). */
48
+ title: string;
49
+ sourceRef: string;
50
+ /** Vault-relative document that dates the item: `payload_ref`, else `source_ref` when it is a file. */
51
+ datedBy: string[];
52
+ /** The signal file's own date (`written_at`, else `decision_date`) in ms: the fallback when no source dates the item. */
53
+ writtenMs: number;
54
+ entityRefs: string[];
55
+ /**
56
+ * When the item's source happened, in ms, when that is known without
57
+ * reading the source: an item written by this run, or one whose citation
58
+ * names a Slack message.
59
+ */
60
+ knownMs?: number;
61
+ }
62
+ /** An earlier item as shown to the model, with its label and its time. */
63
+ export interface ShownItem extends EarlierItem {
64
+ /** `E-7f3a`: made for one turn. */
65
+ label: string;
66
+ /** When the item's source happened, in ms. */
67
+ timeMs: number;
68
+ }
69
+ /** One validated `changes` entry, as written to the signal file. */
70
+ export interface SignalChange {
71
+ target: string;
72
+ target_type: ChangeSignalType;
73
+ kind: ChangeKind;
74
+ quote: string;
75
+ }
76
+ export type ChangeDropReason = "not_a_list" | "no_block" | "over_cap" | "bad_shape" | "signal_type" | "unknown_target" | "kind" | "same_source" | "not_older" | "already_changed" | "quote_not_words" | "quote_too_short" | "quote_too_long" | "quote_not_in_document" | "quote_outside_body" | "quote_mid_word" | "quote_unrelated" | "duplicate";
77
+ export interface ChangeValidation {
78
+ kept: SignalChange[];
79
+ dropped: Partial<Record<ChangeDropReason, number>>;
80
+ droppedTotal: number;
81
+ }
82
+ /**
83
+ * The fields of the fenced block at the head of a file. Only the head is
84
+ * read: the first of `sizes` bytes (8 KB by default), and the next size only
85
+ * when that head was cut short and held no closed block. `{}` when the file
86
+ * is unreadable, has no block, or the block does not close within the largest
87
+ * head. `null` when the block is there and its YAML does not parse. Never
88
+ * rejects.
89
+ */
90
+ export declare function readHeadFields(file: string, sizes?: readonly number[]): Promise<Record<string, unknown> | null>;
91
+ /** True for a vault-relative path under `sources/`. */
92
+ export declare function isVaultSource(ref: unknown): ref is string;
93
+ /** A Slack `ts` (`1760954400.123456`, epoch seconds) as ms. `-Infinity` when the value is not one. */
94
+ export declare function slackTsMs(value: unknown): number;
95
+ /**
96
+ * When a source document happened, from the fields at its head and its name:
97
+ * `when`, `created_at`; then, for a Slack thread, `last_message_at`,
98
+ * `first_message_at`, `thread_ts` and the time in the file's name. The last
99
+ * message comes before the first so that a thread is never taken to be older
100
+ * than it is. `-Infinity` when none is there.
101
+ */
102
+ export declare function sourceDocTime(fields: Record<string, unknown>, ref: string): number;
103
+ export interface EarlierItems {
104
+ /** Open items, in no particular order. The pass keeps this list current during a run. */
105
+ items: EarlierItem[];
106
+ /** Files read. */
107
+ scanned: number;
108
+ /** Signal files of the four types in the audience's folders. */
109
+ total: number;
110
+ /** True when `total` is over the scan limit: only the newest files were read. */
111
+ truncated: boolean;
112
+ /** Files skipped because they carry an `audience_key` that is not the audience of the folder. */
113
+ mismatched: number;
114
+ }
115
+ /**
116
+ * The open decisions, action items, commitments and risks of one audience,
117
+ * read from the head of its signal files. An item named by any signal's
118
+ * `changes` is left out, and so is a file that carries an `audience_key`
119
+ * other than `audienceKey`. A file with no `audience_key` belongs to its
120
+ * folder. Unreadable files and folders are skipped.
121
+ *
122
+ * With more files than `scanLimit`, the newest are read whatever their type.
123
+ * A signal file has no date in its name and is written once, so its
124
+ * modification time is the date used for that cut: it needs a stat and no
125
+ * read.
126
+ */
127
+ export declare function loadEarlierItems(vaultRoot: string, audienceKey: string, options?: {
128
+ scanLimit?: number;
129
+ }): Promise<EarlierItems>;
130
+ /** Distinct words of four letters or more, lower case, without the common ones. */
131
+ export declare function contentWords(text: string): Set<string>;
132
+ /** Share of an item's words that the document also uses, 0 to 1. */
133
+ export declare function wordOverlap(itemWords: ReadonlySet<string>, documentWords: ReadonlySet<string>): number;
134
+ export interface PickInput {
135
+ /** The document text, without any appended data. */
136
+ documentText: string;
137
+ /** The landed document's own key: items from the same source are left out. */
138
+ sourceRefs: readonly string[];
139
+ /** When the document happened, in ms. */
140
+ documentMs: number;
141
+ /** Entity ids the document names (from the graph context pack), when there is one. */
142
+ entityIds?: readonly string[];
143
+ /**
144
+ * When an item's source happened, in ms. Not called for an item that carries
145
+ * `knownMs`. A value that is not finite (`-Infinity` for unknown, `NaN` for
146
+ * a source that could not be parsed) leaves the item out.
147
+ */
148
+ timeOf: (item: EarlierItem) => Promise<number>;
149
+ max?: number;
150
+ /** `timeOf` calls for this document, at most. Defaults to `MAX_TIME_LOOKUPS`. */
151
+ maxTimeLookups?: number;
152
+ /** Random hex of `bytes` bytes, for the labels and the block token. Defaults to `crypto.randomBytes`. */
153
+ token?: (bytes: number) => string;
154
+ }
155
+ export interface PickResult {
156
+ shown: ShownItem[];
157
+ /** The token on the block's delimiter lines for this turn. "" when nothing is shown. */
158
+ nonce: string;
159
+ /** `timeOf` calls made. */
160
+ timeLookups: number;
161
+ /** True when a matching item was left out because the lookups were spent. */
162
+ lookupsCapped: boolean;
163
+ }
164
+ /**
165
+ * The earlier items a document may change: those that share an entity with it
166
+ * and some of its words, or most of its words, best match first. Only items
167
+ * from another source that happened before the document are kept. Each shown
168
+ * item gets a label made for this call.
169
+ */
170
+ export declare function pickEarlierItems(items: readonly EarlierItem[], input: PickInput): Promise<PickResult>;
171
+ /** The block appended to the document, or "" when there is nothing to show. */
172
+ export declare function earlierItemsBlock(shown: readonly ShownItem[], nonce: string): string;
173
+ /** Document text in which no line reads as a delimiter of an earlier-items block. */
174
+ export declare function neutralizeDelimiters(text: string): string;
175
+ /**
176
+ * The document with the block appended. Unchanged when nothing is shown.
177
+ * Otherwise any line of the document that looks like a delimiter of the block
178
+ * is rewritten first, so the appended block is the only one.
179
+ */
180
+ export declare function appendEarlierItems(text: string, shown: readonly ShownItem[], nonce: string): string;
181
+ /** Lower case, typographic quotes made plain, every run of whitespace one space. */
182
+ export declare function squashQuote(text: string): string;
183
+ /**
184
+ * The stretches of document body a quote may come from. Each part is one file
185
+ * as it was sent (the landed document, then its payload when there is one).
186
+ * A part's own fenced block at its head is left out, and so is every line
187
+ * that reads as a delimiter or a row of an earlier-items block. Such a line
188
+ * is only that line: the text after it is ordinary text. With `nonce`, the
189
+ * turn's own block is left out whole, from its opening line with that token
190
+ * to its closing line (or the end of the part). A quote cannot run across
191
+ * what was left out.
192
+ */
193
+ export declare function quotableSegments(parts: readonly string[], nonce?: string): string[];
194
+ export interface ChangeContext {
195
+ /** The items shown for this document, with the labels of its turn. */
196
+ shown: readonly ShownItem[];
197
+ /** The token on the delimiter lines of this turn's block. */
198
+ nonce?: string;
199
+ /**
200
+ * The document as it was before any data was appended, one string per file
201
+ * sent: the landed document, then its payload when there is one.
202
+ */
203
+ documentParts: readonly string[];
204
+ documentMs: number;
205
+ sourceRefs: readonly string[];
206
+ /** Entity ids named in a stretch of the document (from the graph context pack), when there is one. */
207
+ entitiesIn?: (text: string) => readonly string[];
208
+ /** Ids of items another signal of this run already changed. */
209
+ taken?: ReadonlySet<string>;
210
+ }
211
+ /**
212
+ * Checks the `changes` value of one signal from the model's reply against the
213
+ * items that were shown and the document. Returns what holds and a count of
214
+ * what does not, by reason. Never throws.
215
+ */
216
+ export declare function validateChanges(raw: unknown, signalType: string, context: ChangeContext): ChangeValidation;
217
+ /**
218
+ * `changes` and `changes_dropped` for a signal file; nothing when neither
219
+ * applies. Entries that came with no block shown are not counted here: they
220
+ * are counted for the run only.
221
+ */
222
+ export declare function changeFields(validation: ChangeValidation): {
223
+ changes?: SignalChange[];
224
+ changes_dropped?: number;
225
+ };
226
+ /** `over_cap 2, unknown_target 4` for a warning line. */
227
+ export declare function describeDropped(dropped: Partial<Record<ChangeDropReason, number>>): string;
228
+ //# sourceMappingURL=signal-changes.d.ts.map