* Studio: show a Nudging tool calls badge while the tool-call re-prompt runs * Guard the nudge status ordering assertion against index 0 * Tighten the nudge status comments * Announce the nudge text instead of the generic spinner label * Trim the nudge status comments Collapse the multi-line notes to fewer lines and drop one that restated the assert below it. The blank-before-badge ordering reason and the keep-in-sync contract are preserved. --------- Co-authored-by: danielhanchen <unslothai@gmail.com>
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
// SPDX-License-Identifier: AGPL-3.0-only
|
|
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
|
|
|
|
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
NUDGE_TOOL_CALLS_STATUS,
|
|
toolStatusKind,
|
|
} from "../src/features/chat/utils/tool-status.ts";
|
|
|
|
test("the nudge status is the exact string the backend sends", () => {
|
|
// Mirrors tool_call_parser.py, so a reword on either side must break here.
|
|
assert.equal(NUDGE_TOOL_CALLS_STATUS, "Nudging tool calls");
|
|
assert.equal(toolStatusKind(NUDGE_TOOL_CALLS_STATUS), "nudge");
|
|
});
|
|
|
|
test("sandbox tools keep the terminal glyph", () => {
|
|
for (const status of [
|
|
"Running Python: print(1)",
|
|
"Running Python...",
|
|
"Running: ls -la",
|
|
"Running command...",
|
|
]) {
|
|
assert.equal(toolStatusKind(status), "terminal", status);
|
|
}
|
|
});
|
|
|
|
test("every other status keeps the globe", () => {
|
|
for (const status of [
|
|
"Searching: red square",
|
|
"Reading: unsloth.ai",
|
|
"Reading page...",
|
|
"Searching documents: quarterly report",
|
|
"Calling: get_weather",
|
|
]) {
|
|
assert.equal(toolStatusKind(status), "web", status);
|
|
}
|
|
});
|
|
|
|
test("a status that merely mentions nudging is not the nudge itself", () => {
|
|
// Exact match only: a tool named after the phrase must not steal the spinner.
|
|
assert.equal(toolStatusKind("Calling: Nudging tool calls"), "web");
|
|
assert.equal(toolStatusKind("Nudging tool calls again"), "web");
|
|
});
|