Dashboard › opencode › Distillation
edbb8f8c-4c3e-49ba-b532-bfdaae504619["lore_tm_v1_hJa4VWJuFtNGs0f5v-y6DQv8-grPEpP1lRi7umGttWY","lore_tm_v1_QmB_N9ft0F1Jg4Sutpy7dDYES35qOEEeA7yKZSJDUms"]
Date: Sep 15, 2026
/home/byk/Code/opencode/packages/core/src/session/message-updater.ts: current-assistant completion guard at line 33; draft.time.completed = event.data.timestamp at lines 180, 192, 211, 225, 232, and 256; tool.time.completed = event.data.timestamp at line 270; match.time.completed = event.data.timestamp at lines 359 and 382; status: "completed" at line 362; and full match.time reconstruction at line 422./home/byk/Code/opencode/packages/core/src/session/message-updater.ts defines MemoryState as messages: SessionMessage.Message[] and an Adapter interface with getCurrentAssistant(), getAssistant(messageID), getCurrentShell(callID), updateAssistant(assistant), updateShell(shell), and appendMessage(message), all returning Effect operations.memory(state: MemoryState), assistantIndex(messageID) uses state.messages.findLastIndex((message) => message.id === messageID), latestAssistantIndex() finds the last message whose type === "assistant", and activeShellIndex(callID) finds the last shell message with the matching callID.getCurrentAssistant() now checks only the latest assistant row: it calls latestAssistantIndex(), returns nothing when the index is negative, and otherwise returns that assistant only when assistant?.type === "assistant" and !assistant.time.completed; this prevents selecting an older incomplete assistant after a newer turn.getAssistant(messageID) independently retrieves the last message with the requested ID and returns it only if its type is "assistant".