@indigoai-us/hq-cli 5.345.223 → 5.345.226
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.
- package/CHANGELOG.md +98 -0
- package/assets/bot-workers/setup/context/quick-reference.md +2 -2
- package/assets/mesh-daemon/README.md +11 -12
- package/dist/command-catalog.generated.d.ts +156 -4
- package/dist/command-catalog.generated.js +191 -4
- package/dist/commands/cloud-provision.d.ts +4 -1
- package/dist/commands/cloud-provision.js +7 -3
- package/dist/commands/cloud-retire.js +1 -1
- package/dist/commands/core-delegate-w1b.js +3 -1
- package/dist/commands/core-delegate.d.ts +5 -0
- package/dist/commands/core-dm-bind-native.d.ts +5 -1
- package/dist/commands/core-dm-bind-native.js +4 -0
- package/dist/commands/core-job-notify-native.d.ts +5 -1
- package/dist/commands/core-job-notify-native.js +8 -2
- package/dist/commands/core-jobs-native.d.ts +27 -1
- package/dist/commands/core-jobs-native.js +49 -28
- package/dist/commands/core-pipeline-conductor-native.js +7 -7
- package/dist/commands/core-pipeline-driver-native.js +5 -5
- package/dist/commands/core-refresh-vault-access-native.d.ts +5 -0
- package/dist/commands/core-refresh-vault-access-native.js +3 -1
- package/dist/commands/core-work-mesh-bind-trusted-native.js +1 -1
- package/dist/commands/daemon.d.ts +2 -0
- package/dist/commands/daemon.js +68 -2
- package/dist/commands/deploy-domains.js +38 -2
- package/dist/commands/lanes-accounts.d.ts +14 -0
- package/dist/commands/lanes-accounts.js +119 -0
- package/dist/commands/lanes-hold.d.ts +2 -27
- package/dist/commands/lanes-hold.js +3 -75
- package/dist/commands/lanes-loop.js +1 -1
- package/dist/commands/lanes-move.js +10 -0
- package/dist/commands/lanes-session-start.js +2 -2
- package/dist/commands/lanes-shared.js +9 -0
- package/dist/commands/lanes.js +137 -12
- package/dist/commands/mesh.d.ts +12 -0
- package/dist/commands/mesh.js +13 -4
- package/dist/commands/monitor.js +1 -1
- package/dist/commands/packs.js +1 -1
- package/dist/commands/sync-held.d.ts +22 -0
- package/dist/commands/sync-held.js +167 -18
- package/dist/commands/whoami.d.ts +10 -17
- package/dist/commands/whoami.js +7 -79
- package/dist/data/command-states.json +13 -0
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +4845 -2524
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/capacity/accounts.d.ts +4 -0
- package/dist/lib/capacity/accounts.js +4 -0
- package/dist/lib/capacity/route.js +14 -0
- package/dist/lib/capacity/sign-in.d.ts +18 -0
- package/dist/lib/capacity/sign-in.js +34 -1
- package/dist/lib/daemon/catalog.d.ts +9 -5
- package/dist/lib/daemon/catalog.js +14 -8
- package/dist/lib/daemon/config.d.ts +5 -0
- package/dist/lib/daemon/config.js +6 -0
- package/dist/lib/daemon/hook-requests.d.ts +76 -0
- package/dist/lib/daemon/hook-requests.js +481 -0
- package/dist/lib/daemon/lanes-monitor-state.d.ts +55 -0
- package/dist/lib/daemon/lanes-monitor-state.js +129 -0
- package/dist/lib/daemon/lanes-reconcile-loader.d.ts +7 -0
- package/dist/lib/daemon/lanes-reconcile-loader.js +13 -0
- package/dist/lib/daemon/lanes-reconcile-status.d.ts +35 -0
- package/dist/lib/daemon/lanes-reconcile-status.js +86 -0
- package/dist/lib/daemon/merge-sections.d.ts +165 -0
- package/dist/lib/daemon/merge-sections.js +556 -0
- package/dist/lib/daemon/ops/policy.d.ts +2 -2
- package/dist/lib/daemon/ops/policy.js +44 -5
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +0 -6
- package/dist/lib/daemon/run.js +110 -5
- package/dist/lib/daemon/selfcheck.js +2 -2
- package/dist/lib/daemon/server.d.ts +2 -4
- package/dist/lib/daemon/server.js +11 -49
- package/dist/lib/daemon/state-file.d.ts +74 -4
- package/dist/lib/daemon/state-file.js +159 -19
- package/dist/lib/daemon/supervisor.d.ts +3 -1
- package/dist/lib/daemon/updater.d.ts +2 -6
- package/dist/lib/daemon/updater.js +4 -11
- package/dist/lib/daemon/whoami-cache.d.ts +96 -0
- package/dist/lib/daemon/whoami-cache.js +244 -0
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/hook-engine/coverage.d.ts +2 -0
- package/dist/lib/hook-engine/coverage.js +71 -0
- package/dist/lib/hook-engine/native-precompact-compatibility.json +449 -0
- package/dist/lib/hook-engine/reconcile.js +14 -8
- package/dist/lib/install/hook-target.d.ts +13 -3
- package/dist/lib/install/hook-target.js +14 -11
- package/dist/lib/lanes/account-company.d.ts +7 -1
- package/dist/lib/lanes/account-company.js +22 -4
- package/dist/lib/lanes/account-ownership.d.ts +65 -0
- package/dist/lib/lanes/account-ownership.js +134 -0
- package/dist/lib/lanes/accounts.js +9 -2
- package/dist/lib/lanes/claude-balance.js +9 -3
- package/dist/lib/lanes/config.js +17 -0
- package/dist/lib/lanes/envelope-repair-dispatch.js +1 -1
- package/dist/lib/lanes/host-capacity.d.ts +19 -0
- package/dist/lib/lanes/host-capacity.js +37 -0
- package/dist/lib/lanes/monitor.d.ts +2 -0
- package/dist/lib/lanes/monitor.js +2 -1
- package/dist/lib/lanes/reconcile.js +44 -3
- package/dist/lib/lanes/registry-flag.d.ts +6 -0
- package/dist/lib/lanes/registry-flag.js +3 -2
- package/dist/lib/lanes/repo-merge-hold.d.ts +39 -0
- package/dist/lib/lanes/repo-merge-hold.js +90 -0
- package/dist/lib/lanes/spawn.d.ts +0 -10
- package/dist/lib/lanes/spawn.js +51 -1
- package/dist/lib/lanes/types.d.ts +12 -0
- package/dist/lib/lanes/watcher-main.js +3 -3
- package/dist/lib/mesh/live/daemon/doctor.js +1 -1
- package/dist/lib/mesh/live/daemon/install.js +2 -2
- package/dist/lib/windows/install-followup.js +1 -1
- package/dist/utils/client-health-contract.d.ts +1 -0
- package/dist/utils/client-health-contract.js +5 -0
- package/dist/utils/client-health.d.ts +2 -0
- package/dist/utils/client-health.js +40 -0
- package/dist/utils/cognito-session.d.ts +2 -14
- package/dist/utils/cognito-session.js +2 -40
- package/dist/utils/daemon-cli-version.d.ts +13 -0
- package/dist/utils/daemon-cli-version.js +47 -0
- package/dist/utils/duplicate-command-usage.js +1 -1
- package/dist/utils/machine-token-cache.d.ts +21 -0
- package/dist/utils/machine-token-cache.js +49 -0
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/whoami-identity.d.ts +54 -0
- package/dist/utils/whoami-identity.js +108 -0
- package/package.json +8 -8
- package/dist/lib/daemon/ops/memory.d.ts +0 -18
- package/dist/lib/daemon/ops/memory.js +0 -65
- package/dist/lib/daemon/ops/mesh.d.ts +0 -38
- package/dist/lib/daemon/ops/mesh.js +0 -70
|
@@ -21,4 +21,17 @@ export async function ensureDaemonLanesReconcileHandler(options) {
|
|
|
21
21
|
throw new Error("lanes command did not register its daemon reconcile handler");
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* One lane reconcile pass in this process: the daemon's timed
|
|
26
|
+
* `lanes-reconcile` unit when its lane-store watcher is not running. Loads the
|
|
27
|
+
* reconciler on first use. A load failure throws, so the supervisor records
|
|
28
|
+
* the run as failed and tries again on the next tick.
|
|
29
|
+
*/
|
|
30
|
+
export async function runDaemonLanesReconcileInProcess(options, load = ensureDaemonLanesReconcileHandler) {
|
|
31
|
+
await load(options);
|
|
32
|
+
const handler = daemonLanesReconcileHandler();
|
|
33
|
+
if (!handler)
|
|
34
|
+
throw new Error("the in-process lanes reconciler is not registered");
|
|
35
|
+
await handler();
|
|
36
|
+
}
|
|
24
37
|
//# sourceMappingURL=lanes-reconcile-loader.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The status line of the in-process lanes reconcile.
|
|
3
|
+
*
|
|
4
|
+
* While the lane-store watcher owns reconcile the catalog plans no
|
|
5
|
+
* `lanes-reconcile` unit, so the supervisor has no state for it. This records
|
|
6
|
+
* the outcome of each watcher run and adds one unit entry to the state file
|
|
7
|
+
* `hq daemon status` reads.
|
|
8
|
+
*/
|
|
9
|
+
import type { DaemonState } from "./supervisor.js";
|
|
10
|
+
type Unit = DaemonState["units"][number];
|
|
11
|
+
/** The longest `lastError` written to the state file, in UTF-8 bytes. */
|
|
12
|
+
export declare const LANES_RECONCILE_ERROR_BYTES = 300;
|
|
13
|
+
/** One line, no secrets, no control characters (it is printed to a terminal), at most LANES_RECONCILE_ERROR_BYTES. */
|
|
14
|
+
export declare function lanesReconcileErrorText(error: unknown): string;
|
|
15
|
+
export interface LanesReconcileStatus {
|
|
16
|
+
/** The same reconcile, with its outcome recorded. A failure is rethrown. */
|
|
17
|
+
track(reconcile: () => Promise<void>): () => Promise<void>;
|
|
18
|
+
/** Forget the recorded outcome (the watcher was closed or replaced). */
|
|
19
|
+
reset(): void;
|
|
20
|
+
/** The unit entry for the state file. */
|
|
21
|
+
unit(signedIn: boolean): Unit;
|
|
22
|
+
}
|
|
23
|
+
export declare function createLanesReconcileStatus(options?: {
|
|
24
|
+
now?: () => number;
|
|
25
|
+
/** Called after each run has been recorded. */
|
|
26
|
+
onChange?: () => void;
|
|
27
|
+
}): LanesReconcileStatus;
|
|
28
|
+
/**
|
|
29
|
+
* `state` with the in-process reconcile's unit, placed where the timed unit
|
|
30
|
+
* would be in `services` order. A planned `lanes-reconcile` unit (the timed
|
|
31
|
+
* fallback) is left alone.
|
|
32
|
+
*/
|
|
33
|
+
export declare function withLanesReconcileUnit(state: DaemonState, unit: Unit | null, services: readonly string[]): DaemonState;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=lanes-reconcile-status.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The status line of the in-process lanes reconcile.
|
|
3
|
+
*
|
|
4
|
+
* While the lane-store watcher owns reconcile the catalog plans no
|
|
5
|
+
* `lanes-reconcile` unit, so the supervisor has no state for it. This records
|
|
6
|
+
* the outcome of each watcher run and adds one unit entry to the state file
|
|
7
|
+
* `hq daemon status` reads.
|
|
8
|
+
*/
|
|
9
|
+
import { redactForLog } from "../bot/log.js";
|
|
10
|
+
import { redactSecrets } from "../db/redact.js";
|
|
11
|
+
import { NOT_SIGNED_IN, SERVICE_DESCRIPTIONS } from "./catalog.js";
|
|
12
|
+
import { cutUtf8 } from "./state-file.js";
|
|
13
|
+
/** The longest `lastError` written to the state file, in UTF-8 bytes. */
|
|
14
|
+
export const LANES_RECONCILE_ERROR_BYTES = 300;
|
|
15
|
+
const UNIT_ID = "lanes-reconcile";
|
|
16
|
+
/** One line, no secrets, no control characters (it is printed to a terminal), at most LANES_RECONCILE_ERROR_BYTES. */
|
|
17
|
+
export function lanesReconcileErrorText(error) {
|
|
18
|
+
const raw = error instanceof Error ? error.message : String(error);
|
|
19
|
+
const oneLine = redactSecrets(redactForLog(raw)).replace(/\p{Cc}+/gu, " ").replace(/\s+/g, " ").trim();
|
|
20
|
+
return cutUtf8(oneLine, LANES_RECONCILE_ERROR_BYTES);
|
|
21
|
+
}
|
|
22
|
+
export function createLanesReconcileStatus(options = {}) {
|
|
23
|
+
const now = options.now ?? Date.now;
|
|
24
|
+
let lastRunAt;
|
|
25
|
+
let lastResult;
|
|
26
|
+
let lastError;
|
|
27
|
+
return {
|
|
28
|
+
track: (reconcile) => async () => {
|
|
29
|
+
lastRunAt = now();
|
|
30
|
+
try {
|
|
31
|
+
await reconcile();
|
|
32
|
+
lastResult = "ok";
|
|
33
|
+
lastError = undefined;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
lastResult = "failed";
|
|
37
|
+
lastError = lanesReconcileErrorText(error);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
try {
|
|
42
|
+
options.onChange?.();
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Reporting never changes the reconcile outcome.
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
reset: () => {
|
|
50
|
+
lastRunAt = undefined;
|
|
51
|
+
lastResult = undefined;
|
|
52
|
+
lastError = undefined;
|
|
53
|
+
},
|
|
54
|
+
unit: (signedIn) => {
|
|
55
|
+
const failed = lastResult === "failed";
|
|
56
|
+
const waiting = failed && !signedIn;
|
|
57
|
+
return {
|
|
58
|
+
id: UNIT_ID,
|
|
59
|
+
service: UNIT_ID,
|
|
60
|
+
kind: "scheduled",
|
|
61
|
+
description: SERVICE_DESCRIPTIONS[UNIT_ID],
|
|
62
|
+
status: waiting ? "waiting" : "idle",
|
|
63
|
+
...(waiting ? { reason: NOT_SIGNED_IN } : {}),
|
|
64
|
+
restarts: 0,
|
|
65
|
+
...(lastRunAt !== undefined ? { lastRunAt } : {}),
|
|
66
|
+
...(lastResult ? { lastResult } : {}),
|
|
67
|
+
...(failed && lastError !== undefined ? { lastError } : {}),
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* `state` with the in-process reconcile's unit, placed where the timed unit
|
|
74
|
+
* would be in `services` order. A planned `lanes-reconcile` unit (the timed
|
|
75
|
+
* fallback) is left alone.
|
|
76
|
+
*/
|
|
77
|
+
export function withLanesReconcileUnit(state, unit, services) {
|
|
78
|
+
if (!unit || state.units.some((u) => u.id === unit.id))
|
|
79
|
+
return state;
|
|
80
|
+
const position = services.indexOf(unit.service);
|
|
81
|
+
const at = position < 0 ? -1 : state.units.findIndex((u) => services.indexOf(u.service) > position);
|
|
82
|
+
const units = [...state.units];
|
|
83
|
+
units.splice(at < 0 ? units.length : at, 0, unit);
|
|
84
|
+
return { ...state, units };
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=lanes-reconcile-status.js.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two merge sections of the daemon's state file (state-file.ts):
|
|
3
|
+
*
|
|
4
|
+
* - merge_holds: every repository merge hold record under
|
|
5
|
+
* <hqRoot>/workspace/lanes/holds, grouped by the company that owns it, with
|
|
6
|
+
* that company's `lanes.repo-merge-hold` flag;
|
|
7
|
+
* - merge_approvals: per session id, the conduct-link decision queue that
|
|
8
|
+
* gates the session's merges, the session's company, and whether the
|
|
9
|
+
* `lanes.review-before-merge` gate applies to it, with the lane review
|
|
10
|
+
* records.
|
|
11
|
+
*
|
|
12
|
+
* The native merge check in crates/hq-hook reads only these two sections and
|
|
13
|
+
* starts no process. It refuses every merge while a section is missing, has a
|
|
14
|
+
* missing or wrongly typed field, or its `refreshed_at` is older than
|
|
15
|
+
* min(max_age_seconds, 60) seconds, so whenever a decision cannot be made here
|
|
16
|
+
* the section (or the session) is written so the check refuses:
|
|
17
|
+
*
|
|
18
|
+
* - a hold file `hq lanes hold` would refuse, an unreadable holds folder, or
|
|
19
|
+
* an unreadable `lanes.repo-merge-hold` flag omits merge_holds;
|
|
20
|
+
* - an unreadable link folder omits merge_approvals;
|
|
21
|
+
* - a session the conduct gate covers (a link pointer and a decision queue)
|
|
22
|
+
* whose company cannot be resolved is written with queue_status
|
|
23
|
+
* "unreadable";
|
|
24
|
+
* - an unreadable `lanes.review-before-merge` flag writes review_required
|
|
25
|
+
* true with no reviews.
|
|
26
|
+
*
|
|
27
|
+
* Files are read through src/lib/safe-store.ts (a regular single-link file of
|
|
28
|
+
* this user in a folder no other user can write), except lane records and
|
|
29
|
+
* review records, which are read with their stores' own validating readers.
|
|
30
|
+
* Nothing here starts a process; the flags are read from the flag registry.
|
|
31
|
+
*/
|
|
32
|
+
import { type RepoMergeHold } from "../lanes/repo-merge-hold.js";
|
|
33
|
+
import { type LaneCompanyRef } from "../lanes/types.js";
|
|
34
|
+
export declare const MERGE_HOLDS_SCHEMA = "merge-holds.v1";
|
|
35
|
+
export declare const MERGE_APPROVALS_SCHEMA = "merge-approvals.v1";
|
|
36
|
+
/** Written as each section's max_age_seconds; the native check caps it at 60 anyway. */
|
|
37
|
+
export declare const MERGE_SECTION_MAX_AGE_SECONDS = 60;
|
|
38
|
+
/**
|
|
39
|
+
* How long after one refresh finishes the next starts. A section is refused
|
|
40
|
+
* past 60 s, so this plus two refresh durations (each bounded by
|
|
41
|
+
* MERGE_FLAG_READ_TIMEOUT_MS) stays under it.
|
|
42
|
+
*/
|
|
43
|
+
export declare const MERGE_SECTION_REFRESH_INTERVAL_MS = 15000;
|
|
44
|
+
/** A flag value is asked of the registry again after this long. */
|
|
45
|
+
export declare const MERGE_FLAG_TTL_MS = 30000;
|
|
46
|
+
/** A flag read that takes longer than this counts as unreadable. */
|
|
47
|
+
export declare const MERGE_FLAG_READ_TIMEOUT_MS = 12000;
|
|
48
|
+
export interface MergeHoldEntry {
|
|
49
|
+
repo: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
set_at: string;
|
|
52
|
+
until: string;
|
|
53
|
+
released_at: string | null;
|
|
54
|
+
}
|
|
55
|
+
export interface MergeHoldsCompany {
|
|
56
|
+
slug: string;
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
holds: MergeHoldEntry[];
|
|
59
|
+
}
|
|
60
|
+
export interface MergeHoldsSection {
|
|
61
|
+
schema: typeof MERGE_HOLDS_SCHEMA;
|
|
62
|
+
refreshed_at: string;
|
|
63
|
+
max_age_seconds: number;
|
|
64
|
+
companies: Record<string, MergeHoldsCompany>;
|
|
65
|
+
}
|
|
66
|
+
export interface MergeDecision {
|
|
67
|
+
status: string;
|
|
68
|
+
ref: string;
|
|
69
|
+
answer: string;
|
|
70
|
+
}
|
|
71
|
+
export interface MergeReview {
|
|
72
|
+
repo: string;
|
|
73
|
+
pr: number;
|
|
74
|
+
head_sha: string;
|
|
75
|
+
}
|
|
76
|
+
export type MergeQueueStatus = "present" | "absent" | "unreadable";
|
|
77
|
+
export interface MergeApprovalSession {
|
|
78
|
+
company_uid: string;
|
|
79
|
+
company_slug: string;
|
|
80
|
+
link_id: string;
|
|
81
|
+
queue_status: MergeQueueStatus;
|
|
82
|
+
decisions: MergeDecision[];
|
|
83
|
+
review_required: boolean;
|
|
84
|
+
reviews: MergeReview[];
|
|
85
|
+
}
|
|
86
|
+
export interface MergeApprovalsSection {
|
|
87
|
+
schema: typeof MERGE_APPROVALS_SCHEMA;
|
|
88
|
+
refreshed_at: string;
|
|
89
|
+
max_age_seconds: number;
|
|
90
|
+
sessions: Record<string, MergeApprovalSession>;
|
|
91
|
+
}
|
|
92
|
+
export interface MergeSections {
|
|
93
|
+
merge_holds: MergeHoldsSection | null;
|
|
94
|
+
merge_approvals: MergeApprovalsSection | null;
|
|
95
|
+
}
|
|
96
|
+
/** A lanes flag for one company: its value, or null when it could not be read. */
|
|
97
|
+
export type MergeFlagReader = (flag: string, company: LaneCompanyRef) => Promise<boolean | null>;
|
|
98
|
+
export interface MergeSectionInput {
|
|
99
|
+
hqRoot: string;
|
|
100
|
+
/** Written as refreshed_at; take it before any file is read. */
|
|
101
|
+
now: Date;
|
|
102
|
+
readFlag: MergeFlagReader;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Every hold record, or null when any of them is one `hq lanes hold list`
|
|
106
|
+
* would refuse (unreadable, not JSON, invalid fields, or a file name that
|
|
107
|
+
* does not match its repository), or when the folder cannot be read.
|
|
108
|
+
*/
|
|
109
|
+
export declare function readMergeHoldRecords(hqRoot: string): RepoMergeHold[] | null;
|
|
110
|
+
/** The merge_holds section, or null to leave it out of the state file. */
|
|
111
|
+
export declare function buildMergeHoldsSection(input: MergeSectionInput): Promise<MergeHoldsSection | null>;
|
|
112
|
+
export interface FoldedQueue {
|
|
113
|
+
decisions: MergeDecision[];
|
|
114
|
+
/** Rows with an id whose latest state lacks a string status, ref or answer. */
|
|
115
|
+
skipped: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A conduct decision queue folded to the latest state of each row id, in
|
|
119
|
+
* first-seen order: later rows override earlier fields. Blank and unparseable
|
|
120
|
+
* lines (a torn last line among them) and rows without an id are skipped.
|
|
121
|
+
*/
|
|
122
|
+
export declare function foldDecisionQueue(text: string): FoldedQueue;
|
|
123
|
+
/** The merge_approvals section, or null to leave it out of the state file. */
|
|
124
|
+
export declare function buildMergeApprovalsSection(input: MergeSectionInput): Promise<MergeApprovalsSection | null>;
|
|
125
|
+
/** Both sections, read at `input.now`. A builder that throws leaves its section out. */
|
|
126
|
+
export declare function buildMergeSections(input: MergeSectionInput): Promise<MergeSections>;
|
|
127
|
+
export interface RegistryMergeFlagReaderOptions {
|
|
128
|
+
env: NodeJS.ProcessEnv;
|
|
129
|
+
ttlMs?: number;
|
|
130
|
+
timeoutMs?: number;
|
|
131
|
+
now?: () => number;
|
|
132
|
+
/** Test seam: one registry read; null when it could not be read. */
|
|
133
|
+
read?: (flag: string, company: LaneCompanyRef, env: NodeJS.ProcessEnv) => Promise<boolean | null>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Lanes flags as `hq lanes hold check` reads them (readLanesRegistryFlag: local
|
|
137
|
+
* override, then the registry, then its last-known-good cache on a transient
|
|
138
|
+
* failure), asked again after `ttlMs`. A read that fails, throws or takes
|
|
139
|
+
* longer than `timeoutMs` is null and is not kept.
|
|
140
|
+
*/
|
|
141
|
+
export declare function createRegistryMergeFlagReader(options: RegistryMergeFlagReaderOptions): MergeFlagReader;
|
|
142
|
+
export interface MergeSectionRefresher {
|
|
143
|
+
/** The latest sections, each only while younger than its max age. */
|
|
144
|
+
latest(): MergeSections;
|
|
145
|
+
/** Build once now (tests); resolves when the result is kept. */
|
|
146
|
+
refresh(): Promise<void>;
|
|
147
|
+
close(): void;
|
|
148
|
+
}
|
|
149
|
+
export interface MergeSectionRefresherOptions {
|
|
150
|
+
/** The HQ root, or undefined when none is configured (both sections are left out). */
|
|
151
|
+
hqRoot: () => string | undefined;
|
|
152
|
+
readFlag: MergeFlagReader;
|
|
153
|
+
/** Called after each refresh, to rewrite the state file. */
|
|
154
|
+
onRefresh?: () => void;
|
|
155
|
+
intervalMs?: number;
|
|
156
|
+
wallClock?: () => Date;
|
|
157
|
+
/** Start the timer (default true). */
|
|
158
|
+
start?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Rebuild both sections now and then every `intervalMs` after the previous
|
|
162
|
+
* build finished, and hand each result to `onRefresh`. Builds never overlap.
|
|
163
|
+
*/
|
|
164
|
+
export declare function startMergeSectionRefresh(options: MergeSectionRefresherOptions): MergeSectionRefresher;
|
|
165
|
+
//# sourceMappingURL=merge-sections.d.ts.map
|