@arbidocs/sdk 0.4.94 → 0.4.96

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
@@ -1,5 +1,5 @@
1
- import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aJ as SkippedFile, bd as UploadResult, m as AuthHeaders, b9 as UploadBatchResult, bc as UploadOptions, ba as UploadDirectOptions, bb as UploadDirectResult, aG as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-DcxlFaYK.cjs';
2
- export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aF as STEP_FIELD_OPTION_TONES, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, aO as StepFieldOption, aP as StepFieldOptionTone, aQ as StepKind, aR as StepPhase, aS as StepSignal, aT as StepSignalWhen, aU as StepState, aV as StepStatus, aW as SubmitBackgroundQueryOptions, aX as TagChange, aY as TagFieldDefinition, aZ as TagKind, a_ as TagKindField, a$ as TagKindSchema, b0 as TagLinks, b1 as TagListQuery, b2 as TagResponse, b3 as TaskPlan, b4 as TaskPlanStep, b5 as TokenBudgetContext, b6 as UpdateConversationRequest, b8 as UpdateWorkflowRequest, be as UsageBreakdown, bf as UserDailyUsageResponse, bg as UserInfo, bh as UserInputRequestEvent, bi as UserMessageEvent, bj as WebSocketAuthError, bk as WorkStatus, bl as WorkflowAuthMode, bm as WorkflowResponse, bn as WorkflowRunHistoryResponse, bo as WorkflowRunResponse, bp as WorkspaceContext, bq as WsConnection, br as account, bs as agentconfig, bt as agents, bu as assistant, bv as authenticatedFetch, bw as buildDocNameMap, bx as buildFactsContextTool, by as buildRetrievalChunkTool, bz as buildRetrievalFullContextTool, bA as buildRetrievalTocTool, bB as connectWebSocket, bC as connectWithReconnect, bD as consumeSSEStream, bE as contacts, bF as conversations, bG as countCitations, bH as createAuthenticatedClient, bI as createDocumentWaiter, bJ as dm, bK as doctags, bL as documents, bM as facts, bN as files, bO as filterSkills, bP as formatAgentStepLabel, bQ as formatFileSize, bR as formatItemLabel, bS as formatStreamSummary, bT as formatUserName, bU as formatWorkspaceChoices, bV as formatWsMessage, bW as generateEncryptedWorkspaceKey, bX as generateNewWorkspaceKey, bY as getErrorCode, bZ as getErrorMessage, b_ as getRawWorkspaceKey, b$ as health, c1 as identityErrorCode, c0 as identityVerification, c2 as mail, c3 as parseSSEEvents, c4 as parseSlashCommand, c5 as parseSlashTokenInProgress, c6 as performPasswordLogin, c7 as performSigningKeyLogin, c8 as performSsoDeviceFlowLogin, c9 as profile, ca as projects, cb as requireData, cc as requireOk, cd as resolveAuth, ce as resolveCitations, cf as resolveWorkspace, cg as responses, ch as selectWorkspace, ci as selectWorkspaceById, cj as sessions, ck as settings, cl as streamSSE, cm as stripCitationMarkdown, cn as summarizeCitations, co as tags, cp as work, cq as workflowSteps, cr as workflows, cs as workspaces } from './browser-DcxlFaYK.cjs';
1
+ import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aJ as SkippedFile, bd as UploadResult, m as AuthHeaders, b9 as UploadBatchResult, bc as UploadOptions, ba as UploadDirectOptions, bb as UploadDirectResult, aG as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-CJqWb9M6.cjs';
2
+ export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aF as STEP_FIELD_OPTION_TONES, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, aO as StepFieldOption, aP as StepFieldOptionTone, aQ as StepKind, aR as StepPhase, aS as StepSignal, aT as StepSignalWhen, aU as StepState, aV as StepStatus, aW as SubmitBackgroundQueryOptions, aX as TagChange, aY as TagFieldDefinition, aZ as TagKind, a_ as TagKindField, a$ as TagKindSchema, b0 as TagLinks, b1 as TagListQuery, b2 as TagResponse, b3 as TaskPlan, b4 as TaskPlanStep, b5 as TokenBudgetContext, b6 as UpdateConversationRequest, b8 as UpdateWorkflowRequest, be as UsageBreakdown, bf as UserDailyUsageResponse, bg as UserInfo, bh as UserInputRequestEvent, bi as UserMessageEvent, bj as WebSocketAuthError, bk as WorkStatus, bl as WorkflowAuthMode, bm as WorkflowResponse, bn as WorkflowRunHistoryResponse, bo as WorkflowRunResponse, bp as WorkspaceContext, bq as WsConnection, br as account, bs as agentconfig, bt as agents, bu as assistant, bv as authenticatedFetch, bw as buildDocNameMap, bx as buildFactsContextTool, by as buildRetrievalChunkTool, bz as buildRetrievalFullContextTool, bA as buildRetrievalTocTool, bB as connectWebSocket, bC as connectWithReconnect, bD as consumeSSEStream, bE as contacts, bF as conversations, bG as countCitations, bH as createAuthenticatedClient, bI as createDocumentWaiter, bJ as dm, bK as doctags, bL as documents, bM as facts, bN as files, bO as filterSkills, bP as formatAgentStepLabel, bQ as formatFileSize, bR as formatItemLabel, bS as formatStreamSummary, bT as formatUserName, bU as formatWorkspaceChoices, bV as formatWsMessage, bW as generateEncryptedWorkspaceKey, bX as generateNewWorkspaceKey, bY as getErrorCode, bZ as getErrorMessage, b_ as getRawWorkspaceKey, b$ as health, c1 as identityErrorCode, c0 as identityVerification, c2 as mail, c3 as parseSSEEvents, c4 as parseSlashCommand, c5 as parseSlashTokenInProgress, c6 as performPasswordLogin, c7 as performSigningKeyLogin, c8 as performSsoDeviceFlowLogin, c9 as profile, ca as projects, cb as requireData, cc as requireOk, cd as resolveAuth, ce as resolveCitations, cf as resolveWorkspace, cg as responses, ch as selectWorkspace, ci as selectWorkspaceById, cj as sessions, ck as settings, cl as streamSSE, cm as stripCitationMarkdown, cn as summarizeCitations, co as tags, cp as work, cq as workflowSteps, cr as workflows, cs as workspaces } from './browser-CJqWb9M6.cjs';
3
3
  import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
