@indigoai-us/hq-cli 5.345.252 → 5.345.254

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 (67) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/contracts/host-canary-release.json +11 -5
  3. package/dist/command-catalog.generated.d.ts +209 -0
  4. package/dist/command-catalog.generated.js +257 -0
  5. package/dist/command-registration-plan.d.ts +6 -0
  6. package/dist/command-registration-plan.js +1 -0
  7. package/dist/commands/ci-intake.d.ts +32 -0
  8. package/dist/commands/ci-intake.js +294 -0
  9. package/dist/commands/ci-metrics.d.ts +8 -0
  10. package/dist/commands/ci-metrics.js +55 -0
  11. package/dist/commands/ci-priorities.d.ts +56 -0
  12. package/dist/commands/ci-priorities.js +144 -0
  13. package/dist/commands/ci.d.ts +13 -0
  14. package/dist/commands/ci.js +11 -0
  15. package/dist/commands/cloud.d.ts +11 -0
  16. package/dist/commands/cloud.js +76 -0
  17. package/dist/commands/files.d.ts +62 -0
  18. package/dist/commands/files.js +249 -8
  19. package/dist/lib/bot/fleet-cron.d.ts +15 -0
  20. package/dist/lib/bot/fleet-cron.js +119 -20
  21. package/dist/lib/daemon/run.js +4 -3
  22. package/dist/lib/daemon/verified-jq.d.ts +6 -0
  23. package/dist/lib/daemon/verified-jq.js +17 -5
  24. package/dist/lib/delivery/migrations.d.ts +32 -1
  25. package/dist/lib/delivery/migrations.js +69 -8
  26. package/dist/lib/hook-engine/adapter-core-pin.d.ts +2 -1
  27. package/dist/lib/hook-engine/adapter-core-pin.js +2 -1
  28. package/dist/lib/hook-engine/coverage.d.ts +15 -0
  29. package/dist/lib/hook-engine/coverage.js +62 -1
  30. package/dist/lib/hook-engine/fleet-registration.d.ts +4 -0
  31. package/dist/lib/hook-engine/fleet-registration.js +25 -3
  32. package/dist/lib/smart-ci/cost.d.ts +72 -0
  33. package/dist/lib/smart-ci/cost.js +120 -0
  34. package/dist/lib/smart-ci/github.d.ts +112 -0
  35. package/dist/lib/smart-ci/github.js +267 -0
  36. package/dist/lib/smart-ci/intake.d.ts +288 -0
  37. package/dist/lib/smart-ci/intake.js +1078 -0
  38. package/dist/lib/smart-ci/ledger.d.ts +218 -0
  39. package/dist/lib/smart-ci/ledger.js +527 -0
  40. package/dist/lib/smart-ci/metrics.d.ts +137 -0
  41. package/dist/lib/smart-ci/metrics.js +249 -0
  42. package/dist/lib/smart-ci/priorities.d.ts +331 -0
  43. package/dist/lib/smart-ci/priorities.js +964 -0
  44. package/dist/lib/smart-ci/priority-refresh.d.ts +192 -0
  45. package/dist/lib/smart-ci/priority-refresh.js +366 -0
  46. package/dist/lib/smart-ci/priority-snapshots.d.ts +88 -0
  47. package/dist/lib/smart-ci/priority-snapshots.js +233 -0
  48. package/dist/lib/smart-ci/records.d.ts +265 -0
  49. package/dist/lib/smart-ci/records.js +281 -0
  50. package/dist/lib/smart-ci/reducer.d.ts +67 -0
  51. package/dist/lib/smart-ci/reducer.js +261 -0
  52. package/dist/lib/smart-ci/sources.d.ts +294 -0
  53. package/dist/lib/smart-ci/sources.js +659 -0
  54. package/dist/lib/smart-ci/text.d.ts +24 -0
  55. package/dist/lib/smart-ci/text.js +83 -0
  56. package/dist/lib/smart-ci/work-in-flight.d.ts +68 -0
  57. package/dist/lib/smart-ci/work-in-flight.js +154 -0
  58. package/dist/lib/sync/cli-manifest-reconcile.d.ts +20 -0
  59. package/dist/lib/sync/cli-manifest-reconcile.js +170 -0
  60. package/dist/lib/sync-core/engine-holds.d.ts +14 -0
  61. package/dist/lib/sync-core/engine-holds.js +78 -11
  62. package/dist/lib/sync-core/hand-back.d.ts +1 -0
  63. package/dist/lib/sync-core/hand-back.js +7 -2
  64. package/dist/lib/sync-core/reconcile.js +10 -2
  65. package/dist/utils/host-registration.d.ts +1 -0
  66. package/dist/utils/host-registration.js +1 -1
  67. package/package.json +9 -7
@@ -464,6 +464,71 @@ def signals_failures(err):
464
464
  errors.append(error)
465
465
  return found, errors
