@langchain/langgraph-sdk 1.3.1 → 1.4.5

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.
Files changed (152) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +10 -6
  2. package/dist/auth/error.cjs.map +1 -1
  3. package/dist/auth/error.d.cts.map +1 -1
  4. package/dist/auth/error.d.ts.map +1 -1
  5. package/dist/auth/error.js.map +1 -1
  6. package/dist/auth/index.cjs.map +1 -1
  7. package/dist/auth/index.d.cts +1 -3
  8. package/dist/auth/index.d.cts.map +1 -1
  9. package/dist/auth/index.d.ts +1 -3
  10. package/dist/auth/index.d.ts.map +1 -1
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/auth/types.d.cts +1 -1
  13. package/dist/auth/types.d.cts.map +1 -1
  14. package/dist/auth/types.d.ts +1 -1
  15. package/dist/auth/types.d.ts.map +1 -1
  16. package/dist/client.cjs +15 -24
  17. package/dist/client.cjs.map +1 -1
  18. package/dist/client.d.cts +2 -6
  19. package/dist/client.d.cts.map +1 -1
  20. package/dist/client.d.ts +2 -6
  21. package/dist/client.d.ts.map +1 -1
  22. package/dist/client.js +15 -24
  23. package/dist/client.js.map +1 -1
  24. package/dist/index.d.cts +2 -1
  25. package/dist/index.d.ts +2 -1
  26. package/dist/logging/index.cjs.map +1 -1
  27. package/dist/logging/index.d.cts +0 -1
  28. package/dist/logging/index.d.cts.map +1 -1
  29. package/dist/logging/index.d.ts +0 -1
  30. package/dist/logging/index.d.ts.map +1 -1
  31. package/dist/logging/index.js.map +1 -1
  32. package/dist/react/index.d.cts +3 -2
  33. package/dist/react/index.d.ts +3 -2
  34. package/dist/react/stream.cjs +1 -1
  35. package/dist/react/stream.cjs.map +1 -1
  36. package/dist/react/stream.custom.cjs +12 -6
  37. package/dist/react/stream.custom.cjs.map +1 -1
  38. package/dist/react/stream.custom.d.cts +3 -2
  39. package/dist/react/stream.custom.d.cts.map +1 -1
  40. package/dist/react/stream.custom.d.ts +3 -2
  41. package/dist/react/stream.custom.d.ts.map +1 -1
  42. package/dist/react/stream.custom.js +11 -5
  43. package/dist/react/stream.custom.js.map +1 -1
  44. package/dist/react/stream.d.cts +116 -34
  45. package/dist/react/stream.d.cts.map +1 -1
  46. package/dist/react/stream.d.ts +116 -34
  47. package/dist/react/stream.d.ts.map +1 -1
  48. package/dist/react/stream.js.map +1 -1
  49. package/dist/react/stream.lgp.cjs +15 -13
  50. package/dist/react/stream.lgp.cjs.map +1 -1
  51. package/dist/react/stream.lgp.js +14 -12
  52. package/dist/react/stream.lgp.js.map +1 -1
  53. package/dist/react/thread.cjs +1 -2
  54. package/dist/react/thread.cjs.map +1 -1
  55. package/dist/react/thread.js +0 -1
  56. package/dist/react/thread.js.map +1 -1
  57. package/dist/react/types.d.cts +73 -284
  58. package/dist/react/types.d.cts.map +1 -1
  59. package/dist/react/types.d.ts +73 -284
  60. package/dist/react/types.d.ts.map +1 -1
  61. package/dist/react-ui/client.cjs +8 -7
  62. package/dist/react-ui/client.cjs.map +1 -1
  63. package/dist/react-ui/client.d.cts +4 -21
  64. package/dist/react-ui/client.d.cts.map +1 -1
  65. package/dist/react-ui/client.d.ts +4 -21
  66. package/dist/react-ui/client.d.ts.map +1 -1
  67. package/dist/react-ui/client.js +2 -4
  68. package/dist/react-ui/client.js.map +1 -1
  69. package/dist/react-ui/index.cjs.map +1 -1
  70. package/dist/react-ui/index.js.map +1 -1
  71. package/dist/react-ui/server/server.cjs +1 -1
  72. package/dist/react-ui/server/server.cjs.map +1 -1
  73. package/dist/react-ui/server/server.d.cts.map +1 -1
  74. package/dist/react-ui/server/server.d.ts.map +1 -1
  75. package/dist/react-ui/server/server.js.map +1 -1
  76. package/dist/react-ui/types.cjs.map +1 -1
  77. package/dist/react-ui/types.d.cts.map +1 -1
  78. package/dist/react-ui/types.d.ts.map +1 -1
  79. package/dist/react-ui/types.js.map +1 -1
  80. package/dist/schema.d.cts +6 -6
  81. package/dist/schema.d.cts.map +1 -1
  82. package/dist/schema.d.ts +6 -6
  83. package/dist/schema.d.ts.map +1 -1
  84. package/dist/singletons/fetch.cjs.map +1 -1
  85. package/dist/singletons/fetch.js.map +1 -1
  86. package/dist/types.d.cts +1 -1
  87. package/dist/types.d.cts.map +1 -1
  88. package/dist/types.d.ts +1 -1
  89. package/dist/types.d.ts.map +1 -1
  90. package/dist/types.messages.d.cts +207 -34
  91. package/dist/types.messages.d.cts.map +1 -1
  92. package/dist/types.messages.d.ts +207 -34
  93. package/dist/types.messages.d.ts.map +1 -1
  94. package/dist/types.stream.d.cts +1 -3
  95. package/dist/types.stream.d.cts.map +1 -1
  96. package/dist/types.stream.d.ts +1 -3
  97. package/dist/types.stream.d.ts.map +1 -1
  98. package/dist/types.template.d.cts +19 -0
  99. package/dist/types.template.d.cts.map +1 -0
  100. package/dist/types.template.d.ts +19 -0
  101. package/dist/types.template.d.ts.map +1 -0
  102. package/dist/ui/branching.cjs.map +1 -1
  103. package/dist/ui/branching.d.cts +0 -3
  104. package/dist/ui/branching.d.cts.map +1 -1
  105. package/dist/ui/branching.d.ts +0 -3
  106. package/dist/ui/branching.d.ts.map +1 -1
  107. package/dist/ui/branching.js.map +1 -1
  108. package/dist/ui/errors.cjs.map +1 -1
  109. package/dist/ui/errors.js.map +1 -1
  110. package/dist/ui/manager.cjs +8 -2
  111. package/dist/ui/manager.cjs.map +1 -1
  112. package/dist/ui/manager.js +8 -2
  113. package/dist/ui/manager.js.map +1 -1
  114. package/dist/ui/messages.cjs +10 -10
  115. package/dist/ui/messages.cjs.map +1 -1
  116. package/dist/ui/messages.js.map +1 -1
  117. package/dist/ui/types.d.cts +420 -0
  118. package/dist/ui/types.d.cts.map +1 -0
  119. package/dist/ui/types.d.ts +420 -0
  120. package/dist/ui/types.d.ts.map +1 -0
  121. package/dist/ui/utils.cjs +0 -1
  122. package/dist/ui/utils.cjs.map +1 -1
  123. package/dist/ui/utils.js +0 -1
  124. package/dist/ui/utils.js.map +1 -1
  125. package/dist/utils/async_caller.cjs +12 -4
  126. package/dist/utils/async_caller.cjs.map +1 -1
  127. package/dist/utils/async_caller.d.cts +1 -3
  128. package/dist/utils/async_caller.d.cts.map +1 -1
  129. package/dist/utils/async_caller.d.ts +1 -3
  130. package/dist/utils/async_caller.d.ts.map +1 -1
  131. package/dist/utils/async_caller.js +8 -2
  132. package/dist/utils/async_caller.js.map +1 -1
  133. package/dist/utils/env.cjs +1 -1
  134. package/dist/utils/env.cjs.map +1 -1
  135. package/dist/utils/env.js +1 -1
  136. package/dist/utils/env.js.map +1 -1
  137. package/dist/utils/error.cjs.map +1 -1
  138. package/dist/utils/error.js.map +1 -1
  139. package/dist/utils/signals.cjs.map +1 -1
  140. package/dist/utils/signals.js.map +1 -1
  141. package/dist/utils/sse.cjs.map +1 -1
  142. package/dist/utils/sse.js.map +1 -1
  143. package/dist/utils/stream.cjs +1 -3
  144. package/dist/utils/stream.cjs.map +1 -1
  145. package/dist/utils/stream.js +1 -3
  146. package/dist/utils/stream.js.map +1 -1
  147. package/dist/utils/tools.cjs +52 -0
  148. package/dist/utils/tools.cjs.map +1 -0
  149. package/dist/utils/tools.js +51 -0
  150. package/dist/utils/tools.js.map +1 -0
  151. package/package.json +5 -5
  152. package/CHANGELOG.md +0 -281
