@yourgpt/llm-sdk 2.1.1 → 2.1.3

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
@@ -964,6 +964,25 @@ var StreamResult = class {
964
964
  case "tool_calls":
965
965
  collected.toolCalls.push(...event.toolCalls);
966
966
  break;
967
+ case "action:start":
968
+ collected.toolCalls.push({
969
+ id: event.id,
970
+ name: event.name,
971
+ args: {},
972
+ hidden: event.hidden
973
+ });
974
+ break;
975
+ case "action:args": {
976
+ const tc = collected.toolCalls.find((t) => t.id === event.id);
977
+ if (tc) {
978
+ try {
979
+ tc.args = JSON.parse(event.args || "{}");
980
+ } catch {
981
+ tc.args = {};
982
+ }
983
+ }
984
+ break;
985
+ }
967
986
  case "done":
968
987
  if (event.messages) {
969
988
  collected.messages.push(...event.messages);
@@ -1815,6 +1834,7 @@ var Runtime = class {
1815
1834
  ...request,
1816
1835
  messages: messagesWithResults
1817
1836
  };
1837
+ yield { type: "message:end" };
1818
1838
  for await (const event of this.processChatWithLoop(
1819
1839
  nextRequest,
1820
1840
  signal,
@@ -1975,10 +1995,12 @@ var Runtime = class {
1975
1995
  }
1976
1996
  }
1977
1997
  for (const tc of result.toolCalls) {
1998
+ const tool2 = allTools.find((t) => t.name === tc.name);
1978
1999
  yield {
1979
2000
  type: "action:start",
1980
2001
  id: tc.id,
1981
- name: tc.name
2002
+ name: tc.name,
2003
+ hidden: tool2?.hidden ?? false
1982
2004
  };
1983
2005
  yield {
1984
2006
  type: "action:args",
@@ -3012,7 +3034,8 @@ async function executeToolCalls(toolCalls, tools, executeServerTool, waitForClie
3012
3034
  emitEvent?.({
3013
3035
  type: "action:start",
3014
3036
  id: toolCall.id,
3015
- name: toolCall.name
3037
+ name: toolCall.name,
3038
+ hidden: tool2.hidden ?? false
3016
3039
  });
3017
3040
  emitEvent?.({
3018
3041
  type: "action:args",