@ai4b-team/fsaos-gateway-sdk 5.7.1 → 5.9.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
@@ -2482,6 +2482,59 @@ declare function usePublishedComponent(item: PublishedComponentSource | null | u
2482
2482
  /** The version on screen. */
2483
2483
  version: number | null;
2484
2484
  };
2485
+ /**
2486
+ * A build the Script Worker's `compile_bundle` made for a component and a tool
2487
+ * kept: one `file` item under the component whose content is the JSON
2488
+ * `{ js, css, scope }`, and the SHA-256 of that file's bytes. `scope` is the id
2489
+ * the compile scoped the stylesheet under, when it was given one. A card that shows the
2490
+ * component names the build it was delivered with; the component item names
2491
+ * its newest one in `compiled`.
2492
+ */
2493
+ interface CompiledBuildRef {
2494
+ /** The build's `file` item. */
2495
+ fileId: string;
2496
+ /** SHA-256 of the file's bytes, in hex. A build whose bytes differ is never run. */
2497
+ sha256: string;
2498
+ /** The scope to read the file in, when it is not the one the host stands on. */
2499
+ scopePath?: string;
2500
+ }
2501
+ interface CompiledBundle {
2502
+ script: string;
2503
+ stylesheet: string | null;
2504
+ /**
2505
+ * The class the compile scoped the stylesheet under (`fsaos-c-<id>`, from
2506
+ * the `item_id` the compile was given), or null when it scoped nothing. The
2507
+ * host puts it on the element that wraps the component, so the stylesheet
2508
+ * styles the component and nothing else on the page.
2509
+ */
2510
+ scopeClass: string | null;
2511
+ }
2512
+ /**
2513
+ * Read a component's compiled build through the kernel, as the signed-in
2514
+ * person: the build's file item, then its bytes. It is an ordinary item, so
2515
+ * whoever may read it may load the build. For hosts that are not React.
2516
+ */
2517
+ declare function loadCompiledBundle(build: CompiledBuildRef): Promise<CompiledBundle>;
2518
+ type CompiledComponentStatus = 'loading' | 'ready' | 'error';
2519
+ /**
2520
+ * Load a component's compiled build into the host page.
2521
+ *
2522
+ * This is the same loader as `usePublishedComponent`, for a build that no
2523
+ * release sealed: a component an agent wrote and compiled during a reply.
2524
+ * The build runs on the host page's own React and SDK, so the component can
2525
+ * use every hook and call, as the signed-in person. Pass the build a card
2526
+ * names (null until it is known), and wrap the component in an element that
2527
+ * carries `scopeClass`. When the build named changes, the new one
2528
+ * loads behind the one on screen and replaces it, stylesheet included; if it
2529
+ * fails to load, the one on screen stays and `error` says why.
2530
+ */
2531
+ declare function useCompiledComponent(build: CompiledBuildRef | null | undefined): {
2532
+ Component: any;
2533
+ /** The class to put on the element that wraps the component (see `CompiledBundle.scopeClass`). */
2534
+ scopeClass: string | null;
2535
+ status: CompiledComponentStatus;
2536
+ error: Error | null;
2537
+ };
2485
2538
  /** Read CSS custom properties from the document root. */
