-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
Bug
OpenCode now validates message part IDs with a Zod schema requiring them to start with "prt". The chat.message hook creates parts with IDs like supermemory-context-{timestamp} and supermemory-nudge-{timestamp}, which fail validation.
Error
ZodError: [
{
"origin": "string",
"code": "invalid_format",
"format": "starts_with",
"prefix": "prt",
"path": ["id"],
"message": "Invalid string: must start with \"prt\""
}
]
at createUserMessage (/$bunfs/root/src/cli/cmd/tui/worker.js:108:35)
Reproduction
- Install
opencode-supermemory@2.0.4 - Send the first message in a new session
- Error fires on every first message (when context injection runs)
Root Cause
In dist/index.js, the chat.message hook creates parts with non-compliant IDs:
- Line ~14548:
id: \supermemory-nudge-${Date.now()}`` - Line ~14582:
id: \supermemory-context-${Date.now()}``
Meanwhile, generatePartId() (line ~14180) already generates correct prt_-prefixed IDs but is only used in injectHookMessage.
Fix
Use the prt_ prefix for all part IDs in the chat.message hook, e.g.:
id: `prt_supermemory-nudge-${Date.now()}`
id: `prt_supermemory-context-${Date.now()}`Or reuse the existing generatePartId() function.
Environment
- opencode-supermemory: 2.0.4
- OpenCode: latest (bunfs-based CLI)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels