@haex-space/vault-sdk 4.7.1 → 4.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1156,9 +1156,13 @@ else console.warn(end.error?.code, end.error?.message);
1156
1156
  The user decides at run time which model your extension may use and up to which effort, and gives
1157
1157
  consent before anything goes to a destination outside the device; the SDK waits for these answers
1158
1158
  and starts the job again. `models.listAsync()` names the allowed models with their place and
1159
- capabilities, never an address or a key; `models.startAsync`, `models.onCompleted` and
1160
- `models.cancelAsync` give you the job's id and its end separately. A job has no tools and sees only
1161
- the input you send.
1159
+ capabilities, never an address or a key. To let the user stop a job, pass a signal:
1160
+ `runAsync(job, { signal })` asks to cancel the job when the signal aborts; the job ends as `cancelled`,
1161
+ unless it had already ended, then you get its actual result. A signal that is already aborted rejects
1162
+ with its reason and starts no job; a failed cancel request rejects the run with that error, while an
1163
+ unknown job rejects it with an error.
1164
+ `models.startAsync`, `models.onCompleted` and `models.cancelAsync` give you the job's id and its end
1165
+ separately. A job has no tools and sees only the input you send.
1162
1166
 
1163
1167
  ### Database Operations
1164
1168
 
@@ -363,7 +363,8 @@ declare class FilesystemAPI {
363
363
  private client;
364
364
  constructor(client: HaexVaultSdk);
365
365
  /**
366
- * Opens a save file dialog and saves the provided data to the selected location
366
+ * Opens a save file dialog and saves the provided data to the selected location.
367
+ * Waits for the user without the request timeout.
367
368
  * @param data The file data as Uint8Array
368
369
  * @param options Options for the save dialog
369
370
  * @returns The path where the file was saved, or null if cancelled
@@ -426,13 +427,13 @@ declare class FilesystemAPI {
426
427
  */
427
428
  stat(path: string): Promise<FileStat>;
428
429
  /**
429
- * Open a folder selection dialog
430
+ * Open a folder selection dialog; waits for the user without the request timeout
430
431
  * @param options Dialog options
431
432
  * @returns Selected folder path, or null if cancelled
432
433
  */
433
434
  selectFolder(options?: SelectFolderOptions): Promise<string | null>;
434
435
  /**
435
- * Open a file selection dialog
436
+ * Open a file selection dialog; waits for the user without the request timeout
436
437
  * @param options Dialog options
437
438
  * @returns Selected file paths, or null if cancelled
438
439
  */
@@ -1799,8 +1800,15 @@ declare class ModelsAPI {
1799
1800
  * `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
1800
1801
  * consent, no fitting model) reject. The end can arrive before the start answers; it is kept
1801
1802
  * until then.
1802
- */
1803
- runAsync(job: ModelJob): Promise<ModelJobCompletion>;
1803
+ *
1804
+ * Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
1805
+ * already ended keeps its actual end. A signal that is already aborted rejects with its reason
1806
+ * and starts no job. If the cancel request fails, the run rejects with that error and the job
1807
+ * keeps running on the host; if it reports an unknown job, the run rejects with an error.
1808
+ */
1809
+ runAsync(job: ModelJob, options?: {
1810
+ signal?: AbortSignal;
1811
+ }): Promise<ModelJobCompletion>;
1804
1812
  }
1805
1813
 
1806
1814
  /**
@@ -363,7 +363,8 @@ declare class FilesystemAPI {
363
363
  private client;
364
364
  constructor(client: HaexVaultSdk);
365
365
  /**
366
- * Opens a save file dialog and saves the provided data to the selected location
366
+ * Opens a save file dialog and saves the provided data to the selected location.
367
+ * Waits for the user without the request timeout.
367
368
  * @param data The file data as Uint8Array
368
369
  * @param options Options for the save dialog
369
370
  * @returns The path where the file was saved, or null if cancelled
@@ -426,13 +427,13 @@ declare class FilesystemAPI {
426
427
  */
427
428
  stat(path: string): Promise<FileStat>;
428
429
  /**
429
- * Open a folder selection dialog
430
+ * Open a folder selection dialog; waits for the user without the request timeout
430
431
  * @param options Dialog options
431
432
  * @returns Selected folder path, or null if cancelled
432
433
  */
433
434
  selectFolder(options?: SelectFolderOptions): Promise<string | null>;
434
435
  /**
435
- * Open a file selection dialog
436
+ * Open a file selection dialog; waits for the user without the request timeout
436
437
  * @param options Dialog options
437
438
  * @returns Selected file paths, or null if cancelled
438
439
  */
@@ -1799,8 +1800,15 @@ declare class ModelsAPI {
1799
1800
  * `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
1800
1801
  * consent, no fitting model) reject. The end can arrive before the start answers; it is kept
1801
1802
  * until then.
1802
- */
1803
- runAsync(job: ModelJob): Promise<ModelJobCompletion>;
1803
+ *
1804
+ * Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
1805
+ * already ended keeps its actual end. A signal that is already aborted rejects with its reason
1806
+ * and starts no job. If the cancel request fails, the run rejects with that error and the job
1807
+ * keeps running on the host; if it reports an unknown job, the run rejects with an error.
1808
+ */
1809
+ runAsync(job: ModelJob, options?: {
1810
+ signal?: AbortSignal;
1811
+ }): Promise<ModelJobCompletion>;
1804
1812
  }
