@indigoai-us/hq-cli 5.281.0 → 5.283.0

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 (64) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/assets/scaffold/.claude/hooks/validate-policy-frontmatter.sh +485 -0
  3. package/assets/scaffold/core/scripts/eval-trigger.sh +193 -0
  4. package/assets/scaffold/core/scripts/policy-age-report.sh +156 -0
  5. package/assets/scaffold/core/scripts/policy-retire.sh +199 -0
  6. package/assets/scaffold/core/scripts/read-policy-frontmatter.sh +32 -0
  7. package/dist/command-catalog.generated.d.ts +67 -0
  8. package/dist/command-catalog.generated.js +83 -0
  9. package/dist/commands/core-knowledge-prefs.d.ts +10 -0
  10. package/dist/commands/core-knowledge-prefs.js +125 -0
  11. package/dist/commands/core-native-policy-flag.d.ts +9 -0
  12. package/dist/commands/core-native-policy-flag.js +12 -0
  13. package/dist/commands/core-ontology-native.d.ts +0 -1
  14. package/dist/commands/core-ontology-native.js +2 -30
  15. package/dist/commands/core-ontology.d.ts +4 -0
  16. package/dist/commands/core-ontology.js +8 -3
  17. package/dist/commands/core-policy-frontmatter.d.ts +8 -0
  18. package/dist/commands/core-policy-frontmatter.js +52 -0
  19. package/dist/commands/core-policy.d.ts +15 -0
  20. package/dist/commands/core-policy.js +982 -0
  21. package/dist/commands/core.js +14 -1
  22. package/dist/commands/lanes-message.js +1 -0
  23. package/dist/commands/lanes-move.js +2 -0
  24. package/dist/commands/lanes-resume.js +1 -0
  25. package/dist/commands/lanes-shared.d.ts +10 -1
  26. package/dist/commands/lanes-shared.js +2 -1
  27. package/dist/commands/lanes.d.ts +8 -0
  28. package/dist/commands/lanes.js +324 -93
  29. package/dist/fast-lanes-list-route.d.ts +8 -0
  30. package/dist/fast-lanes-list-route.js +30 -0
  31. package/dist/fast-lanes-list.d.ts +3 -0
  32. package/dist/fast-lanes-list.js +252 -0
  33. package/dist/fast-scaffold.d.ts +5 -0
  34. package/dist/fast-scaffold.js +10 -0
  35. package/dist/index.js +10 -1
  36. package/dist/lib/checkpoint-ontology/merge-copies.d.ts +24 -1
  37. package/dist/lib/checkpoint-ontology/merge-copies.js +70 -1
  38. package/dist/lib/lanes/flag-keys.d.ts +3 -0
  39. package/dist/lib/lanes/flag-keys.js +3 -0
  40. package/dist/lib/lanes/index.d.ts +1 -1
  41. package/dist/lib/lanes/index.js +1 -1
  42. package/dist/lib/lanes/keep-alive.js +1 -0
  43. package/dist/lib/lanes/outpost-dispatch.d.ts +1 -1
  44. package/dist/lib/lanes/outpost-dispatch.js +4 -2
  45. package/dist/lib/lanes/outpost-hire-cache.d.ts +3 -0
  46. package/dist/lib/lanes/outpost-hire-cache.js +11 -3
  47. package/dist/lib/lanes/outpost-snapshot-cache.d.ts +26 -0
  48. package/dist/lib/lanes/outpost-snapshot-cache.js +215 -0
  49. package/dist/lib/lanes/reconcile.d.ts +7 -1
  50. package/dist/lib/lanes/reconcile.js +88 -16
  51. package/dist/lib/lanes/spawn.js +5 -0
  52. package/dist/lib/lanes/store.d.ts +4 -0
  53. package/dist/lib/lanes/store.js +66 -0
  54. package/dist/lib/lanes/throttle.d.ts +29 -2
  55. package/dist/lib/lanes/throttle.js +145 -5
  56. package/dist/lib/lanes/types.d.ts +8 -1
  57. package/dist/lib/lanes/types.js +2 -1
  58. package/dist/lib/lanes/watcher.js +1 -0
  59. package/dist/lib/policy-validator.d.ts +2 -0
  60. package/dist/lib/policy-validator.js +136 -0
  61. package/dist/native-fast-route.d.ts +2 -0
  62. package/dist/native-fast-route.js +6 -2
  63. package/dist/utils/contribution-table.d.ts +1 -1
  64. package/package.json +1 -1
