@arbidocs/sdk 0.3.54 → 0.3.55
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-EUKWmZXZ.d.cts → browser-DLTufI-X.d.cts} +19 -1
- package/dist/{browser-EUKWmZXZ.d.ts → browser-DLTufI-X.d.ts} +19 -1
- package/dist/browser.cjs +7 -0
- 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 +7 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +7 -0
- 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 +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -320,6 +320,18 @@ declare function parseSSEEvents(chunk: string, buffer: string): {
|
|
|
320
320
|
* Callbacks for streaming SSE events. All callbacks are optional —
|
|
321
321
|
* omitted callbacks simply ignore that event type.
|
|
322
322
|
*/
|
|
323
|
+
/** Structured ARBI error event (e.g. quota exceeded mid-stream). */
|
|
324
|
+
interface ArbiErrorEvent {
|
|
325
|
+
code: string;
|
|
326
|
+
message: string;
|
|
327
|
+
/** Present for QUOTA_EXCEEDED — current spend in USD. */
|
|
328
|
+
spend?: number;
|
|
329
|
+
/** Present for QUOTA_EXCEEDED — budget cap in USD. */
|
|
330
|
+
budget?: number;
|
|
331
|
+
/** Present for QUOTA_EXCEEDED — affected project external id. */
|
|
332
|
+
project_ext_id?: string | null;
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
}
|
|
323
335
|
interface SSEStreamCallbacks {
|
|
324
336
|
onStreamStart?: (data: SSEStreamStartData) => void;
|
|
325
337
|
onToken?: (content: string) => void;
|
|
@@ -329,6 +341,12 @@ interface SSEStreamCallbacks {
|
|
|
329
341
|
onContentPartAdded?: (data: ResponseContentPartAddedEvent) => void;
|
|
330
342
|
onAgentStep?: (data: AgentStepEvent) => void;
|
|
331
343
|
onError?: (message: string) => void;
|
|
344
|
+
/**
|
|
345
|
+
* Fired when the server emits a structured `arbi.error` event mid-stream.
|
|
346
|
+
* Backend uses this for quota-exceeded errors so clients can render an
|
|
347
|
+
* upgrade modal without losing the surrounding stream context.
|
|
348
|
+
*/
|
|
349
|
+
onArbiError?: (event: ArbiErrorEvent) => void;
|
|
332
350
|
onMessageQueued?: (data: MessageQueuedEvent) => void;
|
|
333
351
|
onUserMessage?: (data: UserMessageEvent) => void;
|
|
334
352
|
onMetadata?: (data: MessageMetadataPayload$1) => void;
|
|
@@ -4141,4 +4159,4 @@ declare namespace responses {
|
|
|
4141
4159
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4142
4160
|
}
|
|
4143
4161
|
|
|
4144
|
-
export { type UserInputRequestEvent as $, type AuthHeaders as A, type ReconnectableWsConnection as B, type ConfigStore as C, type DmCryptoContext as D, type ResolvedCitation as E, type FormattedWsMessage as F, type ResponseCompletedEvent as G, type ResponseContentPartAddedEvent as H, type ResponseCreatedEvent as I, type ResponseFailedEvent as J, type ResponseOutputItemAddedEvent as K, type ListAllOptions as L, type MessageLevel as M, type ResponseOutputItemDoneEvent as N, type OutputTokensDetails as O, type ResponseOutputTextDeltaEvent as P, type QueryOptions as Q, type ReconnectOptions as R, type SkippedFile as S, type ResponseOutputTextDoneEvent as T, type UploadResult as U, type ResponseUsage as V, type SSEEvent as W, type SSEStreamCallbacks as X, type SSEStreamResult as Y, type SSEStreamStartData as Z, type UserInfo as _, type CliConfig as a, type UserMessageEvent as a0, type WorkspaceContext as a1, type WsConnection as a2, agentconfig as a3, assistant as a4, authenticatedFetch as a5, buildRetrievalChunkTool as a6, buildRetrievalFullContextTool as a7, buildRetrievalTocTool as a8, connectWebSocket as a9, performSsoDeviceFlowLogin as aA, requireData as aB, requireOk as aC, resolveAuth as aD, resolveCitations as aE, resolveWorkspace as aF, responses as aG, selectWorkspace as aH, selectWorkspaceById as aI, settings as aJ, streamSSE as aK, stripCitationMarkdown as aL, summarizeCitations as aM, tags as aN, workspaces as aO, connectWithReconnect as aa, consumeSSEStream as ab, contacts as ac, conversations as ad, countCitations as ae, createAuthenticatedClient as af, createDocumentWaiter as ag, dm as ah, doctags as ai, documents as aj, files as ak, formatAgentStepLabel as al, formatFileSize as am, formatStreamSummary as an, formatUserName as ao, formatWorkspaceChoices as ap, formatWsMessage as aq, generateEncryptedWorkspaceKey as ar, generateNewWorkspaceKey as as, getErrorCode as at, getErrorMessage as au, getRawWorkspaceKey as av, health as aw, parseSSEEvents as ax, performPasswordLogin as ay, performSigningKeyLogin as az, type CliCredentials as b, type ChatSession as c, type UploadBatchResult as d, type UploadOptions as e, type UploadDirectOptions as f, type UploadDirectResult as g, SUPPORTED_EXTENSIONS as h, type AgentStepEvent as i, Arbi as j, ArbiApiError as k, ArbiError as l, type ArbiOptions as m, type ArtifactEvent as n, type AuthContext as o, type AuthenticatedClient as p, type CitationSummary as q, type ConnectOptions as r, DOC_TERMINAL_STATUSES as s, type DocumentListFields as t, type DocumentListOrder as u, type DocumentWaiter as v, type DocumentWaiterOptions as w, type ListPaginatedOptions as x, type MessageMetadataPayload$1 as y, type MessageQueuedEvent as z };
|
|
4162
|
+
export { type UserInputRequestEvent as $, type AuthHeaders as A, type ReconnectableWsConnection as B, type ConfigStore as C, type DmCryptoContext as D, type ResolvedCitation as E, type FormattedWsMessage as F, type ResponseCompletedEvent as G, type ResponseContentPartAddedEvent as H, type ResponseCreatedEvent as I, type ResponseFailedEvent as J, type ResponseOutputItemAddedEvent as K, type ListAllOptions as L, type MessageLevel as M, type ResponseOutputItemDoneEvent as N, type OutputTokensDetails as O, type ResponseOutputTextDeltaEvent as P, type QueryOptions as Q, type ReconnectOptions as R, type SkippedFile as S, type ResponseOutputTextDoneEvent as T, type UploadResult as U, type ResponseUsage as V, type SSEEvent as W, type SSEStreamCallbacks as X, type SSEStreamResult as Y, type SSEStreamStartData as Z, type UserInfo as _, type CliConfig as a, type UserMessageEvent as a0, type WorkspaceContext as a1, type WsConnection as a2, agentconfig as a3, assistant as a4, authenticatedFetch as a5, buildRetrievalChunkTool as a6, buildRetrievalFullContextTool as a7, buildRetrievalTocTool as a8, connectWebSocket as a9, performSsoDeviceFlowLogin as aA, requireData as aB, requireOk as aC, resolveAuth as aD, resolveCitations as aE, resolveWorkspace as aF, responses as aG, selectWorkspace as aH, selectWorkspaceById as aI, settings as aJ, streamSSE as aK, stripCitationMarkdown as aL, summarizeCitations as aM, tags as aN, workspaces as aO, type ArbiErrorEvent as aP, connectWithReconnect as aa, consumeSSEStream as ab, contacts as ac, conversations as ad, countCitations as ae, createAuthenticatedClient as af, createDocumentWaiter as ag, dm as ah, doctags as ai, documents as aj, files as ak, formatAgentStepLabel as al, formatFileSize as am, formatStreamSummary as an, formatUserName as ao, formatWorkspaceChoices as ap, formatWsMessage as aq, generateEncryptedWorkspaceKey as ar, generateNewWorkspaceKey as as, getErrorCode as at, getErrorMessage as au, getRawWorkspaceKey as av, health as aw, parseSSEEvents as ax, performPasswordLogin as ay, performSigningKeyLogin as az, type CliCredentials as b, type ChatSession as c, type UploadBatchResult as d, type UploadOptions as e, type UploadDirectOptions as f, type UploadDirectResult as g, SUPPORTED_EXTENSIONS as h, type AgentStepEvent as i, Arbi as j, ArbiApiError as k, ArbiError as l, type ArbiOptions as m, type ArtifactEvent as n, type AuthContext as o, type AuthenticatedClient as p, type CitationSummary as q, type ConnectOptions as r, DOC_TERMINAL_STATUSES as s, type DocumentListFields as t, type DocumentListOrder as u, type DocumentWaiter as v, type DocumentWaiterOptions as w, type ListPaginatedOptions as x, type MessageMetadataPayload$1 as y, type MessageQueuedEvent as z };
|
|
@@ -320,6 +320,18 @@ declare function parseSSEEvents(chunk: string, buffer: string): {
|
|
|
320
320
|
* Callbacks for streaming SSE events. All callbacks are optional —
|
|
321
321
|
* omitted callbacks simply ignore that event type.
|
|
322
322
|
*/
|
|
323
|
+
/** Structured ARBI error event (e.g. quota exceeded mid-stream). */
|
|
324
|
+
interface ArbiErrorEvent {
|
|
325
|
+
code: string;
|
|
326
|
+
message: string;
|
|
327
|
+
/** Present for QUOTA_EXCEEDED — current spend in USD. */
|
|
328
|
+
spend?: number;
|
|
329
|
+
/** Present for QUOTA_EXCEEDED — budget cap in USD. */
|
|
330
|
+
budget?: number;
|
|
331
|
+
/** Present for QUOTA_EXCEEDED — affected project external id. */
|
|
332
|
+
project_ext_id?: string | null;
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
}
|
|
323
335
|
interface SSEStreamCallbacks {
|
|
324
336
|
onStreamStart?: (data: SSEStreamStartData) => void;
|
|
325
337
|
onToken?: (content: string) => void;
|
|
@@ -329,6 +341,12 @@ interface SSEStreamCallbacks {
|
|
|
329
341
|
onContentPartAdded?: (data: ResponseContentPartAddedEvent) => void;
|
|
330
342
|
onAgentStep?: (data: AgentStepEvent) => void;
|
|
331
343
|
onError?: (message: string) => void;
|
|
344
|
+
/**
|
|
345
|
+
* Fired when the server emits a structured `arbi.error` event mid-stream.
|
|
346
|
+
* Backend uses this for quota-exceeded errors so clients can render an
|
|
347
|
+
* upgrade modal without losing the surrounding stream context.
|
|
348
|
+
*/
|
|
349
|
+
onArbiError?: (event: ArbiErrorEvent) => void;
|
|
332
350
|
onMessageQueued?: (data: MessageQueuedEvent) => void;
|
|
333
351
|
onUserMessage?: (data: UserMessageEvent) => void;
|
|
334
352
|
onMetadata?: (data: MessageMetadataPayload$1) => void;
|
|
@@ -4141,4 +4159,4 @@ declare namespace responses {
|
|
|
4141
4159
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4142
4160
|
}
|
|
4143
4161
|
|
|
4144
|
-
export { type UserInputRequestEvent as $, type AuthHeaders as A, type ReconnectableWsConnection as B, type ConfigStore as C, type DmCryptoContext as D, type ResolvedCitation as E, type FormattedWsMessage as F, type ResponseCompletedEvent as G, type ResponseContentPartAddedEvent as H, type ResponseCreatedEvent as I, type ResponseFailedEvent as J, type ResponseOutputItemAddedEvent as K, type ListAllOptions as L, type MessageLevel as M, type ResponseOutputItemDoneEvent as N, type OutputTokensDetails as O, type ResponseOutputTextDeltaEvent as P, type QueryOptions as Q, type ReconnectOptions as R, type SkippedFile as S, type ResponseOutputTextDoneEvent as T, type UploadResult as U, type ResponseUsage as V, type SSEEvent as W, type SSEStreamCallbacks as X, type SSEStreamResult as Y, type SSEStreamStartData as Z, type UserInfo as _, type CliConfig as a, type UserMessageEvent as a0, type WorkspaceContext as a1, type WsConnection as a2, agentconfig as a3, assistant as a4, authenticatedFetch as a5, buildRetrievalChunkTool as a6, buildRetrievalFullContextTool as a7, buildRetrievalTocTool as a8, connectWebSocket as a9, performSsoDeviceFlowLogin as aA, requireData as aB, requireOk as aC, resolveAuth as aD, resolveCitations as aE, resolveWorkspace as aF, responses as aG, selectWorkspace as aH, selectWorkspaceById as aI, settings as aJ, streamSSE as aK, stripCitationMarkdown as aL, summarizeCitations as aM, tags as aN, workspaces as aO, connectWithReconnect as aa, consumeSSEStream as ab, contacts as ac, conversations as ad, countCitations as ae, createAuthenticatedClient as af, createDocumentWaiter as ag, dm as ah, doctags as ai, documents as aj, files as ak, formatAgentStepLabel as al, formatFileSize as am, formatStreamSummary as an, formatUserName as ao, formatWorkspaceChoices as ap, formatWsMessage as aq, generateEncryptedWorkspaceKey as ar, generateNewWorkspaceKey as as, getErrorCode as at, getErrorMessage as au, getRawWorkspaceKey as av, health as aw, parseSSEEvents as ax, performPasswordLogin as ay, performSigningKeyLogin as az, type CliCredentials as b, type ChatSession as c, type UploadBatchResult as d, type UploadOptions as e, type UploadDirectOptions as f, type UploadDirectResult as g, SUPPORTED_EXTENSIONS as h, type AgentStepEvent as i, Arbi as j, ArbiApiError as k, ArbiError as l, type ArbiOptions as m, type ArtifactEvent as n, type AuthContext as o, type AuthenticatedClient as p, type CitationSummary as q, type ConnectOptions as r, DOC_TERMINAL_STATUSES as s, type DocumentListFields as t, type DocumentListOrder as u, type DocumentWaiter as v, type DocumentWaiterOptions as w, type ListPaginatedOptions as x, type MessageMetadataPayload$1 as y, type MessageQueuedEvent as z };
|
|
4162
|
+
export { type UserInputRequestEvent as $, type AuthHeaders as A, type ReconnectableWsConnection as B, type ConfigStore as C, type DmCryptoContext as D, type ResolvedCitation as E, type FormattedWsMessage as F, type ResponseCompletedEvent as G, type ResponseContentPartAddedEvent as H, type ResponseCreatedEvent as I, type ResponseFailedEvent as J, type ResponseOutputItemAddedEvent as K, type ListAllOptions as L, type MessageLevel as M, type ResponseOutputItemDoneEvent as N, type OutputTokensDetails as O, type ResponseOutputTextDeltaEvent as P, type QueryOptions as Q, type ReconnectOptions as R, type SkippedFile as S, type ResponseOutputTextDoneEvent as T, type UploadResult as U, type ResponseUsage as V, type SSEEvent as W, type SSEStreamCallbacks as X, type SSEStreamResult as Y, type SSEStreamStartData as Z, type UserInfo as _, type CliConfig as a, type UserMessageEvent as a0, type WorkspaceContext as a1, type WsConnection as a2, agentconfig as a3, assistant as a4, authenticatedFetch as a5, buildRetrievalChunkTool as a6, buildRetrievalFullContextTool as a7, buildRetrievalTocTool as a8, connectWebSocket as a9, performSsoDeviceFlowLogin as aA, requireData as aB, requireOk as aC, resolveAuth as aD, resolveCitations as aE, resolveWorkspace as aF, responses as aG, selectWorkspace as aH, selectWorkspaceById as aI, settings as aJ, streamSSE as aK, stripCitationMarkdown as aL, summarizeCitations as aM, tags as aN, workspaces as aO, type ArbiErrorEvent as aP, connectWithReconnect as aa, consumeSSEStream as ab, contacts as ac, conversations as ad, countCitations as ae, createAuthenticatedClient as af, createDocumentWaiter as ag, dm as ah, doctags as ai, documents as aj, files as ak, formatAgentStepLabel as al, formatFileSize as am, formatStreamSummary as an, formatUserName as ao, formatWorkspaceChoices as ap, formatWsMessage as aq, generateEncryptedWorkspaceKey as ar, generateNewWorkspaceKey as as, getErrorCode as at, getErrorMessage as au, getRawWorkspaceKey as av, health as aw, parseSSEEvents as ax, performPasswordLogin as ay, performSigningKeyLogin as az, type CliCredentials as b, type ChatSession as c, type UploadBatchResult as d, type UploadOptions as e, type UploadDirectOptions as f, type UploadDirectResult as g, SUPPORTED_EXTENSIONS as h, type AgentStepEvent as i, Arbi as j, ArbiApiError as k, ArbiError as l, type ArbiOptions as m, type ArtifactEvent as n, type AuthContext as o, type AuthenticatedClient as p, type CitationSummary as q, type ConnectOptions as r, DOC_TERMINAL_STATUSES as s, type DocumentListFields as t, type DocumentListOrder as u, type DocumentWaiter as v, type DocumentWaiterOptions as w, type ListPaginatedOptions as x, type MessageMetadataPayload$1 as y, type MessageQueuedEvent as z };
|
package/dist/browser.cjs
CHANGED
|
@@ -3897,6 +3897,13 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
3897
3897
|
artifacts.push(data);
|
|
3898
3898
|
callbacks.onArtifact?.(data);
|
|
3899
3899
|
},
|
|
3900
|
+
"arbi.error": (raw) => {
|
|
3901
|
+
const data = JSON.parse(raw);
|
|
3902
|
+
const message = typeof data?.message === "string" && data.message.length > 0 ? data.message : data.code;
|
|
3903
|
+
errors.push(message);
|
|
3904
|
+
callbacks.onArbiError?.(data);
|
|
3905
|
+
callbacks.onError?.(message);
|
|
3906
|
+
},
|
|
3900
3907
|
"response.complete": () => {
|
|
3901
3908
|
callbacks.onComplete?.();
|
|
3902
3909
|
}
|