@threadplane/langgraph 0.0.51 → 0.0.53
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
|
@@ -351,8 +351,13 @@ interface AgentConfig<T = Record<string, unknown>, _Bag extends BagTemplate = Ba
|
|
|
351
351
|
* config is known up front. Pass a `() => AgentConfig` factory when the config
|
|
352
352
|
* depends on runtime/DI state — the factory runs inside an Angular injection
|
|
353
353
|
* context, so it may call `inject()` to read services, route params, or
|
|
354
|
-
* component-scoped signals
|
|
354
|
+
* component-scoped signals.
|
|
355
355
|
*
|
|
356
|
+
* **Typed state via AgentRef.** Pass a typed ref as the first argument to flow
|
|
357
|
+
* the state shape from `provideAgent` to `injectAgent` without repeating the
|
|
358
|
+
* generic at every call site.
|
|
359
|
+
*
|
|
360
|
+
* @example Factory config reading route params
|
|
356
361
|
* ```ts
|
|
357
362
|
* providers: [
|
|
358
363
|
* provideAgent(() => {
|
|
@@ -361,11 +366,7 @@ interface AgentConfig<T = Record<string, unknown>, _Bag extends BagTemplate = Ba
|
|
|
361
366
|
* }),
|
|
362
367
|
* ];
|
|
363
368
|
* ```
|
|
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
|
+
* @example Typed state via AgentRef
|
|
369
370
|
* ```ts
|
|
370
371
|
* export const TRIP = createAgentRef<TripState>('trip');
|
|
371
372
|
* // app.config.ts:
|
|
@@ -388,13 +389,13 @@ declare function provideAgent<T = Record<string, unknown>>(configOrFactory: Agen
|
|
|
388
389
|
*
|
|
389
390
|
* **Typed state via AgentRef.** Pass the same ref that was supplied to
|
|
390
391
|
* `provideAgent(ref, …)` to carry the state type through DI without repeating
|
|
391
|
-
* the generic at every call site
|
|
392
|
+
* the generic at every call site. The no-arg form defaults to
|
|
393
|
+
* `LangGraphAgent<Record<string, unknown>>`.
|
|
392
394
|
*
|
|
395
|
+
* @example Typed state via AgentRef
|
|
393
396
|
* ```ts
|
|
394
397
|
* const agent = injectAgent(TRIP); // LangGraphAgent<TripState>
|
|
395
398
|
* ```
|
|
396
|
-
*
|
|
397
|
-
* The no-arg form defaults to `LangGraphAgent<Record<string, unknown>>`.
|
|
398
399
|
*/
|
|
399
400
|
declare function injectAgent(): LangGraphAgent<Record<string, unknown>>;
|
|
400
401
|
declare function injectAgent<T, ResolvedBag extends BagTemplate = BagTemplate>(ref: AgentRef<T>): LangGraphAgent<T, ResolvedBag>;
|
|
@@ -556,6 +557,12 @@ interface MockLangGraphAgent extends LangGraphAgent<any, any> {
|
|
|
556
557
|
*
|
|
557
558
|
* Neutral `Agent`-contract signals come from {@link mockAgent}; LangGraph-specific
|
|
558
559
|
* signals are declared here and layered on top.
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* ```ts
|
|
563
|
+
* const agent = mockLangGraphAgent({ isThreadLoading: true });
|
|
564
|
+
* agent.messages.set([{ id: '1', role: 'assistant', content: 'Hi' }]);
|
|
565
|
+
* ```
|
|
559
566
|
*/
|
|
560
567
|
declare function mockLangGraphAgent(initial?: MockAgentOptions & {
|
|
561
568
|
langGraphMessages?: BaseMessage[];
|
|
@@ -571,6 +578,13 @@ declare function mockLangGraphAgent(initial?: MockAgentOptions & {
|
|
|
571
578
|
* advanced manual scripting (tool calls, interrupts, multi-batch), provide
|
|
572
579
|
* the agent yourself with
|
|
573
580
|
* `provideAgent({ assistantId, transport: new MockAgentTransport(...) })`.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```ts
|
|
584
|
+
* TestBed.configureTestingModule({
|
|
585
|
+
* providers: [provideFakeAgent({ responses: ['Hi from the fake LangGraph agent'] })],
|
|
586
|
+
* });
|
|
587
|
+
* ```
|
|
574
588
|
*/
|
|
575
589
|
declare function provideFakeAgent(config?: FakeAgentConfig): Provider[];
|
|
576
590
|
|
|
@@ -598,6 +612,19 @@ declare class FakeStreamTransport implements AgentTransport {
|
|
|
598
612
|
interface KwargsLike {
|
|
599
613
|
additional_kwargs?: Record<string, unknown> | undefined;
|
|
600
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* Normalize {@link Citation}s out of a message's `additional_kwargs` (reading
|
|
617
|
+
* `citations` or `sources`). Exposed for advanced consumers building custom
|
|
618
|
+
* adapters or bridging non-LangGraph message shapes into the neutral
|
|
619
|
+
* `Citation[]` form.
|
|
620
|
+
*
|
|
621
|
+
* @param msg Any object with an `additional_kwargs` bag (e.g. a LangChain message).
|
|
622
|
+
* @returns The normalized citations, or `undefined` when none are present.
|
|
623
|
+
* @example
|
|
624
|
+
* ```ts
|
|
625
|
+
* const citations = extractCitations(lcMessage);
|
|
626
|
+
* ```
|
|
627
|
+
*/
|
|
601
628
|
declare function extractCitations(msg: KwargsLike): Citation[] | undefined;
|
|
602
629
|
|
|
603
630
|
/**
|