Skip to content

Open source CapCut alternative.

TypeScript

fix(app): show friendly activity labels instead of raw tool names in fallback narration

David Leafe5b91c6a80
diff --git a/apps/Donkey/Sources/DonkeyAI/HostedHarnessStepPlanner.swift b/apps/Donkey/Sources/DonkeyAI/HostedHarnessStepPlanner.swift
index 5038c207..bf797971 100644
--- a/apps/Donkey/Sources/DonkeyAI/HostedHarnessStepPlanner.swift
+++ b/apps/Donkey/Sources/DonkeyAI/HostedHarnessStepPlanner.swift
@@ -237,8 +237,9 @@ public final class HostedHarnessStepPlanner: HarnessNextStepPlanning {
/// A neutral one-line account synthesized for a step whose reply carried no narration, so the live
/// pointer still updates for THIS step instead of repeating the previous step's line. Derived from the
/// step's own tool call, never from prior narration: for `shell_exec` the command itself is the most
- /// informative and keeps consecutive steps distinct; everything else names the tool. Kept short so it
- /// reads cleanly in the notch.
+ /// informative and keeps consecutive steps distinct; everything else shows the tool's friendly
+ /// activity label ("Done", "Searching", "Looking at the screen") — a raw tool name like
+ /// `run.complete` reads as an internal in the notch.
static func fallbackNarration(tool: String, input: [String: String]) -> String {
if tool == "shell_exec",
let command = input["command"]?.trimmingCharacters(in: .whitespacesAndNewlines),
@@ -247,7 +248,7 @@ public final class HostedHarnessStepPlanner: HarnessNextStepPlanning {
let clipped = firstLine.count > 80 ? String(firstLine.prefix(80)) + "…" : firstLine
return "Running `\(clipped)`."
}
- return "Running `\(tool)`."
+ return UserQueryActivity.kind(forToolNamed: tool).label
}
/// The corrective note fed back on the next attempt. A content-filter block gets a
diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swift
index 78168460..745b2863 100644
--- a/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swift
+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swift
@@ -1,5 +1,5 @@
@testable import Donkey
-import DonkeyAI
+@testable import DonkeyAI
import DonkeyContracts
import DonkeyHarness
import Foundation
@@ -347,6 +347,21 @@ struct HostedHarnessStepPlannerTests {
#expect(planner.lastNarration == "Running `ls -la`.")
}
+ @Test
+ func fallbackNarrationShowsFriendlyActivityLabelsNotRawToolNames() {
+ // Raw tool names ("Running `run.complete`.") read as internals in the notch; a narration-less
+ // step surfaces the tool's activity label instead. shell_exec keeps the command itself — it is
+ // the most informative line and keeps consecutive steps distinct.
+ #expect(HostedHarnessStepPlanner.fallbackNarration(tool: "run.complete", input: [:]) == "Done")
+ #expect(HostedHarnessStepPlanner.fallbackNarration(tool: "web.search", input: [:]) == "Searching")
+ #expect(HostedHarnessStepPlanner.fallbackNarration(tool: "ax.observe", input: [:]) == "Looking at the screen")
+ #expect(HostedHarnessStepPlanner.fallbackNarration(tool: "content.harvest", input: [:]) == "Thinking")
+ #expect(
+ HostedHarnessStepPlanner.fallbackNarration(tool: "shell_exec", input: ["command": "ls -la"])
+ == "Running `ls -la`."
+ )
+ }
+
@Test
func retriesOnceWhenChosenToolMissesAllRequiredInput() async {
// The exact loop the user hit: the model chose shell_exec with NO command (its required input),