opencode-agent-teams 1.0.0 → 1.0.2
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 +39 -2
- package/package.json +1 -51
package/dist/index.js
CHANGED
|
@@ -101,6 +101,25 @@ function topologicalSort(tasks) {
|
|
|
101
101
|
}
|
|
102
102
|
return levels;
|
|
103
103
|
}
|
|
104
|
+
async function getCurrentModel(client, sessionID) {
|
|
105
|
+
try {
|
|
106
|
+
const { data: msgs } = await client.session.messages({
|
|
107
|
+
path: { id: sessionID },
|
|
108
|
+
query: { limit: 5 },
|
|
109
|
+
});
|
|
110
|
+
if (!msgs)
|
|
111
|
+
return undefined;
|
|
112
|
+
for (const msg of msgs) {
|
|
113
|
+
if (msg.info.role === "assistant" && msg.info.modelID && msg.info.providerID) {
|
|
114
|
+
return { providerID: msg.info.providerID, modelID: msg.info.modelID };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
104
123
|
const plugin = async (ctx) => {
|
|
105
124
|
return {
|
|
106
125
|
tool: {
|
|
@@ -181,6 +200,7 @@ const plugin = async (ctx) => {
|
|
|
181
200
|
const plan = loadPlan(args.plan_id);
|
|
182
201
|
if (!plan)
|
|
183
202
|
return `Plan "${args.plan_id}" not found. Create it first with team_create.`;
|
|
203
|
+
const model = await getCurrentModel(ctx.client, context.sessionID);
|
|
184
204
|
const run = {
|
|
185
205
|
planID: plan.id,
|
|
186
206
|
tasks: plan.tasks.map((t) => ({
|
|
@@ -218,6 +238,7 @@ const plugin = async (ctx) => {
|
|
|
218
238
|
path: { id: session.id },
|
|
219
239
|
body: {
|
|
220
240
|
agent: taskDef.agent || "general",
|
|
241
|
+
model: model,
|
|
221
242
|
parts: [{ type: "text", text: taskDef.prompt }],
|
|
222
243
|
},
|
|
223
244
|
});
|
|
@@ -227,6 +248,12 @@ const plugin = async (ctx) => {
|
|
|
227
248
|
}
|
|
228
249
|
else {
|
|
229
250
|
runEntry.status = "done";
|
|
251
|
+
const textParts = result.parts
|
|
252
|
+
.filter((p) => p.type === "text")
|
|
253
|
+
.map((p) => p.text);
|
|
254
|
+
if (textParts.length > 0) {
|
|
255
|
+
runEntry.result = textParts.join("\n");
|
|
256
|
+
}
|
|
230
257
|
}
|
|
231
258
|
}
|
|
232
259
|
catch (e) {
|
|
@@ -250,9 +277,17 @@ const plugin = async (ctx) => {
|
|
|
250
277
|
lines.push(` ${icon} ${t.id} — ${t.status}${session}`);
|
|
251
278
|
if (t.error)
|
|
252
279
|
lines.push(` error: ${t.error}`);
|
|
280
|
+
if (t.result) {
|
|
281
|
+
const excerpt = t.result.length > 600
|
|
282
|
+
? t.result.slice(0, 600) + "\n ... (truncated)"
|
|
283
|
+
: t.result;
|
|
284
|
+
lines.push(` result:`);
|
|
285
|
+
lines.push(excerpt
|
|
286
|
+
.split("\n")
|
|
287
|
+
.map((l) => ` ${l}`)
|
|
288
|
+
.join("\n"));
|
|
289
|
+
}
|
|
253
290
|
}
|
|
254
|
-
lines.push("");
|
|
255
|
-
lines.push("Use team_status to get detailed results from individual sessions.");
|
|
256
291
|
return lines.join("\n");
|
|
257
292
|
},
|
|
258
293
|
}),
|
|
@@ -341,6 +376,7 @@ const plugin = async (ctx) => {
|
|
|
341
376
|
},
|
|
342
377
|
async execute(args, context) {
|
|
343
378
|
const taskID = `bg-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
379
|
+
const model = await getCurrentModel(ctx.client, context.sessionID);
|
|
344
380
|
try {
|
|
345
381
|
const { data: session, error: createErr } = await ctx.client.session.create({
|
|
346
382
|
body: {
|
|
@@ -364,6 +400,7 @@ const plugin = async (ctx) => {
|
|
|
364
400
|
path: { id: session.id },
|
|
365
401
|
body: {
|
|
366
402
|
agent: args.agent || "general",
|
|
403
|
+
model: model,
|
|
367
404
|
parts: [{ type: "text", text: args.prompt }],
|
|
368
405
|
},
|
|
369
406
|
});
|
package/package.json
CHANGED
|
@@ -1,51 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "opencode-agent-teams",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"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.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"files": ["dist"],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsc",
|
|
17
|
-
"prepublishOnly": "npm run build"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"opencode",
|
|
21
|
-
"plugin",
|
|
22
|
-
"teams",
|
|
23
|
-
"agents",
|
|
24
|
-
"parallel",
|
|
25
|
-
"background",
|
|
26
|
-
"orchestration"
|
|
27
|
-
],
|
|
28
|
-
"author": {
|
|
29
|
-
"name": "Maycol B.T",
|
|
30
|
-
"email": "soymaycol.cn@gmail.com",
|
|
31
|
-
"url": "https://github.com/SoyMaycol"
|
|
32
|
-
},
|
|
33
|
-
"publishConfig": {
|
|
34
|
-
"access": "public"
|
|
35
|
-
},
|
|
36
|
-
"license": "MIT",
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "https://github.com/SoyMaycol/opencode-teams"
|
|
40
|
-
},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"@opencode-ai/plugin": ">=1.0.0",
|
|
43
|
-
"@opencode-ai/sdk": ">=1.0.0"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@opencode-ai/plugin": "1.4.6",
|
|
47
|
-
"@opencode-ai/sdk": "latest",
|
|
48
|
-
"@types/node": "^22.0.0",
|
|
49
|
-
"typescript": "^5.0.0"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{"name":"opencode-agent-teams","version":"1.0.2","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"}}
|