Commit Graph

88 Commits

Author SHA1 Message Date
Kit Langton b23e5b78a8 make Session.updateMessage/updatePart generic, remove all MessageV2 casts
Generic interface preserves the narrowed type through update calls,
eliminating `as MessageV2.Assistant` / `as MessageV2.ToolPart` casts.
Async facades keep Zod validation via parse + cast, with `.force()`
bypass. Tighten test assertions for BusyError type and concurrent
caller identity.
2026-03-29 13:02:05 -04:00
Kit Langton cdac7a7dd1 remove abort from compaction service 2026-03-29 12:42:35 -04:00
Kit Langton eb05bda03b remove abort from llm and processor services 2026-03-29 12:38:24 -04:00
Kit Langton 732bbde850 effectify resolveCommand: use Command.Service, Agent, Plugin directly in layer 2026-03-29 12:22:00 -04:00
Kit Langton 4f784276b4 effectify resolvePromptParts: use AppFileSystem and Agent service directly 2026-03-29 12:21:59 -04:00
Kit Langton f5bf694056 use SessionCompaction.Service and Plugin.Service directly in layer 2026-03-29 12:21:59 -04:00
Kit Langton 51ad4801e8 add Effect-based prompt tests covering loop lifecycle, cancel, concurrency
12 tests using testEffect + TestLLM pattern (no HTTP server):
- loop exits on stop finish, calls LLM for new messages, continues on tool-calls
- loop sets status busy→idle
- cancel interrupts cleanly, returns last assistant, records MessageAbortedError
- cancel with queued callers resolves all cleanly
- concurrent callers get same result via Deferred queue
- concurrent callers receive same error on failure
- assertNotBusy throws BusyError when running, succeeds when idle
- shell rejects with BusyError when loop running
2026-03-29 12:21:58 -04:00
Kit Langton be20ea0f42 use SessionProcessor.Service, Session.Service, Agent.Service directly in layer
Yield effectified services instead of going through async facades. Eliminates
Effect→Promise→Effect double-bounce for processor.create, processor.process,
Session.get/touch/setPermission/updateMessage, and Agent.get/list. Await cancel
in session route. Remove redundant InstanceState.get in shellE ensuring block.
2026-03-29 12:21:57 -04:00
Kit Langton 76373f0c73 use Session.Service and Agent.Service directly instead of Effect.promise wrappers
Yield the effectified services in the layer and call their methods
directly, eliminating the double Effect→Promise→Effect bounce through
async facades. Layer.unwrap(Effect.sync(...)) breaks the circular
import. Also improves the assertNotBusy test with a proper gate/spy
so it deterministically catches the busy state.
2026-03-29 12:21:56 -04:00
Kit Langton 5719a13cbf refactor(session): effectify SessionPrompt service
Migrate SessionPrompt to the Effect service pattern (Interface, Service,
Layer, InstanceState, makeRuntime + async facades).

Key design decisions:

- Fiber-based cancellation replaces manual AbortController management.
  Effect.promise((signal) => ...) derives AbortSignals automatically;
  cancel() interrupts fibers and signals propagate to the AI SDK,
  shell processes, and tool execution.

- Deferred queue replaces Promise callback queue. Concurrent loop()
  callers get a Deferred that resolves when the running fiber finishes.
  On cancel or error, queued callers now receive proper errors instead
  of hanging forever.

- Separate loops/shells maps in InstanceState replace the single shared
  state object, with shell-to-loop handoff preserved: if callers queue
  a loop while a shell is running, shellE cleanup starts the loop.

- Heavy helper functions (createUserMessage, handleSubtask, shellImpl,
  resolveCommand, insertReminders, ensureTitle) stay as plain async
  functions called via Effect.promise, keeping the migration incremental.

- resolveTools and createStructuredOutputTool are unchanged (deeply tied
  to AI SDK tool callbacks).
