@skein-js/agent-protocol 0.6.3 → 0.7.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 CHANGED
@@ -101,7 +101,7 @@ Graph **state, history, and interrupt/resume are 100% LangGraph-native** via the
101
101
  ## API
102
102
 
103
103
  - **Entry points:** `createProtocolRuntime(deps, options?)` → `{ service, handlers, worker }`;
104
- `createProtocolService` / `buildProtocolService`; `createProtocolHandlers`; `createContext`;
104
+ `createProtocolService` / `createProtocolServiceFromContext`; `createProtocolHandlers`; `createContext`;
105
105
  `createRunWorker(ctx, options?)` (`RunWorkerOptions`: `maxConcurrency`, `shutdownGraceMs`).
106
106
  - **Service surface** (`runtime.service`): `assistants` (`registerGraphAssistants`, `get`, `list`,
107
107
  `search`, `schemas`), `threads` (`create`/`get`/`list`/`patch`/`delete`/`history`/`getState`),
package/dist/index.d.ts CHANGED
@@ -331,10 +331,16 @@ interface ProtocolService {
331
331
  store: StoreService;
332
332
  }
333
333
  /** Assemble the service over an existing context (used by the runtime to share the context). */
334
- declare function buildProtocolService(ctx: ProtocolContext): ProtocolService;
334
+ declare function createProtocolServiceFromContext(ctx: ProtocolContext): ProtocolService;
335
335
  /** Build the service with its own context. Use {@link createProtocolRuntime} when you also run a
336
336
  * background worker in the same process, so cancellation is shared. */
337
337
  declare function createProtocolService(deps: ProtocolDeps): ProtocolService;
338
+ /**
339
+ * @deprecated Renamed to {@link createProtocolServiceFromContext} — it builds the service over an
340
+ * existing `ProtocolContext` (vs {@link createProtocolService}, which takes `deps` and makes its own).
341
+ * Kept for back-compat; slated for removal in a future major.
342
+ */
343
+ declare const buildProtocolService: typeof createProtocolServiceFromContext;
338
344
 
339
345
  /** A normalized request an adapter maps its framework request onto. */
