opencara 0.20.1 → 0.21.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/index.js +59 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -240,6 +240,9 @@ var DEFAULT_TRIAGE_TRIGGER = {
|
|
|
240
240
|
events: ["opened"],
|
|
241
241
|
comment: "/opencara triage"
|
|
242
242
|
};
|
|
243
|
+
var DEFAULT_ISSUE_REVIEW_TRIGGER = {
|
|
244
|
+
comment: "/opencara review-issue"
|
|
245
|
+
};
|
|
243
246
|
var DEFAULT_TRIGGER = DEFAULT_REVIEW_TRIGGER;
|
|
244
247
|
var DEFAULT_FEATURE_CONFIG = {
|
|
245
248
|
prompt: "Review this pull request for bugs, security issues, and code quality.",
|
|
@@ -308,6 +311,24 @@ function parseAgentSlots(value) {
|
|
|
308
311
|
}
|
|
309
312
|
return slots.length > 0 ? slots : void 0;
|
|
310
313
|
}
|
|
314
|
+
function parseNamedAgents(value) {
|
|
315
|
+
if (!Array.isArray(value))
|
|
316
|
+
return void 0;
|
|
317
|
+
const agents = [];
|
|
318
|
+
for (const item of value) {
|
|
319
|
+
if (!isObject(item))
|
|
320
|
+
continue;
|
|
321
|
+
if (typeof item.id !== "string" || typeof item.prompt !== "string")
|
|
322
|
+
continue;
|
|
323
|
+
const agent = { id: item.id, prompt: item.prompt };
|
|
324
|
+
if (typeof item.model === "string")
|
|
325
|
+
agent.model = item.model;
|
|
326
|
+
if (typeof item.tool === "string")
|
|
327
|
+
agent.tool = item.tool;
|
|
328
|
+
agents.push(agent);
|
|
329
|
+
}
|
|
330
|
+
return agents.length > 0 ? agents : void 0;
|
|
331
|
+
}
|
|
311
332
|
function parseFeatureFields(raw, defaults) {
|
|
312
333
|
const agentSlots = parseAgentSlots(raw.agents);
|
|
313
334
|
return {
|
|
@@ -408,12 +429,16 @@ var DEFAULT_IMPLEMENT_FEATURE = {
|
|
|
408
429
|
modelDiversityGraceMs: DEFAULT_MODEL_DIVERSITY_GRACE_MS
|
|
409
430
|
};
|
|
410
431
|
function parseImplementSection(raw) {
|
|
411
|
-
const base = parseFeatureFields(raw, DEFAULT_IMPLEMENT_FEATURE);
|
|
432
|
+
const { agents: _slots, ...base } = parseFeatureFields(raw, DEFAULT_IMPLEMENT_FEATURE);
|
|
412
433
|
const triggerRaw = isObject(raw.trigger) ? raw.trigger : void 0;
|
|
434
|
+
const namedAgents = parseNamedAgents(raw.agents);
|
|
435
|
+
const agentField = typeof raw.agent_field === "string" ? raw.agent_field : void 0;
|
|
413
436
|
return {
|
|
414
437
|
...base,
|
|
415
438
|
enabled: typeof raw.enabled === "boolean" ? raw.enabled : true,
|
|
416
|
-
trigger: parseTriggerSection(triggerRaw, DEFAULT_IMPLEMENT_TRIGGER)
|
|
439
|
+
trigger: parseTriggerSection(triggerRaw, DEFAULT_IMPLEMENT_TRIGGER),
|
|
440
|
+
...namedAgents ? { agents: namedAgents } : {},
|
|
441
|
+
...agentField ? { agent_field: agentField } : {}
|
|
417
442
|
};
|
|
418
443
|
}
|
|
419
444
|
var DEFAULT_FIX_FEATURE = {
|
|
@@ -425,12 +450,33 @@ var DEFAULT_FIX_FEATURE = {
|
|
|
425
450
|
modelDiversityGraceMs: DEFAULT_MODEL_DIVERSITY_GRACE_MS
|
|
426
451
|
};
|
|
427
452
|
function parseFixSection(raw) {
|
|
428
|
-
const base = parseFeatureFields(raw, DEFAULT_FIX_FEATURE);
|
|
453
|
+
const { agents: _slots, ...base } = parseFeatureFields(raw, DEFAULT_FIX_FEATURE);
|
|
429
454
|
const triggerRaw = isObject(raw.trigger) ? raw.trigger : void 0;
|
|
455
|
+
const namedAgents = parseNamedAgents(raw.agents);
|
|
456
|
+
const agentField = typeof raw.agent_field === "string" ? raw.agent_field : void 0;
|
|
430
457
|
return {
|
|
431
458
|
...base,
|
|
432
459
|
enabled: typeof raw.enabled === "boolean" ? raw.enabled : true,
|
|
433
|
-
trigger: parseTriggerSection(triggerRaw, DEFAULT_FIX_TRIGGER)
|
|
460
|
+
trigger: parseTriggerSection(triggerRaw, DEFAULT_FIX_TRIGGER),
|
|
461
|
+
...namedAgents ? { agents: namedAgents } : {},
|
|
462
|
+
...agentField ? { agent_field: agentField } : {}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
var DEFAULT_ISSUE_REVIEW_FEATURE = {
|
|
466
|
+
prompt: "Review this issue for clarity, completeness, and actionability.",
|
|
467
|
+
agentCount: 2,
|
|
468
|
+
timeout: "5m",
|
|
469
|
+
preferredModels: [],
|
|
470
|
+
preferredTools: [],
|
|
471
|
+
modelDiversityGraceMs: DEFAULT_MODEL_DIVERSITY_GRACE_MS
|
|
472
|
+
};
|
|
473
|
+
function parseIssueReviewSection(raw) {
|
|
474
|
+
const base = parseFeatureFields(raw, DEFAULT_ISSUE_REVIEW_FEATURE);
|
|
475
|
+
const triggerRaw = isObject(raw.trigger) ? raw.trigger : void 0;
|
|
476
|
+
return {
|
|
477
|
+
...base,
|
|
478
|
+
enabled: typeof raw.enabled === "boolean" ? raw.enabled : true,
|
|
479
|
+
trigger: parseTriggerSection(triggerRaw, DEFAULT_ISSUE_REVIEW_TRIGGER)
|
|
434
480
|
};
|
|
435
481
|
}
|
|
436
482
|
function parseOpenCaraConfig(toml) {
|
|
@@ -473,6 +519,9 @@ function parseOpenCaraConfig(toml) {
|
|
|
473
519
|
if (isObject(raw.fix)) {
|
|
474
520
|
config.fix = parseFixSection(raw.fix);
|
|
475
521
|
}
|
|
522
|
+
if (isObject(raw.issue_review)) {
|
|
523
|
+
config.issue_review = parseIssueReviewSection(raw.issue_review);
|
|
524
|
+
}
|
|
476
525
|
return config;
|
|
477
526
|
}
|
|
478
527
|
function parseLegacyReviewConfig(raw) {
|
|
@@ -2125,15 +2174,10 @@ ${reviewSections}`);
|
|
|
2125
2174
|
}
|
|
2126
2175
|
var TRIAGE_SYSTEM_PROMPT = `You are a triage agent for a software project. Your job is to analyze a GitHub issue and produce a structured triage report.
|
|
2127
2176
|
|
|
2128
|
-
The project is a monorepo with the following packages:
|
|
2129
|
-
- server \u2014 Hono server on Cloudflare Workers (webhook receiver, REST task API, GitHub integration)
|
|
2130
|
-
- cli \u2014 Agent CLI npm package (HTTP polling, local review execution, router mode)
|
|
2131
|
-
- shared \u2014 Shared TypeScript types (REST API contracts, review config parser)
|
|
2132
|
-
|
|
2133
2177
|
## Instructions
|
|
2134
2178
|
|
|
2135
2179
|
1. **Categorize** the issue into one of: bug, feature, improvement, question, docs, chore
|
|
2136
|
-
2. **Identify the module** most relevant to this issue
|
|
2180
|
+
2. **Identify the module** most relevant to this issue (use the most appropriate component, package, or area name from the repository \u2014 or omit if unclear)
|
|
2137
2181
|
3. **Assess priority**: critical (service down / data loss), high (blocks users), medium (important but not urgent), low (nice to have)
|
|
2138
2182
|
4. **Estimate size**: XS (< 1hr), S (1-4hr), M (4hr-2d), L (2-5d), XL (> 5d)
|
|
2139
2183
|
5. **Suggest labels** relevant to the issue (e.g., "bug", "enhancement", "docs", module names, etc.)
|
|
@@ -2148,7 +2192,7 @@ Respond with ONLY a JSON object (no markdown fences, no preamble, no explanation
|
|
|
2148
2192
|
\`\`\`
|
|
2149
2193
|
{
|
|
2150
2194
|
"category": "bug" | "feature" | "improvement" | "question" | "docs" | "chore",
|
|
2151
|
-
"module": "
|
|
2195
|
+
"module": "<string \u2014 component, package, or area name from the repository>",
|
|
2152
2196
|
"priority": "critical" | "high" | "medium" | "low",
|
|
2153
2197
|
"size": "XS" | "S" | "M" | "L" | "XL",
|
|
2154
2198
|
"labels": ["label1", "label2"],
|
|
@@ -5346,7 +5390,7 @@ function sleep2(ms, signal) {
|
|
|
5346
5390
|
async function startAgent(agentId, platformUrl, agentInfo, reviewDeps, consumptionDeps, options) {
|
|
5347
5391
|
const client = new ApiClient(platformUrl, {
|
|
5348
5392
|
authToken: options?.authToken,
|
|
5349
|
-
cliVersion: "0.
|
|
5393
|
+
cliVersion: "0.21.0",
|
|
5350
5394
|
versionOverride: options?.versionOverride,
|
|
5351
5395
|
onTokenRefresh: options?.onTokenRefresh
|
|
5352
5396
|
});
|
|
@@ -5632,7 +5676,7 @@ async function startBatchAgents(config, agents, pollIntervalMs, oauthToken, opti
|
|
|
5632
5676
|
const { versionOverride, verbose, instancesOverride, agentOwner, userOrgs } = options;
|
|
5633
5677
|
const client = new ApiClient(config.platformUrl, {
|
|
5634
5678
|
authToken: oauthToken,
|
|
5635
|
-
cliVersion: "0.
|
|
5679
|
+
cliVersion: "0.21.0",
|
|
5636
5680
|
versionOverride,
|
|
5637
5681
|
onTokenRefresh: () => getValidToken(config.platformUrl, { configPath: config.authFile })
|
|
5638
5682
|
});
|
|
@@ -5975,7 +6019,7 @@ agentCommand.command("start").description("Start agents in polling mode").option
|
|
|
5975
6019
|
}
|
|
5976
6020
|
config = loadConfig();
|
|
5977
6021
|
}
|
|
5978
|
-
console.log(formatVersionBanner("0.
|
|
6022
|
+
console.log(formatVersionBanner("0.21.0", "a24bc6d"));
|
|
5979
6023
|
if (config.agents && config.agents.length > 0) {
|
|
5980
6024
|
const toolEntries = config.agents.map((a) => ({
|
|
5981
6025
|
tool: a.tool,
|
|
@@ -6798,7 +6842,7 @@ var statusCommand = new Command4("status").description("Show agent config, conne
|
|
|
6798
6842
|
});
|
|
6799
6843
|
|
|
6800
6844
|
// src/index.ts
|
|
6801
|
-
var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.
|
|
6845
|
+
var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.21.0"} (${"a24bc6d"})`);
|
|
6802
6846
|
program.addCommand(agentCommand);
|
|
6803
6847
|
program.addCommand(authCommand());
|
|
6804
6848
|
program.addCommand(dedupCommand());
|