diff options
| author | James Long <[email protected]> | 2026-04-16 12:35:37 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-16 12:35:37 -0400 |
| commit | b28956f0dbc22d786fab24b2a34fd07fba6d27ec (patch) | |
| tree | 356d051e430bcaa464e5e338ab3aed2388f706fd | |
| parent | d82bc3a421c04e3abbade123344dc40d81e03395 (diff) | |
| download | opencode-b28956f0dbc22d786fab24b2a34fd07fba6d27ec.tar.gz opencode-b28956f0dbc22d786fab24b2a34fd07fba6d27ec.zip | |
fix(core): better global sync event structure (#22858)
| -rw-r--r-- | packages/opencode/src/control-plane/workspace.ts | 3 | ||||
| -rw-r--r-- | packages/opencode/src/sync/sync-event.ts | 12 |
2 files changed, 5 insertions, 10 deletions
diff --git a/packages/opencode/src/control-plane/workspace.ts b/packages/opencode/src/control-plane/workspace.ts index b43fe848b..d870eb636 100644 --- a/packages/opencode/src/control-plane/workspace.ts +++ b/packages/opencode/src/control-plane/workspace.ts @@ -460,8 +460,7 @@ export namespace Workspace { if (!("payload" in evt)) return if (evt.payload.type === "sync") { - // This name -> type is temporary - SyncEvent.replay({ ...evt.payload, type: evt.payload.name } as SyncEvent.SerializedEvent) + SyncEvent.replay(evt.payload.syncEvent as SyncEvent.SerializedEvent) } GlobalBus.emit("event", { diff --git a/packages/opencode/src/sync/sync-event.ts b/packages/opencode/src/sync/sync-event.ts index db487ddd2..94c889d91 100644 --- a/packages/opencode/src/sync/sync-event.ts +++ b/packages/opencode/src/sync/sync-event.ts @@ -155,8 +155,10 @@ function process<Def extends Definition>(def: Def, event: Event<Def>, options: { workspace: WorkspaceContext.workspaceID, payload: { type: "sync", - name: versionedType(def.type, def.version), - ...event, + syncEvent: { + type: versionedType(def.type, def.version), + ...event, + }, }, }) } @@ -164,12 +166,6 @@ function process<Def extends Definition>(def: Def, event: Event<Def>, options: { }) } -// TODO: -// -// * Support applying multiple events at one time. One transaction, -// and it validets all the sequence ids -// * when loading events from db, apply zod validation to ensure shape - export function replay(event: SerializedEvent, options?: { publish: boolean }) { const def = registry.get(event.type) if (!def) { |
