@arbidocs/sdk 0.3.119 → 0.3.120

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.
@@ -1580,6 +1580,11 @@ declare function resolveRecipient(arbi: ArbiClient, ref: string): Promise<Resolv
1580
1580
  * Encrypts plaintext content for each recipient using their public key.
1581
1581
  * Requires recipient public keys — fetch via contacts or user lookup first.
1582
1582
  *
1583
+ * Returns the created notifications with their content as **plaintext**, not
1584
+ * ciphertext — matching what `listDecryptedDMs` returns. The sender supplied the
1585
+ * text, so it is handed straight back: a caller must never have to re-fetch and
1586
+ * re-decrypt its own ciphertext just to render the message it has just sent.
1587
+ *
1583
1588
  * @param arbi - ArbiClient instance
1584
1589
  * @param messages - Array of { recipient_ext_id, content (plaintext), recipient_encryption_public_key }
1585
1590
  * @param crypto - DM crypto context for the sender
@@ -1588,35 +1593,7 @@ declare function sendEncryptedDM(arbi: ArbiClient, messages: Array<{
1588
1593
  recipient_ext_id: string;
1589
1594
  content: string;
1590
1595
  recipient_encryption_public_key: string;
1591
- }>, crypto: DmCryptoContext): Promise<{
1592
- type: components["schemas"]["NotificationType"];
1593
- external_id: string;
1594
- sender: {
1595
- external_id: string;
1596
- parent_ext_id?: string | null | undefined;
1597
- email: string;
1598
- given_name: string;
1599
- family_name?: string | null | undefined;
1600
- picture?: string | null | undefined;
1601
- encryption_public_key: string;
1602
- is_sso: boolean;
1603
- };
1604
- recipient: {
1605
- external_id: string;
1606
- parent_ext_id?: string | null | undefined;
1607
- email: string;
1608
- given_name: string;
1609
- family_name?: string | null | undefined;
1610
- picture?: string | null | undefined;
1611
- encryption_public_key: string;
1612
- is_sso: boolean;
1613
- };
1614
- workspace_ext_id?: string | null | undefined;
1615
- content?: string | null | undefined;
1616
- read: boolean;
1617
- created_at: string;
1618
- updated_at: string;
1619
- }[]>;
1596
+ }>, crypto: DmCryptoContext): Promise<NotificationResponse[]>;
1620
1597
  /**
1621
1598
  * Ask another user to grant you workspace access.
1622
1599
  *
@@ -2137,13 +2114,19 @@ declare class Arbi {
2137
2114
  readonly user: {
2138
2115
  /**
2139
2116
  * The authenticated user's identity from the current session
2140
- * (`external_id` + `email`), established at login. Returns `null` when not
2141
- * logged in. This is the canonical "who am I" accessor — DM direction and
2142
- * ownership checks read it instead of re-deriving identity per call.
2117
+ * (`external_id`, plus `email` when the session carries one), established at
2118
+ * login. Returns `null` when not logged in. This is the canonical "who am I"
2119
+ * accessor — DM direction and ownership checks read it instead of re-deriving
2120
+ * identity per call.
2121
+ *
2122
+ * The external_id alone decides identity. A session without an email (e.g. an
2123
+ * agent, or a key-restored session) is still a known user, so `email` is
2124
+ * nullable rather than gating the whole identity: an ownership check must
2125
+ * never silently fail open just because the email is missing.
2143
2126
  */
2144
2127
  identity: () => {
2145
2128
  externalId: string;
2146
- email: string;
2129
+ email: string | null;
2147
2130
  } | null;
2148
2131
  /** Today's deployment-wide credit spend for the current user. */
