Event normalization
Convert native platform messages, mentions, slash commands, or replies into a shared
ConversationEvent.
How Slack, Discord, Telegram, and GitHub adapters convert platform events into mikan's shared runtime format.
Their goal is to keep src/runtime/* and src/agent.ts from knowing each platform’s SDK, thread rules, message update API, or file download behavior.
Event normalization
Convert native platform messages, mentions, slash commands, or replies into a shared
ConversationEvent.
Session routing
Compute sessionKey from channels, threads, and reply chains so conversations enter the right
session.
Response capability
ConversationResponder wraps replies, updates, typing/working state, and file uploads.
ConversationEvent and ConversationMessage values.sessionKey so different channels, threads, and replies map to the right session.attachments/ in the workspace.ConversationResponder that wraps replies, updates, typing/working state, and file uploads.MessagingEventHandler, which is ConversationRuntime.Shared types are exported from src/adapter.ts; implementation types live in src/types.ts and src/adapters/types.ts.
sequenceDiagram participant P as Platform SDK participant A as Platform adapter participant I as processMessageIntake() participant R as ConversationRuntime participant C as ConversationResponder
P->>A: native message / slash command / reply A->>A: parse conversation, user, thread, attachments A->>I: ConversationEvent base + trigger/log/attachment hooks I->>I: auto-reply / trigger decision I->>A: download attachments when needed I->>R: handler.handleEvent(event, bot, context) R->>C: respond / replaceResponse / setWorking / uploadFile C->>P: platform formatting and send| File | Purpose |
|---|---|
src/adapter.ts | Exports shared interfaces such as MessagingBot, ConversationEvent, ConversationMessage, and ConversationResponder. |
src/adapters/intake.ts | Shared message intake flow: trigger, log, attachment, queue, and handler call order. |
src/adapters/shared.ts | Shared retry, queue, long message splitting, log, and stop target resolution. |
src/adapters/streaming.ts | Buffers streaming response updates before flushing to avoid overly frequent platform message updates. |
The core runtime depends only on these shared abstractions:
ConversationEvent: one user or platform event.MessagingBot: platform messaging bot capabilities, such as post message and upload file.ConversationContext: message, responder, and platform metadata attached to an event.ConversationResponder: the channel used by the agent to reply.When adding a platform, implement these abstractions first. Do not bring platform SDK details into src/runtime/* or src/agent.ts.