@arbidocs/sdk 0.3.79 → 0.3.81

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.
@@ -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 ConfigStore, o as ConnectOptions, v as MessageMetadataPayload, w as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, x as ReconnectableWsConnection, y as ResolvedCitation, z as ResponseCompletedEvent, B as ResponseContentPartAddedEvent, E as ResponseCreatedEvent, G as ResponseFailedEvent, H as ResponseOutputItemAddedEvent, I as ResponseOutputItemDoneEvent, J as ResponseOutputTextDeltaEvent, K as ResponseOutputTextDoneEvent, N as ResponseUsage, S as SSEEvent, T as SSEStreamCallbacks, U as SSEStreamResult, V as SSEStreamStartData, X as SkillSummary, a2 as UserInfo, a3 as UserInputRequestEvent, a4 as UserMessageEvent, a5 as WebSocketAuthError, a6 as WorkspaceContext, a7 as WsConnection, a8 as agentconfig, a9 as assistant, aa as authenticatedFetch, ab as buildRetrievalChunkTool, ac as buildRetrievalFullContextTool, ad as buildRetrievalTocTool, ae as connectWebSocket, af as connectWithReconnect, ag as consumeSSEStream, ah as contacts, ai as conversations, aj as countCitations, ak as createAuthenticatedClient, am as dm, an as doctags, ao as documents, ap as files, aq as filterSkills, ar as formatAgentStepLabel, as as formatFileSize, au as formatUserName, av as formatWorkspaceChoices, aA as getErrorMessage, aB as getRawWorkspaceKey, aC as health, aD as parseSSEEvents, aE as parseSlashCommand, aF as parseSlashTokenInProgress, aG as performPasswordLogin, aJ as requireData, aK as requireOk, aL as resolveAuth, aM as resolveCitations, aN as resolveWorkspace, aO as responses, aP as selectWorkspace, aQ as selectWorkspaceById, aR as settings, aS as streamSSE, aT as stripCitationMarkdown, aU as summarizeCitations, aV as tags, aW as workspaces } from './browser-a0r4Y6dE.cjs';
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 ConfigStore, o as ConnectOptions, w as MessageMetadataPayload, x as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, y as ReconnectableWsConnection, z as ResolvedCitation, B as ResponseCompletedEvent, E as ResponseContentPartAddedEvent, G as ResponseCreatedEvent, H as ResponseFailedEvent, I as ResponseOutputItemAddedEvent, J as ResponseOutputItemDoneEvent, K as ResponseOutputTextDeltaEvent, N as ResponseOutputTextDoneEvent, S as ResponseUsage, T as SSEEvent, U as SSEStreamCallbacks, V as SSEStreamResult, W as SSEStreamStartData, Y as SkillSummary, a3 as UserInfo, a4 as UserInputRequestEvent, a5 as UserMessageEvent, a6 as WebSocketAuthError, a7 as WorkspaceContext, a8 as WsConnection, a9 as agentconfig, aa as assistant, ab as authenticatedFetch, ac as buildRetrievalChunkTool, ad as buildRetrievalFullContextTool, ae as buildRetrievalTocTool, af as connectWebSocket, ag as connectWithReconnect, ah as consumeSSEStream, ai as contacts, aj as conversations, ak as countCitations, al as createAuthenticatedClient, an as dm, ao as doctags, ap as documents, aq as files, ar as filterSkills, as as formatAgentStepLabel, at as formatFileSize, av as formatUserName, aw as formatWorkspaceChoices, aB as getErrorMessage, aC as getRawWorkspaceKey, aD as health, aE as parseSSEEvents, aF as parseSlashCommand, aG as parseSlashTokenInProgress, aH as performPasswordLogin, aK as requireData, aL as requireOk, aM as resolveAuth, aN as resolveCitations, aO as resolveWorkspace, aP as responses, aQ as selectWorkspace, aR as selectWorkspaceById, aS as settings, aT as streamSSE, aU as stripCitationMarkdown, aV as summarizeCitations, aW as tags, aX as workspaces } from './browser-CV7TVakj.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 ConfigStore, o as ConnectOptions, v as MessageMetadataPayload, w as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, x as ReconnectableWsConnection, y as ResolvedCitation, z as ResponseCompletedEvent, B as ResponseContentPartAddedEvent, E as ResponseCreatedEvent, G as ResponseFailedEvent, H as ResponseOutputItemAddedEvent, I as ResponseOutputItemDoneEvent, J as ResponseOutputTextDeltaEvent, K as ResponseOutputTextDoneEvent, N as ResponseUsage, S as SSEEvent, T as SSEStreamCallbacks, U as SSEStreamResult, V as SSEStreamStartData, X as SkillSummary, a2 as UserInfo, a3 as UserInputRequestEvent, a4 as UserMessageEvent, a5 as WebSocketAuthError, a6 as WorkspaceContext, a7 as WsConnection, a8 as agentconfig, a9 as assistant, aa as authenticatedFetch, ab as buildRetrievalChunkTool, ac as buildRetrievalFullContextTool, ad as buildRetrievalTocTool, ae as connectWebSocket, af as connectWithReconnect, ag as consumeSSEStream, ah as contacts, ai as conversations, aj as countCitations, ak as createAuthenticatedClient, am as dm, an as doctags, ao as documents, ap as files, aq as filterSkills, ar as formatAgentStepLabel, as as formatFileSize, au as formatUserName, av as formatWorkspaceChoices, aA as getErrorMessage, aB as getRawWorkspaceKey, aC as health, aD as parseSSEEvents, aE as parseSlashCommand, aF as parseSlashTokenInProgress, aG as performPasswordLogin, aJ as requireData, aK as requireOk, aL as resolveAuth, aM as resolveCitations, aN as resolveWorkspace, aO as responses, aP as selectWorkspace, aQ as selectWorkspaceById, aR as settings, aS as streamSSE, aT as stripCitationMarkdown, aU as summarizeCitations, aV as tags, aW as workspaces } from './browser-a0r4Y6dE.js';
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 ConfigStore, o as ConnectOptions, w as MessageMetadataPayload, x as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, y as ReconnectableWsConnection, z as ResolvedCitation, B as ResponseCompletedEvent, E as ResponseContentPartAddedEvent, G as ResponseCreatedEvent, H as ResponseFailedEvent, I as ResponseOutputItemAddedEvent, J as ResponseOutputItemDoneEvent, K as ResponseOutputTextDeltaEvent, N as ResponseOutputTextDoneEvent, S as ResponseUsage, T as SSEEvent, U as SSEStreamCallbacks, V as SSEStreamResult, W as SSEStreamStartData, Y as SkillSummary, a3 as UserInfo, a4 as UserInputRequestEvent, a5 as UserMessageEvent, a6 as WebSocketAuthError, a7 as WorkspaceContext, a8 as WsConnection, a9 as agentconfig, aa as assistant, ab as authenticatedFetch, ac as buildRetrievalChunkTool, ad as buildRetrievalFullContextTool, ae as buildRetrievalTocTool, af as connectWebSocket, ag as connectWithReconnect, ah as consumeSSEStream, ai as contacts, aj as conversations, ak as countCitations, al as createAuthenticatedClient, an as dm, ao as doctags, ap as documents, aq as files, ar as filterSkills, as as formatAgentStepLabel, at as formatFileSize, av as formatUserName, aw as formatWorkspaceChoices, aB as getErrorMessage, aC as getRawWorkspaceKey, aD as health, aE as parseSSEEvents, aF as parseSlashCommand, aG as parseSlashTokenInProgress, aH as performPasswordLogin, aK as requireData, aL as requireOk, aM as resolveAuth, aN as resolveCitations, aO as resolveWorkspace, aP as responses, aQ as selectWorkspace, aR as selectWorkspaceById, aS as settings, aT as streamSSE, aU as stripCitationMarkdown, aV as summarizeCitations, aW as tags, aX as workspaces } from './browser-CV7TVakj.js';
2
2
  import '@arbidocs/client';
