Dashboard › opencode › Distillation
d549cd76-f8e2-44c8-b6c8-9f5961c658a1["lore_tm_v1_oBKCEeJ5Nzo3r8wObiNkVaf3NQlPyv02MZ7Kt0_n4qw","lore_tm_v1_H7YneesodJj2MpRFwMQvR4RADKqSDczNT4DHc1g1PLQ","lore_tm_v1_kLt-mC9PaNONcZg-Co72JaFRhhCSZfmYTS3Jhb192h0","lore_tm_v1_hkIa3qwRFw58AjgmwTAIkCPaNiAx32to7ltw4nTe6wc","lore_tm_v1_WEenpgyCb05g-5DL0S82jUhlN_CS17yeOJCszIXqu4w","lore_tm_v1_XrLPO723vgaCebhtoou-t0tLu4lw9T3HXScz-VujQAI","lore_tm_v1_0ZuhIfquHptzVpnavva2nU8c4bc8P-l0fYzbgZhLGLs","lore_tm_v1_LTpGYvFDC6FIu0yAaVlhOFf17dX-guHNHO7V8oGw5Vs","lore_tm_v1_dk2CMAZlthYINvc_VcbW1f66p2-YrMkF4vweYJppe8E","lore_tm_v1_UBZ6b6bOHs8lVA7xFQRz-IwIgZ6Cj0PpkXiGingVtzI","lore_tm_v1_2DU7sTmw0eI_Kr9ihJM3y6O70AIJJY0B3LRkfkUS4Vk"]
Date: Sep 16, 2026
verified 33 patch entries, 33 applied paths, old/new blob identities./tmp/opencode/session-recovery-v7-check/packages/schema/AGENTS.md, /tmp/opencode/session-recovery-v7-check/packages/opencode/AGENTS.md, /tmp/opencode/session-recovery-v7-check/packages/opencode/src/session/llm/AGENTS.md, /tmp/opencode/session-recovery-v7-check/packages/opencode/src/server/routes/instance/httpapi/AGENTS.md, /tmp/opencode/session-recovery-v7-check/packages/opencode/test/AGENTS.md, /tmp/opencode/session-recovery-v7-check/packages/core/src/tool/AGENTS.md, and /tmp/opencode/session-recovery-v7-check/packages/opencode/test/server/AGENTS.md.packages/schema/AGENTS.md establishes schema-package boundaries: @opencode-ai/schema <- @opencode-ai/protocol <- @opencode-ai/server; contracts must be browser-safe and serializable; current contracts are unversioned while retained legacy contracts are explicitly V1; V1-only events such as message.updated and message.part.* stay out of current Protocol/SDK Next unless a current-client requirement is documented; public contracts are readonly; optional fields use optional(...); public Schema.Struct records use same-name interfaces; current public contracts avoid Schema.Any; current ID constructors expose create(); generated IDs validate their exact prefix including _; contract changes require focused tests.packages/opencode/src/server/routes/instance/httpapi/AGENTS.md requires normal and SSE endpoints to use HttpApiBuilder.group(...), with SSE handlers returning HttpServerResponse.stream(...) and success schemas using HttpApiSchema.asText({ contentType: "text/event-stream" }); declared raw/WebSocket endpoints use handleRaw(...); raw HttpRouter.use(...) is reserved for undeclared routes such as UI fallbacks; stable layers must be provided at the application boundary rather than via Effect.provide(SomeLayer) inside handlers; SDK-visible JSON errors must use explicitly declared Schema.ErrorClass contracts and expected domain errors are translated at the handler boundary../packages/opencode/script/build.ts --single, then run as ./packages/opencode/dist/opencode-<platform>/bin/opencode; replace <platform> with the target platform, for example darwin-arm64 or linux-x64.CONTRIBUTING.md states development requires Bun 1.3+; bun dev serve starts the headless API server on default port 4096, while bun dev serve --port 8080 selects port 8080; SDK/API changes require ./script/generate.ts; all PRs must reference an existing issue, remain small and focused, explain verification for logic changes, avoid long AI-generated descriptions, and use conventional prefixes including feat:, fix:, docs:, chore:, refactor:, or test:.packages/core/package.json identifies @opencode-ai/core version 1.18.30, requires module type module, and defines scripts db: bun drizzle-kit, migration: bun run script/migration.ts, fix-node-pty: bun run script/fix-node-pty.ts, test: bun test --only-failures, and typecheck: tsgo --noEmit.packages/core/src/database/migration/20260914170650_session-recovery.ts has ID 20260914170650_session-recovery; it adds session_input.wake_pending as non-null integer defaulting to false, adds session.wake_attempts as non-null integer defaulting to 0 with range 0..9007199254740991, and creates session_execution plus session_recovery.session_execution contains id, session_id, owner_id, nullable assistant_message_id, phase, time_created, expires_at, and nullable recovery_error; its primary key is id, allowed phases are 'ready', 'safe', 'unknown', and 'continue', session_id cascades on session deletion, session_execution_session_idx uniquely constrains session_id, and session_execution_owner_idx indexes owner_id.session_recovery contains session_id, execution_id, nullable assistant_message_id, continuation_message_id, phase, wake_pending defaulting to true, wake_attempts defaulting to 0, nullable recovery_error, and time_created; its primary key is execution_id, wake attempts are constrained to 0..9007199254740991, session/message/input foreign keys cascade on deletion, continuation_message_id is unique, and the wake-scanning index covers wake_pending, recovery_error, wake_attempts, time_created, and execution_id.packages/core/src/session/sql.ts defines MAX_WAKE_ATTEMPTS = Number.MAX_SAFE_INTEGER and SESSION_EXECUTION_LEASE_MS = 30_000; SessionRecoveryTable.phase permits "ready" | "unknown" | "continue", while SessionExecutionTable.phase permits "ready" | "safe" | "unknown" | "continue".packages/core/src/database/migration.gen.ts registers import("./migration/20260914170650_session-recovery") as the final entry in the generated migration list.packages/core/src/session/execution/claim.ts defines SessionExecutionClaim.Claim with sessionID, executionID, and ownerID; Values may update assistant_message_id and phase; Lost reports Session execution claim lost: ${claim.executionID}.packages/core/src/session/execution/claim.ts, claim ownership is valid only when session_id, execution id, and owner_id all match and expires_at > now. update() renews expires_at to now + SESSION_EXECUTION_LEASE_MS and dies with Lost if no row is updated; clear() applies the same live-claim predicate before deletion and dies with Lost if nothing is deleted; transaction() uses an immediate database transaction and renews the claim before running the supplied effect.