@arbidocs/sdk 0.3.109 → 0.3.111
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-C4gqnXaX.d.cts → browser-B5b3SDW6.d.cts} +57 -4
- package/dist/{browser-C4gqnXaX.d.ts → browser-B5b3SDW6.d.ts} +57 -4
- package/dist/browser.cjs +35 -3
- 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 +35 -3
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +35 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +35 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/browser.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as
|
|
1
|
+
export { A as AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as CommandDescriptor, o as ConfigStore, p as ConnectOptions, q as CreateMemoryRequest, r as CreateTaskRequest, M as MemoryResponse, z as MemorySearchRequest, B as MemorySearchResponse, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, I as ReconnectableWsConnection, J as ResolvedCitation, K as ResponseCompletedEvent, N as ResponseContentPartAddedEvent, S as ResponseCreatedEvent, T as ResponseFailedEvent, U as ResponseOutputItemAddedEvent, V as ResponseOutputItemDoneEvent, W as ResponseOutputTextDeltaEvent, X as ResponseOutputTextDoneEvent, Y as ResponseUsage, Z as SSEEvent, _ as SSEStreamCallbacks, $ as SSEStreamResult, a0 as SSEStreamStartData, a2 as SkillSummary, a4 as TaskResponse, a5 as UpdateMemoryRequest, a6 as UpdateTaskRequest, ac as UserInfo, ad as UserInputRequestEvent, ae as UserMessageEvent, af as WebSocketAuthError, ag as WorkspaceContext, ah as WsConnection, ai as agentconfig, aj as assistant, ak as authenticatedFetch, al as buildRetrievalChunkTool, am as buildRetrievalFullContextTool, an as buildRetrievalTocTool, ao as connectWebSocket, ap as connectWithReconnect, aq as consumeSSEStream, ar as contacts, as as conversations, at as countCitations, au as createAuthenticatedClient, aw as dm, ax as doctags, ay as documents, az as files, aA as filterSkills, aB as formatAgentStepLabel, aC as formatFileSize, aE as formatUserName, aF as formatWorkspaceChoices, aK as getErrorMessage, aL as getRawWorkspaceKey, aM as health, aN as memory, aO as parseSSEEvents, aP as parseSlashCommand, aQ as parseSlashTokenInProgress, aR as performPasswordLogin, aU as requireData, aV as requireOk, aW as resolveAuth, aX as resolveCitations, aY as resolveWorkspace, aZ as responses, a_ as selectWorkspace, a$ as selectWorkspaceById, b0 as settings, b1 as streamSSE, b2 as stripCitationMarkdown, b3 as summarizeCitations, b4 as tags, b5 as tasks, b6 as workspaces } from './browser-B5b3SDW6.cjs';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as
|
|
1
|
+
export { A as AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as CommandDescriptor, o as ConfigStore, p as ConnectOptions, q as CreateMemoryRequest, r as CreateTaskRequest, M as MemoryResponse, z as MemorySearchRequest, B as MemorySearchResponse, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, I as ReconnectableWsConnection, J as ResolvedCitation, K as ResponseCompletedEvent, N as ResponseContentPartAddedEvent, S as ResponseCreatedEvent, T as ResponseFailedEvent, U as ResponseOutputItemAddedEvent, V as ResponseOutputItemDoneEvent, W as ResponseOutputTextDeltaEvent, X as ResponseOutputTextDoneEvent, Y as ResponseUsage, Z as SSEEvent, _ as SSEStreamCallbacks, $ as SSEStreamResult, a0 as SSEStreamStartData, a2 as SkillSummary, a4 as TaskResponse, a5 as UpdateMemoryRequest, a6 as UpdateTaskRequest, ac as UserInfo, ad as UserInputRequestEvent, ae as UserMessageEvent, af as WebSocketAuthError, ag as WorkspaceContext, ah as WsConnection, ai as agentconfig, aj as assistant, ak as authenticatedFetch, al as buildRetrievalChunkTool, am as buildRetrievalFullContextTool, an as buildRetrievalTocTool, ao as connectWebSocket, ap as connectWithReconnect, aq as consumeSSEStream, ar as contacts, as as conversations, at as countCitations, au as createAuthenticatedClient, aw as dm, ax as doctags, ay as documents, az as files, aA as filterSkills, aB as formatAgentStepLabel, aC as formatFileSize, aE as formatUserName, aF as formatWorkspaceChoices, aK as getErrorMessage, aL as getRawWorkspaceKey, aM as health, aN as memory, aO as parseSSEEvents, aP as parseSlashCommand, aQ as parseSlashTokenInProgress, aR as performPasswordLogin, aU as requireData, aV as requireOk, aW as resolveAuth, aX as resolveCitations, aY as resolveWorkspace, aZ as responses, a_ as selectWorkspace, a$ as selectWorkspaceById, b0 as settings, b1 as streamSSE, b2 as stripCitationMarkdown, b3 as summarizeCitations, b4 as tags, b5 as tasks, b6 as workspaces } from './browser-B5b3SDW6.js';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -4040,7 +4040,7 @@ var WebSocketAuthError = class extends Error {
|
|
|
4040
4040
|
}
|
|
4041
4041
|
};
|
|
4042
4042
|
function connectWebSocket(options) {
|
|
4043
|
-
const { baseUrl, accessToken, onMessage, onClose } = options;
|
|
4043
|
+
const { baseUrl, accessToken, onMessage, onClose, onAuthenticated } = options;
|
|
4044
4044
|
const url = buildWebSocketUrl(baseUrl);
|
|
4045
4045
|
return new Promise((resolve, reject) => {
|
|
4046
4046
|
const ws = new WebSocket(url);
|
|
@@ -4063,6 +4063,7 @@ function connectWebSocket(options) {
|
|
|
4063
4063
|
clearTimeout(timeout);
|
|
4064
4064
|
if (msg.success) {
|
|
4065
4065
|
authenticated = true;
|
|
4066
|
+
onAuthenticated?.(msg);
|
|
4066
4067
|
resolve({ close: () => ws.close() });
|
|
4067
4068
|
} else {
|
|
4068
4069
|
ws.close();
|
|
@@ -4096,6 +4097,8 @@ async function connectWithReconnect(options) {
|
|
|
4096
4097
|
onReconnectFailed,
|
|
4097
4098
|
onClose,
|
|
4098
4099
|
onMessage,
|
|
4100
|
+
onAuthenticated,
|
|
4101
|
+
shouldReconnect,
|
|
4099
4102
|
baseUrl,
|
|
4100
4103
|
accessToken
|
|
4101
4104
|
} = options;
|
|
@@ -4110,10 +4113,11 @@ async function connectWithReconnect(options) {
|
|
|
4110
4113
|
baseUrl,
|
|
4111
4114
|
accessToken: token,
|
|
4112
4115
|
onMessage,
|
|
4116
|
+
onAuthenticated,
|
|
4113
4117
|
onClose: (code, reason) => {
|
|
4114
4118
|
currentConnection = null;
|
|
4115
4119
|
onClose?.(code, reason);
|
|
4116
|
-
if (!closed) void scheduleReconnect();
|
|
4120
|
+
if (!closed && (shouldReconnect?.(code, reason) ?? true)) void scheduleReconnect();
|
|
4117
4121
|
}
|
|
4118
4122
|
});
|
|
4119
4123
|
};
|
|
@@ -4144,7 +4148,14 @@ async function connectWithReconnect(options) {
|
|
|
4144
4148
|
}
|
|
4145
4149
|
if (!closed) onReconnectFailed?.();
|
|
4146
4150
|
};
|
|
4147
|
-
|
|
4151
|
+
try {
|
|
4152
|
+
currentConnection = await connectOnce();
|
|
4153
|
+
} catch (err) {
|
|
4154
|
+
if (!(err instanceof WebSocketAuthError) || !refreshAuth) throw err;
|
|
4155
|
+
await refreshAuth().catch(() => {
|
|
4156
|
+
});
|
|
4157
|
+
currentConnection = await connectOnce();
|
|
4158
|
+
}
|
|
4148
4159
|
return {
|
|
4149
4160
|
close: () => {
|
|
4150
4161
|
closed = true;
|
|
@@ -4788,6 +4799,7 @@ __export(assistant_exports, {
|
|
|
4788
4799
|
buildRetrievalFullContextTool: () => buildRetrievalFullContextTool,
|
|
4789
4800
|
buildRetrievalTocTool: () => buildRetrievalTocTool,
|
|
4790
4801
|
filterSkills: () => filterSkills,
|
|
4802
|
+
listCommands: () => listCommands,
|
|
4791
4803
|
listSkills: () => listSkills,
|
|
4792
4804
|
parseSlashCommand: () => parseSlashCommand,
|
|
4793
4805
|
parseSlashTokenInProgress: () => parseSlashTokenInProgress,
|
|
@@ -4895,6 +4907,13 @@ async function listSkills(arbi, options) {
|
|
|
4895
4907
|
);
|
|
4896
4908
|
return result.skills;
|
|
4897
4909
|
}
|
|
4910
|
+
async function listCommands(arbi) {
|
|
4911
|
+
const result = requireData(
|
|
4912
|
+
await arbi.fetch.GET("/v1/assistant/commands", {}),
|
|
4913
|
+
"Failed to list commands"
|
|
4914
|
+
);
|
|
4915
|
+
return result.commands;
|
|
4916
|
+
}
|
|
4898
4917
|
function parseSlashCommand(input) {
|
|
4899
4918
|
const m2 = /^\s*\/([a-zA-Z0-9_-]+)(?:\s+([\s\S]*))?$/.exec(input);
|
|
4900
4919
|
if (!m2) return null;
|
|
@@ -5553,6 +5572,19 @@ var Arbi = class {
|
|
|
5553
5572
|
get hasWorkspace() {
|
|
5554
5573
|
return this.currentWorkspaceId !== null;
|
|
5555
5574
|
}
|
|
5575
|
+
/**
|
|
5576
|
+
* Live connection info for opening a raw transport (e.g. a WebSocket).
|
|
5577
|
+
*
|
|
5578
|
+
* Reads the access token from the session on each call, so a token refreshed
|
|
5579
|
+
* elsewhere is reflected on the next (re)connect. Returns `null` when there is
|
|
5580
|
+
* no client/token yet (not logged in) rather than throwing, so callers can
|
|
5581
|
+
* poll for readiness instead of guarding against exceptions.
|
|
5582
|
+
*/
|
|
5583
|
+
getConnectionInfo() {
|
|
5584
|
+
const accessToken = this.client?.session.getState().accessToken;
|
|
5585
|
+
if (!accessToken) return null;
|
|
5586
|
+
return { baseUrl: this.options.url, accessToken };
|
|
5587
|
+
}
|
|
5556
5588
|
// ── Auth headers (for raw fetch operations) ───────────────────────────
|
|
5557
5589
|
getAuthHeaders() {
|
|
5558
5590
|
const client = this.requireClient();
|