@ai4b-team/fsaos-gateway-sdk 5.2.0 → 5.4.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
@@ -352,6 +352,8 @@ declare class EnforcementDeniedError extends Error {
352
352
  readonly deniedBy: string;
353
353
  readonly ruleKey?: string;
354
354
  readonly displayName?: string;
355
+ /** The kernel's denial as it arrived, so a host can pass it to a framed page whole. */
356
+ readonly payload: EnforcementPayload;
355
357
  constructor(payload: EnforcementPayload);
356
358
  static fallbackMessage(payload: EnforcementPayload): string;
357
359
  get isRuleDenial(): boolean;
@@ -542,6 +544,8 @@ interface AccountInfo {
542
544
  isOwner?: boolean;
543
545
  billingResponsible?: boolean;
544
546
  grantedVia?: 'self_provisioned' | 'invitation' | 'purchase' | 'seat_assignment' | null;
547
+ /** Server-verified accepted invitation for this active account membership. */
548
+ invitationAccepted?: boolean;
545
549
  grantedUnderAccountId?: string | null;
546
550
  membershipPath?: string | null;
547
551
  personalSpaceId?: string | null;
@@ -665,6 +669,67 @@ declare class GatewayRequestError extends Error {
665
669
  }
666
670
  declare function gatewayCall(method: string, params?: GatewayParams, options?: GatewayRequestOptions): Promise<GatewayResponse>;
667
671
 
672
+ /**
673
+ * @fsaos/gateway — Host session (the framed page's side)
674
+ *
675
+ * A page whose host holds the session makes no kernel call of its own. It
676
+ * asks the window that frames it, and that window makes the call with the
677
+ * session it already has. A RevDev desk preview inside the builder works this
678
+ * way: the previewed page holds no credential, nothing secret is in its
679
+ * address, and its calls go through the same gateway door, as the same
680
+ * person, as the app around it.
681
+ *
682
+ * The host's side is `serveHostSession` (host-session-serve.ts).
683
+ *
684
+ * Messages (all carry `fsaos: 'host-session'`):
685
+ * page → host { kind: 'hello' }
686
+ * host → page { kind: 'welcome', anchor, item }
687
+ * page → host { kind: 'call', id, method, params }
688
+ * host → page { kind: 'result', id, ok: true, response }
689
+ * | { kind: 'result', id, ok: false, error }
690
+ */
691
+
692
+ /** The page has no host to ask: it is not framed, or its frame did not answer. */
693
+ declare class HostSessionUnavailableError extends Error {
694
+ readonly name = "HostSessionUnavailableError";
695
+ }
696
+ /** What the host hands the page when it answers. */
697
+ interface HostSessionWelcome {
698
+ /** The item the framed app is handed, or null when the host named none. */
699
+ item: OpenEnvelope | null;
700
+ }
701
+ /**
702
+ * Meet the host. Call once before the first render: it sets the anchor the
703
+ * host is standing on and returns the item the app is handed. Rejects with
704
+ * `HostSessionUnavailableError` when the page has no host.
705
+ */
706
+ declare function connectHostSession(): Promise<HostSessionWelcome>;
707
+
708
+ /**
709
+ * @fsaos/gateway — Host session (the host's side)
710
+ *
711
+ * The app that frames a page started with `hostSession` answers that page's
712
+ * kernel calls with its own session. See host-session.ts for the messages.
713
+ *
714
+ * The framed page's code runs as the signed-in person for as long as it is
715
+ * served, exactly as a screen opened inside the app does. Serve only a frame
716
+ * the person chose to open.
717
+ */
718
+
719
+ interface ServeHostSessionOptions {
720
+ /** The framed window. A message from any other window is ignored. */
721
+ frame: () => Window | null | undefined;
722
+ /** The framed page's origin. A message from any other origin is ignored. */
723
+ origin: string;
724
+ /** The item the framed app is handed, as this app would hand it. */
725
+ item?: () => OpenEnvelope | null | undefined;
726
+ }
727
+ /**
728
+ * Answer one framed page. Returns the function that stops answering; call it
729
+ * when the frame goes away.
730
+ */
731
+ declare function serveHostSession(options: ServeHostSessionOptions): () => void;
732
+
668
733
  /**
669
734
  * Governed execution control.
670
735
  *
@@ -851,12 +916,12 @@ declare global {
851
916
  tracking?: {
852
917
  enabled?: boolean;
853
918
  };
854
- /** The page's own host holds the session. Set by a host that serves the
855
- * page and forwards its kernel calls to the gateway itself, attaching
856
- * the caller's identity there (a RevDev desk preview). `gatewayUrl` is
857
- * that host's forwarding address. The SDK then sends no bearer, does
858
- * not wait for a sign-in, and opens no realtime connection: the page
859
- * holds no credential and the host has no event stream to offer. */
919
+ /** The page's host holds the session. Set by a host that frames the page
920
+ * and answers its kernel calls with `serveHostSession` (a RevDev desk
921
+ * preview inside the builder). The SDK then makes every kernel call
922
+ * through the framing window, sends no bearer, does not wait for a
923
+ * sign-in, and opens no realtime connection: the page holds no
924
+ * credential. Outside its host the page has no session at all. */
860
925
  hostSession?: boolean;
861
926
  };
862
927
  }
