Open computers from the chat, let bots ask for a take-over, show task progress
- Serve each computer to its owner under /computers/<id>/ (HTTP and websockets proxied to the AIO sandbox) and show it in a shared ComputerView with browser, terminal and code modes, opened from the computers modal or a take-over button in the thread. - ask_user_to_take_over lets a bot hand a computer to the user for a login or captcha; the message gets a take-over button and needs-you, and the viewer hands it back with a chat message. - While a task runs the thread shows "<bot> is working..." with the task's latest step; steps read as plain words, not tool names. - A coordinator with no workers no longer claims to delegate, and bots describe started tasks in the first person. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
import type { BotJobUpdateKind } from "@/src/dict/bot-queue-dict";
|
||||
import {
|
||||
JobStepToolLabels,
|
||||
JobStepToolPrefixLabels,
|
||||
type BotJobUpdateKind,
|
||||
} from "@/src/dict/bot-queue-dict";
|
||||
import type { TextLoopStep } from "@/src/harness/text/run-text-loop";
|
||||
|
||||
/**
|
||||
* Longest step line kept: the panel shows one line per step.
|
||||
* Longest step line kept: the chat shows one line per step.
|
||||
*/
|
||||
const MaxStepChars = 200;
|
||||
|
||||
/**
|
||||
* One model turn as a `bots_queue_updates` row: the tools it called, or
|
||||
* the first line of what it wrote. Null for an empty turn. Never the tool
|
||||
* arguments, which can hold anything the bot typed.
|
||||
* One model turn as a `bots_queue_updates` row, read by the user while the
|
||||
* bot works: the first line the model wrote (models often say what
|
||||
* they're about to do), else what its tools do in plain words. Null for an
|
||||
* empty turn. Never the tool arguments, which can hold anything the bot
|
||||
* typed.
|
||||
*/
|
||||
export default function describeJobStep({
|
||||
text,
|
||||
@@ -22,24 +28,34 @@ export default function describeJobStep({
|
||||
metadata: Record<string, unknown>;
|
||||
} | null {
|
||||
const metadata = { step: index, model: candidate.model.slug };
|
||||
const line = firstLine({ text });
|
||||
|
||||
if (tool_calls.length) {
|
||||
const tools = [...new Set(tool_calls.map((call) => call.name))];
|
||||
const labels = [...new Set(tools.map((name) => toolLabel({ name })))];
|
||||
|
||||
return {
|
||||
kind: "tool",
|
||||
text: `Using ${tools.join(", ")}`,
|
||||
text: line || labels.join(", "),
|
||||
metadata: { ...metadata, tools },
|
||||
};
|
||||
}
|
||||
|
||||
if (!line) return null;
|
||||
|
||||
return { kind: "note", text: line, metadata };
|
||||
}
|
||||
|
||||
function firstLine({ text }: { text: string | null }) {
|
||||
const line = text?.trim().split("\n").find((l) => l.trim())?.trim();
|
||||
|
||||
if (!line) return null;
|
||||
|
||||
return {
|
||||
kind: "note",
|
||||
text: line.length > MaxStepChars ? `${line.slice(0, MaxStepChars - 1)}…` : line,
|
||||
metadata,
|
||||
};
|
||||
return line.length > MaxStepChars ? `${line.slice(0, MaxStepChars - 1)}…` : line;
|
||||
}
|
||||
|
||||
function toolLabel({ name }: { name: string }) {
|
||||
const prefix = Object.keys(JobStepToolPrefixLabels).find((p) => name.startsWith(p));
|
||||
|
||||
return JobStepToolLabels[name] || (prefix && JobStepToolPrefixLabels[prefix]) || `Using ${name}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user