parallax-opencode 0.3.4 → 0.3.5
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 +9 -14
- package/dist-standalone/parallax-engine.js +3 -4
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -33,12 +33,12 @@ const modeStore = new Map();
|
|
|
33
33
|
const protocolStore = new Map();
|
|
34
34
|
let currentSessionId = null;
|
|
35
35
|
let currentAgentName = null;
|
|
36
|
-
|
|
36
|
+
// Protocol state uses a fixed key that never changes within a plugin load.
|
|
37
|
+
// OpenCode creates multiple internal sessions (root, child, subagent) during
|
|
38
|
+
// a single conversation. The protocol state must survive all of them.
|
|
39
|
+
const PROTOCOL_KEY = "current";
|
|
37
40
|
function sessionId() {
|
|
38
|
-
|
|
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";
|
|
41
|
+
return PROTOCOL_KEY;
|
|
42
42
|
}
|
|
43
43
|
function getFriction(s = sessionId()) {
|
|
44
44
|
if (!frictionStore.has(s)) {
|
|
@@ -638,20 +638,15 @@ export default {
|
|
|
638
638
|
if (input.event.type === "session.created") {
|
|
639
639
|
const props = input.event.properties || {};
|
|
640
640
|
const info = (props.info || {});
|
|
641
|
-
//
|
|
642
|
-
//
|
|
641
|
+
// Child sessions have a parentID. Only track the root session
|
|
642
|
+
// for trace recording. Protocol state uses a fixed key and is unaffected.
|
|
643
643
|
if (info.parentID)
|
|
644
644
|
return;
|
|
645
|
-
|
|
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 =
|
|
645
|
+
currentSessionId =
|
|
651
646
|
info.id ||
|
|
652
647
|
props.sessionID ||
|
|
653
648
|
info.sessionID ||
|
|
654
|
-
null
|
|
649
|
+
null;
|
|
655
650
|
// Agent name lives in Session.agent (v2 SDK types.gen.d.ts:590)
|
|
656
651
|
currentAgentName =
|
|
657
652
|
info.agent ||
|
|
@@ -236,9 +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
|
|
239
|
+
var PROTOCOL_KEY = "current";
|
|
240
240
|
function sessionId() {
|
|
241
|
-
return
|
|
241
|
+
return PROTOCOL_KEY;
|
|
242
242
|
}
|
|
243
243
|
function getFriction(s = sessionId()) {
|
|
244
244
|
if (!frictionStore.has(s)) {
|
|
@@ -766,8 +766,7 @@ ${s.lastObservation}`
|
|
|
766
766
|
const props = input.event.properties || {};
|
|
767
767
|
const info = props.info || {};
|
|
768
768
|
if (info.parentID) return;
|
|
769
|
-
|
|
770
|
-
stableSessionKey ??= currentSessionId = info.id || props.sessionID || info.sessionID || null;
|
|
769
|
+
currentSessionId = info.id || props.sessionID || info.sessionID || null;
|
|
771
770
|
currentAgentName = info.agent || props.agent || null;
|
|
772
771
|
if (currentSessionId) {
|
|
773
772
|
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.5",
|
|
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",
|