@langchain/langgraph-sdk 1.9.19 → 1.9.21
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/index.cjs +2 -1
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1 -0
- package/dist/client/index.d.cts.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/stream/error.cjs +21 -0
- package/dist/client/stream/error.cjs.map +1 -1
- package/dist/client/stream/error.js +21 -1
- package/dist/client/stream/error.js.map +1 -1
- package/dist/client/stream/index.cjs +24 -1
- package/dist/client/stream/index.cjs.map +1 -1
- package/dist/client/stream/index.d.cts.map +1 -1
- package/dist/client/stream/index.d.ts.map +1 -1
- package/dist/client/stream/index.js +24 -1
- package/dist/client/stream/index.js.map +1 -1
- package/dist/client/stream/resolve-client-api-url.cjs +20 -0
- package/dist/client/stream/resolve-client-api-url.cjs.map +1 -0
- package/dist/client/stream/resolve-client-api-url.d.cts +17 -0
- package/dist/client/stream/resolve-client-api-url.d.cts.map +1 -0
- package/dist/client/stream/resolve-client-api-url.d.ts +17 -0
- package/dist/client/stream/resolve-client-api-url.d.ts.map +1 -0
- package/dist/client/stream/resolve-client-api-url.js +20 -0
- package/dist/client/stream/resolve-client-api-url.js.map +1 -0
- package/dist/client/stream/transport/agent-server.cjs +13 -1
- package/dist/client/stream/transport/agent-server.cjs.map +1 -1
- package/dist/client/stream/transport/agent-server.d.cts +13 -0
- package/dist/client/stream/transport/agent-server.d.cts.map +1 -1
- package/dist/client/stream/transport/agent-server.d.ts +13 -0
- package/dist/client/stream/transport/agent-server.d.ts.map +1 -1
- package/dist/client/stream/transport/agent-server.js +13 -1
- package/dist/client/stream/transport/agent-server.js.map +1 -1
- package/dist/client/stream/transport/http.cjs +74 -10
- package/dist/client/stream/transport/http.cjs.map +1 -1
- package/dist/client/stream/transport/http.d.cts +25 -1
- package/dist/client/stream/transport/http.d.cts.map +1 -1
- package/dist/client/stream/transport/http.d.ts +25 -1
- package/dist/client/stream/transport/http.d.ts.map +1 -1
- package/dist/client/stream/transport/http.js +74 -10
- package/dist/client/stream/transport/http.js.map +1 -1
- package/dist/client/stream/transport/index.cjs +2 -1
- package/dist/client/stream/transport/index.js +2 -1
- package/dist/client/stream/transport/types.d.cts +46 -0
- package/dist/client/stream/transport/types.d.cts.map +1 -1
- package/dist/client/stream/transport/types.d.ts +46 -0
- package/dist/client/stream/transport/types.d.ts.map +1 -1
- package/dist/client/stream/transport/websocket.cjs +105 -16
- package/dist/client/stream/transport/websocket.cjs.map +1 -1
- package/dist/client/stream/transport/websocket.d.cts +19 -0
- package/dist/client/stream/transport/websocket.d.cts.map +1 -1
- package/dist/client/stream/transport/websocket.d.ts +19 -0
- package/dist/client/stream/transport/websocket.d.ts.map +1 -1
- package/dist/client/stream/transport/websocket.js +105 -17
- package/dist/client/stream/transport/websocket.js.map +1 -1
- package/dist/client/stream/transport.d.cts +10 -4
- package/dist/client/stream/transport.d.cts.map +1 -1
- package/dist/client/stream/transport.d.ts +10 -4
- package/dist/client/stream/transport.d.ts.map +1 -1
- package/dist/client/stream/types.d.cts +17 -0
- package/dist/client/stream/types.d.cts.map +1 -1
- package/dist/client/stream/types.d.ts +17 -0
- package/dist/client/stream/types.d.ts.map +1 -1
- package/dist/client/threads/index.cjs +30 -14
- package/dist/client/threads/index.cjs.map +1 -1
- package/dist/client/threads/index.js +30 -14
- package/dist/client/threads/index.js.map +1 -1
- package/dist/client.cjs +3 -1
- package/dist/client.d.cts +2 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.js +3 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/stream/controller.cjs +31 -2
- package/dist/stream/controller.cjs.map +1 -1
- package/dist/stream/controller.d.cts.map +1 -1
- package/dist/stream/controller.d.ts.map +1 -1
- package/dist/stream/controller.js +31 -2
- package/dist/stream/controller.js.map +1 -1
- package/dist/stream/index.cjs +2 -0
- package/dist/stream/index.d.cts +2 -1
- package/dist/stream/index.d.ts +2 -1
- package/dist/stream/index.js +2 -1
- package/dist/stream/projections/channel-effect.cjs +52 -0
- package/dist/stream/projections/channel-effect.cjs.map +1 -0
- package/dist/stream/projections/channel-effect.d.cts +35 -0
- package/dist/stream/projections/channel-effect.d.cts.map +1 -0
- package/dist/stream/projections/channel-effect.d.ts +35 -0
- package/dist/stream/projections/channel-effect.d.ts.map +1 -0
- package/dist/stream/projections/channel-effect.js +52 -0
- package/dist/stream/projections/channel-effect.js.map +1 -0
- package/dist/stream/projections/index.cjs +1 -0
- package/dist/stream/projections/index.d.ts +1 -0
- package/dist/stream/projections/index.js +1 -0
- package/dist/stream/root-message-projection.cjs +55 -0
- package/dist/stream/root-message-projection.cjs.map +1 -1
- package/dist/stream/root-message-projection.js +55 -0
- package/dist/stream/root-message-projection.js.map +1 -1
- package/dist/ui/branching.d.cts +1 -1
- package/dist/ui/branching.d.ts +1 -1
- package/dist/ui/orchestrator.d.cts +1 -1
- package/dist/ui/orchestrator.d.cts.map +1 -1
- package/dist/ui/orchestrator.d.ts +1 -1
- package/dist/ui/orchestrator.d.ts.map +1 -1
- package/dist/utils/stream.d.cts +1 -1
- package/dist/utils/stream.d.cts.map +1 -1
- package/dist/utils/stream.d.ts +1 -1
- package/dist/utils/stream.d.ts.map +1 -1
- package/package.json +5 -2
package/dist/client/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@ require("./stream/handles/subgraphs.cjs");
|
|
|
8
8
|
require("./stream/handles/subagents.cjs");
|
|
9
9
|
require("./stream/error.cjs");
|
|
10
10
|
require("./stream/index.cjs");
|
|
11
|
-
require("./stream/transport/http.cjs");
|
|
12
11
|
require("./stream/transport/websocket.cjs");
|
|
12
|
+
require("./stream/transport/http.cjs");
|
|
13
13
|
const require_index$2 = require("./threads/index.cjs");
|
|
14
14
|
const require_index$3 = require("./runs/index.cjs");
|
|
15
15
|
const require_index$4 = require("./crons/index.cjs");
|
|
@@ -17,6 +17,7 @@ const require_index$5 = require("./store/index.cjs");
|
|
|
17
17
|
const require_index$6 = require("./ui-internal/index.cjs");
|
|
18
18
|
require("./stream/transport/agent-server.cjs");
|
|
19
19
|
require("./stream/transport/index.cjs");
|
|
20
|
+
require("./stream/resolve-client-api-url.cjs");
|
|
20
21
|
//#region src/client/index.ts
|
|
21
22
|
var Client = class {
|
|
22
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["AssistantsClient","ThreadsClient","RunsClient","CronsClient","StoreClient","UiClient"],"sources":["../../src/client/index.ts"],"sourcesContent":["import { DefaultValues } from \"../schema.js\";\nimport { type ClientConfig } from \"./base.js\";\nimport { AssistantsClient } from \"./assistants/index.js\";\nimport { ThreadsClient } from \"./threads/index.js\";\nimport { RunsClient } from \"./runs/index.js\";\nimport { CronsClient } from \"./crons/index.js\";\nimport { StoreClient } from \"./store/index.js\";\nimport { UiClient } from \"./ui-internal/index.js\";\n\nexport class Client<\n TStateType = DefaultValues,\n TUpdateType = TStateType,\n TCustomEventType = unknown,\n> {\n /**\n * The client for interacting with assistants.\n */\n public assistants: AssistantsClient;\n\n /**\n * The client for interacting with threads.\n */\n public threads: ThreadsClient<TStateType, TUpdateType>;\n\n /**\n * The client for interacting with runs.\n */\n public runs: RunsClient<TStateType, TUpdateType, TCustomEventType>;\n\n /**\n * The client for interacting with cron runs.\n */\n public crons: CronsClient;\n\n /**\n * The client for interacting with the KV store.\n */\n public store: StoreClient;\n\n /**\n * The client for interacting with the UI.\n * @internal Used by LoadExternalComponent and the API might change in the future.\n */\n public \"~ui\": UiClient;\n\n /**\n * @internal Used to obtain a stable key representing the client.\n */\n private \"~configHash\": string | undefined;\n\n constructor(config?: ClientConfig) {\n this[\"~configHash\"] = (() =>\n JSON.stringify({\n apiUrl: config?.apiUrl,\n apiKey: config?.apiKey,\n timeoutMs: config?.timeoutMs,\n defaultHeaders: config?.defaultHeaders,\n streamProtocol: config?.streamProtocol,\n\n maxConcurrency: config?.callerOptions?.maxConcurrency,\n maxRetries: config?.callerOptions?.maxRetries,\n\n callbacks: {\n onFailedResponseHook:\n config?.callerOptions?.onFailedResponseHook != null,\n onRequest: config?.onRequest != null,\n fetch: config?.callerOptions?.fetch != null,\n },\n }))();\n\n this.assistants = new AssistantsClient(config);\n this.threads = new ThreadsClient(config);\n this.runs = new RunsClient(config);\n this.crons = new CronsClient(config);\n this.store = new StoreClient(config);\n this[\"~ui\"] = new UiClient(config);\n }\n}\n\n/**\n * @internal Used to obtain a stable key representing the client.\n */\nexport function getClientConfigHash(client: Client): string | undefined {\n return client[\"~configHash\"];\n}\n\nexport { BaseClient } from \"./base.js\";\nexport { getApiKey } from \"./base.js\";\nexport type { ClientConfig, RequestHook, HeaderValue } from \"./base.js\";\nexport { AssistantsClient } from \"./assistants/index.js\";\nexport { ThreadsClient } from \"./threads/index.js\";\nexport { RunsClient } from \"./runs/index.js\";\nexport { CronsClient } from \"./crons/index.js\";\nexport { StoreClient } from \"./store/index.js\";\n\nexport {\n ProtocolError,\n ThreadStream,\n SubscriptionHandle,\n StreamingMessage,\n StreamingMessageAssembler,\n MessageAssembler,\n MediaAssembler,\n MediaAssemblyError,\n ToolCallAssembler,\n SubgraphDiscoveryHandle,\n SubgraphHandle,\n SubagentHandle,\n SubagentDiscoveryHandle,\n inferChannel,\n matchesSubscription,\n} from \"./stream/index.js\";\n\nexport type {\n TransportAdapter,\n AgentServerAdapter,\n AssembledMessage,\n MessageAssemblyUpdate,\n AssembledToolCall,\n ToolCallStatus,\n Subscribable,\n InterruptPayload,\n SubscribeOptions,\n EventMethodByChannel,\n EventForChannel,\n EventForChannels,\n ThreadStreamOptions,\n ThreadStreamTransport,\n ThreadStreamTransportKind,\n SessionOrderingState,\n EventSubscription,\n MessageSubscription,\n InputModule,\n StateModule,\n ThreadModules,\n ThreadExtension,\n ThreadExtensions,\n UnwrapExtension,\n AnyMediaHandle,\n AudioMedia,\n FileMedia,\n ImageMedia,\n MediaAssemblerCallbacks,\n MediaAssemblerOptions,\n MediaAssemblyErrorKind,\n MediaBase,\n MediaBlockType,\n VideoMedia,\n} from \"./stream/index.js\";\n\nexport {\n ProtocolSseTransportAdapter,\n ProtocolWebSocketTransportAdapter,\n HttpAgentServerAdapter,\n} from \"./stream/transport/index.js\";\n\nexport type { HttpAgentServerAdapterOptions } from \"./stream/transport/index.js\";\n\nexport type {\n ProtocolRequestHook,\n ProtocolSseTransportOptions,\n ProtocolWebSocketTransportOptions,\n ProtocolTransportPaths,\n ProtocolHeaderValue,\n} from \"./stream/transport/index.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["AssistantsClient","ThreadsClient","RunsClient","CronsClient","StoreClient","UiClient"],"sources":["../../src/client/index.ts"],"sourcesContent":["import { DefaultValues } from \"../schema.js\";\nimport { type ClientConfig } from \"./base.js\";\nimport { AssistantsClient } from \"./assistants/index.js\";\nimport { ThreadsClient } from \"./threads/index.js\";\nimport { RunsClient } from \"./runs/index.js\";\nimport { CronsClient } from \"./crons/index.js\";\nimport { StoreClient } from \"./store/index.js\";\nimport { UiClient } from \"./ui-internal/index.js\";\n\nexport class Client<\n TStateType = DefaultValues,\n TUpdateType = TStateType,\n TCustomEventType = unknown,\n> {\n /**\n * The client for interacting with assistants.\n */\n public assistants: AssistantsClient;\n\n /**\n * The client for interacting with threads.\n */\n public threads: ThreadsClient<TStateType, TUpdateType>;\n\n /**\n * The client for interacting with runs.\n */\n public runs: RunsClient<TStateType, TUpdateType, TCustomEventType>;\n\n /**\n * The client for interacting with cron runs.\n */\n public crons: CronsClient;\n\n /**\n * The client for interacting with the KV store.\n */\n public store: StoreClient;\n\n /**\n * The client for interacting with the UI.\n * @internal Used by LoadExternalComponent and the API might change in the future.\n */\n public \"~ui\": UiClient;\n\n /**\n * @internal Used to obtain a stable key representing the client.\n */\n private \"~configHash\": string | undefined;\n\n constructor(config?: ClientConfig) {\n this[\"~configHash\"] = (() =>\n JSON.stringify({\n apiUrl: config?.apiUrl,\n apiKey: config?.apiKey,\n timeoutMs: config?.timeoutMs,\n defaultHeaders: config?.defaultHeaders,\n streamProtocol: config?.streamProtocol,\n\n maxConcurrency: config?.callerOptions?.maxConcurrency,\n maxRetries: config?.callerOptions?.maxRetries,\n\n callbacks: {\n onFailedResponseHook:\n config?.callerOptions?.onFailedResponseHook != null,\n onRequest: config?.onRequest != null,\n fetch: config?.callerOptions?.fetch != null,\n },\n }))();\n\n this.assistants = new AssistantsClient(config);\n this.threads = new ThreadsClient(config);\n this.runs = new RunsClient(config);\n this.crons = new CronsClient(config);\n this.store = new StoreClient(config);\n this[\"~ui\"] = new UiClient(config);\n }\n}\n\n/**\n * @internal Used to obtain a stable key representing the client.\n */\nexport function getClientConfigHash(client: Client): string | undefined {\n return client[\"~configHash\"];\n}\n\nexport { BaseClient } from \"./base.js\";\nexport { getApiKey } from \"./base.js\";\nexport type { ClientConfig, RequestHook, HeaderValue } from \"./base.js\";\nexport { AssistantsClient } from \"./assistants/index.js\";\nexport { ThreadsClient } from \"./threads/index.js\";\nexport { RunsClient } from \"./runs/index.js\";\nexport { CronsClient } from \"./crons/index.js\";\nexport { StoreClient } from \"./store/index.js\";\n\nexport {\n ProtocolError,\n ThreadStream,\n SubscriptionHandle,\n StreamingMessage,\n StreamingMessageAssembler,\n MessageAssembler,\n MediaAssembler,\n MediaAssemblyError,\n ToolCallAssembler,\n SubgraphDiscoveryHandle,\n SubgraphHandle,\n SubagentHandle,\n SubagentDiscoveryHandle,\n inferChannel,\n matchesSubscription,\n} from \"./stream/index.js\";\n\nexport type {\n TransportAdapter,\n AgentServerAdapter,\n AssembledMessage,\n MessageAssemblyUpdate,\n AssembledToolCall,\n ToolCallStatus,\n Subscribable,\n InterruptPayload,\n SubscribeOptions,\n EventMethodByChannel,\n EventForChannel,\n EventForChannels,\n ThreadStreamOptions,\n ThreadStreamTransport,\n ThreadStreamTransportKind,\n SessionOrderingState,\n EventSubscription,\n MessageSubscription,\n InputModule,\n StateModule,\n ThreadModules,\n ThreadExtension,\n ThreadExtensions,\n UnwrapExtension,\n AnyMediaHandle,\n AudioMedia,\n FileMedia,\n ImageMedia,\n MediaAssemblerCallbacks,\n MediaAssemblerOptions,\n MediaAssemblyErrorKind,\n MediaBase,\n MediaBlockType,\n VideoMedia,\n} from \"./stream/index.js\";\n\nexport {\n ProtocolSseTransportAdapter,\n ProtocolWebSocketTransportAdapter,\n HttpAgentServerAdapter,\n} from \"./stream/transport/index.js\";\n\nexport type { HttpAgentServerAdapterOptions } from \"./stream/transport/index.js\";\nexport { resolveClientApiUrl } from \"./stream/resolve-client-api-url.js\";\n\nexport type {\n ProtocolRequestHook,\n ProtocolSseTransportOptions,\n ProtocolWebSocketTransportOptions,\n ProtocolTransportPaths,\n ProtocolHeaderValue,\n} from \"./stream/transport/index.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,IAAa,SAAb,MAIE;;;;CAIA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;;CAMA;;;;CAKA;CAEA,YAAY,QAAuB;AACjC,OAAK,iBACH,KAAK,UAAU;GACb,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;GAChB,WAAW,QAAQ;GACnB,gBAAgB,QAAQ;GACxB,gBAAgB,QAAQ;GAExB,gBAAgB,QAAQ,eAAe;GACvC,YAAY,QAAQ,eAAe;GAEnC,WAAW;IACT,sBACE,QAAQ,eAAe,wBAAwB;IACjD,WAAW,QAAQ,aAAa;IAChC,OAAO,QAAQ,eAAe,SAAS;IACxC;GACF,CAAC;AAEJ,OAAK,aAAa,IAAIA,cAAAA,iBAAiB,OAAO;AAC9C,OAAK,UAAU,IAAIC,gBAAAA,cAAc,OAAO;AACxC,OAAK,OAAO,IAAIC,gBAAAA,WAAW,OAAO;AAClC,OAAK,QAAQ,IAAIC,gBAAAA,YAAY,OAAO;AACpC,OAAK,QAAQ,IAAIC,gBAAAA,YAAY,OAAO;AACpC,OAAK,SAAS,IAAIC,gBAAAA,SAAS,OAAO;;;;;;AAOtC,SAAgB,oBAAoB,QAAoC;AACtE,QAAO,OAAO"}
|
package/dist/client/index.d.cts
CHANGED
|
@@ -20,6 +20,7 @@ import { HeaderValue as HeaderValue$1, ProtocolRequestHook, ProtocolSseTransport
|
|
|
20
20
|
import { ProtocolSseTransportAdapter } from "./stream/transport/http.cjs";
|
|
21
21
|
import { ProtocolWebSocketTransportAdapter } from "./stream/transport/websocket.cjs";
|
|
22
22
|
import { HttpAgentServerAdapter, HttpAgentServerAdapterOptions } from "./stream/transport/agent-server.cjs";
|
|
23
|
+
import { resolveClientApiUrl } from "./stream/resolve-client-api-url.cjs";
|
|
23
24
|
|
|
24
25
|
//#region src/client/index.d.ts
|
|
25
26
|
declare class Client<TStateType = DefaultValues, TUpdateType = TStateType, TCustomEventType = unknown> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/client/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;cASa,MAAA,cACE,aAAA,gBACC,UAAA;;;;EAMP,UAAA,EAAY,gBAAA;;;;EAKZ,OAAA,EAAS,aAAA,CAAc,UAAA,EAAY,WAAA;;;;EAKnC,IAAA,EAAM,UAAA,CAAW,UAAA,EAAY,WAAA,EAAa,gBAAA;;;;EAK1C,KAAA,EAAO,WAAA;EAvBH;;;EA4BJ,KAAA,EAAO,WAAA;EA1BA;;;;EAAA,OAgCA,QAAA;EAhBU;;;EAAA;EAuBxB,WAAA,CAAY,MAAA,GAAS,YAAA;AAAA;;;;iBAgCP,mBAAA,CAAoB,MAAA,EAAQ,MAAA"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { HeaderValue as HeaderValue$1, ProtocolRequestHook, ProtocolSseTransport
|
|
|
20
20
|
import { ProtocolSseTransportAdapter } from "./stream/transport/http.js";
|
|
21
21
|
import { ProtocolWebSocketTransportAdapter } from "./stream/transport/websocket.js";
|
|
22
22
|
import { HttpAgentServerAdapter, HttpAgentServerAdapterOptions } from "./stream/transport/agent-server.js";
|
|
23
|
+
import { resolveClientApiUrl } from "./stream/resolve-client-api-url.js";
|
|
23
24
|
|
|
24
25
|
//#region src/client/index.d.ts
|
|
25
26
|
declare class Client<TStateType = DefaultValues, TUpdateType = TStateType, TCustomEventType = unknown> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;cASa,MAAA,cACE,aAAA,gBACC,UAAA;;;;EAMP,UAAA,EAAY,gBAAA;;;;EAKZ,OAAA,EAAS,aAAA,CAAc,UAAA,EAAY,WAAA;;;;EAKnC,IAAA,EAAM,UAAA,CAAW,UAAA,EAAY,WAAA,EAAa,gBAAA;;;;EAK1C,KAAA,EAAO,WAAA;EAvBH;;;EA4BJ,KAAA,EAAO,WAAA;EA1BA;;;;EAAA,OAgCA,QAAA;EAhBU;;;EAAA;EAuBxB,WAAA,CAAY,MAAA,GAAS,YAAA;AAAA;;;;iBAgCP,mBAAA,CAAoB,MAAA,EAAQ,MAAA"}
|
package/dist/client/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import "./stream/handles/subgraphs.js";
|
|
|
8
8
|
import "./stream/handles/subagents.js";
|
|
9
9
|
import "./stream/error.js";
|
|
10
10
|
import "./stream/index.js";
|
|
11
|
-
import "./stream/transport/http.js";
|
|
12
11
|
import "./stream/transport/websocket.js";
|
|
12
|
+
import "./stream/transport/http.js";
|
|
13
13
|
import { ThreadsClient } from "./threads/index.js";
|
|
14
14
|
import { RunsClient } from "./runs/index.js";
|
|
15
15
|
import { CronsClient } from "./crons/index.js";
|
|
@@ -17,6 +17,7 @@ import { StoreClient } from "./store/index.js";
|
|
|
17
17
|
import { UiClient } from "./ui-internal/index.js";
|
|
18
18
|
import "./stream/transport/agent-server.js";
|
|
19
19
|
import "./stream/transport/index.js";
|
|
20
|
+
import "./stream/resolve-client-api-url.js";
|
|
20
21
|
//#region src/client/index.ts
|
|
21
22
|
var Client = class {
|
|
22
23
|
/**
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/client/index.ts"],"sourcesContent":["import { DefaultValues } from \"../schema.js\";\nimport { type ClientConfig } from \"./base.js\";\nimport { AssistantsClient } from \"./assistants/index.js\";\nimport { ThreadsClient } from \"./threads/index.js\";\nimport { RunsClient } from \"./runs/index.js\";\nimport { CronsClient } from \"./crons/index.js\";\nimport { StoreClient } from \"./store/index.js\";\nimport { UiClient } from \"./ui-internal/index.js\";\n\nexport class Client<\n TStateType = DefaultValues,\n TUpdateType = TStateType,\n TCustomEventType = unknown,\n> {\n /**\n * The client for interacting with assistants.\n */\n public assistants: AssistantsClient;\n\n /**\n * The client for interacting with threads.\n */\n public threads: ThreadsClient<TStateType, TUpdateType>;\n\n /**\n * The client for interacting with runs.\n */\n public runs: RunsClient<TStateType, TUpdateType, TCustomEventType>;\n\n /**\n * The client for interacting with cron runs.\n */\n public crons: CronsClient;\n\n /**\n * The client for interacting with the KV store.\n */\n public store: StoreClient;\n\n /**\n * The client for interacting with the UI.\n * @internal Used by LoadExternalComponent and the API might change in the future.\n */\n public \"~ui\": UiClient;\n\n /**\n * @internal Used to obtain a stable key representing the client.\n */\n private \"~configHash\": string | undefined;\n\n constructor(config?: ClientConfig) {\n this[\"~configHash\"] = (() =>\n JSON.stringify({\n apiUrl: config?.apiUrl,\n apiKey: config?.apiKey,\n timeoutMs: config?.timeoutMs,\n defaultHeaders: config?.defaultHeaders,\n streamProtocol: config?.streamProtocol,\n\n maxConcurrency: config?.callerOptions?.maxConcurrency,\n maxRetries: config?.callerOptions?.maxRetries,\n\n callbacks: {\n onFailedResponseHook:\n config?.callerOptions?.onFailedResponseHook != null,\n onRequest: config?.onRequest != null,\n fetch: config?.callerOptions?.fetch != null,\n },\n }))();\n\n this.assistants = new AssistantsClient(config);\n this.threads = new ThreadsClient(config);\n this.runs = new RunsClient(config);\n this.crons = new CronsClient(config);\n this.store = new StoreClient(config);\n this[\"~ui\"] = new UiClient(config);\n }\n}\n\n/**\n * @internal Used to obtain a stable key representing the client.\n */\nexport function getClientConfigHash(client: Client): string | undefined {\n return client[\"~configHash\"];\n}\n\nexport { BaseClient } from \"./base.js\";\nexport { getApiKey } from \"./base.js\";\nexport type { ClientConfig, RequestHook, HeaderValue } from \"./base.js\";\nexport { AssistantsClient } from \"./assistants/index.js\";\nexport { ThreadsClient } from \"./threads/index.js\";\nexport { RunsClient } from \"./runs/index.js\";\nexport { CronsClient } from \"./crons/index.js\";\nexport { StoreClient } from \"./store/index.js\";\n\nexport {\n ProtocolError,\n ThreadStream,\n SubscriptionHandle,\n StreamingMessage,\n StreamingMessageAssembler,\n MessageAssembler,\n MediaAssembler,\n MediaAssemblyError,\n ToolCallAssembler,\n SubgraphDiscoveryHandle,\n SubgraphHandle,\n SubagentHandle,\n SubagentDiscoveryHandle,\n inferChannel,\n matchesSubscription,\n} from \"./stream/index.js\";\n\nexport type {\n TransportAdapter,\n AgentServerAdapter,\n AssembledMessage,\n MessageAssemblyUpdate,\n AssembledToolCall,\n ToolCallStatus,\n Subscribable,\n InterruptPayload,\n SubscribeOptions,\n EventMethodByChannel,\n EventForChannel,\n EventForChannels,\n ThreadStreamOptions,\n ThreadStreamTransport,\n ThreadStreamTransportKind,\n SessionOrderingState,\n EventSubscription,\n MessageSubscription,\n InputModule,\n StateModule,\n ThreadModules,\n ThreadExtension,\n ThreadExtensions,\n UnwrapExtension,\n AnyMediaHandle,\n AudioMedia,\n FileMedia,\n ImageMedia,\n MediaAssemblerCallbacks,\n MediaAssemblerOptions,\n MediaAssemblyErrorKind,\n MediaBase,\n MediaBlockType,\n VideoMedia,\n} from \"./stream/index.js\";\n\nexport {\n ProtocolSseTransportAdapter,\n ProtocolWebSocketTransportAdapter,\n HttpAgentServerAdapter,\n} from \"./stream/transport/index.js\";\n\nexport type { HttpAgentServerAdapterOptions } from \"./stream/transport/index.js\";\n\nexport type {\n ProtocolRequestHook,\n ProtocolSseTransportOptions,\n ProtocolWebSocketTransportOptions,\n ProtocolTransportPaths,\n ProtocolHeaderValue,\n} from \"./stream/transport/index.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/client/index.ts"],"sourcesContent":["import { DefaultValues } from \"../schema.js\";\nimport { type ClientConfig } from \"./base.js\";\nimport { AssistantsClient } from \"./assistants/index.js\";\nimport { ThreadsClient } from \"./threads/index.js\";\nimport { RunsClient } from \"./runs/index.js\";\nimport { CronsClient } from \"./crons/index.js\";\nimport { StoreClient } from \"./store/index.js\";\nimport { UiClient } from \"./ui-internal/index.js\";\n\nexport class Client<\n TStateType = DefaultValues,\n TUpdateType = TStateType,\n TCustomEventType = unknown,\n> {\n /**\n * The client for interacting with assistants.\n */\n public assistants: AssistantsClient;\n\n /**\n * The client for interacting with threads.\n */\n public threads: ThreadsClient<TStateType, TUpdateType>;\n\n /**\n * The client for interacting with runs.\n */\n public runs: RunsClient<TStateType, TUpdateType, TCustomEventType>;\n\n /**\n * The client for interacting with cron runs.\n */\n public crons: CronsClient;\n\n /**\n * The client for interacting with the KV store.\n */\n public store: StoreClient;\n\n /**\n * The client for interacting with the UI.\n * @internal Used by LoadExternalComponent and the API might change in the future.\n */\n public \"~ui\": UiClient;\n\n /**\n * @internal Used to obtain a stable key representing the client.\n */\n private \"~configHash\": string | undefined;\n\n constructor(config?: ClientConfig) {\n this[\"~configHash\"] = (() =>\n JSON.stringify({\n apiUrl: config?.apiUrl,\n apiKey: config?.apiKey,\n timeoutMs: config?.timeoutMs,\n defaultHeaders: config?.defaultHeaders,\n streamProtocol: config?.streamProtocol,\n\n maxConcurrency: config?.callerOptions?.maxConcurrency,\n maxRetries: config?.callerOptions?.maxRetries,\n\n callbacks: {\n onFailedResponseHook:\n config?.callerOptions?.onFailedResponseHook != null,\n onRequest: config?.onRequest != null,\n fetch: config?.callerOptions?.fetch != null,\n },\n }))();\n\n this.assistants = new AssistantsClient(config);\n this.threads = new ThreadsClient(config);\n this.runs = new RunsClient(config);\n this.crons = new CronsClient(config);\n this.store = new StoreClient(config);\n this[\"~ui\"] = new UiClient(config);\n }\n}\n\n/**\n * @internal Used to obtain a stable key representing the client.\n */\nexport function getClientConfigHash(client: Client): string | undefined {\n return client[\"~configHash\"];\n}\n\nexport { BaseClient } from \"./base.js\";\nexport { getApiKey } from \"./base.js\";\nexport type { ClientConfig, RequestHook, HeaderValue } from \"./base.js\";\nexport { AssistantsClient } from \"./assistants/index.js\";\nexport { ThreadsClient } from \"./threads/index.js\";\nexport { RunsClient } from \"./runs/index.js\";\nexport { CronsClient } from \"./crons/index.js\";\nexport { StoreClient } from \"./store/index.js\";\n\nexport {\n ProtocolError,\n ThreadStream,\n SubscriptionHandle,\n StreamingMessage,\n StreamingMessageAssembler,\n MessageAssembler,\n MediaAssembler,\n MediaAssemblyError,\n ToolCallAssembler,\n SubgraphDiscoveryHandle,\n SubgraphHandle,\n SubagentHandle,\n SubagentDiscoveryHandle,\n inferChannel,\n matchesSubscription,\n} from \"./stream/index.js\";\n\nexport type {\n TransportAdapter,\n AgentServerAdapter,\n AssembledMessage,\n MessageAssemblyUpdate,\n AssembledToolCall,\n ToolCallStatus,\n Subscribable,\n InterruptPayload,\n SubscribeOptions,\n EventMethodByChannel,\n EventForChannel,\n EventForChannels,\n ThreadStreamOptions,\n ThreadStreamTransport,\n ThreadStreamTransportKind,\n SessionOrderingState,\n EventSubscription,\n MessageSubscription,\n InputModule,\n StateModule,\n ThreadModules,\n ThreadExtension,\n ThreadExtensions,\n UnwrapExtension,\n AnyMediaHandle,\n AudioMedia,\n FileMedia,\n ImageMedia,\n MediaAssemblerCallbacks,\n MediaAssemblerOptions,\n MediaAssemblyErrorKind,\n MediaBase,\n MediaBlockType,\n VideoMedia,\n} from \"./stream/index.js\";\n\nexport {\n ProtocolSseTransportAdapter,\n ProtocolWebSocketTransportAdapter,\n HttpAgentServerAdapter,\n} from \"./stream/transport/index.js\";\n\nexport type { HttpAgentServerAdapterOptions } from \"./stream/transport/index.js\";\nexport { resolveClientApiUrl } from \"./stream/resolve-client-api-url.js\";\n\nexport type {\n ProtocolRequestHook,\n ProtocolSseTransportOptions,\n ProtocolWebSocketTransportOptions,\n ProtocolTransportPaths,\n ProtocolHeaderValue,\n} from \"./stream/transport/index.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,IAAa,SAAb,MAIE;;;;CAIA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;;CAMA;;;;CAKA;CAEA,YAAY,QAAuB;AACjC,OAAK,iBACH,KAAK,UAAU;GACb,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;GAChB,WAAW,QAAQ;GACnB,gBAAgB,QAAQ;GACxB,gBAAgB,QAAQ;GAExB,gBAAgB,QAAQ,eAAe;GACvC,YAAY,QAAQ,eAAe;GAEnC,WAAW;IACT,sBACE,QAAQ,eAAe,wBAAwB;IACjD,WAAW,QAAQ,aAAa;IAChC,OAAO,QAAQ,eAAe,SAAS;IACxC;GACF,CAAC;AAEJ,OAAK,aAAa,IAAI,iBAAiB,OAAO;AAC9C,OAAK,UAAU,IAAI,cAAc,OAAO;AACxC,OAAK,OAAO,IAAI,WAAW,OAAO;AAClC,OAAK,QAAQ,IAAI,YAAY,OAAO;AACpC,OAAK,QAAQ,IAAI,YAAY,OAAO;AACpC,OAAK,SAAS,IAAI,SAAS,OAAO;;;;;;AAOtC,SAAgB,oBAAoB,QAAoC;AACtE,QAAO,OAAO"}
|
|
@@ -12,7 +12,28 @@ var ProtocolError = class extends Error {
|
|
|
12
12
|
this.response = response;
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Thrown when the v2 WebSocket transport exhausts its automatic reconnect
|
|
17
|
+
* budget (`maxReconnectAttempts`) after an unexpected socket close or error.
|
|
18
|
+
*
|
|
19
|
+
* The transport closes its event queue with this error so consumers of
|
|
20
|
+
* `events()` can treat the stream as terminally failed. Set
|
|
21
|
+
* `maxReconnectAttempts` to `0` on `client.threads.stream({ transport:
|
|
22
|
+
* "websocket" })` to disable reconnect and fail fast on the first drop
|
|
23
|
+
* instead.
|
|
24
|
+
*/
|
|
25
|
+
var MaxWebSocketReconnectAttemptsError = class extends Error {
|
|
26
|
+
/** The configured `maxReconnectAttempts` value that was exceeded. */
|
|
27
|
+
maxAttempts;
|
|
28
|
+
constructor(maxAttempts, cause) {
|
|
29
|
+
super(`Exceeded maximum WebSocket reconnection attempts (${maxAttempts})`);
|
|
30
|
+
this.name = "MaxWebSocketReconnectAttemptsError";
|
|
31
|
+
this.maxAttempts = maxAttempts;
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
15
35
|
//#endregion
|
|
36
|
+
exports.MaxWebSocketReconnectAttemptsError = MaxWebSocketReconnectAttemptsError;
|
|
16
37
|
exports.ProtocolError = ProtocolError;
|
|
17
38
|
|
|
18
39
|
//# sourceMappingURL=error.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.cjs","names":[],"sources":["../../../src/client/stream/error.ts"],"sourcesContent":["import type { ErrorResponse } from \"@langchain/protocol\";\n\n/**\n * Error wrapper for protocol-level error responses returned by the server.\n */\nexport class ProtocolError extends Error {\n readonly code: ErrorResponse[\"error\"];\n readonly response: ErrorResponse;\n\n constructor(response: ErrorResponse) {\n super(response.message);\n this.name = \"ProtocolError\";\n this.code = response.error;\n this.response = response;\n }\n}\n"],"mappings":";;;;AAKA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CAEA,YAAY,UAAyB;AACnC,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;AACZ,OAAK,OAAO,SAAS;AACrB,OAAK,WAAW"}
|
|
1
|
+
{"version":3,"file":"error.cjs","names":[],"sources":["../../../src/client/stream/error.ts"],"sourcesContent":["import type { ErrorResponse } from \"@langchain/protocol\";\n\n/**\n * Error wrapper for protocol-level error responses returned by the server.\n */\nexport class ProtocolError extends Error {\n readonly code: ErrorResponse[\"error\"];\n readonly response: ErrorResponse;\n\n constructor(response: ErrorResponse) {\n super(response.message);\n this.name = \"ProtocolError\";\n this.code = response.error;\n this.response = response;\n }\n}\n\n/**\n * Thrown when the v2 WebSocket transport exhausts its automatic reconnect\n * budget (`maxReconnectAttempts`) after an unexpected socket close or error.\n *\n * The transport closes its event queue with this error so consumers of\n * `events()` can treat the stream as terminally failed. Set\n * `maxReconnectAttempts` to `0` on `client.threads.stream({ transport:\n * \"websocket\" })` to disable reconnect and fail fast on the first drop\n * instead.\n */\nexport class MaxWebSocketReconnectAttemptsError extends Error {\n /** The configured `maxReconnectAttempts` value that was exceeded. */\n readonly maxAttempts: number;\n\n constructor(maxAttempts: number, cause: unknown) {\n super(`Exceeded maximum WebSocket reconnection attempts (${maxAttempts})`);\n this.name = \"MaxWebSocketReconnectAttemptsError\";\n this.maxAttempts = maxAttempts;\n this.cause = cause;\n }\n}\n"],"mappings":";;;;AAKA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CAEA,YAAY,UAAyB;AACnC,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;AACZ,OAAK,OAAO,SAAS;AACrB,OAAK,WAAW;;;;;;;;;;;;;AAcpB,IAAa,qCAAb,cAAwD,MAAM;;CAE5D;CAEA,YAAY,aAAqB,OAAgB;AAC/C,QAAM,qDAAqD,YAAY,GAAG;AAC1E,OAAK,OAAO;AACZ,OAAK,cAAc;AACnB,OAAK,QAAQ"}
|
|
@@ -12,7 +12,27 @@ var ProtocolError = class extends Error {
|
|
|
12
12
|
this.response = response;
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Thrown when the v2 WebSocket transport exhausts its automatic reconnect
|
|
17
|
+
* budget (`maxReconnectAttempts`) after an unexpected socket close or error.
|
|
18
|
+
*
|
|
19
|
+
* The transport closes its event queue with this error so consumers of
|
|
20
|
+
* `events()` can treat the stream as terminally failed. Set
|
|
21
|
+
* `maxReconnectAttempts` to `0` on `client.threads.stream({ transport:
|
|
22
|
+
* "websocket" })` to disable reconnect and fail fast on the first drop
|
|
23
|
+
* instead.
|
|
24
|
+
*/
|
|
25
|
+
var MaxWebSocketReconnectAttemptsError = class extends Error {
|
|
26
|
+
/** The configured `maxReconnectAttempts` value that was exceeded. */
|
|
27
|
+
maxAttempts;
|
|
28
|
+
constructor(maxAttempts, cause) {
|
|
29
|
+
super(`Exceeded maximum WebSocket reconnection attempts (${maxAttempts})`);
|
|
30
|
+
this.name = "MaxWebSocketReconnectAttemptsError";
|
|
31
|
+
this.maxAttempts = maxAttempts;
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
15
35
|
//#endregion
|
|
16
|
-
export { ProtocolError };
|
|
36
|
+
export { MaxWebSocketReconnectAttemptsError, ProtocolError };
|
|
17
37
|
|
|
18
38
|
//# sourceMappingURL=error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":[],"sources":["../../../src/client/stream/error.ts"],"sourcesContent":["import type { ErrorResponse } from \"@langchain/protocol\";\n\n/**\n * Error wrapper for protocol-level error responses returned by the server.\n */\nexport class ProtocolError extends Error {\n readonly code: ErrorResponse[\"error\"];\n readonly response: ErrorResponse;\n\n constructor(response: ErrorResponse) {\n super(response.message);\n this.name = \"ProtocolError\";\n this.code = response.error;\n this.response = response;\n }\n}\n"],"mappings":";;;;AAKA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CAEA,YAAY,UAAyB;AACnC,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;AACZ,OAAK,OAAO,SAAS;AACrB,OAAK,WAAW"}
|
|
1
|
+
{"version":3,"file":"error.js","names":[],"sources":["../../../src/client/stream/error.ts"],"sourcesContent":["import type { ErrorResponse } from \"@langchain/protocol\";\n\n/**\n * Error wrapper for protocol-level error responses returned by the server.\n */\nexport class ProtocolError extends Error {\n readonly code: ErrorResponse[\"error\"];\n readonly response: ErrorResponse;\n\n constructor(response: ErrorResponse) {\n super(response.message);\n this.name = \"ProtocolError\";\n this.code = response.error;\n this.response = response;\n }\n}\n\n/**\n * Thrown when the v2 WebSocket transport exhausts its automatic reconnect\n * budget (`maxReconnectAttempts`) after an unexpected socket close or error.\n *\n * The transport closes its event queue with this error so consumers of\n * `events()` can treat the stream as terminally failed. Set\n * `maxReconnectAttempts` to `0` on `client.threads.stream({ transport:\n * \"websocket\" })` to disable reconnect and fail fast on the first drop\n * instead.\n */\nexport class MaxWebSocketReconnectAttemptsError extends Error {\n /** The configured `maxReconnectAttempts` value that was exceeded. */\n readonly maxAttempts: number;\n\n constructor(maxAttempts: number, cause: unknown) {\n super(`Exceeded maximum WebSocket reconnection attempts (${maxAttempts})`);\n this.name = \"MaxWebSocketReconnectAttemptsError\";\n this.maxAttempts = maxAttempts;\n this.cause = cause;\n }\n}\n"],"mappings":";;;;AAKA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CAEA,YAAY,UAAyB;AACnC,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;AACZ,OAAK,OAAO,SAAS;AACrB,OAAK,WAAW;;;;;;;;;;;;;AAcpB,IAAa,qCAAb,cAAwD,MAAM;;CAE5D;CAEA,YAAY,aAAqB,OAAgB;AAC/C,QAAM,qDAAqD,YAAY,GAAG;AAC1E,OAAK,OAAO;AACZ,OAAK,cAAc;AACnB,OAAK,QAAQ"}
|
|
@@ -436,7 +436,10 @@ var ThreadStream = class {
|
|
|
436
436
|
listCheckpoints: async (params) => await this.#send("state.listCheckpoints", params),
|
|
437
437
|
fork: async (params) => await this.#send("state.fork", params)
|
|
438
438
|
};
|
|
439
|
-
if (this.#transportAdapter.openEventStream == null)
|
|
439
|
+
if (this.#transportAdapter.openEventStream == null) {
|
|
440
|
+
this.#transportAdapter.setOnReconnected?.(() => this.#resubscribeWebSocketSubscriptions());
|
|
441
|
+
this.#consumeEvents();
|
|
442
|
+
}
|
|
440
443
|
}
|
|
441
444
|
/**
|
|
442
445
|
* Ensure the underlying transport is connected.
|
|
@@ -1375,6 +1378,26 @@ var ThreadStream = class {
|
|
|
1375
1378
|
this.#subscriptions.set(resolvedId, subscription);
|
|
1376
1379
|
return handle;
|
|
1377
1380
|
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Re-issue `subscription.subscribe` for every active WS subscription
|
|
1383
|
+
* after the transport reconnects. The server replays buffered events on
|
|
1384
|
+
* the new socket; client-side `event_id` dedup suppresses duplicates.
|
|
1385
|
+
*/
|
|
1386
|
+
async #resubscribeWebSocketSubscriptions() {
|
|
1387
|
+
if (this.#transportAdapter.openEventStream != null || this.#closed) return;
|
|
1388
|
+
const entries = [...this.#subscriptions.entries()];
|
|
1389
|
+
await Promise.all(entries.map(async ([id, subscription]) => {
|
|
1390
|
+
if (id.startsWith("pending:")) return;
|
|
1391
|
+
try {
|
|
1392
|
+
const nextId = (await this.#send("subscription.subscribe", subscription.filter)).subscription_id;
|
|
1393
|
+
if (nextId === id) return;
|
|
1394
|
+
this.#subscriptions.delete(id);
|
|
1395
|
+
subscription.subscriptionId = nextId;
|
|
1396
|
+
this.#subscriptions.set(nextId, subscription);
|
|
1397
|
+
if (this.#lifecycleSubId === id) this.#lifecycleSubId = nextId;
|
|
1398
|
+
} catch {}
|
|
1399
|
+
}));
|
|
1400
|
+
}
|
|
1378
1401
|
async #consumeEvents() {
|
|
1379
1402
|
try {
|
|
1380
1403
|
for await (const message of this.#transportAdapter.events()) this.#handleIncoming(message);
|