ai-foreman 1.7.11 → 1.7.13
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.
- package/README.md +15 -0
- package/dist/activity.d.ts +5 -1
- package/dist/activity.js +1 -1
- package/dist/adapters/claude.d.ts +7 -0
- package/dist/adapters/claude.js +133 -7
- package/dist/adapters/codex.d.ts +5 -0
- package/dist/adapters/codex.js +121 -11
- package/dist/adapters/recovering.d.ts +2 -0
- package/dist/adapters/recovering.js +11 -1
- package/dist/adapters/types.d.ts +47 -1
- package/dist/agentRun.d.ts +2 -0
- package/dist/agentRun.js +8 -2
- package/dist/branch/resume.js +11 -1
- package/dist/branch/runner.d.ts +12 -3
- package/dist/branch/runner.js +131 -67
- package/dist/buildRuns.d.ts +6 -2
- package/dist/buildRuns.js +76 -32
- package/dist/cli/doctor.d.ts +7 -0
- package/dist/cli/doctor.js +84 -1
- package/dist/cli/manager.d.ts +17 -0
- package/dist/cli/manager.js +135 -0
- package/dist/cli/recovery.d.ts +4 -0
- package/dist/cli/recovery.js +80 -0
- package/dist/cli/start.js +446 -142
- package/dist/cli/status.js +13 -2
- package/dist/cli/tickets.js +27 -9
- package/dist/config.d.ts +4 -0
- package/dist/config.js +28 -1
- package/dist/continuity.js +14 -9
- package/dist/diagnostics.d.ts +25 -0
- package/dist/diagnostics.js +428 -0
- package/dist/foreman.d.ts +26 -6
- package/dist/foreman.js +147 -104
- package/dist/handoffs.d.ts +35 -3
- package/dist/handoffs.js +155 -17
- package/dist/index.js +6 -0
- package/dist/log.d.ts +3 -3
- package/dist/log.js +4 -1
- package/dist/managerPacket.d.ts +25 -0
- package/dist/managerPacket.js +83 -0
- package/dist/markers.d.ts +1 -1
- package/dist/markers.js +4 -1
- package/dist/notify.d.ts +4 -0
- package/dist/notify.js +15 -0
- package/dist/observability.d.ts +248 -0
- package/dist/observability.js +1018 -0
- package/dist/planChanges.d.ts +4 -0
- package/dist/planChanges.js +16 -0
- package/dist/projectDiagnostics.d.ts +27 -0
- package/dist/projectDiagnostics.js +407 -0
- package/dist/qaRecovery.d.ts +140 -0
- package/dist/qaRecovery.js +595 -0
- package/dist/qaReview.d.ts +133 -14
- package/dist/qaReview.js +984 -59
- package/dist/qaSnapshot.d.ts +31 -5
- package/dist/qaSnapshot.js +209 -134
- package/dist/recoveryPolicy.d.ts +37 -0
- package/dist/recoveryPolicy.js +251 -0
- package/dist/roles.js +1 -0
- package/dist/supervisor.d.ts +40 -0
- package/dist/supervisor.js +102 -0
- package/dist/ticketHistoryReader.d.ts +19 -0
- package/dist/ticketHistoryReader.js +58 -0
- package/dist/tickets/details.d.ts +8 -0
- package/dist/tickets/details.js +59 -11
- package/dist/tickets/output.d.ts +5 -0
- package/dist/tickets/output.js +73 -0
- package/dist/tickets/stateDb.d.ts +1 -0
- package/dist/tickets/stateDb.js +5 -0
- package/dist/workflowDb.d.ts +31 -2
- package/dist/workflowDb.js +192 -23
- package/dist/workflowReader.d.ts +42 -0
- package/dist/workflowReader.js +171 -0
- package/foreman.yaml +13 -0
- package/package.json +51 -3
package/dist/qaReview.d.ts
CHANGED
|
@@ -1,48 +1,166 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ProviderSessionRefV1, type QaFailureReportV1, type SessionStrategy } from "rafi-spec";
|
|
2
2
|
import type { BuilderAdapter, CompactResult } from "./adapters/types.js";
|
|
3
|
+
import type { RunObserver } from "./observability.js";
|
|
3
4
|
import type { TicketDef } from "./tickets/ticketSchema.js";
|
|
5
|
+
import { type QaRecoveryPacket } from "./qaRecovery.js";
|
|
4
6
|
export interface QaStreamState {
|
|
5
7
|
sessionId?: string;
|
|
6
8
|
sessionRef?: ProviderSessionRefV1;
|
|
7
9
|
reviews: number;
|
|
8
10
|
modificationViolations: number;
|
|
11
|
+
remediationGeneration?: number;
|
|
12
|
+
/** Exact host-observed Builder responses; prompt-facing summaries remain separately bounded. */
|
|
13
|
+
builderResponseHistory?: Array<{
|
|
14
|
+
ticketId: string;
|
|
15
|
+
cycle: number;
|
|
16
|
+
kind: "completion" | "remediation" | "plain-fallback";
|
|
17
|
+
response: string;
|
|
18
|
+
summary: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
export interface QaReportHistoryEntry {
|
|
22
|
+
cycle: number;
|
|
23
|
+
reviewAttempt?: number;
|
|
24
|
+
remediationGeneration?: number;
|
|
25
|
+
attemptId?: string;
|
|
26
|
+
outcome: string;
|
|
27
|
+
detail: string;
|
|
28
|
+
reportDigest?: string;
|
|
29
|
+
report?: QaFailureReportV1;
|
|
30
|
+
findingIds?: string[];
|
|
31
|
+
fixSummaryDigest?: string;
|
|
32
|
+
fixSummary?: string;
|
|
33
|
+
remediationDigest?: string;
|
|
34
|
+
remediation?: string;
|
|
9
35
|
}
|
|
10
36
|
export interface QaNonconvergenceContext {
|
|
11
37
|
ticket: TicketDef;
|
|
12
|
-
history:
|
|
13
|
-
cycle: number;
|
|
14
|
-
outcome: string;
|
|
15
|
-
detail: string;
|
|
16
|
-
}>;
|
|
38
|
+
history: QaReportHistoryEntry[];
|
|
17
39
|
builderWorktree: string;
|
|
18
40
|
}
|
|
19
41
|
export type QaNonconvergenceDecision = {
|
|
20
42
|
action: "retry" | "pause" | "waive" | "remediate";
|
|
21
43
|
remediation?: string;
|
|
22
44
|
};
|
|
45
|
+
export type QaFixRequest = {
|
|
46
|
+
kind: "validated-report";
|
|
47
|
+
report: QaFailureReportV1;
|
|
48
|
+
reportDigest: string;
|
|
49
|
+
history: QaReportHistoryEntry[];
|
|
50
|
+
latestBuilderResult: string;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "planner-remediation";
|
|
53
|
+
report: QaFailureReportV1;
|
|
54
|
+
reportDigest: string;
|
|
55
|
+
remediation: string;
|
|
56
|
+
history: QaReportHistoryEntry[];
|
|
57
|
+
latestBuilderResult: string;
|
|
58
|
+
} | {
|
|
59
|
+
kind: "plain-issues";
|
|
60
|
+
issues: string;
|
|
61
|
+
operatorApproved: true;
|
|
62
|
+
history: QaReportHistoryEntry[];
|
|
63
|
+
latestBuilderResult: string;
|
|
64
|
+
};
|
|
65
|
+
export type QaFixResult = {
|
|
66
|
+
ok: true;
|
|
67
|
+
response: string;
|
|
68
|
+
summary: string;
|
|
69
|
+
detail?: string;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
detail?: string;
|
|
73
|
+
response?: string;
|
|
74
|
+
summary?: string;
|
|
75
|
+
};
|
|
76
|
+
export interface QaSessionHandle {
|
|
77
|
+
adapter: BuilderAdapter;
|
|
78
|
+
sessionIdentity?: ProviderSessionRefV1 | string;
|
|
79
|
+
effectiveRoleInstructions: string;
|
|
80
|
+
runtimeContext: unknown;
|
|
81
|
+
skills: Array<{
|
|
82
|
+
name: string;
|
|
83
|
+
digest: string | "unavailable";
|
|
84
|
+
reason?: string;
|
|
85
|
+
path?: string;
|
|
86
|
+
}>;
|
|
87
|
+
handoffReceipt?: unknown;
|
|
88
|
+
}
|
|
89
|
+
export interface QaSessionBoundaryRecovery {
|
|
90
|
+
packetDigest: string;
|
|
91
|
+
reviewedStateDigest: string;
|
|
92
|
+
packetPath: string;
|
|
93
|
+
resources: Array<{
|
|
94
|
+
label: string;
|
|
95
|
+
digest: string;
|
|
96
|
+
requiredForRecovery: boolean;
|
|
97
|
+
mediaType: string;
|
|
98
|
+
path: string;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
export type QaReportRecoveryDecision = {
|
|
102
|
+
action: "fresh";
|
|
103
|
+
} | {
|
|
104
|
+
action: "plain";
|
|
105
|
+
} | {
|
|
106
|
+
action: "manual";
|
|
107
|
+
} | {
|
|
108
|
+
action: "guidance";
|
|
109
|
+
instructions: string;
|
|
110
|
+
route?: "current" | "compact" | "fresh";
|
|
111
|
+
} | {
|
|
112
|
+
action: "pause";
|
|
113
|
+
};
|
|
114
|
+
export type QaReportRecoveryHandler = NonNullable<IsolatedQaOptions["onReportRecovery"]>;
|
|
23
115
|
export interface IsolatedQaOptions {
|
|
24
116
|
ticket: TicketDef;
|
|
25
117
|
builderWorktree: string;
|
|
26
118
|
builderSummary: string;
|
|
27
119
|
qaStrategy: SessionStrategy;
|
|
28
120
|
state: QaStreamState;
|
|
29
|
-
createQa: (cwd: string, sessionId?: string) => Promise<BuilderAdapter>;
|
|
121
|
+
createQa: (cwd: string, sessionId?: string) => Promise<BuilderAdapter | QaSessionHandle>;
|
|
30
122
|
/** Host-owned ordinary QA boundary. Fresh strategies must return a validated successor. */
|
|
31
|
-
sessionBoundary?: (adapter: BuilderAdapter, frozenAction: string, strategy: SessionStrategy, cwd: string) => Promise<BuilderAdapter>;
|
|
123
|
+
sessionBoundary?: (adapter: BuilderAdapter, frozenAction: string, strategy: SessionStrategy, cwd: string, recovery?: QaSessionBoundaryRecovery) => Promise<BuilderAdapter>;
|
|
32
124
|
/** Persist provider-native automatic compactions without imposing an ordinary QA boundary. */
|
|
33
125
|
observeNativeCompactions?: (adapter: BuilderAdapter) => Promise<void>;
|
|
34
|
-
fix: (
|
|
35
|
-
ok: boolean;
|
|
36
|
-
detail?: string;
|
|
37
|
-
}>;
|
|
126
|
+
fix: (request: QaFixRequest) => Promise<QaFixResult>;
|
|
38
127
|
maxCycles: number;
|
|
128
|
+
/** Durable QA execution scope; review/fix budgets survive worker restarts. */
|
|
129
|
+
recovery: {
|
|
130
|
+
projectDir: string;
|
|
131
|
+
runId: string;
|
|
132
|
+
};
|
|
133
|
+
observer?: RunObserver;
|
|
39
134
|
evidence?: (entry: {
|
|
40
135
|
cycle: number;
|
|
136
|
+
reviewAttempt?: number;
|
|
137
|
+
remediationGeneration?: number;
|
|
138
|
+
attemptId?: string;
|
|
41
139
|
outcome: string;
|
|
42
140
|
detail: string;
|
|
141
|
+
durationMs?: number;
|
|
43
142
|
qaDiff?: string[];
|
|
44
143
|
}) => void;
|
|
45
144
|
onNonconvergence?: (context: QaNonconvergenceContext) => Promise<QaNonconvergenceDecision>;
|
|
145
|
+
/** Resolve a QA blocker with the same still-open QA session before disposal. */
|
|
146
|
+
resolveBlocked?: (adapter: BuilderAdapter, reason: string) => Promise<{
|
|
147
|
+
result: import("./adapters/types.js").TurnResult;
|
|
148
|
+
status: import("./foreman.js").StepStatus;
|
|
149
|
+
}>;
|
|
150
|
+
onReportRecovery?: (context: {
|
|
151
|
+
packet: QaRecoveryPacket;
|
|
152
|
+
menu: readonly string[];
|
|
153
|
+
originalIssues?: string;
|
|
154
|
+
liveSession: boolean;
|
|
155
|
+
contextUsage?: unknown;
|
|
156
|
+
}) => Promise<QaReportRecoveryDecision>;
|
|
157
|
+
/** Accumulated authoritative QA/fix history, populated by runIsolatedQa. */
|
|
158
|
+
qaHistory?: QaReportHistoryEntry[];
|
|
159
|
+
qaRuntimeContext?: unknown;
|
|
160
|
+
/** A durable packet selected by build:resume and transferred by validated handoff. */
|
|
161
|
+
resumedRecovery?: QaRecoveryPacket;
|
|
162
|
+
/** True when a continuity wrapper validates and strips deltas before returning turn text. */
|
|
163
|
+
continuityManaged?: boolean;
|
|
46
164
|
}
|
|
47
165
|
export interface IsolatedQaResult {
|
|
48
166
|
outcome: "passed" | "blocked" | "needs-human" | "nonconverged" | "waived";
|
|
@@ -50,6 +168,7 @@ export interface IsolatedQaResult {
|
|
|
50
168
|
summary?: string;
|
|
51
169
|
}
|
|
52
170
|
export declare function runIsolatedQa(opts: IsolatedQaOptions): Promise<IsolatedQaResult>;
|
|
53
|
-
export declare function buildQaReviewHandoff(ticket: TicketDef, builderSummary: string, diffDigest: string, validationChecklist: string[]): string;
|
|
171
|
+
export declare function buildQaReviewHandoff(ticket: TicketDef, builderSummary: string, diffDigest: string, validationChecklist: string[], changeSummary?: unknown): string;
|
|
54
172
|
export declare function compactWithRetry(adapter: BuilderAdapter): Promise<CompactResult>;
|
|
55
|
-
export declare function buildDurableQaFixHandoff(ticket: TicketDef,
|
|
173
|
+
export declare function buildDurableQaFixHandoff(ticket: TicketDef, request: QaFixRequest, worktree: string, priorResult: string, diffDigest: string, changeSummary?: string): string;
|
|
174
|
+
export declare const QA_REPORT_RECOVERY_MENU: readonly ["Try another fresh QA.", "Use plain issues fallback.", "Manually fix saved JSON.", "Give QA specific instructions.", "Pause."];
|