dsh-logicprobe 0.5.4 → 0.5.6

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/lib/index.js CHANGED
@@ -71,8 +71,19 @@ function gateMessage(text) {
71
71
  source: { kind: 'plugin', plugin: GATE_PLUGIN_ID },
72
72
  });
73
73
  }
74
+ function readSessionEvents(session) {
75
+ const source = session;
76
+ if (typeof source.snapshotEvents === 'function') {
77
+ const snapshot = source.snapshotEvents();
78
+ if (Array.isArray(snapshot))
79
+ return snapshot;
80
+ }
81
+ if (Array.isArray(source.events))
82
+ return source.events;
83
+ return [];
84
+ }
74
85
  function lastApprovalPolicy(session) {
75
- const events = session.events;
86
+ const events = readSessionEvents(session);
76
87
  for (let index = events.length - 1; index >= 0; index -= 1) {
77
88
  const event = events[index];
78
89
  if (event.type === 'approval/policy') {
@@ -82,7 +93,7 @@ function lastApprovalPolicy(session) {
82
93
  return undefined;
83
94
  }
84
95
  function planModeActive(session) {
85
- const events = session.events;
96
+ const events = readSessionEvents(session);
86
97
  for (let index = events.length - 1; index >= 0; index -= 1) {
87
98
  const event = events[index];
88
99
  if (event.type === 'plan/mode')
@@ -282,10 +293,10 @@ export function apply(ctx, config) {
282
293
  * first step that runs.
283
294
  */
284
295
  function gateInHistory(session) {
285
- return session.events.some((event) => {
296
+ return readSessionEvents(session).some((event) => {
286
297
  if (event.type !== 'user/message')
287
298
  return false;
288
- const source = event.data.source;
289
- return source.kind === 'plugin' && source.plugin === GATE_PLUGIN_ID;
299
+ const source = event.data?.source;
300
+ return source?.kind === 'plugin' && source.plugin === GATE_PLUGIN_ID;
290
301
  });
291
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-logicprobe",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Design document & plan claim verification — enumerate claims, verify against codebase facts, then escalate to state-machine verification (S1-S8/A1-A11) and data-model verification (DS/DA/DD) for behavioral claims. Supports before/after regression, idempotency/monotonic/sequence/leads-to/atomicity constraints, and concurrency risk mining. Ships a native DeepSeek Harness (dsh) bundle that injects the claim-verification gate into the first model step.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -29,13 +29,15 @@
29
29
  "patch": "./cordis.patch.yml"
30
30
  },
31
31
  "compatibility": {
32
- "dsh": "^0.1.0-rc.7 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
32
+ "dsh": "^0.1.0-rc.7 || ^0.1.1-rc.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4",
33
33
  "dshReleases": {
34
34
  "0.1.0-rc.7": "compatible",
35
35
  "0.1.0-rc.8": "compatible",
36
36
  "0.1.1-rc.1": "compatible",
37
37
  "0.1.1-rc.2": "compatible",
38
- "0.1.2-alpha.2": "compatible"
38
+ "0.1.2-alpha.2": "compatible",
39
+ "0.1.2-alpha.3": "compatible",
40
+ "0.1.2-alpha.4": "compatible"
39
41
  },
40
42
  "profiles": [
41
43
  "headless"
package/src/index.ts CHANGED
@@ -97,8 +97,30 @@ interface SessionEventLike {
97
97
  data?: Record<string, unknown>
98
98
  }
99
99
 
100
+ /**
101
+ * Minimum session-store surface this plugin reads. DSH 0.1.2-alpha.4 replaced
102
+ * the `Session.events` getter with on-demand reads (`seq`, `eventAt()`,
103
+ * `snapshotEvents()`); releases up to 0.1.2-alpha.3 expose `events` as the
104
+ * full log snapshot. Read through a structural union so one build serves every
105
+ * declared DSH release.
106
+ */
107
+ interface SessionEventSource {
108
+ events?: readonly SessionEventLike[]
109
+ snapshotEvents?: () => readonly SessionEventLike[]
110
+ }
111
+
112
+ function readSessionEvents(session: Session): readonly SessionEventLike[] {
113
+ const source = session as unknown as SessionEventSource
114
+ if (typeof source.snapshotEvents === 'function') {
115
+ const snapshot = source.snapshotEvents()
116
+ if (Array.isArray(snapshot)) return snapshot
117
+ }
118
+ if (Array.isArray(source.events)) return source.events
119
+ return []
120
+ }
121
+
100
122
  function lastApprovalPolicy(session: Session): 'ask' | 'never' | undefined {
101
- const events = session.events as readonly SessionEventLike[]
123
+ const events = readSessionEvents(session)
102
124
  for (let index = events.length - 1; index >= 0; index -= 1) {
103
125
  const event = events[index]
104
126
  if (event.type === 'approval/policy') {
@@ -109,7 +131,7 @@ function lastApprovalPolicy(session: Session): 'ask' | 'never' | undefined {
109
131
  }
110
132
 
111
133
  function planModeActive(session: Session): boolean {
112
- const events = session.events as readonly SessionEventLike[]
134
+ const events = readSessionEvents(session)
113
135
  for (let index = events.length - 1; index >= 0; index -= 1) {
114
136
  const event = events[index]
115
137
  if (event.type === 'plan/mode') return event.data?.active === true
@@ -307,9 +329,9 @@ export function apply(ctx: Context, config: Config): void {
307
329
  * first step that runs.
308
330
  */
309
331
  function gateInHistory(session: Session): boolean {
310
- return session.events.some((event) => {
332
+ return readSessionEvents(session).some((event) => {
311
333
  if (event.type !== 'user/message') return false
312
- const source = event.data.source
313
- return source.kind === 'plugin' && source.plugin === GATE_PLUGIN_ID
334
+ const source = event.data?.source as { kind?: string; plugin?: string } | undefined
335
+ return source?.kind === 'plugin' && source.plugin === GATE_PLUGIN_ID
314
336
  })
315
337
  }