parallax-opencode 0.3.5 → 0.3.7

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
@@ -104,7 +104,10 @@ function writeState() {
104
104
  try {
105
105
  const s = getFriction();
106
106
  const m = getMode();
107
- const p = getProtocol();
107
+ // Read from disk: OpenCode may load plugin in different contexts
108
+ // for tools vs hooks, causing separate in-memory Maps.
109
+ const diskState = readProtocolFromDisk();
110
+ const p = diskState || getProtocol();
108
111
  const state = {
109
112
  sessionId: currentSessionId,
110
113
  sessionStart: getTrace(sessionId()).session.startedAt,
@@ -134,6 +137,31 @@ function writeState() {
134
137
  }, STATE_DEBOUNCE_MS);
135
138
  }
136
139
  // ---------------------------------------------------------------------------
140
+ // Read protocol state from disk (write hook reads this, not in-memory Maps)
141
+ // ---------------------------------------------------------------------------
142
+ function readProtocolFromDisk() {
143
+ try {
144
+ if (existsSync(STATE_FILE)) {
145
+ const raw = readFileSync(STATE_FILE, "utf8");
146
+ const s = JSON.parse(raw);
147
+ if (s && s.protocol) {
148
+ return {
149
+ ambiguityDone: s.protocol.ambiguityDone === true,
150
+ invariantsDone: s.protocol.invariantsDone === true,
151
+ gateDone: s.protocol.gateDone === true,
152
+ designDone: s.protocol.designDone === true,
153
+ commitDone: s.protocol.commitDone === true,
154
+ summaryDone: s.protocol.summaryDone === true,
155
+ writesBeforeGate: typeof s.protocol.writesBeforeGate === "number" ? s.protocol.writesBeforeGate : 0,
156
+ gateBlocked: s.protocol.gateBlocked === true,
157
+ };
158
+ }
159
+ }
160
+ }
161
+ catch { }
162
+ return null;
163
+ }
164
+ // ---------------------------------------------------------------------------
137
165
  // Skill loader
138
166
  // ---------------------------------------------------------------------------
139
167
  const skillCache = {};
@@ -294,7 +294,8 @@ function writeState() {
294
294
  try {
295
295
  const s = getFriction();
296
296
  const m = getMode();
297
- const p = getProtocol();
297
+ const diskState = readProtocolFromDisk();
298
+ const p = diskState || getProtocol();
298
299
  const state = {
299
300
  sessionId: currentSessionId,
300
301
  sessionStart: getTrace(sessionId()).session.startedAt,
@@ -321,6 +322,28 @@ function writeState() {
321
322
  }
322
323
  }, STATE_DEBOUNCE_MS);
323
324
  }
325
+ function readProtocolFromDisk() {
326
+ try {
327
+ if (existsSync3(STATE_FILE)) {
328
+ const raw = readFileSync2(STATE_FILE, "utf8");
329
+ const s = JSON.parse(raw);
330
+ if (s && s.protocol) {
331
+ return {
332
+ ambiguityDone: s.protocol.ambiguityDone === true,
333
+ invariantsDone: s.protocol.invariantsDone === true,
334
+ gateDone: s.protocol.gateDone === true,
335
+ designDone: s.protocol.designDone === true,
336
+ commitDone: s.protocol.commitDone === true,
337
+ summaryDone: s.protocol.summaryDone === true,
338
+ writesBeforeGate: typeof s.protocol.writesBeforeGate === "number" ? s.protocol.writesBeforeGate : 0,
339
+ gateBlocked: s.protocol.gateBlocked === true
340
+ };
341
+ }
342
+ }
343
+ } catch {
344
+ }
345
+ return null;
346
+ }
324
347
  var skillCache = {};
325
348
  function loadSkill(name) {
326
349
  if (name in skillCache) return skillCache[name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parallax-opencode",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
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",