fix: opencode plugin broken after version upgrade

This commit is contained in:
Brydon DeWitt 2026-06-10 00:03:03 -04:00
parent 59148ea57c
commit 6a1ec26f99

View File

@ -48,6 +48,9 @@ export const GlobalPlugin: Plugin = async ({ $, client }) => {
'chat.message': async (input, output) => {
logInfoData('chat.message', { input, output });
const sessionID = output.message.sessionID;
const messageID = output.message.id;
// Session-start injection — runs exactly once per session, prepended so it
// reads before the user-prompt-submit nudges on the first turn.
if (!initializedSessions.has(input.sessionID)) {
@ -57,8 +60,8 @@ export const GlobalPlugin: Plugin = async ({ $, client }) => {
if (startContext) {
output.parts.unshift({
id: `prt_${crypto.randomUUID()}`,
sessionID: input.sessionID,
messageID: input.messageID ?? crypto.randomUUID(),
sessionID,
messageID,
type: 'text',
text: startContext,
synthetic: true,
@ -78,8 +81,8 @@ export const GlobalPlugin: Plugin = async ({ $, client }) => {
if (context) {
output.parts.push({
id: `prt_${crypto.randomUUID()}`,
sessionID: input.sessionID,
messageID: input.messageID ?? crypto.randomUUID(),
sessionID,
messageID,
type: 'text',
text: context,
synthetic: true,