2149
2132
  usageToday: () => Promise<{
@@ -3126,10 +3109,18 @@ declare class Arbi {
3126
3109
  /**
3127
3110
  * Build (and cache) the DM crypto context for the current session.
3128
3111
  *
3129
- * Derives the user's curve25519 keypair from the stored signing key and pairs
3130
- * it with their external_id — everything `list()`/`send()` need to encrypt and
3112
+ * Derives the user's curve25519 keypair from their signing key and pairs it
3113
+ * with their external_id — everything `list()`/`send()` need to encrypt and
3131
3114
  * decrypt. Cached for the session and cleared on logout. Consumers never touch
3132
3115
  * this: it's an internal of the `dm` surface.
3116
+ *
3117
+ * The key comes from the live login result first, exactly as `selectWorkspace`
3118
+ * sources it, and only then from persisted storage (which is what restores a
3119
+ * session on reload). Reading storage first would make DMs the one feature that
3120
+ * breaks whenever persistence is unavailable — `saveSession` deliberately
3121
+ * no-ops without Web Crypto (a non-secure origin, tracking prevention, an
3122
+ * embedded widget), so a perfectly authenticated user with a working workspace
3123
+ * would be told they are "not authenticated" the moment they opened Messages.
3133
3124
  */
3134
3125
  private requireDmCrypto;
3135
3126
  readonly dm: {
@@ -3156,28 +3147,10 @@ declare class Arbi {
3156
3147
  send: (recipient: string, text: string) => Promise<{
3157
3148
  type: components["schemas"]["NotificationType"];
3158
3149
  external_id: string;
3159
- sender: {
3160
- external_id: string;
3161
- parent_ext_id?: string | null | undefined;
3162
- email: string;
3163
- given_name: string;
3164
- family_name?: string | null | undefined;
3165
- picture?: string | null | undefined;
3166
- encryption_public_key: string;
3167
- is_sso: boolean;
3168
- };
3169
- recipient: {
3170
- external_id: string;
3171
- parent_ext_id?: string | null | undefined;
3172
- email: string;
3173
- given_name: string;
3174
- family_name?: string | null | undefined;
3175
- picture?: string | null | undefined;
3176
- encryption_public_key: string;
3177
- is_sso: boolean;
3178
- };
3179
- workspace_ext_id?: string | null | undefined;
3180
- content?: string | null | undefined;
3150
+ sender: components["schemas"]["UserResponse"];
3151
+ recipient: components["schemas"]["UserResponse"];
3152
+ workspace_ext_id?: string | null;
3153
+ content?: string | null;
3181
3154
  read: boolean;
3182
3155
  created_at: string;
3183
3156
  updated_at: string;
@@ -3189,28 +3162,10 @@ declare class Arbi {
3189
3162
  sendTo: (recipientExtId: string, recipientPublicKey: string, text: string) => Promise<{
3190
3163
  type: components["schemas"]["NotificationType"];
3191
3164
  external_id: string;
3192
- sender: {
3193
- external_id: string;
3194
- parent_ext_id?: string | null | undefined;
3195
- email: string;
3196
- given_name: string;
3197
- family_name?: string | null | undefined;
3198
- picture?: string | null | undefined;
3199
- encryption_public_key: string;
3200
- is_sso: boolean;
3201
- };
3202
- recipient: {
3203
- external_id: string;
3204
- parent_ext_id?: string | null | undefined;
3205
- email: string;
3206
- given_name: string;
3207
- family_name?: string | null | undefined;
3208
- picture?: string | null | undefined;
3209
- encryption_public_key: string;
3210
- is_sso: boolean;
3211
- };
3212
- workspace_ext_id?: string | null | undefined;
3213
- content?: string | null | undefined;
3165
+ sender: components["schemas"]["UserResponse"];
3166
+ recipient: components["schemas"]["UserResponse"];
3167
+ workspace_ext_id?: string | null;
3168
+ content?: string | null;
3214
3169
  read: boolean;
3215
3170
  created_at: string;
3216
3171
  updated_at: string;
@@ -5475,6 +5430,7 @@ declare namespace responses {
5475
5430
  type ProjectUsageResponse = components['schemas']['ProjectUsageResponse'];
5476
5431
  type ProjectInvoicesResponse = components['schemas']['ProjectInvoicesResponse'];
5477
5432
  type UserDailyUsageResponse = components['schemas']['UserDailyUsageResponse'];
5433
+ type ProjectUpdateRequest = components['schemas']['ProjectUpdateRequest'];
5478
5434
  declare function listProjects(arbi: ArbiClient): Promise<{
5479
5435
  external_id: string;
5480
5436
  name: string;
@@ -5537,6 +5493,71 @@ declare function createProject(arbi: ArbiClient, name: string): Promise<{
5537
5493
  cancel_at_period_end?: boolean | null | undefined;
5538
5494
  portal_url?: string | null | undefined;
5539
5495
  }>;
5496
+ /** Update a project's mutable fields (e.g. `name`, `daily_cap_per_user`). */
5497
+ declare function updateProject(arbi: ArbiClient, projectExtId: string, body: ProjectUpdateRequest): Promise<{
5498
+ external_id: string;
5499
+ name: string;
5500
+ created_by: string;
5501
+ packs: number;
5502
+ subscription: string;
5503
+ created_at: string;
5504
+ quotas: {
5505
+ storage_gb: {
5506
+ used: number;
5507
+ limit: number;
5508
+ };
5509
+ ai_credits: {
5510
+ used: number;
5511
+ limit: number;
5512
+ };
5513
+ collaborators: {
5514
+ used: number;
5515
+ limit: number;
5516
+ };
5517
+ budget_reset_at?: number | null | undefined;
5518
+ };
5519
+ daily_cap_per_user?: number | null | undefined;
5520
+ price_id?: string | null | undefined;
5521
+ plan?: string | null | undefined;
5522
+ amount?: number | null | undefined;
5523
+ currency?: string | null | undefined;
5524
+ current_period_end?: number | null | undefined;
5525
+ cancel_at_period_end?: boolean | null | undefined;
5526
+ portal_url?: string | null | undefined;
5527
+ }>;
5528
+ /** Rename a project. Convenience wrapper over {@link updateProject}. */
5529
+ declare function renameProject(arbi: ArbiClient, projectExtId: string, name: string): Promise<{
5530
+ external_id: string;
5531
+ name: string;
5532
+ created_by: string;
5533
+ packs: number;
5534
+ subscription: string;
5535
+ created_at: string;
5536
+ quotas: {
5537
+ storage_gb: {
5538
+ used: number;
5539
+ limit: number;
5540
+ };
5541
+ ai_credits: {
5542
+ used: number;
5543
+ limit: number;
5544
+ };
5545
+ collaborators: {
5546
+ used: number;
5547
+ limit: number;
5548
+ };
5549
+ budget_reset_at?: number | null | undefined;
5550
+ };
5551
+ daily_cap_per_user?: number | null | undefined;
5552
+ price_id?: string | null | undefined;
5553
+ plan?: string | null | undefined;
5554
+ amount?: number | null | undefined;
5555
+ currency?: string | null | undefined;
5556
+ current_period_end?: number | null | undefined;
5557
+ cancel_at_period_end?: boolean | null | undefined;
5558
+ portal_url?: string | null | undefined;
5559
+ }>;
5560
+ declare function deleteProject(arbi: ArbiClient, projectExtId: string): Promise<void>;
5540
5561
  declare function refreshProject(arbi: ArbiClient, projectExtId: string): Promise<{
5541
5562
  external_id: string;
5542
5563
  name: string;
@@ -5583,16 +5604,20 @@ declare function getProjectInvoices(arbi: ArbiClient, projectExtId: string): Pro
5583
5604
  declare function getUserUsageToday(arbi: ArbiClient): Promise<UserDailyUsageResponse>;
5584
5605
 
5585
5606
  type projects_ProjectInvoicesResponse = ProjectInvoicesResponse;
5607
+ type projects_ProjectUpdateRequest = ProjectUpdateRequest;
5586
5608
  type projects_ProjectUsageResponse = ProjectUsageResponse;
5587
5609
  type projects_UserDailyUsageResponse = UserDailyUsageResponse;
5588
5610
  declare const projects_createProject: typeof createProject;
5611
+ declare const projects_deleteProject: typeof deleteProject;
5589
5612
  declare const projects_getProjectInvoices: typeof getProjectInvoices;
5590
5613
  declare const projects_getProjectUsage: typeof getProjectUsage;
5591
5614
  declare const projects_getUserUsageToday: typeof getUserUsageToday;
5592
5615
  declare const projects_listProjects: typeof listProjects;
5593
5616
  declare const projects_refreshProject: typeof refreshProject;
5617
+ declare const projects_renameProject: typeof renameProject;
5618
+ declare const projects_updateProject: typeof updateProject;
5594
5619
  declare namespace projects {
5595
- export { type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_createProject as createProject, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProjects as listProjects, projects_refreshProject as refreshProject };
5620
+ export { type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectUpdateRequest as ProjectUpdateRequest, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_createProject as createProject, projects_deleteProject as deleteProject, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProjects as listProjects, projects_refreshProject as refreshProject, projects_renameProject as renameProject, projects_updateProject as updateProject };
5596
5621
  }
5597
5622
 
5598
5623
  export { type ResponseUsage as $, type AgentStepDeltaEvent as A, type MemorySearchResponse as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type MessageLevel as E, type FormattedWsMessage as F, type MessageMetadataPayload$1 as G, type MessageQueuedEvent as H, type ProjectInvoicesResponse as I, type ProjectUsageResponse as J, type ReconnectableWsConnection as K, type ListAllOptions as L, type MemoryResponse as M, type ResolvedCitation as N, type OutputTokensDetails as O, type ParsedSlashCommand as P, type QueryOptions as Q, type ReconnectOptions as R, type ResolvedRecipient as S, type ResponseCompletedEvent as T, type ResponseContentPartAddedEvent as U, type ResponseCreatedEvent as V, type ResponseFailedEvent as W, type ResponseOutputItemAddedEvent as X, type ResponseOutputItemDoneEvent as Y, type ResponseOutputTextDeltaEvent as Z, type ResponseOutputTextDoneEvent as _, type AgentStepEvent as a, requireOk as a$, type SSEEvent as a0, type SSEStreamCallbacks as a1, type SSEStreamResult as a2, type SSEStreamStartData as a3, SUPPORTED_EXTENSIONS as a4, type SkillSummary as a5, type SkippedFile as a6, type TaskResponse as a7, type UpdateMemoryRequest as a8, type UpdateTaskRequest as a9, createDocumentWaiter as aA, dm as aB, doctags as aC, documents as aD, files as aE, filterSkills as aF, formatAgentStepLabel as aG, formatFileSize as aH, formatStreamSummary as aI, formatUserName as aJ, formatWorkspaceChoices as aK, formatWsMessage as aL, generateEncryptedWorkspaceKey as aM, generateNewWorkspaceKey as aN, getErrorCode as aO, getErrorMessage as aP, getRawWorkspaceKey as aQ, health as aR, memory as aS, parseSSEEvents as aT, parseSlashCommand as aU, parseSlashTokenInProgress as aV, performPasswordLogin as aW, performSigningKeyLogin as aX, performSsoDeviceFlowLogin as aY, projects as aZ, requireData as a_, type UploadBatchResult as aa, type UploadDirectOptions as ab, type UploadDirectResult as ac, type UploadOptions as ad, type UploadResult as ae, type UserDailyUsageResponse as af, type UserInfo as ag, type UserInputRequestEvent as ah, type UserMessageEvent as ai, WebSocketAuthError as aj, type WorkspaceChronologyOut as ak, type WorkspaceContext as al, type WsConnection as am, agentconfig as an, assistant as ao, authenticatedFetch as ap, buildRetrievalChunkTool as aq, buildRetrievalFullContextTool as ar, buildRetrievalTocTool as as, connectWebSocket as at, connectWithReconnect as au, consumeSSEStream as av, contacts as aw, conversations as ax, countCitations as ay, createAuthenticatedClient as az, Arbi as b, resolveAuth as b0, resolveCitations as b1, resolveWorkspace as b2, responses as b3, selectWorkspace as b4, selectWorkspaceById as b5, settings as b6, streamSSE as b7, stripCitationMarkdown as b8, summarizeCitations as b9, tags as ba, tasks as bb, workspaces as bc, ArbiApiError as c, ArbiError as d, type ArbiErrorEvent as e, type ArbiOptions as f, type ArtifactEvent as g, type AuthContext as h, type AuthHeaders as i, type AuthenticatedClient as j, type CitationSummary as k, type CliConfig as l, type CliCredentials as m, type CommandDescriptor as n, type ConfigStore as o, type ConnectOptions as p, type CreateMemoryRequest as q, type CreateTaskRequest as r, type DmCryptoContext as s, type DocNameMap as t, type DocumentListFields as u, type DocumentListOrder as v, type DocumentWaiter as w, type DocumentWaiterOptions as x, type ListPaginatedOptions as y, type MemorySearchRequest as z };
@@ -1580,6 +1580,11 @@ declare function resolveRecipient(arbi: ArbiClient, ref: string): Promise<Resolv
1580
1580
  * Encrypts plaintext content for each recipient using their public key.
1581
1581
  * Requires recipient public keys — fetch via contacts or user lookup first.
1582
1582
  *
1583
+ * Returns the created notifications with their content as **plaintext**, not
1584
+ * ciphertext — matching what `listDecryptedDMs` returns. The sender supplied the
1585
+ * text, so it is handed straight back: a caller must never have to re-fetch and
1586
+ * re-decrypt its own ciphertext just to render the message it has just sent.
1587
+ *
1583
1588
  * @param arbi - ArbiClient instance
1584
1589
  * @param messages - Array of { recipient_ext_id, content (plaintext), recipient_encryption_public_key }
1585
1590
  * @param crypto - DM crypto context for the sender
@@ -1588,35 +1593,7 @@ declare function sendEncryptedDM(arbi: ArbiClient, messages: Array<{
1588
1593
  recipient_ext_id: string;
1589
1594
  content: string;
1590
1595
  recipient_encryption_public_key: string;
1591
- }>, crypto: DmCryptoContext): Promise<{
1592
- type: components["schemas"]["NotificationType"];
1593
- external_id: string;
1594
- sender: {
1595
- external_id: string;
1596
- parent_ext_id?: string | null | undefined;
1597
- email: string;
1598
- given_name: string;
1599
- family_name?: string | null | undefined;
1600
- picture?: string | null | undefined;
1601
- encryption_public_key: string;
1602
- is_sso: boolean;
1603
- };
1604
- recipient: {
1605
- external_id: string;
1606
- parent_ext_id?: string | null | undefined;
1607
- email: string;
1608
- given_name: string;
1609
- family_name?: string | null | undefined;
1610
- picture?: string | null | undefined;
1611
- encryption_public_key: string;
1612
- is_sso: boolean;
1613
- };
1614
- workspace_ext_id?: string | null | undefined;
1615
- content?: string | null | undefined;
1616
- read: boolean;
1617
- created_at: string;
1618
- updated_at: string;
1619
- }[]>;
1596
+ }>, crypto: DmCryptoContext): Promise<NotificationResponse[]>;
1620
1597
  /**
1621
1598
  * Ask another user to grant you workspace access.
1622
1599
  *
@@ -2137,13 +2114,19 @@ declare class Arbi {
2137
2114
  readonly user: {
2138
2115
  /**
2139
2116
  * The authenticated user's identity from the current session
2140
- * (`external_id` + `email`), established at login. Returns `null` when not
2141
- * logged in. This is the canonical "who am I" accessor — DM direction and
2142
- * ownership checks read it instead of re-deriving identity per call.
2117
+ * (`external_id`, plus `email` when the session carries one), established at
2118
+ * login. Returns `null` when not logged in. This is the canonical "who am I"
2119
+ * accessor — DM direction and ownership checks read it instead of re-deriving
2120
+ * identity per call.
2121
+ *
2122
+ * The external_id alone decides identity. A session without an email (e.g. an
2123
+ * agent, or a key-restored session) is still a known user, so `email` is
2124
+ * nullable rather than gating the whole identity: an ownership check must
2125
+ * never silently fail open just because the email is missing.
2143
2126
  */
2144
2127
  identity: () => {
2145
2128
  externalId: string;
2146
- email: string;
2129
+ email: string | null;
2147
2130
  } | null;
2148
2131
  /** Today's deployment-wide credit spend for the current user. */
2149
2132
  usageToday: () => Promise<{
@@ -3126,10 +3109,18 @@ declare class Arbi {
3126
3109
  /**
3127
3110
  * Build (and cache) the DM crypto context for the current session.
3128
3111
  *
3129
- * Derives the user's curve25519 keypair from the stored signing key and pairs
3130
- * it with their external_id — everything `list()`/`send()` need to encrypt and
3112
+ * Derives the user's curve25519 keypair from their signing key and pairs it
3113
+ * with their external_id — everything `list()`/`send()` need to encrypt and
3131
3114
  * decrypt. Cached for the session and cleared on logout. Consumers never touch
3132
3115
  * this: it's an internal of the `dm` surface.
3116
+ *
3117
+ * The key comes from the live login result first, exactly as `selectWorkspace`
3118
+ * sources it, and only then from persisted storage (which is what restores a
3119
+ * session on reload). Reading storage first would make DMs the one feature that
3120
+ * breaks whenever persistence is unavailable — `saveSession` deliberately
3121
+ * no-ops without Web Crypto (a non-secure origin, tracking prevention, an
3122
+ * embedded widget), so a perfectly authenticated user with a working workspace
3123
+ * would be told they are "not authenticated" the moment they opened Messages.
3133
3124
  */
3134
3125
  private requireDmCrypto;
3135
3126
  readonly dm: {
@@ -3156,28 +3147,10 @@ declare class Arbi {
3156
3147
  send: (recipient: string, text: string) => Promise<{
3157
3148
  type: components["schemas"]["NotificationType"];
3158
3149
  external_id: string;
3159
- sender: {
3160
- external_id: string;
3161
- parent_ext_id?: string | null | undefined;
3162
- email: string;
3163
- given_name: string;
3164
- family_name?: string | null | undefined;
3165
- picture?: string | null | undefined;
3166
- encryption_public_key: string;
3167
- is_sso: boolean;
3168
- };
3169
- recipient: {
3170
- external_id: string;
3171
- parent_ext_id?: string | null | undefined;
3172
- email: string;
3173
- given_name: string;
3174
- family_name?: string | null | undefined;
3175
- picture?: string | null | undefined;
3176
- encryption_public_key: string;
3177
- is_sso: boolean;
3178
- };
3179
- workspace_ext_id?: string | null | undefined;
3180
- content?: string | null | undefined;
3150
+ sender: components["schemas"]["UserResponse"];
3151
+ recipient: components["schemas"]["UserResponse"];
3152
+ workspace_ext_id?: string | null;
3153
+ content?: string | null;
3181
3154
  read: boolean;
3182
3155
  created_at: string;
3183
3156
  updated_at: string;
@@ -3189,28 +3162,10 @@ declare class Arbi {
3189
3162
  sendTo: (recipientExtId: string, recipientPublicKey: string, text: string) => Promise<{
3190
3163
  type: components["schemas"]["NotificationType"];
3191
3164
  external_id: string;
3192
- sender: {
3193
- external_id: string;
3194
- parent_ext_id?: string | null | undefined;
3195
- email: string;
3196
- given_name: string;
3197
- family_name?: string | null | undefined;
3198
- picture?: string | null | undefined;
3199
- encryption_public_key: string;
3200
- is_sso: boolean;
3201
- };
3202
- recipient: {
3203
- external_id: string;
3204
- parent_ext_id?: string | null | undefined;
3205
- email: string;
3206
- given_name: string;
3207
- family_name?: string | null | undefined;
3208
- picture?: string | null | undefined;
3209
- encryption_public_key: string;
3210
- is_sso: boolean;
3211
- };
3212
- workspace_ext_id?: string | null | undefined;
3213
- content?: string | null | undefined;
3165
+ sender: components["schemas"]["UserResponse"];
3166
+ recipient: components["schemas"]["UserResponse"];
3167
+ workspace_ext_id?: string | null;
3168
+ content?: string | null;
3214
3169
  read: boolean;
3215
3170
  created_at: string;
3216
3171
  updated_at: string;
@@ -5475,6 +5430,7 @@ declare namespace responses {
5475
5430
  type ProjectUsageResponse = components['schemas']['ProjectUsageResponse'];
5476
5431
  type ProjectInvoicesResponse = components['schemas']['ProjectInvoicesResponse'];
5477
5432
  type UserDailyUsageResponse = components['schemas']['UserDailyUsageResponse'];
5433
+ type ProjectUpdateRequest = components['schemas']['ProjectUpdateRequest'];
5478
5434
  declare function listProjects(arbi: ArbiClient): Promise<{
5479
5435
  external_id: string;
5480
5436
  name: string;
@@ -5537,6 +5493,71 @@ declare function createProject(arbi: ArbiClient, name: string): Promise<{
5537
5493
  cancel_at_period_end?: boolean | null | undefined;
5538
5494
  portal_url?: string | null | undefined;
5539
5495
  }>;
5496
+ /** Update a project's mutable fields (e.g. `name`, `daily_cap_per_user`). */
5497
+ declare function updateProject(arbi: ArbiClient, projectExtId: string, body: ProjectUpdateRequest): Promise<{
5498
+ external_id: string;
5499
+ name: string;
5500
+ created_by: string;
5501
+ packs: number;
5502
+ subscription: string;
5503
+ created_at: string;
5504
+ quotas: {
5505
+ storage_gb: {
5506
+ used: number;
5507
+ limit: number;
5508
+ };
5509
+ ai_credits: {
5510
+ used: number;
5511
+ limit: number;
5512
+ };
5513
+ collaborators: {
5514
+ used: number;
5515
+ limit: number;
5516
+ };
5517
+ budget_reset_at?: number | null | undefined;
5518
+ };
5519
+ daily_cap_per_user?: number | null | undefined;
5520
+ price_id?: string | null | undefined;
5521
+ plan?: string | null | undefined;
5522
+ amount?: number | null | undefined;
5523
+ currency?: string | null | undefined;
5524
+ current_period_end?: number | null | undefined;
5525
+ cancel_at_period_end?: boolean | null | undefined;
5526
+ portal_url?: string | null | undefined;
5527
+ }>;
5528
+ /** Rename a project. Convenience wrapper over {@link updateProject}. */
5529
+ declare function renameProject(arbi: ArbiClient, projectExtId: string, name: string): Promise<{
5530
+ external_id: string;
5531
+ name: string;
5532
+ created_by: string;
5533
+ packs: number;
5534
+ subscription: string;
5535
+ created_at: string;
5536
+ quotas: {
5537
+ storage_gb: {
5538
+ used: number;
5539
+ limit: number;
5540
+ };
5541
+ ai_credits: {
5542
+ used: number;
5543
+ limit: number;
5544
+ };
5545
+ collaborators: {
5546
+ used: number;
5547
+ limit: number;
5548
+ };
5549
+ budget_reset_at?: number | null | undefined;
5550
+ };
5551
+ daily_cap_per_user?: number | null | undefined;
5552
+ price_id?: string | null | undefined;
5553
+ plan?: string | null | undefined;
5554
+ amount?: number | null | undefined;
5555
+ currency?: string | null | undefined;
5556
+ current_period_end?: number | null | undefined;
5557
+ cancel_at_period_end?: boolean | null | undefined;
5558
+ portal_url?: string | null | undefined;
5559
+ }>;
5560
+ declare function deleteProject(arbi: ArbiClient, projectExtId: string): Promise<void>;
5540
5561
  declare function refreshProject(arbi: ArbiClient, projectExtId: string): Promise<{
5541
5562
  external_id: string;
5542
5563
  name: string;
@@ -5583,16 +5604,20 @@ declare function getProjectInvoices(arbi: ArbiClient, projectExtId: string): Pro
5583
5604
  declare function getUserUsageToday(arbi: ArbiClient): Promise<UserDailyUsageResponse>;
5584
5605
 
5585
5606
  type projects_ProjectInvoicesResponse = ProjectInvoicesResponse;
5607
+ type projects_ProjectUpdateRequest = ProjectUpdateRequest;
5586
5608
  type projects_ProjectUsageResponse = ProjectUsageResponse;
5587
5609
  type projects_UserDailyUsageResponse = UserDailyUsageResponse;
5588
5610
  declare const projects_createProject: typeof createProject;
5611
+ declare const projects_deleteProject: typeof deleteProject;
5589
5612
  declare const projects_getProjectInvoices: typeof getProjectInvoices;
5590
5613
  declare const projects_getProjectUsage: typeof getProjectUsage;
5591
5614
  declare const projects_getUserUsageToday: typeof getUserUsageToday;
5592
5615
  declare const projects_listProjects: typeof listProjects;
5593
5616
  declare const projects_refreshProject: typeof refreshProject;
5617
+ declare const projects_renameProject: typeof renameProject;
5618
+ declare const projects_updateProject: typeof updateProject;
5594
5619
  declare namespace projects {
5595
- export { type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_createProject as createProject, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProjects as listProjects, projects_refreshProject as refreshProject };
5620
+ export { type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectUpdateRequest as ProjectUpdateRequest, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_createProject as createProject, projects_deleteProject as deleteProject, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProjects as listProjects, projects_refreshProject as refreshProject, projects_renameProject as renameProject, projects_updateProject as updateProject };
5596
5621
  }
5597
5622
 
5598
5623
  export { type ResponseUsage as $, type AgentStepDeltaEvent as A, type MemorySearchResponse as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type MessageLevel as E, type FormattedWsMessage as F, type MessageMetadataPayload$1 as G, type MessageQueuedEvent as H, type ProjectInvoicesResponse as I, type ProjectUsageResponse as J, type ReconnectableWsConnection as K, type ListAllOptions as L, type MemoryResponse as M, type ResolvedCitation as N, type OutputTokensDetails as O, type ParsedSlashCommand as P, type QueryOptions as Q, type ReconnectOptions as R, type ResolvedRecipient as S, type ResponseCompletedEvent as T, type ResponseContentPartAddedEvent as U, type ResponseCreatedEvent as V, type ResponseFailedEvent as W, type ResponseOutputItemAddedEvent as X, type ResponseOutputItemDoneEvent as Y, type ResponseOutputTextDeltaEvent as Z, type ResponseOutputTextDoneEvent as _, type AgentStepEvent as a, requireOk as a$, type SSEEvent as a0, type SSEStreamCallbacks as a1, type SSEStreamResult as a2, type SSEStreamStartData as a3, SUPPORTED_EXTENSIONS as a4, type SkillSummary as a5, type SkippedFile as a6, type TaskResponse as a7, type UpdateMemoryRequest as a8, type UpdateTaskRequest as a9, createDocumentWaiter as aA, dm as aB, doctags as aC, documents as aD, files as aE, filterSkills as aF, formatAgentStepLabel as aG, formatFileSize as aH, formatStreamSummary as aI, formatUserName as aJ, formatWorkspaceChoices as aK, formatWsMessage as aL, generateEncryptedWorkspaceKey as aM, generateNewWorkspaceKey as aN, getErrorCode as aO, getErrorMessage as aP, getRawWorkspaceKey as aQ, health as aR, memory as aS, parseSSEEvents as aT, parseSlashCommand as aU, parseSlashTokenInProgress as aV, performPasswordLogin as aW, performSigningKeyLogin as aX, performSsoDeviceFlowLogin as aY, projects as aZ, requireData as a_, type UploadBatchResult as aa, type UploadDirectOptions as ab, type UploadDirectResult as ac, type UploadOptions as ad, type UploadResult as ae, type UserDailyUsageResponse as af, type UserInfo as ag, type UserInputRequestEvent as ah, type UserMessageEvent as ai, WebSocketAuthError as aj, type WorkspaceChronologyOut as ak, type WorkspaceContext as al, type WsConnection as am, agentconfig as an, assistant as ao, authenticatedFetch as ap, buildRetrievalChunkTool as aq, buildRetrievalFullContextTool as ar, buildRetrievalTocTool as as, connectWebSocket as at, connectWithReconnect as au, consumeSSEStream as av, contacts as aw, conversations as ax, countCitations as ay, createAuthenticatedClient as az, Arbi as b, resolveAuth as b0, resolveCitations as b1, resolveWorkspace as b2, responses as b3, selectWorkspace as b4, selectWorkspaceById as b5, settings as b6, streamSSE as b7, stripCitationMarkdown as b8, summarizeCitations as b9, tags as ba, tasks as bb, workspaces as bc, ArbiApiError as c, ArbiError as d, type ArbiErrorEvent as e, type ArbiOptions as f, type ArtifactEvent as g, type AuthContext as h, type AuthHeaders as i, type AuthenticatedClient as j, type CitationSummary as k, type CliConfig as l, type CliCredentials as m, type CommandDescriptor as n, type ConfigStore as o, type ConnectOptions as p, type CreateMemoryRequest as q, type CreateTaskRequest as r, type DmCryptoContext as s, type DocNameMap as t, type DocumentListFields as u, type DocumentListOrder as v, type DocumentWaiter as w, type DocumentWaiterOptions as x, type ListPaginatedOptions as y, type MemorySearchRequest as z };
package/dist/browser.cjs CHANGED
@@ -5217,6 +5217,7 @@ async function resolveRecipient(arbi, ref) {
5217
5217
  return null;
5218
5218
  }
5219
5219
  async function sendEncryptedDM(arbi, messages, crypto) {
5220
+ const plaintextFor = new Map(messages.map((m2) => [m2.recipient_ext_id, m2.content]));
5220
5221
  const encrypted = await Promise.all(
5221
5222
  messages.map(async (msg) => ({
5222
5223
  recipient_ext_id: msg.recipient_ext_id,
@@ -5228,10 +5229,14 @@ async function sendEncryptedDM(arbi, messages, crypto) {
5228
5229
  )
5229
5230
  }))
5230
5231
  );
5231
- return requireData(
5232
+ const created = requireData(
5232
5233
  await arbi.fetch.POST("/v1/notifications/", { body: { messages: encrypted } }),
5233
5234
  "Failed to send message"
5234
5235
  );
5236
+ return created.map((n2) => ({
5237
+ ...n2,
5238
+ content: plaintextFor.get(n2.recipient.external_id) ?? n2.content
5239
+ }));
5235
5240
  }
5236
5241
  async function requestWorkspaceAccess(arbi, params, crypto) {
5237
5242
  const payload = JSON.stringify({
@@ -5421,11 +5426,14 @@ async function listSessions(arbi) {
5421
5426
  var projects_exports = {};
5422
5427
  __export(projects_exports, {
5423
5428
  createProject: () => createProject,
5429
+ deleteProject: () => deleteProject,
5424
5430
  getProjectInvoices: () => getProjectInvoices,
5425
5431
  getProjectUsage: () => getProjectUsage,
5426
5432
  getUserUsageToday: () => getUserUsageToday,
5427
5433
  listProjects: () => listProjects,
5428
- refreshProject: () => refreshProject
5434
+ refreshProject: () => refreshProject,
5435
+ renameProject: () => renameProject,
5436
+ updateProject: () => updateProject
5429
5437
  });
5430
5438
  async function listProjects(arbi) {
5431
5439
  return requireData(await arbi.fetch.GET("/v1/user/projects/"), "Failed to fetch projects");
@@ -5438,6 +5446,26 @@ async function createProject(arbi, name) {
5438
5446
  "Failed to create project"
5439
5447
  );
5440
5448
  }
5449
+ async function updateProject(arbi, projectExtId, body) {
5450
+ return requireData(
5451
+ await arbi.fetch.PATCH("/v1/user/projects/{project_ext_id}", {
5452
+ params: { path: { project_ext_id: projectExtId } },
5453
+ body
5454
+ }),
5455
+ "Failed to update project"
5456
+ );
5457
+ }
5458
+ async function renameProject(arbi, projectExtId, name) {
5459
+ return updateProject(arbi, projectExtId, { name });
5460
+ }
5461
+ async function deleteProject(arbi, projectExtId) {
5462
+ requireOk(
5463
+ await arbi.fetch.DELETE("/v1/user/projects/{project_ext_id}", {
5464
+ params: { path: { project_ext_id: projectExtId } }
5465
+ }),
5466
+ "Failed to delete project"
5467
+ );
5468
+ }
5441
5469
  async function refreshProject(arbi, projectExtId) {
5442
5470
  return requireData(
5443
5471
  await arbi.fetch.POST("/v1/user/projects/{project_ext_id}/refresh", {
@@ -5705,13 +5733,19 @@ var Arbi = class {
5705
5733
  user = {
5706
5734
  /**
5707
5735
  * The authenticated user's identity from the current session
5708
- * (`external_id` + `email`), established at login. Returns `null` when not
5709
- * logged in. This is the canonical "who am I" accessor — DM direction and
5710
- * ownership checks read it instead of re-deriving identity per call.
5736
+ * (`external_id`, plus `email` when the session carries one), established at
5737
+ * login. Returns `null` when not logged in. This is the canonical "who am I"
5738
+ * accessor — DM direction and ownership checks read it instead of re-deriving
5739
+ * identity per call.
5740
+ *
5741
+ * The external_id alone decides identity. A session without an email (e.g. an
5742
+ * agent, or a key-restored session) is still a known user, so `email` is
5743
+ * nullable rather than gating the whole identity: an ownership check must
5744
+ * never silently fail open just because the email is missing.
5711
5745
  */
5712
5746
  identity: () => {
5713
5747
  const state = this.requireClient().session.getState();
5714
- return state.userExtId && state.userEmail ? { externalId: state.userExtId, email: state.userEmail } : null;
5748
+ return state.userExtId ? { externalId: state.userExtId, email: state.userEmail ?? null } : null;
5715
5749
  },
5716
5750
  /** Today's deployment-wide credit spend for the current user. */
5717
5751
  usageToday: () => getUserUsageToday(this.requireClient())
@@ -5899,23 +5933,31 @@ var Arbi = class {
5899
5933
  /**
5900
5934
  * Build (and cache) the DM crypto context for the current session.
5901
5935
  *
5902
- * Derives the user's curve25519 keypair from the stored signing key and pairs
5903
- * it with their external_id — everything `list()`/`send()` need to encrypt and
5936
+ * Derives the user's curve25519 keypair from their signing key and pairs it
5937
+ * with their external_id — everything `list()`/`send()` need to encrypt and
5904
5938
  * decrypt. Cached for the session and cleared on logout. Consumers never touch
5905
5939
  * this: it's an internal of the `dm` surface.
5940
+ *
5941
+ * The key comes from the live login result first, exactly as `selectWorkspace`
5942
+ * sources it, and only then from persisted storage (which is what restores a
5943
+ * session on reload). Reading storage first would make DMs the one feature that
5944
+ * breaks whenever persistence is unavailable — `saveSession` deliberately
5945
+ * no-ops without Web Crypto (a non-secure origin, tracking prevention, an
5946
+ * embedded widget), so a perfectly authenticated user with a working workspace
5947
+ * would be told they are "not authenticated" the moment they opened Messages.
5906
5948
  */
5907
5949
  async requireDmCrypto() {
5908
5950
  if (this.dmCryptoContext) return this.dmCryptoContext;
5909
5951
  const client = this.requireClient();
5910
- const session = await client.storage.getSession();
5911
- if (!session) {
5952
+ const signingPrivateKey = this.loginResult?.signingPrivateKey ?? (await client.storage.getSession())?.signingPrivateKey;
5953
+ if (!signingPrivateKey) {
5912
5954
  throw new ArbiError("Not authenticated \u2014 no session available for DM encryption");
5913
5955
  }
5914
5956
  const userExtId = client.session.getState().userExtId;
5915
5957
  if (!userExtId) {
5916
5958
  throw new ArbiError("No user identity in session \u2014 cannot set up DM encryption");
5917
5959
  }
5918
- this.dmCryptoContext = createDmCryptoContext(client, session.signingPrivateKey, userExtId);
5960
+ this.dmCryptoContext = createDmCryptoContext(client, signingPrivateKey, userExtId);
5919
5961
  return this.dmCryptoContext;
5920
5962
  }
5921
5963
  dm = {