@te-river/opencode-team-mode 1.3.0 → 1.4.0

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/agents.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * TeamMode agent definitions.
3
3
  *
4
- * Each agent is injected into the OpenCode config via the plugin's v2
5
- * `setup` hook. Users see them in the agent picker of OpenCode Desktop
6
- * and can invoke them with `@agent-name` or via the `/team-*` commands.
4
+ * Each agent is injected into the OpenCode config via the plugin's v1
5
+ * `config` hook (the mechanism the shipped 1.18.x loader actually calls).
6
+ * Users see them in the agent picker of OpenCode Desktop and can invoke
7
+ * them with `@agent-name` or via the `/team-*` commands.
7
8
  *
8
9
  * Prompt design principles (v1.2):
9
10
  * - TodoList discipline is a hard rule for the Team Lead (plan-first for
@@ -15,6 +16,6 @@
15
16
  * dispatch embeds the relevant prior outputs.
16
17
  * - Research findings carry confidence tags and critical ones are verified.
17
18
  */
18
- import type { AgentItem } from "./types.js";
19
- export declare const agents: Record<string, AgentItem>;
19
+ import type { AgentConfig } from "./types.js";
20
+ export declare const agents: Record<string, AgentConfig>;
20
21
  //# sourceMappingURL=agents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AA8a3C,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAO5C,CAAA"}
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAyZ7C,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAO9C,CAAA"}
package/dist/agents.js CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * TeamMode agent definitions.
3
3
  *
4
- * Each agent is injected into the OpenCode config via the plugin's v2
5
- * `setup` hook. Users see them in the agent picker of OpenCode Desktop
6
- * and can invoke them with `@agent-name` or via the `/team-*` commands.
4
+ * Each agent is injected into the OpenCode config via the plugin's v1
5
+ * `config` hook (the mechanism the shipped 1.18.x loader actually calls).
6
+ * Users see them in the agent picker of OpenCode Desktop and can invoke
7
+ * them with `@agent-name` or via the `/team-*` commands.
7
8
  *
8
9
  * Prompt design principles (v1.2):
9
10
  * - TodoList discipline is a hard rule for the Team Lead (plan-first for
@@ -15,7 +16,6 @@
15
16
  * dispatch embeds the relevant prior outputs.
16
17
  * - Research findings carry confidence tags and critical ones are verified.
17
18
  */
18
- import { RULE } from "./types.js";
19
19
  /* ------------------------------------------------------------------ */
20
20
  /* Blackboard write guarantee (appended to every specialist prompt) */
21
21
  /* ------------------------------------------------------------------ */
@@ -43,7 +43,7 @@ const teamLead = {
43
43
  "review/test feedback loop, and synthesises their outputs into a coherent " +
44
44
  "deliverable. Use when the task requires multi-step collaboration across " +
45
45
  "different expertise areas.",
46
- system: `You are the **Team Lead** in a multi-agent coding team.
46
+ prompt: `You are the **Team Lead** in a multi-agent coding team.
47
47
 
48
48
  ## Role
49
49
  You orchestrate the team: decompose work, dispatch it to specialist agents
@@ -151,12 +151,12 @@ adoption:
151
151
  - Your final output is a structured summary, not raw agent transcripts.
152
152
  `,
153
153
  color: "#E879F9", // purple
154
- permissions: [
155
- RULE("edit", "*", "allow"),
156
- RULE("bash", "*", "allow"),
157
- RULE("webfetch", "*", "allow"),
158
- RULE("task", "*", "allow"),
159
- ],
154
+ permission: {
155
+ edit: "allow",
156
+ bash: "allow",
157
+ webfetch: "allow",
158
+ task: "allow",
159
+ },
160
160
  };
161
161
  /* ------------------------------------------------------------------ */
162
162
  /* Architect */
@@ -167,7 +167,7 @@ const architect = {
167
167
  "and technical strategy; revises designs when review or testing exposes a " +
168
168
  "flaw. Use when you need a design doc, architecture decision record, or " +
169
169
  "module breakdown before implementation.",
170
- system: `You are the **Architect** on a multi-agent coding team.
170
+ prompt: `You are the **Architect** on a multi-agent coding team.
171
171
 
172
172
  ## Role
173
173
  You produce clear, implementable technical designs. You think in systems:
@@ -206,11 +206,7 @@ When the team lead sends back a design flaw found in review or testing:
206
206
  color: "#38BDF8", // sky blue
207
207
  // Read-only on PROJECT sources; the blackboard artifact is explicitly
208
208
  // writable (see Blackboard write guarantee).
209
- permissions: [
210
- RULE("edit", "*", "allow"),
211
- RULE("bash", "*", "deny"),
212
- RULE("webfetch", "*", "allow"),
213
- ],
209
+ permission: { edit: "allow", bash: "deny", webfetch: "allow" },
214
210
  };
215
211
  /* ------------------------------------------------------------------ */
216
212
  /* Implementer */
@@ -220,7 +216,7 @@ const implementer = {
220
216
  description: "Core implementer — writes production code, creates files, and builds " +
221
217
  "features according to the architect's design; applies review-driven fix " +
222
218
  "tasks. Use when you need clean, working code written quickly.",
223
- system: `You are the **Implementer** on a multi-agent coding team.
219
+ prompt: `You are the **Implementer** on a multi-agent coding team.
224
220
 
225
221
  ## Role
226
222
  You write clean, production-quality code following the design spec handed
@@ -253,11 +249,7 @@ to you by the team lead.
253
249
  check, the previously failing test).
254
250
  `,
255
251
  color: "#4ADE80", // green
256
- permissions: [
257
- RULE("edit", "*", "allow"),
258
- RULE("bash", "*", "allow"),
259
- RULE("webfetch", "*", "allow"),
260
- ],
252
+ permission: { edit: "allow", bash: "allow", webfetch: "allow" },
261
253
  };
262
254
  /* ------------------------------------------------------------------ */
263
255
  /* Reviewer */
@@ -267,7 +259,7 @@ const reviewer = {
267
259
  description: "Code reviewer — audits code for correctness, performance, security, " +
268
260
  "maintainability, and best practices with severity-graded, actionable " +
269
261
  "findings. Use when you want a thorough review before merging.",
270
- system: `You are the **Reviewer** on a multi-agent coding team.
262
+ prompt: `You are the **Reviewer** on a multi-agent coding team.
271
263
 
272
264
  ## Role
273
265
  You perform thorough, constructive code reviews. You catch bugs, security
@@ -310,11 +302,7 @@ by item (fixed / not fixed / partial).
310
302
  color: "#FB923C", // orange
311
303
  // May edit ONLY the blackboard artifact; never the reviewed code
312
304
  // (see Blackboard write guarantee + role rules).
313
- permissions: [
314
- RULE("edit", "*", "allow"),
315
- RULE("bash", "*", "allow"),
316
- RULE("webfetch", "*", "allow"),
317
- ],
305
+ permission: { edit: "allow", bash: "allow", webfetch: "allow" },
318
306
  };
319
307
  /* ------------------------------------------------------------------ */
320
308
  /* Tester */
@@ -324,7 +312,7 @@ const tester = {
324
312
  description: "Test engineer — writes and runs unit/integration tests, classifies " +
325
313
  "failures (product bug vs bad test vs environment), and reports a clear " +
326
314
  "verdict. Use to validate correctness or raise coverage.",
327
- system: `You are the **Tester** on a multi-agent coding team.
315
+ prompt: `You are the **Tester** on a multi-agent coding team.
328
316
 
329
317
  ## Role
330
318
  You write comprehensive, maintainable tests and give the team a trustworthy
@@ -364,11 +352,7 @@ pass/fail signal.
364
352
  refactor instead of contorting the test.
365
353
  `,
366
354
  color: "#F472B6", // pink
367
- permissions: [
368
- RULE("edit", "*", "allow"),
369
- RULE("bash", "*", "allow"),
370
- RULE("webfetch", "*", "allow"),
371
- ],
355
+ permission: { edit: "allow", bash: "allow", webfetch: "allow" },
372
356
  };
373
357
  /* ------------------------------------------------------------------ */
374
358
  /* Researcher */
@@ -379,7 +363,7 @@ const researcher = {
379
363
  "documentation; every finding carries a source and confidence tag so " +
380
364
  "the team can decide what needs verification. Use for information that " +
381
365
  "must inform a technical decision.",
382
- system: `You are the **Researcher** on a multi-agent coding team.
366
+ prompt: `You are the **Researcher** on a multi-agent coding team.
383
367
 
384
368
  ## Role
385
369
  You find accurate, actionable information so the team can make informed
@@ -415,16 +399,11 @@ by the team — flag prominently if that is the case.
415
399
  - State which product/version each finding applies to.
416
400
  `,
417
401
  color: "#A78BFA", // violet
418
- permissions: [
419
- RULE("edit", "*", "allow"),
420
- RULE("bash", "*", "allow"),
421
- RULE("webfetch", "*", "allow"),
422
- RULE("websearch", "*", "allow"),
423
- ],
402
+ permission: { edit: "allow", bash: "allow", webfetch: "allow", websearch: "allow" },
424
403
  };
425
404
  /* Append the blackboard write guarantee to every specialist prompt. */
426
405
  for (const a of [architect, implementer, reviewer, tester, researcher]) {
427
- a.system = (a.system ?? "") + BLACKBOARD_GUARANTEE;
406
+ a.prompt = (a.prompt ?? "") + BLACKBOARD_GUARANTEE;
428
407
  }
429
408
  /* ------------------------------------------------------------------ */
430
409
  /* Export all agents keyed by name */
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;oCAaO,CAAA;AAEpC,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,QAAQ,GAAc;IAC1B,IAAI,EAAE,SAAS;IACf,WAAW,EACT,2EAA2E;QAC3E,qEAAqE;QACrE,2EAA2E;QAC3E,2EAA2E;QAC3E,4BAA4B;IAC9B,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GT;IACC,KAAK,EAAE,SAAS,EAAE,SAAS;IAC3B,WAAW,EAAE;QACX,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;QAC1B,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;QAC1B,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC;QAC9B,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;KAC3B;CACF,CAAA;AAED,wEAAwE;AACxE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I,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;CAChE,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,UAAU,GAAgB;IAC9B,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,iEAAiE;QACjE,sEAAsE;QACtE,yEAAyE;QACzE,mCAAmC;IACrC,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCT;IACC,KAAK,EAAE,SAAS,EAAE,SAAS;IAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;CACpF,CAAA;AAED,uEAAuE;AACvE,KAAK,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;IACvE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,oBAAoB,CAAA;AACpD,CAAC;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,CAAC,MAAM,MAAM,GAAgC;IACjD,WAAW,EAAE,QAAQ;IACrB,SAAS;IACT,WAAW;IACX,QAAQ;IACR,MAAM;IACN,UAAU;CACX,CAAA"}
@@ -5,6 +5,6 @@
5
5
  * `config` hook. Users invoke them with `/team-plan`, `/team-review`, etc.
6
6
  * in both OpenCode Desktop and the TUI.
7
7
  */
8
- import type { CommandItem } from "./types.js";
9
- export declare const commands: Record<string, CommandItem>;
8
+ import type { CommandConfig } from "./types.js";
9
+ export declare const commands: Record<string, CommandConfig>;
10
10
  //# sourceMappingURL=commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAwI7C,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAOhD,CAAA"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAwI/C,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAOlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,wEAAwE;AACxE,MAAM,QAAQ,GAAgB;IAC5B,WAAW,EACT,+FAA+F;IACjG,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE;;;;;;;;;;;;;kDAasC;CACjD,CAAA;AAED,wEAAwE;AACxE,MAAM,aAAa,GAAgB;IACjC,WAAW,EACT,0FAA0F;IAC5F,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE;;;;;;;;4DAQgD;CAC3D,CAAA;AAED,wEAAwE;AACxE,MAAM,UAAU,GAAgB;IAC9B,WAAW,EACT,0EAA0E;IAC5E,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE;;;;;;;;;;;;;gEAaoD;CAC/D,CAAA;AAED,wEAAwE;AACxE,MAAM,QAAQ,GAAgB;IAC5B,WAAW,EACT,2EAA2E;IAC7E,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE;;;;;;;;;;;8BAWkB;CAC7B,CAAA;AAED,wEAAwE;AACxE,MAAM,YAAY,GAAgB;IAChC,WAAW,EACT,uEAAuE;IACzE,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE;;;;;;;;;;;0DAW8C;CACzD,CAAA;AAED,wEAAwE;AACxE,MAAM,OAAO,GAAgB;IAC3B,WAAW,EACT,mGAAmG;IACrG,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE;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A0B0D;CACrE,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,CAAC,MAAM,QAAQ,GAAkC;IACrD,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,aAAa;IAC/B,aAAa,EAAE,UAAU;IACzB,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,YAAY;IAC7B,UAAU,EAAE,OAAO;CACpB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,18 @@
1
1
  /**
2
2
  * opencode-team-mode — OpenCode plugin entry point.
3
3
  *
4
- * Exports the hybrid object shape required by the current OpenCode Desktop
5
- * loader (v1.18.x):
6
- * - `id` → display name in the Desktop plugin list
7
- * - `server` → v1 loader gate; MUST exist or loading is rejected with
8
- * "must default export an object with server()"
9
- * - `setup` → v2 domain injection (agent/command transform), real payload
4
+ * Contract with the SHIPPED OpenCode Desktop loader (1.18.x, verified by
5
+ * reading the binary's own applyPlugin/readV1Plugin code):
6
+ *
7
+ * export default {
8
+ * id: "team-mode", → Desktop plugin display name
9
+ * server: async (input, options) => ({ config(cfg) { ...inject... } })
10
+ * }
11
+ *
12
+ * `server()` is the ONLY function the loader calls; a `setup` property is
13
+ * silently ignored (root cause of v1.1-v1.3 not appearing in the picker).
14
+ * The v1 `config` hook receives the merged opencode config and is the
15
+ * supported way to add agents/commands.
10
16
  *
11
17
  * Options (via the tuple plugin form):
12
18
  * "plugin": [["@te-river/opencode-team-mode@latest", { "ttlDays": 7 }]]
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AA8BhD,QAAA,MAAM,MAAM,EAAE,cA2Cb,CAAA;AAED,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAA;AAsBhE,QAAA,MAAM,MAAM,EAAE,cAmCb,CAAA;AAED,eAAe,MAAM,CAAA"}
package/dist/index.js CHANGED
@@ -1,12 +1,18 @@
1
1
  /**
2
2
  * opencode-team-mode — OpenCode plugin entry point.
3
3
  *
4
- * Exports the hybrid object shape required by the current OpenCode Desktop
5
- * loader (v1.18.x):
6
- * - `id` → display name in the Desktop plugin list
7
- * - `server` → v1 loader gate; MUST exist or loading is rejected with
8
- * "must default export an object with server()"
9
- * - `setup` → v2 domain injection (agent/command transform), real payload
4
+ * Contract with the SHIPPED OpenCode Desktop loader (1.18.x, verified by
5
+ * reading the binary's own applyPlugin/readV1Plugin code):
6
+ *
7
+ * export default {
8
+ * id: "team-mode", → Desktop plugin display name
9
+ * server: async (input, options) => ({ config(cfg) { ...inject... } })
10
+ * }
11
+ *
12
+ * `server()` is the ONLY function the loader calls; a `setup` property is
13
+ * silently ignored (root cause of v1.1-v1.3 not appearing in the picker).
14
+ * The v1 `config` hook receives the merged opencode config and is the
15
+ * supported way to add agents/commands.
10
16
  *
11
17
  * Options (via the tuple plugin form):
12
18
  * "plugin": [["@te-river/opencode-team-mode@latest", { "ttlDays": 7 }]]
@@ -15,14 +21,6 @@
15
21
  import { agents } from "./agents.js";
16
22
  import { commands } from "./commands.js";
17
23
  import { startBlackboardMaintenance, resolveTtlMs, DEFAULT_TTL_DAYS, } from "./blackboard.js";
18
- /** Best-effort workspace directory from plugin context, else cwd. */
19
- function resolveDirectory(ctx) {
20
- for (const candidate of [ctx.directory, ctx.project]) {
21
- if (typeof candidate === "string" && candidate.length > 0)
22
- return candidate;
23
- }
24
- return process.cwd();
25
- }
26
24
  /** Runtime addendum to the team-lead prompt: concrete board + TTL. */
27
25
  function blackboardNote(root, ttlDays) {
28
26
  return [
@@ -37,43 +35,38 @@ function blackboardNote(root, ttlDays) {
37
35
  }
38
36
  const plugin = {
39
37
  id: "team-mode",
40
- /** v1 loader gate — no v1 hooks needed, the v2 setup does everything. */
41
- server: async () => ({}),
42
- setup: async (ctx) => {
38
+ server: async (input, options) => {
43
39
  // ---------- blackboard maintenance (code-level TTL sweeper) ----------
44
- const directory = resolveDirectory(ctx);
45
- const ttlMs = resolveTtlMs(ctx.options);
40
+ const directory = typeof input?.directory === "string" && input.directory.length > 0
41
+ ? input.directory
42
+ : process.cwd();
43
+ const ttlMs = resolveTtlMs(options);
46
44
  const ttlDays = Math.round(ttlMs / (24 * 60 * 60 * 1000)) || DEFAULT_TTL_DAYS;
47
45
  const boardRoot = startBlackboardMaintenance(directory, ttlMs);
48
- // ---------- inject team agents (v2 AgentV2Info fields) ----------
49
- await ctx.agent.transform((agent) => {
50
- for (const [name, def] of Object.entries(agents)) {
51
- agent.update(name, (item) => {
52
- item.description = def.description;
53
- item.mode = def.mode;
54
- item.system =
55
- name === "team-lead"
56
- ? (def.system ?? "") + blackboardNote(boardRoot, ttlDays)
57
- : def.system;
58
- item.color = def.color;
59
- // Authoritative v2 ruleset — overrides any stale file-based agent
60
- // definition that might deny blackboard writes.
61
- if (def.permissions)
62
- item.permissions = def.permissions;
63
- });
64
- }
65
- });
66
- // ---------- inject team commands (v2 CommandV2Info fields) ----------
67
- await ctx.command.transform((command) => {
68
- for (const [name, def] of Object.entries(commands)) {
69
- command.update(name, (item) => {
70
- item.name = name;
71
- item.description = def.description;
72
- item.template = def.template ?? "";
73
- item.agent = def.agent;
74
- });
75
- }
76
- });
46
+ const note = blackboardNote(boardRoot, ttlDays);
47
+ return {
48
+ // ---------- v1 config hook: inject agents & commands ----------
49
+ config(cfg) {
50
+ if (!cfg.agent)
51
+ cfg.agent = {};
52
+ for (const [name, def] of Object.entries(agents)) {
53
+ // Respect user-defined overrides: never clobber an existing entry.
54
+ if (cfg.agent[name])
55
+ continue;
56
+ cfg.agent[name] = {
57
+ ...def,
58
+ prompt: name === "team-lead" ? (def.prompt ?? "") + note : def.prompt,
59
+ };
60
+ }
61
+ if (!cfg.command)
62
+ cfg.command = {};
63
+ for (const [name, def] of Object.entries(commands)) {
64
+ if (cfg.command[name])
65
+ continue;
66
+ cfg.command[name] = def;
67
+ }
68
+ },
69
+ };
77
70
  },
78
71
  };
79
72
  export default plugin;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAExB,qEAAqE;AACrE,SAAS,gBAAgB,CAAC,GAA+C;IACvE,KAAK,MAAM,SAAS,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACrD,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,SAAS,CAAA;IAC7E,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAA;AACtB,CAAC;AAED,sEAAsE;AACtE,SAAS,cAAc,CAAC,IAAY,EAAE,OAAe;IACnD,OAAO;QACL,EAAE;QACF,EAAE;QACF,kDAAkD;QAClD,qBAAqB,IAAI,IAAI;QAC7B,wFAAwF;QACxF,yEAAyE,OAAO,QAAQ;QACxF,+EAA+E;KAChF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC;AAED,MAAM,MAAM,GAAmB;IAC7B,EAAE,EAAE,WAAW;IAEf,yEAAyE;IACzE,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;IAExB,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACnB,wEAAwE;QACxE,MAAM,SAAS,GA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CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;gBACzB,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
package/dist/types.d.ts CHANGED
@@ -1,81 +1,69 @@
1
1
  /**
2
- * OpenCode plugin type definitions (1.18.x dual-stack loader).
2
+ * OpenCode plugin type definitions — contract for the shipped 1.18.x loader.
3
3
  *
4
- * IMPORTANT: the current OpenCode Desktop loader validates plugins with the
5
- * v1 schema (default export MUST have `server()`) while ALSO invoking an
6
- * optional v2-style `setup(context)` on the same object. The only shape that
7
- * actually loads is the hybrid:
4
+ * Verified against the desktop binary's own loader code
5
+ * (app.asar/out/main/chunks/node-*.js, readV1Plugin + applyPlugin):
8
6
  *
9
- * export default { id, server: async () => ({}), setup: async (ctx) => {} }
7
+ * async function applyPlugin(load, input, hooks) {
8
+ * const plugin = readV1Plugin(load.mod, load.spec, "server", "detect");
9
+ * if (plugin) {
10
+ * hooks.push(await plugin.server(input, load.options)); // ← only server()
11
+ * return;
12
+ * }
13
+ * // legacy: bare function default export also works
14
+ * }
10
15
  *
11
- * A pure v2 `define({ id, setup })` export is REJECTED with
12
- * "must default export an object with server()".
13
- *
14
- * v2 agent/command item shapes below are taken from
15
- * @opencode-ai/sdk/v2/types (AgentV2Info / CommandV2Info).
16
+ * Facts encoded here:
17
+ * - `setup` is NEVER called on this loader version (v1.1-v1.3 died here).
18
+ * - default export MUST be an object with a `server(input, options)`
19
+ * function; `id` on the object controls the Desktop plugin display name.
20
+ * - server() returns v1 Hooks; the `config(cfg)` hook receives the merged
21
+ * opencode config and is the working mechanism to inject agents/commands.
22
+ * - Agent/command entries inside cfg use the v1 config shape:
23
+ * prompt (string) + permission (object keyed by tool).
16
24
  */
17
- export type PermissionEffect = "allow" | "deny" | "ask";
18
- export interface PermissionRule {
19
- action: string;
20
- resource: string;
21
- effect: PermissionEffect;
25
+ export interface AgentPermission {
26
+ [tool: string]: string | Record<string, string>;
22
27
  }
23
- export declare const RULE: (action: string, resource: string, effect: PermissionEffect) => PermissionRule;
24
- export interface AgentItem {
28
+ export interface AgentConfig {
25
29
  description?: string;
26
- /** "primary" shows in the Desktop agent switcher; sub-agents use "subagent". */
27
30
  mode?: "primary" | "subagent" | "all";
28
- /** System prompt — v2 field name is `system`, NOT `prompt`. */
29
- system?: string;
31
+ /** v1 config field for the system prompt (NOT `system`). */
32
+ prompt?: string;
33
+ model?: string;
30
34
  color?: string;
31
35
  hidden?: boolean;
32
36
  steps?: number;
33
37
  temperature?: number;
34
- /** v2 ruleset array — NOT the v1 permission object. */
35
- permissions?: PermissionRule[];
38
+ permission?: AgentPermission;
36
39
  [key: string]: unknown;
37
40
  }
38
- export interface CommandItem {
39
- name?: string;
41
+ export interface CommandConfig {
40
42
  description?: string;
41
43
  template?: string;
42
44
  agent?: string;
43
- subtask?: boolean;
44
45
  [key: string]: unknown;
45
46
  }
46
- export interface AgentDraft {
47
- list(): readonly AgentItem[];
48
- get(id: string): AgentItem | undefined;
49
- default(id: string | undefined): void;
50
- /** Upsert: creates the entry when missing, then applies the updater. */
51
- update(id: string, update: (agent: AgentItem) => void): void;
52
- remove(id: string): void;
47
+ export interface OpenCodeConfig {
48
+ agent?: Record<string, AgentConfig>;
49
+ command?: Record<string, CommandConfig>;
50
+ [key: string]: unknown;
53
51
  }
54
- export interface CommandDraft {
55
- list(): readonly CommandItem[];
56
- get(name: string): CommandItem | undefined;
57
- update(name: string, update: (command: CommandItem) => void): void;
58
- remove(name: string): void;
52
+ export interface Hooks {
53
+ config?: (cfg: OpenCodeConfig) => void | Promise<void>;
54
+ [hook: string]: unknown;
59
55
  }
60
- export interface PluginContext {
61
- agent: {
62
- transform<T>(cb: (draft: AgentDraft) => T | Promise<T>): Promise<T | undefined>;
63
- reload(): Promise<void>;
64
- };
65
- command: {
66
- transform<T>(cb: (draft: CommandDraft) => T | Promise<T>): Promise<T | undefined>;
67
- reload(): Promise<void>;
68
- };
69
- options?: Record<string, unknown>;
70
- directory?: string;
71
- project?: string;
56
+ export interface PluginInput {
57
+ client: unknown;
58
+ project: string;
59
+ directory: string;
60
+ worktree?: string;
61
+ $?: unknown;
62
+ serverUrl?: URL;
72
63
  [key: string]: unknown;
73
64
  }
74
65
  export interface OpenCodePlugin {
75
66
  readonly id: string;
76
- /** v1 loader gate: MUST exist. Return the (empty) v1 hooks object. */
77
- readonly server: () => Promise<Record<string, unknown>>;
78
- /** v2 domain injection: the real payload. */
79
- readonly setup: (ctx: PluginContext) => Promise<void>;
67
+ readonly server: (input: PluginInput, options?: Record<string, unknown>) => Promise<Hooks>;
80
68
  }
81
69
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;AAEvD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,gBAAgB,CAAA;CACzB;AAED,eAAO,MAAM,IAAI,GACf,QAAQ,MAAM,EACd,UAAU,MAAM,EAChB,QAAQ,gBAAgB,KACvB,cAAgD,CAAA;AAInD,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,KAAK,CAAA;IACrC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,WAAW,CAAC,EAAE,cAAc,EAAE,CAAA;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAA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+1,26 @@
1
1
  /**
2
- * OpenCode plugin type definitions (1.18.x dual-stack loader).
2
+ * OpenCode plugin type definitions — contract for the shipped 1.18.x loader.
3
3
  *
4
- * IMPORTANT: the current OpenCode Desktop loader validates plugins with the
5
- * v1 schema (default export MUST have `server()`) while ALSO invoking an
6
- * optional v2-style `setup(context)` on the same object. The only shape that
7
- * actually loads is the hybrid:
4
+ * Verified against the desktop binary's own loader code
5
+ * (app.asar/out/main/chunks/node-*.js, readV1Plugin + applyPlugin):
8
6
  *
9
- * export default { id, server: async () => ({}), setup: async (ctx) => {} }
7
+ * async function applyPlugin(load, input, hooks) {
8
+ * const plugin = readV1Plugin(load.mod, load.spec, "server", "detect");
9
+ * if (plugin) {
10
+ * hooks.push(await plugin.server(input, load.options)); // ← only server()
11
+ * return;
12
+ * }
13
+ * // legacy: bare function default export also works
14
+ * }
10
15
  *
11
- * A pure v2 `define({ id, setup })` export is REJECTED with
12
- * "must default export an object with server()".
13
- *
14
- * v2 agent/command item shapes below are taken from
15
- * @opencode-ai/sdk/v2/types (AgentV2Info / CommandV2Info).
16
+ * Facts encoded here:
17
+ * - `setup` is NEVER called on this loader version (v1.1-v1.3 died here).
18
+ * - default export MUST be an object with a `server(input, options)`
19
+ * function; `id` on the object controls the Desktop plugin display name.
20
+ * - server() returns v1 Hooks; the `config(cfg)` hook receives the merged
21
+ * opencode config and is the working mechanism to inject agents/commands.
22
+ * - Agent/command entries inside cfg use the v1 config shape:
23
+ * prompt (string) + permission (object keyed by tool).
16
24
  */
17
- export const RULE = (action, resource, effect) => ({ action, resource, effect });
25
+ export {};
18
26
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAYH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAc,EACd,QAAgB,EAChB,MAAwB,EACR,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@te-river/opencode-team-mode",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Team collaboration mode plugin for OpenCode Desktop — injects specialized agents (architect, reviewer, implementer, tester, researcher) and team workflow commands into your OpenCode workspace.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",