Агентам разрешено читать Google Drive (поиск и чтение, без записи); правило в промтах шага 4 и проектного канала; тест
All checks were successful
ci / test (push) Successful in 24s
ci / deploy (push) Successful in 1m28s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 17:48:07 +03:00
parent 2a92458106
commit ddbf3da93f
7 changed files with 27 additions and 5 deletions

View File

@@ -52,8 +52,17 @@ export interface CliRunnerOptions {
model?: string;
}
/** Google Drive (коннектор claude.ai) - только чтение и поиск; создание, изменение, удаление и расшаривание файлов агенту не разрешены. */
export const DRIVE_READ_TOOLS = [
"mcp__claude_ai_Google_Drive__search_files",
"mcp__claude_ai_Google_Drive__read_file_content",
"mcp__claude_ai_Google_Drive__download_file_content",
"mcp__claude_ai_Google_Drive__get_file_metadata",
"mcp__claude_ai_Google_Drive__list_recent_files",
];
/** Инструменты шага 4: Bash (ffmpeg, whisper, exiftool, rclone), ToolSearch и запросы JobTread через коннектор claude.ai. */
export const CHAT_TOOLS = ["--tools", "Bash,ToolSearch", "--allowedTools", "Bash", "ToolSearch", "mcp__claude_ai_JobTread__query", "--permission-mode", "acceptEdits"];
export const CHAT_TOOLS = ["--tools", "Bash,ToolSearch", "--allowedTools", "Bash", "ToolSearch", "mcp__claude_ai_JobTread__query", ...DRIVE_READ_TOOLS, "--permission-mode", "acceptEdits"];
/** Запуск консольного агента `claude -p`: промт через stdin, ответ - JSON (result, session_id, total_cost_usd). */
export function createCliRunner(opts: CliRunnerOptions): ClaudeRunner {

View File

@@ -1,6 +1,7 @@
import { readFileSync } from "node:fs";
import { basename } from "node:path";
import { describe, expect, it } from "vitest";
import { CHAT_TOOLS } from "./agents/cli-runner.js";
import { fillVars, listPromptFiles, loadFragment, loadPrompt, parseFragments, parsePromptFile, type PromptSide } from "./agents/prompts.js";
const SIDES: PromptSide[] = ["approved", "proposed"];
@@ -89,4 +90,15 @@ describe("промты в docs модуля (p-*.md)", () => {
it("промт шага 2 в approved и proposed совпадает (правки новой версии - только в промтах шага 4 и проектного канала)", () => {
expect(loadPrompt("p-step2-prepare.md", {}, "proposed")).toBe(loadPrompt("p-step2-prepare.md", {}, "approved"));
});
it("Google Drive: агенту разрешены только чтение и поиск; промты это описывают", () => {
const allowed = CHAT_TOOLS.join(" ");
for (const n of ["search_files", "read_file_content", "download_file_content", "get_file_metadata", "list_recent_files"]) expect(allowed).toContain("mcp__claude_ai_Google_Drive__" + n);
for (const n of ["create_file", "update_file", "trash_file", "share_file", "copy_file"]) expect(allowed).not.toContain(n);
for (const side of SIDES) for (const name of ["p-manager-dialog.md", "p-project-channel.md"]) {
const body = loadPrompt(name, {}, side);
expect(body, name + " " + side).toContain("Google Drive");
expect(body, name + " " + side).toContain("Ничего не создавай, не меняй, не удаляй и не расшаривай в Drive");
}
});
});