@holoscript/holoscript-agent 2.1.3 → 2.1.4
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 +38 -0
- package/dist/index.js.map +1 -1
- package/dist/runner.js +38 -0
- package/dist/runner.js.map +1 -1
- package/dist/supervisor.js +38 -0
- package/dist/supervisor.js.map +1 -1
- package/package.json +1 -1
package/dist/runner.js
CHANGED
|
@@ -1052,6 +1052,44 @@ Call write_file NOW. Embed ALL data from the tool result above into the content.
|
|
|
1052
1052
|
finalText = reResp.content;
|
|
1053
1053
|
lastResponse = reResp;
|
|
1054
1054
|
}
|
|
1055
|
+
const WRITE_NAMES = /* @__PURE__ */ new Set(["write_file", "str_replace"]);
|
|
1056
|
+
if (toolsCalled.has("vision_analyze") && ![...toolsCalled].some((n) => WRITE_NAMES.has(n)) && iters < MAX_TOOL_ITERS) {
|
|
1057
|
+
iters++;
|
|
1058
|
+
if (messages.length > 0 && messages[messages.length - 1].role === "assistant") {
|
|
1059
|
+
messages.pop();
|
|
1060
|
+
}
|
|
1061
|
+
messages.push({
|
|
1062
|
+
role: "user",
|
|
1063
|
+
content: `vision_analyze returned a caption but you did NOT call write_file.
|
|
1064
|
+
Task: ${target.title}
|
|
1065
|
+
Output path: ${target.description.match(/path[:\s]+([^\s\n,]+\.json)/i)?.[1] ?? "see task description"}
|
|
1066
|
+
Call write_file NOW. Put the caption from vision_analyze into the JSON content field. Do NOT output text \u2014 your ONLY valid response is a write_file tool call.`
|
|
1067
|
+
});
|
|
1068
|
+
const vwResp = await provider.complete(
|
|
1069
|
+
{ messages, maxTokens: 8192, temperature: 0, tools: activeTools },
|
|
1070
|
+
identity.llmModel
|
|
1071
|
+
);
|
|
1072
|
+
aggUsage = {
|
|
1073
|
+
promptTokens: aggUsage.promptTokens + vwResp.usage.promptTokens,
|
|
1074
|
+
completionTokens: aggUsage.completionTokens + vwResp.usage.completionTokens,
|
|
1075
|
+
totalTokens: aggUsage.totalTokens + vwResp.usage.totalTokens
|
|
1076
|
+
};
|
|
1077
|
+
if (vwResp.finishReason === "tool_use" && vwResp.toolUses && vwResp.toolUses.length > 0) {
|
|
1078
|
+
log({ ev: "vision-write-call", taskId: target.id, iter: iters, tools: vwResp.toolUses.map((t) => t.name) });
|
|
1079
|
+
const vwProd = summarizeToolProductivity(vwResp.toolUses);
|
|
1080
|
+
for (const n of vwProd.names) toolsCalled.add(n);
|
|
1081
|
+
productiveCallCount += vwProd.productiveCount;
|
|
1082
|
+
messages.push({ role: "assistant", content: vwResp.assistantBlocks ?? [] });
|
|
1083
|
+
const vwResults = await Promise.all(
|
|
1084
|
+
vwResp.toolUses.map(
|
|
1085
|
+
(u) => runTool(u, { signReceipt: this.opts.signReceipt, addTask: (tasks2) => mesh.addTasks(tasks2) })
|
|
1086
|
+
)
|
|
1087
|
+
);
|
|
1088
|
+
messages.push({ role: "user", content: vwResults });
|
|
1089
|
+
}
|
|
1090
|
+
finalText = vwResp.content;
|
|
1091
|
+
lastResponse = vwResp;
|
|
1092
|
+
}
|
|
1055
1093
|
const durationMs = Date.now() - start;
|
|
1056
1094
|
if (productiveCallCount === 0) {
|
|
1057
1095
|
log({
|