@codemcp/workflows 6.20.1 → 6.21.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.
Files changed (134) hide show
  1. package/package.json +2 -2
  2. package/packages/cli/dist/{chunk-4N42FFJE.js → chunk-KWAFQZUI.js} +91 -2670
  3. package/packages/cli/dist/{cli-MFHC7UWY.js → cli-O52P3RVC.js} +468 -33
  4. package/packages/cli/dist/{dist-ISN3FRV4.js → dist-FIUD5G5U.js} +65 -4
  5. package/packages/cli/dist/{dist-TDV3DJ2J.js → dist-ZTAPC4IK.js} +3 -1
  6. package/packages/cli/dist/index.js +2 -2
  7. package/packages/cli/package.json +5 -2
  8. package/packages/cli/resources/templates/opencode-agents/coding.md.tmpl +13 -0
  9. package/packages/cli/resources/templates/opencode-agents/research.md.tmpl +13 -0
  10. package/packages/cli/resources/templates/opencode-agents/thinking.md.tmpl +13 -0
  11. package/packages/cli/resources/workflows/bugfix.yaml +6 -0
  12. package/packages/cli/resources/workflows/epcc.yaml +3 -0
  13. package/packages/cli/resources/workflows/greenfield.yaml +3 -0
  14. package/packages/cli/resources/workflows/pr-review.yaml +2 -0
  15. package/packages/cli/resources/workflows/qrspi.yaml +5 -0
  16. package/packages/cli/resources/workflows/tdd.yaml +3 -0
  17. package/packages/cli/resources/workflows/waterfall.yaml +3 -0
  18. package/packages/core/dist/capability-hint.d.ts +28 -0
  19. package/packages/core/dist/capability-hint.js +52 -0
  20. package/packages/core/dist/capability-hint.js.map +1 -0
  21. package/packages/core/dist/config-manager.d.ts +19 -0
  22. package/packages/core/dist/config-manager.js +26 -0
  23. package/packages/core/dist/config-manager.js.map +1 -1
  24. package/packages/core/dist/index.d.ts +1 -0
  25. package/packages/core/dist/index.js +1 -0
  26. package/packages/core/dist/index.js.map +1 -1
  27. package/packages/core/dist/instruction-generator.js +7 -1
  28. package/packages/core/dist/instruction-generator.js.map +1 -1
  29. package/packages/core/dist/interfaces/instruction-generator.interface.d.ts +14 -0
  30. package/packages/core/dist/state-machine-types.d.ts +7 -0
  31. package/packages/core/package.json +1 -1
  32. package/packages/core/resources/templates/opencode-agents/coding.md.tmpl +13 -0
  33. package/packages/core/resources/templates/opencode-agents/research.md.tmpl +13 -0
  34. package/packages/core/resources/templates/opencode-agents/thinking.md.tmpl +13 -0
  35. package/packages/core/resources/workflows/bugfix.yaml +6 -0
  36. package/packages/core/resources/workflows/epcc.yaml +3 -0
  37. package/packages/core/resources/workflows/greenfield.yaml +3 -0
  38. package/packages/core/resources/workflows/pr-review.yaml +2 -0
  39. package/packages/core/resources/workflows/qrspi.yaml +5 -0
  40. package/packages/core/resources/workflows/tdd.yaml +3 -0
  41. package/packages/core/resources/workflows/waterfall.yaml +3 -0
  42. package/packages/docs/.vitepress/dist/404.html +1 -1
  43. package/packages/docs/.vitepress/dist/assets/user_capability-routing.md.DbNKvMiS.js +15 -0
  44. package/packages/docs/.vitepress/dist/assets/user_capability-routing.md.DbNKvMiS.lean.js +1 -0
  45. package/packages/docs/.vitepress/dist/dev/ARCHITECTURE.html +2 -2
  46. package/packages/docs/.vitepress/dist/dev/DEVELOPMENT.html +2 -2
  47. package/packages/docs/.vitepress/dist/dev/LOGGING.html +2 -2
  48. package/packages/docs/.vitepress/dist/dev/PUBLISHING.html +2 -2
  49. package/packages/docs/.vitepress/dist/hashmap.json +1 -1
  50. package/packages/docs/.vitepress/dist/index.html +2 -2
  51. package/packages/docs/.vitepress/dist/user/advanced-engineering.html +3 -3
  52. package/packages/docs/.vitepress/dist/user/agent-setup.html +3 -3
  53. package/packages/docs/.vitepress/dist/user/beads-integration.html +2 -2
  54. package/packages/docs/.vitepress/dist/user/capability-routing.html +40 -0
  55. package/packages/docs/.vitepress/dist/user/crowd-mcp-integration.html +2 -2
  56. package/packages/docs/.vitepress/dist/user/custom-workflows.html +2 -2
  57. package/packages/docs/.vitepress/dist/user/git-commit-feature.html +2 -2
  58. package/packages/docs/.vitepress/dist/user/how-it-works.html +2 -2
  59. package/packages/docs/.vitepress/dist/user/long-term-memory.html +2 -2
  60. package/packages/docs/.vitepress/dist/user/packaged-workflows.html +2 -2
  61. package/packages/docs/.vitepress/dist/user/tutorial.html +2 -2
  62. package/packages/docs/.vitepress/dist/user/workflow-selection.html +2 -2
  63. package/packages/docs/.vitepress/dist/workflows/adr.html +1 -1
  64. package/packages/docs/.vitepress/dist/workflows/big-bang-conversion.html +1 -1
  65. package/packages/docs/.vitepress/dist/workflows/boundary-testing.html +1 -1
  66. package/packages/docs/.vitepress/dist/workflows/bugfix.html +1 -1
  67. package/packages/docs/.vitepress/dist/workflows/bugfix.yaml +6 -0
  68. package/packages/docs/.vitepress/dist/workflows/business-analysis.html +1 -1
  69. package/packages/docs/.vitepress/dist/workflows/c4-analysis.html +1 -1
  70. package/packages/docs/.vitepress/dist/workflows/epcc.html +1 -1
  71. package/packages/docs/.vitepress/dist/workflows/epcc.yaml +3 -0
  72. package/packages/docs/.vitepress/dist/workflows/game-beginner.html +1 -1
  73. package/packages/docs/.vitepress/dist/workflows/greenfield.html +1 -1
  74. package/packages/docs/.vitepress/dist/workflows/greenfield.yaml +3 -0
  75. package/packages/docs/.vitepress/dist/workflows/minor.html +1 -1
  76. package/packages/docs/.vitepress/dist/workflows/posts.html +1 -1
  77. package/packages/docs/.vitepress/dist/workflows/pr-review.html +1 -1
  78. package/packages/docs/.vitepress/dist/workflows/pr-review.yaml +2 -0
  79. package/packages/docs/.vitepress/dist/workflows/qrspi.html +1 -1
  80. package/packages/docs/.vitepress/dist/workflows/qrspi.yaml +5 -0
  81. package/packages/docs/.vitepress/dist/workflows/sdd-bugfix-crowd.html +1 -1
  82. package/packages/docs/.vitepress/dist/workflows/sdd-bugfix.html +1 -1
  83. package/packages/docs/.vitepress/dist/workflows/sdd-feature-crowd.html +1 -1
  84. package/packages/docs/.vitepress/dist/workflows/sdd-feature.html +1 -1
  85. package/packages/docs/.vitepress/dist/workflows/sdd-greenfield-crowd.html +1 -1
  86. package/packages/docs/.vitepress/dist/workflows/sdd-greenfield.html +1 -1
  87. package/packages/docs/.vitepress/dist/workflows/skilled-bugfix.html +1 -1
  88. package/packages/docs/.vitepress/dist/workflows/skilled-epcc.html +1 -1
  89. package/packages/docs/.vitepress/dist/workflows/skilled-greenfield.html +1 -1
  90. package/packages/docs/.vitepress/dist/workflows/slides.html +1 -1
  91. package/packages/docs/.vitepress/dist/workflows/tdd.html +1 -1
  92. package/packages/docs/.vitepress/dist/workflows/tdd.yaml +3 -0
  93. package/packages/docs/.vitepress/dist/workflows/waterfall.html +1 -1
  94. package/packages/docs/.vitepress/dist/workflows/waterfall.yaml +3 -0
  95. package/packages/docs/.vitepress/dist/workflows.html +1 -1
  96. package/packages/docs/package.json +1 -1
  97. package/packages/mcp-server/dist/index.js +67 -4
  98. package/packages/mcp-server/package.json +1 -1
  99. package/packages/mcp-server/resources/templates/opencode-agents/coding.md.tmpl +13 -0
  100. package/packages/mcp-server/resources/templates/opencode-agents/research.md.tmpl +13 -0
  101. package/packages/mcp-server/resources/templates/opencode-agents/thinking.md.tmpl +13 -0
  102. package/packages/mcp-server/resources/workflows/bugfix.yaml +6 -0
  103. package/packages/mcp-server/resources/workflows/epcc.yaml +3 -0
  104. package/packages/mcp-server/resources/workflows/greenfield.yaml +3 -0
  105. package/packages/mcp-server/resources/workflows/pr-review.yaml +2 -0
  106. package/packages/mcp-server/resources/workflows/qrspi.yaml +5 -0
  107. package/packages/mcp-server/resources/workflows/tdd.yaml +3 -0
  108. package/packages/mcp-server/resources/workflows/waterfall.yaml +3 -0
  109. package/packages/opencode-plugin/dist/index.d.ts +8 -192
  110. package/packages/opencode-plugin/dist/index.js +76 -5
  111. package/packages/opencode-plugin/package.json +6 -1
  112. package/packages/opencode-plugin/resources/templates/opencode-agents/coding.md.tmpl +13 -0
  113. package/packages/opencode-plugin/resources/templates/opencode-agents/research.md.tmpl +13 -0
  114. package/packages/opencode-plugin/resources/templates/opencode-agents/thinking.md.tmpl +13 -0
  115. package/packages/opencode-plugin/resources/workflows/bugfix.yaml +6 -0
  116. package/packages/opencode-plugin/resources/workflows/epcc.yaml +3 -0
  117. package/packages/opencode-plugin/resources/workflows/greenfield.yaml +3 -0
  118. package/packages/opencode-plugin/resources/workflows/pr-review.yaml +2 -0
  119. package/packages/opencode-plugin/resources/workflows/qrspi.yaml +5 -0
  120. package/packages/opencode-plugin/resources/workflows/tdd.yaml +3 -0
  121. package/packages/opencode-plugin/resources/workflows/waterfall.yaml +3 -0
  122. package/packages/opencode-tui-plugin/package.json +1 -1
  123. package/packages/visualizer/package.json +1 -1
  124. package/resources/state-machine-schema.json +4 -0
  125. package/resources/templates/opencode-agents/coding.md.tmpl +13 -0
  126. package/resources/templates/opencode-agents/research.md.tmpl +13 -0
  127. package/resources/templates/opencode-agents/thinking.md.tmpl +13 -0
  128. package/resources/workflows/bugfix.yaml +6 -0
  129. package/resources/workflows/epcc.yaml +3 -0
  130. package/resources/workflows/greenfield.yaml +3 -0
  131. package/resources/workflows/pr-review.yaml +2 -0
  132. package/resources/workflows/qrspi.yaml +5 -0
  133. package/resources/workflows/tdd.yaml +3 -0
  134. package/resources/workflows/waterfall.yaml +3 -0
