@langchain/langgraph-cli 0.0.4 → 0.0.6
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/graph/load.mjs +1 -0
- package/dist/storage/ops.mjs +10 -7
- package/package.json +1 -1
package/dist/graph/load.mjs
CHANGED
package/dist/storage/ops.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTTPException } from "hono/http-exception";
|
|
2
|
-
import { v4 as uuid4 } from "uuid";
|
|
3
|
-
import { getGraph } from "../graph/load.mjs";
|
|
2
|
+
import { v4 as uuid4, v5 as uuid5 } from "uuid";
|
|
3
|
+
import { getGraph, NAMESPACE_GRAPH } from "../graph/load.mjs";
|
|
4
4
|
import { checkpointer } from "./checkpoint.mjs";
|
|
5
5
|
import { store } from "./store.mjs";
|
|
6
6
|
import { logger } from "../logging.mjs";
|
|
@@ -99,8 +99,8 @@ export const truncate = (flags) => {
|
|
|
99
99
|
if (flags.threads)
|
|
100
100
|
STORE.threads = {};
|
|
101
101
|
if (flags.assistants) {
|
|
102
|
-
STORE.assistants = Object.fromEntries(Object.entries(STORE.assistants).filter(([
|
|
103
|
-
assistant.
|
|
102
|
+
STORE.assistants = Object.fromEntries(Object.entries(STORE.assistants).filter(([key, assistant]) => assistant.metadata?.created_by === "system" &&
|
|
103
|
+
uuid5(assistant.graph_id, NAMESPACE_GRAPH) === key));
|
|
104
104
|
}
|
|
105
105
|
if (flags.checkpointer)
|
|
106
106
|
checkpointer.clear();
|
|
@@ -148,7 +148,7 @@ export class Assistants {
|
|
|
148
148
|
return bCreatedAt - aCreatedAt;
|
|
149
149
|
});
|
|
150
150
|
for (const assistant of filtered.slice(options.offset, options.offset + options.limit)) {
|
|
151
|
-
yield assistant;
|
|
151
|
+
yield { ...assistant, name: assistant.name ?? assistant.graph_id };
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
}
|
|
@@ -157,7 +157,7 @@ export class Assistants {
|
|
|
157
157
|
const result = STORE.assistants[assistantId];
|
|
158
158
|
if (result == null)
|
|
159
159
|
throw new HTTPException(404, { message: "Assistant not found" });
|
|
160
|
-
return result;
|
|
160
|
+
return { ...result, name: result.name ?? result.graph_id };
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
static async put(assistantId, options) {
|
|
@@ -177,7 +177,7 @@ export class Assistants {
|
|
|
177
177
|
updated_at: now,
|
|
178
178
|
graph_id: options.graph_id,
|
|
179
179
|
metadata: options.metadata ?? {},
|
|
180
|
-
name: options.name,
|
|
180
|
+
name: options.name || options.graph_id,
|
|
181
181
|
};
|
|
182
182
|
STORE.assistant_versions.push({
|
|
183
183
|
assistant_id: assistantId,
|
|
@@ -186,6 +186,7 @@ export class Assistants {
|
|
|
186
186
|
config: options.config ?? {},
|
|
187
187
|
metadata: options.metadata ?? {},
|
|
188
188
|
created_at: now,
|
|
189
|
+
name: options.name || options.graph_id,
|
|
189
190
|
});
|
|
190
191
|
return STORE.assistants[assistantId];
|
|
191
192
|
});
|
|
@@ -224,6 +225,7 @@ export class Assistants {
|
|
|
224
225
|
version: newVersion,
|
|
225
226
|
graph_id: options?.graph_id ?? assistant["graph_id"],
|
|
226
227
|
config: options?.config ?? assistant["config"],
|
|
228
|
+
name: options?.name ?? assistant["name"],
|
|
227
229
|
metadata: metadata ?? assistant["metadata"],
|
|
228
230
|
created_at: now,
|
|
229
231
|
};
|
|
@@ -263,6 +265,7 @@ export class Assistants {
|
|
|
263
265
|
config: assistantVersion["config"],
|
|
264
266
|
metadata: assistantVersion["metadata"],
|
|
265
267
|
version: assistantVersion["version"],
|
|
268
|
+
name: assistantVersion["name"],
|
|
266
269
|
updated_at: now,
|
|
267
270
|
};
|
|
268
271
|
return STORE.assistants[assistantId];
|