Dashboard › opencode › Distillation
f90ff1a4-aeaa-41ad-812e-8c0d583fc068["lore_tm_v1_IvOHbEU6w0TOPWI1vx2WeDbpUudnT8sd5K_rj10dhv0","lore_tm_v1_Ve-vLWANMQ27sZyJz17eJ1wwVXVlqMOuK70qUJ1m9BQ","lore_tm_v1_YQ9MTOUyoM5ZrJ_f4S9OLWu6u8Vy0o8m7D1P3mqey30","lore_tm_v1_yoc438RSkrINg3WMdS-8Gs6h4fhJrViTI2uYtIsxSRY","lore_tm_v1_xSC5eCUeelQY3m75UgIMZOxChd8gXsQOTmIHjWxXAk4","lore_tm_v1_6n0ZYu6Xnq24ttunZ64ZCBcfPNtVeHQWOiUop-FeOuc","lore_tm_v1_m7mg85AjWdfvDg2Jyn6NW1cquUrjSehLtrUiQ1gnvnM","lore_tm_v1_GlFSzkDR5QDx0ZY2OP05sla56GplTFpXoX0KjP-HU2w","lore_tm_v1_VlEmBAofBDdX2eLRhZTUeiTdL5dUPyaSJCSKHfTTGSs","lore_tm_v1_AhGvKI-l-C_wDQcfxb7h_LfbP_mmE30_uSUyRJx2Nhc","lore_tm_v1_w7GFMGQuT9OJ1RqGPeyAZy2mIlCElDvl340ytNW-m1M","lore_tm_v1_nlmu0H_IAAXg949rwIWE3OU-9B_dIvvRFJ7cuv_JIzk","lore_tm_v1_J0igZykNFEpt9we3N56f3f0GNIQU7f6xgxfQ9V0-x4c","lore_tm_v1_Y-zLXBY9hnm5_IcMY3yE6nwXI4M1MQTtDaw_N4tLlzk","lore_tm_v1_VJQCR3g-QNRft4qotyiAsZ-5ZyRxV-QQZJBg3Wm9gM0","lore_tm_v1_4RF2lrnHOiqQGU13FS2oTOaQPsKGK0Knh3o4DQ9W1ck","lore_tm_v1_g9ArUZjsXQatTFPuAVDpN85apxtS0HaFFFi3AMxLFY4"]
Date: Sep 14, 2026
version: 2 in /home/byk/Code/opencode/packages/schema/src/session-event.ts:47; event versioning helpers are in /home/byk/Code/opencode/packages/schema/src/event.ts, including versionedType(type: string, version: number) at line 94 and durable-key construction at line 102.No files found; the searched path/pattern was not preserved in the result./home/byk/Code/opencode/packages/schema/test/event-manifest.test.ts. Manifest regression expectations are EventManifest.ServerDefinitions.length === 55, EventManifest.Definitions.length === 85, EventManifest.Latest.size === 85, and EventManifest.Durable.size === 32. The test verifies Session.Event === SessionEvent, latest "session.next.step.ended" maps to SessionEvent.Step.Ended, legacy durable key "session.next.step.ended.1" is absent, and "session.next.step.ended.2" maps to SessionEvent.Step.Ended./home/byk/Code/opencode/packages/schema/src/event-manifest.ts. It separates SessionV1.Event.Definitions into durable and live definitions; coreDefinitions inventories durable V1 definitions plus SessionEvent.Definitions; ServerDefinitions contains foundation, feature, and SessionTodo definitions; public Definitions additionally includes live V1, installation, LSP, legacy, project, status, compaction, VCS, workspace, worktree, and server events. Latest is built with Event.latest(Definitions), and Durable is re-exported from ./durable-event-manifest./home/byk/Code/opencode/packages/core/src/database/migration/20260603141458_session_input_inbox.ts, ID 20260603141458_session_input_inbox. It creates session_input with columns seq (autoincrement primary key), id (unique), session_id, prompt, delivery, nullable promoted_seq, and time_created; it adds foreign key session_id → session.id with ON DELETE CASCADE and index session_input_session_pending_seq_idx on (session_id,promoted_seq,seq)./home/byk/Code/opencode/packages/core/src/database/migration/20260604172448_event_sourced_session_input.ts, ID 20260604172448_event_sourced_session_input. It clears session_input, session_message, event, event_sequence, and workspace, nulls session.workspace_id, makes event_aggregate_seq_idx and session_message_session_seq_idx unique, and rebuilds session_input with id as primary key plus required admitted_seq. It creates pending index session_input_session_pending_delivery_seq_idx on (session_id,promoted_seq,delivery,admitted_seq) and unique indexes session_input_session_admitted_seq_idx and session_input_session_promoted_seq_idx./home/byk/Code/opencode/packages/core/src/database/migration/20260622170816_reset_v2_session_state.ts, ID 20260622170816_reset_v2_session_state. It deletes all rows from session_context_epoch, session_input, session_message, event, and event_sequence; nulls non-null session.workspace_id; and deletes all workspace rows./home/byk/Code/opencode/packages/core/src/database/migration/20260622202450_simplify_session_input.ts, ID 20260622202450_simplify_session_input, performs the same visible V2-state reset operations as 20260622170816_reset_v2_session_state: clear session_context_epoch, session_input, session_message, event, and event_sequence; null non-null session.workspace_id; delete workspace.session and session_input, index names including session_input_session_admitted_seq_idx and session_message_session_type_seq_idx, preservation of an existing session_context_epoch.agent, cleanup of old event/event-sequence/workspace state by eventSourcedSessionInputMigration, the rebuilt session_input columns, uniqueness of session_message_session_seq_idx, event_aggregate_seq_idx, and session_input_session_admitted_seq_idx, plus projection/replay setup using EventV2.Service. The tool output was partially elided, so the test file path and complete assertions were not available./home/byk/Code/opencode/packages/cli/src/commands/handlers/serve.ts, where createRoutes is imported from @opencode-ai/server/routes; route construction itself is in /home/byk/Code/opencode/packages/server/src/routes.ts via createRoutes(password?: string), with routes = createRoutes() and HttpRouter.toWebHandler(...)./home/byk/Code/opencode/packages/cli/src/commands/handlers/serve.ts. Runtime.handler(Commands.commands.serve, Effect.fn("cli.serve")(...)) obtains Daemon.Service, calls listen(input.hostname, input.port, yield* daemon.password()), optionally calls daemon.register(address), logs the address, then returns Effect.never. listen() binds an explicit port or probes sequentially from port 4096 through 65_535. bind() serves createRoutes(password) and provides NodeHttpServer.layer, then builds only Credential.node and PermissionSaved.node through AppNodeBuilder.build(LayerNode.group([...])); this is the concrete process-start composition point visible in the CLI server path./home/byk/Code/opencode/packages/core/src/effect/app-node.ts. Global and location service dependency classes are defined by LayerNode.tags({ location: ["global"], global: [] }); exported constructors are makeGlobalNode = tags.make("global") and makeLocationNode = tags.make("location")./home/byk/Code/opencode/packages/core/src/effect/app-node-builder.ts. AppNodeBuilder.build(root, replacements = []) checks whether the graph has an unbound LocationServiceMap.node; when needed and not replaced, it builds the location service map, wraps it as a global node, appends that replacement, and calls LayerNode.compile(root, allReplacements). Replacement matching uses source.name === node.name./home/byk/Code/opencode/packages/core/src/location-services.ts. locationServices is a LayerNode.group containing 37 nodes in order: Location.node, Policy.node, Config.node, AgentV2.node, CommandV2.node, Reference.node, Integration.node, Catalog.node, AISDK.node, PluginV2.node, PluginInternal.node, ProjectCopy.node, ProjectCopy.refreshNode, FileSystemSearch.node, FileSystem.node, Watcher.node, Pty.node, SkillV2.node, SystemContextRegistry.node, SystemContextBuiltIns.node, LocationMutation.node, FileMutation.node, PermissionV2.node, ToolOutputStore.node, ToolRegistry.node, ToolRegistry.toolsNode, Image.node, SkillGuidance.node, ReferenceGuidance.node, SessionTodo.node, QuestionV2.node, ReadToolFileSystem.node, BuiltInTools.node, SessionRunnerModel.node, Snapshot.node, and SessionRunnerLLM.node.buildLocationServiceMap(replacements = []) in /home/byk/Code/opencode/packages/core/src/location-services.ts creates a LayerMap keyed by Location.Ref, adds [Location.node, Location.boundNode(ref)], hoists global dependencies before compiling, logs "booting location services" with directory and workspaceID, and uses idleTimeToLive: "60 minutes". The file comments that applying replacements during hoist is required because replacements can introduce tagged dependencies; locationServiceMapLayer remains as temporary backward compatibility./home/byk/Code/opencode/packages/core/src/session/compaction.ts. Compaction constants are DEFAULT_BUFFER = 20_000, DEFAULT_KEEP_TOKENS = 8_000, TOOL_OUTPUT_MAX_CHARS = 2_000, and SUMMARY_OUTPUT_TOKENS = 4_096. Serialized session history explicitly supports user, assistant, system, synthetic, shell, completed tool, errored tool, reasoning, and attachment content; synthetic messages render as [Synthetic context]: ${message.text}.SessionCompaction.make() exposes compactIfNeeded and compactAfterOverflow. Automatic compaction checks model context limits, configured output/buffer, selects a retained recent tail, publishes SessionEvent.Compaction.Started, streams an LLM summary with no tools, then publishes SessionEvent.Compaction.Ended only when streaming succeeded, no provider error occurred, and the summary is non-empty. Started/Ended payloads include sessionID, messageID, timestamp, and reason; Ended additionally includes text and recent.SessionEvent.Compaction.Started in /home/byk/Code/opencode/packages/core/test/session-runner.test.ts at lines 1050 and 1351, and /home/byk/Code/opencode/packages/core/test/session-projector.test.ts at line 300./home/byk/Code/opencode/packages/core/test/session-runner.test.ts. Test "rebuilds the baseline directly after completed compaction" prompts "First", resumes, publishes manual SessionEvent.Compaction.Started and .Ended with text "summary" and recent: "", changes systemBaseline to "Replacement context", prompts "Second", and expects model system contexts [["Initial context"], ["Replacement context"]]; it then calls replaySessionProjection(sessionID) and prompts "Third"."automatically compacts into a completed summary and retained recent turn", creates an earlier turn using "Earlier question ".repeat(180) and response "Earlier answer", switches to compactModel, configures summary response "## Objective\n- Preserve the task" followed by final response "Continued", then prompts "Recent exact request ".repeat(180). The remainder of this test was outside the retrieved line range.