1805
1813
 
1806
1814
  /**
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HaexVaultSdk } from './client-BlUizM-l.mjs';
2
- export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PasswordInput, am as PasswordItemFull, an as PasswordItemSummary, ao as PasswordKeyValue, ap as PasswordKeyValueInput, aq as PasswordsAPI, ar as PendingAuthorization, as as PendingTransfer, at as PermissionsAPI, au as RemoteAddBackendRequest, av as RemoteFolderBackendInfo, aw as RemoteS3BackendInfo, ax as RemoteS3Config, ay as RemoteS3Proposal, az as RemoteS3PublicConfig, aA as RemoteSftpProposal, aB as RemoteStorageAPI, aC as RemoteStorageBackendInfo, aD as RemoteStorageBackendType, aE as RemoteStorageObjectInfo, aF as RemoteUpdateBackendRequest, aG as RemoteWebDavProposal, aH as RequestedExtension, aI as SelectFileOptions, aJ as SelectFolderOptions, aK as ServerInfo, aL as ServerStatus, aM as SessionAuthorization, aN as SharedSpace, aO as ShellAPI, aP as ShellCreateOptions, aQ as ShellCreateResponse, aR as ShellExitEvent, aS as ShellOutputEvent, aT as SmtpConfig, aU as SpaceAccessTokenInfo, aV as SpaceAssignment, aW as SpaceInvite, aX as SpaceKeyGrantInfo, aY as SpaceMember, aZ as SpaceMemberInfo, a_ as SpacesAPI, a$ as SyncBackendInfo, b0 as TabAPI, b1 as ToolContext, b2 as ToolHandler, b3 as ToolsAPI, b4 as TransferDirection, b5 as TransferProgress, b6 as TransferState, b7 as WebAPI, b8 as canExternalClientSendRequests, b9 as isExternalClientConnected } from './client-BlUizM-l.mjs';
1
+ import { H as HaexVaultSdk } from './client-DOAj36ga.mjs';
2
+ export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PasswordInput, am as PasswordItemFull, an as PasswordItemSummary, ao as PasswordKeyValue, ap as PasswordKeyValueInput, aq as PasswordsAPI, ar as PendingAuthorization, as as PendingTransfer, at as PermissionsAPI, au as RemoteAddBackendRequest, av as RemoteFolderBackendInfo, aw as RemoteS3BackendInfo, ax as RemoteS3Config, ay as RemoteS3Proposal, az as RemoteS3PublicConfig, aA as RemoteSftpProposal, aB as RemoteStorageAPI, aC as RemoteStorageBackendInfo, aD as RemoteStorageBackendType, aE as RemoteStorageObjectInfo, aF as RemoteUpdateBackendRequest, aG as RemoteWebDavProposal, aH as RequestedExtension, aI as SelectFileOptions, aJ as SelectFolderOptions, aK as ServerInfo, aL as ServerStatus, aM as SessionAuthorization, aN as SharedSpace, aO as ShellAPI, aP as ShellCreateOptions, aQ as ShellCreateResponse, aR as ShellExitEvent, aS as ShellOutputEvent, aT as SmtpConfig, aU as SpaceAccessTokenInfo, aV as SpaceAssignment, aW as SpaceInvite, aX as SpaceKeyGrantInfo, aY as SpaceMember, aZ as SpaceMemberInfo, a_ as SpacesAPI, a$ as SyncBackendInfo, b0 as TabAPI, b1 as ToolContext, b2 as ToolHandler, b3 as ToolsAPI, b4 as TransferDirection, b5 as TransferProgress, b6 as TransferState, b7 as WebAPI, b8 as canExternalClientSendRequests, b9 as isExternalClientConnected } from './client-DOAj36ga.mjs';
3
3
  import { h as SignedClaimPresentation, H as HaexHubConfig } from './types-3iifP-Q1.mjs';
4
4
  export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, E as ExtensionInfo, a as ExtensionManifest, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, B as HostErrorCode, I as IdentityClaim, G as MAIL_EVENTS, J as MODEL_JOB_EVENTS, K as MailEvent, L as ManifestI18nEntry, N as ManifestTool, O as ManifestToolEffect, Q as ModelJobEvent, T as NOTIFICATION_EVENTS, U as NotificationEvent, V as PermissionDeniedError, X as PermissionErrorBase, Y as PermissionErrorCode, Z as PermissionPromptError, P as PermissionResponse, _ as PermissionStatus, R as RequestOptions, $ as SHELL_EVENTS, a0 as SearchQuery, a1 as SearchRequestEvent, S as SearchResult, a2 as ShellEvent, a3 as SyncTablesUpdatedEvent, a4 as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, a5 as getTableName, a6 as isPermissionDeniedError, a7 as isPermissionError, a8 as isPermissionPromptError } from './types-3iifP-Q1.mjs';
5
5
  export { H as HaextensionConfig } from './config-P_6DqTHl.mjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HaexVaultSdk } from './client--CgEtJ4G.js';
2
- export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PasswordInput, am as PasswordItemFull, an as PasswordItemSummary, ao as PasswordKeyValue, ap as PasswordKeyValueInput, aq as PasswordsAPI, ar as PendingAuthorization, as as PendingTransfer, at as PermissionsAPI, au as RemoteAddBackendRequest, av as RemoteFolderBackendInfo, aw as RemoteS3BackendInfo, ax as RemoteS3Config, ay as RemoteS3Proposal, az as RemoteS3PublicConfig, aA as RemoteSftpProposal, aB as RemoteStorageAPI, aC as RemoteStorageBackendInfo, aD as RemoteStorageBackendType, aE as RemoteStorageObjectInfo, aF as RemoteUpdateBackendRequest, aG as RemoteWebDavProposal, aH as RequestedExtension, aI as SelectFileOptions, aJ as SelectFolderOptions, aK as ServerInfo, aL as ServerStatus, aM as SessionAuthorization, aN as SharedSpace, aO as ShellAPI, aP as ShellCreateOptions, aQ as ShellCreateResponse, aR as ShellExitEvent, aS as ShellOutputEvent, aT as SmtpConfig, aU as SpaceAccessTokenInfo, aV as SpaceAssignment, aW as SpaceInvite, aX as SpaceKeyGrantInfo, aY as SpaceMember, aZ as SpaceMemberInfo, a_ as SpacesAPI, a$ as SyncBackendInfo, b0 as TabAPI, b1 as ToolContext, b2 as ToolHandler, b3 as ToolsAPI, b4 as TransferDirection, b5 as TransferProgress, b6 as TransferState, b7 as WebAPI, b8 as canExternalClientSendRequests, b9 as isExternalClientConnected } from './client--CgEtJ4G.js';
1
+ import { H as HaexVaultSdk } from './client-CNbwFQjB.js';
2
+ export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PasswordInput, am as PasswordItemFull, an as PasswordItemSummary, ao as PasswordKeyValue, ap as PasswordKeyValueInput, aq as PasswordsAPI, ar as PendingAuthorization, as as PendingTransfer, at as PermissionsAPI, au as RemoteAddBackendRequest, av as RemoteFolderBackendInfo, aw as RemoteS3BackendInfo, ax as RemoteS3Config, ay as RemoteS3Proposal, az as RemoteS3PublicConfig, aA as RemoteSftpProposal, aB as RemoteStorageAPI, aC as RemoteStorageBackendInfo, aD as RemoteStorageBackendType, aE as RemoteStorageObjectInfo, aF as RemoteUpdateBackendRequest, aG as RemoteWebDavProposal, aH as RequestedExtension, aI as SelectFileOptions, aJ as SelectFolderOptions, aK as ServerInfo, aL as ServerStatus, aM as SessionAuthorization, aN as SharedSpace, aO as ShellAPI, aP as ShellCreateOptions, aQ as ShellCreateResponse, aR as ShellExitEvent, aS as ShellOutputEvent, aT as SmtpConfig, aU as SpaceAccessTokenInfo, aV as SpaceAssignment, aW as SpaceInvite, aX as SpaceKeyGrantInfo, aY as SpaceMember, aZ as SpaceMemberInfo, a_ as SpacesAPI, a$ as SyncBackendInfo, b0 as TabAPI, b1 as ToolContext, b2 as ToolHandler, b3 as ToolsAPI, b4 as TransferDirection, b5 as TransferProgress, b6 as TransferState, b7 as WebAPI, b8 as canExternalClientSendRequests, b9 as isExternalClientConnected } from './client-CNbwFQjB.js';
3
3
  import { h as SignedClaimPresentation, H as HaexHubConfig } from './types-3iifP-Q1.js';
4
4
  export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, E as ExtensionInfo, a as ExtensionManifest, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, B as HostErrorCode, I as IdentityClaim, G as MAIL_EVENTS, J as MODEL_JOB_EVENTS, K as MailEvent, L as ManifestI18nEntry, N as ManifestTool, O as ManifestToolEffect, Q as ModelJobEvent, T as NOTIFICATION_EVENTS, U as NotificationEvent, V as PermissionDeniedError, X as PermissionErrorBase, Y as PermissionErrorCode, Z as PermissionPromptError, P as PermissionResponse, _ as PermissionStatus, R as RequestOptions, $ as SHELL_EVENTS, a0 as SearchQuery, a1 as SearchRequestEvent, S as SearchResult, a2 as ShellEvent, a3 as SyncTablesUpdatedEvent, a4 as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, a5 as getTableName, a6 as isPermissionDeniedError, a7 as isPermissionError, a8 as isPermissionPromptError } from './types-3iifP-Q1.js';
5
5
  export { H as HaextensionConfig } from './config-P_6DqTHl.js';
package/dist/index.js CHANGED
@@ -1410,7 +1410,8 @@ var FilesystemAPI = class {
1410
1410
  this.client = client;
1411
1411
  }
1412
1412
  /**
1413
- * Opens a save file dialog and saves the provided data to the selected location
1413
+ * Opens a save file dialog and saves the provided data to the selected location.
1414
+ * Waits for the user without the request timeout.
1414
1415
  * @param data The file data as Uint8Array
1415
1416
  * @param options Options for the save dialog
1416
1417
  * @returns The path where the file was saved, or null if cancelled
@@ -1424,7 +1425,8 @@ var FilesystemAPI = class {
1424
1425
  defaultPath: options.defaultPath,
1425
1426
  title: options.title,
1426
1427
  filters: options.filters
1427
- }
1428
+ },
1429
+ { timeout: null }
1428
1430
  );
1429
1431
  return result;
1430
1432
  }
@@ -1544,25 +1546,27 @@ var FilesystemAPI = class {
1544
1546
  );
1545
1547
  }
1546
1548
  /**
1547
- * Open a folder selection dialog
1549
+ * Open a folder selection dialog; waits for the user without the request timeout
1548
1550
  * @param options Dialog options
1549
1551
  * @returns Selected folder path, or null if cancelled
1550
1552
  */