@@ -2950,7 +3015,7 @@ interface InviteMemberResult {
2950
3015
  /** The member item the invite minted — `pending` until the person accepts. */
2951
3016
  member_id: string;
2952
3017
  member_path?: string;
2953
- status: 'pending' | 'active';
3018
+ status: 'pending' | 'invited' | 'active';
2954
3019
  role: MemberRole;
2955
3020
  email: string;
2956
3021
  /** `invited_to_scope` for an account, `invited_to_space` for a space. */
@@ -2960,7 +3025,8 @@ interface InviteMemberResult {
2960
3025
  [key: string]: unknown;
2961
3026
  }
2962
3027
  /**
2963
- * Invite a person into an account or space. Errors: `ROLE_ABOVE_INVITER`,
3028
+ * Legacy membership creation; this call does not deliver an email. Use
3029
+ * createInvitation for a scoped email invitation. Errors: `ROLE_ABOVE_INVITER`,
2964
3030
  * `TARGET_SCOPE_NOT_FOUND`, `INVITE_TARGET_INVALID`.
2965
3031
  */
2966
3032
  declare function inviteMember(params: InviteMemberParams): Promise<InviteMemberResult>;
@@ -2976,9 +3042,8 @@ interface AcceptInviteResult {
2976
3042
  [key: string]: unknown;
2977
3043
  }
2978
3044
  /**
2979
- * Accept an invite as the signed-in person: the member item turns `active`
2980
- * and every seat already linked to it (see `seatMember`) opens at once —
2981
- * `can_do` on those chats is false before this call and true after it.
3045
+ * Accept a legacy member invitation. For an email invitation, use
3046
+ * acceptInvitation(invitation_id), which activates only its saved grants.
2982
3047
  */
2983
3048
  declare function acceptInvite(params: AcceptInviteParams): Promise<AcceptInviteResult>;
2984
3049
  interface SeatMemberParams {
@@ -2994,8 +3059,9 @@ interface SeatMemberParams {
2994
3059
  }
2995
3060
  /**
2996
3061
  * Seat a member on a chat: one `has_member` edge from the chat to the member
2997
- * item, the role in the edge context. Seat an invited member right after
2998
- * `inviteMember`; the seat shows on the roster as pending and opens on accept.
3062
+ * item, the role in the edge context. The member must already be active;
3063
+ * pending membership does not grant an audience seat. Email invitations
3064
+ * seat their recipient atomically when acceptInvitation succeeds.
2999
3065
  */
3000
3066
  declare function seatMember(params: SeatMemberParams): Promise<{
3001
3067
  success: true;
@@ -3102,6 +3168,66 @@ declare function useAnswerInput(): _tanstack_react_query.UseMutationResult<{
3102
3168
  success: true;
3103
3169
  }, Error, AnswerInputParams, unknown>;
3104
3170
 
3171
+ interface CreateInvitationParams {
3172
+ /** Retain this UUID across retries of the same request. */
3173
+ request_id: string;
3174
+ email: string;
3175
+ /** Account, Space, channel, or thread-root message UUID. */
3176
+ target_id: string;
3177
+ role: MemberRole;
3178
+ /** Prerequisite standing; defaults to viewer for a non-account destination. */
3179
+ account_role?: MemberRole;
3180
+ space_role?: MemberRole;
3181
+ message?: string;
3182
+ _scope_path?: string;
3183
+ }
3184
+ interface InvitationReceipt {
3185
+ success: true;
3186
+ invitation_id: string;
3187
+ state: 'pending' | 'accepted' | 'declined' | 'cancelled' | 'expired';
3188
+ email: string;
3189
+ inviter_name?: string | null;
3190
+ account_id: string;
3191
+ account_name: string;
3192
+ account_path: string;
3193
+ space_id: string | null;
3194
+ target_id: string;
3195
+ target_name: string;
3196
+ target_kind: 'account' | 'space' | 'channel' | 'thread';
3197
+ target_path: string;
3198
+ role: MemberRole;
3199
+ account_role: MemberRole;
3200
+ space_role: MemberRole | null;
3201
+ can_accept: boolean;
3202
+ expires_at: string;
3203
+ message: string | null;
3204
+ delivery: {
3205
+ state: 'queued' | 'accepted' | 'failed' | 'unknown' | 'unknown_final';
3206
+ attempt_id: string;
3207
+ error?: string | null;
3208
+ };
3209
+ result: {
3210
+ member_id: string;
3211
+ space_member_id: string | null;
3212
+ principal_id: string;
3213
+ target_id: string;
3214
+ } | null;
3215
+ }
3216
+ declare const createInvitation: (params: CreateInvitationParams) => Promise<InvitationReceipt>;
3217
+ declare const getInvitation: (invitationId: string) => Promise<InvitationReceipt>;
3218
+ declare const acceptInvitation: (invitationId: string) => Promise<InvitationReceipt>;
3219
+ type InvitationChangeReceipt = Pick<InvitationReceipt, 'success' | 'invitation_id' | 'state'> & Partial<Pick<InvitationReceipt, 'delivery'>>;
3220
+ declare const rejectInvitation: (invitationId: string) => Promise<InvitationChangeReceipt>;
3221
+ declare const cancelInvitation: (invitationId: string) => Promise<InvitationChangeReceipt>;
3222
+ declare const resendInvitation: (invitationId: string, requestId: string) => Promise<InvitationChangeReceipt>;
3223
+ type InvitationSummary = Pick<InvitationReceipt, 'invitation_id' | 'email' | 'target_name' | 'target_kind' | 'role' | 'state' | 'delivery'>;
3224
+ interface InvitationPage {
3225
+ success: true;
3226
+ invitations: InvitationSummary[];
3227
+ next_after: string | null;
3228
+ }
3229
+ declare const listInvitations: (accountId: string, after?: string) => Promise<InvitationPage>;
3230
+
3105
3231
  /**
3106
3232
  * @fsaos/gateway — Schema Interpretation Utilities
3107
3233
  *
@@ -3725,4 +3851,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
3725
3851
  contextKey: string;
3726
3852
  };
3727
3853
 
3728
- 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 PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, 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, loadPublishedBundle, 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, usePublishedComponent, useRealtimeQuery, useRecentActivity, useResolve, useResolvedItems, useScope, useScopeReady, useSearch, useSeatMember, useTheme, useTimelineHistory, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
3854
+ 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 CreateInvitationParams, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, FormSubmissionError, type FormSubmissionReceipt, type FsaosRuntime, type GatewayParams, GatewayRequestError, type GatewayRequestOptions, type GatewayResponse, HostSessionUnavailableError, type HostSessionWelcome, type IncrementalItemsOptions, type InfiniteChannelMessagesOptions, type InfiniteItemsOptions, type InitializeFsaosOptions, type InteractionReceipt, InteractionTrackingError, type InvitationChangeReceipt, type InvitationPage, type InvitationReceipt, type InvitationSummary, 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 PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, 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 ServeHostSessionOptions, 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, acceptInvitation, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelInvitation, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, connectHostSession, createAgent, createInvitation, 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, getInvitation, 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, listInvitations, loadMounts, loadPublishedBundle, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, rejectInvitation, replaceMounts, resendInvitation, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, selectMount, serveHostSession, 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, usePublishedComponent, 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
@@ -352,6 +352,8 @@ declare class EnforcementDeniedError extends Error {
352
352
  readonly deniedBy: string;
353
353
  readonly ruleKey?: string;
354
354
  readonly displayName?: string;
355
+ /** The kernel's denial as it arrived, so a host can pass it to a framed page whole. */
356
+ readonly payload: EnforcementPayload;
355
357
  constructor(payload: EnforcementPayload);
356
358
  static fallbackMessage(payload: EnforcementPayload): string;
357
359
  get isRuleDenial(): boolean;
@@ -542,6 +544,8 @@ interface AccountInfo {
542
544
  isOwner?: boolean;
543
545
  billingResponsible?: boolean;
544
546
  grantedVia?: 'self_provisioned' | 'invitation' | 'purchase' | 'seat_assignment' | null;
547
+ /** Server-verified accepted invitation for this active account membership. */
548
+ invitationAccepted?: boolean;
545
549
  grantedUnderAccountId?: string | null;
546
550
  membershipPath?: string | null;
547
551
  personalSpaceId?: string | null;
@@ -665,6 +669,67 @@ declare class GatewayRequestError extends Error {
665
669
  }
666
670
  declare function gatewayCall(method: string, params?: GatewayParams, options?: GatewayRequestOptions): Promise<GatewayResponse>;
667
671
 
672
+ /**
673
+ * @fsaos/gateway — Host session (the framed page's side)
674
+ *
675
+ * A page whose host holds the session makes no kernel call of its own. It
676
+ * asks the window that frames it, and that window makes the call with the
677
+ * session it already has. A RevDev desk preview inside the builder works this
678
+ * way: the previewed page holds no credential, nothing secret is in its
679
+ * address, and its calls go through the same gateway door, as the same
680
+ * person, as the app around it.
681
+ *
682
+ * The host's side is `serveHostSession` (host-session-serve.ts).
683
+ *
684
+ * Messages (all carry `fsaos: 'host-session'`):
685
+ * page → host { kind: 'hello' }
686
+ * host → page { kind: 'welcome', anchor, item }
687
+ * page → host { kind: 'call', id, method, params }
688
+ * host → page { kind: 'result', id, ok: true, response }
689
+ * | { kind: 'result', id, ok: false, error }
690
+ */
691
+
692
+ /** The page has no host to ask: it is not framed, or its frame did not answer. */
693
+ declare class HostSessionUnavailableError extends Error {
694
+ readonly name = "HostSessionUnavailableError";
695
+ }
696
+ /** What the host hands the page when it answers. */
697
+ interface HostSessionWelcome {
698
+ /** The item the framed app is handed, or null when the host named none. */
699
+ item: OpenEnvelope | null;
700
+ }
701
+ /**
702
+ * Meet the host. Call once before the first render: it sets the anchor the
703
+ * host is standing on and returns the item the app is handed. Rejects with
704
+ * `HostSessionUnavailableError` when the page has no host.
705
+ */
706
+ declare function connectHostSession(): Promise<HostSessionWelcome>;
707
+
708
+ /**
709
+ * @fsaos/gateway — Host session (the host's side)
710
+ *
711
+ * The app that frames a page started with `hostSession` answers that page's
712
+ * kernel calls with its own session. See host-session.ts for the messages.
713
+ *
714
+ * The framed page's code runs as the signed-in person for as long as it is
715
+ * served, exactly as a screen opened inside the app does. Serve only a frame
716
+ * the person chose to open.
717
+ */
718
+
719
+ interface ServeHostSessionOptions {
720
+ /** The framed window. A message from any other window is ignored. */
721
+ frame: () => Window | null | undefined;
722
+ /** The framed page's origin. A message from any other origin is ignored. */
723
+ origin: string;
724
+ /** The item the framed app is handed, as this app would hand it. */
725
+ item?: () => OpenEnvelope | null | undefined;
726
+ }
727
+ /**
728
+ * Answer one framed page. Returns the function that stops answering; call it
729
+ * when the frame goes away.
730
+ */
731
+ declare function serveHostSession(options: ServeHostSessionOptions): () => void;
732
+
668
733
  /**
669
734
  * Governed execution control.
670
735
  *
@@ -851,12 +916,12 @@ declare global {
851
916
  tracking?: {
852
917
  enabled?: boolean;
853
918
  };
854
- /** The page's own host holds the session. Set by a host that serves the
855
- * page and forwards its kernel calls to the gateway itself, attaching
856
- * the caller's identity there (a RevDev desk preview). `gatewayUrl` is
857
- * that host's forwarding address. The SDK then sends no bearer, does
858
- * not wait for a sign-in, and opens no realtime connection: the page
859
- * holds no credential and the host has no event stream to offer. */
919
+ /** The page's host holds the session. Set by a host that frames the page
920
+ * and answers its kernel calls with `serveHostSession` (a RevDev desk
921
+ * preview inside the builder). The SDK then makes every kernel call
922
+ * through the framing window, sends no bearer, does not wait for a
923
+ * sign-in, and opens no realtime connection: the page holds no
924
+ * credential. Outside its host the page has no session at all. */
860
925
  hostSession?: boolean;
861
926
  };
862
927
  }
@@ -2950,7 +3015,7 @@ interface InviteMemberResult {
2950
3015
  /** The member item the invite minted — `pending` until the person accepts. */
2951
3016
  member_id: string;
2952
3017
  member_path?: string;
2953
- status: 'pending' | 'active';
3018
+ status: 'pending' | 'invited' | 'active';
2954
3019
  role: MemberRole;
2955
3020
  email: string;
2956
3021
  /** `invited_to_scope` for an account, `invited_to_space` for a space. */
@@ -2960,7 +3025,8 @@ interface InviteMemberResult {
2960
3025
  [key: string]: unknown;
2961
3026
  }
2962
3027
  /**
2963
- * Invite a person into an account or space. Errors: `ROLE_ABOVE_INVITER`,
3028
+ * Legacy membership creation; this call does not deliver an email. Use
3029
+ * createInvitation for a scoped email invitation. Errors: `ROLE_ABOVE_INVITER`,
2964
3030
  * `TARGET_SCOPE_NOT_FOUND`, `INVITE_TARGET_INVALID`.
2965
3031
  */
2966
3032
  declare function inviteMember(params: InviteMemberParams): Promise<InviteMemberResult>;
@@ -2976,9 +3042,8 @@ interface AcceptInviteResult {
2976
3042
  [key: string]: unknown;
2977
3043
  }
2978
3044
  /**
2979
- * Accept an invite as the signed-in person: the member item turns `active`
2980
- * and every seat already linked to it (see `seatMember`) opens at once —
2981
- * `can_do` on those chats is false before this call and true after it.
3045
+ * Accept a legacy member invitation. For an email invitation, use
3046
+ * acceptInvitation(invitation_id), which activates only its saved grants.
2982
3047
  */
2983
3048
  declare function acceptInvite(params: AcceptInviteParams): Promise<AcceptInviteResult>;
2984
3049
  interface SeatMemberParams {
@@ -2994,8 +3059,9 @@ interface SeatMemberParams {
2994
3059
  }
2995
3060
  /**
2996
3061
  * Seat a member on a chat: one `has_member` edge from the chat to the member
2997
- * item, the role in the edge context. Seat an invited member right after
2998
- * `inviteMember`; the seat shows on the roster as pending and opens on accept.
3062
+ * item, the role in the edge context. The member must already be active;
3063
+ * pending membership does not grant an audience seat. Email invitations
3064
+ * seat their recipient atomically when acceptInvitation succeeds.
2999
3065
  */
3000
3066
  declare function seatMember(params: SeatMemberParams): Promise<{
3001
3067
  success: true;
@@ -3102,6 +3168,66 @@ declare function useAnswerInput(): _tanstack_react_query.UseMutationResult<{
3102
3168
  success: true;
3103
3169
  }, Error, AnswerInputParams, unknown>;
3104
3170
 
3171
+ interface CreateInvitationParams {
3172
+ /** Retain this UUID across retries of the same request. */
3173
+ request_id: string;
3174
+ email: string;
3175
+ /** Account, Space, channel, or thread-root message UUID. */
3176
+ target_id: string;
3177
+ role: MemberRole;
3178
+ /** Prerequisite standing; defaults to viewer for a non-account destination. */
3179
+ account_role?: MemberRole;
3180
+ space_role?: MemberRole;
3181
+ message?: string;
3182
+ _scope_path?: string;
3183
+ }
3184
+ interface InvitationReceipt {
3185
+ success: true;
3186
+ invitation_id: string;
3187
+ state: 'pending' | 'accepted' | 'declined' | 'cancelled' | 'expired';
3188
+ email: string;
3189
+ inviter_name?: string | null;
3190
+ account_id: string;
3191
+ account_name: string;
3192
+ account_path: string;
3193
+ space_id: string | null;
3194
+ target_id: string;
3195
+ target_name: string;
3196
+ target_kind: 'account' | 'space' | 'channel' | 'thread';
3197
+ target_path: string;
3198
+ role: MemberRole;
3199
+ account_role: MemberRole;
3200
+ space_role: MemberRole | null;
3201
+ can_accept: boolean;
3202
+ expires_at: string;
3203
+ message: string | null;
3204
+ delivery: {
3205
+ state: 'queued' | 'accepted' | 'failed' | 'unknown' | 'unknown_final';
3206
+ attempt_id: string;
3207
+ error?: string | null;
3208
+ };
3209
+ result: {
3210
+ member_id: string;
3211
+ space_member_id: string | null;
3212
+ principal_id: string;
3213
+ target_id: string;
3214
+ } | null;
3215
+ }
3216
+ declare const createInvitation: (params: CreateInvitationParams) => Promise<InvitationReceipt>;
3217
+ declare const getInvitation: (invitationId: string) => Promise<InvitationReceipt>;
3218
+ declare const acceptInvitation: (invitationId: string) => Promise<InvitationReceipt>;
3219
+ type InvitationChangeReceipt = Pick<InvitationReceipt, 'success' | 'invitation_id' | 'state'> & Partial<Pick<InvitationReceipt, 'delivery'>>;
3220
+ declare const rejectInvitation: (invitationId: string) => Promise<InvitationChangeReceipt>;
3221
+ declare const cancelInvitation: (invitationId: string) => Promise<InvitationChangeReceipt>;
3222
+ declare const resendInvitation: (invitationId: string, requestId: string) => Promise<InvitationChangeReceipt>;
3223
+ type InvitationSummary = Pick<InvitationReceipt, 'invitation_id' | 'email' | 'target_name' | 'target_kind' | 'role' | 'state' | 'delivery'>;
3224
+ interface InvitationPage {
3225
+ success: true;
3226
+ invitations: InvitationSummary[];
3227
+ next_after: string | null;
3228
+ }
3229
+ declare const listInvitations: (accountId: string, after?: string) => Promise<InvitationPage>;
3230
+
3105
3231
  /**
3106
3232
  * @fsaos/gateway — Schema Interpretation Utilities
3107
3233
  *
@@ -3725,4 +3851,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
3725
3851
  contextKey: string;
3726
3852
  };
3727
3853
 
3728
- 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 PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, 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, loadPublishedBundle, 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, usePublishedComponent, useRealtimeQuery, useRecentActivity, useResolve, useResolvedItems, useScope, useScopeReady, useSearch, useSeatMember, useTheme, useTimelineHistory, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };
3854
+ 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 CreateInvitationParams, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, FormSubmissionError, type FormSubmissionReceipt, type FsaosRuntime, type GatewayParams, GatewayRequestError, type GatewayRequestOptions, type GatewayResponse, HostSessionUnavailableError, type HostSessionWelcome, type IncrementalItemsOptions, type InfiniteChannelMessagesOptions, type InfiniteItemsOptions, type InitializeFsaosOptions, type InteractionReceipt, InteractionTrackingError, type InvitationChangeReceipt, type InvitationPage, type InvitationReceipt, type InvitationSummary, 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 PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, 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 ServeHostSessionOptions, 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, acceptInvitation, acceptInvite, answerInput, assignPersonalSection, auth, awaitAnchorReady, awaitScopeReady, callTool, cancelInvitation, cancelQueuedTurn, cancelTurn, clearCachedToken, clearSession, configureGatewayReads, connectHostSession, createAgent, createInvitation, 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, getInvitation, 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, listInvitations, loadMounts, loadPublishedBundle, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, rejectInvitation, replaceMounts, resendInvitation, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, selectMount, serveHostSession, 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, usePublishedComponent, useRealtimeQuery, useRecentActivity, useResolve, useResolvedItems, useScope, useScopeReady, useSearch, useSeatMember, useTheme, useTimelineHistory, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, useUpdatePrincipal, vfsKeys, waitForPathReady };