@prometheus-ags/entity-graph-core 3.0.0-alpha.0 → 3.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,52 @@
1
+ # @prometheus-ags/entity-graph-core
2
+
3
+ ## 3.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 30fc348: Certify the React 19 and Vite 8 release showcase with normalized cross-view
8
+ updates, local/remote/hybrid queries, optimistic confirmation and rollback,
9
+ relationship invalidation, realtime coalescing, PGlite persistence, Loro
10
+ convergence, Suspense and error-boundary lifecycle behavior, DevTools, and
11
+ browser accessibility evidence.
12
+ - 7b64d76: Scope engine dedupe, subscribers, fetches, React hooks, mutations, and realtime
13
+ writes to an application-owned graph so concurrent Next.js requests can
14
+ dehydrate and hydrate without sharing process-global entity state.
15
+
16
+ ## 3.0.0-rc.1
17
+
18
+ ### Patch Changes
19
+
20
+ - Preserve coalesced realtime update operations while merging repeated patches, so a burst does not degrade into a data-less upsert that the graph discards.
21
+ - Accept a public `LoroModuleLoader` callback in `createLoroMergeStrategy` so browser bundlers can include the optional `loro-crdt` peer without making it a core dependency.
22
+
23
+ ## 3.0.0
24
+
25
+ ### Major Changes
26
+
27
+ - v3.0.0 — Universal Platform Evolution
28
+
29
+ Evolves the React-only entity graph into a cross-platform, multi-framework,
30
+ AI-native, local-first ecosystem.
31
+ - **Monorepo split (breaking, but consumer-safe):** the framework-agnostic core
32
+ is extracted into `@prometheus-ags/entity-graph-core` (zero React). The
33
+ published `@prometheus-ags/prometheus-entity-management` package is the React
34
+ binding over the vanilla core. Existing React hook names remain available,
35
+ while core-only imperative consumers migrate from `useGraphStore.getState()`
36
+ to `graphStore.getState()`; the deprecated core alias remains through the
37
+ next-major removal window.
38
+ - **New framework bindings:** `entity-graph-svelte` (Svelte 5 runes),
39
+ `entity-graph-solid`, `entity-graph-web-components` (Lit 3), `entity-graph-alpine`,
40
+ `entity-graph-htmx` (Node SSE fragment server).
41
+ - **Peer sync:** `entity-graph-sync` with a pluggable SyncProvider — Yjs (default)
42
+ and Loro (reusing the 2.2.0 merge seam).
43
+ - **AI-native:** `entity-graph-a2a` plus `a2ui-react` with official A2UI
44
+ v0.9.1 rendering and default-deny graph actions; legacy
45
+ EntityChat/Copilot/Stream/Diff/Approval APIs live under `./ag-ui`.
46
+ - **Codegen contract:** `entity-graph-sdl` (schema → validated IR).
47
+ - **Native (published outside npm):** `entity-graph-cli` + `entity-graph-mcp`
48
+ (Rust, via crates.io), `entity-graph-tauri` (Tauri v2 plugin), and
49
+ `entity_graph_flutter` (Riverpod 3, via pub.dev).
50
+
51
+ All integrations ship as optional peer dependencies; the core bundle stays
52
+ `zustand + immer`.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # `@prometheus-ags/entity-graph-core`
2
+
3
+ Framework-neutral normalized entity graph for the Prometheus entity-management ecosystem. The package contains no React code. React, Svelte, Solid, Alpine, Lit, Tauri, and other bindings share this graph so an entity is stored once and every subscribed view observes the same value.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @prometheus-ags/entity-graph-core
9
+ ```
10
+
11
+ The core runtime depends on Zustand and Immer. Optional integrations such as AG-UI, Loro, and Tauri SQL are loaded only when their adapters are used.
12
+
13
+ ## The data model
14
+
15
+ The graph keeps three distinct structures:
16
+
17
+ - `entities[type][id]` is canonical server-confirmed data.
18
+ - `patches[type][id]` contains local UI-only augmentation merged at read time.
19
+ - `lists[queryKey].ids` contains ordered identifiers, never copied entity records.
20
+
21
+ This ID-only list rule is what makes cross-view updates reliable: changing one canonical entity updates every list, detail view, and relation that reads that identifier.
22
+
23
+ ## Register a transport
24
+
25
+ Register I/O once at application boot. Framework hooks call store and engine methods; transports and adapters own external communication.
26
+
27
+ ```ts
28
+ import {
29
+ registerEntityTransport,
30
+ } from "@prometheus-ags/entity-graph-core";
31
+
32
+ registerEntityTransport("users", {
33
+ identify: (user) => user.id,
34
+ authoritative: false,
35
+ async list(query) {
36
+ const response = await fetch(`/api/users?limit=${query.limit ?? 50}`, {
37
+ signal: query.signal,
38
+ });
39
+ const rows = await response.json();
40
+ return { rows, total: rows.length, nextCursor: null };
41
+ },
42
+ });
43
+ ```
44
+
45
+ Custom transports implement `EntityTransport<T>` with `identify`, `authoritative`, and `list`; `get` and `subscribe` are optional.
46
+
47
+ ## Create, read, and update graphs outside a UI framework
48
+
49
+ ```ts
50
+ import {
51
+ createGraphStore,
52
+ graphStore,
53
+ } from "@prometheus-ags/entity-graph-core";
54
+
55
+ const graph = graphStore.getState();
56
+
57
+ graph.upsertEntity("users", "user-1", {
58
+ id: "user-1",
59
+ name: "Ada Lovelace",
60
+ });
61
+
62
+ graph.setListResult("users:active", ["user-1"], {
63
+ total: 1,
64
+ hasNextPage: false,
65
+ });
66
+
67
+ const user = graphStore.getState().readEntity("users", "user-1");
68
+
69
+ // Isolated stores are useful for SSR requests, tests, and workers.
70
+ const requestGraph = createGraphStore();
71
+ requestGraph.getState().upsertEntity("users", "request-user", {
72
+ id: "request-user",
73
+ name: "Grace Hopper",
74
+ });
75
+ ```
76
+
77
+ UI components should consume the hooks provided by their framework binding instead of reading the store directly.
78
+
79
+ The deprecated core `useGraphStore` name is a StoreApi-shaped alias for `graphStore`, not a React hook. React consumers import the callable `useGraphStore(selector)` hook from `@prometheus-ags/prometheus-entity-management`. See the repository's `release/framework-neutral-core.md` migration contract for the complete boundary.
80
+
81
+ ## Optional Loro merge strategy
82
+
83
+ `loro-crdt` remains an optional peer. Node consumers can let core load it at
84
+ runtime; browser bundlers should provide a statically visible loader:
85
+
86
+ ```ts
87
+ import {
88
+ createLoroMergeStrategy,
89
+ registerMergeStrategy,
90
+ } from "@prometheus-ags/entity-graph-core";
91
+
92
+ const strategy = await createLoroMergeStrategy(
93
+ () => import("loro-crdt"),
94
+ );
95
+ registerMergeStrategy("Document", strategy);
96
+ ```
97
+
98
+ The public `LoroModuleLoader` type describes this callback. Supplying it does
99
+ not make Loro part of the mandatory core bundle.
100
+
101
+ ## Major capabilities
102
+
103
+ - request deduplication, stale-while-revalidate, subscriber tracking, and garbage collection
104
+ - transport-neutral filtering, sorting, search, pagination, and incremental views
105
+ - realtime adapters with coalesced graph writes
106
+ - graph actions, transactions, effects, snapshots, and time travel
107
+ - local-first persistence and retryable action replay
108
+ - schema and relation registries with cascade invalidation
109
+ - AG-UI snapshot/delta ingestion and JSON Patch
110
+ - REST, WebSocket, Supabase, GraphQL, ElectricSQL, PGlite, Tauri SQL, SurrealDB, and Flint adapter seams
111
+ - framework-neutral table row models and faceting
112
+
113
+ ## Module support
114
+
115
+ The package publishes loader-specific artifacts and declarations:
116
+
117
+ - Node ESM and modern bundlers use `dist/index.mjs` with `dist/index.d.ts`.
118
+ - Node CommonJS uses `dist/index.cjs` with `dist/index.d.cts`.
119
+
120
+ Both paths are selected through conditional package exports.
121
+
122
+ ## License
123
+
124
+ MIT