@codemcp/workflows 6.10.0 → 6.11.1
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 +56 -57
- 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.1",
|
|
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.1"
|
|
55
55
|
},
|
|
56
56
|
"lint-staged": {
|
|
57
57
|
"*.{ts,js,mts,cts,tsx,jsx}": [
|
|
@@ -28159,7 +28159,7 @@ function requirePrimaryAgent(agentName) {
|
|
|
28159
28159
|
}
|
|
28160
28160
|
|
|
28161
28161
|
// src/tool-handlers/proceed-to-phase.ts
|
|
28162
|
-
function createProceedToPhaseTool(getServerContext, setBufferedInstructions) {
|
|
28162
|
+
function createProceedToPhaseTool(getServerContext, setBufferedInstructions, client, getModel) {
|
|
28163
28163
|
return tool({
|
|
28164
28164
|
description: "Move to a development phase. Args: target_phase (from plan file), reason (optional), review_state (not-required|pending|performed)",
|
|
28165
28165
|
args: {
|
|
@@ -28202,6 +28202,17 @@ function createProceedToPhaseTool(getServerContext, setBufferedInstructions) {
|
|
|
28202
28202
|
plan_file_path: data.plan_file_path,
|
|
28203
28203
|
allowed_file_patterns: data.allowed_file_patterns
|
|
28204
28204
|
});
|
|
28205
|
+
const model = getModel();
|
|
28206
|
+
client.session.summarize({
|
|
28207
|
+
path: { id: context.sessionID },
|
|
28208
|
+
...model ? { body: model } : {}
|
|
28209
|
+
}).catch(() => {
|
|
28210
|
+
});
|
|
28211
|
+
logger37.info("Triggered compaction after phase transition", {
|
|
28212
|
+
phase: data.phase,
|
|
28213
|
+
sessionID: context.sessionID,
|
|
28214
|
+
hasModel: !!model
|
|
28215
|
+
});
|
|
28205
28216
|
const lines = [];
|
|
28206
28217
|
lines.push(`Transitioned to: ${data.phase}`);
|
|
28207
28218
|
if (data.transition_reason) {
|
|
@@ -28568,9 +28579,17 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28568
28579
|
directory: input.directory,
|
|
28569
28580
|
worktree: input.worktree
|
|
28570
28581
|
});
|
|
28571
|
-
const
|
|
28572
|
-
|
|
28573
|
-
|
|
28582
|
+
const envAgentFilter = process.env.WORKFLOW_AGENTS;
|
|
28583
|
+
const agentFilter = envAgentFilter && envAgentFilter.trim() ? new Set(
|
|
28584
|
+
envAgentFilter.split(",").map((a) => a.trim().toLowerCase()).filter(Boolean)
|
|
28585
|
+
) : null;
|
|
28586
|
+
function isAgentEnabled(agent) {
|
|
28587
|
+
if (agentFilter === null) return true;
|
|
28588
|
+
return agentFilter.has((agent ?? "").toLowerCase());
|
|
28589
|
+
}
|
|
28590
|
+
logger37.info("Workflows state initialized", {
|
|
28591
|
+
agentFilter: agentFilter ? [...agentFilter] : "all (no filter)"
|
|
28592
|
+
});
|
|
28574
28593
|
const planManager = new PlanManager2();
|
|
28575
28594
|
const instructionGenerator = new InstructionGenerator2();
|
|
28576
28595
|
let cachedServerContext = null;
|
|
@@ -28578,6 +28597,7 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28578
28597
|
let currentSessionId = null;
|
|
28579
28598
|
let lastKnownSessionId = null;
|
|
28580
28599
|
let bufferedInstructions = null;
|
|
28600
|
+
let lastKnownModel = null;
|
|
28581
28601
|
function setBufferedInstructions(result) {
|
|
28582
28602
|
bufferedInstructions = {
|
|
28583
28603
|
phase: result.phase,
|
|
@@ -28661,8 +28681,24 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28661
28681
|
});
|
|
28662
28682
|
}
|
|
28663
28683
|
}
|
|
28664
|
-
if (
|
|
28665
|
-
|
|
28684
|
+
if (hookInput.model) {
|
|
28685
|
+
lastKnownModel = hookInput.model;
|
|
28686
|
+
}
|
|
28687
|
+
if (!isAgentEnabled(hookInput.agent)) {
|
|
28688
|
+
logger37.debug(
|
|
28689
|
+
"chat.message: Agent not enabled \u2014 injecting tool suppression",
|
|
28690
|
+
{
|
|
28691
|
+
agent: hookInput.agent
|
|
28692
|
+
}
|
|
28693
|
+
);
|
|
28694
|
+
output.parts.push({
|
|
28695
|
+
id: `prt_workflows_suppress_${Date.now()}`,
|
|
28696
|
+
sessionID: hookInput.sessionID,
|
|
28697
|
+
messageID: hookInput.messageID || output.message.id,
|
|
28698
|
+
type: "text",
|
|
28699
|
+
synthetic: true,
|
|
28700
|
+
text: "IMPORTANT: The following workflow tools are NOT available in this session and must NOT be called under any circumstances: start_development, proceed_to_phase, conduct_review, reset_development, setup_project_docs. Calling them will result in an error. Ignore them entirely."
|
|
28701
|
+
});
|
|
28666
28702
|
return;
|
|
28667
28703
|
}
|
|
28668
28704
|
let result = null;
|
|
@@ -28748,10 +28784,6 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28748
28784
|
* Fires before each tool execution. We block disallowed file edits based on phase.
|
|
28749
28785
|
*/
|
|
28750
28786
|
"tool.execute.before": async (hookInput, output) => {
|
|
28751
|
-
if (!workflowsEnabled) {
|
|
28752
|
-
logger37.debug("tool.execute.before: Workflows disabled, skipping hook");
|
|
28753
|
-
return;
|
|
28754
|
-
}
|
|
28755
28787
|
const editTools = ["edit", "write", "patch", "apply_patch", "multiedit"];
|
|
28756
28788
|
if (!editTools.includes(hookInput.tool)) {
|
|
28757
28789
|
return;
|
|
@@ -28794,12 +28826,6 @@ ACTION REQUIRED: Use transition_phase tool to move to a phase that allows editin
|
|
|
28794
28826
|
* to preserve and instruct the summary to end with phase continuation.
|
|
28795
28827
|
*/
|
|
28796
28828
|
"experimental.session.compacting": async (hookInput, output) => {
|
|
28797
|
-
if (!workflowsEnabled) {
|
|
28798
|
-
logger37.debug(
|
|
28799
|
-
"experimental.session.compacting: Workflows disabled, skipping hook"
|
|
28800
|
-
);
|
|
28801
|
-
return;
|
|
28802
|
-
}
|
|
28803
28829
|
logger37.debug("experimental.session.compacting hook fired", {
|
|
28804
28830
|
sessionID: hookInput.sessionID
|
|
28805
28831
|
});
|
|
@@ -28817,51 +28843,19 @@ ACTION REQUIRED: Use transition_phase tool to move to a phase that allows editin
|
|
|
28817
28843
|
logger37.info("Injected compaction guidance", { phase: state.phase });
|
|
28818
28844
|
},
|
|
28819
28845
|
/**
|
|
28820
|
-
*
|
|
28821
|
-
*
|
|
28822
|
-
|
|
28823
|
-
"command.execute.before": async (hookInput, output) => {
|
|
28824
|
-
const cmd = hookInput.command.toLowerCase();
|
|
28825
|
-
const args = (hookInput.arguments || "").toLowerCase().trim();
|
|
28826
|
-
if (cmd === "workflow" || cmd === "wf") {
|
|
28827
|
-
if (args === "on") {
|
|
28828
|
-
workflowsEnabled = true;
|
|
28829
|
-
output.parts.push({
|
|
28830
|
-
id: `prt_workflows_toggle_${Date.now()}`,
|
|
28831
|
-
type: "text",
|
|
28832
|
-
text: "Workflows enabled for this session."
|
|
28833
|
-
});
|
|
28834
|
-
logger37.info("Workflows toggled via command", { workflowsEnabled });
|
|
28835
|
-
} else if (args === "off") {
|
|
28836
|
-
workflowsEnabled = false;
|
|
28837
|
-
output.parts.push({
|
|
28838
|
-
id: `prt_workflows_toggle_${Date.now()}`,
|
|
28839
|
-
type: "text",
|
|
28840
|
-
text: "Workflows disabled for this session. Plugin will not inject instructions or enforce file restrictions."
|
|
28841
|
-
});
|
|
28842
|
-
logger37.info("Workflows toggled via command", { workflowsEnabled });
|
|
28843
|
-
} else {
|
|
28844
|
-
output.parts.push({
|
|
28845
|
-
id: `prt_workflows_toggle_${Date.now()}`,
|
|
28846
|
-
type: "text",
|
|
28847
|
-
text: `Usage: /workflow on|off or /wf on|off
|
|
28848
|
-
Current state: ${workflowsEnabled ? "enabled" : "disabled"}`
|
|
28849
|
-
});
|
|
28850
|
-
}
|
|
28851
|
-
}
|
|
28852
|
-
},
|
|
28853
|
-
/**
|
|
28854
|
-
* Custom tools - always registered so /workflow on can re-enable them mid-session.
|
|
28855
|
-
* Each tool's execute method checks workflowsEnabled at call time and throws a
|
|
28856
|
-
* clear message when disabled, rather than silently failing.
|
|
28846
|
+
* Custom tools - always registered to allow clear error messages.
|
|
28847
|
+
* Each tool's execute method checks the agent filter at call time and throws
|
|
28848
|
+
* an error if the agent is not allowed to use workflows.
|
|
28857
28849
|
*/
|
|
28858
28850
|
tool: await (async () => {
|
|
28859
|
-
const DISABLED_MSG = "Workflows are disabled (WORKFLOW=off). Enable with /workflow on or /wf on";
|
|
28860
28851
|
const wrap = (def) => ({
|
|
28861
28852
|
...def,
|
|
28862
28853
|
execute: async (args, ctx) => {
|
|
28863
|
-
|
|
28864
|
-
|
|
28854
|
+
const agent = ctx.agent;
|
|
28855
|
+
if (!isAgentEnabled(agent)) {
|
|
28856
|
+
throw new Error(
|
|
28857
|
+
`Workflows are not enabled for this agent (${agent}). Set WORKFLOW_AGENTS environment variable to include this agent, or use a different agent.`
|
|
28858
|
+
);
|
|
28865
28859
|
}
|
|
28866
28860
|
return def.execute(args, ctx);
|
|
28867
28861
|
}
|
|
@@ -28875,7 +28869,12 @@ Current state: ${workflowsEnabled ? "enabled" : "disabled"}`
|
|
|
28875
28869
|
)
|
|
28876
28870
|
),
|
|
28877
28871
|
proceed_to_phase: wrap(
|
|
28878
|
-
createProceedToPhaseTool(
|
|
28872
|
+
createProceedToPhaseTool(
|
|
28873
|
+
getServerContext,
|
|
28874
|
+
setBufferedInstructions,
|
|
28875
|
+
input.client,
|
|
28876
|
+
() => lastKnownModel
|
|
28877
|
+
)
|
|
28879
28878
|
),
|
|
28880
28879
|
conduct_review: wrap(createConductReviewTool(getServerContext)),
|
|
28881
28880
|
reset_development: wrap(
|