466
466
  `;
467
+ /**
468
+ * Waits between tries when a run fails because HQ could not reach the network.
469
+ * The job often fires the moment a laptop wakes, before Wi-Fi and DNS are back
470
+ * (Fleet catches up a missed daily run for up to 2 hours), so a short retry
471
+ * finds the connection. About 3.5 minutes in all, well inside Fleet's 1-hour
472
+ * script timeout.
473
+ */
474
+ export const HOT_SIGNAL_SYNC_NETWORK_RETRY_DELAYS_SEC = [30, 60, 120];
475
+ /**
476
+ * A network failure reaches the owner only once it repeats this many runs in a
477
+ * row. A single morning on a sleeping laptop is not worth a message.
478
+ */
479
+ export const HOT_SIGNAL_SYNC_TRANSIENT_ALERT_AFTER = 2;
480
+ /**
481
+ * Python helper for the flag-off script: one alert per failure streak.
482
+ *
483
+ * The state file next to the log counts failed runs in a row and the reasons
484
+ * already sent to the owner in this streak. A failure the owner already heard
485
+ * about stays in the log only, and the script exits 0 so Fleet sends nothing
486
+ * (Fleet turns any non-zero exit of a no-agent job into a DM). A new reason
487
+ * alerts again. A clean run deletes the file, which ends the streak. A
488
+ * network-only failure alerts from HOT_SIGNAL_SYNC_TRANSIENT_ALERT_AFTER runs
489
+ * in a row. When the file cannot be read or written the script alerts, as it
490
+ * did before the state file existed.
491
+ */
492
+ const HOT_SIGNAL_SYNC_STREAK = String.raw `def read_streak():
493
+ try:
494
+ with open(STATE, encoding='utf-8') as f:
495
+ data = json.load(f)
496
+ if isinstance(data, dict):
497
+ return data
498
+ except Exception:
499
+ pass
500
+ return {}
501
+
502
+ def note_failure(reason, transient):
503
+ # Returns (alert, failures in a row including this run).
504
+ try:
505
+ state = read_streak()
506
+ failures = int(state.get('failures') or 0) + 1
507
+ alerted = [r for r in (state.get('alerted') or []) if isinstance(r, str)]
508
+ alert = reason not in alerted and (not transient or failures >= TRANSIENT_ALERT_AFTER)
509
+ if alert:
510
+ alerted.append(reason)
511
+ tmp = STATE + '.tmp'
512
+ with open(tmp, 'w', encoding='utf-8') as f:
513
+ json.dump({'failures': failures, 'alerted': alerted, 'last': reason, 'at': time.strftime('%Y-%m-%dT%H:%M:%S%z', STARTED)}, f)
514
+ os.replace(tmp, STATE)
515
+ return alert, failures
516
+ except Exception:
517
+ return True, 1
518
+
519
+ def clear_streak():
520
+ try:
521
+ os.remove(STATE)
522
+ except OSError:
523
+ pass
524
+
525
+ def in_a_row(failures):
526
+ return ' (%d runs in a row)' % failures if failures > 1 else ''
527
+
528
+ def log_quiet(failures):
529
+ with open(LOG, 'a', encoding='utf-8') as log:
530
+ log.write('Not sent to the owner: they already heard about this failure in this streak, or it is a network failure seen fewer than %d runs in a row (%d so far).\n' % (TRANSIENT_ALERT_AFTER, failures))
531
+ `;
467
532
  /** How a run ended, for the log line after it: `exit 1` or `signal 9`. */
468
533
  const HOT_SIGNAL_SYNC_RUN_END = String.raw `def run_end(code):
469
534
  return 'signal %d' % -code if code < 0 else 'exit %d' % code
