@skein-js/agent-protocol 0.2.0 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +27 -6
  2. package/dist/index.js +18 -2
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -2,10 +2,26 @@
2
2
 
3
3
  > The framework-agnostic Agent Protocol **engine** — run engine, handler table, and SSE mapping. The heart of skein-js.
4
4
 
5
- Part of **[skein-js](https://github.com/mainawycliffe/skein)** — a TypeScript [Agent Protocol](https://github.com/langchain-ai/agent-protocol) server for [LangGraph.js](https://github.com/langchain-ai/langgraphjs), and a drop-in replacement for the LangGraph CLI.
5
+ Part of **[skein-js](../../README.md)** — a TypeScript [Agent Protocol](https://github.com/langchain-ai/agent-protocol) server for [LangGraph.js](https://github.com/langchain-ai/langgraphjs), and a drop-in replacement for the LangGraph CLI.
6
6
 
7
7
  **Status:** 🚧 Pre-alpha — implemented. Depends only on the [`@skein-js/core`](../core) contracts and is designed to be consumed on its own.
8
8
 
9
+ This is **the engine** at the heart of skein-js: a complete, framework-agnostic implementation of the
10
+ Agent Protocol for LangGraph.js. Build your own server on it — any HTTP framework, any storage/queue —
11
+ by injecting a [`ProtocolDeps`](#the-injected-contract-protocoldeps).
12
+
13
+ ## Contents
14
+
15
+ - [What it does](#what-it-does)
16
+ - [Install](#install)
17
+ - [Usage](#usage)
18
+ - [Two layers](#two-layers)
19
+ - [The injected contract (`ProtocolDeps`)](#the-injected-contract-protocoldeps)
20
+ - [API](#api)
21
+ - [Reuse](#reuse)
22
+ - [Learn more](#learn-more)
23
+ - [License](#license)
24
+
9
25
  ## What it does
10
26
 
11
27
  The **run engine + protocol handler table + SSE mapping**, and nothing else. It has no opinion about
@@ -17,12 +33,16 @@ client.
17
33
 
18
34
  ## Install
19
35
 
20
- ```sh
21
- npm install @skein-js/agent-protocol @skein-js/core @langchain/langgraph @langchain/langgraph-sdk
36
+ ```bash
37
+ pnpm add @skein-js/agent-protocol @skein-js/core
22
38
  ```
23
39
 
24
- `@langchain/langgraph` and `@langchain/langgraph-sdk` are peer dependencies; `@skein-js/core` is a
25
- regular dependency you should pin alongside.
40
+ `@langchain/langgraph` and `@langchain/langgraph-sdk` are peer dependencies install them too if
41
+ your project doesn't already depend on them:
42
+
43
+ ```bash
44
+ pnpm add @langchain/langgraph @langchain/langgraph-sdk
45
+ ```
26
46
 
27
47
  ## Usage
28
48
 
@@ -108,7 +128,8 @@ from `@langchain/langgraph-sdk` via [`@skein-js/core`](../core).
108
128
  ## Learn more
109
129
 
110
130
  - [Agent Protocol surface](../../docs/agent-protocol.md) · [Streaming (SSE)](../../docs/streaming.md) · [Runs & Redis](../../docs/runs-and-redis.md)
111
- - [skein-js overview](../../docs/index.md) · [Reuse-first architecture](../../docs/reuse.md)
131
+ - [Building your own adapter](../../docs/building-an-adapter.md) mount this engine on any HTTP framework
132
+ - [skein-js overview](../../docs/index.md) · [Reuse-first architecture](../../docs/reuse.md) · [Root README](../../README.md)
112
133
 
113
134
  ## License
114
135
 
package/dist/index.js CHANGED
@@ -1312,8 +1312,21 @@ function createAuthorizingHandlers(context, engine) {
1312
1312
  }
1313
1313
 
1314
1314
  // src/runs/run-worker.ts
1315
- import { isTerminalRunStatus as isTerminalRunStatus6 } from "@skein-js/core";
1315
+ import {
1316
+ isTerminalRunStatus as isTerminalRunStatus6
1317
+ } from "@skein-js/core";
1316
1318
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1319
+ function logRunLifecycle(logger, run, status, startedAt, endedAt) {
1320
+ logger.info(status === "success" ? "Background run succeeded" : `Background run ${status}`, {
1321
+ run_id: run.run_id,
1322
+ run_attempt: 1,
1323
+ run_created_at: run.created_at,
1324
+ run_started_at: new Date(startedAt).toISOString(),
1325
+ run_ended_at: new Date(endedAt).toISOString(),
1326
+ run_exec_ms: endedAt - startedAt,
1327
+ run_queue_ms: startedAt - Date.parse(run.created_at)
1328
+ });
1329
+ }
1317
1330
  function createRunWorker(ctx, options = {}) {
1318
1331
  const { deps, control } = ctx;
1319
1332
  const maxConcurrency = options.maxConcurrency ?? 1;
@@ -1325,9 +1338,12 @@ function createRunWorker(ctx, options = {}) {
1325
1338
  const kwargs = await deps.store.runs.getKwargs(queued.run_id) ?? {};
1326
1339
  const runControl = control.register(queued.run_id);
1327
1340
  inFlight.add(queued.run_id);
1341
+ const startedAt = Date.now();
1342
+ let status = "error";
1328
1343
  try {
1329
- await executeRun(deps, { run, kwargs, control: runControl });
1344
+ status = (await executeRun(deps, { run, kwargs, control: runControl })).status;
1330
1345
  } finally {
1346
+ logRunLifecycle(deps.logger, run, status, startedAt, Date.now());
1331
1347
  control.clear(queued.run_id);
1332
1348
  inFlight.delete(queued.run_id);
1333
1349
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skein-js/agent-protocol",
3
- "version": "0.2.0",
3
+ "version": "0.3.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.2.0"
47
+ "@skein-js/core": "0.3.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.2.0"
54
+ "@skein-js/storage-memory": "0.3.0"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"