Skip to content

Consume native LLM events in session processing#26639

Draft
kitlangton wants to merge 3 commits into
devfrom
llm-native-event-adapter
Draft

Consume native LLM events in session processing#26639
kitlangton wants to merge 3 commits into
devfrom
llm-native-event-adapter

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented May 10, 2026

Summary

  • Maps AI SDK fullStream events into @opencode-ai/llm LLMEvents at the existing LLM.Service.stream boundary.
  • Updates SessionProcessor to consume native LLM lifecycle event names and shapes directly.
  • Moves session usage accounting to native Usage and updates compaction fixtures accordingly.

Stack

Tests

  • cd packages/opencode && bun typecheck
  • cd packages/opencode && bun run test test/session/processor-effect.test.ts
  • cd packages/opencode && bun run test test/session/prompt.test.ts
  • cd packages/opencode && bun run test test/session/message-v2.test.ts test/session/retry.test.ts test/provider/transform.test.ts
  • git diff --check

Stack

  1. Consume native LLM events in session processing #26639 👈 current
  2. Add native LLM request adapter #26941
  3. Compile native LLM requests in session tests #26946
  4. Add native OpenAI runtime opt-in #26947

Comment thread packages/opencode/src/session/llm.ts Outdated
}

export type Event = Result["fullStream"] extends AsyncIterable<infer T> ? T : never
export type Event = LLMEvent
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get rid of this alias.

@kitlangton kitlangton force-pushed the llm-native-event-adapter branch from dce937d to 3427bb7 Compare May 10, 2026 16:17
@kitlangton kitlangton changed the title Emit native LLM events from session stream Consume native LLM events in session processing May 10, 2026
@kitlangton kitlangton changed the base branch from dev to llm-event-lifecycle May 10, 2026 16:17
Base automatically changed from llm-event-lifecycle to dev May 10, 2026 16:19
@kitlangton kitlangton force-pushed the llm-native-event-adapter branch 3 times, most recently from e0a4cbf to 1ec6529 Compare May 11, 2026 22:07
@kitlangton kitlangton force-pushed the llm-native-event-adapter branch from 1ec6529 to 48bce2b Compare May 12, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant