Add workspaces, conversation sessions, app-managed computers and pictures
- Rail: Add icon with stacked form modals (bot, workspace, computer), coordinator, recent bots with "See all bots", Workspaces section, and a workspace mode listing only its crew - Workspaces: page for context, bots (per-workspace instructions and memory), computers (default, link, unlink), models and delete; conversations scoped per bot per workspace - Sessions: conversations split into searchable, reopenable sessions with carry-over summaries; sessions and new-session header icons - Computers: created and provisioned over the docker socket, home dir kept at DATA_DIR/computers/<id> after delete; super admins only - Models: workspace settings win over a bot's own, then the defaults - Pictures for bots and workspaces; bots editable from the header - Coordinator tools: update_workspace, set_bot_workspace_instructions Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -5,32 +5,31 @@ import resolveScopedEnvs from "./resolve-scoped-envs";
|
||||
type Params = {
|
||||
computer_id: number | string;
|
||||
/**
|
||||
* The bot using the computer. Only workspaces it shares with the
|
||||
* computer apply; without a bot, every workspace the computer is in.
|
||||
* The workspace the run is in. Its envs apply when the computer is
|
||||
* linked to it (and it isn't archived); outside a workspace only the
|
||||
* computer's own and general envs do.
|
||||
*/
|
||||
bot_id?: number | string;
|
||||
workspace_id?: number | string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* The envs a run on this computer gets (`resolveScopedEnvs`). Workspaces
|
||||
* are non-archived ones, oldest first, so the oldest wins a tie.
|
||||
* The envs a run on this computer gets (`resolveScopedEnvs`).
|
||||
*/
|
||||
export default async function grabComputerEnvs({ computer_id, bot_id }: Params) {
|
||||
const workspaces =
|
||||
(
|
||||
await BunSQLite.sql<{ id: number }>({
|
||||
sql: `SELECT w.id FROM workspaces w
|
||||
export default async function grabComputerEnvs({ computer_id, workspace_id }: Params) {
|
||||
const linked = workspace_id
|
||||
? (
|
||||
await BunSQLite.sql<{ id: number }>({
|
||||
sql: `SELECT w.id FROM workspaces w
|
||||
JOIN workspace_computers wc ON wc.workspace_id = w.id AND wc.computer_id = ?
|
||||
WHERE w.archived = 0
|
||||
${bot_id ? `AND w.id IN (SELECT workspace_id FROM workspace_bots WHERE bot_id = ?)` : ""}
|
||||
ORDER BY w.id ASC`,
|
||||
values: bot_id ? [computer_id, bot_id] : [computer_id],
|
||||
})
|
||||
).payload || [];
|
||||
WHERE w.id = ? AND w.archived = 0 LIMIT 1`,
|
||||
values: [computer_id, workspace_id],
|
||||
})
|
||||
).payload?.[0]
|
||||
: null;
|
||||
|
||||
return resolveScopedEnvs({
|
||||
envs: await grabAllEnvs(),
|
||||
computer_id: Number(computer_id),
|
||||
workspace_ids: workspaces.map((workspace) => Number(workspace.id)),
|
||||
workspace_ids: linked?.id ? [Number(linked.id)] : [],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user