Dashboard › opencode › Distillation
2709036c-a3b1-44c0-8351-ee4e2a4f6e67["lore_tm_v1_di9ADLVxPO_o5C-HNBGRzk7aYRhF-8TofcrY6Vhti7Y","lore_tm_v1_jKdHCVdbVGVur_b_d8uSqlrqUIgeCIzJIV1PsT4Z_bo","lore_tm_v1_3feAfn9TktIZOR97pDDSMyZczLFtiqcLWppfnXAW5Is","lore_tm_v1_iCJwuTDfbE4W7yArF2-_g4cBwd_Q1Qbb0A86fPKxvqs","lore_tm_v1_o8g-V4aVSsglxdD_SMLgUJskoJRnz4zd7wop7Hj9Kjs","lore_tm_v1_AQLOvfvI9FzcmhLwpp64ZMqYgk4LtSO_6rE76owQhpo","lore_tm_v1_zHg32O29a6AigB5xbwQiAI6sgKNWdFy3W5TU6WirWQc","lore_tm_v1_k12o-bJ6oAMAccJ3-YCNdVC3WgMPjj3_aL3v8Y7VwS8","lore_tm_v1_gG5LTtY5PvoMPPge7FhLnE6rkdXgDngZytzdpXWvUGo","lore_tm_v1_WkJ-FUCp2VSo4e6PQX2M2Xoa7gRa9Ok_yeOjQKWrkcU","lore_tm_v1_8G19LNoLGkY2Xmm5Q9u0dY8x64hpe6gxQA3KN46XM2w","lore_tm_v1_Gdj40rTfPQSWBitrYb69zqsO3GLthYzrVVRVlhmz3CQ","lore_tm_v1_CQCDv9ZSEvYdHtahpW3yWZ-WGtdhBRjN9rxbLOLsBik"]
Date: Sep 14, 2026
/home/byk/Code/opencode/packages/core/src/effect/app-node.ts:3-12 defines tags = LayerNode.tags({ location: ["global"], global: [] }), GlobalNode<A, E = never>, LocationNode<A, E = never>, makeGlobalNode = tags.make("global"), and makeLocationNode = tags.make("location"); line 14 exports * as Node from "./app-node".makeGlobalNode usage at 33 locations: /home/byk/Code/opencode/packages/core/src/global.ts:73, ripgrep.ts:284, repository-cache.ts:243, models-dev.ts:264, fs-util.ts:221, tool-output-store.ts:207, session.ts:474, project.ts:132, process.ts:259, npm.ts:251, git.ts:946, event.ts:638, cross-spawn-spawner.ts:505, credential.ts:138, background-job.ts:365, permission/saved.ts:79, ripgrep/binary.ts:127, database/database.ts:57, tool/application-tools.ts:57, control-plane/move-session.ts:144, skill/discovery.ts:213, pty/ticket.ts:56, session/projector.ts:455, session/store.ts:63, project/directories.ts:158, session/execution/local.ts:40, effect/app-node-platform.ts:8-16 (filesystem, path, httpClient, requestExecutor, llmClient), effect/app-node-builder.ts:12, and util/effect-flock.ts:283./home/byk/Code/opencode/packages/core/src/effect/app-node-builder.ts:6-20 defines build<A, E>(root, replacements = []); it conditionally calls buildLocationServiceMap(replacements) only when LayerNode.hasUnbound(root, LocationServiceMap.node) and no replacement exists, creates a replacement with makeGlobalNode({ service: LocationServiceMap.Service, layer: locationMap, deps: [] }), appends [LocationServiceMap.node, locationMapNode], and returns LayerNode.compile(root, allReplacements). hasReplacement(...) compares source.name === node.name."migration": "bun run script/migration.ts" in /home/byk/Code/opencode/packages/core/package.json:10; /home/byk/Code/opencode/packages/core/test/database-migration.test.ts:118 runs bun .../script/migration.ts --check; /home/byk/Code/opencode/packages/core/script/migration.ts reports stale or ungenerated artifacts and invokes bun drizzle-kit generate --config ${config} ${name ? ["--name", name] : []}./home/byk/Code/opencode/packages/opencode/src/effect/app-node-builder-v1.ts:1-10 imports Core AppNodeBuilder and LayerNode, defines bootstrapReplacement = [InstanceStore.bootstrapNode, InstanceBootstrap.node] as const, and builds via AppNodeBuilder.build(root, replacements.concat([bootstrapReplacement]))./home/byk/Code/opencode/packages/core/src/session/projector.ts:430-455 deletes SessionMessageTable rows after boundary.seq, deletes SessionInputTable rows whose admitted_seq or promoted_seq exceeds the boundary, clears SessionTable.revert, updates time_updated using DateTime.toEpochMillis(event.data.timestamp), and declares node = makeGlobalNode({ name: "session-projector", layer, deps: [EventV2.node, Database.node] })./home/byk/Code/opencode/packages/core/src/database/migration/20260622202450_simplify_session_input.ts has ID 20260622202450_simplify_session_input; its up(tx) executes, in order: 1. DELETE FROM \session_context_epoch`;, 2. DELETE FROM `session_input`;, 3. DELETE FROM `session_message`;, 4. DELETE FROM `event`;, 5. DELETE FROM `event_sequence`;, 6. UPDATE `session` SET `workspace_id` = NULL WHERE `workspace_id` IS NOT NULL;, 7. DELETE FROM `workspace`;`./home/byk/Code/opencode/packages/core/src/database/migration.gen.ts:3-44 dynamically imports 38 migrations in this exact order: 1. 20260127222353_familiar_lady_ursula, 2. 20260211171708_add_project_commands, 3. 20260213144116_wakeful_the_professor, 4. 20260225215848_workspace, 5. 20260227213759_add_session_workspace_id, 6. 20260228203230_blue_harpoon, 7. 20260303231226_add_workspace_fields, 8. 20260309230000_move_org_to_state, 9. 20260312043431_session_message_cursor, 10. 20260323234822_events, 11. 20260410174513_workspace-name, 12. 20260413175956_chief_energizer, 13. 20260423070820_add_icon_url_override, 14. 20260427172553_slow_nightmare, 15. 20260428004200_add_session_path, 16. 20260501142318_next_venus, 17. 20260504145000_add_sync_owner, 18. 20260507164347_add_workspace_time, 19. 20260510033149_session_usage, 20. 20260511000411_data_migration_state, 21. 20260511173437_session-metadata, 22. 20260601010001_normalize_storage_paths, 23. 20260601202201_amazing_prowler, 24. 20260602002951_lowly_union_jack, 25. 20260602182828_add_project_directories, 26. 20260603001617_session_message_projection_indexes, 27. 20260603040000_session_message_projection_order, 28. 20260603141458_session_input_inbox, 29. 20260603160727_jittery_ezekiel_stane, 30. 20260604172448_event_sourced_session_input, 31. 20260605003541_add_session_context_snapshot, 32. 20260605042240_add_context_epoch_agent, 33. 20260611035744_credential, 34. 20260611192811_lush_chimera, 35. 20260612174303_project_dir_strategy, 36. 20260622142730_simplify_session_context_epoch, 37. 20260622170816_reset_v2_session_state, 38. 20260622202450_simplify_session_input; imported defaults are mapped into DatabaseMigration.Migration[]./home/byk/Code/opencode/packages/core/src/tool-output-store.ts:180-210 cleanup scans entries beginning with "tool_", reads mtime, defaults unavailable times to 0, and removes files when modified < cutoff, swallowing stat/remove failures. It defines location nodes node with dependencies [FSUtil.node, Global.node, Config.node] and nodeWithoutConfig with [FSUtil.node, Global.node]./home/byk/Code/opencode/packages/core/src/tool-output-store.ts:199-210 defines cleanupLayer to call store.cleanup() repeatedly with Schedule.spaced(Duration.hours(1)) under Effect.forkScoped; process-global cleanupNode is named "tool-output-cleanup", merges layer with cleanupLayer.pipe(Layer.provide(layer)), and depends on [FSUtil.node, Global.node]./home/byk/Code/opencode/packages/core/src/effect/layer-node.ts:219-247 shows hoist(...) walking a replacement-resolved node graph: groups recursively visit dependencies; nodes matching the selected tag are collected by name after rewriteReplacementDependencies(...) and replaced in the residual tree with group([]); conflicting implementations throw Tag ${tag} has conflicting implementations for ${node.name}; unbound nodes remain unchanged; the result contains the rewritten node and a hoisted group made from collected values./home/byk/Code/opencode/packages/core/src/effect/layer-node.ts:250-271 defines compile(...): it builds a replacement map and node-to-layer cache, rejects unresolved nodes with Unbound layer node: ${node.name}, flattens dependency groups, compiles dependencies recursively, supplies nonempty dependency layers with Layer.provide(...), then folds root layers through Layer.provideMerge(...) starting from Layer.empty./home/byk/Code/opencode/packages/core/src/effect/layer-node.ts:274-319 defines replacement normalization: replacements are reduced in order; each new replacement rewrites its own dependencies against prior replacements, then previously mapped nodes are rewritten against the current replacement. rewriteReplacementDependencies(...) preserves unchanged nodes, caches rewritten nodes, and detects cycles with Cycle detected in layer tree: ${...}./home/byk/Code/opencode/packages/core/src/effect/layer-node.ts:321-330 defines hasUnbound(root, source), which rejects a non-unbound source with Cannot check non-unbound layer node: ${source.name} and recursively checks identity through dependencies; flatten(node) recursively expands group dependencies and otherwise returns [node].repo-setup skill was unavailable, so repository guidance was read directly; all requested reads succeeded./home/byk/Code/opencode/packages/core/src/session/sql.ts:22-176, using sqliteTable(...), snake-case fields, typed columns, foreign keys, and indexes; cited SessionMessageTable at lines 119-138, SessionInputTable at lines 140-166, and SessionContextEpochTable at lines 168-176./home/byk/Code/opencode/packages/core/drizzle.config.ts:3-9 discovers both schema naming conventions via schema: ["./src/**/*.sql.ts", "./src/**/sql.ts"]./home/byk/Code/opencode/packages/core/script/migration.ts:10-20 updates four artifacts: 1. packages/core/schema.json, 2. packages/core/src/database/migration/<generated-name>.ts, 3. packages/core/src/database/schema.gen.ts, 4. packages/core/src/database/migration.gen.ts./home/byk/Code/opencode/packages/core/script/migration.ts:30-61: diff against schema.json, require at most one incremental migration, write the TypeScript migration, update the snapshot, then regenerate the full schema and registry. Lines 127-153 generate a default-exported object with id and up(tx) satisfying DatabaseMigration.Migration; /home/byk/Code/opencode/packages/core/src/database/migration.gen.ts:1-44 dynamically imports migrations and maps their default exports./home/byk/Code/opencode/packages/core: bun script/migration.ts --name <migration-name>; cited stale-artifact validation in /home/byk/Code/opencode/packages/core/script/migration.ts:64-88.makeGlobalNode(...) from /home/byk/Code/opencode/packages/core/src/effect/app-node.ts:3-12; keep startup work in the nodeβs layer. As a representative side-effecting node, /home/byk/Code/opencode/packages/core/src/tool-output-store.ts:199-210 uses Effect.repeat(...) and Effect.forkScoped inside cleanupLayer, then wraps it in cleanupNode./home/byk/Code/opencode/packages/core/src/effect/layer-node.ts:108-112 uses LayerNode.group(...) to collect roots; lines 250-271 use LayerNode.compile(...) to resolve dependencies and compose layers; /home/byk/Code/opencode/packages/core/src/effect/app-node-builder.ts:6-17 compiles the graph and creates a Location service map only if required.applicationServices in /home/byk/Code/opencode/packages/server/src/routes.ts:26-37; /home/byk/Code/opencode/packages/server/src/routes.ts:51-62 compiles the complete graph once in makeRoutes, with AppNodeBuilder.build(applicationServices, ...) supplying the layer at the application boundary.app group in /home/byk/Code/opencode/packages/opencode/src/server/routes/instance/httpapi/server.ts:212-269; compile and supply it at the route application boundary at lines 271-312, specifically through AppNodeBuilderV1.build(app) at line 306./home/byk/Code/opencode/packages/opencode/src/effect/app-node-builder-v1.ts:1-10 delegates to Coreβs builder while adding the integrated bootstrap replacement, and cited /home/byk/Code/opencode/packages/opencode/src/server/routes/instance/httpapi/server.ts:183-188 for the lazy-loading rule that avoids server setup costs in CLI processes and scripts.