package/dist/browser.js CHANGED
@@ -3784,26 +3784,65 @@ async function resolveWorkspace(store, workspaceOpt) {
3784
3784
 
3785
3785
  // src/sse.ts
3786
3786
  var LIFECYCLE_LABELS_FALLBACK = {
3787
+ goal: "Thinking\u2026",
3787
3788
  evaluation: "Evaluating results",
3788
3789
  answering: "Answered",
3789
- reviewing: "Reviewing answer",
3790
3790
  planning: "Planning",
3791
3791
  tool_progress: "Working"
3792
3792
  };
3793
- function formatAgentStepLabel(step) {
3794
- if (step.focus) return step.focus;
3795
- if (step.label) return step.label;
3793
+ function resolveDocRefs(text, docNames) {
3794
+ if (!docNames) return text;
3795
+ return text.replace(/\{(doc-[^}]+)\}/g, (_match, id) => docNames[id] ?? id);
3796
+ }
3797
+ function resolveStepDocName(step, docNames) {
3798
+ if (!docNames) return void 0;
3799
+ const detail = step.detail;
3800
+ if (!detail || detail.length === 0) return void 0;
3801
+ for (const d2 of detail) {
3802
+ const id = d2.doc_ext_id ?? d2.document_ext_id;
3803
+ if (typeof id === "string") return docNames[id] ?? id;
3804
+ }
3805
+ return void 0;
3806
+ }
3807
+ function extractPageRange(step) {
3808
+ const detail = step.detail;
3809
+ if (!detail || detail.length === 0) return void 0;
3810
+ for (const d2 of detail) {
3811
+ const summary = typeof d2.summary === "string" ? d2.summary : void 0;
3812
+ if (!summary) continue;
3813
+ const match = summary.match(/\bpp?\.\s*(\d[\d.,\s–—-]*)/);
3814
+ if (!match) continue;
3815
+ const floored = match[1].replace(/\d+(?:\.\d+)?/g, (n2) => String(Math.floor(parseFloat(n2)))).replace(/(\d+)\s*[–—-]\s*\1(?!\d)/g, "$1");
3816
+ const items = [];
3817
+ for (const raw of floored.split(",")) {
3818
+ const item = raw.trim();
3819
+ if (item && !items.includes(item)) items.push(item);
3820
+ }
3821
+ if (items.length > 0) return `pp. ${items.join(", ")}`;
3822
+ }
3823
+ return void 0;
3824
+ }
3825
+ function formatAgentStepLabel(step, docNames) {
3826
+ if (step.step === "goal") {
3827
+ return step.label && step.label !== "Goal" ? step.label : "Thinking\u2026";
3828
+ }
3829
+ if (step.focus) return resolveDocRefs(step.focus, docNames);
3830
+ const docName = resolveStepDocName(step, docNames);
3831
+ const pages = docName ? extractPageRange(step) : void 0;
3832
+ const suffix = docName ? ` \u2014 ${docName}${pages ? ` \xB7 ${pages}` : ""}` : "";
3833
+ if (step.label) return `${step.label}${suffix}`;
3796
3834
  const detail = step.detail;
3797
3835
  if (step.step === "tool_progress" && detail && detail.length > 0) {
3798
3836
  const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
3837
+ if (suffix) return `${label}${suffix}`;
3799
3838
  const message = detail[0].message;
3800
- return message ? `${label}: ${message}` : label;
3839
+ return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
3801
3840
  }
3802
3841
  if (step.step) {
3803
3842
  return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
3804
3843
  }
3805
3844
  if (detail && detail.length > 0) {
3806
- if (detail[0].label) return detail[0].label;
3845
+ if (detail[0].label) return `${detail[0].label}${suffix}`;
3807
3846
  if (detail[0].tool) return detail[0].tool;
3808
3847
  }
3809
3848
  return "";
@@ -4652,6 +4691,7 @@ __export(conversations_exports, {
4652
4691
  deleteMessage: () => deleteMessage,
4653
4692
  getConversationThreads: () => getConversationThreads,
4654
4693
  getMessage: () => getMessage,
4694
+ importConversations: () => importConversations,
4655
4695
  listConversations: () => listConversations,
4656
4696
  shareConversation: () => shareConversation,
4657
4697
  updateConversationTitle: () => updateConversationTitle
@@ -4659,6 +4699,17 @@ __export(conversations_exports, {
4659
4699
  async function listConversations(arbi) {
4660
4700
  return requireData(await arbi.fetch.GET("/v1/conversation/list"), "Failed to fetch conversations");
4661
4701
  }
4702
+ async function importConversations(auth, fileData, fileName, source = "auto") {
4703
+ const formData = new FormData();
4704
+ formData.append("file", fileData, fileName);
4705
+ const res = await authenticatedFetch({
4706
+ ...auth,
4707
+ path: `/v1/conversation/import?source=${encodeURIComponent(source)}`,
4708
+ method: "POST",
4709
+ body: formData
4710
+ });
4711
+ return res.json();
4712
+ }
4662
4713
  async function getConversationThreads(arbi, conversationId) {
4663
4714
  return requireData(
4664
4715
  await arbi.fetch.GET("/v1/conversation/{conversation_ext_id}/threads", {