@indigoai-us/hq-cli 5.345.251 → 5.345.253

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 (188) hide show
  1. package/CHANGELOG.md +153 -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 +269 -1
  5. package/dist/command-catalog.generated.js +330 -1
  6. package/dist/command-registration-plan.d.ts +6 -0
  7. package/dist/command-registration-plan.js +1 -0
  8. package/dist/commands/bot.js +7 -2
  9. package/dist/commands/ci-intake.d.ts +15 -0
  10. package/dist/commands/ci-intake.js +252 -0
  11. package/dist/commands/ci-metrics.d.ts +8 -0
  12. package/dist/commands/ci-metrics.js +55 -0
  13. package/dist/commands/ci.d.ts +13 -0
  14. package/dist/commands/ci.js +10 -0
  15. package/dist/commands/core-bucket-c-work-mesh-offer-native.js +1 -1
  16. package/dist/commands/core-hq-session-binding.d.ts +140 -0
  17. package/dist/commands/core-hq-session-binding.js +363 -0
  18. package/dist/commands/core-hq-session-native.d.ts +23 -0
  19. package/dist/commands/core-hq-session-native.js +59 -9
  20. package/dist/commands/core-stop-autosave.js +1 -1
  21. package/dist/commands/core.js +10 -0
  22. package/dist/commands/doctor.d.ts +5 -1
  23. package/dist/commands/doctor.js +42 -5
  24. package/dist/commands/files.d.ts +62 -0
  25. package/dist/commands/files.js +250 -9
  26. package/dist/commands/install-global.js +4 -2
  27. package/dist/commands/logout.js +4 -0
  28. package/dist/commands/ontology-graph.d.ts +2 -0
  29. package/dist/commands/ontology-graph.js +33 -0
  30. package/dist/commands/report.js +35 -2
  31. package/dist/commands/storage-gate.js +1 -1
  32. package/dist/commands/vault-retention-flag.js +2 -1
  33. package/dist/commands/whoami.js +1 -1
  34. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +238 -221
  35. package/dist/hq-cloud-sync-runner/package.json +1 -1
  36. package/dist/index.js +3 -1
  37. package/dist/lib/agent-kit/inbox-poll-backoff-flag.js +1 -1
  38. package/dist/lib/agent-kit/mcp/tools.js +48 -0
  39. package/dist/lib/bot/fleet-bots-update-pass.js +1 -1
  40. package/dist/lib/bot/fleet-cron.d.ts +50 -0
  41. package/dist/lib/bot/fleet-cron.js +173 -32
  42. package/dist/lib/bot/fleet-local.d.ts +18 -0
  43. package/dist/lib/bot/fleet-local.js +51 -5
  44. package/dist/lib/bot/inbox-poll-backoff-flag.js +1 -1
  45. package/dist/lib/bot/signals-engine-flag.d.ts +1 -1
  46. package/dist/lib/bot/signals-engine-flag.js +1 -1
  47. package/dist/lib/cli-invite-nudge.js +1 -1
  48. package/dist/lib/client-version.d.ts +2 -0
  49. package/dist/lib/client-version.js +24 -0
  50. package/dist/lib/company-flag-gate.d.ts +30 -0
  51. package/dist/lib/company-flag-gate.js +104 -0
  52. package/dist/lib/core-utils/hook-timeout-debug-context-flag.js +1 -1
  53. package/dist/lib/daemon/flag.js +2 -1
  54. package/dist/lib/daemon/legacy-journal-gate.js +3 -1
  55. package/dist/lib/daemon/run.js +4 -3
  56. package/dist/lib/daemon/shared-flag-reads.js +1 -1
  57. package/dist/lib/delivery/migrations.d.ts +32 -1
  58. package/dist/lib/delivery/migrations.js +69 -8
  59. package/dist/lib/doctor/checks/host-core.js +22 -4
  60. package/dist/lib/doctor/checks/jq.d.ts +27 -6
  61. package/dist/lib/doctor/checks/jq.js +46 -8
  62. package/dist/lib/doctor/client-health-reason-codes-flag.js +1 -1
  63. package/dist/lib/doctor/fix/refresh-sync-handoff.d.ts +1 -1
  64. package/dist/lib/doctor/fix/refresh-sync-handoff.js +1 -1
  65. package/dist/lib/flag-client-gate-headers.d.ts +38 -0
  66. package/dist/lib/flag-client-gate-headers.js +62 -0
  67. package/dist/lib/flag-client-headers.d.ts +15 -0
  68. package/dist/lib/flag-client-headers.js +25 -0
  69. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  70. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  71. package/dist/lib/flag-registry-worker.js +35 -0
  72. package/dist/lib/flag-registry.d.ts +1 -20
  73. package/dist/lib/flag-registry.js +5 -81
  74. package/dist/lib/hook-engine/adapter-core-pin.d.ts +30 -0
  75. package/dist/lib/hook-engine/adapter-core-pin.js +30 -0
  76. package/dist/lib/hook-engine/coverage.d.ts +65 -1
  77. package/dist/lib/hook-engine/coverage.js +173 -8
  78. package/dist/lib/hook-engine/reconcile.js +3 -2
  79. package/dist/lib/hot-channels/prompts/signals-pass.md +20 -0
  80. package/dist/lib/hot-channels/signal-changes.d.ts +228 -0
  81. package/dist/lib/hot-channels/signal-changes.js +683 -0
  82. package/dist/lib/hot-channels/signals-pass.d.ts +24 -0
  83. package/dist/lib/hot-channels/signals-pass.js +232 -12
  84. package/dist/lib/lanes/outpost-worktree-pruner-flag.d.ts +1 -1
  85. package/dist/lib/lanes/outpost-worktree-pruner-flag.js +1 -1
  86. package/dist/lib/lanes/registry-flag.js +2 -1
  87. package/dist/lib/lanes/spawn.js +11 -1
  88. package/dist/lib/mesh/live/binding-intent.d.ts +61 -0
  89. package/dist/lib/mesh/live/binding-intent.js +201 -0
  90. package/dist/lib/mesh/live/binding-receipt.d.ts +157 -0
  91. package/dist/lib/mesh/live/binding-receipt.js +365 -0
  92. package/dist/lib/mesh/live/company-flag-refresh.js +1 -1
  93. package/dist/lib/mesh/live/daemon/doctor-telemetry.d.ts +39 -0
  94. package/dist/lib/mesh/live/daemon/doctor-telemetry.js +58 -0
  95. package/dist/lib/mesh/live/daemon/install.js +2 -1
  96. package/dist/lib/mesh/live/daemon/presence.js +9 -0
  97. package/dist/lib/mesh/live/daemon/run.d.ts +3 -0
  98. package/dist/lib/mesh/live/daemon/run.js +33 -1
  99. package/dist/lib/ontology-graph/lineage/index.d.ts +401 -0
  100. package/dist/lib/ontology-graph/lineage/index.js +1027 -0
  101. package/dist/lib/ontology-graph/model/index.d.ts +54 -0
  102. package/dist/lib/ontology-graph/model/index.js +112 -0
  103. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +75 -0
  104. package/dist/lib/ontology-graph/model/pass-tasks.js +166 -0
  105. package/dist/lib/ontology-graph/model/pass.d.ts +6 -0
  106. package/dist/lib/ontology-graph/model/pass.js +9 -2
  107. package/dist/lib/ontology-graph/model/pending-items.d.ts +8 -0
  108. package/dist/lib/ontology-graph/model/pending-items.js +24 -1
  109. package/dist/lib/ontology-graph/model/step.d.ts +1 -1
  110. package/dist/lib/ontology-graph/model/tasks.d.ts +11 -3
  111. package/dist/lib/ontology-graph/model/tasks.js +20 -7
  112. package/dist/lib/ontology-graph/read/brief.js +41 -6
  113. package/dist/lib/ontology-graph/read/index.d.ts +4 -0
  114. package/dist/lib/ontology-graph/read/index.js +173 -29
  115. package/dist/lib/ontology-graph/read/lineage.d.ts +101 -0
  116. package/dist/lib/ontology-graph/read/lineage.js +262 -0
  117. package/dist/lib/ontology-graph/replay/buffered-store.js +17 -0
  118. package/dist/lib/ontology-graph/replay/engine.d.ts +32 -1
  119. package/dist/lib/ontology-graph/replay/engine.js +213 -8
  120. package/dist/lib/ontology-graph/replay/extractors.d.ts +26 -0
  121. package/dist/lib/ontology-graph/replay/extractors.js +25 -1
  122. package/dist/lib/ontology-graph/replay/index.d.ts +2 -0
  123. package/dist/lib/ontology-graph/replay/index.js +9 -3
  124. package/dist/lib/ontology-graph/replay/signal-changes.d.ts +118 -0
  125. package/dist/lib/ontology-graph/replay/signal-changes.js +687 -0
  126. package/dist/lib/ontology-graph/schema/decision-status.d.ts +18 -0
  127. package/dist/lib/ontology-graph/schema/decision-status.js +20 -0
  128. package/dist/lib/ontology-graph/schema/index.d.ts +1 -0
  129. package/dist/lib/ontology-graph/schema/index.js +1 -0
  130. package/dist/lib/ontology-graph/setup/index.js +13 -3
  131. package/dist/lib/search-index/index.d.ts +33 -1
  132. package/dist/lib/search-index/index.js +180 -25
  133. package/dist/lib/search-index/qmd-exit-diagnostics.d.ts +7 -0
  134. package/dist/lib/search-index/qmd-exit-diagnostics.js +25 -1
  135. package/dist/lib/signals/adapters-catalog.js +1 -1
  136. package/dist/lib/smart-ci/cost.d.ts +72 -0
  137. package/dist/lib/smart-ci/cost.js +120 -0
  138. package/dist/lib/smart-ci/github.d.ts +112 -0
  139. package/dist/lib/smart-ci/github.js +267 -0
  140. package/dist/lib/smart-ci/intake.d.ts +288 -0
  141. package/dist/lib/smart-ci/intake.js +1078 -0
  142. package/dist/lib/smart-ci/ledger.d.ts +218 -0
  143. package/dist/lib/smart-ci/ledger.js +527 -0
  144. package/dist/lib/smart-ci/metrics.d.ts +137 -0
  145. package/dist/lib/smart-ci/metrics.js +249 -0
  146. package/dist/lib/smart-ci/records.d.ts +265 -0
  147. package/dist/lib/smart-ci/records.js +281 -0
  148. package/dist/lib/smart-ci/reducer.d.ts +67 -0
  149. package/dist/lib/smart-ci/reducer.js +261 -0
  150. package/dist/lib/sync-core/engine-holds.d.ts +15 -0
  151. package/dist/lib/sync-core/engine-holds.js +104 -11
  152. package/dist/lib/sync-core/engine-home.d.ts +3 -0
  153. package/dist/lib/sync-core/engine-home.js +41 -1
  154. package/dist/lib/sync-core/flag.js +2 -1
  155. package/dist/lib/sync-core/hand-back.d.ts +1 -0
  156. package/dist/lib/sync-core/hand-back.js +7 -2
  157. package/dist/lib/sync-core/legacy-journal-export-child.js +5 -3
  158. package/dist/lib/sync-core/legacy-journal-export.d.ts +23 -4
  159. package/dist/lib/sync-core/legacy-journal-export.js +120 -55
  160. package/dist/lib/sync-core/reconcile.d.ts +2 -1
  161. package/dist/lib/sync-core/reconcile.js +40 -7
  162. package/dist/lib/sync-invalid-entity-warning.js +2 -1
  163. package/dist/lib/windows/install-followup.d.ts +41 -0
  164. package/dist/lib/windows/install-followup.js +87 -0
  165. package/dist/lib/windows/jq.d.ts +59 -0
  166. package/dist/lib/windows/jq.js +154 -3
  167. package/dist/lib/windows/user-path.d.ts +5 -0
  168. package/dist/lib/windows/user-path.js +1 -1
  169. package/dist/lib/work-context/auto-bind.d.ts +12 -0
  170. package/dist/lib/work-context/auto-bind.js +49 -3
  171. package/dist/lib/work-context/organize.d.ts +4 -2
  172. package/dist/lib/work-context/organize.js +18 -8
  173. package/dist/lib/work-context/reconcile.js +16 -1
  174. package/dist/main.js +12 -1
  175. package/dist/utils/client-health-contract.d.ts +30 -0
  176. package/dist/utils/client-health-contract.js +111 -0
  177. package/dist/utils/client-health.d.ts +5 -2
  178. package/dist/utils/client-health.js +74 -5
  179. package/dist/utils/exclusive-lock.d.ts +5 -1
  180. package/dist/utils/exclusive-lock.js +9 -2
  181. package/dist/utils/host-registration.d.ts +7 -0
  182. package/dist/utils/host-registration.js +10 -1
  183. package/dist/utils/pid.d.ts +31 -0
  184. package/dist/utils/pid.js +65 -0
  185. package/dist/utils/resident-package-preload.js +12 -4
  186. package/dist/utils/sentry-fingerprint.js +3 -0
  187. package/package.json +10 -8
  188. package/scripts/install-hook-engine.mjs +5 -3
