@langchain/langgraph-sdk 0.0.80 → 0.0.82

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/dist/client.cjs CHANGED
@@ -626,6 +626,7 @@ class RunsClient extends BaseClient {
626
626
  after_seconds: payload?.afterSeconds,
627
627
  if_not_exists: payload?.ifNotExists,
628
628
  checkpoint_during: payload?.checkpointDuring,
629
+ langsmith_tracer: payload?._langsmithTracer,
629
630
  };
630
631
  const [run, response] = await this.fetch(`/threads/${threadId}/runs`, {
631
632
  method: "POST",
@@ -681,6 +682,12 @@ class RunsClient extends BaseClient {
681
682
  after_seconds: payload?.afterSeconds,
682
683
  if_not_exists: payload?.ifNotExists,
683
684
  checkpoint_during: payload?.checkpointDuring,
685
+ langsmith_tracer: payload?._langsmithTracer
686
+ ? {
687
+ project_name: payload?._langsmithTracer?.projectName,
688
+ example_id: payload?._langsmithTracer?.exampleId,
689
+ }
690
+ : undefined,
684
691
  };
685
692
  const endpoint = threadId == null ? `/runs/wait` : `/threads/${threadId}/runs/wait`;
686
693
  const [run, response] = await this.fetch(endpoint, {
package/dist/client.js CHANGED
@@ -619,6 +619,7 @@ export class RunsClient extends BaseClient {
619
619
  after_seconds: payload?.afterSeconds,
620
620
  if_not_exists: payload?.ifNotExists,
621
621
  checkpoint_during: payload?.checkpointDuring,
622
+ langsmith_tracer: payload?._langsmithTracer,
622
623
  };
623
624
  const [run, response] = await this.fetch(`/threads/${threadId}/runs`, {
624
625
  method: "POST",
@@ -674,6 +675,12 @@ export class RunsClient extends BaseClient {
674
675
  after_seconds: payload?.afterSeconds,
675
676
  if_not_exists: payload?.ifNotExists,
676
677
  checkpoint_during: payload?.checkpointDuring,
678
+ langsmith_tracer: payload?._langsmithTracer
679
+ ? {
680
+ project_name: payload?._langsmithTracer?.projectName,
681
+ example_id: payload?._langsmithTracer?.exampleId,
682
+ }
683
+ : undefined,
677
684
  };
678
685
  const endpoint = threadId == null ? `/runs/wait` : `/threads/${threadId}/runs/wait`;
679
686
  const [run, response] = await this.fetch(endpoint, {
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  export { Client, getApiKey } from "./client.js";
2
2
  export type { ClientConfig, RequestHook } from "./client.js";
3
- export type { AssistantBase, Assistant, AssistantVersion, AssistantGraph, Config, DefaultValues, GraphSchema, Metadata, Run, Thread, ThreadTask, ThreadState, ThreadStatus, Cron, Checkpoint, Interrupt, ListNamespaceResponse, Item, SearchItem, SearchItemsResponse, CronCreateResponse, CronCreateForThreadResponse, } from "./schema.js";
3
+ export type { Assistant, AssistantBase, AssistantGraph, AssistantVersion, Checkpoint, Config, Cron, CronCreateForThreadResponse, CronCreateResponse, DefaultValues, GraphSchema, Interrupt, Item, ListNamespaceResponse, Metadata, Run, SearchItem, SearchItemsResponse, Thread, ThreadState, ThreadStatus, ThreadTask, } from "./schema.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
- export type { OnConflictBehavior, Command } from "./types.js";
6
- export type { StreamMode } from "./types.stream.js";
7
- export type { ValuesStreamEvent, MessagesTupleStreamEvent, MetadataStreamEvent, UpdatesStreamEvent, CustomStreamEvent, MessagesStreamEvent, DebugStreamEvent, EventsStreamEvent, ErrorStreamEvent, FeedbackStreamEvent, } from "./types.stream.js";
8
- export type { Message, HumanMessage, AIMessage, ToolMessage, SystemMessage, FunctionMessage, RemoveMessage, } from "./types.messages.js";
5
+ export type { Command, OnConflictBehavior, RunsInvokePayload, } from "./types.js";
6
+ export type { AIMessage, FunctionMessage, HumanMessage, Message, RemoveMessage, SystemMessage, ToolMessage, } from "./types.messages.js";
7
+ export type { CustomStreamEvent, DebugStreamEvent, ErrorStreamEvent, EventsStreamEvent, FeedbackStreamEvent, MessagesStreamEvent, MessagesTupleStreamEvent, MetadataStreamEvent, StreamMode, UpdatesStreamEvent, ValuesStreamEvent, } from "./types.stream.js";
@@ -27,9 +27,12 @@ function uiMessageReducer(state, update) {
27
27
  }
28
28
  const index = state.findIndex((ui) => ui.id === event.id);
29
29
  if (index !== -1) {
30
- newState[index] = event.metadata.merge
31
- ? { ...event, props: { ...state[index].props, ...event.props } }
32
- : event;
30
+ newState[index] =
31
+ typeof event.metadata === "object" &&
32
+ event.metadata != null &&
33
+ event.metadata.merge
34
+ ? { ...event, props: { ...state[index].props, ...event.props } }
35
+ : event;
33
36
  }
34
37
  else {
35
38
  newState.push(event);
@@ -3,7 +3,7 @@ export interface UIMessage<TName extends string = string, TProps extends Record<
3
3
  id: string;
4
4
  name: TName;
5
5
  props: TProps;
6
- metadata: {
6
+ metadata?: {
7
7
  merge?: boolean;
8
8
  run_id?: string;
9
9
  name?: string;
@@ -22,9 +22,12 @@ export function uiMessageReducer(state, update) {
22
22
  }
23
23
  const index = state.findIndex((ui) => ui.id === event.id);
24
24
  if (index !== -1) {
25
- newState[index] = event.metadata.merge
26
- ? { ...event, props: { ...state[index].props, ...event.props } }
27
- : event;
25
+ newState[index] =
26
+ typeof event.metadata === "object" &&
27
+ event.metadata != null &&
28
+ event.metadata.merge
29
+ ? { ...event, props: { ...state[index].props, ...event.props } }
30
+ : event;
28
31
  }
29
32
  else {
30
33
  newState.push(event);
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { LangChainTracer } from "@langchain/core/tracers/tracer_langchain";
1
2
  import { Checkpoint, Config, Metadata } from "./schema.js";
2
3
  import { StreamMode } from "./types.stream.js";
3
4
  export type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
@@ -25,7 +26,7 @@ export interface Command {
25
26
  */
26
27
  goto?: Send | Send[] | string | string[];
27
28
  }
28
- interface RunsInvokePayload {
29
+ export interface RunsInvokePayload {
29
30
  /**
30
31
  * Input to the run. Pass `null` to resume from the current state of the thread.
31
32
  */
@@ -111,6 +112,11 @@ interface RunsInvokePayload {
111
112
  run_id: string;
112
113
  thread_id?: string;
113
114
  }) => void;
115
+ /**
116
+ * @internal
117
+ * For LangSmith tracing purposes only. Not part of the public API.
118
+ */
119
+ _langsmithTracer?: LangChainTracer;
114
120
  }
115
121
  export interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {
116
122
  /**
@@ -159,4 +165,3 @@ export interface RunsWaitPayload extends RunsStreamPayload {
159
165
  */
160
166
  raiseError?: boolean;
161
167
  }
162
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.19",