@@ -1,72 +1,16 @@
1
- import { z } from 'zod';
2
- import { Effect } from 'effect';
1
+ import { Plugin } from '@opencode-ai/plugin';
2
+ export { Hooks, Plugin, PluginInput, PluginModule, ToolContext, ToolDefinition } from '@opencode-ai/plugin';
3
3
 
4
4
  /**
5
5
  * OpenCode Plugin Types
6
6
  *
7
- * Minimal type definitions needed for the plugin.
8
- * Based on @opencode-ai/plugin package types.
7
+ * Re-exports the types we need directly from the official @opencode-ai/plugin
8
+ * SDK so that any change to the SDK's type signatures (e.g. ToolContext.ask)
9
+ * is caught at compile time rather than silently breaking at runtime.
10
+ *
11
+ * Only types that are NOT exported by the SDK are defined here.
9
12
  */
10
13
 
11
- type Part = {
12
- type: 'text' | 'image' | 'file' | 'tool_use' | 'tool_result';
13
- text?: string;
14
- [key: string]: unknown;
15
- };
16
- type UserMessage = {
17
- id: string;
18
- sessionID: string;
19
- role: 'user';
20
- [key: string]: unknown;
21
- };
22
- type Message = {
23
- id: string;
24
- sessionID: string;
25
- role: 'user' | 'assistant';
26
- [key: string]: unknown;
27
- };
28
- type Model = {
29
- providerID: string;
30
- modelID: string;
31
- [key: string]: unknown;
32
- };
33
- type Project = {
34
- id: string;
35
- path: string;
36
- [key: string]: unknown;
37
- };
38
- type PluginInput = {
39
- client: unknown;
40
- project: Project;
41
- directory: string;
42
- worktree: string;
43
- serverUrl: URL;
44
- $: unknown;
45
- };
46
-
47
- type ToolContext = {
48
- sessionID: string;
49
- messageID: string;
50
- agent: string;
51
- directory: string;
52
- worktree: string;
53
- abort: AbortSignal;
54
- metadata(input: {
55
- title?: string;
56
- metadata?: Record<string, unknown>;
57
- }): void;
58
- ask(input: {
59
- permission: string;
60
- patterns: string[];
61
- always: string[];
62
- metadata: Record<string, unknown>;
63
- }): Effect.Effect<void>;
64
- };
65
- type ToolDefinition = {
66
- description: string;
67
- args: z.ZodRawShape;
68
- execute(args: unknown, context: ToolContext): Promise<string>;
69
- };
70
14
  type SessionCompactedEvent = {
71
15
  type: 'session.compacted';
72
16
  properties: {
@@ -84,134 +28,6 @@ type OtherEvent = {
84
28
  properties: Record<string, unknown>;
85
29
  };
86
30
  type BusEvent = SessionCompactedEvent | SessionIdleEvent | OtherEvent;
87
- interface Hooks {
88
- event?: (input: {
89
- event: BusEvent;
90
- }) => Promise<void>;
91
- config?: (input: unknown) => Promise<void>;
92
- tool?: {
93
- [key: string]: ToolDefinition;
94
- };
95
- auth?: unknown;
96
- /**
97
- * Called when a new message is received
98
- */
99
- 'chat.message'?: (input: {
100
- sessionID: string;
101
- agent?: string;
102
- model?: {
103
- providerID: string;
104
- modelID: string;
105
- };
106
- messageID?: string;
107
- variant?: string;
108
- }, output: {
109
- message: UserMessage;
110
- parts: Part[];
111
- }) => Promise<void>;
112
- /**
113
- * Modify parameters sent to LLM
114
- */
115
- 'chat.params'?: (input: {
116
- sessionID: string;
117
- agent: string;
118
- model: Model;
119
- provider: unknown;
120
- message: UserMessage;
121
- }, output: {
122
- temperature: number;
123
- topP: number;
124
- topK: number;
125
- options: Record<string, unknown>;
126
- }) => Promise<void>;
127
- 'chat.headers'?: (input: {
128
- sessionID: string;
129
- agent: string;
130
- model: Model;
131
- provider: unknown;
132
- message: UserMessage;
133
- }, output: {
134
- headers: Record<string, string>;
135
- }) => Promise<void>;
136
- 'permission.ask'?: (input: unknown, output: {
137
- status: 'ask' | 'deny' | 'allow';
138
- }) => Promise<void>;
139
- 'command.execute.before'?: (input: {
140
- command: string;
141
- sessionID: string;
142
- arguments: string;
143
- }, output: {
144
- parts: Part[];
145
- }) => Promise<void>;
146
- 'tool.execute.before'?: (input: {
147
- tool: string;
148
- sessionID: string;
149
- callID: string;
150
- }, output: {
151
- args: Record<string, unknown>;
152
- }) => Promise<void>;
153
- 'shell.env'?: (input: {
154
- cwd: string;
155
- sessionID?: string;
156
- callID?: string;
157
- }, output: {
158
- env: Record<string, string>;
159
- }) => Promise<void>;
160
- 'tool.execute.after'?: (input: {
161
- tool: string;
162
- sessionID: string;
163
- callID: string;
164
- args: unknown;
165
- }, output: {
166
- title: string;
167
- output: string;
168
- metadata: unknown;
169
- }) => Promise<void>;
170
- 'experimental.chat.messages.transform'?: (input: Record<string, never>, output: {
171
- messages: {
172
- info: Message;
173
- parts: Part[];
174
- }[];
175
- }) => Promise<void>;
176
- 'experimental.chat.system.transform'?: (input: {
177
- sessionID?: string;
178
- model: Model;
179
- }, output: {
180
- system: string[];
181
- }) => Promise<void>;
182
- /**
183
- * Called before session compaction starts. Allows plugins to customize
184
- * the compaction prompt.
185
- */
186
- 'experimental.session.compacting'?: (input: {
187
- sessionID: string;
188
- }, output: {
189
- context: string[];
190
- prompt?: string;
191
- }) => Promise<void>;
192
- 'experimental.text.complete'?: (input: {
193
- sessionID: string;
194
- messageID: string;
195
- partID: string;
196
- }, output: {
197
- text: string;
198
- }) => Promise<void>;
199
- /**
200
- * Modify tool definitions (description and parameters) sent to LLM
201
- */
202
- 'tool.definition'?: (input: {
203
- toolID: string;
204
- }, output: {
205
- description: string;
206
- parameters: unknown;
207
- }) => Promise<void>;
208
- }
209
- type Plugin = (input: PluginInput) => Promise<Hooks>;
210
- type PluginModule = {
211
- id?: string;
212
- server: Plugin;
213
- tui?: never;
214
- };
215
31
 
216
32
  /**
217
33
  * OpenCode Workflows Plugin
@@ -236,4 +52,4 @@ declare const _default: {
236
52
  server: Plugin;
237
53
  };
238
54
 
239
- export { type BusEvent, type Hooks, type Message, type Model, type OtherEvent, type Part, type Plugin, type PluginInput, type PluginModule, type Project, type SessionCompactedEvent, type SessionIdleEvent, type ToolContext, type ToolDefinition, type UserMessage, WorkflowsPlugin, _default as default };
55
+ export { type BusEvent, type OtherEvent, type SessionCompactedEvent, type SessionIdleEvent, WorkflowsPlugin, _default as default };
@@ -16878,7 +16878,8 @@ var ConfigManager = class {
16878
16878
  this.validateConfig(config, configPath);
16879
16879
  logger3.info("Loaded project configuration", {
16880
16880
  configPath,
16881
- enabledWorkflows: config.enabled_workflows?.length || 0
16881
+ enabledWorkflows: config.enabled_workflows?.length || 0,
16882
+ capabilityModels: config.capability_models ? Object.keys(config.capability_models).length : 0
16882
16883
  });
16883
16884
  return config;
16884
16885
  } catch (error) {
@@ -16908,6 +16909,23 @@ var ConfigManager = class {
16908
16909
  }
16909
16910
  }
16910
16911
  }
16912
+ if (config.capability_models !== void 0) {
16913
+ if (typeof config.capability_models !== "object" || config.capability_models === null || Array.isArray(config.capability_models)) {
16914
+ throw new Error(`Invalid config file ${configPath}: capability_models must be an object`);
16915
+ }
16916
+ for (const [key, entry] of Object.entries(config.capability_models)) {
16917
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
16918
+ throw new Error(`Invalid config file ${configPath}: capability_models entry '${key}' must be an object`);
16919
+ }
16920
+ const { model, agent } = entry;
16921
+ if (model !== void 0 && (typeof model !== "string" || model.trim() === "")) {
16922
+ throw new Error(`Invalid config file ${configPath}: capability_models entry '${key}' model must be a non-empty string`);
16923
+ }
16924
+ if (agent !== void 0 && (typeof agent !== "string" || agent.trim() === "")) {
16925
+ throw new Error(`Invalid config file ${configPath}: capability_models entry '${key}' agent must be a non-empty string`);
16926
+ }
16927
+ }
16928
+ }
16911
16929
  }
16912
16930
  };
16913
16931
 
@@ -19861,6 +19879,31 @@ var BeadsStateManager = class {
19861
19879
  }
19862
19880
  };
19863
19881
 
19882
+ // ../core/dist/capability-hint.js
19883
+ var CAPABILITY_DESCRIPTIONS = {
19884
+ thinking: "deep reasoning, complex planning",
19885
+ research: "fast information gathering and browsing"
19886
+ };
19887
+ function formatCapabilityHint(capability, config) {
19888
+ if (!capability) {
19889
+ return "";
19890
+ }
19891
+ const description = CAPABILITY_DESCRIPTIONS[capability];
19892
+ const label = description ? `Capability hint: This phase requires ${capability} capability (${description}).` : `Capability hint: This phase requires ${capability} capability.`;
19893
+ const model = config?.model;
19894
+ const agent = config?.agent;
19895
+ if (agent && model) {
19896
+ return `${label} When launching subagents, use agent: ${agent} (model: ${model}).`;
19897
+ }
19898
+ if (agent) {
19899
+ return `${label} When launching subagents, use agent: ${agent}.`;
19900
+ }
19901
+ if (model) {
19902
+ return `${label} When launching subagents, prefer model: ${model}.`;
19903
+ }
19904
+ return label;
19905
+ }
19906
+
19864
19907
  // ../core/dist/interaction-logger.js
19865
19908
  var logger12 = createLogger("InteractionLogger");
19866
19909
  var InteractionLogger = class {
@@ -19987,7 +20030,7 @@ var InstructionGenerator = class {
19987
20030
  * Enhance base instructions with context-specific information
19988
20031
  */
19989
20032
  async enhanceInstructions(baseInstructions, context3) {
19990
- const { phase, conversationContext, allowedFilePatterns } = context3;
20033
+ const { phase, conversationContext, allowedFilePatterns, requiredCapability, capabilityConfig } = context3;
19991
20034
  const phaseName = capitalizePhase(phase);
19992
20035
  let workflowSection = `---
19993
20036
  ### YOU MUST FOLLOW THESE INSTRUCTIONS:
@@ -20002,6 +20045,12 @@ var InstructionGenerator = class {
20002
20045
  if (allowedFilePatterns && allowedFilePatterns.length > 0 && !allowedFilePatterns.includes("**/*") && !allowedFilePatterns.includes("*")) {
20003
20046
  workflowSection += `
20004
20047
  - Files allowed: \`${allowedFilePatterns.join("`, `")}\``;
20048
+ }
20049
+ const capabilityHint = formatCapabilityHint(requiredCapability, capabilityConfig);
20050
+ if (capabilityHint) {
20051
+ workflowSection += `
20052
+
20053
+ ${capabilityHint}`;
20005
20054
  }
20006
20055
  workflowSection += "\n\nCall `whats_next()` after user messages.";
20007
20056
  return `## ${phaseName} Phase
@@ -26171,6 +26220,11 @@ var WhatsNextHandler = class extends ConversationRequiredToolHandler {
26171
26220
  );
26172
26221
  const phaseState = stateMachine.states[transitionResult.newPhase];
26173
26222
  const allowedFilePatterns = phaseState?.allowed_file_patterns ?? ["**/*"];
26223
+ const requiredCapability = phaseState?.required_capability;
26224
+ const projectConfig = ConfigManager.loadProjectConfig(
26225
+ conversationContext.projectPath
26226
+ );
26227
+ const capabilityConfig = requiredCapability ? projectConfig?.capability_models?.[requiredCapability] : void 0;
26174
26228
  const instructions = await context3.instructionGenerator.generateInstructions(
26175
26229
  transitionResult.instructions,
26176
26230
  {
@@ -26182,7 +26236,9 @@ var WhatsNextHandler = class extends ConversationRequiredToolHandler {
26182
26236
  transitionReason: transitionResult.transitionReason,
26183
26237
  isModeled: transitionResult.isModeled,
26184
26238
  instructionSource: "whats_next",
26185
- allowedFilePatterns
26239
+ allowedFilePatterns,
26240
+ requiredCapability,
26241
+ capabilityConfig
26186
26242
  }
26187
26243
  );
26188
26244
  let finalInstructions = instructions.instructions;
@@ -26343,6 +26399,11 @@ var ProceedToPhaseHandler = class extends ConversationRequiredToolHandler {
26343
26399
  );
26344
26400
  const phaseState = stateMachine.states[transitionResult.newPhase];
26345
26401
  const allowedFilePatterns = phaseState?.allowed_file_patterns ?? ["**/*"];
26402
+ const requiredCapability = phaseState?.required_capability;
26403
+ const projectConfig = ConfigManager.loadProjectConfig(
26404
+ conversationContext.projectPath
26405
+ );
26406
+ const capabilityConfig = requiredCapability ? projectConfig?.capability_models?.[requiredCapability] : void 0;
26346
26407
  const instructions = await context3.instructionGenerator.generateInstructions(
26347
26408
  transitionResult.instructions,
26348
26409
  {
@@ -26354,7 +26415,9 @@ var ProceedToPhaseHandler = class extends ConversationRequiredToolHandler {
26354
26415
  transitionReason: transitionResult.transitionReason,
26355
26416
  isModeled: transitionResult.isModeled,
26356
26417
  instructionSource: "proceed_to_phase",
26357
- allowedFilePatterns
26418
+ allowedFilePatterns,
26419
+ requiredCapability,
26420
+ capabilityConfig
26358
26421
  }
26359
26422
  );
26360
26423
  let finalInstructions = instructions.instructions;
@@ -28815,6 +28878,14 @@ function createOpenCodeLogger(client) {
28815
28878
  }
28816
28879
 
28817
28880
  // src/plugin.ts
28881
+ var EFFECT_TYPE_ID = "~effect/Effect";
28882
+ async function runAsk(askResult) {
28883
+ if (askResult !== null && typeof askResult === "object" && EFFECT_TYPE_ID in askResult) {
28884
+ await Effect_exports.runPromise(askResult);
28885
+ } else {
28886
+ await askResult;
28887
+ }
28888
+ }
28818
28889
  function matchGlobPattern(filePath, pattern) {
28819
28890
  const normalised = filePath.replace(/\\/g, "/");
28820
28891
  const baseName = normalised.split("/").pop() ?? "";
@@ -29277,7 +29348,7 @@ ${phaseInstructions}`
29277
29348
  `Workflows are not enabled for this agent (${agent}). Set WORKFLOW_AGENTS environment variable to include this agent, or use a different agent.`
29278
29349
  );
29279
29350
  }
