@skein-js/storage-memory 0.1.0 β†’ 0.2.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 (2) hide show
  1. package/README.md +62 -15
  2. package/package.json +7 -6
package/README.md CHANGED
@@ -1,45 +1,92 @@
1
1
  # @skein-js/storage-memory
2
2
 
3
- > In-memory SkeinStore + queue driver for development and tests.
3
+ > In-memory `SkeinStore` + run queue + event bus for development and tests.
4
4
 
5
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.
6
6
 
7
- **Status:** 🚧 Pre-alpha β€” implemented and passing the shared conformance suite.
7
+ **Status:** 🚧 Pre-alpha β€” implemented; passes the shared `SkeinStore` conformance suite.
8
8
 
9
9
  ## What it does
10
10
 
11
- Zero-dependency, in-process drivers that power `skein dev`:
11
+ Zero-dependency, in-process drivers that power `skein dev` and back the test fixtures. They
12
+ implement the [`@skein-js/core`](../core) contracts, so the engine uses them unchanged:
12
13
 
13
- - **`MemorySkeinStore`** — `SkeinStore` over plain `Map`s (assistants / threads / runs / store items), with the run-concurrency guard, thread→runs cascade delete, and naive prefix/substring store search. Every read and write deep-clones at the boundary — like a real serializing driver — so callers can't mutate stored rows or corrupt the store through a retained input.
14
+ - **`MemorySkeinStore`** β€” a `SkeinStore` over plain `Map`s (assistants / threads / runs / store
15
+ items), with the run-concurrency guard, thread→runs cascade delete, and naive prefix/substring
16
+ store search. Every read and write **deep-clones at the boundary** β€” like a real serializing
17
+ driver β€” so callers can't mutate stored rows or corrupt the store through a retained reference.
14
18
  - **`MemoryRunQueue`** β€” a single-process FIFO of background runs.
15
- - **`MemoryRunEventBus`** β€” buffered run-frame pub/sub with replay (`afterSeq`) and live-tail, so a client can join a run's stream late or reconnect.
19
+ - **`MemoryRunEventBus`** β€” buffered run-frame pub/sub with replay (`afterSeq`) and live-tail, so a
20
+ client can join a run's stream late or reconnect.
16
21
 
17
- Validated against the shared `SkeinStore` conformance suite, so it behaves identically to the Postgres driver.
22
+ Validated against the shared `SkeinStore` conformance suite, so it behaves **identically** to the
23
+ Postgres driver β€” the same tests run against both.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pnpm add @skein-js/storage-memory
29
+ ```
30
+
31
+ No peer dependencies. Pair it with `MemorySaver` (from `@langchain/langgraph`) as the graph
32
+ checkpointer β€” this package stores only Agent Protocol _resources_, never graph state.
18
33
 
19
34
  ## Usage
20
35
 
36
+ Construct with `new` β€” there is no connect/migrate step:
37
+
21
38
  ```ts
22
39
  import { MemorySkeinStore, MemoryRunQueue, MemoryRunEventBus } from "@skein-js/storage-memory";
23
40
 
24
41
  const store = new MemorySkeinStore();
25
42
  const thread = await store.threads.create({ metadata: { user: "a" } });
