feat(core): add embedded v2 session runtime and tool foundation#30632
Conversation
Introduce @opencode-ai/core/opencode as the first public Effect-native embedding facade. OpenCode.layer() composes the existing SessionV2 default layer so applications can call sessions.list() without wiring internal services manually. Make SessionV2.prompt() durably admit one user prompt by publishing session.next.prompted, projecting SessionMessage.User inline, reading the stored projection, and returning that admitted message. This intentionally stops before model execution: prompt admission remains a short durable boundary, while a later continuation will start or resume the model loop. Leave the next contracts explicit in code comments: Session-scoped application idempotency must return the original admitted message for exact retry and reject conflicting reuse, and OpenCode.create() should later provide the Promise facade over the same semantics.
Allow callers to opt into Session-scoped prompt retry safety with an optional bounded branded Prompt.IdempotencyKey. Calls without a key continue admitting distinct messages. Exact retries with the same key and prompt return the original admitted SessionMessage.User, while changed-payload reuse fails with Session.PromptConflictError. Persist immutable session_prompt_admission tombstones containing the application key, prompt contract, and schema-encoded admitted user-message snapshot. Keep tombstones independent of rebuildable message projections so projection cleanup cannot erase admission history and accidentally permit duplicate work. Handle concurrent same-key races transactionally: the losing projected event rolls back through a private PromptAdmissionRace defect, and prompt recovery catches only that known defect before loading the winning tombstone. Unrelated defects, typed failures, and interruptions remain visible. Expose the optional key and 409 conflict mapping through the experimental V2 HTTP route, add core and HTTP regressions for opt-out, exact retry, conflicting reuse, and concurrent convergence, generate the SQLite migration, and regenerate V2 SDK types.
Schema changes: - Preserve required request bodies for experimental V2 OpenAPI and generated SDK mutation methods. - Add deprecated SDK filesystem DTO aliases for source compatibility. - Reuse existing durable tool failure and replay-owner schemas while tightening settlement and ownership behavior. - Keep pre-launch session.next.* databases disposable across incompatible experimental event iterations. Safety: - Fence replay aggregate and owner mismatches and propagate workspace replay ownership. - Restrict webfetch to globally routable literal IP destinations until DNS connections can be pinned. - Make apply_patch adds create-only, parser validation strict, and mutation commits interruption-safe. - Revalidate search roots before ripgrep traversal and harden pending permission/question transitions. - Sanitize public provider/model API URLs to origin-only values.
Schema changes: - brand embedded durable-event cursors and reserve admitted prompt IDs before projection - preserve provider call/result metadata separately and remove unused live tool-progress variants - regenerate OpenAPI and SDK types for projected tool metadata changes - document deferred provider retry/watchdog policy and foreground-only v2 bash
17ba99d to
fd271e2
Compare
|
One acceptance boundary I’d keep explicit for For this PR’s shape that could be: Location/session id, admitted That gives HTTP/SDK consumers a testable invariant: replay may rebuild history from SQLite, but execution only continues after the runtime can show which durable boundary it is trusting and what must be revalidated before side effects. |
|
This migration breaks upgraded beta DBs with pre-durable session projections. On an affected DB: 2,040 session_message rows total, 1,993 have no matching event.id across 237 sessions, 47 match across 1 session, and 0 sessions mix matched/unmatched rows. These are historical projections rather than partial corruption, but 20260603040000_session_message_projection_order rejects them with: Cannot migrate session_message projections without matching durable events. Suggested fix: backfill durable rows from event.seq; for legacy-only sessions assign seq using the prior deterministic (time_created, id) order; keep rejecting mixed sessions. Desktop currently surfaces this as an indefinite loading animation because the sidecar exits before readiness. |
potential fix: #30720 |
The v2 session runtime ("embedded v2 session runtime and tool foundation",
anomalyco#30632) replaced the V1 session loop for prompt execution, but its tool path
— ToolRegistry.settle plus the core BashTool — never consults the plugin
system. The documented plugin hooks `tool.execute.before` and `shell.env`
(https://opencode.ai/docs/plugins/, e.g. the InjectEnvPlugin example)
therefore silently stopped firing for every tool call, while event hooks kept
working over the event bus — a half-alive plugin API. core/tool/bash.ts
carried the matching parity-debt TODO: "Add plugin shell.env environment
augmentation once V2 plugin hooks exist."
This wires the two hooks back:
- packages/core/src/tool/plugin-hooks.ts (new): a per-directory hook-runner
bridge (install/get). Plain promises on purpose — the plugin system's
per-instance Effect context does not exist inside core's location layer
graph, and the hooks array is already materialized when the runner is
installed.
- packages/core/src/tool/registry.ts: settleWith fires tool.execute.before
before executing a tool; hooks mutate the call's input object in place
(e.g. re-homing paths) before the tool decodes it.
- packages/core/src/tool/bash.ts: merges the plugins' shell.env output into
the agent shell's environment (env + extendEnv: true); drops the TODO.
- packages/opencode/src/plugin/index.ts: installs the per-instance runner
(delegating to the loaded V1 hooks array) when an instance's plugins finish
loading; uninstalls via finalizer.
Binalyze Fleet depends on these hooks for the per-thread session-workspace
jail (re-homing agent file writes into /workspace/<threadId>), the
SESSION_WORKSPACE variable in agent shells, and resetting npm prefer-offline
for user-driven installs. Full rationale, upgrade checklist, and live
verification steps live in Binalyze.Fleet at platform-v2/docs/OPENCODE-FORK.md;
the platform build script (scripts/build-opencode.sh) hard-fails if this patch
is missing from the submodule.
Verified live: agent file writes land in the session workspace, bash cwd is
pinned there, SESSION_WORKSPACE is exported, and the prefer-offline leak is
gone. packages/core typechecks clean; the only packages/opencode typecheck
error is the pre-existing, unrelated src/bus/global.ts EventEmitter issue.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…sted runners (LAC-2386) (#33) * chore: update nix node_modules hashes * refactor(opencode): improve startup time by 38% (anomalyco#30453) Co-authored-by: starptech <starptech@starptechs-MBP.fritz.box> * chore: generate * fix(opencode): patch empty Gemini replay messages (anomalyco#30463) * chore: generate * refactor(core): consolidate filesystem services (anomalyco#30447) * chore: generate * run: enable interactive replay by default (anomalyco#30465) * chore: update nix node_modules hashes * refactor(opencode): remove JSON storage migration (anomalyco#30461) * chore: generate * chore: update nix node_modules hashes * fix(tui): stop idle background task spinner (anomalyco#30484) * refactor(core): move v1 schemas into core (anomalyco#30473) * chore: generate * fix: task id passed to background job for continuation (anomalyco#30485) * chore: generate * feat(core): project copying and tracking directories (anomalyco#30139) * chore: generate * fix(opencode): preserve signed thinking during anthropic reorder (anomalyco#30182) * Revert "fix(opencode): preserve signed thinking during anthropic reorder" (anomalyco#30502) * fix: rm tool reorder logic from old bug (anomalyco#30483) * chore: generate * feat(app): polish home projects list UI (anomalyco#30436) * feat(app): polish select-v2 component (anomalyco#30446) Co-authored-by: Brendan Allan <git@brendonovich.dev> * fix(github): enforce existing git author identity (anomalyco#30507) * feat(app): new update button (anomalyco#30460) Co-authored-by: Brendan Allan <git@brendonovich.dev> * fix(opencode): fallback to sh for curl upgrade (anomalyco#30499) Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> * fix(ui): render whole-file patches as complete diffs (anomalyco#30516) * chore: generate * feat(app): add servers tab to settings dialog (anomalyco#29675) * refactor(core): consolidate pty service (anomalyco#30537) * chore: generate * tui: truncate sidebar file paths (anomalyco#30531) * chore: update nix node_modules hashes * feat(stats): add geo breakdown (anomalyco#30456) * chore: generate * chore: update nix node_modules hashes * fix(acp): classify apply_patch as edit (anomalyco#30564) * fix(acp): classify task as think (anomalyco#30565) * fix(acp): include external directory permission context (anomalyco#30567) * fix(acp): clean read tool display content (anomalyco#30569) * fix(tui): route question responses by session directory (anomalyco#30578) * fix(stats): serve stats og image from banner * docs(go): add Qwen3.7 Plus model (anomalyco#30594) * fix(openai): preserve websocket idle state (anomalyco#30586) * refactor(core): remove ai sdk option fields (anomalyco#30581) * chore: generate * test(core): cover v1 provider option lowering (anomalyco#30599) * chore: generate * refactor(core): nest model api id (anomalyco#30603) * fix(core): expose azure openai xhigh efforts (anomalyco#30620) * feat(core): add skill registry and file agent loading (anomalyco#30617) * chore: generate * chore: update nix node_modules hashes * fix(stats): count all go usage * chore: remove zed extension and automation (anomalyco#30628) * fix(opencode): preserve variant for delegated tasks (anomalyco#30630) * zen: update nvidia tos * fix(opencode): route SAP AI Core reasoning variants through modelParams (anomalyco#30482) * chore: generate * fix(app): hide unavailable titlebar update (anomalyco#30642) * feat(app): v2 thinking level selector (anomalyco#30646) * fix(app,ui): session review reactivity and VCS query cache (anomalyco#30660) * feat(core): add embedded v2 session runtime and tool foundation (anomalyco#30632) * chore: generate * chore: update nix node_modules hashes * docs: correct compaction prune default (anomalyco#30670) * fix(opencode): avoid shell cancel race (anomalyco#30641) * feat: bump bedrock and add proper mantle support for openai models through aws bedrock (anomalyco#30464) * test: wait for shell truncation readiness (anomalyco#30679) * chore: update nix node_modules hashes * refactor(opencode): clean up task tool prompts (anomalyco#30687) * feat(core): add command registry (anomalyco#30624) * chore: generate * fix(acp): replay loaded session transcript (anomalyco#30645) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> * fix(core): reset pre-launch session projections (anomalyco#30728) * feat(tui): improve experimental session switcher (anomalyco#30738) * fix(opencode): respect disabled auto compaction on overflow (anomalyco#30749) * zen: nemotron 3 ultra * fix(enterprise): install hono standard validator peer (anomalyco#30740) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> * fix build * chore: update nix node_modules hashes * make scripts executable * fix(tui): show toast when variant_list keybind used with no variants (anomalyco#30724) * fix(opencode): `ACP.loadSession` should replay all messages (anomalyco#30761) Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> * fix(opencode): attribute task child agent on creation (anomalyco#30786) * fix(tui): add Vue syntax highlighting (anomalyco#30802) * fix: bump @openrouter/ai-sdk-provider to 2.9.0 (anomalyco#30800) * feat(core): moving sessions (anomalyco#30640) * chore: generate * tweak: background agent prompting to avoid polling issues (anomalyco#30790) * upgrade opentui to 0.3.2 (anomalyco#30748) * chore: update nix node_modules hashes * feat(desktop): surface local server startup failures (anomalyco#30822) * ci: publish * refactor(core): make v2 session inputs event sourced (anomalyco#30785) * chore: generate * fix(llm): normalize OpenAI function tool schemas * chore: generate * feat(stats): refresh stats routes and homepage (anomalyco#30419) * fix(stats): sort metric charts by top usage * feat(core): add public native API (anomalyco#30828) * chore: generate * feat(app): color themes (anomalyco#30824) Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com> * chore: generate * sync release versions for v1.16.0 * feat(core): attach global native tools (anomalyco#30832) * chore: generate * feat(core): add Snowflake Cortex provider (anomalyco#29901) Co-authored-by: Cortex Code <noreply@snowflake.com> * chore: generate * feat(core): persist v2 session context epochs (anomalyco#30789) * chore: generate * feat(tui): allow backgrounding synchronous subagents (anomalyco#30488) * fix(app): improve tab handling (anomalyco#30669) * chore: generate * fix(tui): prioritize models slash autocomplete (anomalyco#30848) * fix(tui): route permission replies to session directory (anomalyco#30851) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> * fix(cli): harden daemon lifecycle (anomalyco#30844) * chore: generate * feat(app): improve desktop multi-server support (anomalyco#30678) Co-authored-by: Brendan Allan <git@brendonovich.dev> * chore: generate * fix(app): handle tab overflow and scrolling in titlebar (anomalyco#30886) * fix(app): tab overflow (anomalyco#30894) * tui: guard path formatting inputs (anomalyco#30469) Fixes anomalyco#27726, anomalyco#25216, anomalyco#24856, anomalyco#24294, anomalyco#17071, anomalyco#29164, anomalyco#24837, anomalyco#16865, anomalyco#14279, anomalyco#29895 * opencode/run: refresh themes after terminal reloads (anomalyco#30917) * chore: generate * fix(tui): fall back to local cwd when editor spawns in attach mode (anomalyco#30583) * docs: update Go Qwen tiered pricing (anomalyco#30936) * chore: generate * feat(tui): add diff hunk navigation (anomalyco#30935) * chore: rm fuzzy search on references (anomalyco#30931) * fix: use mapError instead of orDie for context snapshot decoding (anomalyco#30905) Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> * fix(core): recover corrupted models cache (anomalyco#30947) * chore: bun install (anomalyco#30968) * fix(opencode): resolve Bedrock hang by using node build conditions (anomalyco#30873) * fix(workflows): retry nix-hashes compute-hash on transient failure (anomalyco#30743) * fix(stats): scroll model charts to latest on mobile * fix(opencode): prevent destructive edit matches (anomalyco#30932) * chore: generate * fix(core): respect v2 default agents (anomalyco#30969) * chore: generate * test(opencode): remove disposal event wait race (anomalyco#30971) * test(opencode): remove shell timeout output race (anomalyco#30974) * fix(opencode): gate reasoning summaries by provider (anomalyco#30973) * feat(core): admit v2 skill guidance (anomalyco#30843) * fix(workflows): serialize desktop release uploads (anomalyco#30978) * fix(stats): add mobile chart end spacing * chore: generate * sync release versions for v1.16.2 * feat(core): interrupt v2 session execution (anomalyco#30850) * chore: generate * feat(core): honor default session models (anomalyco#30982) * fix(core): harden model selection edges (anomalyco#30987) * fix(tui): show current location in working copies; order by created; change shortcut; tab to cycle actions in dialog select (anomalyco#30989) * chore: generate * feat(core): compact v2 session context (anomalyco#30986) * fix(opencode): terminate help output with newline (anomalyco#30992) * fix(opencode): honor Bedrock Mantle config (anomalyco#31001) * fix(core): preserve model request semantics (anomalyco#30990) * chore: generate * feat(core): bound v2 tool output (anomalyco#30999) * chore: generate * fix(core): scope Vertex provider transforms (anomalyco#31004) * feat(core): expose session model switching (anomalyco#31011) * fix(tui): update tool spacing before layout * fix(core): recover v2 context overflow (anomalyco#31005) * fix(core): validate public session model switches (anomalyco#31012) * feat(tui): delete working copies from move dialog (anomalyco#31017) * chore: generate * fix(tui): bootstrap new project copies (anomalyco#31019) * fix(opencode): limit generated project copy names (anomalyco#31022) * fix(tui): inject reminder after moving session (anomalyco#31027) * fix(session): respect directory filter with workspaces (anomalyco#30804) * feat(app): improve servers UI (anomalyco#30961) * chore: generate * feat(app): updates to project avatar (anomalyco#30964) * chore: generate * feat(app): sessions list improvements (anomalyco#30941) * chore: generate * fix(core): scope v2 prompt cache by session (anomalyco#31036) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> * fix(stats): filter market share to go * fix(app): increase project session limit and add scrolling (anomalyco#31035) * fix(core): make V2 reads media-aware and binary-safe (anomalyco#31038) * chore: update nix node_modules hashes * feat(opencode): add search to auth logout command (anomalyco#31053) * feat(opencode): support non-interactive MCP add (anomalyco#31054) * feat(http-recorder): prepare public beta release (anomalyco#31018) * refactor(core): simplify filesystem mutation protocol (anomalyco#31059) * refactor(core): simplify filesystem read protocol (anomalyco#31058) * chore: update nix node_modules hashes * refactor(core): simplify search root protocol (anomalyco#31060) * feat: desktop v2 everything WSL (anomalyco#23407) * chore: generate * fix(core): bound prompt cache session keys (anomalyco#31062) * fix(core): enforce V2 tool permissions (anomalyco#31061) * feat(opencode): fff search tools (anomalyco#27802) Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> * chore: generate * chore: update nix node_modules hashes * fix: background agent prompting, lets kill this sleep behavior oml (anomalyco#31162) * test: fix tool test (anomalyco#31163) * docs: fix MCP header interpolation example to {env:VAR} (anomalyco#31078) Co-authored-by: wujunchen <wujunchen@baidu.com> * chore(http-recorder): disable release automation (anomalyco#31160) * refactor(core): unify v2 tool architecture (anomalyco#31168) * fix(core): use static tool type imports (anomalyco#31170) * docs(v2): update permission rule naming (anomalyco#31167) * fix(core): isolate image normalization (anomalyco#31165) * fix(test): release Windows search handles (anomalyco#31172) * fix(core): harden unified tool runtime (anomalyco#31171) * test(core): cover managed output read permissions (anomalyco#31166) * fix(core): preserve session failure causes * refactor(server): canonicalize service API (anomalyco#31049) * chore: generate * chore: update nix node_modules hashes * fix(tui): sort connect providers alphabetically (anomalyco#30891) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com> * feat(desktop): make updates persistent and responsive (anomalyco#31191) * chore: generate * refactor(tui): extract standalone package (anomalyco#31193) * chore: generate * chore: update nix node_modules hashes * fix(app): refresh directory MCP status (anomalyco#31194) * feat(desktop): open attachments in active project (anomalyco#31192) * chore: generate * fix(desktop): style home session scrollbar (anomalyco#31202) * fix(desktop): disable hidden agent cycling (anomalyco#31207) * test(core): cover skill directory output (anomalyco#31263) * fix(opencode): avoid duplicate skill catalog (anomalyco#31269) * chore(opencode): update MCP SDK to 1.29.0 (anomalyco#31268) * chore: generate * chore: update nix node_modules hashes * run: make minimal mode more minimal (anomalyco#31227) * chore: generate * chore: update web and desktop code owners (anomalyco#31289) * fix(desktop): few WSL bugs (anomalyco#31095) * chore: generate * fix(opencode): respect MCP server capabilities (anomalyco#31271) * console: update email * zen: fix * fix(opencode): include acp pending tool input (anomalyco#31321) * fix(lsp): resolve JDTLS root to topmost pom.xml in Java Maven multi-module projects (anomalyco#28761) Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> * chore: generate * fix(session): merge per-call tool rules into session permission (anomalyco#30529) Co-authored-by: Simon Klee <hello@simonklee.dk> * docs(go): update MiniMax M3 pricing (anomalyco#31350) * sync: merge upstream/dev catch-up (629 commits) (#31) * fix(app): mount shortcuts per titlebar tab (anomalyco#33567) * fix(tui): normalize autocomplete attachments * refactor(core): drop filesystem entry mime * fix(app): use fixed titlebar tab widths (anomalyco#33572) * refactor(schema): extract shared public schemas (anomalyco#33571) * chore: update nix node_modules hashes * fix(app): throttle directory tree loading (anomalyco#33576) * refactor(core): remove schema forwarding facades (anomalyco#33577) * fix(app): create scoped drafts from home (anomalyco#33578) * feat(cli): add API request command * fix(tui): sort model picker by release date (anomalyco#33558) * chore: generate * fix(app): clear viewed session notifications (anomalyco#33574) * fix(app): route new sessions through tabs (anomalyco#33582) * fix(mcp): bind oauth callback to IPv4 loopback (anomalyco#30022) * fix(opencode): restore v1 account config (anomalyco#33590) Co-authored-by: Test <test@opencode.test> * refactor(app): simplify layout hierarchy (anomalyco#33588) * fix(mcp): restore legacy tool names (anomalyco#33593) * fix(skill): emit base directory as filesystem path, not file:// URL (anomalyco#33580) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> * chore: generate * fix(mcp): prevent resource key collisions (anomalyco#33596) * feat(app): update all components to use v2 tokens (anomalyco#33598) * chore: generate * deps: update OpenTUI to 0.4.2 (anomalyco#33610) * chore: update nix node_modules hashes * fix(app): make session navigation stable and fast (anomalyco#33569) Co-authored-by: Brendan Allan <git@brendonovich.dev> * chore: generate * fix(app): share synced session data (anomalyco#33624) * refactor(app): rename cached context accessors (anomalyco#33627) * ci: notify the current Discord alert role * feat(console): add support actions (anomalyco#33492) * feat(tui): add diff viewer keybind (anomalyco#33365) * chore: generate * fix(app): always apply safe area insets (anomalyco#33619) * feat(tui): add main branch source to diff mode (anomalyco#30942) * fix(enterprise): use delete for remove share * tui: fix multi-day duration formatting (anomalyco#33651) Report elapsed days and remaining hours instead of showing zero days and the total duration as hours. Close anomalyco#32957 Close anomalyco#32956 * docs(llm): propose AI library design (anomalyco#33666) * chore: generate * refactor(ui): isolate session components (anomalyco#33670) * chore: update nix node_modules hashes * zen: migrate to new inference * fix(stats): strip locale prefixes from data routes * refactor(stats): simplify locale prefix stripping * feat(mcp): append server instructions to context (anomalyco#32490) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> * chore: generate * fix(mcp): hide denied resource template tool (anomalyco#33686) * refactor(core): simplify model requests * feat(core): generate model variants * chore: generate * zen: track model tier in stats * fix: restore dev CI (anomalyco#33701) * tui: remove logo animation (anomalyco#33633) Render branding as a static logo to avoid continuous redraws and mouse-driven visual effects. * sync release versions for v1.17.10 * refactor(schema): extract public event definitions (anomalyco#33579) * chore: generate * chore: update nix node_modules hashes * docs: add GMI Cloud provider entry to providers directory (anomalyco#32914) * fix(opencode): always print MCP OAuth URL (anomalyco#33716) * fix(core): scope fff broad scanning * fix(core): disable fff broad scanning * fix(core): handle unavailable fff index * fix(core): preserve unconfigured console models * fix(core): lower OpenAI text verbosity * feat(core): add session snapshot and revert system (anomalyco#33226) * chore: generate * fix(app): remove session loading stripe (anomalyco#33649) Co-authored-by: Test <test@opencode.test> * refactor(protocol): extract server contracts (anomalyco#33708) * refactor(app): centralize session state (anomalyco#33641) * chore: generate * fix(app): clear late session notifications (anomalyco#33753) Co-authored-by: Test <test@opencode.test> * chore: update nix node_modules hashes * feat(sdk): add HttpApi clients and embedded host (anomalyco#33445) * chore: generate * chore: update nix node_modules hashes * fix(app): separate provider lifetimes and reactive ownership (anomalyco#33739) * chore: generate * refactor(app): lift parent session navigation (anomalyco#33782) * chore: generate * feat(app): draggable tabs (anomalyco#31364) Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com> * chore: generate * feat(app): ui improvements (anomalyco#32438) Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com> * chore: generate * fix(app): close missing session tabs (anomalyco#33785) * fix(app): preserve todo dock across sessions (anomalyco#33778) * fix(app): remove produce default values in server session state (anomalyco#33793) * fix(app): update all v1 new-session icons (anomalyco#32017) Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com> * fix(storybook): support prompt state capture (anomalyco#33798) * feat(app): no sesssions empty state (anomalyco#33315) * chore: generate * feat(app): restyle v2 jump-to-latest button (anomalyco#33809) * fix(app): improve home action availability (anomalyco#33805) * fix(app): restore tab layout consistency (anomalyco#33804) * fix(app): reveal tab avatar on hover (anomalyco#33824) Co-authored-by: Test <test@opencode.test> * feat(app): add Chrome tab cycle shortcuts (anomalyco#33838) * Revert "deps: update OpenTUI to 0.4.2 (anomalyco#33610)" (anomalyco#33842) * fix(app): use project server for prompt drafts (anomalyco#33850) * chore: update nix node_modules hashes * fix(client): exclude generated files from formatting (anomalyco#33832) Co-authored-by: Test <test@opencode.test> * feat(ui): publish ui package (anomalyco#33681) * sync release versions for v1.17.11 * fix(app): hide mobile titlebar setting in production (anomalyco#33894) * chore: update nix node_modules hashes * feat(server): add permission request endpoints (anomalyco#33774) * chore: generate * feat(app): improve titlebar tab layout (anomalyco#33914) * feat(stats): add i18n support (anomalyco#33693) * fix(app): suspend while recent models load (anomalyco#33921) * chore: generate * docs(schema): document package conventions (anomalyco#33768) * fix(app): restore new layout shortcuts (anomalyco#33929) * refactor(schema): normalize module patterns (anomalyco#33770) * chore: generate * zen: migrate to new inference * zen: new inference * fix(app): adjust home search and header layout (anomalyco#33923) * fix(tui): load root sessions in session switcher (anomalyco#33931) Request root sessions before applying the session list limit so child sessions cannot crowd roots out of the switcher. Keep the synchronized cache available while requests are pending or fail, reconcile results with live updates, and retain current and pinned sessions. Preserve selection by session ID when asynchronous results reorder the list. Closes anomalyco#16270 Closes anomalyco#32725 * fix(app): persist home project selection (anomalyco#33935) * chore: generate * refactor(schema): tighten public contracts (anomalyco#33771) * chore: generate * refactor(schema): isolate v1 contracts (anomalyco#33769) * feat(app): group prompt projects by server (anomalyco#33941) * feat(sdk): restore session runtime operations (anomalyco#33777) * chore: generate * refactor(core): support tiered layer nodes (anomalyco#33937) * chore: generate * fix(app): use tab-scoped servers in sessions (anomalyco#33946) * fix(app): enable composer shortcuts on drafts (anomalyco#33956) * refactor(app): split session composer (anomalyco#33954) * chore: generate * fix(mcp): scope auth status to server URL (anomalyco#33924) * chore: generate * feat(llm): pass strict through tool definitions for Codex parity (anomalyco#33392) * fix(app): simplify question prompt (anomalyco#33968) Co-authored-by: Test <test@opencode.test> * feat(core): split MCP timeout configuration (anomalyco#33977) Co-authored-by: Test <test@opencode.test> * fix(core): refine small model defaults (anomalyco#33926) * tweak: hide MCP access token prefix (anomalyco#33711) * fix(app): enable auto-accept in session settings (anomalyco#33974) * fix(app): suspend hidden terminal renderer (anomalyco#33990) Co-authored-by: Test <test@opencode.test> * fix(ui): normalize tooltip trigger layout (anomalyco#33979) Co-authored-by: Test <test@opencode.test> Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> * refactor(opencode): stop legacy v2 event emission (anomalyco#33993) * fix(sdk): wake embedded session execution (anomalyco#33992) * feat(sdk): expose active sessions (anomalyco#33991) * chore: generate * fix(app): bump ghostty-web to prevent terminal resize hangs (anomalyco#34020) Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> * chore: update nix node_modules hashes * refactor(app): use dropdown for project selector (anomalyco#33984) * refactor(app): replace tab drag handling with dndkit (anomalyco#33880) Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> * chore: generate * feat(oauth): unify OAuth callback browser pages (anomalyco#34025) * chore: update nix node_modules hashes * feat(app): refine session UI styling (anomalyco#33860) Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> * chore: generate * core: prevent UI imports compiling TSX source * fix(tui): preserve renderer initialization errors (anomalyco#33996) Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> * fix(opencode): preserve skill resource paths (anomalyco#34052) * fix(core): refresh cached remote skills (anomalyco#34059) * fix(acp): surface prompt errors (anomalyco#34061) * feat(app): updates to design system (anomalyco#34066) * fix(acp): skip resume transcript replay (anomalyco#34070) * fix(mcp): refresh credentials on reauthentication (anomalyco#33717) * tweak: update OAuth callback branding (anomalyco#34081) * fix(llm): omit stateless response item ids (anomalyco#34027) * fix(core): enlarge OAuth callback card (anomalyco#34082) * feat(app): add new session workspace controls (anomalyco#34085) * fix(app): consolidate add project action (anomalyco#34086) * fix(acp): enrich permission prompts (anomalyco#34079) * docs(providers): document blacklist and whitelist model filtering (anomalyco#33792) * fix(app): wait for persisted home state before reading collapsed state (anomalyco#34088) * fix(acp): send partial completed tool updates (anomalyco#34091) * fix(data): canonicalize locale pages * docs: route enterprise contact links (anomalyco#34080) * fix(data): clarify unchanged rank * feat(stats): add clickable section headings (anomalyco#34095) * chore: generate * fix(core): resolve prompt attachment mime types * chore: generate * fix(core): authorize external read paths * fix(llm): end reasoning before responses * chore: generate * fix(app): animate prompt selectors after loading (anomalyco#34101) * feat(api): add finite durable session history pages (anomalyco#34097) * chore: generate * fix(app): slow tooltip display for models (anomalyco#30745) Co-authored-by: affanali2k3 <affanalikhanxx@gmail.com> * chore: update nix node_modules hashes * feat(sdk): expose live event stream (anomalyco#34098) * chore: generate * fix(app): centralize notification state (anomalyco#34105) * zen: new inference * fix: apply lash-specific patches after upstream merge - Fix SolidJS accessor usage in question-dock (sdk → sdk()) - Remove dead session-prompt-dock.tsx (no imports, replaced by composer) - Update bun.lock * fix(tui): use generated event union (anomalyco#34118) Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> * fix(app): keep bare slash as plain inline code (anomalyco#34122) Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> * fix(app): hide home session archive action (anomalyco#34136) Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> * refactor(core): separate out location node functionality and integrate into v2 (anomalyco#34119) * chore: generate * fix(mcp): surface OAuth completion errors (anomalyco#34145) * fix(mcp): request refresh token scope (anomalyco#34125) * chore: update nix node_modules hashes * fix(app): migrate composer tooltips to v2 (anomalyco#34147) Co-authored-by: Jay V <air@live.ca> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> * feat(core): port v2 runtime fixes onto dev Cherry-picks the packages/core changes from the v2 branch onto dev: - combined ordered stdout/stderr in AppProcess + bash structured output - edit/apply-patch return FileDiff info with status and line stats - ignore no-op model switches; record reasoning timestamps - return unexpected local tool defects to the model and continue - keep OAuth account metadata out of request bodies - nest OpenAI reasoning effort/summary options - load OpenCode provider config asynchronously; batch plugin boot - export latest public event manifest Includes the supporting schema reasoning time field and regenerated client/SDK types. * chore: generate * fix(opencode): allow empty provider config default (anomalyco#34167) Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> * chore: update nix node_modules hashes * fix(app): space home sessions from scrollbar (anomalyco#34132) Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> * fix(ui): make select hover feedback immediate (anomalyco#34121) Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> * feat(app): update home screen alignment + markdown styles (anomalyco#34172) * fix(desktop): recognize normal auth metadata input prompts in connect provider dialog (anomalyco#33024) * fix(app): reconcile session pages with concurrent events (anomalyco#34042) * chore: generate * fix(app): batch new session tab navigation (anomalyco#34196) * feat(app): minor visual updates (anomalyco#34205) * refactor(core): make node build bind maps conditionally (anomalyco#34218) * feat(app): new debug bar (anomalyco#34237) * chore: generate * fix(tui): register `prompt.skills` keybinds (anomalyco#34180) * refactor(core): rename app node modules (anomalyco#34238) * chore: generate * test(core): cover app node builder graphs (anomalyco#34244) * refactor(core): move session test to nodes (anomalyco#34245) * chore: generate * refactor(core): move more tests to nodes (anomalyco#34248) * chore: generate * fix(app): transition draft project updates (anomalyco#34252) * fix(sdk): preserve V2Event name for SSE streams (anomalyco#34171) * chore: update nix node_modules hashes * feat(client): generate complete protocol client (anomalyco#34164) * fix(app): disable `add project` when given server is offline (anomalyco#34294) * fix(desktop): avoid destroyed window permission checks (anomalyco#34300) * zen: new inference * zen: update alert role * fix(mcp): reconnect after OAuth even when server is disabled Closes anomalyco#33915 * fix(mcp): clarify debug oauth probe (anomalyco#34350) * feat(desktop): Display stored totals for Tokens and Cost in Desktop Session Context (anomalyco#28887) * chore: generate * fix(app): wrap model.set in startTransition (anomalyco#34351) * chore: generate * feat(tui): integrate ServerAuth headers into transport configuration for external served TUI thread (anomalyco#29876) * refactor(core): refine layer node replacements (anomalyco#34377) * chore: generate * test(core): fix layer node replacement type expectation (anomalyco#34386) Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> * fix(app): disable empty server chevron (anomalyco#34292) * zen: budget * zen: budget * feat(app): sticky session list header (anomalyco#34220) Co-authored-by: Brendan Allan <git@brendonovich.dev> * feat(app): show loader on session hover (anomalyco#34224) * chore: generate * fix(tui): use V2Event after upstream SSE name preservation (anomalyco#34171) Upstream renamed the SSE event union back to `V2Event` (no `V2Event1` suffix). Drop the alias import. LAC-2490 --------- Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Co-authored-by: Dax Raad <d@ironbay.co> Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Test <test@opencode.test> Co-authored-by: Chris Yuan <honglong@gmail.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Aarav Sareen <96787824+arvsrn@users.noreply.github.com> Co-authored-by: Simon Klee <hello@simonklee.dk> Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> Co-authored-by: Brendan Allan <git@brendonovich.dev> Co-authored-by: vimtor <vn4varro@gmail.com> Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> Co-authored-by: Frank <frank@anoma.ly> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: 4rcadia <97033226+Arcadi4@users.noreply.github.com> Co-authored-by: opencode <opencode@sst.dev> Co-authored-by: Isaac Huang <isaac.h@gmicloud.ai> Co-authored-by: Dax <mail@thdxr.com> Co-authored-by: James Long <longster@gmail.com> Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com> Co-authored-by: Ariane Emory <97994360+ariane-emory@users.noreply.github.com> Co-authored-by: Stefan Avram <98915060+Slickstef11@users.noreply.github.com> Co-authored-by: Affan Ali <93028901+affanali2k3@users.noreply.github.com> Co-authored-by: affanali2k3 <affanalikhanxx@gmail.com> Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> Co-authored-by: Jay V <air@live.ca> Co-authored-by: OpeOginni <107570612+OpeOginni@users.noreply.github.com> Co-authored-by: Ben Guthrie <benjee.012@gmail.com> Co-authored-by: Filip <34747899+neriousy@users.noreply.github.com> Co-authored-by: Max Anderson <max.a.anderson95@gmail.com> * fix(test): resolve shell/cwd unit-test failures surfaced by GitHub-hosted runners (LAC-2386) Three root causes, all environment-sensitive rather than runner-specific: 1. getCwd() silently degraded to process.cwd() when the ambient instance context was not entered. Effect-based callers (shell tool, session prompt, system prompt) now pass the instance directory as an explicit fallback, and the test fixture enters the ambient instance context the same way production bootstrap() does. This fixes the shell permission tests (permission ask hook never fired because the command resolved against the runner checkout dir instead of the test tmpdir) and the cwd.test.ts suite. 2. Upstream 0c9cfe9 removed the legacy Instance.current fallback from attach(), so lash tests calling AppRuntime.runPromise from plain async code lost InstanceRef. New test/fixture/app.ts runTestApp() provides InstanceRef explicitly (upstream's intended pattern) for prompt-missing-file, prompt-special-chars, and prompt-variant tests. 3. The cwd sentinel cleanup truncated everything after the sentinel, but stderr chunks from the merged output stream can arrive after the sentinel is written to stdout. stripSentinel() now splices out only the sentinel line, preserving late stderr (fixes 'shell captures stdout and stderr'). It also cuts at the sentinel itself rather than the start of its line so unterminated stdout sharing the sentinel's line survives (fixes 'shell completes a fast command'). Also resets the shell-mode cwd singleton between tmpdir instances so a cd from one test cannot leak into the next. * fix(test): repair remaining unit (linux) failures on GitHub-hosted runners (LAC-2386) - execution-mode-color-bar.test.ts read the prompt component source from its pre-sync location (packages/opencode/src/cli/cmd/tui/component/ prompt/index.tsx); the upstream sync moved it to packages/tui/src/ component/prompt/index.tsx, so the module-scope readFileSync threw ENOENT and bun reported an unhandled error between tests. Point the read at the new location — all 14 structural assertions still match. - run-process.test.ts gave the unknown-model regression test a 15s subprocess budget and asserted wall-clock < 15s. Cold CLI startup on loaded 2-core GitHub-hosted runners was observed at 15.2s, tripping the assertion without any hang. Raise budget to 30s (outer timeout 60s, matching sibling tests); a genuine anomalyco#27371-style hang still runs to the cutoff and fails the duration assertion. --------- Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Dustin Deus <deusdustin@gmail.com> Co-authored-by: starptech <starptech@starptechs-MBP.fritz.box> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Dax <mail@thdxr.com> Co-authored-by: Simon Klee <hello@simonklee.dk> Co-authored-by: James Long <longster@gmail.com> Co-authored-by: Aarav Sareen <96787824+arvsrn@users.noreply.github.com> Co-authored-by: Brendan Allan <git@brendonovich.dev> Co-authored-by: Ulises Jeremias <ulisescf.24@gmail.com> Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: Jack <jack@anoma.ly> Co-authored-by: Frank <frank@anoma.ly> Co-authored-by: Jérôme Benoit <jerome.benoit@sap.com> Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Dax Raad <d@ironbay.co> Co-authored-by: Ariane Emory <97994360+ariane-emory@users.noreply.github.com> Co-authored-by: LIU Xinyu <contact@lxy.cc> Co-authored-by: Colin McDonnell <colinmcd94@gmail.com> Co-authored-by: Sebastian <hasta84@gmail.com> Co-authored-by: opencode <opencode@sst.dev> Co-authored-by: Kamesh Sampath <kamesh.sampath@hotmail.com> Co-authored-by: Cortex Code <noreply@snowflake.com> Co-authored-by: pcadena-lila <pcadena@lila.ai> Co-authored-by: weiconghe <46336277+weiconghe@users.noreply.github.com> Co-authored-by: alberto <914199+alblez@users.noreply.github.com> Co-authored-by: mridul <65942753+rexdotsh@users.noreply.github.com> Co-authored-by: Dmitriy Kovalenko <dmitriy@iusevimbtw.com> Co-authored-by: fancivez <384514351@qq.com> Co-authored-by: wujunchen <wujunchen@baidu.com> Co-authored-by: Robert Douglass <rob@robshouse.net> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Filip <34747899+neriousy@users.noreply.github.com> Co-authored-by: huangli <areyouok@gmail.com> Co-authored-by: Tommy D. Rossi <beats.by.morse@gmail.com> Co-authored-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Co-authored-by: Test <test@opencode.test> Co-authored-by: Chris Yuan <honglong@gmail.com> Co-authored-by: vimtor <vn4varro@gmail.com> Co-authored-by: 4rcadia <97033226+Arcadi4@users.noreply.github.com> Co-authored-by: Isaac Huang <isaac.h@gmicloud.ai> Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com> Co-authored-by: Stefan Avram <98915060+Slickstef11@users.noreply.github.com> Co-authored-by: Affan Ali <93028901+affanali2k3@users.noreply.github.com> Co-authored-by: affanali2k3 <affanalikhanxx@gmail.com> Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> Co-authored-by: Jay V <air@live.ca> Co-authored-by: OpeOginni <107570612+OpeOginni@users.noreply.github.com> Co-authored-by: Ben Guthrie <benjee.012@gmail.com> Co-authored-by: Max Anderson <max.a.anderson95@gmail.com>
Summary
This draft PR builds the Effect-native embedded OpenCode V2 foundation needed by local-first consumers such as OpenCord. It separates durable prompt admission from execution, routes Sessions through Location-scoped runtime graphs, refines the existing durable Session event model with replay-safe cursors and projection hardening, and adds the first Core-owned coding-agent tool catalog.
The ordinary V1 Session path remains the default. The new embedded runner and
session.next.*contracts remain experimental and opt-in while the remaining prompt-loop parity slices are designed and reviewed.What This Adds
Embedded Session Runtime
@opencode-ai/core/opencodefacade.session_inputinbox.steerandqueuedelivery modes.SessionStore -> LocationServiceMap -> SessionRunner.Native Provider Loop
llm.stream(request)provider turn at a time.Provider timeout, retry, and watchdog policy is intentionally deferred. The runner does not impose a universal inactivity or absolute stream timeout. A later slice should add bounded pristine-attempt retries and configurable provider-specific watchdogs deliberately.
Durable Events And Replay
session.next.*event family and projected Session-message model; this branch does not introduce them.session_inputinbox storage and delivery-aware pending indexes.session_message.seqand covering indexes so projected history follows durable aggregate order rather than timestamps or caller IDs.EventV2.Cursor.Tool Foundation
Adds Location-scoped Core-owned tools:
readwriteeditapply_patchglobgrepbashquestiontodowriteskillwebfetchwebsearchImportant behavior:
writepreserves UTF-8 BOM semantics.apply_patchpreserves sequential non-transactional behavior while reporting partial application honestly, using create-only add semantics, rejecting malformed grammar, and rejecting moves until their semantics are hardened.readpages oversized UTF-8 files with bounded line and byte limits rather than rejecting them.tool-output://resources with bounded paging and payload-size integrity checks.bashfollows normal configured-rule and saved-approval permission semantics. It remains foreground-only until owner-bound observation, cancellation, durable status, and completion delivery exist.webfetchfollows V1-like HTTP(S) hostname and redirect behavior while retaining requested-URL permission checks, timeout caps, response-size bounds, and text conversion.skilltool reuses the single Location-scopedSkillV2registry, bounds selected-skill output, and hardens remote discovery against cache-path traversal and cross-origin resource fetches.Shared Runtime Foundations
BackgroundJobregistry and keeps the legacy OpenCode adapter instance-scoped; V2 model-facing background execution remains deferred.PluginV2lifecycle: plugin child scopes now close with their Location layer, and same-ID add/remove operations serialize.SystemContextalgebra with namespaced keys, own-property-safe checkpoints, and duplicate-key validation at the interpreter boundary.SessionSystemContextscaffold for Location environment and date facts. It is not wired into provider request assembly yet.HTTP API And SDK
Legacy Compatibility
Draft Blockers Before Broad Exposure
This remains intentionally draft. The foundation is useful for supervised embedded canaries, but it is not a drop-in replacement for the full V1 prompt loop yet.
Highest-priority follow-ups:
AGENTS.md, nearby nested instructions, skills guidance, and plugin transforms.wait, and expose the remote lifecycle needed by HTTP consumers.SystemContextremoval semantics and wireSessionSystemContextinto provider request assembly.The detailed ledger and deferred hardening list live in:
Schema Changes
session.next.*family rather than introducing it: streamed deltas become ephemeral and embedded replay cursors become explicit.Pre-launch
session.next.*databases remain disposable experimental state. Reset experimental V2 data when upgrading across incompatible event-schema iterations. This is not a rolling-upgrade compatibility claim for previously persisted experimental histories.Verification
Passed locally after the latest stabilization commit:
The complete Core CI suite remains independently red only in the existing macOS filesystem-watcher readiness tests:
Refreshed GitHub Actions are running after push.