@codemcp/workflows-opencode 6.5.1 → 6.6.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/dist/index.js +71 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -16919,11 +16919,30 @@ var ConversationManager = class {
|
|
|
16919
16919
|
database;
|
|
16920
16920
|
projectPath;
|
|
16921
16921
|
workflowManager;
|
|
16922
|
+
currentSessionMetadata = null;
|
|
16922
16923
|
constructor(database, workflowManager, projectPath) {
|
|
16923
16924
|
this.database = database;
|
|
16924
16925
|
this.workflowManager = workflowManager;
|
|
16925
16926
|
this.projectPath = projectPath;
|
|
16926
16927
|
}
|
|
16928
|
+
/**
|
|
16929
|
+
* Set session metadata for subsequent conversation state operations.
|
|
16930
|
+
* This links the workflow state to an external session context.
|
|
16931
|
+
*
|
|
16932
|
+
* @param sessionMetadata - Session metadata to store with conversation state
|
|
16933
|
+
*/
|
|
16934
|
+
setSessionMetadata(sessionMetadata) {
|
|
16935
|
+
this.currentSessionMetadata = sessionMetadata;
|
|
16936
|
+
logger8.debug("Session metadata set", {
|
|
16937
|
+
referenceId: sessionMetadata.referenceId
|
|
16938
|
+
});
|
|
16939
|
+
}
|
|
16940
|
+
/**
|
|
16941
|
+
* Get current session metadata
|
|
16942
|
+
*/
|
|
16943
|
+
getSessionMetadata() {
|
|
16944
|
+
return this.currentSessionMetadata;
|
|
16945
|
+
}
|
|
16927
16946
|
/**
|
|
16928
16947
|
* Get conversation state by ID
|
|
16929
16948
|
*/
|
|
@@ -17065,7 +17084,10 @@ var ConversationManager = class {
|
|
|
17065
17084
|
requireReviewsBeforePhaseTransition: false,
|
|
17066
17085
|
// Default to false for new conversations
|
|
17067
17086
|
createdAt: timestamp22,
|
|
17068
|
-
updatedAt: timestamp22
|
|
17087
|
+
updatedAt: timestamp22,
|
|
17088
|
+
...this.currentSessionMetadata && {
|
|
17089
|
+
sessionMetadata: this.currentSessionMetadata
|
|
17090
|
+
}
|
|
17069
17091
|
};
|
|
17070
17092
|
await this.database.saveConversationState(newState);
|
|
17071
17093
|
logger8.info("New conversation state created", {
|
|
@@ -26866,11 +26888,30 @@ var ConversationManager2 = class {
|
|
|
26866
26888
|
database;
|
|
26867
26889
|
projectPath;
|
|
26868
26890
|
workflowManager;
|
|
26891
|
+
currentSessionMetadata = null;
|
|
26869
26892
|
constructor(database, workflowManager, projectPath) {
|
|
26870
26893
|
this.database = database;
|
|
26871
26894
|
this.workflowManager = workflowManager;
|
|
26872
26895
|
this.projectPath = projectPath;
|
|
26873
26896
|
}
|
|
26897
|
+
/**
|
|
26898
|
+
* Set session metadata for subsequent conversation state operations.
|
|
26899
|
+
* This links the workflow state to an external session context.
|
|
26900
|
+
*
|
|
26901
|
+
* @param sessionMetadata - Session metadata to store with conversation state
|
|
26902
|
+
*/
|
|
26903
|
+
setSessionMetadata(sessionMetadata) {
|
|
26904
|
+
this.currentSessionMetadata = sessionMetadata;
|
|
26905
|
+
logger31.debug("Session metadata set", {
|
|
26906
|
+
referenceId: sessionMetadata.referenceId
|
|
26907
|
+
});
|
|
26908
|
+
}
|
|
26909
|
+
/**
|
|
26910
|
+
* Get current session metadata
|
|
26911
|
+
*/
|
|
26912
|
+
getSessionMetadata() {
|
|
26913
|
+
return this.currentSessionMetadata;
|
|
26914
|
+
}
|
|
26874
26915
|
/**
|
|
26875
26916
|
* Get conversation state by ID
|
|
26876
26917
|
*/
|
|
@@ -27012,7 +27053,10 @@ var ConversationManager2 = class {
|
|
|
27012
27053
|
requireReviewsBeforePhaseTransition: false,
|
|
27013
27054
|
// Default to false for new conversations
|
|
27014
27055
|
createdAt: timestamp3,
|
|
27015
|
-
updatedAt: timestamp3
|
|
27056
|
+
updatedAt: timestamp3,
|
|
27057
|
+
...this.currentSessionMetadata && {
|
|
27058
|
+
sessionMetadata: this.currentSessionMetadata
|
|
27059
|
+
}
|
|
27016
27060
|
};
|
|
27017
27061
|
await this.database.saveConversationState(newState);
|
|
27018
27062
|
logger31.info("New conversation state created", {
|
|
@@ -27869,7 +27913,13 @@ var logger36 = createLogger2("SystemPromptGenerator");
|
|
|
27869
27913
|
// src/server-context.ts
|
|
27870
27914
|
import * as path9 from "path";
|
|
27871
27915
|
function createServerContext(options) {
|
|
27872
|
-
const {
|
|
27916
|
+
const {
|
|
27917
|
+
projectDir,
|
|
27918
|
+
planManager,
|
|
27919
|
+
instructionGenerator,
|
|
27920
|
+
loggerFactory,
|
|
27921
|
+
sessionMetadata
|
|
27922
|
+
} = options;
|
|
27873
27923
|
const workflowManager = new WorkflowManager2();
|
|
27874
27924
|
workflowManager.loadProjectWorkflows(projectDir);
|
|
27875
27925
|
const fileStorage = new FileStorage2(
|
|
@@ -27896,7 +27946,8 @@ function createServerContext(options) {
|
|
|
27896
27946
|
interactionLogger,
|
|
27897
27947
|
projectPath: projectDir,
|
|
27898
27948
|
pluginRegistry,
|
|
27899
|
-
loggerFactory
|
|
27949
|
+
loggerFactory,
|
|
27950
|
+
sessionMetadata
|
|
27900
27951
|
};
|
|
27901
27952
|
}
|
|
27902
27953
|
async function initializeServerContext(context) {
|
|
@@ -28306,6 +28357,7 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28306
28357
|
const instructionGenerator = new InstructionGenerator2();
|
|
28307
28358
|
let cachedServerContext = null;
|
|
28308
28359
|
let serverContextInitialized = false;
|
|
28360
|
+
let currentSessionId = null;
|
|
28309
28361
|
let bufferedInstructions = null;
|
|
28310
28362
|
function setBufferedInstructions(result) {
|
|
28311
28363
|
bufferedInstructions = {
|
|
@@ -28317,12 +28369,22 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28317
28369
|
}
|
|
28318
28370
|
async function getServerContext() {
|
|
28319
28371
|
if (!cachedServerContext) {
|
|
28372
|
+
const sessionMetadata = currentSessionId ? {
|
|
28373
|
+
referenceId: currentSessionId,
|
|
28374
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
28375
|
+
} : void 0;
|
|
28320
28376
|
cachedServerContext = createServerContext({
|
|
28321
28377
|
projectDir: input.directory,
|
|
28322
28378
|
planManager,
|
|
28323
28379
|
instructionGenerator,
|
|
28324
|
-
loggerFactory
|
|
28380
|
+
loggerFactory,
|
|
28381
|
+
sessionMetadata
|
|
28325
28382
|
});
|
|
28383
|
+
if (sessionMetadata) {
|
|
28384
|
+
cachedServerContext.conversationManager.setSessionMetadata(
|
|
28385
|
+
sessionMetadata
|
|
28386
|
+
);
|
|
28387
|
+
}
|
|
28326
28388
|
}
|
|
28327
28389
|
if (!serverContextInitialized) {
|
|
28328
28390
|
await initializeServerContext(cachedServerContext);
|
|
@@ -28365,6 +28427,10 @@ var WorkflowsPlugin = async (input) => {
|
|
|
28365
28427
|
* We add a synthetic part with phase instructions.
|
|
28366
28428
|
*/
|
|
28367
28429
|
"chat.message": async (hookInput, output) => {
|
|
28430
|
+
if (hookInput.sessionID && !currentSessionId) {
|
|
28431
|
+
currentSessionId = hookInput.sessionID;
|
|
28432
|
+
logger37.debug("Captured session ID", { sessionId: currentSessionId });
|
|
28433
|
+
}
|
|
28368
28434
|
if (!workflowsEnabled) {
|
|
28369
28435
|
logger37.debug("chat.message: Workflows disabled, skipping hook");
|
|
28370
28436
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemcp/workflows-opencode",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.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-
|
|
23
|
-
"@codemcp/workflows-
|
|
22
|
+
"@codemcp/workflows-server": "6.6.0",
|
|
23
|
+
"@codemcp/workflows-core": "6.6.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@anthropic-ai/sdk": "*"
|