@axiom-lattice/client-sdk 2.1.59 → 2.1.61

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.js CHANGED
@@ -1833,6 +1833,7 @@ __export(src_exports, {
1833
1833
  AuthenticationError: () => AuthenticationError,
1834
1834
  Client: () => Client,
1835
1835
  EvalClient: () => EvalClient,
1836
+ ExportImportClient: () => ExportImportClient,
1836
1837
  NetworkError: () => NetworkError,
1837
1838
  ResourcesClient: () => ResourcesClient,
1838
1839
  ScheduleExecutionType: () => ScheduleExecutionType,
@@ -1911,6 +1912,36 @@ var AbstractClient = class {
1911
1912
  });
1912
1913
  return result;
1913
1914
  },
1915
+ /**
1916
+ * Enqueues a message into the thread's background queue without waiting for a response.
1917
+ * Uses the background flag so the server returns 202 immediately.
1918
+ * Response chunks are delivered through the shared ThreadStream SSE connection.
1919
+ * @param options - Options for the background message
1920
+ * @returns A promise resolving to the enqueued message ID
1921
+ */
1922
+ sendBackground: async (options) => {
1923
+ const message = options.messages[options.messages.length - 1];
1924
+ const { command, threadId, files, assistantId, mode, ...rest } = options;
1925
+ const response = await this.makeRequest("/api/runs", {
1926
+ method: "POST",
1927
+ body: {
1928
+ assistant_id: assistantId || this.assistantId,
1929
+ thread_id: threadId,
1930
+ message: typeof message.content === "string" ? message.content : JSON.stringify(message.content),
1931
+ message_id: message.id,
1932
+ files,
1933
+ command,
1934
+ streaming: false,
1935
+ background: true,
1936
+ mode,
1937
+ ...rest
1938
+ }
1939
+ });
1940
+ if (!response.success) {
1941
+ throw new Error(response.error || "Failed to enqueue message");
1942
+ }
1943
+ return { messageId: response.messageId, queued: response.queued };
1944
+ },
1914
1945
  /**
1915
1946
  * Sends a message to a thread and streams the response
1916
1947
  * @param options - Options for streaming a message
@@ -3824,6 +3855,97 @@ var WorkspaceClient = class {
3824
3855
  }
3825
3856
  };
3826
3857
 
3858
+ // src/export-import.ts
3859
+ var ExportImportClient = class {
3860
+ constructor(config) {
3861
+ this.baseURL = config.baseURL;
3862
+ this.headers = {
3863
+ "Content-Type": "application/json",
3864
+ Authorization: `Bearer ${config.apiKey}`,
3865
+ ...config.headers
3866
+ };
3867
+ }
3868
+ async request(url, options = {}) {
3869
+ const fullUrl = `${this.baseURL}${url}`;
3870
+ const response = await fetch(fullUrl, {
3871
+ ...options,
3872
+ headers: {
3873
+ ...this.headers,
3874
+ ...options.headers
3875
+ }
3876
+ });
3877
+ if (!response.ok) {
3878
+ const err = await response.json().catch(() => ({}));
3879
+ throw new Error(
3880
+ err.message || `HTTP error! Status: ${response.status}`
3881
+ );
3882
+ }
3883
+ return response.json();
3884
+ }
3885
+ async getExportableTypes() {
3886
+ const response = await this.request(
3887
+ "/api/tenants/exportable-types"
3888
+ );
3889
+ return response.data || [];
3890
+ }
3891
+ async exportConfig(tenantId, entityTypes) {
3892
+ const response = await this.request(
3893
+ `/api/tenants/${tenantId}/export`,
3894
+ {
3895
+ method: "POST",
3896
+ body: JSON.stringify({ entityTypes })
3897
+ }
3898
+ );
3899
+ return response.data;
3900
+ }
3901
+ async exportConfigConfirm(tenantId, entityTypes) {
3902
+ const response = await this.request(
3903
+ `/api/tenants/${tenantId}/export/confirm`,
3904
+ {
3905
+ method: "POST",
3906
+ body: JSON.stringify({ entityTypes })
3907
+ }
3908
+ );
3909
+ return response.data;
3910
+ }
3911
+ getExportDownloadUrl(tenantId, jobId) {
3912
+ return `${this.baseURL}/api/tenants/${tenantId}/export/${jobId}/download`;
3913
+ }
3914
+ async importPreview(tenantId, file) {
3915
+ const formData = new FormData();
3916
+ formData.append("file", file);
3917
+ const fullUrl = `${this.baseURL}/api/tenants/${tenantId}/import/preview`;
3918
+ const headers = { ...this.headers };
3919
+ delete headers["Content-Type"];
3920
+ const response = await fetch(fullUrl, {
3921
+ method: "POST",
3922
+ headers,
3923
+ body: formData
3924
+ });
3925
+ if (!response.ok) {
3926
+ const err = await response.json().catch(() => ({}));
3927
+ throw new Error(
3928
+ err.message || `HTTP error! Status: ${response.status}`
3929
+ );
3930
+ }
3931
+ const json = await response.json();
3932
+ if (!json.success || !json.data) {
3933
+ throw new Error(json.error || "Import preview failed");
3934
+ }
3935
+ return json.data;
3936
+ }
3937
+ async importApply(tenantId, bundle, resolutions) {
3938
+ const response = await this.request(
3939
+ `/api/tenants/${tenantId}/import/apply`,
3940
+ {
3941
+ method: "POST",
3942
+ body: JSON.stringify({ bundle, resolutions })
3943
+ }
3944
+ );
3945
+ return response.data;
3946
+ }
3947
+ };
3948
+
3827
3949
  // src/ChunkMessageMerger.ts
3828
3950
  var import_best_effort_json_parser = require("best-effort-json-parser");
3829
3951
  function createSimpleMessageMerger() {
@@ -3948,8 +4070,10 @@ function createSimpleMessageMerger() {
3948
4070
  }
3949
4071
  if (chunk_item.name)
3950
4072
  builder.name = chunk_item.name;
3951
- if (chunk_item.id)
4073
+ if (chunk_item.id) {
3952
4074
  builder.id = chunk_item.id;
4075
+ toolId_MessageIdMap.set(chunk_item.id, message.id);
4076
+ }
3953
4077
  if (chunk_item.args)
3954
4078
  builder.args += chunk_item.args;
3955
4079
  }
@@ -4021,6 +4145,7 @@ function createSimpleMessageMerger() {
4021
4145
  AuthenticationError,
4022
4146
  Client,
4023
4147
  EvalClient,
4148
+ ExportImportClient,
4024
4149
  NetworkError,
4025
4150
  ResourcesClient,
4026
4151
  ScheduleExecutionType,