opencara 0.15.2 → 0.15.4
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/index.js +30 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -945,7 +945,6 @@ ${userMessage}`;
|
|
|
945
945
|
deps.codebaseDir ?? void 0
|
|
946
946
|
);
|
|
947
947
|
const { verdict, review } = extractVerdict(result.stdout);
|
|
948
|
-
const header = buildMetadataHeader(verdict, req.meta);
|
|
949
948
|
const inputTokens = result.tokensParsed ? 0 : estimateTokens(fullPrompt);
|
|
950
949
|
const detail = result.tokenDetail;
|
|
951
950
|
const tokenDetail = result.tokensParsed ? detail : {
|
|
@@ -955,7 +954,7 @@ ${userMessage}`;
|
|
|
955
954
|
parsed: false
|
|
956
955
|
};
|
|
957
956
|
return {
|
|
958
|
-
review
|
|
957
|
+
review,
|
|
959
958
|
verdict,
|
|
960
959
|
tokensUsed: result.tokensUsed + inputTokens,
|
|
961
960
|
tokensEstimated: !result.tokensParsed,
|
|
@@ -1076,10 +1075,6 @@ async function executeSummary(req, deps, runTool = executeTool) {
|
|
|
1076
1075
|
abortController.abort();
|
|
1077
1076
|
}, effectiveTimeout);
|
|
1078
1077
|
try {
|
|
1079
|
-
const summaryMeta = req.meta ? {
|
|
1080
|
-
...req.meta,
|
|
1081
|
-
reviewerModels: req.reviews.map((r) => `${r.model}/${r.tool}`)
|
|
1082
|
-
} : void 0;
|
|
1083
1078
|
const systemPrompt = buildSummarySystemPrompt(req.owner, req.repo, req.reviews.length);
|
|
1084
1079
|
const userMessage = buildSummaryUserMessage(
|
|
1085
1080
|
req.prompt,
|
|
@@ -1099,7 +1094,6 @@ ${userMessage}`;
|
|
|
1099
1094
|
deps.codebaseDir ?? void 0
|
|
1100
1095
|
);
|
|
1101
1096
|
const { verdict, review } = extractVerdict(result.stdout);
|
|
1102
|
-
const header = buildSummaryMetadataHeader(verdict, summaryMeta);
|
|
1103
1097
|
const inputTokens = result.tokensParsed ? 0 : estimateTokens(fullPrompt);
|
|
1104
1098
|
const detail = result.tokenDetail;
|
|
1105
1099
|
const tokenDetail = result.tokensParsed ? detail : {
|
|
@@ -1109,7 +1103,8 @@ ${userMessage}`;
|
|
|
1109
1103
|
parsed: false
|
|
1110
1104
|
};
|
|
1111
1105
|
return {
|
|
1112
|
-
summary:
|
|
1106
|
+
summary: review,
|
|
1107
|
+
verdict,
|
|
1113
1108
|
tokensUsed: result.tokensUsed + inputTokens,
|
|
1114
1109
|
tokensEstimated: !result.tokensParsed,
|
|
1115
1110
|
tokenDetail
|
|
@@ -2076,7 +2071,6 @@ async function executeReviewTask(client, agentId, taskId, owner, repo, prNumber,
|
|
|
2076
2071
|
};
|
|
2077
2072
|
} else {
|
|
2078
2073
|
logger.log(` ${icons.running} Executing review: ${reviewDeps.commandTemplate}`);
|
|
2079
|
-
const meta = { model: agentInfo.model, tool: agentInfo.tool, githubUsername };
|
|
2080
2074
|
const result = await executeReview(
|
|
2081
2075
|
{
|
|
2082
2076
|
taskId,
|
|
@@ -2087,8 +2081,7 @@ async function executeReviewTask(client, agentId, taskId, owner, repo, prNumber,
|
|
|
2087
2081
|
prNumber,
|
|
2088
2082
|
timeout: timeoutSeconds,
|
|
2089
2083
|
reviewMode: "full",
|
|
2090
|
-
contextBlock
|
|
2091
|
-
meta
|
|
2084
|
+
contextBlock
|
|
2092
2085
|
},
|
|
2093
2086
|
reviewDeps
|
|
2094
2087
|
);
|
|
@@ -2102,7 +2095,13 @@ async function executeReviewTask(client, agentId, taskId, owner, repo, prNumber,
|
|
|
2102
2095
|
estimated: result.tokensEstimated
|
|
2103
2096
|
};
|
|
2104
2097
|
}
|
|
2105
|
-
const
|
|
2098
|
+
const reviewMeta = {
|
|
2099
|
+
model: agentInfo.model,
|
|
2100
|
+
tool: agentInfo.tool,
|
|
2101
|
+
githubUsername
|
|
2102
|
+
};
|
|
2103
|
+
const headerReview = buildMetadataHeader(verdict, reviewMeta);
|
|
2104
|
+
const sanitizedReview = sanitizeTokens(headerReview + reviewText);
|
|
2106
2105
|
await withRetry(
|
|
2107
2106
|
() => client.post(`/api/tasks/${taskId}/result`, {
|
|
2108
2107
|
agent_id: agentId,
|
|
@@ -2170,8 +2169,7 @@ async function executeSummaryTask(client, agentId, taskId, owner, repo, prNumber
|
|
|
2170
2169
|
prNumber,
|
|
2171
2170
|
timeout: timeoutSeconds,
|
|
2172
2171
|
reviewMode: "full",
|
|
2173
|
-
contextBlock
|
|
2174
|
-
meta
|
|
2172
|
+
contextBlock
|
|
2175
2173
|
},
|
|
2176
2174
|
reviewDeps
|
|
2177
2175
|
);
|
|
@@ -2185,7 +2183,8 @@ async function executeSummaryTask(client, agentId, taskId, owner, repo, prNumber
|
|
|
2185
2183
|
estimated: result.tokensEstimated
|
|
2186
2184
|
};
|
|
2187
2185
|
}
|
|
2188
|
-
const
|
|
2186
|
+
const headerSingle = buildMetadataHeader(verdict ?? "comment", meta);
|
|
2187
|
+
const sanitizedReview = sanitizeTokens(headerSingle + reviewText);
|
|
2189
2188
|
await withRetry(
|
|
2190
2189
|
() => client.post(`/api/tasks/${taskId}/result`, {
|
|
2191
2190
|
agent_id: agentId,
|
|
@@ -2213,12 +2212,13 @@ async function executeSummaryTask(client, agentId, taskId, owner, repo, prNumber
|
|
|
2213
2212
|
}
|
|
2214
2213
|
const summaryReviews = reviews.map((r) => ({
|
|
2215
2214
|
agentId: r.agent_id,
|
|
2216
|
-
model: "unknown",
|
|
2217
|
-
tool: "unknown",
|
|
2215
|
+
model: r.model ?? "unknown",
|
|
2216
|
+
tool: r.tool ?? "unknown",
|
|
2218
2217
|
review: r.review_text,
|
|
2219
2218
|
verdict: r.verdict
|
|
2220
2219
|
}));
|
|
2221
2220
|
let summaryText;
|
|
2221
|
+
let summaryVerdict;
|
|
2222
2222
|
let tokensUsed;
|
|
2223
2223
|
let usageOpts;
|
|
2224
2224
|
if (routerRelay) {
|
|
@@ -2237,7 +2237,9 @@ async function executeSummaryTask(client, agentId, taskId, owner, repo, prNumber
|
|
|
2237
2237
|
fullPrompt,
|
|
2238
2238
|
timeoutSeconds
|
|
2239
2239
|
);
|
|
2240
|
-
|
|
2240
|
+
const parsed = extractVerdict(response);
|
|
2241
|
+
summaryText = parsed.review;
|
|
2242
|
+
summaryVerdict = parsed.verdict;
|
|
2241
2243
|
tokensUsed = estimateTokens(fullPrompt) + estimateTokens(response);
|
|
2242
2244
|
usageOpts = {
|
|
2243
2245
|
inputTokens: estimateTokens(fullPrompt),
|
|
@@ -2257,12 +2259,12 @@ async function executeSummaryTask(client, agentId, taskId, owner, repo, prNumber
|
|
|
2257
2259
|
prNumber,
|
|
2258
2260
|
timeout: timeoutSeconds,
|
|
2259
2261
|
diffContent,
|
|
2260
|
-
contextBlock
|
|
2261
|
-
meta
|
|
2262
|
+
contextBlock
|
|
2262
2263
|
},
|
|
2263
2264
|
reviewDeps
|
|
2264
2265
|
);
|
|
2265
2266
|
summaryText = result.summary;
|
|
2267
|
+
summaryVerdict = result.verdict;
|
|
2266
2268
|
tokensUsed = result.tokensUsed;
|
|
2267
2269
|
usageOpts = {
|
|
2268
2270
|
inputTokens: result.tokenDetail.input,
|
|
@@ -2271,12 +2273,18 @@ async function executeSummaryTask(client, agentId, taskId, owner, repo, prNumber
|
|
|
2271
2273
|
estimated: result.tokensEstimated
|
|
2272
2274
|
};
|
|
2273
2275
|
}
|
|
2274
|
-
const
|
|
2276
|
+
const summaryMeta = {
|
|
2277
|
+
...meta,
|
|
2278
|
+
reviewerModels: summaryReviews.map((r) => `${r.model}/${r.tool}`)
|
|
2279
|
+
};
|
|
2280
|
+
const headerSummary = buildSummaryMetadataHeader(summaryVerdict, summaryMeta);
|
|
2281
|
+
const sanitizedSummary = sanitizeTokens(headerSummary + summaryText);
|
|
2275
2282
|
await withRetry(
|
|
2276
2283
|
() => client.post(`/api/tasks/${taskId}/result`, {
|
|
2277
2284
|
agent_id: agentId,
|
|
2278
2285
|
type: "summary",
|
|
2279
2286
|
review_text: sanitizedSummary,
|
|
2287
|
+
verdict: summaryVerdict,
|
|
2280
2288
|
tokens_used: tokensUsed
|
|
2281
2289
|
}),
|
|
2282
2290
|
{ maxAttempts: 3 },
|
|
@@ -2563,7 +2571,7 @@ agentCommand.command("start").description("Start agents in polling mode").option
|
|
|
2563
2571
|
});
|
|
2564
2572
|
|
|
2565
2573
|
// src/index.ts
|
|
2566
|
-
var program = new Command2().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version("0.15.
|
|
2574
|
+
var program = new Command2().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version("0.15.4");
|
|
2567
2575
|
program.addCommand(agentCommand);
|
|
2568
2576
|
program.action(() => {
|
|
2569
2577
|
startAgentRouter();
|