@indigoai-us/hq-cli 5.126.0 → 5.127.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 (76) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/assets/lanes-hooks/hq-lanes-drain.json +15 -0
  3. package/assets/lanes-hooks/hq-lanes-drain.mjs +254 -0
  4. package/assets/lanes-hooks/hq-lanes-drain.sh +21 -0
  5. package/assets/lanes-reconcile/hq-lanes-reconcile.service +11 -0
  6. package/assets/lanes-reconcile/hq-lanes-reconcile.timer +12 -0
  7. package/dist/command-catalog.generated.d.ts +245 -11
  8. package/dist/command-catalog.generated.js +323 -11
  9. package/dist/command-registration-plan.d.ts +1 -0
  10. package/dist/command-registration-plan.js +11 -2
  11. package/dist/commands/agents.d.ts +12 -0
  12. package/dist/commands/agents.js +46 -2
  13. package/dist/commands/lanes.d.ts +55 -16
  14. package/dist/commands/lanes.js +1187 -250
  15. package/dist/commands/mesh.js +254 -19
  16. package/dist/lib/lanes/accounts.d.ts +67 -7
  17. package/dist/lib/lanes/accounts.js +233 -43
  18. package/dist/lib/lanes/compaction.d.ts +96 -0
  19. package/dist/lib/lanes/compaction.js +197 -0
  20. package/dist/lib/lanes/config.d.ts +15 -0
  21. package/dist/lib/lanes/config.js +65 -8
  22. package/dist/lib/lanes/delivery.d.ts +151 -0
  23. package/dist/lib/lanes/delivery.js +354 -0
  24. package/dist/lib/lanes/dropbox.d.ts +96 -0
  25. package/dist/lib/lanes/dropbox.js +408 -0
  26. package/dist/lib/lanes/effort.d.ts +50 -0
  27. package/dist/lib/lanes/effort.js +109 -0
  28. package/dist/lib/lanes/errors.d.ts +2 -2
  29. package/dist/lib/lanes/hooks-install.d.ts +81 -0
  30. package/dist/lib/lanes/hooks-install.js +326 -0
  31. package/dist/lib/lanes/hq-root.d.ts +19 -0
  32. package/dist/lib/lanes/hq-root.js +28 -0
  33. package/dist/lib/lanes/index.d.ts +35 -5
  34. package/dist/lib/lanes/index.js +19 -4
  35. package/dist/lib/lanes/liveness.d.ts +7 -1
  36. package/dist/lib/lanes/liveness.js +64 -5
  37. package/dist/lib/lanes/machine-identity.d.ts +34 -0
  38. package/dist/lib/lanes/machine-identity.js +92 -0
  39. package/dist/lib/lanes/mesh-events.d.ts +109 -0
  40. package/dist/lib/lanes/mesh-events.js +275 -0
  41. package/dist/lib/lanes/outpost-dispatch.d.ts +65 -0
  42. package/dist/lib/lanes/outpost-dispatch.js +90 -0
  43. package/dist/lib/lanes/questions.d.ts +75 -0
  44. package/dist/lib/lanes/questions.js +243 -0
  45. package/dist/lib/lanes/quota.d.ts +95 -0
  46. package/dist/lib/lanes/quota.js +320 -0
  47. package/dist/lib/lanes/reconcile-install.d.ts +69 -0
  48. package/dist/lib/lanes/reconcile-install.js +221 -0
  49. package/dist/lib/lanes/reconcile.d.ts +102 -0
  50. package/dist/lib/lanes/reconcile.js +985 -0
  51. package/dist/lib/lanes/registry.d.ts +18 -5
  52. package/dist/lib/lanes/registry.js +293 -19
  53. package/dist/lib/lanes/spawn.d.ts +274 -0
  54. package/dist/lib/lanes/spawn.js +1363 -0
  55. package/dist/lib/lanes/store.d.ts +7 -3
  56. package/dist/lib/lanes/store.js +150 -32
  57. package/dist/lib/lanes/types.d.ts +346 -4
  58. package/dist/lib/lanes/types.js +138 -5
  59. package/dist/lib/lanes/watcher-main.d.ts +9 -0
  60. package/dist/lib/lanes/watcher-main.js +22 -0
  61. package/dist/lib/lanes/watcher.d.ts +216 -0
  62. package/dist/lib/lanes/watcher.js +859 -0
  63. package/dist/lib/mesh/api.d.ts +71 -7
  64. package/dist/lib/mesh/api.js +167 -28
  65. package/dist/lib/mesh/live/backfill-held.d.ts +18 -7
  66. package/dist/lib/mesh/live/backfill-held.js +66 -21
  67. package/dist/lib/mesh/live/daemon/run.d.ts +2 -0
  68. package/dist/lib/mesh/live/daemon/run.js +111 -54
  69. package/dist/lib/mesh/live/daemon/state.d.ts +2 -0
  70. package/dist/lib/mesh/live/daemon/transcript-watch.d.ts +3 -0
  71. package/dist/lib/mesh/live/daemon/transcript-watch.js +31 -8
  72. package/dist/lib/scan-packages/index.d.ts +2 -0
  73. package/dist/lib/scan-packages/index.js +1 -1
  74. package/dist/lib/work-context/state.d.ts +12 -0
  75. package/dist/lib/work-context/state.js +131 -3
  76. package/package.json +3 -1
