@codemcp/workflows 6.9.0 → 6.11.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/package.json +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/packages/docs/package.json +1 -1
- package/packages/mcp-server/package.json +1 -1
- package/packages/opencode-plugin/dist/index.js +35 -55
- package/packages/opencode-plugin/package.json +1 -1
- package/packages/opencode-tui-plugin/package.json +1 -1
- package/packages/visualizer/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemcp/workflows",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.11.0",
|
|
4
4
|
"description": "A Model Context Protocol server that acts as an intelligent conversation state manager and development guide for LLMs, featuring comprehensive long-term memory with persistent project artifacts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "packages/cli/dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"typescript": "^5.9.3",
|
|
52
52
|
"vitepress": "^1.6.4",
|
|
53
53
|
"vitest": "4.0.18",
|
|
54
|
-
"@codemcp/workflows-core": "6.
|
|
54
|
+
"@codemcp/workflows-core": "6.11.0"
|
|
55
55
|
},
|
|
56
56
|
"lint-staged": {
|
|
57
57
|
"*.{ts,js,mts,cts,tsx,jsx}": [
|
|
@@ -28149,6 +28149,14 @@ function unwrapResult(result) {
|
|
|
28149
28149
|
function stripWhatsNextReferences(text) {
|
|
28150
28150
|
return text.split("\n").filter((line) => !line.toLowerCase().includes("whats_next")).join("\n").replace(/\n{3,}/g, "\n\n");
|
|
28151
28151
|
}
|
|
28152
|
+
var SUBAGENT_NAMES = /* @__PURE__ */ new Set(["general", "explore"]);
|
|
28153
|
+
function requirePrimaryAgent(agentName) {
|
|
28154
|
+
if (SUBAGENT_NAMES.has(agentName)) {
|
|
28155
|
+
throw new Error(
|
|
28156
|
+
`Workflow tools cannot be invoked from subagents. Agent "${agentName}" is a subagent. Use a primary agent to manage workflow state.`
|
|
28157
|
+
);
|
|
28158
|
+
}
|
|
28159
|
+
}
|
|
28152
28160
|
|
|
28153
28161
|
// src/tool-handlers/proceed-to-phase.ts
|
|
28154
28162
|
function createProceedToPhaseTool(getServerContext, setBufferedInstructions) {
|
|
@@ -28160,6 +28168,7 @@ function createProceedToPhaseTool(getServerContext, setBufferedInstructions) {
|
|
|
28160
28168
|
review_state: z5.enum(["not-required", "pending", "performed"]).optional().describe("Review state")
|
|
28161
28169
|
},
|
|
28162
28170
|
execute: async (args, context) => {
|
|
28171
|
+
requirePrimaryAgent(context.agent);
|
|
28163
28172
|
const { target_phase, reason, review_state } = args;
|
|
28164
28173
|
const serverContext = await getServerContext();
|
|
28165
28174
|
const logger37 = serverContext.loggerFactory ? serverContext.loggerFactory("proceed_to_phase") : createLogger2("proceed_to_phase");
|
|
@@ -28226,6 +28235,7 @@ function createConductReviewTool(getServerContext) {
|
|
|
28226
28235
|
target_phase: z6.string().describe("Target phase after review")
|
|
28227
28236
|
},
|
|
28228
28237
|
execute: async (args, context) => {
|
|
28238
|
+
requirePrimaryAgent(context.agent);
|
|
28229
28239
|
const { target_phase } = args;
|
|
28230
28240
|
const serverContext = await getServerContext();
|
|
28231
28241
|
const logger37 = serverContext.loggerFactory ? serverContext.loggerFactory("conduct_review") : createLogger2("conduct_review");
|
|
@@ -28266,6 +28276,7 @@ function createResetDevelopmentTool(projectDir, getServerContext) {
|
|
|
28266
28276
|
delete_plan: z7.boolean().optional().describe("Also delete plan file")
|
|
28267
28277
|
},
|
|
28268
28278
|
execute: async (args, context) => {
|
|
28279
|
+
requirePrimaryAgent(context.agent);
|
|
28269
28280
|
const { confirm, reason, delete_plan } = args;
|
|
28270
28281
|
const serverContext = await getServerContext();
|
|
28271
28282
|
const logger37 = serverContext.loggerFactory ? serverContext.loggerFactory("reset_development") : createLogger2("reset_development");
|
|
@@ -28338,6 +28349,7 @@ function createStartDevelopmentTool(projectDir, getServerContext, setBufferedIns
|
|
|
28338
28349
|
require_reviews: z8.boolean().optional().describe("Require reviews before phase transitions")
|
|
28339
28350
|
},
|
|
28340
28351
|
execute: async (args, context) => {
|
|
28352
|
+
requirePrimaryAgent(context.agent);
|
|
28341
28353
|
const serverContext = await getServerContext();
|
|
28342
28354
|
const logger37 = serverContext.loggerFactory ? serverContext.loggerFactory("start_development") : createLogger2("start_development");
|
|
28343
28355
|
logger37.debug("start_development called", { workflow: args.workflow });
|
|
@@ -28556,9 +28568,17 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28556
28568
|
directory: input.directory,
|
|
28557
28569
|
worktree: input.worktree
|
|
28558
28570
|
});
|
|
28559
|
-
const
|
|
28560
|
-
|
|
28561
|
-
|
|
28571
|
+
const envAgentFilter = process.env.WORKFLOW_AGENTS;
|
|
28572
|
+
const agentFilter = envAgentFilter && envAgentFilter.trim() ? new Set(
|
|
28573
|
+
envAgentFilter.split(",").map((a) => a.trim().toLowerCase()).filter(Boolean)
|
|
28574
|
+
) : null;
|
|
28575
|
+
function isAgentEnabled(agent) {
|
|
28576
|
+
if (agentFilter === null) return true;
|
|
28577
|
+
return agentFilter.has((agent ?? "").toLowerCase());
|
|
28578
|
+
}
|
|
28579
|
+
logger37.info("Workflows state initialized", {
|
|
28580
|
+
agentFilter: agentFilter ? [...agentFilter] : "all (no filter)"
|
|
28581
|
+
});
|
|
28562
28582
|
const planManager = new PlanManager2();
|
|
28563
28583
|
const instructionGenerator = new InstructionGenerator2();
|
|
28564
28584
|
let cachedServerContext = null;
|
|
@@ -28649,8 +28669,10 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28649
28669
|
});
|
|
28650
28670
|
}
|
|
28651
28671
|
}
|
|
28652
|
-
if (!
|
|
28653
|
-
logger37.debug("chat.message:
|
|
28672
|
+
if (!isAgentEnabled(hookInput.agent)) {
|
|
28673
|
+
logger37.debug("chat.message: Agent does not support workflows", {
|
|
28674
|
+
agent: hookInput.agent
|
|
28675
|
+
});
|
|
28654
28676
|
return;
|
|
28655
28677
|
}
|
|
28656
28678
|
let result = null;
|
|
@@ -28736,10 +28758,6 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28736
28758
|
* Fires before each tool execution. We block disallowed file edits based on phase.
|
|
28737
28759
|
*/
|
|
28738
28760
|
"tool.execute.before": async (hookInput, output) => {
|
|
28739
|
-
if (!workflowsEnabled) {
|
|
28740
|
-
logger37.debug("tool.execute.before: Workflows disabled, skipping hook");
|
|
28741
|
-
return;
|
|
28742
|
-
}
|
|
28743
28761
|
const editTools = ["edit", "write", "patch", "apply_patch", "multiedit"];
|
|
28744
28762
|
if (!editTools.includes(hookInput.tool)) {
|
|
28745
28763
|
return;
|
|
@@ -28782,12 +28800,6 @@ ACTION REQUIRED: Use transition_phase tool to move to a phase that allows editin
|
|
|
28782
28800
|
* to preserve and instruct the summary to end with phase continuation.
|
|
28783
28801
|
*/
|
|
28784
28802
|
"experimental.session.compacting": async (hookInput, output) => {
|
|
28785
|
-
if (!workflowsEnabled) {
|
|
28786
|
-
logger37.debug(
|
|
28787
|
-
"experimental.session.compacting: Workflows disabled, skipping hook"
|
|
28788
|
-
);
|
|
28789
|
-
return;
|
|
28790
|
-
}
|
|
28791
28803
|
logger37.debug("experimental.session.compacting hook fired", {
|
|
28792
28804
|
sessionID: hookInput.sessionID
|
|
28793
28805
|
});
|
|
@@ -28805,51 +28817,19 @@ ACTION REQUIRED: Use transition_phase tool to move to a phase that allows editin
|
|
|
28805
28817
|
logger37.info("Injected compaction guidance", { phase: state.phase });
|
|
28806
28818
|
},
|
|
28807
28819
|
/**
|
|
28808
|
-
*
|
|
28809
|
-
*
|
|
28810
|
-
|
|
28811
|
-
"command.execute.before": async (hookInput, output) => {
|
|
28812
|
-
const cmd = hookInput.command.toLowerCase();
|
|
28813
|
-
const args = (hookInput.arguments || "").toLowerCase().trim();
|
|
28814
|
-
if (cmd === "workflow" || cmd === "wf") {
|
|
28815
|
-
if (args === "on") {
|
|
28816
|
-
workflowsEnabled = true;
|
|
28817
|
-
output.parts.push({
|
|
28818
|
-
id: `prt_workflows_toggle_${Date.now()}`,
|
|
28819
|
-
type: "text",
|
|
28820
|
-
text: "Workflows enabled for this session."
|
|
28821
|
-
});
|
|
28822
|
-
logger37.info("Workflows toggled via command", { workflowsEnabled });
|
|
28823
|
-
} else if (args === "off") {
|
|
28824
|
-
workflowsEnabled = false;
|
|
28825
|
-
output.parts.push({
|
|
28826
|
-
id: `prt_workflows_toggle_${Date.now()}`,
|
|
28827
|
-
type: "text",
|
|
28828
|
-
text: "Workflows disabled for this session. Plugin will not inject instructions or enforce file restrictions."
|
|
28829
|
-
});
|
|
28830
|
-
logger37.info("Workflows toggled via command", { workflowsEnabled });
|
|
28831
|
-
} else {
|
|
28832
|
-
output.parts.push({
|
|
28833
|
-
id: `prt_workflows_toggle_${Date.now()}`,
|
|
28834
|
-
type: "text",
|
|
28835
|
-
text: `Usage: /workflow on|off or /wf on|off
|
|
28836
|
-
Current state: ${workflowsEnabled ? "enabled" : "disabled"}`
|
|
28837
|
-
});
|
|
28838
|
-
}
|
|
28839
|
-
}
|
|
28840
|
-
},
|
|
28841
|
-
/**
|
|
28842
|
-
* Custom tools - always registered so /workflow on can re-enable them mid-session.
|
|
28843
|
-
* Each tool's execute method checks workflowsEnabled at call time and throws a
|
|
28844
|
-
* clear message when disabled, rather than silently failing.
|
|
28820
|
+
* Custom tools - always registered to allow clear error messages.
|
|
28821
|
+
* Each tool's execute method checks the agent filter at call time and throws
|
|
28822
|
+
* an error if the agent is not allowed to use workflows.
|
|
28845
28823
|
*/
|
|
28846
28824
|
tool: await (async () => {
|
|
28847
|
-
const DISABLED_MSG = "Workflows are disabled (WORKFLOW=off). Enable with /workflow on or /wf on";
|
|
28848
28825
|
const wrap = (def) => ({
|
|
28849
28826
|
...def,
|
|
28850
28827
|
execute: async (args, ctx) => {
|
|
28851
|
-
|
|
28852
|
-
|
|
28828
|
+
const agent = ctx.agent;
|
|
28829
|
+
if (!isAgentEnabled(agent)) {
|
|
28830
|
+
throw new Error(
|
|
28831
|
+
`Workflows are not enabled for this agent (${agent}). Set WORKFLOW_AGENTS environment variable to include this agent, or use a different agent.`
|
|
28832
|
+
);
|
|
28853
28833
|
}
|
|
28854
28834
|
return def.execute(args, ctx);
|
|
28855
28835
|
}
|