@indigoai-us/hq-cli 5.345.247 → 5.345.248
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 +54 -0
- package/assets/lanes-hooks/hq-lanes-drain.sh +1 -1
- package/contracts/host-canary-release.json +14 -0
- package/dist/command-catalog.generated.d.ts +1113 -0
- package/dist/command-catalog.generated.js +1370 -0
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/lanes-hold.js +7 -7
- package/dist/commands/lanes-resume.js +2 -2
- package/dist/commands/lanes-review.js +1 -1
- package/dist/commands/lanes-session-start.d.ts +1 -1
- package/dist/commands/lanes-session-start.js +3 -3
- package/dist/commands/lanes-shared.d.ts +1 -1
- package/dist/commands/lanes.d.ts +2 -2
- package/dist/commands/lanes.js +50 -50
- package/dist/commands/mesh.d.ts +25 -0
- package/dist/commands/mesh.js +48 -8
- package/dist/commands/ontology-graph.d.ts +62 -0
- package/dist/commands/ontology-graph.js +439 -0
- package/dist/index.js +1 -1
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +1 -1
- package/dist/lanes-monitor-check-fast.d.ts +1 -1
- package/dist/lanes-monitor-check-fast.js +1 -1
- package/dist/lanes-session-start-argv.d.ts +1 -1
- package/dist/lanes-session-start-argv.js +1 -1
- package/dist/lib/capacity/sign-in.d.ts +1 -1
- package/dist/lib/capacity/sign-in.js +1 -1
- package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
- package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
- package/dist/lib/daemon/lanes-monitor-state.js +2 -2
- package/dist/lib/daemon/merge-sections.d.ts +3 -3
- package/dist/lib/daemon/merge-sections.js +7 -7
- package/dist/lib/daemon/remote-control-pools.js +1 -1
- package/dist/lib/daemon/run.js +1 -1
- package/dist/lib/daemon/state-file.d.ts +1 -1
- package/dist/lib/daemon/state-file.js +1 -1
- package/dist/lib/flag-snapshot-file.d.ts +2 -0
- package/dist/lib/flag-snapshot-file.js +118 -48
- package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
- package/dist/lib/hook-engine/canary-gate.js +138 -6
- package/dist/lib/hot-channels/graph-context.d.ts +105 -0
- package/dist/lib/hot-channels/graph-context.js +377 -0
- package/dist/lib/hot-channels/signals-pass.js +27 -1
- package/dist/lib/lanes/claude-credential.d.ts +1 -1
- package/dist/lib/lanes/claude-credential.js +1 -1
- package/dist/lib/lanes/delivery-core.d.ts +1 -1
- package/dist/lib/lanes/delivery-core.js +1 -1
- package/dist/lib/lanes/delivery.d.ts +10 -10
- package/dist/lib/lanes/delivery.js +8 -8
- package/dist/lib/lanes/dropbox.d.ts +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +2 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.js +1 -1
- package/dist/lib/lanes/quota-notice.js +1 -1
- package/dist/lib/lanes/quota.d.ts +1 -1
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
- package/dist/lib/lanes/repo-merge-hold.js +2 -2
- package/dist/lib/lanes/spawn.d.ts +4 -4
- package/dist/lib/lanes/spawn.js +5 -5
- package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
- package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
- package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
- package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
- package/dist/lib/mesh/live/daemon/run.js +35 -2
- package/dist/lib/mesh/live/direct-drain.js +1 -1
- package/dist/lib/mesh/live/emit.d.ts +3 -0
- package/dist/lib/mesh/live/emit.js +32 -9
- package/dist/lib/mesh/live/flush.d.ts +3 -0
- package/dist/lib/mesh/live/flush.js +115 -32
- package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
- package/dist/lib/mesh/live/liveness-carry.js +1 -1
- package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
- package/dist/lib/mesh/live/reporting-privacy.js +235 -11
- package/dist/lib/mesh/live/spool.d.ts +17 -2
- package/dist/lib/mesh/live/spool.js +22 -6
- package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
- package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
- package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
- package/dist/lib/ontology-graph/legacy/index.js +1150 -0
- package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
- package/dist/lib/ontology-graph/legacy/parse.js +126 -0
- package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
- package/dist/lib/ontology-graph/legacy/report.js +254 -0
- package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
- package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
- package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
- package/dist/lib/ontology-graph/lint/checks.js +717 -0
- package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
- package/dist/lib/ontology-graph/lint/coverage.js +241 -0
- package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
- package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
- package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
- package/dist/lib/ontology-graph/lint/index.js +176 -0
- package/dist/lib/ontology-graph/model/files.d.ts +20 -0
- package/dist/lib/ontology-graph/model/files.js +89 -0
- package/dist/lib/ontology-graph/model/index.d.ts +65 -0
- package/dist/lib/ontology-graph/model/index.js +100 -0
- package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
- package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
- package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
- package/dist/lib/ontology-graph/model/pass.js +958 -0
- package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
- package/dist/lib/ontology-graph/model/runner.js +160 -0
- package/dist/lib/ontology-graph/model/step.d.ts +195 -0
- package/dist/lib/ontology-graph/model/step.js +523 -0
- package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
- package/dist/lib/ontology-graph/model/tasks.js +349 -0
- package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
- package/dist/lib/ontology-graph/not-implemented.js +8 -0
- package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
- package/dist/lib/ontology-graph/org/compare.js +239 -0
- package/dist/lib/ontology-graph/org/derive.d.ts +65 -0
- package/dist/lib/ontology-graph/org/derive.js +352 -0
- package/dist/lib/ontology-graph/org/index.d.ts +73 -0
- package/dist/lib/ontology-graph/org/index.js +513 -0
- package/dist/lib/ontology-graph/org/load.d.ts +31 -0
- package/dist/lib/ontology-graph/org/load.js +476 -0
- package/dist/lib/ontology-graph/org/role.d.ts +38 -0
- package/dist/lib/ontology-graph/org/role.js +268 -0
- package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
- package/dist/lib/ontology-graph/org/structure.js +437 -0
- package/dist/lib/ontology-graph/org/text.d.ts +95 -0
- package/dist/lib/ontology-graph/org/text.js +315 -0
- package/dist/lib/ontology-graph/org/types.d.ts +452 -0
- package/dist/lib/ontology-graph/org/types.js +80 -0
- package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
- package/dist/lib/ontology-graph/pages/index.js +193 -0
- package/dist/lib/ontology-graph/pages/render.d.ts +142 -0
- package/dist/lib/ontology-graph/pages/render.js +682 -0
- package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
- package/dist/lib/ontology-graph/proposals/apply.js +468 -0
- package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
- package/dist/lib/ontology-graph/proposals/group.js +232 -0
- package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
- package/dist/lib/ontology-graph/proposals/index.js +474 -0
- package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
- package/dist/lib/ontology-graph/proposals/model.js +196 -0
- package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
- package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
- package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
- package/dist/lib/ontology-graph/read/brief.js +251 -0
- package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
- package/dist/lib/ontology-graph/read/graph-index.js +198 -0
- package/dist/lib/ontology-graph/read/index.d.ts +59 -0
- package/dist/lib/ontology-graph/read/index.js +792 -0
- package/dist/lib/ontology-graph/read/member.d.ts +7 -0
- package/dist/lib/ontology-graph/read/member.js +34 -0
- package/dist/lib/ontology-graph/read/names.d.ts +44 -0
- package/dist/lib/ontology-graph/read/names.js +292 -0
- package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
- package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
- package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
- package/dist/lib/ontology-graph/read/test-graph.js +150 -0
- package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
- package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
- package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
- package/dist/lib/ontology-graph/replay/config.js +105 -0
- package/dist/lib/ontology-graph/replay/engine.d.ts +100 -0
- package/dist/lib/ontology-graph/replay/engine.js +1174 -0
- package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
- package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
- package/dist/lib/ontology-graph/replay/index.d.ts +90 -0
- package/dist/lib/ontology-graph/replay/index.js +220 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
- package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
- package/dist/lib/ontology-graph/replay/member.js +65 -0
- package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
- package/dist/lib/ontology-graph/replay/mentions.js +239 -0
- package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
- package/dist/lib/ontology-graph/replay/readers.js +1251 -0
- package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
- package/dist/lib/ontology-graph/replay/rules.js +374 -0
- package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
- package/dist/lib/ontology-graph/replay/scope.js +115 -0
- package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
- package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
- package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
- package/dist/lib/ontology-graph/replay/util.js +256 -0
- package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
- package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
- package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
- package/dist/lib/ontology-graph/resolve/index.js +214 -0
- package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
- package/dist/lib/ontology-graph/resolve/machine.js +95 -0
- package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
- package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
- package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
- package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
- package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
- package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
- package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
- package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
- package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
- package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
- package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
- package/dist/lib/ontology-graph/resolve/roster.js +226 -0
- package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
- package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
- package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
- package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
- package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
- package/dist/lib/ontology-graph/resolve/writer.js +351 -0
- package/dist/lib/ontology-graph/schema/authority.d.ts +73 -0
- package/dist/lib/ontology-graph/schema/authority.js +157 -0
- package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
- package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
- package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
- package/dist/lib/ontology-graph/schema/grammar.js +409 -0
- package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
- package/dist/lib/ontology-graph/schema/index.js +10 -0
- package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
- package/dist/lib/ontology-graph/schema/validate.js +132 -0
- package/dist/lib/ontology-graph/store/files.d.ts +34 -0
- package/dist/lib/ontology-graph/store/files.js +207 -0
- package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
- package/dist/lib/ontology-graph/store/fs.js +101 -0
- package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
- package/dist/lib/ontology-graph/store/graph-store.js +520 -0
- package/dist/lib/ontology-graph/store/index.d.ts +18 -0
- package/dist/lib/ontology-graph/store/index.js +15 -0
- package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
- package/dist/lib/ontology-graph/store/ingest.js +323 -0
- package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
- package/dist/lib/ontology-graph/store/paths.js +232 -0
- package/dist/lib/ontology-graph/types.d.ts +1183 -0
- package/dist/lib/ontology-graph/types.js +131 -0
- package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
- package/dist/utils/frontmatter.d.ts +14 -0
- package/dist/utils/frontmatter.js +18 -0
- package/dist/utils/interactive-caller.js +1 -1
- package/package.json +8 -8
|
@@ -101,6 +101,7 @@ import * as path from "node:path";
|
|
|
101
101
|
import { fileURLToPath } from "node:url";
|
|
102
102
|
import * as yaml from "js-yaml";
|
|
103
103
|
import { audienceKey, COMPANY_AUDIENCE_KEY } from "./audience.js";
|
|
104
|
+
import { appendPackToDocument, openSignalsGraphContext, writeEntityRefs, } from "./graph-context.js";
|
|
104
105
|
import { assertVaultPath } from "../signals/write-guard.js";
|
|
105
106
|
import { assertPayloadRef, assertSafeSegment, writeFileAtomic } from "./landing.js";
|
|
106
107
|
import { fleetFailureClass, fleetFailureMessage, runFleetComplete } from "./fleet-complete.js";
|
|
@@ -952,6 +953,28 @@ export function createClaudeSignalsPass(options) {
|
|
|
952
953
|
let preflight;
|
|
953
954
|
let prompt;
|
|
954
955
|
let docsSent = 0;
|
|
956
|
+
// Graph context pack (graph-context.ts). Off unless the reader setting
|
|
957
|
+
// (personal/settings/ontology-reader.yaml) says `reader: graph` for this
|
|
958
|
+
// company; then each document is sent with the entities it names appended
|
|
959
|
+
// as data, and each signal's entity_refs are chosen from that pack.
|
|
960
|
+
let graphContext;
|
|
961
|
+
const packs = new Map();
|
|
962
|
+
const withPack = (item, input) => {
|
|
963
|
+
if (graphContext === undefined) {
|
|
964
|
+
graphContext = openSignalsGraphContext({ hqRoot: options.hqRoot, company: options.company, warn });
|
|
965
|
+
}
|
|
966
|
+
if (!graphContext)
|
|
967
|
+
return input;
|
|
968
|
+
try {
|
|
969
|
+
const pack = graphContext.pack({ text: input.text, audience: item.audienceKey });
|
|
970
|
+
packs.set(item.file, pack);
|
|
971
|
+
return pack.text ? { ...input, text: appendPackToDocument(input.text, pack) } : input;
|
|
972
|
+
}
|
|
973
|
+
catch {
|
|
974
|
+
// The pack is context only: the document is sent without it.
|
|
975
|
+
return input;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
955
978
|
const runtimeSpawn = options.runtimeSpawn ?? defaultSpawn;
|
|
956
979
|
const codexBot = () => {
|
|
957
980
|
try {
|
|
@@ -1230,7 +1253,8 @@ export function createClaudeSignalsPass(options) {
|
|
|
1230
1253
|
dated.sort((a, b) => b.at - a.at || (a.item.file < b.item.file ? -1 : a.item.file > b.item.file ? 1 : 0));
|
|
1231
1254
|
return { items: dated.map((d) => d.item), pending: true };
|
|
1232
1255
|
};
|
|
1233
|
-
const extract = async (item,
|
|
1256
|
+
const extract = async (item, document) => {
|
|
1257
|
+
const input = withPack(item, document);
|
|
1234
1258
|
for (let attempt = 1;; attempt += 1) {
|
|
1235
1259
|
try {
|
|
1236
1260
|
return await extractOnce(item, input);
|
|
@@ -1413,6 +1437,8 @@ export function createClaudeSignalsPass(options) {
|
|
|
1413
1437
|
}
|
|
1414
1438
|
if (citation !== undefined)
|
|
1415
1439
|
frontmatter.citations = [citation];
|
|
1440
|
+
// Host-side: ids come from the document's pack and nowhere else.
|
|
1441
|
+
writeEntityRefs(frontmatter, packs.get(item.file), { title: signal.title, body: signal.body });
|
|
1416
1442
|
if (input.payloadRef !== undefined)
|
|
1417
1443
|
frontmatter.payload_ref = input.payloadRef;
|
|
1418
1444
|
if (input.fallback !== undefined)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Expiry check for the Claude OAuth credential a lane worker will use.
|
|
3
3
|
*
|
|
4
|
-
* `hq
|
|
4
|
+
* `hq runners accounts list` used to report `logged_in: true` when a
|
|
5
5
|
* credential merely existed (a `.credentials.json` file, or `claude auth
|
|
6
6
|
* status` saying a keychain item is present). An expired access token still
|
|
7
7
|
* passed, and the lane exited seconds after start with an OAuth expiry
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Expiry check for the Claude OAuth credential a lane worker will use.
|
|
3
3
|
*
|
|
4
|
-
* `hq
|
|
4
|
+
* `hq runners accounts list` used to report `logged_in: true` when a
|
|
5
5
|
* credential merely existed (a `.credentials.json` file, or `claude auth
|
|
6
6
|
* status` saying a keychain item is present). An expired access token still
|
|
7
7
|
* passed, and the lane exited seconds after start with an OAuth expiry
|
|
@@ -4,7 +4,7 @@ export interface LaneDeliveryHandlers<T> {
|
|
|
4
4
|
resume: () => T | Promise<T>;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* The shared side-effect seam for lane messages. Both `hq
|
|
7
|
+
* The shared side-effect seam for lane messages. Both `hq runners message` and
|
|
8
8
|
* `hq monitor` use the same delivery decision and cannot choose a provider
|
|
9
9
|
* path from state independently.
|
|
10
10
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deliveryRefusalReason, laneDeliveryMechanism, } from "./delivery.js";
|
|
2
2
|
import { LanesError } from "./errors.js";
|
|
3
3
|
/**
|
|
4
|
-
* The shared side-effect seam for lane messages. Both `hq
|
|
4
|
+
* The shared side-effect seam for lane messages. Both `hq runners message` and
|
|
5
5
|
* `hq monitor` use the same delivery decision and cannot choose a provider
|
|
6
6
|
* path from state independently.
|
|
7
7
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* id and a warm prompt cache (verified live 2026-09-26: the resumed turn
|
|
14
14
|
* recalled the earlier turn's tool calls and read 33,792 cached tokens).
|
|
15
15
|
*
|
|
16
|
-
* Every dispatch site (`hq
|
|
16
|
+
* Every dispatch site (`hq runners message`, spawn, reconcile resume) asks this
|
|
17
17
|
* module rather than testing provider or state inline. A guard bound at one
|
|
18
18
|
* site and not another is the defect class this branch has already shipped.
|
|
19
19
|
*/
|
|
@@ -40,15 +40,15 @@ export declare function sessionNotPortableMessage(provider: LaneProvider): strin
|
|
|
40
40
|
* what it needs. An operator message is usually that missing input. The state
|
|
41
41
|
* is not terminal (spec §6.7) and nothing stopped the lane deliberately.
|
|
42
42
|
*
|
|
43
|
-
* Refused by `hq
|
|
44
|
-
* `awaiting_input` has its own path, `hq
|
|
43
|
+
* Refused by `hq runners message`:
|
|
44
|
+
* `awaiting_input` has its own path, `hq runners questions answer`, while a
|
|
45
45
|
* senior may resume it when no answerable pending question remains. `killed` and
|
|
46
46
|
* `cancelled` were stopped on purpose by the operator; a message must not
|
|
47
47
|
* silently restart them. `failed` means the run ended without an envelope or
|
|
48
48
|
* never started; only the lane's senior can explicitly recover it with
|
|
49
|
-
* `hq
|
|
49
|
+
* `hq runners resume <lane-id> --from-failed --reason <text>`. `interrupted` exited with
|
|
50
50
|
* partial output and no envelope, so the lane's state was never closed
|
|
51
|
-
* cleanly; only the explicit `hq
|
|
51
|
+
* cleanly; only the explicit `hq runners resume` opt-in continues it
|
|
52
52
|
* (RESUME_COMMAND_STATES). `queued` and `running` take the drop box, not a
|
|
53
53
|
* resume.
|
|
54
54
|
*/
|
|
@@ -56,7 +56,7 @@ export declare const RESUMABLE_LANE_STATES: readonly ["done", "blocked"];
|
|
|
56
56
|
export type ResumableLaneState = (typeof RESUMABLE_LANE_STATES)[number];
|
|
57
57
|
export declare function isResumableLaneState(state: LaneState): state is ResumableLaneState;
|
|
58
58
|
/**
|
|
59
|
-
* States `hq
|
|
59
|
+
* States `hq runners resume` continues from. `interrupted` is the one a plain
|
|
60
60
|
* message refuses: the run ended without closing its state, and continuing
|
|
61
61
|
* it is a decision the operator makes by name. `done` and `blocked` are here
|
|
62
62
|
* so the one command covers every exited-with-a-session case.
|
|
@@ -66,7 +66,7 @@ export type ResumeCommandState = (typeof RESUME_COMMAND_STATES)[number];
|
|
|
66
66
|
export declare function isResumeCommandState(state: LaneState): state is ResumeCommandState;
|
|
67
67
|
export declare const LANE_DELIVERY_MECHANISMS: readonly ["dropbox", "resume", "none"];
|
|
68
68
|
export type LaneDeliveryMechanism = (typeof LANE_DELIVERY_MECHANISMS)[number];
|
|
69
|
-
/** Additional presentation-only result used by `hq
|
|
69
|
+
/** Additional presentation-only result used by `hq runners show`. */
|
|
70
70
|
export type LaneShowDeliveryMechanism = LaneDeliveryMechanism | "questions";
|
|
71
71
|
export type DeliveryLane = Pick<LaneRecord, "state" | "provider" | "provider_session_id" | "terminal_reason" | "envelope_repair" | "keep_alive" | "quota_reset_at" | "terminal_details">;
|
|
72
72
|
export declare function isFailedQuotaKeepAliveLane(lane: DeliveryLane): boolean;
|
|
@@ -140,7 +140,7 @@ export type LaunchTrigger = {
|
|
|
140
140
|
monitor_event?: true;
|
|
141
141
|
system_notice?: true;
|
|
142
142
|
} | {
|
|
143
|
-
/** `hq
|
|
143
|
+
/** `hq runners resume`: the operator's explicit opt-in to continue an exited lane. */
|
|
144
144
|
kind: "resume";
|
|
145
145
|
/** Lane state at the moment of the command; recorded as `last_resume.resumed_from`. */
|
|
146
146
|
from: ResumeCommandState | "failed" | "awaiting_input";
|
|
@@ -160,7 +160,7 @@ export type LaunchPlan = {
|
|
|
160
160
|
session_id: string;
|
|
161
161
|
};
|
|
162
162
|
/**
|
|
163
|
-
* Refusal for `hq
|
|
163
|
+
* Refusal for `hq runners resume`, in precedence order: wrong state, provider
|
|
164
164
|
* without a resume path, no recorded session. Null when the resume can go.
|
|
165
165
|
*/
|
|
166
166
|
export declare function resumeCommandRefusal(lane: DeliveryLane, options?: {
|
|
@@ -176,7 +176,7 @@ export declare function resumeCommandRefusal(lane: DeliveryLane, options?: {
|
|
|
176
176
|
* brief. Answered questions resume the recorded session when the provider
|
|
177
177
|
* can, else start fresh with the answers file (today's behaviour). An operator
|
|
178
178
|
* message can only be a resume, and only when `laneDeliveryMechanism` says so.
|
|
179
|
-
* `hq
|
|
179
|
+
* `hq runners resume` is also always a resume, gated by `resumeCommandRefusal`.
|
|
180
180
|
*/
|
|
181
181
|
export declare function planLaneLaunch(lane: DeliveryLane, trigger: LaunchTrigger): LaunchPlan;
|
|
182
182
|
/** Lane states a launch may claim `running` from, per trigger. */
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* id and a warm prompt cache (verified live 2026-09-26: the resumed turn
|
|
14
14
|
* recalled the earlier turn's tool calls and read 33,792 cached tokens).
|
|
15
15
|
*
|
|
16
|
-
* Every dispatch site (`hq
|
|
16
|
+
* Every dispatch site (`hq runners message`, spawn, reconcile resume) asks this
|
|
17
17
|
* module rather than testing provider or state inline. A guard bound at one
|
|
18
18
|
* site and not another is the defect class this branch has already shipped.
|
|
19
19
|
*/
|
|
@@ -60,15 +60,15 @@ export function sessionNotPortableMessage(provider) {
|
|
|
60
60
|
* what it needs. An operator message is usually that missing input. The state
|
|
61
61
|
* is not terminal (spec §6.7) and nothing stopped the lane deliberately.
|
|
62
62
|
*
|
|
63
|
-
* Refused by `hq
|
|
64
|
-
* `awaiting_input` has its own path, `hq
|
|
63
|
+
* Refused by `hq runners message`:
|
|
64
|
+
* `awaiting_input` has its own path, `hq runners questions answer`, while a
|
|
65
65
|
* senior may resume it when no answerable pending question remains. `killed` and
|
|
66
66
|
* `cancelled` were stopped on purpose by the operator; a message must not
|
|
67
67
|
* silently restart them. `failed` means the run ended without an envelope or
|
|
68
68
|
* never started; only the lane's senior can explicitly recover it with
|
|
69
|
-
* `hq
|
|
69
|
+
* `hq runners resume <lane-id> --from-failed --reason <text>`. `interrupted` exited with
|
|
70
70
|
* partial output and no envelope, so the lane's state was never closed
|
|
71
|
-
* cleanly; only the explicit `hq
|
|
71
|
+
* cleanly; only the explicit `hq runners resume` opt-in continues it
|
|
72
72
|
* (RESUME_COMMAND_STATES). `queued` and `running` take the drop box, not a
|
|
73
73
|
* resume.
|
|
74
74
|
*/
|
|
@@ -77,7 +77,7 @@ export function isResumableLaneState(state) {
|
|
|
77
77
|
return RESUMABLE_LANE_STATES.includes(state);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* States `hq
|
|
80
|
+
* States `hq runners resume` continues from. `interrupted` is the one a plain
|
|
81
81
|
* message refuses: the run ended without closing its state, and continuing
|
|
82
82
|
* it is a decision the operator makes by name. `done` and `blocked` are here
|
|
83
83
|
* so the one command covers every exited-with-a-session case.
|
|
@@ -351,7 +351,7 @@ workerOutOffset = 0) {
|
|
|
351
351
|
}
|
|
352
352
|
export const LAUNCH_TRIGGERS = ["admit", "answered_questions", "message", "resume"];
|
|
353
353
|
/**
|
|
354
|
-
* Refusal for `hq
|
|
354
|
+
* Refusal for `hq runners resume`, in precedence order: wrong state, provider
|
|
355
355
|
* without a resume path, no recorded session. Null when the resume can go.
|
|
356
356
|
*/
|
|
357
357
|
export function resumeCommandRefusal(lane, options = {}) {
|
|
@@ -392,7 +392,7 @@ export function resumeCommandRefusal(lane, options = {}) {
|
|
|
392
392
|
* brief. Answered questions resume the recorded session when the provider
|
|
393
393
|
* can, else start fresh with the answers file (today's behaviour). An operator
|
|
394
394
|
* message can only be a resume, and only when `laneDeliveryMechanism` says so.
|
|
395
|
-
* `hq
|
|
395
|
+
* `hq runners resume` is also always a resume, gated by `resumeCommandRefusal`.
|
|
396
396
|
*/
|
|
397
397
|
export function planLaneLaunch(lane, trigger) {
|
|
398
398
|
switch (trigger.kind) {
|
|
@@ -122,7 +122,7 @@ export declare function runDrainHook(env: NodeJS.ProcessEnv, input?: LaneDrainHo
|
|
|
122
122
|
/** Spec §6.5: only a still-running lane gets drop-box delivery. */
|
|
123
123
|
export declare function laneAcceptsDropboxDelivery(lane: Pick<LaneRecord, "state">): boolean;
|
|
124
124
|
/**
|
|
125
|
-
* Operator `hq
|
|
125
|
+
* Operator `hq runners message` delivery. Queued is accepted because the
|
|
126
126
|
* worker that will spawn drains the inbox on its first tool event.
|
|
127
127
|
* `laneAcceptsDropboxDelivery` refuses queued, so it is the wrong guard here.
|
|
128
128
|
*/
|
|
@@ -687,7 +687,7 @@ export function laneAcceptsDropboxDelivery(lane) {
|
|
|
687
687
|
return lane.state === "running";
|
|
688
688
|
}
|
|
689
689
|
/**
|
|
690
|
-
* Operator `hq
|
|
690
|
+
* Operator `hq runners message` delivery. Queued is accepted because the
|
|
691
691
|
* worker that will spawn drains the inbox on its first tool event.
|
|
692
692
|
* `laneAcceptsDropboxDelivery` refuses queued, so it is the wrong guard here.
|
|
693
693
|
*/
|
|
@@ -634,7 +634,7 @@ export function mergeCodexConfigHook(existingText, command, configPath, legacyCo
|
|
|
634
634
|
const sep = text === "" || text.endsWith("\n") ? "" : "\n";
|
|
635
635
|
text =
|
|
636
636
|
`${text}${sep}\n` +
|
|
637
|
-
`# hq
|
|
637
|
+
`# hq runners: drop-box drain for lane workers (no-op unless HQ_LANE_ID is set)\n` +
|
|
638
638
|
`[[hooks.PreToolUse]]\n` +
|
|
639
639
|
`matcher = ".*"\n\n` +
|
|
640
640
|
`[[hooks.PreToolUse.hooks]]\n` +
|
|
@@ -646,7 +646,7 @@ export function mergeCodexConfigHook(existingText, command, configPath, legacyCo
|
|
|
646
646
|
if (isPlainObject(current.hooks) && groupsContainCommand(current.hooks[event], command))
|
|
647
647
|
continue;
|
|
648
648
|
const sep = text === "" || text.endsWith("\n") ? "" : "\n";
|
|
649
|
-
text += `${sep}\n# hq
|
|
649
|
+
text += `${sep}\n# hq runners: drop-box delivery\n[[hooks.${event}]]\nmatcher = ".*"\n\n[[hooks.${event}.hooks]]\ntype = "command"\ncommand = ${tomlBasicString(command)}\ntimeout = ${DRAIN_HOOK_TIMEOUT_SECONDS}\n`;
|
|
650
650
|
}
|
|
651
651
|
const check = parseTomlOrThrow(text, configPath, "after merge");
|
|
652
652
|
if (!tomlHasCommand(check, command) ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Library layer for `hq
|
|
2
|
+
* Library layer for `hq runners`. The command module should import from here.
|
|
3
3
|
*/
|
|
4
4
|
export { AccountResolutionError, LaneNotFoundError, LaneSchemaError, LaneVersionConflict, LanesConfigError, LanesError, WorkerResolutionError, isLaneVersionConflict, isLanesError, } from "./errors.js";
|
|
5
5
|
export { MAX_LANE_DEPTH } from "./constants.js";
|
package/dist/lib/lanes/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Library layer for `hq
|
|
2
|
+
* Library layer for `hq runners`. The command module should import from here.
|
|
3
3
|
*/
|
|
4
4
|
export { AccountResolutionError, LaneNotFoundError, LaneSchemaError, LaneVersionConflict, LanesConfigError, LanesError, WorkerResolutionError, isLaneVersionConflict, isLanesError, } from "./errors.js";
|
|
5
5
|
export { MAX_LANE_DEPTH } from "./constants.js";
|
|
@@ -187,7 +187,7 @@ export function parseMonitorTranscript(text) {
|
|
|
187
187
|
outputPath: item.outputPath,
|
|
188
188
|
}));
|
|
189
189
|
}
|
|
190
|
-
// One optional leading `HQ_ROOT=<path>` assignment. `hq
|
|
190
|
+
// One optional leading `HQ_ROOT=<path>` assignment. `hq runners watch` reads
|
|
191
191
|
// $HQ_ROOT first, and a senior whose cwd is a repo outside the HQ tree has no
|
|
192
192
|
// other way to point the watch at the HQ root (feedback_b6b59676). The value
|
|
193
193
|
// is a bare word or a single- or double-quoted string; nothing else is
|
|
@@ -33,7 +33,7 @@ export function quotaLaneNotice(lane, quota) {
|
|
|
33
33
|
* in the watcher log. Returns where it was delivered.
|
|
34
34
|
*/
|
|
35
35
|
export function deliverQuotaNotice(hqRoot, lane, notice, at) {
|
|
36
|
-
process.stderr.write(`hq
|
|
36
|
+
process.stderr.write(`hq runners: ${notice.text}\n`);
|
|
37
37
|
const message = { at, message_id: notice.message_id, kind: "quota_limit", text: notice.text };
|
|
38
38
|
if (lane.senior.kind === "lane" && lane.senior.id) {
|
|
39
39
|
appendDropboxMessageOnce(hqRoot, lane.senior.id, message);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* A recorded 429 never holds the account (owner decision 2026-10-14, after
|
|
21
21
|
* the 2026-10-13 incident where one 429 on account a blocked every Claude
|
|
22
22
|
* lane until Friday). The reset times and provider text stay here as
|
|
23
|
-
* information for `hq
|
|
23
|
+
* information for `hq runners capacity`, `hq runners accounts list` and the
|
|
24
24
|
* senior notice; only a needs-credits marker skips an account, for that model.
|
|
25
25
|
*/
|
|
26
26
|
import type { LaneProvider } from "./types.js";
|
package/dist/lib/lanes/quota.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* A recorded 429 never holds the account (owner decision 2026-10-14, after
|
|
21
21
|
* the 2026-10-13 incident where one 429 on account a blocked every Claude
|
|
22
22
|
* lane until Friday). The reset times and provider text stay here as
|
|
23
|
-
* information for `hq
|
|
23
|
+
* information for `hq runners capacity`, `hq runners accounts list` and the
|
|
24
24
|
* senior notice; only a needs-credits marker skips an account, for that model.
|
|
25
25
|
*/
|
|
26
26
|
import * as fs from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Repository merge hold records (`hq
|
|
2
|
+
* Repository merge hold records (`hq runners hold`, src/commands/lanes-hold.ts):
|
|
3
3
|
* their location, their format and the parser that accepts or refuses one.
|
|
4
4
|
* Kept apart from the command so the daemon (merge-sections.ts) can read hold
|
|
5
5
|
* records without loading the lanes runtime.
|
|
@@ -34,6 +34,6 @@ export interface RepoMergeHold {
|
|
|
34
34
|
}
|
|
35
35
|
/** `<hqRoot>/workspace/lanes/holds/<owner>__<repo>.json`. */
|
|
36
36
|
export declare function holdFilePath(hqRoot: string, repo: string): string;
|
|
37
|
-
/** A hold record as `hq
|
|
37
|
+
/** A hold record as `hq runners hold` accepts it; throws LanesError for any other value. */
|
|
38
38
|
export declare function parseHold(raw: unknown, file: string): RepoMergeHold;
|
|
39
39
|
//# sourceMappingURL=repo-merge-hold.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Repository merge hold records (`hq
|
|
2
|
+
* Repository merge hold records (`hq runners hold`, src/commands/lanes-hold.ts):
|
|
3
3
|
* their location, their format and the parser that accepts or refuses one.
|
|
4
4
|
* Kept apart from the command so the daemon (merge-sections.ts) can read hold
|
|
5
5
|
* records without loading the lanes runtime.
|
|
@@ -30,7 +30,7 @@ function isCanonicalTimestamp(value) {
|
|
|
30
30
|
const timestamp = Date.parse(value);
|
|
31
31
|
return Number.isFinite(timestamp) && new Date(timestamp).toISOString() === value;
|
|
32
32
|
}
|
|
33
|
-
/** A hold record as `hq
|
|
33
|
+
/** A hold record as `hq runners hold` accepts it; throws LanesError for any other value. */
|
|
34
34
|
export function parseHold(raw, file) {
|
|
35
35
|
if (!isObject(raw))
|
|
36
36
|
return fail("repo_hold_invalid", "Merge hold record must be an object", { path: file });
|
|
@@ -231,7 +231,7 @@ export declare function resumePrompt(input: {
|
|
|
231
231
|
answersPath?: string;
|
|
232
232
|
/** Inline copy of the answers so the turn carries them, not only a path. */
|
|
233
233
|
answers?: AnsweredQuestionLine[];
|
|
234
|
-
/** `hq
|
|
234
|
+
/** `hq runners resume`: the state the operator resumed the lane from. */
|
|
235
235
|
resumedFrom?: string;
|
|
236
236
|
/** Automatic continuation initiated by the lane watcher. */
|
|
237
237
|
resumeSource?: "watcher";
|
|
@@ -323,7 +323,7 @@ export declare function markSpawnFailure(hqRoot: string, laneId: string, reasonR
|
|
|
323
323
|
*/
|
|
324
324
|
export declare function refuseOutpostSelfTarget(hqRoot: string, lane: LaneRecord, deps: SpawnLaneDeps): void;
|
|
325
325
|
/**
|
|
326
|
-
* The hq CLI entry a watcher runs internal `hq
|
|
326
|
+
* The hq CLI entry a watcher runs internal `hq runners` commands through. A
|
|
327
327
|
* watcher admits queued lanes and retries accounts from its own process,
|
|
328
328
|
* where process.argv[1] is watcher-main.js rather than the CLI. Recording that
|
|
329
329
|
* path made envelope repair run `watcher-main.js lanes _spawn-envelope-repair`,
|
|
@@ -365,7 +365,7 @@ export interface SpawnLaunchOptions {
|
|
|
365
365
|
trigger?: LaunchTrigger;
|
|
366
366
|
/**
|
|
367
367
|
* False skips the resume-time compaction check for this launch only
|
|
368
|
-
* (`hq
|
|
368
|
+
* (`hq runners message --no-compact`). Default true.
|
|
369
369
|
*/
|
|
370
370
|
compact?: boolean;
|
|
371
371
|
/** Effort resolved by an explicit resume/message request, or pinned from its record. */
|
|
@@ -408,7 +408,7 @@ export type EnvelopeRepairMode = "resume" | "fresh_turn";
|
|
|
408
408
|
* prompt. `fresh_turn`: grok gets a new single-turn invocation on the same
|
|
409
409
|
* account, whose prompt carries the schema, the parser error and the raw
|
|
410
410
|
* failed output. Grok can resume a session (operator messages and
|
|
411
|
-
* `hq
|
|
411
|
+
* `hq runners resume` use it), but its repair turn stays a fresh turn: that
|
|
412
412
|
* path was built and proven that way, and a repair by resume has not been.
|
|
413
413
|
*/
|
|
414
414
|
export declare function envelopeRepairMode(provider: LaneProvider): EnvelopeRepairMode;
|
package/dist/lib/lanes/spawn.js
CHANGED
|
@@ -1527,7 +1527,7 @@ export function resumePrompt(input) {
|
|
|
1527
1527
|
].join("\n"));
|
|
1528
1528
|
}
|
|
1529
1529
|
// Every resume turn carries the authorization, including a textless
|
|
1530
|
-
// `hq
|
|
1530
|
+
// `hq runners resume`: a pre-upgrade session's brief never had the paragraph.
|
|
1531
1531
|
if (input.operatorMessage !== undefined ||
|
|
1532
1532
|
input.monitorEvent !== undefined ||
|
|
1533
1533
|
input.answersPath !== undefined ||
|
|
@@ -1912,7 +1912,7 @@ export const WORKER_SESSION_ENV_VARS = SESSION_ID_ENV_VARS;
|
|
|
1912
1912
|
* the lane still starts.
|
|
1913
1913
|
*/
|
|
1914
1914
|
export function laneStartFingerprint(hqRoot, env) {
|
|
1915
|
-
return offlineFingerprint(hqRoot, env, "hq
|
|
1915
|
+
return offlineFingerprint(hqRoot, env, "hq runners");
|
|
1916
1916
|
}
|
|
1917
1917
|
/** The session identity a lane turn exports to its worker (see `workerEnv`). */
|
|
1918
1918
|
export function laneWorkerSessionEnv(lane, workerSessionId) {
|
|
@@ -2213,7 +2213,7 @@ function writeSpawnManifest(runDir, input) {
|
|
|
2213
2213
|
}, null, 2)}\n`);
|
|
2214
2214
|
}
|
|
2215
2215
|
/**
|
|
2216
|
-
* The hq CLI entry a watcher runs internal `hq
|
|
2216
|
+
* The hq CLI entry a watcher runs internal `hq runners` commands through. A
|
|
2217
2217
|
* watcher admits queued lanes and retries accounts from its own process,
|
|
2218
2218
|
* where process.argv[1] is watcher-main.js rather than the CLI. Recording that
|
|
2219
2219
|
* path made envelope repair run `watcher-main.js lanes _spawn-envelope-repair`,
|
|
@@ -2477,7 +2477,7 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2477
2477
|
const recordedModel = repairRecordedAccount && existing.model_source === "account"
|
|
2478
2478
|
? existing.model
|
|
2479
2479
|
: undefined;
|
|
2480
|
-
// `hq
|
|
2480
|
+
// `hq runners set` on a running lane leaves the change pending until this spawn.
|
|
2481
2481
|
const pendingSettings = existing.pending_settings;
|
|
2482
2482
|
let pinnedModel = pendingSettings?.model ?? (existing.profile_settings_pinned === true || existing.model_source === undefined || existing.model_source === "cli" || existing.model_source === "preserved"
|
|
2483
2483
|
? existing.model
|
|
@@ -3318,7 +3318,7 @@ export function spawnEnvelopeRepairRequest(hqRoot, rawRequest, deps = {}) {
|
|
|
3318
3318
|
* prompt. `fresh_turn`: grok gets a new single-turn invocation on the same
|
|
3319
3319
|
* account, whose prompt carries the schema, the parser error and the raw
|
|
3320
3320
|
* failed output. Grok can resume a session (operator messages and
|
|
3321
|
-
* `hq
|
|
3321
|
+
* `hq runners resume` use it), but its repair turn stays a fresh turn: that
|
|
3322
3322
|
* path was built and proven that way, and a repair by resume has not been.
|
|
3323
3323
|
*/
|
|
3324
3324
|
export function envelopeRepairMode(provider) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Company flag snapshots for every company with bound session work on this
|
|
3
|
+
* machine (rq_20261121230415_a549af8f50, informational 2).
|
|
4
|
+
*
|
|
5
|
+
* `work-mesh-company-reporting-required` is read from the company's local flag
|
|
6
|
+
* snapshot, which is trusted for 24 hours. A CLI process refreshes only the
|
|
7
|
+
* snapshot of its own company scope, and the desktop app and the mesh daemon
|
|
8
|
+
* usually run with none. A company whose sessions run under such a process,
|
|
9
|
+
* or whose member ran no company-scoped command for a day, then had no fresh
|
|
10
|
+
* snapshot, and its sessions fell back to the member's HQ Anywhere switch
|
|
11
|
+
* while the flag was meant to be on.
|
|
12
|
+
*
|
|
13
|
+
* The mesh daemon now keeps those snapshots fresh. On an interval it lists the
|
|
14
|
+
* companies of recent session records with a verified company binding, and
|
|
15
|
+
* for each one whose snapshot is missing or older than
|
|
16
|
+
* COMPANY_FLAG_REFRESH_AGE_MS it asks the flag registry in that company's
|
|
17
|
+
* context and writes the answer. The registry authenticates the member and
|
|
18
|
+
* decides the values: nothing here can turn a flag on that the registry did
|
|
19
|
+
* not return. A signed-out or failed read writes nothing, so the snapshot
|
|
20
|
+
* keeps the registry's last answer until it expires, as before.
|
|
21
|
+
*/
|
|
22
|
+
import { type FlagClientOptions, type FlagSnapshot } from "@indigoai-us/hq-flags-client";
|
|
23
|
+
/** How often the daemon looks for snapshots to refresh. */
|
|
24
|
+
export declare const COMPANY_FLAG_REFRESH_INTERVAL_MS: number;
|
|
25
|
+
/** A snapshot older than this is fetched again: well inside the 24-hour trust window. */
|
|
26
|
+
export declare const COMPANY_FLAG_REFRESH_AGE_MS: number;
|
|
27
|
+
/** Session records updated within this window name the companies to keep fresh. */
|
|
28
|
+
export declare const COMPANY_FLAG_REFRESH_SESSION_WINDOW_MS: number;
|
|
29
|
+
/** At most this many companies per refresh, and this many session records read. */
|
|
30
|
+
export declare const COMPANY_FLAG_REFRESH_MAX_COMPANIES = 20;
|
|
31
|
+
/** The flag client surface used here, so tests can supply one. */
|
|
32
|
+
export interface CompanyFlagClient {
|
|
33
|
+
ready(): Promise<unknown>;
|
|
34
|
+
snapshot(): FlagSnapshot | null;
|
|
35
|
+
close(): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The companies of recent verified session records whose flag snapshot is
|
|
39
|
+
* missing, unreadable or older than `refreshAgeMs`, newest session first.
|
|
40
|
+
*/
|
|
41
|
+
export declare function companiesNeedingFlagRefresh(workContextRoot: string, env: NodeJS.ProcessEnv, now?: () => Date, refreshAgeMs?: number): Array<{
|
|
42
|
+
uid: string;
|
|
43
|
+
slug?: string;
|
|
44
|
+
}>;
|
|
45
|
+
export interface RefreshCompanyFlagSnapshotsOptions {
|
|
46
|
+
workContextRoot: string;
|
|
47
|
+
env: NodeJS.ProcessEnv;
|
|
48
|
+
getToken: () => Promise<string>;
|
|
49
|
+
now?: () => Date;
|
|
50
|
+
createClient?: (options: FlagClientOptions) => CompanyFlagClient;
|
|
51
|
+
write?: (companyUid: string, flags: FlagSnapshot["flags"], options: {
|
|
52
|
+
env: NodeJS.ProcessEnv;
|
|
53
|
+
}) => unknown;
|
|
54
|
+
log?: (message: string) => void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Refresh the flag snapshot of every company that needs it. Never rejects.
|
|
58
|
+
* Returns the uids whose snapshot was written.
|
|
59
|
+
*/
|
|
60
|
+
export declare function refreshCompanyFlagSnapshots(options: RefreshCompanyFlagSnapshotsOptions): Promise<string[]>;
|
|
61
|
+
//# sourceMappingURL=company-flag-refresh.d.ts.map
|