feat: commit the local agent shell, history budget, and loop hardening
These files were already edited on this machine. Publish that tree instead of rewriting a slice onto a GitHub checkout.
This commit is contained in:
@@ -88,6 +88,7 @@ export interface Settings {
|
||||
port: number;
|
||||
data_dir: string;
|
||||
assets_dir: string;
|
||||
agent_workspace_dir: string;
|
||||
db_name: string;
|
||||
llm_base_url: string;
|
||||
llm_model: string;
|
||||
@@ -101,7 +102,9 @@ export interface Settings {
|
||||
queue_max_retries: number;
|
||||
agent_max_steps: number;
|
||||
agent_hardening_prompt: string;
|
||||
agent_history_char_budget: number;
|
||||
agent_llm_assignments: Record<string, string | null>;
|
||||
agent_shell_enabled: boolean;
|
||||
dry_run: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ export const de: Dict = {
|
||||
'nav.skillsBlurb': 'In diesem Projekt verfügbare Agenten-Fähigkeiten.',
|
||||
'nav.queue': 'Warteschlange',
|
||||
'nav.queueBlurb': 'Parallelität und Zeitlimits für Generierungsjobs.',
|
||||
'nav.storage': 'Speicher',
|
||||
'nav.storageBlurb': 'Wo Dateien auf der Festplatte liegen.',
|
||||
'nav.storage': 'Systempfade',
|
||||
'nav.storageBlurb': 'Wo Dateien liegen und wo der Agent arbeiten darf.',
|
||||
|
||||
// --- Toast ---
|
||||
'toast.dismiss': 'Ausblenden',
|
||||
@@ -1012,12 +1012,32 @@ export const de: Dict = {
|
||||
'settings.comfySection': 'ComfyUI',
|
||||
'settings.comfyLead': 'Wo ComfyUI läuft.',
|
||||
'settings.comfyHint': 'Muss von diesem Rechner aus erreichbar sein.',
|
||||
'settings.storageSection': 'Speicher',
|
||||
'settings.storageLead': 'Wo Dateien auf der Festplatte liegen.',
|
||||
'settings.storageSection': 'Systempfade',
|
||||
'settings.storageLead': 'Wo Dateien liegen und wo der Agent arbeiten darf.',
|
||||
'settings.storageCalloutStrong': 'Datenverzeichnis ändern',
|
||||
'settings.storageCalloutBody': 'verschiebt Ressourcen. Bestehende Pfade funktionieren weiter, bis sie hier gesetzt werden.',
|
||||
'settings.dataDir': 'Datenverzeichnis',
|
||||
'settings.assetsDir': 'Ressourcen-Verzeichnis',
|
||||
'settings.workspaceDir': 'Agent-Arbeitsbereich',
|
||||
'settings.workspaceDirHint':
|
||||
'Isolierter Ordner, in dem die Agent-Shell (run_command) arbeiten darf. Leer = DATA_DIR/workspace. Der Agent kann nichts außerhalb anfassen.',
|
||||
'settings.shellSection': 'Agent-Shell',
|
||||
'settings.shellLead': 'Erlaubt dem Agenten, installierte Kommandozeilen-Tools in seinem Arbeitsbereich auszuführen.',
|
||||
'settings.shellCalloutStrong': 'Nur nach Zustimmung:',
|
||||
'settings.shellCalloutBody':
|
||||
'Befehle laufen auf dieser Maschine, auf den Agent-Arbeitsbereich beschränkt. Sensible Dateien (Konfiguration, Datenbank, Zugangsdaten) werden immer abgelehnt; alles Nicht-Lese-Zugriff fragt vorher nach.',
|
||||
'settings.shellLabel': 'Agent-Shell aktivieren (run_command)',
|
||||
'settings.shellHint':
|
||||
'Standardmäßig aus. Wenn aktiv, darf der Agent Inspektionsbefehle (ffprobe) frei ausführen; alles Modifizierende nur nach Freigabe über eine scope="shell"-Fragekarte.',
|
||||
'settings.historyBudgetSection': 'Kontextverlaufs-Budget',
|
||||
'settings.historyBudgetLead':
|
||||
'Begrenzt, wie viel Konversationsverlauf jede Agentenanfrage wiedergibt, damit lange Sitzungen das Kontextfenster des Modells nie überlaufen.',
|
||||
'settings.historyBudgetField': 'Verlaufsbudget (Zeichen)',
|
||||
'settings.historyBudgetHint':
|
||||
'≈4 Zeichen pro Token. Älteste ganze Runden fallen zuerst heraus; die Presets unten sind gute Startwerte.',
|
||||
'settings.historyBudgetSmall': 'Klein · 60k',
|
||||
'settings.historyBudgetMedium': 'Mittel · 120k',
|
||||
'settings.historyBudgetLarge': 'Groß · 400k',
|
||||
'settings.hardeningSection': 'Prompt-Härtung',
|
||||
'settings.hardeningLead': 'Regeln, die Generierungs-Prompts vorangestellt werden.',
|
||||
'settings.hardeningHint': 'Dienen dazu, negative Vorgaben oder Stil-Leitplanken durchzusetzen.',
|
||||
|
||||
@@ -55,8 +55,8 @@ export const en = {
|
||||
'nav.skillsBlurb': 'Agent skills available in this project.',
|
||||
'nav.queue': 'Job queue',
|
||||
'nav.queueBlurb': 'Concurrency and timeouts for generation jobs.',
|
||||
'nav.storage': 'Storage',
|
||||
'nav.storageBlurb': 'Where files live on disk.',
|
||||
'nav.storage': 'System Paths',
|
||||
'nav.storageBlurb': 'Where files live, and where the agent may work.',
|
||||
|
||||
// --- Toast ---
|
||||
'toast.dismiss': 'Dismiss',
|
||||
@@ -1012,12 +1012,32 @@ export const en = {
|
||||
'settings.comfySection': 'ComfyUI',
|
||||
'settings.comfyLead': 'Where ComfyUI runs.',
|
||||
'settings.comfyHint': 'Must be reachable from this machine.',
|
||||
'settings.storageSection': 'Storage',
|
||||
'settings.storageLead': 'Where files live on disk.',
|
||||
'settings.storageSection': 'System Paths',
|
||||
'settings.storageLead': 'Where files live on disk, and where the agent may work.',
|
||||
'settings.storageCalloutStrong': 'Changing data directory',
|
||||
'settings.storageCalloutBody': 'moves assets. Existing paths keep working until set here.',
|
||||
'settings.dataDir': 'Data directory',
|
||||
'settings.assetsDir': 'Assets directory',
|
||||
'settings.workspaceDir': 'Agent workspace',
|
||||
'settings.workspaceDirHint':
|
||||
'Sandbox folder the AI agent’s shell may work in (run_command). Leave empty to use DATA_DIR/workspace. The agent cannot touch anything outside it.',
|
||||
'settings.shellSection': 'Agent shell',
|
||||
'settings.shellLead': 'Let the agent run installed command-line tools in its workspace.',
|
||||
'settings.shellCalloutStrong': 'Opt-in only:',
|
||||
'settings.shellCalloutBody':
|
||||
'commands run on this machine, sandboxed to the agent workspace. Sensitive files (config, database, credentials) are always denied; anything not read-only asks you first.',
|
||||
'settings.shellLabel': 'Enable agent shell (run_command)',
|
||||
'settings.shellHint':
|
||||
'Off by default. When on, the agent may run inspection commands (ffprobe) freely and mutating commands only after you approve a scope="shell" question card.',
|
||||
'settings.historyBudgetSection': 'Context history budget',
|
||||
'settings.historyBudgetLead':
|
||||
'Caps how much conversation history each agent request replays, so long sessions never overflow the model’s context window.',
|
||||
'settings.historyBudgetField': 'History budget (characters)',
|
||||
'settings.historyBudgetHint':
|
||||
'≈4 characters per token. Oldest whole turns drop first; presets below are good starting points.',
|
||||
'settings.historyBudgetSmall': 'Small · 60k',
|
||||
'settings.historyBudgetMedium': 'Medium · 120k',
|
||||
'settings.historyBudgetLarge': 'Large · 400k',
|
||||
'settings.hardeningSection': 'Prompt hardening',
|
||||
'settings.hardeningLead': 'Rules prepended to generation prompts.',
|
||||
'settings.hardeningHint': 'Used to enforce negative constraints or style guardrails.',
|
||||
|
||||
@@ -57,8 +57,8 @@ export const es: Dict = {
|
||||
'nav.skillsBlurb': 'Habilidades del agente disponibles en este proyecto.',
|
||||
'nav.queue': 'Cola de tareas',
|
||||
'nav.queueBlurb': 'Concurrencia y tiempos de espera de las tareas de generación.',
|
||||
'nav.storage': 'Almacenamiento',
|
||||
'nav.storageBlurb': 'Dónde se guardan los archivos en el disco.',
|
||||
'nav.storage': 'Rutas del sistema',
|
||||
'nav.storageBlurb': 'Dónde se guardan los archivos y dónde puede trabajar el agente.',
|
||||
|
||||
// --- Toast ---
|
||||
'toast.dismiss': 'Descartar',
|
||||
@@ -1012,12 +1012,32 @@ export const es: Dict = {
|
||||
'settings.comfySection': 'ComfyUI',
|
||||
'settings.comfyLead': 'Dónde se ejecuta ComfyUI.',
|
||||
'settings.comfyHint': 'Debe ser accesible desde este equipo.',
|
||||
'settings.storageSection': 'Almacenamiento',
|
||||
'settings.storageLead': 'Dónde se guardan los archivos en el disco.',
|
||||
'settings.storageSection': 'Rutas del sistema',
|
||||
'settings.storageLead': 'Dónde se guardan los archivos y dónde puede trabajar el agente.',
|
||||
'settings.storageCalloutStrong': 'Cambiar el directorio de datos',
|
||||
'settings.storageCalloutBody': 'mueve los recursos. Las rutas existentes seguirán funcionando hasta que se establezca aquí.',
|
||||
'settings.dataDir': 'Directorio de datos',
|
||||
'settings.assetsDir': 'Directorio de recursos',
|
||||
'settings.workspaceDir': 'Espacio de trabajo del agente',
|
||||
'settings.workspaceDirHint':
|
||||
'Carpeta aislada donde puede trabajar el shell del agente (run_command). Si se deja vacía, se usa DATA_DIR/workspace. El agente no puede tocar nada fuera de ella.',
|
||||
'settings.shellSection': 'Shell del agente',
|
||||
'settings.shellLead': 'Permite al agente ejecutar herramientas de línea de comandos en su espacio de trabajo.',
|
||||
'settings.shellCalloutStrong': 'Solo con consentimiento:',
|
||||
'settings.shellCalloutBody':
|
||||
'los comandos se ejecutan en esta máquina, aislados en el espacio de trabajo del agente. Los archivos sensibles (configuración, base de datos, credenciales) siempre se rechazan; lo que no sea de solo lectura te lo preguntará antes.',
|
||||
'settings.shellLabel': 'Activar el shell del agente (run_command)',
|
||||
'settings.shellHint':
|
||||
'Desactivado por defecto. Al activarlo, el agente puede ejecutar comandos de inspección (ffprobe) libremente, y los comandos de modificación solo tras aprobar una tarjeta de pregunta scope="shell".',
|
||||
'settings.historyBudgetSection': 'Presupuesto de historial de contexto',
|
||||
'settings.historyBudgetLead':
|
||||
'Limita cuánto historial de conversación repite cada solicitud del agente, para que las sesiones largas nunca desborden la ventana de contexto del modelo.',
|
||||
'settings.historyBudgetField': 'Presupuesto de historial (caracteres)',
|
||||
'settings.historyBudgetHint':
|
||||
'≈4 caracteres por token. Los turnos más antiguos se descartan primero; los preajustes de abajo son buenos puntos de partida.',
|
||||
'settings.historyBudgetSmall': 'Pequeño · 60k',
|
||||
'settings.historyBudgetMedium': 'Medio · 120k',
|
||||
'settings.historyBudgetLarge': 'Grande · 400k',
|
||||
'settings.hardeningSection': 'Refuerzo de prompts',
|
||||
'settings.hardeningLead': 'Reglas que se añaden al inicio de los prompts de generación.',
|
||||
'settings.hardeningHint': 'Sirve para imponer restricciones negativas o límites de estilo.',
|
||||
|
||||
@@ -57,8 +57,8 @@ export const fr: Dict = {
|
||||
'nav.skillsBlurb': "Compétences de l'agent disponibles dans ce projet.",
|
||||
'nav.queue': "File d'attente",
|
||||
'nav.queueBlurb': 'Parallélisme et délais des tâches de génération.',
|
||||
'nav.storage': 'Stockage',
|
||||
'nav.storageBlurb': 'Où les fichiers sont stockés sur le disque.',
|
||||
'nav.storage': 'Chemins système',
|
||||
'nav.storageBlurb': "Où les fichiers sont stockés et où l'agent peut travailler.",
|
||||
|
||||
// --- Toast ---
|
||||
'toast.dismiss': 'Ignorer',
|
||||
@@ -1012,12 +1012,32 @@ export const fr: Dict = {
|
||||
'settings.comfySection': 'ComfyUI',
|
||||
'settings.comfyLead': "Où ComfyUI s'exécute.",
|
||||
'settings.comfyHint': 'Doit être accessible depuis cette machine.',
|
||||
'settings.storageSection': 'Stockage',
|
||||
'settings.storageLead': 'Où les fichiers sont stockés sur le disque.',
|
||||
'settings.storageSection': 'Chemins système',
|
||||
'settings.storageLead': "Où les fichiers sont stockés et où l'agent peut travailler.",
|
||||
'settings.storageCalloutStrong': 'Changer le répertoire de données',
|
||||
'settings.storageCalloutBody': "déplace les ressources. Les chemins existants continuent de fonctionner jusqu'à la définition ici.",
|
||||
'settings.dataDir': 'Répertoire de données',
|
||||
'settings.assetsDir': 'Répertoire des ressources',
|
||||
'settings.workspaceDir': "Espace de travail de l'agent",
|
||||
'settings.workspaceDirHint':
|
||||
"Dossier isolé où le shell de l'agent (run_command) peut travailler. Vide = DATA_DIR/workspace. L'agent ne peut rien toucher en dehors.",
|
||||
'settings.shellSection': "Shell de l'agent",
|
||||
'settings.shellLead': "Permet à l'agent d'exécuter des outils en ligne de commande dans son espace de travail.",
|
||||
'settings.shellCalloutStrong': 'Sur activation :',
|
||||
'settings.shellCalloutBody':
|
||||
"les commandes s'exécutent sur cette machine, isolées dans l'espace de travail de l'agent. Les fichiers sensibles (config, base de données, identifiants) sont toujours refusés ; tout ce qui n'est pas en lecture seule vous est demandé avant.",
|
||||
'settings.shellLabel': "Activer le shell de l'agent (run_command)",
|
||||
'settings.shellHint':
|
||||
'Désactivé par défaut. Une fois activé, l\'agent peut lancer librement des commandes d\'inspection (ffprobe) ; les commandes modifiantes ne passent qu\'après approbation via une carte de question scope="shell".',
|
||||
'settings.historyBudgetSection': 'Budget d\'historique du contexte',
|
||||
'settings.historyBudgetLead':
|
||||
'Limite la quantité d\'historique de conversation rejouée à chaque requête de l\'agent, afin que les longues sessions ne débordent jamais de la fenêtre de contexte du modèle.',
|
||||
'settings.historyBudgetField': 'Budget d\'historique (caractères)',
|
||||
'settings.historyBudgetHint':
|
||||
'≈4 caractères par token. Les tours les plus anciens sont d\'abord retirés ; les préréglages ci-dessous sont de bons points de départ.',
|
||||
'settings.historyBudgetSmall': 'Petit · 60k',
|
||||
'settings.historyBudgetMedium': 'Moyen · 120k',
|
||||
'settings.historyBudgetLarge': 'Grand · 400k',
|
||||
'settings.hardeningSection': 'Renforcement du prompt',
|
||||
'settings.hardeningLead': 'Règles ajoutées au début des prompts de génération.',
|
||||
'settings.hardeningHint': 'Sert à imposer des contraintes négatives ou des garde-fous de style.',
|
||||
|
||||
@@ -57,8 +57,8 @@ export const ja: Dict = {
|
||||
'nav.skillsBlurb': 'このプロジェクトで利用できるエージェントスキル。',
|
||||
'nav.queue': 'ジョブキュー',
|
||||
'nav.queueBlurb': '生成ジョブの並列数とタイムアウト。',
|
||||
'nav.storage': 'ストレージ',
|
||||
'nav.storageBlurb': 'ファイルの保存先。',
|
||||
'nav.storage': 'システムパス',
|
||||
'nav.storageBlurb': 'ファイルの保存先とエージェントの作業場所。',
|
||||
|
||||
// --- Toast ---
|
||||
'toast.dismiss': '閉じる',
|
||||
@@ -1012,12 +1012,32 @@ export const ja: Dict = {
|
||||
'settings.comfySection': 'ComfyUI',
|
||||
'settings.comfyLead': 'ComfyUI の実行場所。',
|
||||
'settings.comfyHint': 'このマシンから到達できる必要があります。',
|
||||
'settings.storageSection': 'ストレージ',
|
||||
'settings.storageLead': 'ファイルの保存先。',
|
||||
'settings.storageSection': 'システムパス',
|
||||
'settings.storageLead': 'ファイルの保存先と、エージェントの作業場所。',
|
||||
'settings.storageCalloutStrong': 'データディレクトリの変更',
|
||||
'settings.storageCalloutBody': 'はアセットを移動します。既存のパスはここで設定するまで引き続き機能します。',
|
||||
'settings.dataDir': 'データディレクトリ',
|
||||
'settings.assetsDir': 'アセットディレクトリ',
|
||||
'settings.workspaceDir': 'エージェントワークスペース',
|
||||
'settings.workspaceDirHint':
|
||||
'エージェントのシェル(run_command)が作業できるサンドボックスフォルダ。空欄の場合は DATA_DIR/workspace を使用します。エージェントはこのフォルダの外にはアクセスできません。',
|
||||
'settings.shellSection': 'エージェントシェル',
|
||||
'settings.shellLead': 'ワークスペース内でインストール済みのコマンドラインツールを実行できるようにします。',
|
||||
'settings.shellCalloutStrong': 'オプトイン:',
|
||||
'settings.shellCalloutBody':
|
||||
'コマンドはこのマシン上で実行されますが、エージェントワークスペースにサンドボックス化されます。機密ファイル(設定・データベース・資格情報)は常に拒否され、読み取り専用以外のコマンドは事前に確認を求めます。',
|
||||
'settings.shellLabel': 'エージェントシェルを有効化(run_command)',
|
||||
'settings.shellHint':
|
||||
'デフォルトはオフです。オンにすると、検査系コマンド(ffprobe)は自由に実行でき、変更を伴うコマンドは scope="shell" の質問カードで承認を得た後にのみ実行されます。',
|
||||
'settings.historyBudgetSection': 'コンテキスト履歴バジェット',
|
||||
'settings.historyBudgetLead':
|
||||
'各エージェント要求が再生する会話履歴の量を制限し、長いセッションでもモデルのコンテキストウィンドウがあふれないようにします。',
|
||||
'settings.historyBudgetField': '履歴バジェット(文字数)',
|
||||
'settings.historyBudgetHint':
|
||||
'≈1トークン4文字。最も古いターンから先に除外されます。下のプリセットが良い出発点です。',
|
||||
'settings.historyBudgetSmall': '小 · 60k',
|
||||
'settings.historyBudgetMedium': '中 · 120k',
|
||||
'settings.historyBudgetLarge': '大 · 400k',
|
||||
'settings.hardeningSection': 'プロンプトのハードニング',
|
||||
'settings.hardeningLead': '生成プロンプトの先頭に付加されるルール。',
|
||||
'settings.hardeningHint': 'ネガティブ制約やスタイルのガードレールの適用に使います。',
|
||||
|
||||
@@ -57,8 +57,8 @@ export const ko: Dict = {
|
||||
'nav.skillsBlurb': '이 프로젝트에서 사용할 수 있는 에이전트 스킬입니다.',
|
||||
'nav.queue': '작업 대기열',
|
||||
'nav.queueBlurb': '생성 작업의 동시 실행 수와 시간 초과를 설정합니다.',
|
||||
'nav.storage': '저장소',
|
||||
'nav.storageBlurb': '파일이 디스크에 저장되는 위치입니다.',
|
||||
'nav.storage': '시스템 경로',
|
||||
'nav.storageBlurb': '파일이 저장되는 위치와 에이전트가 작업할 수 있는 위치입니다.',
|
||||
|
||||
// --- Toast ---
|
||||
'toast.dismiss': '닫기',
|
||||
@@ -1012,12 +1012,32 @@ export const ko: Dict = {
|
||||
'settings.comfySection': 'ComfyUI',
|
||||
'settings.comfyLead': 'ComfyUI가 실행되는 위치입니다.',
|
||||
'settings.comfyHint': '이 컴퓨터에서 접근할 수 있어야 합니다.',
|
||||
'settings.storageSection': '저장소',
|
||||
'settings.storageLead': '파일이 디스크에 저장되는 위치입니다.',
|
||||
'settings.storageSection': '시스템 경로',
|
||||
'settings.storageLead': '파일이 저장되는 위치와 에이전트가 작업할 수 있는 위치입니다.',
|
||||
'settings.storageCalloutStrong': '데이터 디렉터리를 변경하면',
|
||||
'settings.storageCalloutBody': '에셋이 이동합니다. 여기에 설정하기 전까지 기존 경로는 계속 작동합니다.',
|
||||
'settings.dataDir': '데이터 디렉터리',
|
||||
'settings.assetsDir': '에셋 디렉터리',
|
||||
'settings.workspaceDir': '에이전트 작업 공간',
|
||||
'settings.workspaceDirHint':
|
||||
'에이전트 셸(run_command)이 작업할 수 있는 샌드박스 폴더입니다. 비워 두면 DATA_DIR/workspace를 사용합니다. 에이전트는 이 폴더 밖의 어떤 것도 건드릴 수 없습니다.',
|
||||
'settings.shellSection': '에이전트 셸',
|
||||
'settings.shellLead': '에이전트가 작업 공간 안에서 설치된 명령줄 도구를 실행할 수 있게 합니다.',
|
||||
'settings.shellCalloutStrong': '직접 허용 필요:',
|
||||
'settings.shellCalloutBody':
|
||||
'명령은 이 머신에서, 에이전트 작업 공간으로 샌드박스되어 실행됩니다. 민감한 파일(설정, 데이터베이스, 자격 증명)은 항상 거부되며, 읽기 전용이 아닌 명령은 먼저 사용자에게 묻습니다.',
|
||||
'settings.shellLabel': '에이전트 셸 사용 (run_command)',
|
||||
'settings.shellHint':
|
||||
'기본값은 꺼짐입니다. 켜면 에이전트가 검사 명령(ffprobe)은 자유롭게 실행할 수 있고, 변경 명령은 scope="shell" 질문 카드로 승인받은 후에만 실행됩니다.',
|
||||
'settings.historyBudgetSection': '컨텍스트 기록 예산',
|
||||
'settings.historyBudgetLead':
|
||||
'각 에이전트 요청이 재생하는 대화 기록의 양을 제한하여, 긴 세션도 모델의 컨텍스트 창을 넘치지 않도록 합니다.',
|
||||
'settings.historyBudgetField': '기록 예산 (문자 수)',
|
||||
'settings.historyBudgetHint':
|
||||
'약 토큰당 4문자입니다. 가장 오래된 대화 턴부터 먼저 제외되며, 아래 프리셋이 좋은 시작점입니다.',
|
||||
'settings.historyBudgetSmall': '소형 · 60k',
|
||||
'settings.historyBudgetMedium': '중형 · 120k',
|
||||
'settings.historyBudgetLarge': '대형 · 400k',
|
||||
'settings.hardeningSection': '프롬프트 강화',
|
||||
'settings.hardeningLead': '생성 프롬프트 앞에 추가되는 규칙입니다.',
|
||||
'settings.hardeningHint': '네거티브 제약이나 스타일 가드레일을 적용할 때 사용합니다.',
|
||||
|
||||
@@ -57,8 +57,8 @@ export const zh: Dict = {
|
||||
'nav.skillsBlurb': '本项目可用的智能体技能。',
|
||||
'nav.queue': '任务队列',
|
||||
'nav.queueBlurb': '生成任务的并发数与超时设置。',
|
||||
'nav.storage': '存储',
|
||||
'nav.storageBlurb': '文件在磁盘上的位置。',
|
||||
'nav.storage': '系统路径',
|
||||
'nav.storageBlurb': '文件在磁盘上的位置,以及代理可以工作的位置。',
|
||||
|
||||
// --- Toast ---
|
||||
'toast.dismiss': '关闭',
|
||||
@@ -1012,12 +1012,32 @@ export const zh: Dict = {
|
||||
'settings.comfySection': 'ComfyUI',
|
||||
'settings.comfyLead': 'ComfyUI 的运行位置。',
|
||||
'settings.comfyHint': '必须能从本机访问。',
|
||||
'settings.storageSection': '存储',
|
||||
'settings.storageLead': '文件在磁盘上的位置。',
|
||||
'settings.storageSection': '系统路径',
|
||||
'settings.storageLead': '文件在磁盘上的位置,以及 AI 代理可以工作的位置。',
|
||||
'settings.storageCalloutStrong': '更改数据目录',
|
||||
'settings.storageCalloutBody': '会移动素材。在你于此设置之前,现有路径仍可正常使用。',
|
||||
'settings.dataDir': '数据目录',
|
||||
'settings.assetsDir': '素材目录',
|
||||
'settings.workspaceDir': '代理工作区',
|
||||
'settings.workspaceDirHint':
|
||||
'AI 代理 shell(run_command)可以工作的沙盒文件夹。留空则使用 DATA_DIR/workspace。代理无法触及该文件夹之外的任何内容。',
|
||||
'settings.shellSection': '代理 Shell',
|
||||
'settings.shellLead': '允许代理在其工作区内运行已安装的命令行工具。',
|
||||
'settings.shellCalloutStrong': '需手动开启:',
|
||||
'settings.shellCalloutBody':
|
||||
'命令在本机运行,且被沙盒限制在代理工作区内。敏感文件(配置、数据库、凭据)始终被拒绝;非只读操作会先询问你。',
|
||||
'settings.shellLabel': '启用代理 Shell(run_command)',
|
||||
'settings.shellHint':
|
||||
'默认关闭。开启后,代理可以自由运行检查类命令(ffprobe),修改类命令需先通过 scope="shell" 的提问卡片征得你同意。',
|
||||
'settings.historyBudgetSection': '上下文历史预算',
|
||||
'settings.historyBudgetLead':
|
||||
'限制每次代理请求重放的对话历史数量,避免长会话溢出模型的上下文窗口。',
|
||||
'settings.historyBudgetField': '历史预算(字符数)',
|
||||
'settings.historyBudgetHint':
|
||||
'约每 token 4 个字符。最早的整轮对话最先被丢弃;下方预设是不错的起点。',
|
||||
'settings.historyBudgetSmall': '小 · 60k',
|
||||
'settings.historyBudgetMedium': '中 · 120k',
|
||||
'settings.historyBudgetLarge': '大 · 400k',
|
||||
'settings.hardeningSection': '提示词加固',
|
||||
'settings.hardeningLead': '添加到生成提示词前面的规则。',
|
||||
'settings.hardeningHint': '用于强制执行负面约束或风格护栏。',
|
||||
|
||||
@@ -54,9 +54,12 @@
|
||||
agent_max_steps: 'queue',
|
||||
agent_hardening_prompt: 'agent',
|
||||
agent_llm_assignments: 'agent',
|
||||
agent_history_char_budget: 'agent',
|
||||
data_dir: 'storage',
|
||||
assets_dir: 'storage',
|
||||
agent_workspace_dir: 'storage',
|
||||
db_name: 'storage',
|
||||
agent_shell_enabled: 'agent',
|
||||
};
|
||||
// Mirrors backend Field(ge=..., le=...) limits — validated client-side so
|
||||
// save never trips a raw 422.
|
||||
@@ -66,6 +69,7 @@
|
||||
queue_poll_timeout_sec: { min: 0, max: 86400, labelKey: 'settings.pollTimeoutField' },
|
||||
queue_max_retries: { min: 0, max: 10, labelKey: 'settings.maxRetriesField' },
|
||||
agent_max_steps: { min: 1, max: 100, labelKey: 'settings.agentMaxStepsField' },
|
||||
agent_history_char_budget: { min: 10000, max: 2000000, labelKey: 'settings.historyBudgetField' },
|
||||
};
|
||||
const dirtyTabs = $derived(
|
||||
new Set(dirtyKeys.map((k) => FIELD_TAB[k]).filter((t): t is string => Boolean(t))),
|
||||
@@ -205,6 +209,26 @@
|
||||
return s.dry_run === true;
|
||||
}
|
||||
|
||||
function shellChecked(s: Settings): boolean {
|
||||
if (draft.agent_shell_enabled !== undefined) return Boolean(draft.agent_shell_enabled);
|
||||
return s.agent_shell_enabled === true;
|
||||
}
|
||||
|
||||
// History budget presets (chars). Large matches the backend default (400k).
|
||||
const HISTORY_BUDGET_PRESETS: { value: number; labelKey: string }[] = [
|
||||
{ value: 60_000, labelKey: 'settings.historyBudgetSmall' },
|
||||
{ value: 120_000, labelKey: 'settings.historyBudgetMedium' },
|
||||
{ value: 400_000, labelKey: 'settings.historyBudgetLarge' },
|
||||
];
|
||||
|
||||
function historyBudgetActive(s: Settings, value: number): boolean {
|
||||
const current =
|
||||
draft.agent_history_char_budget !== undefined
|
||||
? Number(draft.agent_history_char_budget)
|
||||
: Number(s.agent_history_char_budget ?? 0);
|
||||
return current === value;
|
||||
}
|
||||
|
||||
// Snap out-of-range numbers back into the valid range when the user leaves
|
||||
// the field, so a typed 200 never reaches the backend.
|
||||
function clampOnBlur(e: FocusEvent, key: string) {
|
||||
@@ -609,6 +633,60 @@
|
||||
></textarea>
|
||||
<p class="field-hint">{t('settings.hardeningHint')}</p>
|
||||
</label>
|
||||
</section>
|
||||
<section class="panel">
|
||||
<h1>{t('settings.historyBudgetSection')}</h1>
|
||||
<p class="lead">{t('settings.historyBudgetLead')}</p>
|
||||
<label class="field">
|
||||
<span class="field-label">{t('settings.historyBudgetField')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors.agent_history_char_budget}
|
||||
type="number"
|
||||
min="10000"
|
||||
max="2000000"
|
||||
step="1000"
|
||||
value={String(fieldValue('agent_history_char_budget', s.agent_history_char_budget))}
|
||||
oninput={(e) => (draft.agent_history_char_budget = e.currentTarget.value)}
|
||||
onblur={(e) => clampOnBlur(e, 'agent_history_char_budget')}
|
||||
/>
|
||||
{#if validationErrors.agent_history_char_budget}
|
||||
<p class="field-error">{validationErrors.agent_history_char_budget}</p>
|
||||
{/if}
|
||||
<div class="preset-chips">
|
||||
{#each HISTORY_BUDGET_PRESETS as preset (preset.value)}
|
||||
<button
|
||||
type="button"
|
||||
class="preset-chip"
|
||||
class:active={historyBudgetActive(s, preset.value)}
|
||||
onclick={() => (draft.agent_history_char_budget = String(preset.value))}
|
||||
>
|
||||
{t(preset.labelKey)}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
<p class="field-hint">{t('settings.historyBudgetHint')}</p>
|
||||
</label>
|
||||
</section>
|
||||
<section class="panel">
|
||||
<h1>{t('settings.shellSection')}</h1>
|
||||
<p class="lead">{t('settings.shellLead')}</p>
|
||||
<div class="callout">
|
||||
<Icon name="alert" size={16} />
|
||||
<p>
|
||||
<strong>{t('settings.shellCalloutStrong')}</strong>{' '}
|
||||
{t('settings.shellCalloutBody')}
|
||||
</p>
|
||||
</div>
|
||||
<label class="check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={shellChecked(s)}
|
||||
onchange={(e) => (draft.agent_shell_enabled = e.currentTarget.checked)}
|
||||
/>
|
||||
{t('settings.shellLabel')}
|
||||
</label>
|
||||
<p class="field-hint">{t('settings.shellHint')}</p>
|
||||
</section>
|
||||
<MemoryPanel />
|
||||
{:else if tab === 'storage'}
|
||||
@@ -640,6 +718,16 @@
|
||||
/>
|
||||
<p class="field-hint">{t('settings.current')} <code class="mono">{s.assets_dir}</code></p>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">{t('settings.workspaceDir')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
value={String(fieldValue('agent_workspace_dir', s.agent_workspace_dir))}
|
||||
oninput={(e) => (draft.agent_workspace_dir = e.currentTarget.value)}
|
||||
/>
|
||||
<p class="field-hint">{t('settings.workspaceDirHint')}</p>
|
||||
<p class="field-hint">{t('settings.current')} <code class="mono">{s.agent_workspace_dir}</code></p>
|
||||
</label>
|
||||
</section>
|
||||
{:else if tab === 'workflows'}
|
||||
<WorkflowsLibrary />
|
||||
@@ -734,6 +822,31 @@
|
||||
.check input {
|
||||
width: auto;
|
||||
}
|
||||
.preset-chips {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.preset-chip {
|
||||
border: 1px solid var(--border);
|
||||
background: transparent;
|
||||
color: var(--text-secondary);
|
||||
border-radius: 999px;
|
||||
padding: 4px 12px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, color 0.15s, background 0.15s;
|
||||
}
|
||||
.preset-chip:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.preset-chip.active {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent);
|
||||
color: var(--accent-contrast, #0b0e14);
|
||||
}
|
||||
.callout {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
Reference in New Issue
Block a user