micro-models-agent 0.35.5 → 0.36.0
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/main.js +16 -10
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -10410,7 +10410,11 @@ class Agent {
|
|
|
10410
10410
|
${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
10411
10411
|
}
|
|
10412
10412
|
emitPhase(iteration, phase, onPhase) {
|
|
10413
|
-
this.deps.pluginManager.runOnPhase?.({
|
|
10413
|
+
this.deps.pluginManager.runOnPhase?.({
|
|
10414
|
+
iteration,
|
|
10415
|
+
logger: this.deps.logger,
|
|
10416
|
+
contextManager: this.deps.contextManager
|
|
10417
|
+
}, phase);
|
|
10414
10418
|
onPhase?.(phase);
|
|
10415
10419
|
}
|
|
10416
10420
|
async run(input, onChunk, onMeta, onTool, onPhase) {
|
|
@@ -10440,7 +10444,8 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
|
10440
10444
|
}
|
|
10441
10445
|
pluginManager.runOnSessionStart({
|
|
10442
10446
|
logger,
|
|
10443
|
-
sessionManager: sessionManager?.getActiveMeta()
|
|
10447
|
+
sessionManager: sessionManager?.getActiveMeta(),
|
|
10448
|
+
contextManager
|
|
10444
10449
|
});
|
|
10445
10450
|
if (config.session?.baselineCheck !== false) {
|
|
10446
10451
|
const verifier = new StepVerifier(baseDir);
|
|
@@ -10573,7 +10578,7 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
|
10573
10578
|
if (chunk.type === "reasoning" && chunk.content) {
|
|
10574
10579
|
reasoningContent += chunk.content;
|
|
10575
10580
|
if (config.showReasoning) {
|
|
10576
|
-
const metaOut = pluginManager.runOnMeta({ iteration, logger }, chunk.content);
|
|
10581
|
+
const metaOut = pluginManager.runOnMeta({ iteration, logger, contextManager }, chunk.content);
|
|
10577
10582
|
if (metaOut) {
|
|
10578
10583
|
onMeta?.(pc2.dim(metaOut));
|
|
10579
10584
|
}
|
|
@@ -10607,7 +10612,7 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
|
10607
10612
|
logger.logLLMResponse(config.model, textContent.length, Date.now() - llmStart, err.message, "agent");
|
|
10608
10613
|
logger.error(`LLM call failed: ${err.message}`);
|
|
10609
10614
|
slog.logError(err.message);
|
|
10610
|
-
pluginManager.runOnError({ iteration, logger }, err);
|
|
10615
|
+
pluginManager.runOnError({ iteration, logger, contextManager }, err);
|
|
10611
10616
|
return {
|
|
10612
10617
|
success: false,
|
|
10613
10618
|
text: lastText,
|
|
@@ -10626,7 +10631,7 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
|
10626
10631
|
const showText = textChunks.length > 0 && (!sawToolCall || toolComments && !isToolCallJson(textContent));
|
|
10627
10632
|
if (showText) {
|
|
10628
10633
|
for (const chunk of textChunks) {
|
|
10629
|
-
const textOut = pluginManager.runOnText({ iteration, logger }, chunk);
|
|
10634
|
+
const textOut = pluginManager.runOnText({ iteration, logger, contextManager }, chunk);
|
|
10630
10635
|
onChunk?.(textOut);
|
|
10631
10636
|
}
|
|
10632
10637
|
}
|
|
@@ -10638,7 +10643,7 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
|
10638
10643
|
} else if (reasoningContent) {
|
|
10639
10644
|
llmResponse = { type: "reasoning", content: reasoningContent };
|
|
10640
10645
|
}
|
|
10641
|
-
pluginManager.runOnAfterThink({ iteration, logger }, llmResponse);
|
|
10646
|
+
pluginManager.runOnAfterThink({ iteration, logger, contextManager }, llmResponse);
|
|
10642
10647
|
if (this.deps.exitOnComplete && sawToolCall) {
|
|
10643
10648
|
const signature = toolCalls.map((tc) => `${tc.name}:${JSON.stringify(tc.arguments)}`).join("|");
|
|
10644
10649
|
if (signature && signature === lastToolSignature) {
|
|
@@ -10679,7 +10684,7 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
|
10679
10684
|
toolName: call.name,
|
|
10680
10685
|
args: call.arguments
|
|
10681
10686
|
});
|
|
10682
|
-
pluginManager.runOnToolStart({ iteration, logger }, { id: call.id, name: call.name, arguments: call.arguments });
|
|
10687
|
+
pluginManager.runOnToolStart({ iteration, logger, contextManager }, { id: call.id, name: call.name, arguments: call.arguments });
|
|
10683
10688
|
onTool?.({ type: "start", tool: call.name, args: call.arguments });
|
|
10684
10689
|
slog.logToolCall(call, iteration);
|
|
10685
10690
|
const tokensBeforeTool = contextManager.getEstimatedTokens();
|
|
@@ -10695,13 +10700,13 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
|
|
|
10695
10700
|
hallucinationDetector.getConsistencyCheck().trackDeletedFile(filePath);
|
|
10696
10701
|
}
|
|
10697
10702
|
}
|
|
10698
|
-
pluginManager.runOnToolEnd({ iteration, logger }, { id: call.id, name: call.name, arguments: call.arguments }, result, duration);
|
|
10703
|
+
pluginManager.runOnToolEnd({ iteration, logger, contextManager }, { id: call.id, name: call.name, arguments: call.arguments }, result, duration);
|
|
10699
10704
|
if (result.display) {
|
|
10700
10705
|
onMeta?.(`
|
|
10701
10706
|
` + result.display + `
|
|
10702
10707
|
`);
|
|
10703
10708
|
} else {
|
|
10704
|
-
const metaOut = pluginManager.runOnMeta({ iteration, logger }, result.output);
|
|
10709
|
+
const metaOut = pluginManager.runOnMeta({ iteration, logger, contextManager }, result.output);
|
|
10705
10710
|
onMeta?.(`
|
|
10706
10711
|
` + pc2.dim(metaOut) + `
|
|
10707
10712
|
`);
|
|
@@ -11022,7 +11027,8 @@ ${warnLine}
|
|
|
11022
11027
|
logger.closeSessionLog();
|
|
11023
11028
|
pluginManager.runOnSessionEnd({
|
|
11024
11029
|
logger,
|
|
11025
|
-
sessionManager: sessionManager?.getActiveMeta()
|
|
11030
|
+
sessionManager: sessionManager?.getActiveMeta(),
|
|
11031
|
+
contextManager
|
|
11026
11032
|
});
|
|
11027
11033
|
}
|
|
11028
11034
|
}
|