@@ -5,7 +5,14 @@
5
5
  * `accounts login`, which hands the terminal to the vendor's own sign-in.
6
6
  */
7
7
  import { Command } from "commander";
8
- import { type LaneCompanyRef, type LaneRecord, type QuestionRecord, type ResolvedLaneWorker, type SeniorRef, type ThrottleDeps } from "../lib/lanes/index.js";
8
+ import { type OutpostDispatchResult } from "../lib/lanes/outpost-dispatch.js";
9
+ import { emitLaneDecisionEvents, type LaneMesh } from "../lib/lanes/mesh-events.js";
10
+ import { type LaneCompanyRef, type LaneRecord, type QuestionRecord, type ResolvedLaneWorker, type SeniorRef, type LivenessDeps, type MachineIdentity, type RunCommand, type ThrottleDeps } from "../lib/lanes/index.js";
11
+ import { questionBodyAbsPath } from "../lib/lanes/questions.js";
12
+ import { type RunCompactionFn } from "../lib/lanes/compaction.js";
13
+ import { spawnLaneWorker, type KillProcessFn, type ProveDetachedFn, type SpawnProcessFn } from "../lib/lanes/spawn.js";
14
+ export { spawnLaneWorker };
15
+ export { questionBodyAbsPath };
9
16
  export declare const MAX_LANE_DEPTH = 2;
10
17
  export declare const OUTPOST_ID_PATH = "/etc/outpost/outpost-id";
11
18
  export declare const OUTPOST_DIR = "/etc/outpost";
