@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.
@@ -1186,6 +1186,37 @@ var AgentRunner = class {
1186
1186
  finalText = resp.content;
1187
1187
  break;
1188
1188
  }
1189
+ if (productiveCallCount === 0 && toolsCalled.size > 0 && iters < MAX_TOOL_ITERS) {
1190
+ iters++;
1191
+ messages.push({
1192
+ role: "user",
1193
+ 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."
1194
+ });
1195
+ const reResp = await provider.complete(
1196
+ { messages, maxTokens: 8192, temperature: 0.4, tools: activeTools },
1197
+ identity.llmModel
1198
+ );
1199
+ aggUsage = {
1200
+ promptTokens: aggUsage.promptTokens + reResp.usage.promptTokens,
1201
+ completionTokens: aggUsage.completionTokens + reResp.usage.completionTokens,
1202
+ totalTokens: aggUsage.totalTokens + reResp.usage.totalTokens
1203
+ };
1204
+ if (reResp.finishReason === "tool_use" && reResp.toolUses && reResp.toolUses.length > 0) {
1205
+ log({ ev: "reprompt-tool-call", taskId: target.id, iter: iters, tools: reResp.toolUses.map((t) => t.name) });
1206
+ const reProd = summarizeToolProductivity(reResp.toolUses);
1207
+ for (const n of reProd.names) toolsCalled.add(n);
1208
+ productiveCallCount += reProd.productiveCount;
1209
+ messages.push({ role: "assistant", content: reResp.assistantBlocks ?? [] });
1210
+ const reResults = await Promise.all(
1211
+ reResp.toolUses.map(
1212
+ (u) => runTool(u, { signReceipt: this.opts.signReceipt, addTask: (tasks2) => mesh.addTasks(tasks2) })
1213
+ )
1214
+ );
1215
+ messages.push({ role: "user", content: reResults });
1216
+ }
1217
+ finalText = reResp.content;
1218
+ lastResponse = reResp;
1219
+ }
1189
1220
  const durationMs = Date.now() - start;
1190
1221
  if (productiveCallCount === 0) {
1191
1222
  log({