43
+ await store.threads.get(thread.thread_id);
26
44
  ```
27
45
 
28
- ## Reuse
46
+ Wired into an engine as a full set of in-memory drivers (this is what `skein dev` does):
29
47
 
30
- Pairs with `MemorySaver` from `@langchain/langgraph-checkpoint` for graph checkpoints β€” it stores only Agent Protocol _resources_, never graph state.
48
+ ```ts
49
+ import { MemorySaver } from "@langchain/langgraph";
50
+ import { createProtocolRuntime } from "@skein-js/agent-protocol";
51
+ import { MemoryRunEventBus, MemoryRunQueue, MemorySkeinStore } from "@skein-js/storage-memory";
52
+
53
+ const runtime = createProtocolRuntime({
54
+ store: new MemorySkeinStore(),
55
+ queue: new MemoryRunQueue(),
56
+ bus: new MemoryRunEventBus(),
57
+ checkpointer: new MemorySaver(),
58
+ graphs, // a GraphResolver, e.g. from @skein-js/config
59
+ });
60
+ ```
31
61
 
32
- ## Install
62
+ ## API
63
+
64
+ - **`class MemorySkeinStore implements SkeinStore`** β€” `new MemorySkeinStore()`. Exposes the four
65
+ repos (`assistants`, `threads`, `runs`, `store`) defined by [`SkeinStore`](../core). Plus two
66
+ methods used by `skein dev`'s persistence:
67
+ - `snapshot(): MemoryStoreSnapshot` β€” serialize all rows.
68
+ - `hydrate(snapshot: MemoryStoreSnapshot): void` β€” restore a snapshot (used to survive restarts).
69
+ - **`interface MemoryStoreSnapshot`** β€” the serialized form (`assistants` / `threads` / `runs` /
70
+ `runKwargs` / `items` entry arrays).
71
+ - **`class MemoryRunQueue implements RunQueue`** β€” `new MemoryRunQueue()`.
72
+ `enqueue(run)` Β· `consume(process, options?)` (`options.concurrency` default `1`) β†’ a `RunConsumer`
73
+ with `close(force?)`.
74
+ - **`class MemoryRunEventBus implements RunEventBus`** β€”
75
+ `new MemoryRunEventBus(options?: { maxRetainedRuns?: number })` (default `1000`; LRU-evicts closed
76
+ runs' buffers). `publish(runId, frame)` Β· `close(runId)` Β· `subscribe(runId, afterSeq = 0)`.
77
+
78
+ See [`@skein-js/core`](../core) for the full `SkeinStore` / `RunQueue` / `RunEventBus` method
79
+ signatures these implement.
33
80
 
34
- ```bash
35
- pnpm add @skein-js/storage-memory
36
- ```
81
+ ## Reuse
82
+
83
+ Pairs with `MemorySaver` (re-exported from `@langchain/langgraph`) for graph checkpoints β€” it stores
84
+ only Agent Protocol _resources_, never graph state.
37
85
 
38
86
  ## Learn more
39
87
 
40
- - [skein-js overview](../../docs/index.md)
41
- - [Reuse-first architecture](../../docs/reuse.md)
42
- - [Roadmap](../../docs/roadmap.md)
88
+ - [Storage](../../docs/storage.md) Β· [Runs & Redis](../../docs/runs-and-redis.md)
89
+ - [skein-js overview](../../docs/index.md) Β· [Reuse-first architecture](../../docs/reuse.md)
43
90
 
44
91
  ## License
45
92
 
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@skein-js/storage-memory",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "In-memory SkeinStore + queue driver for development and tests.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Maina Wycliffe <wmmaina7@gmail.com>",
7
- "homepage": "https://github.com/mainawycliffe/skein/tree/main/packages/storage-memory#readme",
7
+ "homepage": "https://github.com/mainawycliffe/skein-js/tree/main/packages/storage-memory#readme",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/mainawycliffe/skein.git",
10
+ "url": "git+https://github.com/mainawycliffe/skein-js.git",
11
11
  "directory": "packages/storage-memory"
12
12
  },
13
13
  "bugs": {
14
- "url": "https://github.com/mainawycliffe/skein/issues"
14
+ "url": "https://github.com/mainawycliffe/skein-js/issues"
15
15
  },
16
16
  "keywords": [
17
+ "typescript",
17
18
  "langgraph",
18
19
  "agent-protocol",
19
20
  "storage",
@@ -39,10 +40,10 @@
39
40
  "node": ">=20"
40
41
  },
41
42
  "dependencies": {
42
- "@skein-js/core": "0.1.0"
43
+ "@skein-js/core": "0.2.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@skein-js/test-support": "0.0.0"
46
+ "@skein-js/test-support": "0.2.0"
46
47
  },
47
48
  "publishConfig": {
48
49
  "access": "public"