Files
cobble/src/harness/tools/bot/secrets/grab-bot-secret-tools.ts
T
tbenandClaude Opus 5.5 8890d80e6e Tell replies their envs and call queued work runs
Chat replies now list the envs that reach them (keys and descriptions,
never values), so a bot no longer asks for keys that are set or "checks"
them with show_secret or printenv. request_secret refuses a key that's
already set unless the user asked to replace it, and search_computers
says envs aren't loaded in its shell.

start_task and delegate_task results say "Run #N" and that list_tasks
doesn't show it, since bots sent users to the to-do list for queue jobs.
start_task refuses a second open run in the session on the same
computer unless it's separate work, and says how many runs are ahead on
that computer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 19:33:45 +01:00

45 lines
1.3 KiB
TypeScript

import type { HarnessTool } from "../../../types";
import requestSecretTool from "./request-secret-tool";
import showSecretTool from "./show-secret-tool";
type Params = {
user_id: number | string;
bot_id: number | string;
session_id?: number | string;
workspace_id?: number | string | null;
computer_id?: number | string | null;
in_task?: boolean;
/**
* Called with a secret request's ref: the message needs the user.
*/
onRequest?: (params: { ref: string }) => void;
/**
* Called with a shown secret's ref.
*/
onShow?: (params: { ref: string }) => void;
};
/**
* The tools that move secrets without the model seeing them: asking the
* user for one (`request_secret`, needs a conversation to show its card
* in) and showing one (`show_secret`). Capturing one on a computer is a
* computer tool (`capture_secret`).
*/
export default function grabBotSecretTools({
user_id,
bot_id,
session_id,
workspace_id,
computer_id,
in_task,
onRequest,
onShow,
}: Params): HarnessTool[] {
return [
...(session_id && onRequest
? [requestSecretTool({ user_id, bot_id, session_id, workspace_id, computer_id, in_task, onRequest })]
: []),
...(onShow ? [showSecretTool({ user_id, bot_id, workspace_id, computer_id, onShow })] : []),
];
}