@indigoai-us/hq-cli 5.345.223 → 5.345.225
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 +66 -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 +78 -4
- package/dist/command-catalog.generated.js +94 -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 +67 -1
- 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-session-start.js +2 -2
- 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/whoami.d.ts +10 -17
- package/dist/commands/whoami.js +7 -79
- package/dist/data/command-states.json +13 -0
- package/dist/index.js +1 -1
- package/dist/lib/daemon/catalog.d.ts +8 -5
- package/dist/lib/daemon/catalog.js +13 -7
- package/dist/lib/daemon/config.d.ts +5 -0
- package/dist/lib/daemon/config.js +6 -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/merge-sections.d.ts +165 -0
- package/dist/lib/daemon/merge-sections.js +556 -0
- package/dist/lib/daemon/ops/policy.d.ts +1 -1
- package/dist/lib/daemon/ops/policy.js +1 -1
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +0 -6
- package/dist/lib/daemon/run.js +73 -1
- package/dist/lib/daemon/selfcheck.js +2 -2
- package/dist/lib/daemon/server.d.ts +2 -4
- package/dist/lib/daemon/server.js +5 -48
- 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 +1 -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/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/envelope-repair-dispatch.js +1 -1
- package/dist/lib/lanes/monitor.d.ts +2 -0
- package/dist/lib/lanes/monitor.js +2 -1
- 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/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 +7 -7
- 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
package/dist/commands/mesh.js
CHANGED
|
@@ -2604,7 +2604,7 @@ async function runMeshMode(action, opts) {
|
|
|
2604
2604
|
(mode !== act
|
|
2605
2605
|
? ` (note: HQ_MESH_MODE=${process.env.HQ_MESH_MODE} overrides → ${mode})`
|
|
2606
2606
|
: "") +
|
|
2607
|
-
`. Restart the daemon (hq
|
|
2607
|
+
`. Restart the daemon (hq daemon restart mesh) to apply.`);
|
|
2608
2608
|
return;
|
|
2609
2609
|
}
|
|
2610
2610
|
if (act === "check") {
|
|
@@ -3081,7 +3081,7 @@ export function registerMeshCommand(program, deps = {}) {
|
|
|
3081
3081
|
.command("run")
|
|
3082
3082
|
.description("Start the single-instance daemon (pid lock, spool watch, presence)")
|
|
3083
3083
|
.option("--hq-root <path>", "HQ tree root (else HQ_ROOT / persisted trusted roots); the Windows task passes this explicitly")
|
|
3084
|
-
.action((opts) => wrap(() =>
|
|
3084
|
+
.action((opts) => wrap(() => runMeshDaemonService(opts))());
|
|
3085
3085
|
daemon
|
|
3086
3086
|
.command("install")
|
|
3087
3087
|
.description("Install LaunchAgent (macOS), systemd user unit (Linux), or Scheduled Task (Windows)")
|
|
@@ -3104,7 +3104,7 @@ export function registerMeshCommand(program, deps = {}) {
|
|
|
3104
3104
|
.command("doctor")
|
|
3105
3105
|
.description("Report daemon running/MQTT/spool/held/dead-letter/outbox/flush health")
|
|
3106
3106
|
.option("--json", "Print machine-readable JSON")
|
|
3107
|
-
.action((opts) => wrap(() =>
|
|
3107
|
+
.action((opts) => wrap(() => runMeshDaemonDoctor(opts))());
|
|
3108
3108
|
mesh
|
|
3109
3109
|
.command("push-status")
|
|
3110
3110
|
.description("Report whether the owner DM push signal is live or stale, with the last event time")
|
|
@@ -3125,6 +3125,14 @@ async function runMeshPushStatus(opts) {
|
|
|
3125
3125
|
if (status.status === "stale")
|
|
3126
3126
|
process.exitCode = 1;
|
|
3127
3127
|
}
|
|
3128
|
+
/**
|
|
3129
|
+
* The resident Work Mesh loop. `hq daemon` runs it as its `mesh` service
|
|
3130
|
+
* (`hq daemon service mesh`); `hq mesh daemon run`, which older standalone
|
|
3131
|
+
* units still start, is retiring and runs the same loop.
|
|
3132
|
+
*/
|
|
3133
|
+
export async function runMeshDaemonService(opts = {}) {
|
|
3134
|
+
await runResidentCommandWithPackageLease("mesh-daemon", () => runDaemonRun(opts));
|
|
3135
|
+
}
|
|
3128
3136
|
async function runDaemonRun(opts = {}) {
|
|
3129
3137
|
const { runMeshDaemon } = await import("../lib/mesh/live/daemon/run.js");
|
|
3130
3138
|
const hqRoot = opts.hqRoot?.trim() || undefined;
|
|
@@ -3277,7 +3285,8 @@ export async function runDaemonStatus(opts, deps = {}) {
|
|
|
3277
3285
|
console.log(`mqtt: ${state.mqttState}`);
|
|
3278
3286
|
}
|
|
3279
3287
|
}
|
|
3280
|
-
|
|
3288
|
+
/** Work Mesh health report: `hq daemon doctor` (and the retiring `hq mesh daemon doctor`). */
|
|
3289
|
+
export async function runMeshDaemonDoctor(opts) {
|
|
3281
3290
|
// Same predicate as install: a repo's .claude/ is not an HQ root. Doctor
|
|
3282
3291
|
// only reads, so an unresolvable root is reported as absent, not fatal.
|
|
3283
3292
|
const report = collectDaemonDoctor({
|
package/dist/commands/monitor.js
CHANGED
|
@@ -465,7 +465,7 @@ export function invokeLaneMonitorMessage(hqRoot, meta, sequence, text, inProcess
|
|
|
465
465
|
const cliEntrypoint = process.argv[1];
|
|
466
466
|
if (!cliEntrypoint)
|
|
467
467
|
throw new LanesError("monitor_cli_path_missing", "Could not locate the hq CLI entry point for lane delivery.");
|
|
468
|
-
const result = spawnSync(process.execPath, [cliEntrypoint, "
|
|
468
|
+
const result = spawnSync(process.execPath, [cliEntrypoint, "runners", "_monitor-message", meta.target.laneId], {
|
|
469
469
|
cwd: meta.cwd,
|
|
470
470
|
env: { ...process.env, HQ_ROOT: hqRoot },
|
|
471
471
|
input: JSON.stringify({ text, monitor_id: meta.monitor_id, description: meta.description, sequence }),
|
package/dist/commands/packs.js
CHANGED
|
@@ -482,7 +482,7 @@ export function registerPacksCommand(parent) {
|
|
|
482
482
|
.option('--allow-hooks', 'Install pack hooks without prompting')
|
|
483
483
|
.option('--allow-mcp', 'Register pack MCP servers without prompting')
|
|
484
484
|
.option('--branch', 'Follow the source branch instead of SHA-pinning')
|
|
485
|
-
.addOption(new Option('--registry', 'Update installed registry packages instead
|
|
485
|
+
.addOption(new Option('--registry', 'Update installed registry packages instead of content packs ([name] is the package slug)').conflicts([...CONTENT_PACK_UPDATE_OPTIONS]))
|
|
486
486
|
.action(async (name, opts) => {
|
|
487
487
|
if (opts.registry) {
|
|
488
488
|
// Exactly the `hq packages update [slug]` path: same function, lease,
|
|
@@ -2,25 +2,10 @@
|
|
|
2
2
|
* hq whoami — displays current user or 'not logged in'
|
|
3
3
|
*/
|
|
4
4
|
import { Command } from 'commander';
|
|
5
|
+
import { type WhoamiTokenIdentity } from "../utils/whoami-identity.js";
|
|
5
6
|
import { type PlanLimitStatus } from "../lib/billing/plan-lock.js";
|
|
7
|
+
export { resolveWhoamiIdentity, type WhoamiDisplayIdentity, type WhoamiTokenIdentity, } from "../utils/whoami-identity.js";
|
|
6
8
|
export declare const CLI_LIMIT_INVITE_TEAMMATE_FLAG = "cli.limit-invite-teammate-v1";
|
|
7
|
-
export interface WhoamiTokenIdentity {
|
|
8
|
-
email?: string;
|
|
9
|
-
sub?: string;
|
|
10
|
-
delegatedEmail?: string;
|
|
11
|
-
delegatedSub?: string;
|
|
12
|
-
entityType?: string;
|
|
13
|
-
entityUid?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface WhoamiDisplayIdentity {
|
|
16
|
-
email?: string;
|
|
17
|
-
sub?: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Resolves the person represented by an ID token without pairing a delegated
|
|
21
|
-
* email with the token subject of the delegating machine.
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveWhoamiIdentity(identity: WhoamiTokenIdentity): WhoamiDisplayIdentity;
|
|
24
9
|
/**
|
|
25
10
|
* Bound on the person-uid lookup, so `--json` callers with short timeouts still
|
|
26
11
|
* get an answer. Kept at 1s: with every endpoint stalled, a whole `whoami
|
|
@@ -28,6 +13,14 @@ export declare function resolveWhoamiIdentity(identity: WhoamiTokenIdentity): Wh
|
|
|
28
13
|
* (foreground-network-budget.test.ts); 3s overran it.
|
|
29
14
|
*/
|
|
30
15
|
export declare const PERSON_UID_LOOKUP_TIMEOUT_MS = 1000;
|
|
16
|
+
/**
|
|
17
|
+
* The signed-in person's canonical `prs_*` uid for `whoami --json`. Person ID
|
|
18
|
+
* tokens carry no `custom:entityType`/`custom:entityUid` claims, so the token
|
|
19
|
+
* alone almost never has it; the vault's person-entity lookup does (the same
|
|
20
|
+
* rule `hq secrets --personal` uses). Best-effort: no session, a timeout or a
|
|
21
|
+
* network failure resolve to null and the rest of the identity still prints.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readPersonUid(identity: WhoamiTokenIdentity): Promise<string | null>;
|
|
31
24
|
export declare function renderWhoamiPlanBlock(status: PlanLimitStatus, opts?: {
|
|
32
25
|
inviteTeammateEnabled?: boolean;
|
|
33
26
|
}): string | null;
|
package/dist/commands/whoami.js
CHANGED
|
@@ -3,51 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { loadCachedTokens, isExpiring, loadMachineCreds, } from '@indigoai-us/hq-cloud';
|
|
6
|
-
import {
|
|
6
|
+
import { buildWhoamiIdentity, peekWhoamiTokenIdentity as peekIdToken, resolveWhoamiIdentity, } from "../utils/whoami-identity.js";
|
|
7
7
|
import { ensureCognitoToken, loadMachineCachedTokens, resolveCognitoTokenSource, } from "../utils/cognito-session.js";
|
|
8
8
|
import { colorizePlanLimitNotice, fetchPlanLimitStatus, renderPlanLine, renderPlanLimitNotice, } from "../lib/billing/plan-lock.js";
|
|
9
9
|
import { resolveCompanyFlagGate, } from "../lib/flag-registry.js";
|
|
10
10
|
import { queuePlanLimitInviteTeammateExposure } from "../utils/cli-telemetry.js";
|
|
11
11
|
import { resolveCallerPersonUid } from "../utils/vault-api.js";
|
|
12
12
|
import { printDeletedCompanyNotices } from "../utils/deleted-company-notice.js";
|
|
13
|
-
import {
|
|
13
|
+
import { formatAuthExpiry } from "../utils/auth-expiry.js";
|
|
14
14
|
import { authStatusExitCode } from "../utils/auth-session-check.js";
|
|
15
|
+
export { resolveWhoamiIdentity, } from "../utils/whoami-identity.js";
|
|
15
16
|
export const CLI_LIMIT_INVITE_TEAMMATE_FLAG = "cli.limit-invite-teammate-v1";
|
|
16
|
-
/**
|
|
17
|
-
* Resolves the person represented by an ID token without pairing a delegated
|
|
18
|
-
* email with the token subject of the delegating machine.
|
|
19
|
-
*/
|
|
20
|
-
export function resolveWhoamiIdentity(identity) {
|
|
21
|
-
if (identity.email !== undefined && identity.sub !== undefined) {
|
|
22
|
-
return { email: identity.email, sub: identity.sub };
|
|
23
|
-
}
|
|
24
|
-
if (identity.delegatedEmail !== undefined && identity.delegatedSub !== undefined) {
|
|
25
|
-
return { email: identity.delegatedEmail, sub: identity.delegatedSub };
|
|
26
|
-
}
|
|
27
|
-
if (identity.email !== undefined || identity.sub !== undefined) {
|
|
28
|
-
return { email: identity.email, sub: identity.sub };
|
|
29
|
-
}
|
|
30
|
-
return {};
|
|
31
|
-
}
|
|
32
|
-
function peekIdToken(idToken) {
|
|
33
|
-
const decoded = decodeIdToken(idToken);
|
|
34
|
-
return {
|
|
35
|
-
email: typeof decoded.email === "string" ? decoded.email : undefined,
|
|
36
|
-
sub: typeof decoded.sub === "string" ? decoded.sub : undefined,
|
|
37
|
-
delegatedEmail: typeof decoded["custom:delegatedEmail"] === "string"
|
|
38
|
-
? decoded["custom:delegatedEmail"]
|
|
39
|
-
: undefined,
|
|
40
|
-
delegatedSub: typeof decoded["custom:delegatedSub"] === "string"
|
|
41
|
-
? decoded["custom:delegatedSub"]
|
|
42
|
-
: undefined,
|
|
43
|
-
entityType: typeof decoded["custom:entityType"] === "string"
|
|
44
|
-
? decoded["custom:entityType"]
|
|
45
|
-
: undefined,
|
|
46
|
-
entityUid: typeof decoded["custom:entityUid"] === "string"
|
|
47
|
-
? decoded["custom:entityUid"]
|
|
48
|
-
: undefined,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
17
|
/**
|
|
52
18
|
* Bound on the person-uid lookup, so `--json` callers with short timeouts still
|
|
53
19
|
* get an answer. Kept at 1s: with every endpoint stalled, a whole `whoami
|
|
@@ -62,7 +28,7 @@ export const PERSON_UID_LOOKUP_TIMEOUT_MS = 1_000;
|
|
|
62
28
|
* rule `hq secrets --personal` uses). Best-effort: no session, a timeout or a
|
|
63
29
|
* network failure resolve to null and the rest of the identity still prints.
|
|
64
30
|
*/
|
|
65
|
-
async function readPersonUid(identity) {
|
|
31
|
+
export async function readPersonUid(identity) {
|
|
66
32
|
if (identity.entityType === 'person' && identity.entityUid)
|
|
67
33
|
return identity.entityUid;
|
|
68
34
|
try {
|
|
@@ -170,7 +136,7 @@ export function registerWhoamiCommand(program) {
|
|
|
170
136
|
.description('Show signed-in user and session expiry')
|
|
171
137
|
.option('--json', 'Output identity metadata as JSON (never tokens)')
|
|
172
138
|
.option('--company <slug>', 'Also report this company\'s billing and usage notice')
|
|
173
|
-
.option('--check', 'Exit 1 when there is no usable session,
|
|
139
|
+
.option('--check', 'Exit 1 when there is no usable session, so a script can test the exit status')
|
|
174
140
|
.action(async (opts) => {
|
|
175
141
|
try {
|
|
176
142
|
// Effective source (same as auth status / ensureCognitoToken): env
|
|
@@ -199,48 +165,10 @@ export function registerWhoamiCommand(program) {
|
|
|
199
165
|
}
|
|
200
166
|
async function printWhoami(opts, machine, cached) {
|
|
201
167
|
if (opts.json) {
|
|
202
|
-
const machineCreds = machine ? loadMachineCreds() : null;
|
|
203
|
-
const identityCache = machine ? loadMachineCachedTokens() : cached;
|
|
204
|
-
const identity = identityCache ? peekIdToken(identityCache.idToken) : {};
|
|
205
|
-
const displayedIdentity = resolveWhoamiIdentity(identity);
|
|
206
|
-
const claims = identityCache ? decodeIdToken(identityCache.idToken) : {};
|
|
207
|
-
// Modern credentials carry the canonical UID. Legacy caches may only
|
|
208
|
-
// supply a UID when their subject is bound to the selected username.
|
|
209
|
-
const boundLegacyAgent = machineCreds && identity.entityType === 'agent'
|
|
210
|
-
&& (claims['cognito:username'] === machineCreds.username
|
|
211
|
-
|| claims.username === machineCreds.username || claims.sub === machineCreds.username)
|
|
212
|
-
? identity.entityUid ?? null : null;
|
|
213
|
-
const agentUid = machineCreds?.entityUid !== undefined
|
|
214
|
-
? (machineCreds.entityUid.startsWith('agt_') ? machineCreds.entityUid : null)
|
|
215
|
-
: boundLegacyAgent;
|
|
216
168
|
// planLimits is additive: absent-or-null means UNKNOWN.
|
|
217
169
|
const planLimits = await readPlanLimits(opts.company);
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
console.log(JSON.stringify({
|
|
221
|
-
schemaVersion: 1,
|
|
222
|
-
authenticated,
|
|
223
|
-
tokenSource: machine ? 'machine' : 'person',
|
|
224
|
-
email: machine ? null : displayedIdentity.email ?? null,
|
|
225
|
-
// Cognito subject of the person shown in `email` (null for machine
|
|
226
|
-
// identities). Outpost jobs record owners by this id.
|
|
227
|
-
sub: machine ? null : displayedIdentity.sub ?? null,
|
|
228
|
-
// The human an Outpost session acts for, from the token's
|
|
229
|
-
// delegated claims, for machine and person sources alike.
|
|
230
|
-
delegatedEmail: identity.delegatedEmail !== undefined && identity.delegatedSub !== undefined
|
|
231
|
-
? identity.delegatedEmail : null,
|
|
232
|
-
delegatedSub: identity.delegatedEmail !== undefined && identity.delegatedSub !== undefined
|
|
233
|
-
? identity.delegatedSub : null,
|
|
234
|
-
personUid,
|
|
235
|
-
agentUid,
|
|
236
|
-
username: machineCreds?.username ?? null,
|
|
237
|
-
// Additive (what `hq auth status` reported): when the cached
|
|
238
|
-
// session expires, and whether it is inside the refresh window.
|
|
239
|
-
// Both are null when no session is cached.
|
|
240
|
-
sessionExpiresAt: identityCache ? authExpiryIso(identityCache.expiresAt) : null,
|
|
241
|
-
sessionExpiring: identityCache ? isExpiring(identityCache) : null,
|
|
242
|
-
planLimits,
|
|
243
|
-
}, null, 2));
|
|
170
|
+
const identity = await buildWhoamiIdentity(machine, cached, readPersonUid, () => loadMachineCachedTokens());
|
|
171
|
+
console.log(JSON.stringify({ ...identity, planLimits }, null, 2));
|
|
244
172
|
return;
|
|
245
173
|
}
|
|
246
174
|
if (machine) {
|
|
@@ -3,13 +3,26 @@
|
|
|
3
3
|
"commands": {
|
|
4
4
|
"auth login": { "state": "retiring", "replacedBy": "hq login" },
|
|
5
5
|
"auth logout": { "state": "retiring", "replacedBy": "hq logout" },
|
|
6
|
+
"auth status": { "state": "retiring", "replacedBy": "hq whoami --check" },
|
|
7
|
+
"bot set-model": { "state": "retiring", "replacedBy": "hq bot set --model" },
|
|
6
8
|
"crm entity get": { "state": "retiring" },
|
|
7
9
|
"crm entity list": { "state": "retiring" },
|
|
10
|
+
"mesh blocked": { "state": "retiring", "replacedBy": "hq mesh session blocked" },
|
|
11
|
+
"mesh daemon doctor": { "state": "retiring", "replacedBy": "hq daemon doctor" },
|
|
12
|
+
"mesh daemon install": { "state": "retiring", "replacedBy": "hq daemon install" },
|
|
13
|
+
"mesh daemon run": { "state": "retiring", "replacedBy": "hq daemon run" },
|
|
14
|
+
"mesh daemon status": { "state": "retiring", "replacedBy": "hq daemon status" },
|
|
15
|
+
"mesh daemon uninstall": { "state": "retiring", "replacedBy": "hq daemon disable mesh" },
|
|
16
|
+
"mesh done": { "state": "retiring", "replacedBy": "hq mesh session task-status --status done" },
|
|
17
|
+
"mesh note": { "state": "retiring", "replacedBy": "hq mesh session note" },
|
|
18
|
+
"mesh progress": { "state": "retiring", "replacedBy": "hq mesh session note" },
|
|
19
|
+
"mesh start": { "state": "retiring", "replacedBy": "hq mesh session task-status --status in_progress" },
|
|
8
20
|
"packages install": { "state": "retiring", "replacedBy": "hq install" },
|
|
9
21
|
"packages packs list": { "state": "retiring", "replacedBy": "hq packs list" },
|
|
10
22
|
"packages packs uninstall": { "state": "retiring", "replacedBy": "hq packs uninstall" },
|
|
11
23
|
"packages packs update": { "state": "retiring", "replacedBy": "hq packs update" },
|
|
12
24
|
"packages remove": { "state": "retiring", "replacedBy": "hq remove" },
|
|
25
|
+
"packages update": { "state": "retiring", "replacedBy": "hq packs update --registry" },
|
|
13
26
|
"report access": { "state": "retiring" },
|
|
14
27
|
"report discard-draft": { "state": "retiring" },
|
|
15
28
|
"report promote": { "state": "retiring" },
|
package/dist/index.js
CHANGED
|
@@ -216,7 +216,7 @@ export function installFollowupWouldDoWork(argv, env, platform) {
|
|
|
216
216
|
const args = argv.slice(2).filter((arg) => arg !== "--verbose");
|
|
217
217
|
if (args[0] === "mesh" && args[1] === "daemon")
|
|
218
218
|
return false;
|
|
219
|
-
if (args[0] === "daemon" && (args[1] === "run" || args[1] === "install"))
|
|
219
|
+
if (args[0] === "daemon" && (args[1] === "run" || args[1] === "install" || args[1] === "service"))
|
|
220
220
|
return false;
|
|
221
221
|
if (platform === "win32")
|
|
222
222
|
return /[/\\]node_modules[/\\]/i.test(argv[1] ?? "");
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* default list for each machine type, and the concrete unit each service
|
|
4
4
|
* becomes on this host.
|
|
5
5
|
*
|
|
6
|
-
* Services run today's existing entrypoints (`hq
|
|
6
|
+
* Services run today's existing entrypoints (`hq daemon service mesh`,
|
|
7
7
|
* `hq bot run <name>`, `hq-sync-runner --watch`, ...) as child processes, so
|
|
8
8
|
* moving a service under the daemon does not change what it does. Services
|
|
9
9
|
* with no entrypoint yet stay in the catalog as `unavailable` so status shows
|
|
10
10
|
* them instead of silently dropping them.
|
|
11
11
|
*/
|
|
12
12
|
import type { MachineType } from "./machine-type.js";
|
|
13
|
-
import type { SyncOwner } from "./config.js";
|
|
13
|
+
import type { SyncOwner, DaemonConfig } from "./config.js";
|
|
14
14
|
import { type SyncCoreVaultPlan } from "../sync-core/engine-home.js";
|
|
15
15
|
import type { RemoteControlPoolsConfig } from "./remote-control-pools.js";
|
|
16
16
|
import { type SyncRunnerProcess } from "./sync-runner.js";
|
|
@@ -41,11 +41,13 @@ type UnitCommand = {
|
|
|
41
41
|
args: string[];
|
|
42
42
|
} | {
|
|
43
43
|
type: "internal";
|
|
44
|
-
task:
|
|
44
|
+
task: InternalTask;
|
|
45
45
|
};
|
|
46
|
+
/** Work the daemon does in its own process on a schedule, without starting a child. */
|
|
47
|
+
export type InternalTask = "rotate-logs" | "lanes-reconcile";
|
|
46
48
|
interface UnitBlock {
|
|
47
|
-
/** `waiting` clears
|
|
48
|
-
state: "waiting" | "unavailable";
|
|
49
|
+
/** `waiting` clears when requirements appear; `unavailable` needs a newer CLI; `paused` needs an explicit resume. */
|
|
50
|
+
state: "waiting" | "unavailable" | "paused";
|
|
49
51
|
reason: string;
|
|
50
52
|
/** A failed availability probe must not stop an already running service. */
|
|
51
53
|
keepRunning?: true;
|
|
@@ -154,6 +156,7 @@ export interface PlanContext {
|
|
|
154
156
|
instantSyncEnabled?: boolean;
|
|
155
157
|
/** Keep the local sync runner stopped until the operator resumes it. */
|
|
156
158
|
syncPaused: boolean;
|
|
159
|
+
syncCorePause?: DaemonConfig['syncCorePause'];
|
|
157
160
|
/**
|
|
158
161
|
* The desktop app's Settings > Sync switches on this computer (US-016).
|
|
159
162
|
* Off vaults are skipped by the runner; all off keeps the unit stopped.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* default list for each machine type, and the concrete unit each service
|
|
4
4
|
* becomes on this host.
|
|
5
5
|
*
|
|
6
|
-
* Services run today's existing entrypoints (`hq
|
|
6
|
+
* Services run today's existing entrypoints (`hq daemon service mesh`,
|
|
7
7
|
* `hq bot run <name>`, `hq-sync-runner --watch`, ...) as child processes, so
|
|
8
8
|
* moving a service under the daemon does not change what it does. Services
|
|
9
9
|
* with no entrypoint yet stay in the catalog as `unavailable` so status shows
|
|
@@ -320,7 +320,7 @@ function planService(service, ctx) {
|
|
|
320
320
|
return [reconcile, ...engines, manifest, ...selfcheck];
|
|
321
321
|
}
|
|
322
322
|
case "mesh": {
|
|
323
|
-
const args = ["
|
|
323
|
+
const args = ["daemon", "service", "mesh", ...(ctx.hqRoot ? ["--hq-root", ctx.hqRoot] : [])];
|
|
324
324
|
return [
|
|
325
325
|
base(service, {
|
|
326
326
|
command: { type: "hq", args },
|
|
@@ -436,12 +436,15 @@ function planService(service, ctx) {
|
|
|
436
436
|
base(service, {
|
|
437
437
|
kind: "scheduled",
|
|
438
438
|
// Polls every 15 s so local keep-alive resumes are admitted on time (#1396).
|
|
439
|
-
//
|
|
440
|
-
//
|
|
441
|
-
//
|
|
439
|
+
// The daemon's lane-store watcher owns reconcile while it runs (the
|
|
440
|
+
// plan above returns no unit then). This timed unit covers the time
|
|
441
|
+
// before the watcher starts, a watch failure and the watch kill
|
|
442
|
+
// switch. It reconciles in the daemon's own process: it used to start
|
|
443
|
+
// a fresh `hq` node process every 15 s (~1.8 s CPU, ~200 MB RSS),
|
|
444
|
+
// and no longer starts any (hq-core-rust US-036).
|
|
442
445
|
intervalSec: 15,
|
|
443
446
|
initialDelaySec: 30,
|
|
444
|
-
command: { type: "
|
|
447
|
+
command: { type: "internal", task: "lanes-reconcile" },
|
|
445
448
|
env: ctx.hqRoot ? { HQ_ROOT: ctx.hqRoot } : {},
|
|
446
449
|
...(ctx.machineType === "desktop"
|
|
447
450
|
? { runGuard: { name: "lanes-reconcile", idleIntervalSec: 60 } }
|
|
@@ -557,8 +560,11 @@ export function planUnits(services, ctx) {
|
|
|
557
560
|
const units = [];
|
|
558
561
|
for (const service of services) {
|
|
559
562
|
for (const unit of planService(service, ctx)) {
|
|
563
|
+
if (service === "sync-core" && ctx.syncCorePause) {
|
|
564
|
+
unit.blocked = { state: "paused", reason: `paused at ${ctx.syncCorePause.at} by ${ctx.syncCorePause.by}; run hq daemon resume sync-core` };
|
|
565
|
+
}
|
|
560
566
|
const owner = unit.command ? ctx.legacyOwner(unit.id) : null;
|
|
561
|
-
if (owner && unit.blocked?.state !== "unavailable") {
|
|
567
|
+
if (owner && unit.blocked?.state !== "unavailable" && unit.blocked?.state !== "paused") {
|
|
562
568
|
unit.blocked = {
|
|
563
569
|
state: "waiting",
|
|
564
570
|
reason: `already run by ${owner}; \`hq daemon migrate\` will take it over`,
|
|
@@ -14,6 +14,11 @@ export interface DaemonConfig {
|
|
|
14
14
|
hqCloudVersion?: string;
|
|
15
15
|
/** Persisted machine-local sync pause. */
|
|
16
16
|
syncPaused?: boolean;
|
|
17
|
+
/** Separate operator pause for the Rust sync engines only. */
|
|
18
|
+
syncCorePause?: {
|
|
19
|
+
at: string;
|
|
20
|
+
by: string;
|
|
21
|
+
};
|
|
17
22
|
/** Desktop Instant Sync preference, applied when the sync unit is planned. */
|
|
18
23
|
instantSyncEnabled?: boolean;
|
|
19
24
|
/** Explicit desktop handoff; absent values preserve the legacy per-machine owner. */
|
|
@@ -47,6 +47,10 @@ export function readDaemonConfig(file) {
|
|
|
47
47
|
};
|
|
48
48
|
if (typeof obj.instantSyncEnabled === "boolean")
|
|
49
49
|
config.instantSyncEnabled = obj.instantSyncEnabled;
|
|
50
|
+
const pause = obj.syncCorePause;
|
|
51
|
+
if (pause && typeof pause.at === 'string' && Number.isFinite(Date.parse(pause.at)) && typeof pause.by === 'string') {
|
|
52
|
+
config.syncCorePause = { at: pause.at, by: pause.by };
|
|
53
|
+
}
|
|
50
54
|
if (isMachineType(obj.machineType))
|
|
51
55
|
config.machineType = obj.machineType;
|
|
52
56
|
if (obj.syncOwner === "daemon" || obj.syncOwner === "desktop-app")
|
|
@@ -69,6 +73,8 @@ export function writeDaemonConfig(file, config) {
|
|
|
69
73
|
if (config.hqCloudVersion)
|
|
70
74
|
ordered.hqCloudVersion = config.hqCloudVersion;
|
|
71
75
|
ordered.syncPaused = config.syncPaused === true;
|
|
76
|
+
if (config.syncCorePause)
|
|
77
|
+
ordered.syncCorePause = config.syncCorePause;
|
|
72
78
|
if (typeof config.instantSyncEnabled === "boolean")
|
|
73
79
|
ordered.instantSyncEnabled = config.instantSyncEnabled;
|
|
74
80
|
if (config.syncOwner)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lanes_monitor section of the daemon state file (state-file.ts): for each
|
|
3
|
+
* Claude senior session of an active lane, what `hq lanes monitor-check
|
|
4
|
+
* --session <id> --engine claude --json` would answer, plus the
|
|
5
|
+
* `--reminder` text. The UserPromptSubmit hook (crates/hq-hook) reads it
|
|
6
|
+
* instead of starting `hq`, so a prompt never waits on a program. A missing or
|
|
7
|
+
* stale section means no reminder.
|
|
8
|
+
*
|
|
9
|
+
* The rules match runMonitorCheck in src/commands/lanes-watch.ts: a lane is
|
|
10
|
+
* active in the states below, and a lane is covered while a live Claude Code
|
|
11
|
+
* Monitor of that session watches it (coveredLaneIds). Only Claude has a
|
|
12
|
+
* Monitor tool, so every entry's engine is "claude"; the hook ignores an entry
|
|
13
|
+
* whose engine is not the session's.
|
|
14
|
+
*/
|
|
15
|
+
import { type MonitorEvidence } from "../lanes/monitor.js";
|
|
16
|
+
import type { LaneRecord } from "../lanes/types.js";
|
|
17
|
+
/**
|
|
18
|
+
* MAX_WATCHED_LANES in src/lib/lanes/watch.ts (a test checks they match).
|
|
19
|
+
* Not imported: watch.ts reaches spawn.ts and worker-process.ts, whose
|
|
20
|
+
* entry-point block runs when the daemon bundle is the started script and
|
|
21
|
+
* exits the daemon with code 2.
|
|
22
|
+
*/
|
|
23
|
+
export declare const LANES_MONITOR_MAX_WATCHED_LANES = 64;
|
|
24
|
+
import { type DaemonStateLanesMonitor, type DaemonStateMonitorCall } from "./state-file.js";
|
|
25
|
+
/** The states `hq lanes monitor-check` counts as active (MONITOR_ACTIVE_LANE_STATES in lanes-watch.ts). */
|
|
26
|
+
export declare const LANES_MONITOR_ACTIVE_STATES: ReadonlySet<string>;
|
|
27
|
+
export interface ComputeLanesMonitorSectionOptions {
|
|
28
|
+
hqRoot: string;
|
|
29
|
+
now: Date;
|
|
30
|
+
/** Default: readAllLanes from the lanes store. A throw means the store cannot be read (no section). */
|
|
31
|
+
loadLanes?: (hqRoot: string) => readonly Pick<LaneRecord, "lane_id" | "state" | "senior">[];
|
|
32
|
+
/** Home and env the default evidence reader looks for Claude transcripts under. Default: the process's. */
|
|
33
|
+
homedir?: () => string;
|
|
34
|
+
env?: NodeJS.ProcessEnv;
|
|
35
|
+
/** Default: readLiveMonitorEvidence. A throw omits that session. */
|
|
36
|
+
readEvidence?: (sessionId: string, options: {
|
|
37
|
+
now: Date;
|
|
38
|
+
readProcessCommands: () => readonly string[];
|
|
39
|
+
}) => MonitorEvidence;
|
|
40
|
+
/** Default: `ps -eww -o args=`. Read at most once per computation, and only when a session needs evidence. */
|
|
41
|
+
readProcessCommands?: () => readonly string[];
|
|
42
|
+
/** Told about each session left out because its evidence could not be read. */
|
|
43
|
+
onSessionError?: (sessionId: string, error: unknown) => void;
|
|
44
|
+
}
|
|
45
|
+
/** The Monitor calls that cover `laneIds`, chunked like monitorCallsForLaneIds in lanes-watch.ts. */
|
|
46
|
+
export declare function lanesMonitorCalls(laneIds: readonly string[]): DaemonStateMonitorCall[];
|
|
47
|
+
/**
|
|
48
|
+
* The lanes_monitor section, or null when the lane store cannot be read. One
|
|
49
|
+
* entry per valid session id that is the session senior of at least one
|
|
50
|
+
* active lane, in session id order, at most LANES_MONITOR_MAX_SESSIONS and at
|
|
51
|
+
* most LANES_MONITOR_MAX_BYTES serialized; sessions past either cap are left
|
|
52
|
+
* out. No qualifying session gives an empty `sessions` object.
|
|
53
|
+
*/
|
|
54
|
+
export declare function computeLanesMonitorSection(options: ComputeLanesMonitorSectionOptions): DaemonStateLanesMonitor | null;
|
|
55
|
+
//# sourceMappingURL=lanes-monitor-state.d.ts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lanes_monitor section of the daemon state file (state-file.ts): for each
|
|
3
|
+
* Claude senior session of an active lane, what `hq lanes monitor-check
|
|
4
|
+
* --session <id> --engine claude --json` would answer, plus the
|
|
5
|
+
* `--reminder` text. The UserPromptSubmit hook (crates/hq-hook) reads it
|
|
6
|
+
* instead of starting `hq`, so a prompt never waits on a program. A missing or
|
|
7
|
+
* stale section means no reminder.
|
|
8
|
+
*
|
|
9
|
+
* The rules match runMonitorCheck in src/commands/lanes-watch.ts: a lane is
|
|
10
|
+
* active in the states below, and a lane is covered while a live Claude Code
|
|
11
|
+
* Monitor of that session watches it (coveredLaneIds). Only Claude has a
|
|
12
|
+
* Monitor tool, so every entry's engine is "claude"; the hook ignores an entry
|
|
13
|
+
* whose engine is not the session's.
|
|
14
|
+
*/
|
|
15
|
+
import { coveredLaneIds, defaultProcessCommands, MONITOR_MAX_TIMEOUT_MS, monitorReminderText, readLiveMonitorEvidence, } from "../lanes/monitor.js";
|
|
16
|
+
import { readAllLanes } from "../lanes/store.js";
|
|
17
|
+
/**
|
|
18
|
+
* MAX_WATCHED_LANES in src/lib/lanes/watch.ts (a test checks they match).
|
|
19
|
+
* Not imported: watch.ts reaches spawn.ts and worker-process.ts, whose
|
|
20
|
+
* entry-point block runs when the daemon bundle is the started script and
|
|
21
|
+
* exits the daemon with code 2.
|
|
22
|
+
*/
|
|
23
|
+
export const LANES_MONITOR_MAX_WATCHED_LANES = 64;
|
|
24
|
+
const MAX_WATCHED_LANES = LANES_MONITOR_MAX_WATCHED_LANES;
|
|
25
|
+
import { LANES_MONITOR_MAX_BYTES, LANES_MONITOR_MAX_SESSIONS, LANES_MONITOR_SESSION_ID_RE, } from "./state-file.js";
|
|
26
|
+
/** The states `hq lanes monitor-check` counts as active (MONITOR_ACTIVE_LANE_STATES in lanes-watch.ts). */
|
|
27
|
+
export const LANES_MONITOR_ACTIVE_STATES = new Set([
|
|
28
|
+
"running",
|
|
29
|
+
"queued",
|
|
30
|
+
"awaiting_input",
|
|
31
|
+
"blocked",
|
|
32
|
+
]);
|
|
33
|
+
/** The Monitor calls that cover `laneIds`, chunked like monitorCallsForLaneIds in lanes-watch.ts. */
|
|
34
|
+
export function lanesMonitorCalls(laneIds) {
|
|
35
|
+
const calls = [];
|
|
36
|
+
for (let offset = 0; offset < laneIds.length; offset += MAX_WATCHED_LANES) {
|
|
37
|
+
const chunk = laneIds.slice(offset, offset + MAX_WATCHED_LANES);
|
|
38
|
+
calls.push({
|
|
39
|
+
command: `hq runners watch ${chunk.join(" ")}`,
|
|
40
|
+
timeout_ms: MONITOR_MAX_TIMEOUT_MS,
|
|
41
|
+
persistent: false,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return calls;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The lanes_monitor section, or null when the lane store cannot be read. One
|
|
48
|
+
* entry per valid session id that is the session senior of at least one
|
|
49
|
+
* active lane, in session id order, at most LANES_MONITOR_MAX_SESSIONS and at
|
|
50
|
+
* most LANES_MONITOR_MAX_BYTES serialized; sessions past either cap are left
|
|
51
|
+
* out. No qualifying session gives an empty `sessions` object.
|
|
52
|
+
*/
|
|
53
|
+
export function computeLanesMonitorSection(options) {
|
|
54
|
+
const { hqRoot, now } = options;
|
|
55
|
+
const checkedAt = now.toISOString();
|
|
56
|
+
let lanes;
|
|
57
|
+
try {
|
|
58
|
+
lanes = (options.loadLanes ?? ((root) => readAllLanes(root)))(hqRoot);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
// Lane order is the store's (creation time, then id), the order the command prints.
|
|
64
|
+
const activeBySession = new Map();
|
|
65
|
+
for (const lane of lanes) {
|
|
66
|
+
if (lane.senior?.kind !== "session" || typeof lane.senior.id !== "string")
|
|
67
|
+
continue;
|
|
68
|
+
if (!LANES_MONITOR_SESSION_ID_RE.test(lane.senior.id))
|
|
69
|
+
continue;
|
|
70
|
+
if (!LANES_MONITOR_ACTIVE_STATES.has(lane.state))
|
|
71
|
+
continue;
|
|
72
|
+
if (typeof lane.lane_id !== "string" || !lane.lane_id)
|
|
73
|
+
continue;
|
|
74
|
+
const ids = activeBySession.get(lane.senior.id) ?? [];
|
|
75
|
+
ids.push(lane.lane_id);
|
|
76
|
+
activeBySession.set(lane.senior.id, ids);
|
|
77
|
+
}
|
|
78
|
+
const readCommands = options.readProcessCommands ?? defaultProcessCommands;
|
|
79
|
+
let processCommands;
|
|
80
|
+
const sharedProcessCommands = () => {
|
|
81
|
+
processCommands ??= readCommands();
|
|
82
|
+
return processCommands;
|
|
83
|
+
};
|
|
84
|
+
const readEvidence = options.readEvidence ??
|
|
85
|
+
((sessionId, evidenceOptions) => readLiveMonitorEvidence(sessionId, {
|
|
86
|
+
...(options.homedir ? { homedir: options.homedir } : {}),
|
|
87
|
+
...(options.env ? { env: options.env } : {}),
|
|
88
|
+
now: () => evidenceOptions.now,
|
|
89
|
+
readProcessCommands: evidenceOptions.readProcessCommands,
|
|
90
|
+
}));
|
|
91
|
+
const sessions = {};
|
|
92
|
+
let count = 0;
|
|
93
|
+
let bytes = Buffer.byteLength(JSON.stringify({ checked_at: checkedAt, sessions: {} }), "utf8");
|
|
94
|
+
for (const sessionId of [...activeBySession.keys()].sort()) {
|
|
95
|
+
if (count >= LANES_MONITOR_MAX_SESSIONS)
|
|
96
|
+
break;
|
|
97
|
+
const active = activeBySession.get(sessionId);
|
|
98
|
+
let entry;
|
|
99
|
+
try {
|
|
100
|
+
const evidence = readEvidence(sessionId, { now, readProcessCommands: sharedProcessCommands });
|
|
101
|
+
if (evidence.sessionId !== sessionId) {
|
|
102
|
+
throw new Error(`monitor evidence was for another session`);
|
|
103
|
+
}
|
|
104
|
+
const covered = coveredLaneIds(evidence, now);
|
|
105
|
+
const uncovered = active.filter((laneId) => !covered.has(laneId));
|
|
106
|
+
entry = {
|
|
107
|
+
engine: "claude",
|
|
108
|
+
checked_at: checkedAt,
|
|
109
|
+
active_lane_ids: [...active],
|
|
110
|
+
uncovered_lane_ids: uncovered,
|
|
111
|
+
monitor_calls: lanesMonitorCalls(uncovered),
|
|
112
|
+
reminder: monitorReminderText(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
options.onSessionError?.(sessionId, error);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
// `,"<id>":<entry>`: a comma is counted for every entry, which only overstates.
|
|
120
|
+
const added = Buffer.byteLength(`,${JSON.stringify(sessionId)}:${JSON.stringify(entry)}`, "utf8");
|
|
121
|
+
if (bytes + added > LANES_MONITOR_MAX_BYTES)
|
|
122
|
+
break;
|
|
123
|
+
bytes += added;
|
|
124
|
+
sessions[sessionId] = entry;
|
|
125
|
+
count += 1;
|
|
126
|
+
}
|
|
127
|
+
return { checked_at: checkedAt, sessions };
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=lanes-monitor-state.js.map
|
|
@@ -4,4 +4,11 @@ export interface DaemonLanesReconcileRegistrationOptions {
|
|
|
4
4
|
}
|
|
5
5
|
/** Load the lazy lanes command root only when the daemon needs its reconciler. */
|
|
6
6
|
export declare function ensureDaemonLanesReconcileHandler(options: DaemonLanesReconcileRegistrationOptions): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* One lane reconcile pass in this process: the daemon's timed
|
|
9
|
+
* `lanes-reconcile` unit when its lane-store watcher is not running. Loads the
|
|
10
|
+
* reconciler on first use. A load failure throws, so the supervisor records
|
|
11
|
+
* the run as failed and tries again on the next tick.
|
|
12
|
+
*/
|
|
13
|
+
export declare function runDaemonLanesReconcileInProcess(options: DaemonLanesReconcileRegistrationOptions, load?: (options: DaemonLanesReconcileRegistrationOptions) => Promise<void>): Promise<void>;
|
|
7
14
|
//# sourceMappingURL=lanes-reconcile-loader.d.ts.map
|
|
@@ -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
|