Skip to content

Commit 71262b6

Browse files
tombeckenhamclaude
andcommitted
Merge branch 'main' into worktree-serialized-exploring-wall
Reconcile the typed-stream-chunks feature with main's typed-runtime-context (#628) and multimodal-tool-result (#666) work, which had diverged on the same hot paths. Key conflict resolutions: - types.ts: keep the branch's Pick<>-based event interfaces + TypedStreamChunk machinery; layer in main's `usage?: TokenUsage`, multimodal `result?: string | Array<ContentPart>`, and `state?: ToolOutputState` on ToolCallEndEvent (added `state` to the drift-guard Omit). Switched the typed-chunk constraints from `Tool<any,any,any>` to main's `AnyTool` (its bivariant `execute` is what lets concrete tools satisfy the constraint). - chat/index.ts: unify the two generic systems — main's `const TTools` inference (for context) now also feeds the branch's `TextActivityResult<…, TTools>` so streaming tool-call events stay typed. `tools?` widened to ReadonlyArray so const-inferred tuples / mergeAgentTools' readonly return fit. Removed now-unnecessary `as StreamChunk` casts (the literal `type` discriminators check structurally). - tool-calls.ts: executeTools keeps both the branch's typed `output` and main's `normalizeToolResult`/`state`/typed `executionContext`. - chat-params.ts: mergeAgentTools stays generic over `const TServerTools` (constrained to AnyTool) for name narrowing. - createChatOptions: preserve the concrete tool tuple in the return type while threading main's InferredContext. Validated: @tanstack/ai type-check + 1006 unit tests + 0 lint errors; affected workspace type-check (32 projects), unit tests (31), eslint, and build all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 parents 57c46ff + 86cf41c commit 71262b6

626 files changed

Lines changed: 48986 additions & 6648 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
33
"changelog": [
4-
"@svitejs/changesets-changelog-github-compact",
5-
{ "repo": "TanStack/ai" }
4+
"@changesets/changelog-github",
5+
{ "repo": "TanStack/ai", "disableThanks": true }
66
],
77
"commit": false,
88
"access": "public",

.github/workflows/autofix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
persist-credentials: false
2828
- name: Setup Tools
29-
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
29+
uses: TanStack/config/.github/setup@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
3030
- name: Fix formatting
3131
run: pnpm format
3232
- name: Apply fixes

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
persist-credentials: false
2929

3030
- name: Setup Tools
31-
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
31+
uses: TanStack/config/.github/setup@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
3232

3333
- name: Cache Playwright Browsers
3434
id: playwright-cache

.github/workflows/pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fetch-depth: 0
2525
persist-credentials: false
2626
- name: Setup Tools
27-
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
27+
uses: TanStack/config/.github/setup@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
2828
- name: Get base and head commits for `nx affected`
2929
uses: nrwl/nx-set-shas@3e9ad7370203c1e93d109be57f3b72eb0eb511b1 # v4.4.0
3030
with:
@@ -43,7 +43,7 @@ jobs:
4343
with:
4444
persist-credentials: false
4545
- name: Setup Tools
46-
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
46+
uses: TanStack/config/.github/setup@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
4747
- name: Build Packages
4848
run: pnpm run build:all
4949
- name: Publish Previews
@@ -60,6 +60,6 @@ jobs:
6060
with:
6161
persist-credentials: false
6262
- name: Setup Tools
63-
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
63+
uses: TanStack/config/.github/setup@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
6464
- name: Changeset Preview
65-
uses: TanStack/config/.github/changeset-preview@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
65+
uses: TanStack/config/.github/changeset-preview@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fetch-depth: 0
2929
persist-credentials: true # release job pushes version/docs changes
3030
- name: Setup Tools
31-
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
31+
uses: TanStack/config/.github/setup@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
3232
- name: Run Tests
3333
run: pnpm run test:ci
3434
- name: Run Changesets (version or publish)
@@ -59,6 +59,6 @@ jobs:
5959
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060
- name: Comment on PRs about release
6161
if: steps.changesets.outputs.published == 'true'
62-
uses: TanStack/config/.github/comment-on-release@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
62+
uses: TanStack/config/.github/comment-on-release@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
6363
with:
6464
published-packages: ${{ steps.changesets.outputs.publishedPackages }}

.github/workflows/sync-models.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
persist-credentials: true # sync job pushes generated model updates
2626

2727
- name: Setup Tools
28-
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
28+
uses: TanStack/config/.github/setup@a4c6d06ed525a310901e3e9fbed9b2301ebecfd5 # main
2929

