@indigoai-us/hq-cli 5.345.205 → 5.345.207
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 +39 -0
- package/assets/scaffold/core/scripts/checkpoint-stop-gate.sh +111 -15
- package/dist/command-catalog.generated.d.ts +14 -2
- package/dist/command-catalog.generated.js +17 -2
- package/dist/commands/bot.d.ts +6 -0
- package/dist/commands/bot.js +88 -12
- package/dist/commands/core-checkpoint-stop-gate-native.js +130 -25
- package/dist/commands/files.d.ts +36 -0
- package/dist/commands/files.js +80 -1
- package/dist/commands/lanes-shared.d.ts +13 -0
- package/dist/commands/lanes.d.ts +2 -0
- package/dist/commands/lanes.js +44 -4
- package/dist/commands/sources.js +1 -1
- package/dist/commands/storage-offload.d.ts +8 -1
- package/dist/commands/storage-offload.js +6 -1
- package/dist/commands/storage.js +4 -0
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +260 -250
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/bot/fleet-cron.js +4 -1
- package/dist/lib/bot/fleet-local.js +9 -9
- package/dist/lib/bot/fleet-owner-companies.d.ts +7 -0
- package/dist/lib/bot/fleet-owner-companies.js +16 -4
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +2 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +18 -1
- package/dist/lib/bot/jobs/meeting-detect.d.ts +41 -2
- package/dist/lib/bot/jobs/meeting-detect.js +280 -16
- package/dist/lib/bot/run.d.ts +1 -0
- package/dist/lib/bot/run.js +4 -2
- package/dist/lib/bot/runtime-failure.js +4 -2
- package/dist/lib/capacity/collect.d.ts +7 -0
- package/dist/lib/capacity/collect.js +22 -16
- package/dist/lib/capacity/route.d.ts +23 -0
- package/dist/lib/capacity/route.js +41 -2
- package/dist/lib/company-skill-wrapper.js +33 -4
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/hot-channels/alert.d.ts +4 -1
- package/dist/lib/hot-channels/alert.js +10 -4
- package/dist/lib/hot-channels/ledger.d.ts +4 -4
- package/dist/lib/hot-channels/ledger.js +2 -0
- package/dist/lib/hot-channels/run.d.ts +6 -0
- package/dist/lib/hot-channels/run.js +7 -2
- package/dist/lib/hot-channels/signals-pass.d.ts +11 -2
- package/dist/lib/hot-channels/signals-pass.js +129 -15
- package/dist/lib/lanes/links.d.ts +2 -0
- package/dist/lib/lanes/links.js +12 -1
- package/dist/lib/live-meetings.js +1 -1
- package/dist/lib/sync-core/release.d.ts +1 -1
- package/dist/lib/sync-core/release.js +1 -1
- package/dist/utils/redact-error-text.js +1 -0
- package/dist/utils/resident-package-preload.js +32 -4
- package/package.json +8 -8
|
@@ -34,22 +34,28 @@ export async function collectCapacityOnce(options = {}) {
|
|
|
34
34
|
const claude = accounts.filter((account) => account.provider === "claude");
|
|
35
35
|
const codex = accounts.filter((account) => account.provider === "codex");
|
|
36
36
|
const grok = accounts.filter((account) => account.provider === "grok");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
const reads = (provider) => !options.providers || options.providers.includes(provider);
|
|
38
|
+
if (reads("claude")) {
|
|
39
|
+
await collectClaudeOAuth({
|
|
40
|
+
ledger,
|
|
41
|
+
now: options.now,
|
|
42
|
+
allowDisabled: true,
|
|
43
|
+
accounts: claude.map((account) => ({ label: account.label, home: account.home })),
|
|
44
|
+
...options.claude,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (reads("codex"))
|
|
48
|
+
await collectCodexHomes(codex, ledger, options);
|
|
49
|
+
if (reads("grok")) {
|
|
50
|
+
await collectGrok({
|
|
51
|
+
ledger,
|
|
52
|
+
now: options.now,
|
|
53
|
+
allowDisabled: true,
|
|
54
|
+
accounts: grok.map((account) => ({ label: account.label, home: account.home })),
|
|
55
|
+
...options.grok,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (options.includeSpool !== false && reads("claude")) {
|
|
53
59
|
consumeClaudeStatuslineSpool({
|
|
54
60
|
root,
|
|
55
61
|
now: options.now ? options.now() : new Date(),
|
|
@@ -145,6 +145,29 @@ export interface PickAccountInput {
|
|
|
145
145
|
*/
|
|
146
146
|
allowExtraUsage?: boolean;
|
|
147
147
|
}
|
|
148
|
+
/** Skip reason for an account whose newest reading is older than STALE_SKIP_MS. */
|
|
149
|
+
export declare const SKIP_STALE_READING = "no reading in the last 24 hours";
|
|
150
|
+
/** Skip reason for a signed-in account the ledger has no reading for yet. */
|
|
151
|
+
export declare const SKIP_NO_READING = "no usage reading for this account yet";
|
|
152
|
+
/**
|
|
153
|
+
* True when a refusal skipped at least one account only because its reading
|
|
154
|
+
* is missing or old, so a fresh capacity read could change the outcome
|
|
155
|
+
* (feedback_94446741). Signed-out, usage-only and used-up accounts are not
|
|
156
|
+
* counted: a new reading does not give them room.
|
|
157
|
+
*/
|
|
158
|
+
export declare function refusalHasStaleReading(result: RouteResult): boolean;
|
|
159
|
+
/** One account a stale-reading refusal skipped, by provider and lane account id. */
|
|
160
|
+
export interface StaleReadingTarget {
|
|
161
|
+
provider: LaneProvider;
|
|
162
|
+
account: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The accounts a refusal skipped only for a missing or old reading
|
|
166
|
+
* (feedback_94446741). The refresh before refusing reads just these, so it
|
|
167
|
+
* stays inside the `--provider` the user asked for and skips accounts a new
|
|
168
|
+
* reading cannot help.
|
|
169
|
+
*/
|
|
170
|
+
export declare function staleReadingTargets(result: RouteResult): StaleReadingTarget[];
|
|
148
171
|
export declare class RouteUsageError extends Error {
|
|
149
172
|
readonly code = "route_usage";
|
|
150
173
|
constructor(message: string);
|
|
@@ -114,6 +114,45 @@ function safeCanonical(home) {
|
|
|
114
114
|
return home;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
+
/** Skip reason for an account whose newest reading is older than STALE_SKIP_MS. */
|
|
118
|
+
export const SKIP_STALE_READING = "no reading in the last 24 hours";
|
|
119
|
+
/** Skip reason for a signed-in account the ledger has no reading for yet. */
|
|
120
|
+
export const SKIP_NO_READING = "no usage reading for this account yet";
|
|
121
|
+
/**
|
|
122
|
+
* True when a refusal skipped at least one account only because its reading
|
|
123
|
+
* is missing or old, so a fresh capacity read could change the outcome
|
|
124
|
+
* (feedback_94446741). Signed-out, usage-only and used-up accounts are not
|
|
125
|
+
* counted: a new reading does not give them room.
|
|
126
|
+
*/
|
|
127
|
+
export function refusalHasStaleReading(result) {
|
|
128
|
+
if (result.ok && result.pick)
|
|
129
|
+
return false;
|
|
130
|
+
return result.skipped.some((entry) => entry.reason === SKIP_STALE_READING || entry.reason === SKIP_NO_READING);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The accounts a refusal skipped only for a missing or old reading
|
|
134
|
+
* (feedback_94446741). The refresh before refusing reads just these, so it
|
|
135
|
+
* stays inside the `--provider` the user asked for and skips accounts a new
|
|
136
|
+
* reading cannot help.
|
|
137
|
+
*/
|
|
138
|
+
export function staleReadingTargets(result) {
|
|
139
|
+
if (result.ok && result.pick)
|
|
140
|
+
return [];
|
|
141
|
+
const seen = new Set();
|
|
142
|
+
const targets = [];
|
|
143
|
+
for (const entry of result.skipped) {
|
|
144
|
+
if (entry.reason !== SKIP_STALE_READING && entry.reason !== SKIP_NO_READING)
|
|
145
|
+
continue;
|
|
146
|
+
if (!entry.account)
|
|
147
|
+
continue;
|
|
148
|
+
const key = `${entry.provider}\u0000${entry.account}`;
|
|
149
|
+
if (seen.has(key))
|
|
150
|
+
continue;
|
|
151
|
+
seen.add(key);
|
|
152
|
+
targets.push({ provider: entry.provider, account: entry.account });
|
|
153
|
+
}
|
|
154
|
+
return targets;
|
|
155
|
+
}
|
|
117
156
|
export class RouteUsageError extends Error {
|
|
118
157
|
code = "route_usage";
|
|
119
158
|
constructor(message) {
|
|
@@ -305,7 +344,7 @@ export function pickAccount(input) {
|
|
|
305
344
|
}
|
|
306
345
|
skipped.push({
|
|
307
346
|
...base,
|
|
308
|
-
reason:
|
|
347
|
+
reason: SKIP_NO_READING,
|
|
309
348
|
fix: "hq capacity doctor",
|
|
310
349
|
});
|
|
311
350
|
continue;
|
|
@@ -341,7 +380,7 @@ export function pickAccount(input) {
|
|
|
341
380
|
}
|
|
342
381
|
skipped.push({
|
|
343
382
|
...base,
|
|
344
|
-
reason:
|
|
383
|
+
reason: SKIP_STALE_READING,
|
|
345
384
|
fix: "hq capacity doctor",
|
|
346
385
|
});
|
|
347
386
|
continue;
|
|
@@ -56,16 +56,44 @@ function sameFile(left, right) {
|
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
// Windows can report a junction target in NT or Win32 namespace form
|
|
60
|
+
// (`\??\C:\...` or `\\?\C:\...`). Strip the prefix so the target compares
|
|
61
|
+
// as a plain drive path.
|
|
62
|
+
const WIN32_NAMESPACE_PREFIX = /^(?:\\\\\?\\|\\\?\?\\)(?=[A-Za-z]:\\)/;
|
|
59
63
|
function symlinkTarget(linkPath) {
|
|
60
64
|
try {
|
|
61
65
|
if (!fs.lstatSync(linkPath).isSymbolicLink())
|
|
62
66
|
return undefined;
|
|
63
|
-
|
|
67
|
+
const raw = fs.readlinkSync(linkPath).replace(WIN32_NAMESPACE_PREFIX, "");
|
|
68
|
+
return path.resolve(path.dirname(linkPath), raw);
|
|
64
69
|
}
|
|
65
70
|
catch {
|
|
66
71
|
return undefined;
|
|
67
72
|
}
|
|
68
73
|
}
|
|
74
|
+
function realpathOrUndefined(pathname) {
|
|
75
|
+
try {
|
|
76
|
+
return fs.realpathSync.native(pathname);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* True when the link resolves into the company skills folder. The stored
|
|
84
|
+
* target is compared as text first. When the text differs, both sides are
|
|
85
|
+
* resolved on disk: on Windows the same folder can be spelled with a different
|
|
86
|
+
* case, an 8.3 short name, a mapped drive or a namespace prefix, and the
|
|
87
|
+
* junction a previous run wrote (for example `hq skill create --surface-only`)
|
|
88
|
+
* keeps the spelling that run used (feedback_58a0b0de).
|
|
89
|
+
*/
|
|
90
|
+
function linksIntoCompanySkills(linkPath, target, companySkillsRoot) {
|
|
91
|
+
if (isWithin(companySkillsRoot, target))
|
|
92
|
+
return true;
|
|
93
|
+
const realRoot = realpathOrUndefined(companySkillsRoot);
|
|
94
|
+
const realTarget = realpathOrUndefined(linkPath);
|
|
95
|
+
return realRoot !== undefined && realTarget !== undefined && isWithin(realRoot, realTarget);
|
|
96
|
+
}
|
|
69
97
|
function generatedMarkerPath(wrapperPath) {
|
|
70
98
|
return path.join(path.dirname(wrapperPath), WRAPPER_MARKER_DIR, `${path.basename(wrapperPath)}.json`);
|
|
71
99
|
}
|
|
@@ -127,7 +155,7 @@ function inspectGeneratedNamespacedWrapper(wrapperPath, hqRoot, companySlug) {
|
|
|
127
155
|
const target = symlinkTarget(wrapperPath);
|
|
128
156
|
const linkTarget = target === undefined
|
|
129
157
|
? "unavailable"
|
|
130
|
-
:
|
|
158
|
+
: linksIntoCompanySkills(wrapperPath, target, companySkillsRoot)
|
|
131
159
|
? "company_skills"
|
|
132
160
|
: "outside_company_skills";
|
|
133
161
|
return {
|
|
@@ -153,8 +181,9 @@ function inspectGeneratedNamespacedWrapper(wrapperPath, hqRoot, companySlug) {
|
|
|
153
181
|
}
|
|
154
182
|
const entries = fs.readdirSync(wrapperPath).filter((entry) => !entry.startsWith("."));
|
|
155
183
|
const liveBridgeCount = entries.reduce((count, entry) => {
|
|
156
|
-
const
|
|
157
|
-
|
|
184
|
+
const entryPath = path.join(wrapperPath, entry);
|
|
185
|
+
const target = symlinkTarget(entryPath);
|
|
186
|
+
return count + (target !== undefined && linksIntoCompanySkills(entryPath, target, companySkillsRoot) ? 1 : 0);
|
|
158
187
|
}, 0);
|
|
159
188
|
const bridgeState = entries.length === 0
|
|
160
189
|
? "empty"
|