Skip to content

feat(session): expose transient generation API - #37433

Merged
kitlangton merged 1 commit into
v2from
session-generate-api
Jul 17, 2026
Merged

kitlangton merged 1 commit into
v2from
session-generate-api

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Exposes the existing read-only SessionV2.generate capability through the V2 HTTP API, generated Promise and Effect clients, and plugin session contexts. Applications and plugins can now request transient text from current Session context without admitting input or mutating durable history.

const result = await client.session.generate({
  sessionID,
  prompt: "Summarize the current session",
})
// { text: string }

How

  • Adds POST /api/session/:sessionID/generate to the Session Protocol group.
  • Routes the server handler to the existing Location-aware SessionV2.generate implementation.
  • Regenerates both Promise and Effect client surfaces.
  • Exposes ctx.session.generate in Promise and Effect V2 plugin contexts and wires both plugin adapters.
  • Adds a Changeset for Client, Protocol, and Plugin packages.

Scope

This PR only exposes the generic transient generation capability. It does not include recap prompts, stale-result suppression, idle waiting, caching, timers, or TUI presentation; those remain in the separate recap work.

Testing

  • Pre-push bun turbo typecheck --concurrency=3: 32 package tasks passed.
  • bun run test in packages/client: 43 passed.
  • bun run test in packages/plugin: 7 passed.
  • bun run test in packages/server: 10 passed.
  • Focused packages/core/test/plugin/promise.test.ts: 9 passed.
  • Full Core suite: 1,321 passed, 6 skipped; 10 unrelated provider network/timing tests failed.
  • Client generation rerun successfully and produced no additional changes.
  • Prettier and git diff --check passed.

Flow

sequenceDiagram
  participant App as App or plugin
  participant Client as V2 client
  participant Server as Session HTTP handler
  participant Core as SessionV2.generate
  App->>Client: session.generate(sessionID, prompt)
  Client->>Server: POST /api/session/:sessionID/generate
  Server->>Core: generate(sessionID, prompt)
  Core-->>Server: transient text
  Server-->>Client: { data: { text } }
  Client-->>App: { text }
Loading

@kitlangton
kitlangton merged commit 3db4458 into v2 Jul 17, 2026
8 of 10 checks passed
@kitlangton
kitlangton deleted the session-generate-api branch July 17, 2026 13:25
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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