@arbidocs/sdk 0.4.20 → 0.4.22

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/index.cjs CHANGED
@@ -5492,9 +5492,20 @@ async function retrieve(options) {
5492
5492
  return data;
5493
5493
  }
5494
5494
  async function queryAssistant(options) {
5495
- const { workspaceId, question, docIds, previousResponseId, model, mentions, signal, ...auth } = options;
5495
+ const {
5496
+ workspaceId,
5497
+ question,
5498
+ docIds,
5499
+ previousResponseId,
5500
+ model,
5501
+ mentions,
5502
+ signal,
5503
+ activeArtifactExtId,
5504
+ ...auth
5505
+ } = options;
5496
5506
  const body = {
5497
5507
  input: question,
5508
+ ...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
5498
5509
  workspace_ext_id: workspaceId,
5499
5510
  stream: true,
5500
5511
  background: false,
@@ -5871,7 +5882,9 @@ async function sendEncryptedDM(arbi, messages, crypto) {
5871
5882
  }))
5872
5883
  );
5873
5884
  const created = requireData(
5874
- await arbi.fetch.POST("/v1/notifications/", { body: { messages: encrypted } }),
5885
+ await arbi.fetch.POST("/v1/notifications/", {
5886
+ body: { messages: encrypted, context_only: false }
5887
+ }),
5875
5888
  "Failed to send message"
5876
5889
  );
5877
5890
  return created.map((n2) => ({
@@ -5904,7 +5917,7 @@ async function requestWorkspaceAccess(arbi, params, crypto) {
5904
5917
  async function sendDM(arbi, messages) {
5905
5918
  return requireData(
5906
5919
  await arbi.fetch.POST("/v1/notifications/", {
5907
- body: { messages }
5920
+ body: { messages, context_only: false }
5908
5921
  }),
5909
5922
  "Failed to send message"
5910
5923
  );
@@ -6880,6 +6893,40 @@ var Arbi = class {
6880
6893
  assistantMode
6881
6894
  )
6882
6895
  };
6896
+ /** Persisted notifications also arrive on the normal workspace WebSocket. */
6897
+ notifications = {
6898
+ list: async (type) => {
6899
+ const { data, error } = await this.requireClient().fetch.GET("/v1/notifications/", {
6900
+ params: { query: { ...type ? { type } : {}, limit: 100 } }
6901
+ });
6902
+ if (error) throw new ArbiError("Could not load notifications");
6903
+ return data || [];
6904
+ },
6905
+ markRead: async (ids) => {
6906
+ if (!ids.length) return;
6907
+ const { error } = await this.requireClient().fetch.PATCH("/v1/notifications/", {
6908
+ body: { updates: ids.map((external_id) => ({ external_id, read: true })) }
6909
+ });
6910
+ if (error) throw new ArbiError("Could not mark notifications read");
6911
+ }
6912
+ };
6913
+ /** Authenticated native Word transport, with normal session recovery. */
6914
+ editor = {
6915
+ request: (path3, options = {}) => this.recovering(async () => {
6916
+ const { baseUrl, accessToken } = this.getAuthHeaders();
6917
+ const headers = new Headers(options.headers);
6918
+ headers.set("Authorization", `Bearer ${accessToken}`);
6919
+ const response = await fetch(`${baseUrl}/v1/editor${path3}`, { ...options, headers });
6920
+ if (!response.ok) {
6921
+ const body = await response.json().catch(() => null);
6922
+ throw new ArbiApiError(body?.detail || `Document request failed (${response.status})`, {
6923
+ status: response.status,
6924
+ statusText: response.statusText
6925
+ });
6926
+ }
6927
+ return response;
6928
+ })
6929
+ };
6883
6930
  // ── Assistant ─────────────────────────────────────────────────────────
6884
6931
  assistant = {
6885
6932
  /**
@@ -6896,6 +6943,7 @@ var Arbi = class {
6896
6943
  docIds: options.docIds,
6897
6944
  previousResponseId: options.previousResponseId,
6898
6945
  model: options.model,
6946
+ activeArtifactExtId: options.activeArtifactExtId,
6899
6947
  signal: options.signal
6900
6948
  })
6901
6949
  );