@langchain/angular 0.2.0 → 0.3.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 +17 -15
- package/dist/context.cjs +0 -49
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +1 -46
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.ts +1 -46
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -49
- package/dist/context.js.map +1 -1
- package/dist/index.cjs +118 -401
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +261 -27
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +261 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +119 -404
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/index.d.cts +2 -2
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/index.d.ts +2 -2
- package/dist/stream.custom.cjs +54 -158
- package/dist/stream.custom.cjs.map +1 -1
- package/dist/stream.custom.d.cts +45 -0
- package/dist/stream.custom.d.cts.map +1 -0
- package/dist/stream.custom.d.ts +45 -0
- package/dist/stream.custom.d.ts.map +1 -0
- package/dist/stream.custom.js +55 -160
- package/dist/stream.custom.js.map +1 -1
- package/dist/subagent-types.d.cts +15 -0
- package/dist/subagent-types.d.cts.map +1 -0
- package/dist/subagent-types.d.ts +15 -0
- package/dist/subagent-types.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClassSubagentStreamInterface } from "./subagent-types.js";
|
|
2
|
+
import { injectStreamCustom, useStreamCustom } from "./stream.custom.js";
|
|
3
|
+
import { STREAM_DEFAULTS, STREAM_INSTANCE, StreamDefaults, provideStream, provideStreamDefaults } from "./context.js";
|
|
2
4
|
import { Signal, WritableSignal } from "@angular/core";
|
|
3
5
|
import * as _langchain_langgraph_sdk_ui0 from "@langchain/langgraph-sdk/ui";
|
|
4
6
|
import { AcceptBaseMessages, AgentTypeConfigLike, AnyStreamOptions, BaseStream, BaseSubagentState, CompiledSubAgentLike, DeepAgentTypeConfigLike, DefaultSubagentStates, ExtractAgentConfig, ExtractDeepAgentConfig, ExtractSubAgentMiddleware, FetchStreamTransport, GetConfigurableType, GetInterruptType, GetToolCallsType, HistoryWithBaseMessages, InferAgentToolCalls, InferBag, InferBag as InferBag$1, InferDeepAgentSubagents, InferNodeNames, InferStateType, InferStateType as InferStateType$1, InferSubagentByName, InferSubagentNames, InferSubagentState, InferSubagentStates, InferToolCalls, IsAgentLike, IsDeepAgentLike, MessageMetadata, MessageMetadata as MessageMetadata$1, QueueEntry, QueueInterface, ResolveStreamInterface, ResolveStreamInterface as ResolveStreamInterface$1, ResolveStreamOptions, ResolveStreamOptions as ResolveStreamOptions$1, SubAgentLike, SubagentApi, SubagentManager, SubagentStateMap, SubagentStatus, SubagentStream, SubagentStreamInterface, SubagentStreamInterface as SubagentStreamInterface$1, SubagentToolCall, SubmitOptions, UseAgentStream, UseAgentStreamOptions, UseDeepAgentStream, UseDeepAgentStreamOptions, UseStreamCustomOptions, UseStreamCustomOptions as UseStreamCustomOptions$1, UseStreamOptions, UseStreamThread, UseStreamTransport, calculateDepthFromNamespace, extractParentIdFromNamespace, extractToolCallIdFromNamespace, isSubagentNamespace } from "@langchain/langgraph-sdk/ui";
|
|
5
7
|
import * as _langchain_langgraph_sdk0 from "@langchain/langgraph-sdk";
|
|
6
|
-
import { BagTemplate, Client, DefaultToolCall, DefaultToolCall as DefaultToolCall$1, Interrupt, Message, StreamEvent, StreamMode,
|
|
8
|
+
import { BagTemplate, Client, DefaultToolCall, DefaultToolCall as DefaultToolCall$1, Interrupt, Message, StreamEvent, StreamMode, ToolCallFromTool, ToolCallState, ToolCallWithResult as ToolCallWithResult$1, ToolCallsFromTools } from "@langchain/langgraph-sdk";
|
|
7
9
|
import * as _langchain_core_messages0 from "@langchain/core/messages";
|
|
8
10
|
import { AIMessage, BaseMessage, ToolMessage } from "@langchain/core/messages";
|
|
9
11
|
|
|
10
12
|
//#region src/index.d.ts
|
|
11
13
|
type ClassToolCallWithResult<T> = T extends ToolCallWithResult$1<infer TC, unknown, unknown> ? ToolCallWithResult$1<TC, ToolMessage, AIMessage> : T;
|
|
12
|
-
type ClassSubagentStreamInterface<StateType = Record<string, unknown>, ToolCall = DefaultToolCall$1, SubagentName extends string = string> = Omit<SubagentStreamInterface$1<StateType, ToolCall, SubagentName>, "messages"> & {
|
|
13
|
-
messages: BaseMessage[];
|
|
14
|
-
};
|
|
15
14
|
type WithClassMessages<T> = Omit<T, "messages" | "history" | "getMessagesMetadata" | "toolCalls" | "getToolCalls" | "submit" | "subagents" | "activeSubagents" | "getSubagent" | "getSubagentsByType" | "getSubagentsByMessage"> & {
|
|
16
15
|
messages: BaseMessage[];
|
|
17
16
|
getMessagesMetadata: (message: BaseMessage, index?: number) => MessageMetadata$1<Record<string, unknown>> | undefined;
|
|
@@ -60,8 +59,243 @@ type AngularQueueInterface<T> = T extends {
|
|
|
60
59
|
clear: Cl;
|
|
61
60
|
} : T;
|
|
62
61
|
type AngularSignalWrap<T> = { [K in keyof T]: K extends AngularPlainKeys ? T[K] : K extends AngularWritableKeys ? WritableSignal<T[K]> : K extends "queue" ? AngularQueueInterface<T[K]> : Signal<T[K]> };
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Injects the shared stream instance from the nearest ancestor that provided
|
|
64
|
+
* one via {@link provideStream}. Throws if no ancestor provides a stream
|
|
65
|
+
* instance.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* import { Component } from "@angular/core";
|
|
70
|
+
* import { injectStream } from "@langchain/angular";
|
|
71
|
+
*
|
|
72
|
+
* @Component({
|
|
73
|
+
* template: `
|
|
74
|
+
* @for (msg of stream.messages(); track msg.id) {
|
|
75
|
+
* <div>{{ msg.content }}</div>
|
|
76
|
+
* }
|
|
77
|
+
* <button
|
|
78
|
+
* [disabled]="stream.isLoading()"
|
|
79
|
+
* (click)="onSubmit()"
|
|
80
|
+
* >Send</button>
|
|
81
|
+
* `,
|
|
82
|
+
* })
|
|
83
|
+
* export class ChatComponent {
|
|
84
|
+
* stream = injectStream();
|
|
85
|
+
*
|
|
86
|
+
* onSubmit() {
|
|
87
|
+
* void this.stream.submit({
|
|
88
|
+
* messages: [{ type: "human", content: "Hello!" }],
|
|
89
|
+
* });
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @example With type parameters for full type safety:
|
|
95
|
+
* ```typescript
|
|
96
|
+
* import type { agent } from "./agent";
|
|
97
|
+
*
|
|
98
|
+
* export class ChatComponent {
|
|
99
|
+
* stream = injectStream<typeof agent>();
|
|
100
|
+
* // stream.messages() returns typed messages
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
declare function injectStream<T = Record<string, unknown>, Bag extends BagTemplate = BagTemplate>(): AngularSignalWrap<WithClassMessages<ResolveStreamInterface$1<T, InferBag$1<T, Bag>>>>;
|
|
105
|
+
/**
|
|
106
|
+
* Angular entry point for LangGraph streaming. Call from a component, directive,
|
|
107
|
+
* or service field initializer to get a **Signals-based** stream controller
|
|
108
|
+
* connected to the LangGraph Platform (HTTP + threads API).
|
|
109
|
+
*
|
|
110
|
+
* The returned object mirrors the shared `useStream` API from
|
|
111
|
+
* `@langchain/langgraph-sdk/ui`, but reactive fields are
|
|
112
|
+
* {@link https://angular.dev/guide/signals | Angular `Signal`s}:
|
|
113
|
+
* read state with calls like `stream.messages()`, `stream.values()`, and
|
|
114
|
+
* `stream.isLoading()`, and use `WritableSignal` setters where exposed (for
|
|
115
|
+
* example `stream.branch` for branch selection).
|
|
116
|
+
*
|
|
117
|
+
* ## Typing with `createDeepAgent`
|
|
118
|
+
*
|
|
119
|
+
* Expect `export const agent = createDeepAgent({ ... })` from `deepagents`. In
|
|
120
|
+
* UI code, `import { type agent } from "./agent"` (or `import type { agent }`)
|
|
121
|
+
* is a **type-only** import: it is erased when compiling, so the agent module
|
|
122
|
+
* does not run in the browser. You still pass **`typeof agent`** to
|
|
123
|
+
* `injectStream`, not `agent` alone — `agent` is a value; TypeScript only
|
|
124
|
+
* accepts it in a type position via `typeof` (otherwise: *refers to a value,
|
|
125
|
+
* but is being used as a type*). If you prefer a named type in generics, add
|
|
126
|
+
* `export type Agent = typeof agent` next to the const and use
|
|
127
|
+
* `injectStream<Agent>(...)`.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* // agent.ts
|
|
132
|
+
* import { createDeepAgent } from "deepagents";
|
|
133
|
+
* import { tool } from "langchain";
|
|
134
|
+
* import { z } from "zod";
|
|
135
|
+
*
|
|
136
|
+
* const getWeather = tool(
|
|
137
|
+
* async ({ location }) => `Weather in ${location}`,
|
|
138
|
+
* { name: "get_weather", schema: z.object({ location: z.string() }) },
|
|
139
|
+
* );
|
|
140
|
+
*
|
|
141
|
+
* export const agent = createDeepAgent({
|
|
142
|
+
* model: "openai:gpt-4o",
|
|
143
|
+
* tools: [getWeather],
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* // chat.component.ts — type-only import; no agent runtime in the frontend
|
|
147
|
+
* import { Component } from "@angular/core";
|
|
148
|
+
* import { injectStream } from "@langchain/angular";
|
|
149
|
+
* import { type agent } from "./agent";
|
|
150
|
+
*
|
|
151
|
+
* @Component({
|
|
152
|
+
* standalone: true,
|
|
153
|
+
* template: `
|
|
154
|
+
* @for (msg of stream.messages(); track msg.id ?? $index) {
|
|
155
|
+
* <p>{{ msg.content }}</p>
|
|
156
|
+
* }
|
|
157
|
+
* `,
|
|
158
|
+
* })
|
|
159
|
+
* export class ChatComponent {
|
|
160
|
+
* readonly stream = injectStream<typeof agent>({
|
|
161
|
+
* assistantId: "agent",
|
|
162
|
+
* apiUrl: "http://localhost:2024",
|
|
163
|
+
* });
|
|
164
|
+
* // stream.toolCalls()[0].call.name is typed as "get_weather"
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* ## Typing with `StateGraph` / custom graph state
|
|
169
|
+
*
|
|
170
|
+
* Use your graph state interface as `T` and embed tool call unions in
|
|
171
|
+
* `Message<...>[]` when you need discriminated tool types.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* import { Message } from "@langchain/langgraph-sdk";
|
|
176
|
+
* import { Component } from "@angular/core";
|
|
177
|
+
* import { injectStream } from "@langchain/angular";
|
|
178
|
+
*
|
|
179
|
+
* type MyToolCalls =
|
|
180
|
+
* | { name: "search"; args: { query: string }; id?: string }
|
|
181
|
+
* | { name: "calculate"; args: { expression: string }; id?: string };
|
|
182
|
+
*
|
|
183
|
+
* interface MyGraphState {
|
|
184
|
+
* messages: Message<MyToolCalls>[];
|
|
185
|
+
* context?: string;
|
|
186
|
+
* }
|
|
187
|
+
*
|
|
188
|
+
* @Component({ standalone: true, template: "" })
|
|
189
|
+
* export class ChatComponent {
|
|
190
|
+
* readonly stream = injectStream<MyGraphState>({
|
|
191
|
+
* assistantId: "my-graph",
|
|
192
|
+
* apiUrl: "http://localhost:2024",
|
|
193
|
+
* });
|
|
194
|
+
* // stream.values() is typed as MyGraphState | null
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* // Optional bag for interrupts, configurable, custom events, and updates
|
|
201
|
+
* import { Component } from "@angular/core";
|
|
202
|
+
* import { injectStream } from "@langchain/angular";
|
|
203
|
+
* import type { Message } from "@langchain/langgraph-sdk";
|
|
204
|
+
*
|
|
205
|
+
* interface MyGraphState {
|
|
206
|
+
* messages: Message[];
|
|
207
|
+
* }
|
|
208
|
+
*
|
|
209
|
+
* @Component({ standalone: true, template: "" })
|
|
210
|
+
* export class ChatComponent {
|
|
211
|
+
* readonly stream = injectStream<
|
|
212
|
+
* MyGraphState,
|
|
213
|
+
* {
|
|
214
|
+
* InterruptType: { question: string };
|
|
215
|
+
* ConfigurableType: { userId: string };
|
|
216
|
+
* }
|
|
217
|
+
* >({
|
|
218
|
+
* assistantId: "my-graph",
|
|
219
|
+
* apiUrl: "http://localhost:2024",
|
|
220
|
+
* });
|
|
221
|
+
* // stream.interrupt() is typed as { question: string } | undefined
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* ## Subagent streaming
|
|
226
|
+
*
|
|
227
|
+
* For `createDeepAgent` agents with `subagents`, set `filterSubagentMessages`
|
|
228
|
+
* and use `streamSubgraphs` on `submit` to populate `stream.subagents` and
|
|
229
|
+
* related helpers.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* import { Component } from "@angular/core";
|
|
234
|
+
* import { injectStream } from "@langchain/angular";
|
|
235
|
+
* import { type agent } from "./agent";
|
|
236
|
+
*
|
|
237
|
+
* @Component({ standalone: true, template: "" })
|
|
238
|
+
* export class DeepAgentChatComponent {
|
|
239
|
+
* readonly stream = injectStream<typeof agent>({
|
|
240
|
+
* assistantId: "deepagent",
|
|
241
|
+
* apiUrl: "http://localhost:2024",
|
|
242
|
+
* filterSubagentMessages: true,
|
|
243
|
+
* });
|
|
244
|
+
*
|
|
245
|
+
* send(content: string) {
|
|
246
|
+
* void this.stream.submit(
|
|
247
|
+
* { messages: [{ content, type: "human" }] },
|
|
248
|
+
* { streamSubgraphs: true },
|
|
249
|
+
* );
|
|
250
|
+
* }
|
|
251
|
+
* }
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @param options - LangGraph Platform client options (`apiUrl` or `client`),
|
|
255
|
+
* `assistantId`, stream modes, history, reconnect, subagent settings, etc.
|
|
256
|
+
*
|
|
257
|
+
* @returns A stream controller backed by Signals: graph values, messages,
|
|
258
|
+
* loading and error state, interrupts, tool calls, branching, queue, and
|
|
259
|
+
* `submit` / `stop` / `switchThread` helpers (writable where the UI layer
|
|
260
|
+
* requires mutation).
|
|
261
|
+
*
|
|
262
|
+
* @template T Agent type (with `~agentTypes`) from `createDeepAgent` or
|
|
263
|
+
* `createAgent`, or a state shape extending `Record<string, unknown>`.
|
|
264
|
+
* @template Bag Optional configuration bag:
|
|
265
|
+
* - `ConfigurableType` — `config.configurable` typing
|
|
266
|
+
* - `InterruptType` — human-in-the-loop interrupt payloads
|
|
267
|
+
* - `CustomEventType` — custom stream events
|
|
268
|
+
* - `UpdateType` — payload typing for `submit`
|
|
269
|
+
*
|
|
270
|
+
* @see {@link https://docs.langchain.com/oss/javascript/langgraph/overview | LangGraph JavaScript overview}
|
|
271
|
+
* @see {@link https://docs.langchain.com/oss/javascript/langchain/overview | LangChain JavaScript overview}
|
|
272
|
+
* @see {@link https://docs.langchain.com/oss/javascript/deepagents/overview | Deep Agents JavaScript overview}
|
|
273
|
+
*/
|
|
274
|
+
declare function injectStream<T = Record<string, unknown>, Bag extends BagTemplate = BagTemplate>(options: ResolveStreamOptions$1<T, InferBag$1<T, Bag>>): AngularSignalWrap<WithClassMessages<ResolveStreamInterface$1<T, InferBag$1<T, Bag>>>>;
|
|
275
|
+
/**
|
|
276
|
+
* Overload for a **custom transport** (`options.transport`), for example
|
|
277
|
+
* {@link FetchStreamTransport} or any implementation compatible with
|
|
278
|
+
* {@link injectStreamCustom}. Prefer {@link injectStreamCustom} directly when
|
|
279
|
+
* you only use custom transports and want a narrower import.
|
|
280
|
+
*
|
|
281
|
+
* @param options - Custom transport and stream options (must include
|
|
282
|
+
* `transport`).
|
|
283
|
+
*
|
|
284
|
+
* @returns The same Signals-based controller shape as the LangGraph Platform
|
|
285
|
+
* overload.
|
|
286
|
+
*
|
|
287
|
+
* @template T Agent type or state shape, matching the custom transport.
|
|
288
|
+
* @template Bag Same optional bag as the platform overload.
|
|
289
|
+
*
|
|
290
|
+
* @see {@link injectStreamCustom}
|
|
291
|
+
*/
|
|
292
|
+
declare function injectStream<T = Record<string, unknown>, Bag extends BagTemplate = BagTemplate>(options: UseStreamCustomOptions$1<InferStateType$1<T>, InferBag$1<T, Bag>>): AngularSignalWrap<WithClassMessages<ResolveStreamInterface$1<T, InferBag$1<T, Bag>>>>;
|
|
293
|
+
/**
|
|
294
|
+
* @deprecated Use `injectStream` instead. `useStream` will be removed in a
|
|
295
|
+
* future major version. `injectStream` follows Angular's `inject*` naming
|
|
296
|
+
* convention for injection-based patterns.
|
|
297
|
+
*/
|
|
298
|
+
declare const useStream: typeof injectStream;
|
|
65
299
|
declare function useStreamLGP<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends {
|
|
66
300
|
ConfigurableType?: Record<string, unknown>;
|
|
67
301
|
InterruptType?: unknown;
|
|
@@ -70,22 +304,22 @@ declare function useStreamLGP<StateType extends Record<string, unknown> = Record
|
|
|
70
304
|
} = BagTemplate>(options: AnyStreamOptions<StateType, Bag>): {
|
|
71
305
|
assistantId: string;
|
|
72
306
|
client: Client<_langchain_langgraph_sdk0.DefaultValues, _langchain_langgraph_sdk0.DefaultValues, unknown>;
|
|
73
|
-
values: Signal<
|
|
307
|
+
values: Signal<StateType>;
|
|
74
308
|
error: Signal<unknown>;
|
|
75
309
|
isLoading: WritableSignal<boolean>;
|
|
76
310
|
branch: WritableSignal<string>;
|
|
77
|
-
setBranch
|
|
311
|
+
setBranch(value: string): void;
|
|
78
312
|
messages: Signal<(BaseMessage<_langchain_core_messages0.MessageStructure<_langchain_core_messages0.MessageToolSet>, _langchain_core_messages0.MessageType> | _langchain_core_messages0.BaseMessageChunk<_langchain_core_messages0.MessageStructure<_langchain_core_messages0.MessageToolSet>, _langchain_core_messages0.MessageType>)[]>;
|
|
79
313
|
toolCalls: Signal<ToolCallWithResult$1<DefaultToolCall$1>[]>;
|
|
80
|
-
getToolCalls
|
|
314
|
+
getToolCalls(message: Message): ToolCallWithResult$1<DefaultToolCall$1>[];
|
|
81
315
|
interrupt: Signal<Interrupt<GetInterruptType<Bag>> | undefined>;
|
|
82
316
|
interrupts: Signal<Interrupt<GetInterruptType<Bag>>[]>;
|
|
83
|
-
history: Signal<ThreadState<any>[]>;
|
|
317
|
+
history: Signal<_langchain_langgraph_sdk0.ThreadState<any>[]>;
|
|
84
318
|
isThreadLoading: Signal<boolean>;
|
|
85
319
|
experimental_branchTree: Signal<_langchain_langgraph_sdk_ui0.Sequence<any>>;
|
|
86
|
-
getMessagesMetadata
|
|
87
|
-
submit: (values: StateType, submitOptions?: SubmitOptions<StateType, GetConfigurableType<Bag>> | undefined) => Promise<void
|
|
88
|
-
stop: () =>
|
|
320
|
+
getMessagesMetadata(message: Message, index?: number | undefined): MessageMetadata$1<StateType> | undefined;
|
|
321
|
+
submit: (values: StateType, submitOptions?: SubmitOptions<StateType, GetConfigurableType<Bag>> | undefined) => Promise<void | Promise<void>>;
|
|
322
|
+
stop: () => void;
|
|
89
323
|
joinStream: (runId: string, lastEventId?: string | undefined, joinOptions?: {
|
|
90
324
|
streamMode?: StreamMode[] | StreamMode | undefined;
|
|
91
325
|
filter?: ((event: {
|
|
@@ -97,8 +331,8 @@ declare function useStreamLGP<StateType extends Record<string, unknown> = Record
|
|
|
97
331
|
queue: {
|
|
98
332
|
entries: WritableSignal<readonly _langchain_langgraph_sdk_ui0.QueueEntry<StateType, SubmitOptions<StateType, GetConfigurableType<Bag>>>[]>;
|
|
99
333
|
size: WritableSignal<number>;
|
|
100
|
-
cancel(id: string)
|
|
101
|
-
clear()
|
|
334
|
+
cancel: (id: string) => Promise<boolean>;
|
|
335
|
+
clear: () => Promise<void>;
|
|
102
336
|
};
|
|
103
337
|
switchThread(newThreadId: string | null): void;
|
|
104
338
|
readonly subagents: Map<string, SubagentStreamInterface$1<Record<string, unknown>, DefaultToolCall$1, string>>;
|
|
@@ -108,7 +342,7 @@ declare function useStreamLGP<StateType extends Record<string, unknown> = Record
|
|
|
108
342
|
getSubagentsByMessage(messageId: string): SubagentStreamInterface$1<Record<string, unknown>, DefaultToolCall$1, string>[];
|
|
109
343
|
};
|
|
110
344
|
/**
|
|
111
|
-
* Injectable Angular service that wraps {@link
|
|
345
|
+
* Injectable Angular service that wraps {@link injectStream}.
|
|
112
346
|
*
|
|
113
347
|
* Extend this class with your own `@Injectable()` service and call
|
|
114
348
|
* `super(options)` in the constructor:
|
|
@@ -122,7 +356,7 @@ declare function useStreamLGP<StateType extends Record<string, unknown> = Record
|
|
|
122
356
|
* }
|
|
123
357
|
* ```
|
|
124
358
|
*
|
|
125
|
-
* The service exposes the same signals and methods as `
|
|
359
|
+
* The service exposes the same signals and methods as `injectStream`
|
|
126
360
|
* (e.g. `values`, `messages`, `isLoading`, `submit`, `stop`).
|
|
127
361
|
*
|
|
128
362
|
* Must be created within an Angular injection context (via DI or
|
|
@@ -138,7 +372,7 @@ declare class StreamService<T = Record<string, unknown>, Bag extends BagTemplate
|
|
|
138
372
|
get branch(): WritableSignal<string>;
|
|
139
373
|
get interrupt(): Signal<Interrupt<GetInterruptType<Bag>> | undefined>;
|
|
140
374
|
get interrupts(): Signal<Interrupt<GetInterruptType<Bag>>[]>;
|
|
141
|
-
get toolCalls(): Signal<ToolCallWithResult$1<DefaultToolCall$1
|
|
375
|
+
get toolCalls(): Signal<ToolCallWithResult$1<DefaultToolCall$1>[]>;
|
|
142
376
|
get queue(): AngularQueueInterface<{
|
|
143
377
|
entries: readonly {
|
|
144
378
|
id: string;
|
|
@@ -148,15 +382,15 @@ declare class StreamService<T = Record<string, unknown>, Bag extends BagTemplate
|
|
|
148
382
|
cancel: (id: string) => Promise<boolean>;
|
|
149
383
|
clear: () => Promise<void>;
|
|
150
384
|
}>;
|
|
151
|
-
get subagents(): Map<string,
|
|
152
|
-
get activeSubagents():
|
|
385
|
+
get subagents(): Map<string, SubagentStreamInterface$1>;
|
|
386
|
+
get activeSubagents(): SubagentStreamInterface$1[];
|
|
153
387
|
get history(): Signal<unknown>;
|
|
154
388
|
get isThreadLoading(): Signal<boolean>;
|
|
155
389
|
get experimental_branchTree(): Signal<unknown>;
|
|
156
390
|
get client(): Client;
|
|
157
391
|
get assistantId(): string;
|
|
158
392
|
submit(values: AcceptBaseMessages<Exclude<T, null | undefined>> | null | undefined, options?: SubmitOptions<T extends Record<string, unknown> ? T : Record<string, unknown>, GetConfigurableType<Bag>>): ReturnType<typeof this._stream.submit>;
|
|
159
|
-
stop(): void
|
|
393
|
+
stop(): Promise<void>;
|
|
160
394
|
setBranch(value: string): void;
|
|
161
395
|
switchThread(newThreadId: string | null): void;
|
|
162
396
|
joinStream(runId: string, lastEventId?: string, options?: {
|
|
@@ -168,12 +402,12 @@ declare class StreamService<T = Record<string, unknown>, Bag extends BagTemplate
|
|
|
168
402
|
}) => boolean;
|
|
169
403
|
}): Promise<void>;
|
|
170
404
|
getMessagesMetadata(message: BaseMessage, index?: number): MessageMetadata$1<T extends Record<string, unknown> ? T : Record<string, unknown>> | undefined;
|
|
171
|
-
getToolCalls(message: BaseMessage): ToolCallWithResult$1<DefaultToolCall$1
|
|
172
|
-
getSubagent(toolCallId: string):
|
|
173
|
-
getSubagentsByType(type: string):
|
|
174
|
-
getSubagentsByMessage(messageId: string):
|
|
405
|
+
getToolCalls(message: BaseMessage): ToolCallWithResult$1<DefaultToolCall$1>[];
|
|
406
|
+
getSubagent(toolCallId: string): SubagentStreamInterface$1 | undefined;
|
|
407
|
+
getSubagentsByType(type: string): SubagentStreamInterface$1[];
|
|
408
|
+
getSubagentsByMessage(messageId: string): SubagentStreamInterface$1[];
|
|
175
409
|
}
|
|
176
410
|
type ToolCallWithResult<ToolCall = DefaultToolCall$1> = ToolCallWithResult$1<ToolCall, ToolMessage, AIMessage>;
|
|
177
411
|
//#endregion
|
|
178
|
-
export { type AgentTypeConfigLike, type BaseStream, type BaseSubagentState, ClassSubagentStreamInterface, type CompiledSubAgentLike, type DeepAgentTypeConfigLike, type DefaultSubagentStates, type DefaultToolCall, type ExtractAgentConfig, type ExtractDeepAgentConfig, type ExtractSubAgentMiddleware, FetchStreamTransport, type GetToolCallsType, type InferAgentToolCalls, type InferBag, type InferDeepAgentSubagents, type InferNodeNames, type InferStateType, type InferSubagentByName, type InferSubagentNames, type InferSubagentState, type InferSubagentStates, type InferToolCalls, type IsAgentLike, type IsDeepAgentLike, type MessageMetadata, type QueueEntry, type QueueInterface, type ResolveStreamInterface, type ResolveStreamOptions, STREAM_DEFAULTS, STREAM_INSTANCE, type StreamDefaults, StreamService, type SubAgentLike, type SubagentApi, SubagentManager, type SubagentStateMap, type SubagentStatus, type SubagentStream, type SubagentStreamInterface, type SubagentToolCall, type ToolCallFromTool, type ToolCallState, ToolCallWithResult, type ToolCallsFromTools, type UseAgentStream, type UseAgentStreamOptions, type UseDeepAgentStream, type UseDeepAgentStreamOptions, type UseStreamCustomOptions, type UseStreamOptions, type UseStreamThread, type UseStreamTransport, calculateDepthFromNamespace, extractParentIdFromNamespace, extractToolCallIdFromNamespace, injectStream, isSubagentNamespace, provideStream, provideStreamDefaults, useStream, useStreamLGP };
|
|
412
|
+
export { type AgentTypeConfigLike, type BaseStream, type BaseSubagentState, type ClassSubagentStreamInterface, type CompiledSubAgentLike, type DeepAgentTypeConfigLike, type DefaultSubagentStates, type DefaultToolCall, type ExtractAgentConfig, type ExtractDeepAgentConfig, type ExtractSubAgentMiddleware, FetchStreamTransport, type GetToolCallsType, type InferAgentToolCalls, type InferBag, type InferDeepAgentSubagents, type InferNodeNames, type InferStateType, type InferSubagentByName, type InferSubagentNames, type InferSubagentState, type InferSubagentStates, type InferToolCalls, type IsAgentLike, type IsDeepAgentLike, type MessageMetadata, type QueueEntry, type QueueInterface, type ResolveStreamInterface, type ResolveStreamOptions, STREAM_DEFAULTS, STREAM_INSTANCE, type StreamDefaults, StreamService, type SubAgentLike, type SubagentApi, SubagentManager, type SubagentStateMap, type SubagentStatus, type SubagentStream, type SubagentStreamInterface, type SubagentToolCall, type ToolCallFromTool, type ToolCallState, ToolCallWithResult, type ToolCallsFromTools, type UseAgentStream, type UseAgentStreamOptions, type UseDeepAgentStream, type UseDeepAgentStreamOptions, type UseStreamCustomOptions, type UseStreamOptions, type UseStreamThread, type UseStreamTransport, calculateDepthFromNamespace, extractParentIdFromNamespace, extractToolCallIdFromNamespace, injectStream, injectStreamCustom, isSubagentNamespace, provideStream, provideStreamDefaults, useStream, useStreamCustom, useStreamLGP };
|
|
179
413
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;KAyDK,uBAAA,MACH,CAAA,SAAU,oBAAA,+BACN,oBAAA,CAAsB,EAAA,EAAI,WAAA,EAAiB,SAAA,IAC3C,CAAA;AAAA,KAED,iBAAA,MAAuB,IAAA,CAC1B,CAAA;EAaA,QAAA,EAAU,WAAA;EACV,mBAAA,GACE,OAAA,EAAS,WAAA,EACT,KAAA,cACG,iBAAA,CAAgB,MAAA;AAAA,6BACM,CAAA;EACrB,OAAA,EAAS,uBAAA,CAAwB,CAAA;AAAA,uCAEf,CAAA;EAElB,MAAA,EAAQ,CAAA;IACN,MAAA,GAAS,MAAA,WAAiB,OAAA;EAAA,KAGtB,MAAA,EACI,kBAAA,CAAmB,OAAA,CAAQ,CAAA,yCAG/B,OAAA,GAAU,CAAA,KACP,GAAA;AAAA,0CAIY,CAAA;EAErB,SAAA,EAAW,CAAA;IAAY,SAAA;EAAA,IACnB,uBAAA,CAAwB,EAAA;AAAA,6CAIJ,CAAA;EAExB,YAAA,EAAc,CAAA;IACZ,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