GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(session): remove message content mutation API (#48043) · jinhuang712/opencode@43f5414

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • client
      • src
        • effect
          • api
            • api.ts
          • generated
            • client.ts
        • promise/generated
          • client.ts
          • types.ts
        • solid
          • data.ts
      • test
        • solid-data.test.ts
    • core
      • src
        • session.ts
        • session
          • error.ts
          • session.ts
      • test
        • session-message-update.test.ts
        • session-owned.test.ts
    • protocol
      • openapi.json
      • src/groups
        • session.ts
    • schema
      • src
        • session-event.ts
      • test
        • event-manifest.test.ts
    • server
      • src/handlers
        • session.ts
      • test
        • session-message-update.test.ts
  • services/www
    • openapi.json
    • public
      • openapi.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/client/src/effect/api/api.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/effect/api/api.ts
+12-25Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,32 +1033,32 @@ export type SessionLogOutput =
10331033
readonly id: Event.ID
10341034
readonly created: number
10351035
readonly metadata?: { readonly [x: string]: unknown } | undefined
1036-
readonly type: "session.message.content.updated"
1036+
readonly type: "session.usage.recorded"
10371037
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
10381038
readonly location?: Location.Ref | undefined
10391039
readonly data: {
10401040
readonly sessionID: Session.ID
1041-
readonly messageID: SessionMessage.ID
1042-
readonly content: ReadonlyArray<SessionMessage.AssistantContentEncoded>
1041+
readonly source: "title" | "compaction"
1042+
readonly cost: number & Brand.Brand<"Money.USD">
1043+
readonly tokens: {
1044+
readonly input: number
1045+
readonly output: number
1046+
readonly reasoning: number
1047+
readonly cache: { readonly read: number; readonly write: number }
1048+
}
10431049
}
10441050
}
10451051
| {
10461052
readonly id: Event.ID
10471053
readonly created: number
10481054
readonly metadata?: { readonly [x: string]: unknown } | undefined
1049-
readonly type: "session.usage.recorded"
1055+
readonly type: "session.message.content.updated"
10501056
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
10511057
readonly location?: Location.Ref | undefined
10521058
readonly data: {
10531059
readonly sessionID: Session.ID
1054-
readonly source: "title" | "compaction"
1055-
readonly cost: number & Brand.Brand<"Money.USD">
1056-
readonly tokens: {
1057-
readonly input: number
1058-
readonly output: number
1059-
readonly reasoning: number
1060-
readonly cache: { readonly read: number; readonly write: number }
1061-
}
1060+
readonly messageID: SessionMessage.ID
1061+
readonly content: ReadonlyArray<SessionMessage.AssistantContentEncoded>
10621062
}
10631063
}
10641064
)
@@ -1081,18 +1081,6 @@ export type SessionMessageInput = { readonly sessionID: Session.ID; readonly mes
10811081
export type SessionMessageOutput = SessionMessage.Info
10821082
export type SessionMessageOperation<E = never> = (input: SessionMessageInput) => Effect.Effect<SessionMessageOutput, E>
10831083

1084-
export type SessionMessageUpdateInput = {
1085-
readonly sessionID: Session.ID
1086-
readonly messageID: SessionMessage.ID
1087-
readonly content: ReadonlyArray<
1088-
SessionMessage.AssistantText | SessionMessage.AssistantReasoning | SessionMessage.AssistantTool
1089-
>
1090-
}
1091-
export type SessionMessageUpdateOutput = SessionMessage.Assistant
1092-
export type SessionMessageUpdateOperation<E = never> = (
1093-
input: SessionMessageUpdateInput,
1094-
) => Effect.Effect<SessionMessageUpdateOutput, E>
1095-
10961084
export type SessionEnvironmentInput = {
10971085
readonly sessionID: Session.ID
10981086
readonly variables: { readonly [x: string]: string }
@@ -1151,7 +1139,6 @@ export interface SessionApi<E = never> {
11511139
readonly interrupt: SessionInterruptOperation<E>
11521140
readonly background: SessionBackgroundOperation<E>
11531141
readonly message: SessionMessageOperation<E>
1154-
readonly messageUpdate: SessionMessageUpdateOperation<E>
11551142
readonly environment: SessionEnvironmentOperation<E>
11561143
readonly view: SessionViewOperation<E>
11571144
}
Collapse file

‎packages/client/src/effect/generated/client.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/effect/generated/client.ts
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ import type {
9292
SessionBackgroundOutput,
9393
SessionMessageInput,
9494
SessionMessageOutput,
95-
SessionMessageUpdateInput,
96-
SessionMessageUpdateOutput,
9795
SessionEnvironmentInput,
9896
SessionEnvironmentOutput,
9997
SessionViewInput,
@@ -691,17 +689,6 @@ const EndpointSessionMessage = (raw: RawClient["server.session"]) => (input: Ses
691689
),
692690
)
693691

694-
const EndpointSessionMessageUpdate = (raw: RawClient["server.session"]) => (input: SessionMessageUpdateInput) =>
695-
preserveEffect<SessionMessageUpdateOutput>()(
696-
raw["session.messageUpdate"]({
697-
params: { sessionID: input["sessionID"], messageID: input["messageID"] },
698-
payload: { content: input["content"] },
699-
}).pipe(
700-
Effect.mapError(mapClientError),
701-
Effect.map((value) => value.data),
702-
),
703-
)
704-
705692
const EndpointSessionEnvironment = (raw: RawClient["server.session"]) => (input: SessionEnvironmentInput) =>
706693
preserveEffect<SessionEnvironmentOutput>()(
707694
raw["session.environment"]({
@@ -762,7 +749,6 @@ const adaptGroupSession = (raw: RawClient["server.session"]) => ({
762749
interrupt: EndpointSessionInterrupt(raw),
763750
background: EndpointSessionBackground(raw),
764751
message: EndpointSessionMessage(raw),
765-
messageUpdate: EndpointSessionMessageUpdate(raw),
766752
environment: EndpointSessionEnvironment(raw),
767753
view: EndpointSessionView(raw),
768754
})
Collapse file

‎packages/client/src/promise/generated/client.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/promise/generated/client.ts
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ import type {
8686
SessionBackgroundOutput,
8787
SessionMessageInput,
8888
SessionMessageOutput,
89-
SessionMessageUpdateInput,
90-
SessionMessageUpdateOutput,
9189
SessionEnvironmentInput,
9290
SessionEnvironmentOutput,
9391
SessionViewInput,
@@ -986,18 +984,6 @@ export function make(options: ClientOptions) {
986984
},
987985
requestOptions,
988986
).then((value) => value.data),
989-
messageUpdate: (input: SessionMessageUpdateInput, requestOptions?: RequestOptions) =>
990-
request<{ readonly data: SessionMessageUpdateOutput }>(
991-
{
992-
method: "PATCH",
993-
path: `/api/session/${encodeURIComponent(input.sessionID)}/message/${encodeURIComponent(input.messageID)}`,
994-
body: { content: input["content"] },
995-
successStatus: 200,
996-
declaredStatuses: [400, 401, 404, 409],
997-
empty: false,
998-
},
999-
requestOptions,
1000-
).then((value) => value.data),
1001987
environment: (input: SessionEnvironmentInput, requestOptions?: RequestOptions) =>
1002988
request<SessionEnvironmentOutput>(
1003989
{
Collapse file

‎packages/client/src/promise/generated/types.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/promise/generated/types.ts
+1-87Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,8 +2252,8 @@ export type SessionEventDurable =
22522252
| SessionRevertStaged
22532253
| SessionRevertCleared
22542254
| SessionRevertCommitted
2255-
| SessionMessageContentUpdated
22562255
| SessionUsageRecorded
2256+
| SessionMessageContentUpdated
22572257

22582258
export type IntegrationInfo = {
22592259
id: string
@@ -2317,7 +2317,6 @@ export type V2Event =
23172317
| SessionRevertStaged
23182318
| SessionRevertCleared
23192319
| SessionRevertCommitted
2320-
| SessionMessageContentUpdated
23212320
| FilesystemChanged
23222321
| ReferenceUpdated
23232322
| PermissionAsked
@@ -4270,91 +4269,6 @@ export type SessionMessageInput = {
42704269

42714270
export type SessionMessageOutput = { data: SessionMessageInfo }["data"]
42724271

4273-
export type SessionMessageUpdateInput = {
4274-
readonly sessionID: { readonly sessionID: string; readonly messageID: string }["sessionID"]
4275-
readonly messageID: { readonly sessionID: string; readonly messageID: string }["messageID"]
4276-
readonly content: {
4277-
readonly content: ReadonlyArray<
4278-
| { readonly type: "text"; readonly text: string; readonly state?: { readonly [x: string]: JsonValue } }
4279-
| {
4280-
readonly type: "reasoning"
4281-
readonly text: string
4282-
readonly state?: { readonly [x: string]: JsonValue }
4283-
readonly time?: { readonly created: number; readonly completed?: number }
4284-
}
4285-
| {
4286-
readonly type: "tool"
4287-
readonly id: string
4288-
readonly name: string
4289-
readonly executed?: boolean
4290-
readonly providerState?: { readonly [x: string]: JsonValue }
4291-
readonly providerResultState?: { readonly [x: string]: JsonValue }
4292-
readonly state:
4293-
| { readonly status: "streaming"; readonly input: string }
4294-
| {
4295-
readonly status: "running"
4296-
readonly input: { readonly [x: string]: JsonValue }
4297-
readonly metadata: { readonly [x: string]: JsonValue }
4298-
}
4299-
| {
4300-
readonly status: "completed"
4301-
readonly input: { readonly [x: string]: JsonValue }
4302-
readonly content: readonly [
4303-
(
4304-
| { readonly type: "text"; readonly text: string }
4305-
| {
4306-
readonly type: "file"
4307-
readonly uri: string
4308-
readonly mime: string
4309-
readonly name?: string | null
4310-
}
4311-
),
4312-
...Array<
4313-
| { readonly type: "text"; readonly text: string }
4314-
| {
4315-
readonly type: "file"
4316-
readonly uri: string
4317-
readonly mime: string
4318-
readonly name?: string | null
4319-
}
4320-
>,
4321-
]
4322-
readonly metadata?: { readonly [x: string]: JsonValue }
4323-
}
4324-
| {
4325-
readonly status: "error"
4326-
readonly input: { readonly [x: string]: JsonValue }
4327-
readonly error: { readonly type: string; readonly message: string; readonly status?: number }
4328-
readonly content?: readonly [
4329-
(
4330-
| { readonly type: "text"; readonly text: string }
4331-
| {
4332-
readonly type: "file"
4333-
readonly uri: string
4334-
readonly mime: string
4335-
readonly name?: string | null
4336-
}
4337-
),
4338-
...Array<
4339-
| { readonly type: "text"; readonly text: string }
4340-
| {
4341-
readonly type: "file"
4342-
readonly uri: string
4343-
readonly mime: string
4344-
readonly name?: string | null
4345-
}
4346-
>,
4347-
]
4348-
readonly metadata?: { readonly [x: string]: JsonValue }
4349-
}
4350-
readonly time: { readonly created: number; readonly ran?: number; readonly completed?: number }
4351-
}
4352-
>
4353-
}["content"]
4354-
}
4355-
4356-
export type SessionMessageUpdateOutput = { data: SessionMessageAssistant }["data"]
4357-
43584272
export type SessionEnvironmentInput = {
43594273
readonly sessionID: { readonly sessionID: string }["sessionID"]
43604274
readonly variables: { readonly variables: { readonly [x: string]: string } }["variables"]
Collapse file

‎packages/client/src/solid/data.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/solid/data.ts
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -827,16 +827,6 @@ export function createData(config: CreateDataInput) {
827827
match.time.completed = event.created
828828
})
829829
return
830-
case "session.message.content.updated": {
831-
if (store.session.message[event.data.sessionID])
832-
message.editAssistant(event.data.sessionID, event.data.messageID, (assistant) => {
833-
assistant.content = [...event.data.content]
834-
})
835-
if (!sync.pending(`session.message:${event.data.sessionID}`)) return
836-
result.session.message.invalidate(event.data.sessionID)
837-
refresh(() => result.session.message.sync(event.data.sessionID))
838-
return
839-
}
840830
case "session.step.started":
841831
message.update(event.data.sessionID, (draft, index) => {
842832
const position = index.get(event.data.assistantMessageID)
Collapse file

‎packages/client/test/solid-data.test.ts‎

Copy file name to clipboardExpand all lines: packages/client/test/solid-data.test.ts
-71Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -744,77 +744,6 @@ test.each(["success", "failure", "cancel", "cancel-retry", "cancel-page", "join-
744744
},
745745
)
746746

747-
test("preserves assistant content replacement events across an active message read", async () => {
748-
const listeners = new Set<Parameters<CreateDataInput["event"]["listen"]>[0]>()
749-
const release = Promise.withResolvers<void>()
750-
let requests = 0
751-
const content = [
752-
{ type: "text" as const, text: "replacement" },
753-
{ type: "reasoning" as const, text: "reasoning", time: { created: 3 } },
754-
]
755-
const api = OpenCode.make({
756-
baseUrl: "http://opencode.local",
757-
fetch: async () => {
758-
const current = ++requests
759-
if (current === 2) await release.promise
760-
return Response.json({
761-
data: [
762-
{
763-
id: "msg_assistant",
764-
type: "assistant",
765-
agent: "build",
766-
model: { id: "model", providerID: "provider" },
767-
content: current === 3 ? content : [{ type: "text", text: "original" }],
768-
time: { created: 1, completed: 2 },
769-
},
770-
],
771-
cursor: {},
772-
})
773-
},
774-
})
775-
const setup = createRoot((dispose) => ({
776-
data: createData({
777-
api: () => api,
778-
directory: "/project",
779-
event: {
780-
on: () => () => {},
781-
listen(handler) {
782-
listeners.add(handler)
783-
return () => listeners.delete(handler)
784-
},
785-
},
786-
}),
787-
dispose,
788-
}))
789-
790-
try {
791-
await setup.data.session.message.sync("ses_refresh")
792-
setup.data.session.message.invalidate("ses_refresh")
793-
const stale = setup.data.session.message.sync("ses_refresh")
794-
await wait(() => requests === 2)
795-
const updated: OpenCodeEvent = {
796-
id: "evt_message_updated",
797-
created: 3,
798-
type: "session.message.content.updated",
799-
durable: { aggregateID: "ses_refresh", seq: 3, version: 1 },
800-
data: {
801-
sessionID: "ses_refresh",
802-
messageID: "msg_assistant",
803-
content,
804-
},
805-
}
806-
listeners.forEach((listener) => listener({ name: updated.type, details: updated }))
807-
808-
expect(setup.data.session.message.list("ses_refresh")[0]).toMatchObject({ content })
809-
release.resolve()
810-
await stale
811-
await wait(() => requests === 3)
812-
expect(setup.data.session.message.list("ses_refresh")[0]).toMatchObject({ content })
813-
} finally {
814-
setup.dispose()
815-
}
816-
})
817-
818747
test.each([
819748
"session.execution.succeeded",
820749
"session.execution.failed",
Collapse file

‎packages/core/src/session.ts‎

Copy file name to clipboardExpand all lines: packages/core/src/session.ts
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ import {
3131
ForkEmptyError,
3232
InboxConflictError,
3333
MessageDecodeError,
34-
MessageIncompleteError,
35-
MessageNotAssistantError,
3634
MessageNotFoundError,
37-
MessageToolIncompleteError,
3835
NotFoundError,
3936
PromptConflictError,
4037
SkillNotFoundError,
@@ -101,10 +98,7 @@ export {
10198
CompactionConflictError,
10299
InboxConflictError,
103100
MessageDecodeError,
104-
MessageIncompleteError,
105-
MessageNotAssistantError,
106101
MessageNotFoundError,
107-
MessageToolIncompleteError,
108102
NotFoundError,
109103
PromptConflictError,
110104
SkillNotFoundError,
@@ -136,9 +130,6 @@ export interface Interface {
136130
sessionID: SessionSchema.ID
137131
messageID: SessionMessage.ID
138132
}) => Effect.Effect<SessionMessage.Info | undefined>
139-
readonly updateMessage: (
140-
input: Parameters<Session.Handle["updateMessage"]>[0] & { readonly sessionID: SessionSchema.ID },
141-
) => ReturnType<Session.Handle["updateMessage"]>
142133
readonly context: (
143134
sessionID: SessionSchema.ID,
144135
) => Effect.Effect<SessionMessage.Info[], NotFoundError | MessageDecodeError>
@@ -357,7 +348,6 @@ const layer = Layer.effect(
357348
return yield* store.messages(input)
358349
}),
359350
message: (input) => sessions.forSession(input.sessionID).message(input.messageID),
360-
updateMessage: (input) => sessions.forSession(input.sessionID).updateMessage(input),
361351
context: Effect.fn("Session.context")(function* (sessionID) {
362352
yield* result.get(sessionID)
363353
return yield* store.context(sessionID)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.