@ai4b-team/fsaos-gateway-sdk 4.3.0 → 5.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/dist/index.d.cts CHANGED
@@ -2200,8 +2200,20 @@ declare function useAsset(idOrPath: string | undefined | null): {
2200
2200
  loading: boolean;
2201
2201
  error: Error | null;
2202
2202
  };
2203
+ interface UseComponentOptions {
2204
+ /**
2205
+ * Load exactly this published version of the component. The caller passes
2206
+ * the live version it reads from the component item (for example with
2207
+ * `useItem`, which a change event keeps current); when the number changes,
2208
+ * the new version loads and replaces the one on screen. Without it the
2209
+ * edge is asked which version is live, once, when the path is first loaded.
2210
+ * A caller that pins versions passes a null path until it knows the version.
2211
+ * If a new version fails to load, the one on screen stays and `error` is set.
2212
+ */
2213
+ version?: number | null;
2214
+ }
2203
2215
  /** Dynamically load a component from the edge. */
2204
- declare function useComponent(path: string | undefined | null): {
2216
+ declare function useComponent(path: string | undefined | null, options?: UseComponentOptions): {
2205
2217
  Component: any;
2206
2218
  loading: boolean;
2207
2219
  error: Error | null;
@@ -2266,12 +2278,6 @@ declare function usePrincipal(): {
2266
2278
  loading: boolean;
2267
2279
  error: null;
2268
2280
  };
2269
- /** Stub: useTool — returns null tool data. */
2270
- declare function useTool(): {
2271
- data: null;
2272
- loading: boolean;
2273
- error: null;
2274
- };
2275
2281
  /** <ComponentRenderer path="..." /> — runtime composition primitive. */
2276
2282
  declare function ComponentRenderer(props: {
2277
2283
  path: string;
@@ -3142,6 +3148,8 @@ interface UploadOptions {
3142
3148
  parentPath: string;
3143
3149
  /** Override the file name (defaults to File.name). */
3144
3150
  name?: string;
3151
+ /** On a name collision, save a numbered sibling (default) or return NAME_TAKEN. */
3152
+ collisionPolicy?: 'keep_both' | 'fail';
3145
3153
  /** Override item_type (defaults to 'file'). */
3146
3154
  itemType?: string;
3147
3155
  /** Additional type_data fields to merge onto the created item. */
@@ -3660,4 +3668,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
3660
3668
  contextKey: string;
3661
3669
  };
3662
3670
 
3663
- export { type AcceptInviteParams, type AcceptInviteResult, type AccountInfo, type AnswerInputParams, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, CHANNEL_AI_MODES, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelAiMode, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateAgentParams, type CreateAgentResult, 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 InviteMemberParams, type InviteMemberResult, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MemberRole, 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 SeatMemberParams, 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, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createAgent, 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, inviteMember, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, 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, useAcceptInvite, useAccounts, useAgentTimeline, useAllChannels, useAnswerInput, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, 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, useSeatMember, useTheme, useTimelineHistory, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
3671
+ export { type AcceptInviteParams, type AcceptInviteResult, type AccountInfo, type AnswerInputParams, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, CHANNEL_AI_MODES, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelAiMode, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateAgentParams, type CreateAgentResult, 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 InviteMemberParams, type InviteMemberResult, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MemberRole, 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 SeatMemberParams, 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, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createAgent, 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, inviteMember, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, 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, useAcceptInvite, useAccounts, useAgentTimeline, useAllChannels, useAnswerInput, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, 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, useSeatMember, useTheme, useTimelineHistory, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
package/dist/index.d.ts CHANGED
@@ -2200,8 +2200,20 @@ declare function useAsset(idOrPath: string | undefined | null): {
2200
2200
  loading: boolean;
2201
2201
  error: Error | null;
2202
2202
  };
2203
+ interface UseComponentOptions {
2204
+ /**
2205
+ * Load exactly this published version of the component. The caller passes
2206
+ * the live version it reads from the component item (for example with
2207
+ * `useItem`, which a change event keeps current); when the number changes,
2208
+ * the new version loads and replaces the one on screen. Without it the
2209
+ * edge is asked which version is live, once, when the path is first loaded.
2210
+ * A caller that pins versions passes a null path until it knows the version.
2211
+ * If a new version fails to load, the one on screen stays and `error` is set.
2212
+ */
2213
+ version?: number | null;
2214
+ }
2203
2215
  /** Dynamically load a component from the edge. */
2204
- declare function useComponent(path: string | undefined | null): {
2216
+ declare function useComponent(path: string | undefined | null, options?: UseComponentOptions): {
2205
2217
  Component: any;
2206
2218
  loading: boolean;
2207
2219
  error: Error | null;
@@ -2266,12 +2278,6 @@ declare function usePrincipal(): {
2266
2278
  loading: boolean;
2267
2279
  error: null;
2268
2280
  };
2269
- /** Stub: useTool — returns null tool data. */
2270
- declare function useTool(): {
2271
- data: null;
2272
- loading: boolean;
2273
- error: null;
2274
- };
2275
2281
  /** <ComponentRenderer path="..." /> — runtime composition primitive. */
2276
2282
  declare function ComponentRenderer(props: {
2277
2283
  path: string;
@@ -3142,6 +3148,8 @@ interface UploadOptions {
3142
3148
  parentPath: string;
3143
3149
  /** Override the file name (defaults to File.name). */
3144
3150
  name?: string;
3151
+ /** On a name collision, save a numbered sibling (default) or return NAME_TAKEN. */
3152
+ collisionPolicy?: 'keep_both' | 'fail';
3145
3153
  /** Override item_type (defaults to 'file'). */
3146
3154
  itemType?: string;
3147
3155
  /** Additional type_data fields to merge onto the created item. */
@@ -3660,4 +3668,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
3660
3668
  contextKey: string;
3661
3669
  };
3662
3670
 
3663
- export { type AcceptInviteParams, type AcceptInviteResult, type AccountInfo, type AnswerInputParams, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, CHANNEL_AI_MODES, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelAiMode, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateAgentParams, type CreateAgentResult, 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 InviteMemberParams, type InviteMemberResult, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MemberRole, 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 SeatMemberParams, 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, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createAgent, 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, inviteMember, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, 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, useAcceptInvite, useAccounts, useAgentTimeline, useAllChannels, useAnswerInput, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, 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, useSeatMember, useTheme, useTimelineHistory, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
3671
+ export { type AcceptInviteParams, type AcceptInviteResult, type AccountInfo, type AnswerInputParams, type ArtifactDeltaEvent, type ArtifactDoneEvent, type ArtifactEvent, type ArtifactOpenedEvent, type ArtifactState, type ArtifactStatus, type ArtifactStreamState, type ArtifactSurfaceType, CHANNEL_AI_MODES, type CancelQueuedTurnOptions, type CancelQueuedTurnResponse, type CancelQueuedTurnState, type CancelTurnOptions, type CancelTurnResponse, type CancelTurnState, type Channel, type ChannelAiMode, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateAgentParams, type CreateAgentResult, 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 InviteMemberParams, type InviteMemberResult, type ItemVersionsOptions, type ItemVersionsResult, type ItemsDiscovery, type ItemsFilter, type ItemsFilterGroup, KernelProvider, type LinkParams, type LoadMountsOptions, type MemberRole, 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 SeatMemberParams, 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, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createAgent, 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, inviteMember, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, 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, useAcceptInvite, useAccounts, useAgentTimeline, useAllChannels, useAnswerInput, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, 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, useSeatMember, useTheme, useTimelineHistory, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useState, useRef, useEffect, useSyncExternalStore, useCallback, createElement, useLayoutEffect } from 'react';
1
+ import React, { createElement, useMemo, useState, useRef, useEffect, useSyncExternalStore, useCallback, useLayoutEffect } from 'react';
2
2
  import { QueryClient, QueryClientProvider, useQuery, useInfiniteQuery, useQueryClient, useMutation as useMutation$1 } from '@tanstack/react-query';
3
3
  export { QueryClientProvider } from '@tanstack/react-query';
4
4
  import { createClient } from '@supabase/supabase-js';
@@ -198,7 +198,6 @@ __export(src_exports, {
198
198
  useSeatMember: () => useSeatMember,
199
199
  useTheme: () => useTheme,
200
200
  useTimelineHistory: () => useTimelineHistory,
201
- useTool: () => useTool,
202
201
  useTree: () => useTree,
203
202
  useType: () => useType,
204
203
  useTypeHelpers: () => useTypeHelpers,
@@ -2531,6 +2530,204 @@ function replaceMounts(refs, anchor) {
2531
2530
  });
2532
2531
  }
2533
2532
 
2533
+ // src/ui.ts
2534
+ var ui_exports = {};
2535
+ __export(ui_exports, {
2536
+ Badge: () => Badge,
2537
+ Breadcrumbs: () => Breadcrumbs,
2538
+ Button: () => Button,
2539
+ Card: () => Card,
2540
+ DataView: () => DataView,
2541
+ Detail: () => Detail,
2542
+ Empty: () => Empty,
2543
+ FilePreview: () => FilePreview,
2544
+ Form: () => Form,
2545
+ Grid: () => Grid,
2546
+ Image: () => Image,
2547
+ Link: () => Link,
2548
+ Page: () => Page,
2549
+ Router: () => Router,
2550
+ Sidebar: () => Sidebar,
2551
+ Spinner: () => Spinner,
2552
+ Stack: () => Stack,
2553
+ Table: () => Table,
2554
+ Tabs: () => Tabs,
2555
+ Video: () => Video
2556
+ });
2557
+ function getEdgeBaseUrl() {
2558
+ const config2 = typeof window !== "undefined" && window.__FSAOS_CONFIG__ || {};
2559
+ return config2.edgeBaseUrl || "";
2560
+ }
2561
+ function Page(props) {
2562
+ return createElement("div", {
2563
+ style: { minHeight: "100vh", display: "flex", flexDirection: "column" },
2564
+ className: props.className || ""
2565
+ }, props.children);
2566
+ }
2567
+ function Stack(props) {
2568
+ const dir = props.direction || "vertical";
2569
+ return createElement("div", {
2570
+ style: {
2571
+ display: "flex",
2572
+ flexDirection: dir === "horizontal" ? "row" : "column",
2573
+ gap: props.gap || "0.5rem",
2574
+ padding: props.padding || "0",
2575
+ alignItems: props.align || "stretch",
2576
+ justifyContent: props.justify || "flex-start",
2577
+ flex: props.flex || "initial"
2578
+ },
2579
+ className: props.className || ""
2580
+ }, props.children);
2581
+ }
2582
+ function Grid(props) {
2583
+ return createElement("div", {
2584
+ style: {
2585
+ display: "grid",
2586
+ gridTemplateColumns: "repeat(" + (props.columns || 3) + ", 1fr)",
2587
+ gap: props.gap || "1rem",
2588
+ padding: props.padding || "0"
2589
+ },
2590
+ className: props.className || ""
2591
+ }, props.children);
2592
+ }
2593
+ function Sidebar(props) {
2594
+ return createElement("div", {
2595
+ style: { display: "flex", flexDirection: "row", minHeight: "100vh" },
2596
+ className: props.className || ""
2597
+ }, props.children);
2598
+ }
2599
+ function Card(props) {
2600
+ return createElement("div", {
2601
+ style: {
2602
+ border: "1px solid var(--color-border, #e5e7eb)",
2603
+ borderRadius: "var(--border-radius, 0.5rem)",
2604
+ padding: props.padding || "1rem",
2605
+ background: "var(--color-surface, #fff)"
2606
+ },
2607
+ className: props.className || "",
2608
+ onClick: props.onClick
2609
+ }, props.children);
2610
+ }
2611
+ function Badge(props) {
2612
+ return createElement("span", {
2613
+ style: {
2614
+ display: "inline-flex",
2615
+ alignItems: "center",
2616
+ padding: "0.125rem 0.5rem",
2617
+ fontSize: "0.75rem",
2618
+ fontWeight: "500",
2619
+ borderRadius: "9999px",
2620
+ background: props.color || "#e5e7eb",
2621
+ color: props.textColor || "#374151"
2622
+ },
2623
+ className: props.className || ""
2624
+ }, props.children || props.label);
2625
+ }
2626
+ function Spinner(props) {
2627
+ const size = props.size || "1.5rem";
2628
+ return createElement("div", {
2629
+ style: {
2630
+ width: size,
2631
+ height: size,
2632
+ border: "2px solid #e5e7eb",
2633
+ borderTopColor: "var(--color-primary, #3b82f6)",
2634
+ borderRadius: "50%",
2635
+ animation: "fsaos-spin 0.6s linear infinite"
2636
+ }
2637
+ });
2638
+ }
2639
+ function Button(props) {
2640
+ return createElement("button", {
2641
+ style: {
2642
+ display: "inline-flex",
2643
+ alignItems: "center",
2644
+ justifyContent: "center",
2645
+ padding: "0.5rem 1rem",
2646
+ fontSize: "0.875rem",
2647
+ fontWeight: "500",
2648
+ borderRadius: "var(--border-radius, 0.375rem)",
2649
+ border: props.variant === "outline" ? "1px solid var(--color-border, #d1d5db)" : "none",
2650
+ background: props.variant === "outline" || props.variant === "ghost" ? "transparent" : "var(--color-primary, #3b82f6)",
2651
+ color: props.variant === "outline" || props.variant === "ghost" ? "var(--color-text, #1a1a1a)" : "#fff",
2652
+ cursor: props.disabled ? "not-allowed" : "pointer",
2653
+ opacity: props.disabled ? "0.5" : "1",
2654
+ gap: "0.5rem"
2655
+ },
2656
+ className: props.className || "",
2657
+ onClick: props.onClick,
2658
+ disabled: props.disabled
2659
+ }, props.children || props.label);
2660
+ }
2661
+ function Empty(props) {
2662
+ return createElement(
2663
+ "div",
2664
+ {
2665
+ style: {
2666
+ display: "flex",
2667
+ flexDirection: "column",
2668
+ alignItems: "center",
2669
+ justifyContent: "center",
2670
+ padding: "3rem",
2671
+ color: "var(--color-text-secondary, #6b7280)",
2672
+ textAlign: "center"
2673
+ }
2674
+ },
2675
+ props.icon ? createElement("div", { style: { fontSize: "2rem", marginBottom: "0.5rem" } }, props.icon) : null,
2676
+ createElement(
2677
+ "div",
2678
+ { style: { fontWeight: 500, marginBottom: "0.25rem" } },
2679
+ props.title || props.message || props.children || "No items"
2680
+ ),
2681
+ props.description ? createElement("div", { style: { fontSize: "0.875rem", opacity: 0.7 } }, props.description) : null
2682
+ );
2683
+ }
2684
+ function DataView(props) {
2685
+ return createElement("div", { className: props.className || "" }, props.children);
2686
+ }
2687
+ function Table(props) {
2688
+ return createElement("table", { className: props.className || "" }, props.children);
2689
+ }
2690
+ function Form(props) {
2691
+ return createElement("form", { className: props.className || "", onSubmit: props.onSubmit }, props.children);
2692
+ }
2693
+ function Detail(props) {
2694
+ return createElement("div", { className: props.className || "" }, props.children);
2695
+ }
2696
+ function Router(props) {
2697
+ return createElement("div", null, props.children);
2698
+ }
2699
+ function Link(props) {
2700
+ return createElement("a", {
2701
+ href: props.href || props.to,
2702
+ className: props.className || "",
2703
+ onClick: props.onClick
2704
+ }, props.children);
2705
+ }
2706
+ function Tabs(props) {
2707
+ return createElement("div", { className: props.className || "" }, props.children);
2708
+ }
2709
+ function Breadcrumbs(props) {
2710
+ return createElement("nav", { className: props.className || "" }, props.children);
2711
+ }
2712
+ function Image(props) {
2713
+ return createElement("img", {
2714
+ src: props.src || (props.path ? getEdgeBaseUrl() + props.path : ""),
2715
+ alt: props.alt || "",
2716
+ className: props.className || "",
2717
+ style: props.style
2718
+ });
2719
+ }
2720
+ function Video(props) {
2721
+ return createElement("video", {
2722
+ src: props.src || (props.path ? getEdgeBaseUrl() + props.path : ""),
2723
+ controls: true,
2724
+ className: props.className || ""
2725
+ });
2726
+ }
2727
+ function FilePreview(props) {
2728
+ return createElement("div", { className: props.className || "" }, props.children || "File preview");
2729
+ }
2730
+
2534
2731
  // src/mounted-reader-events.ts
2535
2732
  function inMountedReadScope(event) {
2536
2733
  if (typeof event.path !== "string") return false;
@@ -3471,7 +3668,6 @@ function useAsset(idOrPath) {
3471
3668
  return { data, loading, error };
3472
3669
  }
3473
3670
  var componentCache = {};
3474
- var componentCssCache = {};
3475
3671
  registerCleanup(() => {
3476
3672
  for (const key of Object.keys(componentCache)) {
3477
3673
  delete componentCache[key];
@@ -3496,9 +3692,11 @@ function sdkRequireShim(name) {
3496
3692
  return typeof window !== "undefined" && window.React ? { jsx: window.React.createElement, jsxs: window.React.createElement, Fragment: window.React.Fragment } : JsxRuntime;
3497
3693
  case "@fsaos/gateway":
3498
3694
  case "@fsaos/react":
3695
+ case "@ai4b-team/fsaos-gateway-sdk":
3499
3696
  return typeof window !== "undefined" && window.__FSAOS_GATEWAY__ || _sdkExports || {};
3500
3697
  case "@fsaos/ui":
3501
- return typeof window !== "undefined" && window.__FSAOS_UI__ || {};
3698
+ case "@ai4b-team/fsaos-gateway-sdk/ui":
3699
+ return typeof window !== "undefined" && window.__FSAOS_UI__ || ui_exports;
3502
3700
  case "@fsaos/theme":
3503
3701
  return {};
3504
3702
  default:
@@ -3506,29 +3704,41 @@ function sdkRequireShim(name) {
3506
3704
  return {};
3507
3705
  }
3508
3706
  }
3509
- function scopeComponentCss(cssText, scopeClass) {
3510
- return cssText.replace(
3511
- /^(\s*)(:root|body)(\s*[{,])/gm,
3512
- (_match, ws2, _sel, rest) => `${ws2}.${scopeClass}${rest}`
3513
- );
3514
- }
3515
- async function loadComponentCss(cssUrl, scopeId) {
3516
- if (componentCssCache[cssUrl]) return;
3707
+ var componentCss = {};
3708
+ async function fetchComponentCss(cssUrl) {
3517
3709
  try {
3518
3710
  const response = await fetch(cssUrl);
3519
- if (!response.ok) return;
3520
- let cssText = await response.text();
3521
- if (!cssText.trim()) return;
3522
- if (cssText.includes("No CSS bundle for this component")) return;
3523
- if (scopeId && !cssText.includes(`.fsaos-c-${scopeId}`)) ;
3524
- const style = document.createElement("style");
3525
- style.setAttribute("data-fsaos-component-css", cssUrl);
3526
- if (scopeId) ;
3527
- style.textContent = cssText;
3528
- document.head.appendChild(style);
3529
- componentCssCache[cssUrl] = style;
3711
+ if (!response.ok) return null;
3712
+ const cssText = await response.text();
3713
+ if (!cssText.trim()) return null;
3714
+ if (cssText.includes("No CSS bundle for this component")) return null;
3715
+ return cssText;
3530
3716
  } catch {
3717
+ return null;
3718
+ }
3719
+ }
3720
+ async function holdComponentCss(cssUrl) {
3721
+ let entry = componentCss[cssUrl];
3722
+ if (!entry) {
3723
+ entry = componentCss[cssUrl] = { users: 0, text: fetchComponentCss(cssUrl), style: null };
3531
3724
  }
3725
+ entry.users += 1;
3726
+ const cssText = await entry.text;
3727
+ if (componentCss[cssUrl] !== entry || entry.users === 0 || entry.style || !cssText) return;
3728
+ if (typeof document === "undefined") return;
3729
+ const style = document.createElement("style");
3730
+ style.setAttribute("data-fsaos-component-css", cssUrl);
3731
+ style.textContent = cssText;
3732
+ document.head.appendChild(style);
3733
+ entry.style = style;
3734
+ }
3735
+ function releaseComponentCss(cssUrl) {
3736
+ const entry = componentCss[cssUrl];
3737
+ if (!entry) return;
3738
+ entry.users -= 1;
3739
+ if (entry.users > 0) return;
3740
+ entry.style?.remove();
3741
+ delete componentCss[cssUrl];
3532
3742
  }
3533
3743
  function evaluateBundle(jsCode) {
3534
3744
  let registered = null;
@@ -3555,65 +3765,84 @@ function evaluateBundle(jsCode) {
3555
3765
  }
3556
3766
  }
3557
3767
  }
3558
- function useComponent(path) {
3768
+ function useComponent(path, options) {
3559
3769
  const [Component, setComponent] = useState(null);
3560
3770
  const [loading, setLoading] = useState(true);
3561
3771
  const [error, setError] = useState(null);
3772
+ const shown = useRef(null);
3773
+ const pinnedVersion = Number.isSafeInteger(options?.version) && options.version > 0 ? options.version : null;
3562
3774
  useEffect(() => {
3563
3775
  if (!path) return;
3564
3776
  let cancelled = false;
3565
- setLoading(true);
3566
3777
  setError(null);
3778
+ if (shown.current?.path !== path) {
3779
+ if (shown.current?.cssUrl) releaseComponentCss(shown.current.cssUrl);
3780
+ shown.current = null;
3781
+ setComponent(null);
3782
+ setLoading(true);
3783
+ }
3567
3784
  const config2 = typeof window !== "undefined" && window.__FSAOS_CONFIG__ || {};
3568
3785
  const edgeBaseUrl = config2.edgeBaseUrl || "";
3569
3786
  (async () => {
3787
+ let heldCssUrl = null;
3570
3788
  try {
3571
3789
  let version = 1;
3572
3790
  let cacheKey = path + "@v1";
3573
3791
  let bundleUrl = edgeBaseUrl + path + "/__bundle.js";
3574
- try {
3575
- const metaResponse = await fetch(edgeBaseUrl + path + "/__meta", { cache: "no-store" });
3576
- if (metaResponse.ok) {
3577
- const meta = await metaResponse.json();
3578
- version = meta.version || 1;
3579
- cacheKey = path + "@v" + version;
3580
- bundleUrl = edgeBaseUrl + path + "/__bundle.v" + version + ".js";
3792
+ if (pinnedVersion !== null) {
3793
+ version = pinnedVersion;
3794
+ cacheKey = path + "@v" + version;
3795
+ bundleUrl = edgeBaseUrl + path + "/__bundle.v" + version + ".js";
3796
+ } else {
3797
+ try {
3798
+ const metaResponse = await fetch(edgeBaseUrl + path + "/__meta", { cache: "no-store" });
3799
+ if (metaResponse.ok) {
3800
+ const meta = await metaResponse.json();
3801
+ version = meta.version || 1;
3802
+ cacheKey = path + "@v" + version;
3803
+ bundleUrl = edgeBaseUrl + path + "/__bundle.v" + version + ".js";
3804
+ }
3805
+ } catch {
3806
+ bundleUrl = edgeBaseUrl + path + "/__bundle.js?v=" + Date.now();
3581
3807
  }
3582
- } catch {
3583
- bundleUrl = edgeBaseUrl + path + "/__bundle.js?v=" + Date.now();
3584
- }
3585
- if (cancelled) return;
3586
- if (componentCache[cacheKey]) {
3587
- setComponent(() => componentCache[cacheKey]);
3588
- setLoading(false);
3589
- return;
3590
- }
3591
- const jsResponse = await fetch(bundleUrl);
3592
- if (!jsResponse.ok) {
3593
- throw new Error(
3594
- `Failed to fetch bundle: ${jsResponse.status} ${jsResponse.statusText} (${bundleUrl})`
3595
- );
3596
3808
  }
3597
- const jsCode = await jsResponse.text();
3598
3809
  if (cancelled) return;
3599
3810
  const cssUrl = bundleUrl.replace(/__bundle(\.v\d+)?\.js(\?.*)?$/, "__bundle$1.css");
3600
- loadComponentCss(cssUrl).catch(() => {
3601
- });
3602
- const resolved = evaluateBundle(jsCode);
3811
+ heldCssUrl = cssUrl;
3812
+ const cssReady = holdComponentCss(cssUrl);
3813
+ let resolved = componentCache[cacheKey];
3603
3814
  if (!resolved) {
3604
- throw new Error(
3605
- "Bundle did not export a component. Expected window.__FSAOS_COMPONENT__ (FSAOS build) or a __FSAOS_REGISTER__(Component) call."
3606
- );
3607
- }
3608
- if (typeof resolved !== "function") {
3609
- throw new Error(`Bundle export is not a React component (got ${typeof resolved})`);
3815
+ const jsResponse = await fetch(bundleUrl);
3816
+ if (!jsResponse.ok) {
3817
+ throw new Error(
3818
+ `Failed to fetch bundle: ${jsResponse.status} ${jsResponse.statusText} (${bundleUrl})`
3819
+ );
3820
+ }
3821
+ const jsCode = await jsResponse.text();
3822
+ resolved = evaluateBundle(jsCode);
3823
+ if (!resolved) {
3824
+ throw new Error(
3825
+ "Bundle did not export a component. Expected window.__FSAOS_COMPONENT__ (FSAOS build) or a __FSAOS_REGISTER__(Component) call."
3826
+ );
3827
+ }
3828
+ if (typeof resolved !== "function") {
3829
+ throw new Error(`Bundle export is not a React component (got ${typeof resolved})`);
3830
+ }
3831
+ componentCache[cacheKey] = resolved;
3610
3832
  }
3611
- componentCache[cacheKey] = resolved;
3612
- if (!cancelled) {
3613
- setComponent(() => resolved);
3614
- setLoading(false);
3833
+ await cssReady;
3834
+ if (cancelled) {
3835
+ releaseComponentCss(cssUrl);
3836
+ return;
3615
3837
  }
3838
+ const previousCssUrl = shown.current?.cssUrl ?? null;
3839
+ shown.current = { path, cssUrl };
3840
+ heldCssUrl = null;
3841
+ setComponent(() => resolved);
3842
+ setLoading(false);
3843
+ if (previousCssUrl) releaseComponentCss(previousCssUrl);
3616
3844
  } catch (err) {
3845
+ if (heldCssUrl) releaseComponentCss(heldCssUrl);
3617
3846
  if (!cancelled) {
3618
3847
  setError(err instanceof Error ? err : new Error(String(err)));
3619
3848
  setLoading(false);
@@ -3623,7 +3852,11 @@ function useComponent(path) {
3623
3852
  return () => {
3624
3853
  cancelled = true;
3625
3854
  };
3626
- }, [path]);
3855
+ }, [path, pinnedVersion]);
3856
+ useEffect(() => () => {
3857
+ if (shown.current?.cssUrl) releaseComponentCss(shown.current.cssUrl);
3858
+ shown.current = null;
3859
+ }, []);
3627
3860
  return { Component, loading, error };
3628
3861
  }
3629
3862
  var THEME_PROPERTIES = [
@@ -3797,9 +4030,6 @@ function usePrincipal() {
3797
4030
  error: null
3798
4031
  };
3799
4032
  }
3800
- function useTool() {
3801
- return { data: null, loading: false, error: null };
3802
- }
3803
4033
  function ComponentRenderer(props) {
3804
4034
  const { path, ...rest } = props;
3805
4035
  const result = useComponent(path);
@@ -5634,14 +5864,27 @@ function getRequiredFormFields(typeDef) {
5634
5864
  (f) => required.has(f.key) || f.default_value === void 0
5635
5865
  );
5636
5866
  }
5637
- var _idCounter = 0;
5638
5867
  function generateUploadId() {
5639
- return `upload_${Date.now()}_${++_idCounter}`;
5868
+ if (globalThis.crypto?.randomUUID) return globalThis.crypto.randomUUID();
5869
+ const bytes = new Uint8Array(16);
5870
+ if (globalThis.crypto?.getRandomValues) {
5871
+ globalThis.crypto.getRandomValues(bytes);
5872
+ bytes[6] = bytes[6] & 15 | 64;
5873
+ bytes[8] = bytes[8] & 63 | 128;
5874
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
5875
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
5876
+ }
5877
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
5878
+ const n = Math.floor(Math.random() * 16);
5879
+ return (c === "x" ? n : n & 3 | 8).toString(16);
5880
+ });
5640
5881
  }
5641
5882
  async function uploadFile(file, options, onProgress, signal2) {
5642
5883
  const fileName = options.name || (file instanceof File ? file.name : `file-${Date.now()}`);
5643
5884
  const contentType = file.type || "application/octet-stream";
5644
5885
  const itemType = options.itemType || "file";
5886
+ const collisionPolicy = options.collisionPolicy || "keep_both";
5887
+ const uploadId = collisionPolicy === "keep_both" ? generateUploadId() : void 0;
5645
5888
  const createParams = {
5646
5889
  parent_path: options.parentPath,
5647
5890
  item_type: itemType,
@@ -5650,7 +5893,9 @@ async function uploadFile(file, options, onProgress, signal2) {
5650
5893
  ...options.typeData || {},
5651
5894
  file_source: {
5652
5895
  type: "upload",
5653
- content_type: contentType
5896
+ content_type: contentType,
5897
+ collision_policy: collisionPolicy,
5898
+ ...uploadId ? { upload_id: uploadId } : {}
5654
5899
  }
5655
5900
  }
5656
5901
  };
@@ -5752,6 +5997,7 @@ function useFileUpload() {
5752
5997
  const fileName = options.name || file.name;
5753
5998
  const contentType = file.type || "application/octet-stream";
5754
5999
  const itemType = options.itemType || "file";
6000
+ const collisionPolicy = options.collisionPolicy || "keep_both";
5755
6001
  let itemId = existingState?.itemId || null;
5756
6002
  let itemPath = existingState?.itemPath || null;
5757
6003
  let storageKey = existingState?.storageKey || null;
@@ -5768,7 +6014,9 @@ function useFileUpload() {
5768
6014
  ...options.typeData || {},
5769
6015
  file_source: {
5770
6016
  type: "upload",
5771
- content_type: contentType
6017
+ content_type: contentType,
6018
+ collision_policy: collisionPolicy,
6019
+ ...collisionPolicy === "keep_both" ? { upload_id: uploadId } : {}
5772
6020
  }
5773
6021
  }
5774
6022
  });
@@ -6348,6 +6596,6 @@ function usePersonalSections(contextId, collection) {
6348
6596
  // src/index.ts
6349
6597
  __registerSdkExports(src_exports);
6350
6598
 
6351
- export { CHANNEL_AI_MODES, ComponentRenderer, EnforcementDeniedError, FormSubmissionError, GatewayRequestError, InteractionTrackingError, KernelProvider, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createAgent, 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, inviteMember, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount2 as mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, 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, useAcceptInvite, useAccounts, useAgentTimeline, useAllChannels, useAnswerInput, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, 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, useSeatMember, useTheme, useTimelineHistory, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
6599
+ export { CHANNEL_AI_MODES, ComponentRenderer, EnforcementDeniedError, FormSubmissionError, GatewayRequestError, InteractionTrackingError, KernelProvider, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, createAgent, 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, inviteMember, isAnchorReady, isChannelPath, isListableItemsFilter, isScopeReady, itemsFilterFromQueryFilter, listChildren, loadMounts, mount2 as mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, replaceMounts, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, 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, useAcceptInvite, useAccounts, useAgentTimeline, useAllChannels, useAnswerInput, useArrangement, useArtifactStream, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, 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, useSeatMember, useTheme, useTimelineHistory, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
6352
6600
  //# sourceMappingURL=index.js.map
6353
6601
  //# sourceMappingURL=index.js.map