@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/{browser-DcxlFaYK.d.cts → browser-CJqWb9M6.d.cts} +25 -1
- package/dist/{browser-DcxlFaYK.d.ts → browser-CJqWb9M6.d.ts} +25 -1
- package/dist/browser.cjs +46 -23
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +46 -23
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +46 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +46 -23
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, 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, b7 as UpdateFactRequest, 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, bu as assistant, bv as authenticatedFetch, 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, 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, bT as formatUserName, bU as formatWorkspaceChoices, 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, 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-
|
|
1
|
+
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, 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, b7 as UpdateFactRequest, 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, bu as assistant, bv as authenticatedFetch, 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, 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, bT as formatUserName, bU as formatWorkspaceChoices, 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, 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';
|
|
2
2
|
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, 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, b7 as UpdateFactRequest, 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, bu as assistant, bv as authenticatedFetch, 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, 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, bT as formatUserName, bU as formatWorkspaceChoices, 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, 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-
|
|
1
|
+
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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, aH as SendBack, aI as SkillSummary, aK as StepActionRequest, aL as StepActivityEvent, aM as StepAssignee, aN as StepField, 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, b7 as UpdateFactRequest, 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, bu as assistant, bv as authenticatedFetch, 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, 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, bT as formatUserName, bU as formatWorkspaceChoices, 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, 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';
|
|
2
2
|
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -3692,6 +3692,12 @@ async function getRawWorkspaceKey(arbi, workspaceId, signingPrivateKeyBase64) {
|
|
|
3692
3692
|
});
|
|
3693
3693
|
return sealedBoxDecrypt(ws.wrapped_key, encryptionKeyPair.secretKey);
|
|
3694
3694
|
}
|
|
3695
|
+
var StaleSessionError = class extends ArbiError {
|
|
3696
|
+
constructor(message) {
|
|
3697
|
+
super(message);
|
|
3698
|
+
this.name = "StaleSessionError";
|
|
3699
|
+
}
|
|
3700
|
+
};
|
|
3695
3701
|
async function openWorkspaceEntry(arbi, ws, serverSessionKey, signingPrivateKeyBase64) {
|
|
3696
3702
|
if (ws.wrapped_key) {
|
|
3697
3703
|
const sealedKey = await selectWorkspace(
|
|
@@ -3701,12 +3707,13 @@ async function openWorkspaceEntry(arbi, ws, serverSessionKey, signingPrivateKeyB
|
|
|
3701
3707
|
serverSessionKey,
|
|
3702
3708
|
signingPrivateKeyBase64
|
|
3703
3709
|
);
|
|
3704
|
-
const { error: error2 } = await arbi.fetch.POST("/v1/workspace/{workspace_ext_id}/open", {
|
|
3710
|
+
const { error: error2, response } = await arbi.fetch.POST("/v1/workspace/{workspace_ext_id}/open", {
|
|
3705
3711
|
params: { path: { workspace_ext_id: ws.external_id } },
|
|
3706
3712
|
body: { workspace_key: sealedKey }
|
|
3707
3713
|
});
|
|
3708
3714
|
if (error2) {
|
|
3709
|
-
|
|
3715
|
+
const message = `Workspace open failed for ${ws.external_id}: ${JSON.stringify(error2)}`;
|
|
3716
|
+
throw response.status === 401 ? new StaleSessionError(message) : new ArbiError(message);
|
|
3710
3717
|
}
|
|
3711
3718
|
return sealedKey;
|
|
3712
3719
|
}
|
|
@@ -3765,6 +3772,28 @@ async function resolveAuth(store) {
|
|
|
3765
3772
|
const { arbi, loginResult } = await createAuthenticatedClient(config, creds, store);
|
|
3766
3773
|
return { arbi, loginResult, config };
|
|
3767
3774
|
}
|
|
3775
|
+
async function openOnCachedSession(store, config, creds, workspaceId) {
|
|
3776
|
+
const { arbi, loginResult } = await buildAuthFromCache(config, creds, store);
|
|
3777
|
+
arbi.session.setSelectedWorkspace(workspaceId);
|
|
3778
|
+
await selectWorkspaceById(
|
|
3779
|
+
arbi,
|
|
3780
|
+
workspaceId,
|
|
3781
|
+
loginResult.serverSessionKey,
|
|
3782
|
+
creds.signingPrivateKeyBase64
|
|
3783
|
+
);
|
|
3784
|
+
const nextOpened = Array.from(/* @__PURE__ */ new Set([...creds.openedWorkspaces ?? [], workspaceId]));
|
|
3785
|
+
store.saveCredentials({
|
|
3786
|
+
...store.requireCredentials(),
|
|
3787
|
+
openedWorkspaces: nextOpened
|
|
3788
|
+
});
|
|
3789
|
+
return {
|
|
3790
|
+
arbi,
|
|
3791
|
+
loginResult,
|
|
3792
|
+
config,
|
|
3793
|
+
workspaceId,
|
|
3794
|
+
accessToken: creds.accessToken
|
|
3795
|
+
};
|
|
3796
|
+
}
|
|
3768
3797
|
async function resolveWorkspace(store, workspaceOpt) {
|
|
3769
3798
|
const config = store.requireConfig();
|
|
3770
3799
|
const creds = store.requireCredentials();
|
|
@@ -3773,26 +3802,11 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
3773
3802
|
throw new ArbiError("No workspace selected. Run: arbi workspace select <id>");
|
|
3774
3803
|
}
|
|
3775
3804
|
if (isSessionAlive(creds)) {
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
loginResult2.serverSessionKey,
|
|
3782
|
-
creds.signingPrivateKeyBase64
|
|
3783
|
-
);
|
|
3784
|
-
const nextOpened = Array.from(/* @__PURE__ */ new Set([...creds.openedWorkspaces ?? [], workspaceId]));
|
|
3785
|
-
store.saveCredentials({
|
|
3786
|
-
...store.requireCredentials(),
|
|
3787
|
-
openedWorkspaces: nextOpened
|
|
3788
|
-
});
|
|
3789
|
-
return {
|
|
3790
|
-
arbi: arbi2,
|
|
3791
|
-
loginResult: loginResult2,
|
|
3792
|
-
config,
|
|
3793
|
-
workspaceId,
|
|
3794
|
-
accessToken: creds.accessToken
|
|
3795
|
-
};
|
|
3805
|
+
try {
|
|
3806
|
+
return await openOnCachedSession(store, config, creds, workspaceId);
|
|
3807
|
+
} catch (err) {
|
|
3808
|
+
if (!(err instanceof StaleSessionError)) throw err;
|
|
3809
|
+
}
|
|
3796
3810
|
}
|
|
3797
3811
|
const { arbi, loginResult } = await createAuthenticatedClient(config, creds, store);
|
|
3798
3812
|
await selectWorkspaceById(
|
|
@@ -6022,8 +6036,12 @@ function currentSessionId(accessToken) {
|
|
|
6022
6036
|
// src/operations/profile.ts
|
|
6023
6037
|
var profile_exports = {};
|
|
6024
6038
|
__export(profile_exports, {
|
|
6039
|
+
getCurrentUser: () => getCurrentUser,
|
|
6025
6040
|
updateProfile: () => updateProfile
|
|
6026
6041
|
});
|
|
6042
|
+
async function getCurrentUser(arbi) {
|
|
6043
|
+
return requireData(await arbi.fetch.GET("/v1/user/me"), "Failed to fetch the current user");
|
|
6044
|
+
}
|
|
6027
6045
|
async function updateProfile(arbi, body) {
|
|
6028
6046
|
return requireData(
|
|
6029
6047
|
await arbi.fetch.PATCH("/v1/user/profile", { body }),
|
|
@@ -7604,7 +7622,12 @@ var Arbi = class {
|
|
|
7604
7622
|
return () => this.profileListeners.delete(listener);
|
|
7605
7623
|
},
|
|
7606
7624
|
/** Today's deployment-wide credit spend for the current user. */
|
|
7607
|
-
usageToday: () => getUserUsageToday(this.requireClient())
|
|
7625
|
+
usageToday: () => getUserUsageToday(this.requireClient()),
|
|
7626
|
+
/**
|
|
7627
|
+
* The signed-in user from the server, with `can_create_projects`: false on deployments where
|
|
7628
|
+
* only firm members may create projects and workspaces and this user is not one (yet).
|
|
7629
|
+
*/
|
|
7630
|
+
me: () => getCurrentUser(this.requireClient())
|
|
7608
7631
|
};
|
|
7609
7632
|
// ── Profile ───────────────────────────────────────────────────────────
|
|
7610
7633
|
profile = {
|