340
346
  interface ProtocolRequest {
@@ -414,12 +420,18 @@ interface RunWorker {
414
420
  }
415
421
  declare function createRunWorker(ctx: ProtocolContext, options?: RunWorkerOptions): RunWorker;
416
422
 
423
+ /** Options for {@link createProtocolRuntime}. */
417
424
  interface ProtocolRuntimeOptions {
425
+ /** Tuning for the background run worker (concurrency, poll interval). */
418
426
  worker?: RunWorkerOptions;
419
427
  }
428
+ /** The wired engine: the service, the transport-neutral handler table, and the background worker. */
420
429
  interface ProtocolRuntime {
430
+ /** High-level operations over assistants / threads / runs / store (used to seed assistants). */
421
431
  service: ProtocolService;
432
+ /** The transport-neutral HTTP handler table an adapter dispatches requests into. */
422
433
  handlers: ProtocolHandlers;
434
+ /** The background worker that drains the run queue; `start()` it after seeding assistants. */
423
435
  worker: RunWorker;
424
436
  }
425
437
  /**
@@ -448,9 +460,14 @@ declare const skeinRoutes: readonly RouteBinding[];
448
460
  /**
449
461
  * Copy the path `thread_id` into an object body so a stateless run handler runs on the right thread.
450
462
  * A no-op when there is no `thread_id` param. Used by every adapter for the `foldThreadIdIntoBody`
451
- * routes, so the folding rule lives in one place.
463
+ * routes, so this rule lives in one place.
464
+ */
465
+ declare function copyThreadIdIntoBody(request: ProtocolRequest): ProtocolRequest;
466
+ /**
467
+ * @deprecated Renamed to {@link copyThreadIdIntoBody} — it copies the path `thread_id` into the
468
+ * request body. Kept for back-compat; slated for removal in a future major.
452
469
  */
453
- declare function foldThreadId(request: ProtocolRequest): ProtocolRequest;
470
+ declare const foldThreadId: typeof copyThreadIdIntoBody;
454
471
  /** A resolved route: the matched binding plus the path params extracted from the URL. */
455
472
  interface RouteMatch {
456
473
  binding: RouteBinding;
@@ -518,4 +535,4 @@ declare function toSseEvents(frames: AsyncIterable<RunFrame>, finalStatus: () =>
518
535
  */
519
536
  declare function parseAfterSeq(lastEventId: string | undefined): number;
520
537
 
521
- export { type AssistantService, type Clock, type CommandInput, type CompiledGraphFactory, type CreateAssistantInput, type CreateRunInput, type CreateThreadInput, type DeleteAssistantOptions, type DrawGraphOptions, 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 RunService, type RunWorker, type RunWorkerOptions, SSE_HEADERS, SkeinBaseStore, type StartedStream, type StoreService, type SubgraphsOptions, type ThreadService, type ThreadStreamInput, type ThreadStreamService, buildProtocolService, createContext, createProtocolHandlers, createProtocolRuntime, createProtocolService, createRunWorker, encodeFrame, encodeTerminal, foldThreadId, matchSkeinRoute, parseAfterSeq, skeinRoutes, toSseEvents };
538
+ export { type AssistantService, type Clock, type CommandInput, type CompiledGraphFactory, type CreateAssistantInput, type CreateRunInput, type CreateThreadInput, type DeleteAssistantOptions, type DrawGraphOptions, 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 RunService, type RunWorker, type RunWorkerOptions, SSE_HEADERS, SkeinBaseStore, type StartedStream, type StoreService, type SubgraphsOptions, type ThreadService, type ThreadStreamInput, type ThreadStreamService, buildProtocolService, copyThreadIdIntoBody, createContext, createProtocolHandlers, createProtocolRuntime, createProtocolService, createProtocolServiceFromContext, createRunWorker, encodeFrame, encodeTerminal, foldThreadId, matchSkeinRoute, parseAfterSeq, skeinRoutes, toSseEvents };
package/dist/index.js CHANGED
@@ -1692,7 +1692,7 @@ function createThreadStreamService(ctx, runs) {
1692
1692
  }
1693
1693
 
1694
1694
  // src/service.ts
1695
- function buildProtocolService(ctx) {
1695
+ function createProtocolServiceFromContext(ctx) {
1696
1696
  const runs = createRunService(ctx);
1697
1697
  const threads = createThreadService(ctx);
1698
1698
  return {
@@ -1707,8 +1707,9 @@ function buildProtocolService(ctx) {
1707
1707
  };
1708
1708
  }
1709
1709
  function createProtocolService(deps) {
1710
- return buildProtocolService(createContext(deps));
1710
+ return createProtocolServiceFromContext(createContext(deps));
1711
1711
  }
1712
+ var buildProtocolService = createProtocolServiceFromContext;
1712
1713
 
1713
1714
  // src/auth/auth-scoped-store.ts
1714
1715
  import {
@@ -1878,7 +1879,7 @@ var STUDIO_USER = {
1878
1879
  permissions: []
1879
1880
  };
1880
1881
  function createAuthorizingHandlers(context, engine) {
1881
- const baseHandlers = createProtocolHandlers(buildProtocolService(context));
1882
+ const baseHandlers = createProtocolHandlers(createProtocolServiceFromContext(context));
1882
1883
  const names = Object.keys(ROUTE_AUTHZ);
1883
1884
  const resolveAuthContext = async (req) => {
1884
1885
  if (!engine.studioAuthDisabled && req.headers["x-auth-scheme"] === "langsmith") {
@@ -1907,7 +1908,7 @@ function createAuthorizingHandlers(context, engine) {
1907
1908
  store: createAuthScopedStore(context.deps.store, engine, filters, route.resource)
1908
1909
  } : context.deps
1909
1910
  };
1910
- return createProtocolHandlers(buildProtocolService(requestContext))[name](req);
1911
+ return createProtocolHandlers(createProtocolServiceFromContext(requestContext))[name](req);
1911
1912
  };
1912
1913
  }
1913
1914
  return wrapped;
@@ -1977,7 +1978,7 @@ function createRunWorker(ctx, options = {}) {
1977
1978
  // src/runtime.ts
1978
1979
  function createProtocolRuntime(deps, options = {}) {
1979
1980
  const context = createContext(deps);
1980
- const service = buildProtocolService(context);
1981
+ const service = createProtocolServiceFromContext(context);
1981
1982
  const handlers = deps.auth ? createAuthorizingHandlers(context, deps.auth) : createProtocolHandlers(service);
1982
1983
  return {
1983
1984
  service,
@@ -2051,12 +2052,13 @@ var skeinRoutes = [
2051
2052
  { method: "post", path: "/store/items/search", handler: "searchStoreItems" },
2052
2053
  { method: "post", path: "/store/namespaces", handler: "listStoreNamespaces" }
2053
2054
  ];
2054
- function foldThreadId(request) {
2055
+ function copyThreadIdIntoBody(request) {
2055
2056
  const threadId = request.params["thread_id"];
2056
2057
  if (threadId === void 0) return request;
2057
2058
  const base = typeof request.body === "object" && request.body !== null && !Array.isArray(request.body) ? request.body : {};
2058
2059
  return { ...request, body: { ...base, thread_id: threadId } };
2059
2060
  }
2061
+ var foldThreadId = copyThreadIdIntoBody;
2060
2062
  var compiledRoutes = skeinRoutes.map((binding) => ({
2061
2063
  binding,
2062
2064
  regex: new RegExp(`^${binding.path.replace(/:(\w+)/g, "(?<$1>[^/]+)")}$`)
@@ -2085,10 +2087,12 @@ export {
2085
2087
  SSE_HEADERS,
2086
2088
  SkeinBaseStore,
2087
2089
  buildProtocolService,
2090
+ copyThreadIdIntoBody,
2088
2091
  createContext,
2089
2092
  createProtocolHandlers,
2090
2093
  createProtocolRuntime,
2091
2094
  createProtocolService,
2095
+ createProtocolServiceFromContext,
2092
2096
  createRunWorker,
2093
2097
  encodeFrame,
2094
2098
  encodeTerminal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skein-js/agent-protocol",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
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.6.3"
47
+ "@skein-js/core": "0.7.0"
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.6.3"
54
+ "@skein-js/storage-memory": "0.7.0"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"