1551
1553
  async selectFolder(options = {}) {
1552
1554
  return this.client.request(
1553
1555
  FILESYSTEM_COMMANDS.selectFolder,
1554
- options
1556
+ options,
1557
+ { timeout: null }
1555
1558
  );
1556
1559
  }
1557
1560
  /**
1558
- * Open a file selection dialog
1561
+ * Open a file selection dialog; waits for the user without the request timeout
1559
1562
  * @param options Dialog options
1560
1563
  * @returns Selected file paths, or null if cancelled
1561
1564
  */
1562
1565
  async selectFile(options = {}) {
1563
1566
  return this.client.request(
1564
1567
  FILESYSTEM_COMMANDS.selectFile,
1565
- options
1568
+ options,
1569
+ { timeout: null }
1566
1570
  );
1567
1571
  }
1568
1572
  /**
@@ -2485,22 +2489,45 @@ var ModelsAPI = class {
2485
2489
  * `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
2486
2490
  * consent, no fitting model) reject. The end can arrive before the start answers; it is kept
2487
2491
  * until then.
2492
+ *
2493
+ * Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
2494
+ * already ended keeps its actual end. A signal that is already aborted rejects with its reason
2495
+ * and starts no job. If the cancel request fails, the run rejects with that error and the job
2496
+ * keeps running on the host; if it reports an unknown job, the run rejects with an error.
2488
2497
  */
