@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
|
@@ -17,8 +17,15 @@ import * as fs from "node:fs";
|
|
|
17
17
|
import * as path from "node:path";
|
|
18
18
|
import { assertNotIntegrationSecretsPath, personDirName } from "./cursors.js";
|
|
19
19
|
import { writeFileAtomic } from "./landing.js";
|
|
20
|
-
import { CODEX_BOT_NEEDS_CLAUDE_TEXT } from "./signals-pass.js";
|
|
20
|
+
import { CLAUDE_SIGNED_OUT_TEXT, CODEX_BOT_NEEDS_CLAUDE_TEXT } from "./signals-pass.js";
|
|
21
21
|
const CODEX_BOT_NEEDS_CLAUDE_CODE = "claude-logged-out-codex-bot";
|
|
22
|
+
const CLAUDE_SIGNED_OUT_CODE = "claude-logged-out";
|
|
23
|
+
/** Pass failures that mean Claude Code is signed out (or missing) on this computer. */
|
|
24
|
+
export const SIGNED_OUT_SIGNALS_CODES = new Set([CLAUDE_SIGNED_OUT_CODE, CODEX_BOT_NEEDS_CLAUDE_CODE]);
|
|
25
|
+
/** A failed ledger line whose pass found Claude Code signed out. */
|
|
26
|
+
export function isSignedOutSignalsFailure(entry) {
|
|
27
|
+
return entry.status === "failed" && entry.error !== null && SIGNED_OUT_SIGNALS_CODES.has(entry.error);
|
|
28
|
+
}
|
|
22
29
|
export const SIGNALS_HEALTH_RULE = 'Owner rule: "sync and build feels wrong. we should be logging sources and signals generated." ' +
|
|
23
30
|
"A run that lands sources and generates no signals is a failure.";
|
|
24
31
|
/** One alert per adapter and connection per hour. */
|
|
@@ -30,15 +37,22 @@ export const SIGNALS_ALERT_CHANNEL_FIELD = "signals_alert_channel";
|
|
|
30
37
|
export const SLACK_POST_TOOL = "slack.messages.post";
|
|
31
38
|
/**
|
|
32
39
|
* Ledger lines that landed sources and either generated no signals, whatever
|
|
33
|
-
* their status, or failed partway after generating some.
|
|
40
|
+
* their status, or failed partway after generating some. A line whose pass
|
|
41
|
+
* failed because Claude Code is signed out counts too when it landed nothing:
|
|
42
|
+
* the pass only checks the login when queued documents are waiting, so that
|
|
43
|
+
* run had backlog it could not process, and the owner must hear about it.
|
|
34
44
|
*/
|
|
35
45
|
export function findSignalsFailures(entries) {
|
|
36
|
-
return entries.filter((e) => e.sourcesLanded > 0 && (e.signalsGenerated === 0 || e.status === "failed"));
|
|
46
|
+
return entries.filter((e) => (e.sourcesLanded > 0 && (e.signalsGenerated === 0 || e.status === "failed")) || isSignedOutSignalsFailure(e));
|
|
37
47
|
}
|
|
38
48
|
/** The dedupe key: one adapter on one connection. */
|
|
39
49
|
export function signalsAlertKey(entry) {
|
|
40
50
|
return `${entry.adapter}:${entry.connectionId ?? "-"}`;
|
|
41
51
|
}
|
|
52
|
+
/** The dedupe key shared by every connection of one adapter that failed signed out. */
|
|
53
|
+
export function signedOutAlertKey(entry) {
|
|
54
|
+
return `${entry.adapter}:claude-signed-out`;
|
|
55
|
+
}
|
|
42
56
|
/** The first words of every signals-failure alert; the Fleet job script finds the alert by them. */
|
|
43
57
|
export const SIGNALS_FAILURE_PREFIX = "Signals failure for ";
|
|
44
58
|
export function formatSignalsFailureAlert(entry, options = {}) {
|
|
@@ -54,8 +68,11 @@ export function formatSignalsFailureAlert(entry, options = {}) {
|
|
|
54
68
|
// A Codex bot cannot fix this by signing in to its own tool; say what works.
|
|
55
69
|
if (entry.error === CODEX_BOT_NEEDS_CLAUDE_CODE)
|
|
56
70
|
lines.push(CODEX_BOT_NEEDS_CLAUDE_TEXT);
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
else if (entry.error === CLAUDE_SIGNED_OUT_CODE)
|
|
72
|
+
lines.push(CLAUDE_SIGNED_OUT_TEXT);
|
|
73
|
+
// The rule is about a run that landed sources and made no signals; a
|
|
74
|
+
// partial pass, or a backlog-only run, fails on its error alone.
|
|
75
|
+
if (entry.signalsGenerated === 0 && entry.sourcesLanded > 0)
|
|
59
76
|
lines.push(SIGNALS_HEALTH_RULE);
|
|
60
77
|
return lines.join("\n");
|
|
61
78
|
}
|
|
@@ -98,17 +115,25 @@ export async function raiseSignalsFailureAlerts(input) {
|
|
|
98
115
|
const state = await readAlertState(file);
|
|
99
116
|
const seen = new Set();
|
|
100
117
|
let changed = false;
|
|
118
|
+
const recent = (k, at) => {
|
|
119
|
+
const last = state.lastAlertAt[k] ? Date.parse(state.lastAlertAt[k]) : Number.NaN;
|
|
120
|
+
return !Number.isNaN(last) && at.getTime() - last < SIGNALS_ALERT_DEDUPE_MS;
|
|
121
|
+
};
|
|
101
122
|
for (const entry of failures) {
|
|
102
123
|
const key = signalsAlertKey(entry);
|
|
103
124
|
if (seen.has(key))
|
|
104
125
|
continue;
|
|
105
126
|
seen.add(key);
|
|
106
127
|
const at = input.now();
|
|
107
|
-
|
|
108
|
-
|
|
128
|
+
// One sign-out fails every connection of an adapter that has backlog the
|
|
129
|
+
// same way: the adapter gets one DM per hour, not one per connection.
|
|
130
|
+
const signedOutKey = isSignedOutSignalsFailure(entry) ? signedOutAlertKey(entry) : null;
|
|
131
|
+
if (recent(key, at) || (signedOutKey !== null && (seen.has(signedOutKey) || recent(signedOutKey, at)))) {
|
|
109
132
|
result.suppressed.push(key);
|
|
110
133
|
continue;
|
|
111
134
|
}
|
|
135
|
+
if (signedOutKey !== null)
|
|
136
|
+
seen.add(signedOutKey);
|
|
112
137
|
const text = formatSignalsFailureAlert(entry, input.personName ? { personName: input.personName } : {});
|
|
113
138
|
try {
|
|
114
139
|
await input.sendOwnerDm(text);
|
|
@@ -119,6 +144,8 @@ export async function raiseSignalsFailureAlerts(input) {
|
|
|
119
144
|
continue;
|
|
120
145
|
}
|
|
121
146
|
state.lastAlertAt[key] = at.toISOString();
|
|
147
|
+
if (signedOutKey !== null)
|
|
148
|
+
state.lastAlertAt[signedOutKey] = at.toISOString();
|
|
122
149
|
changed = true;
|
|
123
150
|
result.sent.push(key);
|
|
124
151
|
if (input.postCompanyChannel) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Claude Code sign-in that the signals pass needs, as last seen by a pass.
|
|
3
|
+
*
|
|
4
|
+
* The signals pass always runs Claude Code, whatever the bot's own runtime is
|
|
5
|
+
* (signals-pass.ts), so a Codex bot can be signed in to its own tool while
|
|
6
|
+
* signals cannot run. Each pass reports what it saw through `onClaudeLogin`,
|
|
7
|
+
* and this module keeps one machine-local record of it
|
|
8
|
+
* (`{botsRoot}/signals-claude-login.json`; the login belongs to this
|
|
9
|
+
* computer, so the record never goes in a company vault). `hq bot status`
|
|
10
|
+
* reads it to show that login next to the bot's own runtime login.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SIGNALS_CLAUDE_LOGIN_FILE = "signals-claude-login.json";
|
|
13
|
+
/** Who saw the state. Only the signals pass records it today. */
|
|
14
|
+
export type SignalsClaudeLoginSource = "signals-pass";
|
|
15
|
+
export interface SignalsClaudeLogin {
|
|
16
|
+
v: 1;
|
|
17
|
+
signedIn: boolean;
|
|
18
|
+
checkedAt: string;
|
|
19
|
+
source: SignalsClaudeLoginSource;
|
|
20
|
+
/** When the login was first seen signed out, while it still is. */
|
|
21
|
+
signedOutSince?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function signalsClaudeLoginPath(root?: string): string;
|
|
24
|
+
/** The last recorded state, or null when nothing was recorded or the file is unreadable. */
|
|
25
|
+
export declare function readSignalsClaudeLogin(file?: string): SignalsClaudeLogin | null;
|
|
26
|
+
/**
|
|
27
|
+
* Record what a pass just saw. Never throws: the record is a report, and a
|
|
28
|
+
* failed write must not fail a signals run.
|
|
29
|
+
*/
|
|
30
|
+
export declare function recordSignalsClaudeLogin(signedIn: boolean, now?: () => Date, file?: string): void;
|
|
31
|
+
/** One live `claude auth status` answer for `hq bot status`. */
|
|
32
|
+
export interface ClaudeLoginNow {
|
|
33
|
+
/** null when the check could not tell (`error` says why). */
|
|
34
|
+
signedIn: boolean | null;
|
|
35
|
+
checkedAt: string;
|
|
36
|
+
error: string | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Ask `claude auth status` now, the way the signals pass reads it: a CLI that
|
|
40
|
+
* cannot start (not installed) or exits non-zero is signed out,
|
|
41
|
+
* `loggedIn: false` is signed out, any other exit 0 is signed in. It reads
|
|
42
|
+
* local credentials only: no network and no model call. A timeout or a
|
|
43
|
+
* thrown error is `signedIn: null` with the reason. Never throws.
|
|
44
|
+
*/
|
|
45
|
+
export declare function checkClaudeLoginNow(options?: {
|
|
46
|
+
claudeBin?: string;
|
|
47
|
+
env?: NodeJS.ProcessEnv;
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
now?: () => Date;
|
|
50
|
+
}): Promise<ClaudeLoginNow>;
|
|
51
|
+
/** The `onClaudeLogin` reporter `hq sources sync` and `hq bot` give the signals pass. */
|
|
52
|
+
export declare function recordSignalsPassClaudeLogin(signedIn: boolean): void;
|
|
53
|
+
//# sourceMappingURL=signals-claude-login.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Claude Code sign-in that the signals pass needs, as last seen by a pass.
|
|
3
|
+
*
|
|
4
|
+
* The signals pass always runs Claude Code, whatever the bot's own runtime is
|
|
5
|
+
* (signals-pass.ts), so a Codex bot can be signed in to its own tool while
|
|
6
|
+
* signals cannot run. Each pass reports what it saw through `onClaudeLogin`,
|
|
7
|
+
* and this module keeps one machine-local record of it
|
|
8
|
+
* (`{botsRoot}/signals-claude-login.json`; the login belongs to this
|
|
9
|
+
* computer, so the record never goes in a company vault). `hq bot status`
|
|
10
|
+
* reads it to show that login next to the bot's own runtime login.
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from "node:fs";
|
|
13
|
+
import * as os from "node:os";
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
import { botsRoot } from "../bot/paths.js";
|
|
16
|
+
import { AUTH_PREFLIGHT_TIMEOUT_MS, runBounded } from "./signals-pass.js";
|
|
17
|
+
export const SIGNALS_CLAUDE_LOGIN_FILE = "signals-claude-login.json";
|
|
18
|
+
export function signalsClaudeLoginPath(root = botsRoot()) {
|
|
19
|
+
return path.join(root, SIGNALS_CLAUDE_LOGIN_FILE);
|
|
20
|
+
}
|
|
21
|
+
/** The last recorded state, or null when nothing was recorded or the file is unreadable. */
|
|
22
|
+
export function readSignalsClaudeLogin(file = signalsClaudeLoginPath()) {
|
|
23
|
+
try {
|
|
24
|
+
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
25
|
+
if (parsed?.v !== 1 || typeof parsed.signedIn !== "boolean" || typeof parsed.checkedAt !== "string")
|
|
26
|
+
return null;
|
|
27
|
+
if (!Number.isFinite(Date.parse(parsed.checkedAt)))
|
|
28
|
+
return null;
|
|
29
|
+
return {
|
|
30
|
+
v: 1,
|
|
31
|
+
signedIn: parsed.signedIn,
|
|
32
|
+
checkedAt: parsed.checkedAt,
|
|
33
|
+
source: "signals-pass",
|
|
34
|
+
...(!parsed.signedIn && typeof parsed.signedOutSince === "string" ? { signedOutSince: parsed.signedOutSince } : {}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Missing or unreadable: nothing recorded yet.
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Record what a pass just saw. Never throws: the record is a report, and a
|
|
44
|
+
* failed write must not fail a signals run.
|
|
45
|
+
*/
|
|
46
|
+
export function recordSignalsClaudeLogin(signedIn, now = () => new Date(), file = signalsClaudeLoginPath()) {
|
|
47
|
+
try {
|
|
48
|
+
const at = now().toISOString();
|
|
49
|
+
const previous = readSignalsClaudeLogin(file);
|
|
50
|
+
const signedOutSince = signedIn ? undefined : previous && !previous.signedIn ? (previous.signedOutSince ?? previous.checkedAt) : at;
|
|
51
|
+
const record = { v: 1, signedIn, checkedAt: at, source: "signals-pass", ...(signedOutSince ? { signedOutSince } : {}) };
|
|
52
|
+
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
53
|
+
const tmp = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
54
|
+
fs.writeFileSync(tmp, `${JSON.stringify(record, null, 2)}\n`, { mode: 0o600 });
|
|
55
|
+
fs.renameSync(tmp, file);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// A report only; the next pass writes it again.
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Ask `claude auth status` now, the way the signals pass reads it: a CLI that
|
|
63
|
+
* cannot start (not installed) or exits non-zero is signed out,
|
|
64
|
+
* `loggedIn: false` is signed out, any other exit 0 is signed in. It reads
|
|
65
|
+
* local credentials only: no network and no model call. A timeout or a
|
|
66
|
+
* thrown error is `signedIn: null` with the reason. Never throws.
|
|
67
|
+
*/
|
|
68
|
+
export async function checkClaudeLoginNow(options = {}) {
|
|
69
|
+
const checkedAt = (options.now ?? (() => new Date()))().toISOString();
|
|
70
|
+
try {
|
|
71
|
+
const run = await runBounded(options.claudeBin ?? "claude", ["auth", "status"], {
|
|
72
|
+
timeoutMs: options.timeoutMs ?? AUTH_PREFLIGHT_TIMEOUT_MS,
|
|
73
|
+
cwd: os.tmpdir(),
|
|
74
|
+
env: options.env ?? process.env,
|
|
75
|
+
});
|
|
76
|
+
if (run.timedOut)
|
|
77
|
+
return { signedIn: null, checkedAt, error: "claude auth status timed out" };
|
|
78
|
+
if (run.spawnError !== undefined || run.code !== 0)
|
|
79
|
+
return { signedIn: false, checkedAt, error: null };
|
|
80
|
+
try {
|
|
81
|
+
return { signedIn: JSON.parse(run.stdout).loggedIn !== false, checkedAt, error: null };
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// A plain-text status with exit 0 means signed in, as in the pass.
|
|
85
|
+
return { signedIn: true, checkedAt, error: null };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
return { signedIn: null, checkedAt, error: err instanceof Error ? err.message : String(err) };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** The `onClaudeLogin` reporter `hq sources sync` and `hq bot` give the signals pass. */
|
|
93
|
+
export function recordSignalsPassClaudeLogin(signedIn) {
|
|
94
|
+
recordSignalsClaudeLogin(signedIn);
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=signals-claude-login.js.map
|
|
@@ -71,12 +71,22 @@ export declare class SignalsPassError extends Error {
|
|
|
71
71
|
noRetry: boolean;
|
|
72
72
|
constructor(code: SignalsPassErrorCode, message: string);
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* How to sign Claude Code in for signals. The desktop app comes first: its
|
|
76
|
+
* Settings → AI tools pane lists Claude Code with one button: "Connect
|
|
77
|
+
* Claude" when the CLI is installed, "Install Claude" when it is not
|
|
78
|
+
* (hq-desktop-app-src packages/ui/src/settings/AgentsSettingsPane.svelte).
|
|
79
|
+
* The terminal command is the fallback.
|
|
80
|
+
*/
|
|
81
|
+
export declare const CLAUDE_SIGN_IN_STEPS: string;
|
|
74
82
|
/**
|
|
75
83
|
* What the owner of a Codex main bot is told when this pass finds claude
|
|
76
84
|
* missing or signed out. The pass always runs Claude Code, whatever the main
|
|
77
85
|
* bot runs.
|
|
78
86
|
*/
|
|
79
87
|
export declare const CODEX_BOT_NEEDS_CLAUDE_TEXT: string;
|
|
88
|
+
/** What the owner is told when this pass finds claude signed out on any other bot. */
|
|
89
|
+
export declare const CLAUDE_SIGNED_OUT_TEXT: string;
|
|
80
90
|
/** Signal types the pass accepts; the same type folders existing signals use. */
|
|
81
91
|
export declare const SIGNAL_TYPES: readonly ["action_item", "commitment", "decision", "key_point", "participant_contribution", "question", "risk", "summary"];
|
|
82
92
|
export type SignalType = (typeof SIGNAL_TYPES)[number];
|
|
@@ -151,6 +161,13 @@ export interface ClaudeSignalsPassOptions {
|
|
|
151
161
|
* CODEX_BOT_NEEDS_CLAUDE_TEXT. Unset: the failure is reported as is.
|
|
152
162
|
*/
|
|
153
163
|
botRuntime?: () => BotRuntimeId | null;
|
|
164
|
+
/**
|
|
165
|
+
* Told what the pass saw of the Claude login: true after a preflight that
|
|
166
|
+
* passed, false when the pass failed signed out. Unset: nothing is recorded.
|
|
167
|
+
* `hq bot` and `hq sources sync` pass `recordSignalsPassClaudeLogin` here
|
|
168
|
+
* (signals-claude-login.ts), which `hq bot status` reads. Must not throw.
|
|
169
|
+
*/
|
|
170
|
+
onClaudeLogin?: (signedIn: boolean) => void;
|
|
154
171
|
}
|
|
155
172
|
/** Why the pass sent claude the pointer alone. */
|
|
156
173
|
export type PayloadFallbackReason = "payload-out-of-bounds" | "payload-missing" | "payload-unreadable";
|
|
@@ -28,13 +28,27 @@ export class SignalsPassError extends Error {
|
|
|
28
28
|
this.code = code;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* How to sign Claude Code in for signals. The desktop app comes first: its
|
|
33
|
+
* Settings → AI tools pane lists Claude Code with one button: "Connect
|
|
34
|
+
* Claude" when the CLI is installed, "Install Claude" when it is not
|
|
35
|
+
* (hq-desktop-app-src packages/ui/src/settings/AgentsSettingsPane.svelte).
|
|
36
|
+
* The terminal command is the fallback.
|
|
37
|
+
*/
|
|
38
|
+
export const CLAUDE_SIGN_IN_STEPS = "Open HQ, go to Settings → AI tools, and use the Claude Code button there (Connect Claude, or Install Claude if it is not installed yet). " +
|
|
39
|
+
"Or run `claude auth login` in a terminal on this computer.";
|
|
40
|
+
/** Documents the pass could not run stay queued; said in every signed-out message. */
|
|
41
|
+
const QUEUED_DOCS_TEXT = "The documents waiting for signals stay queued and run once Claude Code is signed in.";
|
|
31
42
|
/**
|
|
32
43
|
* What the owner of a Codex main bot is told when this pass finds claude
|
|
33
44
|
* missing or signed out. The pass always runs Claude Code, whatever the main
|
|
34
45
|
* bot runs.
|
|
35
46
|
*/
|
|
36
47
|
export const CODEX_BOT_NEEDS_CLAUDE_TEXT = "Your main bot runs on Codex, but signals from hot-channel sync need Claude Code, which is not installed or not signed in on this computer. " +
|
|
37
|
-
|
|
48
|
+
`${CLAUDE_SIGN_IN_STEPS} ${QUEUED_DOCS_TEXT}`;
|
|
49
|
+
/** What the owner is told when this pass finds claude signed out on any other bot. */
|
|
50
|
+
export const CLAUDE_SIGNED_OUT_TEXT = "Signals from hot-channel sync need Claude Code, which is not signed in on this computer. " +
|
|
51
|
+
`${CLAUDE_SIGN_IN_STEPS} ${QUEUED_DOCS_TEXT}`;
|
|
38
52
|
/** Signal types the pass accepts; the same type folders existing signals use. */
|
|
39
53
|
export const SIGNAL_TYPES = [
|
|
40
54
|
"action_item",
|
|
@@ -574,7 +588,19 @@ export function createClaudeSignalsPass(options) {
|
|
|
574
588
|
return false;
|
|
575
589
|
}
|
|
576
590
|
};
|
|
591
|
+
const tellLogin = (signedIn) => {
|
|
592
|
+
try {
|
|
593
|
+
options.onClaudeLogin?.(signedIn);
|
|
594
|
+
}
|
|
595
|
+
catch {
|
|
596
|
+
// A report only; it never changes the pass's outcome.
|
|
597
|
+
}
|
|
598
|
+
};
|
|
577
599
|
const checkLogin = async () => {
|
|
600
|
+
await checkLoginOnce();
|
|
601
|
+
tellLogin(true);
|
|
602
|
+
};
|
|
603
|
+
const checkLoginOnce = async () => {
|
|
578
604
|
const run = await runBounded(claude, ["auth", "status"], { timeoutMs: authTimeoutMs, cwd: claudeCwd, env });
|
|
579
605
|
if (run.timedOut)
|
|
580
606
|
throw new SignalsPassError("claude-timeout", "claude auth status timed out");
|
|
@@ -866,8 +892,10 @@ export function createClaudeSignalsPass(options) {
|
|
|
866
892
|
}
|
|
867
893
|
catch (caught) {
|
|
868
894
|
let err = caught;
|
|
869
|
-
if (err instanceof SignalsPassError && err.code === "claude-logged-out"
|
|
870
|
-
|
|
895
|
+
if (err instanceof SignalsPassError && err.code === "claude-logged-out") {
|
|
896
|
+
tellLogin(false);
|
|
897
|
+
if (codexBot())
|
|
898
|
+
err = new SignalsPassError("claude-logged-out-codex-bot", CODEX_BOT_NEEDS_CLAUDE_TEXT);
|
|
871
899
|
}
|
|
872
900
|
if (err instanceof SignalsPassError) {
|
|
873
901
|
err.written = progress.written;
|
|
@@ -567,6 +567,10 @@ function invocationBin(invocation) {
|
|
|
567
567
|
function invocationKey(invocation) {
|
|
568
568
|
return [invocation.command, ...invocation.prefixArgs].join('');
|
|
569
569
|
}
|
|
570
|
+
/** Output cap for captured qmd stdout/stderr. Node's spawnSync default is 1 MiB,
|
|
571
|
+
* which overflowed as ENOBUFS on a ~189k-document index (`hq index status` /
|
|
572
|
+
* `hq index sync`, feedback_48c6252c). */
|
|
573
|
+
const QMD_SPAWN_MAX_BUFFER = 64 * 1024 * 1024;
|
|
570
574
|
/** Default low-level spawn: `spawnSync` with captured utf8 output. */
|
|
571
575
|
const defaultSpawn = (cmd, args, options) => {
|
|
572
576
|
const result = spawnSync(cmd, args, {
|
|
@@ -576,6 +580,7 @@ const defaultSpawn = (cmd, args, options) => {
|
|
|
576
580
|
timeout: options.timeout,
|
|
577
581
|
killSignal: options.killSignal,
|
|
578
582
|
shell: options.shell,
|
|
583
|
+
maxBuffer: QMD_SPAWN_MAX_BUFFER,
|
|
579
584
|
});
|
|
580
585
|
return {
|
|
581
586
|
status: result.status,
|
|
@@ -1096,7 +1101,12 @@ function finishRunQmd(result, bin, args, attribution) {
|
|
|
1096
1101
|
commandExists === false) {
|
|
1097
1102
|
throw new QmdBinaryMissingError(`Unable to execute qmd: its Node interpreter (${attribution.command}) could not be executed: ${normalized.error.message}`, diagnostics);
|
|
1098
1103
|
}
|
|
1099
|
-
// (c)
|
|
1104
|
+
// (c) OUTPUT BUFFER. spawnSync raises ENOBUFS when captured stdout/stderr
|
|
1105
|
+
// exceeds maxBuffer. That is not a missing qmd binary — the process ran.
|
|
1106
|
+
if (errnoCode === 'ENOBUFS') {
|
|
1107
|
+
throw new QmdBinaryMissingError(`qmd produced more output than hq index can buffer (${QMD_SPAWN_MAX_BUFFER} bytes, ENOBUFS). The search index is large; this is not a missing qmd binary.`, diagnostics);
|
|
1108
|
+
}
|
|
1109
|
+
// (d) RESIDUAL: an ENOENT the fix cannot attribute (a genuinely missing
|
|
1100
1110
|
// qmd, or a race where the directory/interpreter reappeared) or any other
|
|
1101
1111
|
// spawn errno (EACCES/EINVAL/…). Keep today's class and message byte-for-
|
|
1102
1112
|
// byte, and attach the bounded diagnostics so the next occurrence carries
|
|
@@ -441,6 +441,13 @@ export async function runSignals(opts) {
|
|
|
441
441
|
...(opts.isFlagOn ? { isFlagOn: opts.isFlagOn } : {}),
|
|
442
442
|
...(opts.registeredAdapterIds ? { registeredAdapterIds: opts.registeredAdapterIds } : {}),
|
|
443
443
|
...(redo.length > 0 ? { redo } : {}),
|
|
444
|
+
priorSteps: record.steps.map((s) => ({
|
|
445
|
+
name: s.name,
|
|
446
|
+
status: s.status,
|
|
447
|
+
...(s.skippedReason !== undefined ? { skippedReason: s.skippedReason } : {}),
|
|
448
|
+
...(s.adapterSkips ? { adapterSkips: { ...s.adapterSkips } } : {}),
|
|
449
|
+
...(s.adapterOutcomes ? { adapterOutcomes: { ...s.adapterOutcomes } } : {}),
|
|
450
|
+
})),
|
|
444
451
|
};
|
|
445
452
|
let stepRec;
|
|
446
453
|
const planner = stepImpls[name].dryRun;
|
|
@@ -69,7 +69,55 @@ export interface RunReplyOptions {
|
|
|
69
69
|
retryScheduled?: boolean;
|
|
70
70
|
/** This run was the automatic retry; a failure says no further retry follows. */
|
|
71
71
|
wasRetry?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The reply goes to the HQ desktop app (a local bot's owner DM), which opens
|
|
74
|
+
* `hq-desktop://brief` in place (hot-signal-sync US-023). The reply then
|
|
75
|
+
* links to today's brief instead of offering the "Create today's brief"
|
|
76
|
+
* decision. Unset (Fleet DMs, Slack, the terminal) keeps the decision and
|
|
77
|
+
* never writes an hq-desktop:// link.
|
|
78
|
+
*/
|
|
79
|
+
desktopLinks?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* This bot has a scheduled brief job (a jobs.json entry that runs
|
|
82
|
+
* /daily-brief on a schedule). hq-cli never starts the brief itself, so only
|
|
83
|
+
* then does a desktop reply say the brief builds next; otherwise it says to
|
|
84
|
+
* open the page to create it.
|
|
85
|
+
*/
|
|
86
|
+
briefJobScheduled?: boolean;
|
|
72
87
|
}
|
|
88
|
+
/** The in-app deep link the desktop app opens as the Daily Brief page (US-023). */
|
|
89
|
+
export declare const BRIEF_DEEP_LINK = "hq-desktop://brief";
|
|
90
|
+
/**
|
|
91
|
+
* The brief link line for desktop replies when a brief job is scheduled. The
|
|
92
|
+
* words after the link are the plain-text fallback for a client that shows
|
|
93
|
+
* the label without opening it.
|
|
94
|
+
*/
|
|
95
|
+
export declare const OPEN_BRIEF_LINK_LINE = "[Open today's brief](hq-desktop://brief), or find it on the Daily Brief page.";
|
|
96
|
+
/** The same line when no brief job is scheduled: the member creates the brief on that page. */
|
|
97
|
+
export declare const CREATE_BRIEF_LINK_LINE = "[Open today's brief](hq-desktop://brief) to create it, or find it on the Daily Brief page.";
|
|
98
|
+
/** Said before the link on a finished run, only when a brief job is scheduled. */
|
|
99
|
+
export declare const BRIEF_BUILDS_NEXT_LINE = "Your brief builds next.";
|
|
100
|
+
/** The retry decision's option id, and its label (the text a click sends back). */
|
|
101
|
+
export declare const TRY_NOW_OPTION_ID = "try-now";
|
|
102
|
+
export declare const TRY_NOW_LABEL = "Try now";
|
|
103
|
+
/**
|
|
104
|
+
* What a failed run means for today's brief, true on every channel: a failed
|
|
105
|
+
* signals run never blocks the Daily Brief. It does not promise that a brief
|
|
106
|
+
* runs (hq-cli never starts one, and many bots have no brief job), nor the
|
|
107
|
+
* brief's stale-signals notice (hq-core #1987, only in v16.0.48 betas so far).
|
|
108
|
+
*/
|
|
109
|
+
export declare const FAILED_RUN_BRIEF_LINE = "This does not stop your brief from building.";
|
|
110
|
+
/** The same for a finished-with-problems run, whose new signals the brief can use. */
|
|
111
|
+
export declare const PARTIAL_RUN_BRIEF_LINE = "This does not stop your brief from building with what came in.";
|
|
112
|
+
/** The open-brief decision's question when no brief job is known to be scheduled. */
|
|
113
|
+
export declare const CREATE_BRIEF_QUESTION = "Create today's brief now?";
|
|
114
|
+
/** The line a finished-with-problems reply ends with. */
|
|
115
|
+
export declare const SAY_TRY_NOW_LINE = "Say \"Try now\" to run signals again.";
|
|
116
|
+
/**
|
|
117
|
+
* True when the reply asks the member for "Try now": a decision with the
|
|
118
|
+
* try-now option (run failed), or the finished-with-problems line.
|
|
119
|
+
*/
|
|
120
|
+
export declare function replyOffersTryNow(reply: Pick<FormattedReply, "blocks">): boolean;
|
|
73
121
|
/** One fence, JSON on one line, not indented. */
|
|
74
122
|
export declare function hqBlockFence(blocks: ReplyBlock[]): string;
|
|
75
123
|
/** "6:02 AM" in the given zone. */
|
|
@@ -10,6 +10,46 @@
|
|
|
10
10
|
export const REPLY_BLOCK_KINDS = ["keyValue", "callout", "badge", "progress", "decision"];
|
|
11
11
|
export const REPLY_TONES = ["neutral", "info", "success", "warning", "danger"];
|
|
12
12
|
export const REPLY_ICONS = ["check", "clock", "folder", "calendar"];
|
|
13
|
+
/** The in-app deep link the desktop app opens as the Daily Brief page (US-023). */
|
|
14
|
+
export const BRIEF_DEEP_LINK = "hq-desktop://brief";
|
|
15
|
+
/**
|
|
16
|
+
* The brief link line for desktop replies when a brief job is scheduled. The
|
|
17
|
+
* words after the link are the plain-text fallback for a client that shows
|
|
18
|
+
* the label without opening it.
|
|
19
|
+
*/
|
|
20
|
+
export const OPEN_BRIEF_LINK_LINE = `[Open today's brief](${BRIEF_DEEP_LINK}), or find it on the Daily Brief page.`;
|
|
21
|
+
/** The same line when no brief job is scheduled: the member creates the brief on that page. */
|
|
22
|
+
export const CREATE_BRIEF_LINK_LINE = `[Open today's brief](${BRIEF_DEEP_LINK}) to create it, or find it on the Daily Brief page.`;
|
|
23
|
+
/** Said before the link on a finished run, only when a brief job is scheduled. */
|
|
24
|
+
export const BRIEF_BUILDS_NEXT_LINE = "Your brief builds next.";
|
|
25
|
+
function briefLinkLine(opts) {
|
|
26
|
+
return opts.briefJobScheduled ? OPEN_BRIEF_LINK_LINE : CREATE_BRIEF_LINK_LINE;
|
|
27
|
+
}
|
|
28
|
+
/** The retry decision's option id, and its label (the text a click sends back). */
|
|
29
|
+
export const TRY_NOW_OPTION_ID = "try-now";
|
|
30
|
+
export const TRY_NOW_LABEL = "Try now";
|
|
31
|
+
/**
|
|
32
|
+
* What a failed run means for today's brief, true on every channel: a failed
|
|
33
|
+
* signals run never blocks the Daily Brief. It does not promise that a brief
|
|
34
|
+
* runs (hq-cli never starts one, and many bots have no brief job), nor the
|
|
35
|
+
* brief's stale-signals notice (hq-core #1987, only in v16.0.48 betas so far).
|
|
36
|
+
*/
|
|
37
|
+
export const FAILED_RUN_BRIEF_LINE = "This does not stop your brief from building.";
|
|
38
|
+
/** The same for a finished-with-problems run, whose new signals the brief can use. */
|
|
39
|
+
export const PARTIAL_RUN_BRIEF_LINE = "This does not stop your brief from building with what came in.";
|
|
40
|
+
/** The open-brief decision's question when no brief job is known to be scheduled. */
|
|
41
|
+
export const CREATE_BRIEF_QUESTION = "Create today's brief now?";
|
|
42
|
+
/** The line a finished-with-problems reply ends with. */
|
|
43
|
+
export const SAY_TRY_NOW_LINE = `Say "${TRY_NOW_LABEL}" to run signals again.`;
|
|
44
|
+
/**
|
|
45
|
+
* True when the reply asks the member for "Try now": a decision with the
|
|
46
|
+
* try-now option (run failed), or the finished-with-problems line.
|
|
47
|
+
*/
|
|
48
|
+
export function replyOffersTryNow(reply) {
|
|
49
|
+
return reply.blocks.some((block) => block.kind === "decision"
|
|
50
|
+
? block.options.some((option) => option.id === TRY_NOW_OPTION_ID)
|
|
51
|
+
: block.kind === "callout" && block.body.includes(SAY_TRY_NOW_LINE));
|
|
52
|
+
}
|
|
13
53
|
/** One fence, JSON on one line, not indented. */
|
|
14
54
|
export function hqBlockFence(blocks) {
|
|
15
55
|
return "```hq-block\n" + JSON.stringify({ v: 1, blocks }) + "\n```";
|
|
@@ -136,15 +176,31 @@ function spendBlock(record) {
|
|
|
136
176
|
tone: "neutral",
|
|
137
177
|
};
|
|
138
178
|
}
|
|
139
|
-
|
|
179
|
+
/**
|
|
180
|
+
* The non-desktop brief decision. It says the brief builds next only when a
|
|
181
|
+
* brief job is known to be scheduled; otherwise it asks.
|
|
182
|
+
*/
|
|
183
|
+
function openBriefDecision(date, opts) {
|
|
140
184
|
return {
|
|
141
185
|
kind: "decision",
|
|
142
186
|
questionId: `signals-run-${date}-open-brief`,
|
|
143
|
-
question:
|
|
187
|
+
question: opts.briefJobScheduled ? BRIEF_BUILDS_NEXT_LINE : CREATE_BRIEF_QUESTION,
|
|
144
188
|
options: [{ id: "open-brief", label: "Create today's brief", recommended: true }],
|
|
145
189
|
allowOther: false,
|
|
146
190
|
};
|
|
147
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* How a finished run points at today's brief. Desktop: a second prose
|
|
194
|
+
* paragraph with the deep link and no decision; with `buildsNext` and a
|
|
195
|
+
* scheduled brief job it starts "Your brief builds next.". Elsewhere: the
|
|
196
|
+
* prose as it is and the "Create today's brief" decision.
|
|
197
|
+
*/
|
|
198
|
+
function briefPointer(prose, date, opts, buildsNext) {
|
|
199
|
+
if (!opts.desktopLinks)
|
|
200
|
+
return { prose, blocks: [openBriefDecision(date, opts)] };
|
|
201
|
+
const lead = buildsNext && opts.briefJobScheduled ? `${BRIEF_BUILDS_NEXT_LINE} ` : "";
|
|
202
|
+
return { prose: `${prose}\n\n${lead}${briefLinkLine(opts)}`, blocks: [] };
|
|
203
|
+
}
|
|
148
204
|
/** "a, b and c". */
|
|
149
205
|
function listInWords(parts) {
|
|
150
206
|
if (parts.length <= 1)
|
|
@@ -282,7 +338,7 @@ export function formatRunReply(record, summary, opts) {
|
|
|
282
338
|
: record.failureReason
|
|
283
339
|
? oneSentence(record.failureReason)
|
|
284
340
|
: `Signals for ${company} failed.`;
|
|
285
|
-
const brief =
|
|
341
|
+
const brief = FAILED_RUN_BRIEF_LINE;
|
|
286
342
|
const retryLine = retry
|
|
287
343
|
? `I try again at ${retry}.`
|
|
288
344
|
: opts.wasRetry
|
|
@@ -314,7 +370,7 @@ export function formatRunReply(record, summary, opts) {
|
|
|
314
370
|
questionId: `signals-run-${summary.date}-retry`,
|
|
315
371
|
question: "Try again now, or wait for the retry?",
|
|
316
372
|
options: [
|
|
317
|
-
{ id:
|
|
373
|
+
{ id: TRY_NOW_OPTION_ID, label: TRY_NOW_LABEL, recommended: true },
|
|
318
374
|
{ id: "wait", label: `Wait for ${retry}` },
|
|
319
375
|
],
|
|
320
376
|
allowOther: false,
|
|
@@ -323,10 +379,12 @@ export function formatRunReply(record, summary, opts) {
|
|
|
323
379
|
kind: "decision",
|
|
324
380
|
questionId: `signals-run-${summary.date}-retry`,
|
|
325
381
|
question: "Try again now?",
|
|
326
|
-
options: [{ id:
|
|
382
|
+
options: [{ id: TRY_NOW_OPTION_ID, label: TRY_NOW_LABEL, recommended: true }],
|
|
327
383
|
allowOther: false,
|
|
328
384
|
});
|
|
329
|
-
|
|
385
|
+
// The Try now decision stays; on desktop the prose also links today's brief.
|
|
386
|
+
const stoppedProse = `${job} stopped at ${finished}.`;
|
|
387
|
+
return build(opts.desktopLinks ? `${stoppedProse}\n\n${briefLinkLine(opts)}` : stoppedProse, blocks, "failed");
|
|
330
388
|
}
|
|
331
389
|
const counts = runCountItems(record, summary, opts);
|
|
332
390
|
const spend = spendBlock(record);
|
|
@@ -358,22 +416,25 @@ export function formatRunReply(record, summary, opts) {
|
|
|
358
416
|
? partialReasonInWords(partialReason)
|
|
359
417
|
: null;
|
|
360
418
|
const guidance = failureGuidance(record, failedStep, company);
|
|
361
|
-
const body = [guidance.main, ...(guidance.note ? [guidance.note] : []),
|
|
362
|
-
|
|
419
|
+
const body = [guidance.main, ...(guidance.note ? [guidance.note] : []), `${PARTIAL_RUN_BRIEF_LINE} ${SAY_TRY_NOW_LINE}`].join(" ");
|
|
420
|
+
const brief = briefPointer(`${job} finished with problems at ${finished}.`, summary.date, opts, false);
|
|
421
|
+
return build(brief.prose, [
|
|
363
422
|
{ kind: "badge", label: "Finished with problems", tone: "warning" },
|
|
364
423
|
...(record.catchUp ? [catchUpBadge] : []),
|
|
365
424
|
title ? { kind: "callout", tone: "warning", title, body } : { kind: "callout", tone: "warning", body },
|
|
366
425
|
...tail,
|
|
367
|
-
|
|
426
|
+
...brief.blocks,
|
|
368
427
|
], "partial");
|
|
369
428
|
}
|
|
370
429
|
if (record.catchUp) {
|
|
371
430
|
const prose = due
|
|
372
431
|
? `${job} finished at ${finished} instead of ${due}. Your Mac was asleep at ${due}, so I ran it when it woke.`
|
|
373
432
|
: `${job} finished at ${finished}, later than scheduled. Your Mac was asleep, so I ran it when it woke.`;
|
|
374
|
-
|
|
433
|
+
const brief = briefPointer(prose, summary.date, opts, true);
|
|
434
|
+
return build(brief.prose, [catchUpBadge, ...tail, ...brief.blocks], "catch-up");
|
|
375
435
|
}
|
|
376
|
-
|
|
436
|
+
const brief = briefPointer(`${job} finished at ${finished}.`, summary.date, opts, true);
|
|
437
|
+
return build(brief.prose, [{ kind: "badge", label: "Complete", tone: "success", icon: "check" }, ...tail, ...brief.blocks], "complete");
|
|
377
438
|
}
|
|
378
439
|
/** Another run holds the company's lock (engine exit 3): nothing was started. */
|
|
379
440
|
export function formatLockedReply(locked, opts) {
|
|
@@ -31,6 +31,7 @@ export function mapSyncReport(report) {
|
|
|
31
31
|
const byAdapter = {};
|
|
32
32
|
const itemsInByAdapter = {};
|
|
33
33
|
const tokenLevels = {};
|
|
34
|
+
const adapterOutcomes = {};
|
|
34
35
|
let itemsIn = 0;
|
|
35
36
|
let itemsOut = 0;
|
|
36
37
|
let ok = 0;
|
|
@@ -44,6 +45,9 @@ export function mapSyncReport(report) {
|
|
|
44
45
|
if (o.tokenLevel && TOKEN_LEVEL_ADAPTERS.has(o.adapter) && tokenLevels[o.adapter] !== "workspace") {
|
|
45
46
|
tokenLevels[o.adapter] = o.tokenLevel;
|
|
46
47
|
}
|
|
48
|
+
const seen = adapterOutcomes[o.adapter];
|
|
49
|
+
if (seen === undefined || o.status === "failed" || (o.status === "ok" && seen !== "failed"))
|
|
50
|
+
adapterOutcomes[o.adapter] = o.status;
|
|
47
51
|
itemsIn += o.landed + o.duplicates;
|
|
48
52
|
itemsOut += o.landed;
|
|
49
53
|
if (o.status === "ok")
|
|
@@ -58,6 +62,8 @@ export function mapSyncReport(report) {
|
|
|
58
62
|
result.itemsInByAdapter = itemsInByAdapter;
|
|
59
63
|
if (Object.keys(tokenLevels).length > 0)
|
|
60
64
|
result.tokenLevels = tokenLevels;
|
|
65
|
+
if (Object.keys(adapterOutcomes).length > 0)
|
|
66
|
+
result.adapterOutcomes = adapterOutcomes;
|
|
61
67
|
if (report.outcomes.length === 0) {
|
|
62
68
|
result.status = "skipped";
|
|
63
69
|
result.skippedReason = "no-channels";
|