agent.libx.js 0.93.4 → 0.93.8

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
@@ -2893,12 +2893,21 @@ var Agent = class _Agent {
2893
2893
  if (o.timeoutMs && Date.now() - start >= o.timeoutMs) return kill("timeout");
2894
2894
  if (o.maxTokens && usage.totalTokens >= o.maxTokens) return kill("budget");
2895
2895
  steps++;
2896
+ this.options.host?.notify?.({ kind: "turn_start", message: `step ${steps}` });
2896
2897
  let res;
2897
2898
  const sent = this.trimContext();
2898
2899
  const frag = reasoningToChatFragment(o.model, o.reasoning);
2900
+ const isCursorWithTools = o.model.startsWith("cursor/") && wireTools.length > 0;
2901
+ const cursorPo = isCursorWithTools ? {
2902
+ toolExecutor: async (name, args) => {
2903
+ const tc = { id: `cursor-${Date.now()}`, type: "function", function: { name, arguments: JSON.stringify(args) } };
2904
+ const raw = await this.dispatch(tc);
2905
+ return typeof raw === "string" ? raw : raw.text;
2906
+ }
2907
+ } : void 0;
2899
2908
  const reasonOpts = {
2900
2909
  ...frag,
2901
- ...o.providerOptions ? { providerOptions: { ...frag.providerOptions, ...o.providerOptions } } : {}
2910
+ ...o.providerOptions || cursorPo ? { providerOptions: { ...frag.providerOptions, ...o.providerOptions, ...cursorPo } } : {}
2902
2911
  };
2903
2912
  try {
2904
2913
  if (useStream) {