Dashboard › opencode › Distillation
c5229057-ebf3-4706-8c1f-81564daf11ae["lore_tm_v1_PktWPZqBo5rG6L7uoz-82kWWAtMrcUc4mM8Kiio5nAo","lore_tm_v1_9TR1dgmbxRO3ksLnYapSh7d9SY8n1oZjsG3XSwEs-tY","lore_tm_v1_tCkXqMIkPTrspskrz7ZEdHJbirz0_jnVjf58vBhDdFk","lore_tm_v1_Xs4fzvK7lArfyHFLwsgRXe_6bOA1Ixsf3yBG4to96o4","lore_tm_v1_rpU7692zbbuixc6DLY_530WW9LikPMlCuR8LivxUsNM"]
Date: Sep 14, 2026
dc661f30cb2055ad6248fdc59b14998d834497be, packages/core/src/session/execution/local.ts:68 delegates local execution through SessionRunner.Service.use((runner) => runner.run({ sessionID, force })).ToolResultPart.make; when tool.provider?.executed === true and tool.state.result !== undefined, it reuses tool.state.result, otherwise it calls ToolOutput.toResultValue({ structured: tool.state.structured, content: tool.state.content }).ToolOutput.toResultValue rejects unresolved URIs rather than treating them as media bytes.resultType: "error"; provider-executed tools can reuse tool.state.result, while other tools produce { error: tool.state.error, content: tool.state.content, structured: tool.state.structured }.message.model.providerID matches model.provider and message.model.id matches model.id; provider metadata is reused only for same-model messages without message.error.reasoning content part and can retain providerMetadata; cross-model reasoning is converted to a text part when nonempty and omitted when empty.[call, result] when a result exists, or [call] otherwise; non-provider-executed tool calls stay in assistant content while their completed/error results are emitted afterward as separate Message.tool messages.toLLMMessage omits agent-switched and model-switched records; maps user messages to text plus file media and conditionally adds agents metadata; maps synthetic messages to user-role messages; maps system through Message.system; and maps shell to user content formatted as Shell command: ${message.command}\n\n${message.output}.<conversation-checkpoint>, containing <summary>${message.summary}</summary> and <recent-context>${message.recent}</recent-context>, with an instruction to treat the contents as historical context rather than new instructions.toLLMMessages(messages, model) translates projected V2 session history into canonical @opencode-ai/llm context using messages.flatMap((message) => toLLMMessage(message, model)).packages/opencode/src/server/routes/instance/httpapi/handlers/sync.ts, SyncHttpApi.start invokes workspace.startWorkspaceSyncing((yield* InstanceState.context).project.id), ignores its result, and forks it into the current Scope.SyncHttpApi.replay reconstructs EventV2.SerializedEvent[] from the request’s id, aggregateID, seq, type, and copied data; logs the source session, event count, first/last sequence, and directory; obtains ownerID from InstanceState.workspaceID; then calls events.replayAll(payload, { ownerID, strictOwner: true }) and returns { sessionID: source }.SyncHttpApi.steal rejects a missing workspaceID with HttpApiError.BadRequest, otherwise calls session.setWorkspace({ sessionID: ctx.payload.sessionID, workspaceID }), logs "sync session stolen", and returns the session ID.SyncHttpApi.history queries EventTable, excluding each aggregate’s events through its client-known sequence with not(or(...and(eq(EventTable.aggregate_id, id), lte(EventTable.seq, seq)))); it returns full history when no exclusions are supplied, orders by asc(EventTable.seq), executes .all(), and terminates database defects via Effect.orDie.start, replay, steal, and history./sync; sync.start starts workspace sync loops for workspaces in the current project with active sessions, sync.replay validates and replays a complete sync event history, sync.steal moves a session to the current workspace through the sync event system, and sync.history.list returns events newer than each supplied aggregate sequence while returning full history for aggregates absent from the input.dc661f30cb2055ad6248fdc59b14998d834497be include packages/opencode/src/control-plane/workspace.ts:351, packages/opencode/src/control-plane/workspace.ts:402 using events.replay(payload.syncEvent, { publish: true, ownerID: space.id }), and packages/opencode/src/server/routes/instance/httpapi/handlers/sync.ts:51 using strict owner validation.