Skip to content

The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.

Own agent: pictures within a request's size, and a 413 tried again with half of them (#148)

riverisbuilding0a90640fa541
diff --git a/.changeset/own-agent-pictures.md b/.changeset/own-agent-pictures.md
new file mode 100644
index 0000000..9631785
--- /dev/null
+++ b/.changeset/own-agent-pictures.md
@@ -0,0 +1,6 @@
+---
+"openfilm": patch
+"@openfilm/desktop": patch
+---
+
+The app's own agent (your own key) keeps a long conversation going when it looks at many frames. Pictures keep their full quality. A request carries the pictures of the agent's latest five reads, and at most 32 MB of them; an older one is left out of the request with a line naming its file, so the agent can read it again (the conversation keeps them). A model service that refuses a request as too large (HTTP 413, a proxy's page included) is tried again at once with half of the older pictures left out, and says so in the chat; before, every message after it failed the same way. Settings › Agents says that the agent's rules are the project's own AGENTS.md.
diff --git a/apps/desktop/src/pi-agent.mjs b/apps/desktop/src/pi-agent.mjs
index 4df4f0f..644f229 100644
--- a/apps/desktop/src/pi-agent.mjs
+++ b/apps/desktop/src/pi-agent.mjs
@@ -16,6 +16,12 @@
* context, as Pi sends it, and the answer) is written there (chat-store.mjs's `<turn>.model.jsonl`), only what is new
* since the request before.
*
+ * Pictures are kept within the model services' size limits (pi-config.mjs): a request carries those of the latest
+ * KEEP_PICTURE_RESULTS tool results that hold one, and at most IMAGE_BUDGET of them, the oldest left out of the request
+ * first (never out of the session). A service refusing a request as too large (HTTP 413, a proxy's page included) is
+ * tried again once with half of those pictures, as Pi tries a busy one; that half stays the conversation's limit. A
+ * request with no pictures in it is not tried again: its own words are too large, and the turn says so.
+ *
* What Pi does goes to the chat as ACP session updates: its words and thinking as they stream, each tool call (its
* kind, title and input) and its result, after each answer how full the context is, and a model service tried again.
*/
@@ -26,7 +32,7 @@ import * as acp from '@agentclientprotocol/sdk';
import { DefaultResourceLoader, ModelRuntime, SessionManager, SettingsManager, createAgentSession } from '@earendil-works/pi-coding-agent';
import { Agent, install, setGlobalDispatcher } from 'undici';
import { agentSessionsDir, openLog } from './chat-store.mjs';
-import { THINKING, WAIT_MINUTES, contextUsed, effortOption, modelOption, modelsJson, providerOf, retryNotice, stopReason, toolCall, toolContent } from './pi-config.mjs';
+import { IMAGE_BUDGET, THINKING, TOO_LARGE, WAIT_MINUTES, contextUsed, effortOption, fitImages, modelOption, modelsJson, providerOf, retryNotice, stopReason, toolCall, toolContent } from './pi-config.mjs';
/* stdout is the protocol's: anything else Pi or a library prints goes to stderr */
console.log = console.info = console.warn = console.debug = (...args) => process.stderr.write(`${args.map(String).join(' ')}\n`);
@@ -119,6 +125,9 @@ async function open(client, cwd, resumeId) {
let pending = null;
/* the session's id, once it has one: the questions `ask` puts are the session's */
let sessionId = null;
+ /* the pictures a request carries at most (pi-config.mjs IMAGE_BUDGET), and those the last one carried (bytes) */
+ let imageBudget = IMAGE_BUDGET;
+ let imagesSent = 0;
const resourceLoader = new DefaultResourceLoader({
cwd, agentDir: config.agentDir, settingsManager, noExtensions: true, noPromptTemplates: true, noThemes: true,
/* OpenFilm's skills, and no other Pi would find (in the project, or its own folders) */
@@ -128,6 +137,14 @@ async function open(client, cwd, resumeId) {
appendSystemPromptOverride: () => [],
agentsFilesOverride: ({ agentsFiles }) => ({ agentsFiles: agentsFiles.filter((f) => dirname(resolve(f.path)) === resolve(cwd)) }),
extensionFactories: [
+ /* each request's pictures within the budget, the oldest left out first: the request only, never the session */
+ { name: 'openfilm-images', hidden: true, factory: (pi) => {
+ pi.on('context', (event) => {
+ const fitted = fitImages(event.messages, imageBudget);
+ imagesSent = fitted.kept;
+ return fitted.messages === event.messages ? undefined : { messages: fitted.messages };
+ });
+ } },
{ name: 'openfilm-log', hidden: true, factory: (pi) => {
pi.on('context_with_system', (event) => { pending = { startedAt: Date.now(), messages: event.messages }; });
} },
@@ -141,6 +158,10 @@ async function open(client, cwd, resumeId) {
...(startEffort !== 'auto' ? { thinkingLevel: startEffort } : {}),
resourceLoader, sessionManager, settingsManager, tools: ['read', 'bash', 'edit', 'write', 'ask'],
});
+ /* a request refused as too large is one Pi tries again (its retry: once, the failed attempt left out of what is sent)
+ when it held pictures to leave out; Pi neither retries a 413 nor, but for Anthropic's own words, compacts for it */
+ const retryable = session._isRetryableError.bind(session);
+ session._isRetryableError = (message) => (TOO_LARGE.test(String(message?.errorMessage ?? '')) ? imagesSent > 0 : retryable(message));
/* what it runs on now, as the chat names it (a conversation taken up again may be on another model and effort) */
const now = ownOf(session.model);
const onModel = now.id ?? startModel;
@@ -165,6 +186,8 @@ async function open(client, cwd, resumeId) {
if (message?.role !== 'assistant') break;
/* the turn's last answer: Pi drops one too long for the model from the conversation as it tries to recover */
entry.answer = message;
+ /* refused as too large: the request tried again (see below) carries half of its pictures */
+ if (message.stopReason === 'error' && TOO_LARGE.test(String(message.errorMessage ?? '')) && imagesSent > 0) imageBudget = Math.floor(imagesSent / 2);
if (pending && entry.log) {
const toolsNow = (session.agent?.state?.tools ?? []).map((t) => ({ name: t.name, description: t.description, parameters: t.parameters }));
entry.log.write({ startedAt: pending.startedAt, messages: pending.messages, toolsNow, answer: { message, systemPrompt: session.systemPrompt } });
diff --git a/apps/desktop/src/pi-agent.test.mjs b/apps/desktop/src/pi-agent.test.mjs
index 1ae758f..4780c31 100644
--- a/apps/desktop/src/pi-agent.test.mjs
+++ b/apps/desktop/src/pi-agent.test.mjs
@@ -2,12 +2,14 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import { createServer } from 'node:http';
import { mkdtempSync } from 'node:fs';
+import { randomBytes } from 'node:crypto';
+import { crc32, deflateSync } from 'node:zlib';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { AgentSession } from './agents.mjs';
/** A service on the Chat Completions API that answers "ok" and notes the model each request named (and each request, and its key). */
-async function service({ broke = false, fails = null, busyOnce = false } = {}) {
+async function service({ broke = false, fails = null, busyOnce = false, largest = Infinity } = {}) {
const asked = [];
const bodies = [];
const keys = [];
@@ -19,6 +21,8 @@ async function service({ broke = false, fails = null, busyOnce = false } = {}) {
asked.push(model);
bodies.push(JSON.parse(body || '{}'));
keys.push(String(req.headers.authorization ?? ''));
+ /* a proxy in front of the service refusing a body past its size, with its own HTML page */
+ if (body.length > largest) { res.writeHead(413, { 'content-type': 'text/html' }); res.end('<html><head><title>413 Request Entity Too Large</title></head><body><center><h1>413 Request Entity Too Large</h1></center><hr><center>openresty</center></body></html>'); return; }
if (broke) { res.writeHead(402, { 'content-type': 'application/json' }); res.end(JSON.stringify({ error: { message: 'Insufficient Balance' } })); return; }
if (busyOnce && asked.length === 1) { res.writeHead(503, { 'content-type': 'application/json' }); res.end(JSON.stringify({ error: { message: 'The service is busy.' } })); return; }
if (fails) { res.writeHead(400, { 'content-type': 'application/json' }); res.end(JSON.stringify({ error: { message: fails } })); return; }
@@ -197,3 +201,79 @@ test('a service that fails and is tried again says so in the chat as a notice, a
svc.close();
}
});
+
+/** A picture of noise, which no encoding makes smaller: `w` × `h`, RGB, as a PNG. */
+function noisePng(w, h) {
+ const chunk = (type, data) => {
+ const head = Buffer.alloc(8);
+ head.writeUInt32BE(data.length, 0);
+ head.write(type, 4, 'ascii');
+ const crc = Buffer.alloc(4);
+ crc.writeUInt32BE(crc32(Buffer.concat([Buffer.from(type, 'ascii'), data])) >>> 0, 0);
+ return Buffer.concat([head, data, crc]);
+ };
+ const ihdr = Buffer.alloc(13);
+ ihdr.writeUInt32BE(w, 0); ihdr.writeUInt32BE(h, 4); ihdr[8] = 8; ihdr[9] = 2;
+ const rows = Buffer.concat(Array.from({ length: h }, () => Buffer.concat([Buffer.from([0]), randomBytes(w * 3)])));
+ return Buffer.concat([Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]), chunk('IHDR', ihdr), chunk('IDAT', deflateSync(rows, { level: 0 })), chunk('IEND', Buffer.alloc(0))]);
+}
+
+test('a request refused as too large is tried again at once with half of its pictures, and the turn goes on', { timeout: 60_000 }, async () => {
+ const svc = await service({ largest: 8 * 1024 * 1024 });
+ const session = new AgentSession({
+ agent: 'byok',
+ cwd: mkdtempSync(join(tmpdir(), 'of-pi-')),
+ harness: { home: mkdtempSync(join(tmpdir(), 'of-pi-home-')), models: [own('a', svc.url)], model: 'a', env: { OPENFILM_BYOK_KEY_a: 'sk' } },
+ });
+ /* fourteen pictures of about 0.95 MB each (Pi sends them as they are): 13 MB, past this service's 8 MB */
+ const pictures = Array.from({ length: 14 }, () => ({ type: 'image', mimeType: 'image/png', data: noisePng(560, 420).toString('base64') }));
+ try {
+ await session.start();
+ await session.prompt([{ type: 'text', text: 'look' }, ...pictures]);
+ assert.equal(svc.bodies.length, 2, 'refused once, then tried again');
+ const last = JSON.stringify(svc.bodies.at(-1));
+ assert.ok(last.length < 8 * 1024 * 1024, 'the request tried again is within the service\'s size');
+ assert.equal((last.match(/left out of this request to keep it small/g) ?? []).length, 7, 'half of the pictures left out, the oldest');
+ } finally {
+ session.close();
+ svc.close();
+ }
+});
+
+test('a request still too large when tried again with half of its pictures says so, and the next message goes on with fewer', { timeout: 60_000 }, async () => {
+ const svc = await service({ largest: 4 * 1024 * 1024 });
+ const session = new AgentSession({
+ agent: 'byok',
+ cwd: mkdtempSync(join(tmpdir(), 'of-pi-')),
+ harness: { home: mkdtempSync(join(tmpdir(), 'of-pi-home-')), models: [own('a', svc.url)], model: 'a', env: { OPENFILM_BYOK_KEY_a: 'sk' } },
+ });
+ const pictures = Array.from({ length: 14 }, () => ({ type: 'image', mimeType: 'image/png', data: noisePng(560, 420).toString('base64') }));
+ try {
+ await session.start();
+ const error = await session.prompt([{ type: 'text', text: 'look' }, ...pictures]).then(() => null, (e) => e);
+ assert.match(error?.message ?? '', /too large for the model service, even with older pictures left out/);
+ await session.prompt([{ type: 'text', text: 'go on' }]);
+ assert.ok(JSON.stringify(svc.bodies.at(-1)).length < 4 * 1024 * 1024, 'the next message goes with fewer pictures still');
+ } finally {
+ session.close();
+ svc.close();
+ }
+});
+
+test('a request too large with no pictures in it is not tried again, and says so', { timeout: 60_000 }, async () => {
+ const svc = await service({ largest: 10 });
+ const session = new AgentSession({
+ agent: 'byok',
+ cwd: mkdtempSync(join(tmpdir(), 'of-pi-')),
+ harness: { home: mkdtempSync(join(tmpdir(), 'of-pi-home-')), models: [own('a', svc.url)], model: 'a', env: { OPENFILM_BYOK_KEY_a: 'sk' } },
+ });
+ try {
+ await session.start();
+ const error = await session.prompt([{ type: 'text', text: 'hi' }]).then(() => null, (e) => e);
+ assert.match(error?.message ?? '', /too large for the model service/);
+ assert.equal(svc.bodies.length, 1, 'not tried again');
+ } finally {
+ session.close();
+ svc.close();
+ }
+});
diff --git a/apps/desktop/src/pi-config.mjs b/apps/desktop/src/pi-config.mjs
index a1d2e16..7897a08 100644
--- a/apps/desktop/src/pi-config.mjs
+++ b/apps/desktop/src/pi-config.mjs
@@ -41,6 +41,59 @@ const CONTEXT = 128_000;
/** The most a model is asked to write in one answer: a quarter of 128K, so a long context does not ask for more. */
const MAX_OUTPUT = 32_000;
+/**
+ * The pictures one request carries at most (their base64, bytes): 32 MB, the request size Anthropic's API documents
+ * as its limit. Pi makes each picture at most 2000 px and 4.5 MB as it reads it (its defaults), so
+ * a frame keeps its full quality; but every picture goes again with each request after it, and the context's token
+ * count hardly sees a picture's bytes, so nothing else keeps a conversation that looks at many frames under a service's
+ * size limit. Past this, the oldest are left out of the request (never out of the conversation).
+ */
+export const IMAGE_BUDGET = 32 * 1024 * 1024;
+/** A model service refusing a request as too large: HTTP 413, as services and the proxies before them say it. */
+export const TOO_LARGE = /^\s*413\b|request entity too large|payload too large|request_too_large|request too large/i;
+
+/**
+ * The tool results whose pictures a request carries: the latest few that hold one. An older one's pictures are left out
+ * of the request; the agent reads a file again when it needs to look back.
+ */
+export const KEEP_PICTURE_RESULTS = 5;
+
+/**
+ * The conversation as one request sends it: pictures only in the latest KEEP_PICTURE_RESULTS tool results that hold
+ * one, and all of them within `budget` (bytes of base64), the newest kept. Each picture left out is a line saying so
+ * and which file it was, so the agent can read it again. `messages` the same when nothing is left out; `kept`, the
+ * bytes of the pictures that go.
+ * @param {any[]} messages @param {number} budget
+ * @returns {{ messages: any[], kept: number }}
+ */
+export function fitImages(messages, budget) {
+ /* which file each tool call read, to name a picture left out */
+ const paths = new Map();
+ for (const m of messages) {
+ if (m?.role !== 'assistant' || !Array.isArray(m.content)) continue;
+ for (const c of m.content) if (c?.type === 'toolCall' && typeof c.arguments?.path === 'string') paths.set(c.id, c.arguments.path);
+ }
+ let used = 0;
+ let cut = false;
+ let results = 0;
+ const out = [...messages];
+ for (let i = out.length - 1; i >= 0; i--) {
+ const m = out[i];
+ if (!Array.isArray(m?.content) || !m.content.some((c) => c?.type === 'image')) continue;
+ const old = m.role === 'toolResult' && ++results > KEEP_PICTURE_RESULTS;
+ const content = m.content.map((c) => {
+ if (c?.type !== 'image') return c;
+ const size = String(c.data ?? '').length;
+ if (!old && used + size <= budget) { used += size; return c; }
+ cut = true;
+ const path = m.role === 'toolResult' ? paths.get(m.toolCallId) : undefined;
+ return { type: 'text', text: `[A picture${path ? ` (${path})` : ''} was left out of this request to keep it small. Read it again to see it.]` };
+ });
+ out[i] = { ...m, content };
+ }
+ return { messages: cut ? out : messages, kept: used };
+}
+
/**
* A model's context length as kept: a whole number of tokens from 32K to 10M, as the person gave it in Settings (the
* service documents it; OpenFilm cannot know it). Null for none or anything else: the model gets 128K.
@@ -165,6 +218,7 @@ export function failureText(said) {
if (TIMED_OUT.test(text)) return `The model service didn't answer for ${WAIT_MINUTES} minutes, even after trying again. Check that the service is running and reachable, then try again.`;
if (PI_OVERFLOW.test(text)) return `${text} ${CONTEXT_HINT}`;
if (OVERFLOW.test(text)) return `The conversation is too long for the model. ${CONTEXT_HINT}`;
+ if (TOO_LARGE.test(text)) return 'The request is too large for the model service, even with older pictures left out. Send your message again to go on with fewer, or start a new conversation.';
return text;
}
@@ -175,6 +229,7 @@ export function failureText(said) {
export function retryNotice(event) {
const said = String(event?.errorMessage ?? '').trim();
const again = `trying again (${event?.attempt ?? 1} of ${event?.maxAttempts ?? 1}).`;
+ if (TOO_LARGE.test(said)) return { sessionUpdate: 'notice', severity: 'warning', title: `The request was too large for the model service; ${again.replace(/\.$/, '')} with half of the older pictures left out.` };
if (TIMED_OUT.test(said)) return { sessionUpdate: 'notice', severity: 'warning', title: `The model service didn't answer for ${WAIT_MINUTES} minutes; ${again}` };
return { sessionUpdate: 'notice', severity: 'warning', title: `The model service failed; ${again}`, ...(said ? { description: said } : {}) };
}
diff --git a/apps/desktop/src/pi-config.test.mjs b/apps/desktop/src/pi-config.test.mjs
index fce0b2e..ccb9b48 100644
--- a/apps/desktop/src/pi-config.test.mjs
+++ b/apps/desktop/src/pi-config.test.mjs
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { THINKING, contextLength, contextUsed, effortOption, failureText, modelEffort, modelOption, modelsJson, outOfBalance, providerOf, retryNotice, stopReason, toolCall, toolContent } from './pi-config.mjs';
+import { IMAGE_BUDGET, KEEP_PICTURE_RESULTS, THINKING, TOO_LARGE, contextLength, contextUsed, effortOption, failureText, fitImages, modelEffort, modelOption, modelsJson, outOfBalance, providerOf, retryNotice, stopReason, toolCall, toolContent } from './pi-config.mjs';
/** One of the person's own models, as the roster's harness gives it. */
const own = (id, over = {}) => ({ id, name: id.toUpperCase(), api: 'openai-completions', baseUrl: `https://${id}.test/v1`, keyEnv: `K_${id}`, model: `${id}-model`, levels: ['auto'], effort: 'auto', ...over });
@@ -119,3 +119,56 @@ test('a model service tried again, as a notice: one that sent nothing in time in
sessionUpdate: 'notice', severity: 'warning', title: 'The model service failed; trying again (1 of 2).', description: '503 Service Unavailable',
});
});
+
+test("each of the person's models reads pictures as Pi does (2000 px, 4.5 MB at most), and a request carries 32 MB of them", () => {
+ const [model] = modelsJson([own('a')]).providers[providerOf('a')].models;
+ assert.equal(model.inputLimits, undefined, 'Pi\'s own picture limits');
+ assert.equal(IMAGE_BUDGET, 32 * 1024 * 1024);
+});
+
+test("a request's pictures within its budget: the newest kept, the older ones a line naming their file", () => {
+ const pic = (n) => ({ type: 'image', mimeType: 'image/png', data: 'x'.repeat(n) });
+ const messages = [
+ { role: 'user', content: [{ type: 'text', text: 'look' }, pic(40)] },
+ { role: 'assistant', content: [{ type: 'toolCall', id: 't1', name: 'read', arguments: { path: '.film/look/00.03.png' } }] },
+ { role: 'toolResult', toolCallId: 't1', toolName: 'read', content: [{ type: 'text', text: 'Read image file [image/png]' }, pic(50)] },
+ { role: 'assistant', content: [{ type: 'toolCall', id: 't2', name: 'read', arguments: { path: '.film/look/00.07.png' } }] },
+ { role: 'toolResult', toolCallId: 't2', toolName: 'read', content: [pic(60)] },
+ ];
+ assert.deepEqual(fitImages(messages, 150), { messages, kept: 150 }, 'within it: the same messages');
+ assert.equal(fitImages(messages, 150).messages, messages);
+ const { messages: fitted, kept } = fitImages(messages, 120);
+ assert.equal(kept, 110);
+ assert.deepEqual(fitted[4].content, [pic(60)], 'the newest kept');
+ assert.deepEqual(fitted[2].content[1], pic(50));
+ assert.match(fitted[0].content[1].text, /^\[A picture was left out of this request/, 'the oldest left out');
+ const tighter = fitImages(messages, 100).messages;
+ assert.equal(tighter[2].content[1].text, '[A picture (.film/look/00.03.png) was left out of this request to keep it small. Read it again to see it.]');
+ assert.equal(messages[2].content[1].type, 'image', 'the conversation itself is left as it was');
+});
+
+test('a request refused as too large is told apart from other failures, and said in plain words', () => {
+ assert.ok(TOO_LARGE.test('413 <html><head><title>413 Request Entity Too Large</title></head></html>'));
+ assert.ok(TOO_LARGE.test('413 status code (no body)'));
+ assert.ok(TOO_LARGE.test('Payload Too Large'));
+ assert.ok(!TOO_LARGE.test('400 The prompt has 413 tokens too many'));
+ assert.match(failureText('413 <html>openresty</html>'), /too large for the model service, even with older pictures left out/);
+ assert.equal(retryNotice({ attempt: 1, maxAttempts: 1, errorMessage: '413 <html>openresty</html>' }).title,
+ 'The request was too large for the model service; trying again (1 of 1) with half of the older pictures left out.');
+});
+
+test("pictures only in the latest five tool results that hold one; an older one's a line naming its file", () => {
+ assert.equal(KEEP_PICTURE_RESULTS, 5);
+ const pic = { type: 'image', mimeType: 'image/png', data: 'x' };
+ const messages = [{ role: 'user', content: [{ type: 'text', text: 'look' }, pic] }];
+ for (let n = 1; n <= 7; n++) {
+ messages.push({ role: 'assistant', content: [{ type: 'toolCall', id: `t${n}`, name: 'read', arguments: { path: `f${n}.png` } }] });
+ messages.push({ role: 'toolResult', toolCallId: `t${n}`, toolName: 'read', content: [{ type: 'text', text: 'Read image file [image/png]' }, pic] });
+ }
+ const { messages: fitted, kept } = fitImages(messages, Infinity);
+ const shown = fitted.filter((m) => m.role === 'toolResult').map((m) => m.content[1].type);
+ assert.deepEqual(shown, ['text', 'text', 'image', 'image', 'image', 'image', 'image'], 'the latest five keep theirs');
+ assert.equal(fitted[2].content[1].text, '[A picture (f1.png) was left out of this request to keep it small. Read it again to see it.]');
+ assert.equal(fitted[0].content[1].type, 'image', 'a picture the person attached is not a tool result');
+ assert.equal(kept, 6);
+});
diff --git a/packages/openfilm/studio/ui/src/components/settings/AgentsSection.tsx b/packages/openfilm/studio/ui/src/components/settings/AgentsSection.tsx
index b7045f2..4950fbb 100644
--- a/packages/openfilm/studio/ui/src/components/settings/AgentsSection.tsx
+++ b/packages/openfilm/studio/ui/src/components/settings/AgentsSection.tsx
@@ -476,6 +476,7 @@ function OwnModels({ agent, onDone }: { agent: HostAgent; onDone: () => void })
</div>
) : null}
<p className="text-[13px] leading-relaxed text-[var(--text-faint)]">{t('settings.agents.byokNote')}</p>
+ <p className="text-[13px] leading-relaxed text-[var(--text-faint)]">{t('settings.agents.byokRules')}</p>
</SettingsInset>
);
}
diff --git a/packages/openfilm/studio/ui/src/i18n/en.ts b/packages/openfilm/studio/ui/src/i18n/en.ts
index 7d3e08d..8dc7c0b 100644
--- a/packages/openfilm/studio/ui/src/i18n/en.ts
+++ b/packages/openfilm/studio/ui/src/i18n/en.ts
@@ -1700,6 +1700,7 @@ export const en = {
keyPlaceholder: 'Paste your API key',
keyKept: 'Key ending in {last4} (leave empty to keep it)',
byokNote: 'Each model has to read pictures: the agent looks at its own frames. Your keys stay on this computer, and each goes only to its service.',
+ byokRules: 'Its rules are the project\'s own AGENTS.md (or CLAUDE.md), in the project\'s folder. One kept anywhere else, in a folder above or with the agent\'s settings, is not read.',
save: 'Check and save',
checkingKey: 'Checking…',
cancel: 'Cancel',
diff --git a/packages/openfilm/studio/ui/src/i18n/es.ts b/packages/openfilm/studio/ui/src/i18n/es.ts
index 706c610..5a4aa55 100644
--- a/packages/openfilm/studio/ui/src/i18n/es.ts
+++ b/packages/openfilm/studio/ui/src/i18n/es.ts
@@ -1699,6 +1699,7 @@ export const es: Words = {
keyPlaceholder: 'Pega tu clave de API',
keyKept: 'Clave terminada en {last4} (déjalo vacío para conservarla)',
byokNote: 'Cada modelo tiene que poder leer imágenes: el agente mira sus propios fotogramas. Tus claves se quedan en este equipo y cada una solo se envía a su servicio.',
+ byokRules: 'Sus reglas son el AGENTS.md (o CLAUDE.md) de la carpeta del proyecto. Uno guardado en otro sitio, en una carpeta superior o con los ajustes del agente, no se lee.',
save: 'Comprobar y guardar',
checkingKey: 'Comprobando…',
cancel: 'Cancelar',
diff --git a/packages/openfilm/studio/ui/src/i18n/ja.ts b/packages/openfilm/studio/ui/src/i18n/ja.ts
index 9fabea1..d1e4cf1 100644
--- a/packages/openfilm/studio/ui/src/i18n/ja.ts
+++ b/packages/openfilm/studio/ui/src/i18n/ja.ts
@@ -1699,6 +1699,7 @@ export const ja: Words = {
keyPlaceholder: 'API キーを貼り付け',
keyKept: '末尾が {last4} のキー(空欄のままにすると現在のキーを使います)',
byokNote: 'どのモデルも画像を読める必要があります。エージェントは自分で作ったフレームを確認するためです。キーはこのコンピューターに保存され、それぞれのサービス以外には送信されません。',
+ byokRules: '従うルールは、プロジェクトのフォルダにある AGENTS.md(または CLAUDE.md)だけです。上位のフォルダやエージェントの設定フォルダなど、ほかの場所にあるものは読まれません。',
save: '確認して保存',
checkingKey: '確認中…',
cancel: 'キャンセル',
diff --git a/packages/openfilm/studio/ui/src/i18n/ko.ts b/packages/openfilm/studio/ui/src/i18n/ko.ts
index e753573..299b852 100644
--- a/packages/openfilm/studio/ui/src/i18n/ko.ts
+++ b/packages/openfilm/studio/ui/src/i18n/ko.ts
@@ -1698,6 +1698,7 @@ export const ko: Words = {
keyPlaceholder: 'API 키 붙여넣기',
keyKept: '{last4}(으)로 끝나는 키(유지하려면 비워 두세요)',
byokNote: '모든 모델이 이미지를 읽을 수 있어야 합니다. 에이전트가 직접 만든 프레임을 확인하기 때문입니다. 키는 이 컴퓨터에만 저장되며 각자의 서비스로만 전송됩니다.',
+ byokRules: '따르는 규칙은 프로젝트 폴더에 있는 AGENTS.md(또는 CLAUDE.md)뿐입니다. 상위 폴더나 에이전트 설정 폴더 등 다른 곳에 둔 파일은 읽지 않습니다.',
save: '확인 후 저장',
checkingKey: '확인 중…',
cancel: '취소',
diff --git a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts b/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
index 13be802..0b97e52 100644
--- a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
+++ b/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
@@ -1700,6 +1700,7 @@ export const zhCN: Words = {
keyPlaceholder: '粘贴你的 API 密钥',
keyKept: '尾号为 {last4} 的密钥(留空则保留)',
byokNote: '每个模型都需要能看图:智能体会查看自己生成的画面。密钥只保存在这台电脑上,且只会发送给各自的服务。',
+ byokRules: '它遵循的规则只来自项目文件夹里的 AGENTS.md(或 CLAUDE.md)。放在别处的,比如上层文件夹或智能体自己的设置目录里,都不会被读取。',
save: '检查并保存',
checkingKey: '正在检查…',
cancel: '取消',