@indigoai-us/hq-cli 5.345.206 → 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 +24 -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-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/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
|
@@ -23,7 +23,10 @@ export declare const SIGNALS_ALERT_STATE_FILE = "_alerts.json";
|
|
|
23
23
|
export declare const SIGNALS_ALERT_CHANNEL_FIELD = "signals_alert_channel";
|
|
24
24
|
/** The gateway's Slack post tool. */
|
|
25
25
|
export declare const SLACK_POST_TOOL = "slack.messages.post";
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Ledger lines that landed sources and either generated no signals, whatever
|
|
28
|
+
* their status, or failed partway after generating some.
|
|
29
|
+
*/
|
|
27
30
|
export declare function findSignalsFailures(entries: readonly RunLedgerEntry[]): RunLedgerEntry[];
|
|
28
31
|
/** The dedupe key: one adapter on one connection. */
|
|
29
32
|
export declare function signalsAlertKey(entry: Pick<RunLedgerEntry, "adapter" | "connectionId">): string;
|
|
@@ -26,9 +26,12 @@ export const SIGNALS_ALERT_STATE_FILE = "_alerts.json";
|
|
|
26
26
|
export const SIGNALS_ALERT_CHANNEL_FIELD = "signals_alert_channel";
|
|
27
27
|
/** The gateway's Slack post tool. */
|
|
28
28
|
export const SLACK_POST_TOOL = "slack.messages.post";
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Ledger lines that landed sources and either generated no signals, whatever
|
|
31
|
+
* their status, or failed partway after generating some.
|
|
32
|
+
*/
|
|
30
33
|
export function findSignalsFailures(entries) {
|
|
31
|
-
return entries.filter((e) => e.sourcesLanded > 0 && e.signalsGenerated === 0);
|
|
34
|
+
return entries.filter((e) => e.sourcesLanded > 0 && (e.signalsGenerated === 0 || e.status === "failed"));
|
|
32
35
|
}
|
|
33
36
|
/** The dedupe key: one adapter on one connection. */
|
|
34
37
|
export function signalsAlertKey(entry) {
|
|
@@ -38,12 +41,15 @@ export function formatSignalsFailureAlert(entry, options = {}) {
|
|
|
38
41
|
const who = options.personName ?? entry.personUid;
|
|
39
42
|
const lines = [
|
|
40
43
|
`Signals failure for ${who}: ${entry.adapter}${entry.connectionId ? ` (${entry.connectionId})` : ""} ` +
|
|
41
|
-
`landed ${entry.sourcesLanded} source${entry.sourcesLanded === 1 ? "" : "s"} and generated
|
|
44
|
+
`landed ${entry.sourcesLanded} source${entry.sourcesLanded === 1 ? "" : "s"} and generated ` +
|
|
45
|
+
`${entry.signalsGenerated} signal${entry.signalsGenerated === 1 ? "" : "s"}.`,
|
|
42
46
|
`Run ${entry.runId} (${entry.trigger}, status ${entry.status}) finished ${entry.finishedAt}.`,
|
|
43
47
|
];
|
|
44
48
|
if (entry.error)
|
|
45
49
|
lines.push(`Error: ${entry.error}`);
|
|
46
|
-
|
|
50
|
+
// The rule is about a run with no signals; a partial pass fails on its error alone.
|
|
51
|
+
if (entry.signalsGenerated === 0)
|
|
52
|
+
lines.push(SIGNALS_HEALTH_RULE);
|
|
47
53
|
return lines.join("\n");
|
|
48
54
|
}
|
|
49
55
|
/** `{vaultRoot}/sources/_runs/@{personKey}/_alerts.json` */
|
|
@@ -87,10 +87,10 @@ export interface RunHotChannelSyncInput extends RunHotChannelLoopInput {
|
|
|
87
87
|
firstRun?: boolean;
|
|
88
88
|
/**
|
|
89
89
|
* The signals pass for this adapter's landed sources; returns the number of
|
|
90
|
-
* signals it wrote. Any throw makes this adapter's line `failed`
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
90
|
+
* signals it wrote. Any throw makes this adapter's line `failed` and the run
|
|
91
|
+
* goes on to the next adapter: a `SignalsPassError` records its code and the
|
|
92
|
+
* signals written before it failed, any other error its message and a count
|
|
93
|
+
* of 0. With no callback the count is 0.
|
|
94
94
|
*/
|
|
95
95
|
signalsGenerated?: SignalsGeneratedFn;
|
|
96
96
|
}
|
|
@@ -150,6 +150,8 @@ export async function runHotChannelSync(input) {
|
|
|
150
150
|
if (err instanceof SyncLockLostError)
|
|
151
151
|
throw err;
|
|
152
152
|
passFailure = err instanceof SignalsPassError ? err.code : errorText(err);
|
|
153
|
+
if (err instanceof SignalsPassError)
|
|
154
|
+
signals = err.written;
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
}
|
|
@@ -154,6 +154,12 @@ export interface OnDemandSyncReport {
|
|
|
154
154
|
/** Lines for the person (no channels, sign-in needed). */
|
|
155
155
|
notices: string[];
|
|
156
156
|
exitCode: 0 | 1;
|
|
157
|
+
/** What the signals-failure alert did this run, when the caller asked for one. */
|
|
158
|
+
signalsAlert?: {
|
|
159
|
+
sent: string[];
|
|
160
|
+
suppressed: string[];
|
|
161
|
+
failed: string[];
|
|
162
|
+
};
|
|
157
163
|
}
|
|
158
164
|
/** The line that tells the person how to get one connection syncing again. */
|
|
159
165
|
export declare function reconnectPrompt(app: HotChannelApp, reason: ReconnectReason): string;
|
|
@@ -327,15 +327,20 @@ export async function runOnDemandSync(input) {
|
|
|
327
327
|
planned.forEach((p, i) => {
|
|
328
328
|
const result = results[i];
|
|
329
329
|
const failed = !result || result.error !== undefined;
|
|
330
|
+
// The adapter landed its sources and the signals pass then failed: the
|
|
331
|
+
// landing count stands, and the run does not read as ok. One ledger line per
|
|
332
|
+
// planned entry, in order, so `i` also indexes the run's entries.
|
|
333
|
+
const entry = report.entries[i];
|
|
334
|
+
const passFailure = !failed && entry?.status === "failed" ? entry.error : null;
|
|
330
335
|
const outcome = {
|
|
331
336
|
adapter: p.adapter.id,
|
|
332
337
|
provider: p.item.provider,
|
|
333
338
|
connectionId: p.app?.connectionId ?? null,
|
|
334
339
|
appName: p.app?.name ?? null,
|
|
335
|
-
status: failed ? "failed" : "ok",
|
|
340
|
+
status: failed || passFailure !== null ? "failed" : "ok",
|
|
336
341
|
landed: result?.landed ?? 0,
|
|
337
342
|
duplicates: result?.duplicates ?? 0,
|
|
338
|
-
message: result?.error?.message ?? null,
|
|
343
|
+
message: result?.error?.message ?? (passFailure !== null ? `signals pass failed: ${passFailure}` : null),
|
|
339
344
|
};
|
|
340
345
|
if (p.app)
|
|
341
346
|
outcome.tokenLevel = tokenLevelOf(p.app);
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { HotChannelRunResult, WriteGuard } from "./loop.js";
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Ledger `error` values a failed pass records:
|
|
4
|
+
* - `claude-usage-limit`: the account's plan has no usage left.
|
|
5
|
+
* - `claude-logged-out`: no usable sign-in.
|
|
6
|
+
* - `claude-timeout`: the call ran past its budget.
|
|
7
|
+
* - `claude-provider-error`: claude reported or exited with some other error.
|
|
8
|
+
* - `claude-bad-output`: claude finished cleanly and its reply is unusable.
|
|
9
|
+
*/
|
|
10
|
+
export type SignalsPassErrorCode = "claude-usage-limit" | "claude-logged-out" | "claude-timeout" | "claude-provider-error" | "claude-bad-output";
|
|
4
11
|
/**
|
|
5
12
|
* A pass failure the run ledger records as `status: failed` with `error` set
|
|
6
13
|
* to the code. Any other error thrown from the pass is a crash.
|
|
7
14
|
*/
|
|
8
15
|
export declare class SignalsPassError extends Error {
|
|
9
16
|
readonly code: SignalsPassErrorCode;
|
|
17
|
+
/** Signals this pass call had already written before it failed. */
|
|
18
|
+
written: number;
|
|
10
19
|
constructor(code: SignalsPassErrorCode, message: string);
|
|
11
20
|
}
|
|
12
21
|
/** Signal types the pass accepts; the same type folders existing signals use. */
|
|
@@ -30,7 +30,15 @@ import { prepareSignalPublication, flushSignalPublications } from "../bot/jobs/s
|
|
|
30
30
|
* bounded single-turn call. Cloud Claude is not the bot brain, and no model is
|
|
31
31
|
* called from the poller itself. Do not reuse this pass for a shared, fleet or
|
|
32
32
|
* hosted identity.
|
|
33
|
+
*
|
|
34
|
+
* Failures: a pass that fails keeps the real class as its ledger code (see
|
|
35
|
+
* SignalsPassErrorCode), and writes the provider's own reason, redacted and
|
|
36
|
+
* cut, to `warn`. The reason stays out of the ledger because the ledger syncs
|
|
37
|
+
* with the company vault. A failed document is never marked done, so a later
|
|
38
|
+
* run picks it up. No account is picked and no other provider is called here.
|
|
33
39
|
*/
|
|
40
|
+
import { isRuntimeUsageLimit } from "../bot/runtime-failure.js";
|
|
41
|
+
import { redactErrorText } from "../../utils/redact-error-text.js";
|
|
34
42
|
import { acquireSyncLock } from "./sync-lock.js";
|
|
35
43
|
import { spawn } from "node:child_process";
|
|
36
44
|
import { createHash } from "node:crypto";
|
|
@@ -48,6 +56,8 @@ import { assertPayloadRef, assertSafeSegment, writeFileAtomic } from "./landing.
|
|
|
48
56
|
*/
|
|
49
57
|
export class SignalsPassError extends Error {
|
|
50
58
|
code;
|
|
59
|
+
/** Signals this pass call had already written before it failed. */
|
|
60
|
+
written = 0;
|
|
51
61
|
constructor(code, message) {
|
|
52
62
|
super(message);
|
|
53
63
|
this.name = "SignalsPassError";
|
|
@@ -101,6 +111,12 @@ const MAX_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
|
101
111
|
const MAX_SIGNALS_PER_DOC = 12;
|
|
102
112
|
const KILL_GRACE_MS = 2_000;
|
|
103
113
|
const SIGNAL_ORIGIN = "hot-signal-sync";
|
|
114
|
+
/** Provider text kept in a failure message. */
|
|
115
|
+
const MAX_REASON_CHARS = 300;
|
|
116
|
+
/** A reply longer than this is not a provider's limit sentence. */
|
|
117
|
+
const MAX_LIMIT_SENTENCE_CHARS = 500;
|
|
118
|
+
/** A reply that opens as a provider's limit sentence and has no clause after it. */
|
|
119
|
+
const LIMIT_SENTENCE_REPLY = /^(?:you(?:['’]?ve| have) (?:hit|reached) your |you['’]?re out of |(?:claude ai )?usage limit )[^,;\n]*(?:$|[|·.])/i;
|
|
104
120
|
/**
|
|
105
121
|
* Run a command with a hard timeout. The child leads its own process group;
|
|
106
122
|
* on timeout the whole group gets SIGTERM, then SIGKILL after a short grace
|
|
@@ -185,7 +201,7 @@ export function runBounded(command, args, options) {
|
|
|
185
201
|
export function defaultPromptFile() {
|
|
186
202
|
return path.join(path.dirname(fileURLToPath(import.meta.url)), "prompts", "signals-pass.md");
|
|
187
203
|
}
|
|
188
|
-
export const CLAUDE_LOGGED_OUT_RE = /not logged in
|
|
204
|
+
export const CLAUDE_LOGGED_OUT_RE = /not logged in|\blog ?in\b|\/login|invalid api key|authenticat|oauth token/i;
|
|
189
205
|
export function channelOf(key) {
|
|
190
206
|
const parts = key.split("/");
|
|
191
207
|
if (parts.length !== 3 || parts[0] !== "sources" || !parts[2].endsWith(".md"))
|
|
@@ -341,6 +357,70 @@ export async function buildSignalsInput(vaultRoot, file) {
|
|
|
341
357
|
const head = pointer.endsWith("\n") ? pointer : `${pointer}\n`;
|
|
342
358
|
return { text: `${head}--- payload: ${ref} ---\n${payload}`, payloadRef: ref };
|
|
343
359
|
}
|
|
360
|
+
/** The provider's own words, safe for a log line: credentials removed, one line, bounded. */
|
|
361
|
+
function providerReason(text) {
|
|
362
|
+
const reason = redactErrorText(text).slice(0, MAX_REASON_CHARS);
|
|
363
|
+
return reason ? `: ${reason}` : "";
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Sort claude's error text into a failure class. Only call this with text
|
|
367
|
+
* claude reported as an error; a usage limit is checked first because its
|
|
368
|
+
* sentence can mention signing in to another account. `reason` is what the
|
|
369
|
+
* message may quote: stderr or an error envelope's fields, never stdout prose.
|
|
370
|
+
*/
|
|
371
|
+
function classifyClaudeError(text, fallback, reason = text) {
|
|
372
|
+
if (isRuntimeUsageLimit(text)) {
|
|
373
|
+
return new SignalsPassError("claude-usage-limit", `claude is out of usage${providerReason(reason)}`);
|
|
374
|
+
}
|
|
375
|
+
if (CLAUDE_LOGGED_OUT_RE.test(text)) {
|
|
376
|
+
return new SignalsPassError("claude-logged-out", `claude reported it is not logged in${providerReason(reason)}`);
|
|
377
|
+
}
|
|
378
|
+
return new SignalsPassError("claude-provider-error", `${fallback}${providerReason(reason)}`);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* The error text of an envelope claude marked as failed; null for any other
|
|
382
|
+
* envelope, whose `result` is model output built from the document and must
|
|
383
|
+
* stay out of logs. `error_*` subtypes (for example `error_max_turns`) can come
|
|
384
|
+
* without `is_error` and without a `result`.
|
|
385
|
+
*/
|
|
386
|
+
function envelopeErrorText(envelope) {
|
|
387
|
+
if (!envelope || typeof envelope !== "object")
|
|
388
|
+
return null;
|
|
389
|
+
const env = envelope;
|
|
390
|
+
const errorSubtype = typeof env.subtype === "string" && env.subtype.startsWith("error");
|
|
391
|
+
if (env.is_error !== true && !errorSubtype)
|
|
392
|
+
return null;
|
|
393
|
+
const parts = [];
|
|
394
|
+
if (typeof env.api_error_status === "number")
|
|
395
|
+
parts.push(`status ${env.api_error_status}`);
|
|
396
|
+
if (errorSubtype)
|
|
397
|
+
parts.push(env.subtype);
|
|
398
|
+
if (typeof env.result === "string")
|
|
399
|
+
parts.push(env.result);
|
|
400
|
+
if (Array.isArray(env.errors))
|
|
401
|
+
parts.push(...env.errors.filter((e) => typeof e === "string"));
|
|
402
|
+
return parts.join(" ");
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* A `claude -p` that exited non-zero: its reply is never a result, whatever
|
|
406
|
+
* stdout holds. Unparseable stdout can be a cut-off reply built from the
|
|
407
|
+
* document, so it is never quoted. Short plain text can still decide the class,
|
|
408
|
+
* because claude can print its error there.
|
|
409
|
+
*/
|
|
410
|
+
function classifyClaudeExit(run) {
|
|
411
|
+
let envelopeText = "";
|
|
412
|
+
let plainStdout = "";
|
|
413
|
+
try {
|
|
414
|
+
envelopeText = envelopeErrorText(JSON.parse(run.stdout)) ?? "";
|
|
415
|
+
}
|
|
416
|
+
catch {
|
|
417
|
+
const stdout = run.stdout.trim();
|
|
418
|
+
if (!stdout.startsWith("{") && stdout.length <= MAX_LIMIT_SENTENCE_CHARS)
|
|
419
|
+
plainStdout = stdout;
|
|
420
|
+
}
|
|
421
|
+
const reason = `${envelopeText}\n${run.stderr}`.trim();
|
|
422
|
+
return classifyClaudeError(`${plainStdout}\n${reason}`.trim(), `claude exited with code ${String(run.code)}`, reason);
|
|
423
|
+
}
|
|
344
424
|
/**
|
|
345
425
|
* Parse `claude -p --output-format json` output into signals. The envelope's
|
|
346
426
|
* `result` must itself be one JSON object, optionally inside a single code
|
|
@@ -357,13 +437,10 @@ export function parseClaudeSignals(stdout) {
|
|
|
357
437
|
if (!envelope || typeof envelope !== "object") {
|
|
358
438
|
throw new SignalsPassError("claude-bad-output", "claude printed a JSON value that is not an envelope");
|
|
359
439
|
}
|
|
440
|
+
const errorText = envelopeErrorText(envelope);
|
|
441
|
+
if (errorText !== null)
|
|
442
|
+
throw classifyClaudeError(errorText, "claude returned an error result");
|
|
360
443
|
const env = envelope;
|
|
361
|
-
if (env.is_error === true) {
|
|
362
|
-
const text = typeof env.result === "string" ? env.result : "";
|
|
363
|
-
if (CLAUDE_LOGGED_OUT_RE.test(text))
|
|
364
|
-
throw new SignalsPassError("claude-logged-out", "claude reported it is not logged in");
|
|
365
|
-
throw new SignalsPassError("claude-bad-output", "claude returned an error result");
|
|
366
|
-
}
|
|
367
444
|
if (typeof env.result !== "string") {
|
|
368
445
|
throw new SignalsPassError("claude-bad-output", "claude envelope has no result text");
|
|
369
446
|
}
|
|
@@ -376,6 +453,12 @@ export function parseClaudeSignals(stdout) {
|
|
|
376
453
|
body = JSON.parse(text);
|
|
377
454
|
}
|
|
378
455
|
catch {
|
|
456
|
+
// A limit sentence can arrive as a plain successful reply. The whole reply
|
|
457
|
+
// must be that sentence, so prose about a limit stays bad output, and the
|
|
458
|
+
// reply is not quoted because it is stdout.
|
|
459
|
+
if (text.length <= MAX_LIMIT_SENTENCE_CHARS && LIMIT_SENTENCE_REPLY.test(text) && isRuntimeUsageLimit(text)) {
|
|
460
|
+
throw new SignalsPassError("claude-usage-limit", "claude is out of usage: its whole reply was a limit sentence");
|
|
461
|
+
}
|
|
379
462
|
throw new SignalsPassError("claude-bad-output", "claude result is not JSON");
|
|
380
463
|
}
|
|
381
464
|
const signals = body?.signals;
|
|
@@ -617,10 +700,19 @@ export function createClaudeSignalsPass(options) {
|
|
|
617
700
|
throw new SignalsPassError("claude-timeout", `claude timed out after ${timeoutMs}ms on ${item.file}`);
|
|
618
701
|
if (run.spawnError !== undefined)
|
|
619
702
|
throw new SignalsPassError("claude-logged-out", `claude could not start: ${run.spawnError}`);
|
|
620
|
-
if (run.code !== 0
|
|
621
|
-
throw
|
|
703
|
+
if (run.code !== 0)
|
|
704
|
+
throw classifyClaudeExit(run);
|
|
705
|
+
try {
|
|
706
|
+
return parseClaudeSignals(run.stdout);
|
|
707
|
+
}
|
|
708
|
+
catch (err) {
|
|
709
|
+
if (err instanceof SignalsPassError && err.code === "claude-bad-output") {
|
|
710
|
+
// Only sizes and stderr: stdout is model output built from the document.
|
|
711
|
+
const stderr = run.stderr.trim() ? `, stderr${providerReason(run.stderr)}` : "";
|
|
712
|
+
throw new SignalsPassError("claude-bad-output", `${err.message} (stdout ${Buffer.byteLength(run.stdout)} bytes${stderr})`);
|
|
713
|
+
}
|
|
714
|
+
throw err;
|
|
622
715
|
}
|
|
623
|
-
return parseClaudeSignals(run.stdout);
|
|
624
716
|
};
|
|
625
717
|
const write = async (item, input, signals, beforeWrite) => {
|
|
626
718
|
const at = now().toISOString();
|
|
@@ -671,7 +763,7 @@ export function createClaudeSignalsPass(options) {
|
|
|
671
763
|
flushSignalPublications(options.hqRoot, options.company);
|
|
672
764
|
return written;
|
|
673
765
|
};
|
|
674
|
-
|
|
766
|
+
const runPass = async (result, guard, progress) => {
|
|
675
767
|
const beforeWrite = guard?.beforeWrite ?? (async () => undefined);
|
|
676
768
|
await beforeWrite();
|
|
677
769
|
flushSignalPublications(options.hqRoot, options.company);
|
|
@@ -686,13 +778,22 @@ export function createClaudeSignalsPass(options) {
|
|
|
686
778
|
continue;
|
|
687
779
|
byChannel.set(channel, [...(byChannel.get(channel) ?? []), key]);
|
|
688
780
|
}
|
|
689
|
-
let total = 0;
|
|
690
781
|
for (const [channel, files] of byChannel) {
|
|
691
782
|
// With the cap spent and nothing landed here, there is nothing to list:
|
|
692
783
|
// the channel's backlog stays where it is (worklist or pending file).
|
|
693
784
|
if (docsSent >= maxDocs && files.length === 0)
|
|
694
785
|
continue;
|
|
695
|
-
|
|
786
|
+
let work;
|
|
787
|
+
try {
|
|
788
|
+
work = await itemsFor(channel, files, Math.max(0, maxDocs - docsSent));
|
|
789
|
+
}
|
|
790
|
+
catch (err) {
|
|
791
|
+
// This run's landed keys exist only in memory until they are queued,
|
|
792
|
+
// so a failed listing must not lose them for later runs.
|
|
793
|
+
if (files.length > 0)
|
|
794
|
+
await queuePendingSignals(vaultRoot, channel, files, beforeWrite);
|
|
795
|
+
throw err;
|
|
796
|
+
}
|
|
696
797
|
// No worklist: every candidate is pending until it is processed, so
|
|
697
798
|
// documents over the cap (or left by a failed call) wait for a later run.
|
|
698
799
|
let pending = work.pending ? work.items.map((item) => item.file) : undefined;
|
|
@@ -710,7 +811,7 @@ export function createClaudeSignalsPass(options) {
|
|
|
710
811
|
if (input.fallback !== undefined) {
|
|
711
812
|
warn(`signals pass: ${item.file}: ${input.fallback} for payload_ref ${JSON.stringify(input.fallbackRef)}; sent the pointer only`);
|
|
712
813
|
}
|
|
713
|
-
|
|
814
|
+
progress.written += await write(item, input, await extract(item, input), beforeWrite);
|
|
714
815
|
if (item.fromWorklist) {
|
|
715
816
|
await runWorklist(["--company", options.company, "--channel", channel, "--mark-done", item.file]);
|
|
716
817
|
}
|
|
@@ -720,7 +821,20 @@ export function createClaudeSignalsPass(options) {
|
|
|
720
821
|
}
|
|
721
822
|
}
|
|
722
823
|
}
|
|
723
|
-
|
|
824
|
+
};
|
|
825
|
+
return async (result, guard) => {
|
|
826
|
+
const progress = { written: 0 };
|
|
827
|
+
try {
|
|
828
|
+
await runPass(result, guard, progress);
|
|
829
|
+
}
|
|
830
|
+
catch (err) {
|
|
831
|
+
if (err instanceof SignalsPassError) {
|
|
832
|
+
err.written = progress.written;
|
|
833
|
+
warn(`signals pass failed (${err.code}): ${err.message}`);
|
|
834
|
+
}
|
|
835
|
+
throw err;
|
|
836
|
+
}
|
|
837
|
+
return progress.written;
|
|
724
838
|
};
|
|
725
839
|
}
|
|
726
840
|
//# sourceMappingURL=signals-pass.js.map
|
|
@@ -5,7 +5,7 @@ export async function fetchAttendedLiveBots(token, companyId, strict = false, si
|
|
|
5
5
|
const res = await vaultApiFetch({ token, path: "/v1/meetings", query: { companyId, view: "live" }, ...(signal ? { signal } : {}) });
|
|
6
6
|
if (!res.ok) {
|
|
7
7
|
if (strict)
|
|
8
|
-
throw new Error("Could not list attended meetings");
|
|
8
|
+
throw Object.assign(new Error("Could not list attended meetings"), { status: res.status });
|
|
9
9
|
return [];
|
|
10
10
|
}
|
|
11
11
|
const data = (await res.json());
|
|
@@ -3,7 +3,7 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
|
-
export const SYNC_CORE_RELEASE = "v0.1.
|
|
6
|
+
export const SYNC_CORE_RELEASE = "v0.1.25";
|
|
7
7
|
export const SYNC_CORE_FULL_RELEASE = "v0.1.23";
|
|
8
8
|
/**
|
|
9
9
|
* The first engine release whose Windows build runs full sync. Until it is set, Windows vaults
|
|
@@ -26,6 +26,7 @@ export function redactErrorText(text) {
|
|
|
26
26
|
.replace(/\b(password|secret|client[_-]?secret|api[_-]?key|(?:id|access|refresh)[_-]?token|token|authorization)\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s&"'<>;,}]+)/gi, (_match, label) => `${label}=[REDACTED]`)
|
|
27
27
|
.replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, "[REDACTED]")
|
|
28
28
|
.replace(/\b(?:hqk_|xox[abprs]-|github_pat_|gh[pousr]_)[A-Za-z0-9_-]+\b/gi, "[REDACTED]")
|
|
29
|
+
.replace(/\bsk-ant-[A-Za-z0-9_-]+/g, "[REDACTED]")
|
|
29
30
|
.replace(/\bAKIA[0-9A-Z]{16}\b/g, "[REDACTED]")
|
|
30
31
|
.replace(/\s+/g, " ")
|
|
31
32
|
.trim()
|
|
@@ -45,6 +45,8 @@ export const RESIDENT_PACKAGE_MODULES = {
|
|
|
45
45
|
"../lib/first-sync-next-step.js",
|
|
46
46
|
"../utils/local-files-overview.js",
|
|
47
47
|
"@indigoai-us/hq-cloud",
|
|
48
|
+
"../lib/capacity/collect.js",
|
|
49
|
+
"../lib/capacity/accounts.js",
|
|
48
50
|
],
|
|
49
51
|
"bot-logs-follow": [],
|
|
50
52
|
mcp: ["../lib/mcp/tools.js", "../lib/mcp/prompts.js", "../lib/mcp/local-native-tools.js", "../lib/anywhere-person-setting.js", "../utils/cognito-session.js", "@indigoai-us/hq-cloud", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client"],
|
|
@@ -76,15 +78,17 @@ export const RESIDENT_PACKAGE_MODULES = {
|
|
|
76
78
|
"../commands/access.js",
|
|
77
79
|
"../commands/sources.js",
|
|
78
80
|
"../lib/hot-channels/adapters/index.js",
|
|
81
|
+
"../lib/capacity/collect.js",
|
|
82
|
+
"../lib/capacity/accounts.js",
|
|
79
83
|
],
|
|
80
84
|
"daemon-logs-follow": [],
|
|
81
85
|
"mesh-daemon": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
|
|
82
|
-
"lanes-watch": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../commands/lanes.js"],
|
|
83
|
-
"monitor-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../commands/lanes.js"],
|
|
84
|
-
"monitor-run": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js"],
|
|
86
|
+
"lanes-watch": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../commands/lanes.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
|
|
87
|
+
"monitor-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../commands/lanes.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
|
|
88
|
+
"monitor-run": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
|
|
85
89
|
"agents-message-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
|
|
86
90
|
"integrations-oauth-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
|
|
87
|
-
"outpost-wait": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js"],
|
|
91
|
+
"outpost-wait": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
|
|
88
92
|
"secrets-sandbox": [],
|
|
89
93
|
"pkg-update": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../utils/cognito-session.js", "@indigoai-us/hq-cloud"],
|
|
90
94
|
"pack-install": [
|
|
@@ -214,6 +218,10 @@ const LOADERS = {
|
|
|
214
218
|
() => import("../lib/first-sync-next-step.js"),
|
|
215
219
|
() => import("../utils/local-files-overview.js"),
|
|
216
220
|
() => import("@indigoai-us/hq-cloud"),
|
|
221
|
+
// lanes create --account auto takes one fresh capacity reading in-process
|
|
222
|
+
// before it refuses on a stale one.
|
|
223
|
+
() => import("../lib/capacity/collect.js"),
|
|
224
|
+
() => import("../lib/capacity/accounts.js"),
|
|
217
225
|
],
|
|
218
226
|
"bot-logs-follow": [],
|
|
219
227
|
mcp: [
|
|
@@ -269,6 +277,10 @@ const LOADERS = {
|
|
|
269
277
|
() => import("../commands/access.js"),
|
|
270
278
|
() => import("../commands/sources.js"),
|
|
271
279
|
() => import("../lib/hot-channels/adapters/index.js"),
|
|
280
|
+
// lanes create --account auto takes one fresh capacity reading in-process
|
|
281
|
+
// before it refuses on a stale one.
|
|
282
|
+
() => import("../lib/capacity/collect.js"),
|
|
283
|
+
() => import("../lib/capacity/accounts.js"),
|
|
272
284
|
],
|
|
273
285
|
"daemon-logs-follow": [],
|
|
274
286
|
"mesh-daemon": [
|
|
@@ -310,6 +322,10 @@ const LOADERS = {
|
|
|
310
322
|
() => import("../commands/sources.js"),
|
|
311
323
|
() => import("../lib/hot-channels/adapters/index.js"),
|
|
312
324
|
() => import("../commands/lanes.js"),
|
|
325
|
+
// lanes create --account auto takes one fresh capacity reading in-process
|
|
326
|
+
// before it refuses on a stale one.
|
|
327
|
+
() => import("../lib/capacity/collect.js"),
|
|
328
|
+
() => import("../lib/capacity/accounts.js"),
|
|
313
329
|
],
|
|
314
330
|
"monitor-wait": [
|
|
315
331
|
async () => {
|
|
@@ -336,6 +352,10 @@ const LOADERS = {
|
|
|
336
352
|
() => import("../commands/sources.js"),
|
|
337
353
|
() => import("../lib/hot-channels/adapters/index.js"),
|
|
338
354
|
() => import("../commands/lanes.js"),
|
|
355
|
+
// lanes create --account auto takes one fresh capacity reading in-process
|
|
356
|
+
// before it refuses on a stale one.
|
|
357
|
+
() => import("../lib/capacity/collect.js"),
|
|
358
|
+
() => import("../lib/capacity/accounts.js"),
|
|
339
359
|
],
|
|
340
360
|
"monitor-run": [
|
|
341
361
|
() => import("../commands/lanes.js"),
|
|
@@ -362,6 +382,10 @@ const LOADERS = {
|
|
|
362
382
|
() => import("../commands/access.js"),
|
|
363
383
|
() => import("../commands/sources.js"),
|
|
364
384
|
() => import("../lib/hot-channels/adapters/index.js"),
|
|
385
|
+
// lanes create --account auto takes one fresh capacity reading in-process
|
|
386
|
+
// before it refuses on a stale one.
|
|
387
|
+
() => import("../lib/capacity/collect.js"),
|
|
388
|
+
() => import("../lib/capacity/accounts.js"),
|
|
365
389
|
],
|
|
366
390
|
"agents-message-wait": [
|
|
367
391
|
async () => {
|
|
@@ -416,6 +440,10 @@ const LOADERS = {
|
|
|
416
440
|
() => import("../commands/access.js"),
|
|
417
441
|
() => import("../commands/sources.js"),
|
|
418
442
|
() => import("../lib/hot-channels/adapters/index.js"),
|
|
443
|
+
// lanes create --account auto takes one fresh capacity reading in-process
|
|
444
|
+
// before it refuses on a stale one.
|
|
445
|
+
() => import("../lib/capacity/collect.js"),
|
|
446
|
+
() => import("../lib/capacity/accounts.js"),
|
|
419
447
|
],
|
|
420
448
|
"secrets-sandbox": [],
|
|
421
449
|
"pkg-update": [
|
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.207",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@aws-sdk/client-iot-data-plane": "^3.1096.0",
|
|
56
56
|
"@aws-sdk/client-s3": "^3.1049.0",
|
|
57
57
|
"@aws-sdk/dsql-signer": "^3.1146.0",
|
|
58
|
-
"@indigoai-us/hq-cloud": "6.18.
|
|
58
|
+
"@indigoai-us/hq-cloud": "6.18.109",
|
|
59
59
|
"@indigoai-us/hq-flags-client": "^0.2.0",
|
|
60
60
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
61
61
|
"@sentry/node": "^10.49.0",
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
118
118
|
},
|
|
119
119
|
"optionalDependencies": {
|
|
120
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
121
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
122
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
123
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
124
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
125
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
120
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.207",
|
|
121
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.207",
|
|
122
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.207",
|
|
123
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.207",
|
|
124
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.207",
|
|
125
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.207"
|
|
126
126
|
}
|
|
127
127
|
}
|