4
4
  export { LoginProfile } from '@arbidocs/client';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aJ as SkippedFile, bd as UploadResult, m as AuthHeaders, b9 as UploadBatchResult, bc as UploadOptions, ba as UploadDirectOptions, bb as UploadDirectResult, aG as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-DcxlFaYK.js';
2
- export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aF as STEP_FIELD_OPTION_TONES, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, aO as StepFieldOption, aP as StepFieldOptionTone, aQ as StepKind, aR as StepPhase, aS as StepSignal, aT as StepSignalWhen, aU as StepState, aV as StepStatus, aW as SubmitBackgroundQueryOptions, aX as TagChange, aY as TagFieldDefinition, aZ as TagKind, a_ as TagKindField, a$ as TagKindSchema, b0 as TagLinks, b1 as TagListQuery, b2 as TagResponse, b3 as TaskPlan, b4 as TaskPlanStep, b5 as TokenBudgetContext, b6 as UpdateConversationRequest, b8 as UpdateWorkflowRequest, be as UsageBreakdown, bf as UserDailyUsageResponse, bg as UserInfo, bh as UserInputRequestEvent, bi as UserMessageEvent, bj as WebSocketAuthError, bk as WorkStatus, bl as WorkflowAuthMode, bm as WorkflowResponse, bn as WorkflowRunHistoryResponse, bo as WorkflowRunResponse, bp as WorkspaceContext, bq as WsConnection, br as account, bs as agentconfig, bt as agents, bu as assistant, bv as authenticatedFetch, bw as buildDocNameMap, bx as buildFactsContextTool, by as buildRetrievalChunkTool, bz as buildRetrievalFullContextTool, bA as buildRetrievalTocTool, bB as connectWebSocket, bC as connectWithReconnect, bD as consumeSSEStream, bE as contacts, bF as conversations, bG as countCitations, bH as createAuthenticatedClient, bI as createDocumentWaiter, bJ as dm, bK as doctags, bL as documents, bM as facts, bN as files, bO as filterSkills, bP as formatAgentStepLabel, bQ as formatFileSize, bR as formatItemLabel, bS as formatStreamSummary, bT as formatUserName, bU as formatWorkspaceChoices, bV as formatWsMessage, bW as generateEncryptedWorkspaceKey, bX as generateNewWorkspaceKey, bY as getErrorCode, bZ as getErrorMessage, b_ as getRawWorkspaceKey, b$ as health, c1 as identityErrorCode, c0 as identityVerification, c2 as mail, c3 as parseSSEEvents, c4 as parseSlashCommand, c5 as parseSlashTokenInProgress, c6 as performPasswordLogin, c7 as performSigningKeyLogin, c8 as performSsoDeviceFlowLogin, c9 as profile, ca as projects, cb as requireData, cc as requireOk, cd as resolveAuth, ce as resolveCitations, cf as resolveWorkspace, cg as responses, ch as selectWorkspace, ci as selectWorkspaceById, cj as sessions, ck as settings, cl as streamSSE, cm as stripCitationMarkdown, cn as summarizeCitations, co as tags, cp as work, cq as workflowSteps, cr as workflows, cs as workspaces } from './browser-DcxlFaYK.js';
1
+ import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aJ as SkippedFile, bd as UploadResult, m as AuthHeaders, b9 as UploadBatchResult, bc as UploadOptions, ba as UploadDirectOptions, bb as UploadDirectResult, aG as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-CJqWb9M6.js';
2
+ export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aF as STEP_FIELD_OPTION_TONES, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, aO as StepFieldOption, aP as StepFieldOptionTone, aQ as StepKind, aR as StepPhase, aS as StepSignal, aT as StepSignalWhen, aU as StepState, aV as StepStatus, aW as SubmitBackgroundQueryOptions, aX as TagChange, aY as TagFieldDefinition, aZ as TagKind, a_ as TagKindField, a$ as TagKindSchema, b0 as TagLinks, b1 as TagListQuery, b2 as TagResponse, b3 as TaskPlan, b4 as TaskPlanStep, b5 as TokenBudgetContext, b6 as UpdateConversationRequest, b8 as UpdateWorkflowRequest, be as UsageBreakdown, bf as UserDailyUsageResponse, bg as UserInfo, bh as UserInputRequestEvent, bi as UserMessageEvent, bj as WebSocketAuthError, bk as WorkStatus, bl as WorkflowAuthMode, bm as WorkflowResponse, bn as WorkflowRunHistoryResponse, bo as WorkflowRunResponse, bp as WorkspaceContext, bq as WsConnection, br as account, bs as agentconfig, bt as agents, bu as assistant, bv as authenticatedFetch, bw as buildDocNameMap, bx as buildFactsContextTool, by as buildRetrievalChunkTool, bz as buildRetrievalFullContextTool, bA as buildRetrievalTocTool, bB as connectWebSocket, bC as connectWithReconnect, bD as consumeSSEStream, bE as contacts, bF as conversations, bG as countCitations, bH as createAuthenticatedClient, bI as createDocumentWaiter, bJ as dm, bK as doctags, bL as documents, bM as facts, bN as files, bO as filterSkills, bP as formatAgentStepLabel, bQ as formatFileSize, bR as formatItemLabel, bS as formatStreamSummary, bT as formatUserName, bU as formatWorkspaceChoices, bV as formatWsMessage, bW as generateEncryptedWorkspaceKey, bX as generateNewWorkspaceKey, bY as getErrorCode, bZ as getErrorMessage, b_ as getRawWorkspaceKey, b$ as health, c1 as identityErrorCode, c0 as identityVerification, c2 as mail, c3 as parseSSEEvents, c4 as parseSlashCommand, c5 as parseSlashTokenInProgress, c6 as performPasswordLogin, c7 as performSigningKeyLogin, c8 as performSsoDeviceFlowLogin, c9 as profile, ca as projects, cb as requireData, cc as requireOk, cd as resolveAuth, ce as resolveCitations, cf as resolveWorkspace, cg as responses, ch as selectWorkspace, ci as selectWorkspaceById, cj as sessions, ck as settings, cl as streamSSE, cm as stripCitationMarkdown, cn as summarizeCitations, co as tags, cp as work, cq as workflowSteps, cr as workflows, cs as workspaces } from './browser-CJqWb9M6.js';
3
3
  import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
