Skip to content

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

#5681: make a Chief's every-department charge automatic, drop the setting

milind-soni6d2ff6f03c11
diff --git a/server/admin-activity.e2e.test.ts b/server/admin-activity.e2e.test.ts
index fe4ae53fc1..6c542b4502 100644
--- a/server/admin-activity.e2e.test.ts
+++ b/server/admin-activity.e2e.test.ts
@@ -243,6 +243,19 @@ posixOnly("admin activity log", () => {
].sort());
});
+ it("records a new department a Chief in charge of every department got, put down to the admin who made it", async () => {
+ const chief = (await api("POST", "/api/bots", { name: "Wide Heron" }, BOSS)).body.bot as { id: string };
+ expect((await api("PATCH", `/api/bots/${chief.id}`, { section: "Heron desk" }, BOSS)).status).toBe(200);
+ const others = ((await api("GET", "/api/sidebar-sections", undefined, BOSS)).body.sections as string[]).filter((name) => name !== "Heron desk");
+ const ticked = ["", ...others];
+ expect((await api("PATCH", `/api/bots/${chief.id}`, { chiefOfStaff: true, managedSections: ticked, acknowledgePeerScope: true }, BOSS)).status).toBe(200);
+ expect((await api("POST", "/api/sidebar-sections", { name: "Heron research", botIds: [] }, BOSS)).status).toBe(200);
+
+ const rows = (await activity("?what=bot")).filter((entry) => entry.action === "bot.update" && entry.target?.id === chief.id);
+ expect(rows[0]).toMatchObject({ who: BOSS, target: { kind: "bot", id: chief.id, name: "Wide Heron" }, changed: ["managedSections"],
+ before: { managedSections: ticked }, after: { managedSections: [...ticked, "Heron research"] } });
+ });
+
it("records only while the workspace is shared, including the change that ends or starts sharing", async () => {
expect((await api("PUT", "/api/config", { signIn: { admins: [BOSS], members: [] } }, BOSS)).status).toBe(200);
expect((await activity("?what=people"))[0]).toMatchObject({ who: BOSS, changed: ["signIn.members"] });
diff --git a/server/admin-activity.ts b/server/admin-activity.ts
index e6abbedd35..a223a961e4 100644
--- a/server/admin-activity.ts
+++ b/server/admin-activity.ts
@@ -225,7 +225,7 @@ export function configChangeRows(before: unknown, after: unknown): Array<Omit<Ad
/** What a bot may do, where, and who may see it; display fields (colour, unread, pins) are not audited. */
export const BOT_AUDIT_FIELDS = [
"approvalMode", "autoApprove", "alwaysAllow", "computer", "cloudBackend", "autoStartVps", "vpsAlias",
- "cwd", "composio", "browser", "browserProfile", "mcpServers", "chiefOfStaff", "managedSections", "managesAllSections", "section",
+ "cwd", "composio", "browser", "browserProfile", "mcpServers", "chiefOfStaff", "managedSections", "section",
"parkDirectMessages", "hidden", "modelSelection", "helperModel", "visibility",
] as const;
diff --git a/server/bot-overview.test.ts b/server/bot-overview.test.ts
index 1dd64a1bd3..56fa87682b 100644
--- a/server/bot-overview.test.ts
+++ b/server/bot-overview.test.ts
@@ -48,8 +48,9 @@ describe("buildBotOverview", () => {
});
it("says when a Chief is in charge of every department, only while it is the Chief", () => {
- const facts = baseFacts({ bot: { ...baseFacts().bot, chiefOfStaff: true, managesAllSections: true }, engine: { agentsMcp: true }, sectionPeers: 3 });
+ const facts = baseFacts({ bot: { ...baseFacts().bot, chiefOfStaff: true, managedSections: ["", "Research"] }, allDepartments: true, engine: { agentsMcp: true }, sectionPeers: 3 });
expect(buildBotOverview(facts).reaches).toContain("In charge of every department, including new ones.");
+ expect(buildBotOverview(facts).reaches.join(" ")).not.toContain("Also in charge of these departments");
facts.bot.chiefOfStaff = false;
expect(buildBotOverview(facts).reaches.join(" ")).not.toContain("every department, including new ones");
});
diff --git a/server/bot-overview.ts b/server/bot-overview.ts
index c552ba90f6..cd74badee3 100644
--- a/server/bot-overview.ts
+++ b/server/bot-overview.ts
@@ -59,8 +59,9 @@ export interface OverviewFacts {
| "browser"
| "chiefOfStaff"
| "managedSections"
- | "managesAllSections"
>;
+ /** A Chief in charge of every department, which therefore also gets each new one (server/department-grants.ts). */
+ allDepartments?: boolean;
routines: Array<{
id: string;
name: string;
@@ -245,7 +246,7 @@ function reachesLines(facts: OverviewFacts): string[] {
const peers = facts.sectionPeers;
if (facts.engine?.agentsMcp && peers > 0) lines.push(peers === 1 ? "Can talk to the other bot." : `Can talk to all ${peers} other bots, in any department.`);
if (facts.bot.chiefOfStaff) lines.push("Coordinates its department as Chief of Staff.");
- if (facts.bot.chiefOfStaff && facts.bot.managesAllSections === true) lines.push("In charge of every department, including new ones.");
+ if (facts.bot.chiefOfStaff && facts.allDepartments) lines.push("In charge of every department, including new ones.");
else if (facts.bot.chiefOfStaff && facts.bot.managedSections?.length) {
lines.push(`Also in charge of these departments: ${facts.bot.managedSections.map(name => name || "General").join(", ")}.`);
}
diff --git a/server/chief-of-staff.test.ts b/server/chief-of-staff.test.ts
index f4f2601106..f410288e93 100644
--- a/server/chief-of-staff.test.ts
+++ b/server/chief-of-staff.test.ts
@@ -86,15 +86,19 @@ describe("chiefOfStaffSystemPrompt", () => {
expect(prompt).toContain("structured result");
});
- it("puts every department's bots on the team of a Chief responsible for all of them", () => {
- const everywhere = bots.map(bot => bot.id === "chief" ? { ...bot, chiefOfStaff: true, managesAllSections: true } : bot);
- const prompt = chiefOfStaffSystemPrompt("chief", everywhere, true);
- expect(prompt).toContain("The owner also made you responsible for every department, including ones added later.");
+ it("puts every department's bots on the team of a Chief in charge of all of them, and says new ones join", () => {
+ const everywhere = bots.map(bot => bot.id === "chief" ? { ...bot, chiefOfStaff: true, managedSections: ["", "Personal"] } : bot);
+ const prompt = chiefOfStaffSystemPrompt("chief", everywhere, true, undefined, ["Work", "Personal"]);
+ expect(prompt).toContain("The owner also made you responsible for every department, and each new department becomes yours as it is added.");
expect(prompt).toContain("Reaching a bot outside your team gives you no authority over it");
expect(prompt).not.toContain("Reaching a bot gives you no authority over it");
expect(prompt).toMatch(/Your team, in every department:\n(?:- .*\n)*- Scout — Travel planner \(Personal\) \[id: personal\]/);
expect(prompt).not.toContain("Other bots you can reach, in other departments:");
- expect(chiefOfStaffSystemPrompt("chief", bots, true)).not.toContain("every department");
+ // A department it was not ticked for: the list it has, no promise about new ones.
+ const some = chiefOfStaffSystemPrompt("chief", everywhere, true, undefined, ["Work", "Personal", "Legal"]);
+ expect(some).toContain("The owner also made you responsible for these departments: General, Personal.");
+ expect(some).not.toContain("every department");
+ expect(chiefOfStaffSystemPrompt("chief", bots, true, undefined, ["Work", "Personal"])).not.toContain("every department");
});
it("is the person's assistant, does the work itself and adds a specialist without asking", () => {
diff --git a/server/chief-of-staff.ts b/server/chief-of-staff.ts
index aa65dfbdbe..05789d4e7c 100644
--- a/server/chief-of-staff.ts
+++ b/server/chief-of-staff.ts
@@ -1,5 +1,5 @@
import { botOwner, nameFromEmail } from "../shared/bot-owner.ts";
-import { canManage, hasAuthority, peerName, renderRoster, reachablePeers, type RosterMember } from "./peer-roster.ts"; import { chiefLevel } from "./chief-level.ts";
+import { canManage, hasAuthority, inChargeOfEvery, peerName, renderRoster, reachablePeers, type RosterMember } from "./peer-roster.ts"; import { chiefLevel } from "./chief-level.ts";
import type { TaskRecord } from "./store.ts";
export type ChiefTeamMember = RosterMember;
@@ -32,6 +32,7 @@ export function chiefOfStaffSystemPrompt(
bots: ChiefTeamMember[],
canDelegate: boolean,
also?: (bot: ChiefTeamMember) => boolean,
+ departments?: readonly string[],
): string {
const chief = bots.find((bot) => bot.id === chiefId);
const chiefSection = sectionKey(chief?.section);
@@ -59,7 +60,8 @@ export function chiefOfStaffSystemPrompt(
: "Your current engine cannot contact teammates. Be honest about that limitation and ask the user to choose a delegation-compatible engine before promising coordinated work.";
const isChief = !chief?.defaultBot || chief.chiefOfStaff === true;
- const responsibleFor = chief?.managesAllSections === true ? "every department, including ones added later"
+ const everywhere = Boolean(chief && departments && inChargeOfEvery(chief, departments));
+ const responsibleFor = everywhere ? "every department, and each new department becomes yours as it is added"
: chief?.managedSections?.length ? `these departments: ${chief.managedSections.map(s => peerName(s) || "General").join(", ")}` : "";
return [
isChief
@@ -83,7 +85,7 @@ export function chiefOfStaffSystemPrompt(
delegation,
canDelegate ? "Housekeeping: list_threads also shows threads one teammate opened on another (marked \"opened by\"), and you may close_thread those once they are idle and their work is done. Threads the person started are theirs: never close them." : "",
canDelegate ? "When the user asks you to assemble or configure a team, use list_team_setup for the exact authorized teams, bot IDs and model catalog, then propose_team_setup once with all named specialists and their profile/model changes. Include new teams explicitly; the plan covers their creation and your access. Existing thread models and other bots' execution permissions stay unchanged. Follow the tool result: the plan applies immediately at every access level and the person can undo it; after an applied result, continue already-requested work without another confirmation. Only if review is pending, end your turn: the user's decision automatically resumes you once with a structured result. Report failed or cancelled results honestly. Do not ask for another yes, poll, or repeat the proposal. After successful setup, use the available coordination tools for already requested work. For explicitly requested bot deletion, use propose_bot_deletion separately and follow its applied or pending result too." : "",
- person ? `Bots that report to ${person} (your team):` : chief?.managesAllSections === true ? "Your team, in every department:" : chief?.managedSections?.length ? "Your team, in the departments you are responsible for:" : `Current ${sectionName} department (your team):`,
+ person ? `Bots that report to ${person} (your team):` : everywhere ? "Your team, in every department:" : chief?.managedSections?.length ? "Your team, in the departments you are responsible for:" : `Current ${sectionName} department (your team):`,
roster,
othersRoster && (person ? "Other bots you can reach (they report to someone else):" : "Other bots you can reach, in other departments:"),
othersRoster,
diff --git a/server/department-grants.ts b/server/department-grants.ts
new file mode 100644
index 0000000000..1799582e88
--- /dev/null
+++ b/server/department-grants.ts
@@ -0,0 +1,36 @@
+// A Chief already in charge of every department gets each new department too, added to its managedSections the way the
+// owner's tick under "Also in charge of" adds one: the same store write, the same bot update every client sees, and a
+// bot.update row in the admin activity log for the request that made the department. A Chief in charge of only some
+// departments gets nothing, and the owner can untick any department afterwards. Chiefs someone owns on a Team Cloud are
+// never counted (inChargeOfEvery), so this never widens what a member's Chief can reach.
+import { AsyncLocalStorage } from "node:async_hooks";
+
+import { inChargeOfEvery } from "./peer-roster.ts";
+import type { Store } from "./store.ts";
+
+export interface DepartmentGrant { id: string; name: string; before: string[]; after: string[] }
+
+/** What one request's new departments gave which Chiefs, for that request's admin activity rows (server/index.ts). */
+export const departmentGrants = new AsyncLocalStorage<DepartmentGrant[]>();
+
+/** The settings page saves at most this many departments for one Chief (server/routes/bot-patch.ts). */
+const MAX_MANAGED = 100;
+
+/** `added` just joined the departments. The grant waits until the store's current write is done, which may still be
+ * saving a copy of the bots. */
+export function grantNewDepartments(store: Pick<Store, "sections" | "bots" | "patchBot">, added: readonly string[]): void {
+ const before = store.sections.filter((name) => !added.includes(name));
+ void Promise.resolve().then(() => {
+ for (const chief of store.bots.filter((bot) => inChargeOfEvery(bot, before))) {
+ const previous = [...chief.managedSections!];
+ const managedSections = [...new Set([...previous, ...added])];
+ if (managedSections.length === previous.length || managedSections.length > MAX_MANAGED) continue;
+ try {
+ store.patchBot(chief.id, { managedSections });
+ departmentGrants.getStore()?.push({ id: chief.id, name: chief.name, before: previous, after: managedSections });
+ } catch (error) {
+ console.warn(`[teams] Could not add the new department to ${chief.name}: ${(error as Error).message}`);
+ }
+ }
+ });
+}
diff --git a/server/incidents.ts b/server/incidents.ts
index 81bb25c588..6bf38ecac2 100644
--- a/server/incidents.ts
+++ b/server/incidents.ts
@@ -13,7 +13,6 @@ export interface IncidentBot {
section?: string;
chiefOfStaff?: boolean;
managedSections?: string[];
- managesAllSections?: boolean;
createdBy?: string;
reportsTo?: string;
hidden?: boolean;
diff --git a/server/index.test.ts b/server/index.test.ts
index c7c1c57e7e..46ed390e87 100644
--- a/server/index.test.ts
+++ b/server/index.test.ts
@@ -4940,26 +4940,47 @@ describe("harness HTTP API", () => {
body: { error: "Confirm additional department access (acknowledgePeerScope)", errorKey: "serverError.department.confirmExtra" } });
});
- it("makes only a confirmed Chief responsible for every department and revokes it with the role", async () => {
- const bot = (await api("POST", "/api/bots")).body.bot;
+ it("gives a Chief in charge of every department each new one, live, and nothing to a Chief in charge of only some", async () => {
+ const whole = (await api("POST", "/api/bots")).body.bot;
+ const partial = (await api("POST", "/api/bots")).body.bot;
+ const made: string[] = [];
+ const department = async (name: string) => {
+ made.push(name);
+ expect((await api("POST", "/api/sidebar-sections", { name, botIds: [] })).status).toBe(200);
+ };
+ const managed = async (id: string) => ((await api("GET", "/api/bots?messages=0")).body.bots
+ .find((entry: { id: string }) => entry.id === id).managedSections ?? []) as string[];
try {
- await api("PATCH", `/api/bots/${bot.id}`, { section: "All departments fixture" });
- expect(await api("PATCH", `/api/bots/${bot.id}`, { managesAllSections: true, acknowledgePeerScope: true }))
- .toMatchObject({ status: 400, body: { errorKey: "serverError.department.chiefResponsibility" } });
- expect(await api("PATCH", `/api/bots/${bot.id}`, { chiefOfStaff: true, managesAllSections: "yes", acknowledgePeerScope: true }))
- .toMatchObject({ status: 400 });
- expect(await api("PATCH", `/api/bots/${bot.id}`, { chiefOfStaff: true, managesAllSections: true }))
- .toMatchObject({ status: 400, body: { errorKey: "serverError.department.confirmResponsibility" } });
- const listed = async () => (await api("GET", "/api/bots")).body.bots.find((entry: { id: string }) => entry.id === bot.id);
- expect(Boolean((await listed()).chiefOfStaff)).toBe(false);
- expect((await api("PATCH", `/api/bots/${bot.id}`, { chiefOfStaff: true, managesAllSections: true, acknowledgePeerScope: true })).status).toBe(200);
- expect(await listed()).toMatchObject({ chiefOfStaff: true, managesAllSections: true });
- expect((await api("PATCH", `/api/bots/${bot.id}`, { chiefOfStaff: false })).status).toBe(200);
- expect(Boolean((await listed()).managesAllSections)).toBe(false);
- expect(await api("PATCH", `/api/bots/${bot.id}`, { managesAllSections: true, acknowledgePeerScope: true }))
- .toMatchObject({ status: 400, body: { errorKey: "serverError.department.chiefResponsibility" } });
+ await department("Whole fixture");
+ await department("Partial fixture");
+ for (const [bot, section] of [[whole, "Whole fixture"], [partial, "Partial fixture"]] as const) {
+ expect((await api("PATCH", `/api/bots/${bot.id}`, { section })).status).toBe(200);
+ }
+ const others = ((await api("GET", "/api/sidebar-sections")).body.sections as string[]).filter((name) => name !== "Whole fixture");
+ expect((await api("PATCH", `/api/bots/${whole.id}`, { chiefOfStaff: true, managedSections: ["", ...others], acknowledgePeerScope: true })).status).toBe(200);
+ expect((await api("PATCH", `/api/bots/${partial.id}`, { chiefOfStaff: true, managedSections: [""], acknowledgePeerScope: true })).status).toBe(200);
+
+ const stream = await openSse(`${BASE}/api/events`);
+ try {
+ await stream.until((frame) => frame.kind === "hello");
+ await department("New fixture A");
+ const frame = await stream.until((candidate) => candidate.kind === "bot" && candidate.bot?.id === whole.id &&
+ Boolean(candidate.bot.managedSections?.includes("New fixture A")));
+ expect(frame.bot.chiefOfStaff).toBe(true);
+ } finally {
+ stream.close();
+ }
+ expect(await managed(whole.id)).toEqual(["", ...others, "New fixture A"]);
+ expect(await managed(partial.id)).toEqual([""]);
+
+ // The owner can still untick it, and a Chief no longer in charge of every department gets no new one.
+ expect((await api("PATCH", `/api/bots/${whole.id}`, { managedSections: ["", ...others] })).status).toBe(200);
+ await department("New fixture B");
+ expect(await managed(whole.id)).toEqual(["", ...others]);
+ expect(await managed(partial.id)).toEqual([""]);
} finally {
- await api("DELETE", `/api/bots/${bot.id}`);
+ for (const bot of [whole, partial]) await api("DELETE", `/api/bots/${bot.id}`);
+ for (const name of made) await api("DELETE", `/api/sidebar-sections?section=${encodeURIComponent(name)}`);
}
});
diff --git a/server/index.ts b/server/index.ts
index 0257ba990b..ec12640983 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -128,7 +128,7 @@ import { createSideJobs, helperSelection } from "./side-jobs.ts";
import type { CaptureTurn, RoomLine } from "./memory-capture.ts";
import { createAboutMe } from "./about-me.ts"; import { createPersonPreference } from "./host/person-preference.ts";
import { botMemoryUpdate, ownersOwnAsk } from "./memory-forget.ts";
-import { canManage, canReach, departmentRefusal, hasTeamAuthority, livePeerRoster, livePeerRosterBlock, peerName, peerRosterSystemPrompt, peerStatus, peerStatusWords, reachablePeers, resolveTeammate, roomPeerRosterSystemPrompt, roomRosterLine } from "./peer-roster.ts"; import { roomPostRefusal, sharedNamesNote, unreachedMentionLines } from "./same-name-mentions.ts";
+import { canManage, canReach, departmentRefusal, hasTeamAuthority, inChargeOfEvery, livePeerRoster, livePeerRosterBlock, peerName, peerRosterSystemPrompt, peerStatus, peerStatusWords, reachablePeers, resolveTeammate, roomPeerRosterSystemPrompt, roomRosterLine } from "./peer-roster.ts"; import { roomPostRefusal, sharedNamesNote, unreachedMentionLines } from "./same-name-mentions.ts";
import {
containerComputerAction,
containerComputerFrame,
@@ -193,7 +193,7 @@ import { GroupUsageReader } from "./group-thread-usage.ts";
import { ledgerCost } from "./model-prices.ts";
import type { PriceList } from "./prices.ts";
import type { RequestAuth } from "./request-auth.ts";
-import { adminAuditPlan, type AuditPlan } from "./admin-audit-plan.ts";
+import { adminAuditPlan, type AuditPlan } from "./admin-audit-plan.ts"; import { departmentGrants, type DepartmentGrant } from "./department-grants.ts";
import { onKeyRejectionChange } from "./key-rejections.ts";
import { assertWithinBudget, noteSpend, spendAlertText, spendState, takeSpendAlert } from "./spend.ts";
import { fleetAvailable, fleetSocketPath } from "./fleet-client.ts";
@@ -1263,7 +1263,7 @@ function requestedBotFields(req: IncomingMessage, path: string): string[] {
if (!body || typeof body !== "object" || Array.isArray(body)) return [];
const fields = new Set(Object.keys(body));
if (fields.has("autoApprove") || fields.has("approvalMode")) fields.add("autoApprove").add("approvalMode");
- if (fields.has("chiefOfStaff")) fields.add("managedSections").add("managesAllSections");
+ if (fields.has("chiefOfStaff")) fields.add("managedSections");
return [...fields];
}
@@ -1273,14 +1273,14 @@ function beginAdminAudit(req: IncomingMessage, res: ServerResponse, method: stri
const actor = plan ? adminActorFor(auth, req) : null;
const sharedAtStart = plan ? adminActivityRecording() : false;
// Set for every request, so a kept-alive connection never inherits one.
- adminActorScope.enterWith(plan?.config && actor ? { actor, sharedAtStart } : null);
+ adminActorScope.enterWith(plan?.config && actor ? { actor, sharedAtStart } : null); const granted: DepartmentGrant[] = []; departmentGrants.enterWith(granted);
if (!plan || !actor || store.bot(plan.botId ?? plan.deletesBot ?? "")?.defaultBot?.person) return; // a person's own MausBot is not the team's: what they do with it is never an admin's to read
const before = {
bot: auditBot(plan.botId ?? plan.deletesBot),
botName: store.bot(plan.botId ?? plan.deletesBot ?? "")?.name,
hook: auditHook(plan.webhookId),
session: plan.sessionId ? sessions.list().find((session) => session.id === plan.sessionId) : undefined,
- roomFloor: plan.roomId ? store.group(plan.roomId)?.audienceFloor ?? "everyone" : undefined,
+ roomFloor: plan.roomId ? store.group(plan.roomId)?.audienceFloor ?? "everyone" : undefined, granted,
};
let answered: unknown;
if (plan.createsBots || plan.createsWebhook || plan.pairing) onJsonBody(res, (body) => (answered = body));
@@ -1298,15 +1298,15 @@ function adminAuditRows(
plan: AuditPlan,
req: IncomingMessage,
path: string,
- before: { bot: Record<string, unknown> | null; botName?: string; hook?: WebhookTrigger; session?: ReturnType<typeof sessions.list>[number]; roomFloor?: unknown },
+ before: { bot: Record<string, unknown> | null; botName?: string; hook?: WebhookTrigger; session?: ReturnType<typeof sessions.list>[number]; roomFloor?: unknown; granted: DepartmentGrant[] },
answered: unknown,
): Array<Omit<AdminActionRow, "at" | "actor">> {
const rows: Array<Omit<AdminActionRow, "at" | "actor">> = [];
const reply = answered && typeof answered === "object" ? answered as Record<string, unknown> : {};
const idOf = (value: unknown) => (value && typeof value === "object" && typeof (value as { id?: unknown }).id === "string" ? (value as { id: string }).id : undefined);
- if (plan.botId) {
- rows.push(...botChangeRows({ id: plan.botId, name: store.bot(plan.botId)?.name }, before.bot, auditBot(plan.botId), requestedBotFields(req, path), BOT_AUDITED));
- }
+ if (plan.botId) rows.push(...botChangeRows({ id: plan.botId, name: store.bot(plan.botId)?.name }, before.bot, auditBot(plan.botId), requestedBotFields(req, path), BOT_AUDITED));
+ // A new department this request made, added to a Chief in charge of every department (server/department-grants.ts).
+ for (const grant of before.granted) rows.push(...botChangeRows(grant, { managedSections: grant.before }, { managedSections: grant.after }, ["managedSections"], BOT_AUDITED));
if (plan.createsBots) {
const created = [idOf(reply.bot), ...(Array.isArray(reply.bots) ? reply.bots.map(idOf) : [])].filter((id): id is string => Boolean(id));
for (const id of new Set(created)) {
@@ -2953,7 +2953,7 @@ function previewSystemPrompt(bot: BotRecord) {
});
const peers = reachablePeers(store.bots, bot);
const coordination = chiefLevel(bot)
- ? chiefOfStaffSystemPrompt(bot.id, store.bots, true)
+ ? chiefOfStaffSystemPrompt(bot.id, store.bots, true, undefined, store.sections)
: peers.length > 0
? peerRosterSystemPrompt(peers, bot)
: "";
@@ -3035,7 +3035,7 @@ async function botOverview(bot: BotRecord, shown: { routine(routine: Routine): b
connectorTools: bot.connectorTools,
browser: bot.browser,
chiefOfStaff: bot.chiefOfStaff,
- managedSections: bot.managedSections, managesAllSections: bot.managesAllSections,
+ managedSections: bot.managedSections,
},
routines: routines!.listRoutines()
.filter((routine) => routine.botId === bot.id && shown.routine(routine))
@@ -3067,7 +3067,7 @@ async function botOverview(bot: BotRecord, shown: { routine(routine: Routine): b
browserEnabled: builtInBrowserEnabled(cfg),
cloudHome: Boolean(CLOUD_HOME),
connectedApps,
- sectionPeers,
+ sectionPeers, allDepartments: inChargeOfEvery(bot, store.sections),
timeZone,
recent,
});
@@ -8268,7 +8268,7 @@ async function beginTurn(
store.bots.filter((one) => !one.hidden).map((one) => one.name)), sectionPeers, opts?.mentions)
: [];
const coordinationPrompt = (chiefLevel(bot)
- ? chiefOfStaffSystemPrompt(bot.id, store.bots, Boolean(integrations.agents), (peer) => personalReach.listed(bot, peer, threadId))
+ ? chiefOfStaffSystemPrompt(bot.id, store.bots, Boolean(integrations.agents), (peer) => personalReach.listed(bot, peer, threadId), store.sections)
: integrations.agents && sectionPeers.length > 0
? peerRosterSystemPrompt(sectionPeers, bot)
: "") + (integrations.agents ? personalReach.prompt(bot, threadId, sectionPeers) : "");
diff --git a/server/peer-roster.test.ts b/server/peer-roster.test.ts
index 76bad1cbaf..c081548fa3 100644
--- a/server/peer-roster.test.ts
+++ b/server/peer-roster.test.ts
@@ -6,6 +6,7 @@ import {
departmentRefusal,
hasAuthority,
hasTeamAuthority,
+ inChargeOfEvery,
PEER_ACCESS_HELP,
LIVE_PEER_ROSTER_MAX,
livePeerRoster,
@@ -102,15 +103,17 @@ describe("Chief authority over additional departments", () => {
expect(hasTeamAuthority({ ...chief, managedSections: [null] as unknown as string[] }, "Personal")).toBe(false);
expect(hasTeamAuthority({ ...chief, managedSections: [""] }, undefined)).toBe(true);
});
- it("gives a Chief made responsible for every department authority there, including new ones, and nobody else", () => {
- const everywhere = { ...self, chiefOfStaff: true, managesAllSections: true };
- expect(hasTeamAuthority(everywhere, "Finance")).toBe(true);
- expect(hasTeamAuthority(everywhere, "A department added later")).toBe(true);
- expect(hasAuthority(everywhere, fleet[4]!)).toBe(true);
- expect(hasAuthority(fleet[4]!, everywhere)).toBe(false);
- expect(hasTeamAuthority({ ...everywhere, chiefOfStaff: false }, "Finance")).toBe(false);
- expect(hasTeamAuthority({ ...everywhere, managesAllSections: false }, "Finance")).toBe(false);
- expect(hasTeamAuthority({ ...everywhere, managesAllSections: "true" as unknown as boolean }, "Finance")).toBe(false);
+ it("counts a Chief in charge of every department only when the owner ticked each one, General included", () => {
+ const everywhere = { ...self, chiefOfStaff: true, managedSections: ["", "Personal", "Finance"] };
+ expect(inChargeOfEvery(everywhere, ["Work", "Personal", "Finance"])).toBe(true);
+ expect(inChargeOfEvery(everywhere, ["Work", "Personal", "Finance", "Legal"])).toBe(false);
+ expect(inChargeOfEvery({ ...everywhere, managedSections: ["Personal", "Finance"] }, ["Work", "Personal", "Finance"])).toBe(false);
+ expect(inChargeOfEvery({ ...everywhere, chiefOfStaff: false }, ["Work", "Personal", "Finance"])).toBe(false);
+ expect(inChargeOfEvery({ ...everywhere, managedSections: ["", "Personal", 7 as unknown as string] }, ["Work", "Personal", "Finance"])).toBe(false);
+ // With nothing to tick yet, the owner has not put it in charge of anything beyond its own department.
+ expect(inChargeOfEvery({ id: "c", name: "C", chiefOfStaff: true }, [])).toBe(false);
+ // A member's own Chief on a Team Cloud answers for its person's bots, never for departments.
+ expect(inChargeOfEvery({ ...everywhere, createdBy: "[email protected]" }, ["Work", "Personal", "Finance"])).toBe(false);
});
});
diff --git a/server/peer-roster.ts b/server/peer-roster.ts
index c75bd744ee..d7a6948649 100644
--- a/server/peer-roster.ts
+++ b/server/peer-roster.ts
@@ -12,7 +12,6 @@ export interface RosterMember extends Pick<DefaultBotFields, "defaultBot"> {
section?: string;
chiefOfStaff?: boolean;
managedSections?: string[];
- managesAllSections?: boolean;
createdBy?: string;
reportsTo?: string;
activity?: BotActivity;
@@ -28,16 +27,26 @@ export const PEER_ACCESS_HELP = "Every bot can reach every other bot, in any dep
/** A title, peer id, imported persona or room membership is not a grant; invalid saved grants fail closed. */
export function hasTeamAuthority(
- from: Pick<RosterMember, "section" | "chiefOfStaff" | "managedSections" | "managesAllSections">,
+ from: Pick<RosterMember, "section" | "chiefOfStaff" | "managedSections">,
section?: string,
): boolean {
const target = sectionKey(section);
- if (from.chiefOfStaff === true && from.managesAllSections === true) return true;
return target === sectionKey(from.section) || Boolean(from.chiefOfStaff &&
Array.isArray(from.managedSections) && from.managedSections.some(value =>
typeof value === "string" && sectionKey(value) === target));
}
+/** A Chief the owner put in charge of every department there is (General and each one ticked under "Also in charge of"),
+ * which is why it also gets each new one (server/department-grants.ts). Never a Chief someone owns on a Team Cloud: it
+ * answers for its person's bots, not for departments. */
+export function inChargeOfEvery(
+ bot: Pick<RosterMember, "section" | "chiefOfStaff" | "managedSections" | "createdBy" | "reportsTo" | "defaultBot">,
+ departments: readonly string[],
+): boolean {
+ if (bot.chiefOfStaff !== true || botOwner(bot) || !Array.isArray(bot.managedSections) || !bot.managedSections.length) return false;
+ return ["", ...departments].every(name => hasTeamAuthority(bot, name));
+}
+
/** What widens `bot`'s departments, so a refused Chief can tell the person the one step instead of guessing. Only a
* Chief of Staff's grants count (hasTeamAuthority), and only the person can change them. */
export function managedDepartmentsHelp(bot: Pick<RosterMember, "name" | "chiefOfStaff">): string {
diff --git a/server/request-auth.test.ts b/server/request-auth.test.ts
index 0db70acede..fd96910081 100644
--- a/server/request-auth.test.ts
+++ b/server/request-auth.test.ts
@@ -237,7 +237,7 @@ describe("scopes", () => {
it("lets a bot's maker without the admin scope say who it is and how it looks, never what it may do or whom it directs", () => {
const profile = { name: "Scout", title: "Trips", soul: "Plans trips.", color: "teal", avatarCrop: "square", voice: "alloy", modelSelection: { instanceId: "claude", model: "m" } };
expect(adminOnlyBotSetting(profile)).toBeNull();
- for (const field of ["approvalMode", "autoApprove", "alwaysAllow", "chiefOfStaff", "managedSections", "managesAllSections", "computer", "cwd",
+ for (const field of ["approvalMode", "autoApprove", "alwaysAllow", "chiefOfStaff", "managedSections", "computer", "cwd",
"mcpServers", "browserProfile", "toolScope", "composio", "browser", "section", "visibility", "reportsTo", "preset", "defaultBot", "installedPackage"]) {
expect(adminOnlyBotSetting({ ...profile, [field]: true }), field).toBe(field);
expect(botProfileSettings({ ...profile, [field]: true }), field).toEqual(profile);
diff --git a/server/routes/bot-patch.ts b/server/routes/bot-patch.ts
index d2ddc2e58f..6791a72ee7 100644
--- a/server/routes/bot-patch.ts
+++ b/server/routes/bot-patch.ts
@@ -546,7 +546,6 @@ export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {
error: "Auto mode on this computer requires confirming the warning first (acknowledgeLocalAuto)",
});
}
- const staysChief = body.chiefOfStaff === true || Boolean(existingBot?.chiefOfStaff && body.chiefOfStaff !== false);
if (body.managedSections !== undefined) {
const parsed = z.array(z.string().trim().max(60)).max(100).safeParse(body.managedSections);
if (!parsed.success) return json(res, 400, { error: "managedSections must be a list of up to 100 department names (60 characters each)" });
@@ -555,7 +554,7 @@ export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {
if (newSections.some(section => section !== "" && !store.sections.includes(section))) {
return json(res, 400, userError("serverError.department.createFirst"));
}
- if (sections.length && !staysChief) {
+ if (sections.length && !(body.chiefOfStaff === true || (existingBot?.chiefOfStaff && body.chiefOfStaff !== false))) {
return json(res, 400, userError("serverError.department.chiefResponsibility"));
}
if (newSections.length && body.acknowledgePeerScope !== true) {
@@ -563,18 +562,8 @@ export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {
}
patch.managedSections = sections;
}
- if (body.managesAllSections !== undefined) {
- if (typeof body.managesAllSections !== "boolean") return json(res, 400, { error: "managesAllSections must be true or false" });
- if (body.managesAllSections && !staysChief) {
- return json(res, 400, userError("serverError.department.chiefResponsibility"));
- }
- if (body.managesAllSections && existingBot?.managesAllSections !== true && body.acknowledgePeerScope !== true) {
- return json(res, 400, userError("serverError.department.confirmResponsibility"));
- }
- patch.managesAllSections = body.managesAllSections;
- }
// Losing the role revokes its grants: no dormant authority returns if it is elected again.
- if (body.chiefOfStaff === false) { patch.managedSections = []; patch.managesAllSections = false; }
+ if (body.chiefOfStaff === false) patch.managedSections = [];
// "everyone" (default), "admins" or { people: [...] }; members' PATCHes never get here.
if (Object.hasOwn(body, "visibility")) {
const parsed = parseVisibility(body.visibility);
@@ -607,9 +596,8 @@ export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {
if (Array.isArray(patch.managedSections) && patch.managedSections.some(section => !(existingBot?.managedSections ?? []).includes(section))) {
loosened.push("managedSections");
}
- if (patch.managesAllSections === true && existingBot?.managesAllSections !== true) loosened.push("managesAllSections");
// A shell can forge an Origin header: new cross-team authority from local scripts only while every bot is idle.
- if ((loosened.includes("managedSections") || loosened.includes("managesAllSections")) && auth.kind === "loopback" && !DESKTOP_MANAGED && store.bots.some(bot => bot.busy)) {
+ if (loosened.includes("managedSections") && auth.kind === "loopback" && !DESKTOP_MANAGED && store.bots.some(bot => bot.busy)) {
return json(res, 409, userError("serverError.department.stopBots"));
}
if (section !== undefined && sectionKey(existingBot?.section) !== sectionKey(section)) loosened.push("section");
@@ -648,10 +636,6 @@ export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {
section !== undefined &&
sectionKey(existingBot?.section) !== sectionKey(section);
let bot: BotRecord | null;
- // Rechecked: a turn can start during the awaits above, and nothing awaits between here and the write.
- if ((loosened.includes("managedSections") || loosened.includes("managesAllSections")) && auth.kind === "loopback" && !DESKTOP_MANAGED && store.bots.some(bot => bot.busy)) {
- return json(res, 409, userError("serverError.department.stopBots"));
- }
const freshBrowserBot = store.bot(m[1]);
// Rechecked: the awaits above can yield after the first memory check.
if (freshBrowserBot && body.memoryEnabled !== undefined &&
diff --git a/server/section-context.ts b/server/section-context.ts
index 483060dc7f..482c8a21f1 100644
--- a/server/section-context.ts
+++ b/server/section-context.ts
@@ -96,13 +96,14 @@ export function ensureSectionMemoryKey(section?: string | null): string {
}
return data.memoryKeys[name] ?? name;
}
-export function ensureSections(names: (string | undefined)[]): boolean {
+/** Registers any of `names` that are not departments yet; the ones it added. */
+export function ensureSections(names: (string | undefined)[]): string[] {
const data = loadFile(true);
- const sections = [...new Set([...data.sections, ...names.map(sectionContextKey).filter(Boolean)])];
- if (sections.length === data.sections.length) return false;
- for (const name of sections) if (!data.sections.includes(name)) data.memoryKeys[name] = `team:${randomUUID()}`;
- saveFile({ ...data, sections });
- return true;
+ const added = [...new Set(names.map(sectionContextKey).filter((name) => name && !data.sections.includes(name)))];
+ if (!added.length) return added;
+ for (const name of added) data.memoryKeys[name] = `team:${randomUUID()}`;
+ saveFile({ ...data, sections: [...data.sections, ...added] });
+ return added;
}
export function changeEmptySection(name: string, nextName: string | null): void {
diff --git a/server/store.ts b/server/store.ts
index a3be2fedce..f2c8e8b4a4 100644
--- a/server/store.ts
+++ b/server/store.ts
@@ -6,7 +6,7 @@ import { commitRegistryChange, keptRevocation, saveRegistryFor, touchesPermissio
import { parseToolScope, toolScopeWidens } from "../shared/tool-scope.ts"; import { grantScopedApps } from "../shared/connector-scopes.ts"; import { dropRetiredApps } from "./retired-apps.ts";
import { reorderInPlace } from "../shared/bot-order.ts"; import { trimOutboundPolicy } from "../shared/outbound.ts";
import { botOwner, chiefConflict, chiefScope, ownerEmail } from "../shared/bot-owner.ts"; import { reshowWhenMoved } from "../shared/default-bot.ts";
-import { ensureSections, readSections, changeEmptySection } from "./section-context.ts";
+import { ensureSections, readSections, changeEmptySection } from "./section-context.ts"; import { grantNewDepartments } from "./department-grants.ts";
import type { TeamComputers } from "./team-computers.ts";
import { removeBotFolder, soulFile, soulHash, writeSoulMirror } from "./bot-folder.ts";
import type { BotProfilePatch } from "./bot-profile.ts";
@@ -434,7 +434,7 @@ export class Store {
continue;
}
b.chiefOfStaff = false;
- delete b.managedSections; delete b.managesAllSections;
+ delete b.managedSections;
botsMigrated = true;
}
for (const b of this.bots as Array<BotRecord & { peers?: unknown; approvePeerComms?: unknown }>) {
@@ -697,7 +697,8 @@ export class Store {
private rememberSections(names: (string | undefined)[]) {
try {
- if (ensureSections(names)) this.emit({ type: "sections" });
+ const added = ensureSections(names); // a name an older save left unregistered at startup is not a new department
+ if (added.length) { this.emit({ type: "sections" }); if (!this.registeringInitialSections) grantNewDepartments(this, added); }
} catch (error) {
if (!this.registeringInitialSections) throw error;
console.warn(`[teams] Startup could not register team names; saved teams and shared instructions were left unchanged: ${(error as Error).message}`);
@@ -1392,7 +1393,7 @@ export class Store {
if (operation.fields.modelSelection) next.tasks = this.withDefaultModel(previous, operation.fields.modelSelection);
nextBots[at] = next;
}
- if (operation.fields.chiefOfStaff === false) { delete next.managedSections; delete next.managesAllSections; }
+ if (operation.fields.chiefOfStaff === false) delete next.managedSections;
next.section = sectionKey(next.section) || undefined;
if (operation.fields.soul !== undefined) { next.soulHash = soulHash(operation.fields.soul); next.soulDrift = false; }
changed.push(next);
@@ -1678,11 +1679,10 @@ export class Store {
const next = bot.id === id;
if (Boolean(bot.chiefOfStaff) === next && !(next && bot.hidden)) continue;
if (next) {
- bot.chiefOfStaff = true;
- bot.hidden = false;
+ bot.chiefOfStaff = true; bot.hidden = false;
} else {
bot.chiefOfStaff = false;
- delete bot.managedSections; delete bot.managesAllSections;
+ delete bot.managedSections;
}
changed.push(bot);
}
diff --git a/server/team-setup-requests.ts b/server/team-setup-requests.ts
index 5b643bf483..bfea54af03 100644
--- a/server/team-setup-requests.ts
+++ b/server/team-setup-requests.ts
@@ -46,7 +46,7 @@ export function teamSetupRevision(bot: BotRecord, fields?: TeamSetupFields): str
return createHash("sha256").update(JSON.stringify({
...profileSnapshot(bot), section: section(bot.section), modelSelection: bot.modelSelection,
hidden: Boolean(bot.hidden), chiefOfStaff: Boolean(bot.chiefOfStaff),
- managedSections: bot.managedSections, managesAllSections: bot.managesAllSections,
+ managedSections: bot.managedSections,
approvalMode: bot.approvalMode, autoApprove: bot.autoApprove, approvalGrant: bot.approvalGrant,
receipt: bot.lastTeamSetupReceipt?.requestId,
})).digest("hex");
diff --git a/shared/wire.ts b/shared/wire.ts
index a17d9b8507..66d5131a11 100644
--- a/shared/wire.ts
+++ b/shared/wire.ts
@@ -368,8 +368,8 @@ export interface WireBot extends DefaultBotFields, BotAccessFields {
pinnedMessageId?: string;
/** The coordinator for this bot's sidebar section. */
chiefOfStaff?: boolean;
- /** Owner-selected additional teams this Chief may coordinate; managesAllSections: every department, including ones added later. */
- managedSections?: string[]; managesAllSections?: boolean;
+ /** Owner-selected additional teams this Chief may coordinate. */
+ managedSections?: string[];
/** Team Cloud only: the lowercased email of the member who created the bot (or moved it in). */
createdBy?: string;
/** Team Cloud only: the lowercased email of the member the bot reports to, whose inbox its questions, approvals,
diff --git a/src/components/bot-settings/ManagedTeamsSettings.tsx b/src/components/bot-settings/ManagedTeamsSettings.tsx
index c2a80de31b..c11074bd39 100644
--- a/src/components/bot-settings/ManagedTeamsSettings.tsx
+++ b/src/components/bot-settings/ManagedTeamsSettings.tsx
@@ -2,34 +2,28 @@ import { useState } from "react";
import { t } from "@/lib/i18n";
export function ManagedTeamsSettings({
- name, ownTeam, teams, allowed, allowAll = false, onSave,
+ name, ownTeam, teams, allowed, onSave,
}: {
name: string;
ownTeam: string;
teams: string[];
allowed: string[];
- allowAll?: boolean;
- onSave: (teams: string[], allTeams: boolean) => void;
+ onSave: (teams: string[]) => void;
}) {
const [selected, setSelected] = useState(allowed);
- const [all, setAll] = useState(allowAll);
const choices = [...new Set([...teams, ...allowed])].filter(team => team !== ownTeam).sort();
- const changed = all !== allowAll || JSON.stringify([...selected].sort()) !== JSON.stringify([...allowed].sort());
+ const changed = JSON.stringify([...selected].sort()) !== JSON.stringify([...allowed].sort());
return (
<details className="mt-3 border-t border-hairline/40 pt-3">
<summary className="cursor-pointer text-[13px] font-medium text-ink">{t("botAccess.teams.title")}</summary>
<p className="mt-2 text-[13px] leading-relaxed text-ink-secondary">
{t("botAccess.teams.description", { name })}
</p>
- <label className="mt-3 flex items-center gap-2 text-[13px] font-medium text-ink">
- <input type="checkbox" className="accent-accent" checked={all} onChange={event => setAll(event.target.checked)} />
- {t("botAccess.teams.all")}
- </label>
- <fieldset disabled={all} className="mt-3 flex max-h-52 flex-col gap-2 overflow-y-auto disabled:opacity-50">
+ <fieldset className="mt-3 flex max-h-52 flex-col gap-2 overflow-y-auto">
<legend className="sr-only">{t("botAccess.teams.legend", { name })}</legend>
{choices.map(team => (
<label key={team} className="flex items-center gap-2 text-[13px] text-ink">
- <input type="checkbox" className="accent-accent" checked={all || selected.includes(team)}
+ <input type="checkbox" className="accent-accent" checked={selected.includes(team)}
onChange={event => setSelected(current => event.target.checked
? [...current, team] : current.filter(value => value !== team))} />
{team === "General" || !team ? t("botAccess.teams.general") : team}
@@ -37,7 +31,7 @@ export function ManagedTeamsSettings({
))}
{!choices.length && <p className="text-[13px] text-ink-secondary">{t("botAccess.teams.empty")}</p>}
</fieldset>
- <button type="button" disabled={!changed} onClick={() => onSave(selected, all)}
+ <button type="button" disabled={!changed} onClick={() => onSave(selected)}
className="mt-3 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white disabled:opacity-40">
{t("botAccess.teams.save")}
</button>
diff --git a/src/components/bot-settings/PermissionsSection.test.ts b/src/components/bot-settings/PermissionsSection.test.ts
index 42a1e272b6..57b651d6c1 100644
--- a/src/components/bot-settings/PermissionsSection.test.ts
+++ b/src/components/bot-settings/PermissionsSection.test.ts
@@ -101,34 +101,6 @@ describe("on a team", () => {
});
});
-describe("departments a Chief is in charge of", () => {
- const chief: Bot = { ...base, chiefOfStaff: true, managedSections: ["Sales"] };
- const allBox = () => [...host.querySelectorAll("label")].find(label => label.textContent === t("botAccess.teams.all"))!.querySelector("input")!;
- const saveTeams = () => [...host.querySelectorAll("button")].find(button => button.textContent === t("botAccess.teams.save"))!;
-
- it("saves every department, including new ones, with the confirmation the server asks for", () => {
- render(chief, false, [{ ...base, id: "seller", name: "Seller", section: "Sales" }]);
- expect(allBox().checked).toBe(false);
- expect(saveTeams().disabled).toBe(true);
- flushSync(() => allBox().click());
- expect(host.querySelector("fieldset")!.disabled).toBe(true);
- flushSync(() => saveTeams().click());
- expect(dispatch).toHaveBeenCalledExactlyOnceWith({
- type: "updateBot", botId: "pepper", patch: { managedSections: ["Sales"], managesAllSections: true, acknowledgePeerScope: true },
- });
- });
-
- it("shows a saved every-department choice and can turn it off", () => {
- render({ ...chief, managesAllSections: true });
- expect(allBox().checked).toBe(true);
- flushSync(() => allBox().click());
- flushSync(() => saveTeams().click());
- expect(dispatch).toHaveBeenCalledExactlyOnceWith({
- type: "updateBot", botId: "pepper", patch: { managedSections: ["Sales"], managesAllSections: false, acknowledgePeerScope: true },
- });
- });
-});
-
describe("PermissionsSection parts", () => {
it("leaves Chief of Staff out of a page that asks only for approvals", () => {
const derived = {
diff --git a/src/components/bot-settings/PermissionsSection.tsx b/src/components/bot-settings/PermissionsSection.tsx
index eea55039ae..38d59cfe7b 100644
--- a/src/components/bot-settings/PermissionsSection.tsx
+++ b/src/components/bot-settings/PermissionsSection.tsx
@@ -96,11 +96,11 @@ export function PermissionsSection({
</div>
<ProposalStatus bot={bot} kind="chief" />
{bot.chiefOfStaff && <ManagedTeamsSettings
- key={bot.id + JSON.stringify(bot.managedSections ?? []) + String(bot.managesAllSections === true)}
+ key={bot.id + JSON.stringify(bot.managedSections ?? [])}
name={bot.name} ownTeam={bot.section?.trim() || ""}
teams={["", ...(state.sections ?? []), ...[...state.bots, ...state.groups].map(member => member.section?.trim() || "")]}
- allowed={bot.managedSections ?? []} allowAll={bot.managesAllSections === true}
- onSave={(managedSections, managesAllSections) => patch({ managedSections, managesAllSections, acknowledgePeerScope: true })}
+ allowed={bot.managedSections ?? []}
+ onSave={managedSections => patch({ managedSections, acknowledgePeerScope: true })}
/>}
{bot.chiefOfStaff && <ProposalStatus bot={bot} kind="owner" />}
</div>}
diff --git a/src/components/bot-settings/useBotSettingsDerived.ts b/src/components/bot-settings/useBotSettingsDerived.ts
index a23cbe5415..d10ed5bb3c 100644
--- a/src/components/bot-settings/useBotSettingsDerived.ts
+++ b/src/components/bot-settings/useBotSettingsDerived.ts
@@ -37,7 +37,6 @@ export type BotPatch = Partial<
| "voice"
| "chiefOfStaff"
| "managedSections"
- | "managesAllSections"
| "composio"
| "browser"
| "recordBrowserSteps"
diff --git a/src/locales/en.json b/src/locales/en.json
index a2403f73ad..6abc7c5a54 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -7061,7 +7061,6 @@
"botAccess.scopes.readWriteHint": "Tool grants and sending limits still apply.",
"botAccess.teams.title": "Also in charge of",
"botAccess.teams.description": "{name} can already talk to every bot, in any department. Pick the other departments it's also in charge of as Chief of Staff: it looks after their bots, hears about their problems, and can suggest changes to how they're set up. Its own department is always included.",
- "botAccess.teams.all": "Every department, including new ones",
"botAccess.teams.legend": "Departments {name} is in charge of",
"botAccess.teams.general": "General",
"botAccess.teams.empty": "There are no other departments yet.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 3c0db5bdf6..20b0639002 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -6725,7 +6725,6 @@
"botAccess.scopes.readWriteHint": "As permissões de ferramentas e os limites de envio continuam valendo.",
"botAccess.teams.title": "Também é responsável por",
"botAccess.teams.description": "{name} já pode falar com todos os bots, de qualquer equipe. Escolha as outras equipes pelas quais também será responsável como chefe de gabinete: ele cuida dos bots delas, recebe avisos sobre os problemas deles e pode sugerir mudanças nas configurações. A própria equipe sempre está incluída.",
- "botAccess.teams.all": "Todas as equipes, incluindo as novas",
"botAccess.teams.legend": "Equipes sob a responsabilidade de {name}",
"botAccess.teams.general": "Geral",
"botAccess.teams.empty": "Ainda não há outras equipes.",
diff --git a/src/state/store.tsx b/src/state/store.tsx
index d40e5bd5ca..170f816fc4 100644
--- a/src/state/store.tsx
+++ b/src/state/store.tsx
@@ -308,7 +308,7 @@ export interface Bot extends DefaultBotFields, Pick<WireBot, "mascotFaceColor" |
section?: string;
pinnedMessageId?: string;
chiefOfStaff?: boolean;
- managedSections?: string[]; managesAllSections?: boolean;
+ managedSections?: string[];
createdBy?: string; reportsTo?: string;
composio?: boolean;
connectorTools?: Record<string, ConnectorToolGrant>;
@@ -1174,7 +1174,7 @@ export function reducer(state: AppState, action: Action): AppState {
if ((switchedThread || (before.awaitingThreadSnapshot && action.bot.threadId === before.threadId)) &&
Array.isArray(action.bot.messages)) {
// The slim deletion broadcast can beat the full snapshot; later duplicate snapshots must not overwrite newer messages.
- return reducer(switching, { type: "taskSwitched", bot: { ...before, ...action.bot, computer: action.bot.computer, section: action.bot.section, toolScope: action.bot.toolScope, managedSections: action.bot.managedSections, managesAllSections: action.bot.managesAllSections, messages: action.bot.messages, browserProfile: action.bot.browserProfile, vpsAlias: action.bot.vpsAlias, phoneApps: action.bot.phoneApps, onlyPeopleAdded: action.bot.onlyPeopleAdded } });
+ return reducer(switching, { type: "taskSwitched", bot: { ...before, ...action.bot, computer: action.bot.computer, section: action.bot.section, toolScope: action.bot.toolScope, managedSections: action.bot.managedSections, messages: action.bot.messages, browserProfile: action.bot.browserProfile, vpsAlias: action.bot.vpsAlias, phoneApps: action.bot.phoneApps, onlyPeopleAdded: action.bot.onlyPeopleAdded } });
}
const patched = updateBot(switching, action.bot.id, (b) => ({
...b,
@@ -1186,7 +1186,7 @@ export function reducer(state: AppState, action: Action): AppState {
browserProfile: action.bot.browserProfile,
computer: action.bot.computer,
toolScope: action.bot.toolScope,
- section: action.bot.section, managedSections: action.bot.managedSections, managesAllSections: action.bot.managesAllSections,
+ section: action.bot.section, managedSections: action.bot.managedSections,
vpsAlias: action.bot.vpsAlias, phoneApps: action.bot.phoneApps, onlyPeopleAdded: action.bot.onlyPeopleAdded,
tasks: action.bot.tasks ? mergeTaskStamps(b.tasks, action.bot.tasks) : b.tasks,
// Old approvals must never be sent to the replacement thread while its transcript loads.
@@ -1735,7 +1735,7 @@ export function reducer(state: AppState, action: Action): AppState {
...bot,
...action.bot,
computer: action.bot.computer,
- toolScope: action.bot.toolScope, managedSections: action.bot.managedSections, managesAllSections: action.bot.managesAllSections,
+ toolScope: action.bot.toolScope, managedSections: action.bot.managedSections,
vpsAlias: action.bot.vpsAlias,
messages: action.bot.messages ?? [],
hasMore: action.bot.hasMore,