langchain 1.3.1 → 1.3.3
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/CHANGELOG.md +17 -0
- package/dist/agents/ReactAgent.cjs +5 -11
- package/dist/agents/ReactAgent.cjs.map +1 -1
- package/dist/agents/ReactAgent.d.cts.map +1 -1
- package/dist/agents/ReactAgent.d.ts.map +1 -1
- package/dist/agents/ReactAgent.js +5 -11
- package/dist/agents/ReactAgent.js.map +1 -1
- package/dist/agents/nodes/AfterAgentNode.cjs +2 -2
- package/dist/agents/nodes/AfterAgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AfterAgentNode.js +2 -2
- package/dist/agents/nodes/AfterAgentNode.js.map +1 -1
- package/dist/agents/nodes/AfterModelNode.cjs +2 -2
- package/dist/agents/nodes/AfterModelNode.cjs.map +1 -1
- package/dist/agents/nodes/AfterModelNode.js +2 -2
- package/dist/agents/nodes/AfterModelNode.js.map +1 -1
- package/dist/agents/nodes/AgentNode.cjs +2 -3
- package/dist/agents/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AgentNode.js +2 -3
- package/dist/agents/nodes/AgentNode.js.map +1 -1
- package/dist/agents/nodes/BeforeAgentNode.cjs +2 -2
- package/dist/agents/nodes/BeforeAgentNode.cjs.map +1 -1
- package/dist/agents/nodes/BeforeAgentNode.js +2 -2
- package/dist/agents/nodes/BeforeAgentNode.js.map +1 -1
- package/dist/agents/nodes/BeforeModelNode.cjs +2 -2
- package/dist/agents/nodes/BeforeModelNode.cjs.map +1 -1
- package/dist/agents/nodes/BeforeModelNode.js +2 -2
- package/dist/agents/nodes/BeforeModelNode.js.map +1 -1
- package/dist/agents/nodes/middleware.cjs +1 -4
- package/dist/agents/nodes/middleware.cjs.map +1 -1
- package/dist/agents/nodes/middleware.js +1 -4
- package/dist/agents/nodes/middleware.js.map +1 -1
- package/dist/storage/file_system.cjs +72 -8
- package/dist/storage/file_system.cjs.map +1 -1
- package/dist/storage/file_system.d.cts +4 -0
- package/dist/storage/file_system.d.cts.map +1 -1
- package/dist/storage/file_system.d.ts +4 -0
- package/dist/storage/file_system.d.ts.map +1 -1
- package/dist/storage/file_system.js +72 -8
- package/dist/storage/file_system.js.map +1 -1
- package/package.json +5 -5
- package/dist/agents/state.cjs +0 -43
- package/dist/agents/state.cjs.map +0 -1
- package/dist/agents/state.js +0 -43
- package/dist/agents/state.js.map +0 -1
package/dist/agents/state.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
//#region src/agents/state.ts
|
|
2
|
-
/**
|
|
3
|
-
* The StateManager is responsible for managing the state of the agent.
|
|
4
|
-
* The `createAgent` maintains different nodes with their own state. For the user
|
|
5
|
-
* however, they only see the combined state of all nodes. This class is helps
|
|
6
|
-
* to share the state between different nodes.
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
var StateManager = class {
|
|
11
|
-
#nodes = /* @__PURE__ */ new Map();
|
|
12
|
-
/**
|
|
13
|
-
* Add node to middleware group.
|
|
14
|
-
* @param name - The name of the middleware group.
|
|
15
|
-
* @param node - The node to add.
|
|
16
|
-
*/
|
|
17
|
-
addNode(middleware, node) {
|
|
18
|
-
this.#nodes.set(middleware.name, [...this.#nodes.get(middleware.name) ?? [], node]);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get the state of a middleware group.
|
|
22
|
-
* @param name - The name of the middleware group.
|
|
23
|
-
* @returns The state of the middleware group.
|
|
24
|
-
*/
|
|
25
|
-
getState(name) {
|
|
26
|
-
const state = (this.#nodes.get(name) ?? []).reduce((prev, node) => {
|
|
27
|
-
return {
|
|
28
|
-
...prev,
|
|
29
|
-
...node.getState() ?? {}
|
|
30
|
-
};
|
|
31
|
-
}, {});
|
|
32
|
-
/**
|
|
33
|
-
* we internally reset the jumpTo property and shouldn't propagate this value
|
|
34
|
-
* to the middleware hooks.
|
|
35
|
-
*/
|
|
36
|
-
delete state.jumpTo;
|
|
37
|
-
return state;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
//#endregion
|
|
41
|
-
export { StateManager };
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=state.js.map
|
package/dist/agents/state.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","names":["#nodes"],"sources":["../../src/agents/state.ts"],"sourcesContent":["import type { InteropZodObject } from \"@langchain/core/utils/types\";\nimport type { RunnableCallable } from \"./RunnableCallable.js\";\nimport type { AgentMiddleware } from \"./middleware/types.js\";\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\ntype AgentNode = RunnableCallable<any, any>;\n\n/**\n * The StateManager is responsible for managing the state of the agent.\n * The `createAgent` maintains different nodes with their own state. For the user\n * however, they only see the combined state of all nodes. This class is helps\n * to share the state between different nodes.\n *\n * @internal\n */\nexport class StateManager {\n #nodes = new Map<string, AgentNode[]>();\n\n /**\n * Add node to middleware group.\n * @param name - The name of the middleware group.\n * @param node - The node to add.\n */\n addNode(\n middleware: AgentMiddleware<InteropZodObject | undefined>,\n node: AgentNode\n ) {\n this.#nodes.set(middleware.name, [\n ...(this.#nodes.get(middleware.name) ?? []),\n node,\n ]);\n }\n\n /**\n * Get the state of a middleware group.\n * @param name - The name of the middleware group.\n * @returns The state of the middleware group.\n */\n getState(name: string) {\n const middlewareNodes = this.#nodes.get(name) ?? [];\n const state = middlewareNodes.reduce(\n (prev, node) => {\n return {\n ...prev,\n ...((node.getState() as Record<string, unknown>) ?? {}),\n };\n },\n {} as Record<string, unknown>\n );\n\n /**\n * we internally reset the jumpTo property and shouldn't propagate this value\n * to the middleware hooks.\n */\n delete state.jumpTo;\n\n return state;\n }\n}\n"],"mappings":";;;;;;;;;AAeA,IAAa,eAAb,MAA0B;CACxB,yBAAS,IAAI,KAA0B;;;;;;CAOvC,QACE,YACA,MACA;AACA,QAAA,MAAY,IAAI,WAAW,MAAM,CAC/B,GAAI,MAAA,MAAY,IAAI,WAAW,KAAK,IAAI,EAAE,EAC1C,KACD,CAAC;;;;;;;CAQJ,SAAS,MAAc;EAErB,MAAM,SADkB,MAAA,MAAY,IAAI,KAAK,IAAI,EAAE,EACrB,QAC3B,MAAM,SAAS;AACd,UAAO;IACL,GAAG;IACH,GAAK,KAAK,UAAU,IAAgC,EAAE;IACvD;KAEH,EAAE,CACH;;;;;AAMD,SAAO,MAAM;AAEb,SAAO"}
|