@almightygpt/core 0.9.1 → 0.10.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.
- package/dist/adapters/claude.d.ts.map +1 -1
- package/dist/adapters/claude.js +3 -1
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/defaults.d.ts +34 -0
- package/dist/adapters/defaults.d.ts.map +1 -0
- package/dist/adapters/defaults.js +41 -0
- package/dist/adapters/defaults.js.map +1 -0
- package/dist/adapters/factory.d.ts +12 -0
- package/dist/adapters/factory.d.ts.map +1 -0
- package/dist/adapters/factory.js +40 -0
- package/dist/adapters/factory.js.map +1 -0
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +3 -1
- package/dist/adapters/gemini.js.map +1 -1
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +3 -1
- package/dist/adapters/openai.js.map +1 -1
- package/dist/auth/keychain.d.ts +11 -1
- package/dist/auth/keychain.d.ts.map +1 -1
- package/dist/auth/keychain.js +13 -4
- package/dist/auth/keychain.js.map +1 -1
- package/dist/auth/resolver.d.ts.map +1 -1
- package/dist/auth/resolver.js +19 -3
- package/dist/auth/resolver.js.map +1 -1
- package/dist/auth/types.d.ts +18 -5
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js +8 -6
- package/dist/auth/types.js.map +1 -1
- package/dist/auth/validator.d.ts +23 -3
- package/dist/auth/validator.d.ts.map +1 -1
- package/dist/auth/validator.js +126 -21
- package/dist/auth/validator.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/plan/run-plan-review.d.ts +40 -0
- package/dist/plan/run-plan-review.d.ts.map +1 -0
- package/dist/plan/run-plan-review.js +224 -0
- package/dist/plan/run-plan-review.js.map +1 -0
- package/dist/plan/run-plan.d.ts +42 -0
- package/dist/plan/run-plan.d.ts.map +1 -0
- package/dist/plan/run-plan.js +193 -0
- package/dist/plan/run-plan.js.map +1 -0
- package/dist/runs/types.d.ts +1 -1
- package/dist/runs/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/claude.ts +3 -1
- package/src/adapters/defaults.ts +44 -0
- package/src/adapters/factory.ts +45 -0
- package/src/adapters/gemini.ts +3 -1
- package/src/adapters/openai.ts +3 -1
- package/src/auth/keychain.ts +20 -6
- package/src/auth/resolver.ts +23 -3
- package/src/auth/types.ts +27 -8
- package/src/auth/validator.ts +149 -25
- package/src/index.ts +13 -1
- package/src/plan/run-plan-review.ts +302 -0
- package/src/plan/run-plan.ts +247 -0
- package/src/runs/types.ts +3 -1
package/dist/auth/validator.js
CHANGED
|
@@ -13,14 +13,20 @@
|
|
|
13
13
|
* - Google: tiny generateContent call against gemini-2.5-flash
|
|
14
14
|
*
|
|
15
15
|
* Cost is fractions of a cent per call. Latency is ~1-3 seconds.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* **Error handling (per Codex v0.8 P2 #6):** failure responses are
|
|
18
|
+
* parsed into a short user-safe message + status code. We never
|
|
19
|
+
* return the raw provider body to the user — those bodies can include
|
|
20
|
+
* request IDs, billing/account state, org/project details, quota
|
|
21
|
+
* metadata, or other account information that's too noisy for CLI
|
|
22
|
+
* logs. The raw body is available via the `rawBody` field for callers
|
|
23
|
+
* that explicitly want it (e.g. debug mode).
|
|
24
|
+
*
|
|
25
|
+
* **Default models (per Codex v0.8 P2 #5):** sourced from
|
|
26
|
+
* `adapters/defaults.ts` — the single source of truth — so the
|
|
27
|
+
* validator can't drift from the adapters.
|
|
18
28
|
*/
|
|
19
|
-
|
|
20
|
-
openai: "gpt-4o",
|
|
21
|
-
anthropic: "claude-sonnet-4-6",
|
|
22
|
-
google: "gemini-2.5-flash",
|
|
23
|
-
};
|
|
29
|
+
import { DEFAULT_MODELS } from "../adapters/defaults.js";
|
|
24
30
|
const VALIDATION_TIMEOUT_MS = 15_000;
|
|
25
31
|
/**
|
|
26
32
|
* Validate that a key can actually invoke the model real reviews use.
|
|
@@ -28,25 +34,33 @@ const VALIDATION_TIMEOUT_MS = 15_000;
|
|
|
28
34
|
* on programmer errors like an unsupported provider).
|
|
29
35
|
*/
|
|
30
36
|
export async function validateKey(provider, key) {
|
|
37
|
+
const start = Date.now();
|
|
31
38
|
try {
|
|
39
|
+
let result;
|
|
32
40
|
switch (provider) {
|
|
33
41
|
case "openai":
|
|
34
|
-
|
|
42
|
+
result = await validateOpenAI(key);
|
|
43
|
+
break;
|
|
35
44
|
case "anthropic":
|
|
36
|
-
|
|
45
|
+
result = await validateAnthropic(key);
|
|
46
|
+
break;
|
|
37
47
|
case "google":
|
|
38
|
-
|
|
48
|
+
result = await validateGoogle(key);
|
|
49
|
+
break;
|
|
39
50
|
}
|
|
51
|
+
result.latencyMs = Date.now() - start;
|
|
52
|
+
return result;
|
|
40
53
|
}
|
|
41
54
|
catch (err) {
|
|
42
55
|
return {
|
|
43
56
|
ok: false,
|
|
44
|
-
error:
|
|
57
|
+
error: friendlyNetworkError(err),
|
|
58
|
+
latencyMs: Date.now() - start,
|
|
45
59
|
};
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
async function validateOpenAI(key) {
|
|
49
|
-
const model =
|
|
63
|
+
const model = DEFAULT_MODELS.openai;
|
|
50
64
|
const controller = new AbortController();
|
|
51
65
|
const timer = setTimeout(() => controller.abort(), VALIDATION_TIMEOUT_MS);
|
|
52
66
|
try {
|
|
@@ -64,7 +78,13 @@ async function validateOpenAI(key) {
|
|
|
64
78
|
signal: controller.signal,
|
|
65
79
|
});
|
|
66
80
|
if (!res.ok) {
|
|
67
|
-
|
|
81
|
+
const rawBody = await res.text().catch(() => "");
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
statusCode: res.status,
|
|
85
|
+
error: normalizeOpenAIError(res.status, rawBody),
|
|
86
|
+
rawBody,
|
|
87
|
+
};
|
|
68
88
|
}
|
|
69
89
|
const data = (await res.json());
|
|
70
90
|
return { ok: true, model: data.model ?? model };
|
|
@@ -74,7 +94,7 @@ async function validateOpenAI(key) {
|
|
|
74
94
|
}
|
|
75
95
|
}
|
|
76
96
|
async function validateAnthropic(key) {
|
|
77
|
-
const model =
|
|
97
|
+
const model = DEFAULT_MODELS.anthropic;
|
|
78
98
|
const controller = new AbortController();
|
|
79
99
|
const timer = setTimeout(() => controller.abort(), VALIDATION_TIMEOUT_MS);
|
|
80
100
|
try {
|
|
@@ -93,7 +113,13 @@ async function validateAnthropic(key) {
|
|
|
93
113
|
signal: controller.signal,
|
|
94
114
|
});
|
|
95
115
|
if (!res.ok) {
|
|
96
|
-
|
|
116
|
+
const rawBody = await res.text().catch(() => "");
|
|
117
|
+
return {
|
|
118
|
+
ok: false,
|
|
119
|
+
statusCode: res.status,
|
|
120
|
+
error: normalizeAnthropicError(res.status, rawBody),
|
|
121
|
+
rawBody,
|
|
122
|
+
};
|
|
97
123
|
}
|
|
98
124
|
const data = (await res.json());
|
|
99
125
|
return { ok: true, model: data.model ?? model };
|
|
@@ -103,14 +129,11 @@ async function validateAnthropic(key) {
|
|
|
103
129
|
}
|
|
104
130
|
}
|
|
105
131
|
async function validateGoogle(key) {
|
|
106
|
-
const model =
|
|
132
|
+
const model = DEFAULT_MODELS.google;
|
|
107
133
|
const controller = new AbortController();
|
|
108
134
|
const timer = setTimeout(() => controller.abort(), VALIDATION_TIMEOUT_MS);
|
|
109
135
|
try {
|
|
110
|
-
//
|
|
111
|
-
// leak into proxy logs, HTTP tooling, crash diagnostics. The header
|
|
112
|
-
// path is supported by all v1beta endpoints. Codex's v0.8 security
|
|
113
|
-
// review flagged the URL-key approach as a P1.
|
|
136
|
+
// x-goog-api-key header (per v0.9.1 fix) — never the URL query.
|
|
114
137
|
const url = `https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent`;
|
|
115
138
|
const res = await fetch(url, {
|
|
116
139
|
method: "POST",
|
|
@@ -125,7 +148,13 @@ async function validateGoogle(key) {
|
|
|
125
148
|
signal: controller.signal,
|
|
126
149
|
});
|
|
127
150
|
if (!res.ok) {
|
|
128
|
-
|
|
151
|
+
const rawBody = await res.text().catch(() => "");
|
|
152
|
+
return {
|
|
153
|
+
ok: false,
|
|
154
|
+
statusCode: res.status,
|
|
155
|
+
error: normalizeGoogleError(res.status, rawBody, key),
|
|
156
|
+
rawBody,
|
|
157
|
+
};
|
|
129
158
|
}
|
|
130
159
|
return { ok: true, model };
|
|
131
160
|
}
|
|
@@ -133,4 +162,80 @@ async function validateGoogle(key) {
|
|
|
133
162
|
clearTimeout(timer);
|
|
134
163
|
}
|
|
135
164
|
}
|
|
165
|
+
// ─── Error normalization (Codex v0.8 P2 #6) ──────────────────────────
|
|
166
|
+
//
|
|
167
|
+
// Parse known provider JSON error shapes into short, user-safe messages.
|
|
168
|
+
// Never echo the raw key back even by accident (defense in depth: we
|
|
169
|
+
// also redact anything that looks like the submitted key).
|
|
170
|
+
function normalizeOpenAIError(status, rawBody) {
|
|
171
|
+
// OpenAI shape: { "error": { "message": "...", "type": "...", "code": "..." } }
|
|
172
|
+
try {
|
|
173
|
+
const parsed = JSON.parse(rawBody);
|
|
174
|
+
const msg = parsed.error?.message;
|
|
175
|
+
if (msg)
|
|
176
|
+
return `[${status}] OpenAI: ${truncate(msg, 200)}`;
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
/* fall through */
|
|
180
|
+
}
|
|
181
|
+
return statusOnlyMessage("OpenAI", status);
|
|
182
|
+
}
|
|
183
|
+
function normalizeAnthropicError(status, rawBody) {
|
|
184
|
+
// Anthropic shape: { "type": "error", "error": { "type": "...", "message": "..." } }
|
|
185
|
+
try {
|
|
186
|
+
const parsed = JSON.parse(rawBody);
|
|
187
|
+
const msg = parsed.error?.message;
|
|
188
|
+
if (msg)
|
|
189
|
+
return `[${status}] Anthropic: ${truncate(msg, 200)}`;
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
/* fall through */
|
|
193
|
+
}
|
|
194
|
+
return statusOnlyMessage("Anthropic", status);
|
|
195
|
+
}
|
|
196
|
+
function normalizeGoogleError(status, rawBody, submittedKey) {
|
|
197
|
+
// Google shape: { "error": { "code": N, "message": "...", "status": "..." } }
|
|
198
|
+
try {
|
|
199
|
+
const parsed = JSON.parse(rawBody);
|
|
200
|
+
let msg = parsed.error?.message ?? "";
|
|
201
|
+
// Belt-and-braces redaction: Google sometimes echoes the key in
|
|
202
|
+
// error messages (e.g. "API key not valid. Pass a valid API key.")
|
|
203
|
+
// — we don't ship the actual key value if it ever ends up here.
|
|
204
|
+
if (submittedKey && msg.includes(submittedKey)) {
|
|
205
|
+
msg = msg.replace(submittedKey, "<redacted-key>");
|
|
206
|
+
}
|
|
207
|
+
if (msg)
|
|
208
|
+
return `[${status}] Google: ${truncate(msg, 200)}`;
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
/* fall through */
|
|
212
|
+
}
|
|
213
|
+
return statusOnlyMessage("Google", status);
|
|
214
|
+
}
|
|
215
|
+
function statusOnlyMessage(provider, status) {
|
|
216
|
+
if (status === 401 || status === 403) {
|
|
217
|
+
return `[${status}] ${provider} rejected the key (unauthorized).`;
|
|
218
|
+
}
|
|
219
|
+
if (status === 429) {
|
|
220
|
+
return `[${status}] ${provider} rate-limited or quota exceeded.`;
|
|
221
|
+
}
|
|
222
|
+
if (status >= 500) {
|
|
223
|
+
return `[${status}] ${provider} returned a server error; try again.`;
|
|
224
|
+
}
|
|
225
|
+
return `[${status}] ${provider} returned an unrecognized error.`;
|
|
226
|
+
}
|
|
227
|
+
function truncate(s, n) {
|
|
228
|
+
return s.length <= n ? s : s.slice(0, n - 1) + "…";
|
|
229
|
+
}
|
|
230
|
+
function friendlyNetworkError(err) {
|
|
231
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
232
|
+
if (msg.includes("abort")) {
|
|
233
|
+
return "Validation timed out (network or provider too slow).";
|
|
234
|
+
}
|
|
235
|
+
if (msg.includes("ENOTFOUND") || msg.includes("ECONNREFUSED")) {
|
|
236
|
+
return "Could not reach the provider (network issue).";
|
|
237
|
+
}
|
|
238
|
+
// Generic — but never include random stack data; just the message.
|
|
239
|
+
return `Network error: ${truncate(msg, 200)}`;
|
|
240
|
+
}
|
|
136
241
|
//# sourceMappingURL=validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/auth/validator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/auth/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAoBzD,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAAoB,EACpB,GAAW;IAEX,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,IAAI,CAAC;QACH,IAAI,MAAwB,CAAC;QAC7B,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,QAAQ;gBACX,MAAM,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;gBACnC,MAAM;YACR,KAAK,WAAW;gBACd,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;gBACtC,MAAM;YACR,KAAK,QAAQ;gBACX,MAAM,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;gBACnC,MAAM;QACV,CAAC;QACD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC;YAChC,SAAS,EAAE,I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AAC,GAAG,CAAC,CAAC;IAC7D,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,OAAO,sDAAsD,CAAC;IAChE,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAC9D,OAAO,+CAA+C,CAAC;IACzD,CAAC;IACD,mEAAmE;IACnE,OAAO,kBAAkB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - review/ ✅ task #11 diff review pipeline (with #12/#13/#14 wiring)
|
|
13
13
|
* - budget/ ✅ task #14 BudgetTracker + BudgetExceededError
|
|
14
14
|
*/
|
|
15
|
-
export declare const VERSION = "0.
|
|
15
|
+
export declare const VERSION = "0.10.0";
|
|
16
16
|
export { startMcpServer } from "./mcp/server.js";
|
|
17
17
|
export { checkGitStatus, assertSafeToWrite, GitStatusDirtyError, type GitStatusCheck, } from "./git/status.js";
|
|
18
18
|
export { installTemplate, hasExistingConfig, type InstallOptions, type InstallResult, } from "./templates/install.js";
|
|
@@ -34,5 +34,7 @@ export type { ReviewEvent, ReviewEventHandler, AgentRoleInRun, } from "./review/
|
|
|
34
34
|
export { resolveApiKey, requireApiKey, type ResolveOptions, } from "./auth/resolver.js";
|
|
35
35
|
export { getKeychain, _resetKeychainCache, type KeychainAdapter, } from "./auth/keychain.js";
|
|
36
36
|
export { validateKey, type ValidationResult } from "./auth/validator.js";
|
|
37
|
+
export { runWorkerPlan, type PlanOptions, type PlanResult, } from "./plan/run-plan.js";
|
|
38
|
+
export { runPlanReview, type PlanReviewOptions, type PlanReviewResult, } from "./plan/run-plan-review.js";
|
|
37
39
|
export { AuthMissingError, PROVIDER_ENV_VARS, PROVIDER_KEY_URLS, type ProviderId, type KeySource, type KeyResolution, } from "./auth/types.js";
|
|
38
40
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,WAAW,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,KAAK,MAAM,EACX,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,YAAY,GAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB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EAChB,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - review/ ✅ task #11 diff review pipeline (with #12/#13/#14 wiring)
|
|
13
13
|
* - budget/ ✅ task #14 BudgetTracker + BudgetExceededError
|
|
14
14
|
*/
|
|
15
|
-
export const VERSION = "0.
|
|
15
|
+
export const VERSION = "0.10.0";
|
|
16
16
|
// MCP server (v0.9.0+) — exposes AlmightyGPT's review surface as MCP tools.
|
|
17
17
|
export { startMcpServer } from "./mcp/server.js";
|
|
18
18
|
// Git safety primitives
|
|
@@ -41,5 +41,8 @@ export { BudgetTracker, BudgetExceededError, } from "./review/budget.js";
|
|
|
41
41
|
export { resolveApiKey, requireApiKey, } from "./auth/resolver.js";
|
|
42
42
|
export { getKeychain, _resetKeychainCache, } from "./auth/keychain.js";
|
|
43
43
|
export { validateKey } from "./auth/validator.js";
|
|
44
|
+
// Plan subsystem (v0.10.0+) — Worker plan + Reviewer plan-review
|
|
45
|
+
export { runWorkerPlan, } from "./plan/run-plan.js";
|
|
46
|
+
export { runPlanReview, } from "./plan/run-plan-review.js";
|
|
44
47
|
export { AuthMissingError, PROVIDER_ENV_VARS, PROVIDER_KEY_URLS, } from "./auth/types.js";
|
|
45
48
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|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,EACrB,iBAAiB,EACjB,4BAA4B,GAE7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC;AAO5B,2DAA2D;AAC3D,OAAO,EACL,aAAa,EACb,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,WAAW,EACX,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAyB,MAAM,qBAAqB,CAAC;AACzE,iEAAiE;AACjE,OAAO,EACL,aAAa,GAGd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,GAGd,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GAIlB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `almightygpt review --plan <file>` — Reviewer AI critiques a PLAN
|
|
3
|
+
* doc (not a git diff). Same review primitives as runDiffReview but
|
|
4
|
+
* the input is the plan markdown and the framing tells the Reviewer
|
|
5
|
+
* to critique the plan's structure, completeness, and risks rather
|
|
6
|
+
* than line-by-line code.
|
|
7
|
+
*
|
|
8
|
+
* Output lands at `<reviewsDir>/plan-<topic>.md` (prefix distinguishes
|
|
9
|
+
* plan reviews from diff reviews when they share the same topic name).
|
|
10
|
+
*/
|
|
11
|
+
export interface PlanReviewOptions {
|
|
12
|
+
repoRoot: string;
|
|
13
|
+
topic: string;
|
|
14
|
+
/** Path (relative to repoRoot) to the plan markdown to review. */
|
|
15
|
+
planPath: string;
|
|
16
|
+
reviewer?: string;
|
|
17
|
+
force?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface PlanReviewResult {
|
|
20
|
+
reviewPath: string;
|
|
21
|
+
reviewBytes: number;
|
|
22
|
+
reviewer: string;
|
|
23
|
+
provider: string;
|
|
24
|
+
modelUsed: string;
|
|
25
|
+
tokensIn: number;
|
|
26
|
+
cachedTokensIn: number;
|
|
27
|
+
tokensOut: number;
|
|
28
|
+
costUsd: number;
|
|
29
|
+
latencyMs: number;
|
|
30
|
+
memorySources: {
|
|
31
|
+
path: string;
|
|
32
|
+
bytes: number;
|
|
33
|
+
}[];
|
|
34
|
+
memoryMissing: string[];
|
|
35
|
+
runId: string;
|
|
36
|
+
runFolder: string;
|
|
37
|
+
shallowWarning?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function runPlanReview(opts: PlanReviewOptions): Promise<PlanReviewResult>;
|
|
40
|
+
//# sourceMappingURL=run-plan-review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan-review.d.ts","sourceRoot":"","sources":["../../src/plan/run-plan-review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoBH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA+DD,wBAAsB,aAAa,CACjC,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAgK3B"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `almightygpt review --plan <file>` — Reviewer AI critiques a PLAN
|
|
3
|
+
* doc (not a git diff). Same review primitives as runDiffReview but
|
|
4
|
+
* the input is the plan markdown and the framing tells the Reviewer
|
|
5
|
+
* to critique the plan's structure, completeness, and risks rather
|
|
6
|
+
* than line-by-line code.
|
|
7
|
+
*
|
|
8
|
+
* Output lands at `<reviewsDir>/plan-<topic>.md` (prefix distinguishes
|
|
9
|
+
* plan reviews from diff reviews when they share the same topic name).
|
|
10
|
+
*/
|
|
11
|
+
import { readFile } from "node:fs/promises";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { loadConfig } from "../config/load.js";
|
|
14
|
+
import { makeAdapter } from "../adapters/factory.js";
|
|
15
|
+
import { AdapterError } from "../adapters/types.js";
|
|
16
|
+
import { assembleMemory } from "../review/memory.js";
|
|
17
|
+
import { createRunFolder, writeRunMetadata, writeRunInput, writeAgentOutput, collectGitContext, } from "../runs/folder.js";
|
|
18
|
+
import { writeHumanReviewFile, preflightReviewFileCollision, } from "../review/write.js";
|
|
19
|
+
const PLAN_REVIEW_SYSTEM_FRAMING = [
|
|
20
|
+
"You are the Reviewer AI in an AlmightyGPT Plan-review stage.",
|
|
21
|
+
"",
|
|
22
|
+
"WHAT YOU ARE REVIEWING: the PLAN markdown supplied below. NOT a git",
|
|
23
|
+
"diff and NOT code — a plan that a Worker AI drafted in response to a",
|
|
24
|
+
"human's requirement. The plan has not been implemented yet. Your job",
|
|
25
|
+
"is to find what's WRONG with the plan: missing steps, hidden",
|
|
26
|
+
"dependencies, risks the Worker didn't surface, ambiguous decisions,",
|
|
27
|
+
"things that will break in production, edge cases the test plan misses.",
|
|
28
|
+
"",
|
|
29
|
+
"WHAT THE ORCHESTRATOR OWNS (do NOT include these in your response):",
|
|
30
|
+
" - The H1 title (orchestrator prepends `# Plan Review: <topic>`).",
|
|
31
|
+
" - The header block with model / tokens / cost.",
|
|
32
|
+
" - The `## Cost and Latency` and `## Appendix: Raw Outputs` sections.",
|
|
33
|
+
"",
|
|
34
|
+
"WHAT YOU MUST PRODUCE — start with `## Decision Required` and emit",
|
|
35
|
+
"ONLY these sections in this order:",
|
|
36
|
+
" ## Decision Required",
|
|
37
|
+
" ## Highest-Risk Findings",
|
|
38
|
+
" ## Concrete Weaknesses",
|
|
39
|
+
" ## Worker Plan Summary",
|
|
40
|
+
" ## Test Plan",
|
|
41
|
+
" ## Human Decision",
|
|
42
|
+
"",
|
|
43
|
+
"ANTI-SYCOPHANCY (non-negotiable):",
|
|
44
|
+
" - Find at least 3 concrete weaknesses with specific file / step / line",
|
|
45
|
+
" references from the plan.",
|
|
46
|
+
" - A finding without a specific anchor is too vague.",
|
|
47
|
+
" - 'Looks good, minor suggestions' is a FAILED review — recalibrate.",
|
|
48
|
+
"",
|
|
49
|
+
"REVIEW LENS — focus on what plans commonly get wrong:",
|
|
50
|
+
" - Steps assume capabilities that don't exist yet",
|
|
51
|
+
" - Risks section underweights production blast radius",
|
|
52
|
+
" - Test plan is generic ('add tests') instead of named cases",
|
|
53
|
+
" - Open questions are missing things the human will actually need to",
|
|
54
|
+
" decide before implementation",
|
|
55
|
+
" - Affected modules list is incomplete (the plan touches more surfaces",
|
|
56
|
+
" than it admits)",
|
|
57
|
+
" - Migration / rollback story is missing or hand-wavy",
|
|
58
|
+
].join("\n");
|
|
59
|
+
function buildPlanReviewUserMessage(topic, planContent) {
|
|
60
|
+
return [
|
|
61
|
+
`# Plan-review request — topic: \`${topic}\``,
|
|
62
|
+
"",
|
|
63
|
+
"## The plan to review",
|
|
64
|
+
"",
|
|
65
|
+
"```markdown",
|
|
66
|
+
planContent.trim(),
|
|
67
|
+
"```",
|
|
68
|
+
"",
|
|
69
|
+
"## Your task",
|
|
70
|
+
"",
|
|
71
|
+
"Critique the plan above using the structure in your system prompt.",
|
|
72
|
+
"Start your response with `## Decision Required` (no H1, no preamble).",
|
|
73
|
+
].join("\n");
|
|
74
|
+
}
|
|
75
|
+
export async function runPlanReview(opts) {
|
|
76
|
+
const config = await loadConfig(opts.repoRoot);
|
|
77
|
+
const reviewerName = opts.reviewer ?? config.defaults.reviewer;
|
|
78
|
+
if (!reviewerName) {
|
|
79
|
+
throw new Error("No reviewer specified. Pass --reviewer <name> or set defaults.reviewer in .almightygpt/config.yaml.");
|
|
80
|
+
}
|
|
81
|
+
const agentConfig = config.agents[reviewerName];
|
|
82
|
+
if (!agentConfig) {
|
|
83
|
+
throw new Error(`Reviewer "${reviewerName}" not found in .almightygpt/config.yaml agents map.`);
|
|
84
|
+
}
|
|
85
|
+
if (!agentConfig.enabled) {
|
|
86
|
+
throw new Error(`Reviewer "${reviewerName}" is disabled in .almightygpt/config.yaml.`);
|
|
87
|
+
}
|
|
88
|
+
const adapter = makeAdapter(reviewerName, agentConfig.provider);
|
|
89
|
+
if (!(await adapter.isAvailable())) {
|
|
90
|
+
throw new AdapterError(`Adapter "${reviewerName}" (${agentConfig.provider}) is not available. Set the provider's API key.`, reviewerName);
|
|
91
|
+
}
|
|
92
|
+
// Plan reviews land at <reviewsDir>/plan-<topic>.md so they don't
|
|
93
|
+
// collide with diff reviews on the same topic.
|
|
94
|
+
const planReviewTopic = `plan-${opts.topic}`;
|
|
95
|
+
await preflightReviewFileCollision(opts.repoRoot, config.reviewsDir, planReviewTopic, opts.force ?? false);
|
|
96
|
+
// Load the plan to review.
|
|
97
|
+
let planContent;
|
|
98
|
+
try {
|
|
99
|
+
planContent = await readFile(join(opts.repoRoot, opts.planPath), "utf8");
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
throw new Error(`Could not read plan file at ${opts.planPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
103
|
+
}
|
|
104
|
+
const runFolder = await createRunFolder({
|
|
105
|
+
repoRoot: opts.repoRoot,
|
|
106
|
+
runsDir: config.runsDir,
|
|
107
|
+
topic: planReviewTopic,
|
|
108
|
+
type: "review-plan",
|
|
109
|
+
});
|
|
110
|
+
const createdAt = new Date().toISOString();
|
|
111
|
+
const memory = await assembleMemory(opts.repoRoot, agentConfig.memoryFile);
|
|
112
|
+
const systemPrompt = PLAN_REVIEW_SYSTEM_FRAMING + "\n\n" + memory.text;
|
|
113
|
+
const userMessage = buildPlanReviewUserMessage(opts.topic, planContent);
|
|
114
|
+
await writeRunInput(runFolder.absPath, userMessage);
|
|
115
|
+
const adapterOut = await adapter.execute({
|
|
116
|
+
role: "reviewer",
|
|
117
|
+
systemPrompt,
|
|
118
|
+
userMessage,
|
|
119
|
+
});
|
|
120
|
+
await writeAgentOutput(runFolder.absPath, "reviewer", adapterOut.content);
|
|
121
|
+
// Shallow detection: same rule as diff reviews — need N concrete
|
|
122
|
+
// weaknesses with anchors.
|
|
123
|
+
const shallowWarning = detectShallowPlanReview(adapterOut.content, config.review.requireConcreteWeaknesses);
|
|
124
|
+
const writeOpts = {
|
|
125
|
+
repoRoot: opts.repoRoot,
|
|
126
|
+
reviewsDir: config.reviewsDir,
|
|
127
|
+
topic: planReviewTopic,
|
|
128
|
+
reviewerName,
|
|
129
|
+
reviewerProvider: adapter.provider,
|
|
130
|
+
modelUsed: adapterOut.modelUsed,
|
|
131
|
+
body: adapterOut.content,
|
|
132
|
+
metrics: {
|
|
133
|
+
tokensIn: adapterOut.tokensIn,
|
|
134
|
+
tokensOut: adapterOut.tokensOut,
|
|
135
|
+
costUsd: adapterOut.costUsd,
|
|
136
|
+
latencyMs: adapterOut.latencyMs,
|
|
137
|
+
},
|
|
138
|
+
runFolder: runFolder.relPath,
|
|
139
|
+
};
|
|
140
|
+
if (shallowWarning)
|
|
141
|
+
writeOpts.shallowWarning = shallowWarning;
|
|
142
|
+
if (opts.force)
|
|
143
|
+
writeOpts.force = opts.force;
|
|
144
|
+
const written = await writeHumanReviewFile(writeOpts);
|
|
145
|
+
const git = await collectGitContext(opts.repoRoot);
|
|
146
|
+
await writeRunMetadata(runFolder.absPath, {
|
|
147
|
+
id: runFolder.id,
|
|
148
|
+
type: "review-plan",
|
|
149
|
+
createdAt,
|
|
150
|
+
finishedAt: new Date().toISOString(),
|
|
151
|
+
workspacePath: opts.repoRoot,
|
|
152
|
+
topic: planReviewTopic,
|
|
153
|
+
git,
|
|
154
|
+
input: { source: "requirement-file", path: opts.planPath },
|
|
155
|
+
agents: [
|
|
156
|
+
{
|
|
157
|
+
name: reviewerName,
|
|
158
|
+
role: "reviewer",
|
|
159
|
+
provider: agentConfig.provider,
|
|
160
|
+
enabled: true,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
adapterVersions: [],
|
|
164
|
+
status: "completed",
|
|
165
|
+
metrics: [
|
|
166
|
+
{
|
|
167
|
+
agent: reviewerName,
|
|
168
|
+
role: "reviewer",
|
|
169
|
+
provider: adapter.provider,
|
|
170
|
+
model: adapterOut.modelUsed,
|
|
171
|
+
tokensIn: adapterOut.tokensIn,
|
|
172
|
+
cachedTokensIn: adapterOut.cachedTokensIn ?? 0,
|
|
173
|
+
tokensOut: adapterOut.tokensOut,
|
|
174
|
+
costUsd: adapterOut.costUsd,
|
|
175
|
+
latencyMs: adapterOut.latencyMs,
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
totals: {
|
|
179
|
+
tokensIn: adapterOut.tokensIn,
|
|
180
|
+
tokensOut: adapterOut.tokensOut,
|
|
181
|
+
costUsd: adapterOut.costUsd,
|
|
182
|
+
latencyMs: adapterOut.latencyMs,
|
|
183
|
+
},
|
|
184
|
+
reviewPath: written.path,
|
|
185
|
+
budget: {
|
|
186
|
+
maxCostPerRunUsd: config.budget.maxCostPerRunUsd,
|
|
187
|
+
maxTokensPerRun: config.budget.maxTokensPerRun,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
const result = {
|
|
191
|
+
reviewPath: written.path,
|
|
192
|
+
reviewBytes: written.bytes,
|
|
193
|
+
reviewer: reviewerName,
|
|
194
|
+
provider: adapter.provider,
|
|
195
|
+
modelUsed: adapterOut.modelUsed,
|
|
196
|
+
tokensIn: adapterOut.tokensIn,
|
|
197
|
+
cachedTokensIn: adapterOut.cachedTokensIn ?? 0,
|
|
198
|
+
tokensOut: adapterOut.tokensOut,
|
|
199
|
+
costUsd: adapterOut.costUsd,
|
|
200
|
+
latencyMs: adapterOut.latencyMs,
|
|
201
|
+
memorySources: memory.sources,
|
|
202
|
+
memoryMissing: memory.missing,
|
|
203
|
+
runId: runFolder.id,
|
|
204
|
+
runFolder: runFolder.relPath,
|
|
205
|
+
};
|
|
206
|
+
if (shallowWarning)
|
|
207
|
+
result.shallowWarning = shallowWarning;
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
/** Same shallow heuristic as diff reviews — count file/step/line anchors. */
|
|
211
|
+
function detectShallowPlanReview(content, requireConcreteWeaknesses) {
|
|
212
|
+
const anchorPattern = /\b(?:file|step|line|section)[:\s][\w\-./]+/gi;
|
|
213
|
+
const anchors = content.match(anchorPattern) ?? [];
|
|
214
|
+
const weaknessesSection = content.match(/## Concrete Weaknesses([\s\S]*?)(?=##|$)/i);
|
|
215
|
+
const weaknessBullets = weaknessesSection?.[1]?.match(/^\s*[-*\d.]/gm)?.length ?? 0;
|
|
216
|
+
if (anchors.length === 0) {
|
|
217
|
+
return "Plan review has zero anchored references (file / step / line). The Reviewer may not have engaged with specifics — consider re-running.";
|
|
218
|
+
}
|
|
219
|
+
if (weaknessBullets < requireConcreteWeaknesses) {
|
|
220
|
+
return `Plan review listed ${weaknessBullets} concrete weaknesses, fewer than the configured minimum of ${requireConcreteWeaknesses}. Output may be shallow — consider re-running with a more rigorous Reviewer.`;
|
|
221
|
+
}
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=run-plan-review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan-review.js","sourceRoot":"","sources":["../../src/plan/run-plan-review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AA6B5B,MAAM,0BAA0B,GAAG;IACjC,8DAA8D;IAC9D,EAAE;IACF,qEAAqE;IACrE,sEAAsE;IACtE,sEAAsE;IACtE,8DAA8D;IAC9D,qEAAqE;IACrE,wEAAwE;IACxE,EAAE;IACF,qEAAqE;IACrE,oEAAoE;IACpE,kDAAkD;IAClD,wEAAwE;IACxE,EAAE;IACF,oEAAoE;IACpE,oCAAoC;IACpC,wBAAwB;IACxB,4BAA4B;IAC5B,0BAA0B;IAC1B,0BAA0B;IAC1B,gBAAgB;IAChB,qBAAqB;IACrB,EAAE;IACF,mCAAmC;IACnC,0EAA0E;IAC1E,+BAA+B;IAC/B,uDAAuD;IACvD,uEAAuE;IACvE,EAAE;IACF,uDAAuD;IACvD,oDAAoD;IACpD,wDAAwD;IACxD,+DAA+D;IAC/D,uEAAuE;IACvE,kCAAkC;IAClC,yEAAyE;IACzE,qBAAqB;IACrB,wDAAwD;CACzD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,SAAS,0BAA0B,CACjC,KAAa,EACb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cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,CAAC;QAC9C,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,aAAa,EAAE,MAAM,CAAC,OAAO;QAC7B,aAAa,EAAE,MAAM,CAAC,OAAO;QAC7B,KAAK,EAAE,SAAS,CAAC,EAAE;QACnB,SAAS,EAAE,SAAS,CAAC,OAAO;KAC7B,CAAC;IACF,IAAI,cAAc;QAAE,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,6EAA6E;AAC7E,SAAS,uBAAuB,CAC9B,OAAe,EACf,yBAAiC;IAEjC,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IACnD,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,CACrC,2CAA2C,CAC5C,CAAC;IACF,MAAM,eAAe,GACnB,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IAE9D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,wIAAwI,CAAC;IAClJ,CAAC;IACD,IAAI,eAAe,GAAG,yBAAyB,EAAE,CAAC;QAChD,OAAO,sBAAsB,eAAe,8DAA8D,yBAAyB,8EAA8E,CAAC;IACpN,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `almightygpt plan` — Worker AI reads a free-text requirement +
|
|
3
|
+
* project memory, produces a structured plan markdown.
|
|
4
|
+
*
|
|
5
|
+
* Distinct from the review pipeline because the INPUT is a
|
|
6
|
+
* requirement (a sentence or paragraph from the user describing
|
|
7
|
+
* what they want), not a git diff. Output is a plan doc with
|
|
8
|
+
* required sections — same shape on every run so the Reviewer
|
|
9
|
+
* downstream knows what to expect.
|
|
10
|
+
*
|
|
11
|
+
* Plans land at `docs/<worker>-plans/<topic>.md`. The Reviewer step
|
|
12
|
+
* then runs against this plan via the `review --plan <file>` mode
|
|
13
|
+
* (see run-plan-review.ts).
|
|
14
|
+
*/
|
|
15
|
+
export interface PlanOptions {
|
|
16
|
+
repoRoot: string;
|
|
17
|
+
topic: string;
|
|
18
|
+
requirement: string;
|
|
19
|
+
worker?: string;
|
|
20
|
+
force?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface PlanResult {
|
|
23
|
+
planPath: string;
|
|
24
|
+
planBytes: number;
|
|
25
|
+
worker: string;
|
|
26
|
+
provider: string;
|
|
27
|
+
modelUsed: string;
|
|
28
|
+
tokensIn: number;
|
|
29
|
+
cachedTokensIn: number;
|
|
30
|
+
tokensOut: number;
|
|
31
|
+
costUsd: number;
|
|
32
|
+
latencyMs: number;
|
|
33
|
+
memorySources: {
|
|
34
|
+
path: string;
|
|
35
|
+
bytes: number;
|
|
36
|
+
}[];
|
|
37
|
+
memoryMissing: string[];
|
|
38
|
+
runId: string;
|
|
39
|
+
runFolder: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function runWorkerPlan(opts: PlanOptions): Promise<PlanResult>;
|
|
42
|
+
//# sourceMappingURL=run-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan.d.ts","sourceRoot":"","sources":["../../src/plan/run-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiBH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AA6CD,wBAAsB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAoJ1E"}
|