@indigoai-us/hq-cli 5.345.219 → 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 +52 -0
- package/dist/command-catalog.generated.d.ts +25 -1
- package/dist/command-catalog.generated.js +31 -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.js +5 -4
- package/dist/commands/daemon.js +21 -2
- package/dist/commands/integrations.js +84 -3
- 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/run.js +55 -45
- package/dist/commands/sources.js +3 -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/run.js +5 -0
- package/dist/lib/daemon/runtime-notifications.d.ts +7 -0
- package/dist/lib/daemon/runtime-notifications.js +50 -0
- package/dist/lib/doctor/checks/fleet-hook-core.d.ts +9 -1
- package/dist/lib/doctor/checks/fleet-hook-core.js +39 -15
- package/dist/lib/hook-engine/fleet-registration.d.ts +17 -5
- package/dist/lib/hook-engine/fleet-registration.js +53 -17
- 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/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/host-registration.d.ts +1 -1
- package/dist/utils/host-registration.js +4 -0
- package/package.json +13 -9
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type StoredPriorSignal } from "../prior-signals.js";
|
|
2
2
|
import { type BotRuntimeId } from "../../bot/config.js";
|
|
3
|
-
import type { SignalsStep, SpawnSyncFn, StepContext, StepResult } from "./types.js";
|
|
3
|
+
import type { PriorStep, SignalsStep, SpawnSyncFn, StepContext, StepResult } from "./types.js";
|
|
4
4
|
export declare const EXTRACT_SIGNAL_TYPES: readonly ["action_item", "commitment", "decision", "risk", "question", "key_point", "participant_contribution", "summary"];
|
|
5
5
|
export declare const DEFAULT_WORKLIST_LIMIT = 20;
|
|
6
6
|
export declare const DEFAULT_TURN_TIMEOUT_MS: number;
|
|
@@ -75,8 +75,55 @@ export declare function defaultResolveBotRuntime(root?: string): BotRuntimeId |
|
|
|
75
75
|
* or null when it is not in that form.
|
|
76
76
|
*/
|
|
77
77
|
export declare function redoItemChannel(item: string): string | null;
|
|
78
|
-
/**
|
|
79
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The batch channel that holds meeting transcripts. The meetings hot channel
|
|
80
|
+
* (adapters/meetings.ts) reads the same folder in the adapters step and
|
|
81
|
+
* extracts each transcript the signed-in person attended as `meeting:<id>`.
|
|
82
|
+
*/
|
|
83
|
+
export declare const MEETINGS_BATCH_CHANNEL: string;
|
|
84
|
+
/** What the meetings hot channel covers when it runs (adapters/meetings.ts, MAX_CATCH_UP_WINDOW_MS). */
|
|
85
|
+
export declare const MEETINGS_HOT_CHANNEL_COVERAGE = "attended-last-30d";
|
|
86
|
+
/** A channel folder the step does not run, and why. */
|
|
87
|
+
export interface SkippedSourceChannel {
|
|
88
|
+
channel: string;
|
|
89
|
+
/**
|
|
90
|
+
* covered-by-hot-channel: the meetings folder has no source.yaml and the
|
|
91
|
+
* meetings hot channel ran ok in this run's adapters step. It extracts only
|
|
92
|
+
* the meetings the signed-in person attended, from the last 30 days.
|
|
93
|
+
* no-source-yaml: a folder with no source.yaml that nothing extracted this
|
|
94
|
+
* run (for meetings, `hotChannel` says why the hot channel did not run).
|
|
95
|
+
* source-yaml-invalid: run is neither local nor cloud.
|
|
96
|
+
* run-cloud: run: cloud without --force.
|
|
97
|
+
*/
|
|
98
|
+
reason: "covered-by-hot-channel" | "no-source-yaml" | "source-yaml-invalid" | "run-cloud";
|
|
99
|
+
error?: string;
|
|
100
|
+
/** Meetings only: `not-run:<why>` when the hot channel did not cover this run. */
|
|
101
|
+
hotChannel?: string;
|
|
102
|
+
/** With covered-by-hot-channel: what the hot channel takes. */
|
|
103
|
+
coverage?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Whether the meetings hot channel ran ok in this run, from the adapters step
|
|
107
|
+
* record: null when it did, else `not-run:<why>`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function meetingsHotChannelGap(priorSteps: readonly PriorStep[] | undefined): string | null;
|
|
110
|
+
export interface SourceChannelListing {
|
|
111
|
+
channels: SourceChannel[];
|
|
112
|
+
skipped: SkippedSourceChannel[];
|
|
113
|
+
/** Channels whose source.yaml exists but could not be read: a config failure, not a skip. */
|
|
114
|
+
unreadable: {
|
|
115
|
+
channel: string;
|
|
116
|
+
error: string;
|
|
117
|
+
}[];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Declared source channels with run: local (or any run: when forced), and the
|
|
121
|
+
* folders the step does not run with the reason for each. A folder with no
|
|
122
|
+
* source.yaml is never given one: for the meetings folder the hot channel is
|
|
123
|
+
* the extraction path, and the batch path would key the same transcript a
|
|
124
|
+
* second way (`meetings:<file>`).
|
|
125
|
+
*/
|
|
126
|
+
export declare function listSourceChannels(hqRoot: string, company: string, force?: boolean, priorSteps?: readonly PriorStep[]): SourceChannelListing;
|
|
80
127
|
/** Shell single-quote a value so a generated script carries it as data. */
|
|
81
128
|
export declare function shellQuote(value: string): string;
|
|
82
129
|
/**
|
|
@@ -111,6 +111,7 @@ import yaml from "js-yaml";
|
|
|
111
111
|
import { findPriorSignals, normalizeSignalTitle, priorSignalPath } from "../prior-signals.js";
|
|
112
112
|
import { splitFrontmatter } from "../../hot-channels/signals-pass.js";
|
|
113
113
|
import { audienceKey } from "../../hot-channels/audience.js";
|
|
114
|
+
import { MEETINGS_ADAPTER_ID, MEETINGS_TRANSCRIPT_DIR } from "../../hot-channels/adapters/meetings.js";
|
|
114
115
|
import { isBotRuntimeId } from "../../bot/config.js";
|
|
115
116
|
import { resolveExecutiveBot } from "../../bot/executive.js";
|
|
116
117
|
import { botsRoot } from "../../bot/paths.js";
|
|
@@ -217,25 +218,91 @@ export function redoItemChannel(item) {
|
|
|
217
218
|
const m = REDO_ITEM_RE.exec(item);
|
|
218
219
|
return m && !m[2].includes("\0") ? m[1] : null;
|
|
219
220
|
}
|
|
220
|
-
/**
|
|
221
|
-
|
|
221
|
+
/**
|
|
222
|
+
* The batch channel that holds meeting transcripts. The meetings hot channel
|
|
223
|
+
* (adapters/meetings.ts) reads the same folder in the adapters step and
|
|
224
|
+
* extracts each transcript the signed-in person attended as `meeting:<id>`.
|
|
225
|
+
*/
|
|
226
|
+
export const MEETINGS_BATCH_CHANNEL = path.posix.basename(MEETINGS_TRANSCRIPT_DIR);
|
|
227
|
+
/** What the meetings hot channel covers when it runs (adapters/meetings.ts, MAX_CATCH_UP_WINDOW_MS). */
|
|
228
|
+
export const MEETINGS_HOT_CHANNEL_COVERAGE = "attended-last-30d";
|
|
229
|
+
/**
|
|
230
|
+
* Whether the meetings hot channel ran ok in this run, from the adapters step
|
|
231
|
+
* record: null when it did, else `not-run:<why>`.
|
|
232
|
+
*/
|
|
233
|
+
export function meetingsHotChannelGap(priorSteps) {
|
|
234
|
+
const adapters = [...(priorSteps ?? [])].reverse().find((s) => s.name === "adapters");
|
|
235
|
+
if (!adapters)
|
|
236
|
+
return "not-run:adapters-step-not-in-plan";
|
|
237
|
+
const skip = adapters.adapterSkips?.[MEETINGS_ADAPTER_ID];
|
|
238
|
+
if (skip)
|
|
239
|
+
return `not-run:${skip}`;
|
|
240
|
+
if (adapters.status === "skipped")
|
|
241
|
+
return `not-run:${adapters.skippedReason ?? "adapters-skipped"}`;
|
|
242
|
+
const outcome = adapters.adapterOutcomes?.[MEETINGS_ADAPTER_ID];
|
|
243
|
+
if (outcome === "ok")
|
|
244
|
+
return null;
|
|
245
|
+
if (outcome !== undefined)
|
|
246
|
+
return `not-run:meetings-${outcome}`;
|
|
247
|
+
if (adapters.status === "failed")
|
|
248
|
+
return "not-run:adapters-failed";
|
|
249
|
+
return "not-run:meetings-not-in-sync";
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Declared source channels with run: local (or any run: when forced), and the
|
|
253
|
+
* folders the step does not run with the reason for each. A folder with no
|
|
254
|
+
* source.yaml is never given one: for the meetings folder the hot channel is
|
|
255
|
+
* the extraction path, and the batch path would key the same transcript a
|
|
256
|
+
* second way (`meetings:<file>`).
|
|
257
|
+
*/
|
|
258
|
+
export function listSourceChannels(hqRoot, company, force = false, priorSteps) {
|
|
222
259
|
const dir = path.join(hqRoot, "companies", company, "sources");
|
|
260
|
+
const listing = { channels: [], skipped: [], unreadable: [] };
|
|
223
261
|
if (!fs.existsSync(dir))
|
|
224
|
-
return
|
|
225
|
-
const out = [];
|
|
262
|
+
return listing;
|
|
226
263
|
for (const e of fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
227
264
|
if (!e.isDirectory())
|
|
228
265
|
continue;
|
|
229
266
|
const y = path.join(dir, e.name, "source.yaml");
|
|
230
|
-
|
|
267
|
+
const missing = () => {
|
|
268
|
+
if (e.name !== MEETINGS_BATCH_CHANNEL) {
|
|
269
|
+
listing.skipped.push({ channel: e.name, reason: "no-source-yaml" });
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const gap = meetingsHotChannelGap(priorSteps);
|
|
273
|
+
listing.skipped.push(gap === null
|
|
274
|
+
? { channel: e.name, reason: "covered-by-hot-channel", coverage: MEETINGS_HOT_CHANNEL_COVERAGE }
|
|
275
|
+
: { channel: e.name, reason: "no-source-yaml", hotChannel: gap });
|
|
276
|
+
};
|
|
277
|
+
if (!fs.existsSync(y)) {
|
|
278
|
+
missing();
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
let text;
|
|
282
|
+
try {
|
|
283
|
+
text = fs.readFileSync(y, "utf8");
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
// Removed between the check and the read: the same as no file.
|
|
287
|
+
if (err.code === "ENOENT") {
|
|
288
|
+
missing();
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
listing.unreadable.push({ channel: e.name, error: err.message.slice(0, 200) });
|
|
231
292
|
continue;
|
|
232
|
-
|
|
293
|
+
}
|
|
294
|
+
const run = yamlField(text, "run");
|
|
233
295
|
if (run === "local")
|
|
234
|
-
|
|
296
|
+
listing.channels.push({ channel: e.name, force: false });
|
|
297
|
+
// As before: a forced run hands every other channel to the worklist, which validates it.
|
|
235
298
|
else if (force)
|
|
236
|
-
|
|
299
|
+
listing.channels.push({ channel: e.name, force: true });
|
|
300
|
+
else if (run === "cloud")
|
|
301
|
+
listing.skipped.push({ channel: e.name, reason: "run-cloud" });
|
|
302
|
+
else
|
|
303
|
+
listing.skipped.push({ channel: e.name, reason: "source-yaml-invalid", error: `run must be local or cloud (got '${run || "<missing>"}')` });
|
|
237
304
|
}
|
|
238
|
-
return
|
|
305
|
+
return listing;
|
|
239
306
|
}
|
|
240
307
|
/** Shell single-quote a value so a generated script carries it as data. */
|
|
241
308
|
export function shellQuote(value) {
|
|
@@ -1218,11 +1285,22 @@ export function createExtractStep(options = {}) {
|
|
|
1218
1285
|
return extractPartialDocument(ctx, options.documentOverride, options.priorSignals ?? []);
|
|
1219
1286
|
}
|
|
1220
1287
|
const empty = { modelTurns: 0, estimatedSpendUsd: 0 };
|
|
1221
|
-
const
|
|
1288
|
+
const listing = listSourceChannels(ctx.hqRoot, ctx.company, options.force === true, ctx.priorSteps);
|
|
1289
|
+
const channels = listing.channels;
|
|
1290
|
+
// Folders this step does not run, with the reason for each, kept in the run record.
|
|
1291
|
+
const listingDetail = listing.skipped.length ? { skippedChannels: listing.skipped } : {};
|
|
1292
|
+
// A source.yaml that exists but cannot be read is a config failure the alert can see.
|
|
1293
|
+
const unreadable = listing.unreadable.map((u) => ({
|
|
1294
|
+
file: `sources/${u.channel}/source.yaml`,
|
|
1295
|
+
error: `source.yaml could not be read: ${u.error}`,
|
|
1296
|
+
}));
|
|
1222
1297
|
// A --redo item whose channel this step does not run cannot be re-queued here.
|
|
1223
1298
|
const unrunRedo = (ctx.redo ?? []).filter((f) => !channels.some((c) => c.channel === redoItemChannel(f)));
|
|
1224
1299
|
if (channels.length === 0 && unrunRedo.length === 0) {
|
|
1225
|
-
|
|
1300
|
+
if (unreadable.length > 0) {
|
|
1301
|
+
return { status: "failed", itemsIn: 0, itemsOut: 0, error: unreadable[0].error, errorKind: "config", failures: unreadable, ...empty, detail: { ...listingDetail } };
|
|
1302
|
+
}
|
|
1303
|
+
return { status: "skipped", itemsIn: 0, itemsOut: 0, skippedReason: "no-sources", ...empty, ...(listing.skipped.length ? { detail: { ...listingDetail } } : {}) };
|
|
1226
1304
|
}
|
|
1227
1305
|
const turnOpts = {
|
|
1228
1306
|
claudeBin: options.claudeBin ?? "claude",
|
|
@@ -1281,11 +1359,16 @@ export function createExtractStep(options = {}) {
|
|
|
1281
1359
|
let uncitedCandidates = 0;
|
|
1282
1360
|
const uncitedSources = [];
|
|
1283
1361
|
let errorKind;
|
|
1284
|
-
const failures =
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1362
|
+
const failures = [
|
|
1363
|
+
...unreadable,
|
|
1364
|
+
...unrunRedo.map((file) => ({
|
|
1365
|
+
file,
|
|
1366
|
+
error: "redo: not a source channel this run processes (needs a source.yaml with run: local, or --force for run: cloud)",
|
|
1367
|
+
})),
|
|
1368
|
+
];
|
|
1369
|
+
if (unreadable.length > 0)
|
|
1370
|
+
errorKind = "config";
|
|
1371
|
+
else if (unrunRedo.length > 0)
|
|
1289
1372
|
errorKind = "other";
|
|
1290
1373
|
const skippedItems = [];
|
|
1291
1374
|
const sourcesReal = fs.realpathSync(path.join(ctx.hqRoot, "companies", ctx.company, "sources"));
|
|
@@ -1499,7 +1582,7 @@ export function createExtractStep(options = {}) {
|
|
|
1499
1582
|
...(failures.length ? { failures } : {}),
|
|
1500
1583
|
...(skippedItems.length ? { skippedItems } : {}),
|
|
1501
1584
|
...(rejected ? { rejectedCandidates: rejected } : {}),
|
|
1502
|
-
detail: { new: itemsOut, updated, skipped, runtime, ...(choice.fallback ? { fallback: choice.fallback } : {}), ...(budgetStoppedAt ? { budgetStoppedAt } : {}), ...(uncitedCandidates ? { uncitedCandidates, uncitedSources } : {}) },
|
|
1585
|
+
detail: { new: itemsOut, updated, skipped, runtime, ...(choice.fallback ? { fallback: choice.fallback } : {}), ...(budgetStoppedAt ? { budgetStoppedAt } : {}), ...(uncitedCandidates ? { uncitedCandidates, uncitedSources } : {}), ...listingDetail },
|
|
1503
1586
|
};
|
|
1504
1587
|
if (budgetStop) {
|
|
1505
1588
|
result.status = "partial";
|
|
@@ -62,6 +62,19 @@ export interface StepContext {
|
|
|
62
62
|
* with the worklist's `--redo` before it lists that channel.
|
|
63
63
|
*/
|
|
64
64
|
redo?: readonly string[];
|
|
65
|
+
/**
|
|
66
|
+
* The steps this run already finished, in order. Extract reads the adapters
|
|
67
|
+
* step to tell whether the meetings hot channel ran.
|
|
68
|
+
*/
|
|
69
|
+
priorSteps?: readonly PriorStep[];
|
|
70
|
+
}
|
|
71
|
+
/** What a later step may read of an earlier step in the same run. */
|
|
72
|
+
export interface PriorStep {
|
|
73
|
+
name: StepName;
|
|
74
|
+
status: StepStatus;
|
|
75
|
+
skippedReason?: string;
|
|
76
|
+
adapterSkips?: Record<string, string>;
|
|
77
|
+
adapterOutcomes?: Record<string, string>;
|
|
65
78
|
}
|
|
66
79
|
export interface StepResult {
|
|
67
80
|
status: StepStatus;
|
|
@@ -78,6 +91,12 @@ export interface StepResult {
|
|
|
78
91
|
tokenLevels?: Record<string, string>;
|
|
79
92
|
/** Adapter id -> reason it did not run (`flag-off`). */
|
|
80
93
|
adapterSkips?: Record<string, string>;
|
|
94
|
+
/**
|
|
95
|
+
* Adapter id -> how its sync ended this run (`ok`, `failed`, `unavailable`,
|
|
96
|
+
* `no-connection`, `gated`). An adapter with several connections is `failed`
|
|
97
|
+
* when any failed, else `ok` when any was ok.
|
|
98
|
+
*/
|
|
99
|
+
adapterOutcomes?: Record<string, string>;
|
|
81
100
|
uploaded?: {
|
|
82
101
|
count: number;
|
|
83
102
|
bytes: number;
|
|
@@ -14,10 +14,13 @@ export interface SyncCoreVaultPlan extends SyncCoreVault {
|
|
|
14
14
|
blockedReason?: string;
|
|
15
15
|
}
|
|
16
16
|
export declare const SYNC_CORE_REQUESTS_PER_DAY = 20000;
|
|
17
|
+
export declare const SYNC_CORE_REQUEST_COUNT_REMOVED_IN = "v0.1.29";
|
|
17
18
|
export declare function syncCoreEngineHome(home: string, vaultUid: string): string;
|
|
18
19
|
export declare function syncCoreUnitId(vaultUid: string): string;
|
|
19
20
|
export declare function isSyncCoreVaultUid(value: unknown): value is string;
|
|
20
|
-
export declare function engineConfigToml(vault: SyncCoreVault, hqRoot: string, phase: SyncCoreVaultPhase, tokenPath?: string
|
|
21
|
+
export declare function engineConfigToml(vault: SyncCoreVault, hqRoot: string, phase: SyncCoreVaultPhase, tokenPath?: string,
|
|
22
|
+
/** The engine release this vault runs. Not given: treated as an engine that still counts requests. */
|
|
23
|
+
release?: string): string;
|
|
21
24
|
export interface WriteEngineHomeOptions {
|
|
22
25
|
home: string;
|
|
23
26
|
hqRoot: string;
|
|
@@ -25,6 +28,8 @@ export interface WriteEngineHomeOptions {
|
|
|
25
28
|
phase: SyncCoreVaultPhase;
|
|
26
29
|
tokenFile: string;
|
|
27
30
|
platform?: NodeJS.Platform;
|
|
31
|
+
/** The engine release this vault runs; decides whether the config carries `requests_per_day`. */
|
|
32
|
+
release?: string;
|
|
28
33
|
}
|
|
29
34
|
export declare function writeEngineHome(opts: WriteEngineHomeOptions): {
|
|
30
35
|
engineHome: string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { parse as parseToml } from "smol-toml";
|
|
4
|
+
import { compareSyncCoreReleases } from "./release-compare.js";
|
|
4
5
|
export const SYNC_CORE_REQUESTS_PER_DAY = 20_000;
|
|
6
|
+
// The first engine release with no daily request count; it ignores `requests_per_day`.
|
|
7
|
+
export const SYNC_CORE_REQUEST_COUNT_REMOVED_IN = "v0.1.29";
|
|
5
8
|
export function syncCoreEngineHome(home, vaultUid) {
|
|
6
9
|
return path.join(home, ".hq", "sync-core", "engines", vaultUid);
|
|
7
10
|
}
|
|
@@ -11,7 +14,14 @@ export function syncCoreUnitId(vaultUid) {
|
|
|
11
14
|
export function isSyncCoreVaultUid(value) {
|
|
12
15
|
return typeof value === "string" && /^(prs|cmp)_[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value);
|
|
13
16
|
}
|
|
14
|
-
export function engineConfigToml(vault, hqRoot, phase, tokenPath
|
|
17
|
+
export function engineConfigToml(vault, hqRoot, phase, tokenPath,
|
|
18
|
+
/** The engine release this vault runs. Not given: treated as an engine that still counts requests. */
|
|
19
|
+
release) {
|
|
20
|
+
// Engines before the removal fall back to 10,000 a day when the line is missing.
|
|
21
|
+
// A release that is not a plain vX.Y.Z (a pre-release, a mislabelled marker) keeps the line too.
|
|
22
|
+
const countsRequests = release === undefined ||
|
|
23
|
+
!/^v?\d+\.\d+\.\d+$/.test(release) ||
|
|
24
|
+
compareSyncCoreReleases(release, SYNC_CORE_REQUEST_COUNT_REMOVED_IN) < 0;
|
|
15
25
|
const lines = [
|
|
16
26
|
"[sync]",
|
|
17
27
|
'engine = "rust-test"',
|
|
@@ -19,7 +29,7 @@ export function engineConfigToml(vault, hqRoot, phase, tokenPath) {
|
|
|
19
29
|
...(phase === "full" ? ["full_vault = true"] : []),
|
|
20
30
|
`vaults = [${JSON.stringify(vault.uid)}]`,
|
|
21
31
|
`hq_root = ${JSON.stringify(hqRoot)}`,
|
|
22
|
-
`requests_per_day = ${SYNC_CORE_REQUESTS_PER_DAY}
|
|
32
|
+
...(countsRequests ? [`requests_per_day = ${SYNC_CORE_REQUESTS_PER_DAY}`] : []),
|
|
23
33
|
...(tokenPath ? [`token_path = ${JSON.stringify(tokenPath)}`] : []),
|
|
24
34
|
];
|
|
25
35
|
if (vault.kind === "company") {
|
|
@@ -70,7 +80,7 @@ export function writeEngineHome(opts) {
|
|
|
70
80
|
replaceSymlink(path.join(hq, "work-mesh"), path.join(opts.home, ".hq", "work-mesh"));
|
|
71
81
|
replaceSymlink(path.join(hq, "cognito-tokens.json"), opts.tokenFile);
|
|
72
82
|
}
|
|
73
|
-
const configChanged = writeIfChanged(path.join(root, "config.toml"), engineConfigToml(opts.vault, opts.hqRoot, opts.phase, windows ? opts.tokenFile : undefined));
|
|
83
|
+
const configChanged = writeIfChanged(path.join(root, "config.toml"), engineConfigToml(opts.vault, opts.hqRoot, opts.phase, windows ? opts.tokenFile : undefined, opts.release));
|
|
74
84
|
const ownedPath = path.join(root, "owned", `${opts.vault.uid}.json`);
|
|
75
85
|
let ownedChanged = false;
|
|
76
86
|
if (opts.phase === "full") {
|
|
@@ -179,7 +179,7 @@ export async function reconcileSyncCore(deps) {
|
|
|
179
179
|
const engineHome = syncCoreEngineHome(deps.home, vault.uid);
|
|
180
180
|
if (!before)
|
|
181
181
|
clearEngineStatus(deps.home, vault.uid);
|
|
182
|
-
writeEngineHome({ home: deps.home, hqRoot: deps.hqRoot, vault, phase: "full", tokenFile: deps.tokenFile, platform });
|
|
182
|
+
writeEngineHome({ home: deps.home, hqRoot: deps.hqRoot, vault, phase: "full", tokenFile: deps.tokenFile, platform, release: engineRelease });
|
|
183
183
|
const wasFull = before?.phase === "full";
|
|
184
184
|
const alreadyOff = vault.kind === "personal"
|
|
185
185
|
? switchesBefore.personalOff
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two engine releases ("v0.1.28", "0.1.29"). Negative when `a` is older.
|
|
3
|
+
* Kept apart from release.ts, which downloads, so callers that only compare
|
|
4
|
+
* versions do not pull networking into their import closure.
|
|
5
|
+
*/
|
|
6
|
+
export declare function compareSyncCoreReleases(a: string, b: string): number;
|
|
7
|
+
//# sourceMappingURL=release-compare.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two engine releases ("v0.1.28", "0.1.29"). Negative when `a` is older.
|
|
3
|
+
* Kept apart from release.ts, which downloads, so callers that only compare
|
|
4
|
+
* versions do not pull networking into their import closure.
|
|
5
|
+
*/
|
|
6
|
+
export function compareSyncCoreReleases(a, b) {
|
|
7
|
+
const parse = (release) => release.replace(/^v/, "").split(".").map((part) => Number.parseInt(part, 10) || 0);
|
|
8
|
+
const [x, y] = [parse(a), parse(b)];
|
|
9
|
+
for (let i = 0; i < Math.max(x.length, y.length); i += 1) {
|
|
10
|
+
const diff = (x[i] ?? 0) - (y[i] ?? 0);
|
|
11
|
+
if (diff !== 0)
|
|
12
|
+
return diff;
|
|
13
|
+
}
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=release-compare.js.map
|
|
@@ -7,7 +7,8 @@ export declare const SYNC_CORE_FULL_RELEASE: string | null;
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const SYNC_CORE_WINDOWS_FULL_RELEASE: string | null;
|
|
9
9
|
export declare const SYNC_CORE_WINDOWS_FULL_RELEASE_ENV = "HQ_SYNC_CORE_WINDOWS_FULL_RELEASE";
|
|
10
|
-
|
|
10
|
+
import { compareSyncCoreReleases } from "./release-compare.js";
|
|
11
|
+
export { compareSyncCoreReleases };
|
|
11
12
|
export declare function windowsFullRelease(env?: NodeJS.ProcessEnv): string | null;
|
|
12
13
|
export declare function fullModeAllowed(release: string, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
|
|
13
14
|
export declare const SYNC_CORE_DOWNLOAD_BASE = "https://indigoai-public.s3.amazonaws.com/hq-sync-core";
|
|
@@ -12,16 +12,8 @@ export const SYNC_CORE_FULL_RELEASE = "v0.1.23";
|
|
|
12
12
|
*/
|
|
13
13
|
export const SYNC_CORE_WINDOWS_FULL_RELEASE = null;
|
|
14
14
|
export const SYNC_CORE_WINDOWS_FULL_RELEASE_ENV = "HQ_SYNC_CORE_WINDOWS_FULL_RELEASE";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const [x, y] = [parse(a), parse(b)];
|
|
18
|
-
for (let i = 0; i < Math.max(x.length, y.length); i += 1) {
|
|
19
|
-
const diff = (x[i] ?? 0) - (y[i] ?? 0);
|
|
20
|
-
if (diff !== 0)
|
|
21
|
-
return diff;
|
|
22
|
-
}
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
15
|
+
import { compareSyncCoreReleases } from "./release-compare.js";
|
|
16
|
+
export { compareSyncCoreReleases };
|
|
25
17
|
export function windowsFullRelease(env = process.env) {
|
|
26
18
|
const override = env[SYNC_CORE_WINDOWS_FULL_RELEASE_ENV]?.trim();
|
|
27
19
|
return override && /^v?\d+\.\d+\.\d+$/.test(override) ? override : SYNC_CORE_WINDOWS_FULL_RELEASE;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq run` must not let inherited process.env values replace .env.schema
|
|
3
|
+
* (feedback_d5698e57). Varlock treats process.env as overrides: an item whose
|
|
4
|
+
* key is already in the environment is marked overridden and the hq() resolver
|
|
5
|
+
* is never called. `hq secrets exec` injects last, so the vault value wins.
|
|
6
|
+
* These helpers make `hq run` match that: schema and .env.local files win,
|
|
7
|
+
* inherited env does not.
|
|
8
|
+
*/
|
|
9
|
+
/** Env keys declared in schema / .env.local files (KEY=... lines). */
|
|
10
|
+
export declare function schemaDeclaredKeys(paths: string[]): string[];
|
|
11
|
+
export interface EnvOverrideGraph {
|
|
12
|
+
overrideValues?: Record<string, string | undefined>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Drop inherited process.env overrides for schema-declared keys so varlock
|
|
16
|
+
* resolves the file (and hq()) instead of the caller's shell.
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearInheritedSchemaOverrides(graph: EnvOverrideGraph, keys: string[]): void;
|
|
19
|
+
/**
|
|
20
|
+
* Run `fn` with schema-declared keys removed from process.env, then restore.
|
|
21
|
+
* Covers a varlock that re-reads process.env at load/resolve time.
|
|
22
|
+
*/
|
|
23
|
+
export declare function withoutInheritedSchemaEnv<T>(keys: string[], fn: () => Promise<T>): Promise<T>;
|
|
24
|
+
//# sourceMappingURL=schema-env-overrides.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq run` must not let inherited process.env values replace .env.schema
|
|
3
|
+
* (feedback_d5698e57). Varlock treats process.env as overrides: an item whose
|
|
4
|
+
* key is already in the environment is marked overridden and the hq() resolver
|
|
5
|
+
* is never called. `hq secrets exec` injects last, so the vault value wins.
|
|
6
|
+
* These helpers make `hq run` match that: schema and .env.local files win,
|
|
7
|
+
* inherited env does not.
|
|
8
|
+
*/
|
|
9
|
+
import * as fs from "node:fs";
|
|
10
|
+
const KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
11
|
+
/** Env keys declared in schema / .env.local files (KEY=... lines). */
|
|
12
|
+
export function schemaDeclaredKeys(paths) {
|
|
13
|
+
const keys = new Set();
|
|
14
|
+
for (const file of paths) {
|
|
15
|
+
let text;
|
|
16
|
+
try {
|
|
17
|
+
text = fs.readFileSync(file, "utf8");
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
23
|
+
const line = raw.trim();
|
|
24
|
+
if (line === "" || line.startsWith("#"))
|
|
25
|
+
continue;
|
|
26
|
+
const eq = line.indexOf("=");
|
|
27
|
+
if (eq < 1)
|
|
28
|
+
continue;
|
|
29
|
+
const key = line.slice(0, eq).trim();
|
|
30
|
+
if (KEY.test(key))
|
|
31
|
+
keys.add(key);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [...keys];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Drop inherited process.env overrides for schema-declared keys so varlock
|
|
38
|
+
* resolves the file (and hq()) instead of the caller's shell.
|
|
39
|
+
*/
|
|
40
|
+
export function clearInheritedSchemaOverrides(graph, keys) {
|
|
41
|
+
const ov = graph.overrideValues;
|
|
42
|
+
if (!ov)
|
|
43
|
+
return;
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
delete ov[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Run `fn` with schema-declared keys removed from process.env, then restore.
|
|
50
|
+
* Covers a varlock that re-reads process.env at load/resolve time.
|
|
51
|
+
*/
|
|
52
|
+
export async function withoutInheritedSchemaEnv(keys, fn) {
|
|
53
|
+
const saved = [];
|
|
54
|
+
for (const key of keys) {
|
|
55
|
+
if (!Object.prototype.hasOwnProperty.call(process.env, key))
|
|
56
|
+
continue;
|
|
57
|
+
saved.push([key, process.env[key]]);
|
|
58
|
+
delete process.env[key];
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return await fn();
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
for (const [key, value] of saved) {
|
|
65
|
+
if (value === undefined)
|
|
66
|
+
delete process.env[key];
|
|
67
|
+
else
|
|
68
|
+
process.env[key] = value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=schema-env-overrides.js.map
|
|
@@ -4,7 +4,7 @@ export { CORE_NEXT_FLAG, coreNextEnabled } from './core-next-flag.js';
|
|
|
4
4
|
export { coreNextKillReason, CORE_NEXT_KILL_ENV, CORE_NEXT_KILL_FILE, ENGINE_KILL_ENV, ENGINE_KILL_FILE } from './core-next-kill.js';
|
|
5
5
|
/** Name of the release-stable link next to the pinned engine versions. */
|
|
6
6
|
export declare const STABLE_LINK_NAME = "stable";
|
|
7
|
-
export type CoreNextHost = 'claude' | 'codex' | 'grok' | 'fleet-local';
|
|
7
|
+
export type CoreNextHost = 'claude' | 'codex' | 'grok' | 'fleet-local' | 'agents-v2';
|
|
8
8
|
/**
|
|
9
9
|
* `project`: the HQ root's own registration, always answers.
|
|
10
10
|
* `global`: the user-scope Claude Code entry; answers nothing inside an HQ
|
|
@@ -338,6 +338,10 @@ function hostCanaryGate(home, env, version, platform, warn) {
|
|
|
338
338
|
return (root, host) => {
|
|
339
339
|
if (host === 'fleet-local')
|
|
340
340
|
return true;
|
|
341
|
+
// agents-v2 is planned by `hq core hook-registration-plan`, which gates on
|
|
342
|
+
// coverage and never asks this gate; any other caller keeps the shell plan.
|
|
343
|
+
if (host === 'agents-v2')
|
|
344
|
+
return false;
|
|
341
345
|
const gate = checkHostCanary({ home, root, host, engineVersion: version, env, platform });
|
|
342
346
|
if (gate.skipped) {
|
|
343
347
|
warnOnce(`hq: warning: ${SKIP_CANARY_GATE_ENV} is set: bypassing the host canary gate and switching ${host} hook events to the new core (hq-hook ${version}) without a passing host canary (${gate.reason})`, warn);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.345.
|
|
3
|
+
"version": "5.345.220",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"!dist/**/*.map",
|
|
13
|
+
"!dist/**/__fixtures__",
|
|
14
|
+
"!dist/**/__testing__",
|
|
15
|
+
"!dist/**/*.test-d.*",
|
|
16
|
+
"!dist/lib/test-utils",
|
|
17
|
+
"!dist/lib/decisions/fixtures",
|
|
18
|
+
"!dist/lib/fingerprint/fixtures.*",
|
|
13
19
|
"assets/scaffold",
|
|
14
20
|
"assets/bot-workers",
|
|
15
21
|
"assets/mesh-daemon",
|
|
@@ -21,9 +27,7 @@
|
|
|
21
27
|
"CHANGELOG.md",
|
|
22
28
|
"README.md",
|
|
23
29
|
"contracts",
|
|
24
|
-
"scripts/mesh-daemon-if-stale.mjs",
|
|
25
30
|
"scripts/install-hook-engine.mjs",
|
|
26
|
-
"scripts/hook-engine-manifest.mjs",
|
|
27
31
|
"scripts/check-function-manifest.mjs",
|
|
28
32
|
"scripts/bench-core.mjs"
|
|
29
33
|
],
|
|
@@ -119,11 +123,11 @@
|
|
|
119
123
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
120
124
|
},
|
|
121
125
|
"optionalDependencies": {
|
|
122
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
123
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
124
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
125
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
126
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
127
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
126
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.220",
|
|
127
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.220",
|
|
128
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.220",
|
|
129
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.220",
|
|
130
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.220",
|
|
131
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.220"
|
|
128
132
|
}
|
|
129
133
|
}
|
|
@@ -456,10 +456,11 @@ function refExcluded(file) {
|
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
/** Lines in the tree that name a retiring or removed function. */
|
|
459
|
-
export function findReferences(targets, root, { allFiles } = {}) {
|
|
459
|
+
export function findReferences(targets, root, { allFiles, manifest } = {}) {
|
|
460
460
|
const problems = [];
|
|
461
461
|
if (!targets.length) return { problems, files: 0 };
|
|
462
|
-
const files = (allFiles || listFiles(root, ["."])).filter((f) => !refExcluded(f)
|
|
462
|
+
const files = (allFiles || listFiles(root, ["."])).filter((f) => !refExcluded(f)
|
|
463
|
+
&& (!manifest || path.resolve(root, f) !== path.resolve(manifest)));
|
|
463
464
|
let scanned = 0;
|
|
464
465
|
for (const file of files) {
|
|
465
466
|
let stat;
|
|
@@ -628,14 +629,14 @@ export async function run(argv) {
|
|
|
628
629
|
if (opt.coreRoot) {
|
|
629
630
|
const tree = checkCoreTree(entries, opt.coreRoot);
|
|
630
631
|
problems.push(...tree.problems);
|
|
631
|
-
const refs = findReferences(targets, opt.coreRoot);
|
|
632
|
+
const refs = findReferences(targets, opt.coreRoot, { manifest: opt.manifest });
|
|
632
633
|
problems.push(...refs.problems);
|
|
633
634
|
checked.push(`core tree ${opt.coreRoot}: ${tree.files} hook and script files; references searched in ${refs.files} files`);
|
|
634
635
|
} else notices.push("no --core-root: hooks and scripts on disk were not compared with the manifest");
|
|
635
636
|
if (opt.cliRoot) {
|
|
636
637
|
const tree = checkCliTree(entries, opt.cliRoot, catalog);
|
|
637
638
|
problems.push(...tree.problems);
|
|
638
|
-
const refs = findReferences(targets, opt.cliRoot);
|
|
639
|
+
const refs = findReferences(targets, opt.cliRoot, { manifest: opt.manifest });
|
|
639
640
|
problems.push(...refs.problems);
|
|
640
641
|
checked.push(`hq-cli source ${opt.cliRoot}: ${tree.commands} commands, ${tree.daemonFiles} daemon files; references searched in ${refs.files} files`);
|
|
641
642
|
} else if (opt.cliPackage) {
|