@ai4b-team/fsaos-gateway-sdk 5.7.0 → 5.7.1

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 CHANGED
@@ -528,3 +528,41 @@ relevant edge/message changes and releases its watcher on close. It never polls.
528
528
  `fetchNextPage()` is explicit, including when an authorization-filtered page is
529
529
  empty but has another cursor. Mounting one reader per closed message is unnecessary:
530
530
  use the already-loaded history's `reply_to` projection for summaries.
531
+
532
+ ## Native item permission checks
533
+
534
+ `usePermission(action, item)` and `usePermissions(item, actions)` call the existing
535
+ FSAOS `check-item-access` method as the authenticated SDK session. Supported native
536
+ actions are `view`, `edit`, `delete`, and `admin`. Prefer an already-resolved item
537
+ UUID; an absolute VFS path uses one shared `read` to resolve its UUID first.
538
+
539
+ ```tsx
540
+ const { data, loading, error, refetch } = usePermissions(item.id, ['view', 'edit']);
541
+ // Or: usePermission('edit', item.id).data.allowed
542
+ if (loading) return <span>Checking access…</span>;
543
+ if (error) return <button onClick={() => void refetch()}>Retry access check</button>;
544
+ return <button disabled={!data.edit}>Edit</button>;
545
+ ```
546
+
547
+ The host must initialize an authenticated SDK session and provide the shared
548
+ `QueryClientProvider`/`setQueryClient` instance. Missing/anonymous context, loading,
549
+ refreshing, errors and malformed responses never report allowed. Unsupported
550
+ actions or non-UUID/non-absolute-path targets report `PERMISSION_INPUT_INVALID`.
551
+ These hooks do not create an approval request or grant access. They check native
552
+ item access, not an action allowance, entitlement or every method-specific rule;
553
+ the actual kernel operation remains authoritative.
554
+
555
+ Each distinct visible item/action has one shared query. Identical consumers reuse
556
+ it, including consumers mixing the two hooks. There are no interval reads, retries,
557
+ focus reads or per-hook subscriptions. Existing workspace VFS/CCM events invalidate
558
+ matching checks; membership/sharing changes refresh the affected mounted scope.
559
+ Bursts coalesce, old grants disappear immediately, and stream resync refreshes
560
+ active checks. Closing the last observer discards the check, so reopening checks
561
+ again. A host using the SDK without workspace events must explicitly `refetch`
562
+ after its own permission changes. Calls are also eligible for the existing
563
+ `configureGatewayReads` concurrency and cancellation controls.
564
+
565
+ Tokenless `hostSession` frames do not have a seated identity of their own. Render
566
+ permission-dependent host controls in the authenticated host; these hooks remain
567
+ false in an unseated frame. Frame operations still use the host's governed gateway
568
+ calls. Do not invent a principal or copy a bearer into the frame to enable a UI.