opencode-magi 0.0.0-dev-20260522141748 → 0.0.0-dev-20260522141851
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/config/validate.js +0 -1
- package/dist/orchestrator/triage.js +2 -45
- package/dist/prompts/compose.js +1 -9
- package/dist/prompts/contracts.js +0 -19
- package/dist/prompts/output.js +0 -15
- package/package.json +1 -1
- package/schema.json +0 -1
- package/dist/prompts/templates/triage/action.md +0 -5
package/dist/config/validate.js
CHANGED
|
@@ -3,8 +3,8 @@ import { dirname, join } from "node:path";
|
|
|
3
3
|
import { issueRunOutputDir } from "../config/output";
|
|
4
4
|
import { worktreeBaseDir } from "../config/worktree";
|
|
5
5
|
import { assignIssue, closeIssue, closePullRequest, configureGitIdentity, createPullRequest, fetchIssue, fetchIssueComments, fetchRelatedPullRequests, postIssueComment, pushHead, removeIssueLabels, removeWorktree, searchDuplicateIssues, shellQuote, updateIssueComment, } from "../github/commands";
|
|
6
|
-
import { composeTriageAcceptancePrompt,
|
|
7
|
-
import {
|
|
6
|
+
import { composeTriageAcceptancePrompt, composeTriageCategoryPrompt, composeTriageCommentClassificationPrompt, composeTriageCreatePrPrompt, composeTriageDuplicatePrompt, composeTriageExistingPrPrompt, composeTriageReconsiderPrompt, } from "../prompts/compose";
|
|
7
|
+
import { parseTriageBinaryOutput, parseTriageCategoryOutput, parseTriageCommentClassificationOutput, parseTriageCreatePrOutput, parseTriageDuplicateOutput, parseTriageExistingPrOutput, } from "../prompts/output";
|
|
8
8
|
import { aggregateStringMajority, majorityThreshold } from "./majority";
|
|
9
9
|
import { runModelWithRepair, } from "./model";
|
|
10
10
|
const MARKER_PREFIX = "opencode-magi:triage";
|
|
@@ -456,42 +456,6 @@ function previousAutomationPlan(input) {
|
|
|
456
456
|
postComment: false,
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
async function runActionPrompt(input) {
|
|
460
|
-
const agent = input.input.repository.agents.triage?.[0];
|
|
461
|
-
if (!agent)
|
|
462
|
-
throw new Error("triage.agents is required");
|
|
463
|
-
const context = JSON.stringify({
|
|
464
|
-
allowedActions: input.plan.allowedActions,
|
|
465
|
-
deterministicPlan: input.plan,
|
|
466
|
-
result: input.result,
|
|
467
|
-
triageContext: input.context,
|
|
468
|
-
}, null, 2);
|
|
469
|
-
const prompt = await composeTriageActionPrompt({
|
|
470
|
-
context,
|
|
471
|
-
directory: input.input.directory,
|
|
472
|
-
issue: input.input.issue,
|
|
473
|
-
repository: input.input.repository,
|
|
474
|
-
reviewer: agent,
|
|
475
|
-
});
|
|
476
|
-
const result = await runModelWithRepair({
|
|
477
|
-
client: input.input.client,
|
|
478
|
-
model: agent.model,
|
|
479
|
-
options: agent.options,
|
|
480
|
-
parentSessionId: input.input.parentSessionId,
|
|
481
|
-
parse: parseTriageActionOutput,
|
|
482
|
-
permission: agent.permission,
|
|
483
|
-
prompt,
|
|
484
|
-
repairAttempts: 3,
|
|
485
|
-
schemaName: "triage action",
|
|
486
|
-
signal: input.input.signal,
|
|
487
|
-
title: `Magi triage action #${input.input.issue}`,
|
|
488
|
-
});
|
|
489
|
-
await writeJson(join(input.outputDir, "action.json"), {
|
|
490
|
-
model: result.value,
|
|
491
|
-
plan: input.plan,
|
|
492
|
-
});
|
|
493
|
-
return result.value;
|
|
494
|
-
}
|
|
495
459
|
async function classifyMentionReplies(input) {
|
|
496
460
|
const agent = input.input.repository.agents.triage?.[0];
|
|
497
461
|
if (!agent)
|
|
@@ -663,13 +627,6 @@ async function finishWithResult(input) {
|
|
|
663
627
|
result: input.result,
|
|
664
628
|
type: "decision",
|
|
665
629
|
});
|
|
666
|
-
await runActionPrompt({
|
|
667
|
-
context: input.context,
|
|
668
|
-
input: input.input,
|
|
669
|
-
outputDir: input.outputDir,
|
|
670
|
-
plan,
|
|
671
|
-
result: input.result,
|
|
672
|
-
});
|
|
673
630
|
let prUrl;
|
|
674
631
|
const reporter = triageReporter(input.input.repository, input.issue.number);
|
|
675
632
|
const comment = plan.postComment && input.result.disposition !== "ask"
|
package/dist/prompts/compose.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { isAbsolute, join } from "node:path";
|
|
4
|
-
import { ciClassificationAfterEditOutputContract, ciClassificationOutputContract, closeReconsiderationOutputContract, editOutputContract, findingValidationOutputContract, rereviewCloseReconsiderationOutputContract, rereviewOutputContract, reviewOutputContract,
|
|
4
|
+
import { ciClassificationAfterEditOutputContract, ciClassificationOutputContract, closeReconsiderationOutputContract, editOutputContract, findingValidationOutputContract, rereviewCloseReconsiderationOutputContract, rereviewOutputContract, reviewOutputContract, triageCommentClassificationOutputContract, triageCreatePrOutputContract, triageDuplicateOutputContract, triageVoteOutputContract, } from "./contracts";
|
|
5
5
|
async function readOptionalPrompt(directory, path, values = {}) {
|
|
6
6
|
if (!path)
|
|
7
7
|
return "";
|
|
@@ -339,14 +339,6 @@ async function composeTriageVotePrompt(input) {
|
|
|
339
339
|
.filter(Boolean)
|
|
340
340
|
.join("\n\n");
|
|
341
341
|
}
|
|
342
|
-
export async function composeTriageActionPrompt(input) {
|
|
343
|
-
return composeTriageVotePrompt({
|
|
344
|
-
...input,
|
|
345
|
-
builtin: "action",
|
|
346
|
-
customPath: input.repository.triage?.prompts.action,
|
|
347
|
-
outputContract: triageActionOutputContract,
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
342
|
export async function composeTriageCommentPrompt(input) {
|
|
351
343
|
const values = triageValues(input);
|
|
352
344
|
const task = await taskBlock({
|
|
@@ -256,24 +256,6 @@ The object must match this shape:
|
|
|
256
256
|
]
|
|
257
257
|
}
|
|
258
258
|
</output_contract>`.trim();
|
|
259
|
-
export const triageActionOutputContract = `
|
|
260
|
-
<output_contract>
|
|
261
|
-
Return exactly one JSON object and nothing else. Do not wrap it in markdown.
|
|
262
|
-
|
|
263
|
-
The object must match this shape:
|
|
264
|
-
{
|
|
265
|
-
"action": "ASK" | "COMMENT" | "CLOSE" | "PR" | "CLEAR_ONLY",
|
|
266
|
-
"reason": "Short rationale."
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
Rules:
|
|
270
|
-
- Choose only an action listed as allowed in the task context.
|
|
271
|
-
- ASK means post an author-mentioned question and do not close, create a PR, or clear labels.
|
|
272
|
-
- COMMENT means post a decision comment only.
|
|
273
|
-
- CLOSE means post a decision comment and close the issue.
|
|
274
|
-
- PR means post a decision comment and create an implementation PR.
|
|
275
|
-
- CLEAR_ONLY means clear labels without posting a comment.
|
|
276
|
-
</output_contract>`.trim();
|
|
277
259
|
const outputContractsBySchemaName = {
|
|
278
260
|
"CI classification": ciClassificationOutputContract,
|
|
279
261
|
"close reconsideration": closeReconsiderationOutputContract,
|
|
@@ -282,7 +264,6 @@ const outputContractsBySchemaName = {
|
|
|
282
264
|
rereview: rereviewOutputContract,
|
|
283
265
|
"rereview close reconsideration": rereviewCloseReconsiderationOutputContract,
|
|
284
266
|
review: reviewOutputContract,
|
|
285
|
-
"triage action": triageActionOutputContract,
|
|
286
267
|
"triage acceptance": triageVoteOutputContract('"YES" | "NO" | "ASK"'),
|
|
287
268
|
"triage category": triageVoteOutputContract('"ASK" or one of the configured category IDs'),
|
|
288
269
|
"triage create PR": triageCreatePrOutputContract,
|
package/dist/prompts/output.js
CHANGED
|
@@ -154,21 +154,6 @@ export function parseTriageCommentClassificationOutput(text) {
|
|
|
154
154
|
}),
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
export function parseTriageActionOutput(text) {
|
|
158
|
-
const data = extractJson(text);
|
|
159
|
-
if (!data || typeof data !== "object")
|
|
160
|
-
throw new Error("triage action output must be an object");
|
|
161
|
-
return {
|
|
162
|
-
action: requireOneOf(data.action, "action", [
|
|
163
|
-
"ASK",
|
|
164
|
-
"CLEAR_ONLY",
|
|
165
|
-
"CLOSE",
|
|
166
|
-
"COMMENT",
|
|
167
|
-
"PR",
|
|
168
|
-
]),
|
|
169
|
-
reason: requireString(data.reason, "reason"),
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
157
|
export function parseReviewOutput(text) {
|
|
173
158
|
const data = extractJson(text);
|
|
174
159
|
if (!data || typeof data !== "object")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-magi",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260522141851",
|
|
4
4
|
"description": "Multi-agent PR review and merge orchestration plugin for OpenCode.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",
|
package/schema.json
CHANGED
|
@@ -229,7 +229,6 @@
|
|
|
229
229
|
"duplicate": { "type": "string" },
|
|
230
230
|
"category": { "type": "string" },
|
|
231
231
|
"acceptance": { "type": "string" },
|
|
232
|
-
"action": { "type": "string" },
|
|
233
232
|
"question": { "type": "string" },
|
|
234
233
|
"comment": { "type": "string" },
|
|
235
234
|
"commentClassification": { "type": "string" },
|