@indigoai-us/hq-cli 5.345.56 → 5.345.57

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.
@@ -16,6 +16,8 @@ export declare const LANE_HIRE_GRANT_FINISHED_LANES_FLAG = "lanes.hire-grant-cou
16
16
  export declare const LANE_LIST_SKIP_REMOTE_REFRESH_FLAG = "lanes.list-skip-remote-refresh";
17
17
  /** Enables missed-deadline lead nudges and second-miss operator escalation. */
18
18
  export declare const LANE_AUTOPILOT_MISSED_DEADLINE_ESCALATION_FLAG = "lanes.autopilot-missed-deadline-escalation";
19
+ /** Enables durable six-hour escalation for lanes that remain blocked. */
20
+ export declare const LANE_BLOCKED_ESCALATION_FLAG = "lanes.blocked-escalation-6h";
19
21
  /** Enables company-scoped lookup of a hostless lane ULID across Outpost indexes. */
20
22
  export declare const LANE_MESSAGE_ROUTE_OWNER_HOST_FLAG = "lanes.message-route-owner-host";
21
23
  /** Enables stale manager-status KPI reporting and one-time lead nudges. */
@@ -40,4 +42,6 @@ export declare const LANE_CONDUCT_SESSION_START_FLAG = "lanes.conduct-session-st
40
42
  export declare const LANE_REAP_STOP_FLAG = "lanes.reap-stop";
41
43
  /** Enables same-senior worker lane continuity on create; keep ON as the kill switch default. */
42
44
  export declare const LANE_WORKER_CONTINUITY_FLAG = "lanes.worker-continuity";
45
+ /** Kill switch for conduct loop lanes; absence or read failure keeps it enabled. */
46
+ export declare const LANE_CONDUCT_LOOP_FLAG = "lanes.conduct-loop";
43
47
  //# sourceMappingURL=flag-keys.d.ts.map
@@ -16,6 +16,8 @@ export const LANE_HIRE_GRANT_FINISHED_LANES_FLAG = "lanes.hire-grant-count-live-
16
16
  export const LANE_LIST_SKIP_REMOTE_REFRESH_FLAG = "lanes.list-skip-remote-refresh";
17
17
  /** Enables missed-deadline lead nudges and second-miss operator escalation. */
18
18
  export const LANE_AUTOPILOT_MISSED_DEADLINE_ESCALATION_FLAG = "lanes.autopilot-missed-deadline-escalation";
19
+ /** Enables durable six-hour escalation for lanes that remain blocked. */
20
+ export const LANE_BLOCKED_ESCALATION_FLAG = "lanes.blocked-escalation-6h";
19
21
  /** Enables company-scoped lookup of a hostless lane ULID across Outpost indexes. */
20
22
  export const LANE_MESSAGE_ROUTE_OWNER_HOST_FLAG = "lanes.message-route-owner-host";
21
23
  /** Enables stale manager-status KPI reporting and one-time lead nudges. */
@@ -40,4 +42,6 @@ export const LANE_CONDUCT_SESSION_START_FLAG = "lanes.conduct-session-start";
40
42
  export const LANE_REAP_STOP_FLAG = "lanes.reap-stop";
41
43
  /** Enables same-senior worker lane continuity on create; keep ON as the kill switch default. */
42
44
  export const LANE_WORKER_CONTINUITY_FLAG = "lanes.worker-continuity";
45
+ /** Kill switch for conduct loop lanes; absence or read failure keeps it enabled. */
46
+ export const LANE_CONDUCT_LOOP_FLAG = "lanes.conduct-loop";
43
47
  //# sourceMappingURL=flag-keys.js.map
