@holoscript/holoscript-agent 2.1.0 → 2.1.2
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 +37 -0
- package/dist/index.js.map +1 -1
- package/dist/runner.js +37 -0
- package/dist/runner.js.map +1 -1
- package/dist/supervisor.js +37 -0
- package/dist/supervisor.js.map +1 -1
- package/package.json +1 -1
package/dist/runner.js
CHANGED
|
@@ -948,6 +948,43 @@ var AgentRunner = class {
|
|
|
948
948
|
finalText = resp.content;
|
|
949
949
|
break;
|
|
950
950
|
}
|
|
951
|
+
if (productiveCallCount === 0 && toolsCalled.size > 0 && iters < MAX_TOOL_ITERS) {
|
|
952
|
+
iters++;
|
|
953
|
+
if (messages.length > 0 && messages[messages.length - 1].role === "assistant") {
|
|
954
|
+
messages.pop();
|
|
955
|
+
}
|
|
956
|
+
messages.push({
|
|
957
|
+
role: "user",
|
|
958
|
+
content: `You read data but did NOT call write_file. This is a TASK FAILURE unless you act now.
|
|
959
|
+
Task: ${target.title}
|
|
960
|
+
Required output path (from task description): ${target.description.match(/path[:\s]+([^\s\n,]+\.json)/i)?.[1] ?? "see task description"}
|
|
961
|
+
Call write_file NOW. Embed ALL data from the tool result above into the content. Do NOT output any text \u2014 your ONLY valid response is a write_file tool call.`
|
|
962
|
+
});
|
|
963
|
+
const reResp = await provider.complete(
|
|
964
|
+
{ messages, maxTokens: 8192, temperature: 0, tools: activeTools },
|
|
965
|
+
identity.llmModel
|
|
966
|
+
);
|
|
967
|
+
aggUsage = {
|
|
968
|
+
promptTokens: aggUsage.promptTokens + reResp.usage.promptTokens,
|
|
969
|
+
completionTokens: aggUsage.completionTokens + reResp.usage.completionTokens,
|
|
970
|
+
totalTokens: aggUsage.totalTokens + reResp.usage.totalTokens
|
|
971
|
+
};
|
|
972
|
+
if (reResp.finishReason === "tool_use" && reResp.toolUses && reResp.toolUses.length > 0) {
|
|
973
|
+
log({ ev: "reprompt-tool-call", taskId: target.id, iter: iters, tools: reResp.toolUses.map((t) => t.name) });
|
|
974
|
+
const reProd = summarizeToolProductivity(reResp.toolUses);
|
|
975
|
+
for (const n of reProd.names) toolsCalled.add(n);
|
|
976
|
+
productiveCallCount += reProd.productiveCount;
|
|
977
|
+
messages.push({ role: "assistant", content: reResp.assistantBlocks ?? [] });
|
|
978
|
+
const reResults = await Promise.all(
|
|
979
|
+
reResp.toolUses.map(
|
|
980
|
+
(u) => runTool(u, { signReceipt: this.opts.signReceipt, addTask: (tasks2) => mesh.addTasks(tasks2) })
|
|
981
|
+
)
|
|
982
|
+
);
|
|
983
|
+
messages.push({ role: "user", content: reResults });
|
|
984
|
+
}
|
|
985
|
+
finalText = reResp.content;
|
|
986
|
+
lastResponse = reResp;
|
|
987
|
+
}
|
|
951
988
|
const durationMs = Date.now() - start;
|
|
952
989
|
if (productiveCallCount === 0) {
|
|
953
990
|
log({
|