Commit graph

4546 commits

Author SHA1 Message Date
Kit Langton
ab31c41fee refactor(bus): one GlobalBus emit per event, with optional sync metadata
Today every sync.run produces TWO GlobalBus events:

  1. From bus.publish itself — the projection view:
     { payload: { id, type: "session.created", properties } }

  2. From sync/index.ts — the source-of-truth envelope:
     { payload: { type: "sync", syncEvent: { type: "session.created.1", id, seq, aggregateID, data } } }

These two emits live in different files and discriminate via
`payload.type` — either a real event type or the sentinel "sync".
That collision is the source of confusion in the codebase:
consumers have to know which shape they're looking at.

The duality dates back to:
  - d88912abf0 (Dec 2025): Dax added GlobalBus.emit inside bus.publish.
  - b22add292c (#22347, Apr 2026): James consolidated sync events onto
    GlobalBus by ADDING a second emit with the source envelope.

#22347's stated intent was "consolidate events into a single stream".
Two emits with different shapes on one channel isn't quite that. One
emit per event with a unified shape is.

This PR collapses the two emits into one:

  { payload: { id, type: "session.created", properties, sync?: { name, seq, aggregateID, data } } }

- bus.publish accepts an optional `sync?: SyncMetadata` option.
- sync/index.ts passes it; its own GlobalBus.emit is removed.
- BusEvent.effectPayloads() adds an optional `sync` field to every
  event schema.
- SyncEvent.effectPayloads() is no longer included in the wire schema
  (it's now subsumed by the optional field).
- Consumers migrate from `payload.type === "sync"` filtering to
  `payload.sync != null` filtering. control-plane/workspace.ts
  reconstructs SerializedEvent from { id, sync.* } for replay.

Note: this is a BREAKING SDK wire-format change. External consumers
that read `payload.type === "sync"` or `payload.syncEvent` need to
migrate. Internal opencode consumers all migrated in this PR.

Side observation: the runtime emit was using `payload.syncEvent`
(nested) while the SDK schema declared the fields at top level under
`type: "sync"` — a silent schema drift. Collapsing to one emit also
fixes that drift by definition.

Verified:
  - bun typecheck — clean
  - bun run test test/sync/index.test.ts test/bus/bus-effect.test.ts
    test/server/httpapi-event.test.ts
    test/server/httpapi-event-diagnostics.test.ts — 29/29 green
  - bun run test test/server/httpapi-sdk.test.ts -t "streams sync-backed" — green
2026-05-18 13:23:30 -04:00
opencode-agent[bot]
094886c848 chore: generate 2026-05-18 17:03:44 +00:00
Shoubhit Dash
dc0297f4ac
refactor(session): extract reference prompt helpers (#28197) 2026-05-18 22:32:18 +05:30
Shoubhit Dash
a2e6bd503b
refactor(reference): split materialization state (#28190) 2026-05-18 22:14:33 +05:30
Aiden Cline
05ac345696
refactor(session): move prompt reminders out of core loop (#28082) 2026-05-18 11:36:38 -05:00
opencode-agent[bot]
e3feca09b3 chore: generate 2026-05-18 16:20:46 +00:00
Kit Langton
896ad7b884
Speed up targeted opencode tests
Reduce avoidable setup costs in slow opencode tests while preserving reviewed coverage and recording the benchmark evidence for follow-up test-suite work.
2026-05-18 16:18:29 +00:00
opencode-agent[bot]
0a945219a9 chore: generate 2026-05-18 16:17:46 +00:00
Shoubhit Dash
94828eb44b
refactor(repository): type cache failures (#28188) 2026-05-18 21:46:18 +05:30
Shoubhit Dash
96192495ae
refactor(repository): add cache service (#28184) 2026-05-18 21:25:38 +05:30
Kit Langton
cb35493242
fix(bus): acquire PubSub subscription eagerly to close /event race (#27959) 2026-05-18 11:38:05 -04:00
Shoubhit Dash
5bfd7fd16c
refactor(repository): clarify reference domain (#28182) 2026-05-18 21:04:44 +05:30
opencode-agent[bot]
2932b41e64 chore: generate 2026-05-18 15:14:13 +00:00
Shoubhit Dash
eb389c58eb
refactor(reference): normalize config entries (#28178) 2026-05-18 20:42:41 +05:30
opencode-agent[bot]
e56999fd36 chore: generate 2026-05-18 12:31:37 +00:00
Simon Klee
1124315267
run: refresh prompt layout after paste (#28164)
Pasting into the prompt textarea left its layout stale until the next edit, so the visible content did not reflect the pasted text. Mark the layout dirty on paste and notify the content-change handler once the renderer is idle so the prompt updates immediately.
2026-05-18 12:30:20 +00:00
Shoubhit Dash
564cde393e
fix(tui): copy pasted prompt content (#28156) 2026-05-18 17:02:34 +05:30
opencode-agent[bot]
c813927bb6 chore: generate 2026-05-18 11:07:52 +00:00
Simon Klee
5970c12d90
run: replay session history on interactive resume (#26880) 2026-05-18 13:06:27 +02:00
opencode-agent[bot]
116a4e33ba chore: generate 2026-05-18 11:06:05 +00:00
Shoubhit Dash
611e48c4ac
fix(tui): collapse long tool output lines (#28148) 2026-05-18 16:34:34 +05:30
Kagura
e94aecaa08
fix(tui): use contrast-aware foreground for paste summary badge (#27969)
Co-authored-by: Simon Klee <hello@simonklee.dk>
2026-05-18 08:38:40 +00:00
Dax
e85119aa64
Load models.dev snapshot from build global (#28077) 2026-05-17 21:59:44 -04:00
opencode-agent[bot]
969d0f48b2 chore: generate 2026-05-17 23:03:12 +00:00
Luke Parker
fc19dcc70c
fix: sort v2 session list by updated time (#27954) 2026-05-18 09:01:55 +10:00
Sebastian
f97e115ee2
dialog prompt submit keybind + opentui event sink (#27945) 2026-05-18 00:23:19 +02:00
Dax
23b594de6e
fix: preserve bus instance context (#28051) 2026-05-17 12:56:42 -04:00
Shoubhit Dash
e4cc4e1682
fix(lsp): preserve instance ref for update events (#28016) 2026-05-17 16:37:00 +05:30
Kit Langton
c0a8b509c7
style(tui): distinguish markdown h1 headings (#27814) 2026-05-16 11:18:17 -04:00
Shoubhit Dash
68af95390d
fix: hide task background instructions by default (#27872) 2026-05-16 19:18:15 +05:30
opencode-agent[bot]
321db7a819 chore: generate 2026-05-16 13:27:23 +00:00
Dax Raad
6d2219e001 fix(cli): preserve instance context in async commands 2026-05-16 09:25:45 -04:00
opencode-agent[bot]
dd432e3cde chore: generate 2026-05-16 13:21:57 +00:00
Dax Raad
77db212a0a fix read stream byte cap 2026-05-16 09:20:35 -04:00
Dax Raad
88363f1ed9 fixed issue in opencode run 2026-05-16 08:27:25 -04:00
Dax
53849bd866
fix(sync): publish events on injected project bus (#27825) 2026-05-16 05:56:49 +00:00
Aiden Cline
548648a3d9
core: reduce prompts for shell, todowrite, and task tools (#26821) 2026-05-16 00:18:47 -05:00
Dax Raad
042e6a5c86 tui: newly pinned sessions now append to the end of the list instead of jumping to the top 2026-05-15 23:57:40 -04:00
Sebastian
cc9c0b15c7
Revert "add dialog prompt submit keybind (#27807)" (#27815) 2026-05-16 04:44:32 +02:00
Kit Langton
f3b0d3d7ac
fix(tui): dedupe consecutive prompt history entries (#27816) 2026-05-16 02:36:35 +00:00
Sebastian
d441e931f9
add dialog prompt submit keybind (#27807) 2026-05-16 03:11:46 +02:00
Kit Langton
5911bd532d
fix(tui): show config error details on startup (#27803) 2026-05-15 20:42:56 -04:00
Dax Raad
2385123f03 Fix thinking toggle defaults 2026-05-15 20:27:36 -04:00
Sebastian
0f31fd631b
Fix multiline mentions (#27649) 2026-05-15 23:04:20 +02:00
Sebastian
aa07e21945
handle undefined tips (#27635) 2026-05-15 23:04:00 +02:00
Shoubhit Dash
f060874b29
feat(tui): add minimal thinking mode with click-to-expand (#27623) 2026-05-16 02:09:58 +05:30
Shoubhit Dash
65f96a5851
refactor(instance): retire WithInstance adapter (#27782) 2026-05-16 01:30:07 +05:30
Aiden Cline
48122b31cc
fix(tool): bridge custom tool zod metadata (#27770) 2026-05-15 14:50:21 -05:00
Shoubhit Dash
f33b4455a1
feat(tui): enable pinned session switching (#27780) 2026-05-16 01:10:16 +05:30
Shoubhit Dash
a24abd2b11
refactor(lsp): require explicit instance context (#27767) 2026-05-16 00:46:27 +05:30