Dashboard › opencode › Distillation
a974c6a3-c1ae-488d-9f24-271da7582233["lore_tm_v1_DVEMXzBZttmYGl89puILX-Q7Od4GfcnrpPSQcF22Qbk","lore_tm_v1_QJvOIh0HgX9plQDFHJbZDJ0N6rJYnducyMpZLV9Dyus","lore_tm_v1_X43ODzfYZN1USLaAMNUg8xKA49XANV7PbYcw3CMTdw8","lore_tm_v1_dBuWNq3QlA3qghYtKRTdceI6mVmuEtZ4Hymf4HI4FUY","lore_tm_v1_-oeYmptUMBoUgpZt8PCLTJ-pp5aH6F73aLvHsiIEutU","lore_tm_v1_2ACaYu1Q3XlKCuxAzGlxnbeUqm4FM56RfobYDdegXME","lore_tm_v1_TZz4UgkzsAdivpq4C5fsYfYQ117ulq8_UDGC5U_MCr0"]
Date: Sep 16, 2026
packages/opencode/package.json: package opencode is private, ESM, MIT-licensed, version 1.18.30; exports "./*": "./src/*.ts" and maps #db to ./src/storage/db.bun.ts for Bun/default and ./src/storage/db.node.ts for Node.packages/opencode/package.json scripts: "typecheck": "tsgo --noEmit", "test": "bun test --timeout 30000 --only-failures", "test:httpapi": "bun run script/httpapi-exercise.ts --mode coverage --fail-on-missing --fail-on-skip && bun run script/httpapi-exercise.ts --mode auth --fail-on-missing --fail-on-skip && bun run script/httpapi-exercise.ts --mode effect --fail-on-missing --fail-on-skip", "bench:test": "bun run script/bench-test-suite.ts", "profile:test": "bun run script/profile-test-files.ts", "build": "bun run script/build.ts", "build:server": "node script/build-server.mjs", "dev": "bun run ./src/index.ts", and "dev:temporary": "bun run ./src/temporary.ts".packages/sdk/js/package.json: package @opencode-ai/sdk is ESM, MIT-licensed, version 1.18.30; scripts are "test": "bun test", "typecheck": "tsgo --noEmit", and "build": "bun ./script/build.ts"; published files are limited to dist.@opencode-ai/sdk exports: "." β ./src/index.ts, "./client" β ./src/client.ts, "./server" β ./src/server.ts, "./v2" β ./src/v2/index.ts, "./v2/client" β ./src/v2/client.ts, "./v2/gen/client" β ./src/v2/gen/client/index.ts, "./v2/server" β ./src/v2/server.ts, and "./v2/types" β ./src/v2/gen/types.gen.ts.@opencode-ai/sdk dependency details: its sole runtime dependency is "cross-spawn": "catalog:"; development dependencies are @hey-api/openapi-ts 0.90.10, @tsconfig/node22, @types/cross-spawn, @types/node, @typescript/native-preview, and typescript.packages/core/src/session/execution/claim.ts that lease timestamps use node wall clocks, SESSION_EXECUTION_LEASE_MS must exceed the deploymentβs maximum clock skew plus one renewal interval, execution IDs immediately fence a node after takeover, and an expired claim never renews itself.packages/core/src/session/execution/claim.ts: SessionExecutionClaim.Claim contains readonly sessionID, executionID, and ownerID; claim mutations require matching session_id, execution id, owner_id, and expires_at > now.packages/core/src/session/execution/claim.ts: update() sets optional assistant_message_id/phase values and renews expires_at to now + SESSION_EXECUTION_LEASE_MS; absence of an updated row defects with SessionExecutionClaim.Lost.packages/core/src/session/execution/claim.ts: clear() deletes only a still-unexpired row matching Session, execution, and owner identity; absence of a deleted row defects with SessionExecutionClaim.Lost.SessionExecutionClaim.transaction() behavior in packages/core/src/session/execution/claim.ts: it uses a database transaction with { behavior: "immediate" }, renews the claim through update(db, claim), and only then runs the supplied effect; database failures are converted with Effect.orDie.packages/core/src/session/execution/local.ts: each process creates one random ownerID; each drain creates a random executionID; active claims are tracked in Map<SessionSchema.ID, SessionExecutionClaim.Claim>.SessionExecutionTable with phase: "ready", time_created: now, and expires_at: now + leaseDuration, using .onConflictDoNothing(); if insertion does not return a row, the drain returns without running.SessionRecoveryTable row for the Session where wake_pending = true and recovery_error IS NULL, ordered by time_created then execution_id, and passes its continuation_message_id to input.run(...).input.run(claim, force, recovery?.continuationMessageID) races via Effect.raceFirst against repeated SessionExecutionClaim.update(db, claim) calls spaced at leaseDuration / 3.activeClaims; successful drains clear the claim; interrupted drains leave it uncleared; non-interrupt failures re-read the claim and clear it only when its phase is neither "unknown" nor "continue".coordinator.interrupt(sessionID); otherwise it renews the claim, forks a scoped renewal loop every leaseDuration / 3, and interrupts through the coordinator with claim clearing as the final effect. SessionExecutionClaim.Lost during that clear is ignored, while other defects are rethrown.SessionExecutionLocal loads the Session from SessionStore, defects with Session not found: ${claim.sessionID} when absent, and runs SessionRunner.Service.use((runner) => runner.run({ ...claim, force, recoveryInputID })) under locations.get(session.location).SessionExecutionLocal.node construction: makeGlobalNode provides SessionExecution.Service with dependencies [Database.node, SessionStore.node, LocationServiceMap.node].