@ai4b-team/fsaos-gateway-sdk 3.40.0 → 3.41.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 +1 -1
- package/dist/iife/gateway.js +4 -4
- package/dist/iife/gateway.js.map +3 -3
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +74 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +74 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2092,9 +2092,18 @@ interface ScopeResult {
|
|
|
2092
2092
|
/** Returns the current scope session via initSession(). */
|
|
2093
2093
|
declare function useScope(): ScopeResult;
|
|
2094
2094
|
|
|
2095
|
+
/** A billing-party account and the accounts mounted under it. */
|
|
2096
|
+
interface SwitcherAccount {
|
|
2097
|
+
/** Account with `placement === 'switcher_entry'` (it pays for itself). */
|
|
2098
|
+
account: AccountInfo;
|
|
2099
|
+
/** Accounts whose `subordinateTo` is this account. Space rows stay on `allMemberships`. */
|
|
2100
|
+
mountables: AccountInfo[];
|
|
2101
|
+
}
|
|
2095
2102
|
interface AccountsState {
|
|
2096
|
-
/** Election candidates — accounts the user can log into (top-level forest first). */
|
|
2103
|
+
/** Election candidates — accounts the user can log into (top-level forest first). Space rows are excluded. */
|
|
2097
2104
|
accounts: AccountInfo[];
|
|
2105
|
+
/** Billing-party accounts, each with the accounts that mount under it. */
|
|
2106
|
+
switcherAccounts: SwitcherAccount[];
|
|
2098
2107
|
/** Full membership list (accounts + spaces). Raw material for MountRefs. */
|
|
2099
2108
|
allMemberships: AccountInfo[];
|
|
2100
2109
|
/** The account ref of the current ANCHOR (was: billing-responsible account). */
|
|
@@ -2108,7 +2117,13 @@ interface AccountsState {
|
|
|
2108
2117
|
loading: boolean;
|
|
2109
2118
|
error: Error | null;
|
|
2110
2119
|
}
|
|
2111
|
-
/**
|
|
2120
|
+
/**
|
|
2121
|
+
* Memberships for the seated principal, plus anchor and mount actions.
|
|
2122
|
+
*
|
|
2123
|
+
* A Supabase user is not required. An embed/FSAOS token seats a principal via
|
|
2124
|
+
* `initSession()`, and the membership query uses `vfsKeys.memberships(principal_id)`
|
|
2125
|
+
* — the same key `initializeWorkspace` fills — so the two share one cache.
|
|
2126
|
+
*/
|
|
2112
2127
|
declare function useAccounts(): AccountsState;
|
|
2113
2128
|
/** The working set (mounts) as reactive state, plus mount/unmount verbs. */
|
|
2114
2129
|
declare function useMounts(): {
|
|
@@ -3415,4 +3430,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
|
|
|
3415
3430
|
contextKey: string;
|
|
3416
3431
|
};
|
|
3417
3432
|
|
|
3418
|
-
export { type AccountInfo, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, FormSubmissionError, type FormSubmissionReceipt, type FsaosRuntime, type GatewayParams, GatewayRequestError, type GatewayRequestOptions, type GatewayResponse, type IncrementalItemsOptions, type InfiniteChannelMessagesOptions, type InfiniteItemsOptions, type InitializeFsaosOptions, type InteractionReceipt, InteractionTrackingError, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type ReadPriority, type ReadTiming, type ResolveItemsResponse, type ResolveParams, type ResolveResponse, type ResolveResultItem, type ResolvedItem, type SectionChange, type SectionCollection, type SectionDestination, type SectionSnapshot, type SectionTarget, type SessionEntry, type SourceCaptureAdapter, type SourceIdentityStorage, type StartTrackingOptions, type SteerTurnOptions, type SteerTurnResponse, type SteerTurnState, type SubmitFormOptions, type TimelineEvent, type TimelineHistoryEvent, type TimelineHistoryOptions, type TrackEventOptions, type TurnQueueEntry, type TurnQueueEntryState, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UpdatePrincipalParams, type UploadItem, type UploadOptions, type UploadResult, type UseArtifactStreamReturn, type UseFileUploadReturn, type UseTimelineHistoryReturn, type VFSEdge, type VFSItem, type VfsItemChange, type WorkCorrelation, type WorkspaceOptions, type WorkspaceSession, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createItem, disconnectSSE, disposeVfsRealtimeWs, electHomeAnchor, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getHomeAnchor, getMountVersion, getMounts, getPathSubscriptionState, getQueryClient, getRequiredFormFields, getScope, getScopeVersion, getServerClockOffsetMs, getServerClockSyncedAt, getSessionEntry, hasServerClock, initSession, initVfsRealtimeWs, initializeFsaos, initializeWorkspace, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, selectMount, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startTracking, steerTurn, submitForm, subscribeAnchor, subscribeArtifactStream, subscribeMounts, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, trackAction, trackEvent, trackPageView, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAgentTimeline, useAllChannels, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMintedAsset, useMounts, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePersonalItemOrder, usePersonalSections, usePinnedItems, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useResolvedItems, useScope, useScopeReady, useSearch, useTheme, useTimelineHistory, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
|
|
3433
|
+
export { type AccountInfo, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, FormSubmissionError, type FormSubmissionReceipt, type FsaosRuntime, type GatewayParams, GatewayRequestError, type GatewayRequestOptions, type GatewayResponse, type IncrementalItemsOptions, type InfiniteChannelMessagesOptions, type InfiniteItemsOptions, type InitializeFsaosOptions, type InteractionReceipt, InteractionTrackingError, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type ReadPriority, type ReadTiming, type ResolveItemsResponse, type ResolveParams, type ResolveResponse, type ResolveResultItem, type ResolvedItem, type SectionChange, type SectionCollection, type SectionDestination, type SectionSnapshot, type SectionTarget, type SessionEntry, type SourceCaptureAdapter, type SourceIdentityStorage, type StartTrackingOptions, type SteerTurnOptions, type SteerTurnResponse, type SteerTurnState, type SubmitFormOptions, type SwitcherAccount, type TimelineEvent, type TimelineHistoryEvent, type TimelineHistoryOptions, type TrackEventOptions, type TurnQueueEntry, type TurnQueueEntryState, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UpdatePrincipalParams, type UploadItem, type UploadOptions, type UploadResult, type UseArtifactStreamReturn, type UseFileUploadReturn, type UseTimelineHistoryReturn, type VFSEdge, type VFSItem, type VfsItemChange, type WorkCorrelation, type WorkspaceOptions, type WorkspaceSession, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createItem, disconnectSSE, disposeVfsRealtimeWs, electHomeAnchor, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getHomeAnchor, getMountVersion, getMounts, getPathSubscriptionState, getQueryClient, getRequiredFormFields, getScope, getScopeVersion, getServerClockOffsetMs, getServerClockSyncedAt, getSessionEntry, hasServerClock, initSession, initVfsRealtimeWs, initializeFsaos, initializeWorkspace, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, selectMount, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startTracking, steerTurn, submitForm, subscribeAnchor, subscribeArtifactStream, subscribeMounts, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, trackAction, trackEvent, trackPageView, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAgentTimeline, useAllChannels, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMintedAsset, useMounts, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePersonalItemOrder, usePersonalSections, usePinnedItems, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useResolvedItems, useScope, useScopeReady, useSearch, useTheme, useTimelineHistory, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
|
package/dist/index.d.ts
CHANGED
|
@@ -2092,9 +2092,18 @@ interface ScopeResult {
|
|
|
2092
2092
|
/** Returns the current scope session via initSession(). */
|
|
2093
2093
|
declare function useScope(): ScopeResult;
|
|
2094
2094
|
|
|
2095
|
+
/** A billing-party account and the accounts mounted under it. */
|
|
2096
|
+
interface SwitcherAccount {
|
|
2097
|
+
/** Account with `placement === 'switcher_entry'` (it pays for itself). */
|
|
2098
|
+
account: AccountInfo;
|
|
2099
|
+
/** Accounts whose `subordinateTo` is this account. Space rows stay on `allMemberships`. */
|
|
2100
|
+
mountables: AccountInfo[];
|
|
2101
|
+
}
|
|
2095
2102
|
interface AccountsState {
|
|
2096
|
-
/** Election candidates — accounts the user can log into (top-level forest first). */
|
|
2103
|
+
/** Election candidates — accounts the user can log into (top-level forest first). Space rows are excluded. */
|
|
2097
2104
|
accounts: AccountInfo[];
|
|
2105
|
+
/** Billing-party accounts, each with the accounts that mount under it. */
|
|
2106
|
+
switcherAccounts: SwitcherAccount[];
|
|
2098
2107
|
/** Full membership list (accounts + spaces). Raw material for MountRefs. */
|
|
2099
2108
|
allMemberships: AccountInfo[];
|
|
2100
2109
|
/** The account ref of the current ANCHOR (was: billing-responsible account). */
|
|
@@ -2108,7 +2117,13 @@ interface AccountsState {
|
|
|
2108
2117
|
loading: boolean;
|
|
2109
2118
|
error: Error | null;
|
|
2110
2119
|
}
|
|
2111
|
-
/**
|
|
2120
|
+
/**
|
|
2121
|
+
* Memberships for the seated principal, plus anchor and mount actions.
|
|
2122
|
+
*
|
|
2123
|
+
* A Supabase user is not required. An embed/FSAOS token seats a principal via
|
|
2124
|
+
* `initSession()`, and the membership query uses `vfsKeys.memberships(principal_id)`
|
|
2125
|
+
* — the same key `initializeWorkspace` fills — so the two share one cache.
|
|
2126
|
+
*/
|
|
2112
2127
|
declare function useAccounts(): AccountsState;
|
|
2113
2128
|
/** The working set (mounts) as reactive state, plus mount/unmount verbs. */
|
|
2114
2129
|
declare function useMounts(): {
|
|
@@ -3415,4 +3430,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
|
|
|
3415
3430
|
contextKey: string;
|
|
3416
3431
|
};
|
|
3417
3432
|
|
|
3418
|
-
export { type AccountInfo, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, FormSubmissionError, type FormSubmissionReceipt, type FsaosRuntime, type GatewayParams, GatewayRequestError, type GatewayRequestOptions, type GatewayResponse, type IncrementalItemsOptions, type InfiniteChannelMessagesOptions, type InfiniteItemsOptions, type InitializeFsaosOptions, type InteractionReceipt, InteractionTrackingError, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type ReadPriority, type ReadTiming, type ResolveItemsResponse, type ResolveParams, type ResolveResponse, type ResolveResultItem, type ResolvedItem, type SectionChange, type SectionCollection, type SectionDestination, type SectionSnapshot, type SectionTarget, type SessionEntry, type SourceCaptureAdapter, type SourceIdentityStorage, type StartTrackingOptions, type SteerTurnOptions, type SteerTurnResponse, type SteerTurnState, type SubmitFormOptions, type TimelineEvent, type TimelineHistoryEvent, type TimelineHistoryOptions, type TrackEventOptions, type TurnQueueEntry, type TurnQueueEntryState, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UpdatePrincipalParams, type UploadItem, type UploadOptions, type UploadResult, type UseArtifactStreamReturn, type UseFileUploadReturn, type UseTimelineHistoryReturn, type VFSEdge, type VFSItem, type VfsItemChange, type WorkCorrelation, type WorkspaceOptions, type WorkspaceSession, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createItem, disconnectSSE, disposeVfsRealtimeWs, electHomeAnchor, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getHomeAnchor, getMountVersion, getMounts, getPathSubscriptionState, getQueryClient, getRequiredFormFields, getScope, getScopeVersion, getServerClockOffsetMs, getServerClockSyncedAt, getSessionEntry, hasServerClock, initSession, initVfsRealtimeWs, initializeFsaos, initializeWorkspace, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, selectMount, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startTracking, steerTurn, submitForm, subscribeAnchor, subscribeArtifactStream, subscribeMounts, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, trackAction, trackEvent, trackPageView, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAgentTimeline, useAllChannels, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMintedAsset, useMounts, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePersonalItemOrder, usePersonalSections, usePinnedItems, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useResolvedItems, useScope, useScopeReady, useSearch, useTheme, useTimelineHistory, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
|
|
3433
|
+
export { type AccountInfo, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, FormSubmissionError, type FormSubmissionReceipt, type FsaosRuntime, type GatewayParams, GatewayRequestError, type GatewayRequestOptions, type GatewayResponse, type IncrementalItemsOptions, type InfiniteChannelMessagesOptions, type InfiniteItemsOptions, type InitializeFsaosOptions, type InteractionReceipt, InteractionTrackingError, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type ReadPriority, type ReadTiming, type ResolveItemsResponse, type ResolveParams, type ResolveResponse, type ResolveResultItem, type ResolvedItem, type SectionChange, type SectionCollection, type SectionDestination, type SectionSnapshot, type SectionTarget, type SessionEntry, type SourceCaptureAdapter, type SourceIdentityStorage, type StartTrackingOptions, type SteerTurnOptions, type SteerTurnResponse, type SteerTurnState, type SubmitFormOptions, type SwitcherAccount, type TimelineEvent, type TimelineHistoryEvent, type TimelineHistoryOptions, type TrackEventOptions, type TurnQueueEntry, type TurnQueueEntryState, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UpdatePrincipalParams, type UploadItem, type UploadOptions, type UploadResult, type UseArtifactStreamReturn, type UseFileUploadReturn, type UseTimelineHistoryReturn, type VFSEdge, type VFSItem, type VfsItemChange, type WorkCorrelation, type WorkspaceOptions, type WorkspaceSession, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createItem, disconnectSSE, disposeVfsRealtimeWs, electHomeAnchor, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getHomeAnchor, getMountVersion, getMounts, getPathSubscriptionState, getQueryClient, getRequiredFormFields, getScope, getScopeVersion, getServerClockOffsetMs, getServerClockSyncedAt, getSessionEntry, hasServerClock, initSession, initVfsRealtimeWs, initializeFsaos, initializeWorkspace, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, selectMount, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startTracking, steerTurn, submitForm, subscribeAnchor, subscribeArtifactStream, subscribeMounts, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, trackAction, trackEvent, trackPageView, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAgentTimeline, useAllChannels, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMintedAsset, useMounts, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePersonalItemOrder, usePersonalSections, usePinnedItems, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useResolvedItems, useScope, useScopeReady, useSearch, useTheme, useTimelineHistory, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
|
package/dist/index.js
CHANGED
|
@@ -408,9 +408,30 @@ function commitMountSelection(mounts, anchor) {
|
|
|
408
408
|
var sessionEntry = null;
|
|
409
409
|
var sessionPromise = null;
|
|
410
410
|
var sessionGeneration = 0;
|
|
411
|
+
var sessionListeners = /* @__PURE__ */ new Set();
|
|
412
|
+
var sessionVersion = 0;
|
|
413
|
+
function notifySessionListeners() {
|
|
414
|
+
sessionVersion++;
|
|
415
|
+
sessionListeners.forEach((listener) => {
|
|
416
|
+
try {
|
|
417
|
+
listener();
|
|
418
|
+
} catch (e) {
|
|
419
|
+
console.warn("[SDK] Session listener error:", e);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
411
423
|
function getSessionGeneration() {
|
|
412
424
|
return sessionGeneration;
|
|
413
425
|
}
|
|
426
|
+
function getSessionVersion() {
|
|
427
|
+
return sessionVersion;
|
|
428
|
+
}
|
|
429
|
+
function subscribeSession(listener) {
|
|
430
|
+
sessionListeners.add(listener);
|
|
431
|
+
return () => {
|
|
432
|
+
sessionListeners.delete(listener);
|
|
433
|
+
};
|
|
434
|
+
}
|
|
414
435
|
async function initSession() {
|
|
415
436
|
if (sessionEntry) return sessionEntry;
|
|
416
437
|
if (sessionPromise) return sessionPromise;
|
|
@@ -444,6 +465,7 @@ async function initSession() {
|
|
|
444
465
|
// resolver has no principal and omits the field entirely.
|
|
445
466
|
principal_id: entry.principal_id || null
|
|
446
467
|
};
|
|
468
|
+
notifySessionListeners();
|
|
447
469
|
return sessionEntry;
|
|
448
470
|
})().catch((error) => {
|
|
449
471
|
if (generation === sessionGeneration) sessionPromise = null;
|
|
@@ -462,6 +484,7 @@ function clearSession() {
|
|
|
462
484
|
currentAnchorRef = null;
|
|
463
485
|
homeAnchor = null;
|
|
464
486
|
mountSet = [];
|
|
487
|
+
notifySessionListeners();
|
|
465
488
|
}
|
|
466
489
|
var cleanupRegistry = [];
|
|
467
490
|
function registerCleanup(fn) {
|
|
@@ -3149,14 +3172,50 @@ function useScope() {
|
|
|
3149
3172
|
return { data, loading, error };
|
|
3150
3173
|
}
|
|
3151
3174
|
var EMPTY_ACCOUNTS = [];
|
|
3175
|
+
function embedTokenConfigured() {
|
|
3176
|
+
if (typeof window === "undefined") return false;
|
|
3177
|
+
const token = window.__FSAOS_CONFIG__?.embedToken;
|
|
3178
|
+
return typeof token === "function" || typeof token === "string" && token.length > 0;
|
|
3179
|
+
}
|
|
3180
|
+
function groupSwitcherAccounts(accountMemberships) {
|
|
3181
|
+
return accountMemberships.filter((account) => account.placement === "switcher_entry").map((account) => ({
|
|
3182
|
+
account,
|
|
3183
|
+
mountables: accountMemberships.filter((candidate) => candidate.placement !== "switcher_entry" && candidate.subordinateTo === account.accountId)
|
|
3184
|
+
}));
|
|
3185
|
+
}
|
|
3152
3186
|
function useAccounts() {
|
|
3153
3187
|
const { user } = useAuth();
|
|
3188
|
+
const sessionVersion2 = useSyncExternalStore(subscribeSession, getSessionVersion, getSessionVersion);
|
|
3189
|
+
const principalId = getSessionEntry()?.principal_id ?? null;
|
|
3154
3190
|
const autoSelectedRef = useRef(null);
|
|
3155
3191
|
const [mountError, setMountError] = useState(null);
|
|
3192
|
+
const [sessionError, setSessionError] = useState(null);
|
|
3193
|
+
useEffect(() => {
|
|
3194
|
+
if (principalId) {
|
|
3195
|
+
setSessionError(null);
|
|
3196
|
+
return;
|
|
3197
|
+
}
|
|
3198
|
+
if (!user?.id && !embedTokenConfigured()) {
|
|
3199
|
+
setSessionError(null);
|
|
3200
|
+
return;
|
|
3201
|
+
}
|
|
3202
|
+
let cancelled = false;
|
|
3203
|
+
initSession().then((entry) => {
|
|
3204
|
+
if (cancelled) return;
|
|
3205
|
+
if (!entry.principal_id) {
|
|
3206
|
+
setSessionError(new Error("Memberships require an authenticated principal"));
|
|
3207
|
+
}
|
|
3208
|
+
}).catch((err) => {
|
|
3209
|
+
if (!cancelled) setSessionError(err instanceof Error ? err : new Error(String(err)));
|
|
3210
|
+
});
|
|
3211
|
+
return () => {
|
|
3212
|
+
cancelled = true;
|
|
3213
|
+
};
|
|
3214
|
+
}, [principalId, user?.id, sessionVersion2]);
|
|
3156
3215
|
const query = useQuery({
|
|
3157
|
-
queryKey: vfsKeys.memberships(
|
|
3216
|
+
queryKey: vfsKeys.memberships(principalId ?? "anonymous"),
|
|
3158
3217
|
queryFn: fetchMemberships,
|
|
3159
|
-
enabled: !!
|
|
3218
|
+
enabled: !!principalId,
|
|
3160
3219
|
staleTime: 1e3 * 60 * 2
|
|
3161
3220
|
});
|
|
3162
3221
|
const allMemberships = query.data ?? EMPTY_ACCOUNTS;
|
|
@@ -3175,12 +3234,16 @@ function useAccounts() {
|
|
|
3175
3234
|
if (!ref) return null;
|
|
3176
3235
|
return allMemberships.find((a) => a.accountId === ref.id) ?? null;
|
|
3177
3236
|
}, [anchorVersion2, allMemberships]);
|
|
3237
|
+
const switcherAccounts = useMemo(
|
|
3238
|
+
() => groupSwitcherAccounts(accountMemberships),
|
|
3239
|
+
[accountMemberships]
|
|
3240
|
+
);
|
|
3178
3241
|
useEffect(() => {
|
|
3179
|
-
if (!
|
|
3242
|
+
if (!principalId) {
|
|
3180
3243
|
autoSelectedRef.current = null;
|
|
3181
3244
|
return;
|
|
3182
3245
|
}
|
|
3183
|
-
if (autoSelectedRef.current ===
|
|
3246
|
+
if (autoSelectedRef.current === principalId) return;
|
|
3184
3247
|
setMountError(null);
|
|
3185
3248
|
if (electionCandidates.length === 1) {
|
|
3186
3249
|
const only = electionCandidates[0];
|
|
@@ -3192,11 +3255,11 @@ function useAccounts() {
|
|
|
3192
3255
|
return m ? membershipToMountRef(m) : null;
|
|
3193
3256
|
}).catch(setMountError);
|
|
3194
3257
|
}
|
|
3195
|
-
autoSelectedRef.current =
|
|
3258
|
+
autoSelectedRef.current = principalId;
|
|
3196
3259
|
} else if (electionCandidates.length > 1) {
|
|
3197
|
-
autoSelectedRef.current =
|
|
3260
|
+
autoSelectedRef.current = principalId;
|
|
3198
3261
|
}
|
|
3199
|
-
}, [
|
|
3262
|
+
}, [principalId, electionCandidates, allMemberships]);
|
|
3200
3263
|
const switchAccount = useCallback(async (accountPath) => {
|
|
3201
3264
|
const m = allMemberships.find((a) => a.path === accountPath);
|
|
3202
3265
|
if (!m) throw new Error("Account membership is unavailable");
|
|
@@ -3219,15 +3282,17 @@ function useAccounts() {
|
|
|
3219
3282
|
if (!m) throw new Error("Scope membership is unavailable");
|
|
3220
3283
|
await mount(membershipToMountRef(m));
|
|
3221
3284
|
}, [allMemberships]);
|
|
3285
|
+
const awaitingPrincipal = (!!user?.id || embedTokenConfigured()) && !principalId && !sessionError;
|
|
3222
3286
|
return {
|
|
3223
3287
|
accounts: electionCandidates,
|
|
3288
|
+
switcherAccounts,
|
|
3224
3289
|
allMemberships,
|
|
3225
3290
|
currentAccount,
|
|
3226
3291
|
mountedScope: null,
|
|
3227
3292
|
switchAccount,
|
|
3228
3293
|
mountScope,
|
|
3229
|
-
loading: query.isLoading,
|
|
3230
|
-
error: query.error ?? mountError
|
|
3294
|
+
loading: awaitingPrincipal || query.isLoading,
|
|
3295
|
+
error: sessionError ?? query.error ?? mountError
|
|
3231
3296
|
};
|
|
3232
3297
|
}
|
|
3233
3298
|
function useMounts() {
|