@axiom-lattice/client-sdk 2.1.30 → 2.1.32

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.mjs CHANGED
@@ -1876,13 +1876,14 @@ var AbstractClient = class {
1876
1876
  send: async (options) => {
1877
1877
  try {
1878
1878
  const message = options.messages[options.messages.length - 1];
1879
- const { command, threadId, files, assistantId, ...rest } = options;
1879
+ const { command, threadId, files, assistantId, mode, ...rest } = options;
1880
1880
  const result = await this.run({
1881
1881
  threadId,
1882
1882
  message: typeof message.content === "string" ? message.content : JSON.stringify(message.content),
1883
1883
  streaming: false,
1884
1884
  command,
1885
1885
  files,
1886
+ mode,
1886
1887
  ...rest
1887
1888
  });
1888
1889
  return result;
@@ -1906,6 +1907,7 @@ var AbstractClient = class {
1906
1907
  assistantId,
1907
1908
  background,
1908
1909
  enableReturnStateWhenSteamCompleted,
1910
+ mode,
1909
1911
  ...rest
1910
1912
  } = options;
1911
1913
  const message = options.messages[options.messages.length - 1];
@@ -1914,16 +1916,53 @@ var AbstractClient = class {
1914
1916
  threadId,
1915
1917
  assistantId,
1916
1918
  message: typeof message.content === "string" ? message.content : JSON.stringify(message.content),
1919
+ messageId: message.id,
1917
1920
  streaming: true,
1918
1921
  command,
1919
1922
  background,
1920
1923
  enableReturnStateWhenSteamCompleted,
1924
+ mode,
1921
1925
  ...rest
1922
1926
  },
1923
1927
  onEvent,
1924
1928
  onComplete,
1925
1929
  onError
1926
1930
  );
1931
+ },
1932
+ /**
1933
+ * Remove a pending message from the queue
1934
+ * @param options - Options for removing the message
1935
+ * @returns Promise with success status
1936
+ */
1937
+ removePendingMessage: async (options) => {
1938
+ try {
1939
+ const { assistantId, threadId, messageId } = options;
1940
+ return await this.makeRequest(
1941
+ `/api/assistants/${assistantId}/threads/${threadId}/pending-messages/${messageId}`,
1942
+ {
1943
+ method: "DELETE"
1944
+ }
1945
+ );
1946
+ } catch (error) {
1947
+ throw error;
1948
+ }
1949
+ },
1950
+ /**
1951
+ * Abort agent execution for a thread
1952
+ * @param params - Parameters for aborting
1953
+ * @returns Promise with success status
1954
+ */
1955
+ abort: async (params) => {
1956
+ try {
1957
+ return await this.makeRequest(
1958
+ `/api/assistants/${params.assistantId}/threads/${params.threadId}/abort`,
1959
+ {
1960
+ method: "POST"
1961
+ }
1962
+ );
1963
+ } catch (error) {
1964
+ throw error;
1965
+ }
1927
1966
  }
1928
1967
  };
1929
1968
  /**
@@ -2524,7 +2563,7 @@ var AbstractClient = class {
2524
2563
  * @returns The formatted request parameters
2525
2564
  */
2526
2565
  buildStreamRequestParams(options) {
2527
- const { command, threadId, message, files, background, custom_run_config, ...rest } = options;
2566
+ const { command, threadId, message, messageId, files, background, custom_run_config, ...rest } = options;
2528
2567
  return {
2529
2568
  url: "/api/runs",
2530
2569
  method: "POST",
@@ -2532,6 +2571,7 @@ var AbstractClient = class {
2532
2571
  assistant_id: this.assistantId,
2533
2572
  thread_id: threadId,
2534
2573
  message,
2574
+ message_id: messageId,
2535
2575
  files,
2536
2576
  command,
2537
2577
  streaming: true,
@@ -2837,14 +2877,15 @@ var _Client = class extends AbstractClient {
2837
2877
  ...workspaceHeaders,
2838
2878
  ...options?.headers || {}
2839
2879
  };
2880
+ if (method === "DELETE" && !options?.body) {
2881
+ delete requestHeaders["Content-Type"];
2882
+ }
2840
2883
  const requestOptions = {
2841
2884
  method,
2842
2885
  headers: requestHeaders
2843
2886
  };
2844
2887
  if (options?.body) {
2845
2888
  requestOptions.body = JSON.stringify(options.body);
2846
- } else if (method !== "GET" && method !== "HEAD") {
2847
- requestOptions.body = JSON.stringify({});
2848
2889
  }
2849
2890
  return this.fetchWithTimeout(url, requestOptions);
2850
2891
  }
@@ -3620,6 +3661,7 @@ function createSimpleMessageMerger() {
3620
3661
  updateToolCalls(message);
3621
3662
  }
3622
3663
  if (message.role === "tool" && chunk.data.tool_call_id) {
3664
+ const original_tool_message_id = chunk.data.id;
3623
3665
  const messageId = toolId_MessageIdMap.get(chunk.data.tool_call_id);
3624
3666
  if (!messageId)
3625
3667
  return;
@@ -3628,7 +3670,7 @@ function createSimpleMessageMerger() {
3628
3670
  const message2 = messages[messageIndex];
3629
3671
  message2.tool_calls = message2.tool_calls?.map((tc) => {
3630
3672
  if (tc.id === chunk.data.tool_call_id) {
3631
- return { ...tc, response: chunk.data.content, status: "success" };
3673
+ return { ...tc, response: chunk.data.content, status: "success", original_tool_message_id };
3632
3674
  }
3633
3675
  return tc;
3634
3676
  });