agent.libx.js 0.93.4 → 0.93.6

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
@@ -2896,9 +2896,17 @@ var Agent = class _Agent {
2896
2896
  let res;
2897
2897
  const sent = this.trimContext();
2898
2898
  const frag = reasoningToChatFragment(o.model, o.reasoning);
2899
+ const isCursorWithTools = o.model.startsWith("cursor/") && wireTools.length > 0;
2900
+ const cursorPo = isCursorWithTools ? {
2901
+ toolExecutor: async (name, args) => {
2902
+ const tc = { id: `cursor-${Date.now()}`, type: "function", function: { name, arguments: JSON.stringify(args) } };
2903
+ const raw = await this.dispatch(tc);
2904
+ return typeof raw === "string" ? raw : raw.text;
2905
+ }
2906
+ } : void 0;
2899
2907
  const reasonOpts = {
2900
2908
  ...frag,
2901
- ...o.providerOptions ? { providerOptions: { ...frag.providerOptions, ...o.providerOptions } } : {}
2909
+ ...o.providerOptions || cursorPo ? { providerOptions: { ...frag.providerOptions, ...o.providerOptions, ...cursorPo } } : {}
2902
2910
  };
2903
2911
  try {
2904
2912
  if (useStream) {