@codemcp/workflows-opencode 6.11.0 → 6.12.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/README.md +12 -0
- package/dist/index.js +43 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -90,6 +90,18 @@ When the env var is set, workflow hooks are skipped and tools throw a clear erro
|
|
|
90
90
|
|
|
91
91
|
**When unset**, workflows are active for all agents (default behavior).
|
|
92
92
|
|
|
93
|
+
### Auto-Compaction
|
|
94
|
+
|
|
95
|
+
When transitioning to a new phase via `proceed_to_phase`, the plugin automatically triggers a session compaction (summarize) to clear prior-phase context from the LLM window. This is enabled by default.
|
|
96
|
+
|
|
97
|
+
Set `WORKFLOW_AUTO_COMPACT=false` to disable this behavior:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
WORKFLOW_AUTO_COMPACT=false npx opencode
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**When unset or any value other than `false`**, compaction runs on every successful phase transition (default behavior).
|
|
104
|
+
|
|
93
105
|
### Per-Agent Behavior
|
|
94
106
|
|
|
95
107
|
- **Agent in filter**: Workflow instructions are injected on every message, tools work normally
|
package/dist/index.js
CHANGED
|
@@ -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,25 @@ 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 autoCompact = process.env["WORKFLOW_AUTO_COMPACT"]?.trim()?.toLowerCase();
|
|
28206
|
+
if (autoCompact !== "false") {
|
|
28207
|
+
const model = getModel();
|
|
28208
|
+
client.session.summarize({
|
|
28209
|
+
path: { id: context.sessionID },
|
|
28210
|
+
...model ? { body: model } : {}
|
|
28211
|
+
}).catch(() => {
|
|
28212
|
+
});
|
|
28213
|
+
logger37.info("Triggered compaction after phase transition", {
|
|
28214
|
+
phase: data.phase,
|
|
28215
|
+
sessionID: context.sessionID,
|
|
28216
|
+
hasModel: !!model
|
|
28217
|
+
});
|
|
28218
|
+
} else {
|
|
28219
|
+
logger37.debug("Skipped compaction: WORKFLOW_AUTO_COMPACT=false", {
|
|
28220
|
+
phase: data.phase,
|
|
28221
|
+
sessionID: context.sessionID
|
|
28222
|
+
});
|
|
28223
|
+
}
|
|
28205
28224
|
const lines = [];
|
|
28206
28225
|
lines.push(`Transitioned to: ${data.phase}`);
|
|
28207
28226
|
if (data.transition_reason) {
|
|
@@ -28586,6 +28605,7 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28586
28605
|
let currentSessionId = null;
|
|
28587
28606
|
let lastKnownSessionId = null;
|
|
28588
28607
|
let bufferedInstructions = null;
|
|
28608
|
+
let lastKnownModel = null;
|
|
28589
28609
|
function setBufferedInstructions(result) {
|
|
28590
28610
|
bufferedInstructions = {
|
|
28591
28611
|
phase: result.phase,
|
|
@@ -28669,9 +28689,23 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28669
28689
|
});
|
|
28670
28690
|
}
|
|
28671
28691
|
}
|
|
28692
|
+
if (hookInput.model) {
|
|
28693
|
+
lastKnownModel = hookInput.model;
|
|
28694
|
+
}
|
|
28672
28695
|
if (!isAgentEnabled(hookInput.agent)) {
|
|
28673
|
-
logger37.debug(
|
|
28674
|
-
|
|
28696
|
+
logger37.debug(
|
|
28697
|
+
"chat.message: Agent not enabled \u2014 injecting tool suppression",
|
|
28698
|
+
{
|
|
28699
|
+
agent: hookInput.agent
|
|
28700
|
+
}
|
|
28701
|
+
);
|
|
28702
|
+
output.parts.push({
|
|
28703
|
+
id: `prt_workflows_suppress_${Date.now()}`,
|
|
28704
|
+
sessionID: hookInput.sessionID,
|
|
28705
|
+
messageID: hookInput.messageID || output.message.id,
|
|
28706
|
+
type: "text",
|
|
28707
|
+
synthetic: true,
|
|
28708
|
+
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."
|
|
28675
28709
|
});
|
|
28676
28710
|
return;
|
|
28677
28711
|
}
|
|
@@ -28843,7 +28877,12 @@ ACTION REQUIRED: Use transition_phase tool to move to a phase that allows editin
|
|
|
28843
28877
|
)
|
|
28844
28878
|
),
|
|
28845
28879
|
proceed_to_phase: wrap(
|
|
28846
|
-
createProceedToPhaseTool(
|
|
28880
|
+
createProceedToPhaseTool(
|
|
28881
|
+
getServerContext,
|
|
28882
|
+
setBufferedInstructions,
|
|
28883
|
+
input.client,
|
|
28884
|
+
() => lastKnownModel
|
|
28885
|
+
)
|
|
28847
28886
|
),
|
|
28848
28887
|
conduct_review: wrap(createConductReviewTool(getServerContext)),
|
|
28849
28888
|
reset_development: wrap(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemcp/workflows-opencode",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.0",
|
|
4
4
|
"description": "OpenCode plugin for structured development workflows",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"rimraf": "^6.0.1",
|
|
20
20
|
"tsup": "^8.0.0",
|
|
21
21
|
"vitest": "4.0.18",
|
|
22
|
-
"@codemcp/workflows-core": "6.
|
|
23
|
-
"@codemcp/workflows-server": "6.
|
|
22
|
+
"@codemcp/workflows-core": "6.12.0",
|
|
23
|
+
"@codemcp/workflows-server": "6.12.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@anthropic-ai/sdk": "*"
|