2026-03-29 12:21:56 -04:00
Kit Langton 860531c275 refactor(session): effectify session processor (#19485) 2026-03-28 12:09:47 -04:00
Kit Langton 2145d97f18 refactor(session): effectify SessionCompaction service (#19459) 2026-03-28 01:09:14 +00:00
Aiden Cline c33d9996f0 feat: AI SDK v6 support (#18433) 2026-03-27 15:24:30 -05:00
André Cruz 7123aad5a8 fix(opencode): classify ZlibError from Bun fetch as retryable instead of unknown (#19104)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
2026-03-25 13:08:40 -05:00
James Long b0017bf1b9 feat(core): initial implementation of syncing (#17814) 2026-03-25 10:47:40 -04:00
Ryan Skidmore 814a515a8a fix: improve plugin system robustness — agent/command resolution, async errors, hook timing, two-phase init (#18280)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
2026-03-24 12:50:55 -05:00
jorge g 2dbcd79fd2 fix: stabilize agent and skill ordering in prompt descriptions (#18261)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
2026-03-19 15:04:03 -05:00
Kit Langton 84e62fc662 fix(session): preserve tagged error messages (#18165) 2026-03-18 20:36:53 -04:00
Johannes Loher e718db624f fix(core): consider code: context_length_exceeded as context overflow in API call errors (#17748) 2026-03-16 10:25:24 -05:00
Luke Parker 59c530cc6c fix(opencode): teach Kit's test what an ID is (#17745) 2026-03-16 18:08:27 +10:00
Jason Quense c2ca1494e5 fix(opencode): preserve prompt tool enables with empty agent permissions (#17064)
Co-authored-by: jquense <jquense@ramp.com>
2026-03-15 23:01:46 -05:00
Shoubhit Dash 9457493696 perf(server): paginate session history (#17134) 2026-03-13 15:48:43 +05:30
Kit Langton 1cb7df7159 refactor(provider): flow branded ProviderID/ModelID through internal signatures (#17182) 2026-03-12 14:48:17 +00:00
Kit Langton c45467964c feat(id): brand ProviderID and ModelID (#17110) 2026-03-12 09:27:52 -04:00
Kit Langton 090f636354 feat(id): brand PartID through Drizzle and Zod schemas (#16966) 2026-03-11 23:40:50 +00:00
Kit Langton 16a6d6feba feat(id): brand WorkspaceID through Drizzle and Zod schemas (#16964) 2026-03-11 23:30:17 +00:00
Kit Langton cb67465675 feat(id): brand SessionID through Drizzle and Zod schemas (#16953) 2026-03-11 23:16:56 +00:00
Aiden Cline 5acfdd1c5d chore: kill old copilot 403 message that was used for old plugin migration (#16904) 2026-03-10 16:20:41 -05:00
Dax 3ebba02d04 refactor: replace Bun.sleep with node timers (#15013)
publish-github-action / publish (push) Has been cancelled
2026-03-05 21:54:06 -05:00
opencode-agent[bot] e41b53504f chore: generate 2026-03-03 03:53:50 +00:00
Ryan Skidmore fd6f7133c5 fix(opencode): clone part data in Bus event to preserve token values (#15780) 2026-03-02 22:52:43 -05:00
Aiden Cline 04a634a80d test: merge test files into a single file (#14366) 2026-02-19 20:32:01 -06:00
Dax Raad cb5a0de42f core: remove User-Agent header assertion from LLM test to fix failing test 2026-02-19 18:37:55 -06:00
Dax 02a9495063 Remove use of Bun.file (#14215) 2026-02-19 11:32:32 -05:00
Aiden Cline e35a4131d0 core: keep message part order stable when files resolve asynchronously (#13915) 2026-02-16 18:45:11 -06:00
Kyle Mistele e269788a8f feat: support claude agent SDK-style structured outputs in the OpenCode SDK (#8161)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Dax Raad <d@ironbay.co>
2026-02-12 04:54:05 +00:00
Aiden Cline 0fd6f365be fix(core): ensure compaction is more reliable, add reserve token buffer to ensure that input window has enough room to compact (#12924)
Co-authored-by: James Lal <james@littlebearlabs.io>
2026-02-10 19:55:22 -06:00
Aiden Cline f74c0339cc test: fix failing prompt test (#12847) 2026-02-09 11:25:22 -06:00
Aiden Cline 99ea1351ce tweak: add new ContextOverflowError type (#12777) 2026-02-08 23:54:01 -06:00
Aiden Cline 62f38087b8 fix: parse mid stream openai responses style errors to prevent infinite retries for errors that should STOP execution (#12768) 2026-02-08 20:55:41 -06:00
Khang Ha (Kelvin) fde0b39b7c fix: properly encode file URLs with special characters (#12424) 2026-02-06 16:16:56 -06:00
Adam 1721c6efdf fix(core): session errors when attachment file not found 2026-02-04 10:21:03 -06:00
Łukasz Gładysz 6daa962aaa fix: prioritize OPENCODE_CONFIG_DIR for AGENTS.md (#11536) 2026-02-04 01:35:22 +00:00
Aiden Cline aa6b552c39 Revert pr that was mistakenly merged (#11844) 2026-02-02 15:28:02 -06:00
Aiden Cline 5db089070a test: add unit test 2026-02-01 19:26:23 -05:00
neavo f15755684f fix(opencode): scope agent variant to model (#11410) 2026-02-01 14:12:30 -06:00
YeonGyu-Kim 16145af480 fix: prevent duplicate AGENTS.md injection when reading instruction files (#11581)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
2026-02-01 13:46:08 -06:00
Aiden Cline da7c874808 tweak: show actual retry error message instead of generic error msg (#11520) 2026-01-31 13:15:42 -06:00
Aiden Cline f834915d3f test: fix flaky test (#11427) 2026-01-31 01:07:22 -06:00
Aiden Cline 9d3f32065b test: add llm.test.ts (#11375) 2026-01-30 17:04:32 -06:00