aegra-hono 0.14.2 → 0.15.0

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.d.ts CHANGED
@@ -1,22 +1,7 @@
1
1
  import type { RunnableConfig } from "@langchain/core/runnables";
2
- import type { BaseCheckpointSaver, BaseStore } from "@langchain/langgraph-checkpoint";
2
+ import type { CompiledStateGraph } from "@langchain/langgraph";
3
+ import type { BaseStore } from "@langchain/langgraph-checkpoint";
3
4
  import type { AuthUser } from "./types.js";
4
- export type RunnableGraph = {
5
- invoke(input: unknown, options?: Record<string, unknown>): Promise<unknown>;
6
- stream(input: unknown, options?: Record<string, unknown>): Promise<AsyncIterable<unknown>>;
7
- getState?(config: RunnableConfig, options?: Record<string, unknown>): Promise<unknown>;
8
- getStateHistory?(config: RunnableConfig, options?: Record<string, unknown>): AsyncIterable<unknown>;
9
- updateState?(config: RunnableConfig, values: unknown, asNode?: string): Promise<RunnableConfig>;
10
- getGraphAsync?(config?: RunnableConfig & {
11
- xray?: boolean | number;
12
- }): Promise<{
13
- toJSON(): Record<string, unknown>;
14
- }>;
15
- getSubgraphsAsync?(namespace?: string, recurse?: boolean): AsyncGenerator<[string, RunnableGraph]>;
16
- builder?: unknown;
17
- checkpointer?: BaseCheckpointSaver | boolean;
18
- store?: BaseStore;
19
- };
20
5
  export interface ServerRuntime<Context = Record<string, unknown>> {
21
6
  accessContext: "threads.create_run" | "threads.update" | "threads.read" | "assistants.read";
22
7
  user: AuthUser;
@@ -27,11 +12,5 @@ export interface GraphInput<Context = Record<string, unknown>> {
27
12
  config: RunnableConfig | undefined;
28
13
  runtime: ServerRuntime<Context>;
29
14
  }
30
- export type GraphFactory<Context = Record<string, unknown>> = (input: GraphInput<Context>) => RunnableGraph | Promise<RunnableGraph>;
31
- /** @deprecated Export a GraphFactory function directly. */
32
- export interface GraphProvider<Context = Record<string, unknown>> {
33
- resolve(input: GraphInput<Context>): RunnableGraph | Promise<RunnableGraph>;
34
- }
35
- export type GraphDefinition = RunnableGraph | GraphFactory<any> | GraphProvider<any>;
36
- /** @deprecated Export the compiled graph or factory directly. */
37
- export declare function defineGraph<T extends GraphDefinition>(graph: T): T;
15
+ export type GraphFactory<Context = Record<string, unknown>, Graph extends CompiledStateGraph<any, any, any, any, any, any, any, any, any, any> = CompiledStateGraph<any, any, any, any, any, any, any, any, any, any>> = (input: GraphInput<Context>) => Graph | Promise<Graph>;
16
+ export type GraphDefinition = CompiledStateGraph<any, any, any, any, any, any, any, any, any, any> | GraphFactory<any>;
package/dist/graph.js CHANGED
@@ -1,26 +1,3 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
2
 
18
- // src/graph.ts
19
- function defineGraph(graph) {
20
- return graph;
21
- }
22
- export {
23
- defineGraph
24
- };
25
-
26
- //# debugId=3C2AFB1C029A7EE964756E2164756E21
3
+ //# debugId=98A76D911778A36E64756E2164756E21
package/dist/graph.js.map CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/graph.ts"],
3
+ "sources": [],
4
4
  "sourcesContent": [
5
- "import type { RunnableConfig } from \"@langchain/core/runnables\";\nimport type { BaseCheckpointSaver, BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport type { AuthUser } from \"./types.ts\";\n\nexport type RunnableGraph = {\n invoke(input: unknown, options?: Record<string, unknown>): Promise<unknown>;\n stream(input: unknown, options?: Record<string, unknown>): Promise<AsyncIterable<unknown>>;\n getState?(config: RunnableConfig, options?: Record<string, unknown>): Promise<unknown>;\n getStateHistory?(config: RunnableConfig, options?: Record<string, unknown>): AsyncIterable<unknown>;\n updateState?(config: RunnableConfig, values: unknown, asNode?: string): Promise<RunnableConfig>;\n getGraphAsync?(config?: RunnableConfig & { xray?: boolean | number }): Promise<{ toJSON(): Record<string, unknown> }>;\n getSubgraphsAsync?(namespace?: string, recurse?: boolean): AsyncGenerator<[string, RunnableGraph]>;\n builder?: unknown;\n checkpointer?: BaseCheckpointSaver | boolean;\n store?: BaseStore;\n};\n\nexport interface ServerRuntime<Context = Record<string, unknown>> {\n accessContext: \"threads.create_run\" | \"threads.update\" | \"threads.read\" | \"assistants.read\";\n user: AuthUser;\n store?: BaseStore;\n context?: Context | null;\n}\n\nexport interface GraphInput<Context = Record<string, unknown>> {\n config: RunnableConfig | undefined;\n runtime: ServerRuntime<Context>;\n}\n\nexport type GraphFactory<Context = Record<string, unknown>> = (input: GraphInput<Context>) => RunnableGraph | Promise<RunnableGraph>;\n\n/** @deprecated Export a GraphFactory function directly. */\nexport interface GraphProvider<Context = Record<string, unknown>> {\n resolve(input: GraphInput<Context>): RunnableGraph | Promise<RunnableGraph>;\n}\n\nexport type GraphDefinition = RunnableGraph | GraphFactory<any> | GraphProvider<any>;\n\n/** @deprecated Export the compiled graph or factory directly. */\nexport function defineGraph<T extends GraphDefinition>(graph: T): T {\n return graph;\n}\n"
6
5
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;AAuCO,SAAS,WAAsC,CAAC,OAAa;AAAA,EAClE,OAAO;AAAA;",
8
- "debugId": "3C2AFB1C029A7EE964756E2164756E21",
6
+ "mappings": "",
7
+ "debugId": "98A76D911778A36E64756E2164756E21",
9
8
  "names": []
10
9
  }
package/dist/index.js CHANGED
@@ -1253,20 +1253,15 @@ function deterministicAssistantId(graphId) {
1253
1253
  function assistantIdForGraph(graphId) {
1254
1254
  return graphs.has(graphId) ? deterministicAssistantId(graphId) : graphId;
1255
1255
  }
1256
- function isRunnableGraph(value) {
1256
+ function isCompiledStateGraph(value) {
1257
1257
  if (!value || typeof value !== "object")
1258
1258
  return false;
1259
1259
  const candidate = value;
1260
- return typeof candidate.invoke === "function" && typeof candidate.stream === "function";
1261
- }
1262
- function isGraphProvider(value) {
1263
- if (!value || typeof value !== "object" || isRunnableGraph(value))
1264
- return false;
1265
- return typeof value.resolve === "function";
1260
+ return ["invoke", "stream", "getState", "getStateHistory", "updateState", "getGraphAsync", "getSubgraphsAsync"].every((method) => typeof candidate[method] === "function");
1266
1261
  }
1267
1262
  function assertGraphDefinition(value, exportName, modulePath) {
1268
- if (!isRunnableGraph(value) && typeof value !== "function" && !isGraphProvider(value)) {
1269
- throw new Error(`Graph export '${exportName}' in ${modulePath} must be a runnable graph, factory function, or legacy GraphProvider`);
1263
+ if (!isCompiledStateGraph(value) && typeof value !== "function") {
1264
+ throw new Error(`Graph export '${exportName}' in ${modulePath} must be a CompiledStateGraph or graph factory`);
1270
1265
  }
1271
1266
  }
1272
1267
  async function initializeGraphs() {
@@ -1329,9 +1324,9 @@ async function getGraph(graphId, options) {
1329
1324
  ...options.context !== undefined ? { context: options.context } : {}
1330
1325
  };
1331
1326
  const input = { config: options.config, runtime };
1332
- const resolved = typeof configured === "function" ? await configured(input) : isGraphProvider(configured) ? await configured.resolve(input) : configured;
1333
- if (!isRunnableGraph(resolved))
1334
- throw new Error(`Graph factory/provider '${graphId}' did not return a runnable graph`);
1327
+ const resolved = typeof configured === "function" ? await configured(input) : configured;
1328
+ if (!isCompiledStateGraph(resolved))
1329
+ throw new Error(`Graph factory '${graphId}' did not return a CompiledStateGraph`);
1335
1330
  if (!resolved.checkpointer && checkpointer)
1336
1331
  resolved.checkpointer = checkpointer;
1337
1332
  return resolved;
@@ -10454,4 +10449,4 @@ async function shutdown() {
10454
10449
  process.on("SIGINT", () => void shutdown().then(() => process.exit(0)));
10455
10450
  process.on("SIGTERM", () => void shutdown().then(() => process.exit(0)));
10456
10451
 
10457
- //# debugId=48FD78F597AFF02B64756E2164756E21
10452
+ //# debugId=7826A2E10204262164756E2164756E21