@codemcp/workflows-opencode 6.6.0 → 6.6.2

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 (2) hide show
  1. package/dist/index.js +24 -12
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -28358,6 +28358,7 @@ var WorkflowsPlugin = async (input) => {
28358
28358
  let cachedServerContext = null;
28359
28359
  let serverContextInitialized = false;
28360
28360
  let currentSessionId = null;
28361
+ let lastKnownSessionId = null;
28361
28362
  let bufferedInstructions = null;
28362
28363
  function setBufferedInstructions(result) {
28363
28364
  bufferedInstructions = {
@@ -28368,6 +28369,15 @@ var WorkflowsPlugin = async (input) => {
28368
28369
  };
28369
28370
  }
28370
28371
  async function getServerContext() {
28372
+ if (currentSessionId && currentSessionId !== lastKnownSessionId) {
28373
+ logger37.debug("Session ID changed, invalidating cached ServerContext", {
28374
+ oldSessionId: lastKnownSessionId,
28375
+ newSessionId: currentSessionId
28376
+ });
28377
+ cachedServerContext = null;
28378
+ serverContextInitialized = false;
28379
+ lastKnownSessionId = currentSessionId;
28380
+ }
28371
28381
  if (!cachedServerContext) {
28372
28382
  const sessionMetadata = currentSessionId ? {
28373
28383
  referenceId: currentSessionId,
@@ -28392,15 +28402,6 @@ var WorkflowsPlugin = async (input) => {
28392
28402
  }
28393
28403
  return cachedServerContext;
28394
28404
  }
28395
- getServerContext().then((context) => {
28396
- const pluginNames = context.pluginRegistry?.getPluginNames() ?? [];
28397
- if (pluginNames.length > 0) {
28398
- logger37.info("Registered plugins", { plugins: pluginNames });
28399
- } else {
28400
- logger37.debug("No plugins registered");
28401
- }
28402
- }).catch(() => {
28403
- });
28404
28405
  async function getWorkflowState() {
28405
28406
  try {
28406
28407
  const serverContext = await getServerContext();
@@ -28427,9 +28428,20 @@ var WorkflowsPlugin = async (input) => {
28427
28428
  * We add a synthetic part with phase instructions.
28428
28429
  */
28429
28430
  "chat.message": async (hookInput, output) => {
28430
- if (hookInput.sessionID && !currentSessionId) {
28431
- currentSessionId = hookInput.sessionID;
28432
- logger37.debug("Captured session ID", { sessionId: currentSessionId });
28431
+ if (hookInput.sessionID) {
28432
+ if (!currentSessionId) {
28433
+ currentSessionId = hookInput.sessionID;
28434
+ lastKnownSessionId = hookInput.sessionID;
28435
+ logger37.debug("Captured initial session ID", {
28436
+ sessionId: currentSessionId
28437
+ });
28438
+ } else if (currentSessionId !== hookInput.sessionID) {
28439
+ currentSessionId = hookInput.sessionID;
28440
+ logger37.info("Session ID changed", {
28441
+ oldSessionId: lastKnownSessionId,
28442
+ newSessionId: currentSessionId
28443
+ });
28444
+ }
28433
28445
  }
28434
28446
  if (!workflowsEnabled) {
28435
28447
  logger37.debug("chat.message: Workflows disabled, skipping hook");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/workflows-opencode",
3
- "version": "6.6.0",
3
+ "version": "6.6.2",
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-server": "6.6.0",
23
- "@codemcp/workflows-core": "6.6.0"
22
+ "@codemcp/workflows-core": "6.6.2",
23
+ "@codemcp/workflows-server": "6.6.2"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@anthropic-ai/sdk": "*"