@arbidocs/sdk 0.3.74 → 0.3.76
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-D_TPBZXY.d.cts → browser-D06F2w6S.d.cts} +40 -2
- package/dist/{browser-D_TPBZXY.d.ts → browser-D06F2w6S.d.ts} +40 -2
- package/dist/browser.cjs +43 -22
- 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 +43 -23
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +54 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +54 -29
- 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 AgentStepEvent, a as Arbi, b as ArbiApiError, c as ArbiError, d as ArbiErrorEvent, e as ArbiOptions, f as ArtifactEvent, g as AuthContext, h as AuthHeaders, i as AuthenticatedClient, C as ChatSession, j as CitationSummary, k as CliConfig, l as CliCredentials, m as ConfigStore, n as ConnectOptions, u as MessageMetadataPayload, v as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, w as ReconnectableWsConnection, x as ResolvedCitation, y as ResponseCompletedEvent, z as ResponseContentPartAddedEvent, B as ResponseCreatedEvent, E as ResponseFailedEvent, G as ResponseOutputItemAddedEvent, H as ResponseOutputItemDoneEvent, I as ResponseOutputTextDeltaEvent, J as ResponseOutputTextDoneEvent, K as ResponseUsage, S as SSEEvent, N as SSEStreamCallbacks, T as SSEStreamResult, U as SSEStreamStartData, W as SkillSummary, a1 as UserInfo, a2 as UserInputRequestEvent, a3 as UserMessageEvent, a4 as
|
|
1
|
+
export { A as AgentStepEvent, a as Arbi, b as ArbiApiError, c as ArbiError, d as ArbiErrorEvent, e as ArbiOptions, f as ArtifactEvent, g as AuthContext, h as AuthHeaders, i as AuthenticatedClient, C as ChatSession, j as CitationSummary, k as CliConfig, l as CliCredentials, m as ConfigStore, n as ConnectOptions, u as MessageMetadataPayload, v as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, w as ReconnectableWsConnection, x as ResolvedCitation, y as ResponseCompletedEvent, z as ResponseContentPartAddedEvent, B as ResponseCreatedEvent, E as ResponseFailedEvent, G as ResponseOutputItemAddedEvent, H as ResponseOutputItemDoneEvent, I as ResponseOutputTextDeltaEvent, J as ResponseOutputTextDoneEvent, K as ResponseUsage, S as SSEEvent, N as SSEStreamCallbacks, T as SSEStreamResult, U as SSEStreamStartData, W as SkillSummary, a1 as UserInfo, a2 as UserInputRequestEvent, a3 as UserMessageEvent, a4 as WebSocketAuthError, a5 as WorkspaceContext, a6 as WsConnection, a7 as agentconfig, a8 as assistant, a9 as authenticatedFetch, aa as buildRetrievalChunkTool, ab as buildRetrievalFullContextTool, ac as buildRetrievalTocTool, ad as connectWebSocket, ae as connectWithReconnect, af as consumeSSEStream, ag as contacts, ah as conversations, ai as countCitations, aj as createAuthenticatedClient, al as dm, am as doctags, an as documents, ao as files, ap as filterSkills, aq as formatAgentStepLabel, ar as formatFileSize, at as formatUserName, au as formatWorkspaceChoices, az as getErrorMessage, aA as getRawWorkspaceKey, aB as health, aC as parseSSEEvents, aD as parseSlashCommand, aE as parseSlashTokenInProgress, aF as performPasswordLogin, aI as requireData, aJ as requireOk, aK as resolveAuth, aL as resolveCitations, aM as resolveWorkspace, aN as responses, aO as selectWorkspace, aP as selectWorkspaceById, aQ as settings, aR as streamSSE, aS as stripCitationMarkdown, aT as summarizeCitations, aU as tags, aV as workspaces } from './browser-D06F2w6S.cjs';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AgentStepEvent, a as Arbi, b as ArbiApiError, c as ArbiError, d as ArbiErrorEvent, e as ArbiOptions, f as ArtifactEvent, g as AuthContext, h as AuthHeaders, i as AuthenticatedClient, C as ChatSession, j as CitationSummary, k as CliConfig, l as CliCredentials, m as ConfigStore, n as ConnectOptions, u as MessageMetadataPayload, v as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, w as ReconnectableWsConnection, x as ResolvedCitation, y as ResponseCompletedEvent, z as ResponseContentPartAddedEvent, B as ResponseCreatedEvent, E as ResponseFailedEvent, G as ResponseOutputItemAddedEvent, H as ResponseOutputItemDoneEvent, I as ResponseOutputTextDeltaEvent, J as ResponseOutputTextDoneEvent, K as ResponseUsage, S as SSEEvent, N as SSEStreamCallbacks, T as SSEStreamResult, U as SSEStreamStartData, W as SkillSummary, a1 as UserInfo, a2 as UserInputRequestEvent, a3 as UserMessageEvent, a4 as
|
|
1
|
+
export { A as AgentStepEvent, a as Arbi, b as ArbiApiError, c as ArbiError, d as ArbiErrorEvent, e as ArbiOptions, f as ArtifactEvent, g as AuthContext, h as AuthHeaders, i as AuthenticatedClient, C as ChatSession, j as CitationSummary, k as CliConfig, l as CliCredentials, m as ConfigStore, n as ConnectOptions, u as MessageMetadataPayload, v as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, w as ReconnectableWsConnection, x as ResolvedCitation, y as ResponseCompletedEvent, z as ResponseContentPartAddedEvent, B as ResponseCreatedEvent, E as ResponseFailedEvent, G as ResponseOutputItemAddedEvent, H as ResponseOutputItemDoneEvent, I as ResponseOutputTextDeltaEvent, J as ResponseOutputTextDoneEvent, K as ResponseUsage, S as SSEEvent, N as SSEStreamCallbacks, T as SSEStreamResult, U as SSEStreamStartData, W as SkillSummary, a1 as UserInfo, a2 as UserInputRequestEvent, a3 as UserMessageEvent, a4 as WebSocketAuthError, a5 as WorkspaceContext, a6 as WsConnection, a7 as agentconfig, a8 as assistant, a9 as authenticatedFetch, aa as buildRetrievalChunkTool, ab as buildRetrievalFullContextTool, ac as buildRetrievalTocTool, ad as connectWebSocket, ae as connectWithReconnect, af as consumeSSEStream, ag as contacts, ah as conversations, ai as countCitations, aj as createAuthenticatedClient, al as dm, am as doctags, an as documents, ao as files, ap as filterSkills, aq as formatAgentStepLabel, ar as formatFileSize, at as formatUserName, au as formatWorkspaceChoices, az as getErrorMessage, aA as getRawWorkspaceKey, aB as health, aC as parseSSEEvents, aD as parseSlashCommand, aE as parseSlashTokenInProgress, aF as performPasswordLogin, aI as requireData, aJ as requireOk, aK as resolveAuth, aL as resolveCitations, aM as resolveWorkspace, aN as responses, aO as selectWorkspace, aP as selectWorkspaceById, aQ as settings, aR as streamSSE, aS as stripCitationMarkdown, aT as summarizeCitations, aU as tags, aV as workspaces } from './browser-D06F2w6S.js';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -3983,6 +3983,12 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
3983
3983
|
var consumeSSEStream = streamSSE;
|
|
3984
3984
|
var AUTH_TIMEOUT_MS = 1e4;
|
|
3985
3985
|
var MAX_BACKOFF_MS = 3e4;
|
|
3986
|
+
var WebSocketAuthError = class extends Error {
|
|
3987
|
+
constructor(reason) {
|
|
3988
|
+
super(`WebSocket auth failed: ${reason}`);
|
|
3989
|
+
this.name = "WebSocketAuthError";
|
|
3990
|
+
}
|
|
3991
|
+
};
|
|
3986
3992
|
function connectWebSocket(options) {
|
|
3987
3993
|
const { baseUrl, accessToken, onMessage, onClose } = options;
|
|
3988
3994
|
const url = buildWebSocketUrl(baseUrl);
|
|
@@ -4010,7 +4016,7 @@ function connectWebSocket(options) {
|
|
|
4010
4016
|
resolve({ close: () => ws.close() });
|
|
4011
4017
|
} else {
|
|
4012
4018
|
ws.close();
|
|
4013
|
-
reject(new
|
|
4019
|
+
reject(new WebSocketAuthError(msg.reason || "unknown"));
|
|
4014
4020
|
}
|
|
4015
4021
|
}
|
|
4016
4022
|
return;
|
|
@@ -4033,52 +4039,66 @@ async function connectWithReconnect(options) {
|
|
|
4033
4039
|
const {
|
|
4034
4040
|
maxRetries = 10,
|
|
4035
4041
|
initialDelayMs = 1e3,
|
|
4042
|
+
getAccessToken,
|
|
4043
|
+
refreshAuth,
|
|
4036
4044
|
onReconnecting,
|
|
4037
4045
|
onReconnected,
|
|
4038
4046
|
onReconnectFailed,
|
|
4039
4047
|
onClose,
|
|
4040
|
-
|
|
4048
|
+
onMessage,
|
|
4049
|
+
baseUrl,
|
|
4050
|
+
accessToken
|
|
4041
4051
|
} = options;
|
|
4052
|
+
const resolveToken = getAccessToken ?? (() => accessToken);
|
|
4042
4053
|
let closed = false;
|
|
4043
|
-
let
|
|
4054
|
+
let cancelDelay = null;
|
|
4044
4055
|
let currentConnection = null;
|
|
4056
|
+
const connectOnce = async () => {
|
|
4057
|
+
const token = await resolveToken();
|
|
4058
|
+
if (!token) throw new WebSocketAuthError("no access token available");
|
|
4059
|
+
return connectWebSocket({
|
|
4060
|
+
baseUrl,
|
|
4061
|
+
accessToken: token,
|
|
4062
|
+
onMessage,
|
|
4063
|
+
onClose: (code, reason) => {
|
|
4064
|
+
currentConnection = null;
|
|
4065
|
+
onClose?.(code, reason);
|
|
4066
|
+
if (!closed) void scheduleReconnect();
|
|
4067
|
+
}
|
|
4068
|
+
});
|
|
4069
|
+
};
|
|
4045
4070
|
const scheduleReconnect = async () => {
|
|
4046
4071
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
4047
4072
|
if (closed) return;
|
|
4048
4073
|
const delay = Math.min(initialDelayMs * Math.pow(2, attempt - 1), MAX_BACKOFF_MS);
|
|
4049
4074
|
onReconnecting?.(attempt, maxRetries);
|
|
4050
4075
|
await new Promise((resolve) => {
|
|
4051
|
-
|
|
4076
|
+
const timer = setTimeout(resolve, delay);
|
|
4077
|
+
cancelDelay = () => {
|
|
4078
|
+
clearTimeout(timer);
|
|
4079
|
+
resolve();
|
|
4080
|
+
};
|
|
4052
4081
|
});
|
|
4082
|
+
cancelDelay = null;
|
|
4053
4083
|
if (closed) return;
|
|
4054
4084
|
try {
|
|
4055
|
-
currentConnection = await
|
|
4056
|
-
...connectOpts,
|
|
4057
|
-
onClose: (code, reason) => {
|
|
4058
|
-
currentConnection = null;
|
|
4059
|
-
onClose?.(code, reason);
|
|
4060
|
-
if (!closed) scheduleReconnect();
|
|
4061
|
-
}
|
|
4062
|
-
});
|
|
4085
|
+
currentConnection = await connectOnce();
|
|
4063
4086
|
onReconnected?.();
|
|
4064
4087
|
return;
|
|
4065
|
-
} catch {
|
|
4088
|
+
} catch (err) {
|
|
4089
|
+
if (err instanceof WebSocketAuthError && refreshAuth) {
|
|
4090
|
+
await refreshAuth().catch(() => {
|
|
4091
|
+
});
|
|
4092
|
+
}
|
|
4066
4093
|
}
|
|
4067
4094
|
}
|
|
4068
4095
|
if (!closed) onReconnectFailed?.();
|
|
4069
4096
|
};
|
|
4070
|
-
currentConnection = await
|
|
4071
|
-
...connectOpts,
|
|
4072
|
-
onClose: (code, reason) => {
|
|
4073
|
-
currentConnection = null;
|
|
4074
|
-
onClose?.(code, reason);
|
|
4075
|
-
if (!closed) scheduleReconnect();
|
|
4076
|
-
}
|
|
4077
|
-
});
|
|
4097
|
+
currentConnection = await connectOnce();
|
|
4078
4098
|
return {
|
|
4079
4099
|
close: () => {
|
|
4080
4100
|
closed = true;
|
|
4081
|
-
|
|
4101
|
+
cancelDelay?.();
|
|
4082
4102
|
currentConnection?.close();
|
|
4083
4103
|
currentConnection = null;
|
|
4084
4104
|
}
|
|
@@ -5624,6 +5644,6 @@ function extractResponseText(response) {
|
|
|
5624
5644
|
return parts.join("");
|
|
5625
5645
|
}
|
|
5626
5646
|
|
|
5627
|
-
export { Arbi, ArbiApiError, ArbiError, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, settings_exports as settings, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, workspaces_exports as workspaces };
|
|
5647
|
+
export { Arbi, ArbiApiError, ArbiError, WebSocketAuthError, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, settings_exports as settings, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, workspaces_exports as workspaces };
|
|
5628
5648
|
//# sourceMappingURL=browser.js.map
|
|
5629
5649
|
//# sourceMappingURL=browser.js.map
|