@runappsai/agent 0.1.4 → 0.1.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/agent.js CHANGED
@@ -118,6 +118,7 @@ function withoutMedia(messages, media, model) {
118
118
  const emptyUsage = () => ({ total_cost: 0, prompt_tokens: 0, completion_tokens: 0, calls: 0 });
119
119
  const abortedResult = () => ({ runId: "", reason: "aborted", text: "", usage: emptyUsage() });
120
120
  const SKIPPED_STOP = "Skipped: the user stopped the run.";
121
+ const FILE_TOOL_NAMES = new Set(["read_file", "list_files", "search_files", "write_file", "edit_file", "move_file", "copy_file", "delete_file"]);
121
122
  const balanceError = () => new ProviderError(402, "The reply was cut short because the balance could not cover a full answer; top up to continue", { code: "insufficient_balance" });
122
123
  /** Settles with `p`, or rejects as soon as `signal` aborts (the work itself may go on; its result is ignored). */
123
124
  function raceAbort(p, signal) {
@@ -793,7 +794,8 @@ export class Agent {
793
794
  appName: this.opts.appName,
794
795
  instructions: typeof this.opts.instructions === "function" ? this.opts.instructions() : this.opts.instructions,
795
796
  tools,
796
- workspaceDescription: ws ? ws.describe() : undefined,
797
+ // run_js reaches the files too; with neither, the directory is only where the session is kept.
798
+ workspaceDescription: ws && tools.some((t) => FILE_TOOL_NAMES.has(t.name) || t.name === "run_js") ? ws.describe() : undefined,
797
799
  skills: ws ? await ws.skills() : [],
798
800
  hasSandbox: tools.some((t) => t.name === "run_js"),
799
801
  hasAskUser: tools.some((t) => t.name === "ask_user"),