@indigoai-us/hq-cli 5.345.220 → 5.345.221

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.
Files changed (138) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/command-catalog.generated.d.ts +144 -2
  3. package/dist/command-catalog.generated.js +175 -2
  4. package/dist/commands/auth.js +4 -1
  5. package/dist/commands/bot-runtime.d.ts +18 -5
  6. package/dist/commands/bot-runtime.js +29 -12
  7. package/dist/commands/bot.d.ts +39 -2
  8. package/dist/commands/bot.js +140 -11
  9. package/dist/commands/core-stop-autosave.d.ts +21 -0
  10. package/dist/commands/core-stop-autosave.js +300 -0
  11. package/dist/commands/core.js +2 -0
  12. package/dist/commands/daemon.d.ts +5 -0
  13. package/dist/commands/daemon.js +31 -7
  14. package/dist/commands/doctor-usage.d.ts +5 -0
  15. package/dist/commands/doctor-usage.js +25 -0
  16. package/dist/commands/env.d.ts +49 -4
  17. package/dist/commands/env.js +355 -5
  18. package/dist/commands/lanes-shared.d.ts +3 -0
  19. package/dist/commands/lanes.d.ts +3 -0
  20. package/dist/commands/lanes.js +87 -3
  21. package/dist/commands/sources.js +3 -3
  22. package/dist/commands/sync-core.d.ts +1 -0
  23. package/dist/commands/sync-core.js +77 -3
  24. package/dist/commands/whoami.js +96 -80
  25. package/dist/lib/bot/config.d.ts +17 -0
  26. package/dist/lib/bot/config.js +13 -0
  27. package/dist/lib/bot/fleet-cron.js +24 -2
  28. package/dist/lib/bot/fleet-local.d.ts +30 -2
  29. package/dist/lib/bot/fleet-local.js +60 -1
  30. package/dist/lib/bot/grok-login-scope.d.ts +36 -0
  31. package/dist/lib/bot/grok-login-scope.js +93 -0
  32. package/dist/lib/bot/legacy-provider-login.d.ts +32 -9
  33. package/dist/lib/bot/legacy-provider-login.js +28 -22
  34. package/dist/lib/bot/runtime-sign-in-check.js +6 -1
  35. package/dist/lib/bot/runtime-sign-in.d.ts +2 -0
  36. package/dist/lib/core-utils/sentry-report.js +2 -0
  37. package/dist/lib/daemon/machine-checks.d.ts +22 -1
  38. package/dist/lib/daemon/machine-checks.js +54 -12
  39. package/dist/lib/daemon/run.js +66 -8
  40. package/dist/lib/daemon/stop-autosave-lock.d.ts +19 -0
  41. package/dist/lib/daemon/stop-autosave-lock.js +166 -0
  42. package/dist/lib/daemon/stop-autosave.d.ts +28 -0
  43. package/dist/lib/daemon/stop-autosave.js +111 -0
  44. package/dist/lib/daemon/stop-diagnostics.d.ts +11 -0
  45. package/dist/lib/daemon/stop-diagnostics.js +136 -0
  46. package/dist/lib/daemon/stop-job-executor.d.ts +19 -0
  47. package/dist/lib/daemon/stop-job-executor.js +126 -0
  48. package/dist/lib/daemon/stop-jobs.d.ts +93 -0
  49. package/dist/lib/daemon/stop-jobs.js +599 -0
  50. package/dist/lib/doctor/checks/fleet-hook-core.js +1 -1
  51. package/dist/lib/doctor/checks/host-core.js +1 -1
  52. package/dist/lib/environment/access-probes.d.ts +234 -0
  53. package/dist/lib/environment/access-probes.js +918 -0
  54. package/dist/lib/environment/profile.d.ts +15 -2
  55. package/dist/lib/environment/profile.js +55 -20
  56. package/dist/lib/environment/rfc3339.d.ts +8 -0
  57. package/dist/lib/environment/rfc3339.js +26 -0
  58. package/dist/lib/environment/work-requirements.d.ts +169 -0
  59. package/dist/lib/environment/work-requirements.js +389 -0
  60. package/dist/lib/hook-engine/coverage.d.ts +137 -7
  61. package/dist/lib/hook-engine/coverage.js +1424 -4
  62. package/dist/lib/hook-engine/fleet-registration.js +2 -2
  63. package/dist/lib/hook-engine/git-stop-config.json +513 -0
  64. package/dist/lib/hook-engine/native-stop-compatibility.json +311 -0
  65. package/dist/lib/hook-engine/reconcile.js +2 -2
  66. package/dist/lib/hot-channels/alert.d.ts +2 -2
  67. package/dist/lib/hot-channels/alert.js +8 -5
  68. package/dist/lib/hot-channels/signals-pass.d.ts +126 -17
  69. package/dist/lib/hot-channels/signals-pass.js +296 -17
  70. package/dist/lib/hot-channels/signals-runtime.d.ts +30 -0
  71. package/dist/lib/hot-channels/signals-runtime.js +82 -0
  72. package/dist/lib/install/hook-target.js +1 -1
  73. package/dist/lib/lanes/host-capacity.d.ts +26 -2
  74. package/dist/lib/lanes/host-capacity.js +17 -2
  75. package/dist/lib/lanes/host-compute.d.ts +90 -0
  76. package/dist/lib/lanes/host-compute.js +185 -0
  77. package/dist/lib/lanes/index.d.ts +2 -0
  78. package/dist/lib/lanes/index.js +1 -0
  79. package/dist/lib/lanes/reconcile.js +22 -1
  80. package/dist/lib/lanes/resource-usage.d.ts +155 -0
  81. package/dist/lib/lanes/resource-usage.js +589 -0
  82. package/dist/lib/lanes/run-size.d.ts +46 -0
  83. package/dist/lib/lanes/run-size.js +197 -0
  84. package/dist/lib/lanes/store.js +27 -0
  85. package/dist/lib/lanes/throttle.d.ts +36 -1
  86. package/dist/lib/lanes/throttle.js +47 -10
  87. package/dist/lib/lanes/types.d.ts +40 -0
  88. package/dist/lib/lanes/types.js +2 -2
  89. package/dist/lib/lanes/watcher.js +13 -4
  90. package/dist/lib/lanes/worker-process.d.ts +25 -2
  91. package/dist/lib/lanes/worker-process.js +71 -19
  92. package/dist/lib/placement/match.d.ts +192 -0
  93. package/dist/lib/placement/match.js +667 -0
  94. package/dist/lib/safe-store.d.ts +14 -0
  95. package/dist/lib/safe-store.js +77 -4
  96. package/dist/lib/search-index/index.d.ts +88 -4
  97. package/dist/lib/search-index/index.js +288 -24
  98. package/dist/lib/search-index/max-doc-bytes.d.ts +17 -6
  99. package/dist/lib/search-index/max-doc-bytes.js +48 -23
  100. package/dist/lib/signals/codex-lockdown.d.ts +79 -0
  101. package/dist/lib/signals/codex-lockdown.js +271 -0
  102. package/dist/lib/signals/codex-login.d.ts +37 -0
  103. package/dist/lib/signals/codex-login.js +83 -0
  104. package/dist/lib/signals/engine.d.ts +27 -0
  105. package/dist/lib/signals/engine.js +70 -0
  106. package/dist/lib/signals/reply.js +22 -1
  107. package/dist/lib/signals/run-record.js +6 -1
  108. package/dist/lib/signals/settings.d.ts +5 -0
  109. package/dist/lib/signals/settings.js +2 -0
  110. package/dist/lib/signals/steps/extract.d.ts +85 -9
  111. package/dist/lib/signals/steps/extract.js +317 -68
  112. package/dist/lib/signals/steps/types.d.ts +2 -0
  113. package/dist/lib/sync-core/engine-home.d.ts +35 -1
  114. package/dist/lib/sync-core/engine-home.js +119 -16
  115. package/dist/lib/sync-core/rollout-state.d.ts +2 -1
  116. package/dist/lib/sync-core/rollout-state.js +5 -2
  117. package/dist/lib/sync-core/vault-uid.d.ts +2 -0
  118. package/dist/lib/sync-core/vault-uid.js +4 -0
  119. package/dist/schemas/hq-work-requirements.v1.schema.json +145 -0
  120. package/dist/utils/auth-session-check.d.ts +16 -0
  121. package/dist/utils/auth-session-check.js +16 -0
  122. package/dist/utils/client-health-contract.d.ts +6 -0
  123. package/dist/utils/client-health-contract.js +13 -0
  124. package/dist/utils/client-health.d.ts +7 -0
  125. package/dist/utils/client-health.js +22 -1
  126. package/dist/utils/command-usage.d.ts +40 -0
  127. package/dist/utils/command-usage.js +61 -0
  128. package/dist/utils/duplicate-command-usage.d.ts +72 -0
  129. package/dist/utils/duplicate-command-usage.js +125 -0
  130. package/dist/utils/host-registration.js +2 -1
  131. package/dist/utils/resident-package-preload.js +4 -0
  132. package/dist/utils/sentry-fingerprint.js +9 -0
  133. package/dist/utils/windows-bash.d.ts +2 -0
  134. package/dist/utils/windows-bash.js +2 -1
  135. package/package.json +9 -8
  136. package/scripts/bench-core-compare.mjs +313 -0
  137. package/scripts/bench-core.mjs +399 -12
  138. package/scripts/check-function-manifest.mjs +116 -3