@@ -21,13 +28,13 @@ export type OutpostIdentity = {
21
28
  export interface SpawnLoginResult {
22
29
  status: number;
23
30
  }
24
- export interface LanesMesh {
25
- ensureProjectThread: (company: LaneCompanyRef, projectId: string) => Promise<string>;
26
- appendThreadEvent: (company: LaneCompanyRef, threadId: string, eventKind: string, payload: Record<string, unknown>) => Promise<void>;
27
- patchStoryStatus: (company: LaneCompanyRef, projectId: string, storyId: string, status: string) => Promise<void>;
28
- }
31
+ /** The lane → mesh seam. Defined in lib/lanes/mesh-events.ts; the watcher shares it. */
32
+ export type LanesMesh = LaneMesh;
33
+ export { emitLaneDecisionEvents };
29
34
  export interface LanesCommandDeps {
30
35
  hqRoot?: () => string;
36
+ /** Start HQ-root walk here instead of process.cwd(). Tests only. */
37
+ cwd?: () => string;
31
38
  env?: NodeJS.ProcessEnv;
32
39
  now?: () => Date;
33
40
  hostname?: () => string;
@@ -46,24 +53,55 @@ export interface LanesCommandDeps {
46
53
  homedir?: () => string;
47
54
  mesh?: LanesMesh;
48
55
  sleep?: (ms: number) => Promise<void>;
56
+ spawnProcess?: SpawnProcessFn;
57
+ proveDetached?: ProveDetachedFn;
58
+ killProcess?: KillProcessFn;
59
+ isAlive?: (pid: number) => boolean;
60
+ stopSleepMs?: (ms: number) => void;
61
+ livenessDeps?: LivenessDeps;
62
+ presenceConnected?: boolean;
63
+ systemdRoot?: string;
64
+ runSystemctl?: RunCommand;
65
+ resolveMachineIdentity?: () => MachineIdentity;
66
+ stageOutpostPayload?: (outpostId: string, bytes: Uint8Array) => Promise<{
67
+ getUrl: string;
68
+ }>;
69
+ dispatchOutpostExec?: (input: {
70
+ outpostId: string;
71
+ command: string;
72
+ }) => Promise<OutpostDispatchResult>;
73
+ fetchText?: (url: string) => Promise<string>;
74
+ runCompaction?: RunCompactionFn;
75
+ locateTranscript?: (home: string, sessionId: string) => string | null;
49
76
  }
50
- /**
51
- * Spawn seam for the worker process (spec §5). Process spawning and the
52
- * reconcile daemon are out of scope for this command surface; calling this
53
- * throws rather than faking a running lane.
54
- */
55
- export declare function spawnLaneWorker(lane: LaneRecord): never;
56
77
  export declare function readOutpostIdentity(existsSync?: (p: string) => boolean, readFileSync?: (p: string) => string): OutpostIdentity;
57
78
  export declare function parseSeniorRef(raw: string): SeniorRef;
58
79
  export declare function resolveAnswerChoice(choice: string, options: string[], freeform: boolean): string;
59
- /** Tenant-store path for a question body (spec §6.2 / §10). Never the personal vault for company prose. */
60
- export declare function questionBodyAbsPath(hqRoot: string, question: Pick<QuestionRecord, "company" | "body" | "question_id">): string;
80
+ /**
81
+ * Spec §5.1: `hq lanes ask` from inside a lane can hit a binary or dist
82
+ * being replaced mid-call (ENOENT / ETXTBSY / a module that no longer
83
+ * resolves) or a record written by a newer CLI. Three attempts, waits of
84
+ * 5 s then 15 s, 20 s of backoff in total, inside the 30 s bound.
85
+ */
86
+ export declare const ASK_BACKOFF_MS: readonly [5000, 15000];
87
+ export declare const ASK_ATTEMPTS: number;
61
88
  export declare function casUpdateQuestion(hqRoot: string, questionId: string, updater: (current: QuestionRecord) => QuestionRecord): QuestionRecord;
62
89
  export declare function casUpdateLane(hqRoot: string, laneId: string, updater: (current: LaneRecord) => LaneRecord): LaneRecord;
90
+ /**
91
+ * Spec §5.3: an approval gate ends the run. The lane stops at each
92
+ * checkpoint with a `decision: ask` envelope whose question names it; the
93
+ * reconcile pass resumes the lane once every question is answered.
94
+ */
95
+ export declare function checkpointInstruction(worker: Pick<ResolvedLaneWorker, "approvalRequired" | "humanCheckpoints">): string;
63
96
  export declare function composeWorkerBrief(worker: ResolvedLaneWorker, taskBrief: string): string;
97
+ /**
98
+ * A lane with no worker still carries the standing authorization paragraph
99
+ * and the foreground-only rule.
100
+ */
101
+ export declare function composeGeneralBrief(taskBrief: string): string;
64
102
  export declare function parseMaxRuntimeSeconds(raw: unknown, workerId: string): number | undefined;
65
- export declare function emitLaneDecisionEvents(mesh: LanesMesh, lane: LaneRecord, decision: "blocked" | "done", extra?: Record<string, unknown>): Promise<void>;
66
103
  export declare const PICKUP_TERMINAL_REASONS: readonly ["account_not_logged_in", "unknown_account", "account_disabled"];
104
+ export declare const DISPATCH_TERMINAL_REASON: "outpost_dispatch_failed";
67
105
  export type PickupTerminalReason = (typeof PICKUP_TERMINAL_REASONS)[number];
68
106
  /**
69
107
  * Outpost-side account bind (spec §5.2). Writes a named terminal reason,
@@ -71,5 +109,6 @@ export type PickupTerminalReason = (typeof PICKUP_TERMINAL_REASONS)[number];
71
109
  */
72
110
  export declare function applyOutpostAccountPickup(hqRoot: string, laneId: string): LaneRecord;
73
111
  export declare function cancelPendingQuestionsForLane(hqRoot: string, laneId: string, nowIso: string, operatorReason?: string): QuestionRecord[];
74
- export declare function registerLanesCommand(parent: Command, deps?: LanesCommandDeps): void;
112
+ export declare function stopCommittedState(state: LaneRecord["state"]): "cancelled" | "killed";
113
+ export declare function registerLanesCommand(parent: Command, deps?: LanesCommandDeps): Command;
75
114
  //# sourceMappingURL=lanes.d.ts.map