Name the workspace in a bot's task status line

A task running in a workspace shows "Working on a task in <name>
workspace", so the bot's own chat and the main rail say where the work
is. Outside a workspace it stays "Working on a task".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-27 19:22:25 +01:00
co-authored by Claude Opus 5.5
parent 864dcce30a
commit 96d3227bd0
5 changed files with 74 additions and 11 deletions
@@ -0,0 +1,20 @@
import BunSQLite from "@moduletrace/bun-sqlite";
type Params = {
workspace_id?: number | string | null;
};
/**
* A workspace's name as it is, without an access check, for copy the
* caller already decided to show. Null when there's none.
*/
export default async function grabWorkspaceName({ workspace_id }: Params): Promise<string | null> {
if (!workspace_id) return null;
const res = await BunSQLite.sql<{ name: string | null }>({
sql: `SELECT name FROM workspaces WHERE id = ? LIMIT 1`,
values: [Number(workspace_id)],
});
return res.payload?.[0]?.name || null;
}