@@ -23,12 +23,77 @@ import { extractStep, redoItemChannel } from "./steps/extract.js";
23
23
  import { uploadStep } from "./steps/upload.js";
24
24
  import { SIGNALS_RUN_ALERT_ADAPTER, raiseSignalsRunAlerts, resolveSignedInAlertPerson, } from "./failure-alert.js";
25
25
  import { signalsAlertKey, signalsAlertStatePath } from "../hot-channels/alert.js";
26
+ import { canonicalHostIdHere } from "../lanes/run-size.js";
27
+ import { resolveExecutiveBot } from "../bot/executive.js";
28
+ import { botsRoot } from "../bot/paths.js";
26
29
  export const SIGNALS_TRIGGERS = ["job", "chat", "manual", "brief"];
27
30
  export const SIGNALS_STEP_CHOICES = ["garden", "extract", "adapters", "upload", "all"];
28
31
  export const STEP_ORDER = ["garden", "adapters", "extract", "garden", "upload"];
29
32
  export const RUN_RECORD_SCHEMA_VERSION = 2;
30
33
  /** A failed run with a transient error is due for a retry this long after it finished. */
31
34
  export const RETRY_DELAY_MS = 15 * 60 * 1000;
35
+ /** The runtime the record's extract step ran, or null when no extract turn ran. */
36
+ export function signalsRunEngine(record, incremental) {
37
+ const extract = [...record.steps].reverse().find((s) => s.name === "extract" && s.status !== "skipped");
38
+ if (!extract)
39
+ return null;
40
+ const runtime = extract.detail?.runtime;
41
+ if (typeof runtime === "string" && runtime.trim() !== "")
42
+ return runtime;
43
+ // The incremental (single growing source) extract always runs claude.
44
+ return incremental ? "claude" : null;
45
+ }
46
+ /** The login an engine's extract turn uses, named without paths or e-mail addresses. */
47
+ export function defaultSignalsAccount(engine, env = process.env, resolveBotName = () => resolveExecutiveBot({ root: botsRoot() })?.name ?? null) {
48
+ if (engine === "claude") {
49
+ const dir = env.CLAUDE_CONFIG_DIR?.trim();
50
+ if (!dir)
51
+ return "default";
52
+ const name = path.basename(dir);
53
+ // A folder named after an e-mail address, or one path.basename cannot
54
+ // split (a backslash path), is not a safe label to store.
55
+ return !name || /[@/\\]/.test(name) ? "custom" : name;
56
+ }
57
+ if (engine === "codex") {
58
+ try {
59
+ const name = resolveBotName();
60
+ return name ? "bot:" + name : null;
61
+ }
62
+ catch {
63
+ return null;
64
+ }
65
+ }
66
+ if (engine === "grok")
67
+ return "default";
68
+ return null;
69
+ }
70
+ /** Sets host_id, engine, account and duration_seconds on a finished record (PS-011). */
71
+ export function stampRunPlacement(record, deps, incremental) {
72
+ let hostId;
73
+ try {
74
+ hostId = (deps.hostId ?? (() => canonicalHostIdHere()))();
75
+ }
76
+ catch {
77
+ hostId = null;
78
+ }
79
+ const engine = signalsRunEngine(record, incremental);
80
+ let account = null;
81
+ if (engine) {
82
+ try {
83
+ account = (deps.account ?? ((e) => defaultSignalsAccount(e)))(engine);
84
+ }
85
+ catch {
86
+ account = null;
87
+ }
88
+ }
89
+ const started = Date.parse(record.startedAt);
90
+ const finished = record.finishedAt === null ? NaN : Date.parse(record.finishedAt);
91
+ record.host_id = hostId;
92
+ record.engine = engine;
93
+ record.account = account;
94
+ record.duration_seconds =
95
+ Number.isFinite(started) && Number.isFinite(finished) ? Math.round(Math.max(0, finished - started) / 100) / 10 : null;
96
+ }
32
97
  /** Bad input from the caller (company slug, missing company): exit 2. */
