@holoscript/holoscript-agent 2.1.0 → 2.1.1

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
@@ -1733,6 +1733,37 @@ var AgentRunner = class {
1733
1733
  finalText = resp.content;
1734
1734
  break;
1735
1735
  }
1736
+ if (productiveCallCount === 0 && toolsCalled.size > 0 && iters < MAX_TOOL_ITERS) {
1737
+ iters++;
1738
+ messages.push({
1739
+ role: "user",
1740
+ content: "You gathered data but did not write the task deliverable. Call write_file NOW with the exact output path from the task description. Embed all data you gathered into the write_file content field. Do NOT output text \u2014 your only valid response is a write_file tool call."
1741
+ });
1742
+ const reResp = await provider.complete(
1743
+ { messages, maxTokens: 8192, temperature: 0.4, tools: activeTools },
1744
+ identity.llmModel
1745
+ );
1746
+ aggUsage = {
1747
+ promptTokens: aggUsage.promptTokens + reResp.usage.promptTokens,
1748
+ completionTokens: aggUsage.completionTokens + reResp.usage.completionTokens,
1749
+ totalTokens: aggUsage.totalTokens + reResp.usage.totalTokens
1750
+ };
1751
+ if (reResp.finishReason === "tool_use" && reResp.toolUses && reResp.toolUses.length > 0) {
1752
+ log({ ev: "reprompt-tool-call", taskId: target.id, iter: iters, tools: reResp.toolUses.map((t) => t.name) });
1753
+ const reProd = summarizeToolProductivity(reResp.toolUses);
1754
+ for (const n of reProd.names) toolsCalled.add(n);
1755
+ productiveCallCount += reProd.productiveCount;
1756
+ messages.push({ role: "assistant", content: reResp.assistantBlocks ?? [] });
1757
+ const reResults = await Promise.all(
1758
+ reResp.toolUses.map(
1759
+ (u) => runTool(u, { signReceipt: this.opts.signReceipt, addTask: (tasks2) => mesh.addTasks(tasks2) })
1760
+ )
1761
+ );
1762
+ messages.push({ role: "user", content: reResults });
1763
+ }
1764
+ finalText = reResp.content;
1765
+ lastResponse = reResp;
1766
+ }
1736
1767
  const durationMs = Date.now() - start;
1737
1768
  if (productiveCallCount === 0) {
1738
1769
  log({