@tanstack/ai-angular 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/dist/README.md +11 -10
- package/dist/fesm2022/tanstack-ai-angular-byok.mjs +1 -6
- package/dist/fesm2022/tanstack-ai-angular-ui.mjs +578 -326
- package/dist/fesm2022/tanstack-ai-angular-ui.mjs.map +1 -1
- package/dist/fesm2022/tanstack-ai-angular.mjs +457 -665
- package/dist/fesm2022/tanstack-ai-angular.mjs.map +1 -1
- package/dist/types/tanstack-ai-angular-byok.d.ts +2 -1
- package/dist/types/tanstack-ai-angular-ui.d.ts +80 -95
- package/dist/types/tanstack-ai-angular.d.ts +414 -380
- package/package.json +17 -16
- package/src/index.ts +8 -0
- package/src/inject-generate-3d-model.ts +92 -0
- package/dist/fesm2022/tanstack-ai-angular-byok.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/ai-angular",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Angular signals integration for TanStack AI streaming chat, structured outputs, and media generation.",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,29 +54,30 @@
|
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"tslib": "^2.8.1",
|
|
57
|
-
"@tanstack/ai-client": "^1.0
|
|
57
|
+
"@tanstack/ai-client": "^1.2.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@angular/common": ">=
|
|
61
|
-
"@angular/core": ">=
|
|
62
|
-
"@tanstack/ai": "^1.0
|
|
60
|
+
"@angular/common": ">=22.0.0 <23",
|
|
61
|
+
"@angular/core": ">=22.0.0 <23",
|
|
62
|
+
"@tanstack/ai": "^1.7.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@analogjs/vite-plugin-angular": "^2.6
|
|
66
|
-
"@angular/build": "
|
|
67
|
-
"@angular/common": "^
|
|
68
|
-
"@angular/compiler": "^
|
|
69
|
-
"@angular/
|
|
70
|
-
"@angular/
|
|
71
|
-
"@angular/platform-browser
|
|
65
|
+
"@analogjs/vite-plugin-angular": "^2.9.6",
|
|
66
|
+
"@angular/build": "22.2.4",
|
|
67
|
+
"@angular/common": "^22.2.4",
|
|
68
|
+
"@angular/compiler": "^22.2.4",
|
|
69
|
+
"@angular/compiler-cli": "22.2.4",
|
|
70
|
+
"@angular/core": "^22.2.4",
|
|
71
|
+
"@angular/platform-browser": "^22.2.4",
|
|
72
|
+
"@angular/platform-browser-dynamic": "^22.2.4",
|
|
72
73
|
"@types/node": "^24.10.1",
|
|
73
74
|
"jsdom": "^27.4.0",
|
|
74
|
-
"ng-packagr": "^
|
|
75
|
-
"typescript": "
|
|
76
|
-
"vitest": "^4.1.
|
|
75
|
+
"ng-packagr": "^22.2.1",
|
|
76
|
+
"typescript": "6.0.2",
|
|
77
|
+
"vitest": "^4.1.12",
|
|
77
78
|
"zod": "^4.2.0",
|
|
78
79
|
"zone.js": "^0.15.0",
|
|
79
|
-
"@tanstack/ai": "1.0
|
|
80
|
+
"@tanstack/ai": "1.7.0"
|
|
80
81
|
},
|
|
81
82
|
"scripts": {
|
|
82
83
|
"clean": "premove ./build ./dist",
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,13 @@ export type {
|
|
|
26
26
|
InjectGenerateImageResult,
|
|
27
27
|
} from './inject-generate-image'
|
|
28
28
|
|
|
29
|
+
// Generate 3D Model (experimental)
|
|
30
|
+
export { injectGenerate3DModel } from './inject-generate-3d-model'
|
|
31
|
+
export type {
|
|
32
|
+
InjectGenerate3DModelOptions,
|
|
33
|
+
InjectGenerate3DModelResult,
|
|
34
|
+
} from './inject-generate-3d-model'
|
|
35
|
+
|
|
29
36
|
// Generate Audio
|
|
30
37
|
export { injectGenerateAudio } from './inject-generate-audio'
|
|
31
38
|
export type {
|
|
@@ -166,4 +173,5 @@ export {
|
|
|
166
173
|
type VideoGenerateInput,
|
|
167
174
|
type VideoGenerateResult,
|
|
168
175
|
type VideoStatusInfo,
|
|
176
|
+
type Model3DGenerateInput,
|
|
169
177
|
} from '@tanstack/ai-client'
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { injectGeneration } from './inject-generation'
|
|
2
|
+
import type { Signal } from '@angular/core'
|
|
3
|
+
import type { Model3DResult } from '@tanstack/ai'
|
|
4
|
+
import type {
|
|
5
|
+
GenerationClientState,
|
|
6
|
+
InferGenerationOutputFromReturn,
|
|
7
|
+
Model3DGenerateInput,
|
|
8
|
+
} from '@tanstack/ai-client'
|
|
9
|
+
import type {
|
|
10
|
+
InjectGenerationOptions,
|
|
11
|
+
InjectGenerationResult,
|
|
12
|
+
} from './inject-generation'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Options for {@link injectGenerate3DModel}.
|
|
16
|
+
*
|
|
17
|
+
* @experimental 3D model generation is experimental. The shape can change in
|
|
18
|
+
* a minor release.
|
|
19
|
+
*/
|
|
20
|
+
export type InjectGenerate3DModelOptions<TOutput = Model3DResult> = Omit<
|
|
21
|
+
InjectGenerationOptions<Model3DGenerateInput, Model3DResult, TOutput>,
|
|
22
|
+
| 'onResult'
|
|
23
|
+
| 'reconstructResult'
|
|
24
|
+
| 'persistence'
|
|
25
|
+
| 'hydrateGeneration'
|
|
26
|
+
| 'joinRun'
|
|
27
|
+
> & {
|
|
28
|
+
onResult?: (result: Model3DResult) => TOutput | null | void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Return type of {@link injectGenerate3DModel}.
|
|
33
|
+
*
|
|
34
|
+
* @experimental 3D model generation is experimental. The shape can change in
|
|
35
|
+
* a minor release.
|
|
36
|
+
*/
|
|
37
|
+
export interface InjectGenerate3DModelResult<
|
|
38
|
+
TOutput = Model3DResult,
|
|
39
|
+
> extends Omit<InjectGenerationResult<TOutput>, 'generate'> {
|
|
40
|
+
generate: (input: Model3DGenerateInput) => Promise<void>
|
|
41
|
+
result: Signal<TOutput | null>
|
|
42
|
+
isLoading: Signal<boolean>
|
|
43
|
+
error: Signal<Error | undefined>
|
|
44
|
+
status: Signal<GenerationClientState>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Generates a 3D model from a text or image prompt, with Angular signals.
|
|
49
|
+
*
|
|
50
|
+
* The server route runs `generate3DModel()` and streams the response. The
|
|
51
|
+
* stream sends `generation:progress` events while the provider job runs, then
|
|
52
|
+
* one `generation:result` event with the `Model3DResult`. Call it in an
|
|
53
|
+
* injection context (a component field initializer, the constructor, or
|
|
54
|
+
* `runInInjectionContext`).
|
|
55
|
+
*
|
|
56
|
+
* @param options - A `connection` (streaming) or a `fetcher` (one request),
|
|
57
|
+
* a `threadId`, and optional callbacks (`onResult`, `onProgress`, `onError`).
|
|
58
|
+
* If `onResult` returns a value, `result` holds that value.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* model = injectGenerate3DModel({
|
|
63
|
+
* threadId: 'product-model',
|
|
64
|
+
* connection: fetchServerSentEvents('/api/generate/3d-model'),
|
|
65
|
+
* })
|
|
66
|
+
*
|
|
67
|
+
* this.model.generate({ prompt: 'A low-poly wooden chair' })
|
|
68
|
+
* // this.model.result()?.url is the GLB file
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @experimental 3D model generation is experimental. The shape can change in
|
|
72
|
+
* a minor release.
|
|
73
|
+
*/
|
|
74
|
+
export function injectGenerate3DModel<TTransformed = void>(
|
|
75
|
+
options: Omit<InjectGenerate3DModelOptions, 'onResult'> & {
|
|
76
|
+
onResult?: (result: Model3DResult) => TTransformed
|
|
77
|
+
},
|
|
78
|
+
): InjectGenerate3DModelResult<
|
|
79
|
+
InferGenerationOutputFromReturn<Model3DResult, TTransformed>
|
|
80
|
+
> {
|
|
81
|
+
const devtools = {
|
|
82
|
+
...options.devtools,
|
|
83
|
+
framework: 'angular' as const,
|
|
84
|
+
hookName: 'injectGenerate3DModel',
|
|
85
|
+
}
|
|
86
|
+
return injectGeneration<Model3DGenerateInput, Model3DResult, TTransformed>({
|
|
87
|
+
...options,
|
|
88
|
+
devtools,
|
|
89
|
+
// 3D results are never persisted, even if an untyped caller sets it.
|
|
90
|
+
persistence: false,
|
|
91
|
+
})
|
|
92
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tanstack-ai-angular-byok.mjs","sources":["../../byok/src/tanstack-ai-angular-byok.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;AAEG"}
|