opencode-magi 0.0.0-dev-20260525005102 → 0.0.0-dev-20260525022209

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 CHANGED
@@ -143,7 +143,6 @@ Add the following content to the configuration file.
143
143
  "editor": { "ref": "account-4" }
144
144
  },
145
145
  "triage": {
146
- "account": "account-5",
147
146
  "agents": [
148
147
  { "ref": "account-1" },
149
148
  { "ref": "account-2" },
@@ -128,13 +128,14 @@ async function emitTriageModelProgress(input) {
128
128
  }
129
129
  }
130
130
  async function runVote(input) {
131
- const prompt = await input.prompt({
132
- context: input.context,
133
- directory: input.directory,
134
- issue: input.issue,
135
- repository: input.repository,
136
- voter: input.agent,
137
- });
131
+ const prompt = input.promptText ??
132
+ (await input.prompt({
133
+ context: input.context,
134
+ directory: input.directory,
135
+ issue: input.issue,
136
+ repository: input.repository,
137
+ voter: input.agent,
138
+ }));
138
139
  await emitProgress(input.run, {
139
140
  phase: input.phase,
140
141
  type: "triage_agent_started",
@@ -260,7 +261,14 @@ async function runPhaseVote(input) {
260
261
  if (!agents?.length)
261
262
  throw new Error("triage.agents is required");
262
263
  await emitProgress(input.input, { phase: input.phase, type: "phase" });
263
- const outputs = await Promise.all(agents.map((agent) => runVote({
264
+ const promptTexts = await Promise.all(agents.map((agent) => input.prompt({
265
+ context: input.context,
266
+ directory: input.input.directory,
267
+ issue: input.input.issue,
268
+ repository: input.input.repository,
269
+ voter: agent,
270
+ })));
271
+ const outputs = await Promise.all(agents.map((agent, index) => runVote({
264
272
  agent,
265
273
  client: input.input.client,
266
274
  context: input.context,
@@ -269,6 +277,7 @@ async function runPhaseVote(input) {
269
277
  parse: input.parse,
270
278
  phase: input.phase,
271
279
  prompt: input.prompt,
280
+ promptText: promptTexts[index],
272
281
  repository: input.input.repository,
273
282
  run: input.input,
274
283
  schemaName: input.schemaName,
@@ -285,7 +294,16 @@ async function runPhaseVote(input) {
285
294
  voter: agents[index].key,
286
295
  })));
287
296
  await writeJson(join(input.outputDir, `${input.phase}-majority.json`), majority);
288
- return { outputs, vote: majority.vote };
297
+ return {
298
+ outputs,
299
+ reason: chooseDecisionReason({
300
+ outputs,
301
+ threshold: majority.threshold,
302
+ vote: majority.vote,
303
+ voters: majority.vote ? majority.voters[majority.vote] : undefined,
304
+ }),
305
+ vote: majority.vote,
306
+ };
289
307
  }
290
308
  async function relationshipScan(input, issue) {
291
309
  const [comments, relatedPullRequests, duplicateCandidates] = await Promise.all([
@@ -552,11 +570,12 @@ function askOutputs(outputs) {
552
570
  return (outputs ?? []).filter((output) => output.vote === "ASK");
553
571
  }
554
572
  function chooseDecisionReason(input) {
555
- return (input.outputs?.find((output) => output.voter === input.reporter.key &&
556
- output.vote === input.vote &&
557
- output.reason)?.reason ??
558
- input.outputs?.find((output) => output.vote === input.vote)?.reason ??
559
- input.outputs?.find((output) => output.voter === input.reporter.key)?.reason);
573
+ if (!input.vote)
574
+ return undefined;
575
+ const canonicalVoter = input.voters?.[input.threshold - 1];
576
+ const canonicalReason = input.outputs?.find((output) => output.voter === canonicalVoter && output.vote === input.vote);
577
+ return (canonicalReason?.reason ??
578
+ input.outputs?.find((output) => output.vote === input.vote)?.reason);
560
579
  }
561
580
  async function postMarkedIssueComment(input) {
562
581
  const posted = await postIssueComment(input.exec, input.repository, input.issue, input.account, input.body);
@@ -1004,12 +1023,7 @@ export async function runTriage(input) {
1004
1023
  input,
1005
1024
  outputDir,
1006
1025
  });
1007
- const reporter = triageReporter(input.repository, issue.number);
1008
- commentReason = chooseDecisionReason({
1009
- outputs: reconsideration.outputs,
1010
- reporter,
1011
- vote: reconsideration.vote ?? "ASK",
1012
- });
1026
+ commentReason = reconsideration.reason;
1013
1027
  result =
1014
1028
  reconsideration.vote === "YES"
1015
1029
  ? { category: previous.category, disposition: "accepted" }
@@ -1053,11 +1067,7 @@ export async function runTriage(input) {
1053
1067
  postComment: true,
1054
1068
  };
1055
1069
  return finishWithResult({
1056
- commentReason: chooseDecisionReason({
1057
- outputs: existingPr.outputs,
1058
- reporter: triageReporter(input.repository, issue.number),
1059
- vote: "RELATED_PR_HANDLES_ISSUE",
1060
- }),
1070
+ commentReason: existingPr.reason,
1061
1071
  context,
1062
1072
  input,
1063
1073
  issue,
@@ -1138,12 +1148,7 @@ export async function runTriage(input) {
1138
1148
  schemaName: "triage acceptance",
1139
1149
  votes: BINARY_VOTES,
1140
1150
  });
1141
- const reporter = triageReporter(input.repository, issue.number);
1142
- commentReason = chooseDecisionReason({
1143
- outputs: acceptance.outputs,
1144
- reporter,
1145
- vote: acceptance.vote ?? "ASK",
1146
- });
1151
+ commentReason = acceptance.reason;
1147
1152
  result =
1148
1153
  acceptance.vote === "YES"
1149
1154
  ? { category, disposition: "accepted" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magi",
3
- "version": "0.0.0-dev-20260525005102",
3
+ "version": "0.0.0-dev-20260525022209",
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>",