@openfairygui/backend 0.2.0-alpha.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 ADDED
@@ -0,0 +1,59 @@
1
+ # @openfairygui/backend
2
+
3
+ Stateful backend runtime and session services for OpenFairyGUI.
4
+
5
+ ## Purpose
6
+
7
+ `@openfairygui/backend` is the first stateful runtime layer in the monorepo.
8
+
9
+ It owns:
10
+
11
+ - project/session lifecycle
12
+ - revisioned request handling
13
+ - coordinated but non-atomic save semantics
14
+ - backend-local advisory locking
15
+ - capability discovery
16
+ - transport-neutral bootstrap
17
+
18
+ It also provides:
19
+
20
+ - service stratification (`read` / `authoring` / `artifact` / `runtime`)
21
+ - unified response metadata and diagnostics
22
+ - capability planes
23
+ - centralized path/workspace safety policy
24
+ - backend contract versioning surface
25
+ - compatibility policy
26
+ - polling runtime events with per-runtime monotonic sequence and bounded retention
27
+ - `cache.refresh` in-memory jobs with cooperative cancel and terminal retention
28
+ - revision-bound derived read-only cache snapshots
29
+
30
+ It does **not** redefine transaction grammar or expose `Document`.
31
+ It also does **not** implement MCP or any transport-specific wire protocol.
32
+
33
+ ## Relationship to other packages
34
+
35
+ - `@openfairygui/core` owns UAM, I/O, validation, and the transaction kernel
36
+ - `@openfairygui/functions` owns the thin stateless app seam and workflow helpers
37
+ - `@openfairygui/backend` wraps those layers into a reusable runtime/service boundary
38
+
39
+ ## Example
40
+
41
+ ```ts
42
+ import { BackendRuntime } from '@openfairygui/backend';
43
+
44
+ const runtime = new BackendRuntime();
45
+ const opened = await runtime.openSession({ projectPath: './MyProject' });
46
+ if (!opened.ok) throw new Error(opened.error.message);
47
+
48
+ const capabilities = runtime.getCapabilities();
49
+ console.log(capabilities.data.runtimeOwner);
50
+ console.log(capabilities.data.contractVersion);
51
+ console.log(capabilities.data.compatibilityPolicy.incompatibleChange);
52
+
53
+ const refresh = runtime.refreshCache({ sessionId: opened.data.sessionId });
54
+ if (refresh.ok) {
55
+ console.log(refresh.data.kind, refresh.data.status);
56
+ }
57
+
58
+ await runtime.closeSession({ sessionId: opened.data.sessionId });
59
+ ```