parallax-opencode 0.3.1 → 0.3.3

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 CHANGED
@@ -634,6 +634,10 @@ export default {
634
634
  if (input.event.type === "session.created") {
635
635
  const props = input.event.properties || {};
636
636
  const info = (props.info || {});
637
+ // Ignore child sessions (subagents, background tasks).
638
+ // They have a parentID and would overwrite the main session's protocol state.
639
+ if (info.parentID)
640
+ return;
637
641
  currentSessionId =
638
642
  info.id ||
639
643
  props.sessionID ||
@@ -647,6 +651,20 @@ export default {
647
651
  // Initialize trace with session info
648
652
  if (currentSessionId) {
649
653
  initTrace(currentSessionId, process.cwd(), detectProject());
654
+ // Carry over protocol state from default if checkins happened before
655
+ // the session.created event fired (common race on session start).
656
+ if (protocolStore.has("default")) {
657
+ protocolStore.set(currentSessionId, protocolStore.get("default"));
658
+ protocolStore.delete("default");
659
+ }
660
+ if (frictionStore.has("default")) {
661
+ frictionStore.set(currentSessionId, frictionStore.get("default"));
662
+ frictionStore.delete("default");
663
+ }
664
+ if (modeStore.has("default")) {
665
+ modeStore.set(currentSessionId, modeStore.get("default"));
666
+ modeStore.delete("default");
667
+ }
650
668
  writeState();
651
669
  }
652
670
  }
@@ -764,10 +764,23 @@ ${s.lastObservation}`
764
764
  if (input.event.type === "session.created") {
765
765
  const props = input.event.properties || {};
766
766
  const info = props.info || {};
767
+ if (info.parentID) return;
767
768
  currentSessionId = info.id || props.sessionID || info.sessionID || null;
768
769
  currentAgentName = info.agent || props.agent || null;
769
770
  if (currentSessionId) {
770
771
  initTrace(currentSessionId, process.cwd(), detectProject());
772
+ if (protocolStore.has("default")) {
773
+ protocolStore.set(currentSessionId, protocolStore.get("default"));
774
+ protocolStore.delete("default");
775
+ }
776
+ if (frictionStore.has("default")) {
777
+ frictionStore.set(currentSessionId, frictionStore.get("default"));
778
+ frictionStore.delete("default");
779
+ }
780
+ if (modeStore.has("default")) {
781
+ modeStore.set(currentSessionId, modeStore.get("default"));
782
+ modeStore.delete("default");
783
+ }
771
784
  writeState();
772
785
  }
773
786
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parallax-opencode",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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",
@@ -62,4 +62,3 @@
62
62
  "vitest": "^3.2.4"
63
63
  }
64
64
  }
65
-