Dashboard › opencode › Distillation
a997e981-e40c-411f-97c2-7f20034f056d["lore_tm_v1_KfpLYmcbOpd6Dpi7myZFkmTK0ww4qvbG3nXPKHAz6ko","lore_tm_v1_0eMcw1IhmZjn0hOKq13ndGUWIUK0V9kGUSAILC5d-uQ"]
Date: Sep 17, 2026
packages/core/package.json defines private ESM package @opencode-ai/core version 1.18.30, license MIT, 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"; binary "opencode" points to ./bin/opencode.packages/core/package.json exports ./effect/layer-node β ./src/effect/layer-node.ts, ./effect/app-node β ./src/effect/app-node.ts, ./session/runner β ./src/session/runner/index.ts, ./system-context β ./src/system-context/index.ts, and wildcard ./* β ./src/*.ts.packages/core/package.json conditionally imports #sqlite as ./src/database/sqlite.bun.ts for Bun/default and ./src/database/sqlite.node.ts for Node; #pty as ./src/pty/pty.bun.ts for Bun/default and ./src/pty/pty.node.ts for Node; and #fff as ./src/filesystem/fff.bun.ts for Bun/default and ./src/filesystem/fff.node.ts for Node.packages/core/package.json dev dependencies are @tsconfig/bun, @types/bun, @types/cross-spawn, @types/node, @types/semver, and drizzle-kit via catalog:; @types/npm-package-arg@6.1.4, @types/npmcli__arborist@6.3.3, @types/turndown@5.0.5, @types/which@3.0.4; eight @parcel/watcher-* platform packages at 2.5.1; and @opencode-ai/http-recorder@workspace:*.packages/core/package.json AI-provider dependencies include @ai-sdk/alibaba@1.0.17, @ai-sdk/amazon-bedrock@4.0.166, @ai-sdk/anthropic@3.0.111, @ai-sdk/azure@3.0.93, @ai-sdk/cerebras@2.0.41, @ai-sdk/cohere@3.0.27, @ai-sdk/deepinfra@2.0.41, @ai-sdk/gateway@3.0.191, @ai-sdk/google@3.0.73, @ai-sdk/google-vertex@4.0.181, @ai-sdk/groq@3.0.31, @ai-sdk/mistral@3.0.51, @ai-sdk/openai@3.0.88, @ai-sdk/openai-compatible@2.0.41, @ai-sdk/perplexity@3.0.26, @ai-sdk/provider@3.0.16, @ai-sdk/provider-utils@4.0.51, @ai-sdk/togetherai@2.0.41, @ai-sdk/vercel@2.0.39, @ai-sdk/xai@3.0.102, @openrouter/ai-sdk-provider@2.9.0, ai-gateway-provider@3.2.0, gitlab-ai-provider@6.15.0, and venice-ai-sdk-provider@2.1.1.packages/core/package.json dependencies include @aws-sdk/credential-providers@3.1057.0; catalog dependencies @effect/opentelemetry, @effect/platform-node, @effect/sql-sqlite-bun, @lydell/node-pty, cross-spawn, diff, drizzle-orm, effect, and zod; @ff-labs/fff-bun@0.9.4; @npmcli/arborist@9.4.0; @npmcli/config@10.8.1; workspace dependencies @opencode-ai/effect-drizzle-sqlite, @opencode-ai/effect-sqlite-node, @opencode-ai/llm, @opencode-ai/schema, and @opencode-ai/plugin; @opentelemetry/api@1.9.0, @opentelemetry/context-async-hooks@2.6.1, @opentelemetry/exporter-trace-otlp-http@0.214.0, @opentelemetry/sdk-trace-base@2.6.1; @parcel/watcher@2.5.1; @silvia-odwyer/photon-node@0.3.4; bun-pty@0.4.8; fuzzysort@3.1.0; glob@13.0.5; google-auth-library@10.5.0; gray-matter@4.0.3; htmlparser2@8.0.2; immer@11.1.4; ignore@7.0.5; jsonc-parser@3.3.1; mime-types@3.0.2; minimatch@10.2.5; npm-package-arg@13.0.2; semver@^7.6.3; turndown@7.2.0; which@6.0.1; and xdg-basedir@5.1.0. The package override forces "drizzle-orm": "catalog:".packages/core/script/migration.ts is a Bun migration generator/checker. Its fixed paths are packages/core/schema.json (snapshot), packages/core/src/database/migration (tsDir), packages/core/src/database/migration.gen.ts (registry), and packages/core/src/database/schema.gen.ts (schema); CLI options are boolean --check and string --name.packages/core/script/migration.ts calls generate(): it creates an opencode-core-migration- temporary directory with incremental and full outputs, copies packages/core/schema.json to incremental/baseline/snapshot.json, runs Drizzle incrementally with the optional migration name, rejects more than one generated migration, writes a new formatted TypeScript migration to packages/core/src/database/migration/${name}.ts unless that file already exists, updates packages/core/schema.json from the generated snapshot, generates the complete schema into packages/core/src/database/schema.gen.ts, regenerates packages/core/src/database/migration.gen.ts, and recursively removes the temporary directory in finally.packages/core/script/migration.ts --check calls check(): it generates an incremental migration from the baseline and throws Core schema has ungenerated database migrations. Run \bun script/migration.ts` from packages/core.if any migration appears; regenerates and byte-compares the full schema, throwingCurrent database schema is stale. Run `bun script/migration.ts` from packages/core.on mismatch; regenerates and byte-compares the registry, throwingDatabase migration registry is stale. Run `bun script/migration.ts` from packages/core.on mismatch; and always recursively deletes itsopencode-core-migration-check-` temporary directory.drizzle() helper in packages/core/script/migration.ts writes a temporary ${path.basename(output)}.config.ts that imports packages/core/drizzle.config.ts by file URL and overrides out; it runs bun drizzle-kit generate --config ${config} plus ["--name", name] when a name exists, with working directory packages/core.packages/core/script/migration.ts scans */migration.sql, extracts and sorts directory names; generatedSql() requires exactly one full-schema migration and throws Expected one full schema migration, found ${generated.length}. otherwise; typescriptMigrations() scans *.ts in packages/core/src/database/migration, strips extensions, and sorts names.Effect and DatabaseMigration, export { id: name, up(tx) { return Effect.gen(...) } } satisfies DatabaseMigration.Migration; generated full-schema modules omit id and satisfy Omit<DatabaseMigration.Migration, "id">. SQL is split on --> statement-breakpoint, trimmed, empty statements removed, and each statement rendered as yield* tx.run(...).renderRun() in packages/core/script/migration.ts replaces tabs with two spaces, emits one-line SQL inline and multiline SQL in an indented template literal; escapeTemplate() escapes backslashes, backticks, and ${. Generated TypeScript is formatted with Prettierβs typescript and estree plugins using semi: false and printWidth: 120.renderRegistry() in packages/core/script/migration.ts emits parallel dynamic imports via await Promise.all([import("./migration/${name}"), ...]), maps each module to .default, and constrains the result with satisfies DatabaseMigration.Migration[].