Dashboard › opencode › Distillation
b144d822-23b9-457b-aa70-c061ad4a0264["lore_tm_v1_gJV45wJN1f2BQ7i6QkQIG4bFnR0k7diJVU5lQCbIGac","lore_tm_v1_QRGBfuaakTNeRbIleD-9MJGS2PJFNFLNNXFrtEXiVCQ","lore_tm_v1_SSq3gr5V1l8fYOzoqqLd38XDp42XIDrpDyXQA3QzGu4","lore_tm_v1_xFPFpCA2lwpScMTNd4NRgpU-smfnfhd7YWGeRjgwWz4","lore_tm_v1_RLd4d7mFTlX-2JEWnnJOI5N5oJBi98bSxOUhmeYA09k","lore_tm_v1_7moqJaX_7dEjnoY8V3g9kKrEb5msUJ7tmBqs-KC0FtM","lore_tm_v1_ypn4UKLWtPngSqsIeAXftd87gXU6uoerwIbcFNQ-CR8","lore_tm_v1_TRo_qw6udms_fJV-wtMSyXNqOq1vR-uR-7XmEuDk1Zw","lore_tm_v1_eBseIWnYgmH_MxV95E-Mw1S0VeaQnp9v7xwSoJ9XxZk","lore_tm_v1_xJZstIi7euNXZA7STK0AQOMnqneZN2OSpfq7kVHIm2Y","lore_tm_v1_rV4iKSQi7MMb1-Q5ZHmZc3U68eOnNbDh98ji8iwCBH8","lore_tm_v1_XqtRx3lz_aOxC1Oyq6-MZ-RZvEuffnxV-yyl_3G_oKQ","lore_tm_v1_zlW868qVLKCI942OQcWMqL5oeKp27FaBXr8jqSgk9L8","lore_tm_v1_Q8q186-K7WD-fSTrO3vsVZaj-s12WrLG90CGHFmcL50"]
Date: Sep 17, 2026
bun typecheck from package directories such as packages/opencode; never run tsc directly.sdk-next composes Client, Core, and Server.import { foo as bar } from "..." or resolve as pathResolve.import * as Foo from "..." and import type * as Foo from "..."; namespace-style use should import a moduleβs own named namespace export./tmp/opencode/session-recovery-v21-review at detached HEAD ab9408c81cc9916177641ae8e9f08624fc27b5b9, matching the required base commit. SHA-256 values matched for /tmp/opencode/session-recovery-final-v21.patch (2ae4eea72024cafe8b69c0461063ee25cbf54608856cd258866b7f3b86620b36) and /home/byk/Code/opencode/packages/opencode/dist/server/opencode-server (aa98d64abb3bf6ac0ef88a940f9c41c6eb14ffeab3c3a7846921ba01ef46643d).packages/core/src/database/migration/20260914170650_session-recovery.ts, packages/core/src/session/execution/claim.ts, packages/core/src/session/recovery-id.ts, packages/core/src/session/recovery.ts, and packages/core/test/session-execution-local.test.ts.do-not-run-tests-from-root guard; tests must run from package directories such as packages/opencode.HttpApi, run bun run generate from packages/client; do not edit src/generated or src/generated-effect directly. Legacy JavaScript SDK regeneration uses ./packages/sdk/js/script/build.ts.SessionV2.prompt(...) durably admits one session_input row before advisory SessionExecution.wake(sessionID), unless resume: false requests admit-only behavior; the serialized runner promotes admitted inputs at safe boundaries.SessionExecution must remain process-global and Session-ID based; its local implementation owns the process-local Session coordinator, discovers placement only when a drain starts, and V2 interruption targets the active process-local ownership chain while idle or missing interruption is a no-op.SessionRunCoordinator joins explicit same-Session resumes, coalesces prompt wakeups, permits different Sessions to run concurrently, and keeps local drains process-local until clustering exists.llm.stream(request) call must be preserved per provider turn, projected history must be reloaded before durable continuation, and orchestration must not bridge through legacy SessionPrompt.loop(...) or an in-memory tool loop.queue inputs remain pending until otherwise idle, then exactly one queued input is promoted before continuation is reevaluated; promoting new user input resets the selected agentβs provider-turn allowance, with a steer batch resetting it once.export namespace Foo; use flat top-level exports and a self-reexport such as export * as Foo from "./foo" or export * as Foo from "." for an index.ts. Multi-sibling directories must not add barrel index.ts files.Effect.cached for concurrent in-flight deduplication rather than manually storing Fiber | undefined or Promise | undefined; Effect.fork and Effect.forkDaemon do not exist in Effect v4 beta, so use Effect.forkIn(scope).HttpApiBuilder.group(...) for declared endpoints, handleRaw(...) for declared raw/WebSocket routes, and raw HttpRouter.use(...) only outside the declared API surface. Stable services/layers must be provided at assembly boundaries rather than via Effect.provide(...) inside request handlers.@opencode-ai/schema <- @opencode-ai/protocol <- @opencode-ai/server; Schema owns browser-safe serializable contracts, while runtime behavior, services, side effects, and host-local implementation remain in their owning domain package.V1, and V2 must not remain the permanent naming for replacement architecture. Clearly V1-only events such as message.updated and message.part.* must stay out of current Protocol/SDK Next surfaces absent a documented current-client requirement.packages/core/package.json defines typecheck as tsgo --noEmit and test as bun test --only-failures; root package.json defines test as echo 'do not run tests from root' && exit 1 and uses package manager bun@1.3.14.packages/core/src/session/execution/claim.ts defines SessionExecutionClaim.Claim with sessionID, executionID, and ownerID; Lost; and operations update, renew, settleCancellation, clear, and transaction.packages/core/src/session/execution/claim.ts fences claim operations by matching session_id, execution id, owner_id, and expires_at > now. update renews expiry to now + SESSION_EXECUTION_LEASE_MS; phase guards allow "cancelled" only from "cancelling", prevent "cancelling" from updating already "cancelled" claims, and prevent ordinary updates in "cancelling" or "cancelled" phases. Missing updates/deletes die with SessionExecutionClaim.Lost.SessionExecutionClaim.settleCancellation only updates a live claim whose phase is "cancelling". SessionExecutionClaim.transaction uses an immediate database transaction and performs update(db, claim) before the supplied effect.packages/core/src/session/recovery-id.ts deterministically generates recovery assistant IDs as msg_recovery_${executionID} unless an existing assistant message ID is supplied, and continuation IDs as msg_recovery_continue_${executionID}.packages/core/src/database/migration/20260914170650_session-recovery.ts has ID 20260914170650_session-recovery; it adds session_input.wake_pending (integer DEFAULT false NOT NULL) and session.wake_attempts (integer DEFAULT 0 NOT NULL, constrained from 0 through 9007199254740991).20260914170650_session-recovery creates session_execution with fields id, session_id, owner_id, nullable assistant_message_id, phase, assistant_seq DEFAULT -1, time_created, expires_at, and nullable recovery_error. Allowed phases are 'ready', 'safe', 'unknown', 'continue', 'cancelling', and 'cancelled'; session_id references session(id) with ON DELETE CASCADE.20260914170650_session-recovery creates session_recovery with session_id, execution_id primary key, nullable assistant_message_id, continuation_message_id, phase, wake_pending DEFAULT true, wake_attempts DEFAULT 0 constrained through 9007199254740991, nullable recovery_error, and time_created. Foreign keys cascade from session, session_message, and session_input.20260914170650_session-recovery creates unique indexes session_execution_session_idx and session_recovery_continuation_message_idx, plus session_execution_owner_idx, session_execution_recovery_scan_idx, session_input_wake_pending_promoted_session_idx, and session_recovery_wake_pending_error_attempts_created_execution_idx.