@ai4b-team/fsaos-gateway-sdk 3.11.1 → 3.12.2
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 +72 -20
- package/dist/iife/gateway.js +3 -3
- package/dist/iife/gateway.js.map +4 -4
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +311 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +150 -120
- package/dist/index.d.ts +150 -120
- package/dist/index.js +300 -112
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,16 @@ Mount Runtime:
|
|
|
24
24
|
6. __FSAOS_MOUNT__() → renders the component
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Location vs. Access — the two kinds of read
|
|
28
|
+
|
|
29
|
+
Two questions look similar but are answered by different calls. Getting this right is the difference between a correct UI and one that shows a member items that aren't theirs.
|
|
30
|
+
|
|
31
|
+
- **Location** — "what is at this path / of this type in this account?" → `useItems`, `useList`, `useTree`. These scope to the current account and return what's there. They do **not** know *who you are within the account*.
|
|
32
|
+
- **Access** — "what can THIS actor reach in THIS context?" → `useResolvedItems`. Resolved server-side by the kernel: union of account / member / space / system / licensed tiers, frame-bounded to the acting principal, preference-cascade aware.
|
|
33
|
+
|
|
34
|
+
Rule of thumb: if the answer should differ depending on *who is asking* or *which channel they are in* — connectors, tools, or anything member-scoped — use `useResolvedItems`. The SDK never computes frames or permissions client-side; it forwards to the kernel and renders the answer.
|
|
35
|
+
|
|
36
|
+
## Exports
|
|
28
37
|
|
|
29
38
|
### Error
|
|
30
39
|
- `EnforcementDeniedError` — Error class for enforcement denials (rules, access, entitlement)
|
|
@@ -35,6 +44,7 @@ Mount Runtime:
|
|
|
35
44
|
- `getSessionEntry()` — Get current session entry (or null)
|
|
36
45
|
- `getAccessToken()` — Get current auth token (waits for first auth event)
|
|
37
46
|
- `setCachedToken()` — Manually set auth token (for embed tokens)
|
|
47
|
+
- `getScope()` / `setScope()` / `subscribeScope()` — Active scope (account/switcher) accessors + subscription
|
|
38
48
|
|
|
39
49
|
### Gateway Call
|
|
40
50
|
- `gatewayCall(method, params)` — Core RPC dispatcher: `POST /d/{hostname}`
|
|
@@ -69,11 +79,14 @@ The SDK does not decide when AI should respond, spawn agents, or infer agent ide
|
|
|
69
79
|
### VFS Operations (pure async functions)
|
|
70
80
|
- `normalizeItem(raw)` — Normalize raw gateway response to `VFSItem`
|
|
71
81
|
- `fetchVfsItem(path)` — Fetch a single item
|
|
82
|
+
- `fetchVfsItemById(id)` — Fetch a single item by UUID
|
|
72
83
|
- `fetchVfsChildren(path)` — Fetch children (also warms item cache)
|
|
84
|
+
- `fetchItems(filter)` — Fetch items by type with structured filters
|
|
73
85
|
- `fetchTypeDefinitions(scopeId?)` — Fetch type definitions as `Map<string, TypeDefinition>`
|
|
74
86
|
- `fetchEdgesForItem(itemId)` — Fetch edges (incoming + outgoing)
|
|
75
87
|
- `fetchVfsTree(path, depth?, types?, limit?)` — Fetch recursive tree
|
|
76
88
|
- `fetchMemberFocus(scopeId, types?, limit?)` — Fetch member-focus items
|
|
89
|
+
- `fetchResolvedItems(contextId, itemType)` — Imperative form of `useResolvedItems` (access resolution)
|
|
77
90
|
|
|
78
91
|
### Cache Invalidation
|
|
79
92
|
- `invalidateChildren(path)` — Invalidate children query
|
|
@@ -84,8 +97,9 @@ The SDK does not decide when AI should respond, spawn agents, or infer agent ide
|
|
|
84
97
|
- `invalidateTypes(scopeId?)` — Invalidate type definitions
|
|
85
98
|
|
|
86
99
|
### Realtime
|
|
87
|
-
- `
|
|
88
|
-
- `
|
|
100
|
+
- `initVfsRealtimeWs(scopeId)` — Subscribe to VFS changes over WebSocket
|
|
101
|
+
- `disposeVfsRealtimeWs()` — Tear down realtime connection
|
|
102
|
+
- `mountRealtimeScope(path)` / `unmountRealtimeScope(path)` — Add/remove a scope from the realtime subscription
|
|
89
103
|
|
|
90
104
|
### React Hooks (TanStack Query)
|
|
91
105
|
|
|
@@ -94,12 +108,46 @@ The SDK does not decide when AI should respond, spawn agents, or infer agent ide
|
|
|
94
108
|
| Hook | Description |
|
|
95
109
|
|------|-------------|
|
|
96
110
|
| `useItem(path)` | Single item by path |
|
|
97
|
-
| `
|
|
111
|
+
| `useItemById(id)` | Single item by UUID |
|
|
112
|
+
| `useList(path)` / `useChildren(path)` | Children of a path (location) |
|
|
113
|
+
| `useItems(filter)` | Items by type with filters (location; account-scoped, **not** frame-aware) |
|
|
114
|
+
| `useInfiniteItems(filter)` | Infinite-scroll items by type |
|
|
115
|
+
| `useInfiniteChildren(path)` | Infinite-scroll directory listing |
|
|
98
116
|
| `useTree(path, depth?)` | Recursive tree |
|
|
99
|
-
| `useSearch(query, types?)` |
|
|
117
|
+
| `useSearch(query, types?)` | Keyword search |
|
|
118
|
+
| `useResolve(params)` | Multi-signal search (exact + trigram + keyword + semantic) |
|
|
119
|
+
| `useResolvedItems(contextId, itemType)` | **Access** resolution — what this actor can reach here (frame-bounded, pref-aware). Use for connectors, tools, any member-scoped type. |
|
|
120
|
+
| `useOpen(path, options?)` | Open envelope — render directives + compatible components |
|
|
100
121
|
| `useEdges(itemId)` | Edges for an item |
|
|
101
|
-
| `useTypes(scopeId?)` |
|
|
102
|
-
| `
|
|
122
|
+
| `useTypes(scopeId?)` / `useType(typeKey, scopeId?)` | Type definitions |
|
|
123
|
+
| `useTypeHelpers(scopeId?)` | Derived type-system helper functions |
|
|
124
|
+
| `useMemberFocus(scopeId, types?, limit?)` | Items relevant to the current user in a scope |
|
|
125
|
+
| `useItemVersions(itemId, opts?)` | Version history (`useItemHistory` is deprecated) |
|
|
126
|
+
| `useRecentActivity(scopePath, limit?, offset?)` | Audit log for a scope |
|
|
127
|
+
| `useScope()` / `useScopeReady()` | Current scope session / readiness |
|
|
128
|
+
| `useAuth()` | Reactive Supabase auth |
|
|
129
|
+
| `useAccounts()` | Account memberships + switching |
|
|
130
|
+
| `usePrincipal()` / `useUpdatePrincipal()` | Current principal identity / update |
|
|
131
|
+
| `useAsset(idOrPath)` | Resolve an asset URL |
|
|
132
|
+
| `useComponent(path)` | Dynamically load a component from the edge |
|
|
133
|
+
| `useTheme()` | Read theme CSS custom properties |
|
|
134
|
+
|
|
135
|
+
**Channel / notification hooks:**
|
|
136
|
+
|
|
137
|
+
| Hook | Description |
|
|
138
|
+
|------|-------------|
|
|
139
|
+
| `useChannelMessages(opts)` | Channel messages + bundled cards |
|
|
140
|
+
| `useInfiniteChannelMessages(opts)` | Cursor-paginated messages (live tail) |
|
|
141
|
+
| `useAllChannels()` / `useChannels()` / `useDmChannels()` | Channel lists (all / public / DM) |
|
|
142
|
+
| `useNotifications(opts?)` | Notifications feed |
|
|
143
|
+
| `useUnreadCounts(opts?)` | Aggregated unread counts |
|
|
144
|
+
|
|
145
|
+
**Realtime hooks:**
|
|
146
|
+
|
|
147
|
+
| Hook | Description |
|
|
148
|
+
|------|-------------|
|
|
149
|
+
| `useEventStream(...)` | Subscribe to SSE events by type |
|
|
150
|
+
| `useRealtimeQuery(opts)` | `useQuery` that auto-refetches on matching events |
|
|
103
151
|
|
|
104
152
|
**Mutation hooks:**
|
|
105
153
|
|
|
@@ -116,17 +164,21 @@ The SDK does not decide when AI should respond, spawn agents, or infer agent ide
|
|
|
116
164
|
|
|
117
165
|
```
|
|
118
166
|
src/
|
|
119
|
-
types.ts
|
|
120
|
-
config.ts
|
|
121
|
-
enforcement.ts
|
|
122
|
-
session.ts
|
|
123
|
-
client.ts
|
|
124
|
-
query-client.ts
|
|
125
|
-
vfs-keys.ts
|
|
126
|
-
vfs.ts
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
167
|
+
types.ts — All type definitions (VFSItem, TypeDefinition, VFSEdge, etc.)
|
|
168
|
+
config.ts — Reads __FSAOS_CONFIG__, creates Supabase client
|
|
169
|
+
enforcement.ts — EnforcementDeniedError class
|
|
170
|
+
session.ts — Auth token lifecycle, domain session init, scope accessors
|
|
171
|
+
client.ts — gatewayCall() — the core RPC dispatcher
|
|
172
|
+
query-client.ts — TanStack QueryClient with VFS-tuned defaults
|
|
173
|
+
vfs-keys.ts — Query key factory
|
|
174
|
+
vfs.ts — VFS fetch functions + cache invalidation helpers
|
|
175
|
+
vfs-realtime-ws.ts — WebSocket realtime subscriptions
|
|
176
|
+
ws.ts — WebSocket transport (events, scope, ping)
|
|
177
|
+
hooks.ts — All React hooks (useQuery/useMutation wrappers)
|
|
178
|
+
resolved-items.ts — useResolvedItems / fetchResolvedItems (access resolution)
|
|
179
|
+
upload.ts — File upload (imperative + hook)
|
|
180
|
+
schema-utils.ts — Schema interpretation utilities
|
|
181
|
+
index.ts — Barrel export
|
|
130
182
|
```
|
|
131
183
|
|
|
132
184
|
## Build
|
|
@@ -140,7 +192,7 @@ node build.mjs --dev # dist/gateway.dev.js (readable, ~128 KB)
|
|
|
140
192
|
The build produces:
|
|
141
193
|
- `dist/gateway.js` — Minified IIFE assigned to `window.__FSAOS_GATEWAY__`
|
|
142
194
|
- `dist/gateway.dev.js` — Unminified for debugging
|
|
143
|
-
- `dist/*.d.ts` — TypeScript declarations
|
|
195
|
+
- `dist/*.d.ts` — TypeScript declarations
|
|
144
196
|
- `dist/*.js.map` — Source maps
|
|
145
197
|
|
|
146
198
|
## Dependencies
|
|
@@ -154,7 +206,7 @@ The build produces:
|
|
|
154
206
|
|
|
155
207
|
## Zero Kernel
|
|
156
208
|
|
|
157
|
-
This SDK has **zero** references to "kernel" in source, bundle, or type declarations. All naming uses gateway terminology.
|
|
209
|
+
This SDK has **zero** references to "kernel" in source, bundle, or type declarations. All naming uses gateway terminology. (The kernel owns resolution, frames, and enforcement; the SDK is the control surface that forwards to it.)
|
|
158
210
|
|
|
159
211
|
## License
|
|
160
212
|
|