33
98
  export class SignalsUsageError extends Error {
34
99
  constructor(message) {
@@ -354,6 +419,7 @@ export async function runSignals(opts) {
354
419
  }
355
420
  return;
356
421
  }
422
+ stampRunPlacement(record, opts.placement ?? {}, opts.incremental === true);
357
423
  persist();
358
424
  updateSummaryFile(hqRoot, date, record, record.finishedAt ?? now().toISOString());
359
425
  };
@@ -402,6 +468,7 @@ export async function runSignals(opts) {
402
468
  record.failureReason = sentence(err.message.charAt(0).toUpperCase() + err.message.slice(1));
403
469
  record.nextRetryAt = null;
404
470
  if (!dryRun) {
471
+ stampRunPlacement(record, opts.placement ?? {}, opts.incremental === true);
405
472
  persist();
406
473
  updateSummaryFile(hqRoot, date, record, record.finishedAt ?? now().toISOString());
407
474
  }
@@ -433,6 +500,7 @@ export async function runSignals(opts) {
433
500
  catchUp: record.catchUp,
434
501
  maxTurns,
435
502
  maxBudgetUsd,
503
+ unpricedSourceEstimateUsd: settings.unpricedSourceEstimateUsd,
436
504
  now,
437
505
  spawn,
438
506
  write,
@@ -511,6 +579,8 @@ export async function runSignals(opts) {
511
579
  record.nextRetryAt =
512
580
  record.errorKind === "transient" ? new Date(new Date(record.finishedAt).getTime() + RETRY_DELAY_MS).toISOString() : null;
513
581
  try {
582
+ if (!dryRun)
583
+ stampRunPlacement(record, opts.placement ?? {}, opts.incremental === true);
514
584
  persist();
515
585
  }
516
586
  catch {
@@ -169,13 +169,29 @@ function spendBlock(record) {
169
169
  return null;
170
170
  const spend = spendUsd(record);
171
171
  const value = Math.max(0, Math.min(100, Math.round((spend / record.maxBudgetUsd) * 100)));
172
+ // Some coding tools report no cost; the step then counts a flat amount per source. Say it is an estimate.
173
+ const estimated = record.steps.some((s) => s.detail?.spendEstimated === true);
172
174
  return {
173
175
  kind: "progress",
174
176
  value,
175
- label: `Spend $${spend.toFixed(2)} of the $${record.maxBudgetUsd.toFixed(2)} cap`,
177
+ label: `${estimated ? "Estimated spend" : "Spend"} $${spend.toFixed(2)} of the $${record.maxBudgetUsd.toFixed(2)} cap`,
176
178
  tone: "neutral",
177
179
  };
178
180
  }
181
+ /**
182
+ * A run that stopped at the spend cap on estimated spend, in plain words:
183
+ * how many sources were processed, how many are left, and what controls it.
184
+ * Null for any other outcome.
185
+ */
186
+ function estimatedBudgetStop(record) {
187
+ const step = record.steps.find((s) => s.error === "budget-exceeded" && s.detail?.spendEstimated === true && typeof s.detail.sourcesProcessed === "number");
188
+ const d = step?.detail;
189
+ if (!d)
190
+ return null;
191
+ const each = typeof d.unpricedSourceEstimateUsd === "number" ? `$${d.unpricedSourceEstimateUsd.toFixed(2)}` : "a set amount";
192
+ const left = typeof d.sourcesLeft === "number" && d.sourcesLeft > 0 ? `, with at least ${plural(d.sourcesLeft, "source")} left for the next run` : "";
193
+ return `Signals stopped at the $${record.maxBudgetUsd.toFixed(2)} spend cap after ${plural(d.sourcesProcessed, "source")}${left}. The spend is an estimate: this coding tool does not report its cost, so each source counts as ${each}. To process more in one run, raise the cap with --max-budget-usd.`;
194
+ }
179
195
  /**
180
196
  * The non-desktop brief decision. It says the brief builds next only when a
181
197
  * brief job is known to be scheduled; otherwise it asks.
@@ -237,6 +253,11 @@ function raiseCapLine(record) {
237
253
  * that the rest waits for the next run, and how to raise the cap for a run.
238
254
  */
239
255
  function budgetGuidance(record, stopped) {
256
+ // Estimated spend has its own sentence (counts and the per-source amount).
257
+ // A metered stop still names the source it stopped at.
258
+ const estimated = estimatedBudgetStop(record);
259
+ if (estimated)
260
+ return estimated;
240
261
  const raw = stopped.detail?.budgetStoppedAt;
241
262
  const at = typeof raw === "string" && raw.trim() ? raw.trim() : null;
242
263
  const cap = capInWords(record);
@@ -68,7 +68,12 @@ export function isRunRecord(v) {
68
68
  strOrNull(v.partial) &&
69
69
  typeof v.alreadyRanToday === "boolean" &&
70
70
  isCounts(v.counts) &&
71
- optional(v.lockTakeover, isObj);
71
+ optional(v.lockTakeover, isObj) &&
72
+ // PS-011 placement facts: absent on older records.
73
+ optional(v.host_id, strOrNull) &&
74
+ optional(v.engine, strOrNull) &&
75
+ optional(v.account, strOrNull) &&
76
+ optional(v.duration_seconds, (x) => x === null || (isNum(x) && x >= 0));
72
77
  if (!shape)
73
78
  return false;
74
79
  // Contract invariants: finishedAt is null exactly while running, and the
@@ -3,6 +3,11 @@ export interface SignalsSettings {
3
3
  maxBudgetUsd: number;
4
4
  lateStartHour: number;
5
5
  briefWaitMinutes: number;
6
+ /**
7
+ * What one source counts as against maxBudgetUsd when the coding tool reports
8
+ * no cost for it (Codex always, Grok sometimes). 0 turns the charge off.
9
+ */
10
+ unpricedSourceEstimateUsd: number;
6
11
  }
7
12
  export declare const DEFAULT_SIGNALS_SETTINGS: SignalsSettings;
8
13
  export declare const SIGNALS_SETTINGS_REL: string;
@@ -7,6 +7,7 @@ export const DEFAULT_SIGNALS_SETTINGS = {
7
7
  maxBudgetUsd: 2.0,
8
8
  lateStartHour: 22,
9
9
  briefWaitMinutes: 20,
10
+ unpricedSourceEstimateUsd: 0.1,
10
11
  };
11
12
  /** maxTurns: whole number >= 1. lateStartHour: whole hour 1-24 (0 would make every job late; 24 turns it off). */
12
13
  const VALID = {
@@ -14,6 +15,7 @@ const VALID = {
14
15
  maxBudgetUsd: (v) => Number.isFinite(v) && v >= 0,
15
16
  lateStartHour: (v) => Number.isInteger(v) && v >= 1 && v <= 24,
16
17
  briefWaitMinutes: (v) => Number.isFinite(v) && v >= 0,
18
+ unpricedSourceEstimateUsd: (v) => Number.isFinite(v) && v >= 0,
17
19
  };
18
20
  export const SIGNALS_SETTINGS_REL = path.join("core", "settings", "signals.yaml");
19
21
  export function loadSignalsSettings(hqRoot) {
@@ -1,5 +1,6 @@
1
1
  import { type StoredPriorSignal } from "../prior-signals.js";
2
2
  import { type BotRuntimeId } from "../../bot/config.js";
3
+ import { type SignalsCodexLogin } from "../codex-login.js";
3
4
  import type { PriorStep, SignalsStep, SpawnSyncFn, StepContext, StepResult } from "./types.js";
4
5
  export declare const EXTRACT_SIGNAL_TYPES: readonly ["action_item", "commitment", "decision", "risk", "question", "key_point", "participant_contribution", "summary"];
5
6
  export declare const DEFAULT_WORKLIST_LIMIT = 20;
@@ -42,6 +43,8 @@ export interface PartialDocument {
42
43
  audience: string[];
43
44
  }
44
45
  export interface ExtractStepOptions {
46
+ /** Charge per source when the runtime reports no cost. Default UNPRICED_SOURCE_ESTIMATE_USD. */
47
+ unpricedSourceEstimateUsd?: number;
45
48
  documentOverride?: PartialDocument;
46
49
  priorSignals?: readonly PriorSignal[];
47
50
  /** Runtime when no main local bot config is found. Default claude. */
@@ -57,6 +60,10 @@ export interface ExtractStepOptions {
57
60
  force?: boolean;
58
61
  /** OS used to decide whether grok's child-process network block exists. Default: this process. */
59
62
  platform?: NodeJS.Platform;
63
+ /** The Codex login a codex turn uses. Default: the Executive bot's own (defaultResolveCodexLogin). */
64
+ resolveCodexLogin?: () => SignalsCodexLogin;
65
+ /** The account's passwd home, checked as well as $HOME. Default: os.userInfo().homedir. */
66
+ passwdHome?: string;
60
67
  }
61
68
  interface SourceChannel {
62
69
  channel: string;
@@ -68,6 +75,21 @@ interface WorkItem {
68
75
  audience?: string[];
69
76
  skip?: string;
70
77
  }
78
+ /**
79
+ * What one source is charged against the run budget when the runtime reports
80
+ * no cost for it. `codex exec` has no turn or budget option and its event
81
+ * stream carries no cost, and a grok end event can omit total_cost_usd. Without
82
+ * a charge the run's spend stays 0 and the budget stop never fires.
83
+ *
84
+ * 0.10 USD (owner decision, 2026-11-16) is an assumption, not a measurement:
85
+ * no priced codex or grok extract run exists to derive it from. With the
86
+ * default 2.00 USD run budget it lets at most 20 such sources run. A codex turn
87
+ * that fails or is refused is not charged. The run record marks the spend as
88
+ * estimated.
89
+ * Set `unpricedSourceEstimateUsd` in core/settings/signals.yaml to change it;
90
+ * 0 turns the charge off.
91
+ */
92
+ export declare const UNPRICED_SOURCE_ESTIMATE_USD = 0.1;
71
93
  /** The Executive bot's runtime (lib/bot/executive.ts), or null when there is no personal bot. */
72
94
  export declare function defaultResolveBotRuntime(root?: string): BotRuntimeId | null;
73
95
  /**
@@ -142,10 +164,13 @@ export declare function buildExtractPrompt(input: {
142
164
  itemPath: string;
143
165
  wrapperPath: string;
144
166
  /**
145
- * codex has no Read tool; it reads with shell commands inside its sandbox.
146
- * grok reads with read_file and returns candidate commands as JSON data.
167
+ * codex has no tools: the item's text comes in the prompt (itemText) and it
168
+ * returns candidate commands as JSON data. grok reads with read_file and
169
+ * returns candidate commands as JSON data.
147
170
  */
148
171
  runtime?: "claude" | "codex" | "grok";
172
+ /** codex only: the item's text, read by the host. */
173
+ itemText?: string;
149
174
  }): string;
150
175
  /**
151
176
  * The per-item candidate command. It pins --company, --audience and
@@ -172,6 +197,7 @@ export declare function parseTurnOutput(stdout: string): {
172
197
  result: Record<string, unknown> | null;
173
198
  turns: number;
174
199
  costUsd: number;
200
+ costReported: boolean;
175
201
  };
176
202
  /**
177
203
  * How many of this item's new signal candidates in this company carry no
@@ -229,8 +255,13 @@ export interface TurnScope {
229
255
  */
230
256
  wrapperBody?: string;
231
257
  }
232
- /** TOML inline table for the codex permission profile's filesystem entries. */
233
- export declare function codexFilesystemProfile(scope: TurnScope, codexBin: string, envPath: string | undefined): string;
258
+ /**
259
+ * TOML inline table for the codex permission profile's filesystem entries:
260
+ * the platform minimum, the codex install dir and the turn's empty work dir,
261
+ * all read-only. No HQ path is granted; the host reads the item and writes
262
+ * the candidates.
263
+ */
264
+ export declare function codexFilesystemProfile(installDir: string, workDir: string): string;
234
265
  /**
235
266
  * The sandbox profile for a grok turn, written to <turn dir>/.grok/sandbox.toml.
236
267
  * grok's `strict` already covers the turn dir (cwd), system paths and ~/.grok;
@@ -249,7 +280,7 @@ export declare function grokCandidateArgv(command: string, wrapperPath: string):
249
280
  * immediately before each exec. Strict can write the turn directory, so a
250
281
  * writer that no longer matches is not run.
251
282
  */
252
- export declare function executeGrokCandidates(text: string, wrapperPath: string, spawn: SpawnSyncFn, opts: Parameters<SpawnSyncFn>[2], expectedWrapper?: string): string | undefined;
283
+ export declare function executeGrokCandidates(text: string, wrapperPath: string, spawn: SpawnSyncFn, opts: Parameters<SpawnSyncFn>[2], expectedWrapper?: string, runtime?: "grok" | "codex"): string | undefined;
253
284
  /**
254
285
  * Read denies for the grok login. Grok matches a `~` tool path literally and
255
286
  * expands `~` only after that check, so the absolute temp home is not enough.
@@ -295,16 +326,61 @@ export type ExtractRuntimeChoice = {
295
326
  /**
296
327
  * Which runtime runs the turns. The main bot's runtime, except that a grok
297
328
  * that is missing or cannot be locked down is never run: the step uses
298
- * claude, then codex, when that tool is installed and signed in, and
299
- * otherwise fails. The claude and codex checks run only when needed.
329
+ * claude when it is installed and signed in, and otherwise fails. It does
330
+ * not fall back to codex: a Codex turn needs a bot that runs on Codex with
331
+ * its own login (signalsCodexLogin), which a grok main bot never is. The
332
+ * claude check runs only when needed.
300
333
  */
301
334
  export declare function chooseExtractRuntime(main: BotRuntimeId, avail: {
302
335
  grok: () => GrokAvailability;
303
336
  claude: () => ToolAvailability;
304
- codex: () => ToolAvailability;
305
337
  }, platform?: NodeJS.Platform): ExtractRuntimeChoice;
306
338
  export declare function claudeTurnArgs(prompt: string, scope: TurnScope, maxTurns: number, budgetUsd: number): string[];
307
- export declare function codexTurnArgs(prompt: string, scope: TurnScope, codexBin: string, envPath: string | undefined): string[];
339
+ /**
340
+ * argv for one codex turn. The prompt goes on stdin (`-`), which keeps a long
341
+ * transcript off argv; the reply comes back in `outputFile`.
342
+ */
343
+ export declare function codexTurnArgs(input: {
344
+ workDir: string;
345
+ outputFile: string;
346
+ installDir: string;
347
+ }): string[];
348
+ /**
349
+ * The first codex item that is not a plain message, reasoning or error:
350
+ * evidence that a tool ran despite the lockdown. Null when there is none.
351
+ */
352
+ export declare function codexToolItem(stdout: string): string | null;
353
+ /** The real codex binary a turn runs, its install dir (the only install path the turn reads), and the bot's login dir (CODEX_HOME). */
354
+ export interface CodexTurnTarget {
355
+ binary: string;
356
+ installDir: string;
357
+ codexHome: string;
358
+ }
359
+ /** The Executive bot's own Codex login (signalsCodexLogin), or why extract may not use one. */
360
+ export declare function defaultResolveCodexLogin(root?: string, base?: NodeJS.ProcessEnv): SignalsCodexLogin;
361
+ /**
362
+ * The Codex login an extract turn may use, or why not: signalsCodexLogin's
363
+ * answer, also refused when its dir is the personal ~/.codex of any home,
364
+ * the passwd home included (os.homedir() follows $HOME and can hide it).
365
+ */
366
+ export declare function extractCodexLogin(login: SignalsCodexLogin, homes: readonly string[]): {
367
+ ok: true;
368
+ codexHome: string;
369
+ } | {
370
+ ok: false;
371
+ error: string;
372
+ };
373
+ /**
374
+ * Files in CODEX_HOME that codex loads into the model's context on its own:
375
+ * AGENTS.md, AGENTS.override.md and user skills (skills/<name>, not the
376
+ * skills/.system folder codex writes for its bundled skills, which
377
+ * skills.bundled.enabled=false keeps out). No codex 0.169.0 flag or config
378
+ * key turns these off (`codex debug prompt-input` still showed both with
379
+ * project_doc_max_bytes=0, include_skills_usage_instructions=false and
380
+ * skills.user.enabled=false), so a login folder holding any of them is
381
+ * refused instead. Rules files there are dropped by --ignore-rules.
382
+ */
383
+ export declare function codexHomeInstructions(codexHome: string): string[];
308
384
  export declare function extractPartialDocument(ctx: StepContext, doc: PartialDocument, prior: readonly PriorSignal[]): Promise<StepResult>;
309
385
  export declare function createExtractStep(options?: ExtractStepOptions): SignalsStep;
310
386
  export declare const extractStep: SignalsStep;