feat: extend verbose tool feedback

This commit is contained in:
Peter Steinberger
2026-01-17 05:33:27 +00:00
parent 4d314db750
commit 99dd428862
31 changed files with 208 additions and 34 deletions

View File

@@ -24,6 +24,7 @@ import type { VerboseLevel } from "../thinking.js";
import type { GetReplyOptions, ReplyPayload } from "../types.js";
import { runAgentTurnWithFallback } from "./agent-runner-execution.js";
import {
createShouldEmitToolOutput,
createShouldEmitToolResult,
finalizeWithFollowup,
isAudioPayload,
@@ -116,6 +117,11 @@ export async function runReplyAgent(params: {
storePath,
resolvedVerboseLevel,
});
const shouldEmitToolOutput = createShouldEmitToolOutput({
sessionKey,
storePath,
resolvedVerboseLevel,
});
const pendingToolTasks = new Set<Promise<void>>();
const blockReplyTimeoutMs = opts?.blockReplyTimeoutMs ?? BLOCK_REPLY_SEND_TIMEOUT_MS;
@@ -296,6 +302,7 @@ export async function runReplyAgent(params: {
resolvedBlockStreamingBreak,
applyReplyToMode,
shouldEmitToolResult,
shouldEmitToolOutput,
pendingToolTasks,
resetSessionAfterCompactionFailure,
resetSessionAfterRoleOrderingConflict,
@@ -473,6 +480,7 @@ export async function runReplyAgent(params: {
// If verbose is enabled and this is a new session, prepend a session hint.
let finalPayloads = replyPayloads;
const verboseEnabled = resolvedVerboseLevel !== "off";
if (autoCompactionCompleted) {
const count = await incrementCompactionCount({
sessionEntry: activeSessionEntry,
@@ -480,12 +488,12 @@ export async function runReplyAgent(params: {
sessionKey,
storePath,
});
if (resolvedVerboseLevel === "on") {
if (verboseEnabled) {
const suffix = typeof count === "number" ? ` (count ${count})` : "";
finalPayloads = [{ text: `🧹 Auto-compaction complete${suffix}.` }, ...finalPayloads];
}
}
if (resolvedVerboseLevel === "on" && activeIsNewSession) {
if (verboseEnabled && activeIsNewSession) {
finalPayloads = [{ text: `🧭 New session: ${followupRun.run.sessionId}` }, ...finalPayloads];
}
if (responseUsageLine) {