2489
- async runAsync(job) {
2498
+ async runAsync(job, options = {}) {
2499
+ const { signal } = options;
2500
+ if (signal?.aborted) throw signal.reason;
2490
2501
  const ended = /* @__PURE__ */ new Map();
2491
2502
  let waiting = null;
2492
2503
  const unsubscribe = this.onCompleted((completion) => {
2493
2504
  if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
2494
2505
  else ended.set(completion.jobId, completion);
2495
2506
  });
2507
+ let detach = () => {
2508
+ };
2496
2509
  try {
2497
2510
  const { jobId } = await this.startAsync(job);
2498
- return await new Promise((resolve) => {
2511
+ return await new Promise((resolve, reject) => {
2499
2512
  const early = ended.get(jobId);
2500
- if (early) resolve(early);
2501
- else waiting = { jobId, resolve };
2513
+ if (early) return resolve(early);
2514
+ waiting = { jobId, resolve };
2515
+ if (!signal) return;
2516
+ const cancel = async () => {
2517
+ try {
2518
+ if (!await this.cancelAsync(jobId)) {
2519
+ reject(new Error("The model job could not be cancelled"));
2520
+ }
2521
+ } catch (error) {
2522
+ reject(error);
2523
+ }
2524
+ };
2525
+ if (signal.aborted) return cancel();
2526
+ signal.addEventListener("abort", cancel, { once: true });
2527
+ detach = () => signal.removeEventListener("abort", cancel);
2502
2528
  });
2503
2529
  } finally {
2530
+ detach();
2504
2531
  unsubscribe();
2505
2532
  }
2506
2533
  }