4
4
  export { LoginProfile } from '@arbidocs/client';
5
5
 
package/dist/index.js CHANGED
@@ -4079,6 +4079,12 @@ async function getRawWorkspaceKey(arbi, workspaceId, signingPrivateKeyBase64) {
4079
4079
  });
4080
4080
  return sealedBoxDecrypt(ws.wrapped_key, encryptionKeyPair.secretKey);
4081
4081
  }
4082
+ var StaleSessionError = class extends ArbiError {
4083
+ constructor(message) {
4084
+ super(message);
4085
+ this.name = "StaleSessionError";
4086
+ }
4087
+ };
4082
4088
  async function openWorkspaceEntry(arbi, ws, serverSessionKey, signingPrivateKeyBase64) {
4083
4089
  if (ws.wrapped_key) {
4084
4090
  const sealedKey = await selectWorkspace(
@@ -4088,12 +4094,13 @@ async function openWorkspaceEntry(arbi, ws, serverSessionKey, signingPrivateKeyB
4088
4094
  serverSessionKey,
4089
4095
  signingPrivateKeyBase64
4090
4096
  );
4091
- const { error: error2 } = await arbi.fetch.POST("/v1/workspace/{workspace_ext_id}/open", {
4097
+ const { error: error2, response } = await arbi.fetch.POST("/v1/workspace/{workspace_ext_id}/open", {
4092
4098
  params: { path: { workspace_ext_id: ws.external_id } },
4093
4099
  body: { workspace_key: sealedKey }
4094
4100
  });
4095
4101
  if (error2) {
4096
- throw new ArbiError(`Workspace open failed for ${ws.external_id}: ${JSON.stringify(error2)}`);
4102
+ const message = `Workspace open failed for ${ws.external_id}: ${JSON.stringify(error2)}`;
4103
+ throw response.status === 401 ? new StaleSessionError(message) : new ArbiError(message);
4097
4104
  }
4098
4105
  return sealedKey;
4099
4106
  }
@@ -4152,6 +4159,28 @@ async function resolveAuth(store) {
4152
4159
  const { arbi, loginResult } = await createAuthenticatedClient(config, creds, store);
4153
4160
  return { arbi, loginResult, config };
4154
4161
  }
4162
+ async function openOnCachedSession(store, config, creds, workspaceId) {
4163
+ const { arbi, loginResult } = await buildAuthFromCache(config, creds, store);
4164
+ arbi.session.setSelectedWorkspace(workspaceId);
4165
+ await selectWorkspaceById(
4166
+ arbi,
4167
+ workspaceId,
4168
+ loginResult.serverSessionKey,
4169
+ creds.signingPrivateKeyBase64
4170
+ );
4171
+ const nextOpened = Array.from(/* @__PURE__ */ new Set([...creds.openedWorkspaces ?? [], workspaceId]));
4172
+ store.saveCredentials({
4173
+ ...store.requireCredentials(),
4174
+ openedWorkspaces: nextOpened
4175
+ });
4176
+ return {
4177
+ arbi,
4178
+ loginResult,
4179
+ config,
4180
+ workspaceId,
4181
+ accessToken: creds.accessToken
4182
+ };
4183
+ }
4155
4184
  async function resolveWorkspace(store, workspaceOpt) {
4156
4185
  const config = store.requireConfig();
4157
4186
  const creds = store.requireCredentials();
@@ -4160,26 +4189,11 @@ async function resolveWorkspace(store, workspaceOpt) {
4160
4189
  throw new ArbiError("No workspace selected. Run: arbi workspace select <id>");
4161
4190
  }
4162
4191
  if (isSessionAlive(creds)) {
4163
- const { arbi: arbi2, loginResult: loginResult2 } = await buildAuthFromCache(config, creds, store);
4164
- arbi2.session.setSelectedWorkspace(workspaceId);
4165
- await selectWorkspaceById(
4166
- arbi2,
4167
- workspaceId,
4168
- loginResult2.serverSessionKey,
4169
- creds.signingPrivateKeyBase64
4170
- );
4171
- const nextOpened = Array.from(/* @__PURE__ */ new Set([...creds.openedWorkspaces ?? [], workspaceId]));
4172
- store.saveCredentials({
4173
- ...store.requireCredentials(),
4174
- openedWorkspaces: nextOpened
4175
- });
4176
- return {
4177
- arbi: arbi2,
4178
- loginResult: loginResult2,
4179
- config,
4180
- workspaceId,
4181
- accessToken: creds.accessToken
4182
- };
4192
+ try {
4193
+ return await openOnCachedSession(store, config, creds, workspaceId);
4194
+ } catch (err) {
4195
+ if (!(err instanceof StaleSessionError)) throw err;
4196
+ }
4183
4197
  }
4184
4198
  const { arbi, loginResult } = await createAuthenticatedClient(config, creds, store);
4185
4199
  await selectWorkspaceById(
@@ -6580,8 +6594,12 @@ function currentSessionId(accessToken) {
6580
6594
  // src/operations/profile.ts
6581
6595
  var profile_exports = {};
6582
6596
  __export(profile_exports, {
6597
+ getCurrentUser: () => getCurrentUser,
6583
6598
  updateProfile: () => updateProfile
6584
6599
  });
6600
+ async function getCurrentUser(arbi) {
6601
+ return requireData(await arbi.fetch.GET("/v1/user/me"), "Failed to fetch the current user");
6602
+ }
6585
6603
  async function updateProfile(arbi, body) {
6586
6604
  return requireData(
6587
6605
  await arbi.fetch.PATCH("/v1/user/profile", { body }),
@@ -8162,7 +8180,12 @@ var Arbi = class {
8162
8180
  return () => this.profileListeners.delete(listener);
8163
8181
  },
8164
8182
  /** Today's deployment-wide credit spend for the current user. */
8165
- usageToday: () => getUserUsageToday(this.requireClient())
8183
+ usageToday: () => getUserUsageToday(this.requireClient()),
8184
+ /**
8185
+ * The signed-in user from the server, with `can_create_projects`: false on deployments where
8186
+ * only firm members may create projects and workspaces and this user is not one (yet).
8187
+ */
8188
+ me: () => getCurrentUser(this.requireClient())
8166
8189
  };
8167
8190
  // ── Profile ───────────────────────────────────────────────────────────
8168
8191
  profile = {