-
Notifications
You must be signed in to change notification settings - Fork 22.1k
add experimental.chat.messages.transform hook #5207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rekram1-node
merged 31 commits into
anomalyco:dev
from
jorgenwh:chat-messages-transform-hook
Dec 11, 2025
Merged
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
154afc7
chat messages transform hook and chat messages type
jorgenwh f93b0ff
fix typecheck errors
jorgenwh 1f2ac0d
Update packages/opencode/src/session/prompt.ts
jorgenwh ce47e3c
fix github-actions bot bug
jorgenwh 81efaf5
add removed filter for messages
jorgenwh 5cedfa9
Merge branch 'dev' of https://github.com/sst/opencode into chat-messa…
jorgenwh 22b0cab
Merge branch 'dev' of https://github.com/sst/opencode into chat-messa…
jorgenwh 1b1ea7d
make hook experimental for now
jorgenwh 12de5ec
make hook experimental for now
jorgenwh e9e96d3
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh 5e4b9cc
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh b7e5b5b
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh c770f75
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh 877b9ec
pull dev
jorgenwh 183b8de
mimic messagev2 instead of vercel ai's model message
jorgenwh e90ff06
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh 268f47d
pulled dev
jorgenwh 6e06cee
pulled dev
jorgenwh f5b009b
Merge branch 'chat-messages-transform-hook' of github.com:jorgenwh/op…
jorgenwh 5441400
cleanup
jorgenwh 7d9b083
cleanup
jorgenwh 65078de
cleanup
jorgenwh 9e52984
use MessageV2.WithParts directly
jorgenwh 3c5089e
remove unnecessary import
jorgenwh ee7ad25
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh c52baf7
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh 0a73c56
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh 4f4f65b
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh 743870c
use remeda copy instead of ugly JSON trick
jorgenwh 47acc80
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh 388a442
Merge branch 'dev' into chat-messages-transform-hook
jorgenwh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| export interface ChatMessageTextPart { | ||
| type: "text" | ||
| text: string | ||
| providerMetadata?: Record<string, unknown> | ||
| } | ||
|
|
||
| export interface ChatMessageFilePart { | ||
| type: "file" | ||
| url: string | ||
| mediaType: string | ||
| filename?: string | ||
| } | ||
|
|
||
| export interface ChatMessageStepStartPart { | ||
| type: "step-start" | ||
|
jorgenwh marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| export interface ChatMessageToolPart { | ||
| type: "tool" | ||
| toolName: string | ||
| toolCallId: string | ||
| state: "completed" | "error" | ||
| input: Record<string, unknown> | ||
| output?: string | ||
| error?: string | ||
| compacted?: boolean | ||
| callProviderMetadata?: Record<string, unknown> | ||
| attachments?: ChatMessageFilePart[] | ||
| } | ||
|
|
||
| export interface ChatMessageReasoningPart { | ||
| type: "reasoning" | ||
| text: string | ||
| providerMetadata?: Record<string, unknown> | ||
| } | ||
|
|
||
| export type ChatMessagePart = | ||
| | ChatMessageTextPart | ||
| | ChatMessageFilePart | ||
| | ChatMessageStepStartPart | ||
| | ChatMessageToolPart | ||
| | ChatMessageReasoningPart | ||
|
|
||
| export interface ChatMessage { | ||
| id: string | ||
| role: "user" | "assistant" | ||
| parts: ChatMessagePart[] | ||
| altered?: boolean | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.