3030
- name: Fetch and sync model metadata
3131
run: pnpm generate:models

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ docs/superpowers
7272
# Only .claude.settings.json should be committed
7373
.claude/settings.local.json
7474
.claude/worktrees/*
75+
.claude/scheduled_tasks.lock
7576
solo.yml
7677

7778
# Agent scratch output (gap-analysis reports, triage notes — generated locally)

AGENTS.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# AGENTS.md
2+
3+
Cross-agent guidance for this repository. See `CLAUDE.md` for the full project
4+
overview, architecture, and conventions — this file mirrors the rules that
5+
apply to every coding agent regardless of tool.
6+
7+
## Dependency Install
8+
9+
Run `pnpm install` before starting any task and again after every merge with
10+
`main`.
11+
12+
## Pre-PR Quality Gate (MANDATORY)
13+
14+
**Before committing, run the narrowest meaningful quality checks for your
15+
changes and confirm they pass locally. Before opening a PR or pushing changes
16+
intended for review, run the same checks CI runs.** If you make post-commit
17+
changes, rebase, or merge before pushing to a PR, rerun the relevant checks
18+
first.
19+
20+
Use the repo-preferred package manager, scripts, and Nx targets where
21+
applicable. Do **not** commit or push while quality checks are failing unless
22+
the user explicitly instructs otherwise; report the exact failing command and
23+
failure instead.
24+
25+
The single canonical command is:
26+
27+
```bash
28+
pnpm test:pr
29+
```
30+
31+
This runs the exact target set the `PR` workflow runs in CI
32+
(`nx affected --targets=test:sherif,test:knip,test:docs,test:eslint,test:lib,test:types,test:build,build --exclude=examples/**,testing/**`).
33+
34+
If you can't run `test:pr` (e.g. it's too slow on your machine), at minimum run
35+
each of these and confirm they're green before pushing:
36+
37+
- `pnpm test:sherif` — workspace consistency
38+
- `pnpm test:knip` — unused dependencies
39+
- `pnpm test:docs` — doc link verification
40+
- `pnpm test:eslint` — lint
41+
- `pnpm test:types` — typecheck
42+
- `pnpm test:lib` — unit tests
43+
- `pnpm test:build` — build artifact verification
44+
- `pnpm build` — build all affected packages
45+
- `pnpm --filter @tanstack/ai-e2e test:e2e` — E2E suite (mandatory for any
46+
behavior change; see `testing/e2e/README.md`)
47+
48+
Do **not** rely on CI as your first signal. Run locally, fix, then push.
49+
50+
## Everything Else
51+
52+
For package manager (`pnpm@10.17.0`), monorepo layout, adapter architecture,
53+
tool system, framework integrations, E2E requirements, and all other
54+
conventions, read `CLAUDE.md` in this directory.

CLAUDE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ TanStack AI is a type-safe, provider-agnostic AI SDK for building AI-powered app
1515
- **Linting**: ESLint with custom TanStack config
1616
- **Formatting**: Prettier
1717

18+
Run `pnpm install` before starting any task and again after every merge with
19+
`main`.
20+
1821
## Common Commands
1922

2023
### Testing
@@ -215,6 +218,34 @@ Each framework integration uses the headless `ai-client` under the hood.
215218
8. Format code: `pnpm format`
216219
9. Verify build: `pnpm test:build` or `pnpm build`
217220

221+
### Pre-PR Quality Gate (MANDATORY)
222+
223+
**Before committing, run the narrowest meaningful quality checks for your changes and confirm they pass locally. Before opening a PR or pushing changes intended for review, run the same checks CI runs.** If you make post-commit changes, rebase, or merge before pushing to a PR, rerun the relevant checks first.
224+
225+
Use the repo-preferred package manager, scripts, and Nx targets where applicable. Do **not** commit or push while quality checks are failing unless the user explicitly instructs otherwise; report the exact failing command and failure instead.
226+
227+
The single canonical command is:
228+
229+
```bash
230+
pnpm test:pr
231+
```
232+
233+
This runs the exact target set the `PR` workflow runs in CI (`nx affected --targets=test:sherif,test:knip,test:docs,test:eslint,test:lib,test:types,test:build,build --exclude=examples/**,testing/**`).
234+
235+
If you can't run `test:pr` (e.g. it's too slow on your machine), at minimum run each of these and confirm they're green before pushing:
236+
237+
- `pnpm test:sherif` — workspace consistency
238+
- `pnpm test:knip` — unused dependencies
239+
- `pnpm test:docs` — doc link verification
240+
- `pnpm test:eslint` — lint
241+
- `pnpm test:types` — typecheck
242+
- `pnpm test:lib` — unit tests
243+
- `pnpm test:build` — build artifact verification
244+
- `pnpm build` — build all affected packages
245+
- `pnpm --filter @tanstack/ai-e2e test:e2e` — E2E suite (mandatory for any behavior change; see E2E Testing)
246+
247+
Do **not** rely on CI as your first signal. Run locally, fix, then push.
248+
218249
### Working with Examples
219250

220251
Examples are not built by Nx. To run an example:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Official adapters include:
186186

187187
| Package | Use it for |
188188
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
189-
| [`@tanstack/ai-openrouter`](https://tanstack.com/ai/latest/docs/adapters/openrouter) | 300+ models through one OpenRouter API |
189+
| [`@tanstack/ai-openrouter`](https://tanstack.com/ai/latest/docs/adapters/openrouter) | 300+ models through one OpenRouter API, with per-request cost tracking |
190190
| [`@tanstack/ai-openai`](https://tanstack.com/ai/latest/docs/adapters/openai) | OpenAI chat, image, video, speech, transcription, realtime, and provider tools |
191191
| [`@tanstack/ai-anthropic`](https://tanstack.com/ai/latest/docs/adapters/anthropic) | Anthropic Claude chat, thinking, tools, and structured outputs |
192192
| [`@tanstack/ai-gemini`](https://tanstack.com/ai/latest/docs/adapters/gemini) | Google Gemini chat, image, speech, and audio generation |

0 commit comments

Comments
 (0)