opencode-magi 0.0.0-dev-20260522141520 → 0.0.0-dev-20260522141748
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.
|
@@ -97,15 +97,26 @@ export async function createModelSession(input) {
|
|
|
97
97
|
}
|
|
98
98
|
export async function promptModelText(input) {
|
|
99
99
|
throwIfAborted(input.signal);
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
const abort = () => {
|
|
101
|
+
void input.client.session
|
|
102
|
+
.abort?.({ path: { id: input.sessionId } })
|
|
103
|
+
.catch(() => undefined);
|
|
104
|
+
};
|
|
105
|
+
input.signal?.addEventListener("abort", abort, { once: true });
|
|
106
|
+
try {
|
|
107
|
+
const result = await input.client.session.prompt({
|
|
108
|
+
body: {
|
|
109
|
+
model: modelBody(input.model),
|
|
110
|
+
parts: [{ type: "text", text: input.prompt }],
|
|
111
|
+
},
|
|
112
|
+
path: { id: input.sessionId },
|
|
113
|
+
});
|
|
114
|
+
throwIfAborted(input.signal);
|
|
115
|
+
return extractText(result, input.allowEmpty);
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
input.signal?.removeEventListener("abort", abort);
|
|
119
|
+
}
|
|
109
120
|
}
|
|
110
121
|
async function sendPrompt(client, sessionId, model, prompt, signal) {
|
|
111
122
|
return promptModelText({ client, model, prompt, sessionId, signal });
|
|
@@ -676,53 +676,7 @@ export class MagiRunManager {
|
|
|
676
676
|
state.status = "cancelled";
|
|
677
677
|
state.phase = "cancelled";
|
|
678
678
|
state.completedAt = now();
|
|
679
|
-
|
|
680
|
-
state.editor?.status === "running" ||
|
|
681
|
-
state.editor?.status === "repairing") {
|
|
682
|
-
state.editor.status = "cancelled";
|
|
683
|
-
}
|
|
684
|
-
if (state.editor?.sessionId) {
|
|
685
|
-
await this.input.client.session
|
|
686
|
-
.abort?.({ path: { id: state.editor.sessionId } })
|
|
687
|
-
.catch(() => undefined);
|
|
688
|
-
}
|
|
689
|
-
if (state.triageCreator?.status === "pending" ||
|
|
690
|
-
state.triageCreator?.status === "running" ||
|
|
691
|
-
state.triageCreator?.status === "repairing" ||
|
|
692
|
-
state.triageCreator?.status === "blocked") {
|
|
693
|
-
state.triageCreator.status = "cancelled";
|
|
694
|
-
}
|
|
695
|
-
if (state.triageCreator?.sessionId) {
|
|
696
|
-
await this.input.client.session
|
|
697
|
-
.abort?.({ path: { id: state.triageCreator.sessionId } })
|
|
698
|
-
.catch(() => undefined);
|
|
699
|
-
}
|
|
700
|
-
for (const reviewer of Object.values(state.reviewers)) {
|
|
701
|
-
if (reviewer.status === "pending" ||
|
|
702
|
-
reviewer.status === "running" ||
|
|
703
|
-
reviewer.status === "repairing" ||
|
|
704
|
-
reviewer.status === "blocked") {
|
|
705
|
-
reviewer.status = "cancelled";
|
|
706
|
-
}
|
|
707
|
-
if (reviewer.sessionId) {
|
|
708
|
-
await this.input.client.session
|
|
709
|
-
.abort?.({ path: { id: reviewer.sessionId } })
|
|
710
|
-
.catch(() => undefined);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
for (const classifier of Object.values(state.ciClassifiers ?? {})) {
|
|
714
|
-
if (classifier.status === "pending" ||
|
|
715
|
-
classifier.status === "running" ||
|
|
716
|
-
classifier.status === "repairing" ||
|
|
717
|
-
classifier.status === "blocked") {
|
|
718
|
-
classifier.status = "cancelled";
|
|
719
|
-
}
|
|
720
|
-
if (classifier.sessionId) {
|
|
721
|
-
await this.input.client.session
|
|
722
|
-
.abort?.({ path: { id: classifier.sessionId } })
|
|
723
|
-
.catch(() => undefined);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
679
|
+
await this.finishActiveAgents(state, "cancelled");
|
|
726
680
|
if (state.worktreePath) {
|
|
727
681
|
await removeWorktree(this.input.exec, state.worktreePath).catch(() => undefined);
|
|
728
682
|
}
|
|
@@ -1223,6 +1177,26 @@ export class MagiRunManager {
|
|
|
1223
1177
|
...Object.entries(state.reviewers),
|
|
1224
1178
|
];
|
|
1225
1179
|
}
|
|
1180
|
+
isActiveAgent(agent) {
|
|
1181
|
+
return (agent.status === "pending" ||
|
|
1182
|
+
agent.status === "running" ||
|
|
1183
|
+
agent.status === "repairing" ||
|
|
1184
|
+
agent.status === "blocked");
|
|
1185
|
+
}
|
|
1186
|
+
async finishActiveAgents(state, status, error) {
|
|
1187
|
+
for (const [, agent] of this.agentEntries(state)) {
|
|
1188
|
+
if (this.isActiveAgent(agent)) {
|
|
1189
|
+
agent.status = status;
|
|
1190
|
+
if (error != null)
|
|
1191
|
+
agent.error = error;
|
|
1192
|
+
}
|
|
1193
|
+
if (agent.sessionId) {
|
|
1194
|
+
await this.input.client.session
|
|
1195
|
+
.abort?.({ path: { id: agent.sessionId } })
|
|
1196
|
+
.catch(() => undefined);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1226
1200
|
selectPendingAgent(state, kind, key, requestId) {
|
|
1227
1201
|
const entries = key
|
|
1228
1202
|
? this.agentState(state, key)
|
|
@@ -1966,46 +1940,7 @@ export class MagiRunManager {
|
|
|
1966
1940
|
state.phase = "failed";
|
|
1967
1941
|
state.completedAt = now();
|
|
1968
1942
|
state.error = errorMessage(error);
|
|
1969
|
-
|
|
1970
|
-
state.editor?.status === "running" ||
|
|
1971
|
-
state.editor?.status === "repairing" ||
|
|
1972
|
-
state.editor?.status === "blocked") {
|
|
1973
|
-
state.editor.status = "failed";
|
|
1974
|
-
state.editor.error = state.error;
|
|
1975
|
-
}
|
|
1976
|
-
if (state.editor?.sessionId) {
|
|
1977
|
-
await this.input.client.session
|
|
1978
|
-
.abort?.({ path: { id: state.editor.sessionId } })
|
|
1979
|
-
.catch(() => undefined);
|
|
1980
|
-
}
|
|
1981
|
-
for (const reviewer of Object.values(state.reviewers)) {
|
|
1982
|
-
if (reviewer.status === "pending" ||
|
|
1983
|
-
reviewer.status === "running" ||
|
|
1984
|
-
reviewer.status === "repairing" ||
|
|
1985
|
-
reviewer.status === "blocked") {
|
|
1986
|
-
reviewer.status = "failed";
|
|
1987
|
-
reviewer.error = state.error;
|
|
1988
|
-
}
|
|
1989
|
-
if (reviewer.sessionId) {
|
|
1990
|
-
await this.input.client.session
|
|
1991
|
-
.abort?.({ path: { id: reviewer.sessionId } })
|
|
1992
|
-
.catch(() => undefined);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
for (const classifier of Object.values(state.ciClassifiers ?? {})) {
|
|
1996
|
-
if (classifier.status === "pending" ||
|
|
1997
|
-
classifier.status === "running" ||
|
|
1998
|
-
classifier.status === "repairing" ||
|
|
1999
|
-
classifier.status === "blocked") {
|
|
2000
|
-
classifier.status = "failed";
|
|
2001
|
-
classifier.error = state.error;
|
|
2002
|
-
}
|
|
2003
|
-
if (classifier.sessionId) {
|
|
2004
|
-
await this.input.client.session
|
|
2005
|
-
.abort?.({ path: { id: classifier.sessionId } })
|
|
2006
|
-
.catch(() => undefined);
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
1943
|
+
await this.finishActiveAgents(state, "failed", state.error);
|
|
2009
1944
|
await this.persist(state);
|
|
2010
1945
|
await this.notify(state, `Magi ${state.command} failed for ${runLabel(state)}: ${state.error}`, { reply: true });
|
|
2011
1946
|
this.active.delete(runId);
|
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-20260522141748",
|
|
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>",
|