opencode-agent-teams 1.0.1 → 1.0.3
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 +48 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48,24 +48,36 @@ function loadBg(id) {
|
|
|
48
48
|
}
|
|
49
49
|
function listPlans() {
|
|
50
50
|
ensureDir();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
try {
|
|
52
|
+
return readdirSync(TEAMS_DIR)
|
|
53
|
+
.filter((f) => f.startsWith("plan-"))
|
|
54
|
+
.map((f) => JSON.parse(readFileSync(join(TEAMS_DIR, f), "utf-8")));
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
55
59
|
}
|
|
56
60
|
function listRuns() {
|
|
57
61
|
ensureDir();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
try {
|
|
63
|
+
return readdirSync(TEAMS_DIR)
|
|
64
|
+
.filter((f) => f.startsWith("run-"))
|
|
65
|
+
.map((f) => JSON.parse(readFileSync(join(TEAMS_DIR, f), "utf-8")));
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
62
70
|
}
|
|
63
71
|
function listBg() {
|
|
64
72
|
ensureDir();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
try {
|
|
74
|
+
return readdirSync(TEAMS_DIR)
|
|
75
|
+
.filter((f) => f.startsWith("bg-"))
|
|
76
|
+
.map((f) => JSON.parse(readFileSync(join(TEAMS_DIR, f), "utf-8")));
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
69
81
|
}
|
|
70
82
|
function topologicalSort(tasks) {
|
|
71
83
|
const taskMap = new Map(tasks.map((t) => [t.id, t]));
|
|
@@ -105,13 +117,13 @@ async function getCurrentModel(client, sessionID) {
|
|
|
105
117
|
try {
|
|
106
118
|
const { data: msgs } = await client.session.messages({
|
|
107
119
|
path: { id: sessionID },
|
|
108
|
-
query: { limit:
|
|
120
|
+
query: { limit: 20 },
|
|
109
121
|
});
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
if (msgs) {
|
|
123
|
+
for (const msg of msgs) {
|
|
124
|
+
if (msg.info.role === "assistant" && msg.info.modelID && msg.info.providerID) {
|
|
125
|
+
return { providerID: msg.info.providerID, modelID: msg.info.modelID };
|
|
126
|
+
}
|
|
115
127
|
}
|
|
116
128
|
}
|
|
117
129
|
return undefined;
|
|
@@ -238,7 +250,7 @@ const plugin = async (ctx) => {
|
|
|
238
250
|
path: { id: session.id },
|
|
239
251
|
body: {
|
|
240
252
|
agent: taskDef.agent || "general",
|
|
241
|
-
model:
|
|
253
|
+
...(model ? { model } : {}),
|
|
242
254
|
parts: [{ type: "text", text: taskDef.prompt }],
|
|
243
255
|
},
|
|
244
256
|
});
|
|
@@ -248,6 +260,12 @@ const plugin = async (ctx) => {
|
|
|
248
260
|
}
|
|
249
261
|
else {
|
|
250
262
|
runEntry.status = "done";
|
|
263
|
+
const textParts = result.parts
|
|
264
|
+
.filter((p) => p.type === "text")
|
|
265
|
+
.map((p) => p.text);
|
|
266
|
+
if (textParts.length > 0) {
|
|
267
|
+
runEntry.result = textParts.join("\n");
|
|
268
|
+
}
|
|
251
269
|
}
|
|
252
270
|
}
|
|
253
271
|
catch (e) {
|
|
@@ -271,9 +289,17 @@ const plugin = async (ctx) => {
|
|
|
271
289
|
lines.push(` ${icon} ${t.id} — ${t.status}${session}`);
|
|
272
290
|
if (t.error)
|
|
273
291
|
lines.push(` error: ${t.error}`);
|
|
292
|
+
if (t.result) {
|
|
293
|
+
const excerpt = t.result.length > 600
|
|
294
|
+
? t.result.slice(0, 600) + "\n ... (truncated)"
|
|
295
|
+
: t.result;
|
|
296
|
+
lines.push(` result:`);
|
|
297
|
+
lines.push(excerpt
|
|
298
|
+
.split("\n")
|
|
299
|
+
.map((l) => ` ${l}`)
|
|
300
|
+
.join("\n"));
|
|
301
|
+
}
|
|
274
302
|
}
|
|
275
|
-
lines.push("");
|
|
276
|
-
lines.push("Use team_status to get detailed results from individual sessions.");
|
|
277
303
|
return lines.join("\n");
|
|
278
304
|
},
|
|
279
305
|
}),
|
|
@@ -386,7 +412,7 @@ const plugin = async (ctx) => {
|
|
|
386
412
|
path: { id: session.id },
|
|
387
413
|
body: {
|
|
388
414
|
agent: args.agent || "general",
|
|
389
|
-
model:
|
|
415
|
+
...(model ? { model } : {}),
|
|
390
416
|
parts: [{ type: "text", text: args.prompt }],
|
|
391
417
|
},
|
|
392
418
|
});
|
|
@@ -427,7 +453,6 @@ const plugin = async (ctx) => {
|
|
|
427
453
|
{
|
|
428
454
|
type: "text",
|
|
429
455
|
text: `[Background task "${taskID}" completed]\n\n${text}`,
|
|
430
|
-
synthetic: true,
|
|
431
456
|
},
|
|
432
457
|
],
|
|
433
458
|
noReply: true,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"opencode-agent-teams","version":"1.0.
|
|
1
|
+
{"name":"opencode-agent-teams","version":"1.0.3","description":"OpenCode plugin for parallel agent execution, background tasks, and team coordination. Create teams of agents that work together, run tasks in parallel respecting dependencies, and fire off background work without blocking.","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"files":["dist"],"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"keywords":["opencode","plugin","teams","agents","parallel","background","orchestration"],"author":{"name":"Maycol B.T","email":"soymaycol.cn@gmail.com","url":"https://github.com/SoyMaycol"},"publishConfig":{"access":"public"},"license":"MIT","repository":{"type":"git","url":"https://github.com/SoyMaycol/opencode-teams"},"peerDependencies":{"@opencode-ai/plugin":">=1.0.0","@opencode-ai/sdk":">=1.0.0"},"devDependencies":{"@opencode-ai/plugin":"1.4.6","@opencode-ai/sdk":"latest","@types/node":"^22.0.0","typescript":"^5.0.0"}}
|