dsh-embedded-workbench 0.8.1 → 0.8.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/lib/index.js +14 -3
- package/package.json +5 -3
- package/src/index.ts +30 -3
package/lib/index.js
CHANGED
|
@@ -74,6 +74,17 @@ function gateMessage(text) {
|
|
|
74
74
|
source: { kind: 'plugin', plugin: GATE_PLUGIN_ID },
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
function readSessionEvents(session) {
|
|
78
|
+
const source = session;
|
|
79
|
+
if (typeof source.snapshotEvents === 'function') {
|
|
80
|
+
const snapshot = source.snapshotEvents();
|
|
81
|
+
if (Array.isArray(snapshot))
|
|
82
|
+
return snapshot;
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(source.events))
|
|
85
|
+
return source.events;
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
77
88
|
/**
|
|
78
89
|
* Model-visible catalog entry (cordis_inspect_list / cordis_inspect_query):
|
|
79
90
|
* lets the model read this plugin's runtime status without guessing. Mirrors
|
|
@@ -188,10 +199,10 @@ export function apply(ctx, config) {
|
|
|
188
199
|
* first step that runs.
|
|
189
200
|
*/
|
|
190
201
|
function gateInHistory(session) {
|
|
191
|
-
return session.
|
|
202
|
+
return readSessionEvents(session).some((event) => {
|
|
192
203
|
if (event.type !== 'user/message')
|
|
193
204
|
return false;
|
|
194
|
-
const source = event.data
|
|
195
|
-
return source
|
|
205
|
+
const source = event.data?.source;
|
|
206
|
+
return source?.kind === 'plugin' && source.plugin === GATE_PLUGIN_ID;
|
|
196
207
|
});
|
|
197
208
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-embedded-workbench",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Embedded C/C++ firmware development toolbox — 4 agents, 8 skills covering FreeRTOS, ISR, NVM storage, Keil MDK, ARMCLANG, HardFault, state machines, architecture, LVGL patterns, and claim fact-checking. Ships a native DeepSeek Harness (dsh) bundle that injects the session-start gate into the first model step.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
"patch": "./cordis.patch.yml"
|
|
33
33
|
},
|
|
34
34
|
"compatibility": {
|
|
35
|
-
"dsh": "^0.1.0-rc.7 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
|
|
35
|
+
"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",
|
|
36
36
|
"dshReleases": {
|
|
37
37
|
"0.1.0-rc.7": "compatible",
|
|
38
38
|
"0.1.0-rc.8": "compatible",
|
|
39
39
|
"0.1.1-rc.1": "compatible",
|
|
40
40
|
"0.1.1-rc.2": "compatible",
|
|
41
|
-
"0.1.2-alpha.2": "compatible"
|
|
41
|
+
"0.1.2-alpha.2": "compatible",
|
|
42
|
+
"0.1.2-alpha.3": "compatible",
|
|
43
|
+
"0.1.2-alpha.4": "compatible"
|
|
42
44
|
},
|
|
43
45
|
"profiles": [
|
|
44
46
|
"headless"
|
package/src/index.ts
CHANGED
|
@@ -91,6 +91,33 @@ function gateMessage(text: string): UserMessage {
|
|
|
91
91
|
})
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
interface SessionEventLike {
|
|
95
|
+
type: string
|
|
96
|
+
data?: Record<string, unknown>
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Minimum session-store surface this plugin reads. DSH 0.1.2-alpha.4 replaced
|
|
101
|
+
* the `Session.events` getter with on-demand reads (`seq`, `eventAt()`,
|
|
102
|
+
* `snapshotEvents()`); releases up to 0.1.2-alpha.3 expose `events` as the
|
|
103
|
+
* full log snapshot. Read through a structural union so one build serves every
|
|
104
|
+
* declared DSH release.
|
|
105
|
+
*/
|
|
106
|
+
interface SessionEventSource {
|
|
107
|
+
events?: readonly SessionEventLike[]
|
|
108
|
+
snapshotEvents?: () => readonly SessionEventLike[]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function readSessionEvents(session: Session): readonly SessionEventLike[] {
|
|
112
|
+
const source = session as unknown as SessionEventSource
|
|
113
|
+
if (typeof source.snapshotEvents === 'function') {
|
|
114
|
+
const snapshot = source.snapshotEvents()
|
|
115
|
+
if (Array.isArray(snapshot)) return snapshot
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(source.events)) return source.events
|
|
118
|
+
return []
|
|
119
|
+
}
|
|
120
|
+
|
|
94
121
|
/**
|
|
95
122
|
* Model-visible catalog entry (cordis_inspect_list / cordis_inspect_query):
|
|
96
123
|
* lets the model read this plugin's runtime status without guessing. Mirrors
|
|
@@ -201,9 +228,9 @@ export function apply(ctx: Context, config: Config): void {
|
|
|
201
228
|
* first step that runs.
|
|
202
229
|
*/
|
|
203
230
|
function gateInHistory(session: Session): boolean {
|
|
204
|
-
return session.
|
|
231
|
+
return readSessionEvents(session).some((event) => {
|
|
205
232
|
if (event.type !== 'user/message') return false
|
|
206
|
-
const source = event.data
|
|
207
|
-
return source
|
|
233
|
+
const source = event.data?.source as { kind?: string; plugin?: string } | undefined
|
|
234
|
+
return source?.kind === 'plugin' && source.plugin === GATE_PLUGIN_ID
|
|
208
235
|
})
|
|
209
236
|
}
|