@threadplane/langgraph 0.0.50 → 0.0.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadplane/langgraph",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "description": "LangGraph adapter for @threadplane/chat — Angular bindings for LangGraph Platform.",
5
5
  "keywords": [
6
6
  "angular",
@@ -4,7 +4,7 @@ import { BaseMessage, AIMessage } from '@langchain/core/messages';
4
4
  import * as _langchain_langgraph_sdk from '@langchain/langgraph-sdk';
5
5
  import { ThreadState, Config, Checkpoint, Command, Metadata, StreamMode, BagTemplate, Interrupt, ToolCallWithResult, ToolProgress, Client } from '@langchain/langgraph-sdk';
6
6
  export { BagTemplate, InferBag, Interrupt, ThreadState } from '@langchain/langgraph-sdk';
7
- import { AgentRuntimeTelemetrySink, AgentWithHistory, AgentSubmitInput, AgentSubmitOptions, ClientToolsCapability, Message, AgentStatus, ToolCall, AgentInterrupt, Subagent, AgentCheckpoint, MockAgent, MockAgentOptions, Citation, Thread } from '@threadplane/chat';
7
+ import { AgentRuntimeTelemetrySink, AgentWithHistory, AgentSubmitInput, AgentSubmitOptions, ClientToolsCapability, AgentRef, Message, AgentStatus, AgentError, ToolCall, AgentInterrupt, Subagent, AgentCheckpoint, MockAgent, MockAgentOptions, Citation, Thread } from '@threadplane/chat';
8
8
  import { MessageMetadata } from '@langchain/langgraph-sdk/ui';
9
9
  export { SubmitOptions } from '@langchain/langgraph-sdk/ui';
10
10
  import { FakeAgentConfig } from '@threadplane/chat/testing';
@@ -230,7 +230,7 @@ interface SubagentStreamRef {
230
230
  * any LangGraph-specific demo. Raw LangGraph signals are prefixed with
231
231
  * `langGraph` to avoid collision with the runtime-neutral names.
232
232
  */
233
- interface LangGraphAgent<T = unknown, ResolvedBag extends BagTemplate = BagTemplate> extends AgentWithHistory {
233
+ interface LangGraphAgent<T = unknown, ResolvedBag extends BagTemplate = BagTemplate> extends AgentWithHistory<T> {
234
234
  /** Raw LangChain BaseMessage list. Use `messages` for chat rendering. */
235
235
  langGraphMessages: Signal<BaseMessage[]>;
236
236
  /** All interrupts received during the current run (raw LangGraph shape). */
@@ -361,7 +361,20 @@ interface AgentConfig<T = Record<string, unknown>, _Bag extends BagTemplate = Ba
361
361
  * }),
362
362
  * ];
363
363
  * ```
364
+ *
365
+ * **Typed state via AgentRef.** Pass a typed ref as the first argument to flow
366
+ * the state shape from `provideAgent` to `injectAgent` without repeating the
367
+ * generic at every call site:
368
+ *
369
+ * ```ts
370
+ * export const TRIP = createAgentRef<TripState>('trip');
371
+ * // app.config.ts:
372
+ * providers: [provideAgent(TRIP, { assistantId: 'trip-graph' })]
373
+ * // component:
374
+ * const agent = injectAgent(TRIP); // LangGraphAgent<TripState>
375
+ * ```
364
376
  */
377
+ declare function provideAgent<T = Record<string, unknown>>(ref: AgentRef<T>, configOrFactory: AgentConfig<T> | (() => AgentConfig<T>)): Provider[];
365
378
  declare function provideAgent<T = Record<string, unknown>>(configOrFactory: AgentConfig<T> | (() => AgentConfig<T>)): Provider[];
366
379
 
367
380
  /**
@@ -372,8 +385,19 @@ declare function provideAgent<T = Record<string, unknown>>(configOrFactory: Agen
372
385
  * singleton scoped to the injector that called `provideAgent()` — re-provide
373
386
  * in a child component's `providers: []` to scope a different agent to that
374
387
  * subtree (Angular's hierarchical DI handles the rest).
388
+ *
389
+ * **Typed state via AgentRef.** Pass the same ref that was supplied to
390
+ * `provideAgent(ref, …)` to carry the state type through DI without repeating
391
+ * the generic at every call site:
392
+ *
393
+ * ```ts
394
+ * const agent = injectAgent(TRIP); // LangGraphAgent<TripState>
395
+ * ```
396
+ *
397
+ * The no-arg form defaults to `LangGraphAgent<Record<string, unknown>>`.
375
398
  */
376
- declare function injectAgent<T = Record<string, unknown>, ResolvedBag extends BagTemplate = BagTemplate>(): LangGraphAgent<T, ResolvedBag>;
399
+ declare function injectAgent(): LangGraphAgent<Record<string, unknown>>;
400
+ declare function injectAgent<T, ResolvedBag extends BagTemplate = BagTemplate>(ref: AgentRef<T>): LangGraphAgent<T, ResolvedBag>;
377
401
 
378
402
  /**
379
403
  * Optional registry that collects per-instance agent lifecycles within
@@ -504,7 +528,7 @@ interface MockLangGraphAgent extends LangGraphAgent<any, any> {
504
528
  messages: WritableSignal<Message[]>;
505
529
  status: WritableSignal<AgentStatus>;
506
530
  isLoading: WritableSignal<boolean>;
507
- error: WritableSignal<unknown>;
531
+ error: WritableSignal<AgentError | undefined>;
508
532
  toolCalls: WritableSignal<ToolCall[]>;
509
533
  interrupt: WritableSignal<AgentInterrupt | undefined>;
510
534
  subagents: WritableSignal<Map<string, Subagent>>;