shmem-opencode 0.3.34 → 0.3.36
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/index.ts +5 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -212,11 +212,11 @@ function shmemHookAsync(subcommand: string, payload: Record<string, unknown>): v
|
|
|
212
212
|
// What counts as too short to keep is `shmem hook`'s call, as it is for
|
|
213
213
|
// every other agent: the plugin passes everything through.
|
|
214
214
|
function userMessage(text: string, cwd: string, sessionID: string) {
|
|
215
|
-
setTurnContext(sessionID, text.trim() ? hookContext(shmemHook("user-message", { prompt: text, cwd })) : "")
|
|
215
|
+
setTurnContext(sessionID, text.trim() ? hookContext(shmemHook("user-message", { prompt: text, session_id: sessionID, cwd })) : "")
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
function response(text: string, cwd: string) {
|
|
219
|
-
if (text.trim()) shmemHookAsync("response", { last_assistant_message: text, cwd })
|
|
218
|
+
function response(text: string, cwd: string, sessionID: string) {
|
|
219
|
+
if (text.trim()) shmemHookAsync("response", { last_assistant_message: text, session_id: sessionID, cwd })
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
// TOOLS maps OpenCode's tool names (1.x and 2.x) onto the Claude Code names
|
|
@@ -309,7 +309,7 @@ async function setup(ctx: V2.Context): Promise<V2.Cleanup> {
|
|
|
309
309
|
for await (const event of ctx.event.subscribe({ types: [...types], signal })) {
|
|
310
310
|
switch (event.type) {
|
|
311
311
|
case "session.text.ended":
|
|
312
|
-
response(event.data.text, cwd)
|
|
312
|
+
response(event.data.text, cwd, event.data.sessionID)
|
|
313
313
|
break
|
|
314
314
|
case "session.tool.input.started":
|
|
315
315
|
calls.set(event.data.id, { name: event.data.name })
|
|
@@ -398,7 +398,7 @@ function replyEvents(directory: string) {
|
|
|
398
398
|
const sent = live.get(part.messageID)
|
|
399
399
|
if (!sent || sent.has(part.id)) return
|
|
400
400
|
sent.add(part.id)
|
|
401
|
-
response(part.text, directory)
|
|
401
|
+
response(part.text, directory, part.sessionID)
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
|