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:
@@ -1,41 +1,71 @@
|
||||
type WorkspacePrompt = {
|
||||
name?: string | null;
|
||||
description?: string | null;
|
||||
system_prompt?: string | null;
|
||||
};
|
||||
|
||||
type WorkspaceBotPrompt = {
|
||||
system_prompt?: string | null;
|
||||
memory?: string | null;
|
||||
};
|
||||
|
||||
type Params = {
|
||||
system_prompt?: string | null;
|
||||
memory?: string | null;
|
||||
workspaces?: WorkspacePrompt[];
|
||||
/**
|
||||
* The workspace the bot is working in, if any.
|
||||
*/
|
||||
workspace?: WorkspacePrompt | null;
|
||||
/**
|
||||
* The bot's own instructions and memory for that workspace.
|
||||
*/
|
||||
workspace_bot?: WorkspaceBotPrompt | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* The full prompt a bot runs with (markdown): its own core instructions,
|
||||
* then the shared context of each workspace it's in, then its memory.
|
||||
* Empty parts are left out.
|
||||
* then, in a workspace, the workspace's context and the bot's
|
||||
* instructions there, then its core memory and its memory there. Empty
|
||||
* parts are left out; the workspace heading always shows, so the bot
|
||||
* knows where it is.
|
||||
*/
|
||||
export default function composeBotPrompt({
|
||||
system_prompt,
|
||||
memory,
|
||||
workspaces = [],
|
||||
workspace,
|
||||
workspace_bot,
|
||||
}: Params) {
|
||||
const parts: string[] = [];
|
||||
const name = workspace?.name?.trim() || "Untitled";
|
||||
|
||||
if (system_prompt?.trim()) {
|
||||
parts.push(system_prompt.trim());
|
||||
}
|
||||
|
||||
for (const workspace of workspaces) {
|
||||
if (!workspace.system_prompt?.trim()) continue;
|
||||
|
||||
if (workspace) {
|
||||
parts.push(
|
||||
`# Workspace: ${workspace.name?.trim() || "Untitled"}\n\n${workspace.system_prompt.trim()}`,
|
||||
[
|
||||
`# Workspace: ${name}`,
|
||||
`You're working in the workspace "${name}". Follow its context and your instructions for it below, over your general habits where they differ.`,
|
||||
workspace.description?.trim() || "",
|
||||
workspace.system_prompt?.trim() || "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("\n\n"),
|
||||
);
|
||||
|
||||
if (workspace_bot?.system_prompt?.trim()) {
|
||||
parts.push(`# Your instructions in ${name}\n\n${workspace_bot.system_prompt.trim()}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (memory?.trim()) {
|
||||
parts.push(`# Memory\n\n${memory.trim()}`);
|
||||
}
|
||||
|
||||
if (workspace && workspace_bot?.memory?.trim()) {
|
||||
parts.push(`# Memory in ${name}\n\n${workspace_bot.memory.trim()}`);
|
||||
}
|
||||
|
||||
return parts.join("\n\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user