@skein-js/agent-protocol 0.9.0 → 0.9.1
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 +4 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.js +3 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -102,7 +102,10 @@ Graph **state, history, and interrupt/resume are 100% LangGraph-native** via the
|
|
|
102
102
|
|
|
103
103
|
- **Entry points:** `createProtocolRuntime(deps, options?)` → `{ service, handlers, worker }`;
|
|
104
104
|
`createProtocolService` / `createProtocolServiceFromContext`; `createProtocolHandlers`; `createContext`;
|
|
105
|
-
`createRunWorker(ctx, options?)` (`RunWorkerOptions`: `maxConcurrency
|
|
105
|
+
`createRunWorker(ctx, options?)` (`RunWorkerOptions`: `maxConcurrency` — queued runs at once,
|
|
106
|
+
default `DEFAULT_RUN_CONCURRENCY` (10, matching the LangGraph CLI) — and `shutdownGraceMs`). The
|
|
107
|
+
adapters surface this as `worker.maxConcurrency` and also read `SKEIN_RUN_CONCURRENCY` /
|
|
108
|
+
`N_JOBS_PER_WORKER`; see [runs-and-redis.md](../../docs/runs-and-redis.md#run-concurrency).
|
|
106
109
|
- **Service surface** (`runtime.service`): `assistants` (`registerGraphAssistants`, `get`, `list`,
|
|
107
110
|
`search`, `schemas`), `threads` (`create`/`get`/`list`/`patch`/`delete`/`history`/`getState`),
|
|
108
111
|
`threadStream` (`stream` / `joinStream` / `command` — HIL resume, requires status `interrupted`),
|
package/dist/index.d.ts
CHANGED
|
@@ -436,8 +436,19 @@ interface ProtocolHandlers {
|
|
|
436
436
|
}
|
|
437
437
|
declare function createProtocolHandlers(service: ProtocolService): ProtocolHandlers;
|
|
438
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Queued runs one worker executes at once when nothing is configured. Matches the LangGraph CLI's
|
|
441
|
+
* `--n-jobs-per-worker` default, so a project moving off `langgraph dev` keeps its throughput.
|
|
442
|
+
*/
|
|
443
|
+
declare const DEFAULT_RUN_CONCURRENCY = 10;
|
|
439
444
|
interface RunWorkerOptions {
|
|
440
|
-
/**
|
|
445
|
+
/**
|
|
446
|
+
* Max queued runs this worker executes at once. Default {@link DEFAULT_RUN_CONCURRENCY}.
|
|
447
|
+
* Per-thread ordering does not depend on this: `startRunExecution` serializes by `thread_id` at
|
|
448
|
+
* every value. The trade-off is head-of-line blocking — a run waiting on a busy thread's lock
|
|
449
|
+
* still holds a slot, so a burst of `multitask_strategy: "enqueue"` runs on one thread can occupy
|
|
450
|
+
* the worker. See docs/runs-and-redis.md.
|
|
451
|
+
*/
|
|
441
452
|
maxConcurrency?: number;
|
|
442
453
|
/** How long `stop()` waits for in-flight runs before aborting them (ms). Default 5000. */
|
|
443
454
|
shutdownGraceMs?: number;
|
|
@@ -452,7 +463,7 @@ declare function createRunWorker(ctx: ProtocolContext, options?: RunWorkerOption
|
|
|
452
463
|
|
|
453
464
|
/** Options for {@link createProtocolRuntime}. */
|
|
454
465
|
interface ProtocolRuntimeOptions {
|
|
455
|
-
/** Tuning for the background run worker (concurrency,
|
|
466
|
+
/** Tuning for the background run worker (max concurrency, shutdown grace period). */
|
|
456
467
|
worker?: RunWorkerOptions;
|
|
457
468
|
}
|
|
458
469
|
/** The wired engine: the service, the transport-neutral handler table, and the background worker. */
|
|
@@ -602,4 +613,4 @@ declare function toSseEvents(frames: AsyncIterable<RunFrame>, finalStatus: () =>
|
|
|
602
613
|
*/
|
|
603
614
|
declare function parseAfterSeq(lastEventId: string | undefined): number;
|
|
604
615
|
|
|
605
|
-
export { type AssistantService, type Clock, type CommandInput, type CompiledGraphFactory, type CreateAssistantInput, type CreateRunInput, type CreateThreadInput, DEFAULT_INVOKE_PREFIX, type DeleteAssistantOptions, type DrawGraphOptions, type GraphInvokeHandlerName, type GraphInvokeOptions, type GraphResolver, type GraphSchemas, type HistoryOptions, type HttpMethod, type Logger, type PatchThreadInput, type ProtocolContext, type ProtocolDeps, type ProtocolHandler, type ProtocolHandlers, type ProtocolRequest, type ProtocolResponse, type ProtocolRuntime, type ProtocolRuntimeOptions, type ProtocolService, type ResolvedGraph, type RouteBinding, type RouteMatch, type RouteMatcher, type RunService, type RunWorker, type RunWorkerOptions, SSE_HEADERS, SkeinBaseStore, type StartedStream, type StoreService, type SubgraphsOptions, type ThreadService, type ThreadStreamInput, type ThreadStreamService, buildProtocolService, copyThreadIdIntoBody, createContext, createGraphInvokeHandler, createProtocolHandlers, createProtocolRuntime, createProtocolService, createProtocolServiceFromContext, createRouteMatcher, createRunWorker, encodeFrame, encodeTerminal, foldThreadId, graphInvokeRoutes, matchSkeinRoute, parseAfterSeq, skeinRoutes, toSseEvents };
|
|
616
|
+
export { type AssistantService, type Clock, type CommandInput, type CompiledGraphFactory, type CreateAssistantInput, type CreateRunInput, type CreateThreadInput, DEFAULT_INVOKE_PREFIX, DEFAULT_RUN_CONCURRENCY, type DeleteAssistantOptions, type DrawGraphOptions, type GraphInvokeHandlerName, type GraphInvokeOptions, type GraphResolver, type GraphSchemas, type HistoryOptions, type HttpMethod, type Logger, type PatchThreadInput, type ProtocolContext, type ProtocolDeps, type ProtocolHandler, type ProtocolHandlers, type ProtocolRequest, type ProtocolResponse, type ProtocolRuntime, type ProtocolRuntimeOptions, type ProtocolService, type ResolvedGraph, type RouteBinding, type RouteMatch, type RouteMatcher, type RunService, type RunWorker, type RunWorkerOptions, SSE_HEADERS, SkeinBaseStore, type StartedStream, type StoreService, type SubgraphsOptions, type ThreadService, type ThreadStreamInput, type ThreadStreamService, buildProtocolService, copyThreadIdIntoBody, createContext, createGraphInvokeHandler, createProtocolHandlers, createProtocolRuntime, createProtocolService, createProtocolServiceFromContext, createRouteMatcher, createRunWorker, encodeFrame, encodeTerminal, foldThreadId, graphInvokeRoutes, matchSkeinRoute, parseAfterSeq, skeinRoutes, toSseEvents };
|
package/dist/index.js
CHANGED
|
@@ -2014,6 +2014,7 @@ function createAuthorizingHandlers(context, engine) {
|
|
|
2014
2014
|
import {
|
|
2015
2015
|
isTerminalRunStatus as isTerminalRunStatus6
|
|
2016
2016
|
} from "@skein-js/core";
|
|
2017
|
+
var DEFAULT_RUN_CONCURRENCY = 10;
|
|
2017
2018
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2018
2019
|
function logRunLifecycle(logger, run, status, startedAt, endedAt) {
|
|
2019
2020
|
logger.info(status === "success" ? "Background run succeeded" : `Background run ${status}`, {
|
|
@@ -2028,7 +2029,7 @@ function logRunLifecycle(logger, run, status, startedAt, endedAt) {
|
|
|
2028
2029
|
}
|
|
2029
2030
|
function createRunWorker(ctx, options = {}) {
|
|
2030
2031
|
const { deps, control } = ctx;
|
|
2031
|
-
const maxConcurrency = options.maxConcurrency ??
|
|
2032
|
+
const maxConcurrency = options.maxConcurrency ?? DEFAULT_RUN_CONCURRENCY;
|
|
2032
2033
|
const shutdownGraceMs = options.shutdownGraceMs ?? 5e3;
|
|
2033
2034
|
const inFlight = /* @__PURE__ */ new Set();
|
|
2034
2035
|
const process = async (queued) => {
|
|
@@ -2315,6 +2316,7 @@ function createGraphInvokeHandler(deps, options = {}) {
|
|
|
2315
2316
|
}
|
|
2316
2317
|
export {
|
|
2317
2318
|
DEFAULT_INVOKE_PREFIX,
|
|
2319
|
+
DEFAULT_RUN_CONCURRENCY,
|
|
2318
2320
|
SSE_HEADERS,
|
|
2319
2321
|
SkeinBaseStore,
|
|
2320
2322
|
buildProtocolService,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skein-js/agent-protocol",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Framework-agnostic Agent Protocol engine for LangGraph.js — run engine, handlers, and SSE, driven entirely by injected dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Maina Wycliffe <wmmaina7@gmail.com>",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"zod": "^3.25.76",
|
|
47
|
-
"@skein-js/core": "0.9.
|
|
47
|
+
"@skein-js/core": "0.9.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@langchain/langgraph": "^1.4.0",
|
|
51
51
|
"@langchain/langgraph-sdk": "^1.9.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@skein-js/storage-memory": "0.9.
|
|
54
|
+
"@skein-js/storage-memory": "0.9.1"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|