@indigoai-us/hq-cli 5.345.236 → 5.345.238
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 +46 -0
- package/dist/command-catalog.generated.d.ts +1 -1
- package/dist/command-catalog.generated.js +1 -1
- package/dist/commands/bot.d.ts +2 -0
- package/dist/commands/bot.js +32 -0
- package/dist/commands/daemon.d.ts +1 -0
- package/dist/commands/daemon.js +70 -6
- package/dist/commands/deploy-app-db.js +4 -19
- package/dist/commands/deploy-app-upload.js +66 -40
- package/dist/commands/deploy-mutations.js +24 -16
- package/dist/commands/deploy-runtime-bindings.js +7 -26
- package/dist/commands/deploy-ssr.js +5 -24
- package/dist/commands/mesh.js +6 -2
- package/dist/commands/signals-run.d.ts +43 -2
- package/dist/commands/signals-run.js +85 -7
- package/dist/commands/sync-core.d.ts +7 -0
- package/dist/commands/sync-core.js +52 -3
- package/dist/lib/agent-kit/inbox-state.d.ts +2 -1
- package/dist/lib/agent-kit/inbox-state.js +27 -3
- package/dist/lib/bot/continuity.d.ts +21 -2
- package/dist/lib/bot/continuity.js +48 -19
- package/dist/lib/bot/fleet-cron.js +6 -0
- package/dist/lib/bot/fleet-local.d.ts +11 -1
- package/dist/lib/bot/fleet-local.js +21 -1
- package/dist/lib/bot/fleet-state.d.ts +129 -0
- package/dist/lib/bot/fleet-state.js +669 -0
- package/dist/lib/bot/promote.d.ts +32 -3
- package/dist/lib/bot/promote.js +188 -16
- package/dist/lib/bot/promotion-hold-reconcile.d.ts +56 -0
- package/dist/lib/bot/promotion-hold-reconcile.js +155 -0
- package/dist/lib/daemon/catalog.d.ts +13 -0
- package/dist/lib/daemon/catalog.js +32 -6
- package/dist/lib/daemon/lanes-reconcile-status.d.ts +0 -4
- package/dist/lib/daemon/lanes-reconcile-status.js +2 -12
- package/dist/lib/daemon/lanes-reconcile-watcher.d.ts +1 -1
- package/dist/lib/daemon/lanes-reconcile-watcher.js +2 -1
- package/dist/lib/daemon/legacy-handover.d.ts +38 -0
- package/dist/lib/daemon/legacy-handover.js +117 -0
- package/dist/lib/daemon/mesh-owner.js +2 -1
- package/dist/lib/daemon/run.d.ts +35 -2
- package/dist/lib/daemon/run.js +108 -15
- package/dist/lib/daemon/selfcheck.d.ts +28 -0
- package/dist/lib/daemon/selfcheck.js +86 -15
- package/dist/lib/deploy-api.d.ts +1 -1
- package/dist/lib/deploy-api.js +2 -1
- package/dist/lib/deploy-identity.d.ts +18 -0
- package/dist/lib/deploy-identity.js +179 -0
- package/dist/lib/hot-channels/alert.js +13 -6
- package/dist/lib/hot-channels/fleet-complete.d.ts +89 -0
- package/dist/lib/hot-channels/fleet-complete.js +157 -0
- package/dist/lib/hot-channels/run.js +2 -1
- package/dist/lib/hot-channels/signals-claude-login.d.ts +3 -2
- package/dist/lib/hot-channels/signals-claude-login.js +6 -1
- package/dist/lib/hot-channels/signals-pass-failure.d.ts +29 -0
- package/dist/lib/hot-channels/signals-pass-failure.js +36 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +49 -2
- package/dist/lib/hot-channels/signals-pass.js +188 -12
- package/dist/lib/hot-channels/signals-runtime.d.ts +6 -3
- package/dist/lib/hot-channels/signals-runtime.js +11 -2
- package/dist/lib/lanes/reconcile-result.d.ts +5 -0
- package/dist/lib/lanes/reconcile-result.js +20 -2
- package/dist/lib/lanes/reconcile.js +12 -3
- package/dist/lib/mesh/live/emit.js +25 -6
- package/dist/lib/mesh/live/flush.js +119 -15
- package/dist/lib/mesh/live/reporting-privacy.d.ts +41 -0
- package/dist/lib/mesh/live/reporting-privacy.js +147 -1
- package/dist/lib/mesh/live/spool.d.ts +16 -0
- package/dist/lib/mesh/live/spool.js +45 -0
- package/dist/lib/signals/engine.d.ts +17 -3
- package/dist/lib/signals/engine.js +28 -9
- package/dist/lib/signals/failure-alert.d.ts +33 -1
- package/dist/lib/signals/failure-alert.js +72 -5
- package/dist/lib/signals/owner-notice.d.ts +94 -0
- package/dist/lib/signals/owner-notice.js +233 -0
- package/dist/lib/signals/reply.d.ts +7 -0
- package/dist/lib/signals/reply.js +23 -3
- package/dist/lib/signals/steps/adapters.d.ts +51 -2
- package/dist/lib/signals/steps/adapters.js +213 -7
- package/dist/lib/signals/steps/extract.js +18 -4
- package/dist/lib/signals/steps/types.d.ts +63 -1
- package/dist/lib/signals/steps/types.js +32 -0
- package/dist/lib/sync-core/engine-auth.d.ts +35 -0
- package/dist/lib/sync-core/engine-auth.js +96 -0
- package/dist/lib/sync-core/engine-home.d.ts +6 -0
- package/dist/lib/sync-core/engine-home.js +12 -0
- package/dist/lib/sync-core/rollout-state.d.ts +1 -0
- package/dist/lib/sync-core/rollout-state.js +3 -0
- package/dist/lib/vault-sync-switches.d.ts +7 -0
- package/dist/lib/vault-sync-switches.js +56 -0
- package/dist/lib/work-context/errors.d.ts +12 -0
- package/dist/lib/work-context/errors.js +15 -0
- package/dist/lib/work-context/organize.js +6 -1
- package/dist/lib/work-context/reconcile.js +20 -1
- package/dist/utils/resident-package-preload.js +34 -4
- package/docs/anywhere-runtime.md +6 -0
- package/package.json +7 -7
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The signals pass on an HQ Fleet Executive bot's own login.
|
|
3
|
+
*
|
|
4
|
+
* An HQ Fleet bot answers chat with the login its runtime resolves for it: its
|
|
5
|
+
* own sign-in, or the person's Claude or ChatGPT subscription sign-in when its
|
|
6
|
+
* login is "default". `hq-fleet-local complete` (hq-fleet-local,
|
|
7
|
+
* single-turn completion) makes one locked-down model turn with exactly that
|
|
8
|
+
* login: prompt on stdin, no tools, memory, context files or session, one
|
|
9
|
+
* request, one JSON object out. It never uses an API key (`api_key_login`).
|
|
10
|
+
*
|
|
11
|
+
* So the pass needs no `claude auth login` of its own: if the bot can chat,
|
|
12
|
+
* signals can run. This is the default for a Claude or Codex Fleet Executive
|
|
13
|
+
* bot. The pass falls back to the `claude` CLI only when the helper is
|
|
14
|
+
* missing: the bot is not a Claude or Codex Fleet bot, its helper is not
|
|
15
|
+
* installed, or the installed helper release has no `complete` command yet.
|
|
16
|
+
*
|
|
17
|
+
* Policy: hq-signals-pass-codex-exec-narrow-exception point 3 (owner decision
|
|
18
|
+
* 2026-11-15, widened to this Fleet turn; owner instruction 2026-11-18 that the
|
|
19
|
+
* turn uses the bot's own login). The turn's lockdown lives in the helper; this
|
|
20
|
+
* module only names the bot and its profile, sends the prompt on stdin, and
|
|
21
|
+
* reads the one JSON line back. The reply text is model output built from the
|
|
22
|
+
* document, so it is parsed and never logged.
|
|
23
|
+
*/
|
|
24
|
+
import { readBotConfig, HQ_FLEET_RUNTIME_ENGINE_ID } from "../bot/config.js";
|
|
25
|
+
import { fleetLocalHelper } from "../bot/fleet-local.js";
|
|
26
|
+
/** Largest prompt the helper accepts (its hard limit, 1 MiB). */
|
|
27
|
+
export const FLEET_COMPLETE_MAX_PROMPT_BYTES = 1024 * 1024;
|
|
28
|
+
/** The helper's own `--timeout` ceiling, in seconds. */
|
|
29
|
+
const FLEET_COMPLETE_MAX_TIMEOUT_S = 600;
|
|
30
|
+
/** Time the helper gets on top of its own timeout to start, kill its worker and answer. */
|
|
31
|
+
const FLEET_COMPLETE_GRACE_MS = 20_000;
|
|
32
|
+
/**
|
|
33
|
+
* The Fleet target for the bot in `dir`, or null when the pass should keep
|
|
34
|
+
* today's `claude` CLI path: no readable bot.json, not an HQ Fleet bot, or its
|
|
35
|
+
* profile, runtime or helper is not installed on this computer.
|
|
36
|
+
*/
|
|
37
|
+
export function fleetCompleteTargetFor(config, deps = {}) {
|
|
38
|
+
if (!config || config.engine?.id !== HQ_FLEET_RUNTIME_ENGINE_ID)
|
|
39
|
+
return null;
|
|
40
|
+
// Claude and Codex bots only. `complete` answers a Grok profile (its
|
|
41
|
+
// chat_completions transport has no one-request guard there yet) with
|
|
42
|
+
// invalid_profile, so a Grok Executive bot keeps today's claude CLI path.
|
|
43
|
+
if (config.runtime !== "claude" && config.runtime !== "codex")
|
|
44
|
+
return null;
|
|
45
|
+
if (typeof config.agentUid !== "string" || !/^agt_[A-Za-z0-9_-]+$/.test(config.agentUid))
|
|
46
|
+
return null;
|
|
47
|
+
const installed = fleetLocalHelper(config.agentUid, deps);
|
|
48
|
+
if (!installed)
|
|
49
|
+
return null;
|
|
50
|
+
return {
|
|
51
|
+
helper: installed.helper,
|
|
52
|
+
profileDir: installed.profileDir,
|
|
53
|
+
botId: config.agentUid,
|
|
54
|
+
runtime: config.runtime,
|
|
55
|
+
botName: config.name,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** fleetCompleteTargetFor for the bot folder `dir`, read when the pass asks. */
|
|
59
|
+
export function fleetCompleteTarget(dir) {
|
|
60
|
+
return fleetCompleteTargetFor(readBotConfig(dir));
|
|
61
|
+
}
|
|
62
|
+
/** argv for one completion. The prompt never goes on argv. */
|
|
63
|
+
export function fleetCompleteArgs(target, timeoutMs) {
|
|
64
|
+
const seconds = Math.min(FLEET_COMPLETE_MAX_TIMEOUT_S, Math.max(1, Math.ceil(timeoutMs / 1000)));
|
|
65
|
+
return [
|
|
66
|
+
"complete",
|
|
67
|
+
"--profile",
|
|
68
|
+
target.profileDir,
|
|
69
|
+
"--bot-id",
|
|
70
|
+
target.botId,
|
|
71
|
+
"--timeout",
|
|
72
|
+
String(seconds),
|
|
73
|
+
"--max-prompt-bytes",
|
|
74
|
+
String(FLEET_COMPLETE_MAX_PROMPT_BYTES),
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
const ERROR_CODES = new Set([
|
|
78
|
+
"invalid_request",
|
|
79
|
+
"too_large",
|
|
80
|
+
"invalid_profile",
|
|
81
|
+
"signed_out",
|
|
82
|
+
"api_key_login",
|
|
83
|
+
"rate_limited",
|
|
84
|
+
"out_of_usage",
|
|
85
|
+
"provider_error",
|
|
86
|
+
"empty_response",
|
|
87
|
+
"timeout",
|
|
88
|
+
"runtime_unavailable",
|
|
89
|
+
"internal_error",
|
|
90
|
+
]);
|
|
91
|
+
/** An argparse refusal of the `complete` subcommand: a helper release from before it. */
|
|
92
|
+
const NO_COMPLETE_COMMAND = /invalid choice: '?complete'?/;
|
|
93
|
+
/**
|
|
94
|
+
* Run one completion. Reads only the helper's single JSON line; stderr is used
|
|
95
|
+
* only to tell an older helper (no `complete` command) from a failure.
|
|
96
|
+
*/
|
|
97
|
+
export async function runFleetComplete(target, prompt, options) {
|
|
98
|
+
const run = await options.run(target.helper, fleetCompleteArgs(target, options.timeoutMs), {
|
|
99
|
+
timeoutMs: options.timeoutMs + FLEET_COMPLETE_GRACE_MS,
|
|
100
|
+
input: prompt,
|
|
101
|
+
cwd: options.cwd,
|
|
102
|
+
env: options.env,
|
|
103
|
+
});
|
|
104
|
+
if (run.spawnError !== undefined)
|
|
105
|
+
return { kind: "missing", reason: "the hq-fleet-local helper could not start" };
|
|
106
|
+
if (run.timedOut)
|
|
107
|
+
return { kind: "error", code: "timeout", timedOut: true };
|
|
108
|
+
const lines = run.stdout.split("\n").filter((line) => line.trim().length > 0);
|
|
109
|
+
let payload;
|
|
110
|
+
if (lines.length === 1) {
|
|
111
|
+
try {
|
|
112
|
+
payload = JSON.parse(lines[0]);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
payload = undefined;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (payload === undefined) {
|
|
119
|
+
if (run.code === 2 && NO_COMPLETE_COMMAND.test(run.stderr)) {
|
|
120
|
+
return { kind: "missing", reason: "the installed hq-fleet-local has no complete command" };
|
|
121
|
+
}
|
|
122
|
+
return { kind: "error", code: "unknown" };
|
|
123
|
+
}
|
|
124
|
+
const value = payload;
|
|
125
|
+
if (run.code === 0 && typeof value.text === "string")
|
|
126
|
+
return { kind: "text", text: value.text };
|
|
127
|
+
const code = value.error && typeof value.error.code === "string" ? value.error.code : "";
|
|
128
|
+
return { kind: "error", code: ERROR_CODES.has(code) ? code : "unknown" };
|
|
129
|
+
}
|
|
130
|
+
/** The pass's failure class for a helper error code. */
|
|
131
|
+
export function fleetFailureClass(code) {
|
|
132
|
+
switch (code) {
|
|
133
|
+
case "signed_out":
|
|
134
|
+
case "api_key_login":
|
|
135
|
+
return "logged-out";
|
|
136
|
+
case "rate_limited":
|
|
137
|
+
case "out_of_usage":
|
|
138
|
+
return "usage-limit";
|
|
139
|
+
case "timeout":
|
|
140
|
+
return "timeout";
|
|
141
|
+
case "empty_response":
|
|
142
|
+
return "bad-output";
|
|
143
|
+
default:
|
|
144
|
+
return "provider-error";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/** A log-safe message for a helper error: the code and the fix, never provider text. */
|
|
148
|
+
export function fleetFailureMessage(target, code, detail) {
|
|
149
|
+
if (code === "signed_out") {
|
|
150
|
+
return `${target.botName}'s own model login is not usable (hq-fleet-local complete: signed_out). Signals run on the login ${target.botName} answers chat with; sign ${target.botName} in again (hq bot auth ${target.botName}) and the queued documents run on the next pass`;
|
|
151
|
+
}
|
|
152
|
+
if (code === "api_key_login") {
|
|
153
|
+
return `${target.botName} signs in with an API key, and signals run only on a subscription sign-in (hq-fleet-local complete: api_key_login). Sign ${target.botName} in with a Claude or ChatGPT subscription (hq bot auth ${target.botName})`;
|
|
154
|
+
}
|
|
155
|
+
return `hq-fleet-local complete failed (${code})${detail}`;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=fleet-complete.js.map
|
|
@@ -19,6 +19,7 @@ import { createVaultCursorStore } from "./cursors.js";
|
|
|
19
19
|
import { cursorFilePath } from "./cursors.js";
|
|
20
20
|
import { runHotChannelSync } from "./ledger.js";
|
|
21
21
|
import { connectionSelection, meetingsSelection } from "./selection.js";
|
|
22
|
+
import { SIGNALS_PASS_FAILED_PREFIX } from "./signals-pass-failure.js";
|
|
22
23
|
/** Token-scope providers served from the HQ vault: no external connection. */
|
|
23
24
|
/**
|
|
24
25
|
* The bare, lowercased provider id used to match a connection against a
|
|
@@ -340,7 +341,7 @@ export async function runOnDemandSync(input) {
|
|
|
340
341
|
status: failed || passFailure !== null ? "failed" : "ok",
|
|
341
342
|
landed: result?.landed ?? 0,
|
|
342
343
|
duplicates: result?.duplicates ?? 0,
|
|
343
|
-
message: result?.error?.message ?? (passFailure !== null ?
|
|
344
|
+
message: result?.error?.message ?? (passFailure !== null ? `${SIGNALS_PASS_FAILED_PREFIX}${passFailure}` : null),
|
|
344
345
|
};
|
|
345
346
|
if (p.app)
|
|
346
347
|
outcome.tokenLevel = tokenLevelOf(p.app);
|
|
@@ -17,6 +17,7 @@ export interface SignalsClaudeLogin {
|
|
|
17
17
|
signedIn: boolean;
|
|
18
18
|
checkedAt: string;
|
|
19
19
|
source: SignalsClaudeLoginSource;
|
|
20
|
+
loginRoute?: "claude-cli";
|
|
20
21
|
/** When the login was first seen signed out, while it still is. */
|
|
21
22
|
signedOutSince?: string;
|
|
22
23
|
}
|
|
@@ -27,7 +28,7 @@ export declare function readSignalsClaudeLogin(file?: string): SignalsClaudeLogi
|
|
|
27
28
|
* Record what a pass just saw. Never throws: the record is a report, and a
|
|
28
29
|
* failed write must not fail a signals run.
|
|
29
30
|
*/
|
|
30
|
-
export declare function recordSignalsClaudeLogin(signedIn: boolean, now?: () => Date, file?: string): void;
|
|
31
|
+
export declare function recordSignalsClaudeLogin(signedIn: boolean | null, now?: () => Date, file?: string): void;
|
|
31
32
|
/** One live `claude auth status` answer for `hq bot status`. */
|
|
32
33
|
export interface ClaudeLoginNow {
|
|
33
34
|
/** null when the check could not tell (`error` says why). */
|
|
@@ -49,5 +50,5 @@ export declare function checkClaudeLoginNow(options?: {
|
|
|
49
50
|
now?: () => Date;
|
|
50
51
|
}): Promise<ClaudeLoginNow>;
|
|
51
52
|
/** The `onClaudeLogin` reporter `hq sources sync` and `hq bot` give the signals pass. */
|
|
52
|
-
export declare function recordSignalsPassClaudeLogin(signedIn: boolean): void;
|
|
53
|
+
export declare function recordSignalsPassClaudeLogin(signedIn: boolean | null): void;
|
|
53
54
|
//# sourceMappingURL=signals-claude-login.d.ts.map
|
|
@@ -31,6 +31,7 @@ export function readSignalsClaudeLogin(file = signalsClaudeLoginPath()) {
|
|
|
31
31
|
signedIn: parsed.signedIn,
|
|
32
32
|
checkedAt: parsed.checkedAt,
|
|
33
33
|
source: "signals-pass",
|
|
34
|
+
...(parsed.loginRoute === "claude-cli" ? { loginRoute: "claude-cli" } : {}),
|
|
34
35
|
...(!parsed.signedIn && typeof parsed.signedOutSince === "string" ? { signedOutSince: parsed.signedOutSince } : {}),
|
|
35
36
|
};
|
|
36
37
|
}
|
|
@@ -45,10 +46,14 @@ export function readSignalsClaudeLogin(file = signalsClaudeLoginPath()) {
|
|
|
45
46
|
*/
|
|
46
47
|
export function recordSignalsClaudeLogin(signedIn, now = () => new Date(), file = signalsClaudeLoginPath()) {
|
|
47
48
|
try {
|
|
49
|
+
if (signedIn === null) {
|
|
50
|
+
fs.rmSync(file, { force: true });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
48
53
|
const at = now().toISOString();
|
|
49
54
|
const previous = readSignalsClaudeLogin(file);
|
|
50
55
|
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 } : {}) };
|
|
56
|
+
const record = { loginRoute: "claude-cli", v: 1, signedIn, checkedAt: at, source: "signals-pass", ...(signedOutSince ? { signedOutSince } : {}) };
|
|
52
57
|
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
53
58
|
const tmp = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
54
59
|
fs.writeFileSync(tmp, `${JSON.stringify(record, null, 2)}\n`, { mode: 0o600 });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a hot-channel sync reports a signals pass that failed after its adapter
|
|
3
|
+
* landed sources, and which pass failures mean the tool is signed out.
|
|
4
|
+
*
|
|
5
|
+
* This module imports nothing, on purpose. `signals/steps/adapters.ts` reads
|
|
6
|
+
* these values, and it must not statically import `alert.ts`, `run.ts` or
|
|
7
|
+
* `signals-pass.ts`: those reach `bot/jobs/hot-signal-sync.ts`, which imports
|
|
8
|
+
* the signals engine, which reads the adapters step while it loads.
|
|
9
|
+
*/
|
|
10
|
+
/** Signals from hot-channel sync run on Claude Code, which is missing or signed out here. */
|
|
11
|
+
export declare const CLAUDE_SIGNED_OUT_CODE = "claude-logged-out";
|
|
12
|
+
/** The same, on a computer whose main bot runs on Codex and has not opted signals in to it. */
|
|
13
|
+
export declare const CODEX_BOT_NEEDS_CLAUDE_CODE = "claude-logged-out-codex-bot";
|
|
14
|
+
/** Signals run on the bot's Codex, which is missing or signed out here. */
|
|
15
|
+
export declare const CODEX_SIGNED_OUT_CODE = "codex-logged-out";
|
|
16
|
+
/** Pass failures that mean the tool signals run on (Claude Code, or a Codex bot's Codex) is signed out or missing on this computer. */
|
|
17
|
+
export declare const SIGNED_OUT_SIGNALS_CODES: ReadonlySet<string>;
|
|
18
|
+
/** How a `failed` sync outcome's message starts when the adapter landed its sources and the signals pass then failed. */
|
|
19
|
+
export declare const SIGNALS_PASS_FAILED_PREFIX = "signals pass failed: ";
|
|
20
|
+
/**
|
|
21
|
+
* The signals pass failure behind a `failed` sync outcome (a
|
|
22
|
+
* `SignalsPassErrorCode`, or another error's message), or null when the
|
|
23
|
+
* adapter itself failed or the outcome did not fail.
|
|
24
|
+
*/
|
|
25
|
+
export declare function signalsPassFailureOf(outcome: {
|
|
26
|
+
status: string;
|
|
27
|
+
message: string | null;
|
|
28
|
+
}): string | null;
|
|
29
|
+
//# sourceMappingURL=signals-pass-failure.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a hot-channel sync reports a signals pass that failed after its adapter
|
|
3
|
+
* landed sources, and which pass failures mean the tool is signed out.
|
|
4
|
+
*
|
|
5
|
+
* This module imports nothing, on purpose. `signals/steps/adapters.ts` reads
|
|
6
|
+
* these values, and it must not statically import `alert.ts`, `run.ts` or
|
|
7
|
+
* `signals-pass.ts`: those reach `bot/jobs/hot-signal-sync.ts`, which imports
|
|
8
|
+
* the signals engine, which reads the adapters step while it loads.
|
|
9
|
+
*/
|
|
10
|
+
/** Signals from hot-channel sync run on Claude Code, which is missing or signed out here. */
|
|
11
|
+
export const CLAUDE_SIGNED_OUT_CODE = "claude-logged-out";
|
|
12
|
+
/** The same, on a computer whose main bot runs on Codex and has not opted signals in to it. */
|
|
13
|
+
export const CODEX_BOT_NEEDS_CLAUDE_CODE = "claude-logged-out-codex-bot";
|
|
14
|
+
/** Signals run on the bot's Codex, which is missing or signed out here. */
|
|
15
|
+
export const CODEX_SIGNED_OUT_CODE = "codex-logged-out";
|
|
16
|
+
/** Pass failures that mean the tool signals run on (Claude Code, or a Codex bot's Codex) is signed out or missing on this computer. */
|
|
17
|
+
export const SIGNED_OUT_SIGNALS_CODES = new Set([
|
|
18
|
+
"bot-logged-out",
|
|
19
|
+
"bot-api-key-login",
|
|
20
|
+
CLAUDE_SIGNED_OUT_CODE,
|
|
21
|
+
CODEX_BOT_NEEDS_CLAUDE_CODE,
|
|
22
|
+
CODEX_SIGNED_OUT_CODE,
|
|
23
|
+
]);
|
|
24
|
+
/** How a `failed` sync outcome's message starts when the adapter landed its sources and the signals pass then failed. */
|
|
25
|
+
export const SIGNALS_PASS_FAILED_PREFIX = "signals pass failed: ";
|
|
26
|
+
/**
|
|
27
|
+
* The signals pass failure behind a `failed` sync outcome (a
|
|
28
|
+
* `SignalsPassErrorCode`, or another error's message), or null when the
|
|
29
|
+
* adapter itself failed or the outcome did not fail.
|
|
30
|
+
*/
|
|
31
|
+
export function signalsPassFailureOf(outcome) {
|
|
32
|
+
if (outcome.status !== "failed" || !outcome.message?.startsWith(SIGNALS_PASS_FAILED_PREFIX))
|
|
33
|
+
return null;
|
|
34
|
+
return outcome.message.slice(SIGNALS_PASS_FAILED_PREFIX.length);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=signals-pass-failure.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BotRuntimeId } from "../bot/config.js";
|
|
2
2
|
import { type SpawnLike } from "../bot/runtime/index.js";
|
|
3
3
|
import type { HotChannelRunResult, WriteGuard } from "./loop.js";
|
|
4
|
+
import { type FleetCompleteTarget } from "./fleet-complete.js";
|
|
4
5
|
/** The tools the pass can run on. */
|
|
5
6
|
export type SignalsRuntimeId = "claude" | "codex";
|
|
6
7
|
/** What went wrong, whatever the tool. */
|
|
@@ -18,7 +19,7 @@ export type SignalsFailureClass = "usage-limit" | "logged-out" | "timeout" | "pr
|
|
|
18
19
|
* bot runs on Codex, and signals still run on Claude Code because the bot
|
|
19
20
|
* has not opted in (see CODEX_BOT_NEEDS_CLAUDE_TEXT).
|
|
20
21
|
*/
|
|
21
|
-
export type SignalsPassErrorCode = `${SignalsRuntimeId}-${SignalsFailureClass}` | "claude-logged-out-codex-bot";
|
|
22
|
+
export type SignalsPassErrorCode = `${SignalsRuntimeId}-${SignalsFailureClass}` | "claude-logged-out-codex-bot" | "bot-logged-out" | "bot-api-key-login";
|
|
22
23
|
/**
|
|
23
24
|
* A pass failure the run ledger records as `status: failed` with `error` set
|
|
24
25
|
* to the code. Any other error thrown from the pass is a crash.
|
|
@@ -41,6 +42,8 @@ export declare class SignalsPassError extends Error {
|
|
|
41
42
|
* The terminal command is the fallback.
|
|
42
43
|
*/
|
|
43
44
|
export declare const CLAUDE_SIGN_IN_STEPS: string;
|
|
45
|
+
export declare const BOT_SIGNED_OUT_TEXT = "The Executive bot's own login needs renewing. Open its profile in HQ, go to Brain, and reconnect its subscription login. Waiting documents stay queued.";
|
|
46
|
+
export declare const BOT_API_KEY_TEXT = "The Executive bot is using an API key. Open its profile in HQ, go to Brain, and connect its Claude or ChatGPT subscription instead. Waiting documents stay queued.";
|
|
44
47
|
/** The same steps for Codex: the pane's Codex row has "Connect Codex" / "Install Codex". */
|
|
45
48
|
export declare const CODEX_SIGN_IN_STEPS: string;
|
|
46
49
|
/** The sign-in steps for the tool the pass runs on. */
|
|
@@ -73,6 +76,33 @@ export type SignalType = (typeof SIGNAL_TYPES)[number];
|
|
|
73
76
|
* sign-in; `--safe-mode` keeps auth working (checked on Claude Code 2.1.308).
|
|
74
77
|
*/
|
|
75
78
|
export declare const CLAUDE_ISOLATION_ARGS: readonly string[];
|
|
79
|
+
/**
|
|
80
|
+
* The only variables a `claude` spawn of the pass (the `auth status`
|
|
81
|
+
* preflight and every `claude -p` turn) receives from the parent environment.
|
|
82
|
+
* The pass bills to the subscription login Claude Code keeps (its keychain
|
|
83
|
+
* entry or CLAUDE_CONFIG_DIR, or a CLAUDE_CODE_OAUTH_TOKEN subscription
|
|
84
|
+
* token), never to an API key. In `-p` mode Claude Code prefers
|
|
85
|
+
* ANTHROPIC_API_KEY over that login, and ANTHROPIC_AUTH_TOKEN,
|
|
86
|
+
* ANTHROPIC_BASE_URL, CLAUDE_CODE_USE_BEDROCK and CLAUDE_CODE_USE_VERTEX send
|
|
87
|
+
* the turn to another account or provider, so the environment is an
|
|
88
|
+
* allowlist (like CODEX_SIGNALS_ENV_ALLOWLIST) rather than a list of removals:
|
|
89
|
+
* a variable not named here never reaches claude.
|
|
90
|
+
*/
|
|
91
|
+
export declare const CLAUDE_SIGNALS_ENV_ALLOWLIST: readonly string[];
|
|
92
|
+
/** `base` cut down to CLAUDE_SIGNALS_ENV_ALLOWLIST: the environment of every `claude` spawn of the pass. */
|
|
93
|
+
export declare function claudeSignalsEnv(base: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
94
|
+
/**
|
|
95
|
+
* Why a `claude auth status` reply is not a subscription login, or null when
|
|
96
|
+
* it is (or when the reply does not say). An API key (`authMethod: api_key`,
|
|
97
|
+
* any `apiKeySource`), a Bedrock or Vertex provider (`authMethod:
|
|
98
|
+
* third_party`, or an `apiProvider` other than `firstParty`) all bill
|
|
99
|
+
* somewhere other than the user's subscription. Exported for tests.
|
|
100
|
+
*/
|
|
101
|
+
export declare function claudeApiKeyLogin(status: {
|
|
102
|
+
authMethod?: unknown;
|
|
103
|
+
apiProvider?: unknown;
|
|
104
|
+
apiKeySource?: unknown;
|
|
105
|
+
}): string | null;
|
|
76
106
|
/** Per-document `claude -p` budget (policy indigo-executors-bound-all-waits). */
|
|
77
107
|
export declare const DEFAULT_SIGNALS_TIMEOUT_MS = 120000;
|
|
78
108
|
/** Budget for the `claude auth status` preflight. */
|
|
@@ -147,6 +177,13 @@ export interface ClaudeSignalsPassOptions {
|
|
|
147
177
|
* `codex-logged-out`; no other login is used.
|
|
148
178
|
*/
|
|
149
179
|
botRuntimeEnv?: () => NodeJS.ProcessEnv;
|
|
180
|
+
/**
|
|
181
|
+
* The HQ Fleet Executive bot whose own login the pass runs on (see the file
|
|
182
|
+
* header and fleet-complete.ts), or null when it is not a Fleet bot or its
|
|
183
|
+
* helper is not installed. Read once, when the first document is about to
|
|
184
|
+
* be sent. Unset, null or a throw: the paths below, as before.
|
|
185
|
+
*/
|
|
186
|
+
fleetComplete?: () => FleetCompleteTarget | null;
|
|
150
187
|
/** The `codex` CLI for the Codex runtime; the bot runtime's own lookup by default. */
|
|
151
188
|
codexBin?: string;
|
|
152
189
|
/** Test seam: the spawn used for the sign-in check and the Codex turn. */
|
|
@@ -158,7 +195,17 @@ export interface ClaudeSignalsPassOptions {
|
|
|
158
195
|
* (signals-claude-login.ts), which `hq bot status` reads. Must not throw.
|
|
159
196
|
* Only a pass on Claude Code reports; a pass on Codex does not.
|
|
160
197
|
*/
|
|
161
|
-
onClaudeLogin?: (signedIn: boolean) => void;
|
|
198
|
+
onClaudeLogin?: (signedIn: boolean | null) => void;
|
|
199
|
+
/**
|
|
200
|
+
* Told each time the pass sends one document to its tool, after the login
|
|
201
|
+
* check passed, with the tool it runs on. Bad-output retries of the same
|
|
202
|
+
* document are not counted again. `hq signals run` counts these for its run
|
|
203
|
+
* record (engine, account, model turns). Unset: nothing is reported. A throw
|
|
204
|
+
* is ignored.
|
|
205
|
+
*/
|
|
206
|
+
onDocumentSent?: (runtime: SignalsRuntimeId) => void;
|
|
207
|
+
/** Login actually selected, including a fallback before its preflight. */
|
|
208
|
+
onLoginRoute?: (route: "fleet" | "claude-cli" | "codex-bot") => void;
|
|
162
209
|
}
|
|
163
210
|
/** Why the pass sent claude the pointer alone. */
|
|
164
211
|
export type PayloadFallbackReason = "payload-out-of-bounds" | "payload-missing" | "payload-unreadable";
|