@indigoai-us/hq-cli 5.345.203 → 5.345.204
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 +9 -0
- package/dist/commands/bot.js +7 -2
- package/dist/commands/cloud.d.ts +14 -2
- package/dist/commands/cloud.js +25 -16
- package/dist/commands/sync-core.js +2 -0
- package/dist/lib/bot/claude-login.d.ts +7 -1
- package/dist/lib/bot/claude-login.js +56 -16
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +53 -5
- package/dist/lib/capacity/collectors/claude-oauth.js +251 -71
- package/dist/lib/daemon/catalog.js +2 -2
- package/dist/lib/daemon/run.js +2 -2
- package/dist/lib/lanes/config.js +13 -0
- package/dist/lib/lanes/throttle.d.ts +12 -1
- package/dist/lib/lanes/throttle.js +27 -8
- package/dist/lib/lanes/types.d.ts +5 -0
- package/dist/lib/signals/steps/extract.d.ts +110 -4
- package/dist/lib/signals/steps/extract.js +520 -39
- package/dist/lib/sync-core/engine-home.d.ts +2 -1
- package/dist/lib/sync-core/engine-home.js +25 -8
- package/dist/lib/sync-core/reconcile.d.ts +3 -1
- package/dist/lib/sync-core/reconcile.js +21 -8
- package/dist/lib/sync-core/release.d.ts +14 -5
- package/dist/lib/sync-core/release.js +58 -14
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type StoredPriorSignal } from "../prior-signals.js";
|
|
2
2
|
import { type BotRuntimeId } from "../../bot/config.js";
|
|
3
|
-
import type { SignalsStep, StepContext, StepResult } from "./types.js";
|
|
3
|
+
import type { SignalsStep, SpawnSyncFn, StepContext, StepResult } from "./types.js";
|
|
4
4
|
export declare const EXTRACT_SIGNAL_TYPES: readonly ["action_item", "commitment", "decision", "risk", "question", "key_point", "participant_contribution", "summary"];
|
|
5
5
|
export declare const DEFAULT_WORKLIST_LIMIT = 20;
|
|
6
6
|
export declare const DEFAULT_TURN_TIMEOUT_MS: number;
|
|
@@ -13,6 +13,20 @@ export declare const WORKLIST_ITEM_TIMEOUT_MS = 10000;
|
|
|
13
13
|
export declare function worklistTimeoutMs(limit: number): number;
|
|
14
14
|
export declare const CODEX_PERMISSION_PROFILE = "hq_signals_extract";
|
|
15
15
|
export declare const CANDIDATE_WRAPPER_NAME = "write-candidate.sh";
|
|
16
|
+
/** The sandbox profile the step writes to <turn dir>/.grok/sandbox.toml for a grok turn. */
|
|
17
|
+
export declare const GROK_SANDBOX_PROFILE = "hq_signals_extract";
|
|
18
|
+
export declare const GROK_SANDBOX_FILE: string;
|
|
19
|
+
/** The oldest grok whose `--help` lists every flag in GROK_EXTRACT_FLAGS. */
|
|
20
|
+
export declare const GROK_MIN_VERSION = "1.0.70";
|
|
21
|
+
/** Flags a grok turn needs; one missing from `--help` means the installed grok cannot be locked down. */
|
|
22
|
+
export declare const GROK_EXTRACT_FLAGS: readonly ["--permission-mode", "--tools", "--disallowed-tools", "--allow", "--deny", "--sandbox", "--disable-web-search", "--no-subagents", "--max-turns", "--cwd", "--output-format"];
|
|
23
|
+
/**
|
|
24
|
+
* grok's built-in read-only shell list (its permissions guide, "Read-Only
|
|
25
|
+
* Shell Commands"): auto-approved even under dontAsk, so each is denied by
|
|
26
|
+
* name. A Bash rule without `*` is a prefix match, so `Bash(cat)` also covers
|
|
27
|
+
* `cat` with any arguments.
|
|
28
|
+
*/
|
|
29
|
+
export declare const GROK_READ_ONLY_COMMANDS: readonly ["ls", "cat", "pwd", "date", "whoami", "hostname", "uptime", "ps", "head", "tail", "wc", "sort", "uniq", "tr", "cut", "mkdir", "touch", "git", "grep", "rg", "kubectl"];
|
|
16
30
|
/** The only tools a claude turn may use: Read inside the channel folder and the pinned wrapper. */
|
|
17
31
|
export declare function claudeAllowedTools(channelDir: string, wrapperPath: string): string[];
|
|
18
32
|
export interface PriorSignal {
|
|
@@ -36,10 +50,13 @@ export interface ExtractStepOptions {
|
|
|
36
50
|
resolveBotRuntime?: () => BotRuntimeId | null;
|
|
37
51
|
claudeBin?: string;
|
|
38
52
|
codexBin?: string;
|
|
53
|
+
grokBin?: string;
|
|
39
54
|
worklistLimit?: number;
|
|
40
55
|
turnTimeoutMs?: number;
|
|
41
56
|
/** Run channels whose source.yaml says run: cloud too (passes --force). */
|
|
42
57
|
force?: boolean;
|
|
58
|
+
/** OS used to decide whether grok's child-process network block exists. Default: this process. */
|
|
59
|
+
platform?: NodeJS.Platform;
|
|
43
60
|
}
|
|
44
61
|
interface SourceChannel {
|
|
45
62
|
channel: string;
|
|
@@ -77,8 +94,11 @@ export declare function buildExtractPrompt(input: {
|
|
|
77
94
|
item: WorkItem;
|
|
78
95
|
itemPath: string;
|
|
79
96
|
wrapperPath: string;
|
|
80
|
-
/**
|
|
81
|
-
|
|
97
|
+
/**
|
|
98
|
+
* codex has no Read tool; it reads with shell commands inside its sandbox.
|
|
99
|
+
* grok reads with read_file and returns candidate commands as JSON data.
|
|
100
|
+
*/
|
|
101
|
+
runtime?: "claude" | "codex" | "grok";
|
|
82
102
|
}): string;
|
|
83
103
|
/**
|
|
84
104
|
* The per-item candidate command. It pins --company, --audience and
|
|
@@ -91,7 +111,16 @@ export declare function buildCandidateWrapper(input: {
|
|
|
91
111
|
audience: string;
|
|
92
112
|
sourceRef: string;
|
|
93
113
|
}): string;
|
|
94
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Parse a stream-json transcript (claude), a codex --json event stream, or a
|
|
116
|
+
* grok streaming-json event stream.
|
|
117
|
+
*
|
|
118
|
+
* grok writes `{"type":"text","data":…}` deltas and one terminal
|
|
119
|
+
* `{"type":"end","stopReason":…,"num_turns":n,"total_cost_usd":x}`; a refused
|
|
120
|
+
* tool call ends the turn with stopReason "cancelled", and an API failure is
|
|
121
|
+
* `{"type":"error","message":…}`. Both are mapped to an error result so the
|
|
122
|
+
* item fails and is retried; only "end_turn" is success.
|
|
123
|
+
*/
|
|
95
124
|
export declare function parseTurnOutput(stdout: string): {
|
|
96
125
|
result: Record<string, unknown> | null;
|
|
97
126
|
turns: number;
|
|
@@ -134,9 +163,86 @@ export interface TurnScope {
|
|
|
134
163
|
wrapperPath: string;
|
|
135
164
|
/** companies/{co}/{signals,ontology}/_candidates, realpath. */
|
|
136
165
|
candidateDirs: string[];
|
|
166
|
+
/**
|
|
167
|
+
* Text of the pinned writer, when this turn generated one. A grok turn
|
|
168
|
+
* compares the file to this immediately before executing it.
|
|
169
|
+
*/
|
|
170
|
+
wrapperBody?: string;
|
|
137
171
|
}
|
|
138
172
|
/** TOML inline table for the codex permission profile's filesystem entries. */
|
|
139
173
|
export declare function codexFilesystemProfile(scope: TurnScope, codexBin: string, envPath: string | undefined): string;
|
|
174
|
+
/**
|
|
175
|
+
* The sandbox profile for a grok turn, written to <turn dir>/.grok/sandbox.toml.
|
|
176
|
+
* grok's `strict` already covers the turn dir (cwd), system paths and ~/.grok;
|
|
177
|
+
* the grants add bash's install prefix (Homebrew bash loads from it) and the
|
|
178
|
+
* read-only HQ paths of hqTurnGrants. Candidate folders are not granted:
|
|
179
|
+
* the host writes them after the turn, outside this sandbox.
|
|
180
|
+
*/
|
|
181
|
+
export declare function grokSandboxProfile(scope: TurnScope, envPath: string | undefined): string;
|
|
182
|
+
/** Grok can read the source; candidate writing belongs to the host. */
|
|
183
|
+
export declare function grokAllowRules(channelDir: string): string[];
|
|
184
|
+
/** Parse literal arguments only. No shell ever interprets model output. */
|
|
185
|
+
export declare function grokCandidateArgv(command: string, wrapperPath: string): string[] | null;
|
|
186
|
+
/**
|
|
187
|
+
* Validate the whole batch before writing. Only the host executes the pinned
|
|
188
|
+
* writer. When `expectedWrapper` is set, the file is compared to that text
|
|
189
|
+
* immediately before each exec. Strict can write the turn directory, so a
|
|
190
|
+
* writer that no longer matches is not run.
|
|
191
|
+
*/
|
|
192
|
+
export declare function executeGrokCandidates(text: string, wrapperPath: string, spawn: SpawnSyncFn, opts: Parameters<SpawnSyncFn>[2], expectedWrapper?: string): string | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Read denies for the grok login. Grok matches a `~` tool path literally and
|
|
195
|
+
* expands `~` only after that check, so the absolute temp home is not enough.
|
|
196
|
+
* `realHomes` is every home the original login might live under (the process
|
|
197
|
+
* HOME we copied from, and os.homedir() when that differs).
|
|
198
|
+
*/
|
|
199
|
+
export declare function grokAuthReadDenies(tempHome: string, realHomes: readonly string[]): string[];
|
|
200
|
+
/** Deny rules of a grok turn: every other tool class, the login file, and the read-only shell list. */
|
|
201
|
+
export declare function grokDenyRules(tempHome: string, realHomes: readonly string[]): string[];
|
|
202
|
+
export declare function grokTurnArgs(prompt: string, scope: TurnScope, maxTurns: number, tempHome: string, realHomes: readonly string[]): string[];
|
|
203
|
+
/** Parent env keys copied into a grok turn. Everything else, including credentials, stays out. */
|
|
204
|
+
export declare const GROK_ENV_ALLOW: readonly ["PATH", "HOME", "TMPDIR", "TMP", "TEMP", "LANG", "LC_ALL", "LC_CTYPE", "USER", "LOGNAME", "SHELL", "SystemRoot", "COMSPEC", "PATHEXT", "WINDIR", "TERM", "TZ", "HQ_ROOT"];
|
|
205
|
+
/** The turn's environment for grok: an allowlist, no sandbox or config overrides, no Claude or Cursor configuration scans. */
|
|
206
|
+
export declare function grokTurnEnv(base: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
207
|
+
export type GrokExtractSupport = {
|
|
208
|
+
ok: true;
|
|
209
|
+
} | {
|
|
210
|
+
ok: false;
|
|
211
|
+
missing: string[];
|
|
212
|
+
};
|
|
213
|
+
/** Whether `grok --help` lists every flag a locked-down turn needs, and streaming-json output. */
|
|
214
|
+
export declare function grokExtractSupportFromHelp(helpText: string): GrokExtractSupport;
|
|
215
|
+
export declare function resetGrokExtractProbeCache(): void;
|
|
216
|
+
/** Probe `grok --help` once per grok binary path (empty or failed output counts as every flag missing). */
|
|
217
|
+
export declare function probeGrokExtractSupport(grokBin: string, readHelp: () => string): GrokExtractSupport;
|
|
218
|
+
export type GrokAvailability = {
|
|
219
|
+
installed: false;
|
|
220
|
+
} | {
|
|
221
|
+
installed: true;
|
|
222
|
+
support: GrokExtractSupport;
|
|
223
|
+
};
|
|
224
|
+
export interface ToolAvailability {
|
|
225
|
+
installed: boolean;
|
|
226
|
+
/** The tool's own answer; null when it did not say (then it is not used as a fallback). */
|
|
227
|
+
signedIn: boolean | null;
|
|
228
|
+
}
|
|
229
|
+
export type ExtractRuntimeChoice = {
|
|
230
|
+
runtime: BotRuntimeId;
|
|
231
|
+
fallback?: string;
|
|
232
|
+
} | {
|
|
233
|
+
error: string;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Which runtime runs the turns. The main bot's runtime, except that a grok
|
|
237
|
+
* that is missing or cannot be locked down is never run: the step uses
|
|
238
|
+
* claude, then codex, when that tool is installed and signed in, and
|
|
239
|
+
* otherwise fails. The claude and codex checks run only when needed.
|
|
240
|
+
*/
|
|
241
|
+
export declare function chooseExtractRuntime(main: BotRuntimeId, avail: {
|
|
242
|
+
grok: () => GrokAvailability;
|
|
243
|
+
claude: () => ToolAvailability;
|
|
244
|
+
codex: () => ToolAvailability;
|
|
245
|
+
}, platform?: NodeJS.Platform): ExtractRuntimeChoice;
|
|
140
246
|
export declare function claudeTurnArgs(prompt: string, scope: TurnScope, maxTurns: number, budgetUsd: number): string[];
|
|
141
247
|
export declare function codexTurnArgs(prompt: string, scope: TurnScope, codexBin: string, envPath: string | undefined): string[];
|
|
142
248
|
export declare function extractPartialDocument(ctx: StepContext, doc: PartialDocument, prior: readonly PriorSignal[]): Promise<StepResult>;
|