@graphrefly/ts 0.0.2 → 0.0.3
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 +197 -117
- package/dist/{actions-types-wl9Mgkmr.d.cts → actions-types-CH-XCU9O.d.cts} +4 -4
- package/dist/{actions-types-CSC3NMDl.d.ts → actions-types-w2iPQTkv.d.ts} +4 -4
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +10 -10
- package/dist/adapters/index.d.ts +10 -10
- package/dist/adapters/index.js +7 -7
- package/dist/adapters/nestjs/microservices.d.cts +3 -3
- package/dist/adapters/nestjs/microservices.d.ts +3 -3
- package/dist/adapters/nestjs/native.cjs.map +1 -1
- package/dist/adapters/nestjs/native.d.cts +4 -4
- package/dist/adapters/nestjs/native.d.ts +4 -4
- package/dist/adapters/nestjs/native.js +3 -3
- package/dist/adapters/nestjs/websockets.d.cts +3 -3
- package/dist/adapters/nestjs/websockets.d.ts +3 -3
- package/dist/adapters/nestjs.d.cts +3 -3
- package/dist/adapters/nestjs.d.ts +3 -3
- package/dist/adapters/observe-storage.d.cts +3 -3
- package/dist/adapters/observe-storage.d.ts +3 -3
- package/dist/adapters/react.d.cts +2 -2
- package/dist/adapters/react.d.ts +2 -2
- package/dist/adapters/solid.d.cts +2 -2
- package/dist/adapters/solid.d.ts +2 -2
- package/dist/adapters/svelte.d.cts +2 -2
- package/dist/adapters/svelte.d.ts +2 -2
- package/dist/adapters/vue.d.cts +2 -2
- package/dist/adapters/vue.d.ts +2 -2
- package/dist/{agent-runtime-types-core-hU299uIC.d.ts → agent-runtime-types-core-CKwrBDyi.d.ts} +1 -1
- package/dist/{agent-runtime-types-core-CaXfKNtY.d.cts → agent-runtime-types-core-bfl4m0vM.d.cts} +1 -1
- package/dist/{agent-runtime-types-tool-DninPEzk.d.cts → agent-runtime-types-tool-BLPV3azj.d.cts} +4 -4
- package/dist/{agent-runtime-types-tool-BEpSINol.d.ts → agent-runtime-types-tool-hwqvVqNt.d.ts} +4 -4
- package/dist/{agentic-memory-retention-BmGX368S.d.ts → agentic-memory-retention-CLwI76JK.d.ts} +2 -2
- package/dist/{agentic-memory-retention-Ih1qhX9Z.d.cts → agentic-memory-retention-Cz8GR6ie.d.cts} +2 -2
- package/dist/{agentic-memory-types-FnnYlVUs.d.cts → agentic-memory-types-JDr7MPhh.d.cts} +2 -2
- package/dist/{agentic-memory-types-CVSUS6XR.d.ts → agentic-memory-types-khYJgzKL.d.ts} +2 -2
- package/dist/{capability-admission-lwSecxXs.d.cts → capability-admission-B8RNFyaZ.d.cts} +3 -3
- package/dist/{capability-admission-BW2CziT6.d.ts → capability-admission-Dkw1Xz3r.d.ts} +3 -3
- package/dist/{chunk-SIDJO2T4.js → chunk-3J7UPZL5.js} +6 -6
- package/dist/{chunk-ECURQ3HD.js → chunk-3LYI6ADX.js} +4 -4
- package/dist/chunk-3LYI6ADX.js.map +1 -0
- package/dist/{chunk-M7J6Z4IJ.js → chunk-4M37FH2I.js} +2 -2
- package/dist/chunk-4M37FH2I.js.map +1 -0
- package/dist/{chunk-CJIFGJQG.js → chunk-54WPEODM.js} +2 -2
- package/dist/chunk-54WPEODM.js.map +1 -0
- package/dist/{chunk-CX6B6PO2.js → chunk-DKFWDTVY.js} +2 -2
- package/dist/chunk-DKFWDTVY.js.map +1 -0
- package/dist/{chunk-SHZDP2MQ.js → chunk-GXU6WFEJ.js} +1 -1
- package/dist/chunk-GXU6WFEJ.js.map +1 -0
- package/dist/{chunk-YDWBXXQZ.js → chunk-KFURM6FM.js} +3 -3
- package/dist/{chunk-STXRMPW4.js → chunk-MCOFHMUU.js} +2 -2
- package/dist/{chunk-EOKT4QFF.js → chunk-NNDIFUKX.js} +3 -3
- package/dist/chunk-NNDIFUKX.js.map +1 -0
- package/dist/{chunk-TPND5MJS.js → chunk-PUSRRALM.js} +3 -3
- package/dist/{chunk-7HZRJMN6.js → chunk-UEMN5URK.js} +2 -2
- package/dist/{chunk-2NJP6GO4.js → chunk-WOS7RJYZ.js} +2 -2
- package/dist/composition/index.cjs.map +1 -1
- package/dist/composition/index.d.cts +3 -3
- package/dist/composition/index.d.ts +3 -3
- package/dist/composition/index.js +3 -3
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +23 -2
- package/dist/core/index.d.ts +23 -2
- package/dist/core/index.js +1 -1
- package/dist/cqrs/index.d.cts +3 -3
- package/dist/cqrs/index.d.ts +3 -3
- package/dist/cqrs/messaging.d.cts +4 -4
- package/dist/cqrs/messaging.d.ts +4 -4
- package/dist/cqrs/work-queue.d.cts +5 -5
- package/dist/cqrs/work-queue.d.ts +5 -5
- package/dist/data-structures/index.cjs.map +1 -1
- package/dist/data-structures/index.d.cts +8 -8
- package/dist/data-structures/index.d.ts +8 -8
- package/dist/data-structures/index.js +4 -4
- package/dist/{describe-CQRrkv-Q.d.cts → describe-BumQ-3_0.d.cts} +1 -1
- package/dist/{describe-B_A5fbXH.d.ts → describe-cYr_Z5zm.d.ts} +1 -1
- package/dist/executors/tool-provider-adapters.d.cts +7 -7
- package/dist/executors/tool-provider-adapters.d.ts +7 -7
- package/dist/executors/tool-provider-adapters.js +5 -5
- package/dist/executors/tool-provider-runtime.cjs.map +1 -1
- package/dist/executors/tool-provider-runtime.d.cts +8 -8
- package/dist/executors/tool-provider-runtime.d.ts +8 -8
- package/dist/executors/tool-provider-runtime.js +2 -2
- package/dist/executors/tool-provider.cjs.map +1 -1
- package/dist/executors/tool-provider.d.cts +7 -7
- package/dist/executors/tool-provider.d.ts +7 -7
- package/dist/executors/tool-provider.js +2 -2
- package/dist/executors/work-queue.d.cts +6 -6
- package/dist/executors/work-queue.d.ts +6 -6
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +9 -9
- package/dist/graph/index.d.ts +9 -9
- package/dist/graph/index.js +7 -7
- package/dist/{graph-CWK3HLPB.d.cts → graph-C1C-wb0L.d.cts} +135 -8
- package/dist/{graph-ho5sotHP.d.ts → graph-CS0b4V9B.d.ts} +135 -8
- package/dist/{index-CQWcE0Dw.d.ts → index-DLrNopda.d.cts} +135 -8
- package/dist/{index-DHA1i67c.d.cts → index-DzJni3_6.d.ts} +135 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +13 -13
- package/dist/inspection/boundary.d.cts +4 -4
- package/dist/inspection/boundary.d.ts +4 -4
- package/dist/{measurements-OMpCeBwh.d.ts → measurements-BWAnochv.d.ts} +139 -9
- package/dist/{measurements-C0mAvWU1.d.cts → measurements-B_gJfD8h.d.cts} +139 -9
- package/dist/messaging/index.d.cts +5 -5
- package/dist/messaging/index.d.ts +5 -5
- package/dist/operators/index.cjs.map +1 -1
- package/dist/operators/index.d.cts +5 -5
- package/dist/operators/index.d.ts +5 -5
- package/dist/operators/index.js +4 -4
- package/dist/orchestration/index.cjs.map +1 -1
- package/dist/orchestration/index.d.cts +12 -12
- package/dist/orchestration/index.d.ts +12 -12
- package/dist/orchestration/index.js +5 -5
- package/dist/orchestration/messaging.d.cts +5 -5
- package/dist/orchestration/messaging.d.ts +5 -5
- package/dist/orchestration/work-queue.d.cts +8 -8
- package/dist/orchestration/work-queue.d.ts +8 -8
- package/dist/patterns/event-flow.d.cts +4 -4
- package/dist/patterns/event-flow.d.ts +4 -4
- package/dist/patterns/index.d.cts +6 -6
- package/dist/patterns/index.d.ts +6 -6
- package/dist/{process-types-h3uRlzDc.d.cts → process-types-BB7oRhX3.d.cts} +1 -1
- package/dist/{process-types-C9uMYz3i.d.ts → process-types-QNhyoYJ8.d.ts} +1 -1
- package/dist/{reactive-collection-B9R0Bl1P.d.cts → reactive-collection-BYlWvtnp.d.cts} +3 -3
- package/dist/{reactive-collection-BXFrH0U2.d.ts → reactive-collection-efOEdGFN.d.ts} +3 -3
- package/dist/{reactive-collection-storage-BLGv8Xp8.d.cts → reactive-collection-storage-BjoLsoiC.d.cts} +5 -5
- package/dist/{reactive-collection-storage-a4zD3665.d.ts → reactive-collection-storage-DwW6UuK_.d.ts} +5 -5
- package/dist/{reactive-map-jle5dnok.d.ts → reactive-map-BHacbIqz.d.cts} +7 -3
- package/dist/{reactive-map-C_8sOfdS.d.cts → reactive-map-DN4Jyqnf.d.ts} +7 -3
- package/dist/render/index.d.cts +2 -2
- package/dist/render/index.d.ts +2 -2
- package/dist/{scheduled-readiness-5rwQlyjV.d.ts → scheduled-readiness-BmqXxnzX.d.ts} +3 -3
- package/dist/{scheduled-readiness-DpRY8jI0.d.cts → scheduled-readiness-CYSw7KDE.d.cts} +3 -3
- package/dist/{semantic-memory-graph-DlZBD_Eu.d.cts → semantic-memory-graph-B_LwbM-E.d.cts} +2 -2
- package/dist/{semantic-memory-graph-C2ZUwIlq.d.ts → semantic-memory-graph-rsFNNhwn.d.ts} +2 -2
- package/dist/{semantic-memory-graph-types-BvzdqmkY.d.cts → semantic-memory-graph-types-Y73bbwVI.d.cts} +1 -1
- package/dist/{semantic-memory-graph-types-Ci-OtahO.d.ts → semantic-memory-graph-types-safmPkuX.d.ts} +1 -1
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +11 -11
- package/dist/solutions/index.d.ts +11 -11
- package/dist/solutions/index.js +2 -2
- package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/browser/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/browser/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/browser/index.js +2 -2
- package/dist/solutions/reactive-layout/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/index.d.cts +6 -6
- package/dist/solutions/reactive-layout/index.d.ts +6 -6
- package/dist/solutions/reactive-layout/index.js +2 -2
- package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/node-canvas/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.js +2 -2
- package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/react-native/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.js +2 -2
- package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/skia/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/skia/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/skia/index.js +2 -2
- package/dist/solutions/work-item/actions.d.cts +10 -10
- package/dist/solutions/work-item/actions.d.ts +10 -10
- package/dist/solutions/work-item/scheduling.d.cts +9 -9
- package/dist/solutions/work-item/scheduling.d.ts +9 -9
- package/dist/solutions/work-item/work-queue.d.cts +7 -7
- package/dist/solutions/work-item/work-queue.d.ts +7 -7
- package/dist/sources/browser.cjs.map +1 -1
- package/dist/sources/browser.d.cts +22 -6
- package/dist/sources/browser.d.ts +22 -6
- package/dist/sources/browser.js +3 -3
- package/dist/sources/browser.js.map +1 -1
- package/dist/sources/index.cjs.map +1 -1
- package/dist/sources/index.d.cts +4 -4
- package/dist/sources/index.d.ts +4 -4
- package/dist/sources/index.js +3 -3
- package/dist/sources/node.d.cts +3 -3
- package/dist/sources/node.d.ts +3 -3
- package/dist/storage/index.d.cts +5 -5
- package/dist/storage/index.d.ts +5 -5
- package/dist/{store-BmtEs9mG.d.ts → store-6_CHF6Ge.d.ts} +1 -1
- package/dist/{store-PAAsYvML.d.cts → store-BljX8RkQ.d.cts} +1 -1
- package/dist/{types-BhveCMg5.d.cts → types-BAw2QVVE.d.cts} +1 -1
- package/dist/{types-XDoqxYO9.d.cts → types-BUbbbh4f.d.cts} +1 -1
- package/dist/{types-BWK2ay3e.d.cts → types-CMnzoL54.d.cts} +2 -2
- package/dist/{types-BS6CyR-x.d.cts → types-CTN3XoMl.d.cts} +30 -0
- package/dist/{types-BXKSAoE1.d.cts → types-CV_ohy5T.d.cts} +2 -2
- package/dist/{types-C9NOgNJw.d.ts → types-DChxk1vK.d.ts} +30 -0
- package/dist/{types-CTsQ8Ww4.d.ts → types-DRu7SnLV.d.ts} +1 -1
- package/dist/{types-DL_05n2M.d.ts → types-DeID_FRl.d.ts} +1 -1
- package/dist/{types-BRNKoFHj.d.ts → types-IhKH0hGW.d.ts} +2 -2
- package/dist/{types-BaPpZItj.d.ts → types-ePlD2uyT.d.ts} +2 -2
- package/dist/{work-item-runtime-types-CHO03AKh.d.cts → work-item-runtime-types-BTxLskN5.d.cts} +2 -2
- package/dist/{work-item-runtime-types-BqtWnSCS.d.ts → work-item-runtime-types-DAsZbb2y.d.ts} +2 -2
- package/dist/work-queue/index.d.cts +6 -6
- package/dist/work-queue/index.d.ts +6 -6
- package/package.json +9 -1
- package/dist/chunk-CJIFGJQG.js.map +0 -1
- package/dist/chunk-CX6B6PO2.js.map +0 -1
- package/dist/chunk-ECURQ3HD.js.map +0 -1
- package/dist/chunk-EOKT4QFF.js.map +0 -1
- package/dist/chunk-M7J6Z4IJ.js.map +0 -1
- package/dist/chunk-SHZDP2MQ.js.map +0 -1
- /package/dist/{chunk-SIDJO2T4.js.map → chunk-3J7UPZL5.js.map} +0 -0
- /package/dist/{chunk-YDWBXXQZ.js.map → chunk-KFURM6FM.js.map} +0 -0
- /package/dist/{chunk-STXRMPW4.js.map → chunk-MCOFHMUU.js.map} +0 -0
- /package/dist/{chunk-TPND5MJS.js.map → chunk-PUSRRALM.js.map} +0 -0
- /package/dist/{chunk-7HZRJMN6.js.map → chunk-UEMN5URK.js.map} +0 -0
- /package/dist/{chunk-2NJP6GO4.js.map → chunk-WOS7RJYZ.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1,135 +1,215 @@
|
|
|
1
1
|
# @graphrefly/ts
|
|
2
2
|
|
|
3
|
-
Clean-slate TypeScript implementation of GraphReFly
|
|
4
|
-
sources, storage, messaging, work queues, orchestration, CQRS, render, and tests.
|
|
3
|
+
Clean-slate TypeScript implementation of GraphReFly.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
GraphReFly is a synchronous reactive graph runtime. You compose nodes, push data
|
|
6
|
+
through explicit messages, inspect the live graph, and keep async work at clear
|
|
7
|
+
source/adapter/executor boundaries.
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install @graphrefly/ts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { graph } from "@graphrefly/ts";
|
|
17
|
+
|
|
18
|
+
const g = graph({ name: "example" });
|
|
19
|
+
|
|
20
|
+
const count = g.state(0, { name: "count" });
|
|
21
|
+
const doubled = g.derived([count], (n) => n * 2, { name: "doubled" });
|
|
22
|
+
|
|
23
|
+
doubled.subscribe((msg) => {
|
|
24
|
+
if (msg[0] === "DATA") console.log("doubled", msg[1]);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
count.set(3);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The graph can also describe itself:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
console.log(g.topology());
|
|
34
|
+
console.log(g.describe());
|
|
35
|
+
```
|
|
11
36
|
|
|
12
|
-
|
|
13
|
-
execution:
|
|
37
|
+
## Core Ideas
|
|
14
38
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
- `state` is the sanctioned external input boundary.
|
|
40
|
+
- `derived` computes from declared dependencies.
|
|
41
|
+
- `producer` and source factories create graph-visible input streams.
|
|
42
|
+
- `effect` performs side effects from graph-visible values.
|
|
43
|
+
- Operators are node factories, not a second runtime.
|
|
44
|
+
- `describe()`, `topology()`, `observe()`, and `profile()` are read-only
|
|
45
|
+
inspection surfaces.
|
|
19
46
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
47
|
+
The wave core is synchronous. Promises, timers, fetches, subprocesses, workers,
|
|
48
|
+
and remote bridges belong at source, adapter, executor, worker, or wire-bridge
|
|
49
|
+
boundaries. Results re-enter the graph as facts, commands, or messages.
|
|
50
|
+
|
|
51
|
+
## Common Imports
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { graph } from "@graphrefly/ts/graph";
|
|
55
|
+
import { map, filter, scan, switchMap } from "@graphrefly/ts/operators";
|
|
56
|
+
import { fromPromise, fromEvent, timer } from "@graphrefly/ts/sources";
|
|
57
|
+
import { memoryKv } from "@graphrefly/ts/storage";
|
|
58
|
+
import { describeToMermaid } from "@graphrefly/ts/render";
|
|
59
|
+
```
|
|
23
60
|
|
|
24
|
-
The
|
|
61
|
+
The package also exports the common surface from the root:
|
|
25
62
|
|
|
26
63
|
```ts
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} from "@graphrefly/ts";
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
const queue = workQueue<HttpTask>(g, {
|
|
42
|
-
queueId: "http",
|
|
43
|
-
bus,
|
|
44
|
-
topic: "http-work",
|
|
45
|
-
subscriptionId: "http-worker-input",
|
|
64
|
+
import { graph, map, timer, memoryKv } from "@graphrefly/ts";
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Operators
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { graph, map, scan } from "@graphrefly/ts";
|
|
71
|
+
|
|
72
|
+
const g = graph({ name: "counter" });
|
|
73
|
+
const count = g.state(0, { name: "count" });
|
|
74
|
+
|
|
75
|
+
const doubled = g.initNode(map((n: number) => n * 2), [count], { name: "doubled" });
|
|
76
|
+
const total = g.initNode(scan((acc: number, n: number) => acc + n, 0), [doubled], {
|
|
77
|
+
name: "total",
|
|
46
78
|
});
|
|
47
79
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})
|
|
113
|
-
.finally(() => {
|
|
114
|
-
inFlight.delete(record.workId);
|
|
115
|
-
refill();
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
refill();
|
|
120
|
-
return unsubscribe;
|
|
80
|
+
count.set(1);
|
|
81
|
+
count.set(2);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Available operator families include transform, filter, accumulation, combine,
|
|
85
|
+
buffer, higher-order, time, control, and error handling operators.
|
|
86
|
+
|
|
87
|
+
## Sources
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { graph, timer } from "@graphrefly/ts";
|
|
91
|
+
|
|
92
|
+
const g = graph({ name: "clock" });
|
|
93
|
+
const tick = g.initNode(timer(1000), [], { name: "tick" });
|
|
94
|
+
|
|
95
|
+
tick.subscribe((msg) => {
|
|
96
|
+
if (msg[0] === "DATA") console.log(msg[1]);
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Sources include scalar values, sync and async iterables, promises, timers,
|
|
101
|
+
events, push notifications, HTTP/SSE/WebSocket driver boundaries, webhooks, and
|
|
102
|
+
cron-like schedules. Node-only process and filesystem helpers live under
|
|
103
|
+
`@graphrefly/ts/sources/node`.
|
|
104
|
+
|
|
105
|
+
## Inspection And Rendering
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { describeToMermaid, graph } from "@graphrefly/ts";
|
|
109
|
+
|
|
110
|
+
const g = graph({ name: "pricing" });
|
|
111
|
+
const price = g.state(100, { name: "price" });
|
|
112
|
+
const tax = g.derived([price], (p) => p * 0.0825, { name: "tax" });
|
|
113
|
+
g.derived([price, tax], (p, t) => p + t, { name: "total" });
|
|
114
|
+
|
|
115
|
+
const topology = g.topology();
|
|
116
|
+
const snapshot = g.describe();
|
|
117
|
+
const mermaid = describeToMermaid(snapshot);
|
|
118
|
+
const stop = g.observe().subscribe((event) => console.log(event));
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Use `topology()` for pure structure, `describe()` for richer developer
|
|
122
|
+
inspection, `observe()` for message egress, and render helpers for Mermaid, D2,
|
|
123
|
+
ASCII, JSON, and pretty text.
|
|
124
|
+
|
|
125
|
+
## Storage And Restore
|
|
126
|
+
|
|
127
|
+
Storage helpers are passive. They store facts, frames, snapshots, checkpoints,
|
|
128
|
+
and event logs, but they do not own graph hydration.
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import { defaultRestoreRegistry, graph, memoryKv, restoreGraph } from "@graphrefly/ts";
|
|
132
|
+
|
|
133
|
+
const g = graph({ name: "counter" });
|
|
134
|
+
const count = g.state(1, { name: "count", restore: { ref: "state" } });
|
|
135
|
+
count.set(2);
|
|
136
|
+
|
|
137
|
+
const checkpoint = g.checkpoint();
|
|
138
|
+
const kv = memoryKv();
|
|
139
|
+
await kv.put("checkpoint:counter", checkpoint);
|
|
140
|
+
|
|
141
|
+
const saved = await kv.get("checkpoint:counter");
|
|
142
|
+
if (saved !== undefined) {
|
|
143
|
+
const restored = restoreGraph(saved, { registry: defaultRestoreRegistry });
|
|
121
144
|
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Reactive Collections
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { graph, reactiveMap } from "@graphrefly/ts";
|
|
122
151
|
|
|
123
|
-
const
|
|
152
|
+
const g = graph({ name: "inventory" });
|
|
153
|
+
const items = reactiveMap<string, { stock: number }>();
|
|
154
|
+
|
|
155
|
+
items.set("sku-1", { stock: 3 });
|
|
156
|
+
|
|
157
|
+
g.effect([items.snapshot], (snapshot) => {
|
|
158
|
+
console.log(snapshot.get("sku-1"));
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The package includes `reactiveMap`, `reactiveList`, `reactiveLog`,
|
|
163
|
+
`reactiveIndex`, collection persistence helpers, views, and cascading cache.
|
|
164
|
+
|
|
165
|
+
## Framework And Runtime Adapters
|
|
166
|
+
|
|
167
|
+
Focused adapter subpaths keep framework/runtime ownership explicit:
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import { useNodeValue as useReactNodeValue } from "@graphrefly/ts/adapters/react";
|
|
171
|
+
import { useNodeValue as useVueNodeValue } from "@graphrefly/ts/adapters/vue";
|
|
172
|
+
import { nodeReadable } from "@graphrefly/ts/adapters/svelte";
|
|
173
|
+
import { createNodeValue } from "@graphrefly/ts/adapters/solid";
|
|
124
174
|
```
|
|
125
175
|
|
|
126
|
-
|
|
127
|
-
queue remains responsible for claim/lease/retry/dead-letter facts; the runner is
|
|
128
|
-
responsible for ordinary JavaScript concurrency.
|
|
176
|
+
Other focused surfaces include:
|
|
129
177
|
|
|
130
|
-
|
|
178
|
+
- `@graphrefly/ts/adapters/nestjs`
|
|
179
|
+
- `@graphrefly/ts/adapters/observe-storage`
|
|
180
|
+
- `@graphrefly/ts/messaging`
|
|
181
|
+
- `@graphrefly/ts/work-queue`
|
|
182
|
+
- `@graphrefly/ts/orchestration`
|
|
183
|
+
- `@graphrefly/ts/cqrs`
|
|
184
|
+
- `@graphrefly/ts/executors/tool-provider`
|
|
185
|
+
- `@graphrefly/ts/executors/tool-provider-runtime`
|
|
186
|
+
- `@graphrefly/ts/executors/tool-provider-adapters`
|
|
187
|
+
- `@graphrefly/ts/solutions/reactive-layout`
|
|
188
|
+
- `@graphrefly/ts/solutions/work-item/actions`
|
|
189
|
+
- `@graphrefly/ts/solutions/work-item/scheduling`
|
|
131
190
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
191
|
+
## Package Status
|
|
192
|
+
|
|
193
|
+
This is the current TypeScript package. The old `@graphrefly/graphrefly` and
|
|
194
|
+
`@graphrefly/pure-ts` packages are retired and deprecated. New code should use
|
|
195
|
+
`@graphrefly/ts` and its focused subpaths.
|
|
196
|
+
|
|
197
|
+
`@graphrefly/ts` is pre-1.0. The package favors clean-slate correctness over
|
|
198
|
+
backward compatibility with retired APIs.
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
pnpm --filter @graphrefly/ts test
|
|
204
|
+
pnpm --filter @graphrefly/ts build
|
|
205
|
+
pnpm run lint
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Before publishing:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
pnpm test
|
|
212
|
+
pnpm run lint
|
|
213
|
+
pnpm run build
|
|
214
|
+
pnpm --filter @graphrefly/ts pack --pack-destination /tmp
|
|
215
|
+
```
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataIssue } from './data/index.cjs';
|
|
2
2
|
import { BoundaryCapabilityRef } from './inspection/boundary.cjs';
|
|
3
|
-
import { N as Node } from './types-
|
|
4
|
-
import { S as SourceRef, l as EffectRunGoal, h as AgentOutputEnvelope, a as AgentRuntimeAuditRecord, m as EffectRunLimits, k as EffectRunResultStatus, n as EffectRunResult } from './agent-runtime-types-core-
|
|
5
|
-
import { W as WorkItemEffectRequested, c as WorkItemDomainActionProposal, a as WorkItemEvidenceRecorded, d as WorkItemDomainActionProposalSpec, e as WorkItemDomainActionAdmission, f as WorkItemDomainActionAdmissionDecision } from './work-item-runtime-types-
|
|
6
|
-
import { C as CapabilityAdmission, g as CapabilityAdmissionStatus } from './capability-admission-
|
|
3
|
+
import { N as Node } from './types-CTN3XoMl.cjs';
|
|
4
|
+
import { S as SourceRef, l as EffectRunGoal, h as AgentOutputEnvelope, a as AgentRuntimeAuditRecord, m as EffectRunLimits, k as EffectRunResultStatus, n as EffectRunResult } from './agent-runtime-types-core-bfl4m0vM.cjs';
|
|
5
|
+
import { W as WorkItemEffectRequested, c as WorkItemDomainActionProposal, a as WorkItemEvidenceRecorded, d as WorkItemDomainActionProposalSpec, e as WorkItemDomainActionAdmission, f as WorkItemDomainActionAdmissionDecision } from './work-item-runtime-types-BTxLskN5.cjs';
|
|
6
|
+
import { C as CapabilityAdmission, g as CapabilityAdmissionStatus } from './capability-admission-B8RNFyaZ.cjs';
|
|
7
7
|
|
|
8
8
|
type WorkItemValidationIssueCode = "malformed-draft" | "missing-required-field" | "invalid-patch" | "duplicate-id" | "dangling-ref" | "cyclic-dependency" | "unsupported-mode" | "unsupported-effect-kind" | "oversized-inline-data" | "policy-mismatch" | "missing-policy" | "stale-revision" | "stale-execution-input" | "blocked-prerequisite" | "verification-unplanned" | "manual-review-required" | "duplicate-suppressed" | "ambiguous-coverage" | "partial-coverage" | "unverifiable-output" | "unauthorized-author" | "unauthorized-target" | "invalid-schedule";
|
|
9
9
|
type WorkItemValidationStatusState = "projected" | "rejected" | "deferred" | "blocked" | "needs-human-review" | "stale" | "duplicate" | "request-emitted" | "result-recorded" | "domain-action-proposed";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataIssue } from './data/index.js';
|
|
2
2
|
import { BoundaryCapabilityRef } from './inspection/boundary.js';
|
|
3
|
-
import { N as Node } from './types-
|
|
4
|
-
import { S as SourceRef, l as EffectRunGoal, h as AgentOutputEnvelope, a as AgentRuntimeAuditRecord, m as EffectRunLimits, k as EffectRunResultStatus, n as EffectRunResult } from './agent-runtime-types-core-
|
|
5
|
-
import { W as WorkItemEffectRequested, c as WorkItemDomainActionProposal, a as WorkItemEvidenceRecorded, d as WorkItemDomainActionProposalSpec, e as WorkItemDomainActionAdmission, f as WorkItemDomainActionAdmissionDecision } from './work-item-runtime-types-
|
|
6
|
-
import { C as CapabilityAdmission, g as CapabilityAdmissionStatus } from './capability-admission-
|
|
3
|
+
import { N as Node } from './types-DChxk1vK.js';
|
|
4
|
+
import { S as SourceRef, l as EffectRunGoal, h as AgentOutputEnvelope, a as AgentRuntimeAuditRecord, m as EffectRunLimits, k as EffectRunResultStatus, n as EffectRunResult } from './agent-runtime-types-core-CKwrBDyi.js';
|
|
5
|
+
import { W as WorkItemEffectRequested, c as WorkItemDomainActionProposal, a as WorkItemEvidenceRecorded, d as WorkItemDomainActionProposalSpec, e as WorkItemDomainActionAdmission, f as WorkItemDomainActionAdmissionDecision } from './work-item-runtime-types-DAsZbb2y.js';
|
|
6
|
+
import { C as CapabilityAdmission, g as CapabilityAdmissionStatus } from './capability-admission-Dkw1Xz3r.js';
|
|
7
7
|
|
|
8
8
|
type WorkItemValidationIssueCode = "malformed-draft" | "missing-required-field" | "invalid-patch" | "duplicate-id" | "dangling-ref" | "cyclic-dependency" | "unsupported-mode" | "unsupported-effect-kind" | "oversized-inline-data" | "policy-mismatch" | "missing-policy" | "stale-revision" | "stale-execution-input" | "blocked-prerequisite" | "verification-unplanned" | "manual-review-required" | "duplicate-suppressed" | "ambiguous-coverage" | "partial-coverage" | "unverifiable-output" | "unauthorized-author" | "unauthorized-target" | "invalid-schedule";
|
|
9
9
|
type WorkItemValidationStatusState = "projected" | "rejected" | "deferred" | "blocked" | "needs-human-review" | "stale" | "duplicate" | "request-emitted" | "result-recorded" | "domain-action-proposed";
|