-
-
Notifications
You must be signed in to change notification settings - Fork 147
feat: Subscription Lifecycle Amendment #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
samwillis
wants to merge
33
commits into
TanStack:main
Choose a base branch
from
thruflo:samwillis/sub-lifecycle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
f0b81bb
feat(ai): align start event types with AG-UI
thruflo 30d00e1
feat(ai): add MessageStreamState type for per-message stream tracking
thruflo f03493b
feat(ai): refactor StreamProcessor to per-message state
thruflo f036f55
feat(ai): replace STATE_SNAPSHOT with MESSAGES_SNAPSHOT event
thruflo 3f1ccb5
feat(ai-client): add SessionAdapter interface and createDefaultSession
thruflo 202244a
feat(ai-client): refactor ChatClient to use SessionAdapter subscripti…
thruflo d4cc2b1
fix(ai-preact): thread option through.
thruflo f45dd77
fix(ai): finalizeStream when RUN_FINISHED.
thruflo 6d1c733
fix(ai-client): handle reload during active stream with generation co…
thruflo a217426
docs: remove proposal docs.
thruflo fd1c50c
fix(ai, ai-client): address stream lifecycle edge cases from PR review
thruflo 8c628ee
fix(ai-client): fix reload failures from stale stream state and waite…
thruflo 36d6a93
ci: apply automated fixes
autofix-ci[bot] 2abc6c7
fix(ai): resolve eslint errors in stream processor
thruflo c5e1aa3
fix(ai-client): resolve eslint errors in chat-client and session-adapter
thruflo 537b73c
fix(ai-client): propagate send() errors to subscribe() consumers
thruflo fc52ef7
fix(ai): map 'tool' role to 'assistant' in message state to fix lookups
thruflo ed1cddb
fix(ai): normalize chunk.delta to avoid "undefined" string concatenation
thruflo fd7c226
fix(ai): use || instead of ?? for chunk.delta fallback to satisfy eslint
thruflo 64f5517
fix(ai): reset stream flags on MESSAGES_SNAPSHOT to avoid stale state
thruflo 7155e87
refactor(ai-client): finalize connection adapter unification
samwillis 1bcfdfe
Combine the SessionAdapter with the ConnectionAdapter
samwillis 04e3e70
Merge branch 'main' into thruflo/durable-session-support
jherr fe307a1
ci: apply automated fixes
autofix-ci[bot] 4e3a6cd
Merge remote-tracking branch 'origin/main' into thruflo/durable-sessi…
samwillis 620ab8e
fix: return booleans from chat client streamResponse
samwillis 098e07e
Merge remote-tracking branch 'origin/main' into thruflo/durable-sessi…
samwillis 3b1c3b1
chore: add changeset for durable chat updates
samwillis 3d858c1
feat: add sessionGenerating lifecycle for shared generation activity
samwillis ac7905e
fix: make stream finalization run-aware and fix reconnect message dedup
samwillis 78bcfcb
fix: clean up framework client type exports
samwillis 16f983c
chore: add changeset for subscription lifecycle updates
samwillis 0503d13
Merge branch 'main' into pr-356-sub-lifecycle
jherr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| '@tanstack/ai': patch | ||
| '@tanstack/ai-client': patch | ||
| '@tanstack/ai-preact': patch | ||
| '@tanstack/ai-react': patch | ||
| '@tanstack/ai-solid': patch | ||
| '@tanstack/ai-svelte': patch | ||
| '@tanstack/ai-vue': patch | ||
| --- | ||
|
|
||
| Add an explicit subscription lifecycle to `ChatClient` with `subscribe()`/`unsubscribe()`, `isSubscribed`, `connectionStatus`, and `sessionGenerating`, while keeping request lifecycle state separate from long-lived connection state for durable chat sessions. | ||
|
|
||
| Update the React, Preact, Solid, Svelte, and Vue chat bindings with `live` mode plus reactive subscription/session state, and improve `StreamProcessor` handling for concurrent runs and reconnects so active sessions do not finalize early or duplicate resumed assistant messages. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| '@tanstack/ai': patch | ||
| '@tanstack/ai-client': patch | ||
| '@tanstack/ai-react': patch | ||
| '@tanstack/ai-solid': patch | ||
| '@tanstack/ai-svelte': patch | ||
| '@tanstack/ai-vue': patch | ||
| --- | ||
|
|
||
| Add durable `subscribe()`/`send()` transport support to `ChatClient` while preserving compatibility with existing `connect()` adapters. This also introduces shared generation clients for one-shot streaming tasks and updates the framework wrappers to use the new generation transport APIs. | ||
|
|
||
| Improve core stream processing to better handle concurrent runs and resumed streams so shared sessions stay consistent during reconnects and overlapping generations. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
@tanstack/ai-preactto this changeset.packages/typescript/ai-preact/src/use-chat.tschanges the hook's public behavior and return state, but@tanstack/ai-preactis missing from the release plan here. Without an entry, those changes will not publish.Suggested update
'@tanstack/ai': patch '@tanstack/ai-client': patch +'@tanstack/ai-preact': patch '@tanstack/ai-react': patch '@tanstack/ai-solid': patch '@tanstack/ai-svelte': patch '@tanstack/ai-vue': patch📝 Committable suggestion
🤖 Prompt for AI Agents