@@ -32,6 +32,8 @@ import { Option } from "commander";
32
32
  import { registerCoreCheckpointCommand } from "./core-checkpoint.js";
33
33
  import { registerCoreDelegateCommand } from "./core-delegate.js";
34
34
  import { registerCoreOntologyCommand } from "./core-ontology.js";
35
+ import { registerCoreKnowledgePrefsCommand } from "./core-knowledge-prefs.js";
36
+ import { registerCorePolicyCommand } from "./core-policy.js";
35
37
  import { registerCoreCheckpointGateSettingCommand } from "./core-checkpoint-gate-setting.js";
36
38
  import { resolveLiveRoot } from "../utils/hq-roots.js";
37
39
  import { interpreterFor, runBundledScript } from "../utils/run-bundled-script.js";
@@ -230,7 +232,16 @@ export const SCAFFOLD_ONLY_ASSETS = [
230
232
  { asset: "core/scripts/ontology-garden.mjs", root: "live", summary: "Rollback companion for native ontology garden" },
231
233
  { asset: "core/scripts/ontology-source-worklist.sh", root: "live", summary: "Rollback companion for native ontology source worklist" },
232
234
  { asset: "core/scripts/source-yaml-validate.sh", root: "cwd", summary: "Rollback companion for native source YAML validation" },
233
- { asset: "core/scripts/knowledge-prefs.sh", root: "live", summary: "Sibling dependency for ontology candidate rollback companion" },
235
+ // Shared by native knowledge-prefs and the ontology candidate shell fallback.
236
+ { asset: "core/scripts/knowledge-prefs.sh", root: "live", summary: "Rollback companion for native knowledge-prefs and ontology candidate" },
237
+ // Rollback companions for the default-off native knowledge and policy routes.
238
+ // policy-retire also runs the scaffold validator in-process when native, but
239
+ // its bundled shell fallback needs both helper assets at these exact paths.
240
+ { asset: "core/scripts/policy-age-report.sh", root: "live", summary: "Rollback companion for native policy age-report" },
241
+ { asset: "core/scripts/policy-retire.sh", root: "live", summary: "Rollback companion for native policy retire" },
242
+ { asset: "core/scripts/read-policy-frontmatter.sh", root: "cwd", summary: "Rollback companion for native policy frontmatter" },
243
+ { asset: "core/scripts/eval-trigger.sh", root: "live", summary: "Trigger grammar helper used by the policy validator companion" },
244
+ { asset: ".claude/hooks/validate-policy-frontmatter.sh", root: "live", summary: "Policy validator companion used by policy-retire rollback" },
234
245
  ...NATIVE_UTILITY_COMMANDS.map(({ asset, root, summary }) => ({
235
246
  asset,
236
247
  root,
@@ -307,6 +318,8 @@ export function registerCoreCommands(program) {
307
318
  registerCoreOntologyCommand(core);
308
319
  registerCoreCheckpointGateSettingCommand(core);
309
320
  registerCoreDelegateCommand(core);
321
+ registerCoreKnowledgePrefsCommand(core);
322
+ registerCorePolicyCommand(core);
310
323
  // These command names intentionally own native implementations. Their
311
324
  // similarly named scaffold assets are forwarders, so sending them through
312
325
  // runEntry would recurse back into this command forever.
@@ -507,6 +507,7 @@ export function createLaneMessageHandlers(deps) {
507
507
  ...current,
508
508
  state: "queued",
509
509
  queued_reason: admission.reason ?? "throttle",
510
+ queued_details: undefined,
510
511
  queued_at: at,
511
512
  pending_resume: {
512
513
  session_id: sessionId,
@@ -156,6 +156,7 @@ export function createLaneMoveHandlers(deps) {
156
156
  host: target,
157
157
  account,
158
158
  queued_reason: undefined,
159
+ queued_details: undefined,
159
160
  admission_reserved_at: undefined,
160
161
  }));
161
162
  }, ctx.sleep);
@@ -218,6 +219,7 @@ export function createLaneMoveHandlers(deps) {
218
219
  host: before.host,
219
220
  account: before.account,
220
221
  queued_reason: before.queued_reason,
222
+ queued_details: before.queued_details,
221
223
  admission_reserved_at: before.admission_reserved_at,
222
224
  }));
223
225
  return true;
@@ -317,6 +317,7 @@ export function createLaneResumeHandlers(deps) {
317
317
  ...current,
318
318
  state: "queued",
319
319
  queued_reason: admission.reason ?? "throttle",
320
+ queued_details: undefined,
320
321
  queued_at: at,
321
322
  pending_resume: {
322
323
  session_id: sessionId,
@@ -1,6 +1,7 @@
1
1
  import type { LaneCompanyRef, LanePlacementPolicy, LaneRecord, LanesConfig, QuestionAnswer, QuestionBody, QuestionRecord, SeniorRef, AccountHistoryEntry, LaneAccountSelection, PendingResume, QueuedReason, ResolvedLaneWorker, LivenessDeps, MachineIdentity, MonitorEvidenceReader, ReconcileHost, RunCommand, ThrottleDeps, withLaneHireLocks } from "../lib/lanes/index.js";
2
2
  import type { OutpostIdentity } from "../lib/lanes/admission-host.js";
3
3
  import type { OutpostDispatchResult } from "../lib/lanes/outpost-dispatch.js";
4
+ import type { CpuBusySource } from "../lib/lanes/throttle.js";
4
5
  import type { ProbeCommand } from "../lib/lanes/models.js";
5
6
  import type { KillProcessFn, ProveDetachedFn, SpawnProcessFn } from "../lib/lanes/spawn.js";
6
7
  import type { WatcherLoopDeps } from "../lib/lanes/watcher.js";
@@ -8,6 +9,7 @@ import type { RunCompactionFn } from "../lib/lanes/compaction.js";
8
9
  import type { LaneMesh, LaneMeshEvent } from "../lib/lanes/mesh-events.js";
9
10
  import type { BalanceHostGap, BalanceHostSnapshot } from "../lib/lanes/claude-balance.js";
10
11
  import type { HostCapacitySnapshot } from "../lib/lanes/host-capacity.js";
12
+ import { LANE_OUTPOST_LOAD_BALANCING_FLAG } from "../lib/lanes/flag-keys.js";
11
13
  import { type ResolvedEffort } from "../lib/lanes/effort.js";
12
14
  import type { SessionCopyResult } from "../lib/lanes/move-account.js";
13
15
  import type { WorkerProfile } from "../lib/lanes/profile.js";
@@ -81,6 +83,11 @@ export interface AdmissionResult {
81
83
  action: "start" | "queue" | "refuse";
82
84
  reason?: QueuedReason;
83
85
  error?: LanesError;
86
+ throttle?: {
87
+ last_busy: number | null;
88
+ busy_source: CpuBusySource | undefined;
89
+ sampled_at: string | undefined;
90
+ };
84
91
  }
85
92
  export interface PrepareAccountMoveInput {
86
93
  account: string;
@@ -239,6 +246,8 @@ export interface Ctx {
239
246
  backfillOutpostIdentity: (expectedId: string) => "created" | "unchanged";
240
247
  fetchText: (url: string) => Promise<string>;
241
248
  lanePlacementEnabled: (company: LaneCompanyRef | undefined) => Promise<boolean>;
249
+ outpostSnapshotCacheEnabled: () => Promise<boolean>;
250
+ startOutpostLaneSnapshotRefresh: (hqRoot: string) => void;
242
251
  storyLedgerEnabled: () => boolean;
243
252
  isSsmOwnerDispatch: () => boolean;
244
253
  withGrantHireLocks: typeof withLaneHireLocks;
@@ -249,7 +258,7 @@ export interface OutpostRouteIdentity {
249
258
  outpostId: string;
250
259
  instanceName?: string;
251
260
  }
252
- export declare const LANE_OUTPOST_LOAD_BALANCING_FLAG = "lanes.outpost-load-balancing";
261
+ export { LANE_OUTPOST_LOAD_BALANCING_FLAG };
253
262
  export declare const CLAUDE_ACCOUNT_BALANCE_SIGNALS_FLAG = "lanes.claude-account-balance-signals";
254
263
  export declare function defaultLanePlacementEnabled(company: LaneCompanyRef | undefined): Promise<boolean>;
255
264
  export declare function readLanePlacementEnabled(ctx: Ctx, company: LaneCompanyRef | undefined): Promise<boolean>;
@@ -1,5 +1,6 @@
1
1
  import { resolveProcessFlagCompanyContext } from "../lib/flag-registry.js";
2
2
  import { readLanesRegistryFlag } from "../lib/lanes/registry-flag.js";
3
+ import { LANE_OUTPOST_LOAD_BALANCING_FLAG } from "../lib/lanes/flag-keys.js";
3
4
  import { resolveLaneEffort } from "../lib/lanes/effort.js";
4
5
  import { LanesError } from "../lib/lanes/errors.js";
5
6
  import { AccountResolutionError, accountStatus, loadLanesConfig } from "../lib/lanes/index.js";
@@ -98,7 +99,7 @@ export function recordedResumeEffort(lane) {
98
99
  source: lane.effort_source ?? "none",
99
100
  };
100
101
  }
101
- export const LANE_OUTPOST_LOAD_BALANCING_FLAG = "lanes.outpost-load-balancing";
102
+ export { LANE_OUTPOST_LOAD_BALANCING_FLAG };
102
103
  export const CLAUDE_ACCOUNT_BALANCE_SIGNALS_FLAG = "lanes.claude-account-balance-signals";
103
104
  function lanePlacementFlagErrorCode(error) {
104
105
  if (error && typeof error === "object") {
@@ -14,6 +14,7 @@ import type { OutpostIdentity } from "../lib/lanes/admission-host.js";
14
14
  export { OUTPOST_DIR, OUTPOST_ID_PATH, readOutpostIdentity } from "../lib/lanes/admission-host.js";
15
15
  export type { OutpostIdentity } from "../lib/lanes/admission-host.js";
16
16
  import { type OutpostDispatchResult } from "../lib/lanes/outpost-dispatch.js";
17
+ import { LANE_OUTPOST_SNAPSHOT_CACHE_FLAG } from "../lib/lanes/outpost-hire-cache.js";
17
18
  import { emitLaneDecisionEvents } from "../lib/lanes/mesh-events.js";
18
19
  import { MAX_LANE_DEPTH, withLaneHireLocks, type LaneCompanyRef, type QuestionBody, type LaneRecord, type QuestionRecord, type ResolvedLaneWorker, type SeniorRef, type LivenessDeps, type MachineIdentity, type MonitorEvidenceReader, type RunCommand, type ThrottleDeps } from "../lib/lanes/index.js";
19
20
  import { questionBodyAbsPath } from "../lib/lanes/questions.js";
@@ -87,6 +88,10 @@ export interface LanesCommandDeps {
87
88
  monitorEvidence?: MonitorEvidenceReader;
88
89
  /** Test seam for the default-off outpost placement rollout flag. */
89
90
  lanePlacementEnabled?: (company: LaneCompanyRef | undefined) => Promise<boolean>;
91
+ /** Test seam for the default-off shared Outpost snapshot cache. */
92
+ outpostSnapshotCacheEnabled?: () => Promise<boolean>;
93
+ /** Test seam for the detached refresh started by the cache-first lane list. */
94
+ startOutpostLaneSnapshotRefresh?: (hqRoot: string) => void;
90
95
  /** Test seam for the default-off story ledger flag. */
91
96
  storyLedgerEnabled?: () => boolean;
92
97
  /** Test seam for the SSM-only Outpost owner grant path. */
@@ -98,6 +103,7 @@ export interface LanesCommandDeps {
98
103
  /** Test seam for the repository-merge-hold registry flag. */
99
104
  mergeHoldEnabled?: (company: LaneCompanyRef) => boolean | Promise<boolean>;
100
105
  }
106
+ export { LANE_OUTPOST_SNAPSHOT_CACHE_FLAG };
101
107
  export declare function parseSeniorRef(raw: string): SeniorRef;
102
108
  export declare function parseQuestionBody(raw: unknown): QuestionBody | null;
103
109
  /**
@@ -140,6 +146,8 @@ export declare function pickupFailureUpdater(reasonRaw: string, details: Record<
140
146
  */
141
147
  export declare function applyOutpostAccountPickup(hqRoot: string, laneId: string, modelDeps?: KnownModelsDeps): LaneRecord;
142
148
  export declare function cancelPendingQuestionsForLane(hqRoot: string, laneId: string, nowIso: string, operatorReason?: string): QuestionRecord[];
149
+ /** Keeps the placement-enabled cache-first path on the full lane command graph. */
150
+ export declare function runFastCachedLanesListFromEntrypoint(): Promise<void>;
143
151
  export declare function stopCommittedState(state: LaneRecord["state"]): "cancelled" | "killed";
144
152
  /** Stderr notice that `stop` ends a lane for good, naming the resumable path. */
145
153
  export declare function stopTerminalWarning(laneId: string): string;