Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
feat(team-setup): bulk edits for a Chief, up to 40 bots and an added rule
AdityaUmaleaaceb557d2d0
diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.jsonindex f4a2ffcd12..3ee50fbad9 100644--- a/server/drivers/agents-catalog-goldens/full.tools-list.json+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json@@ -719,7 +719,7 @@},{"name": "propose_team_setup",- "description": "Chief of Staff only: submit all requested specialist creation, profile/model configuration, Chief assignments, and authorized team moves in ONE combined plan. Use exact catalog engine/model IDs from list_team_setup. Combine all fields for each bot; use the same create key or botId to coalesce repeated entries. New teams must be named explicitly in newTeams and have a specialist in this plan; access is granted only to those new teams. Existing unauthorized teams cannot be included. Models change bot defaults for groups/new threads; existing threads and execution permissions stay unchanged. If review is pending, the decision and structured result automatically resume you once; do not ask again, poll, or repeat the proposal. Read the result: it applies immediately at every access level, and the person sees it with an Undo where possible. If applied, continue the work without another confirmation. Only a pending result (a Cloud conversation its owner did not drive) means ending the turn to wait for the owner. Never claim success without an applied result; report failures honestly. This does not elevate another bot's execution permissions.",+ "description": "Chief of Staff only: submit all requested specialist creation, profile/model configuration, Chief assignments, and authorized team moves in ONE combined plan. Use exact catalog engine/model IDs from list_team_setup. Combine all fields for each bot; use the same create key or botId to coalesce repeated entries. Bulk edits: one update per bot, up to 40 bots (8 new). New teams must be named explicitly in newTeams and have a specialist in this plan; access is granted only to those new teams. Existing unauthorized teams cannot be included. Models change bot defaults for groups/new threads; existing threads and execution permissions stay unchanged. If review is pending, the decision and structured result automatically resume you once; do not ask again, poll, or repeat the proposal. Read the result: it applies immediately at every access level, and the person sees it with an Undo where possible. If applied, continue the work without another confirmation. Only a pending result (a Cloud conversation its owner did not drive) means ending the turn to wait for the owner. Never claim success without an applied result; report failures honestly. This does not elevate another bot's execution permissions.","inputSchema": {"type": "object","additionalProperties": false,@@ -729,7 +729,6 @@},"newTeams": {"type": "array",- "maxItems": 8,"items": {"type": "string","maxLength": 60@@ -737,7 +736,6 @@},"operations": {"type": "array",- "maxItems": 24,"items": {"type": "object","additionalProperties": false,@@ -779,6 +777,10 @@"type": "string","description": "Standing instructions; required with name/title/modelSelection for every new bot."},+ "soulAppend": {+ "type": "string",+ "description": "Update only, instead of soul: text appended to its current instructions."+ },"cwd": {"type": "string","description": "Create only: absolute path of the folder the new bot's tools read and write in. It must already exist. Leave it out for a private workspace."diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.jsonindex f6b8f59e97..6b7cb587f1 100644--- a/server/drivers/agents-catalog-goldens/profiles.json+++ b/server/drivers/agents-catalog-goldens/profiles.json@@ -1,7 +1,7 @@{"default": {- "bytes": 62980,- "sha256": "a1e5bb5f9e8fa1b9f6732f4fe692ab2be406d66586b888346a96edb9d22a6d4e",+ "bytes": 63128,+ "sha256": "514ee727915d09eff119485f60e4876b1f4bde3d0f1c66fd61a5efcd3ce0eda3","tools": ["tool_result_read","list_room_targets",@@ -54,8 +54,8 @@]},"voice": {- "bytes": 63761,- "sha256": "cc4fd7bd860db9f32db031b78069daee494ff4865fdb1a7abc2f7c65998398e9",+ "bytes": 63909,+ "sha256": "1a26aabd9b2c9f17a4ddb1ba40c96eb9792eb336383ca602c4720c0b77755663","tools": ["tool_result_read","list_room_targets",@@ -109,8 +109,8 @@]},"shared": {- "bytes": 65245,- "sha256": "c57b84ffb9dc6e5a7abb1cdc504b83156c2a80aaa8e0e9fdd9203f2923a9176c",+ "bytes": 65393,+ "sha256": "8ca86e81d9f85d305a1b9e70f3cae981be4747dab30c90ae967fe88139c28706","tools": ["tool_result_read","list_shared_computers",@@ -165,8 +165,8 @@]},"shared+voice": {- "bytes": 66026,- "sha256": "550deca03c99117f0247e2940693d7e245485066b9f69a71221bcd7b8203f757",+ "bytes": 66174,+ "sha256": "e8a0705fa25c1ef90fd2c15358fe3d6c5da5054f1b76bb40e1b2d820ecaa2fde","tools": ["tool_result_read","list_shared_computers",@@ -222,8 +222,8 @@]},"skills": {- "bytes": 66056,- "sha256": "c49d63c2bb37a00ef269d9b0e37c2e21df88b2bfbfe0e528c6ee472f009b3338",+ "bytes": 66204,+ "sha256": "688178a5248c912b74d87fb2a83c78c1711beb369974b6e63644cfbc68917636","tools": ["tool_result_read","list_room_targets",@@ -278,8 +278,8 @@]},"skills+voice": {- "bytes": 66837,- "sha256": "dd2a3a4d3f39f92d1ea51e7dc25e2722f6b0bd51053e49b54ffff747f92f4a8a",+ "bytes": 66985,+ "sha256": "586d1d8d3587f78254e923258269c84cac600836b8346378b457db8324a6811d","tools": ["tool_result_read","list_room_targets",@@ -335,8 +335,8 @@]},"skills+shared": {- "bytes": 68321,- "sha256": "85d3c36e68b49d096820201bc71f1852a84dfe04c742e8334777c8886c79858d",+ "bytes": 68469,+ "sha256": "11a0d8dab8f90a1ae3752f7f41782625b8e88c84e00424b2bba0c872554023bb","tools": ["tool_result_read","list_shared_computers",@@ -393,8 +393,8 @@]},"skills+shared+voice": {- "bytes": 69102,- "sha256": "095e7b1a7b10e17ba636acab91ec9ab0fca623024eb2a950d98a8871750d5486",+ "bytes": 69250,+ "sha256": "35ad5fdc8dc79adb444c37f0b7ae73f6da27fd374205f18cfabd7e933d344f41","tools": ["tool_result_read","list_shared_computers",@@ -848,8 +848,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 68868,- "sha256": "a47df948561206ccc2b3a086e8636e52a5f8b2b5dbae2b9b45cd9fe19469256e",+ "bytes": 69016,+ "sha256": "457de07eecfdf99c82dcf9481fee324c96adfb0fcc5055d81f41fdae3422edef","tools": ["tool_result_read","list_shared_computers",@@ -959,8 +959,8 @@]},"skills+shared+voice+x": {- "bytes": 72941,- "sha256": "4ad6c77e071425a847c944a5153a6a0f8a7abd1341882e1f78eb72d6ef0aa707",+ "bytes": 73089,+ "sha256": "7a711205f99a608fbd9667bb21f0b925e48260bf4b9e56fad22d68645e8c32b1","tools": ["tool_result_read","list_shared_computers",@@ -1022,8 +1022,8 @@]},"skills+shared+voice+x+team": {- "bytes": 72941,- "sha256": "4ad6c77e071425a847c944a5153a6a0f8a7abd1341882e1f78eb72d6ef0aa707",+ "bytes": 73089,+ "sha256": "7a711205f99a608fbd9667bb21f0b925e48260bf4b9e56fad22d68645e8c32b1","tools": ["tool_result_read","list_shared_computers",@@ -1085,8 +1085,8 @@]},"skills+shared+voice+x+team+images": {- "bytes": 73714,- "sha256": "cb2eab11a4e88edfaca262facd422c39446a8d828691240dbcdbd257b1b63988",+ "bytes": 73862,+ "sha256": "c754a9fee6181e5bd7c15f831830dcf84d656d99b15bd32441bbdfa209012b93","tools": ["tool_result_read","list_shared_computers",@@ -1149,8 +1149,8 @@]},"default+legacy-switches": {- "bytes": 62980,- "sha256": "a1e5bb5f9e8fa1b9f6732f4fe692ab2be406d66586b888346a96edb9d22a6d4e",+ "bytes": 63128,+ "sha256": "514ee727915d09eff119485f60e4876b1f4bde3d0f1c66fd61a5efcd3ce0eda3","tools": ["tool_result_read","list_room_targets",@@ -1203,8 +1203,8 @@]},"default+mausbot": {- "bytes": 63631,- "sha256": "580c7d5e93bcdc095300fa01ce46982aa794c6cf96d9d24bb21d07bb1df16401",+ "bytes": 63779,+ "sha256": "8083b28ece4369fa2e818f8f05f3754a9e65cd6f76a62e1950d7e18ff721a13b","tools": ["tool_result_read","list_room_targets",@@ -1259,8 +1259,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 69753,- "sha256": "c6f275dd5a7735cca36490ee665edb08e775c6249207edd05cf298556cb2a913",+ "bytes": 69901,+ "sha256": "879abe295f1c58444531c6aec7ee1c4592bbd610e4469d2beb0853849630b860","tools": ["tool_result_read","list_shared_computers",@@ -1320,8 +1320,8 @@]},"default+no-computer-pick": {- "bytes": 61768,- "sha256": "ae01fde9181abcef5a13b43033c00f534796433e2d395f598b8ff383a7e21303",+ "bytes": 61916,+ "sha256": "a9dba9c47050dc791dc6a1293e0791e0da9f554517b8f934bc5a1343d38ac706","tools": ["tool_result_read","list_room_targets",@@ -1373,8 +1373,8 @@]},"default+room": {- "bytes": 59270,- "sha256": "22fcfe0c0c9c51f35200f2df652ca52875ae65ea53a8a6e63434e6ab26704a40",+ "bytes": 59418,+ "sha256": "cdfe09f2d0eaccf5dec64f9d875943b952bc09d1eabc8e8b55658668ba3a8e05","tools": ["tool_result_read","list_room_targets",@@ -1464,8 +1464,8 @@]},"default+images": {- "bytes": 63753,- "sha256": "580c754ef01b3ffeff0f3d0a341eb8e94012151beb2abeb40687c3de467d6bac",+ "bytes": 63901,+ "sha256": "d29e23d63f8f3e271d05ac767663aba3581889e0b66955e9c7ac79a7611ae6f4","tools": ["tool_result_read","list_room_targets",@@ -1519,8 +1519,8 @@]},"skills+shared+voice+x+team+images+hosting": {- "bytes": 75577,- "sha256": "738ee8cec5b177b8c7e828f15ccd86c5d7cca77a90d24910ee91aa2c7e786586",+ "bytes": 75725,+ "sha256": "8085bc3937152c3a8b1ff8c29c10654ea1e01588df0cec991a43d97eaed8bc21","tools": ["tool_result_read","list_shared_computers",@@ -1585,8 +1585,8 @@]},"default+hosting": {- "bytes": 64843,- "sha256": "3ccc4dc55f2c8337943b995f75fcfabbe6c4aee4ffd4f412bd9062b4a07a5cff",+ "bytes": 64991,+ "sha256": "bb4e833889a30fa955bf61452d4436d91c2a4a465ffae934f738a0439383a574","tools": ["tool_result_read","list_room_targets",diff --git a/server/drivers/agents-catalog-wire.test.ts b/server/drivers/agents-catalog-wire.test.tsindex b8d2315f08..b02b9f9633 100644--- a/server/drivers/agents-catalog-wire.test.ts+++ b/server/drivers/agents-catalog-wire.test.ts@@ -85,14 +85,14 @@ const FULL = "skills+shared+voice+x+team+images+hosting";/** Bytes when the budget was last set; a profile may move at most 2% either way (lower it to lock in a win). */const BUDGET_BASELINE: Record<string, number> = {- "default": 61763,- "voice": 62544,- "shared": 64028,- "shared+voice": 64809,- "skills": 64839,- "skills+voice": 65620,- "skills+shared": 67009,- "skills+shared+voice": 67790,+ "default": 61911,+ "voice": 62692,+ "shared": 64176,+ "shared+voice": 64957,+ "skills": 64987,+ "skills+voice": 65768,+ "skills+shared": 67157,+ "skills+shared+voice": 67938,"non-chief": 52785,"voice+non-chief": 53566,"shared+non-chief": 55050,@@ -101,20 +101,20 @@ const BUDGET_BASELINE: Record<string, number> = {"skills+voice+non-chief": 56642,"skills+shared+non-chief": 58126,"skills+shared+voice+non-chief": 58907,- "skills+shared+voice+cloud-home": 67556,+ "skills+shared+voice+cloud-home": 67704,"skills+shared+voice+non-chief+cloud-home": 58673,- "default+legacy-switches": 61763,- "default+mausbot": 62414,- "skills+shared+voice+mausbot": 68441,- "skills+shared+voice+x": 71614,- "skills+shared+voice+x+team": 71614,- "default+no-computer-pick": 60923,- "default+room": 58440,+ "default+legacy-switches": 61911,+ "default+mausbot": 62562,+ "skills+shared+voice+mausbot": 68589,+ "skills+shared+voice+x": 71762,+ "skills+shared+voice+x+team": 71762,+ "default+no-computer-pick": 61071,+ "default+room": 58588,"non-chief+room": 49224,- "skills+shared+voice+x+team+images": 72387,- "default+images": 62536,- "skills+shared+voice+x+team+images+hosting": 74226,- "default+hosting": 63965,+ "skills+shared+voice+x+team+images": 72535,+ "default+images": 62684,+ "skills+shared+voice+x+team+images+hosting": 74374,+ "default+hosting": 64113,};const RPC_PREFIX = '{"jsonrpc":"2.0","id":1,"result":';diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.tsindex b56734e51d..b7f672aa90 100644--- a/server/drivers/agents-catalog.ts+++ b/server/drivers/agents-catalog.ts@@ -440,13 +440,13 @@ const TOOL_DEFINITIONS = [},{name: "propose_team_setup",- description: "Chief of Staff only: submit all requested specialist creation, profile/model configuration, Chief assignments, and authorized team moves in ONE combined plan. Use exact catalog engine/model IDs from list_team_setup. Combine all fields for each bot; use the same create key or botId to coalesce repeated entries. New teams must be named explicitly in newTeams and have a specialist in this plan; access is granted only to those new teams. Existing unauthorized teams cannot be included. Models change bot defaults for groups/new threads; existing threads and execution permissions stay unchanged. If review is pending, the decision and structured result automatically resume you once; do not ask again, poll, or repeat the proposal." + APPLIES_OUTCOME,+ description: "Chief of Staff only: submit all requested specialist creation, profile/model configuration, Chief assignments, and authorized team moves in ONE combined plan. Use exact catalog engine/model IDs from list_team_setup. Combine all fields for each bot; use the same create key or botId to coalesce repeated entries. Bulk edits: one update per bot, up to 40 bots (8 new). New teams must be named explicitly in newTeams and have a specialist in this plan; access is granted only to those new teams. Existing unauthorized teams cannot be included. Models change bot defaults for groups/new threads; existing threads and execution permissions stay unchanged. If review is pending, the decision and structured result automatically resume you once; do not ask again, poll, or repeat the proposal." + APPLIES_OUTCOME,inputSchema: {type: "object", additionalProperties: false,properties: {reason: { type: "string", minLength: 1, maxLength: 500 },newTeams: { type: "array", maxItems: 8, items: { type: "string", minLength: 1, maxLength: 60 } },- operations: { type: "array", minItems: 1, maxItems: 24, items: {+ operations: { type: "array", minItems: 1, maxItems: 40, items: {type: "object", additionalProperties: false,properties: {action: { type: "string", enum: ["create", "update"] },@@ -456,6 +456,7 @@ const TOOL_DEFINITIONS = [name: { type: "string", maxLength: 100 }, title: { type: "string", maxLength: 200 },chiefOfStaff: { type: "boolean", description: "Appoint or remove this team's Chief. At most one Chief per team: explicitly demote the current Chief in the same plan when replacing them. Does not grant access to other teams or change execution permissions." },description: { type: "string", maxLength: 4000 }, soul: { type: "string", description: "Standing instructions; required with name/title/modelSelection for every new bot." },+ soulAppend: { type: "string", description: "Update only, instead of soul: text appended to its current instructions." },cwd: { type: "string", maxLength: 1024, description: "Create only: absolute path of the folder the new bot's tools read and write in. It must already exist. Leave it out for a private workspace." },section: { type: "string", maxLength: 60, description: "Exact authorized existing team, or a team explicitly named in newTeams. Empty string means General." },modelSelection: { type: "object", additionalProperties: false, properties: {diff --git a/server/team-setup-requests.test.ts b/server/team-setup-requests.test.tsindex e6891ad232..474aa50b45 100644--- a/server/team-setup-requests.test.ts+++ b/server/team-setup-requests.test.ts@@ -338,6 +338,47 @@ describe("reviewed Chief team setup", () => {} }]);expect(card.detail).toContain("Default AI and model: claude/sonnet (variant high) → codex/gpt-fixture (no variant)");});++ it("switches the model of 40 existing bots in one setup, while still reviewing at most eight new bots", async () => {+ const h = harness();+ const team = Array.from({ length: 39 }, (_, index) => h.bot(`Worker${index}`));+ const switchModel = (bot: BotRecord) => ({ action: "update", botId: bot.id, fields: { modelSelection: { instanceId: "claude", model: "opus" } } });+ const card = h.propose([h.peer, ...team].map(switchModel));+ expect(card.title).toBe("Apply setup for 40 bots?");+ expect((await h.resolve(card.requestId))?.result.state).toBe("applied");+ expect([h.peer, ...team].every((bot) => bot.modelSelection.model === "opus")).toBe(true);+ expect(() => h.propose([h.peer, ...team, h.bot("Extra")].map(switchModel))).toThrow(/at most 40 bots/);+ expect(() => h.propose(Array.from({ length: 9 }, (_, index) => specialist(`New${index}`, "Work")))).toThrow(/at most 8 new bots/);+ });++ it("adds a rule to the end of each bot's instructions without restating them, with a diff and one Undo", async () => {+ const h = harness(); h.autoApply.mockReturnValue("level");+ h.peer.soul = "Verify sources.\n"; const blank = h.bot("Blank");+ const add = (bot: BotRecord) => ({ action: "update", botId: bot.id, fields: { soulAppend: "Reply in English." } });+ const preview = h.propose([add(h.peer), add(blank)]);+ expect(preview.detail).toContain(" Verify sources.");+ expect(preview.detail).toContain("+Reply in English.");+ const response = await h.submit([add(h.peer), add(blank)]);+ expect(response).toMatchObject({ state: "applied", applied: true });+ expect(h.peer.soul).toBe("Verify sources.\n\nReply in English.");+ expect(blank.soul).toBe("Reply in English.");+ const twice = h.propose([{ action: "update", botId: blank.id, fields: { soulAppend: "Be brief." } }, { action: "update", botId: blank.id, fields: { soulAppend: "Cite sources." } }]);+ expect(twice.detail).toContain("+Be brief.");+ expect(twice.detail).toContain("+Cite sources.");+ expect(await h.service.undo({ botId: h.chief.id, threadId: h.chief.threadId, requestId: response.requestId })).toMatchObject({ state: "undone" });+ expect(h.peer.soul).toBe("Verify sources.\n");+ expect(blank.soul).toBe("");+ });++ it("refuses an added rule on a new bot, beside replacement instructions, or where re-saving would redact existing text", () => {+ const h = harness();+ expect(() => h.propose([{ action: "update", botId: h.peer.id, fields: { soul: "New.", soulAppend: "More." } }])).toThrow(/either soul or soulAppend/);+ expect(() => h.propose([{ ...specialist("Mira", "Work"), fields: { ...specialist("Mira", "Work").fields, soul: undefined, soulAppend: "More." } }])).toThrow(/soulAppend only adds to an existing bot/);+ const outsider = h.bot("Outsider", { section: "Private", soul: `Use key sk-${"b".repeat(24)} for the API.` });+ expect(() => h.propose([{ action: "update", botId: outsider.id, fields: { soulAppend: "More." } }])).toThrow(/Private/);+ h.peer.soul = `Use key sk-${"a".repeat(24)} for the API.`;+ expect(() => h.propose([{ action: "update", botId: h.peer.id, fields: { soulAppend: "More." } }])).toThrow(/credential-like text/);+ });});describe("team setup that applies on its own", () => {diff --git a/server/team-setup-requests.ts b/server/team-setup-requests.tsindex bfea54af03..87e7dcff93 100644--- a/server/team-setup-requests.ts+++ b/server/team-setup-requests.ts@@ -18,9 +18,13 @@ const teamName = z.string().trim().min(1).max(60).refine(fitsOnOneLine).refine((const FIELD_LABELS: Record<string, string> = { name: "Name", title: "Title", description: "Description", section: "Department", cwd: "Working folder" };const modelSelectionText = (selection: ModelSelection) =>`${selection.instanceId}/${selection.model}${selection.variant ? ` (variant ${selection.variant})` : " (no variant)"}${selection.effort ? ` (effort ${selection.effort})` : ""}`;+/** One setup may edit a whole department at once (a model switch, an added rule), but each new bot still needs a close review. */+const MAX_SETUP_BOTS = 40;+const MAX_NEW_BOTS = 8;const fieldsSchema = z.object({chiefOfStaff: z.boolean().optional(),name: z.string().optional(), title: z.string().optional(), description: z.string().optional(), soul: z.string().optional(),+ soulAppend: z.string().trim().min(1).optional(),cwd: z.string().optional(),section: z.string().trim().max(60).refine(fitsOnOneLine).refine((value) => redactSecretsInText(value) === value, "Team names cannot contain credentials").optional(),modelSelection: z.object({ instanceId: z.string().trim().min(1), model: z.string().trim().min(1), effort: z.string().optional(), variant: z.string().optional() }).strict().optional(),@@ -31,7 +35,7 @@ const planSchema = z.object({operations: z.array(z.discriminatedUnion("action", [z.object({ action: z.literal("create"), key: z.string().trim().min(1).max(80), fields: fieldsSchema }).strict(),z.object({ action: z.literal("update"), botId: z.string().min(1).max(128), fields: fieldsSchema }).strict(),- ])).min(1).max(24),+ ])).min(1).max(MAX_SETUP_BOTS, `Review at most ${MAX_SETUP_BOTS} bots in one setup`),}).strict();export class TeamSetupError extends Error {@@ -201,12 +205,28 @@ export class TeamSetupRequestService {for (const operation of parsed.data.operations) {const key = operation.action === "create" ? `create:${operation.key}` : `update:${operation.botId}`;const previous = combined.get(key);- combined.set(key, { ...operation, fields: { ...previous?.fields, ...operation.fields } });+ if (operation.fields.soul !== undefined && operation.fields.soulAppend !== undefined) throw new TeamSetupError("Use either soul or soulAppend for a bot, not both");+ // Repeated added rules for one bot all land, in order; any other repeated field keeps its last value.+ const soulAppend = [previous?.fields.soulAppend, operation.fields.soulAppend].filter(Boolean).join("\n\n") || undefined;+ combined.set(key, { ...operation, fields: { ...previous?.fields, ...operation.fields, soulAppend } });}- if (combined.size > 8) throw new TeamSetupError("Review at most eight bots in one setup");- const operations: TeamSetupOperation[] = [...combined.values()].map((operation) => {+ const entries = [...combined.values()];+ if (entries.filter((operation) => operation.action === "create").length > MAX_NEW_BOTS) throw new TeamSetupError(`Review at most ${MAX_NEW_BOTS} new bots in one setup`);+ const operations: TeamSetupOperation[] = entries.map((operation) => {const target = operation.action === "update" ? this.options.store.bot(operation.botId) : undefined;- const fields = this.fields({ ...operation.fields, section: operation.fields.section ?? target?.section ?? chief.section ?? "" }, target ?? undefined);+ const { soulAppend, ...requested } = operation.fields;+ if (soulAppend !== undefined) {+ if (operation.action === "create") throw new TeamSetupError("soulAppend only adds to an existing bot's instructions; give a new bot its full soul");+ if (requested.soul !== undefined) throw new TeamSetupError("Use either soul or soulAppend for a bot, not both");+ // A bot this Chief may not change is never read here; validate() refuses it.+ if (target && !target.hidden && this.options.hasTeamAuthority(chief, target.section)) {+ // Re-saving runs the whole text through redaction; never let an added rule rewrite what the bot already had.+ const current = target.soul ?? "";+ if (redactSecretsInText(current) !== current) throw new TeamSetupError(`@${target.name}'s instructions hold credential-like text; change them with a full soul instead`);+ requested.soul = current.trim() ? `${current.trimEnd()}\n\n${soulAppend}` : soulAppend;+ }+ }+ const fields = this.fields({ ...requested, section: requested.section ?? target?.section ?? chief.section ?? "" }, target ?? undefined);return { action: operation.action, botId: operation.action === "create" ? newId() : operation.botId,...(operation.action === "create" ? { threadId: newId() } : {}),fields,