Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

feat(agents): rename_thread lets a bot name the thread it is working in

AdityaUmale6de09836792e
diff --git a/server/activity.ts b/server/activity.ts
index 0012d5458b..f4dff530cb 100644
--- a/server/activity.ts
+++ b/server/activity.ts
@@ -85,6 +85,7 @@ const TEAM_ACTION_KEYS: Record<string, string> = {
assignment_status: "activity.tool.team.assignmentStatus",
attach_file: "activity.tool.team.attachFile",
close_thread: "activity.tool.team.closeThread",
+ rename_thread: "activity.tool.team.renameThread",
coordinate_bots: "activity.tool.team.coordinateBots",
create_bot: "activity.tool.team.createBot",
create_room: "activity.tool.team.createRoom",
diff --git a/server/agent-tool-policy.test.ts b/server/agent-tool-policy.test.ts
index e84821cd74..07478dee50 100644
--- a/server/agent-tool-policy.test.ts
+++ b/server/agent-tool-policy.test.ts
@@ -31,7 +31,7 @@ describe("built-in agent tool read policy", () => {
});
it.each([
- "shared_computer", "ask_bot", "delegate_bot", "check_delegation", "wait_delegation", "start_thread", "close_thread", "post_to_room",
+ "shared_computer", "ask_bot", "delegate_bot", "check_delegation", "wait_delegation", "start_thread", "close_thread", "rename_thread", "post_to_room",
// These post into the chat: never read-only.
"attach_file", "show_widget", "update_widget", "show_html", "update_html",
"create_bot", "request_credential", "request_sign_in", "memory_update", "trigger", "delete_trigger", "create_trigger",
diff --git a/server/direct-coordination.e2e.test.ts b/server/direct-coordination.e2e.test.ts
index 3c4b50b061..5263e3df8e 100644
--- a/server/direct-coordination.e2e.test.ts
+++ b/server/direct-coordination.e2e.test.ts
@@ -414,6 +414,24 @@ it("lets the opener find and close the completed task", () => fixture(async f =>
expect((await f.messages(child.threadId)).some((message: any) => message.text === "Implemented and reviewer confirmed checks")).toBe(true);
}), 45_000);
+it("lets a bot rename only the thread it is working in", () => fixture(async f => {
+ f.plan[f.chief.id] = {
+ steps: [{ tool: "rename_thread", arguments: { title: "Acme: carousel design" } }],
+ reply: "Renamed this thread",
+ };
+ f.save();
+ const before = (await f.api("/api/bots")).bots.find((bot: any) => bot.id === f.chief.id).tasks.find((task: any) => task.threadId === f.chief.activeTaskId).title;
+ await f.cli("send", "--bot", f.chief.id, "--task", f.chief.activeTaskId, "--text", "Terminei o design e a skill de carrossel pra cliente Acme, pode dar um nome melhor a esta conversa?");
+ expect((await f.wait()).status).toBe("settled");
+ const step = f.evidence().at(-1).evidence.find((entry: any) => entry.step?.tool === "rename_thread");
+ expect(step.response.result.isError).toBeFalsy();
+ expect(step.response.result.content[0].text).toContain("#Acme: carousel design");
+ const chief = (await f.api("/api/bots")).bots.find((bot: any) => bot.id === f.chief.id);
+ const renamed = chief.tasks.find((task: any) => task.threadId === f.chief.activeTaskId);
+ expect(renamed.title).toBe("Acme: carousel design");
+ expect(renamed.title).not.toBe(before);
+}), 45_000);
+
it("does not treat self-opened work or an abandoned human branch as new human authority", () => fixture(async f => {
await f.api("/api/config", { threads: { maxConcurrentPerBot: 1 } }, "PUT");
const room = (await f.cli("new-channel", "--name", "Updates", "--members", f.chief.id, "--section", "Leadership")).channel;
diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.ts
index e6f93d48ae..1c5b2d304b 100644
--- a/server/drivers/agents-call.ts
+++ b/server/drivers/agents-call.ts
@@ -21,6 +21,7 @@ import { callResearchTool, RESEARCH_TOOL_NAMES } from "./agents-research-tools.t
import { callHelperTool, HELPER_TOOL_NAMES } from "./agents-helper-tools.ts";
import { callUsageLimitsTool, USAGE_LIMITS_TOOL } from "./agents-usage-tool.ts";
import { callThreadPostTool, THREAD_POST_TOOL } from "./agents-thread-post-tool.ts";
+import { callRenameThreadTool, RENAME_THREAD_TOOL } from "./agents-thread-title-tool.ts";
import { callWaitTool, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts";
import { callBurstTool } from "./agents-burst-tool.ts";
import { callComputerAskTool, COMPUTER_ASK_TOOL_NAMES } from "./agents-computer-ask-tool.ts";
@@ -406,6 +407,7 @@ export async function callTool(called: string, input: Json, context: ToolCallCon
};
}
if (name === THREAD_POST_TOOL) return callThreadPostTool(args, context);
+ if (name === RENAME_THREAD_TOOL) return callRenameThreadTool(args, context);
if (name === "select_computer") {
if (args.surface !== undefined && (typeof args.surface !== "string" || !["auto", "cloud", "vm", "local", "browser"].includes(args.surface))) {
return { text: "Choose auto, cloud, vm, local or browser; omit surface to inspect connected choices.", isError: true };
diff --git a/server/drivers/agents-catalog-goldens/bridged.profiles.json b/server/drivers/agents-catalog-goldens/bridged.profiles.json
index 6fe033be99..f6ccda31bc 100644
--- a/server/drivers/agents-catalog-goldens/bridged.profiles.json
+++ b/server/drivers/agents-catalog-goldens/bridged.profiles.json
@@ -1,7 +1,7 @@
{
"default": {
- "bytes": 18651,
- "sha256": "4a1fc605dc7ad4ea84ec2748221f94f44915a83ee9fea3c3d885fa2e1e10a05d",
+ "bytes": 18666,
+ "sha256": "a001d6850312a52b0de19ebdb55afdfe7ea0d0a4ff93804354f5949dc9e1f0ce",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -23,8 +23,8 @@
]
},
"voice": {
- "bytes": 19432,
- "sha256": "a3c87a70ad905c9fdc8e2c7b2d0789f3b6b8a345ef7e15227fa99cc9d4f87dff",
+ "bytes": 19447,
+ "sha256": "759844e6d17f27311bbd723fb26164b61b329f4576cf66323861ad19efbfd8ee",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -47,8 +47,8 @@
]
},
"shared": {
- "bytes": 18691,
- "sha256": "005bbe97fbac1974b152835d949c3483896b04a67dfd7cf414d90f2e594a53d8",
+ "bytes": 18706,
+ "sha256": "440d9d4e80c749187b927f7c097a95a18833812416c1b9591987253728eb03c1",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -70,8 +70,8 @@
]
},
"shared+voice": {
- "bytes": 19472,
- "sha256": "23763e33556753b7b1075a01037d7e66ace07c147ab7f951723b377c29cbae61",
+ "bytes": 19487,
+ "sha256": "7f6d3a896b85e823a34ff4f0ac1395cfcd3f7e2ccd69e10f5d024813a3f0caeb",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -94,8 +94,8 @@
]
},
"skills": {
- "bytes": 18678,
- "sha256": "a04a468b2cefd2c06dfbbd7af42356e9d60f4a64b4f888213b077023001f0c83",
+ "bytes": 18693,
+ "sha256": "b71d8817c4157d43dbb7af6c0af1adc051c98e009a0efb90ef0bf05db1b8acd5",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -117,8 +117,8 @@
]
},
"skills+voice": {
- "bytes": 19459,
- "sha256": "4c999c3e290d6ddce8d061558de4e5f2c7c23899ca7930f2c8fce1c19c0095bf",
+ "bytes": 19474,
+ "sha256": "42ab6a32efcf9bf4302d9c6c3f40b4a0eda09e32eead97adb05431a1f6764741",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -141,8 +141,8 @@
]
},
"skills+shared": {
- "bytes": 18718,
- "sha256": "b298f8bab5135d3e92b69c175ec1e193cf1489bd1124cd435ef7971727ff29d1",
+ "bytes": 18733,
+ "sha256": "e621abe7e341a0e96cd814d25cea56c3691764e49475b5c0d7d43062b85eb0b2",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -164,8 +164,8 @@
]
},
"skills+shared+voice": {
- "bytes": 19499,
- "sha256": "0d4ee7d86841a2ec20a45a4b58cd5ed060ac0ecf04864840b405ffc19ef4fc19",
+ "bytes": 19514,
+ "sha256": "d1f0047189fe9bdbc1d098040de64298bef740903ca3af8a2bfb980f66359f01",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -188,8 +188,8 @@
]
},
"non-chief": {
- "bytes": 18534,
- "sha256": "c23bd40198830815705adde77490bad0854e52ee58eb3534b2116bcdb2f75d93",
+ "bytes": 18549,
+ "sha256": "2a8324a504a058193dcf201ecabd7201e1d3052346b33c77645594264f867653",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -211,8 +211,8 @@
]
},
"voice+non-chief": {
- "bytes": 19315,
- "sha256": "674d50bdf0770f120f18c0c790ab4ca13c764eb5d31623828f40d2d4f060d2a4",
+ "bytes": 19330,
+ "sha256": "b32926681a1d239b5a2e61ce46d67f310692491a8140a1afcf3f3a012f0b09e5",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -235,8 +235,8 @@
]
},
"shared+non-chief": {
- "bytes": 18574,
- "sha256": "fb9b82ac22ff2728c38a95cf2f008285bd7a5efed216d8b9ab862ec793660d35",
+ "bytes": 18589,
+ "sha256": "2eab10f9391e85a9cb619eb2aed7091452ab66bace38f1a6f0d7dbd6dc214f4a",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -258,8 +258,8 @@
]
},
"shared+voice+non-chief": {
- "bytes": 19355,
- "sha256": "416f1fdfb47b46e096238ed42cb084c919c1feddef9a256a4d31edaf7be7bd61",
+ "bytes": 19370,
+ "sha256": "415e57393dc2ff8bf93f282de725b1f95df00a293326b7d96877e54de8654887",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -282,8 +282,8 @@
]
},
"skills+non-chief": {
- "bytes": 18561,
- "sha256": "37e9f6ec7623ebf345051d12661705fc4ae90b3c96b1bae704713333317ea618",
+ "bytes": 18576,
+ "sha256": "4ff1ec9036661270ce58064b4777b3169c489d3bd0e46c915e4d5bcbd1479a5d",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -305,8 +305,8 @@
]
},
"skills+voice+non-chief": {
- "bytes": 19342,
- "sha256": "a455e0dd93b13b70d009d05753aba68421c70f53f3a746398f4c3b388f64db42",
+ "bytes": 19357,
+ "sha256": "cd75549bef7f5b0a22e00d78b8f0d5756b491d2312c63375338af06f0bc7dbc8",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -329,8 +329,8 @@
]
},
"skills+shared+non-chief": {
- "bytes": 18601,
- "sha256": "cf88076df94c7d4a2a4ad6f89d127fe6f263a567e613b6535950936d55531af2",
+ "bytes": 18616,
+ "sha256": "90b4f676acaabdc68c1e08b530850b43a40157cd39831f0e3221c6544a1443b7",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -352,8 +352,8 @@
]
},
"skills+shared+voice+non-chief": {
- "bytes": 19382,
- "sha256": "e930f84a92cd6b39ca122d4abd7dd6944d8b90bd5e0e1a2c2ba4450b93589b03",
+ "bytes": 19397,
+ "sha256": "b2cd279e511861be80ac2c0c818ff12961dfa79519086dd96d9bdae49ef6c57b",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -376,8 +376,8 @@
]
},
"skills+shared+voice+cloud-home": {
- "bytes": 19515,
- "sha256": "6a742a734ce3a5ee4d3dc1a5547f8afd66d1385378a79dbdbf45ff6549ca8b01",
+ "bytes": 19530,
+ "sha256": "947e094f62f8cff2ef29876fdbbe8508bc657d0f24281ece92d1c21cfd41dfb5",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -400,8 +400,8 @@
]
},
"skills+shared+voice+non-chief+cloud-home": {
- "bytes": 19398,
- "sha256": "bdf52d1787b9dc1a5b06e3f94ec1e3ea8228b2b6d47780c682d1850c2172638d",
+ "bytes": 19413,
+ "sha256": "59f8d36422b850eb311546bfb1058e9d30b8c2d8e1fe1814c96e74434f0e218d",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -424,8 +424,8 @@
]
},
"skills+shared+voice+x": {
- "bytes": 19560,
- "sha256": "6f854f04ccc6eac878b97c9062c5c0c3b7ef6c2fe3ded2a9ae70c0ca5e446d1c",
+ "bytes": 19575,
+ "sha256": "993d37bdf3b4134dab98888ba4ca1114d8ca148b6502628afdc931a2b20c6f15",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -448,8 +448,8 @@
]
},
"skills+shared+voice+x+team": {
- "bytes": 19560,
- "sha256": "6f854f04ccc6eac878b97c9062c5c0c3b7ef6c2fe3ded2a9ae70c0ca5e446d1c",
+ "bytes": 19575,
+ "sha256": "993d37bdf3b4134dab98888ba4ca1114d8ca148b6502628afdc931a2b20c6f15",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -472,8 +472,8 @@
]
},
"skills+shared+voice+x+team+images": {
- "bytes": 19576,
- "sha256": "2c89e7dbe68dd11f060d4eb66abda3443e4e9ca19cf937b8e0868578ee6b571f",
+ "bytes": 19591,
+ "sha256": "2f79ca867c87fd7de0435b304881480a5087166a27d30a60bb6aafebe9ba99a6",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -496,8 +496,8 @@
]
},
"default+legacy-switches": {
- "bytes": 18651,
- "sha256": "4a1fc605dc7ad4ea84ec2748221f94f44915a83ee9fea3c3d885fa2e1e10a05d",
+ "bytes": 18666,
+ "sha256": "a001d6850312a52b0de19ebdb55afdfe7ea0d0a4ff93804354f5949dc9e1f0ce",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -519,8 +519,8 @@
]
},
"default+mausbot": {
- "bytes": 18703,
- "sha256": "18c24f6e014e65cc6ac996fdf487afba006b6accf9b10ad36bdf204dd914e5ce",
+ "bytes": 18718,
+ "sha256": "9d064a176f61dc3cf51631d351b213b64cd470fe95b8dfaf856a8ad5794e0262",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -542,8 +542,8 @@
]
},
"skills+shared+voice+mausbot": {
- "bytes": 19551,
- "sha256": "e272c08e1601de93d22ca6795828cacc924a075153ee70574795ba46997e715b",
+ "bytes": 19566,
+ "sha256": "d71975c6a9fbf431d81bc13ed580f18cdd017ca69ade73ba89327d4efa82b6e0",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -566,8 +566,8 @@
]
},
"default+no-computer-pick": {
- "bytes": 17439,
- "sha256": "f92c4ae6bd4386cb0bfc179a7b898f5bb78c96f830d9550773eee7a47771722b",
+ "bytes": 17454,
+ "sha256": "9837b3cf610574059334ef448c9a059bb660efaf948dbbc60684afb901b4fe7a",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -632,8 +632,8 @@
]
},
"default+images": {
- "bytes": 18667,
- "sha256": "4308160ad757679ad1fdcaedc8a5583d96538814698edd55877b69f7c48bedda",
+ "bytes": 18682,
+ "sha256": "c7afc68fae9f499c1548b664c9fe5f61bc9638e9823dccc0217c5ebd13beea8c",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -655,8 +655,8 @@
]
},
"skills+shared+voice+x+team+images+hosting": {
- "bytes": 20778,
- "sha256": "944e28419af23e66dfc4e2e37ad01f82f44c4434b2e21eea0932d000d216c0b1",
+ "bytes": 20793,
+ "sha256": "a2da314578fbad6a3bcfd8e6560824218b73747d5ca1c7e5164ee10ac0714a24",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -680,8 +680,8 @@
]
},
"default+hosting": {
- "bytes": 19853,
- "sha256": "2455feec30f89b22f013e89c901528c7fe30e4ca0f343134640eb915906a81a9",
+ "bytes": 19868,
+ "sha256": "bdc5a005a31573f123f24dd9a1d471995f07b25d0bd5a114ea92f203fa501090",
"tools": [
"tool_result_read",
"list_room_targets",
diff --git a/server/drivers/agents-catalog-goldens/bridged.tools-list.json b/server/drivers/agents-catalog-goldens/bridged.tools-list.json
index fe18ae00cb..3e156fb534 100644
--- a/server/drivers/agents-catalog-goldens/bridged.tools-list.json
+++ b/server/drivers/agents-catalog-goldens/bridged.tools-list.json
@@ -486,7 +486,7 @@
},
{
"name": "find_tool",
- "description": "Find an OpenMausBot tool that is not in your tool list. Say what you want to do in a few words, or give the tool's name. Each match comes back with its description and exact input schema; run one with use_tool. Tools reached this way: list_shared_computers, shared_computer, assignment_status, usage_limits, list_threads, close_thread, start_thread, burst, list_models, vm_exec, show_widget, show_html, unpublish_page, create_bot, list_team_setup, list_team_library, propose_team_setup, propose_bot_deletion, manage_room, x_search, research_search, research_endpoint, research_call, decide, extract, generate_image, report_bug, check_app_hosting, retry_thread, memory_log, session_search, trigger_info, trigger, delete_trigger, wait_until, list_waits, cancel_wait, propose_profile, propose_model, propose_team_memory, skills_list, skill_manage, mcp_server, app_settings.",
+ "description": "Find an OpenMausBot tool that is not in your tool list. Say what you want to do in a few words, or give the tool's name. Each match comes back with its description and exact input schema; run one with use_tool. Tools reached this way: list_shared_computers, shared_computer, assignment_status, usage_limits, list_threads, close_thread, rename_thread, start_thread, burst, list_models, vm_exec, show_widget, show_html, unpublish_page, create_bot, list_team_setup, list_team_library, propose_team_setup, propose_bot_deletion, manage_room, x_search, research_search, research_endpoint, research_call, decide, extract, generate_image, report_bug, check_app_hosting, retry_thread, memory_log, session_search, trigger_info, trigger, delete_trigger, wait_until, list_waits, cancel_wait, propose_profile, propose_model, propose_team_memory, skills_list, skill_manage, mcp_server, app_settings.",
"inputSchema": {
"type": "object",
"additionalProperties": false,
diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.json
index 3bc2a6ed90..d601d7ab10 100644
--- a/server/drivers/agents-catalog-goldens/full.tools-list.json
+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json
@@ -311,6 +311,23 @@
]
}
},
+ {
+ "name": "rename_thread",
+ "description": "Rename the thread you are in so the sidebar says what it is about (\"Acme: carousel design\"): when the person asks, or when the title is only the cut start of the first message. Never rename a thread the person named unless asked. Rooms and automation chats keep their names.",
+ "inputSchema": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "title": {
+ "type": "string",
+ "description": "One short, specific line, at most 80 characters."
+ }
+ },
+ "required": [
+ "title"
+ ]
+ }
+ },
{
"name": "start_thread",
"description": "Open a separate job on yourself: one conversation with its own history and its own run, shown to the person as a row under you, without switching the person's selected conversation. Use it only when the user requests independent jobs (for example one review per pull request, \"review each pull request\" — one thread per pull request) instead of doing them inside this conversation, or a second opinion from another model (model_selection from list_models, report_back true). The title becomes the row's name, so make it short and specific, and write it as #Title when you mention it to the person; give complete instructions, since the run will not see this conversation. You can open at most five per turn; a self-opened job cannot open more jobs. This is not a teammate handoff: use coordinate_bots for teammates (thread \"new\" opens a fresh thread on them) and their automatic replies. If a call is refused, do not retry it: say what you still wanted opened.",
diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.json
index 55ff4d6909..a2d4b30809 100644
--- a/server/drivers/agents-catalog-goldens/profiles.json
+++ b/server/drivers/agents-catalog-goldens/profiles.json
@@ -1,7 +1,7 @@
{
"default": {
- "bytes": 64430,
- "sha256": "fdb7450572a3c61d6f4614f6b039e213c54b5564023d8ab4499ce29ad139b446",
+ "bytes": 64936,
+ "sha256": "1aceb1d8b3e08ee2bea11f8be55e7843d1642c6106fba73112d346a17acdc2d7",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -13,6 +13,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -55,8 +56,8 @@
]
},
"voice": {
- "bytes": 65211,
- "sha256": "4c589a35da6368e1d307175bd5b549ac8c6cd121dcc0039aec4039457b1d1661",
+ "bytes": 65717,
+ "sha256": "6db0bf07c4b8621fe0af2e0fb4ea96570f7654faabc87bcabb0e392fc37157f0",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -68,6 +69,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -111,8 +113,8 @@
]
},
"shared": {
- "bytes": 66695,
- "sha256": "c4e0c297772bd3c0f88f98beed577d83308ab1fc2a35c62c972114b7bd48b467",
+ "bytes": 67201,
+ "sha256": "6b5da58256239b39cf41400604cd60c556ad1582f0be6f373752b331d9e98135",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -126,6 +128,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -168,8 +171,8 @@
]
},
"shared+voice": {
- "bytes": 67476,
- "sha256": "50ed0fb42c0a4773a2f3ed3adf85d5831331ed665585f31639f7b1105693d3cd",
+ "bytes": 67982,
+ "sha256": "1a1e1ec4cfdc811d5b867545e7881f7ece886dd9fc3f30497e6b03e352560b65",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -183,6 +186,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -226,8 +230,8 @@
]
},
"skills": {
- "bytes": 67506,
- "sha256": "6af3cabd8244e03d2a96b008c64d98f9f7eeb18d0aa91afe68a9cd8aa04ffc52",
+ "bytes": 68012,
+ "sha256": "ee6a61691d88d45b2a2fc89e5f493a1d882928e67e472bc7e28f22af66dba25f",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -239,6 +243,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -283,8 +288,8 @@
]
},
"skills+voice": {
- "bytes": 68287,
- "sha256": "3c34d5963a8e399240983a8ec41aa8e06d2809f75d2c23fa9aa8f3f7f0966ca5",
+ "bytes": 68793,
+ "sha256": "de8225e7d4168d5dde7fcdee0934a3e257097d749290d3a74297dfbf51449f65",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -296,6 +301,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -341,8 +347,8 @@
]
},
"skills+shared": {
- "bytes": 69771,
- "sha256": "7c457c19e711c5ac02feb06e5d0c90e5223d9532ad014016c8e1dbede300e8a4",
+ "bytes": 70277,
+ "sha256": "bec3269c17539bb6395d63ee4c209d806822168563eb0ca936d38f0a4e2160c6",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -356,6 +362,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -400,8 +407,8 @@
]
},
"skills+shared+voice": {
- "bytes": 70552,
- "sha256": "952334bb5212777ee18e60c030967c62ad638712b3df783ace87f7488a72c30c",
+ "bytes": 71058,
+ "sha256": "64455ffdc5a35ee5efcc152d1b6bec9d6573e2ac8ea70172dca518c4d50d6b46",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -415,6 +422,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -460,8 +468,8 @@
]
},
"non-chief": {
- "bytes": 54933,
- "sha256": "51dcb7904b8548d31f6be1f38a3884d87a96901c9ba7a285cd2d8829f56e733b",
+ "bytes": 55439,
+ "sha256": "12dc8f6dae3a6af2b56c88852aa34eb316cf6bad47ccc450f451d2da3f997b48",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -473,6 +481,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -508,8 +517,8 @@
]
},
"voice+non-chief": {
- "bytes": 55714,
- "sha256": "186c8e8bfa8e99d0e840c3a2c6555498ca48a371cac11e36a1c2ec82e7ac513a",
+ "bytes": 56220,
+ "sha256": "71783a4f26b1bf64216b3d5b6a381df21e50d22e3416365a8ddfdb74d2cede05",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -521,6 +530,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -557,8 +567,8 @@
]
},
"shared+non-chief": {
- "bytes": 57198,
- "sha256": "88258178bf9e365d56ca3d97203dbecad46b7d344ac9999e5764c2ef2074026f",
+ "bytes": 57704,
+ "sha256": "0c3ba5727722e3a7a01f40e1216ee781e2cc73736aded72ae99e06f165cf2bb4",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -572,6 +582,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -607,8 +618,8 @@
]
},
"shared+voice+non-chief": {
- "bytes": 57979,
- "sha256": "f39cf7350c59cfc9974bae3a4e062d7e15bc3d73c504de3c8cd5821fa07c9e28",
+ "bytes": 58485,
+ "sha256": "28f8427482d7b741a701cfd90c486505de04c55e6e249bf3241a678ad3145ed1",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -622,6 +633,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -658,8 +670,8 @@
]
},
"skills+non-chief": {
- "bytes": 58009,
- "sha256": "9319e3ff6d9823a120a3d12bcd6ba61f8d015a494e172bcd0d1c6d97ffe6b7bc",
+ "bytes": 58515,
+ "sha256": "9f782875b0b1c2d781828263347807c06e021cab3738514cd3fa071053f81d9d",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -671,6 +683,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -708,8 +721,8 @@
]
},
"skills+voice+non-chief": {
- "bytes": 58790,
- "sha256": "4c3b4e7ebbcfd7c4b3394590c511fc3a9c8fbc6b76b76f5a1209b14c42ed50bc",
+ "bytes": 59296,
+ "sha256": "0aa8dc73adf5a8955443a6ade0a141c7152398e38979353deafb57dba9f20246",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -721,6 +734,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -759,8 +773,8 @@
]
},
"skills+shared+non-chief": {
- "bytes": 60274,
- "sha256": "cd8c050e5127ff9ef4142dc05ed12287c9106d1779a84af6eb5a80018b3718a9",
+ "bytes": 60780,
+ "sha256": "8f108f7aa3b301b8bf93944dfb15a1525a2db99d9854593ba06b73ebdf9c2682",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -774,6 +788,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -811,8 +826,8 @@
]
},
"skills+shared+voice+non-chief": {
- "bytes": 61055,
- "sha256": "64e9f61c07218ee328cef7b930d23943a8c0de02f5909423057f0425fd1addb0",
+ "bytes": 61561,
+ "sha256": "e7a41915af9f987a55e60ad19940b075108f676d0e107836143d9456c15025df",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -826,6 +841,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -864,8 +880,8 @@
]
},
"skills+shared+voice+cloud-home": {
- "bytes": 70318,
- "sha256": "99e384f91fb663f7abda8c6e1ed540e978105f403ef207eee5cb94df5d4dbc50",
+ "bytes": 70824,
+ "sha256": "a32f14f4ebcc15d0ec2be59b6c26dc9628055dc905455a379c01db78a37c0618",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -879,6 +895,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -924,8 +941,8 @@
]
},
"skills+shared+voice+non-chief+cloud-home": {
- "bytes": 60821,
- "sha256": "f044d3c2254a15d0a61731de291f462e8108b786f7ad4993714f1979fd0789ef",
+ "bytes": 61327,
+ "sha256": "0e7ac207cd95bb92d63c9780b723ba1f7e9b31eca5f2b5203af4dc011646b124",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -939,6 +956,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -977,8 +995,8 @@
]
},
"skills+shared+voice+x": {
- "bytes": 74391,
- "sha256": "daf4bc1ed1d34decc7a19bf3d6978dfcedb09ac4a3c2308ff85ad5905846efb6",
+ "bytes": 74897,
+ "sha256": "94f3d4ec31e41c3371811c43a7bd30f71145bdda3f7b84a7f5a331123726a245",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -992,6 +1010,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1041,8 +1060,8 @@
]
},
"skills+shared+voice+x+team": {
- "bytes": 74391,
- "sha256": "daf4bc1ed1d34decc7a19bf3d6978dfcedb09ac4a3c2308ff85ad5905846efb6",
+ "bytes": 74897,
+ "sha256": "94f3d4ec31e41c3371811c43a7bd30f71145bdda3f7b84a7f5a331123726a245",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1056,6 +1075,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1105,8 +1125,8 @@
]
},
"skills+shared+voice+x+team+images": {
- "bytes": 75164,
- "sha256": "6bb97a76748d2e61cb4591d2673bd13c045083198790e6a82d4188efb73e088e",
+ "bytes": 75670,
+ "sha256": "1fb13a6c719b14e06eac626af99c74086b957385f568a5196d970c52e7fc31e1",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1120,6 +1140,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1170,8 +1191,8 @@
]
},
"default+legacy-switches": {
- "bytes": 64430,
- "sha256": "fdb7450572a3c61d6f4614f6b039e213c54b5564023d8ab4499ce29ad139b446",
+ "bytes": 64936,
+ "sha256": "1aceb1d8b3e08ee2bea11f8be55e7843d1642c6106fba73112d346a17acdc2d7",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1183,6 +1204,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1225,8 +1247,8 @@
]
},
"default+mausbot": {
- "bytes": 65081,
- "sha256": "c556266fc366834f22846a8ddb664ca478de990d10cef468ccb0a721e6b48d8e",
+ "bytes": 65587,
+ "sha256": "744d8e9855d043962af1833d0f4d3089c791359359a93257fd20608277b89fb9",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1238,6 +1260,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1282,8 +1305,8 @@
]
},
"skills+shared+voice+mausbot": {
- "bytes": 71203,
- "sha256": "7afcb75a26d575335c28e6c4a8fe4a4b288d7e9e4efd97bd54a9335d4c8dc917",
+ "bytes": 71709,
+ "sha256": "e48fa3f0c6b158545c1120d3e04875f0e4bcccacc63ccd0de2c142ca95bc3300",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1297,6 +1320,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1344,8 +1368,8 @@
]
},
"default+no-computer-pick": {
- "bytes": 63218,
- "sha256": "3ddfba221f672c3deb77ff0c1a6e7f32efc91b3a00de2841c5a07c11cf75d2a6",
+ "bytes": 63724,
+ "sha256": "b07d18bba3f912478d602d665ad94e5339e9ea9849793d87b0c637ce1431840b",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1356,6 +1380,7 @@
"list_rooms",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1491,8 +1516,8 @@
]
},
"default+images": {
- "bytes": 65203,
- "sha256": "284f8213d22d8bae4f045dd9dd2cd356b0e99ab9f85f9c4f0bf3e3d01b5d76d0",
+ "bytes": 65709,
+ "sha256": "35a1130b0cbd616d829f47ddc71d3b823ca3f786d11df3310720e3715282a301",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1504,6 +1529,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1547,8 +1573,8 @@
]
},
"skills+shared+voice+x+team+images+hosting": {
- "bytes": 77027,
- "sha256": "9e80dbb89d28a24184ed8cba5e69c188ecc7835a52af7b3cb4578f95aa150adf",
+ "bytes": 77533,
+ "sha256": "8abc63908b0a20837c5d5f4513a17fde6ed78783e9f474a7ba6e9c1ba647f4cc",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1562,6 +1588,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
@@ -1614,8 +1641,8 @@
]
},
"default+hosting": {
- "bytes": 66293,
- "sha256": "fdcfd8817fdb3946faf148b1dd0a72b0b4f0504f1ac096f1f03cce8fa2b06a49",
+ "bytes": 66799,
+ "sha256": "52e043a979268187a04f533b2f86f5323affcef821667d2fa3468e3919ce6963",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1627,6 +1654,7 @@
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
diff --git a/server/drivers/agents-catalog-wire.test.ts b/server/drivers/agents-catalog-wire.test.ts
index 0578e52529..5900781d21 100644
--- a/server/drivers/agents-catalog-wire.test.ts
+++ b/server/drivers/agents-catalog-wire.test.ts
@@ -85,36 +85,36 @@ const FULL = "skills+shared+voice+x+team+images+hosting";
/** Bytes when the budget was last set; a profile may move at most 2% either way (lower it to lock in a win). */
const BUDGET_BASELINE: Record<string, number> = {
- "default": 63197,
- "voice": 63978,
- "shared": 65462,
- "shared+voice": 66243,
- "skills": 66273,
- "skills+voice": 67054,
- "skills+shared": 68443,
- "skills+shared+voice": 69224,
- "non-chief": 54087,
- "voice+non-chief": 54868,
- "shared+non-chief": 56352,
- "shared+voice+non-chief": 57133,
- "skills+non-chief": 57163,
- "skills+voice+non-chief": 57944,
- "skills+shared+non-chief": 59428,
- "skills+shared+voice+non-chief": 60209,
- "skills+shared+voice+cloud-home": 68990,
- "skills+shared+voice+non-chief+cloud-home": 59975,
- "default+legacy-switches": 63197,
- "default+mausbot": 63848,
- "skills+shared+voice+mausbot": 69875,
- "skills+shared+voice+x": 73048,
- "skills+shared+voice+x+team": 73048,
- "default+no-computer-pick": 62163,
+ "default": 63703,
+ "voice": 64484,
+ "shared": 65968,
+ "shared+voice": 66749,
+ "skills": 66779,
+ "skills+voice": 67560,
+ "skills+shared": 68949,
+ "skills+shared+voice": 69730,
+ "non-chief": 54593,
+ "voice+non-chief": 55374,
+ "shared+non-chief": 56858,
+ "shared+voice+non-chief": 57639,
+ "skills+non-chief": 57669,
+ "skills+voice+non-chief": 58450,
+ "skills+shared+non-chief": 59934,
+ "skills+shared+voice+non-chief": 60715,
+ "skills+shared+voice+cloud-home": 69496,
+ "skills+shared+voice+non-chief+cloud-home": 60481,
+ "default+legacy-switches": 63703,
+ "default+mausbot": 64354,
+ "skills+shared+voice+mausbot": 70381,
+ "skills+shared+voice+x": 73554,
+ "skills+shared+voice+x+team": 73554,
+ "default+no-computer-pick": 62669,
"default+room": 59680,
"non-chief+room": 50526,
- "skills+shared+voice+x+team+images": 73821,
- "default+images": 63970,
- "skills+shared+voice+x+team+images+hosting": 75660,
- "default+hosting": 65205,
+ "skills+shared+voice+x+team+images": 74327,
+ "default+images": 64476,
+ "skills+shared+voice+x+team+images+hosting": 76166,
+ "default+hosting": 65711,
};
const RPC_PREFIX = '{"jsonrpc":"2.0","id":1,"result":';
@@ -340,7 +340,7 @@ describe("agents proxy tools/list golden", () => {
const names = (name: string) => toolsOf(wires[name]!).map((tool) => tool.name);
expect(names("default+no-computer-pick")).toEqual(names("default").filter((tool) => tool !== "select_computer"));
for (const name of ["default", "non-chief"]) {
- expect(names(`${name}+room`), name).toEqual(names(name).filter((tool) => !["select_computer", "wait_until", "list_waits", "cancel_wait", "burst"].includes(tool)));
+ expect(names(`${name}+room`), name).toEqual(names(name).filter((tool) => !["select_computer", "wait_until", "list_waits", "cancel_wait", "burst", "rename_thread"].includes(tool)));
}
for (const [name, profile] of Object.entries(PROFILES)) {
expect(names(name).includes("select_computer"), name).toBe(profile.env.OMB_COMPUTER_SELECTION === "1");
diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.ts
index 4aedc88cab..f29998dbf4 100644
--- a/server/drivers/agents-catalog.ts
+++ b/server/drivers/agents-catalog.ts
@@ -10,6 +10,7 @@ import { HELPER_TOOL_DEFINITIONS } from "./agents-helper-tools.ts";
import { USAGE_LIMITS_TOOL_DEFINITION } from "./agents-usage-tool.ts";
import { APP_SETTINGS_TOOL_DEFINITION } from "./agents-app-settings-tool.ts";
import { THREAD_POST_TOOL_DEFINITION } from "./agents-thread-post-tool.ts";
+import { RENAME_THREAD_TOOL_DEFINITION } from "./agents-thread-title-tool.ts";
import { WAIT_TOOL_DEFINITIONS, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts";
import { COMPUTER_ASK_TOOL_DEFINITIONS, COMPUTER_ASK_TOOL_NAMES } from "./agents-computer-ask-tool.ts";
import { IMAGE_TOOL_DEFINITIONS, IMAGE_TOOL_NAMES } from "./agents-image-tools.ts";
@@ -313,6 +314,7 @@ const TOOL_DEFINITIONS = [
required: ["thread_id"],
},
},
+ RENAME_THREAD_TOOL_DEFINITION,
{
name: "start_thread",
description:
@@ -942,7 +944,7 @@ const WATCHER_TOOL_NAMES = new Set(["create_options_card"]);
const LOCAL_VM_TOOL_NAMES = new Set(["vm_exec"]);
/** Refused in a room's thread (routes/waits.ts), and list_waits, since a room holds no wait. */
-const ROOM_REFUSED_TOOL_NAMES = new Set([...WAIT_TOOL_NAMES, "burst"]);
+const ROOM_REFUSED_TOOL_NAMES = new Set([...WAIT_TOOL_NAMES, "burst", "rename_thread"]);
const CLOUD_HOME_SURFACE = {
type: "string", enum: ["auto", "cloud", "browser"],
description: "auto = suitable configured computer, cloud = the bot's cloud computer, browser = built-in browser. Omit to list. This server runs in the cloud: the user's own computer and a Local VM are not places here.",
diff --git a/server/drivers/agents-proxy.test.ts b/server/drivers/agents-proxy.test.ts
index dd18f69c4f..2b31072796 100644
--- a/server/drivers/agents-proxy.test.ts
+++ b/server/drivers/agents-proxy.test.ts
@@ -647,6 +647,7 @@ describe("agents-proxy MCP surface", () => {
"select_computer",
"list_threads",
"close_thread",
+ "rename_thread",
"start_thread",
"burst",
"list_models",
diff --git a/server/drivers/agents-thread-title-tool.ts b/server/drivers/agents-thread-title-tool.ts
new file mode 100644
index 0000000000..e3caae65f4
--- /dev/null
+++ b/server/drivers/agents-thread-title-tool.ts
@@ -0,0 +1,29 @@
+// The agents catalog's rename_thread tool: a bot names the thread it is working in. The internal route
+// (server/routes/internal-threads.ts) renames only that thread; a room's thread and an automation's chat keep their names.
+import type { Json } from "./agents-client.ts";
+import type { ToolCallContext, ToolCallResult } from "./agents-call.ts";
+
+export const RENAME_THREAD_TOOL = "rename_thread";
+
+export async function callRenameThreadTool(args: Json, context: ToolCallContext): Promise<ToolCallResult> {
+ const title = String(args.title ?? "").trim();
+ if (!title) return { text: "rename_thread needs title: one short line saying what this thread is about.", isError: true };
+ const r = await context.client.api("/api/internal/thread-title", {
+ method: "POST",
+ body: JSON.stringify({ fromBotId: context.botId, fromThreadId: context.threadId, title }),
+ });
+ if (r.error) return { text: `Couldn't rename this thread: ${String(r.error)}`, isError: true };
+ return { text: `Renamed this thread to #${String(r.title)} (it was #${String(r.previous)}).` };
+}
+
+export const RENAME_THREAD_TOOL_DEFINITION = {
+ name: RENAME_THREAD_TOOL,
+ description:
+ "Rename the thread you are in so the sidebar says what it is about (\"Acme: carousel design\"): when the person asks, or when the title is only the cut start of the first message. Never rename a thread the person named unless asked. Rooms and automation chats keep their names.",
+ inputSchema: {
+ type: "object",
+ additionalProperties: false,
+ properties: { title: { type: "string", description: "One short, specific line, at most 80 characters." } },
+ required: ["title"],
+ },
+};
diff --git a/server/index.ts b/server/index.ts
index 6f5d35afc4..45a590f736 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -13164,7 +13164,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
store, coordinator, from: internalSender, fromThreadId: internalCapability.threadId,
ownsThread: (botId, threadId) => Boolean(connectorThread(botId, threadId)),
shown: (id) => !proactive.fence.confines(id) && !botApiThread(id) && (CLOUD_TEAM ? teamHost.readableFrom(internalCapability.threadId)(id) : cloudLendingView(internalCapability) ? cloudOwnerOnlyThread(id) : true),
- threadBusy, queuedThreadPosition, queuedReason: queuedStatus,
+ threadBusy, queuedThreadPosition, queuedReason: queuedStatus, readBody: readInternalBody,
}), createToolTimingRoute(usageTrace, internalCapability.threadId)], { req, res, url, path, method, auth, json, readBody })) return;
if (method === "POST" && path === "/api/internal/attach-file") {
const from = internalSender;
diff --git a/server/routes/internal-threads.test.ts b/server/routes/internal-threads.test.ts
index ee9eabc044..0f4d8fd56b 100644
--- a/server/routes/internal-threads.test.ts
+++ b/server/routes/internal-threads.test.ts
@@ -20,6 +20,7 @@ async function listThreads(from: BotRecord) {
from, fromThreadId: "t-own", ownsThread: () => true, shown: () => true,
threadBusy: (_bot, threadId) => threadId === "t-ops-busy", queuedThreadPosition: () => null,
queuedReason: (node, showTitle) => `${node.id} waits${showTitle ? " (titles)" : ""}`,
+ readBody: async () => ({}),
});
let body: { threads: Array<Record<string, unknown>> } | undefined;
await route({ res: {}, path: "/api/internal/threads", method: "GET", json: (_res: unknown, _status: number, value: never) => { body = value; } } as never);
@@ -40,3 +41,47 @@ describe("list_threads on a queued handoff", () => {
expect(running).not.toHaveProperty("waiting");
});
});
+
+describe("rename_thread on the conversation the turn speaks in", () => {
+ async function rename(body: unknown, opts: { own?: TaskRecord; owns?: boolean } = {}) {
+ const own = opts.own ?? task("t-own", "Terminei o design e a skill de carrossel pra cl…");
+ const renamed: Array<[string, string, string]> = [];
+ const route = createInternalThreadRoutes({
+ store: {
+ bot: () => lead, bots: [lead, ops], tasks: () => [own],
+ taskByThread: (botId: string, threadId: string) => botId === lead.id && threadId === own.threadId ? own : undefined,
+ renameTask: (botId: string, threadId: string, title: string) => { renamed.push([botId, threadId, title]); return { ...own, title }; },
+ } as never,
+ coordinator: {} as never,
+ from: lead, fromThreadId: "t-own", ownsThread: () => opts.owns ?? true, shown: () => true,
+ threadBusy: () => false, queuedThreadPosition: () => null, queuedReason: () => "",
+ readBody: async () => body,
+ });
+ let status = 0;
+ let answer: Record<string, unknown> | undefined;
+ await route({ res: {}, path: "/api/internal/thread-title", method: "POST", json: (_res: unknown, code: number, value: never) => { status = code; answer = value; } } as never);
+ return { status, answer: answer!, renamed };
+ }
+
+ it("renames only its own current thread, trimmed to one line of at most 80 characters", async () => {
+ const { status, answer, renamed } = await rename({ title: ` ACME:\n carousel design ${"x".repeat(100)}` });
+ expect(status).toBe(200);
+ expect(renamed).toHaveLength(1);
+ expect(renamed[0]!.slice(0, 2)).toEqual(["bot-lead", "t-own"]);
+ expect(renamed[0]![2]).toMatch(/^ACME: carousel design x+$/);
+ expect(renamed[0]![2]).toHaveLength(80);
+ expect(answer).toMatchObject({ title: renamed[0]![2], previous: "Terminei o design e a skill de carrossel pra cl…" });
+ });
+
+ it("refuses an empty title, a conversation that is not the sender's, a room's thread and an automation's chat", async () => {
+ expect((await rename({ title: " " })).status).toBe(400);
+ expect((await rename({ title: "New name" }, { owns: false })).status).toBe(403);
+ const room = await rename({ title: "New name" }, { own: task("t-room", "Room thread") });
+ expect(room.status).toBe(404);
+ for (const own of [task("t-own", "Daily brief · Results"), { ...task("t-own", "Run"), routineRunId: "run-1" } as TaskRecord]) {
+ const refused = await rename({ title: "New name" }, { own });
+ expect(refused.status).toBe(409);
+ expect(refused.renamed).toEqual([]);
+ }
+ });
+});
diff --git a/server/routes/internal-threads.ts b/server/routes/internal-threads.ts
index f19538398c..11dba95c8c 100644
--- a/server/routes/internal-threads.ts
+++ b/server/routes/internal-threads.ts
@@ -1,7 +1,7 @@
import { chiefTidies } from "../chief-of-staff.ts";
import type { Coordinator, HandoffView } from "../coordinator.ts";
import { reachablePeers } from "../peer-roster.ts";
-import type { BotRecord, Store, TaskRecord } from "../store.ts";
+import { threadTitleFrom, type BotRecord, type Store, type TaskRecord } from "../store.ts";
import { PASS, type RouteHandler } from "./table.ts";
import { conversationLanguage, serverLine } from "../server-lines.ts";
@@ -18,7 +18,7 @@ interface ThreadRow {
/** Only dispatch inside the internal capability gate: `from` and `fromThreadId` come from the caller's capability. */
export function createInternalThreadRoutes(deps: {
- store: Pick<Store, "bot" | "bots" | "tasks" | "taskByThread" | "appendMessage" | "patchTask" | "setTaskClosedBy">;
+ store: Pick<Store, "bot" | "bots" | "tasks" | "taskByThread" | "appendMessage" | "patchTask" | "setTaskClosedBy" | "renameTask">;
coordinator: Pick<Coordinator, "awaitingAnswer" | "parkedDirect" | "activeDirect" | "active">;
from: BotRecord;
fromThreadId: string;
@@ -29,6 +29,8 @@ export function createInternalThreadRoutes(deps: {
queuedThreadPosition(botId: string, threadId: string): number | null;
/** `showTitle`: the caller is the receiver, so its own busy threads it may see can be named. */
queuedReason(node: HandoffView, showTitle?: (threadId: string) => boolean): string;
+ /** The caller's body, read only while its turn still holds the capability. */
+ readBody(): Promise<unknown>;
}): RouteHandler {
const { store, coordinator, from, fromThreadId } = deps;
return async ({ res, path, method, json }) => {
@@ -79,6 +81,25 @@ export function createInternalThreadRoutes(deps: {
rows.sort((a, b) => b.openedAt - a.openedAt);
return json(res, 200, { threads: rows.slice(0, 100) });
}
+ // rename_thread names only the conversation the turn speaks in. A room's thread is the room's, and an automation's
+ // chat keeps the name its runs find it by.
+ if (method === "POST" && path === "/api/internal/thread-title") {
+ if (!deps.ownsThread(from.id, fromThreadId)) {
+ return json(res, 403, { error: "source conversation does not belong to sender" });
+ }
+ const body = await deps.readBody() as { title?: unknown } | null;
+ const title = typeof body?.title === "string" ? body.title.replace(/\s+/g, " ").trim() : "";
+ if (!title) return json(res, 400, { error: "rename_thread needs a title: one short line" });
+ const task = store.taskByThread(from.id, fromThreadId);
+ if (!task) return json(res, 404, { error: "this conversation is not one of your own threads (a room's thread keeps the room's name)" });
+ if (task.routineRunId || task.title.endsWith(" · Results")) {
+ return json(res, 409, { error: `#${task.title} holds an automation's results and keeps its name` });
+ }
+ const previous = task.title;
+ const renamed = store.renameTask(from.id, fromThreadId, threadTitleFrom(title));
+ if (!renamed) return json(res, 404, { error: "this conversation is not one of your own threads" });
+ return json(res, 200, { renamed: true, title: renamed.title, previous });
+ }
// close_thread folds a thread, never deletes it (a person's confirmed action), and never while it runs.
const closeMatch = method === "POST" ? path.match(/^\/api\/internal\/threads\/([\w-]+)\/close$/) : null;
if (!closeMatch) return PASS;
diff --git a/src/locales/en.json b/src/locales/en.json
index 93c5e67a71..e5c34d6f80 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -9190,6 +9190,7 @@
"activity.tool.team.assignmentStatus": "Assignment status",
"activity.tool.team.attachFile": "Attach file",
"activity.tool.team.closeThread": "Close thread",
+ "activity.tool.team.renameThread": "Rename thread",
"activity.tool.team.coordinateBots": "Coordinate bots",
"activity.tool.team.createBot": "Create bot",
"activity.tool.team.createRoom": "Create room",