@arbidocs/sdk 0.3.89 → 0.3.91

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.
@@ -1823,6 +1823,46 @@ declare class Arbi {
1823
1823
  agent_ext_id?: string | null | undefined;
1824
1824
  is_temporary: boolean;
1825
1825
  }[]>;
1826
+ /**
1827
+ * Ask another user to grant you workspace access. Builds the E2E-encrypted
1828
+ * request `content` (carrying this session's public key for a temporary
1829
+ * grant) and posts it. `workspaceExtId` is optional — pass it only when you
1830
+ * already know the target workspace id (obtained out-of-band).
1831
+ */
1832
+ requestAccess: (params: {
1833
+ recipientExtId: string;
1834
+ recipientEncryptionPublicKey: string;
1835
+ note?: string;
1836
+ workspaceExtId?: string;
1837
+ }) => Promise<{
1838
+ type: components["schemas"]["NotificationType"];
1839
+ external_id: string;
1840
+ sender: {
1841
+ external_id: string;
1842
+ parent_ext_id?: string | null | undefined;
1843
+ email: string;
1844
+ given_name: string;
1845
+ family_name?: string | null | undefined;
1846
+ picture?: string | null | undefined;
1847
+ encryption_public_key: string;
1848
+ is_sso: boolean;
1849
+ };
1850
+ recipient: {
1851
+ external_id: string;
1852
+ parent_ext_id?: string | null | undefined;
1853
+ email: string;
1854
+ given_name: string;
1855
+ family_name?: string | null | undefined;
1856
+ picture?: string | null | undefined;
1857
+ encryption_public_key: string;
1858
+ is_sso: boolean;
1859
+ };
1860
+ workspace_ext_id?: string | null | undefined;
1861
+ content?: string | null | undefined;
1862
+ read: boolean;
1863
+ created_at: string;
1864
+ updated_at: string;
1865
+ }>;
1826
1866
  copyDocuments: (targetWorkspaceId: string, docIds: string[], targetWorkspaceKey: string) => Promise<{
1827
1867
  detail: string;
1828
1868
  documents_copied: number;
@@ -2669,6 +2709,7 @@ declare class Arbi {
2669
2709
  show_conversation_search: boolean;
2670
2710
  show_agent_sessions: boolean;
2671
2711
  show_mcp_connectors: boolean;
2712
+ show_file_explorer: boolean;
2672
2713
  show_hints: boolean;
2673
2714
  dismissed_tips?: string[] | undefined;
2674
2715
  use_s3_direct_upload: boolean;
@@ -3925,6 +3966,54 @@ declare function sendEncryptedDM(arbi: ArbiClient, messages: Array<{
3925
3966
  created_at: string;
3926
3967
  updated_at: string;
3927
3968
  }[]>;
3969
+ /**
3970
+ * Ask another user to grant you workspace access.
3971
+ *
3972
+ * Creates a `workspace_access_request` notification. The `content` is an
3973
+ * opaque base64 blob, E2E-encrypted with the requester↔recipient shared key
3974
+ * (same scheme as a DM), carrying the requester's live session public key
3975
+ * (`sessionPubkeyB64`) so the recipient can mint a temporary, session-scoped
3976
+ * grant, plus an optional note.
3977
+ *
3978
+ * `workspaceExtId` is optional and only meaningful for API/SDK/CLI callers who
3979
+ * already know a workspace id (obtained out-of-band); omit it and the recipient
3980
+ * picks the workspace.
3981
+ */
3982
+ declare function requestWorkspaceAccess(arbi: ArbiClient, params: {
3983
+ recipientExtId: string;
3984
+ recipientEncryptionPublicKey: string;
3985
+ sessionPubkeyB64: string;
3986
+ note?: string;
3987
+ workspaceExtId?: string;
3988
+ }, crypto: DmCryptoContext): Promise<{
3989
+ type: components["schemas"]["NotificationType"];
3990
+ external_id: string;
3991
+ sender: {
3992
+ external_id: string;
3993
+ parent_ext_id?: string | null | undefined;
3994
+ email: string;
3995
+ given_name: string;
3996
+ family_name?: string | null | undefined;
3997
+ picture?: string | null | undefined;
3998
+ encryption_public_key: string;
3999
+ is_sso: boolean;
4000
+ };
4001
+ recipient: {
4002
+ external_id: string;
4003
+ parent_ext_id?: string | null | undefined;
4004
+ email: string;
4005
+ given_name: string;
4006
+ family_name?: string | null | undefined;
4007
+ picture?: string | null | undefined;
4008
+ encryption_public_key: string;
4009
+ is_sso: boolean;
4010
+ };
4011
+ workspace_ext_id?: string | null | undefined;
4012
+ content?: string | null | undefined;
4013
+ read: boolean;
4014
+ created_at: string;
4015
+ updated_at: string;
4016
+ }>;
3928
4017
  /**
3929
4018
  * Send a plaintext DM (no encryption).
3930
4019
  * @deprecated Use sendEncryptedDM instead.
@@ -4001,10 +4090,11 @@ declare const dm_encryptDmContent: typeof encryptDmContent;
4001
4090
  declare const dm_listDMs: typeof listDMs;
4002
4091
  declare const dm_listDecryptedDMs: typeof listDecryptedDMs;
4003
4092
  declare const dm_markRead: typeof markRead;
4093
+ declare const dm_requestWorkspaceAccess: typeof requestWorkspaceAccess;
4004
4094
  declare const dm_sendDM: typeof sendDM;
4005
4095
  declare const dm_sendEncryptedDM: typeof sendEncryptedDM;
4006
4096
  declare namespace dm {
4007
- export { type dm_DmCryptoContext as DmCryptoContext, dm_createDmCryptoContext as createDmCryptoContext, dm_decryptDmBatch as decryptDmBatch, dm_decryptDmContent as decryptDmContent, dm_deleteDMs as deleteDMs, dm_encryptDmContent as encryptDmContent, dm_listDMs as listDMs, dm_listDecryptedDMs as listDecryptedDMs, dm_markRead as markRead, dm_sendDM as sendDM, dm_sendEncryptedDM as sendEncryptedDM };
4097
+ export { type dm_DmCryptoContext as DmCryptoContext, dm_createDmCryptoContext as createDmCryptoContext, dm_decryptDmBatch as decryptDmBatch, dm_decryptDmContent as decryptDmContent, dm_deleteDMs as deleteDMs, dm_encryptDmContent as encryptDmContent, dm_listDMs as listDMs, dm_listDecryptedDMs as listDecryptedDMs, dm_markRead as markRead, dm_requestWorkspaceAccess as requestWorkspaceAccess, dm_sendDM as sendDM, dm_sendEncryptedDM as sendEncryptedDM };
4008
4098
  }
4009
4099
 
4010
4100
  /**
@@ -4040,6 +4130,7 @@ declare function getSettings(arbi: ArbiClient): Promise<{
4040
4130
  show_conversation_search: boolean;
4041
4131
  show_agent_sessions: boolean;
4042
4132
  show_mcp_connectors: boolean;
4133
+ show_file_explorer: boolean;
4043
4134
  show_hints: boolean;
4044
4135
  dismissed_tips?: string[] | undefined;
4045
4136
  use_s3_direct_upload: boolean;
@@ -1823,6 +1823,46 @@ declare class Arbi {
1823
1823
  agent_ext_id?: string | null | undefined;
1824
1824
  is_temporary: boolean;
1825
1825
  }[]>;
1826
+ /**
1827
+ * Ask another user to grant you workspace access. Builds the E2E-encrypted
1828
+ * request `content` (carrying this session's public key for a temporary
1829
+ * grant) and posts it. `workspaceExtId` is optional — pass it only when you
1830
+ * already know the target workspace id (obtained out-of-band).
1831
+ */
1832
+ requestAccess: (params: {
1833
+ recipientExtId: string;
1834
+ recipientEncryptionPublicKey: string;
1835
+ note?: string;
1836
+ workspaceExtId?: string;
1837
+ }) => Promise<{
1838
+ type: components["schemas"]["NotificationType"];
1839
+ external_id: string;
1840
+ sender: {
1841
+ external_id: string;
1842
+ parent_ext_id?: string | null | undefined;
1843
+ email: string;
1844
+ given_name: string;
1845
+ family_name?: string | null | undefined;
1846
+ picture?: string | null | undefined;
1847
+ encryption_public_key: string;
1848
+ is_sso: boolean;
1849
+ };
1850
+ recipient: {
1851
+ external_id: string;
1852
+ parent_ext_id?: string | null | undefined;
1853
+ email: string;
1854
+ given_name: string;
1855
+ family_name?: string | null | undefined;
1856
+ picture?: string | null | undefined;
1857
+ encryption_public_key: string;
1858
+ is_sso: boolean;
1859
+ };
1860
+ workspace_ext_id?: string | null | undefined;
1861
+ content?: string | null | undefined;
1862
+ read: boolean;
1863
+ created_at: string;
1864
+ updated_at: string;
1865
+ }>;
1826
1866
  copyDocuments: (targetWorkspaceId: string, docIds: string[], targetWorkspaceKey: string) => Promise<{
1827
1867
  detail: string;
1828
1868
  documents_copied: number;
@@ -2669,6 +2709,7 @@ declare class Arbi {
2669
2709
  show_conversation_search: boolean;
2670
2710
  show_agent_sessions: boolean;
2671
2711
  show_mcp_connectors: boolean;
2712
+ show_file_explorer: boolean;
2672
2713
  show_hints: boolean;
2673
2714
  dismissed_tips?: string[] | undefined;
2674
2715
  use_s3_direct_upload: boolean;
@@ -3925,6 +3966,54 @@ declare function sendEncryptedDM(arbi: ArbiClient, messages: Array<{
3925
3966
  created_at: string;
3926
3967
  updated_at: string;
3927
3968
  }[]>;
3969
+ /**
3970
+ * Ask another user to grant you workspace access.
3971
+ *
3972
+ * Creates a `workspace_access_request` notification. The `content` is an
3973
+ * opaque base64 blob, E2E-encrypted with the requester↔recipient shared key
3974
+ * (same scheme as a DM), carrying the requester's live session public key
3975
+ * (`sessionPubkeyB64`) so the recipient can mint a temporary, session-scoped
3976
+ * grant, plus an optional note.
3977
+ *
3978
+ * `workspaceExtId` is optional and only meaningful for API/SDK/CLI callers who
3979
+ * already know a workspace id (obtained out-of-band); omit it and the recipient
3980
+ * picks the workspace.
3981
+ */
3982
+ declare function requestWorkspaceAccess(arbi: ArbiClient, params: {
3983
+ recipientExtId: string;
3984
+ recipientEncryptionPublicKey: string;
3985
+ sessionPubkeyB64: string;
3986
+ note?: string;
3987
+ workspaceExtId?: string;
3988
+ }, crypto: DmCryptoContext): Promise<{
3989
+ type: components["schemas"]["NotificationType"];
3990
+ external_id: string;
3991
+ sender: {
3992
+ external_id: string;
3993
+ parent_ext_id?: string | null | undefined;
3994
+ email: string;
3995
+ given_name: string;
3996
+ family_name?: string | null | undefined;
3997
+ picture?: string | null | undefined;
3998
+ encryption_public_key: string;
3999
+ is_sso: boolean;
4000
+ };
4001
+ recipient: {
4002
+ external_id: string;
4003
+ parent_ext_id?: string | null | undefined;
4004
+ email: string;
4005
+ given_name: string;
4006
+ family_name?: string | null | undefined;
4007
+ picture?: string | null | undefined;
4008
+ encryption_public_key: string;
4009
+ is_sso: boolean;
4010
+ };
4011
+ workspace_ext_id?: string | null | undefined;
4012
+ content?: string | null | undefined;
4013
+ read: boolean;
4014
+ created_at: string;
4015
+ updated_at: string;
4016
+ }>;
3928
4017
  /**
3929
4018
  * Send a plaintext DM (no encryption).
3930
4019
  * @deprecated Use sendEncryptedDM instead.
@@ -4001,10 +4090,11 @@ declare const dm_encryptDmContent: typeof encryptDmContent;
4001
4090
  declare const dm_listDMs: typeof listDMs;
4002
4091
  declare const dm_listDecryptedDMs: typeof listDecryptedDMs;
4003
4092
  declare const dm_markRead: typeof markRead;
4093
+ declare const dm_requestWorkspaceAccess: typeof requestWorkspaceAccess;
4004
4094
  declare const dm_sendDM: typeof sendDM;
4005
4095
  declare const dm_sendEncryptedDM: typeof sendEncryptedDM;
4006
4096
  declare namespace dm {
4007
- export { type dm_DmCryptoContext as DmCryptoContext, dm_createDmCryptoContext as createDmCryptoContext, dm_decryptDmBatch as decryptDmBatch, dm_decryptDmContent as decryptDmContent, dm_deleteDMs as deleteDMs, dm_encryptDmContent as encryptDmContent, dm_listDMs as listDMs, dm_listDecryptedDMs as listDecryptedDMs, dm_markRead as markRead, dm_sendDM as sendDM, dm_sendEncryptedDM as sendEncryptedDM };
4097
+ export { type dm_DmCryptoContext as DmCryptoContext, dm_createDmCryptoContext as createDmCryptoContext, dm_decryptDmBatch as decryptDmBatch, dm_decryptDmContent as decryptDmContent, dm_deleteDMs as deleteDMs, dm_encryptDmContent as encryptDmContent, dm_listDMs as listDMs, dm_listDecryptedDMs as listDecryptedDMs, dm_markRead as markRead, dm_requestWorkspaceAccess as requestWorkspaceAccess, dm_sendDM as sendDM, dm_sendEncryptedDM as sendEncryptedDM };
4008
4098
  }
4009
4099
 
4010
4100
  /**
@@ -4040,6 +4130,7 @@ declare function getSettings(arbi: ArbiClient): Promise<{
4040
4130
  show_conversation_search: boolean;
4041
4131
  show_agent_sessions: boolean;
4042
4132
  show_mcp_connectors: boolean;
4133
+ show_file_explorer: boolean;
4043
4134
  show_hints: boolean;
4044
4135
  dismissed_tips?: string[] | undefined;
4045
4136
  use_s3_direct_upload: boolean;
package/dist/browser.cjs CHANGED
@@ -5035,6 +5035,7 @@ __export(dm_exports, {
5035
5035
  listDMs: () => listDMs,
5036
5036
  listDecryptedDMs: () => listDecryptedDMs,
5037
5037
  markRead: () => markRead,
5038
+ requestWorkspaceAccess: () => requestWorkspaceAccess,
5038
5039
  sendDM: () => sendDM,
5039
5040
  sendEncryptedDM: () => sendEncryptedDM
5040
5041
  });
@@ -5103,6 +5104,28 @@ async function sendEncryptedDM(arbi, messages, crypto) {
5103
5104
  "Failed to send message"
5104
5105
  );
5105
5106
  }
5107
+ async function requestWorkspaceAccess(arbi, params, crypto) {
5108
+ const payload = JSON.stringify({
5109
+ session_pubkey_b64: params.sessionPubkeyB64,
5110
+ note: params.note?.trim() || void 0
5111
+ });
5112
+ const content = await encryptDmContent(
5113
+ arbi,
5114
+ payload,
5115
+ params.recipientEncryptionPublicKey,
5116
+ crypto.encryptionKeypair.secretKey
5117
+ );
5118
+ return requireData(
5119
+ await arbi.fetch.POST("/v1/notifications/access-request", {
5120
+ body: {
5121
+ recipient_ext_id: params.recipientExtId,
5122
+ content,
5123
+ ...params.workspaceExtId ? { workspace_ext_id: params.workspaceExtId } : {}
5124
+ }
5125
+ }),
5126
+ "Failed to request workspace access"
5127
+ );
5128
+ }
5106
5129
  async function sendDM(arbi, messages) {
5107
5130
  return requireData(
5108
5131
  await arbi.fetch.POST("/v1/notifications/", {
@@ -5452,6 +5475,21 @@ var Arbi = class {
5452
5475
  addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
5453
5476
  removeUsers: (userIds) => removeWorkspaceUsers(this.requireClient(), userIds),
5454
5477
  setUserRole: (userIds, role) => setUserRole(this.requireClient(), userIds, role),
5478
+ /**
5479
+ * Ask another user to grant you workspace access. Builds the E2E-encrypted
5480
+ * request `content` (carrying this session's public key for a temporary
5481
+ * grant) and posts it. `workspaceExtId` is optional — pass it only when you
5482
+ * already know the target workspace id (obtained out-of-band).
5483
+ */
5484
+ requestAccess: (params) => {
5485
+ const client = this.requireClient();
5486
+ const lr2 = this.requireLogin();
5487
+ const userExtId = lr2.userExtId ?? client.session.getState().userExtId;
5488
+ if (!userExtId) throw new ArbiError("No user id in session \u2014 cannot request access");
5489
+ const crypto = createDmCryptoContext(client, lr2.signingPrivateKey, userExtId);
5490
+ const sessionPubkeyB64 = client.crypto.bytesToBase64(lr2.serverSessionKey);
5491
+ return requestWorkspaceAccess(client, { ...params, sessionPubkeyB64 }, crypto);
5492
+ },
5455
5493
  copyDocuments: (targetWorkspaceId, docIds, targetWorkspaceKey) => copyDocuments(
5456
5494
  this.requireClient(),
5457
5495
  targetWorkspaceId,