2486
2539
  declare function useTheme(): {
2487
2540
  data: {
@@ -3661,15 +3714,12 @@ declare function getRequiredFormFields(typeDef: TypeDefinition): FieldDescriptor
3661
3714
  /**
3662
3715
  * @fsaos/gateway — File Upload
3663
3716
  *
3664
- * Two exports:
3665
- * - uploadFile() — imperative, returns a Promise. Use from Fractals, scripts,
3666
- * non-React contexts, or anywhere you just need the result.
3667
- * - useFileUpload() — React hook wrapping uploadFile() with reactive state
3668
- * (progress tracking, retry, cancel, uploads list).
3717
+ * uploadFile() uploads one file. createFileUpload() keeps the same transfer
3718
+ * for a draft's Retry action. useFileUpload() presents these transfers in React.
3669
3719
  *
3670
- * Both orchestrate the same three-step dance:
3720
+ * All three share the same protocol:
3671
3721
  * 1. gatewayCall('create', { file_source }) → VFS item + storage instruction
3672
- * 2. PUT binary → storage worker (direct upload, no gateway proxy)
3722
+ * 2. Upload bytes directly to storage, using multipart for files above 100 MiB
3673
3723
  * 3. POST /storage/upload-complete → gateway verifies + commits file_ref
3674
3724
  *
3675
3725
  * The consumer never sees storage_instruction, upload_token, or the
@@ -3748,41 +3798,14 @@ interface UseFileUploadReturn {
3748
3798
  /** True if any upload is currently in progress. */
3749
3799
  isUploading: boolean;
3750
3800
  }
3751
- /**
3752
- * Upload a file to the VFS. Handles the full three-step dance:
3753
- * create → upload binary → confirm.
3754
- *
3755
- * @param file The File or Blob to upload.
3756
- * @param options Where to put it and what to call it.
3757
- * @param onProgress Optional callback for upload progress (0–100).
3758
- * @param signal Optional AbortSignal for cancellation.
3759
- * @returns The created item's ID, path, and committed file_ref.
3760
- */
3801
+ interface FileUploadAttempt {
3802
+ /** Run again after a failure to continue this file and its confirmed parts. */
3803
+ run(onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<UploadResult>;
3804
+ }
3805
+ /** Owns retries for a single user-selected upload, including its file identity. */
3806
+ declare function createFileUpload(file: File | Blob, options: UploadOptions): FileUploadAttempt;
3807
+ /** A fresh file upload. Use createFileUpload when a retry button owns the same draft. */
3761
3808
  declare function uploadFile(file: File | Blob, options: UploadOptions, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<UploadResult>;
3762
- /**
3763
- * React hook for file uploads. Wraps uploadFile() with reactive state:
3764
- * tracks progress, supports retry from the failed step, cancel, and
3765
- * manages a list of concurrent uploads.
3766
- *
3767
- * @example
3768
- * ```tsx
3769
- * const { upload, uploads, isUploading } = useFileUpload();
3770
- *
3771
- * const handleDrop = (files: File[]) => {
3772
- * for (const file of files) {
3773
- * upload(file, { parentPath: '/root/accounts/.../drive' });
3774
- * }
3775
- * };
3776
- *
3777
- * return (
3778
- * <div onDrop={handleDrop}>
3779
- * {uploads.map(u => (
3780
- * <div key={u.id}>{u.file.name} — {u.status} — {u.progress}%</div>
3781
- * ))}
3782
- * </div>
3783
- * );
3784
- * ```
3785
- */
3786
3809
  declare function useFileUpload(): UseFileUploadReturn;
3787
3810
 
3788
3811
  /** One resolved item row (menu-safe: secrets/tokens/urls withheld by sealing). */
@@ -4213,4 +4236,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
4213
4236
  contextKey: string;
4214
4237
  };
4215
4238
 
4216
- 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 FilePurchaseReceipt, 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 MessageRepliesCursor, type MessageRepliesOptions, type MessageRepliesPage, type MessageReplyContext, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PermissionAction, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, type PurchaseJourneyRequest, 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 SendMessageParams, type SendMessageResult, 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, fetchMessageReplies, fetchMessageReplyContexts, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, filePurchaseNextUrl, funnelCheckoutLink, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getFilePurchase, 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, sendMessage, serveHostSession, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startFileCheckout, 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, useMessageReplies, 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 };
4239
+ 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 CompiledBuildRef, type CompiledBundle, type CompiledComponentStatus, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateAgentParams, type CreateAgentResult, type CreateInvitationParams, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FilePurchaseReceipt, type FileRef, type FileUploadAttempt, 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 MessageRepliesCursor, type MessageRepliesOptions, type MessageRepliesPage, type MessageReplyContext, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PermissionAction, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, type PurchaseJourneyRequest, 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 SendMessageParams, type SendMessageResult, 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, createFileUpload, createInvitation, createItem, disconnectSSE, disposeVfsRealtimeWs, electHomeAnchor, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchMessageReplies, fetchMessageReplyContexts, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, filePurchaseNextUrl, funnelCheckoutLink, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getFilePurchase, 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, loadCompiledBundle, loadMounts, loadPublishedBundle, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, rejectInvitation, replaceMounts, resendInvitation, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, selectMount, sendMessage, serveHostSession, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startFileCheckout, 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, useCompiledComponent, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMessageReplies, 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
@@ -2482,6 +2482,59 @@ declare function usePublishedComponent(item: PublishedComponentSource | null | u
2482
2482
  /** The version on screen. */
2483
2483
  version: number | null;
2484
2484
  };
2485
+ /**
2486
+ * A build the Script Worker's `compile_bundle` made for a component and a tool
2487
+ * kept: one `file` item under the component whose content is the JSON
2488
+ * `{ js, css, scope }`, and the SHA-256 of that file's bytes. `scope` is the id
2489
+ * the compile scoped the stylesheet under, when it was given one. A card that shows the
2490
+ * component names the build it was delivered with; the component item names
2491
+ * its newest one in `compiled`.
2492
+ */
2493
+ interface CompiledBuildRef {
2494
+ /** The build's `file` item. */
2495
+ fileId: string;
2496
+ /** SHA-256 of the file's bytes, in hex. A build whose bytes differ is never run. */
2497
+ sha256: string;
2498
+ /** The scope to read the file in, when it is not the one the host stands on. */
2499
+ scopePath?: string;
2500
+ }
2501
+ interface CompiledBundle {
2502
+ script: string;
2503
+ stylesheet: string | null;
2504
+ /**
2505
+ * The class the compile scoped the stylesheet under (`fsaos-c-<id>`, from
2506
+ * the `item_id` the compile was given), or null when it scoped nothing. The
2507
+ * host puts it on the element that wraps the component, so the stylesheet
2508
+ * styles the component and nothing else on the page.
2509
+ */
2510
+ scopeClass: string | null;
2511
+ }
2512
+ /**
2513
+ * Read a component's compiled build through the kernel, as the signed-in
2514
+ * person: the build's file item, then its bytes. It is an ordinary item, so
2515
+ * whoever may read it may load the build. For hosts that are not React.
2516
+ */
2517
+ declare function loadCompiledBundle(build: CompiledBuildRef): Promise<CompiledBundle>;
2518
+ type CompiledComponentStatus = 'loading' | 'ready' | 'error';
2519
+ /**
2520
+ * Load a component's compiled build into the host page.
2521
+ *
2522
+ * This is the same loader as `usePublishedComponent`, for a build that no
2523
+ * release sealed: a component an agent wrote and compiled during a reply.
2524
+ * The build runs on the host page's own React and SDK, so the component can
2525
+ * use every hook and call, as the signed-in person. Pass the build a card
2526
+ * names (null until it is known), and wrap the component in an element that
2527
+ * carries `scopeClass`. When the build named changes, the new one
2528
+ * loads behind the one on screen and replaces it, stylesheet included; if it
2529
+ * fails to load, the one on screen stays and `error` says why.
2530
+ */
2531
+ declare function useCompiledComponent(build: CompiledBuildRef | null | undefined): {
2532
+ Component: any;
2533
+ /** The class to put on the element that wraps the component (see `CompiledBundle.scopeClass`). */
2534
+ scopeClass: string | null;
2535
+ status: CompiledComponentStatus;
2536
+ error: Error | null;
2537
+ };
2485
2538
  /** Read CSS custom properties from the document root. */
2486
2539
  declare function useTheme(): {
2487
2540
  data: {
@@ -3661,15 +3714,12 @@ declare function getRequiredFormFields(typeDef: TypeDefinition): FieldDescriptor
3661
3714
  /**
3662
3715
  * @fsaos/gateway — File Upload
3663
3716
  *
3664
- * Two exports:
3665
- * - uploadFile() — imperative, returns a Promise. Use from Fractals, scripts,
3666
- * non-React contexts, or anywhere you just need the result.
3667
- * - useFileUpload() — React hook wrapping uploadFile() with reactive state
3668
- * (progress tracking, retry, cancel, uploads list).
3717
+ * uploadFile() uploads one file. createFileUpload() keeps the same transfer
3718
+ * for a draft's Retry action. useFileUpload() presents these transfers in React.
3669
3719
  *
3670
- * Both orchestrate the same three-step dance:
3720
+ * All three share the same protocol:
3671
3721
  * 1. gatewayCall('create', { file_source }) → VFS item + storage instruction
3672
- * 2. PUT binary → storage worker (direct upload, no gateway proxy)
3722
+ * 2. Upload bytes directly to storage, using multipart for files above 100 MiB
3673
3723
  * 3. POST /storage/upload-complete → gateway verifies + commits file_ref
3674
3724
  *
3675
3725
  * The consumer never sees storage_instruction, upload_token, or the
@@ -3748,41 +3798,14 @@ interface UseFileUploadReturn {
3748
3798
  /** True if any upload is currently in progress. */
3749
3799
  isUploading: boolean;
3750
3800
  }
3751
- /**
3752
- * Upload a file to the VFS. Handles the full three-step dance:
3753
- * create → upload binary → confirm.
3754
- *
3755
- * @param file The File or Blob to upload.
3756
- * @param options Where to put it and what to call it.
3757
- * @param onProgress Optional callback for upload progress (0–100).
3758
- * @param signal Optional AbortSignal for cancellation.
3759
- * @returns The created item's ID, path, and committed file_ref.
3760
- */
3801
+ interface FileUploadAttempt {
3802
+ /** Run again after a failure to continue this file and its confirmed parts. */
3803
+ run(onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<UploadResult>;
3804
+ }
3805
+ /** Owns retries for a single user-selected upload, including its file identity. */
3806
+ declare function createFileUpload(file: File | Blob, options: UploadOptions): FileUploadAttempt;
3807
+ /** A fresh file upload. Use createFileUpload when a retry button owns the same draft. */
3761
3808
  declare function uploadFile(file: File | Blob, options: UploadOptions, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<UploadResult>;
3762
- /**
3763
- * React hook for file uploads. Wraps uploadFile() with reactive state:
3764
- * tracks progress, supports retry from the failed step, cancel, and
3765
- * manages a list of concurrent uploads.
3766
- *
3767
- * @example
3768
- * ```tsx
3769
- * const { upload, uploads, isUploading } = useFileUpload();
3770
- *
3771
- * const handleDrop = (files: File[]) => {
3772
- * for (const file of files) {
3773
- * upload(file, { parentPath: '/root/accounts/.../drive' });
3774
- * }
3775
- * };
3776
- *
3777
- * return (
3778
- * <div onDrop={handleDrop}>
3779
- * {uploads.map(u => (
3780
- * <div key={u.id}>{u.file.name} — {u.status} — {u.progress}%</div>
3781
- * ))}
3782
- * </div>
3783
- * );
3784
- * ```
3785
- */
3786
3809
  declare function useFileUpload(): UseFileUploadReturn;
3787
3810
 
3788
3811
  /** One resolved item row (menu-safe: secrets/tokens/urls withheld by sealing). */
@@ -4213,4 +4236,4 @@ declare function usePersonalSections(contextId: string | null, collection: Secti
4213
4236
  contextKey: string;
4214
4237
  };
4215
4238
 
4216
- 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 FilePurchaseReceipt, 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 MessageRepliesCursor, type MessageRepliesOptions, type MessageRepliesPage, type MessageReplyContext, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PermissionAction, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, type PurchaseJourneyRequest, 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 SendMessageParams, type SendMessageResult, 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, fetchMessageReplies, fetchMessageReplyContexts, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, filePurchaseNextUrl, funnelCheckoutLink, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getFilePurchase, 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, sendMessage, serveHostSession, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startFileCheckout, 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, useMessageReplies, 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 };
4239
+ 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 CompiledBuildRef, type CompiledBundle, type CompiledComponentStatus, type ComponentOpener, ComponentRenderer, type ConnectionState, type CreateAgentParams, type CreateAgentResult, type CreateInvitationParams, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FilePurchaseReceipt, type FileRef, type FileUploadAttempt, 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 MessageRepliesCursor, type MessageRepliesOptions, type MessageRepliesPage, type MessageReplyContext, type MintedAsset, type MintedAssetState, type MountRef, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PathSubscriptionState, type PermissionAction, type PersonalItemOrderKey, type PersonalSection, type PinTarget, type PinnedItem, type PrincipalData, type PublicSourceConfig, type PublishedBundle, type PublishedComponentSource, type PublishedComponentStatus, type PurchaseJourneyRequest, 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 SendMessageParams, type SendMessageResult, 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, createFileUpload, createInvitation, createItem, disconnectSSE, disposeVfsRealtimeWs, electHomeAnchor, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchMessageReplies, fetchMessageReplyContexts, fetchOpenEnvelope, fetchRecentActivity, fetchResolvedItems, fetchTimelineHistory, fetchTurnQueueEntries, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, filePurchaseNextUrl, funnelCheckoutLink, gatewayCall, getAccessToken, getAnchor, getAnchorRef, getAnchorVersion, getAssetUrl, getDefaultSort, getFilePurchase, 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, loadCompiledBundle, loadMounts, loadPublishedBundle, mount, mountRealtimeScope, normalizeItem, onConnectionStateChange, pathSubscriptionMatches, personalSectionsKey, ping, pushChanges, queryClient, readItem, refreshQuery, registerCleanup, rejectInvitation, replaceMounts, resendInvitation, resetAllSdkState, resolvePrincipalId, resubscribePath, seatMember, selectMount, sendMessage, serveHostSession, serverDeadlinePassed, serverMsUntil, serverNow, setAnchor, setCachedToken, setQueryClient, setScope, setupRequireShim, signal, startFileCheckout, 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, useCompiledComponent, useComponent, useCreate, useCreateAgent, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useIncrementalItems, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useInviteMember, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMessageReplies, 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 };