@arbidocs/sdk 0.3.17 → 0.3.19
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-BtAHbiq_.d.cts → browser-D8aF-wkt.d.cts} +22 -7
- package/dist/{browser-BtAHbiq_.d.ts → browser-D8aF-wkt.d.ts} +22 -7
- package/dist/browser.cjs +11 -25
- 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 +12 -24
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +146 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -3
- package/dist/index.d.ts +63 -3
- package/dist/index.js +145 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -92,6 +92,8 @@ interface CliCredentials {
|
|
|
92
92
|
workspaceId?: string;
|
|
93
93
|
/** ISO timestamp when the token was cached */
|
|
94
94
|
tokenTimestamp?: string;
|
|
95
|
+
/** Auth0 SSO token — needed for session recovery of SSO users */
|
|
96
|
+
ssoToken?: string;
|
|
95
97
|
}
|
|
96
98
|
interface ChatSession {
|
|
97
99
|
/** Last assistant message ID — used as previous_response_id for follow-ups */
|
|
@@ -173,6 +175,17 @@ declare function createAuthenticatedClient(config: CliConfig, creds: CliCredenti
|
|
|
173
175
|
* use createAuthenticatedClient() instead.
|
|
174
176
|
*/
|
|
175
177
|
declare function performPasswordLogin(config: CliConfig, email: string, password: string, store: ConfigStore): Promise<AuthContext>;
|
|
178
|
+
/**
|
|
179
|
+
* SSO device-flow login (RFC 8628).
|
|
180
|
+
*
|
|
181
|
+
* Fetches SSO config from the deployment, initiates the device authorization
|
|
182
|
+
* flow with Auth0, waits for the user to authorize in a browser, then logs
|
|
183
|
+
* in to the ARBI deployment using the Auth0 JWT.
|
|
184
|
+
*/
|
|
185
|
+
declare function performSsoDeviceFlowLogin(config: CliConfig, email: string, password: string, store: ConfigStore, callbacks?: {
|
|
186
|
+
onUserCode?: (userCode: string, verificationUri: string) => void;
|
|
187
|
+
onPoll?: (elapsedMs: number) => void;
|
|
188
|
+
}): Promise<AuthContext>;
|
|
176
189
|
/**
|
|
177
190
|
* Decrypt wrapped workspace key and set it as the active workspace header.
|
|
178
191
|
*/
|
|
@@ -242,17 +255,19 @@ interface SSEEvent {
|
|
|
242
255
|
event: string;
|
|
243
256
|
data: string;
|
|
244
257
|
}
|
|
245
|
-
declare const TOOL_LABELS: Record<string, string>;
|
|
246
|
-
declare const LIFECYCLE_LABELS: Record<string, string>;
|
|
247
258
|
/**
|
|
248
259
|
* Format an AgentStepEvent into a human-readable label.
|
|
249
260
|
*
|
|
261
|
+
* Uses backend-provided `label` field when available, falling back to
|
|
262
|
+
* tool name or step name for old persisted events.
|
|
263
|
+
*
|
|
250
264
|
* Priority:
|
|
251
265
|
* 1. `focus` — the agent's descriptive sentence about what it's doing
|
|
252
|
-
* 2.
|
|
253
|
-
* 3.
|
|
254
|
-
* 4.
|
|
255
|
-
* 5.
|
|
266
|
+
* 2. `label` — backend-provided display label
|
|
267
|
+
* 3. For `tool_progress` — detail label + optional message
|
|
268
|
+
* 4. Lifecycle fallback (planning, evaluation, etc.)
|
|
269
|
+
* 5. Tool name from detail
|
|
270
|
+
* 6. Fallback to step name or empty string
|
|
256
271
|
*/
|
|
257
272
|
declare function formatAgentStepLabel(step: AgentStepEvent): string;
|
|
258
273
|
/**
|
|
@@ -3306,4 +3321,4 @@ declare namespace responses {
|
|
|
3306
3321
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
3307
3322
|
}
|
|
3308
3323
|
|
|
3309
|
-
export {
|
|
3324
|
+
export { connectWebSocket as $, type AuthHeaders as A, type ResponseOutputTextDeltaEvent as B, type ConfigStore as C, type DocumentWaiter as D, type ResponseOutputTextDoneEvent as E, type FormattedWsMessage as F, type ResponseUsage as G, type SSEStreamCallbacks as H, type SSEStreamResult as I, type SSEStreamStartData as J, type UserInfo as K, type UserInputRequestEvent as L, type MessageLevel as M, type UserMessageEvent as N, type OutputTokensDetails as O, type WsConnection as P, type QueryOptions as Q, type ReconnectOptions as R, type SSEEvent as S, agentconfig as T, type UploadBatchResult as U, assistant as V, type WorkspaceContext as W, authenticatedFetch as X, buildRetrievalChunkTool as Y, buildRetrievalFullContextTool as Z, buildRetrievalTocTool as _, type CliConfig as a, connectWithReconnect as a0, consumeSSEStream as a1, contacts as a2, conversations as a3, countCitations as a4, createAuthenticatedClient as a5, createDocumentWaiter as a6, dm as a7, doctags as a8, documents as a9, tags as aA, workspaces as aB, files as aa, formatAgentStepLabel as ab, formatFileSize as ac, formatStreamSummary as ad, formatUserName as ae, formatWorkspaceChoices as af, formatWsMessage as ag, generateEncryptedWorkspaceKey as ah, getErrorCode as ai, getErrorMessage as aj, health as ak, parseSSEEvents as al, performPasswordLogin as am, performSsoDeviceFlowLogin as an, requireData as ao, requireOk as ap, resolveAuth as aq, resolveCitations as ar, resolveWorkspace as as, responses as at, selectWorkspace as au, selectWorkspaceById as av, settings as aw, streamSSE as ax, stripCitationMarkdown as ay, summarizeCitations as az, type CliCredentials as b, type ChatSession as c, type UploadOptions as d, type UploadResult as e, type AgentStepEvent as f, Arbi as g, ArbiApiError as h, ArbiError as i, type ArbiOptions as j, type ArtifactEvent as k, type AuthContext as l, type AuthenticatedClient as m, type CitationSummary as n, type ConnectOptions as o, type DocumentWaiterOptions as p, type MessageMetadataPayload$1 as q, type MessageQueuedEvent as r, type ReconnectableWsConnection as s, type ResolvedCitation as t, type ResponseCompletedEvent as u, type ResponseContentPartAddedEvent as v, type ResponseCreatedEvent as w, type ResponseFailedEvent as x, type ResponseOutputItemAddedEvent as y, type ResponseOutputItemDoneEvent as z };
|
|
@@ -92,6 +92,8 @@ interface CliCredentials {
|
|
|
92
92
|
workspaceId?: string;
|
|
93
93
|
/** ISO timestamp when the token was cached */
|
|
94
94
|
tokenTimestamp?: string;
|
|
95
|
+
/** Auth0 SSO token — needed for session recovery of SSO users */
|
|
96
|
+
ssoToken?: string;
|
|
95
97
|
}
|
|
96
98
|
interface ChatSession {
|
|
97
99
|
/** Last assistant message ID — used as previous_response_id for follow-ups */
|
|
@@ -173,6 +175,17 @@ declare function createAuthenticatedClient(config: CliConfig, creds: CliCredenti
|
|
|
173
175
|
* use createAuthenticatedClient() instead.
|
|
174
176
|
*/
|
|
175
177
|
declare function performPasswordLogin(config: CliConfig, email: string, password: string, store: ConfigStore): Promise<AuthContext>;
|
|
178
|
+
/**
|
|
179
|
+
* SSO device-flow login (RFC 8628).
|
|
180
|
+
*
|
|
181
|
+
* Fetches SSO config from the deployment, initiates the device authorization
|
|
182
|
+
* flow with Auth0, waits for the user to authorize in a browser, then logs
|
|
183
|
+
* in to the ARBI deployment using the Auth0 JWT.
|
|
184
|
+
*/
|
|
185
|
+
declare function performSsoDeviceFlowLogin(config: CliConfig, email: string, password: string, store: ConfigStore, callbacks?: {
|
|
186
|
+
onUserCode?: (userCode: string, verificationUri: string) => void;
|
|
187
|
+
onPoll?: (elapsedMs: number) => void;
|
|
188
|
+
}): Promise<AuthContext>;
|
|
176
189
|
/**
|
|
177
190
|
* Decrypt wrapped workspace key and set it as the active workspace header.
|
|
178
191
|
*/
|
|
@@ -242,17 +255,19 @@ interface SSEEvent {
|
|
|
242
255
|
event: string;
|
|
243
256
|
data: string;
|
|
244
257
|
}
|
|
245
|
-
declare const TOOL_LABELS: Record<string, string>;
|
|
246
|
-
declare const LIFECYCLE_LABELS: Record<string, string>;
|
|
247
258
|
/**
|
|
248
259
|
* Format an AgentStepEvent into a human-readable label.
|
|
249
260
|
*
|
|
261
|
+
* Uses backend-provided `label` field when available, falling back to
|
|
262
|
+
* tool name or step name for old persisted events.
|
|
263
|
+
*
|
|
250
264
|
* Priority:
|
|
251
265
|
* 1. `focus` — the agent's descriptive sentence about what it's doing
|
|
252
|
-
* 2.
|
|
253
|
-
* 3.
|
|
254
|
-
* 4.
|
|
255
|
-
* 5.
|
|
266
|
+
* 2. `label` — backend-provided display label
|
|
267
|
+
* 3. For `tool_progress` — detail label + optional message
|
|
268
|
+
* 4. Lifecycle fallback (planning, evaluation, etc.)
|
|
269
|
+
* 5. Tool name from detail
|
|
270
|
+
* 6. Fallback to step name or empty string
|
|
256
271
|
*/
|
|
257
272
|
declare function formatAgentStepLabel(step: AgentStepEvent): string;
|
|
258
273
|
/**
|
|
@@ -3306,4 +3321,4 @@ declare namespace responses {
|
|
|
3306
3321
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
3307
3322
|
}
|
|
3308
3323
|
|
|
3309
|
-
export {
|
|
3324
|
+
export { connectWebSocket as $, type AuthHeaders as A, type ResponseOutputTextDeltaEvent as B, type ConfigStore as C, type DocumentWaiter as D, type ResponseOutputTextDoneEvent as E, type FormattedWsMessage as F, type ResponseUsage as G, type SSEStreamCallbacks as H, type SSEStreamResult as I, type SSEStreamStartData as J, type UserInfo as K, type UserInputRequestEvent as L, type MessageLevel as M, type UserMessageEvent as N, type OutputTokensDetails as O, type WsConnection as P, type QueryOptions as Q, type ReconnectOptions as R, type SSEEvent as S, agentconfig as T, type UploadBatchResult as U, assistant as V, type WorkspaceContext as W, authenticatedFetch as X, buildRetrievalChunkTool as Y, buildRetrievalFullContextTool as Z, buildRetrievalTocTool as _, type CliConfig as a, connectWithReconnect as a0, consumeSSEStream as a1, contacts as a2, conversations as a3, countCitations as a4, createAuthenticatedClient as a5, createDocumentWaiter as a6, dm as a7, doctags as a8, documents as a9, tags as aA, workspaces as aB, files as aa, formatAgentStepLabel as ab, formatFileSize as ac, formatStreamSummary as ad, formatUserName as ae, formatWorkspaceChoices as af, formatWsMessage as ag, generateEncryptedWorkspaceKey as ah, getErrorCode as ai, getErrorMessage as aj, health as ak, parseSSEEvents as al, performPasswordLogin as am, performSsoDeviceFlowLogin as an, requireData as ao, requireOk as ap, resolveAuth as aq, resolveCitations as ar, resolveWorkspace as as, responses as at, selectWorkspace as au, selectWorkspaceById as av, settings as aw, streamSSE as ax, stripCitationMarkdown as ay, summarizeCitations as az, type CliCredentials as b, type ChatSession as c, type UploadOptions as d, type UploadResult as e, type AgentStepEvent as f, Arbi as g, ArbiApiError as h, ArbiError as i, type ArbiOptions as j, type ArtifactEvent as k, type AuthContext as l, type AuthenticatedClient as m, type CitationSummary as n, type ConnectOptions as o, type DocumentWaiterOptions as p, type MessageMetadataPayload$1 as q, type MessageQueuedEvent as r, type ReconnectableWsConnection as s, type ResolvedCitation as t, type ResponseCompletedEvent as u, type ResponseContentPartAddedEvent as v, type ResponseCreatedEvent as w, type ResponseFailedEvent as x, type ResponseOutputItemAddedEvent as y, type ResponseOutputItemDoneEvent as z };
|
package/dist/browser.cjs
CHANGED
|
@@ -98,6 +98,8 @@ async function authenticatedFetch(options) {
|
|
|
98
98
|
}
|
|
99
99
|
return res;
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
// src/auth.ts
|
|
101
103
|
function formatWorkspaceChoices(wsList) {
|
|
102
104
|
return wsList.map((ws) => {
|
|
103
105
|
const totalDocs = ws.shared_document_count + ws.private_document_count;
|
|
@@ -118,7 +120,8 @@ async function createAuthenticatedClient(config, creds, store) {
|
|
|
118
120
|
const signingPrivateKey = client.base64ToBytes(creds.signingPrivateKeyBase64);
|
|
119
121
|
const loginResult = await arbi.auth.loginWithKey({
|
|
120
122
|
email: creds.email,
|
|
121
|
-
signingPrivateKey
|
|
123
|
+
signingPrivateKey,
|
|
124
|
+
ssoToken: creds.ssoToken
|
|
122
125
|
});
|
|
123
126
|
store.saveCredentials({
|
|
124
127
|
...creds,
|
|
@@ -259,23 +262,7 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
259
262
|
}
|
|
260
263
|
|
|
261
264
|
// src/sse.ts
|
|
262
|
-
var
|
|
263
|
-
search_documents: "Searching documents",
|
|
264
|
-
get_document_passages: "Reading document",
|
|
265
|
-
get_table_of_contents: "Getting table of contents",
|
|
266
|
-
view_document_pages: "Viewing document pages",
|
|
267
|
-
get_full_document: "Reading full document",
|
|
268
|
-
web_search: "Searching the web",
|
|
269
|
-
read_url: "Reading web pages",
|
|
270
|
-
ask_user: "Asking user",
|
|
271
|
-
compaction: "Compacting conversation",
|
|
272
|
-
personal_agent: "Running agent",
|
|
273
|
-
create_artifact: "Creating artifact",
|
|
274
|
-
create_plan: "Creating plan",
|
|
275
|
-
save_skill: "Saving skill",
|
|
276
|
-
run_code: "Running code"
|
|
277
|
-
};
|
|
278
|
-
var LIFECYCLE_LABELS = {
|
|
265
|
+
var LIFECYCLE_LABELS_FALLBACK = {
|
|
279
266
|
evaluation: "Evaluating results",
|
|
280
267
|
answering: "Writing answer",
|
|
281
268
|
reviewing: "Reviewing answer",
|
|
@@ -284,18 +271,19 @@ var LIFECYCLE_LABELS = {
|
|
|
284
271
|
};
|
|
285
272
|
function formatAgentStepLabel(step) {
|
|
286
273
|
if (step.focus) return step.focus;
|
|
274
|
+
if (step.label) return step.label;
|
|
287
275
|
const detail = step.detail;
|
|
288
276
|
if (step.step === "tool_progress" && detail && detail.length > 0) {
|
|
289
|
-
const
|
|
290
|
-
const label = toolName && TOOL_LABELS[toolName] || LIFECYCLE_LABELS.tool_progress;
|
|
277
|
+
const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
|
|
291
278
|
const message = detail[0].message;
|
|
292
279
|
return message ? `${label}: ${message}` : label;
|
|
293
280
|
}
|
|
294
281
|
if (step.step) {
|
|
295
|
-
return
|
|
282
|
+
return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
|
|
296
283
|
}
|
|
297
|
-
if (detail && detail.length > 0
|
|
298
|
-
|
|
284
|
+
if (detail && detail.length > 0) {
|
|
285
|
+
if (detail[0].label) return detail[0].label;
|
|
286
|
+
if (detail[0].tool) return detail[0].tool;
|
|
299
287
|
}
|
|
300
288
|
return "";
|
|
301
289
|
}
|
|
@@ -1639,8 +1627,6 @@ function extractResponseText(response) {
|
|
|
1639
1627
|
exports.Arbi = Arbi;
|
|
1640
1628
|
exports.ArbiApiError = ArbiApiError;
|
|
1641
1629
|
exports.ArbiError = ArbiError;
|
|
1642
|
-
exports.LIFECYCLE_LABELS = LIFECYCLE_LABELS;
|
|
1643
|
-
exports.TOOL_LABELS = TOOL_LABELS;
|
|
1644
1630
|
exports.agentconfig = agentconfig_exports;
|
|
1645
1631
|
exports.assistant = assistant_exports;
|
|
1646
1632
|
exports.authenticatedFetch = authenticatedFetch;
|