opencode-agent-teams 1.0.2 → 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.
Files changed (2) hide show
  1. package/dist/index.js +32 -21
  2. 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
- const files = readFileSync(TEAMS_DIR, "utf-8")
52
- ? readdirSync(TEAMS_DIR).filter((f) => f.startsWith("plan-"))
53
- : [];
54
- return files.map((f) => JSON.parse(readFileSync(join(TEAMS_DIR, f), "utf-8")));
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
- const files = readFileSync(TEAMS_DIR, "utf-8")
59
- ? readdirSync(TEAMS_DIR).filter((f) => f.startsWith("run-"))
60
- : [];
61
- return files.map((f) => JSON.parse(readFileSync(join(TEAMS_DIR, f), "utf-8")));
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
- const files = readFileSync(TEAMS_DIR, "utf-8")
66
- ? readdirSync(TEAMS_DIR).filter((f) => f.startsWith("bg-"))
67
- : [];
68
- return files.map((f) => JSON.parse(readFileSync(join(TEAMS_DIR, f), "utf-8")));
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: 5 },
120
+ query: { limit: 20 },
109
121
  });
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 };
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: model,
253
+ ...(model ? { model } : {}),
242
254
  parts: [{ type: "text", text: taskDef.prompt }],
243
255
  },
244
256
  });
@@ -400,7 +412,7 @@ const plugin = async (ctx) => {
400
412
  path: { id: session.id },
401
413
  body: {
402
414
  agent: args.agent || "general",
403
- model: model,
415
+ ...(model ? { model } : {}),
404
416
  parts: [{ type: "text", text: args.prompt }],
405
417
  },
406
418
  });
@@ -441,7 +453,6 @@ const plugin = async (ctx) => {
441
453
  {
442
454
  type: "text",
443
455
  text: `[Background task "${taskID}" completed]\n\n${text}`,
444
- synthetic: true,
445
456
  },
446
457
  ],
447
458
  noReply: true,
package/package.json CHANGED
@@ -1 +1 @@
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"}}
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"}}