Dashboard › opencode › Distillation
a731da48-fdf2-423a-b4fb-5e9571203c50["lore_tm_v1_JPvVjtfR8DhvGJeuOWjKY78KjnrDuHdmSUAef6ggJSk","lore_tm_v1_EK1X1fQ70eIUJE5eGbE3krlN5B7tdnt-Pl0NQ3SvNaQ","lore_tm_v1_SkhbyH7FzeXjEoa1oy9CQycs6CkHwQe7wK-beFJofFo","lore_tm_v1_XWXIV7LFr5Ej2GAhflsgp1rVipMNb5h5Nm7I3GHNmyQ","lore_tm_v1_8Qt_7HWIF5ACURwdc5kjuFrS-1M8FG0r-0W22pY6-Ro","lore_tm_v1_8VOiV6z3Gp72e00V2_jryWeRUPcDuLUgyRgpCdN7NL8","lore_tm_v1_Fxqy5rAQGDznRNQ18sVAvnhgiKcIAbbIholLTFdWfmo","lore_tm_v1_UKSnEavKETsE-IGYhUWV3_Kpx0-rrEcdqw-14_IXFBA","lore_tm_v1_5n0G0P3wEWkVLsgcHJHpZyBcUldNlv2sHGSPlFLIB6M"]
Date: Sep 14, 2026
./packages/opencode/script/build.ts --single, it is run as ./packages/opencode/dist/opencode-<platform>/bin/opencode; replace <platform> with the actual platform, such as darwin-arm64 or linux-x64./home/byk/Code/opencode/CONTRIBUTING.md: UI or core product features require design review with the core team before implementation; PRs ignoring the guardrails will likely be closed./home/byk/Code/opencode/CONTRIBUTING.md identifies core areas: packages/opencode contains core business logic and server; packages/opencode/src/cli/cmd/tui/ contains the SolidJS/opentui TUI; packages/app contains shared SolidJS web UI components; packages/desktop is the Electron desktop app wrapping packages/app; packages/plugin is the source for @opencode-ai/plugin./home/byk/Code/opencode/CONTRIBUTING.md: bun install; bun dev; bun dev <directory> to run against another directory; bun dev . for the repository root; bun dev --help; bun dev serve; bun dev web; and production equivalents opencode --help, opencode serve, opencode web, and opencode <directory>.bun dev serve and defaults to port 4096; a custom port can be selected with bun dev serve --port 8080. The web app uses bun run --cwd packages/app dev after starting the server and normally serves at http://localhost:5173 or the similar port printed at startup. Desktop commands are bun run --cwd packages/desktop dev, bun run --cwd packages/desktop build, and bun run --cwd packages/desktop package./home/byk/Code/opencode/CONTRIBUTING.md: prefer bun run --inspect=<url> dev ...; bun dev spawn may be required to trigger server breakpoints from the TUI because ordinary bun dev runs the server in a worker thread. Separate debugging uses bun run --inspect=ws://localhost:6499/ --cwd packages/opencode ./src/index.ts serve --port 4096, then opencode attach http://localhost:4096; TUI debugging uses bun run --inspect=ws://localhost:6499/ --cwd packages/opencode ./src/index.ts. Alternatives include --inspect-wait, --inspect-brk, or export BUN_OPTIONS=--inspect=ws://localhost:6499/. VSCode "request": "launch" and the JavaScript Debug Terminal may map breakpoints incorrectly./home/byk/Code/opencode/packages/core/package.json defines @opencode-ai/core version 1.18.30, ESM ("type": "module"), private, with 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"; its binary is "opencode": "./bin/opencode".@opencode-ai/core exports ./effect/layer-node, ./effect/app-node, ./session/runner, ./system-context, and wildcard ./*. Conditional imports are #sqlite → ./src/database/sqlite.bun.ts for Bun/default and ./src/database/sqlite.node.ts for Node; #pty → ./src/pty/pty.bun.ts for Bun/default and ./src/pty/pty.node.ts for Node; #fff → ./src/filesystem/fff.bun.ts for Bun/default and ./src/filesystem/fff.node.ts for Node./home/byk/Code/opencode/packages/core/src/session/: projector.ts, compaction.ts, todo.ts, store.ts, sql.ts, schema.ts, run-coordinator.ts, revert.ts, prompt.ts, message.ts, message-updater.ts, input.ts, info.ts, history.ts, execution.ts, event.ts, error.ts, context-epoch.ts, runner/llm.ts, runner/to-llm-message.ts, runner/publish-llm-event.ts, runner/model.ts, runner/max-steps.ts, runner/index.ts, and execution/local.ts./home/byk/Code/opencode/packages/core/src/session/execution.ts: SessionExecution.Interface exposes active, resume(sessionID), wake(sessionID), and interrupt(sessionID); Service is identified as @opencode/v2/SessionExecution; node is an unbound global LayerNode; noopLayer reports an empty active set and makes resume, wake, and interrupt no-ops for compatibility with callers that only require durable Session recording./home/byk/Code/opencode/packages/core/src/session/execution/local.ts: the global local layer obtains SessionStore.Service and LocationServiceMap.Service, creates SessionRunCoordinator.make<SessionSchema.ID, SessionRunner.RunError>, resolves the Session with store.get(sessionID) when draining, dies with Session not found: ${sessionID} if absent, and invokes exactly runner.run({ sessionID, force }) under Effect.provide(locations.get(session.location)). Interrupt-only causes are not logged; other failures are logged as "Failed to drain Session" with sessionID. The service maps active to coordinator.active, interrupt to coordinator.interrupt, resume to coordinator.run, and wake to coordinator.wake; dependencies are [SessionStore.node, LocationServiceMap.node]./home/byk/Code/opencode/packages/core/src/session/run-coordinator.ts: coordination state is a process-memory Map<Key, Entry<E>>; each Entry has done, optional owner, pendingWake, and stopping. run(key) starts drain(key, true) when idle, joins the existing Deferred when active, or waits for a stopping entry before retrying. wake(key) sets one coalesced pendingWake on an active entry or starts drain(key, false) when idle. A successful drain with a pending wake starts a non-forced successor after Effect.yieldNow; a failed or interrupted drain with a pending wake installs a fresh successor entry. interrupt(key) sets stopping = true, clears pendingWake, interrupts the owner fiber, and is a no-op if no owner exists. Different keys can execute concurrently.SessionRunCoordinator map; SessionExecutionLocal shows no startup scan or automatic rehydration of active drains after process restart./home/byk/Code/opencode/packages/core/src/session/prompt.ts only re-exports AgentAttachment, FileAttachment, Prompt, and Source from @opencode-ai/schema/prompt./home/byk/Code/opencode/packages/core/src/session/input.ts: SessionInput.admit(db, events, input) first calls find(db, input.id) and returns an existing row if present; otherwise it publishes SessionEvent.PromptAdmitted with messageID, sessionID, timestamp, prompt, and delivery, requires event.durable.seq as admittedSeq, and on a defect retries find so a concurrently committed input can be recovered. Admission itself does not invoke the provider.SessionInput.projectAdmitted rejects an input ID already present in SessionMessageTable with SessionInput.LifecycleConflict, inserts into SessionInputTable using onConflictDoNothing(), and also raises LifecycleConflict if no row was inserted. SessionInput.projectPrompted atomically fills promoted_seq only for the matching unpromoted Session input, validates the stored projection, and can synthesize a historical input row with admitted_seq and promoted_seq both equal to the promoted sequence.SessionInput.equivalent requires identical delivery, sessionID, and encoded prompt JSON. Projection matching additionally requires equal timeCreated epoch milliseconds. SessionInput.hasPending checks for an unpromoted row by Session and delivery mode.SessionInput.promoteSteers(db, events, sessionID, cutoff) selects all unpromoted "steer" rows with admitted_seq <= cutoff, ordered ascending by admitted_seq, and publishes each as SessionEvent.Prompted. SessionInput.promoteNextQueued(db, events, sessionID) selects only the first unpromoted "queue" row in ascending admission order and returns false when none exists or publishes it and returns true./home/byk/Code/opencode/packages/core/test/session-runner.test.ts, /home/byk/Code/opencode/packages/core/test/session-runner-recorded.test.ts, /home/byk/Code/opencode/packages/core/test/session-run-coordinator.test.ts, /home/byk/Code/opencode/packages/core/test/session-prompt.test.ts, /home/byk/Code/opencode/packages/core/test/session-projector.test.ts, /home/byk/Code/opencode/packages/core/test/session-history.test.ts, and /home/byk/Code/opencode/packages/core/test/session-create.test.ts; the search returned 100 displayed matches and was truncated because more matches were available.