@@ -0,0 +1,158 @@
1
+ import type { LaneRecord, LaneProvider } from "./types.js";
2
+ export declare const LOOP_SCHEMA: "hq-lane-loop.v1";
3
+ export declare const PHASE_ENVELOPE_SCHEMA: "hq-phase-envelope/v1";
4
+ export declare const PHASE_HANDOFF_SCHEMA: "hq-phase-handoff/v1";
5
+ export declare const LOOP_ENVELOPE_LIMIT: number;
6
+ export type GenericPhaseEnvelope = {
7
+ schema_version?: string;
8
+ id?: string;
9
+ kind: "phase" | "stop";
10
+ story_id?: string;
11
+ phase?: string;
12
+ engine?: LaneProvider;
13
+ prompt?: string;
14
+ result_path?: string;
15
+ deadline_seconds?: number;
16
+ deadline?: string;
17
+ fresh?: boolean;
18
+ [key: string]: unknown;
19
+ };
20
+ export type Section8PhaseEnvelope = {
21
+ schema: typeof PHASE_ENVELOPE_SCHEMA;
22
+ id?: string;
23
+ story_id: string;
24
+ phase: string;
25
+ engine?: LaneProvider;
26
+ worktree: string;
27
+ fresh_call?: boolean;
28
+ result_path?: string;
29
+ deadline_seconds?: number;
30
+ deadline?: string;
31
+ [key: string]: unknown;
32
+ };
33
+ export type LoopEnvelope = GenericPhaseEnvelope | Section8PhaseEnvelope;
34
+ export interface LoopQueuePosition {
35
+ lane_id: string;
36
+ envelope_id: string;
37
+ position: number;
38
+ queue_depth: number;
39
+ queued_at: string;
40
+ }
41
+ export interface LoopStatus {
42
+ mode: "loop";
43
+ lane_id: string;
44
+ state: "waiting" | "running" | "parked" | "stopped" | "failed";
45
+ queue_depth: number;
46
+ active_envelope_id: string | null;
47
+ active_phase: string | null;
48
+ stall_counts: Record<string, number>;
49
+ pid?: number;
50
+ updated_at: string;
51
+ }
52
+ export interface LoopResult {
53
+ schema_version: typeof LOOP_SCHEMA;
54
+ envelope_id: string;
55
+ status: "done" | "failed" | "stalled" | "stopped";
56
+ started_at: string;
57
+ finished_at: string;
58
+ output?: string;
59
+ error?: string;
60
+ session_id?: string;
61
+ resumed?: boolean;
62
+ fresh_fallback?: boolean;
63
+ }
64
+ export interface Section8Handoff {
65
+ schema: typeof PHASE_HANDOFF_SCHEMA;
66
+ story_id: string;
67
+ phase: string;
68
+ worker_id: string;
69
+ status: "passed" | "failed" | "blocked";
70
+ summary: string;
71
+ files_changed: string[];
72
+ commits: string[];
73
+ back_pressure: {
74
+ tests: "pass" | "fail" | "skip";
75
+ lint: "pass" | "fail" | "skip";
76
+ typecheck: "pass" | "fail" | "skip";
77
+ build: "pass" | "fail" | "skip";
78
+ };
79
+ context_for_next: string;
80
+ engine?: string;
81
+ notes?: string;
82
+ [key: string]: unknown;
83
+ }
84
+ export interface LoopExecutionContext {
85
+ lane: LaneRecord;
86
+ envelope: LoopEnvelope;
87
+ envelopeId: string;
88
+ signal: AbortSignal;
89
+ sessionId?: string;
90
+ fresh: boolean;
91
+ }
92
+ export interface LoopExecutionResult {
93
+ output: string;
94
+ sessionId?: string;
95
+ }
96
+ export interface LoopRunnerOptions {
97
+ lane: LaneRecord;
98
+ runDir: string;
99
+ execute(context: LoopExecutionContext): Promise<LoopExecutionResult>;
100
+ canResume?(provider: LaneProvider): boolean;
101
+ raiseQuestion?(input: {
102
+ envelope: LoopEnvelope;
103
+ envelopeId: string;
104
+ attempt: number;
105
+ error: string;
106
+ }): Promise<void> | void;
107
+ defaultDeadlineSeconds?: number;
108
+ now?: () => Date;
109
+ idlePollMs?: number;
110
+ signal?: AbortSignal;
111
+ }
112
+ export interface LoopRunSummary {
113
+ state: "stopped" | "parked" | "aborted";
114
+ completed: number;
115
+ }
116
+ export type LoopAdmissionPath = "initial" | "deferred" | "resume";
117
+ export declare function loopAdmissionPath(state: string, hasPendingResume: boolean, initialAdmission: boolean): LoopAdmissionPath;
118
+ interface StoredEnvelope {
119
+ schema_version: typeof LOOP_SCHEMA;
120
+ envelope_id: string;
121
+ queued_at: string;
122
+ deadline_budget_seconds?: number;
123
+ deadline_at_ms?: number;
124
+ envelope: LoopEnvelope;
125
+ }
126
+ /** Validate both hq-cli phase envelopes and the conduct protocol §8 shape. */
127
+ export declare function validateLoopEnvelope(value: unknown): LoopEnvelope;
128
+ export declare function validateSection8Handoff(value: unknown, envelope: Section8PhaseEnvelope): Section8Handoff;
129
+ /** Queue depth and FIFO ordering are based on the timestamp-prefixed filename. */
130
+ export declare function listLoopQueue(runDir: string): StoredEnvelope[];
131
+ /**
132
+ * Copy and enqueue atomically. Unique timestamp/ULID-like names establish FIFO;
133
+ * temporary files are ignored by claimers until rename completes.
134
+ */
135
+ export declare function enqueueLoopEnvelope(input: {
136
+ runDir: string;
137
+ laneId: string;
138
+ envelope: unknown;
139
+ now?: () => Date;
140
+ }): LoopQueuePosition;
141
+ /** Atomically claims exactly the FIFO head. The active rename is the claim. */
142
+ export declare function claimNextLoopEnvelope(runDir: string): {
143
+ file: string;
144
+ record: StoredEnvelope;
145
+ } | null;
146
+ /** Withdraw all unclaimed envelopes; active work remains claimed by the worker. */
147
+ export declare function interruptLoopQueue(runDir: string): {
148
+ withdrawn: string[];
149
+ already_picked_up: string[];
150
+ };
151
+ export declare function loopStatus(runDir: string, laneId: string): LoopStatus;
152
+ export declare function setLoopControllerPid(runDir: string, laneId: string, pid: number | undefined): void;
153
+ export declare function clearLoopControllerPid(runDir: string, laneId: string, pid: number): void;
154
+ export declare function loopControllerIsAlive(runDir: string): boolean;
155
+ /** Run queued phases serially. Sessions are isolated by story and provider. */
156
+ export declare function runLoopLane(options: LoopRunnerOptions): Promise<LoopRunSummary>;
157
+ export {};
158
+ //# sourceMappingURL=loop.d.ts.map