Dashboard › opencode › Distillation
bde61293-57e4-4118-9e56-8ea4c4f5d3f2["lore_tm_v1_5A5gN9Q8l1OurArylvHJWhZeGnLK2nDCtDzPwyPrdHc","lore_tm_v1_wtrA7Vd6FDYD3EEWTideoY8OICPZZJfT_FKhtNSNoig","lore_tm_v1_WQth-JkoSQcEMUXv3fS4j36T0-fvwNzsJ2Df7KTvNyM","lore_tm_v1_1GQzOBTP0WLaZLZ493brE28yd6QWz1DcjxHeVrOUqKs","lore_tm_v1_XFOpzEzLGWSRRKo9WEwGzgTXDxVqJCNtQPrXcmvRzwM","lore_tm_v1_WHm9OL1G2n3Jt5x468dKMyBceTEJRV6iiN1D-gIt4gk","lore_tm_v1_wBY2BLU6CS0FeOO2XUelZLhQazm6ivOjDPoHfhNkDsU","lore_tm_v1_-XH43xorgnsqf9Fy4UUGGaLluv7ZNTTBMWStd-QpN7I","lore_tm_v1_iRUvvS1dsEJlpdRpld9qyaXTRu1pQJd82GbjV9M4ff4","lore_tm_v1_6Wg9c_QXxIoh7itZp5x6kuhAP1Ds_gNX8w1TuidpyDk","lore_tm_v1_riWmoWnh-QVdRPziW1PhVOx1gyhfbzupteC92r1JeeM","lore_tm_v1_aoqS01n79p7tcA0Gf3giMENdDVMCniTV1y2rrgrHjwM","lore_tm_v1_GyI-Oro3p7N0tjwTXGv4h_bSEG5Zy5z3HhEO5vE6xH4","lore_tm_v1_xVAwLvqU5OAYH3sbLO90HnaVNXTA_GQbW9Yvt4uSWAo","lore_tm_v1_AaRl6IKg4b_LKmWv0U0oZMNySR91HiOCV9OOrFQvlgU","lore_tm_v1_AIH0wYwu0ISyhYZyu3LhtJ4ZXUiJ8ETjEjtBTPbA_d4","lore_tm_v1_ZI9SI07h0UixVcQUMQI9d_YFAzSCrkiltjvEdNwYcjA","lore_tm_v1_iKRnI01FBgPegGUKI5qpYbcqqJLOvw2DfonWbmIVtAk","lore_tm_v1_KqX1kffiEeSFnZH2JLyWhwbg5LDvP7-wF5_27hJzp4U"]
Date: Sep 16, 2026
/tmp/opencode/session-recovery-final-v5.patch with SHA-256 49183f9e082f71a26d07ce8bf7dd2b391214908f3d07637a3c02163fe20826c7./home/byk/Code/opencode/packages/opencode/dist/server/opencode-server with SHA-256 f08e78a61ef53f72a9810cc09facbe2d181c63f6a14231a95d66d16de44a80ed.ab9408c81cc9916177641ae8e9f08624fc27b5b9 and tree d3323b963b9ef2de41a7ff9884299c74b93886ba.packages/core/schema.json; packages/core/src/database/migration.gen.ts; packages/core/src/database/migration/20260914170650_session-recovery.ts; packages/core/src/database/schema.gen.ts; packages/core/src/session.ts; packages/core/src/session/compaction.ts; packages/core/src/session/context-epoch.ts; packages/core/src/session/execution/claim.ts; packages/core/src/session/execution/local.ts; packages/core/src/session/input.ts; packages/core/src/session/message-updater.ts; packages/core/src/session/projector.ts; packages/core/src/session/recovery-id.ts; packages/core/src/session/recovery.ts; packages/core/src/session/run-coordinator.ts; packages/core/src/session/runner/index.ts; packages/core/src/session/runner/llm.ts; packages/core/src/session/runner/publish-llm-event.ts; packages/core/src/session/sql.ts; packages/core/test/database-migration.test.ts; packages/core/test/session-execution-local.test.ts; packages/core/test/session-projector.test.ts; packages/core/test/session-prompt.test.ts; packages/core/test/session-run-coordinator.test.ts; packages/core/test/session-runner-recorded.test.ts; packages/core/test/session-runner-tool-events.test.ts; packages/core/test/session-runner.test.ts; packages/opencode/src/server/routes/instance/httpapi/server.ts; packages/schema/src/session-event.ts; packages/schema/test/event-manifest.test.ts; packages/sdk/js/src/v2/gen/types.gen.ts; packages/sdk/openapi.json; packages/server/src/routes.ts.ab9408c81cc9916177641ae8e9f08624fc27b5b9 with tree d3323b963b9ef2de41a7ff9884299c74b93886ba, confirmed the isolated index accepted the patch cleanly, and confirmed exactly 33 changed files./tmp/opencode, without reading candidate source from the mutable repository worktree; review directory was /tmp/opencode/session-recovery-review-v5-49183f9e, and an additional reported object/hash was d7c7ac9d3aa5606d2b8adf965fd584cd37494110.sdk-next composes Client, Core, and Server.HttpApi changes to be followed by bun run generate from packages/client; src/generated and src/generated-effect must not be edited directly. Legacy JavaScript SDK regeneration uses ./packages/sdk/js/script/build.ts.dev; local main may not exist, so diffs should use dev or origin/dev.feat/ or fix/; examples include session-recovery, fix-scroll-state, and regenerate-sdk.type(scope): summary form. Valid types are feat, fix, docs, chore, refactor, and test; scopes are optional and may include core, opencode, tui, app, desktop, sdk, or plugin.import { foo as bar } from "..." and resolve as pathResolve.import * as Foo from "..." and import type * as Foo from "...". Namespace-style usage must import a module’s own exported namespace by name, such as import { Project } from "@opencode-ai/core/project" followed by Project.ID.await import("./module").then((mod) => mod.value()) and (await import("./module")).value() are disallowed, and branch-specific imports should remain inside their branch.bun typecheck to be run from package directories such as packages/opencode, never tsc directly.packages/opencode, never repository root; root package.json deliberately defines test as echo 'do not run tests from root' && exit 1.try/catch, any, unnecessary destructuring, let, reassignment, and else; prefer Bun APIs, inferred types, functional array methods, const, ternaries, and early returns; inline values used only once to reduce variable count.Effect from synchronous helpers. Prefer Schema.UnknownFromJsonString and Schema.decodeUnknownOption over manual JSON.parse inside Effect.try.snake_case, avoiding explicit string remapping such as projectID: text("project_id").globalThis.* unless it is the only option, and test actual implementation rather than duplicating implementation logic.SessionV2.prompt(...) admits exactly one durable session_input before advisory SessionExecution.wake(sessionID), unless resume: false requests admit-only behavior; the serialized runner promotes admitted inputs at safe boundaries.SessionExecution to remain process-global and Session-ID based. Its local implementation owns the process-local Session coordinator and discovers placement through SessionStore plus LocationServiceMap.get(session.location) only when a drain starts; V2 interruption targets the active process-local ownership chain, and idle or missing interruption is a no-op.SessionRunner, model resolution, tool registry, permissions, and filesystem to remain Location-scoped. Omitted Location.workspaceID means implicit-local placement; explicit workspace identity is reserved for future placement semantics.llm.stream(request) call per provider turn and projected-history reload before durable continuation; orchestration must not bridge through legacy SessionPrompt.loop(...) or an in-memory tool loop.SessionRunCoordinator joins explicit same-Session resumes, coalesces prompt wakeups, and permits different Sessions concurrently. Advisory wakes only drain eligible durable inbox rows; post-crash provider-work recovery requires a separate explicit design. A drain has no durable identity or transcript boundary.queue inputs remain pending until the Session would otherwise idle, then one queued input is promoted and continuation is reevaluated before another; any promoted user input resets the selected agent’s provider-turn allowance, with a steer batch resetting it once.src/system-context; Context Source producers stay with their observed domains; Session History selection and Context Epoch persistence remain Session-owned.@opencode-ai/schema owns browser-safe wire/storage contracts and must preserve @opencode-ai/schema <- @opencode-ai/protocol <- @opencode-ai/server; runtime behavior, service layers, side effects, registries, and host-local details remain in owning domain packages.Session, Permission, Question); retained compatibility contracts are explicitly V1 (SessionV1, PermissionV1); V2 must not remain the permanent replacement-architecture name. New/current code must not depend on the future src/v1/ subtree.current, shared transitional, or V1-only; V1 emission alone does not justify Protocol/SDK Next inclusion. V1-only events including message.updated and message.part.* must stay out of current Protocol/SDK Next unless a current-client requirement is documented.PluginID, PluginEvent, PtyInfo, PtyEvent, and SessionTodoInfo; Core facades must re-export the exact canonical Schema value rather than creating a second identity.optional(...) so encoded objects omit undefined, avoid Schema.Any, use Schema.Json for JSON-serializable values and Schema.Unknown for opaque values, and use same-name interfaces for public Schema.Struct records.create(); new generated ID schemas must validate exactly the emitted prefix including _; legacy loose validators must not be tightened without an explicit compatibility/migration decision; public schema identifiers and brands must be unique and stable.packages/core/src/**/*.sql.ts; migrations live in packages/core and are applied by Core.bun dev from packages/opencode to run in detached tmux when inspection is needed: start with tmux new-session -d -s opencode-dev 'bun dev', inspect using tmux capture-pane -pt opencode-dev, and stop using tmux kill-session -t opencode-dev.export namespace Foo { ... } for module organization. Modules use flat top-level exports and self-reexports such as export * as Foo from "./foo"; index.ts uses export * as Foo from ".". Multi-sibling directories such as src/session/ and src/config/ must not gain barrel index.ts files; consumers import specific siblings.Effect.gen(function* () { ... }), Effect.fn("Domain.method") for named/traced effects, Effect.fnUntraced for internal helpers, Effect.callback for callback APIs, Effect.void rather than successful undefined, and DateTime.nowAsDate rather than constructing Date from Clock.currentTimeMillis.makeRuntime from src/effect/run-service.ts for all services and InstanceState from src/effect/instance-state.ts for per-directory/project state and cleanup. Work belongs directly in InstanceState.make; cleanup uses Effect.addFinalizer or Effect.acquireRelease; background consumers use Effect.forkScoped; non-blocking init() forks InstanceState.get(state) at the call site, not inside the closure.Effect.fork and Effect.forkDaemon; use Effect.forkIn(scope).FileSystem.FileSystem over fs/promises, ChildProcessSpawner.ChildProcessSpawner with ChildProcess.make(...) over custom wrappers, HttpClient.HttpClient over raw fetch, and Path.Path, Config, Clock, and DateTime within Effect code. Scheduled/background work uses Effect.repeat or Effect.schedule with Effect.forkScoped.Effect.cached to deduplicate concurrent in-flight work instead of manually storing Fiber | undefined or Promise | undefined; native/external callbacks re-entering Effect use EffectBridge, while plain async code passes explicit context or remains inside an Effect fiber.HttpApiBuilder.group(...); SSE returns HttpServerResponse.stream(...) and declares HttpApiSchema.asText({ contentType: "text/event-stream" }); declared raw/WebSocket routes use handleRaw(...); raw HttpRouter.use(...) is only for routes outside the declared API surface.Effect.provide(SomeLayer) and discourages HttpRouter.provideRequest(...) except for intentionally request-level dependencies. Effect.provideService(...) middleware is limited to request-derived context such as WorkspaceRouteContext, InstanceRef, or WorkspaceRef.Schema.ErrorClass endpoint contracts. Built-in HttpApiError.* is allowed only when its empty/tagged body is the intended wire shape; SDK-visible errors with messages require an exact API error schema such as ApiNotFoundError. Domain/storage services stay free of HttpApi types, with expected errors translated at the handler boundary.1.3.14; root scripts include "typecheck": "bun turbo typecheck", while packages/core, packages/schema, and packages/server each expose "typecheck": "tsgo --noEmit". The required invocation remains bun typecheck from each package directory, never direct tsc.packages/core/package.json exports ./session/runner from ./src/session/runner/index.ts and ./system-context from ./src/system-context/index.ts; @opencode-ai/core version is 1.18.30.@opencode-ai/schema depends only on effect at runtime and exports "." as ./src/index.ts plus "./*" as ./src/*.ts.@opencode-ai/server version 1.18.30 depends on @opencode-ai/core, @opencode-ai/protocol, drizzle-orm, and effect, and exports "./*" as ./src/*.ts.