package/dist/schema.d.ts CHANGED
@@ -65,7 +65,7 @@ interface GraphSchema {
65
65
  }
66
66
  type Subgraphs = Record<string, GraphSchema>;
67
67
  type Metadata = Optional<{
68
- source?: "input" | "loop" | "update" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
68
+ source?: "input" | "loop" | "update" | (string & {});
69
69
  step?: number;
70
70
  writes?: Record<string, unknown> | null;
71
71
  parents?: Record<string, string>;
@@ -106,7 +106,6 @@ interface AssistantGraph {
106
106
  nodes: Array<{
107
107
  id: string | number;
108
108
  name?: string;
109
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
109
  data?: Record<string, any> | string;
111
110
  metadata?: unknown;
112
111
  }>;
@@ -133,7 +132,7 @@ interface Interrupt<TValue = unknown> {
133
132
  * Will be deprecated in the future.
134
133
  * @deprecated Will be removed in the future.
135
134
  */
136
- when?: "during" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
135
+ when?: "during" | (string & {});
137
136
  /**
138
137
  * Whether the interrupt can be resumed.
139
138
  * @deprecated Will be removed in the future.
@@ -160,6 +159,10 @@ interface Thread<ValuesType = DefaultValues> {
160
159
  values: ValuesType;
161
160
  /** Interrupts which were thrown in this thread */
162
161
  interrupts: Record<string, Array<Interrupt>>;
162
+ /** The config for the thread */
163
+ config?: Config;
164
+ /** The error for the thread (if status == "error") */
165
+ error?: Optional<string | Record<string, unknown>>;
163
166
  }
164
167
  interface Cron {
165
168
  /** The ID of the cron */
@@ -242,7 +245,6 @@ interface ListNamespaceResponse {
242
245
  interface Item {
243
246
  namespace: string[];
244
247
  key: string;
245
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
246
248
  value: Record<string, any>;
247
249
  createdAt: string;
248
250
  updatedAt: string;
@@ -273,8 +275,6 @@ type AssistantSortBy = "assistant_id" | "graph_id" | "name" | "created_at" | "up
273
275
  type ThreadSortBy = "thread_id" | "status" | "created_at" | "updated_at";
274
276
  type CronSortBy = "cron_id" | "assistant_id" | "thread_id" | "created_at" | "updated_at" | "next_run_date";
275
277
  type SortOrder = "asc" | "desc";
276
- // Select field aliases for client-side typing of `select` parameters.
277
- // These mirror the server's allowed field sets.
278
278
  type AssistantSelectField = "assistant_id" | "graph_id" | "name" | "description" | "config" | "context" | "created_at" | "updated_at" | "metadata" | "version";
279
279
  type ThreadSelectField = "thread_id" | "created_at" | "updated_at" | "metadata" | "config" | "context" | "status" | "values" | "interrupts";
280
280
  type RunSelectField = "run_id" | "thread_id" | "assistant_id" | "created_at" | "updated_at" | "status" | "metadata" | "kwargs" | "multitask_strategy";
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\n// Select field aliases for client-side typing of `select` parameters.\n// These mirror the server's allowed field sets.\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\"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BV;;UAEFP;;UAEAkB;;cAEIZ,eAAeO,MAAMC;;UAEpBK,IAAAA;;;;;;aAMFtB;;YAEDA;;;;;;;;WAQDS;;WAEAT;;iBAEMA;;YAELS;;KAEFW,aAAAA,GAAgBX,4BAA4BA;KAC5Cc,kBAAAA,GAAqBd;UAChBe,yBAAyBJ;;UAE9BC;;;;cAIII;;YAEFf;;cAEEV;;qBAEOA,SAASyB;;SAErBT,MAAMU;;UAEAA,UAAAA;;;;SAIN1B;cACKgB,MAAMC;cACNjB,SAASyB;SACdzB,SAASwB;;UAEHG,GAAAA;;;;;;;;;;;;UAYLzB;;YAEEQ;;sBAEUV,SAASI;;KAErBqB,UAAAA;;;iBAGOzB;kBACCA,SAASS;;UAEZmB,qBAAAA;;;UAGAC,IAAAA;;;;SAINpB;;;;UAIMqB,UAAAA,SAAmBD;;;UAGnBE,mBAAAA;SACND;;UAEME,kBAAAA;;;;;WAKJvB;;;;;;YAMCC;;UAEGuB,2BAAAA,SAAoCC,KAAKF;;;KAG9CG,eAAAA;KACAC,YAAAA;KACAC,UAAAA;KACAC,SAAAA;;;KAGAC,oBAAAA;KACAC,iBAAAA;KACAC,cAAAA;KACAC,eAAAA"}
1
+ {"version":3,"file":"schema.d.ts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {});\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {});\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt>>;\n /** The config for the thread */\n config?: Config;\n /** The error for the thread (if status == \"error\") */\n error?: Optional<string | Record<string, unknown>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":";;;KACKC,cAAcC;KACPC,SAAAA;AADPF,KAEOG,YAAAA,GAFOF,MAAC,GAAA,MAAA,GAAA,aAAA,GAAA,OAAA;AACpB,KAEKG,iBAAAA,GAFgB,QAAA,GAAA,WAAA,GAAA,UAAA,GAAA,SAAA;AACTD,KAEAE,YAAAA,GAFY,WAAA,GAAA,UAAA;AACnBD,KAEOE,MAAAA,GAFPF;EACOC;AACZ;;;MAsBwBL,CAAAA,EAAAA,MAAAA,EAAAA;EAAQ;AAIhC;;;iBAcoBD,CAAAA,EAAAA,MAAAA;;;;EAeY,YAAA,CAAA,EAAA;IAEpB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T;;iBAEMA;;YAELS;;KAEFW,aAAAA,GAAgBX,4BAA4BA;KAC5Cc,kBAAAA,GAAqBd;UAChBe,yBAAyBJ;;UAE9BC;;;;cAIII;;YAEFf;;cAEEV;;qBAEOA,SAASyB;;SAErBT,MAAMU;;UAEAA,UAAAA;;;;SAIN1B;cACKgB,MAAMC;cACNjB,SAASyB;SACdzB,SAASwB;;UAEHG,GAAAA;;;;;;;;;;;;UAYLzB;;YAEEQ;;sBAEUV,SAASI;;KAErBqB,UAAAA;;;iBAGOzB;kBACCA,SAASS;;UAEZmB,qBAAAA;;;UAGAC,IAAAA;;;SAGNpB;;;;UAIMqB,UAAAA,SAAmBD;;;UAGnBE,mBAAAA;SACND;;UAEME,kBAAAA;;;;;WAKJvB;;;;;;YAMCC;;UAEGuB,2BAAAA,SAAoCC,KAAKF;;;KAG9CG,eAAAA;KACAC,YAAAA;KACAC,UAAAA;KACAC,SAAAA;KACAC,oBAAAA;KACAC,iBAAAA;KACAC,cAAAA;KACAC,eAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.cjs","names":["fetch","_getFetchImplementation: () => (...args: any[]) => any"],"sources":["../../src/singletons/fetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// Wrap the default fetch call due to issues with illegal invocations\n// in some environments:\n// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err\n// @ts-expect-error Broad typing to support a range of fetch implementations\nconst DEFAULT_FETCH_IMPLEMENTATION = (...args: any[]) => fetch(...args);\n\nconst LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for(\n \"lg:fetch_implementation\"\n);\n\n/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport const overrideFetchImplementation = (fetch: (...args: any[]) => any) => {\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;\n};\n\n/**\n * @internal\n */\nexport const _getFetchImplementation: () => (...args: any[]) => any = () => {\n return (\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??\n DEFAULT_FETCH_IMPLEMENTATION\n );\n};\n"],"mappings":";;AAKA,MAAM,gCAAgC,GAAG,SAAgB,MAAM,GAAG;AAElE,MAAM,qCAAqC,OAAO,IAChD;;;;;;;AASF,MAAa,+BAA+B,YAAmC;AAC7E,CAAC,WAAmB,sCAAsCA;;;;;AAM5D,MAAaC,gCAA+D;AAC1E,QACG,WAAmB,uCACpB"}
1
+ {"version":3,"file":"fetch.cjs","names":["fetch"],"sources":["../../src/singletons/fetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// Wrap the default fetch call due to issues with illegal invocations\n// in some environments:\n// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err\n// @ts-expect-error Broad typing to support a range of fetch implementations\nconst DEFAULT_FETCH_IMPLEMENTATION = (...args: any[]) => fetch(...args);\n\nconst LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for(\n \"lg:fetch_implementation\"\n);\n\n/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport const overrideFetchImplementation = (fetch: (...args: any[]) => any) => {\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;\n};\n\n/**\n * @internal\n */\nexport const _getFetchImplementation: () => (...args: any[]) => any = () => {\n return (\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??\n DEFAULT_FETCH_IMPLEMENTATION\n );\n};\n"],"mappings":";;AAKA,MAAM,gCAAgC,GAAG,SAAgB,MAAM,GAAG,KAAK;AAEvE,MAAM,qCAAqC,OAAO,IAChD,0BACD;;;;;;;AAQD,MAAa,+BAA+B,YAAmC;AAC7E,CAAC,WAAmB,sCAAsCA;;;;;AAM5D,MAAa,gCAA+D;AAC1E,QACG,WAAmB,uCACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","names":["fetch","_getFetchImplementation: () => (...args: any[]) => any"],"sources":["../../src/singletons/fetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// Wrap the default fetch call due to issues with illegal invocations\n// in some environments:\n// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err\n// @ts-expect-error Broad typing to support a range of fetch implementations\nconst DEFAULT_FETCH_IMPLEMENTATION = (...args: any[]) => fetch(...args);\n\nconst LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for(\n \"lg:fetch_implementation\"\n);\n\n/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport const overrideFetchImplementation = (fetch: (...args: any[]) => any) => {\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;\n};\n\n/**\n * @internal\n */\nexport const _getFetchImplementation: () => (...args: any[]) => any = () => {\n return (\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??\n DEFAULT_FETCH_IMPLEMENTATION\n );\n};\n"],"mappings":";AAKA,MAAM,gCAAgC,GAAG,SAAgB,MAAM,GAAG;AAElE,MAAM,qCAAqC,OAAO,IAChD;;;;;;;AASF,MAAa,+BAA+B,YAAmC;AAC7E,CAAC,WAAmB,sCAAsCA;;;;;AAM5D,MAAaC,gCAA+D;AAC1E,QACG,WAAmB,uCACpB"}
1
+ {"version":3,"file":"fetch.js","names":["fetch"],"sources":["../../src/singletons/fetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// Wrap the default fetch call due to issues with illegal invocations\n// in some environments:\n// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err\n// @ts-expect-error Broad typing to support a range of fetch implementations\nconst DEFAULT_FETCH_IMPLEMENTATION = (...args: any[]) => fetch(...args);\n\nconst LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for(\n \"lg:fetch_implementation\"\n);\n\n/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport const overrideFetchImplementation = (fetch: (...args: any[]) => any) => {\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;\n};\n\n/**\n * @internal\n */\nexport const _getFetchImplementation: () => (...args: any[]) => any = () => {\n return (\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??\n DEFAULT_FETCH_IMPLEMENTATION\n );\n};\n"],"mappings":";AAKA,MAAM,gCAAgC,GAAG,SAAgB,MAAM,GAAG,KAAK;AAEvE,MAAM,qCAAqC,OAAO,IAChD,0BACD;;;;;;;AAQD,MAAa,+BAA+B,YAAmC;AAC7E,CAAC,WAAmB,sCAAsCA;;;;;AAM5D,MAAa,gCAA+D;AAC1E,QACG,WAAmB,uCACpB"}
package/dist/types.d.cts CHANGED
@@ -8,7 +8,7 @@ type OnConflictBehavior = "raise" | "do_nothing";
8
8
  type OnCompletionBehavior = "complete" | "continue";
9
9
  type DisconnectMode = "cancel" | "continue";
10
10
  type Durability = "exit" | "async" | "sync";
11
- type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | "messages" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
11
+ type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | "messages" | (string & {});
12
12
  interface Send {
13
13
  node: string;
14
14
  input: unknown | null;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job\n */\n schedule: string;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;WAIXC;EAYIC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;;AAe3C;AAMA;;;;;eA1HiBC,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;UAM3BG,eAAAA,SAAwBN"}
1
+ {"version":3,"file":"types.d.cts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {});\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job\n */\n schedule: string;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;EAcF,MAAA,CAAA,EAVTC,MAUS,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IAAA;EAELC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;EAAiB;AAe5D;AAMA;;;;;eA1HiBC,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;UAM3BG,eAAAA,SAAwBN"}
package/dist/types.d.ts CHANGED
@@ -8,7 +8,7 @@ type OnConflictBehavior = "raise" | "do_nothing";
8
8
  type OnCompletionBehavior = "complete" | "continue";
9
9
  type DisconnectMode = "cancel" | "continue";
10
10
  type Durability = "exit" | "async" | "sync";
11
- type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | "messages" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
11
+ type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | "messages" | (string & {});
12
12
  interface Send {
13
13
  node: string;
14
14
  input: unknown | null;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job\n */\n schedule: string;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;WAIXC;EAYIC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;;AAe3C;AAMA;;;;;eA1HiBC,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;UAM3BG,eAAAA,SAAwBN"}
1
+ {"version":3,"file":"types.d.ts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {});\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job\n */\n schedule: string;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;EAcF,MAAA,CAAA,EAVTC,MAUS,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IAAA;EAELC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;EAAiB;AAe5D;AAMA;;;;;eA1HiBC,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;UAM3BG,eAAAA,SAAwBN"}
@@ -28,39 +28,77 @@ type HumanMessage = BaseMessage & {
28
28
  type: "human";
29
29
  example?: boolean | undefined;
30
30
  };
31
- type AIMessage = BaseMessage & {
31
+ /**
32
+ * Default tool call type when no specific tool definitions are provided.
33
+ */
34
+ type DefaultToolCall = {
35
+ name: string;
36
+ args: {
37
+ [x: string]: any;
38
+ };
39
+ id?: string | undefined;
40
+ type?: "tool_call" | undefined;
41
+ };
42
+ /**
43
+ * Invalid tool call type.
44
+ */
45
+ type InvalidToolCall = {
46
+ name?: string | undefined;
47
+ args?: string | undefined;
48
+ id?: string | undefined;
49
+ error?: string | undefined;
50
+ type?: "invalid_tool_call" | undefined;
51
+ };
52
+ /**
53
+ * Usage metadata for AI messages.
54
+ */
55
+ type UsageMetadata = {
56
+ input_tokens: number;
57
+ output_tokens: number;
58
+ total_tokens: number;
59
+ input_token_details?: {
60
+ audio?: number | undefined;
61
+ cache_read?: number | undefined;
62
+ cache_creation?: number | undefined;
63
+ } | undefined;
64
+ output_token_details?: {
65
+ audio?: number | undefined;
66
+ reasoning?: number | undefined;
67
+ } | undefined;
68
+ };
69
+ /**
70
+ * AI message type that can be parameterized with custom tool call types.
71
+ *
72
+ * @template ToolCall The type of tool calls, defaults to DefaultToolCall.
73
+ * Provide a discriminated union for type-safe tool call handling.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * // Define typed tool calls as a discriminated union
78
+ * type MyToolCalls =
79
+ * | { name: "get_weather"; args: { location: string }; id?: string }
80
+ * | { name: "search"; args: { query: string; limit?: number }; id?: string };
81
+ *
82
+ * // Use with AIMessage
83
+ * const message: AIMessage<MyToolCalls> = ...;
84
+ *
85
+ * // Now tool.name === "get_weather" narrows tool.args type
86
+ * if (message.tool_calls) {
87
+ * for (const tool of message.tool_calls) {
88
+ * if (tool.name === "get_weather") {
89
+ * // tool.args is now { location: string }
90
+ * console.log(tool.args.location);
91
+ * }
92
+ * }
93
+ * }
94
+ * ```
95
+ */
96
+ type AIMessage<ToolCall = DefaultToolCall> = BaseMessage & {
32
97
  type: "ai";
33
98
  example?: boolean | undefined;
34
- tool_calls?: {
35
- name: string;
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- args: {
38
- [x: string]: any;
39
- };
40
- id?: string | undefined;
41
- type?: "tool_call" | undefined;
42
- }[] | undefined;
43
- invalid_tool_calls?: {
44
- name?: string | undefined;
45
- args?: string | undefined;
46
- id?: string | undefined;
47
- error?: string | undefined;
48
- type?: "invalid_tool_call" | undefined;
49
- }[] | undefined;
50
- usage_metadata?: {
51
- input_tokens: number;
52
- output_tokens: number;
53
- total_tokens: number;
54
- input_token_details?: {
55
- audio?: number | undefined;
56
- cache_read?: number | undefined;
57
- cache_creation?: number | undefined;
58
- } | undefined;
59
- output_token_details?: {
60
- audio?: number | undefined;
61
- reasoning?: number | undefined;
62
- } | undefined;
63
- } | undefined;
99
+ tool_calls?: ToolCall[] | undefined;
100
+ invalid_tool_calls?: InvalidToolCall[] | undefined;
101
+ usage_metadata?: UsageMetadata | undefined;
64
102
  };
65
103
  type ToolMessage = BaseMessage & {
66
104
  type: "tool";
@@ -73,7 +111,6 @@ type ToolMessage = BaseMessage & {
73
111
  * a subset of the full tool output is being passed as message content but the full
74
112
  * output is needed in other parts of the code.
75
113
  */
76
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
114
  artifact?: any;
78
115
  };
79
116
  type SystemMessage = BaseMessage & {
@@ -85,7 +122,143 @@ type FunctionMessage = BaseMessage & {
85
122
  type RemoveMessage = BaseMessage & {
86
123
  type: "remove";
87
124
  };
88
- type Message = HumanMessage | AIMessage | ToolMessage | SystemMessage | FunctionMessage | RemoveMessage;
125
+ /**
126
+ * Union of all message types.
127
+ *
128
+ * @template ToolCall The type of tool calls for AIMessage, defaults to DefaultToolCall.
129
+ */
130
+ type Message<ToolCall = DefaultToolCall> = HumanMessage | AIMessage<ToolCall> | ToolMessage | SystemMessage | FunctionMessage | RemoveMessage;
131
+ /**
132
+ * Helper type to infer schema input type, supporting both Zod v3 and v4.
133
+ * - Zod v4 uses `_zod.input` property
134
+ * - Zod v3 uses `_input` property
135
+ *
136
+ * Note: Zod v4 is checked first as it's the more specific structure.
137
+ */
138
+ type InferSchemaInput<S> = S extends {
139
+ _zod: {
140
+ input: infer Args;
141
+ };
142
+ } ? Args : S extends {
143
+ _input: infer Args;
144
+ } ? Args : never;
145
+ /**
146
+ * Helper type to extract the input type from a DynamicStructuredTool's _call method.
147
+ * This is more reliable than trying to infer from the schema directly because
148
+ * DynamicStructuredTool has the input type baked into its _call signature.
149
+ */
150
+ type InferToolInput<T> = T extends {
151
+ _call: (arg: infer Args, ...rest: any[]) => any;
152
+ } ? Args : T extends {
153
+ schema: infer S;
154
+ } ? InferSchemaInput<S> : never;
155
+ /**
156
+ * Infer a tool call type from a single tool.
157
+ * Works with tools created via `tool()` from `@langchain/core/tools`.
158
+ *
159
+ * For DynamicStructuredTool, this extracts the input type from the _call method,
160
+ * which is the most reliable source as it's the pre-computed input type.
161
+ *
162
+ * @template T The tool type (e.g., DynamicStructuredTool)
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * import { tool } from "@langchain/core/tools";
167
+ * import { z } from "zod";
168
+ *
169
+ * const getWeather = tool(
170
+ * async ({ location }) => `Weather in ${location}`,
171
+ * { name: "get_weather", schema: z.object({ location: z.string() }) }
172
+ * );
173
+ *
174
+ * // Infer: { name: "get_weather"; args: { location: string }; id?: string; type?: "tool_call" }
175
+ * type WeatherToolCall = ToolCallFromTool<typeof getWeather>;
176
+ * ```
177
+ */
178
+ type ToolCallFromTool<T> = T extends {
179
+ name: infer N;
180
+ } ? InferToolInput<T> extends infer Args ? Args extends never ? never : Args extends Record<string, any> ? {
181
+ name: N;
182
+ args: Args;
183
+ id?: string;
184
+ type?: "tool_call";
185
+ } : never : never : never;
186
+ /**
187
+ * Infer a union of tool call types from an array of tools.
188
+ * Works with tools created via `tool()` from `@langchain/core/tools`.
189
+ *
190
+ * @template T A tuple/array of tools
191
+ *
192
+ * @example
193
+ * ```ts
194
+ * import { tool } from "@langchain/core/tools";
195
+ * import { z } from "zod";
196
+ *
197
+ * const getWeather = tool(
198
+ * async ({ location }) => `Weather in ${location}`,
199
+ * { name: "get_weather", schema: z.object({ location: z.string() }) }
200
+ * );
201
+ *
202
+ * const search = tool(
203
+ * async ({ query }) => `Results for ${query}`,
204
+ * { name: "search", schema: z.object({ query: z.string() }) }
205
+ * );
206
+ *
207
+ * const tools = [getWeather, search] as const;
208
+ *
209
+ * // Infer union:
210
+ * // | { name: "get_weather"; args: { location: string }; id?: string; type?: "tool_call" }
211
+ * // | { name: "search"; args: { query: string }; id?: string; type?: "tool_call" }
212
+ * type MyToolCalls = ToolCallsFromTools<typeof tools>;
213
+ * ```
214
+ */
215
+ type ToolCallsFromTools<T extends readonly unknown[]> = T extends readonly [infer First, ...infer Rest] ? ToolCallFromTool<First> | ToolCallsFromTools<Rest> : never;
216
+ /**
217
+ * The lifecycle state of a tool call.
218
+ *
219
+ * - `pending`: Tool call received, awaiting result
220
+ * - `completed`: Tool execution finished successfully
221
+ * - `error`: Tool execution failed (result.status === "error")
222
+ */
223
+ type ToolCallState = "pending" | "completed" | "error";
224
+ /**
225
+ * Represents a tool call paired with its result.
226
+ * Useful for rendering tool invocations and their outputs together.
227
+ *
228
+ * @template ToolCall The type of the tool call.
229
+ */
230
+ type ToolCallWithResult<ToolCall = DefaultToolCall> = {
231
+ /**
232
+ * Unique identifier for this tool call.
233
+ * Uses the tool call's id if available, otherwise generates one from aiMessage.id and index.
234
+ */
235
+ id: string;
236
+ /**
237
+ * The tool call from the AI message.
238
+ */
239
+ call: ToolCall;
240
+ /**
241
+ * The result message from tool execution.
242
+ * `undefined` if the tool is still being executed or no result was received.
243
+ */
244
+ result: ToolMessage | undefined;
245
+ /**
246
+ * The AI message that initiated this tool call.
247
+ */
248
+ aiMessage: AIMessage<ToolCall>;
249
+ /**
250
+ * Index of this tool call within the AI message's tool_calls array.
251
+ */
252
+ index: number;
253
+ /**
254
+ * The current lifecycle state of the tool call.
255
+ *
256
+ * - `pending`: No result yet
257
+ * - `completed`: Has result with success status
258
+ * - `error`: Has result with error status
259
+ */
260
+ state: ToolCallState;
261
+ };
89
262
  //#endregion
90
- export { AIMessage, FunctionMessage, HumanMessage, Message, RemoveMessage, SystemMessage, ToolMessage };
263
+ export { AIMessage, DefaultToolCall, FunctionMessage, HumanMessage, Message, RemoveMessage, SystemMessage, ToolCallFromTool, ToolCallState, ToolCallWithResult, ToolCallsFromTools, ToolMessage };
91
264
  //# sourceMappingURL=types.messages.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.messages.d.cts","names":["ImageDetail","MessageContentImageUrl","MessageContentText","MessageContentComplex","MessageContent","MessageAdditionalKwargs","Record","BaseMessage","HumanMessage","AIMessage","ToolMessage","SystemMessage","FunctionMessage","RemoveMessage","Message"],"sources":["../src/types.messages.d.ts"],"sourcesContent":["type ImageDetail = \"auto\" | \"low\" | \"high\";\ntype MessageContentImageUrl = {\n type: \"image_url\";\n image_url: string | {\n url: string;\n detail?: ImageDetail | undefined;\n };\n};\ntype MessageContentText = {\n type: \"text\";\n text: string;\n};\ntype MessageContentComplex = MessageContentText | MessageContentImageUrl;\ntype MessageContent = string | MessageContentComplex[];\n/**\n * Model-specific additional kwargs, which is passed back to the underlying LLM.\n */\ntype MessageAdditionalKwargs = Record<string, unknown>;\ntype BaseMessage = {\n additional_kwargs?: MessageAdditionalKwargs | undefined;\n content: MessageContent;\n id?: string | undefined;\n name?: string | undefined;\n response_metadata?: Record<string, unknown> | undefined;\n};\nexport type HumanMessage = BaseMessage & {\n type: \"human\";\n example?: boolean | undefined;\n};\nexport type AIMessage = BaseMessage & {\n type: \"ai\";\n example?: boolean | undefined;\n tool_calls?: {\n name: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: {\n [x: string]: any;\n };\n id?: string | undefined;\n type?: \"tool_call\" | undefined;\n }[] | undefined;\n invalid_tool_calls?: {\n name?: string | undefined;\n args?: string | undefined;\n id?: string | undefined;\n error?: string | undefined;\n type?: \"invalid_tool_call\" | undefined;\n }[] | undefined;\n usage_metadata?: {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n input_token_details?: {\n audio?: number | undefined;\n cache_read?: number | undefined;\n cache_creation?: number | undefined;\n } | undefined;\n output_token_details?: {\n audio?: number | undefined;\n reasoning?: number | undefined;\n } | undefined;\n } | undefined;\n};\nexport type ToolMessage = BaseMessage & {\n type: \"tool\";\n status?: \"error\" | \"success\" | undefined;\n tool_call_id: string;\n /**\n * Artifact of the Tool execution which is not meant to be sent to the model.\n *\n * Should only be specified if it is different from the message content, e.g. if only\n * a subset of the full tool output is being passed as message content but the full\n * output is needed in other parts of the code.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n artifact?: any;\n};\nexport type SystemMessage = BaseMessage & {\n type: \"system\";\n};\nexport type FunctionMessage = BaseMessage & {\n type: \"function\";\n};\nexport type RemoveMessage = BaseMessage & {\n type: \"remove\";\n};\nexport type Message = HumanMessage | AIMessage | ToolMessage | SystemMessage | FunctionMessage | RemoveMessage;\nexport {};\n"],"mappings":";KAAKA,WAAAA;KACAC,sBAAAA,GADW;EACXA,IAAAA,EAAAA,WAAAA;EAOAC,SAAAA,EAAAA,MAAAA,GAAAA;IAIAC,GAAAA,EAAAA,MAAAA;IAAqB,MAAA,CAAA,EAPTH,WAOS,GAAA,SAAA;;;KAJrBE,kBAAAA;EAKAE,IAAAA,EAAAA,MAAAA;EAIAC,IAAAA,EAAAA,MAAAA;AAAgC,CAAA;KALhCF,qBAAAA,GAAwBD,kBAMb,GANkCD,sBAMlC;KALXG,cAAAA,GAMmBC,MAAAA,GANOF,qBAMPE,EAAAA;;;;AAMxB,KARKA,uBAAAA,GAA0BC,MAQJC,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;AAI3B,KAXKA,WAAAA,GAWgB;EAkCTG,iBAAW,CAAA,EA5CCL,uBA4CEE,GAAAA,SAAAA;EAcdI,OAAAA,EAzDCP,cAyDY;EAGbQ,EAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAe;EAGfC,IAAAA,CAAAA,EAAAA,MAAAA,GAAa,SAAA;EAGbC,iBAAO,CAAA,EA/DKR,MA+DL,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;CAAA;AAAGE,KA7DVA,YAAAA,GAAeD,WA6DLC,GAAAA;MAAeC,EAAAA,OAAAA;SAAYC,CAAAA,EAAAA,OAAAA,GAAAA,SAAAA;;AAA8BE,KAzDnEH,SAAAA,GAAYF,WAyDuDK,GAAAA;MAAkBC,EAAAA,IAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAvBrFH,WAAAA,GAAcH;;;;;;;;;;;;;;KAcdI,aAAAA,GAAgBJ;;;KAGhBK,eAAAA,GAAkBL;;;KAGlBM,aAAAA,GAAgBN;;;KAGhBO,OAAAA,GAAUN,eAAeC,YAAYC,cAAcC,gBAAgBC,kBAAkBC"}
1
+ {"version":3,"file":"types.messages.d.cts","names":["ImageDetail","MessageContentImageUrl","MessageContentText","MessageContentComplex","MessageContent","MessageAdditionalKwargs","Record","BaseMessage","HumanMessage","DefaultToolCall","InvalidToolCall","UsageMetadata","AIMessage","ToolCall","ToolMessage","SystemMessage","FunctionMessage","RemoveMessage","Message","InferSchemaInput","S","Args","InferToolInput","T","ToolCallFromTool","N","ToolCallsFromTools","First","Rest","ToolCallState","ToolCallWithResult"],"sources":["../src/types.messages.d.ts"],"sourcesContent":["type ImageDetail = \"auto\" | \"low\" | \"high\";\ntype MessageContentImageUrl = {\n type: \"image_url\";\n image_url: string | {\n url: string;\n detail?: ImageDetail | undefined;\n };\n};\ntype MessageContentText = {\n type: \"text\";\n text: string;\n};\ntype MessageContentComplex = MessageContentText | MessageContentImageUrl;\ntype MessageContent = string | MessageContentComplex[];\n/**\n * Model-specific additional kwargs, which is passed back to the underlying LLM.\n */\ntype MessageAdditionalKwargs = Record<string, unknown>;\ntype BaseMessage = {\n additional_kwargs?: MessageAdditionalKwargs | undefined;\n content: MessageContent;\n id?: string | undefined;\n name?: string | undefined;\n response_metadata?: Record<string, unknown> | undefined;\n};\nexport type HumanMessage = BaseMessage & {\n type: \"human\";\n example?: boolean | undefined;\n};\n/**\n * Default tool call type when no specific tool definitions are provided.\n */\nexport type DefaultToolCall = {\n name: string;\n args: {\n [x: string]: any;\n };\n id?: string | undefined;\n type?: \"tool_call\" | undefined;\n};\n/**\n * Invalid tool call type.\n */\nexport type InvalidToolCall = {\n name?: string | undefined;\n args?: string | undefined;\n id?: string | undefined;\n error?: string | undefined;\n type?: \"invalid_tool_call\" | undefined;\n};\n/**\n * Usage metadata for AI messages.\n */\nexport type UsageMetadata = {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n input_token_details?: {\n audio?: number | undefined;\n cache_read?: number | undefined;\n cache_creation?: number | undefined;\n } | undefined;\n output_token_details?: {\n audio?: number | undefined;\n reasoning?: number | undefined;\n } | undefined;\n};\n/**\n * AI message type that can be parameterized with custom tool call types.\n *\n * @template ToolCall The type of tool calls, defaults to DefaultToolCall.\n * Provide a discriminated union for type-safe tool call handling.\n *\n * @example\n * ```ts\n * // Define typed tool calls as a discriminated union\n * type MyToolCalls =\n * | { name: \"get_weather\"; args: { location: string }; id?: string }\n * | { name: \"search\"; args: { query: string; limit?: number }; id?: string };\n *\n * // Use with AIMessage\n * const message: AIMessage<MyToolCalls> = ...;\n *\n * // Now tool.name === \"get_weather\" narrows tool.args type\n * if (message.tool_calls) {\n * for (const tool of message.tool_calls) {\n * if (tool.name === \"get_weather\") {\n * // tool.args is now { location: string }\n * console.log(tool.args.location);\n * }\n * }\n * }\n * ```\n */\nexport type AIMessage<ToolCall = DefaultToolCall> = BaseMessage & {\n type: \"ai\";\n example?: boolean | undefined;\n tool_calls?: ToolCall[] | undefined;\n invalid_tool_calls?: InvalidToolCall[] | undefined;\n usage_metadata?: UsageMetadata | undefined;\n};\nexport type ToolMessage = BaseMessage & {\n type: \"tool\";\n status?: \"error\" | \"success\" | undefined;\n tool_call_id: string;\n /**\n * Artifact of the Tool execution which is not meant to be sent to the model.\n *\n * Should only be specified if it is different from the message content, e.g. if only\n * a subset of the full tool output is being passed as message content but the full\n * output is needed in other parts of the code.\n */\n artifact?: any;\n};\nexport type SystemMessage = BaseMessage & {\n type: \"system\";\n};\nexport type FunctionMessage = BaseMessage & {\n type: \"function\";\n};\nexport type RemoveMessage = BaseMessage & {\n type: \"remove\";\n};\n/**\n * Union of all message types.\n *\n * @template ToolCall The type of tool calls for AIMessage, defaults to DefaultToolCall.\n */\nexport type Message<ToolCall = DefaultToolCall> = HumanMessage | AIMessage<ToolCall> | ToolMessage | SystemMessage | FunctionMessage | RemoveMessage;\n/**\n * Helper type to infer schema input type, supporting both Zod v3 and v4.\n * - Zod v4 uses `_zod.input` property\n * - Zod v3 uses `_input` property\n *\n * Note: Zod v4 is checked first as it's the more specific structure.\n */\ntype InferSchemaInput<S> = S extends {\n _zod: {\n input: infer Args;\n };\n} ? Args : S extends {\n _input: infer Args;\n} ? Args : never;\n/**\n * Helper type to extract the input type from a DynamicStructuredTool's _call method.\n * This is more reliable than trying to infer from the schema directly because\n * DynamicStructuredTool has the input type baked into its _call signature.\n */\ntype InferToolInput<T> = T extends {\n _call: (arg: infer Args, ...rest: any[]) => any;\n} ? Args : T extends {\n schema: infer S;\n} ? InferSchemaInput<S> : never;\n/**\n * Infer a tool call type from a single tool.\n * Works with tools created via `tool()` from `@langchain/core/tools`.\n *\n * For DynamicStructuredTool, this extracts the input type from the _call method,\n * which is the most reliable source as it's the pre-computed input type.\n *\n * @template T The tool type (e.g., DynamicStructuredTool)\n *\n * @example\n * ```ts\n * import { tool } from \"@langchain/core/tools\";\n * import { z } from \"zod\";\n *\n * const getWeather = tool(\n * async ({ location }) => `Weather in ${location}`,\n * { name: \"get_weather\", schema: z.object({ location: z.string() }) }\n * );\n *\n * // Infer: { name: \"get_weather\"; args: { location: string }; id?: string; type?: \"tool_call\" }\n * type WeatherToolCall = ToolCallFromTool<typeof getWeather>;\n * ```\n */\nexport type ToolCallFromTool<T> = T extends {\n name: infer N;\n} ? InferToolInput<T> extends infer Args ? Args extends never ? never : Args extends Record<string, any> ? {\n name: N;\n args: Args;\n id?: string;\n type?: \"tool_call\";\n} : never : never : never;\n/**\n * Infer a union of tool call types from an array of tools.\n * Works with tools created via `tool()` from `@langchain/core/tools`.\n *\n * @template T A tuple/array of tools\n *\n * @example\n * ```ts\n * import { tool } from \"@langchain/core/tools\";\n * import { z } from \"zod\";\n *\n * const getWeather = tool(\n * async ({ location }) => `Weather in ${location}`,\n * { name: \"get_weather\", schema: z.object({ location: z.string() }) }\n * );\n *\n * const search = tool(\n * async ({ query }) => `Results for ${query}`,\n * { name: \"search\", schema: z.object({ query: z.string() }) }\n * );\n *\n * const tools = [getWeather, search] as const;\n *\n * // Infer union:\n * // | { name: \"get_weather\"; args: { location: string }; id?: string; type?: \"tool_call\" }\n * // | { name: \"search\"; args: { query: string }; id?: string; type?: \"tool_call\" }\n * type MyToolCalls = ToolCallsFromTools<typeof tools>;\n * ```\n */\nexport type ToolCallsFromTools<T extends readonly unknown[]> = T extends readonly [infer First, ...infer Rest] ? ToolCallFromTool<First> | ToolCallsFromTools<Rest> : never;\n/**\n * The lifecycle state of a tool call.\n *\n * - `pending`: Tool call received, awaiting result\n * - `completed`: Tool execution finished successfully\n * - `error`: Tool execution failed (result.status === \"error\")\n */\nexport type ToolCallState = \"pending\" | \"completed\" | \"error\";\n/**\n * Represents a tool call paired with its result.\n * Useful for rendering tool invocations and their outputs together.\n *\n * @template ToolCall The type of the tool call.\n */\nexport type ToolCallWithResult<ToolCall = DefaultToolCall> = {\n /**\n * Unique identifier for this tool call.\n * Uses the tool call's id if available, otherwise generates one from aiMessage.id and index.\n */\n id: string;\n /**\n * The tool call from the AI message.\n */\n call: ToolCall;\n /**\n * The result message from tool execution.\n * `undefined` if the tool is still being executed or no result was received.\n */\n result: ToolMessage | undefined;\n /**\n * The AI message that initiated this tool call.\n */\n aiMessage: AIMessage<ToolCall>;\n /**\n * Index of this tool call within the AI message's tool_calls array.\n */\n index: number;\n /**\n * The current lifecycle state of the tool call.\n *\n * - `pending`: No result yet\n * - `completed`: Has result with success status\n * - `error`: Has result with error status\n */\n state: ToolCallState;\n};\nexport {};\n"],"mappings":";KAAKA,WAAAA;KACAC,sBAAAA,GADW;EACXA,IAAAA,EAAAA,WAAAA;EAOAC,SAAAA,EAAAA,MAAAA,GAAAA;IAIAC,GAAAA,EAAAA,MAAAA;IAAqB,MAAA,CAAA,EAPTH,WAOS,GAAA,SAAA;;;KAJrBE,kBAAAA,GAImE;EACnEE,IAAAA,EAAAA,MAAAA;EAIAC,IAAAA,EAAAA,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