Skip to content

Commit b2a5fab

Browse files
JoviDeCroockAlemTuzlakautofix-ci[bot]
authored
Add preact devtools (#204)
* Add preact devtools * Fix package.json * Bump devtools * Correct repo directory * update readme * ci: apply automated fixes --------- Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 7573619 commit b2a5fab

File tree

18 files changed

+347
-15
lines changed

18 files changed

+347
-15
lines changed

.changeset/every-keys-beg.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@tanstack/ai-devtools-core': minor
3+
'@tanstack/react-ai-devtools': minor
4+
'@tanstack/solid-ai-devtools': minor
5+
---
6+
7+
Bump tanstack-devtools to 0.2.3

.changeset/slow-falcons-leave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/preact-ai-devtools': minor
3+
---
4+
5+
Initial release

docs/getting-started/devtools.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ Or the `@tanstack/solid-ai-devtools` package for SolidJS:
2424
npm install -D @tanstack/solid-ai-devtools @tanstack/solid-devtools
2525
```
2626

27+
Or the `@tanstack/preact-ai-devtools` package for Preact:
28+
```bash
29+
npm install -D @tanstack/preact-ai-devtools @tanstack/preact-devtools
30+
```
31+
2732
## Usage
2833

2934
Import and include the Devtools component in your application:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"format": "prettier --experimental-cli --ignore-unknown '**/*' --write",
3434
"generate-docs": "node scripts/generate-docs.ts && pnpm run copy:readme",
3535
"sync-docs-config": "node scripts/sync-docs-config.ts",
36-
"copy:readme": "cp README.md packages/typescript/ai/README.md && cp README.md packages/typescript/ai-devtools/README.md && cp README.md packages/typescript/ai-client/README.md && cp README.md packages/typescript/ai-gemini/README.md && cp README.md packages/typescript/ai-ollama/README.md && cp README.md packages/typescript/ai-openai/README.md && cp README.md packages/typescript/ai-react/README.md && cp README.md packages/typescript/ai-react-ui/README.md && cp README.md packages/typescript/react-ai-devtools/README.md && cp README.md packages/typescript/solid-ai-devtools/README.md",
36+
"copy:readme": "cp README.md packages/typescript/ai/README.md && cp README.md packages/typescript/ai-devtools/README.md && cp README.md packages/typescript/preact-ai-devtools/README.md && cp README.md packages/typescript/ai-client/README.md && cp README.md packages/typescript/ai-gemini/README.md && cp README.md packages/typescript/ai-ollama/README.md && cp README.md packages/typescript/ai-openai/README.md && cp README.md packages/typescript/ai-react/README.md && cp README.md packages/typescript/ai-react-ui/README.md && cp README.md packages/typescript/react-ai-devtools/README.md && cp README.md packages/typescript/solid-ai-devtools/README.md",
3737
"changeset": "changeset",
3838
"changeset:publish": "changeset publish",
3939
"changeset:version": "changeset version && pnpm install --no-frozen-lockfile && pnpm format"

packages/typescript/ai-devtools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"dependencies": {
4949
"@tanstack/ai": "workspace:*",
5050
"@tanstack/devtools-ui": "^0.4.4",
51-
"@tanstack/devtools-utils": "^0.0.8",
51+
"@tanstack/devtools-utils": "^0.2.3",
5252
"goober": "^2.1.18",
5353
"solid-js": "^1.9.10"
5454
},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# @tanstack/preact-ai-devtools
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<div align="center">
2+
<img src="./media/header_ai.png" >
3+
</div>
4+
5+
<br />
6+
7+
<div align="center">
8+
<a href="https://npmjs.com/package/@tanstack/ai" target="\_parent">
9+
<img alt="" src="https://img.shields.io/npm/dm/@tanstack/ai.svg" />
10+
</a>
11+
<a href="https://github.com/TanStack/ai" target="\_parent">
12+
<img alt="" src="https://img.shields.io/github/stars/TanStack/ai.svg?style=social&label=Star" alt="GitHub stars" />
13+
</a>
14+
<a href="https://bundlephobia.com/result?p=@tanstack/ai@latest" target="\_parent">
15+
<img alt="" src="https://badgen.net/bundlephobia/minzip/@tanstack/ai@latest" />
16+
</a>
17+
</div>
18+
19+
<div align="center">
20+
<a href="#badge">
21+
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
22+
</a>
23+
<a href="#badge">
24+
<img src="https://img.shields.io/github/v/release/tanstack/ai" alt="Release"/>
25+
</a>
26+
<a href="https://twitter.com/tan_stack">
27+
<img src="https://img.shields.io/twitter/follow/tan_stack.svg?style=social" alt="Follow @TanStack"/>
28+
</a>
29+
</div>
30+
31+
<div align="center">
32+
33+
### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
34+
</div>
35+
36+
# TanStack AI
37+
38+
A powerful, type-safe AI SDK for building AI-powered applications.
39+
40+
- Provider-agnostic adapters (OpenAI, Anthropic, Gemini, Ollama, etc.)
41+
- **Tree-shakeable adapters** - Import only what you need for smaller bundles
42+
- **Multimodal content support** - Send images, audio, video, and documents
43+
- **Image generation** - Generate images with OpenAI DALL-E/GPT-Image and Gemini Imagen
44+
- Chat completion, streaming, and agent loop strategies
45+
- Headless chat state management with adapters (SSE, HTTP stream, custom)
46+
- Isomorphic type-safe tools with server/client execution
47+
- **Enhanced integration with TanStack Start** - Share implementations between AI tools and server functions
48+
49+
### <a href="https://tanstack.com/ai">Read the docs →</b></a>
50+
51+
## Tree-Shakeable Adapters
52+
53+
Import only the functionality you need for smaller bundle sizes:
54+
55+
```typescript
56+
// Only chat functionality - no summarization code bundled
57+
import { openaiText } from '@tanstack/ai-openai/adapters'
58+
import { generate } from '@tanstack/ai'
59+
60+
const textAdapter = openaiText()
61+
62+
const result = generate({
63+
adapter: textAdapter,
64+
model: 'gpt-4o',
65+
messages: [{ role: 'user', content: [{ type: 'text', content: 'Hello!' }] }],
66+
})
67+
68+
for await (const chunk of result) {
69+
console.log(chunk)
70+
}
71+
```
72+
73+
Available adapters: `openaiText`, `openaiEmbed`, `openaiSummarize`, `anthropicText`, `geminiText`, `ollamaText`, and more.
74+
75+
## Get Involved
76+
77+
- We welcome issues and pull requests!
78+
- Participate in [GitHub discussions](https://github.com/TanStack/ai/discussions)
79+
- Chat with the community on [Discord](https://discord.com/invite/WrRKjPJ)
80+
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions
81+
82+
## Partners
83+
84+
<table align="center">
85+
<tr>
86+
<td>
87+
<a href="https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS" >
88+
<picture>
89+
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-CMcuvjEy.svg" height="40" />
90+
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" />
91+
<img src="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" alt="CodeRabbit" />
92+
</picture>
93+
</a>
94+
</td>
95+
<td>
96+
<a href="https://www.cloudflare.com?utm_source=tanstack">
97+
<picture>
98+
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-DQDB7UaL.svg" height="60" />
99+
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" />
100+
<img src="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" alt="Cloudflare" />
101+
</picture>
102+
</a>
103+
</td>
104+
</tr>
105+
</table>
106+
107+
<div align="center">
108+
<img src="./media/partner_logo.svg" alt="AI & you?" height="65">
109+
<p>
110+
We're looking for TanStack AI Partners to join our mission! Partner with us to push the boundaries of TanStack AI and build amazing things together.
111+
</p>
112+
<a href="mailto:partners@tanstack.com?subject=TanStack AI Partnership"><b>LET'S CHAT</b></a>
113+
</div>
114+
115+
## Explore the TanStack Ecosystem
116+
117+
- <a href="https://github.com/tanstack/config"><b>TanStack Config</b></a> – Tooling for JS/TS packages
118+
- <a href="https://github.com/tanstack/db"><b>TanStack DB</b></a> – Reactive sync client store
119+
- <a href="https://github.com/tanstack/devtools"><b>TanStack Devtools</b></a> – Unified devtools panel
120+
- <a href="https://github.com/tanstack/form"><b>TanStack Form</b></a> – Type‑safe form state
121+
- <a href="https://github.com/tanstack/pacer"><b>TanStack Pacer</b></a> – Debouncing, throttling, batching
122+
- <a href="https://github.com/tanstack/query"><b>TanStack Query</b></a> – Async state & caching
123+
- <a href="https://github.com/tanstack/ranger"><b>TanStack Ranger</b></a> – Range & slider primitives
124+
- <a href="https://github.com/tanstack/router"><b>TanStack Router</b></a> – Type‑safe routing, caching & URL state
125+
- <a href="https://github.com/tanstack/router"><b>TanStack Start</b></a> – Full‑stack SSR & streaming
126+
- <a href="https://github.com/tanstack/store"><b>TanStack Store</b></a> – Reactive data store
127+
- <a href="https://github.com/tanstack/table"><b>TanStack Table</b></a> – Headless datagrids
128+
- <a href="https://github.com/tanstack/virtual"><b>TanStack Virtual</b></a> – Virtualized rendering
129+
130+
… and more at <a href="https://tanstack.com"><b>TanStack.com »</b></a>
131+
132+
<!-- USE THE FORCE LUKE -->
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "@tanstack/preact-ai-devtools",
3+
"version": "0.0.0",
4+
"description": "Preact Devtools for TanStack AI.",
5+
"author": "tannerlinsley",
6+
"license": "MIT",
7+
"homepage": "https://tanstack.com/ai",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/TanStack/ai.git",
11+
"directory": "packages/typescript/preact-ai-devtools"
12+
},
13+
"funding": {
14+
"type": "github",
15+
"url": "https://github.com/sponsors/tannerlinsley"
16+
},
17+
"scripts": {
18+
"clean": "premove ./build ./dist",
19+
"lint:fix": "eslint ./src --fix",
20+
"test:eslint": "eslint ./src",
21+
"test:lib": "vitest --passWithNoTests",
22+
"test:lib:dev": "pnpm test:lib --watch",
23+
"test:types": "tsc",
24+
"test:build": "publint --strict",
25+
"build": "vite build"
26+
},
27+
"type": "module",
28+
"types": "./dist/esm/index.d.ts",
29+
"module": "./dist/esm/index.js",
30+
"exports": {
31+
".": {
32+
"import": {
33+
"types": "./dist/esm/index.d.ts",
34+
"default": "./dist/esm/index.js"
35+
}
36+
},
37+
"./production": {
38+
"import": {
39+
"types": "./dist/esm/production.d.ts",
40+
"default": "./dist/esm/production.js"
41+
}
42+
},
43+
"./package.json": "./package.json"
44+
},
45+
"sideEffects": false,
46+
"files": [
47+
"dist",
48+
"src"
49+
],
50+
"dependencies": {
51+
"@tanstack/ai-devtools-core": "workspace:*",
52+
"@tanstack/devtools-utils": "^0.2.3"
53+
},
54+
"devDependencies": {
55+
"@vitest/coverage-v8": "4.0.14",
56+
"vite": "^7.2.7"
57+
},
58+
"peerDependencies": {
59+
"preact": "^10.0.0"
60+
}
61+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { createPreactPanel } from '@tanstack/devtools-utils/preact'
2+
import { AiDevtoolsCore } from '@tanstack/ai-devtools-core'
3+
import type { DevtoolsPanelProps } from '@tanstack/devtools-utils/preact'
4+
5+
const [AiDevtoolsPanel, AiDevtoolsPanelNoOp] = createPreactPanel(AiDevtoolsCore)
6+
7+
export interface AiDevtoolsPreactInit extends DevtoolsPanelProps {}
8+
9+
export { AiDevtoolsPanel, AiDevtoolsPanelNoOp }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as Devtools from './AiDevtools'
2+
import * as plugin from './plugin'
3+
4+
export const AiDevtoolsPanel =
5+
process.env.NODE_ENV !== 'development'
6+
? Devtools.AiDevtoolsPanelNoOp
7+
: Devtools.AiDevtoolsPanel
8+
9+
export const aiDevtoolsPlugin =
10+
process.env.NODE_ENV !== 'development'
11+
? plugin.aiDevtoolsNoOpPlugin
12+
: plugin.aiDevtoolsPlugin
13+
14+
export type { AiDevtoolsPreactInit } from './AiDevtools'

0 commit comments

Comments
 (0)