@tanstack/ai-angular 0.14.1 → 1.0.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 +15 -4
- package/dist/README.md +15 -4
- package/dist/fesm2022/tanstack-ai-angular-ui.mjs +4 -6
- package/dist/fesm2022/tanstack-ai-angular-ui.mjs.map +1 -1
- package/dist/fesm2022/tanstack-ai-angular.mjs +13 -54
- package/dist/fesm2022/tanstack-ai-angular.mjs.map +1 -1
- package/dist/types/tanstack-ai-angular-ui.d.ts +2 -3
- package/dist/types/tanstack-ai-angular.d.ts +29 -46
- package/package.json +4 -4
- package/src/index.ts +0 -2
- package/src/inject-chat.ts +6 -34
- package/src/inject-generate-audio.ts +3 -6
- package/src/inject-generate-image.ts +2 -6
- package/src/inject-generate-speech.ts +2 -6
- package/src/inject-generate-video.ts +7 -20
- package/src/inject-generation.ts +8 -28
- package/src/inject-summarize.ts +2 -6
- package/src/inject-transcription.ts +2 -6
- package/src/inject-web-mcp-tools.ts +1 -13
- package/src/types.ts +2 -12
- package/ui/src/create-chat-hook.ts +7 -12
|
@@ -26,12 +26,6 @@ export type InjectRegisterWebMCPToolsOptions<
|
|
|
26
26
|
onError?: (error: unknown) => void
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/** @deprecated Use `InjectRegisterWebMCPToolsOptions`. Removed in 1.0.0. */
|
|
30
|
-
export type InjectWebMCPToolsOptions<
|
|
31
|
-
TTools extends ReadonlyArray<AnyClientTool>,
|
|
32
|
-
TContext = InferredClientContext<TTools>,
|
|
33
|
-
> = InjectRegisterWebMCPToolsOptions<TTools, TContext>
|
|
34
|
-
|
|
35
29
|
/**
|
|
36
30
|
* Registers executable client tools with WebMCP for the current Angular owner.
|
|
37
31
|
*
|
|
@@ -74,12 +68,6 @@ export function injectRegisterWebMCPTools<
|
|
|
74
68
|
})
|
|
75
69
|
}
|
|
76
70
|
|
|
77
|
-
/**
|
|
78
|
-
* @deprecated Use `injectRegisterWebMCPTools`. Removed in 1.0.0.
|
|
79
|
-
* @alias
|
|
80
|
-
*/
|
|
81
|
-
export const injectWebMCPTools = injectRegisterWebMCPTools
|
|
82
|
-
|
|
83
71
|
/** Options for {@link injectPageWebMCPTools}. */
|
|
84
72
|
export type InjectPageWebMCPToolsOptions = Omit<
|
|
85
73
|
SubscribeWebMCPToolsOptions,
|
|
@@ -100,7 +88,7 @@ export type InjectPageWebMCPToolsOptions = Omit<
|
|
|
100
88
|
* pageTools = injectPageWebMCPTools({
|
|
101
89
|
* filter: (tool) => tool.origin === location.origin,
|
|
102
90
|
* })
|
|
103
|
-
* chat = injectChat({ connection, tools: this.pageTools })
|
|
91
|
+
* chat = injectChat({ threadId: 'support-1', connection, tools: this.pageTools })
|
|
104
92
|
* ```
|
|
105
93
|
*/
|
|
106
94
|
export function injectPageWebMCPTools(
|
package/src/types.ts
CHANGED
|
@@ -61,7 +61,7 @@ export type DeepPartial<T> =
|
|
|
61
61
|
*
|
|
62
62
|
* Mirrors the Vue `useChat` options, except:
|
|
63
63
|
* - State-change callbacks are managed internally and exposed as signals.
|
|
64
|
-
* - `tools`, `
|
|
64
|
+
* - `tools`, `forwardedProps`, and `live` accept a {@link ReactiveOption} so
|
|
65
65
|
* they can be a static value, a `Signal`, or a getter and stay reactive.
|
|
66
66
|
*/
|
|
67
67
|
export type InjectChatOptions<
|
|
@@ -85,7 +85,6 @@ export type InjectChatOptions<
|
|
|
85
85
|
| 'onRunIdChange'
|
|
86
86
|
| 'context'
|
|
87
87
|
| 'devtools'
|
|
88
|
-
| 'body'
|
|
89
88
|
| 'forwardedProps'
|
|
90
89
|
| 'tools'
|
|
91
90
|
> & {
|
|
@@ -93,9 +92,7 @@ export type InjectChatOptions<
|
|
|
93
92
|
devtools?: AIDevtoolsDisplayOptions
|
|
94
93
|
/** Client-side tools with execution logic. Reactive. */
|
|
95
94
|
tools?: ReactiveOption<TTools>
|
|
96
|
-
/**
|
|
97
|
-
body?: ReactiveOption<Record<string, any>>
|
|
98
|
-
/** Forwarded request props (preferred over `body`). Reactive. */
|
|
95
|
+
/** Forwarded request props. Reactive. */
|
|
99
96
|
forwardedProps?: ReactiveOption<Record<string, any>>
|
|
100
97
|
/** Whether to keep a live subscription open. Reactive. */
|
|
101
98
|
live?: ReactiveOption<boolean>
|
|
@@ -160,11 +157,6 @@ interface BaseInjectChatResult<
|
|
|
160
157
|
state?: 'output-available' | 'output-error'
|
|
161
158
|
errorText?: string
|
|
162
159
|
}) => Promise<void>
|
|
163
|
-
/** Respond to a tool approval request. */
|
|
164
|
-
addToolApprovalResponse: (response: {
|
|
165
|
-
id: string
|
|
166
|
-
approved: boolean
|
|
167
|
-
}) => Promise<void>
|
|
168
160
|
/**
|
|
169
161
|
* The id of the run this client has in flight — one it started or rejoined —
|
|
170
162
|
* or `null` when there is none (including while a run sits paused on an
|
|
@@ -179,8 +171,6 @@ interface BaseInjectChatResult<
|
|
|
179
171
|
runId: Signal<string | null>
|
|
180
172
|
/** Immutable bound interrupts for the current interrupted run. */
|
|
181
173
|
interrupts: Signal<BoundInterrupts<TTools, TInterrupts>>
|
|
182
|
-
/** @deprecated Use `interrupts`. */
|
|
183
|
-
pendingInterrupts: Signal<BoundInterrupts<TTools, TInterrupts>>
|
|
184
174
|
/** Batch-level interrupt errors. */
|
|
185
175
|
interruptErrors: Signal<
|
|
186
176
|
ChatInterruptState<TTools, TInterrupts>['interruptErrors']
|
|
@@ -19,10 +19,9 @@ type HeadlessOptions<TOptions> = InjectChatOptions<
|
|
|
19
19
|
>
|
|
20
20
|
|
|
21
21
|
type ChatInstanceOverrides<TOptions> = {
|
|
22
|
-
threadId
|
|
22
|
+
threadId: string
|
|
23
23
|
live?: HeadlessOptions<TOptions>['live']
|
|
24
24
|
forwardedProps?: HeadlessOptions<TOptions>['forwardedProps']
|
|
25
|
-
body?: HeadlessOptions<TOptions>['body']
|
|
26
25
|
initialMessages?: HeadlessOptions<TOptions>['initialMessages']
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -48,16 +47,12 @@ export function createChatHook<
|
|
|
48
47
|
chatComponents as ChatUIFactoryConfig<NoInfer<TOptions>, TInput>,
|
|
49
48
|
)
|
|
50
49
|
|
|
51
|
-
function injectAppChat(overrides
|
|
50
|
+
function injectAppChat(overrides: ChatInstanceOverrides<TOptions>) {
|
|
52
51
|
assertInInjectionContext(injectAppChat)
|
|
53
|
-
const chat = (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...overrides,
|
|
58
|
-
})
|
|
59
|
-
: injectChat(options as HeadlessOptions<TOptions>)
|
|
60
|
-
) as ChatUIHost<TOptions>
|
|
52
|
+
const chat = injectChat({
|
|
53
|
+
...(options as HeadlessOptions<TOptions>),
|
|
54
|
+
...overrides,
|
|
55
|
+
}) as ChatUIHost<TOptions>
|
|
61
56
|
return chat
|
|
62
57
|
}
|
|
63
58
|
|
|
@@ -68,7 +63,7 @@ export function createChatHook<
|
|
|
68
63
|
ChatProvider: ui.ChatProvider,
|
|
69
64
|
} as {
|
|
70
65
|
injectAppChat: (
|
|
71
|
-
overrides
|
|
66
|
+
overrides: ChatInstanceOverrides<TOptions>,
|
|
72
67
|
) => ChatUIHost<TOptions>
|
|
73
68
|
injectChatContext: () => ChatUIHost<TOptions>
|
|
74
69
|
Chat: Type<unknown>
|