@@ -0,0 +1,288 @@
1
+ import { type GitHubReadClient, type RequestCounts } from "./github.js";
2
+ import type { ApplyReport, CursorMove, SmartCiLedger } from "./ledger.js";
3
+ import { OBSERVATION_TYPES, type Observation, type RunBody } from "./records.js";
4
+ export declare class IntakeInputError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ /**
8
+ * Reduces observations to records and commits them with their cursors.
9
+ *
10
+ * stage() adds to a batch held in memory; flush() writes the batch and its
11
+ * cursors in one commit. Reads through the engine (runs, peek, cursor) see the
12
+ * batch laid over the ledger, so a poll cycle can act on what it has just read
13
+ * before anything is committed.
14
+ */
15
+ export declare class IntakeEngine {
16
+ private readonly ledger;
17
+ private reducer;
18
+ private readonly cursors;
19
+ constructor(ledger: SmartCiLedger);
20
+ /** Add observations and cursor moves to the batch. A malformed observation refuses the whole call; nothing of it is staged. */
21
+ stage(observations: readonly Observation[], cursors?: readonly CursorMove[]): void;
22
+ /** Add a record that is not derived from an observation (a gap note) to the batch. */
23
+ stageRecord(kind: string, id: string, body: Record<string, unknown>): void;
24
+ /** Commit the batch: its records and cursors, plus any cursors given here, in one commit. */
25
+ flush(extraCursors?: readonly CursorMove[]): ApplyReport;
26
+ /** Record a batch and move the cursors in one commit. A malformed observation refuses the whole batch; nothing is written. */
27
+ apply(observations: readonly Observation[], cursors?: readonly CursorMove[]): ApplyReport;
28
+ /** Drop the batch and read the ledger again. */
29
+ reset(): void;
30
+ /** Every run record, as it will be after the batch. */
31
+ runs(): RunBody[];
32
+ peek<T extends Record<string, unknown>>(kind: string, id: string): T | undefined;
33
+ cursor(stream: string): string | null;
34
+ }
35
+ export interface FixtureHeader {
36
+ id: string;
37
+ repo: string;
38
+ from: string;
39
+ to: string;
40
+ recordedAt: string;
41
+ observations: number;
42
+ }
43
+ export interface Fixture {
44
+ header: FixtureHeader;
45
+ observations: Observation[];
46
+ }
47
+ /** One header line, then one observation per line. */
48
+ export declare function serializeFixture(header: Omit<FixtureHeader, "id" | "observations">, observations: readonly Observation[]): string;
49
+ /** Read a fixture file (.jsonl or .jsonl.gz). Every line is validated; a bad line is refused with its number. */
50
+ export declare function readFixture(path: string): Fixture;
51
+ export interface ReplayReport {
52
+ fixtureId: string;
53
+ total: number;
54
+ /** Observations already recorded by an earlier run and skipped. */
55
+ resumedFrom: number;
56
+ applied: number;
57
+ batches: number;
58
+ created: number;
59
+ updated: number;
60
+ unchanged: number;
61
+ }
62
+ export declare const fixtureStream: (fixtureId: string) => string;
63
+ /**
64
+ * Replay a fixture into the ledger in batches. The cursor is the count of
65
+ * observations recorded, and it moves in the same commit as each batch, so a
66
+ * replay killed part way continues at the first unrecorded observation, and a
67
+ * second replay of a finished fixture writes nothing.
68
+ */
69
+ export declare function replayFixture(ledger: SmartCiLedger, fixture: Fixture, opts?: {
70
+ batchSize?: number;
71
+ fromStart?: boolean;
72
+ onBatch?: (done: number, total: number) => void;
73
+ }): ReplayReport;
74
+ export interface PollerOptions {
75
+ repos: string[];
76
+ /** Org whose runner pools are sampled, or null to skip. */
77
+ runnerOrg: string | null;
78
+ /**
79
+ * Record runs, pull requests and pushes from this time on. Used only for a
80
+ * ledger that has no cursor yet. GitHub gives times in whole seconds, so the
81
+ * start is taken down to its whole second: a run created in the second the
82
+ * intake starts is recorded.
83
+ */
84
+ startAt: string;
85
+ /** Ask again for the jobs of a run that is still going at most this often. Default 10 minutes. */
86
+ activeRefreshMs?: number;
87
+ /** Ask by id for the state of an open run the listing no longer reaches at most this often. Default 2 minutes. */
88
+ statusRefreshMs?: number;
89
+ /** Sample the runner pools at most this often. Default 2 minutes. */
90
+ runnerSampleMs?: number;
91
+ /**
92
+ * List the runs GitHub reports as queued or in progress at most this often:
93
+ * how reruns of older runs are found. Default 0, every cycle. Each listing is
94
+ * a conditional request, so an unchanged one is not charged.
95
+ */
96
+ rerunSweepMs?: number;
97
+ /** Read the run listing again this far behind the cursor, for runs GitHub lists late. Default 15 minutes. */
98
+ overlapMs?: number;
99
+ /** Pages of 100 a listing is followed for in one cycle. Past it the cursor moves on and a gap record is written. Default 10. */
100
+ maxListPages?: number;
101
+ /**
102
+ * Charged requests (every answer but a 304) the intake allows itself in any
103
+ * hour, counted across restarts. Every request is checked against it.
104
+ * Default 1500.
105
+ */
106
+ hourlyBudget?: number;
107
+ /** Make no request while GitHub reports this many or fewer left in the login's hourly allowance. Default 500. */
108
+ rateFloor?: number;
109
+ /** Read the check runs of each finished run's head. Default true. */
110
+ checkRuns?: boolean;
111
+ /** Closed records last written longer ago than this are moved to archive files. 0 keeps everything in the active file. Default 2 hours. */
112
+ activeWindowMs?: number;
113
+ /** Look for records to archive at most this often. Default 15 minutes. */
114
+ rotateEveryMs?: number;
115
+ clock?: () => number;
116
+ log?: (line: string) => void;
117
+ }
118
+ export interface CycleReport {
119
+ startedAt: string;
120
+ observations: number;
121
+ created: number;
122
+ updated: number;
123
+ runsFinalized: number;
124
+ openRuns: number;
125
+ skipped: string[];
126
+ /** Gap records written this cycle. */
127
+ gaps: number;
128
+ /** Records moved to archive files this cycle. */
129
+ archived: number;
130
+ /** Charged requests in the last hour, counted across restarts: the number the budget is checked against. */
131
+ chargedLastHour: number;
132
+ requests: RequestCounts;
133
+ }
134
+ export declare const DEFAULT_HOURLY_BUDGET = 1500;
135
+ export declare const DEFAULT_RATE_FLOOR = 500;
136
+ /** A time in milliseconds taken down to its whole second, the precision of GitHub's timestamps. */
137
+ export declare function wholeSecond(ms: number): number;
138
+ /** Charged requests by clock minute for the last hour, as JSON: the budget's memory across restarts. */
139
+ export declare const REQUEST_COUNT_STREAM = "smart-ci:requests:github";
140
+ /** Polls GitHub for the configured repos and records what changed, one commit a cycle. */
141
+ export declare class Poller {
142
+ private readonly ledger;
143
+ private readonly client;
144
+ private readonly opts;
145
+ private readonly engine;
146
+ private readonly clock;
147
+ private readonly log;
148
+ private readonly activeRefreshMs;
149
+ private readonly statusRefreshMs;
150
+ private readonly runnerSampleMs;
151
+ private readonly rerunSweepMs;
152
+ private readonly overlapMs;
153
+ private readonly maxListPages;
154
+ private readonly hourlyBudget;
155
+ private readonly rateFloor;
156
+ private readonly activeWindowMs;
157
+ private readonly rotateEveryMs;
158
+ private readonly lastJobsFetch;
159
+ private readonly lastStatusCheck;
160
+ /** Runs whose jobs filled more than one page: read without If-None-Match. */
161
+ private readonly multiPage;
162
+ private readonly checkedShas;
163
+ private readonly checkQueue;
164
+ private readonly lastRerunSweep;
165
+ /** Per repo: the oldest created_at the last run listing reached. Runs newer than this had their status read from the listing. */
166
+ private readonly listingFloor;
167
+ /** Per repo: the oldest created_at on page 1 of the last full listing. */
168
+ private readonly pageOneFloor;
169
+ /** Charged requests of earlier processes in the last hour, by clock minute. */
170
+ private carried;
171
+ /** No requests before this clock time: set when GitHub rate limits the intake or the allowance is low. */
172
+ private pausedUntil;
173
+ private lastRunnerSample;
174
+ private lastRotate;
175
+ private runnersUnavailable;
176
+ private readonly get;
177
+ /** opts.startAt taken down to its whole second. */
178
+ private readonly startAt;
179
+ constructor(ledger: SmartCiLedger, client: GitHubReadClient, opts: PollerOptions);
180
+ /** Charged requests in the last hour: this process's and, from the ledger, those of the processes before it. */
181
+ chargedLastHour(): number;
182
+ /**
183
+ * True when one more request may be made now. `reserve` is the share of the
184
+ * budget this kind of read leaves for more important ones.
185
+ */
186
+ private allow;
187
+ /** The one way the poller makes a request: refused once the budget or the rate floor is reached. */
188
+ private read;
189
+ /**
190
+ * Put what a stream read into the cycle's batch. An observation GitHub
191
+ * returned in a shape the ledger cannot hold is left out and logged, so one
192
+ * odd object cannot stop the stream or pin its cursor.
193
+ */
194
+ private stage;
195
+ private gap;
196
+ /**
197
+ * One pass over every repo and the runner pools, committed once at the end.
198
+ * A failed stream is logged and the others still run. With `sweep`, every
199
+ * open run is asked for its state and jobs whatever its last read time: the
200
+ * intake does this once as it stops.
201
+ */
202
+ cycle(opts?: {
203
+ sweep?: boolean;
204
+ }): Promise<CycleReport>;
205
+ /** The last pass before the intake stops: every open run is read once more, within the budget. */
206
+ finish(): Promise<CycleReport>;
207
+ private requestCountPosition;
208
+ /** Move closed records older than the active window into archive files, so the file each commit rewrites stays small. */
209
+ private rotate;
210
+ /** After a rate-limit answer, stop asking until GitHub's stated time. A plain permission refusal is not one. */
211
+ private backOff;
212
+ private openRuns;
213
+ /**
214
+ * Read the newest runs, page by page, back to a little behind the cursor.
215
+ *
216
+ * - Every run created at or after `cursor - overlap` is recorded, so a run
217
+ * GitHub lists late is still picked up; records are keyed, so reading the
218
+ * overlap again writes nothing. A run behind the cursor that is older than
219
+ * the active window is left alone: its record may have moved to an
220
+ * archive file, and reading it as new would record it a second time.
221
+ * - Older runs on the pages read are recorded only when the ledger holds
222
+ * them open (a status change) or when they are a new attempt that changed
223
+ * inside the overlap (a rerun).
224
+ * - The listing never pages back for an old open run: those are asked for
225
+ * by id (refreshOpenRuns).
226
+ * - Each page is checked against the request budget, and at most
227
+ * maxListPages are read. When either stops the read short of the cursor,
228
+ * the cursor still moves to the newest run and the stretch not read is
229
+ * written as a gap record, so a long stop costs a bounded number of
230
+ * requests once and the hole is visible in the ledger.
231
+ */
232
+ private discoverRuns;
233
+ /**
234
+ * List the runs GitHub reports as in progress or queued, one page each. A
235
+ * rerun keeps its original created_at, so the listing by creation time never
236
+ * shows the rerun of an old run; this does. It also finds a run that is
237
+ * active but was never recorded.
238
+ */
239
+ private sweepActiveRuns;
240
+ /**
241
+ * For each run not yet final: once it completed, read all of its jobs and
242
+ * mark it final in the same commit, provided every job of that attempt
243
+ * reads completed; while it is going, read its jobs at most every
244
+ * activeRefreshMs. Completed runs first, then the runs read longest ago. A
245
+ * run that cannot be read is logged and the next one is still tried.
246
+ */
247
+ private refreshOpenRuns;
248
+ private queueCheckRuns;
249
+ /**
250
+ * Check runs of the heads whose runs finished, read last and only while a
251
+ * fifth of the budget is still free: a workflow job is itself a check run
252
+ * and is already recorded, so this adds only the checks other apps report.
253
+ */
254
+ private readCheckRuns;
255
+ private readPulls;
256
+ private readActivity;
257
+ private sampleRunners;
258
+ }
259
+ export interface RecordOptions {
260
+ repo: string;
261
+ /** Inclusive start, ISO. */
262
+ from: string;
263
+ /** Exclusive end, ISO. */
264
+ to: string;
265
+ checkRuns?: boolean;
266
+ log?: (line: string) => void;
267
+ }
268
+ /**
269
+ * Read one past window of a repo from GitHub and return it as the stream of
270
+ * observations a live intake would have seen, in time order: each run when it
271
+ * was created and when it completed, each job when it was queued, started and
272
+ * finished, each push, each pull request that was opened, merged or closed in
273
+ * the window, and the check runs of each head. Read-only.
274
+ */
275
+ export declare function recordWindow(client: GitHubReadClient, opts: RecordOptions): Promise<Observation[]>;
276
+ /** Lines of a serialized fixture that hold an email address or something shaped like a credential. Empty means clean. */
277
+ export declare function findSensitive(text: string): Array<{
278
+ line: number;
279
+ what: string;
280
+ }>;
281
+ /**
282
+ * Remove email addresses and credential-shaped text from the free-text fields
283
+ * of an observation (a pull request title, a branch name). Every other field
284
+ * is an id, a time, a status or a label.
285
+ */
286
+ export declare function scrubObservation(o: Observation): Observation;
287
+ export { OBSERVATION_TYPES };
288
+ //# sourceMappingURL=intake.d.ts.map