@langchain/langgraph-sdk 1.9.6 → 1.9.7

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.
@@ -1,4 +1,4 @@
1
- import { ToolCallAssembler } from "../../client/stream/handles/tools.js";
1
+ import { ToolCallAssembler, shouldIgnoreScopedTaskToolEvent } from "../../client/stream/handles/tools.js";
2
2
  import { isRootNamespace, namespaceKey } from "../namespace.js";
3
3
  import { upsertToolCall } from "../tool-calls.js";
4
4
  import { openProjectionSubscription } from "./runtime.js";
@@ -12,8 +12,7 @@ function toolCallsProjection(namespace) {
12
12
  open({ thread, store, rootBus }) {
13
13
  const assembler = new ToolCallAssembler();
14
14
  const applyToolsEvent = (event) => {
15
- const data = event.params.data;
16
- if (ns.length > 0 && event.params.namespace.length === ns.length && data.tool_name === "task") return;
15
+ if (shouldIgnoreScopedTaskToolEvent(ns, event)) return;
17
16
  const tc = assembler.consume(event);
18
17
  if (tc == null) return;
19
18
  const next = upsertToolCall(store.getSnapshot(), tc);
@@ -1 +1 @@
1
- {"version":3,"file":"tool-calls.js","names":[],"sources":["../../../src/stream/projections/tool-calls.ts"],"sourcesContent":["/**\n * Namespace-scoped `tools` projection.\n *\n * Opens `thread.subscribe({ channels: [\"tools\"], namespaces: [ns] })`,\n * feeds events through {@link ToolCallAssembler}, and surfaces an\n * array of {@link AssembledToolCall}s that grows as calls are\n * discovered. Each handle exposes reactive {@link AssembledToolCall.status},\n * {@link AssembledToolCall.error}, and {@link AssembledToolCall.output}\n * (`null` until the call succeeds).\n */\nimport type { ToolsEvent } from \"@langchain/protocol\";\nimport { ToolCallAssembler } from \"../../client/stream/handles/tools.js\";\nimport type { AssembledToolCall } from \"../../client/stream/handles/tools.js\";\nimport type { ProjectionSpec, ProjectionRuntime } from \"../types.js\";\nimport { isRootNamespace, namespaceKey } from \"../namespace.js\";\nimport { upsertToolCall } from \"../tool-calls.js\";\nimport { openProjectionSubscription } from \"./runtime.js\";\n\nexport function toolCallsProjection(\n namespace: readonly string[]\n): ProjectionSpec<AssembledToolCall[]> {\n const ns = [...namespace];\n const key = `toolCalls|${namespaceKey(ns)}`;\n\n return {\n key,\n namespace: ns,\n initial: [],\n open({ thread, store, rootBus }): ProjectionRuntime {\n const assembler = new ToolCallAssembler();\n\n const applyToolsEvent = (event: ToolsEvent): void => {\n const data = event.params.data;\n if (\n ns.length > 0 &&\n event.params.namespace.length === ns.length &&\n data.tool_name === \"task\"\n ) {\n return;\n }\n const tc = assembler.consume(event);\n if (tc == null) return;\n const next = upsertToolCall(store.getSnapshot(), tc);\n store.setValue(next);\n };\n\n // See `messagesProjection` — root-scoped projections short-\n // circuit onto the root bus when the requested channels are\n // covered by the controller's root pump.\n const rootShortCircuit =\n isRootNamespace(ns) && rootBus.channels.includes(\"tools\");\n\n if (rootShortCircuit) {\n const unsubscribe = rootBus.subscribe((event) => {\n if (event.method !== \"tools\") return;\n if (!isRootNamespace(event.params.namespace)) return;\n applyToolsEvent(event as ToolsEvent);\n });\n return {\n dispose() {\n unsubscribe();\n },\n };\n }\n\n const runtime = openProjectionSubscription({\n thread,\n channels: [\"tools\"],\n namespace: ns,\n onEvent(event) {\n if (event.method !== \"tools\") return;\n applyToolsEvent(event as ToolsEvent);\n },\n });\n\n return {\n async dispose() {\n await runtime.dispose();\n },\n };\n },\n };\n}\n"],"mappings":";;;;;AAkBA,SAAgB,oBACd,WACqC;CACrC,MAAM,KAAK,CAAC,GAAG,UAAU;AAGzB,QAAO;EACL,KAHU,aAAa,aAAa,GAAG;EAIvC,WAAW;EACX,SAAS,EAAE;EACX,KAAK,EAAE,QAAQ,OAAO,WAA8B;GAClD,MAAM,YAAY,IAAI,mBAAmB;GAEzC,MAAM,mBAAmB,UAA4B;IACnD,MAAM,OAAO,MAAM,OAAO;AAC1B,QACE,GAAG,SAAS,KACZ,MAAM,OAAO,UAAU,WAAW,GAAG,UACrC,KAAK,cAAc,OAEnB;IAEF,MAAM,KAAK,UAAU,QAAQ,MAAM;AACnC,QAAI,MAAM,KAAM;IAChB,MAAM,OAAO,eAAe,MAAM,aAAa,EAAE,GAAG;AACpD,UAAM,SAAS,KAAK;;AAStB,OAFE,gBAAgB,GAAG,IAAI,QAAQ,SAAS,SAAS,QAAQ,EAErC;IACpB,MAAM,cAAc,QAAQ,WAAW,UAAU;AAC/C,SAAI,MAAM,WAAW,QAAS;AAC9B,SAAI,CAAC,gBAAgB,MAAM,OAAO,UAAU,CAAE;AAC9C,qBAAgB,MAAoB;MACpC;AACF,WAAO,EACL,UAAU;AACR,kBAAa;OAEhB;;GAGH,MAAM,UAAU,2BAA2B;IACzC;IACA,UAAU,CAAC,QAAQ;IACnB,WAAW;IACX,QAAQ,OAAO;AACb,SAAI,MAAM,WAAW,QAAS;AAC9B,qBAAgB,MAAoB;;IAEvC,CAAC;AAEF,UAAO,EACL,MAAM,UAAU;AACd,UAAM,QAAQ,SAAS;MAE1B;;EAEJ"}
1
+ {"version":3,"file":"tool-calls.js","names":[],"sources":["../../../src/stream/projections/tool-calls.ts"],"sourcesContent":["/**\n * Namespace-scoped `tools` projection.\n *\n * Opens `thread.subscribe({ channels: [\"tools\"], namespaces: [ns] })`,\n * feeds events through {@link ToolCallAssembler}, and surfaces an\n * array of {@link AssembledToolCall}s that grows as calls are\n * discovered. Each handle exposes reactive {@link AssembledToolCall.status},\n * {@link AssembledToolCall.error}, and {@link AssembledToolCall.output}\n * (`null` until the call succeeds).\n */\nimport type { ToolsEvent } from \"@langchain/protocol\";\nimport {\n shouldIgnoreScopedTaskToolEvent,\n ToolCallAssembler,\n} from \"../../client/stream/handles/tools.js\";\nimport type { AssembledToolCall } from \"../../client/stream/handles/tools.js\";\nimport type { ProjectionSpec, ProjectionRuntime } from \"../types.js\";\nimport { isRootNamespace, namespaceKey } from \"../namespace.js\";\nimport { upsertToolCall } from \"../tool-calls.js\";\nimport { openProjectionSubscription } from \"./runtime.js\";\n\nexport function toolCallsProjection(\n namespace: readonly string[]\n): ProjectionSpec<AssembledToolCall[]> {\n const ns = [...namespace];\n const key = `toolCalls|${namespaceKey(ns)}`;\n\n return {\n key,\n namespace: ns,\n initial: [],\n open({ thread, store, rootBus }): ProjectionRuntime {\n const assembler = new ToolCallAssembler();\n\n const applyToolsEvent = (event: ToolsEvent): void => {\n if (shouldIgnoreScopedTaskToolEvent(ns, event)) return;\n const tc = assembler.consume(event);\n if (tc == null) return;\n const next = upsertToolCall(store.getSnapshot(), tc);\n store.setValue(next);\n };\n\n // See `messagesProjection` — root-scoped projections short-\n // circuit onto the root bus when the requested channels are\n // covered by the controller's root pump.\n const rootShortCircuit =\n isRootNamespace(ns) && rootBus.channels.includes(\"tools\");\n\n if (rootShortCircuit) {\n const unsubscribe = rootBus.subscribe((event) => {\n if (event.method !== \"tools\") return;\n if (!isRootNamespace(event.params.namespace)) return;\n applyToolsEvent(event as ToolsEvent);\n });\n return {\n dispose() {\n unsubscribe();\n },\n };\n }\n\n const runtime = openProjectionSubscription({\n thread,\n channels: [\"tools\"],\n namespace: ns,\n onEvent(event) {\n if (event.method !== \"tools\") return;\n applyToolsEvent(event as ToolsEvent);\n },\n });\n\n return {\n async dispose() {\n await runtime.dispose();\n },\n };\n },\n };\n}\n"],"mappings":";;;;;AAqBA,SAAgB,oBACd,WACqC;CACrC,MAAM,KAAK,CAAC,GAAG,UAAU;AAGzB,QAAO;EACL,KAHU,aAAa,aAAa,GAAG;EAIvC,WAAW;EACX,SAAS,EAAE;EACX,KAAK,EAAE,QAAQ,OAAO,WAA8B;GAClD,MAAM,YAAY,IAAI,mBAAmB;GAEzC,MAAM,mBAAmB,UAA4B;AACnD,QAAI,gCAAgC,IAAI,MAAM,CAAE;IAChD,MAAM,KAAK,UAAU,QAAQ,MAAM;AACnC,QAAI,MAAM,KAAM;IAChB,MAAM,OAAO,eAAe,MAAM,aAAa,EAAE,GAAG;AACpD,UAAM,SAAS,KAAK;;AAStB,OAFE,gBAAgB,GAAG,IAAI,QAAQ,SAAS,SAAS,QAAQ,EAErC;IACpB,MAAM,cAAc,QAAQ,WAAW,UAAU;AAC/C,SAAI,MAAM,WAAW,QAAS;AAC9B,SAAI,CAAC,gBAAgB,MAAM,OAAO,UAAU,CAAE;AAC9C,qBAAgB,MAAoB;MACpC;AACF,WAAO,EACL,UAAU;AACR,kBAAa;OAEhB;;GAGH,MAAM,UAAU,2BAA2B;IACzC;IACA,UAAU,CAAC,QAAQ;IACnB,WAAW;IACX,QAAQ,OAAO;AACb,SAAI,MAAM,WAAW,QAAS;AAC9B,qBAAgB,MAAoB;;IAEvC,CAAC;AAEF,UAAO,EACL,MAAM,UAAU;AACd,UAAM,QAAQ,SAAS;MAE1B;;EAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "repository": {