@@ -547,6 +612,12 @@ export function renderFleetHotSignalSyncScript(input) {
547
612
  // lines (US-018 AC1). A clean run that landed sources and found no signals
548
613
  // also raises the alert, but with no error; it stays in the log. The exit
549
614
  // code stays 0: the sync itself finished.
615
+ //
616
+ // Each failure streak alerts once (HOT_SIGNAL_SYNC_STREAK): a reason the
617
+ // owner already heard about in this streak stays in the log and the script
618
+ // exits 0, because Fleet DMs every non-zero exit. A network failure is
619
+ // retried within the run (NETWORK_RETRY_DELAYS) and alerts only from its
620
+ // second run in a row.
550
621
  const launcher = input.hqLauncher ?? fleetPnpmHqLauncher(input.hqBinary);
551
622
  // HQ is often the pnpm hash folder's dist/index.js. That path dies on the
552
623
  // next CLI update (feedback_614121bf). Prefer it while it exists so tests
@@ -554,31 +625,51 @@ export function renderFleetHotSignalSyncScript(input) {
554
625
  // launcher without node (it is a shell/cmd shim, not JS).
555
626
  const run = plainSync
556
627
  ? [
557
- " command = hq_argv() + ARGS",
558
- " result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', errors='replace')",
559
- " note = ''",
628
+ " def sync_once():",
629
+ " command = hq_argv() + ARGS",
630
+ " result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', errors='replace')",
631
+ " note = ''",
560
632
  // Commander rejects the option before the sync starts, so the retry is
561
633
  // the only run that does any work.
562
- " if result.returncode != 0 and \"unknown option '--trigger'\" in result.stderr:",
563
- " note = 'This hq has no --trigger option; ran the sync without it.\\n'",
564
- " command = hq_argv() + LEGACY_ARGS",
565
- " result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', errors='replace')",
566
- " with open(LOG, 'a', encoding='utf-8') as log:",
567
- header,
568
- " log.write(note)",
569
- " log.write(result.stderr)",
570
- " log.write(result.stdout)",
571
- " if result.returncode != 0 and not output_lines(result.stderr) and not output_lines(result.stdout):",
572
- " log.write('hq printed nothing. Command: ' + shlex.join(command) + '\\n')",
573
- footer,
634
+ " if result.returncode != 0 and \"unknown option '--trigger'\" in result.stderr:",
635
+ " note = 'This hq has no --trigger option; ran the sync without it.\\n'",
636
+ " command = hq_argv() + LEGACY_ARGS",
637
+ " result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', errors='replace')",
638
+ " with open(LOG, 'a', encoding='utf-8') as log:",
639
+ header.replace(/^ {8}/, " "),
640
+ " log.write(note)",
641
+ " log.write(result.stderr)",
642
+ " log.write(result.stdout)",
643
+ " if result.returncode != 0 and not output_lines(result.stderr) and not output_lines(result.stdout):",
644
+ " log.write('hq printed nothing. Command: ' + shlex.join(command) + '\\n')",
645
+ footer.replace(/^ {8}/, " "),
646
+ " return result",
647
+ // A network failure is retried a few times before it counts: the job
648
+ // often fires the moment a laptop wakes, before the connection is back.
649
+ " result = sync_once()",
650
+ " for delay in NETWORK_RETRY_DELAYS:",
651
+ " if result.returncode == 0 or classify(result.stdout, result.stderr, result.returncode)[1] != FIXES['network']:",
652
+ " break",
653
+ " with open(LOG, 'a', encoding='utf-8') as log:",
654
+ " log.write('HQ could not reach the network; trying again in %d s.\\n' % delay)",
655
+ " time.sleep(delay)",
656
+ " result = sync_once()",
574
657
  " if result.returncode != 0:",
575
658
  " reason, fix = classify(result.stdout, result.stderr, result.returncode)",
576
- ` sys.stdout.write('The ' + scheduled_time() + ${JSON.stringify(` hot-channel sync for ${input.company} did not finish: `)} + reason + '.\\n')`,
659
+ " alert, failures = note_failure(reason, fix == FIXES['network'])",
660
+ " if not alert:",
661
+ " log_quiet(failures)",
662
+ // Exit 0 so Fleet sends nothing: it turns any non-zero exit into a DM.
663
+ // The failure is in the log and in the sync's own run ledger.
664
+ " sys.exit(0)",
665
+ ` sys.stdout.write('The ' + scheduled_time() + ${JSON.stringify(` hot-channel sync for ${input.company} did not finish: `)} + reason + in_a_row(failures) + '.\\n')`,
577
666
  " sys.stdout.write('Fix: ' + fix + '\\n')",
578
667
  " sys.stdout.write('Log: ' + LOG + ' (run started ' + time.strftime('%Y-%m-%d %H:%M', STARTED) + ')\\n')",
579
668
  " sys.exit(128 - result.returncode if result.returncode < 0 else result.returncode)",
580
669
  " found, errors = signals_failures(result.stderr)",
581
- " if found:",
670
+ " if not found:",
671
+ " clear_streak()",
672
+ " else:",
582
673
  " reasons, fixes = [], []",
583
674
  " for error in errors:",
584
675
  " reason, fix = classify('', error, 1)",
@@ -586,9 +677,13 @@ export function renderFleetHotSignalSyncScript(input) {
586
677
  " reasons.append(reason)",
587
678
  " if fix not in fixes:",
588
679
  " fixes.append(fix)",
589
- ` sys.stdout.write('The ' + scheduled_time() + ${JSON.stringify(` hot-channel sync for ${input.company} landed sources but the signals step failed: `)} + '; '.join(found) + '. Cause: ' + '; '.join(reasons) + '.\\n')`,
590
- " sys.stdout.write('Fix: ' + ' Also, '.join(fixes) + '\\n')",
591
- " sys.stdout.write('Log: ' + LOG + ' (run started ' + time.strftime('%Y-%m-%d %H:%M', STARTED) + ')\\n')",
680
+ " alert, failures = note_failure('signals: ' + '; '.join(reasons), all(f == FIXES['network'] for f in fixes))",
681
+ " if not alert:",
682
+ " log_quiet(failures)",
683
+ " else:",
684
+ ` sys.stdout.write('The ' + scheduled_time() + ${JSON.stringify(` hot-channel sync for ${input.company} landed sources but the signals step failed: `)} + '; '.join(found) + '. Cause: ' + '; '.join(reasons) + in_a_row(failures) + '.\\n')`,
685
+ " sys.stdout.write('Fix: ' + ' Also, '.join(fixes) + '\\n')",
686
+ " sys.stdout.write('Log: ' + LOG + ' (run started ' + time.strftime('%Y-%m-%d %H:%M', STARTED) + ')\\n')",
592
687
  ]
593
688
  : [
594
689
  " with open(LOG, 'a', encoding='utf-8') as log:",
@@ -611,11 +706,15 @@ export function renderFleetHotSignalSyncScript(input) {
611
706
  ...(plainSync
612
707
  ? [
613
708
  `LEGACY_ARGS = ${JSON.stringify(legacyArgs)}`,
709
+ `STATE = ${JSON.stringify(path.join(path.dirname(input.logFile), `hot-signal-sync-${input.company}.state.json`))}`,
710
+ `NETWORK_RETRY_DELAYS = ${JSON.stringify(input.networkRetryDelaysSec ?? HOT_SIGNAL_SYNC_NETWORK_RETRY_DELAYS_SEC)}`,
711
+ `TRANSIENT_ALERT_AFTER = ${HOT_SIGNAL_SYNC_TRANSIENT_ALERT_AFTER}`,
614
712
  `FIXES = ${JSON.stringify(fixes)}`,
615
713
  "FIXES = dict((k, v.replace('DATE', time.strftime('%Y-%m-%d', STARTED))) for k, v in FIXES.items())",
616
714
  HOT_SIGNAL_SYNC_ALERT_HELPERS,
617
715
  `SIGNALS_FAILURE_PREFIX = ${JSON.stringify(SIGNALS_FAILURE_PREFIX)}`,
618
716
  HOT_SIGNAL_SYNC_SIGNALS_FAILURES,
717
+ HOT_SIGNAL_SYNC_STREAK,
619
718
  ]
620
719
  : []),
621
720
  "try:",
@@ -34,7 +34,7 @@ import { serveQmdWorker } from "../search-index/worker-process.js";
34
34
  import { inspectEngineHome, syncCoreUnitId } from "../sync-core/engine-home.js";
35
35
  import { fullModeHold } from "../sync-core/reconcile.js";
36
36
  import { engineVaultCount, readSyncCoreRolloutState } from "../sync-core/rollout-state.js";
37
- import { engineOwnsVault, finishLegacyHandBack } from "../sync-core/hand-back.js";
37
+ import { engineHoldBlocksHandBack, engineOwnsVault, finishLegacyHandBack } from "../sync-core/hand-back.js";
38
38
  import { effectiveEngineSettings, readSyncCoreVaultSettings } from "../sync-core/vault-settings.js";
39
39
  import { assertPersonalServiceSessionCapability, readRemoteControlPoolsConfig, remoteControlPoolSecretsEnv, } from "./remote-control-pools.js";
40
40
  import { loadLanesConfig } from "../lanes/config.js";
@@ -147,8 +147,9 @@ export function planUnitsWithSyncCoreInterlock(services, context, supervisor, re
147
147
  let personalOff = context.vaultSync.personalOff;
148
148
  const offCompanies = new Set(context.vaultSync.offCompanies);
149
149
  const engineStopped = (uid) => !!supervisor && supervisor.runningPlanKey(syncCoreUnitId(uid)) === undefined;
150
- const held = (context.syncCoreVaults ?? []).filter((vault) => vault.phase === "full" && engineStopped(vault.uid) && fullModeHold(vault, vault.release, context.platform));
151
- const handingBack = (context.syncCoreHandingBack ?? []).filter((vault) => engineStopped(vault.uid) && engineOwnsVault(context.home, vault.uid));
150
+ const held = (context.syncCoreVaults ?? []).filter((vault) => vault.phase === "full" && engineStopped(vault.uid) && fullModeHold(vault, vault.release, context.platform)
151
+ && !engineHoldBlocksHandBack(context.home, vault.uid));
152
+ const handingBack = (context.syncCoreHandingBack ?? []).filter((vault) => engineStopped(vault.uid) && engineOwnsVault(context.home, vault.uid) && !engineHoldBlocksHandBack(context.home, vault.uid));
152
153
  const handBack = [...held, ...handingBack];
153
154
  const restore = legacySwitchRestorePatch(handBack, context.vaultSync);
154
155
  if (restore.personal)
@@ -27,6 +27,12 @@ export declare const JQ_BEHAVIOR_PROBE: {
27
27
  readonly filter: "(if .a == null then \"\" else .a end) + \"|\" + (.b | ascii_upcase) + \"|\" + (.c | map(. * 2 | tostring) | join(\",\")) + \"|\" + (.d | to_entries | map(.key + \"=\" + .value) | join(\";\"))";
28
28
  readonly expected: "|X|2,4|e=f";
29
29
  };
30
+ /**
31
+ * Per probe step; real jq answers in milliseconds when idle, but spawning it
32
+ * under heavy CPU load can take several seconds. Ten seconds avoids false
33
+ * timeouts during load spikes while still failing closed on a hung stand-in.
34
+ */
35
+ export declare const PROBE_TIMEOUT_MS = 10000;
30
36
  export interface JqProbe {
31
37
  ok: boolean;
32
38
  version: string | null;
@@ -31,8 +31,12 @@ export const JQ_BEHAVIOR_PROBE = {
31
31
  filter: '(if .a == null then "" else .a end) + "|" + (.b | ascii_upcase) + "|" + (.c | map(. * 2 | tostring) | join(",")) + "|" + (.d | to_entries | map(.key + "=" + .value) | join(";"))',
32
32
  expected: "|X|2,4|e=f",
33
33
  };
34
- /** Per probe step; real jq answers in milliseconds. Keeps a cold check well under the client's timeout. */
35
- const PROBE_TIMEOUT_MS = 2_000;
34
+ /**
35
+ * Per probe step; real jq answers in milliseconds when idle, but spawning it
36
+ * under heavy CPU load can take several seconds. Ten seconds avoids false
37
+ * timeouts during load spikes while still failing closed on a hung stand-in.
38
+ */
39
+ export const PROBE_TIMEOUT_MS = 10_000;
36
40
  export class JqUnavailableError extends Error {
37
41
  rejected;
38
42
  note;
@@ -136,7 +140,7 @@ export function jqCandidates(env, platform = process.platform, vettedPaths = VET
136
140
  }
137
141
  return [...new Set([...vetted, ...fromPath])];
138
142
  }
139
- /** Probe results by real path, valid while the file's stat stamp is unchanged. */
143
+ /** Passing probe results by real path, valid while the file's stat stamp is unchanged. */
140
144
  const probeCache = new Map();
141
145
  /** For tests. */
142
146
  export function clearJqProbeCache() {
@@ -266,14 +270,22 @@ export async function resolveVerifiedJq(deps) {
266
270
  continue;
267
271
  let probe = probeCache.get(realPath);
268
272
  if (!probe || probe.stamp !== stamp) {
269
- probe = { stamp, probe: await probeJq(realPath, run, deps.timeoutMs) };
273
+ const result = await probeJq(realPath, run, deps.timeoutMs);
270
274
  // A verdict about replaced bytes must neither be cached nor used.
271
275
  if (stampOf(realPath) !== stamp) {
272
276
  probeCache.delete(realPath);
273
277
  rejected.push({ path: candidate, reason: "jq changed while it was being checked" });
274
278
  continue;
275
279
  }
276
- probeCache.set(realPath, probe);
280
+ probe = { stamp, probe: result };
281
+ // Only cache passing probes: a transient timeout under load must not
282
+ // lock out a working jq until the daemon restarts or the file changes.
283
+ if (result.ok) {
284
+ probeCache.set(realPath, probe);
285
+ }
286
+ else {
287
+ probeCache.delete(realPath);
288
+ }
277
289
  }
278
290
  if (!probe.probe.ok) {
279
291
  rejected.push({ path: candidate, reason: probe.probe.reason });
@@ -12,8 +12,10 @@ export declare const STORE_SCHEMA_V5 = "hq-delivery.store.v5";
12
12
  export declare const STORE_SCHEMA_V6 = "hq-delivery.store.v6";
13
13
  /** v7 (US-011 slice 4) adds a claim lease to every attempt (leaseExpiresAt). */
14
14
  export declare const STORE_SCHEMA_V7 = "hq-delivery.store.v7";
15
+ /** v8 (smart-ci US-001) adds the smart-ci namespace: keyed records and stream cursors. */
16
+ export declare const STORE_SCHEMA_V8 = "hq-delivery.store.v8";
15
17
  /** The store schema version this code writes. */
16
- export declare const STORE_SCHEMA_VERSION = "hq-delivery.store.v7";
18
+ export declare const STORE_SCHEMA_VERSION = "hq-delivery.store.v8";
17
19
  /** Every version this code can open, oldest first. Older ones migrate forward on open. */
18
20
  export declare const KNOWN_STORE_SCHEMA_VERSIONS: readonly string[];
19
21
  export type DeliveryStoreErrorCode = "STORE_CORRUPT" | "STORE_SCHEMA_NEWER" | "STORE_SCHEMA_UNKNOWN" | "STORE_INVALID_RECORD" | "CONTROLLER_OWNED" | "CONTROLLER_AMBIGUOUS" | "FENCED" | "STORE_CLOSED" | "STORE_IO" | "INVALID_RECORD" | "DUPLICATE_CONFLICT" | "UNKNOWN_RUN" | "UNKNOWN_JOB" | "UNKNOWN_DEPENDENCY" | "DEPENDENCY_CYCLE" | "NOT_CLAIMABLE" | "UNKNOWN_ATTEMPT" | "ATTEMPT_CONFLICT" | "ATTEMPT_ABANDONED" | "ACCESS_DENIED" | "WORKER_REVOKED" | "PRIVILEGE_REJECTED" | "CREDENTIAL_UNAVAILABLE" | "NOTIFICATION_UNVERIFIED" | "ARTIFACT_UNKNOWN" | "ARTIFACT_TAMPERED" | "ARTIFACT_NOT_PROMOTABLE" | "SIGNING_KEY_UNCONFIGURED" | "BACKUP_INVALID" | "RESTORE_PENDING" | "STORE_RETIRED" | "DEPLOY_BLOCKED" | "ENV_BUSY" | "DEPLOY_OUTCOME_UNKNOWN" | "STALE_PUBLICATION" | "UNKNOWN_DEPLOYMENT" | "TARGET_UNREACHABLE" | "RPC_TIMEOUT" | "RPC_CLOSED" | "RPC_UNREACHABLE" | "RPC_BAD_REQUEST" | "RPC_UNKNOWN_METHOD" | "RPC_TOO_LARGE" | "RPC_BAD_ANSWER" | "RPC_SERVER_ERROR" | "RPC_NOT_LOOPBACK" | "RPC_BUSY" | "LEASE_UNCONFIRMED";
@@ -129,6 +131,35 @@ export interface StoreState {
129
131
  deployments: StoredDeployment[];
130
132
  /** US-009: one admin-set, signed deploy policy per company. Workers never write it. */
131
133
  deployPolicies: StoredDeployPolicy[];
134
+ /** v8: the smart-ci namespace. Smart CI records and cursors live here and nowhere else. */
135
+ smartCi: SmartCiNamespace;
136
+ }
137
+ /**
138
+ * One smart-ci record (v8). `kind` and `id` together are unique, so writing
139
+ * the same observation again replaces the record and never adds a second one.
140
+ * The store checks this envelope only; src/lib/smart-ci owns each kind's body.
141
+ */
142
+ export interface StoredSmartCiRecord {
143
+ kind: string;
144
+ id: string;
145
+ /** When the record was first written, on the controller's clock. */
146
+ recordedAt: string;
147
+ recordedEpoch: number;
148
+ /** When the body last changed, on the controller's clock. */
149
+ updatedAt: string;
150
+ updatedEpoch: number;
151
+ body: Record<string, unknown>;
152
+ }
153
+ /** How far one smart-ci input stream has been read (v8). One entry per stream. */
154
+ export interface StoredSmartCiCursor {
155
+ stream: string;
156
+ position: string;
157
+ updatedAt: string;
158
+ updatedEpoch: number;
159
+ }
160
+ export interface SmartCiNamespace {
161
+ records: StoredSmartCiRecord[];
162
+ cursors: StoredSmartCiCursor[];
132
163
  }
133
164
  /**
134
165
  * blocked: refused by admission; carries a decision, no fence, no effect.
@@ -28,12 +28,14 @@ export const STORE_SCHEMA_V5 = "hq-delivery.store.v5";
28
28
  export const STORE_SCHEMA_V6 = "hq-delivery.store.v6";
29
29
  /** v7 (US-011 slice 4) adds a claim lease to every attempt (leaseExpiresAt). */
30
30
  export const STORE_SCHEMA_V7 = "hq-delivery.store.v7";
31
+ /** v8 (smart-ci US-001) adds the smart-ci namespace: keyed records and stream cursors. */
32
+ export const STORE_SCHEMA_V8 = "hq-delivery.store.v8";
31
33
  /** The store schema version this code writes. */
32
- export const STORE_SCHEMA_VERSION = STORE_SCHEMA_V7;
34
+ export const STORE_SCHEMA_VERSION = STORE_SCHEMA_V8;
33
35
  /** Every version this code can open, oldest first. Older ones migrate forward on open. */
34
- export const KNOWN_STORE_SCHEMA_VERSIONS = [STORE_SCHEMA_V1, STORE_SCHEMA_V2, STORE_SCHEMA_V3, STORE_SCHEMA_V4, STORE_SCHEMA_V5, STORE_SCHEMA_V6, STORE_SCHEMA_V7];
36
+ export const KNOWN_STORE_SCHEMA_VERSIONS = [STORE_SCHEMA_V1, STORE_SCHEMA_V2, STORE_SCHEMA_V3, STORE_SCHEMA_V4, STORE_SCHEMA_V5, STORE_SCHEMA_V6, STORE_SCHEMA_V7, STORE_SCHEMA_V8];
35
37
  const VERSION_PATTERN = /^hq-delivery\.store\.v(\d+)$/;
36
- const CURRENT_VERSION_NUMBER = 7;
38
+ const CURRENT_VERSION_NUMBER = 8;
37
39
  /** Every refusal from the delivery store. The message reads "CODE: found ...; expected .... action". */
38
40
  export class DeliveryStoreError extends Error {
39
41
  code;
@@ -69,7 +71,7 @@ export const DECISION_CODES = [
69
71
  ];
70
72
  export const OBSERVATION_SOURCES = ["apply-response", "apply-rejected", "transport-error", "stale-publication", "lease-lost", "target-query"];
71
73
  export function emptyState() {
72
- return { epoch: 0, controllers: [], runs: [], jobs: [], attempts: [], workers: [], artifacts: [], cache: [], deployments: [], deployPolicies: [] };
74
+ return { epoch: 0, controllers: [], runs: [], jobs: [], attempts: [], workers: [], artifacts: [], cache: [], deployments: [], deployPolicies: [], smartCi: { records: [], cursors: [] } };
73
75
  }
74
76
  export function stateChecksum(state) {
75
77
  return createHash("sha256").update(JSON.stringify(state)).digest("hex");
@@ -123,8 +125,8 @@ export function parseStoreText(text, source) {
123
125
  });
124
126
  }
125
127
  const envelope = () => readEnvelope(parsed, source);
126
- const state = version === STORE_SCHEMA_V7
127
- ? readEnvelope(parsed, source)
128
+ const v7 = () => version === STORE_SCHEMA_V7
129
+ ? envelope()
128
130
  : version === STORE_SCHEMA_V6
129
131
  ? migrateV6(envelope(), source)
130
132
  : version === STORE_SCHEMA_V5
@@ -136,6 +138,7 @@ export function parseStoreText(text, source) {
136
138
  : version === STORE_SCHEMA_V2
137
139
  ? migrateV6(migrateV5(migrateV4(migrateV3(migrateV2(envelope(), source), source), source), source), source)
138
140
  : migrateV6(migrateV5(migrateV4(migrateV1(parsed, source), source), source), source);
141
+ const state = version === STORE_SCHEMA_V8 ? readEnvelope(parsed, source) : migrateV7(v7(), source);
139
142
  const errors = validateState(state);
140
143
  if (errors.length > 0)
141
144
  throw invalidStore(source, errors);
@@ -187,7 +190,16 @@ function migrateV6(state, source) {
187
190
  });
188
191
  return { ...state, attempts };
189
192
  }
190
- /** The v2 to v7 file envelope: exactly storeSchemaVersion, sha256 and state, with a matching checksum. */
193
+ /**
194
+ * v7 → v8. v8 adds the smart-ci namespace, which starts empty. Nothing else
195
+ * changes. The v7 checksum is checked first, by readEnvelope.
196
+ */
197
+ function migrateV7(state, source) {
198
+ if ("smartCi" in state)
199
+ throw invalidStore(source, ["v7 state has a smartCi field; v7 has none"]);
200
+ return { ...state, smartCi: { records: [], cursors: [] } };
201
+ }
202
+ /** The v2 to v8 file envelope: exactly storeSchemaVersion, sha256 and state, with a matching checksum. */
191
203
  function readEnvelope(parsed, source) {
192
204
  const keys = Object.keys(parsed).sort().join(",");
193
205
  if (keys !== "sha256,state,storeSchemaVersion" || typeof parsed.sha256 !== "string" || !isObject(parsed.state)) {
@@ -348,7 +360,7 @@ function checkRecord(kind, input, where, errors) {
348
360
  /** All problems with a store state, or [] when it is valid. Never throws. */
349
361
  export function validateState(input) {
350
362
  const errors = [];
351
- if (!hasExactKeys(input, ["epoch", "controllers", "runs", "jobs", "attempts", "workers", "artifacts", "cache", "deployments", "deployPolicies"], "state", errors))
363
+ if (!hasExactKeys(input, ["epoch", "controllers", "runs", "jobs", "attempts", "workers", "artifacts", "cache", "deployments", "deployPolicies", "smartCi"], "state", errors))
352
364
  return errors;
353
365
  const epoch = isCount(input.epoch) ? input.epoch : null;
354
366
  if (epoch === null)
@@ -556,8 +568,57 @@ export function validateState(input) {
556
568
  validateArtifacts(input, attemptsById, checkEpoch, errors);
557
569
  validateDeployments(input, attemptsById, checkEpoch, errors);
558
570
  validateDeployPolicies(input, checkEpoch, errors);
571
+ validateSmartCi(input, checkEpoch, errors);
559
572
  return errors;
560
573
  }
574
+ /** v8 smart-ci namespace: the record and cursor envelopes. Bodies are checked by src/lib/smart-ci. */
575
+ function validateSmartCi(input, checkEpoch, errors) {
576
+ const ns = input.smartCi;
577
+ if (!hasExactKeys(ns, ["records", "cursors"], "state.smartCi", errors))
578
+ return;
579
+ const isTime = (v) => v !== null && isTimeOrNull(v);
580
+ const seen = new Set();
581
+ (Array.isArray(ns.records) ? ns.records : (errors.push("state.smartCi.records: not an array"), [])).forEach((r, i) => {
582
+ const where = `smartCi.records[${i}]`;
583
+ if (!hasExactKeys(r, ["kind", "id", "recordedAt", "recordedEpoch", "updatedAt", "updatedEpoch", "body"], where, errors))
584
+ return;
585
+ if (!isText(r.kind))
586
+ errors.push(`${where}.kind: not a non-empty string`);
587
+ if (!isText(r.id))
588
+ errors.push(`${where}.id: not a non-empty string`);
589
+ if (isText(r.kind) && isText(r.id)) {
590
+ const key = JSON.stringify([r.kind, r.id]);
591
+ if (seen.has(key))
592
+ errors.push(`${where}: duplicate ${r.kind} record ${r.id}`);
593
+ seen.add(key);
594
+ }
595
+ if (!isTime(r.recordedAt))
596
+ errors.push(`${where}.recordedAt: not a timestamp`);
597
+ if (!isTime(r.updatedAt))
598
+ errors.push(`${where}.updatedAt: not a timestamp`);
599
+ checkEpoch(r.recordedEpoch, `${where}.recordedEpoch`);
600
+ checkEpoch(r.updatedEpoch, `${where}.updatedEpoch`);
601
+ if (!isObject(r.body))
602
+ errors.push(`${where}.body: not an object`);
603
+ });
604
+ const streams = new Set();
605
+ (Array.isArray(ns.cursors) ? ns.cursors : (errors.push("state.smartCi.cursors: not an array"), [])).forEach((c, i) => {
606
+ const where = `smartCi.cursors[${i}]`;
607
+ if (!hasExactKeys(c, ["stream", "position", "updatedAt", "updatedEpoch"], where, errors))
608
+ return;
609
+ if (!isText(c.stream))
610
+ errors.push(`${where}.stream: not a non-empty string`);
611
+ else if (streams.has(c.stream))
612
+ errors.push(`${where}: duplicate cursor for stream ${c.stream}`);
613
+ else
614
+ streams.add(c.stream);
615
+ if (typeof c.position !== "string")
616
+ errors.push(`${where}.position: not a string`);
617
+ if (!isTime(c.updatedAt))
618
+ errors.push(`${where}.updatedAt: not a timestamp`);
619
+ checkEpoch(c.updatedEpoch, `${where}.updatedEpoch`);
620
+ });
621
+ }
561
622
  const isHex64 = (v) => typeof v === "string" && SHA256_HEX.test(v);
562
623
  const isText = (v) => typeof v === "string" && v !== "";
563
624
  /** US-008 artifact provenance and cache entries. Signatures are checked by artifacts.ts, which holds the key. */
@@ -22,8 +22,9 @@
22
22
  * file, and update that file's record in test/fixtures/PROVENANCE.md.
23
23
  */
24
24
  export declare const CLASSIFYING_ADAPTER_CORE_SHA256 = "cf1abd5c832722d26a46ced0694e8a3cd0d70ff30194a03fb2ce989289a8621c";
25
- /** Released v16.0.51 revision still supported by the Claude project adapter hold. */
25
+ /** Released v16.0.51 revision, accepted by the Claude project adapter hold and by the fleet-local and agents-v2 ports. */
26
26
  export declare const RELEASED_CLASSIFYING_ADAPTER_CORE_SHA256 = "09f5a3e05db016257f4515cf7e0101a9a34368a04c975337a5ce22f8dfe3dfb0";
27
+ export declare const RELEASED_CLASSIFYING_ADAPTER_CORE_FIXTURE = "adapter-stable-alias-16.0.51/core/scripts/lib/hook-adapter-core.sh";
27
28
  /** The fixture copy of the pinned revision, under crates/hq-hook/tests/fixtures. */
28
29
  export declare const CLASSIFYING_ADAPTER_CORE_FIXTURE = "adapter-stable-alias/core/scripts/lib/hook-adapter-core.sh";
29
30
  //# sourceMappingURL=adapter-core-pin.d.ts.map
@@ -22,8 +22,9 @@
22
22
  * file, and update that file's record in test/fixtures/PROVENANCE.md.
23
23
  */
24
24
  export const CLASSIFYING_ADAPTER_CORE_SHA256 = 'cf1abd5c832722d26a46ced0694e8a3cd0d70ff30194a03fb2ce989289a8621c';
25
- /** Released v16.0.51 revision still supported by the Claude project adapter hold. */
25
+ /** Released v16.0.51 revision, accepted by the Claude project adapter hold and by the fleet-local and agents-v2 ports. */
26
26
  export const RELEASED_CLASSIFYING_ADAPTER_CORE_SHA256 = '09f5a3e05db016257f4515cf7e0101a9a34368a04c975337a5ce22f8dfe3dfb0';
27
+ export const RELEASED_CLASSIFYING_ADAPTER_CORE_FIXTURE = 'adapter-stable-alias-16.0.51/core/scripts/lib/hook-adapter-core.sh';
27
28
  /** The fixture copy of the pinned revision, under crates/hq-hook/tests/fixtures. */
28
29
  export const CLASSIFYING_ADAPTER_CORE_FIXTURE = 'adapter-stable-alias/core/scripts/lib/hook-adapter-core.sh';
29
30
  //# sourceMappingURL=adapter-core-pin.js.map
@@ -185,6 +185,21 @@ export declare const SESSION_START_PINS: ReadonlyArray<readonly [string, readonl
185
185
  * any revision it does not rebuild. Null when every file matches.
186
186
  */
187
187
  export declare function sessionStartHold(root: string): string | null;
188
+ /**
189
+ * The script revisions the native SessionStart `migrate-policy-triggers` port rebuilds
190
+ * (`crates/hq-hook/src/session_start_ss1/migrate_triggers.rs`: `SCRIPT_SHA256`,
191
+ * `FORWARDER_SHA256`, `FORWARDER_LIB_SHA256`; hq-core v16.0.47 through v16.0.50).
192
+ * A missing script is skipped silently by both master-hook and the native port, so only a
193
+ * present file whose hash is outside the accepted set holds SessionStart on master-hook.
194
+ */
195
+ export declare const MIGRATE_POLICY_TRIGGERS_PINS: ReadonlyArray<readonly [string, readonly string[]]>;
196
+ /**
197
+ * Why SessionStart must stay on master-hook for `migrate-policy-triggers` in `root`: the hook
198
+ * script is present on disk and either it or its forwarder/library is not a pinned revision.
199
+ * Absent hook script (or absent forwarder) is a silent no-op on both shell and native, so it
200
+ * does not hold. Null when every present pinned file matches.
201
+ */
202
+ export declare function migratePolicyTriggersHold(root: string): string | null;
188
203
  /**
189
204
  * The one Codex adapter pair the native Codex SubagentStop is modelled on (hq-core v16.0.47):
190
205
  * `ADAPTER_RELEASES` and `ADAPTER_CORE_RELEASES` in crates/hq-hook/src/post_hooks/codex.rs.
@@ -1743,6 +1743,11 @@ export function uncoveredHooks(root, host, event, covers, env = process.env) {
1743
1743
  if (hold)
1744
1744
  missing.push(`(native ${event} compatibility: ${hold})`);
1745
1745
  }
1746
+ if (event === 'SessionStart' && covered.includes('migrate-policy-triggers')) {
1747
+ const hold = migratePolicyTriggersHold(root);
1748
+ if (hold)
1749
+ missing.push(`(native SessionStart compatibility: ${hold})`);
1750
+ }
1746
1751
  if (host === 'agents-v2' && event === 'PreToolUse' && covered.includes('agents-v2-adapter:PreToolUse')) {
1747
1752
  const hold = sessionStartHold(root);
1748
1753
  if (hold)
@@ -1790,6 +1795,59 @@ export function sessionStartHold(root) {
1790
1795
  }
1791
1796
  return null;
1792
1797
  }
1798
+ /**
1799
+ * The script revisions the native SessionStart `migrate-policy-triggers` port rebuilds
1800
+ * (`crates/hq-hook/src/session_start_ss1/migrate_triggers.rs`: `SCRIPT_SHA256`,
1801
+ * `FORWARDER_SHA256`, `FORWARDER_LIB_SHA256`; hq-core v16.0.47 through v16.0.50).
1802
+ * A missing script is skipped silently by both master-hook and the native port, so only a
1803
+ * present file whose hash is outside the accepted set holds SessionStart on master-hook.
1804
+ */
1805
+ export const MIGRATE_POLICY_TRIGGERS_PINS = [
1806
+ [
1807
+ '.claude/hooks/migrate-policy-triggers-if-changed.sh',
1808
+ [
1809
+ '4f4cf879bf31750a87386de0db5efa6d166116da629cf2d31819b7a21faa8335',
1810
+ '1a01eb3c4a46bd04cc6ed7d5c465405343200b3baf391b2d1f4f393577d639f2',
1811
+ ],
1812
+ ],
1813
+ [
1814
+ 'core/scripts/migrate-policy-triggers.sh',
1815
+ ['9fac89fba7cc04d31aed493aee9d1a43670c0d3e570675e01be466ebe156cee6'],
1816
+ ],
1817
+ [
1818
+ 'core/scripts/lib/forwarder.sh',
1819
+ ['a030068f482cac2ecbfad90394fd7bcd1e24926e9179bcec5c770076ad6e4fc4'],
1820
+ ],
1821
+ ];
1822
+ /**
1823
+ * Why SessionStart must stay on master-hook for `migrate-policy-triggers` in `root`: the hook
1824
+ * script is present on disk and either it or its forwarder/library is not a pinned revision.
1825
+ * Absent hook script (or absent forwarder) is a silent no-op on both shell and native, so it
1826
+ * does not hold. Null when every present pinned file matches.
1827
+ */
1828
+ export function migratePolicyTriggersHold(root) {
1829
+ const hookPath = path.join(root, MIGRATE_POLICY_TRIGGERS_PINS[0][0]);
1830
+ if (!fs.existsSync(hookPath))
1831
+ return null;
1832
+ for (const [index, [relative, shas]] of MIGRATE_POLICY_TRIGGERS_PINS.entries()) {
1833
+ const file = path.join(root, relative);
1834
+ if (index === 1 && !fs.existsSync(file))
1835
+ return null;
1836
+ let bytes;
1837
+ try {
1838
+ if (!fs.statSync(file).isFile())
1839
+ return `unreadable SessionStart file ${relative}`;
1840
+ bytes = fs.readFileSync(file);
1841
+ }
1842
+ catch {
1843
+ return `unreadable SessionStart file ${relative}`;
1844
+ }
1845
+ if (!shas.includes(createHash('sha256').update(bytes).digest('hex'))) {
1846
+ return `unmodeled SessionStart file ${relative}`;
1847
+ }
1848
+ }
1849
+ return null;
1850
+ }
1793
1851
  /**
1794
1852
  * The one Codex adapter pair the native Codex SubagentStop is modelled on (hq-core v16.0.47):
1795
1853
  * `ADAPTER_RELEASES` and `ADAPTER_CORE_RELEASES` in crates/hq-hook/src/post_hooks/codex.rs.
@@ -1895,7 +1953,7 @@ export const GROK_STOP_OBSERVE_SESSION_ID_LEAF = 'b373b582a906b0993a3ce56aa43c1e
1895
1953
  */
1896
1954
  export const GROK_STOP_OBSERVE_SESSION_ID_PIN = {
1897
1955
  relative: 'core/scripts/lib/session-id.sh',
1898
- accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d'],
1956
+ accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d', 'd6a04155571ec53edd853878cebaba5a5bab93801a73e356499440c1cd009c71'],
1899
1957
  missing: 'allowed',
1900
1958
  };
1901
1959
  /**
@@ -1964,6 +2022,7 @@ export const PRE_TOOL_USE_DISPATCHER_PINS = [
1964
2022
  accepted: [
1965
2023
  'a443b481d895e74b46743548d049644ab011b1e5cb8ae3fcb8da1a6a169cd364',
1966
2024
  'fab0ada24e4ac09e05eb5293a795f7f2bde4d58b47ac5112bfc8a5ad4900eda5',
2025
+ '4dd7f5296934d4488c137c9a485d4c9d55b597ee3aa2ceb6dbc3afdb0d3c1a74',
1967
2026
  ],
1968
2027
  },
1969
2028
  { relative: '.claude/hooks/hook-timeout-probe.sh', accepted: ['ae5c40212c088044205e246a5715a53f52c28f4021e798bd7a74df6ba570113b'] },
@@ -2199,6 +2258,7 @@ export function promptCompanyBindHold(root) {
2199
2258
  * (crates/hq-hook/src/gate/facts.rs `accepted_hook_lib_sha256`).
2200
2259
  */
2201
2260
  export const POLICY_GATE_REVISIONS = [
2261
+ { revision: 'Core16_0_51', gate: 'ca58a94859eae0a345c11c8d9c59303eb76350dc1cf223391037d21979c28718', hookLibs: ['9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f'] },
2202
2262
  { revision: 'Staging2018', gate: '1bc4df8eaabded175804d2effba704c93b439df05c0867f85bb27f5dcfbc7914', hookLibs: ['9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f'] },
2203
2263
  { revision: 'Core16_0_48Beta90', gate: 'a2879dfe692233f5953bac86672947bbd82f3c5247292f3efcb80f16c3d2c6b1', hookLibs: ['9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f', '49c337ceccf0a2d7c2a64f6b1de8c3c4d1da507bc5d7afcd01ed292e1f25abf7', 'be7ca74b2524afba56fefd530bf46cbd1dd39a4c181b6a64c87e124b29bdebe7'] },
2204
2264
  { revision: 'Core16_0_48Beta68', gate: '6005f2315210c31daf0c870b768303bfd15f58f3416c52b6e02da9bcb430e9bb', hookLibs: ['c3eb950f80aea21d3f8ad2bc0f76656e6c5a39a5197b4d985aa03d13144fc8a7'] },
@@ -2242,6 +2302,7 @@ export const GROK_POST_TOOL_USE_GENERATIONS = [
2242
2302
  /** The hook-adapter-core.sh revisions of crates/hq-hook/src/host/fleet/local_pre.rs `RELEASED_CORE_SHA256`. */
2243
2303
  export const FLEET_LOCAL_ADAPTER_CORE = [
2244
2304
  '940bb5a0a268929a4cd3f88b61a0ce619f0fdf64e5d3f25f7f18da35df466ab5',
2305
+ RELEASED_CLASSIFYING_ADAPTER_CORE_SHA256,
2245
2306
  CLASSIFYING_ADAPTER_CORE_SHA256,
2246
2307
  ];
2247
2308
  /**
@@ -18,6 +18,9 @@ export type FleetEngineLookup = CoreNextEngineLookup;
18
18
  /** Self-check, then probe, then the host claim. */
19
19
  export declare function fleetEngineCapabilities(engine: string, probe?: typeof probeEngine, verify?: typeof verifyHookEngine, host?: FleetHost): EngineCapabilities;
20
20
  export declare function inspectFleetEngine(engine: string, home: string, probe?: typeof probeEngine, verify?: typeof verifyHookEngine, lookup?: FleetEngineLookup, host?: FleetHost): EngineCapabilities;
21
+ export declare const HAND_BACK_SCHEMA = "hq-hook.hand-back.v1";
22
+ export type HandBackQuery = (engine: string, args: string[], env: NodeJS.ProcessEnv) => string;
23
+ export declare function engineHandBack(caps: EngineCapabilities, argv: string[], env: NodeJS.ProcessEnv, query?: HandBackQuery): string | null;
21
24
  export interface FleetPlanOptions {
22
25
  home: string;
23
26
  env?: NodeJS.ProcessEnv;
@@ -27,6 +30,7 @@ export interface FleetPlanOptions {
27
30
  inspect?: (engine: string) => EngineCapabilities;
28
31
  /** Test injection. Production passes nothing and uses the desktop lookup. */
29
32
  lookup?: FleetEngineLookup;
33
+ handBackQuery?: HandBackQuery;
30
34
  }
31
35
  export interface FleetPlanEntry {
32
36
  mode: 'native' | 'shell';