fix(context-injector): prefix synthetic part ids with prt_
Ensure injected synthetic message parts satisfy OpenCode's part-id schema and avoid new-session Zod validation failures. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -106,6 +106,8 @@ describe("createContextInjectorMessagesTransformHook", () => {
|
||||
expect(
|
||||
"synthetic" in secondSyntheticPart && secondSyntheticPart.synthetic === true
|
||||
).toBe(true)
|
||||
expect(typeof secondSyntheticPart.id).toBe("string")
|
||||
expect(secondSyntheticPart.id.startsWith("prt_")).toBe(true)
|
||||
expect(secondSyntheticPart.id).toBe(firstSyntheticPart.id)
|
||||
})
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ export function createContextInjectorMessagesTransformHook(
|
||||
|
||||
// synthetic part pattern (minimal fields)
|
||||
const syntheticPart = {
|
||||
id: `synthetic_hook_${sessionID}`,
|
||||
id: `prt_synthetic_hook_${sessionID}`,
|
||||
messageID: lastUserMessage.info.id,
|
||||
sessionID: (lastUserMessage.info as { sessionID?: string }).sessionID ?? "",
|
||||
type: "text" as const,
|
||||
|
||||
Reference in New Issue
Block a user