@indigoai-us/hq-cli 5.345.218 → 5.345.220
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 +130 -0
- package/dist/command-catalog.generated.d.ts +94 -1
- package/dist/command-catalog.generated.js +114 -1
- package/dist/commands/agents.d.ts +22 -0
- package/dist/commands/agents.js +92 -1
- package/dist/commands/bot.d.ts +48 -0
- package/dist/commands/bot.js +108 -8
- package/dist/commands/cloud.d.ts +16 -0
- package/dist/commands/cloud.js +112 -102
- package/dist/commands/core-checkpoint-native.d.ts +13 -0
- package/dist/commands/core-checkpoint-native.js +167 -52
- package/dist/commands/core-hook-registration-plan.d.ts +8 -0
- package/dist/commands/core-hook-registration-plan.js +22 -0
- package/dist/commands/core.js +9 -0
- package/dist/commands/daemon.js +21 -2
- package/dist/commands/doctor.js +4 -0
- package/dist/commands/integrations.js +84 -3
- package/dist/commands/lanes-shared.d.ts +2 -0
- package/dist/commands/lanes-watch.js +28 -1
- package/dist/commands/lanes.d.ts +2 -0
- package/dist/commands/lanes.js +99 -9
- package/dist/commands/packs.js +23 -0
- package/dist/commands/pkg-update.d.ts +6 -0
- package/dist/commands/pkg-update.js +15 -7
- package/dist/commands/reindex.js +6 -0
- package/dist/commands/run.js +55 -45
- package/dist/commands/sources.js +3 -2
- package/dist/index.js +8 -0
- package/dist/lib/anywhere-person-setting.d.ts +2 -2
- package/dist/lib/anywhere-person-setting.js +2 -2
- package/dist/lib/bot/fleet-cron.js +5 -2
- package/dist/lib/bot/inflight.d.ts +9 -0
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +51 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +90 -9
- package/dist/lib/bot/run.d.ts +29 -5
- package/dist/lib/bot/run.js +203 -1
- package/dist/lib/bot/signals-try-now.d.ts +76 -0
- package/dist/lib/bot/signals-try-now.js +111 -0
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +22 -3
- package/dist/lib/capacity/collectors/claude-oauth.js +78 -22
- package/dist/lib/capacity/scheduler.d.ts +8 -0
- package/dist/lib/capacity/scheduler.js +5 -2
- package/dist/lib/daemon/anywhere-listener.d.ts +33 -1
- package/dist/lib/daemon/anywhere-listener.js +86 -4
- package/dist/lib/daemon/machine-check-owner.d.ts +21 -0
- package/dist/lib/daemon/machine-check-owner.js +95 -0
- package/dist/lib/daemon/machine-check-registration.d.ts +4 -0
- package/dist/lib/daemon/machine-check-registration.js +64 -0
- package/dist/lib/daemon/machine-checks.d.ts +144 -0
- package/dist/lib/daemon/machine-checks.js +412 -0
- package/dist/lib/daemon/run.js +35 -4
- package/dist/lib/daemon/runtime-notifications.d.ts +7 -0
- package/dist/lib/daemon/runtime-notifications.js +50 -0
- package/dist/lib/daemon/server.d.ts +2 -0
- package/dist/lib/daemon/server.js +6 -0
- package/dist/lib/daemon/state-file.d.ts +12 -1
- package/dist/lib/daemon/state-file.js +23 -1
- package/dist/lib/doctor/checks/fleet-hook-core.d.ts +12 -0
- package/dist/lib/doctor/checks/fleet-hook-core.js +127 -0
- package/dist/lib/doctor/checks/host-core.js +3 -1
- package/dist/lib/doctor/checks/machine-checks.d.ts +16 -0
- package/dist/lib/doctor/checks/machine-checks.js +103 -0
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/doctor/types.d.ts +4 -0
- package/dist/lib/hook-engine/canary-gate.d.ts +64 -0
- package/dist/lib/hook-engine/canary-gate.js +147 -0
- package/dist/lib/hook-engine/coverage.d.ts +3 -1
- package/dist/lib/hook-engine/coverage.js +8 -2
- package/dist/lib/hook-engine/fleet-registration.d.ts +42 -0
- package/dist/lib/hook-engine/fleet-registration.js +168 -0
- package/dist/lib/hook-engine/reconcile.js +3 -2
- package/dist/lib/hook-engine/registration-identity.d.ts +33 -0
- package/dist/lib/hook-engine/registration-identity.js +97 -0
- package/dist/lib/hook-engine/registration.d.ts +1 -30
- package/dist/lib/hook-engine/registration.js +1 -88
- package/dist/lib/hook-engine/resolve.d.ts +2 -0
- package/dist/lib/hook-engine/resolve.js +7 -3
- package/dist/lib/hot-channels/alert.d.ts +10 -1
- package/dist/lib/hot-channels/alert.js +34 -7
- package/dist/lib/hot-channels/signals-claude-login.d.ts +53 -0
- package/dist/lib/hot-channels/signals-claude-login.js +96 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +17 -0
- package/dist/lib/hot-channels/signals-pass.js +31 -3
- package/dist/lib/lanes/canonical-host.d.ts +8 -1
- package/dist/lib/lanes/canonical-host.js +9 -3
- package/dist/lib/lanes/machine-identity.d.ts +15 -0
- package/dist/lib/lanes/machine-identity.js +26 -0
- package/dist/lib/lanes/spawn.js +17 -3
- package/dist/lib/search-index/index.js +11 -1
- package/dist/lib/signals/engine.d.ts +1 -0
- package/dist/lib/signals/engine.js +7 -0
- package/dist/lib/signals/reply.d.ts +48 -0
- package/dist/lib/signals/reply.js +72 -11
- package/dist/lib/signals/steps/adapters.js +6 -0
- package/dist/lib/signals/steps/extract.d.ts +50 -3
- package/dist/lib/signals/steps/extract.js +100 -17
- package/dist/lib/signals/steps/types.d.ts +19 -0
- package/dist/lib/sync-core/engine-home.d.ts +6 -1
- package/dist/lib/sync-core/engine-home.js +13 -3
- package/dist/lib/sync-core/reconcile.js +1 -1
- package/dist/lib/sync-core/release-compare.d.ts +7 -0
- package/dist/lib/sync-core/release-compare.js +16 -0
- package/dist/lib/sync-core/release.d.ts +2 -1
- package/dist/lib/sync-core/release.js +2 -10
- package/dist/run/schema-env-overrides.d.ts +24 -0
- package/dist/run/schema-env-overrides.js +72 -0
- package/dist/utils/core-next-flag.d.ts +4 -0
- package/dist/utils/core-next-flag.js +22 -0
- package/dist/utils/core-next-kill.d.ts +16 -0
- package/dist/utils/core-next-kill.js +35 -0
- package/dist/utils/host-registration.d.ts +33 -23
- package/dist/utils/host-registration.js +90 -66
- package/package.json +14 -10
- package/scripts/check-function-manifest.mjs +5 -4
- package/dist/commands/__fixtures__/access-vault.d.ts +0 -95
- package/dist/commands/__fixtures__/access-vault.js +0 -166
- package/dist/commands/__fixtures__/make-tar.d.ts +0 -38
- package/dist/commands/__fixtures__/make-tar.js +0 -102
- package/dist/commands/secrets-public-types.test-d.d.ts +0 -2
- package/dist/commands/secrets-public-types.test-d.js +0 -18
- package/dist/lib/decisions/fixtures/us001.d.ts +0 -137
- package/dist/lib/decisions/fixtures/us001.js +0 -21
- package/dist/lib/doctor/__testing__/fake-hq-tree.d.ts +0 -226
- package/dist/lib/doctor/__testing__/fake-hq-tree.js +0 -408
- package/dist/lib/doctor/__testing__/run-doctor.d.ts +0 -8
- package/dist/lib/doctor/__testing__/run-doctor.js +0 -69
- package/dist/lib/fingerprint/fixtures.d.ts +0 -19
- package/dist/lib/fingerprint/fixtures.js +0 -61
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.d.ts +0 -33
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.js +0 -53
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.d.ts +0 -38
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.js +0 -64
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.d.ts +0 -2
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.js +0 -10
- package/dist/lib/test-utils/isolated-flag-company-context.d.ts +0 -3
- package/dist/lib/test-utils/isolated-flag-company-context.js +0 -18
- package/scripts/hook-engine-manifest.mjs +0 -22
- package/scripts/mesh-daemon-if-stale.mjs +0 -20
package/dist/commands/lanes.js
CHANGED
|
@@ -49,7 +49,7 @@ import { appendProjectFocusOverride, readProjectStoryFocusData, removeProjectFoc
|
|
|
49
49
|
import { appendLaneFocusOverride, assertFocusGuardAllows, makeFocusOverride } from "../lib/lanes/focus-guard.js";
|
|
50
50
|
import { LANE_FOCUS_GUARD_FLAG, LANE_FOCUS_DASHBOARD_FLAG, LANE_HIRE_GRANT_FINISHED_LANES_FLAG, LANE_LIST_SKIP_REMOTE_REFRESH_FLAG, LANE_MESSAGE_ROUTE_OWNER_HOST_FLAG, LANE_ORPHANED_BARE_ID_DROPBOX_REPAIR_FLAG, LANE_PROFILE_PIN_EXHAUSTED_FALLBACK_FLAG, LANE_STATUS_ROW_FIELDS_FLAG, LANE_REAP_STOP_FLAG, LANE_REUSE_REFRESHES_PROFILE_FLAG, LANE_WORKER_CONTINUITY_FLAG, LANE_CONDUCT_LOOP_FLAG, LANE_ENVELOPE_REPAIR_GUIDANCE_FLAG, } from "../lib/lanes/flag-keys.js";
|
|
51
51
|
import { applyContinuitySettings, findWorkerContinuityLane, sameLaneHost, workerContinuityPrompt } from "../lib/lanes/worker-continuity.js";
|
|
52
|
-
import { localHostIdsReferToSameMachine, observeLocalHostIdentity, resolveLocalHostIdentity } from "../lib/lanes/local-host-identity.js";
|
|
52
|
+
import { laneHostIdentityPath, localHostIdsReferToSameMachine, observeLocalHostIdentity, resolveLocalHostIdentity } from "../lib/lanes/local-host-identity.js";
|
|
53
53
|
import { commitIdleLoopStop, enqueueLoopEnvelope, interruptLoopQueue, interruptLoopQueueForStory, loopControllerIsAlive, loopLaneIsIdle, loopStatus, validateLoopEnvelope } from "../lib/lanes/loop.js";
|
|
54
54
|
import { LOOP_CONTROLLER_RECOVERY_REASON, LOOP_STALL_RESTART_REASON, runLaneLoopController, startLaneLoopController, startLaneLoopControllerWithAdmissionLockHeld } from "./lanes-loop.js";
|
|
55
55
|
import { configuredCodexRolloutHomes, retainCodexRollouts } from "../lib/lanes/disk-guard.js";
|
|
@@ -68,6 +68,7 @@ import { buildOutpostCapacityCommand, buildOutpostIdentityBackfillCommand, build
|
|
|
68
68
|
import { outpostHireSummaryCacheKey, OUTPOST_HIRE_SUMMARY_CACHE_TTL_MS, readOutpostHireSummaryCache, readOutpostHireSummaryCacheIncludingStale, writeOutpostHireSummaryCache, } from "../lib/lanes/outpost-hire-cache.js";
|
|
69
69
|
import { buildHostCapacitySnapshot, chooseHostForLane, hostCapacitySnapshotToWire, parseHostCapacitySnapshot, } from "../lib/lanes/host-capacity.js";
|
|
70
70
|
import { resolveCanonicalHost } from "../lib/lanes/canonical-host.js";
|
|
71
|
+
import { readInstanceIdFromDisk } from "../lib/lanes/machine-identity.js";
|
|
71
72
|
import { BALANCE_MOVABLE_STATES, selectClaudeAccount, } from "../lib/lanes/claude-balance.js";
|
|
72
73
|
import { parseUserYaml } from "../utils/user-yaml-error.js";
|
|
73
74
|
import { backfillOutpostIdentityMarker as backfillOutpostIdentityMarkerImpl, createOutpostIdentityMarkerIfMissing, validateOutpostIdentityId, } from "../lib/lanes/outpost-identity.js";
|
|
@@ -487,6 +488,7 @@ function resolveDeps(deps = {}) {
|
|
|
487
488
|
};
|
|
488
489
|
}),
|
|
489
490
|
resolveMachineIdentity: deps.resolveMachineIdentity ?? lookupMachineIdentity,
|
|
491
|
+
readInstanceIdFromDisk: deps.readInstanceIdFromDisk ?? (() => readInstanceIdFromDisk()),
|
|
490
492
|
probeProvider: deps.probeProvider ?? defaultProbe,
|
|
491
493
|
readClaudeCredential: deps.readClaudeCredential ??
|
|
492
494
|
(deps.probeProvider === undefined ? readLaneClaudeCredential : undefined),
|
|
@@ -657,6 +659,21 @@ function reconcileHostFromCtx(ctx) {
|
|
|
657
659
|
readOutpostIdentity: ctx.readOutpostIdentity,
|
|
658
660
|
});
|
|
659
661
|
}
|
|
662
|
+
/**
|
|
663
|
+
* What lane admission matches a local lane against on this machine: the
|
|
664
|
+
* hostname, the stable id and the hostnames in `~/.hq/lane-host.json`. Every
|
|
665
|
+
* local capacity snapshot counts with it, so placement, account balance and
|
|
666
|
+
* `runners capacity` count the lanes admission would run here and no others.
|
|
667
|
+
* Read only. `buildHostCapacitySnapshot` ignores it for an Outpost host.
|
|
668
|
+
*/
|
|
669
|
+
function localAdmissionMatch(ctx) {
|
|
670
|
+
const host = reconcileHostFromCtx(ctx);
|
|
671
|
+
return {
|
|
672
|
+
hostname: host.hostname,
|
|
673
|
+
...(host.machineId !== undefined ? { machineId: host.machineId } : {}),
|
|
674
|
+
...(host.aliases !== undefined ? { aliases: host.aliases } : {}),
|
|
675
|
+
};
|
|
676
|
+
}
|
|
660
677
|
export function parseSeniorRef(raw) {
|
|
661
678
|
const trimmed = raw.trim();
|
|
662
679
|
if (trimmed.length === 0) {
|
|
@@ -1463,6 +1480,50 @@ function localStableHost(ctx) {
|
|
|
1463
1480
|
const identity = resolveLocalHostIdentity({ homedir: ctx.homedir(), hostname });
|
|
1464
1481
|
return { kind: "local", id: identity.id };
|
|
1465
1482
|
}
|
|
1483
|
+
/**
|
|
1484
|
+
* The host a subagent-run lane records: the same stable id a worker lane on
|
|
1485
|
+
* this machine records. A subagent lane is a board record written from inside
|
|
1486
|
+
* its senior session, which may not be allowed to write the home directory,
|
|
1487
|
+
* and before this id was used it never read the identity file at all. So this
|
|
1488
|
+
* never fails on the file. When the file cannot be created or updated, the
|
|
1489
|
+
* lane records the stable id already on disk, or the hostname when there is
|
|
1490
|
+
* none. When the file is present but invalid, the lane records the hostname.
|
|
1491
|
+
* The lane host matcher resolves each of these to this machine.
|
|
1492
|
+
*/
|
|
1493
|
+
function subagentLaneHost(ctx) {
|
|
1494
|
+
const hostname = ctx.hostname().trim();
|
|
1495
|
+
if (!hostname) {
|
|
1496
|
+
throw new LanesError("host_identity_unknown", "Cannot resolve this host for lane placement", {});
|
|
1497
|
+
}
|
|
1498
|
+
const unusable = (err) => {
|
|
1499
|
+
if (isLanesError(err))
|
|
1500
|
+
return err.error === "host_identity_corrupt" ? err.error : null;
|
|
1501
|
+
const code = err?.code;
|
|
1502
|
+
return typeof code === "string" && /^E[A-Z0-9]+$/.test(code) ? code : null;
|
|
1503
|
+
};
|
|
1504
|
+
const file = laneHostIdentityPath(ctx.homedir());
|
|
1505
|
+
try {
|
|
1506
|
+
return localStableHost(ctx);
|
|
1507
|
+
}
|
|
1508
|
+
catch (err) {
|
|
1509
|
+
const reason = unusable(err);
|
|
1510
|
+
if (reason === null)
|
|
1511
|
+
throw err;
|
|
1512
|
+
process.stderr.write(`hq lanes: could not use ${file} (${reason}); recording a host id that can be read\n`);
|
|
1513
|
+
if (reason === "host_identity_corrupt")
|
|
1514
|
+
return { kind: "local", id: hostname };
|
|
1515
|
+
}
|
|
1516
|
+
try {
|
|
1517
|
+
return recordedLocalHost(ctx);
|
|
1518
|
+
}
|
|
1519
|
+
catch (err) {
|
|
1520
|
+
const reason = unusable(err);
|
|
1521
|
+
if (reason === null)
|
|
1522
|
+
throw err;
|
|
1523
|
+
process.stderr.write(`hq lanes: could not read ${file} (${reason}); recording the hostname\n`);
|
|
1524
|
+
return { kind: "local", id: hostname };
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1466
1527
|
/** Read the stable id when one exists. Does not create or update `~/.hq/lane-host.json`. */
|
|
1467
1528
|
function recordedLocalHost(ctx) {
|
|
1468
1529
|
const hostname = ctx.hostname().trim();
|
|
@@ -1571,6 +1632,7 @@ async function loadHostCapacitySnapshots(ctx, hqRoot, config = loadLanesConfig(h
|
|
|
1571
1632
|
.sort();
|
|
1572
1633
|
const local = buildHostCapacitySnapshot({
|
|
1573
1634
|
host: localHost,
|
|
1635
|
+
localMatch: localAdmissionMatch(ctx),
|
|
1574
1636
|
lanes: localLanes,
|
|
1575
1637
|
config,
|
|
1576
1638
|
existsSync: ctx.existsSync,
|
|
@@ -2208,6 +2270,7 @@ async function loadClaudeBalanceHostSnapshots(ctx, hqRoot, config, options = {})
|
|
|
2208
2270
|
const localLanes = loadAllLanes(hqRoot);
|
|
2209
2271
|
const local = buildHostCapacitySnapshot({
|
|
2210
2272
|
host: localHost,
|
|
2273
|
+
localMatch: localAdmissionMatch(ctx),
|
|
2211
2274
|
lanes: localLanes,
|
|
2212
2275
|
config,
|
|
2213
2276
|
existsSync: ctx.existsSync,
|
|
@@ -2232,6 +2295,7 @@ async function loadClaudeBalanceHostSnapshots(ctx, hqRoot, config, options = {})
|
|
|
2232
2295
|
snapshots.push({
|
|
2233
2296
|
capacity: buildHostCapacitySnapshot({
|
|
2234
2297
|
host: actualLocalHost,
|
|
2298
|
+
localMatch: localAdmissionMatch(ctx),
|
|
2235
2299
|
lanes: actualLocalLanes,
|
|
2236
2300
|
config,
|
|
2237
2301
|
existsSync: ctx.existsSync,
|
|
@@ -4373,6 +4437,7 @@ async function runCreate(ctx, opts) {
|
|
|
4373
4437
|
const refreshedLocal = {
|
|
4374
4438
|
capacity: buildHostCapacitySnapshot({
|
|
4375
4439
|
host: localHost,
|
|
4440
|
+
localMatch: localAdmissionMatch(ctx),
|
|
4376
4441
|
lanes: localLanes,
|
|
4377
4442
|
config,
|
|
4378
4443
|
existsSync: ctx.existsSync,
|
|
@@ -6479,12 +6544,16 @@ async function runCapacity(ctx) {
|
|
|
6479
6544
|
const hostname = ctx.hostname();
|
|
6480
6545
|
// Read only: this command also runs as the remote capacity probe.
|
|
6481
6546
|
const localIdentity = observeLocalHostIdentity({ homedir: ctx.homedir(), hostname: hostname.trim() });
|
|
6547
|
+
// A file read, and only on an Outpost: lane records created there carry the
|
|
6548
|
+
// instance id as their origin. Other machines never read it.
|
|
6549
|
+
const instanceId = host.kind === "outpost" ? ctx.readInstanceIdFromDisk() : null;
|
|
6482
6550
|
const canonical = resolveCanonicalHost({
|
|
6483
6551
|
host,
|
|
6484
6552
|
hostname,
|
|
6485
6553
|
...(localIdentity
|
|
6486
6554
|
? { identityAliases: localIdentity.aliases, localIdentityId: localIdentity.id }
|
|
6487
6555
|
: {}),
|
|
6556
|
+
...(instanceId ? { instanceId } : {}),
|
|
6488
6557
|
lanes,
|
|
6489
6558
|
now,
|
|
6490
6559
|
});
|
|
@@ -6492,11 +6561,7 @@ async function runCapacity(ctx) {
|
|
|
6492
6561
|
host,
|
|
6493
6562
|
aliases: canonical.aliases,
|
|
6494
6563
|
// Count what lane admission and `queued_lanes` below accept, no wider.
|
|
6495
|
-
localMatch:
|
|
6496
|
-
hostname: admissionHost.hostname,
|
|
6497
|
-
...(admissionHost.machineId !== undefined ? { machineId: admissionHost.machineId } : {}),
|
|
6498
|
-
...(admissionHost.aliases !== undefined ? { aliases: admissionHost.aliases } : {}),
|
|
6499
|
-
},
|
|
6564
|
+
localMatch: localAdmissionMatch(ctx),
|
|
6500
6565
|
lanes,
|
|
6501
6566
|
config: loadLanesConfig(hqRoot),
|
|
6502
6567
|
existsSync: ctx.existsSync,
|
|
@@ -8147,6 +8212,25 @@ async function prepareAccountMove(ctx, lane, input) {
|
|
|
8147
8212
|
? writeMove()
|
|
8148
8213
|
: withLaneAdmissionLock(hqRoot, lane.provider, writeMove, ctx.sleep);
|
|
8149
8214
|
}
|
|
8215
|
+
/**
|
|
8216
|
+
* The host a lane's Claude account is balanced on. A local lane whose
|
|
8217
|
+
* recorded id is another id of this machine, and which has no snapshot under
|
|
8218
|
+
* that id, balances on this machine's local snapshot. Every other lane
|
|
8219
|
+
* balances on the host it records.
|
|
8220
|
+
*/
|
|
8221
|
+
function canonicalBalanceHostForLane(ctx, lane, snapshots) {
|
|
8222
|
+
if (lane.host.kind !== "local")
|
|
8223
|
+
return lane.host;
|
|
8224
|
+
if (snapshots.some((host) => sameLaneHost(host.capacity.host, lane.host)))
|
|
8225
|
+
return lane.host;
|
|
8226
|
+
const match = localAdmissionMatch(ctx);
|
|
8227
|
+
if (!localHostIdsReferToSameMachine(lane.host.id, match))
|
|
8228
|
+
return lane.host;
|
|
8229
|
+
// This machine's own snapshots come first in the list. Its local one is
|
|
8230
|
+
// keyed by the stable id, or by the hostname when this machine is an Outpost.
|
|
8231
|
+
const here = snapshots.find((host) => host.capacity.host.kind === "local" && localHostIdsReferToSameMachine(host.capacity.host.id, match));
|
|
8232
|
+
return here?.capacity.host ?? lane.host;
|
|
8233
|
+
}
|
|
8150
8234
|
async function selectAutomaticClaudeResumeAccount(ctx, lane, workerProfile, options = {}) {
|
|
8151
8235
|
if (lane.provider !== "claude")
|
|
8152
8236
|
return undefined;
|
|
@@ -8227,7 +8311,13 @@ async function selectAutomaticClaudeResumeAccount(ctx, lane, workerProfile, opti
|
|
|
8227
8311
|
const balanceHosts = await loadClaudeBalanceHostSnapshots(ctx, hqRoot, config, {
|
|
8228
8312
|
tolerateInvalidLaneLists: options.tolerateInvalidHostLaneLists === true,
|
|
8229
8313
|
});
|
|
8230
|
-
|
|
8314
|
+
// A lane written under another id of this machine (its hostname before the
|
|
8315
|
+
// stable id existed) balances against this machine's local snapshot. The
|
|
8316
|
+
// lane's `host` keeps the id it has. The stored `account_selection.target_host`
|
|
8317
|
+
// is the host balanced on, the one its `considered` rows are keyed by, as
|
|
8318
|
+
// it is for a lane created on an Outpost.
|
|
8319
|
+
const balanceLaneHost = canonicalBalanceHostForLane(ctx, lane, balanceHosts.snapshots);
|
|
8320
|
+
const targetHost = balanceHosts.snapshots.find((host) => host.capacity.host.kind === balanceLaneHost.kind && host.capacity.host.id === balanceLaneHost.id);
|
|
8231
8321
|
const currentTargetAccount = lane.account === undefined
|
|
8232
8322
|
? undefined
|
|
8233
8323
|
: targetHost?.capacity.providers.claude.accounts[lane.account];
|
|
@@ -8243,7 +8333,7 @@ async function selectAutomaticClaudeResumeAccount(ctx, lane, workerProfile, opti
|
|
|
8243
8333
|
company: resolveLaneCompany(hqRoot, lane).company,
|
|
8244
8334
|
retainedAccount: lane.account,
|
|
8245
8335
|
hosts: balanceHosts.snapshots,
|
|
8246
|
-
targetHost:
|
|
8336
|
+
targetHost: balanceLaneHost,
|
|
8247
8337
|
actualTargetHost: lane.host,
|
|
8248
8338
|
requestedPlacement: null,
|
|
8249
8339
|
config,
|
|
@@ -9483,7 +9573,7 @@ async function runCreateSubagent(ctx, opts) {
|
|
|
9483
9573
|
model_source: cliModel !== undefined ? "cli" : "none",
|
|
9484
9574
|
...(cliEffort !== undefined ? { effort: cliEffort } : {}),
|
|
9485
9575
|
effort_source: cliEffort !== undefined ? "cli" : "none",
|
|
9486
|
-
host:
|
|
9576
|
+
host: subagentLaneHost(ctx),
|
|
9487
9577
|
attribution_history: [],
|
|
9488
9578
|
created_at: createdAt,
|
|
9489
9579
|
updated_at: createdAt,
|
package/dist/commands/packs.js
CHANGED
|
@@ -22,6 +22,7 @@ import { codexTargets } from '../lib/install/codex-targets.js';
|
|
|
22
22
|
import * as path from 'path';
|
|
23
23
|
import * as readline from 'readline';
|
|
24
24
|
import { spawnSync } from 'child_process';
|
|
25
|
+
import { Option } from 'commander';
|
|
25
26
|
import chalk from 'chalk';
|
|
26
27
|
import semverSatisfies from 'semver/functions/satisfies.js';
|
|
27
28
|
import { findHqRoot } from '../utils/manifest.js';
|
|
@@ -442,6 +443,20 @@ export function registerPacksListCommand(parent) {
|
|
|
442
443
|
}
|
|
443
444
|
});
|
|
444
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* `packs update` options that only apply to content packs. Each is a usage
|
|
448
|
+
* error together with `--registry`, which takes none of them.
|
|
449
|
+
*/
|
|
450
|
+
const CONTENT_PACK_UPDATE_OPTIONS = [
|
|
451
|
+
'json',
|
|
452
|
+
'hqRoot',
|
|
453
|
+
'checkOnly',
|
|
454
|
+
'refresh',
|
|
455
|
+
'yes',
|
|
456
|
+
'allowHooks',
|
|
457
|
+
'allowMcp',
|
|
458
|
+
'branch',
|
|
459
|
+
];
|
|
445
460
|
export function registerPacksCommand(parent) {
|
|
446
461
|
const packs = parent.command('packs').description('Content-pack lifecycle (install via `hq install`)');
|
|
447
462
|
registerPacksListCommand(packs);
|
|
@@ -456,7 +471,15 @@ export function registerPacksCommand(parent) {
|
|
|
456
471
|
.option('--allow-hooks', 'Install pack hooks without prompting')
|
|
457
472
|
.option('--allow-mcp', 'Register pack MCP servers without prompting')
|
|
458
473
|
.option('--branch', 'Follow the source branch instead of SHA-pinning')
|
|
474
|
+
.addOption(new Option('--registry', 'Update installed registry packages instead (same as `hq packages update [slug]`; [name] is the package slug)').conflicts([...CONTENT_PACK_UPDATE_OPTIONS]))
|
|
459
475
|
.action(async (name, opts) => {
|
|
476
|
+
if (opts.registry) {
|
|
477
|
+
// Exactly the `hq packages update [slug]` path: same function, lease,
|
|
478
|
+
// checks, output and exit status.
|
|
479
|
+
const { runPackageUpdateCommand } = await import('./pkg-update.js');
|
|
480
|
+
await runPackageUpdateCommand(name);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
460
483
|
try {
|
|
461
484
|
const results = await runUpdate(name, opts);
|
|
462
485
|
if (wantsJson(opts)) {
|
|
@@ -7,5 +7,11 @@
|
|
|
7
7
|
import { Command } from 'commander';
|
|
8
8
|
import { type ResidentCommandLeaseOptions } from '../utils/resident-package-preload.js';
|
|
9
9
|
export declare function registerPackageUpdateCommand(parent: Command): void;
|
|
10
|
+
/**
|
|
11
|
+
* The whole `hq packages update [slug]` action: lease, registry check,
|
|
12
|
+
* integrity checks, output and exit status. `hq packs update --registry [slug]`
|
|
13
|
+
* calls this same function so the two commands cannot drift apart.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runPackageUpdateCommand(slug?: string): Promise<void>;
|
|
10
16
|
export declare function runPackageUpdateWithLease<T>(run: () => Promise<T>, leaseOptions?: ResidentCommandLeaseOptions): Promise<T>;
|
|
11
17
|
//# sourceMappingURL=pkg-update.d.ts.map
|
|
@@ -21,15 +21,23 @@ export function registerPackageUpdateCommand(parent) {
|
|
|
21
21
|
.command('update [slug]')
|
|
22
22
|
.description('Check for and apply package updates')
|
|
23
23
|
.action(async (slug) => {
|
|
24
|
-
|
|
25
|
-
await runPackageUpdateWithLease(() => updatePackages(slug));
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error(chalk.red('Update failed:'), error instanceof Error ? error.message : 'Unknown error');
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
24
|
+
await runPackageUpdateCommand(slug);
|
|
31
25
|
});
|
|
32
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* The whole `hq packages update [slug]` action: lease, registry check,
|
|
29
|
+
* integrity checks, output and exit status. `hq packs update --registry [slug]`
|
|
30
|
+
* calls this same function so the two commands cannot drift apart.
|
|
31
|
+
*/
|
|
32
|
+
export async function runPackageUpdateCommand(slug) {
|
|
33
|
+
try {
|
|
34
|
+
await runPackageUpdateWithLease(() => updatePackages(slug));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error(chalk.red('Update failed:'), error instanceof Error ? error.message : 'Unknown error');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
33
41
|
export function runPackageUpdateWithLease(run, leaseOptions) {
|
|
34
42
|
return runResidentCommandWithPackageLease("pkg-update", run, leaseOptions);
|
|
35
43
|
}
|
package/dist/commands/reindex.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reconcileHookRegistrations } from '../lib/hook-engine/reconcile.js';
|
|
2
|
+
import { SKIP_CANARY_GATE_ENV } from '../lib/hook-engine/canary-gate.js';
|
|
2
3
|
import { trustCodexUserHooks } from '../utils/hook-trust.js';
|
|
3
4
|
/**
|
|
4
5
|
* hq reindex — surface namespaced skills and commands, clean up retired
|
|
@@ -742,7 +743,12 @@ export function registerReindexCommand(program) {
|
|
|
742
743
|
.option('--repo-root <path>', 'HQ root to operate on (defaults to the current directory)')
|
|
743
744
|
.option('--from-hook', 'Invoked from a Claude/Codex lifecycle hook: never wait on the per-root operation lock — if a sync/rescue holds it, skip this reindex instead of blocking the session (equivalent to --lock-timeout 0)')
|
|
744
745
|
.option('--lock-timeout <seconds>', 'Bound the wait for the per-root operation lock (seconds). 0 = refuse immediately; omitted = wait indefinitely (the interactive default). --from-hook implies 0; an explicit --lock-timeout wins.')
|
|
746
|
+
.option('--skip-host-canary-gate', 'Bypass the host canary gate (hq-core-rust US-019): with core.next on, switch Claude Code, Codex and Grok Build hook events to the new core even when no current passing host canary exists for this hq-hook version and HQ root. Prints a warning. Same as HQ_SKIP_HOST_CANARY_GATE=1.')
|
|
745
747
|
.action(async (opts) => {
|
|
748
|
+
// The registration switch reads the override from the environment, so
|
|
749
|
+
// install, reindex and the Grok trust step all honor it the same way.
|
|
750
|
+
if (opts.skipHostCanaryGate)
|
|
751
|
+
process.env[SKIP_CANARY_GATE_ENV] = '1';
|
|
746
752
|
// Resolve the lock-wait bound. An explicit --lock-timeout wins; otherwise
|
|
747
753
|
// --from-hook forces 0 (refuse-fast) so a hook fired while a sync/rescue
|
|
748
754
|
// holds the shared per-root operation lock can never stall the agent.
|
package/dist/commands/run.js
CHANGED
|
@@ -12,6 +12,7 @@ import { vaultApiFetch, getCompanyUid } from '../utils/vault-api.js';
|
|
|
12
12
|
import { discoverSchemas } from '../run/discover-schemas.js';
|
|
13
13
|
import { installHqPlugin, itemIsOptional, prewarmHqSecrets } from '../run/hq-plugin.js';
|
|
14
14
|
import { assertEnvGraphLoaded, resolveEnvValuesOrThrow, EnvGraphLoadError, EnvResolutionError, } from '../run/env-graph-guard.js';
|
|
15
|
+
import { clearInheritedSchemaOverrides, schemaDeclaredKeys, withoutInheritedSchemaEnv, } from '../run/schema-env-overrides.js';
|
|
15
16
|
import { hadFatalRejection } from '../unhandled-rejection-boundary.js';
|
|
16
17
|
import { withRunSecretReadTelemetry } from './run-feature-telemetry.js';
|
|
17
18
|
import { isHqCliChild, releaseChildWrapperPackageUseLeaseAfterStart } from '../utils/child-wrapper-lease.js';
|
|
@@ -196,52 +197,61 @@ export function registerRunCommand(program) {
|
|
|
196
197
|
}
|
|
197
198
|
else {
|
|
198
199
|
let state;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
// feedback_d5698e57: inherited process.env must not replace schema
|
|
201
|
+
// hq() values. Varlock treats process.env as overrides; secrets exec
|
|
202
|
+
// injects last. Drop schema keys from the env and from the graph's
|
|
203
|
+
// override set so the vault (or .env.local) wins. Keep them unset
|
|
204
|
+
// through resolve so a later process.env re-read cannot restore them.
|
|
205
|
+
const declaredKeys = schemaDeclaredKeys(paths);
|
|
206
|
+
resolvedEnv = await withoutInheritedSchemaEnv(declaredKeys, async () => {
|
|
207
|
+
const graph = await internal.loadEnvGraph({
|
|
208
|
+
entryFilePaths: paths,
|
|
209
|
+
// hq run owns its short-lived in-memory resolution. Varlock's default
|
|
210
|
+
// cache auto-detection can write ~/.config/varlock and initialize
|
|
211
|
+
// the native local-encryption helper, neither of which belongs on
|
|
212
|
+
// this command path.
|
|
213
|
+
skipCache: true,
|
|
214
|
+
afterInit: async (g) => { state = installHqPlugin(g, pluginOpts); },
|
|
215
|
+
});
|
|
216
|
+
clearInheritedSchemaOverrides(graph, declaredKeys);
|
|
217
|
+
// Refuse to resolve a graph varlock never finished loading (a malformed
|
|
218
|
+
// .env.schema / .env.local): resolving an unprocessed item whose key is
|
|
219
|
+
// also in process.env reaches varlock's `expected dataType to be set`
|
|
220
|
+
// invariant as a FLOATED, never-settling rejection — the CLI then exits
|
|
221
|
+
// 0 with the command never run (HQ-CLI-W). Run this BEFORE prewarm so a
|
|
222
|
+
// bad file can never trigger a secret fetch.
|
|
223
|
+
assertEnvGraphLoaded(graph);
|
|
224
|
+
await prewarmHqSecrets(graph, pluginOpts, state);
|
|
225
|
+
// Defence in depth: convert a floated resolution rejection into a thrown
|
|
226
|
+
// error instead of hanging on varlock's never-settling promise, in case
|
|
227
|
+
// the shape-dependent guard above ever silently degrades.
|
|
228
|
+
await resolveEnvValuesOrThrow(graph);
|
|
229
|
+
// varlock's item.errors includes warning-severity entries (isWarning),
|
|
230
|
+
// e.g. "Value is very short! Is it actually sensitive?" for a short
|
|
231
|
+
// sensitive value. Print those and carry on; only real errors are fatal.
|
|
232
|
+
const schemaItems = Object.entries(graph.configSchema);
|
|
233
|
+
const itemMessages = (wantWarnings) => schemaItems.flatMap(([k, item]) => (item.errors ?? [])
|
|
234
|
+
.filter((e) => Boolean(e?.isWarning) === wantWarnings)
|
|
235
|
+
.filter((e) => {
|
|
236
|
+
if (wantWarnings)
|
|
237
|
+
return true;
|
|
238
|
+
if (!itemIsOptional(item))
|
|
239
|
+
return true;
|
|
240
|
+
const msg = e?.message ?? '';
|
|
241
|
+
return !/No read permission|does not exist in company|not returned by vault/.test(msg);
|
|
242
|
+
})
|
|
243
|
+
.map((e) => ` ${k}: ${e?.message ?? String(e)}`));
|
|
244
|
+
const warningMsgs = itemMessages(true);
|
|
245
|
+
if (warningMsgs.length > 0) {
|
|
246
|
+
process.stderr.write(`Warning: env var checks reported warnings:\n${warningMsgs.join('\n')}\n`);
|
|
247
|
+
}
|
|
248
|
+
const errorMsgs = itemMessages(false);
|
|
249
|
+
if (errorMsgs.length > 0) {
|
|
250
|
+
process.stderr.write(`Error: failed to resolve env vars:\n${errorMsgs.join('\n')}\n`);
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
return graph.getResolvedEnvObject();
|
|
207
254
|
});
|
|
208
|
-
// Refuse to resolve a graph varlock never finished loading (a malformed
|
|
209
|
-
// .env.schema / .env.local): resolving an unprocessed item whose key is
|
|
210
|
-
// also in process.env reaches varlock's `expected dataType to be set`
|
|
211
|
-
// invariant as a FLOATED, never-settling rejection — the CLI then exits
|
|
212
|
-
// 0 with the command never run (HQ-CLI-W). Run this BEFORE prewarm so a
|
|
213
|
-
// bad file can never trigger a secret fetch.
|
|
214
|
-
assertEnvGraphLoaded(graph);
|
|
215
|
-
await prewarmHqSecrets(graph, pluginOpts, state);
|
|
216
|
-
// Defence in depth: convert a floated resolution rejection into a thrown
|
|
217
|
-
// error instead of hanging on varlock's never-settling promise, in case
|
|
218
|
-
// the shape-dependent guard above ever silently degrades.
|
|
219
|
-
await resolveEnvValuesOrThrow(graph);
|
|
220
|
-
// varlock's item.errors includes warning-severity entries (isWarning),
|
|
221
|
-
// e.g. "Value is very short! Is it actually sensitive?" for a short
|
|
222
|
-
// sensitive value. Print those and carry on; only real errors are fatal.
|
|
223
|
-
const schemaItems = Object.entries(graph.configSchema);
|
|
224
|
-
const itemMessages = (wantWarnings) => schemaItems.flatMap(([k, item]) => (item.errors ?? [])
|
|
225
|
-
.filter((e) => Boolean(e?.isWarning) === wantWarnings)
|
|
226
|
-
.filter((e) => {
|
|
227
|
-
if (wantWarnings)
|
|
228
|
-
return true;
|
|
229
|
-
if (!itemIsOptional(item))
|
|
230
|
-
return true;
|
|
231
|
-
const msg = e?.message ?? '';
|
|
232
|
-
return !/No read permission|does not exist in company|not returned by vault/.test(msg);
|
|
233
|
-
})
|
|
234
|
-
.map((e) => ` ${k}: ${e?.message ?? String(e)}`));
|
|
235
|
-
const warningMsgs = itemMessages(true);
|
|
236
|
-
if (warningMsgs.length > 0) {
|
|
237
|
-
process.stderr.write(`Warning: env var checks reported warnings:\n${warningMsgs.join('\n')}\n`);
|
|
238
|
-
}
|
|
239
|
-
const errorMsgs = itemMessages(false);
|
|
240
|
-
if (errorMsgs.length > 0) {
|
|
241
|
-
process.stderr.write(`Error: failed to resolve env vars:\n${errorMsgs.join('\n')}\n`);
|
|
242
|
-
process.exit(1);
|
|
243
|
-
}
|
|
244
|
-
resolvedEnv = graph.getResolvedEnvObject();
|
|
245
255
|
}
|
|
246
256
|
const varCount = Object.keys(resolvedEnv).length;
|
|
247
257
|
process.stderr.write(`Loaded ${varCount} env vars from .env.schema (company: ${slug})\n`);
|
package/dist/commands/sources.js
CHANGED
|
@@ -37,6 +37,7 @@ import { createSignalsAlertChannelPoster, raiseSignalsFailureAlerts } from "../l
|
|
|
37
37
|
import { audienceKey } from "../lib/hot-channels/audience.js";
|
|
38
38
|
import { appendRunLedgerEntry, ledgerDay, readRunLedger, RUN_TRIGGERS, summarizeRunLedger, } from "../lib/hot-channels/ledger.js";
|
|
39
39
|
import { createClaudeSignalsPass, DEFAULT_MAX_SIGNAL_DOCS, readPendingSignals, SignalsPassError, } from "../lib/hot-channels/signals-pass.js";
|
|
40
|
+
import { recordSignalsPassClaudeLogin } from "../lib/hot-channels/signals-claude-login.js";
|
|
40
41
|
import { backlogRunResult, parseSince, queueSignalsRedo, selectSignalsRedo, SignalsRedoUsageError, } from "../lib/hot-channels/signals-redo.js";
|
|
41
42
|
import { assertSafeSegment } from "../lib/hot-channels/landing.js";
|
|
42
43
|
import { acquireSyncLock, SYNC_LOCK_BUSY_REASON } from "../lib/hot-channels/sync-lock.js";
|
|
@@ -607,7 +608,7 @@ export async function runSync(options, overrides = {}) {
|
|
|
607
608
|
...(overrides.registry ? { registry: overrides.registry } : {}),
|
|
608
609
|
...(overrides.now ? { now: overrides.now } : {}),
|
|
609
610
|
...(overrides.createSelections ? { createSelections: overrides.createSelections } : {}),
|
|
610
|
-
signalsGenerated: overrides.signalsGenerated ?? createClaudeSignalsPass({ hqRoot: options.hqRoot, company, botRuntime: defaultResolveBotRuntime }),
|
|
611
|
+
signalsGenerated: overrides.signalsGenerated ?? createClaudeSignalsPass({ hqRoot: options.hqRoot, company, botRuntime: defaultResolveBotRuntime, onClaudeLogin: recordSignalsPassClaudeLogin }),
|
|
611
612
|
// The CLI has no owner-DM sender: the terminal is the primary alert here.
|
|
612
613
|
signalsAlert: {
|
|
613
614
|
sendOwnerDm: async (text) => {
|
|
@@ -723,7 +724,7 @@ export async function runSignalsRedo(options, overrides = {}) {
|
|
|
723
724
|
});
|
|
724
725
|
const pass = overrides.createPass
|
|
725
726
|
? overrides.createPass(maxDocs)
|
|
726
|
-
: createClaudeSignalsPass({ hqRoot: options.hqRoot, company, maxDocs, botRuntime: defaultResolveBotRuntime });
|
|
727
|
+
: createClaudeSignalsPass({ hqRoot: options.hqRoot, company, maxDocs, botRuntime: defaultResolveBotRuntime, onClaudeLogin: recordSignalsPassClaudeLogin });
|
|
727
728
|
for (const channel of channels) {
|
|
728
729
|
try {
|
|
729
730
|
report.signalsWritten += await pass(backlogRunResult(channel), { beforeWrite: lock.assertHeld });
|
package/dist/index.js
CHANGED
|
@@ -226,6 +226,14 @@ function dispatchCliEntry() {
|
|
|
226
226
|
// Before anything spawns: a background hq on Windows (no terminal) hides the
|
|
227
227
|
// console window of every child it starts (feedback_351a40d5).
|
|
228
228
|
installWindowsHideDefault();
|
|
229
|
+
// Offline hook query: bypass full CLI startup, install followup, telemetry
|
|
230
|
+
// and update checks. It reads only the existing flag snapshot/kill switches.
|
|
231
|
+
if (process.argv.length === 4 && process.argv[2] === "core" && process.argv[3] === "machine-check-owner") {
|
|
232
|
+
void import("./lib/daemon/machine-check-owner.js").then(({ machineCheckOwner }) => {
|
|
233
|
+
process.stdout.write(`${JSON.stringify(machineCheckOwner())}\n`);
|
|
234
|
+
}).catch(() => { process.exitCode = 1; });
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
229
237
|
// A run that mentions --i-still-use-this takes the full command graph, which
|
|
230
238
|
// knows the command names and reads the flag only where it is hq's (before
|
|
231
239
|
// the command's own arguments). The fast routes pass their arguments on
|
|
@@ -15,8 +15,8 @@ export declare function personTokenCachePath(env: NodeJS.ProcessEnv, home: strin
|
|
|
15
15
|
export declare function readHqAnywherePersonSetting(options?: ReadHqAnywherePersonSettingOptions): Promise<boolean | null>;
|
|
16
16
|
/**
|
|
17
17
|
* Wrap a setting reader so a failed read (null) returns the last successfully
|
|
18
|
-
* read value for `graceMs`. A long-running caller such as hqd re-reads
|
|
19
|
-
*
|
|
18
|
+
* read value for `graceMs`. A long-running caller such as hqd re-reads it
|
|
19
|
+
* whenever its runtime gate is checked, and one slow request would otherwise switch HQ Anywhere off for
|
|
20
20
|
* every session. A newly read value, including off, always applies at once;
|
|
21
21
|
* with no successful read inside the window the result stays null (closed).
|
|
22
22
|
*/
|
|
@@ -59,8 +59,8 @@ export async function readHqAnywherePersonSetting(options = {}) {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Wrap a setting reader so a failed read (null) returns the last successfully
|
|
62
|
-
* read value for `graceMs`. A long-running caller such as hqd re-reads
|
|
63
|
-
*
|
|
62
|
+
* read value for `graceMs`. A long-running caller such as hqd re-reads it
|
|
63
|
+
* whenever its runtime gate is checked, and one slow request would otherwise switch HQ Anywhere off for
|
|
64
64
|
* every session. A newly read value, including off, always applies at once;
|
|
65
65
|
* with no successful read inside the window the result stays null (closed).
|
|
66
66
|
*/
|
|
@@ -437,10 +437,13 @@ export function renderFleetHotSignalSyncScript(input) {
|
|
|
437
437
|
? ["sources", "sync", "--trigger", "scheduled", "--company", input.company, "--hq-root", input.hqRoot]
|
|
438
438
|
: ["signals", "run", "--trigger", "job", "--company", input.company, "--hq-root", input.hqRoot, "--report-found"];
|
|
439
439
|
const syncCommand = `hq sources sync --company ${input.company}`;
|
|
440
|
+
const claudeSignInFix = `open HQ, go to Settings → AI tools, and use the Claude Code button there (Connect Claude, or Install Claude if it is not installed yet). Or run \`${signInCommand("claude")}\` in a terminal on this computer.`;
|
|
440
441
|
const fixes = {
|
|
441
442
|
hq_signed_out: "run `hq login`.",
|
|
442
|
-
|
|
443
|
-
|
|
443
|
+
// The desktop app first (Settings → AI tools lists Claude Code with a
|
|
444
|
+
// "Connect Claude" or "Install Claude" button), the terminal as the fallback.
|
|
445
|
+
claude_signed_out: claudeSignInFix,
|
|
446
|
+
codex_bot_needs_claude: claudeSignInFix,
|
|
444
447
|
claude_missing: `install Claude Code (\`npm install -g @anthropic-ai/claude-code\`), then run \`${signInCommand("claude")}\`.`,
|
|
445
448
|
claude_timeout_key: `run \`hq sources signals --company ${input.company} --key KEY\` to retry that document.`,
|
|
446
449
|
claude_timeout: "the next run retries the document.",
|
|
@@ -73,6 +73,15 @@ export interface InflightTurn {
|
|
|
73
73
|
/** Older markers: the raw excerpt. Not reported anywhere since 5.345.76. */
|
|
74
74
|
excerpt?: string;
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* A signals "Try now" run (US-006 AC9): the company it ran for and the
|
|
78
|
+
* job's zone. A run cut off by a restart puts the Try now offer back, so
|
|
79
|
+
* the owner's next "Try now" runs.
|
|
80
|
+
*/
|
|
81
|
+
tryNow?: {
|
|
82
|
+
company: string;
|
|
83
|
+
timeZone?: string;
|
|
84
|
+
};
|
|
76
85
|
rootEventId?: string;
|
|
77
86
|
/** DM message carrying the thinking reaction, so a restart can clear it. */
|
|
78
87
|
reactionEventId?: string;
|
|
@@ -42,6 +42,8 @@ import { type FormattedReply } from "../../signals/reply.js";
|
|
|
42
42
|
import { type BotConfig } from "../config.js";
|
|
43
43
|
import { type LocalJob } from "../local-jobs.js";
|
|
44
44
|
export declare const HOT_SIGNAL_SYNC_JOB_KIND = "hot-signal-sync";
|
|
45
|
+
/** The job name in a "Try now" run's reply (the scheduled job's is "Morning signals"). */
|
|
46
|
+
export declare const TRY_NOW_JOB_NAME = "Signals";
|
|
45
47
|
/**
|
|
46
48
|
* 06:30 every day, in the job's time zone (the stored six-field form of
|
|
47
49
|
* "30 6 * * *"). Only the first registration uses it; after that the job's
|
|
@@ -64,6 +66,16 @@ export declare function forgetHotSignalSyncRegistrationsExcept(dir: string, keep
|
|
|
64
66
|
export declare function hotSignalSyncJobContext(company: string): Record<string, unknown>;
|
|
65
67
|
/** The company a job item syncs, when its context marks it as this built-in; else null. */
|
|
66
68
|
export declare function hotSignalSyncJobCompany(context: unknown): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* The companies this bot runs the hot-signal-sync job for. A legacy bot's job
|
|
71
|
+
* is in its own `jobs.json`; an HQ Fleet Runtime bot's job lives in the
|
|
72
|
+
* runtime's cron store, which only the runtime's python can list, so its
|
|
73
|
+
* registration marker (`hot-signal-sync:fleet:{company}`) stands in for it.
|
|
74
|
+
* Never throws: an unreadable file counts as no job.
|
|
75
|
+
*/
|
|
76
|
+
export declare function hotSignalSyncJobCompanies(dir: string, opts?: {
|
|
77
|
+
fleet?: boolean;
|
|
78
|
+
}): string[];
|
|
67
79
|
/**
|
|
68
80
|
* The HQ's active company from `{hqRoot}/.hq/config.json` (`activeCompany`),
|
|
69
81
|
* the same company `hq sources sync` falls back to. Undefined when the file is
|
|
@@ -215,7 +227,34 @@ export interface HotSignalSyncRunInput {
|
|
|
215
227
|
* the failure reply say when it tries again. Unset = no automatic retry.
|
|
216
228
|
*/
|
|
217
229
|
scheduleRetry?: (at: string) => boolean;
|
|
230
|
+
/**
|
|
231
|
+
* The member answered a reply's "Try now" (US-006 AC9): one run with
|
|
232
|
+
* `trigger: "chat"` and `force: true`, the same as `hq signals run --trigger
|
|
233
|
+
* chat --force`, with the engine's caps and company lock. Never a catch-up,
|
|
234
|
+
* never retried. Runs only through the engine: with no engine (the
|
|
235
|
+
* cli.bot-signals-engine-job flag off) nothing runs.
|
|
236
|
+
*/
|
|
237
|
+
tryNow?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* The reply goes to the HQ desktop app (the local bot's owner DM), so it
|
|
240
|
+
* links today's brief with `hq-desktop://brief` (US-023). Unset keeps the
|
|
241
|
+
* "Create today's brief" decision and writes no hq-desktop:// link.
|
|
242
|
+
*/
|
|
243
|
+
desktopLinks?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* This bot has a scheduled brief job (`hasScheduledBriefJob`). Only then
|
|
246
|
+
* does a desktop reply say the brief builds next.
|
|
247
|
+
*/
|
|
248
|
+
briefJobScheduled?: boolean;
|
|
218
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* True when the bot's own jobs.json has a scheduled job that runs
|
|
252
|
+
* /daily-brief. hq-cli never starts the brief itself, so a reply says the
|
|
253
|
+
* brief builds next only when one of these exists. Cloud-scheduled jobs are
|
|
254
|
+
* not read here; a bot with only those gets the "open it to create" wording.
|
|
255
|
+
* Never throws: an unreadable jobs.json counts as no brief job.
|
|
256
|
+
*/
|
|
257
|
+
export declare function hasScheduledBriefJob(dir: string): boolean;
|
|
219
258
|
/**
|
|
220
259
|
* The engine options a fired job passes. `signalsAlert` is the owner-DM
|
|
221
260
|
* sender for the signals-failure alert (US-018, hq-cli #2314). Until #2314
|
|
@@ -240,7 +279,19 @@ export interface HotSignalSyncRunOutcome {
|
|
|
240
279
|
retryAt?: string;
|
|
241
280
|
/** The signals-failure alert already told the owner, so the bot sends no second DM for this run. */
|
|
242
281
|
ownerAlerted?: boolean;
|
|
282
|
+
/** The reply asks the member for "Try now" (a failed or finished-with-problems run). */
|
|
283
|
+
tryNowOffered?: boolean;
|
|
284
|
+
/** Another run held the company lock, so this one started nothing. */
|
|
285
|
+
running?: boolean;
|
|
286
|
+
/** A Try now with no engine (flag off): nothing ran and nothing should be sent. */
|
|
287
|
+
notRun?: true;
|
|
243
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* True when a member's message is the "Try now" answer: the decision button
|
|
291
|
+
* (which sends its label, "Try now") or the exact text the reply asks for.
|
|
292
|
+
* Case, surrounding space and quotes are ignored; anything else is not it.
|
|
293
|
+
*/
|
|
294
|
+
export declare function isTryNowReply(text: string): boolean;
|
|
244
295
|
/** Run the scheduled sync once and describe it in plain words. Never throws. */
|
|
245
296
|
export declare function runHotSignalSyncJob(input: HotSignalSyncRunInput): Promise<HotSignalSyncRunOutcome>;
|
|
246
297
|
export declare function describeSyncReport(company: string, report: OnDemandSyncReport): string;
|