parallax-opencode 0.3.3 → 0.3.4
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/plugin.js +12 -3
- package/dist-standalone/parallax-engine.js +4 -2
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -33,8 +33,12 @@ const modeStore = new Map();
|
|
|
33
33
|
const protocolStore = new Map();
|
|
34
34
|
let currentSessionId = null;
|
|
35
35
|
let currentAgentName = null;
|
|
36
|
+
let stableSessionKey = null;
|
|
36
37
|
function sessionId() {
|
|
37
|
-
|
|
38
|
+
// Protocol state is keyed by a stable identifier, not OpenCode session ID.
|
|
39
|
+
// OpenCode creates multiple sessions per conversation (root, child, subagent).
|
|
40
|
+
// The first root session ID is locked in and never changes.
|
|
41
|
+
return stableSessionKey || "default";
|
|
38
42
|
}
|
|
39
43
|
function getFriction(s = sessionId()) {
|
|
40
44
|
if (!frictionStore.has(s)) {
|
|
@@ -638,11 +642,16 @@ export default {
|
|
|
638
642
|
// They have a parentID and would overwrite the main session's protocol state.
|
|
639
643
|
if (info.parentID)
|
|
640
644
|
return;
|
|
641
|
-
|
|
645
|
+
// Lock in the first root session ID. Subsequent root session.created
|
|
646
|
+
// events must not change the key because protocol state is already
|
|
647
|
+
// attached to the first key via stableSessionKey.
|
|
648
|
+
if (stableSessionKey)
|
|
649
|
+
return;
|
|
650
|
+
stableSessionKey ??= (currentSessionId =
|
|
642
651
|
info.id ||
|
|
643
652
|
props.sessionID ||
|
|
644
653
|
info.sessionID ||
|
|
645
|
-
null;
|
|
654
|
+
null);
|
|
646
655
|
// Agent name lives in Session.agent (v2 SDK types.gen.d.ts:590)
|
|
647
656
|
currentAgentName =
|
|
648
657
|
info.agent ||
|
|
@@ -236,8 +236,9 @@ var modeStore = /* @__PURE__ */ new Map();
|
|
|
236
236
|
var protocolStore = /* @__PURE__ */ new Map();
|
|
237
237
|
var currentSessionId = null;
|
|
238
238
|
var currentAgentName = null;
|
|
239
|
+
var stableSessionKey = null;
|
|
239
240
|
function sessionId() {
|
|
240
|
-
return
|
|
241
|
+
return stableSessionKey || "default";
|
|
241
242
|
}
|
|
242
243
|
function getFriction(s = sessionId()) {
|
|
243
244
|
if (!frictionStore.has(s)) {
|
|
@@ -765,7 +766,8 @@ ${s.lastObservation}`
|
|
|
765
766
|
const props = input.event.properties || {};
|
|
766
767
|
const info = props.info || {};
|
|
767
768
|
if (info.parentID) return;
|
|
768
|
-
|
|
769
|
+
if (stableSessionKey) return;
|
|
770
|
+
stableSessionKey ??= currentSessionId = info.id || props.sessionID || info.sessionID || null;
|
|
769
771
|
currentAgentName = info.agent || props.agent || null;
|
|
770
772
|
if (currentSessionId) {
|
|
771
773
|
initTrace(currentSessionId, process.cwd(), detectProject());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parallax-opencode",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "PARALLAX ENGINE plugin for OpenCode -- protocol enforcement, friction-loop verification, mode switching (plan/build/debug), trace recording, coherence scoring, CI gate, and PR-ready trace artifacts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin.js",
|