@skein-js/server-kit 0.18.0 → 0.19.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.
|
@@ -100,7 +100,11 @@ function resolveIdempotency(raw) {
|
|
|
100
100
|
|
|
101
101
|
// src/in-memory-deps.ts
|
|
102
102
|
import { MemorySaver } from "@langchain/langgraph";
|
|
103
|
-
import {
|
|
103
|
+
import {
|
|
104
|
+
cloneLangGraphCheckpoint,
|
|
105
|
+
normalizeEmbeddableGraphs,
|
|
106
|
+
SkeinBaseStore
|
|
107
|
+
} from "@skein-js/langgraph";
|
|
104
108
|
import { MemoryRunEventBus, MemoryRunQueue, MemorySkeinStore } from "@skein-js/storage-memory";
|
|
105
109
|
|
|
106
110
|
// src/max-page-size.ts
|
|
@@ -186,30 +190,10 @@ function resolveWebhooks(raw, options = {}) {
|
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
// src/in-memory-deps.ts
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
function normalizeEmbeddableGraphs(graphs) {
|
|
194
|
-
return langGraphResolver(isGraphResolver(graphs) ? graphs : graphMapToResolver(graphs));
|
|
195
|
-
}
|
|
196
|
-
function graphMapToResolver(graphs) {
|
|
197
|
-
const ids = Object.keys(graphs);
|
|
198
|
-
return {
|
|
199
|
-
ids,
|
|
200
|
-
load: async (graphId) => {
|
|
201
|
-
const graph = graphs[graphId];
|
|
202
|
-
if (graph == null) {
|
|
203
|
-
const known = ids.join(", ") || "none";
|
|
204
|
-
throw new Error(
|
|
205
|
-
ids.includes(graphId) ? `Graph "${graphId}" resolved to ${String(graph)} \u2014 check its export/factory (known: ${known}).` : `Unknown graph "${graphId}" (known: ${known}).`
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
return graph;
|
|
209
|
-
},
|
|
210
|
-
schemas: async (graphId) => ({ [graphId]: { graph_id: graphId } })
|
|
211
|
-
};
|
|
212
|
-
}
|
|
193
|
+
import {
|
|
194
|
+
graphMapToResolver,
|
|
195
|
+
normalizeEmbeddableGraphs as normalizeEmbeddableGraphs2
|
|
196
|
+
} from "@skein-js/langgraph";
|
|
213
197
|
function embedInMemoryGraphs(graphs, overrides = {}) {
|
|
214
198
|
const webhooks = resolveWebhooks(void 0);
|
|
215
199
|
return {
|
|
@@ -361,10 +345,10 @@ export {
|
|
|
361
345
|
resolveMaxPageSize,
|
|
362
346
|
resolveMemoryBusLimits,
|
|
363
347
|
resolveWebhooks,
|
|
364
|
-
normalizeEmbeddableGraphs,
|
|
365
|
-
graphMapToResolver,
|
|
366
348
|
embedInMemoryGraphs,
|
|
367
349
|
createInMemoryDeps,
|
|
350
|
+
graphMapToResolver,
|
|
351
|
+
normalizeEmbeddableGraphs2 as normalizeEmbeddableGraphs,
|
|
368
352
|
resolveThreadTtl,
|
|
369
353
|
resolveStoreTtl,
|
|
370
354
|
loadInMemoryRuntime,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import { MemoryRunEventBusOptions } from '@skein-js/storage-memory';
|
|
|
7
7
|
import { D as DevStateSnapshot } from './dev-Zz4VRv7T.js';
|
|
8
8
|
export { a as DevStateCounts } from './dev-Zz4VRv7T.js';
|
|
9
9
|
import { StoreTtlConfig, ThreadTtlConfig } from '@skein-js/core';
|
|
10
|
-
import {
|
|
10
|
+
import { EmbeddableGraph } from '@skein-js/langgraph';
|
|
11
|
+
export { EmbeddableGraph, graphMapToResolver, normalizeEmbeddableGraphs } from '@skein-js/langgraph';
|
|
11
12
|
import { ServerResponse } from 'node:http';
|
|
12
13
|
|
|
13
14
|
interface SkeinRuntimeCommonOptions {
|
|
@@ -532,46 +533,6 @@ declare function resolveWebhooks(raw: RawWebhooks | undefined, options?: {
|
|
|
532
533
|
warn?: (message: string) => void;
|
|
533
534
|
}): WebhookDeliveryConfig | undefined;
|
|
534
535
|
|
|
535
|
-
type AnyCompiledGraph = CompiledGraph<any>;
|
|
536
|
-
/**
|
|
537
|
-
* The surface the engine actually drives, stated structurally.
|
|
538
|
-
*
|
|
539
|
-
* `CompiledGraph` is not the right bound here even though every graph is one. LangChain's own
|
|
540
|
-
* `createAgent` returns a `ReactAgent`, which is graph-*like* — it streams and it has state — but is
|
|
541
|
-
* not structurally a `CompiledGraph`, so requiring that type rejected the blessed way to build an
|
|
542
|
-
* agent. The engine never needed it: `langGraphResolver` casts whatever it is to an `AgentGraph`, and
|
|
543
|
-
* `AgentGraph` requires exactly these two methods.
|
|
544
|
-
*
|
|
545
|
-
* Kept narrow enough to still catch a mistake — an object with neither method is not a graph — while
|
|
546
|
-
* accepting anything the runtime can genuinely drive.
|
|
547
|
-
*/
|
|
548
|
-
interface EmbeddableAgentSurface {
|
|
549
|
-
stream(input: any, options?: any): any;
|
|
550
|
-
getState(config: any): any;
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* A graph you can embed in code: any compiled LangGraph.js graph, anything `createAgent` returns, or a
|
|
554
|
-
* factory that builds one per run (called with the run's `configurable`). Keys of a graph map become
|
|
555
|
-
* graph ids.
|
|
556
|
-
*/
|
|
557
|
-
type EmbeddableGraph = AnyCompiledGraph | EmbeddableAgentSurface | ((config: {
|
|
558
|
-
configurable?: Record<string, unknown>;
|
|
559
|
-
}) => AnyCompiledGraph | EmbeddableAgentSurface | Promise<AnyCompiledGraph | EmbeddableAgentSurface>);
|
|
560
|
-
/**
|
|
561
|
-
* Accept either a ready {@link GraphResolver} or a plain graph map and return a `GraphResolver` either
|
|
562
|
-
* way — the normalization every in-code embedding helper shares (`embedInMemoryGraphs` here,
|
|
563
|
-
* `embedPostgresGraphs` in `@skein-js/runtime`), so the {@link isGraphResolver} discriminator lives in
|
|
564
|
-
* exactly one place.
|
|
565
|
-
*/
|
|
566
|
-
declare function normalizeEmbeddableGraphs(graphs: GraphResolver | Record<string, EmbeddableGraph>): GraphResolver;
|
|
567
|
-
/**
|
|
568
|
-
* Turn a map of compiled graphs (or per-config factories) into a {@link GraphResolver}. Keys become the
|
|
569
|
-
* graph ids — one auto-registered assistant each. `schemas()` returns a minimal `{ graph_id }` stub:
|
|
570
|
-
* enough for the assistants introspection endpoints and everything `useStream` / Agent Chat UI render.
|
|
571
|
-
* Real input/output/state schema extraction stays a `langgraph.json`/config feature — it needs static
|
|
572
|
-
* TypeScript analysis of the graph source, which a compiled graph object no longer carries.
|
|
573
|
-
*/
|
|
574
|
-
declare function graphMapToResolver(graphs: Record<string, EmbeddableGraph>): GraphResolver;
|
|
575
536
|
/**
|
|
576
537
|
* Build a `ProtocolDeps` backed by fresh in-process drivers (store, queue, bus, checkpointer) around
|
|
577
538
|
* graphs you already hold in code — no `langgraph.json`, no CLI. Pass a map of compiled graphs (or
|
|
@@ -755,4 +716,4 @@ type RuntimeGlobal = typeof globalThis & {
|
|
|
755
716
|
/** Detect Node, Bun, or Deno without importing a runtime-specific module. */
|
|
756
717
|
declare function detectRuntimeCapabilities(scope?: RuntimeGlobal): RuntimeCapabilities;
|
|
757
718
|
|
|
758
|
-
export { type ConsoleLogLevel, type ConsoleLoggerOptions, type CorsSetting, DEFAULT_HEAP_SAMPLE_MS, DEFAULT_HEAP_WARN_PERCENT, DevStateSnapshot, type
|
|
719
|
+
export { type ConsoleLogLevel, type ConsoleLoggerOptions, type CorsSetting, DEFAULT_HEAP_SAMPLE_MS, DEFAULT_HEAP_WARN_PERCENT, DevStateSnapshot, type FileReader, HEAP_REARM_MARGIN_PERCENT, HEAP_REARM_PERCENT, type HeapHeadroom, type HeapPressureContext, type HeapPressureMonitor, type HeapPressureMonitorOptions, type InMemoryRuntimeConfig, type IntervalHandle, type LanggraphCorsConfig, type RawIdempotency, type RawStoreTtl, type RawThreadTtl, type RawWebhooks, type ReloadableInMemoryRuntime, type ResolvedMemoryBusLimits, type ResolvedProtocolRuntime, type ResolvedRuntimeDeps, type RuntimeCapabilities, type RuntimeMemorySnapshot, type RuntimeSignalSubscription, type SkeinRuntimeCommonOptions, type SkeinRuntimeOptions, allowedOrigin, applyNodeCors, checkHeapHeadroom, consoleMountFromHttpConfig, corsFromHttpConfig, corsPreflightHeaders, corsResponseHeaders, createConsoleLogger, createInMemoryDeps, describeError, describeHeapHeadroom, describePoolPressure, detectRuntimeCapabilities, disabledRoutesFromHttpConfig, embedInMemoryGraphs, formatLogMeta, joinList, loadInMemoryRuntime, loadReloadableInMemoryRuntime, readContainerMemoryLimit, resolveCronTickMs, resolveHeapPressureOptions, resolveIdempotency, resolveMaxPageSize, resolveMemoryBusLimits, resolveProtocolRuntime, resolveRunConcurrency, resolveRunTimeoutMs, resolveRuntimeDeps, resolveShutdownGraceMs, resolveStoreTtl, resolveThreadTtl, resolveWebhooks, routeMatcherFor, routesFromHttpConfig, runFailureIdentity, sendNodeError, sendNodePreflight, sendNodeResponse, startHeapPressureMonitor, stripBasePath, toCorsOptions };
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resolveWebhooks,
|
|
19
19
|
routesFromHttpConfig,
|
|
20
20
|
toCorsOptions
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UJZBVPYI.js";
|
|
22
22
|
import "./chunk-JUBBCC7R.js";
|
|
23
23
|
|
|
24
24
|
// src/resolve-runtime.ts
|
|
@@ -168,7 +168,7 @@ function resolveLogger(option, injected, frameworkLogger) {
|
|
|
168
168
|
return option ?? frameworkLogger;
|
|
169
169
|
}
|
|
170
170
|
async function resolveRuntimeDeps(options, frameworkLogger) {
|
|
171
|
-
const loaded = options.deps ? { deps: options.deps, cors: void 0, routes: skeinRoutes, channels: options.channels } : await (await import("./in-memory-runtime-
|
|
171
|
+
const loaded = options.deps ? { deps: options.deps, cors: void 0, routes: skeinRoutes, channels: options.channels } : await (await import("./in-memory-runtime-IOQZUNLV.js")).loadInMemoryRuntime(options.config, options.importModule);
|
|
172
172
|
const logger = resolveLogger(options.logger, loaded.deps.logger, frameworkLogger);
|
|
173
173
|
if (logger && !loaded.deps.logger) loaded.deps.logger = logger;
|
|
174
174
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skein-js/server-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Shared, framework-agnostic building blocks for skein-js HTTP adapters — in-memory dev runtime, LangGraph dev-state import, and langgraph.json CORS mapping.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Maina Wycliffe <wmmaina7@gmail.com>",
|
|
@@ -49,22 +49,22 @@
|
|
|
49
49
|
"cors": "^2.8.5",
|
|
50
50
|
"superjson": "^2.2.6",
|
|
51
51
|
"zod": "^3.25.76",
|
|
52
|
-
"@skein-js/agent-protocol": "0.
|
|
53
|
-
"@skein-js/
|
|
54
|
-
"@skein-js/core": "0.
|
|
55
|
-
"@skein-js/
|
|
56
|
-
"@skein-js/
|
|
52
|
+
"@skein-js/agent-protocol": "0.19.0",
|
|
53
|
+
"@skein-js/langgraph": "0.19.0",
|
|
54
|
+
"@skein-js/core": "0.19.0",
|
|
55
|
+
"@skein-js/storage-memory": "0.19.0",
|
|
56
|
+
"@skein-js/config": "0.19.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@langchain/langgraph": "^1.4.0",
|
|
60
|
-
"@skein-js/channels": "0.
|
|
60
|
+
"@skein-js/channels": "0.19.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@langchain/core": "^1.2.9",
|
|
64
64
|
"@langchain/langgraph": "^1.4.0",
|
|
65
65
|
"@langchain/langgraph-sdk": "^1.9.0",
|
|
66
66
|
"@types/cors": "^2.8.17",
|
|
67
|
-
"@skein-js/channels": "0.
|
|
67
|
+
"@skein-js/channels": "0.19.0"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|