Skip to content

sessions: flatten SessionState; move model/agent to Message, drafts#264

Merged
connor4312 merged 3 commits into
mainfrom
connor4312/sessionsummary-split
Jun 26, 2026
Merged

sessions: flatten SessionState; move model/agent to Message, drafts#264
connor4312 merged 3 commits into
mainfrom
connor4312/sessionsummary-split

Conversation

@connor4312

Copy link
Copy Markdown
Member

Fixes #187.

Makes SessionSummary a root-only catalog type and relocates model/agent selection onto individual messages, so per-message and per-draft selections are expressible and the "one timestamp, two writers" summary divergence (#186) goes away.

What changed & why

  • Flatten SessionState — inline the shared metadata (provider, title, status, activity, project, workingDirectory, annotations) via a new SessionMetadata base interface; drop the embedded summary sub-object. One overlapping set of update actions instead of two.
  • SessionSummary is root-channel-only now (listSessions / root/sessionAdded / root/sessionSummaryChanged). Its createdAt/modifiedAt are ISO-8601 strings (were numbers), matching ChatSummary and the resource* mtime/ctime. The host owns modifiedAt at its discretion.
  • Remove session/chat model & agent — dropped from SessionState, SessionSummary, ChatState, ChatSummary; deleted the now-defunct session/modelChanged & session/agentChanged actions and the model/agent params on createSession/createChat.
  • Model/agent live on Message — added model?/agent? so a turn records the selection it used (editable/resendable); absent ⇒ agent-host default. There is no session-level selection.
  • Per-chat draft — added ChatState.draft + client-dispatchable chat/draftChanged. Clients MAY debounce-sync in-progress input (not eager) and SHOULD rehydrate composer UI from any draft. State-only; not mirrored onto ChatSummary.
  • Reducers — the session reducer no longer stamps a timestamp; the chat reducer is unchanged. Added chat/draftChanged (set/clear). 100% branch coverage retained.
  • Breaking version — dropped 0.4.0/0.3.0 from SUPPORTED_PROTOCOL_VERSIONS; 0.5.0 no longer negotiates them.
  • All 5 clients regenerated (+ schema + reference docs) and hand-written reducers/host code/tests updated for Rust, Kotlin, Swift, Go, TypeScript.
  • Docs + CHANGELOGs — updated state-model/session/chat/root-channel/actions guides and each client CHANGELOG.
  • Migration aid — new plugins/session-metadata-migration-plugin (skill) to help consumers upgrade.

Verification

  • Root: npm run generate clean (no drift), npm run test green — 264 tests, lint, verify:release-metadata, verify:changelog, 100% reducer coverage.
  • Clients: TypeScript (59), Go (go test ./...), Rust (cargo test + clippy clean), Swift (107) all green. Kotlin verified in a podman eclipse-temurin:17-jdk container (./gradlew test BUILD SUCCESSFUL).

Notes for reviewers

  • Breaking change across the whole protocol surface; intentional SUPPORTED_PROTOCOL_VERSIONS truncation to [0.5.0].
  • The Swift AHPApp example (Xcode-only) was updated best-effort and is not built in CI.

connor4312 and others added 2 commits June 25, 2026 10:58
Make SessionSummary a root-only catalog type and relocate model/agent
selection onto individual messages, so per-message/per-draft selections
are expressible and the "one timestamp, two writers" summary problem goes
away.

- Flatten SessionState: inline the shared metadata (provider, title,
  status, activity, project, workingDirectory, annotations) via a new
  SessionMetadata base; drop the embedded `summary` sub-object.
- SessionSummary is now root-channel-only (listSessions / sessionAdded /
  sessionSummaryChanged); createdAt/modifiedAt are ISO-8601 strings, not
  numbers, matching our other timestamps.
- Remove session/chat-level model & agent: drop them from SessionState,
  SessionSummary, ChatState, ChatSummary and delete the now-defunct
  session/modelChanged & session/agentChanged actions (+ createSession /
  createChat model/agent params).
- Add model?/agent? to Message so a turn records the selection it used
  (editable/resendable) and the host default applies when absent.
- Add ChatState.draft + client-dispatchable chat/draftChanged so clients
  can debounce-sync in-progress input and rehydrate composer UI per chat.
- Session reducer no longer stamps a timestamp; chat reducer unchanged.
- Drop 0.4.0/0.3.0 from SUPPORTED_PROTOCOL_VERSIONS (breaking change).
- Regenerate all 5 clients + schema + reference docs; update hand-written
  reducers/host code/tests for Rust, Kotlin, Swift, Go, TypeScript.
- Update guides/spec docs and per-client CHANGELOGs.
- Add migration plugin+skill (plugins/session-metadata-migration-plugin)
  to help consumers upgrade.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collapse a single-statement `with_status_flag` call onto one line so
`cargo fmt --check` passes in CI. No behavior change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@connor4312 connor4312 marked this pull request as ready for review June 25, 2026 22:08
sandy081
sandy081 previously approved these changes Jun 25, 2026
@connor4312 connor4312 changed the title sessions: flatten SessionState; move model/agent to Message sessions: flatten SessionState; move model/agent to Message, drafts Jun 26, 2026
@connor4312 connor4312 merged commit 221dac8 into main Jun 26, 2026
9 checks passed
@connor4312 connor4312 deleted the connor4312/sessionsummary-split branch June 26, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove SessionSummary from SessionState

4 participants