@skein-js/server-kit 0.16.0 → 0.18.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/README.md +1 -1
- package/dist/{channels-runtime-OADE6ORT.js → channels-runtime-JHTMXARF.js} +20 -1
- package/dist/{chunk-OZ477M7A.js → chunk-5Q3G665D.js} +9 -13
- package/dist/{in-memory-runtime-HE3LTSLD.js → in-memory-runtime-N3GPWIA5.js} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -3
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ Pass `overrides` to swap in production drivers or an auth engine while keeping t
|
|
|
81
81
|
**`@deprecated`** alias. `graphMapToResolver` / `normalizeEmbeddableGraphs` are the lower-level
|
|
82
82
|
graph→`GraphResolver` helpers.
|
|
83
83
|
- **`resolveProtocolRuntime(options, frameworkLogger?): Promise<ResolvedProtocolRuntime>`** — turn a
|
|
84
|
-
`{ config } | { deps }` bag (`SkeinRuntimeOptions`) into a live runtime (assistants seeded, worker
|
|
84
|
+
`{ config } | { deps, channels? }` bag (`SkeinRuntimeOptions`) into a live runtime (assistants seeded, worker
|
|
85
85
|
started) — the step every adapter runs before mounting routes. `options.worker`
|
|
86
86
|
(`RunWorkerOptions`) tunes the background worker; `worker.maxConcurrency` is how many queued runs
|
|
87
87
|
run at once. `frameworkLogger` is the adapter's own default, applied only when the caller supplied
|
|
@@ -27,14 +27,33 @@ async function resolveChannels(input) {
|
|
|
27
27
|
graphIds: input.graphIds
|
|
28
28
|
});
|
|
29
29
|
const pipelineDeps = buildPipelineDeps(input.deps, input.service);
|
|
30
|
+
const channelInventory = registry.names.map((routeName) => {
|
|
31
|
+
const registered = registry.get(routeName);
|
|
32
|
+
if (!registered) throw new Error(`Channel registry lost configured route "${routeName}".`);
|
|
33
|
+
return {
|
|
34
|
+
route_name: routeName,
|
|
35
|
+
assistant: registered.config.assistant,
|
|
36
|
+
allowed_assistants: [...registered.config.allowedAssistants ?? []],
|
|
37
|
+
channel_name: registered.channel.name,
|
|
38
|
+
delivery_supported: typeof registered.channel.deliver === "function"
|
|
39
|
+
};
|
|
40
|
+
});
|
|
30
41
|
return {
|
|
31
|
-
routes:
|
|
42
|
+
routes: [
|
|
43
|
+
{ method: "get", path: "/channels", handler: "listChannels" },
|
|
44
|
+
...channels.channelRouteBindings(registry.names)
|
|
45
|
+
],
|
|
32
46
|
wrapDispatcher: (inner) => channels.wrapChannelDispatcher({
|
|
33
47
|
registry,
|
|
34
48
|
inner,
|
|
35
49
|
logger: input.deps.logger ?? console
|
|
36
50
|
}),
|
|
37
51
|
handlers: {
|
|
52
|
+
listChannels: async () => ({
|
|
53
|
+
kind: "json",
|
|
54
|
+
status: 200,
|
|
55
|
+
body: { channels: channelInventory }
|
|
56
|
+
}),
|
|
38
57
|
handleInboundEvent: async (req) => {
|
|
39
58
|
const name = req.url.split("?")[0].split("/channels/")[1] ?? "";
|
|
40
59
|
const registered = registry.get(name);
|
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
loadChannels,
|
|
11
11
|
loadConfig
|
|
12
12
|
} from "@skein-js/config";
|
|
13
|
-
import {
|
|
14
|
-
import { MemoryRunEventBus as MemoryRunEventBus2, MemoryRunQueue as MemoryRunQueue2, MemorySkeinStore as MemorySkeinStore2 } from "@skein-js/storage-memory";
|
|
13
|
+
import { MemorySkeinStore as MemorySkeinStore2 } from "@skein-js/storage-memory";
|
|
15
14
|
|
|
16
15
|
// src/cors-config.ts
|
|
17
16
|
import {
|
|
@@ -19,7 +18,7 @@ import {
|
|
|
19
18
|
skeinRoutes
|
|
20
19
|
} from "@skein-js/agent-protocol";
|
|
21
20
|
var ALWAYS_EXPOSED_HEADERS = ["content-location", "x-pagination-total", "idempotent-replay"];
|
|
22
|
-
var ALWAYS_ALLOWED_HEADERS = ["idempotency-key"];
|
|
21
|
+
var ALWAYS_ALLOWED_HEADERS = ["idempotency-key", "x-api-key"];
|
|
23
22
|
function toCorsOptions(config) {
|
|
24
23
|
const options = {};
|
|
25
24
|
const allowAll = config.allow_origins?.includes("*") ?? false;
|
|
@@ -277,7 +276,7 @@ async function loadInMemoryRuntime(configPath, importModule, staticSchemas) {
|
|
|
277
276
|
importModule,
|
|
278
277
|
staticSchemas
|
|
279
278
|
});
|
|
280
|
-
const deps = embedInMemoryGraphs(
|
|
279
|
+
const deps = embedInMemoryGraphs(toGraphResolver(graphs));
|
|
281
280
|
deps.auth = await loadAuthEngine(config.auth, { configDir, importModule });
|
|
282
281
|
return {
|
|
283
282
|
deps,
|
|
@@ -292,11 +291,11 @@ async function loadInMemoryRuntime(configPath, importModule, staticSchemas) {
|
|
|
292
291
|
async function loadReloadableInMemoryRuntime(configPath, importModule, staticSchemas, extraDeps) {
|
|
293
292
|
const first = await loadConfig({ configPath, importModule, staticSchemas });
|
|
294
293
|
let current = first.graphs;
|
|
295
|
-
const graphs =
|
|
294
|
+
const graphs = {
|
|
296
295
|
ids: first.graphs.ids,
|
|
297
296
|
load: (graphId) => current.load(graphId),
|
|
298
297
|
schemas: async (graphId) => await current.schemas(graphId)
|
|
299
|
-
}
|
|
298
|
+
};
|
|
300
299
|
const threadTtl = resolveThreadTtl(first.config.checkpointer?.ttl);
|
|
301
300
|
const storeTtl = resolveStoreTtl(first.config.store?.ttl);
|
|
302
301
|
const idempotency = resolveIdempotency(first.config.skein?.idempotency);
|
|
@@ -309,22 +308,19 @@ async function loadReloadableInMemoryRuntime(configPath, importModule, staticSch
|
|
|
309
308
|
...storeTtl ? { ttl: storeTtl } : {}
|
|
310
309
|
});
|
|
311
310
|
const checkpointer = new MemorySaver2();
|
|
312
|
-
const deps = {
|
|
311
|
+
const deps = embedInMemoryGraphs(graphs, {
|
|
313
312
|
store,
|
|
314
|
-
graphs,
|
|
315
|
-
queue: new MemoryRunQueue2(),
|
|
316
|
-
// This is the path `skein start` and `skein up` take by default, so it is the longest-lived
|
|
317
|
-
// memory bus skein runs — the bounds have to be resolved here too, not just on the embed paths.
|
|
318
|
-
bus: new MemoryRunEventBus2(resolveMemoryBusLimits()),
|
|
319
313
|
checkpointer,
|
|
320
314
|
auth: await loadAuthEngine(first.config.auth, { configDir: first.configDir, importModule }),
|
|
321
315
|
// Present only when configured — its presence is what starts the thread TTL sweeper.
|
|
322
316
|
...threadTtl ? { threadTtl } : {},
|
|
323
317
|
// Unlike `threadTtl`, absence here means *defaults*, not *off*: the header is honoured either way.
|
|
324
318
|
...idempotency ? { idempotency } : {},
|
|
319
|
+
// Resolved from this runtime's config, which `resolveWebhooks` already merges with the environment
|
|
320
|
+
// — so this subsumes the env-only value `embedInMemoryGraphs` computes, and overrides spread last.
|
|
325
321
|
...webhooks ? { webhooks } : {},
|
|
326
322
|
...extraDeps
|
|
327
|
-
};
|
|
323
|
+
});
|
|
328
324
|
return {
|
|
329
325
|
deps,
|
|
330
326
|
// Loaded here so the modules are imported once, with the same importer the graphs used — under
|
package/dist/index.d.ts
CHANGED
|
@@ -85,6 +85,8 @@ type SkeinRuntimeOptions = SkeinRuntimeCommonOptions & ({
|
|
|
85
85
|
deps: ProtocolDeps;
|
|
86
86
|
config?: never;
|
|
87
87
|
importModule?: never;
|
|
88
|
+
/** Preloaded channel modules when another assembler consumed langgraph.json before us. */
|
|
89
|
+
channels?: Record<string, LoadedChannel>;
|
|
88
90
|
});
|
|
89
91
|
interface ResolvedProtocolRuntime {
|
|
90
92
|
/** The wired runtime — assistants seeded and the background worker already started. */
|
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-5Q3G665D.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:
|
|
171
|
+
const loaded = options.deps ? { deps: options.deps, cors: void 0, routes: skeinRoutes, channels: options.channels } : await (await import("./in-memory-runtime-N3GPWIA5.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 {
|
|
@@ -191,7 +191,7 @@ async function resolveProtocolRuntime(options, frameworkLogger) {
|
|
|
191
191
|
const runTimeoutMs = resolveRunTimeoutMs(deps.runTimeoutMs);
|
|
192
192
|
if (runTimeoutMs !== void 0) deps.runTimeoutMs = runTimeoutMs;
|
|
193
193
|
const runtimeRef = {};
|
|
194
|
-
const channelSurface = channels ? await (await import("./channels-runtime-
|
|
194
|
+
const channelSurface = channels ? await (await import("./channels-runtime-JHTMXARF.js")).resolveChannels({
|
|
195
195
|
channels,
|
|
196
196
|
graphIds: deps.graphs.ids,
|
|
197
197
|
deps,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skein-js/server-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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/config": "0.
|
|
54
|
-
"@skein-js/core": "0.
|
|
55
|
-
"@skein-js/langgraph": "0.
|
|
56
|
-
"@skein-js/storage-memory": "0.
|
|
52
|
+
"@skein-js/agent-protocol": "0.18.0",
|
|
53
|
+
"@skein-js/config": "0.18.0",
|
|
54
|
+
"@skein-js/core": "0.18.0",
|
|
55
|
+
"@skein-js/langgraph": "0.18.0",
|
|
56
|
+
"@skein-js/storage-memory": "0.18.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@langchain/langgraph": "^1.4.0",
|
|
60
|
-
"@skein-js/channels": "0.
|
|
60
|
+
"@skein-js/channels": "0.18.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.18.0"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|