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:
@@ -0,0 +1,56 @@
|
||||
import { z } from "zod";
|
||||
import type { BUN_SQLITE_COBBLE_BOTS } from "@/db/types/db";
|
||||
import { AppData } from "@/src/data/app-data";
|
||||
import updateWorkspaceBot from "@/src/functions/backend/db/workspaces/update-workspace-bot";
|
||||
import type { HarnessTool } from "../../types";
|
||||
|
||||
type Params = {
|
||||
user_id: number | string;
|
||||
workspace_id: number | string;
|
||||
/**
|
||||
* The workspace's crew members (not the coordinator).
|
||||
*/
|
||||
workers: BUN_SQLITE_COBBLE_BOTS[];
|
||||
};
|
||||
|
||||
type Args = {
|
||||
bot_id: number;
|
||||
instructions: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lets the coordinator set a crew member's instructions for this
|
||||
* workspace: how that bot should do its job here.
|
||||
*/
|
||||
export default function setWorkspaceInstructionsTool({
|
||||
user_id,
|
||||
workspace_id,
|
||||
workers,
|
||||
}: Params): HarnessTool<Args> {
|
||||
const crew = workers.map((bot) => `${bot.id}: ${bot.name}`).join("; ");
|
||||
|
||||
return {
|
||||
name: "set_bot_workspace_instructions",
|
||||
description: `Replace a crew member's instructions for this workspace with this full text (markdown): how they should do their job here, on top of their own instructions. Use it when the user tells you how someone should work in this workspace. It replaces what they had for it, so keep what still applies. Crew here: ${crew}.`,
|
||||
schema: z.object({
|
||||
bot_id: z.number().int(),
|
||||
instructions: z.string().trim().max(AppData.PromptMaxLength),
|
||||
}),
|
||||
run: async ({ args }) => {
|
||||
const worker = workers.find((bot) => bot.id == args.bot_id);
|
||||
|
||||
if (!worker?.id) {
|
||||
throw new Error(`No crew member here has id ${args.bot_id}. Crew here: ${crew}.`);
|
||||
}
|
||||
|
||||
await updateWorkspaceBot({
|
||||
user_id,
|
||||
workspace_id,
|
||||
bot_id: worker.id,
|
||||
system_prompt: args.instructions,
|
||||
});
|
||||
|
||||
return `${worker.name}'s instructions for this workspace are saved. They apply from their next run here.`;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user