Move secrets between users and computers without the model seeing them

A new personal env scope (paradigm user: one user's secret for one bot)
beats every other scope, reaches only that user's runs of that bot, and
is redacted like any secret. Bots take secrets in with request_secret,
which puts a [secret-request:ID] card in the chat: the user types the
value into a masked input there, never into a message, and the bot is
told only the key. Bots show secrets with capture_secret (a task's
computer tool that saves a file or a command's output straight to a
personal env, then redacts it from the rest of the run) and show_secret
(an env by key): both give a [secret:ID] chip whose Reveal and Copy fetch
the value on click, for its own user (personal) or a super admin
(anything else), logged by key. Values never go into messages, page
props, history, Copy chat or logs. Users manage their own secrets on
Settings > Secrets; the Environment page lists everyone's, remove only.
Deleting a bot or user removes its personal secrets, and SecretsNote
tells bots never to ask for or print secrets in chat.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 16:51:32 +01:00
co-authored by Claude Opus 5.5
parent 83ff79b9c3
commit 69988e08fc
78 changed files with 2472 additions and 52 deletions
+19
View File
@@ -3,6 +3,7 @@ import { grabSkillBodyShownChars } from "@/src/functions/backend/db/app-settings
import { AppData } from "@/src/data/app-data";
import {
ActionCheckNote,
SecretsNote,
botFilesNote,
chatReplyNote,
ComputerFilesNote,
@@ -38,6 +39,7 @@ import hasUnansweredMessage from "./has-unanswered-message";
import grabAnsweredMessageId from "@/src/functions/backend/db/bots-queue/grab-answered-message-id";
import markReplyAnswered from "@/src/functions/backend/db/bots-queue/mark-reply-answered";
import sendMessageTool from "@/src/harness/tools/bot/send-message-tool";
import grabBotSecretTools from "@/src/harness/tools/bot/secrets/grab-bot-secret-tools";
import type { BotMessageWithAttachments } from "@/src/types";
import type { HarnessMessage } from "@/src/harness/types";
import type { BotJobContext, BotJobOutcome } from "./types";
@@ -144,6 +146,11 @@ export default async function runBotReply({
* coordinator did: their cards need the user just like a take-over.
*/
const proposals: string[] = [];
/**
* The secrets the bot showed (`show_secret`), whose chips the reply
* always carries.
*/
const shown: string[] = [];
/**
* Files the bot wrote and asked to send with its reply.
*/
@@ -194,6 +201,7 @@ export default async function runBotReply({
const extensions = await openBotExtensions({
bot_id: bot.id,
user_id,
workspace_id,
computer_id: computers[0]?.id || null,
dirs,
@@ -236,6 +244,7 @@ export default async function runBotReply({
TasksNote,
TaskReminderNote,
ActionCheckNote,
SecretsNote,
workspace_id ? WorkspaceLearningNote : "",
composeComputersNote({
computers,
@@ -253,6 +262,15 @@ export default async function runBotReply({
tools: [
...tools,
sendMessageTool({ bot_id: bot.id, session_id: Number(session_id), workspace_id }),
...grabBotSecretTools({
user_id,
bot_id: bot.id,
session_id,
workspace_id,
computer_id: computers[0]?.id || null,
onRequest: ({ ref }) => proposals.push(ref),
onShow: ({ ref }) => shown.push(ref),
}),
...file_tools,
...extensions.tools,
...skills.tools,
@@ -273,6 +291,7 @@ export default async function runBotReply({
...withTakeOverRefs({
text: stripAppRecords({ text: result.text }),
refs: [...take_overs, ...proposals],
shown,
}),
attachments: attachments.length ? attachments : undefined,
tool_log: result.tool_uses,
+24 -1
View File
@@ -5,6 +5,7 @@ import workspaceAdminsNote from "./workspace-admins-note";
import type { BUN_SQLITE_COBBLE_BOTS } from "@/db/types/db";
import {
ActionCheckNote,
SecretsNote,
botFilesNote,
ComputerFilesNote,
ScheduledRunNote,
@@ -22,6 +23,7 @@ import openComputerTools from "@/src/harness/tools/computer/open-computer-tools"
import openBotExtensions, { type OpenBotExtensions } from "@/src/harness/tools/extensions/open-bot-extensions";
import openBotSkills, { type OpenBotSkills } from "@/src/harness/tools/skills/open-bot-skills";
import grabBotTools from "@/src/harness/tools/bot/grab-bot-tools";
import grabBotSecretTools from "@/src/harness/tools/bot/secrets/grab-bot-secret-tools";
import createWorkspaceTool from "@/src/harness/tools/bot/create-workspace-tool";
import updateWorkspaceTool from "@/src/harness/tools/bot/update-workspace-tool";
import askToTakeOverTool from "@/src/harness/tools/computer/ask-to-take-over-tool";
@@ -75,12 +77,20 @@ export default async function runBotTask({
*/
const dirs = computerRunDirs({ bot_id: bot.id, bot_kind: bot.kind, user_id, workspace_id });
/**
* The secrets the bot captured or showed, whose chips the report
* always carries.
*/
const shown: string[] = [];
const computer = job.computer_id
? await openComputerTools({
computer_id: job.computer_id,
bot_id: bot.id,
user_id,
workspace_id,
dirs,
onSecretRef: ({ ref }) => shown.push(ref),
signal,
})
: null;
@@ -175,7 +185,7 @@ export default async function runBotTask({
: []),
...(computers.length
? [
searchComputersTool({ bot_id: bot.id, computers, workspace_id, dirs }),
searchComputersTool({ bot_id: bot.id, user_id, computers, workspace_id, dirs }),
askToTakeOverTool({
computers: take_over_computers,
in_task: true,
@@ -183,6 +193,16 @@ export default async function runBotTask({
}),
]
: []),
...grabBotSecretTools({
user_id,
bot_id: bot.id,
session_id,
workspace_id,
computer_id: job.computer_id || null,
in_task: true,
onRequest: hooked ? undefined : ({ ref }) => take_overs.push(ref),
onShow: ({ ref }) => shown.push(ref),
}),
...(scheduled || hooked ? [reportRunFailedTool({ onFail: ({ reason }) => (failure = reason) })] : []),
...(computer?.tools || []),
...(job.computer_id
@@ -208,6 +228,7 @@ export default async function runBotTask({
extensions = await openBotExtensions({
bot_id: bot.id,
user_id,
workspace_id,
computer_id: job.computer_id || null,
dirs,
@@ -232,6 +253,7 @@ export default async function runBotTask({
ComputerFilesNote({ computer_id: job.computer_id || 0, dirs }),
TasksNote,
ActionCheckNote,
SecretsNote,
workspace_id ? WorkspaceLearningNote : "",
powers.is_coordinator
? `If this brief asked you to record something in a workspace (its context, or a new one), do it yourself with update_workspace or create_workspace before you report: the report alone changes nothing.`
@@ -288,6 +310,7 @@ export default async function runBotTask({
...withTakeOverRefs({
text: computer ? computer.redact(text) : text,
refs: take_overs,
shown,
}),
attachments: attachments.length ? attachments : undefined,
tool_log: result.tool_uses,
+7 -2
View File
@@ -5,6 +5,11 @@ type Params = {
* and the proposals it made for the user to confirm (`proposalRef`).
*/
refs: string[];
/**
* The secrets it showed (`secretRef`): added the same way, but they
* don't need the user.
*/
shown?: string[];
};
/**
@@ -13,8 +18,8 @@ type Params = {
* end, so the user always gets the button. A message asking for either
* needs the user.
*/
export default function withTakeOverRefs({ text, refs }: Params) {
const missing = [...new Set(refs)].filter((ref) => !text.includes(ref));
export default function withTakeOverRefs({ text, refs, shown = [] }: Params) {
const missing = [...new Set([...refs, ...shown])].filter((ref) => !text.includes(ref));
return {
result: [text.trim(), ...missing].filter(Boolean).join("\n\n"),