29280
- await Effect_exports.runPromise(
29351
+ await runAsk(
29281
29352
  ctx.ask({
29282
29353
  permission: toolName,
29283
29354
  patterns: buildPermissionPatterns(
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/workflows-opencode",
3
- "version": "6.20.1",
3
+ "version": "6.21.0",
4
4
  "description": "OpenCode plugin for structured development workflows",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,18 +29,23 @@
29
29
  "devDependencies": {
30
30
  "@codemcp/workflows-core": "workspace:*",
31
31
  "@codemcp/workflows-server": "workspace:*",
32
+ "@opencode-ai/plugin": "*",
32
33
  "rimraf": "^6.0.1",
33
34
  "tsup": "^8.0.0",
34
35
  "vitest": "4.0.18"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "@anthropic-ai/sdk": "*",
39
+ "@opencode-ai/plugin": "*",
38
40
  "zod": ">=4.1.8"
39
41
  },
40
42
  "peerDependenciesMeta": {
41
43
  "@anthropic-ai/sdk": {
42
44
  "optional": true
43
45
  },
46
+ "@opencode-ai/plugin": {
47
+ "optional": false
48
+ },
44
49
  "zod": {
45
50
  "optional": false
46
51
  }
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: "Subagent for code generation and editing, focused on idiomatic patterns and minimal scope."
3
+ mode: subagent
4
+ model: ${model}
5
+ ---
6
+
7
+ You are the `${capability}` subagent for the workflows system. Your job is to implement focused, high-quality code changes on behalf of the parent agent.
8
+
9
+ Read the file you are about to edit before changing it. Match the surrounding style: indentation, naming, import order, error-handling conventions, and test patterns. Prefer small, surgical edits over large rewrites — change as little as possible to satisfy the requirement, and leave unrelated code untouched.
10
+
11
+ Write idiomatic code for the language and framework in use. Avoid clever one-liners, speculative abstractions, or new dependencies unless they are clearly justified. When a fix could be done two ways, pick the simpler one and note the trade-off in a short comment if it matters.
12
+
13
+ Run the relevant tests and linters when you can. If a build or test fails, do not declare success — diagnose and fix the root cause rather than papering over it. Never commit, push, or modify git state unless the parent agent explicitly instructs you to.
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: "Subagent for fast information gathering and codebase exploration."
3
+ mode: subagent
4
+ model: ${model}
5
+ ---
6
+
7
+ You are the `${capability}` subagent for the workflows system. Your job is to gather information quickly and report back concisely to the parent agent.
8
+
9
+ Search the codebase, documentation, and any provided context before answering. Use the most targeted query you can — exact symbol names, file paths, or distinctive error messages — before falling back to broader patterns. When a question can be answered by reading one or two files, just read them instead of guessing.
10
+
11
+ Report findings as a tight, structured summary: the direct answer first, then supporting evidence with file paths and line numbers. Quote only the snippets that matter. Do not paraphrase code when the original is clearer.
12
+
13
+ Avoid making changes. Do not implement, refactor, or "fix while you're there" — your job is to inform the parent's decision, not to make it. If a question cannot be answered from the available context, say so plainly and suggest the next investigation step.
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: "Subagent for deep reasoning, complex planning, and architectural trade-off analysis."
3
+ mode: subagent
4
+ model: ${model}
5
+ ---
6
+
7
+ You are the `${capability}` subagent for the workflows system. Your job is to support the parent agent during phases that demand careful reasoning, planning, and architectural analysis.
8
+
9
+ Approach problems methodically. Read the relevant code, surrounding tests, and any linked design notes before forming an opinion. When a question involves trade-offs, lay out the options with their concrete consequences rather than jumping to a single answer. Distinguish clearly between observed facts, reasonable inferences, and assumptions that still need verification.
10
+
11
+ Prefer structured output: short bullet lists, named options, and explicit recommendation with rationale. Call out open questions, risks, and edge cases the parent agent should not overlook. When a decision depends on values (readability, performance, maintainability, scope) name them rather than hand-waving.
12
+
13
+ Avoid making code changes unless the parent agent explicitly asks you to. Your primary value is sharp thinking, not typing. Do not invent APIs, file paths, or version numbers — when uncertain, say so and point at where to verify.
@@ -26,10 +26,13 @@ metadata:
26
26
  states:
27
27
  reproduce:
28
28
  description: 'Reproduce and understand the bug'
29
+ required_capability: 'research'
29
30
  allowed_file_patterns:
30
31
  - '**/*.md'
31
32
  - '**/*.txt'
32
33
  - '**/*.adoc'
34
+ - '**/*test*'
35
+ - '**/*spec*'
33
36
  default_instructions: |
34
37
  Gather specific information to reliably reproduce the reported bug:
35
38
  - What are the exact OS, browser/runtime versions, and hardware specs?
@@ -46,6 +49,7 @@ states:
46
49
 
47
50
  analyze:
48
51
  description: 'Analyze the bug and identify root cause'
52
+ required_capability: 'thinking'
49
53
  allowed_file_patterns:
50
54
  - '**/*.md'
51
55
  - '**/*.txt'
@@ -74,6 +78,7 @@ states:
74
78
 
75
79
  fix:
76
80
  description: 'Implement the bug fix'
81
+ required_capability: 'coding'
77
82
  allowed_file_patterns:
78
83
  - '**/*'
79
84
  default_instructions: |
@@ -110,6 +115,7 @@ states:
110
115
 
111
116
  verify:
112
117
  description: 'Verify the fix and ensure no regressions'
118
+ required_capability: 'thinking'
113
119
  allowed_file_patterns:
114
120
  - '**/*'
115
121
  default_instructions: Test the fix thoroughly to ensure the original bug is resolved and no new issues were introduced. Run existing tests, create new ones if needed, and verify the solution is robust.
@@ -26,6 +26,7 @@ metadata:
26
26
  states:
27
27
  explore:
28
28
  description: 'Research and exploration phase - understanding the problem space'
29
+ required_capability: 'research'
29
30
  allowed_file_patterns:
30
31
  - '**/*.md'
31
32
  - '**/*.txt'
@@ -48,6 +49,7 @@ states:
48
49
 
49
50
  plan:
50
51
  description: 'Planning phase - creating a detailed implementation strategy'
52
+ required_capability: 'thinking'
51
53
  allowed_file_patterns:
52
54
  - '**/*.md'
53
55
  - '**/*.txt'
@@ -92,6 +94,7 @@ states:
92
94
 
93
95
  code:
94
96
  description: 'Implementation phase - writing and building the solution'
97
+ required_capability: 'coding'
95
98
  allowed_file_patterns:
96
99
  - '**/*'
97
100
  default_instructions: |
@@ -27,6 +27,7 @@ metadata:
27
27
  states:
28
28
  ideation:
29
29
  description: 'Deep requirements discovery and PRD creation phase'
30
+ required_capability: 'thinking'
30
31
  allowed_file_patterns:
31
32
  - '**/*.md'
32
33
  - '**/*.txt'
@@ -51,6 +52,7 @@ states:
51
52
 
52
53
  architecture:
53
54
  description: 'Tech stack selection and architecture design phase'
55
+ required_capability: 'thinking'
54
56
  allowed_file_patterns:
55
57
  - '**/*.md'
56
58
  - '**/*.txt'
@@ -130,6 +132,7 @@ states:
130
132
 
131
133
  code:
132
134
  description: 'Implementation phase following the established plan and architecture'
135
+ required_capability: 'coding'
133
136
  allowed_file_patterns:
134
137
  - '**/*'
135
138
  default_instructions: |
@@ -57,6 +57,7 @@ states:
57
57
 
58
58
  review_architecture:
59
59
  description: 'Review whether the change is in the right place and respects existing structure'
60
+ required_capability: 'thinking'
60
61
  default_instructions: |
61
62
  Evaluate the structural decisions in the change against the confirmed intent:
62
63
 
@@ -93,6 +94,7 @@ states:
93
94
 
94
95
  review_correctness:
95
96
  description: 'Review whether the logic correctly achieves the confirmed intent'
97
+ required_capability: 'thinking'
96
98
  default_instructions: |
97
99
  Evaluate the logic of the change against the confirmed intent:
98
100
 
@@ -54,6 +54,7 @@ states:
54
54
 
55
55
  research:
56
56
  description: 'Gather facts without forming conclusions or proposing solutions'
57
+ required_capability: 'research'
57
58
  allowed_file_patterns:
58
59
  - '**/*.md'
59
60
  - '**/*.txt'
@@ -81,6 +82,7 @@ states:
81
82
 
82
83
  design:
83
84
  description: 'Explore options and reach consensus on WHAT and high-level HOW'
85
+ required_capability: 'thinking'
84
86
  allowed_file_patterns:
85
87
  - '**/*.md'
86
88
  - '**/*.txt'
@@ -114,6 +116,7 @@ states:
114
116
 
115
117
  structure:
116
118
  description: 'Decompose the approved design into end-to-end vertical slices'
119
+ required_capability: 'thinking'
117
120
  allowed_file_patterns:
118
121
  - '**/*.md'
119
122
  - '**/*.txt'
@@ -143,6 +146,7 @@ states:
143
146
 
144
147
  plan:
145
148
  description: 'Create a detailed implementation plan per vertical slice'
149
+ required_capability: 'thinking'
146
150
  allowed_file_patterns:
147
151
  - '**/*.md'
148
152
  - '**/*.txt'
@@ -182,6 +186,7 @@ states:
182
186
 
183
187
  implement:
184
188
  description: 'Build the solution slice by slice'
189
+ required_capability: 'coding'
185
190
  allowed_file_patterns:
186
191
  - '**/*'
187
192
  default_instructions: |
@@ -26,6 +26,7 @@ metadata:
26
26
  states:
27
27
  explore:
28
28
  description: 'Research and exploration phase - understanding the problem space and codebase'
29
+ required_capability: 'research'
29
30
  allowed_file_patterns:
30
31
  - '**/*.md'
31
32
  - '**/*.txt'
@@ -50,6 +51,7 @@ states:
50
51
 
51
52
  red:
52
53
  description: 'RED phase - Write a failing test that defines the expected behavior'
54
+ required_capability: 'thinking'
53
55
  allowed_file_patterns:
54
56
  - '**/*'
55
57
  default_instructions: |
@@ -87,6 +89,7 @@ states:
87
89
 
88
90
  green:
89
91
  description: 'GREEN phase - Write only the necessary code to make the test pass'
92
+ required_capability: 'coding'
90
93
  allowed_file_patterns:
91
94
  - '**/*'
92
95
  default_instructions: |
@@ -27,6 +27,7 @@ metadata:
27
27
  states:
28
28
  requirements:
29
29
  description: 'Gathering and analyzing requirements'
30
+ required_capability: 'research'
30
31
  allowed_file_patterns:
31
32
  - '**/*.md'
32
33
  - '**/*.txt'
@@ -53,6 +54,7 @@ states:
53
54
 
54
55
  design:
55
56
  description: 'Technical design and architecture planning'
57
+ required_capability: 'thinking'
56
58
  allowed_file_patterns:
57
59
  - '**/*.md'
58
60
  - '**/*.txt'
@@ -80,6 +82,7 @@ states:
80
82
 
81
83
  implementation:
82
84
  description: 'Building the solution according to design'
85
+ required_capability: 'coding'
83
86
  allowed_file_patterns:
84
87
  - '**/*'
85
88
  default_instructions: |
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/workflows-opencode-tui",
3
- "version": "6.20.1",
3
+ "version": "6.21.0",
4
4
  "description": "OpenCode TUI sidebar plugin that displays the current responsible-vibe workflow phase and name",
5
5
  "main": "workflows-phase.tsx",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/workflows-visualizer",
3
- "version": "6.20.1",
3
+ "version": "6.21.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.ts",
6
6
  "module": "dist/index.ts",
@@ -82,6 +82,10 @@
82
82
  },
83
83
  "description": "Glob patterns for files that can be edited in this state. Use '**/*' to allow all files."
84
84
  },
85
+ "required_capability": {
86
+ "type": "string",
87
+ "description": "Optional capability hint for this phase. If absent, no capability routing is applied. Free-form string; conventional values are `thinking`, `research`, `coding`. See `.vibe/config.yaml` `capability_models` for optional model/agent mapping."
88
+ },
85
89
  "default_instructions": {
86
90
  "type": "string",
87
91
  "description": "Default instructions when entering this state"