Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:recycle: Unify workspace AI instruction storage https://github.com/siyuan-note/siyuan/issues/20768

Daniel61c8990b67cf
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 76f2fe4544..5c6caac69d 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "يختلف محتوى data/ai/AGENTS.md عن data/storage/ai/AGENTS.md؛ ادمج المحتوى في الملف الجديد ثم احذف الملف القديم",
"dataImportConflicts": "دفاتر الملاحظات المتعارضة",
"dataImportSkip": "تخطي التعارضات",
"dataImportOverwrite": "الكتابة فوق التعارضات",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "يجب إعداد قاعدة مطالبة واحدة على الأقل ما لم تُمنح صلاحيات المسؤول لجميع المستخدمين المصادق عليهم",
"oidcGitHubClaimRulesTip": "مثال GitHub (استبدل YOUR_GITHUB_USERNAME باسم مستخدم GitHub الخاص بك): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "تعليمات مخصصة",
- "agentInstructionsTip": "تُحفظ تفضيلات مساحة العمل في data/ai/AGENTS.md وتُزامَن ما لم تُستثنَ؛ نص UTF-8 بحجم أقصى 32 KiB، يسري بدءًا من الجولة التالية من المحادثة",
+ "agentInstructionsTip": "تُحفظ تفضيلات مساحة العمل في data/storage/ai/AGENTS.md وتُزامَن ما لم تُستثنَ؛ نص UTF-8 بحجم أقصى 32 KiB، يسري بدءًا من الجولة التالية من المحادثة",
"agentInstructionsTooLarge": "يجب ألا يتجاوز حجم التعليمات 32 KiB",
"agentInstructionsConflict": "تم تغيير AGENTS.md. انسخ تعديلاتك، وأعد فتح المحرر، ثم ادمج التغييرات قبل الحفظ",
"listMindmapSummary": "ملخص",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index d529df2a2e..6dc93bfa53 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md und data/storage/ai/AGENTS.md unterscheiden sich; führen Sie die Inhalte in der neuen Datei zusammen und entfernen Sie dann die alte Datei",
"dataImportConflicts": "Notizbücher mit Konflikten",
"dataImportSkip": "Konflikte überspringen",
"dataImportOverwrite": "Konflikte überschreiben",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Mindestens eine Claim-Regel ist erforderlich, sofern nicht alle authentifizierten Benutzer Administratorrechte erhalten",
"oidcGitHubClaimRulesTip": "GitHub-Beispiel (YOUR_GITHUB_USERNAME durch Ihren GitHub-Benutzernamen ersetzen): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Benutzerdefinierte Anweisungen",
- "agentInstructionsTip": "Arbeitsbereichsweite Vorgaben werden in data/ai/AGENTS.md gespeichert und synchronisiert, sofern nicht ausgeschlossen; UTF-8-Text bis 32 KiB, gültig ab dem nächsten Gesprächsschritt",
+ "agentInstructionsTip": "Arbeitsbereichsweite Vorgaben werden in data/storage/ai/AGENTS.md gespeichert und synchronisiert, sofern nicht ausgeschlossen; UTF-8-Text bis 32 KiB, gültig ab dem nächsten Gesprächsschritt",
"agentInstructionsTooLarge": "Anweisungen dürfen höchstens 32 KiB groß sein",
"agentInstructionsConflict": "AGENTS.md wurde geändert. Kopieren Sie Ihre Änderungen, öffnen Sie den Editor erneut und führen Sie die Änderungen vor dem Speichern zusammen",
"listMindmapSummary": "Zusammenfassung",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index d3227bb11b..adecb5dc56 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md and data/storage/ai/AGENTS.md differ; merge their contents into the new file, then remove the old file",
"dataImportConflicts": "Conflicting notebooks",
"dataImportSkip": "Skip conflicts",
"dataImportOverwrite": "Overwrite conflicts",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "At least one claim rule is required unless administrator access is granted to all authenticated users",
"oidcGitHubClaimRulesTip": "GitHub example (replace YOUR_GITHUB_USERNAME with your GitHub username): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Custom instructions",
- "agentInstructionsTip": "Workspace-wide preferences stored in data/ai/AGENTS.md and synced unless excluded; UTF-8 text up to 32 KiB, effective from the next conversation turn",
+ "agentInstructionsTip": "Workspace-wide preferences stored in data/storage/ai/AGENTS.md and synced unless excluded; UTF-8 text up to 32 KiB, effective from the next conversation turn",
"agentInstructionsTooLarge": "Instructions must be at most 32 KiB",
"agentInstructionsConflict": "AGENTS.md has changed. Copy your edits, reopen the editor, and merge them before saving",
"listMindmapSummary": "Summary",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index dc7ed2c4d6..486a0d1e11 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md y data/storage/ai/AGENTS.md difieren; combine su contenido en el archivo nuevo y luego elimine el antiguo",
"dataImportConflicts": "Cuadernos en conflicto",
"dataImportSkip": "Omitir conflictos",
"dataImportOverwrite": "Sobrescribir conflictos",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Se requiere al menos una regla de atributos si no se concede acceso de administrador a todos los usuarios autenticados",
"oidcGitHubClaimRulesTip": "Ejemplo de GitHub (sustituye YOUR_GITHUB_USERNAME por tu nombre de usuario de GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Instrucciones personalizadas",
- "agentInstructionsTip": "Preferencias del espacio de trabajo guardadas en data/ai/AGENTS.md y sincronizadas salvo exclusión; texto UTF-8 de hasta 32 KiB, efectivo a partir del siguiente turno de conversación",
+ "agentInstructionsTip": "Preferencias del espacio de trabajo guardadas en data/storage/ai/AGENTS.md y sincronizadas salvo exclusión; texto UTF-8 de hasta 32 KiB, efectivo a partir del siguiente turno de conversación",
"agentInstructionsTooLarge": "Las instrucciones no deben superar los 32 KiB",
"agentInstructionsConflict": "AGENTS.md ha cambiado. Copia tus cambios, vuelve a abrir el editor y combínalos antes de guardar",
"listMindmapSummary": "Resumen",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index 3858a838ae..ee67eaf1ce 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md et data/storage/ai/AGENTS.md diffèrent ; fusionnez leur contenu dans le nouveau fichier, puis supprimez l’ancien fichier",
"dataImportConflicts": "Carnets en conflit",
"dataImportSkip": "Ignorer les conflits",
"dataImportOverwrite": "Écraser les conflits",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Au moins une règle de revendication est requise si les droits administrateur ne sont pas accordés à tous les utilisateurs authentifiés",
"oidcGitHubClaimRulesTip": "Exemple GitHub (remplacez YOUR_GITHUB_USERNAME par votre nom d’utilisateur GitHub) : [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Instructions personnalisées",
- "agentInstructionsTip": "Préférences de l’espace de travail enregistrées dans data/ai/AGENTS.md et synchronisées sauf exclusion ; texte UTF-8 de 32 KiB maximum, appliqué au prochain tour de conversation",
+ "agentInstructionsTip": "Préférences de l’espace de travail enregistrées dans data/storage/ai/AGENTS.md et synchronisées sauf exclusion ; texte UTF-8 de 32 KiB maximum, appliqué au prochain tour de conversation",
"agentInstructionsTooLarge": "Les instructions ne doivent pas dépasser 32 KiB",
"agentInstructionsConflict": "AGENTS.md a changé. Copiez vos modifications, rouvrez l’éditeur et fusionnez-les avant d’enregistrer",
"listMindmapSummary": "Résumé",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index cb75b258a5..b4153ba447 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "התוכן של data/ai/AGENTS.md ושל data/storage/ai/AGENTS.md שונה; יש למזג את התוכן בקובץ החדש ואז להסיר את הקובץ הישן",
"dataImportConflicts": "מחברות מתנגשות",
"dataImportSkip": "דילוג על התנגשויות",
"dataImportOverwrite": "החלפת מחברות מתנגשות",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "נדרש לפחות כלל הצהרה אחד אם לא ניתנות הרשאות מנהל לכל המשתמשים המאומתים",
"oidcGitHubClaimRulesTip": "דוגמת GitHub (יש להחליף את YOUR_GITHUB_USERNAME בשם המשתמש שלך ב-GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "הוראות מותאמות אישית",
- "agentInstructionsTip": "העדפות סביבת העבודה נשמרות ב־data/ai/AGENTS.md ומסונכרנות אלא אם הוחרגו; טקסט UTF-8 עד 32 KiB, בתוקף מסבב השיחה הבא",
+ "agentInstructionsTip": "העדפות סביבת העבודה נשמרות ב־data/storage/ai/AGENTS.md ומסונכרנות אלא אם הוחרגו; טקסט UTF-8 עד 32 KiB, בתוקף מסבב השיחה הבא",
"agentInstructionsTooLarge": "גודל ההוראות לא יכול לעלות על 32 KiB",
"agentInstructionsConflict": "AGENTS.md השתנה. יש להעתיק את העריכות, לפתוח מחדש את העורך ולמזג את השינויים לפני השמירה",
"listMindmapSummary": "סיכום",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index 5215367753..1b691ec7bf 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md और data/storage/ai/AGENTS.md की सामग्री अलग है; सामग्री को नई फ़ाइल में मिलाएँ, फिर पुरानी फ़ाइल हटाएँ",
"dataImportConflicts": "टकराव वाली नोटबुक",
"dataImportSkip": "टकराव छोड़ें",
"dataImportOverwrite": "टकराव अधिलेखित करें",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "यदि सभी प्रमाणित उपयोगकर्ताओं को व्यवस्थापक पहुँच नहीं दी गई है, तो कम से कम एक क्लेम नियम आवश्यक है",
"oidcGitHubClaimRulesTip": "GitHub उदाहरण (YOUR_GITHUB_USERNAME को अपने GitHub उपयोगकर्ता नाम से बदलें): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "कस्टम निर्देश",
- "agentInstructionsTip": "कार्यस्थान की प्राथमिकताएँ data/ai/AGENTS.md में सहेजी जाती हैं और बाहर न रखे जाने पर सिंक होती हैं; अधिकतम 32 KiB का UTF-8 पाठ, बातचीत के अगले चरण से लागू",
+ "agentInstructionsTip": "कार्यस्थान की प्राथमिकताएँ data/storage/ai/AGENTS.md में सहेजी जाती हैं और बाहर न रखे जाने पर सिंक होती हैं; अधिकतम 32 KiB का UTF-8 पाठ, बातचीत के अगले चरण से लागू",
"agentInstructionsTooLarge": "निर्देश 32 KiB से अधिक नहीं होने चाहिए",
"agentInstructionsConflict": "AGENTS.md बदल गया है। अपने बदलाव कॉपी करें, संपादक फिर से खोलें और सहेजने से पहले बदलावों को मिलाएँ",
"listMindmapSummary": "सारांश",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index a9df6cc313..ccd04a77a8 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "Isi data/ai/AGENTS.md dan data/storage/ai/AGENTS.md berbeda; gabungkan isinya ke berkas baru, lalu hapus berkas lama",
"dataImportConflicts": "Buku catatan yang berkonflik",
"dataImportSkip": "Lewati konflik",
"dataImportOverwrite": "Timpa konflik",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Setidaknya satu aturan klaim diperlukan jika akses administrator tidak diberikan kepada semua pengguna terautentikasi",
"oidcGitHubClaimRulesTip": "Contoh GitHub (ganti YOUR_GITHUB_USERNAME dengan nama pengguna GitHub Anda): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Instruksi khusus",
- "agentInstructionsTip": "Preferensi ruang kerja disimpan di data/ai/AGENTS.md dan disinkronkan kecuali dikecualikan; teks UTF-8 hingga 32 KiB, berlaku mulai giliran percakapan berikutnya",
+ "agentInstructionsTip": "Preferensi ruang kerja disimpan di data/storage/ai/AGENTS.md dan disinkronkan kecuali dikecualikan; teks UTF-8 hingga 32 KiB, berlaku mulai giliran percakapan berikutnya",
"agentInstructionsTooLarge": "Instruksi tidak boleh melebihi 32 KiB",
"agentInstructionsConflict": "AGENTS.md telah berubah. Salin perubahan Anda, buka kembali editor, lalu gabungkan sebelum menyimpan",
"listMindmapSummary": "Ringkasan",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index ce0cc3263a..0507de9e8f 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md e data/storage/ai/AGENTS.md sono diversi; unisci i contenuti nel nuovo file, quindi rimuovi quello precedente",
"dataImportConflicts": "Quaderni in conflitto",
"dataImportSkip": "Salta i conflitti",
"dataImportOverwrite": "Sovrascrivi i conflitti",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "È necessaria almeno una regola sui claim se non si concede accesso amministratore a tutti gli utenti autenticati",
"oidcGitHubClaimRulesTip": "Esempio GitHub (sostituisci YOUR_GITHUB_USERNAME con il tuo nome utente GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Istruzioni personalizzate",
- "agentInstructionsTip": "Preferenze dell’area di lavoro salvate in data/ai/AGENTS.md e sincronizzate salvo esclusione; testo UTF-8 fino a 32 KiB, valido dal prossimo turno di conversazione",
+ "agentInstructionsTip": "Preferenze dell’area di lavoro salvate in data/storage/ai/AGENTS.md e sincronizzate salvo esclusione; testo UTF-8 fino a 32 KiB, valido dal prossimo turno di conversazione",
"agentInstructionsTooLarge": "Le istruzioni non devono superare 32 KiB",
"agentInstructionsConflict": "AGENTS.md è cambiato. Copia le tue modifiche, riapri l’editor e uniscile prima di salvare",
"listMindmapSummary": "Riepilogo",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index 11f6b0854f..0f3ff11e46 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md と data/storage/ai/AGENTS.md の内容が異なります。内容を新しいファイルに統合してから古いファイルを削除してください",
"dataImportConflicts": "競合するノートブック",
"dataImportSkip": "競合をスキップ",
"dataImportOverwrite": "競合を上書き",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "認証済みの全ユーザーに管理者権限を付与しない場合、少なくとも1つのクレームルールが必要です",
"oidcGitHubClaimRulesTip": "GitHub の例(YOUR_GITHUB_USERNAME を自分の GitHub ユーザー名に置き換えてください):[{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "カスタム指示",
- "agentInstructionsTip": "ワークスペース全体の設定を data/ai/AGENTS.md に保存し、除外されていなければ同期します。最大 32 KiB の UTF-8 テキストに対応し、次の会話ターンから適用されます",
+ "agentInstructionsTip": "ワークスペース全体の設定を data/storage/ai/AGENTS.md に保存し、除外されていなければ同期します。最大 32 KiB の UTF-8 テキストに対応し、次の会話ターンから適用されます",
"agentInstructionsTooLarge": "指示は 32 KiB 以下にしてください",
"agentInstructionsConflict": "AGENTS.md が変更されました。編集内容をコピーし、エディターを開き直して変更を統合してから保存してください",
"listMindmapSummary": "要約",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 9ed102602b..4e69084690 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md와 data/storage/ai/AGENTS.md의 내용이 다릅니다. 새 파일에 내용을 병합한 후 이전 파일을 삭제하세요",
"dataImportConflicts": "충돌하는 노트북",
"dataImportSkip": "충돌 건너뛰기",
"dataImportOverwrite": "충돌 덮어쓰기",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "인증된 모든 사용자에게 관리자 권한을 부여하지 않는 경우 클레임 규칙을 하나 이상 설정해야 합니다",
"oidcGitHubClaimRulesTip": "GitHub 예시 (YOUR_GITHUB_USERNAME을 본인의 GitHub 사용자 이름으로 바꾸세요): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "사용자 지정 지침",
- "agentInstructionsTip": "작업 공간 전체의 기본 설정은 data/ai/AGENTS.md에 저장되며 제외되지 않으면 동기화됩니다. 최대 32 KiB의 UTF-8 텍스트를 지원하며 다음 대화 차례부터 적용됩니다",
+ "agentInstructionsTip": "작업 공간 전체의 기본 설정은 data/storage/ai/AGENTS.md에 저장되며 제외되지 않으면 동기화됩니다. 최대 32 KiB의 UTF-8 텍스트를 지원하며 다음 대화 차례부터 적용됩니다",
"agentInstructionsTooLarge": "지침은 32 KiB를 초과할 수 없습니다",
"agentInstructionsConflict": "AGENTS.md가 변경되었습니다. 수정 내용을 복사한 다음 편집기를 다시 열고 변경 사항을 병합하여 저장하세요",
"listMindmapSummary": "요약",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index ebfeece8aa..abcd4ad155 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md en data/storage/ai/AGENTS.md verschillen; voeg de inhoud samen in het nieuwe bestand en verwijder daarna het oude bestand",
"dataImportConflicts": "Notitieboeken met conflicten",
"dataImportSkip": "Conflicten overslaan",
"dataImportOverwrite": "Conflicten overschrijven",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Minstens één claimregel is vereist als niet alle geauthenticeerde gebruikers beheerderstoegang krijgen",
"oidcGitHubClaimRulesTip": "GitHub-voorbeeld (vervang YOUR_GITHUB_USERNAME door uw GitHub-gebruikersnaam): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Aangepaste instructies",
- "agentInstructionsTip": "Voorkeuren voor de hele werkruimte worden opgeslagen in data/ai/AGENTS.md en gesynchroniseerd tenzij uitgesloten; UTF-8-tekst tot 32 KiB, van kracht vanaf de volgende gespreksbeurt",
+ "agentInstructionsTip": "Voorkeuren voor de hele werkruimte worden opgeslagen in data/storage/ai/AGENTS.md en gesynchroniseerd tenzij uitgesloten; UTF-8-tekst tot 32 KiB, van kracht vanaf de volgende gespreksbeurt",
"agentInstructionsTooLarge": "Instructies mogen maximaal 32 KiB groot zijn",
"agentInstructionsConflict": "AGENTS.md is gewijzigd. Kopieer je wijzigingen, open de editor opnieuw en voeg ze samen voordat je opslaat",
"listMindmapSummary": "Samenvatting",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 60676f612f..ff76b9948a 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "Pliki data/ai/AGENTS.md i data/storage/ai/AGENTS.md różnią się; scal ich zawartość w nowym pliku, a następnie usuń stary plik",
"dataImportConflicts": "Konfliktujące notatniki",
"dataImportSkip": "Pomiń konflikty",
"dataImportOverwrite": "Nadpisz konflikty",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Wymagana jest co najmniej jedna reguła oświadczeń, jeśli nie przyznano uprawnień administratora wszystkim uwierzytelnionym użytkownikom",
"oidcGitHubClaimRulesTip": "Przykład GitHub (zastąp YOUR_GITHUB_USERNAME swoją nazwą użytkownika GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Własne instrukcje",
- "agentInstructionsTip": "Preferencje obszaru roboczego zapisane w data/ai/AGENTS.md i synchronizowane, o ile nie zostały wykluczone; tekst UTF-8 do 32 KiB, stosowany od następnej tury rozmowy",
+ "agentInstructionsTip": "Preferencje obszaru roboczego zapisane w data/storage/ai/AGENTS.md i synchronizowane, o ile nie zostały wykluczone; tekst UTF-8 do 32 KiB, stosowany od następnej tury rozmowy",
"agentInstructionsTooLarge": "Instrukcje nie mogą przekraczać 32 KiB",
"agentInstructionsConflict": "Plik AGENTS.md został zmieniony. Skopiuj swoje zmiany, otwórz edytor ponownie i scal je przed zapisaniem",
"listMindmapSummary": "Podsumowanie",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index cfdf15308a..5be01848e3 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md e data/storage/ai/AGENTS.md são diferentes; mescle o conteúdo no novo arquivo e remova o antigo",
"dataImportConflicts": "Cadernos em conflito",
"dataImportSkip": "Ignorar conflitos",
"dataImportOverwrite": "Sobrescrever conflitos",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "É necessária pelo menos uma regra de declarações se o acesso de administrador não for concedido a todos os usuários autenticados",
"oidcGitHubClaimRulesTip": "Exemplo do GitHub (substitua YOUR_GITHUB_USERNAME pelo seu nome de usuário do GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Instruções personalizadas",
- "agentInstructionsTip": "Preferências do espaço de trabalho salvas em data/ai/AGENTS.md e sincronizadas salvo exclusão; texto UTF-8 de até 32 KiB, aplicado a partir do próximo turno da conversa",
+ "agentInstructionsTip": "Preferências do espaço de trabalho salvas em data/storage/ai/AGENTS.md e sincronizadas salvo exclusão; texto UTF-8 de até 32 KiB, aplicado a partir do próximo turno da conversa",
"agentInstructionsTooLarge": "As instruções não podem exceder 32 KiB",
"agentInstructionsConflict": "AGENTS.md foi alterado. Copie suas alterações, reabra o editor e combine-as antes de salvar",
"listMindmapSummary": "Resumo",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index 581d93c2ad..c4389922d1 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "Содержимое data/ai/AGENTS.md и data/storage/ai/AGENTS.md различается; объедините его в новом файле, затем удалите старый файл",
"dataImportConflicts": "Конфликтующие блокноты",
"dataImportSkip": "Пропустить конфликты",
"dataImportOverwrite": "Перезаписать конфликты",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Необходимо хотя бы одно правило утверждений, если права администратора не предоставлены всем прошедшим проверку пользователям",
"oidcGitHubClaimRulesTip": "Пример для GitHub (замените YOUR_GITHUB_USERNAME своим именем пользователя GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Пользовательские инструкции",
- "agentInstructionsTip": "Настройки рабочего пространства хранятся в data/ai/AGENTS.md и синхронизируются, если не исключены; текст UTF-8 до 32 KiB, применяется со следующего хода диалога",
+ "agentInstructionsTip": "Настройки рабочего пространства хранятся в data/storage/ai/AGENTS.md и синхронизируются, если не исключены; текст UTF-8 до 32 KiB, применяется со следующего хода диалога",
"agentInstructionsTooLarge": "Размер инструкций не должен превышать 32 KiB",
"agentInstructionsConflict": "AGENTS.md изменён. Скопируйте свои правки, заново откройте редактор и объедините изменения перед сохранением",
"listMindmapSummary": "Обобщение",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 330e849fdf..2a5692038c 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "Súbory data/ai/AGENTS.md a data/storage/ai/AGENTS.md sa líšia; zlúčte ich obsah do nového súboru a potom odstráňte starý súbor",
"dataImportConflicts": "Konfliktné poznámkové bloky",
"dataImportSkip": "Preskočiť konflikty",
"dataImportOverwrite": "Prepísať konflikty",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Ak nemajú všetci overení používatelia práva správcu, vyžaduje sa aspoň jedno pravidlo tvrdení",
"oidcGitHubClaimRulesTip": "Príklad pre GitHub (nahraďte YOUR_GITHUB_USERNAME svojím používateľským menom GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Vlastné pokyny",
- "agentInstructionsTip": "Predvoľby pracovného priestoru uložené v data/ai/AGENTS.md a synchronizované, ak nie sú vylúčené; text UTF-8 do 32 KiB, platný od ďalšieho kola konverzácie",
+ "agentInstructionsTip": "Predvoľby pracovného priestoru uložené v data/storage/ai/AGENTS.md a synchronizované, ak nie sú vylúčené; text UTF-8 do 32 KiB, platný od ďalšieho kola konverzácie",
"agentInstructionsTooLarge": "Pokyny nesmú presiahnuť 32 KiB",
"agentInstructionsConflict": "Súbor AGENTS.md sa zmenil. Skopírujte svoje zmeny, znova otvorte editor a pred uložením ich zlúčte",
"listMindmapSummary": "Súhrn",
diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.json
index ede3d2f726..2b02ddd6ce 100644
--- a/app/appearance/langs/sr.json
+++ b/app/appearance/langs/sr.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "Садржаји датотека data/ai/AGENTS.md и data/storage/ai/AGENTS.md се разликују; обједините их у новој датотеци, па уклоните стару датотеку",
"dataImportConflicts": "Бележнице у сукобу",
"dataImportSkip": "Прескочи сукобе",
"dataImportOverwrite": "Препиши сукобе",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Потребно је бар једно правило тврдњи ако администраторски приступ није додељен свим потврђеним корисницима",
"oidcGitHubClaimRulesTip": "GitHub пример (замените YOUR_GITHUB_USERNAME својим GitHub корисничким именом): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Прилагођена упутства",
- "agentInstructionsTip": "Подешавања радног простора чувају се у data/ai/AGENTS.md и синхронизују ако нису изузета; UTF-8 текст до 32 KiB, примењује се од следећег круга разговора",
+ "agentInstructionsTip": "Подешавања радног простора чувају се у data/storage/ai/AGENTS.md и синхронизују ако нису изузета; UTF-8 текст до 32 KiB, примењује се од следећег круга разговора",
"agentInstructionsTooLarge": "Упутства не смеју бити већа од 32 KiB",
"agentInstructionsConflict": "AGENTS.md је промењен. Копирајте своје измене, поново отворите уређивач и обједините их пре чувања",
"listMindmapSummary": "Сажетак",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index 0e36a096f2..e8fa9c62c4 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "เนื้อหาใน data/ai/AGENTS.md และ data/storage/ai/AGENTS.md ต่างกัน โปรดรวมเนื้อหาไว้ในไฟล์ใหม่แล้วลบไฟล์เดิม",
"dataImportConflicts": "สมุดบันทึกที่ขัดแย้งกัน",
"dataImportSkip": "ข้ามรายการที่ขัดแย้ง",
"dataImportOverwrite": "เขียนทับรายการที่ขัดแย้ง",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "ต้องกำหนดกฎการอ้างสิทธิ์อย่างน้อยหนึ่งข้อ หากไม่ได้ให้สิทธิ์ผู้ดูแลระบบแก่ผู้ใช้ที่ยืนยันตัวตนแล้วทุกคน",
"oidcGitHubClaimRulesTip": "ตัวอย่าง GitHub (แทนที่ YOUR_GITHUB_USERNAME ด้วยชื่อผู้ใช้ GitHub ของคุณ): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "คำสั่งที่กำหนดเอง",
- "agentInstructionsTip": "บันทึกการตั้งค่าสำหรับพื้นที่ทำงานใน data/ai/AGENTS.md และซิงค์หากไม่ได้ยกเว้น รองรับข้อความ UTF-8 สูงสุด 32 KiB โดยมีผลในรอบสนทนาถัดไป",
+ "agentInstructionsTip": "บันทึกการตั้งค่าสำหรับพื้นที่ทำงานใน data/storage/ai/AGENTS.md และซิงค์หากไม่ได้ยกเว้น รองรับข้อความ UTF-8 สูงสุด 32 KiB โดยมีผลในรอบสนทนาถัดไป",
"agentInstructionsTooLarge": "คำสั่งต้องมีขนาดไม่เกิน 32 KiB",
"agentInstructionsConflict": "AGENTS.md มีการเปลี่ยนแปลง โปรดคัดลอกสิ่งที่คุณแก้ไข เปิดตัวแก้ไขอีกครั้ง แล้วรวมการเปลี่ยนแปลงก่อนบันทึก",
"listMindmapSummary": "สรุป",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index 483e61d21c..04b909cdb6 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md ve data/storage/ai/AGENTS.md farklı; içeriklerini yeni dosyada birleştirin, ardından eski dosyayı kaldırın",
"dataImportConflicts": "Çakışan not defterleri",
"dataImportSkip": "Çakışmaları atla",
"dataImportOverwrite": "Çakışmaların üzerine yaz",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Kimliği doğrulanmış tüm kullanıcılara yönetici erişimi verilmediyse en az bir talep kuralı gereklidir",
"oidcGitHubClaimRulesTip": "GitHub örneği (YOUR_GITHUB_USERNAME yerine GitHub kullanıcı adınızı yazın): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Özel talimatlar",
- "agentInstructionsTip": "Çalışma alanı tercihleri data/ai/AGENTS.md dosyasında saklanır ve hariç tutulmadıkça eşitlenir; en fazla 32 KiB UTF-8 metin, sonraki konuşma turundan itibaren geçerlidir",
+ "agentInstructionsTip": "Çalışma alanı tercihleri data/storage/ai/AGENTS.md dosyasında saklanır ve hariç tutulmadıkça eşitlenir; en fazla 32 KiB UTF-8 metin, sonraki konuşma turundan itibaren geçerlidir",
"agentInstructionsTooLarge": "Talimatlar 32 KiB boyutunu aşmamalıdır",
"agentInstructionsConflict": "AGENTS.md değişti. Düzenlemelerinizi kopyalayın, düzenleyiciyi yeniden açın ve kaydetmeden önce değişiklikleri birleştirin",
"listMindmapSummary": "Özet",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index f9192ce873..02e340128b 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "Вміст data/ai/AGENTS.md і data/storage/ai/AGENTS.md відрізняється; об’єднайте його в новому файлі, а потім видаліть старий файл",
"dataImportConflicts": "Конфліктні блокноти",
"dataImportSkip": "Пропустити конфлікти",
"dataImportOverwrite": "Перезаписати конфлікти",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "Потрібне принаймні одне правило тверджень, якщо права адміністратора не надано всім автентифікованим користувачам",
"oidcGitHubClaimRulesTip": "Приклад GitHub (замініть YOUR_GITHUB_USERNAME своїм іменем користувача GitHub): [{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "Власні інструкції",
- "agentInstructionsTip": "Налаштування робочого простору зберігаються в data/ai/AGENTS.md і синхронізуються, якщо не виключені; текст UTF-8 до 32 KiB, застосовується з наступного ходу розмови",
+ "agentInstructionsTip": "Налаштування робочого простору зберігаються в data/storage/ai/AGENTS.md і синхронізуються, якщо не виключені; текст UTF-8 до 32 KiB, застосовується з наступного ходу розмови",
"agentInstructionsTooLarge": "Розмір інструкцій не має перевищувати 32 KiB",
"agentInstructionsConflict": "AGENTS.md змінено. Скопіюйте свої правки, знову відкрийте редактор і об’єднайте зміни перед збереженням",
"listMindmapSummary": "Узагальнення",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index 0b62cd0c83..95dcad7c08 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md 与 data/storage/ai/AGENTS.md 内容不同,请将内容合并到新文件后移除旧文件",
"dataImportConflicts": "冲突的笔记本",
"dataImportSkip": "跳过冲突",
"dataImportOverwrite": "覆盖冲突",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "未开启“授予所有已认证用户管理员权限”时,必须配置至少一条声明规则",
"oidcGitHubClaimRulesTip": "GitHub 示例(将 YOUR_GITHUB_USERNAME 替换为你的 GitHub 用户名):[{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "自定义指令",
- "agentInstructionsTip": "工作空间级偏好保存在 data/ai/AGENTS.md 中,未被忽略时参与同步;支持最多 32 KiB 的 UTF-8 文本,保存后下一轮对话生效",
+ "agentInstructionsTip": "工作空间级偏好保存在 data/storage/ai/AGENTS.md 中,未被忽略时参与同步;支持最多 32 KiB 的 UTF-8 文本,保存后下一轮对话生效",
"agentInstructionsTooLarge": "指令内容不能超过 32 KiB",
"agentInstructionsConflict": "AGENTS.md 已发生变化。请先复制你的修改,重新打开编辑器并合并后再保存",
"listMindmapSummary": "概要",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 0c42f0cce6..2ea8e34d09 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,5 @@
{
+ "agentInstructionsLocationConflict": "data/ai/AGENTS.md 與 data/storage/ai/AGENTS.md 內容不同,請將內容合併至新檔案後移除舊檔案",
"dataImportConflicts": "衝突的筆記本",
"dataImportSkip": "略過衝突",
"dataImportOverwrite": "覆寫衝突",
@@ -367,7 +368,7 @@
"oidcClaimRulesRequired": "未開啟「授予所有已驗證使用者管理員權限」時,必須設定至少一條宣告規則",
"oidcGitHubClaimRulesTip": "GitHub 範例(將 YOUR_GITHUB_USERNAME 替換為你的 GitHub 使用者名稱):[{\"claim\": \"login\", \"operator\": \"equals\", \"values\": [\"YOUR_GITHUB_USERNAME\"]}]",
"agentInstructions": "自訂指令",
- "agentInstructionsTip": "工作空間層級偏好儲存於 data/ai/AGENTS.md,未被忽略時參與同步;支援最多 32 KiB 的 UTF-8 文字,儲存後下一輪對話生效",
+ "agentInstructionsTip": "工作空間層級偏好儲存於 data/storage/ai/AGENTS.md,未被忽略時參與同步;支援最多 32 KiB 的 UTF-8 文字,儲存後下一輪對話生效",
"agentInstructionsTooLarge": "指令內容不能超過 32 KiB",
"agentInstructionsConflict": "AGENTS.md 已變更。請先複製你的修改,重新開啟編輯器並合併後再儲存",
"listMindmapSummary": "概要",
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.sy
index fd145ad5cf..03500fbf0b 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.sy
@@ -6,7 +6,7 @@
"id": "20260804171004-aiagt03",
"title": "AI Agent",
"type": "doc",
- "updated": "20261018104335"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -44,7 +44,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260804170025-2kdbnc8",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -168,7 +168,7 @@
"HeadingLevel": 3,
"Properties": {
"id": "20260926163337-6d5c7t2",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -232,12 +232,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926163337-lzrrvoq",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
"Type": "NodeText",
- "Data": "Instructions are stored in data/ai/AGENTS.md inside the workspace as UTF-8 text, up to 32 KiB. The file syncs with the workspace when data sync is enabled and no sync ignore rule excludes it. You can also edit the file directly with a text editor. A missing or empty file adds no custom instructions."
+ "Data": "Instructions are stored in data/storage/ai/AGENTS.md inside the workspace as UTF-8 text, up to 32 KiB. The file syncs with the workspace when data sync is enabled and no sync ignore rule excludes it. You can also edit the file directly with a text editor. A missing or empty file adds no custom instructions. The old data/ai/AGENTS.md remains readable and moves to the new location when you save in settings. Update any sync ignore rules for the old path before saving. If both files exist with different contents, merge them into the new file and remove the old file before continuing."
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.sy
index 44a8bb4299..d41c62be42 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.sy
@@ -6,7 +6,7 @@
"id": "20260804171000-aiagt01",
"title": "AI 智能体",
"type": "doc",
- "updated": "20261019222954"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -44,7 +44,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260804170025-0kg9iaq",
- "updated": "20261019222954"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -168,7 +168,7 @@
"HeadingLevel": 3,
"Properties": {
"id": "20260926163337-jwclkdq",
- "updated": "20261019222954"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -232,12 +232,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926163337-kr7adcx",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
"Type": "NodeText",
- "Data": "指令保存在工作空间的 data/ai/AGENTS.md 中,支持最多 32 KiB 的 UTF-8 文本。启用数据同步且未被同步忽略规则排除时,该文件随工作空间同步。也可以使用文本编辑器直接编辑文件;文件不存在或为空时不添加自定义指令。"
+ "Data": "指令保存在工作空间的 data/storage/ai/AGENTS.md 中,支持最多 32 KiB 的 UTF-8 文本。启用数据同步且未被同步忽略规则排除时,该文件随工作空间同步。也可以使用文本编辑器直接编辑文件;文件不存在或为空时不添加自定义指令。旧路径 data/ai/AGENTS.md 仍可读取,在设置中保存时迁移到新位置;如有针对旧路径的同步忽略规则,请在保存前更新。若两处文件内容不同,请将内容合并到新文件并移除旧文件后再继续。"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.sy
index a07ee067cf..f2fb1fb213 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.sy
@@ -6,7 +6,7 @@
"id": "20260804171002-aiagt02",
"title": "AI 智能體",
"type": "doc",
- "updated": "20261018104335"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -44,7 +44,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260804170025-arr6px9",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -168,7 +168,7 @@
"HeadingLevel": 3,
"Properties": {
"id": "20260926163337-a9sacr9",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -232,12 +232,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926163337-zznm7nc",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
"Type": "NodeText",
- "Data": "指令儲存於工作空間的 data/ai/AGENTS.md,支援最多 32 KiB 的 UTF-8 文字。啟用資料同步且未被同步忽略規則排除時,此檔案會隨工作空間同步。也可以使用文字編輯器直接編輯檔案;檔案不存在或為空時不加入自訂指令。"
+ "Data": "指令儲存於工作空間的 data/storage/ai/AGENTS.md,支援最多 32 KiB 的 UTF-8 文字。啟用資料同步且未被同步忽略規則排除時,此檔案會隨工作空間同步。也可以使用文字編輯器直接編輯檔案;檔案不存在或為空時不加入自訂指令。舊路徑 data/ai/AGENTS.md 仍可讀取,在設定中儲存時遷移至新位置;如有針對舊路徑的同步忽略規則,請在儲存前更新。若兩處檔案內容不同,請將內容合併至新檔案並移除舊檔案後再繼續。"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.sy
index 39f00299ba..385114b9ff 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.sy
@@ -6,7 +6,7 @@
"id": "20260804171006-aiagt04",
"title": "AI エージェント",
"type": "doc",
- "updated": "20261018104335"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -44,7 +44,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260804170025-r2m4o0b",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -164,7 +164,7 @@
"HeadingLevel": 3,
"Properties": {
"id": "20260926163337-49n3p0a",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
@@ -224,12 +224,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926163337-f5ixseu",
- "updated": "20260926163337"
+ "updated": "20261021001816"
},
"Children": [
{
"Type": "NodeText",
- "Data": "指示はワークスペース内の data/ai/AGENTS.md に最大 32 KiB の UTF-8 テキストとして保存されます。データ同期が有効で、同期の除外ルールに該当しなければ、ワークスペースとともに同期されます。テキストエディターで直接編集することもできます。ファイルが存在しない場合や空の場合、カスタム指示は追加されません。"
+ "Data": "指示はワークスペース内の data/storage/ai/AGENTS.md に最大 32 KiB の UTF-8 テキストとして保存されます。データ同期が有効で、同期の除外ルールに該当しなければ、ワークスペースとともに同期されます。テキストエディターで直接編集することもできます。ファイルが存在しない場合や空の場合、カスタム指示は追加されません。旧パスの data/ai/AGENTS.md も引き続き読み込めます。設定で保存すると新しい場所に移行します。旧パスに対する同期の除外ルールがある場合は、保存前に更新してください。両方のファイルの内容が異なる場合は、新しいファイルに内容を統合し、古いファイルを削除してから続行してください。"
}
]
},
diff --git a/app/src/types/api/index.d.ts b/app/src/types/api/index.d.ts
index 9dc0d09ee2..5c50ba703c 100644
--- a/app/src/types/api/index.d.ts
+++ b/app/src/types/api/index.d.ts
@@ -2877,7 +2877,8 @@ export interface APIPOSTRoutes {
additionalErrorStatuses: [409];
};
/**
- * 返回工作空间 data/ai/AGENTS.md 的 content 和 revision,要求管理员权限。
+ * 返回工作空间 data/storage/ai/AGENTS.md 的 content 和 revision,要求管理员权限。
+ * 兼容读取旧路径 data/ai/AGENTS.md,读取不迁移;两处内容不同时返回 code=-1,保留两份文件并提示合并。
* 缺失文件返回空 content 和 missing 修订,不创建文件;非 UTF-8 文本、超出 32 KiB 或读取失败返回 code=-1。
*/
"/api/ai/agent/getInstructions": {
@@ -2997,6 +2998,7 @@ export interface APIPOSTRoutes {
/**
* 接收 content 和读取时的 revision,要求管理员权限且禁止只读写入。
* 内容允许为空;修订冲突返回 code=-1 并保留原文。保存采用原子替换,并按工作空间同步忽略规则通知同步。
+ * 首次保存迁移旧路径 data/ai/AGENTS.md,先持久化原文到新路径再移除旧文件;旧路径的忽略规则需在保存前更新。
* 指令在下一轮用户对话生效,同轮工具调用和压缩使用固定快照,且不能覆盖工具权限、审批或访问控制。
*/
"/api/ai/agent/setInstructions": {
diff --git a/kernel/agent/instructions_test.go b/kernel/agent/instructions_test.go
index 77258a7be9..5c5e08cf3d 100644
--- a/kernel/agent/instructions_test.go
+++ b/kernel/agent/instructions_test.go
@@ -7,6 +7,7 @@ import (
"net/http"
"net/http/httptest"
"os"
+ "path/filepath"
"strings"
"sync/atomic"
"testing"
@@ -22,7 +23,7 @@ import (
func TestAgentInstructionsTurnSnapshot(t *testing.T) {
setupCompactionAgentTest(t)
kernelModel.Conf.AI.Load().Agent.MaxToolCallRounds = 1
- initial, err := util.SaveAgentInstructions("original-workspace-preference", "missing")
+ initial, _, err := util.SaveAgentInstructions("original-workspace-preference", "missing")
if err != nil {
t.Fatal(err)
}
@@ -32,7 +33,7 @@ func TestAgentInstructionsTurnSnapshot(t *testing.T) {
InputSchema: tools.ToolSchema{Type: "object", Properties: map[string]tools.Property{}},
ActionEffects: map[string]tools.ToolEffects{"": {LocalRead: true}},
Handler: func(args map[string]any) (tools.CallToolResult, error) {
- _, err := util.SaveAgentInstructions("changed-workspace-preference", initial.Revision)
+ _, _, err := util.SaveAgentInstructions("changed-workspace-preference", initial.Revision)
return tools.CallToolResult{Content: []tools.ContentItem{{Type: "text", Text: "done"}}}, err
},
})
@@ -85,7 +86,7 @@ func TestAgentInstructionsTurnSnapshot(t *testing.T) {
func TestAgentInstructionsInvalidSourceStopsTurn(t *testing.T) {
setupCompactionAgentTest(t)
- if _, err := util.SaveAgentInstructions("valid", "missing"); err != nil {
+ if _, _, err := util.SaveAgentInstructions("valid", "missing"); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(util.AgentInstructionsPath(), []byte{255}, 0644); err != nil {
@@ -123,3 +124,27 @@ func TestAgentInstructionsCompactionAndBudget(t *testing.T) {
t.Fatal("empty instructions changed prompt")
}
}
+
+func TestAgentInstructionsConflictingLocationsStopTurn(t *testing.T) {
+ setupCompactionAgentTest(t)
+ if _, _, err := util.SaveAgentInstructions("canonical", "missing"); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.MkdirAll(filepath.Dir(util.LegacyAgentInstructionsPath()), 0755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(util.LegacyAgentInstructionsPath(), []byte("legacy"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ errorSeen := false
+ for event := range AgentChat(context.Background(), nil, "openai", "test-model", "", 0,
+ "", "", 0, "test", nil, "English", nil, EditorContext{}, nil, false,
+ time.Second, 0, "", time.Second, time.Second) {
+ if event.Type == "error" && strings.Contains(event.Error, "AGENTS.md") {
+ errorSeen = true
+ }
+ }
+ if !errorSeen {
+ t.Fatal("conflicting sources did not stop before provider access")
+ }
+}
diff --git a/kernel/api/agent_instructions.go b/kernel/api/agent_instructions.go
index 1715e66418..535d213a1d 100644
--- a/kernel/api/agent_instructions.go
+++ b/kernel/api/agent_instructions.go
@@ -22,8 +22,10 @@ func getAgentInstructionsContract(c *gin.Context, request apicontract.EmptyReque
}
func setAgentInstructionsContract(c *gin.Context, request apicontract.AIAgentInstructionsSaveRequest) apicontract.Response[apicontract.AIAgentInstructionsData] {
- data, err := util.SaveAgentInstructions(request.Content, request.Revision)
- if err == nil {
+ data, migrated, err := util.SaveAgentInstructions(request.Content, request.Revision)
+ if migrated {
+ model.IncSyncIfNeeded(util.AgentInstructionsPath(), util.LegacyAgentInstructionsPath())
+ } else if err == nil {
model.IncSyncIfNeeded(util.AgentInstructionsPath())
}
return agentInstructionsResponse(data, err)
diff --git a/kernel/api/contract_agent_instructions_test.go b/kernel/api/contract_agent_instructions_test.go
index edeb9d1799..38771f2a86 100644
--- a/kernel/api/contract_agent_instructions_test.go
+++ b/kernel/api/contract_agent_instructions_test.go
@@ -5,6 +5,7 @@ import (
"net/http"
"net/http/httptest"
"os"
+ "path/filepath"
"strings"
"testing"
@@ -89,3 +90,68 @@ func TestAPIContractAIAgentInstructionsAuthorization(t *testing.T) {
}
}
}
+
+func TestAPIContractAIAgentInstructionsLegacyMigration(t *testing.T) {
+ aiContractConfiguration(t)
+ model.Conf.Sync.Store(conf.NewSync())
+ legacy := util.LegacyAgentInstructionsPath()
+ if err := os.MkdirAll(filepath.Dir(legacy), 0755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(legacy, []byte("legacy preferences\r\n"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ previousReadonly := util.ReadOnly
+ t.Cleanup(func() { util.ReadOnly = previousReadonly })
+ engine := gin.New()
+ engine.Use(func(c *gin.Context) { c.Set(model.RoleContextKey, model.RoleAdministrator); c.Next() })
+ ServeAPI(engine)
+ call := func(name, body string, code int) apicontract.AIAgentInstructionsData {
+ t.Helper()
+ path := "/api/ai/agent/" + name
+ recorder := httptest.NewRecorder()
+ engine.ServeHTTP(recorder, httptest.NewRequest("POST", path, strings.NewReader(body)))
+ requireAPIContract(t, "POST", path, recorder)
+ var result struct {
+ Code int
+ Data apicontract.AIAgentInstructionsData
+ }
+ if err := json.Unmarshal(recorder.Body.Bytes(), &result); err != nil || result.Code != code {
+ t.Fatalf("%s: %s %v", name, recorder.Body.String(), err)
+ }
+ return result.Data
+ }
+ util.ReadOnly = true
+ read := call("getInstructions", "", 0)
+ if read.Content != "legacy preferences\r\n" || read.Revision == "missing" {
+ t.Fatalf("legacy read: %+v", read)
+ }
+ if _, err := os.Stat(util.AgentInstructionsPath()); !os.IsNotExist(err) {
+ t.Fatalf("read-only read migrated the file: %v", err)
+ }
+ body, _ := json.Marshal(apicontract.AIAgentInstructionsSaveRequest{Content: "edited", Revision: read.Revision})
+ call("setInstructions", string(body), -1)
+ if _, err := os.Stat(util.AgentInstructionsPath()); !os.IsNotExist(err) {
+ t.Fatalf("denied save migrated the file: %v", err)
+ }
+ util.ReadOnly = false
+ written := call("setInstructions", string(body), 0)
+ if written.Content != "edited" || call("getInstructions", "", 0) != written {
+ t.Fatalf("migrated save: %+v", written)
+ }
+ if _, err := os.Stat(legacy); !os.IsNotExist(err) {
+ t.Fatalf("legacy source remains: %v", err)
+ }
+ if err := os.WriteFile(legacy, []byte("old device update"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ call("getInstructions", "", -1)
+ body, _ = json.Marshal(apicontract.AIAgentInstructionsSaveRequest{Content: "replacement", Revision: written.Revision})
+ call("setInstructions", string(body), -1)
+ for path, want := range map[string]string{legacy: "old device update", util.AgentInstructionsPath(): "edited"} {
+ actual, err := os.ReadFile(path)
+ if err != nil || string(actual) != want {
+ t.Fatalf("conflict changed %s: %q %v", path, actual, err)
+ }
+ }
+}
diff --git a/kernel/apicontract/ai_instructions.go b/kernel/apicontract/ai_instructions.go
index fac1d48f0f..7c7d91de52 100644
--- a/kernel/apicontract/ai_instructions.go
+++ b/kernel/apicontract/ai_instructions.go
@@ -1,6 +1,7 @@
package apicontract
-// AIAgentInstructionsData 是工作空间 data/ai/AGENTS.md 的 UTF-8 原文与内容修订标识。
+// AIAgentInstructionsData 是工作空间 data/storage/ai/AGENTS.md 的 UTF-8 原文与内容修订标识。
+// 兼容读取旧路径 data/ai/AGENTS.md;读取不迁移,两处内容不同时返回 code -1 并保留两份文件。
// 文件缺失返回空正文和 missing 修订,不创建文件;读取失败、非文本或超过 32 KiB 返回 code -1。
// 指令在下一次用户发起对话时生效,同一轮工具调用及上下文压缩使用相同快照。
type AIAgentInstructionsData struct {
@@ -10,6 +11,7 @@ type AIAgentInstructionsData struct {
// AIAgentInstructionsSaveRequest 必须携带读取时的修订标识;冲突返回 code -1 并保留原文。
// 允许空正文,最多 32 KiB UTF-8 文本。固定路径原子保存,成功后通知同步;用户同步忽略规则仍有效。
+// 保存时先持久化旧原文到新路径,再移除旧文件;旧路径的同步忽略规则应在保存前更新为新路径。
// 接口要求管理员且禁止只读写入,不为智能体注册修改长期指令的专用工具。
type AIAgentInstructionsSaveRequest struct {
Content string `json:"content"`
diff --git a/kernel/apicontract/contracts.go b/kernel/apicontract/contracts.go
index fb31019422..f2e80fa9d0 100644
--- a/kernel/apicontract/contracts.go
+++ b/kernel/apicontract/contracts.go
@@ -1442,12 +1442,14 @@ var AIListSkills = define[EmptyRequest, []AISkillInfo]("lsSkills", "/api/ai/agen
// AIListBuiltinSkills 独立于斜杠菜单的普通技能发现,只返回只读元数据,包括已禁用条目。
var AIListBuiltinSkills = define[EmptyRequest, []AIBuiltinSkillInfo]("lsBuiltinSkills", "/api/ai/agent/lsBuiltinSkills", AuthenticatedAccess|AdminAccess, NoBody, ResponseOptions{}, "POST")
-// 返回工作空间 data/ai/AGENTS.md 的 content 和 revision,要求管理员权限。
+// 返回工作空间 data/storage/ai/AGENTS.md 的 content 和 revision,要求管理员权限。
+// 兼容读取旧路径 data/ai/AGENTS.md,读取不迁移;两处内容不同时返回 code=-1,保留两份文件并提示合并。
// 缺失文件返回空 content 和 missing 修订,不创建文件;非 UTF-8 文本、超出 32 KiB 或读取失败返回 code=-1。
var AIGetAgentInstructions = define[EmptyRequest, AIAgentInstructionsData]("getAgentInstructions", "/api/ai/agent/getInstructions", AuthenticatedAccess|AdminAccess, NoBody, ResponseOptions{}, "POST")
// 接收 content 和读取时的 revision,要求管理员权限且禁止只读写入。
// 内容允许为空;修订冲突返回 code=-1 并保留原文。保存采用原子替换,并按工作空间同步忽略规则通知同步。
+// 首次保存迁移旧路径 data/ai/AGENTS.md,先持久化原文到新路径再移除旧文件;旧路径的忽略规则需在保存前更新。
// 指令在下一轮用户对话生效,同轮工具调用和压缩使用固定快照,且不能覆盖工具权限、审批或访问控制。
var AISetAgentInstructions = define[AIAgentInstructionsSaveRequest, AIAgentInstructionsData]("setAgentInstructions", "/api/ai/agent/setInstructions", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{}, "POST")
var AIListUserSkills = define[EmptyRequest, []AIUserSkillInfo]("lsUserSkills", "/api/ai/agent/lsUserSkills", AuthenticatedAccess|AdminAccess, NoBody, ResponseOptions{}, "POST")
diff --git a/kernel/model/agent_instructions_test.go b/kernel/model/agent_instructions_test.go
index f9b4c469a1..9257e98f70 100644
--- a/kernel/model/agent_instructions_test.go
+++ b/kernel/model/agent_instructions_test.go
@@ -20,13 +20,21 @@ func TestAgentInstructionsSync(t *testing.T) {
t.Fatalf("instructions excluded from sync: %v %v", ignored, err)
}
_, matcher := mustSyncIgnoreRules(t)
- if matcher.MatchesPath("/ai/AGENTS.md") {
+ if matcher.MatchesPath("/storage/ai/AGENTS.md") {
t.Fatal("built-in ignore excludes instructions")
}
- writeAppearanceTestFile(t, filepath.Join(util.DataDir, syncIgnoreRulePath), "/ai/AGENTS.md\n")
+ writeAppearanceTestFile(t, filepath.Join(util.DataDir, syncIgnoreRulePath), "/storage/ai/AGENTS.md\n")
invalidateSyncIgnoreRules(filepath.Join(util.DataDir, syncIgnoreRulePath))
_, matcher = mustSyncIgnoreRules(t)
- if !matcher.MatchesPath("/ai/AGENTS.md") {
+ if !matcher.MatchesPath("/storage/ai/AGENTS.md") {
t.Fatal("user ignore rule must remain effective")
}
+ if PathsAffectSync(file) {
+ t.Fatal("ignored canonical instructions scheduled synchronization")
+ }
+ // Migration removes the legacy source. Its deletion still needs upload even
+ // when the new file is excluded by the user's current ignore rules.
+ if !PathsAffectSync(file, util.LegacyAgentInstructionsPath()) {
+ t.Fatal("legacy deletion omitted from synchronization")
+ }
}
diff --git a/kernel/util/agent_instructions.go b/kernel/util/agent_instructions.go
index 6432487faf..0a37badf20 100644
--- a/kernel/util/agent_instructions.go
+++ b/kernel/util/agent_instructions.go
@@ -18,6 +18,7 @@ const MaxAgentInstructionsSize = 32 * 1024
var agentInstructionsLock sync.Mutex
var ErrAgentInstructionsTooLarge = errors.New("AGENTS.md must be at most 32 KiB")
var ErrAgentInstructionsConflict = errors.New("AGENTS.md changed; reload it before saving")
+var ErrAgentInstructionsLocationConflict = errors.New("data/ai/AGENTS.md and data/storage/ai/AGENTS.md differ; merge the files and remove the old file")
type AgentInstructions struct {
Content string
@@ -25,29 +26,47 @@ type AgentInstructions struct {
}
func AgentInstructionsPath() string {
+ return filepath.Join(DataDir, "storage", "ai", "AGENTS.md")
+}
+
+func LegacyAgentInstructionsPath() string {
return filepath.Join(DataDir, "ai", "AGENTS.md")
}
// 仅访问工作空间内的固定文件,拒绝链接和特殊文件,不创建读取时缺失的目录。
-func openAgentInstructionsRoot(create bool) (*os.Root, error) {
+func openAgentInstructionsRoot(create, legacy bool) (*os.Root, error) {
root, err := os.OpenRoot(DataDir)
if err != nil {
return nil, err
}
- defer root.Close()
- if create {
- if err = root.Mkdir("ai", 0755); err != nil && !errors.Is(err, os.ErrExist) {
- return nil, err
- }
- }
- info, err := root.Lstat("ai")
- if err != nil {
- return nil, err
+ parts := []string{"storage", "ai"}
+ if legacy {
+ parts = []string{"ai"}
}
- if !info.IsDir() || info.Mode()&os.ModeSymlink != 0 {
- return nil, errors.New("AGENTS.md storage is not a regular directory")
+ for _, part := range parts {
+ if create {
+ if err = root.Mkdir(part, 0755); err != nil && !errors.Is(err, os.ErrExist) {
+ root.Close()
+ return nil, err
+ }
+ }
+ info, statErr := root.Lstat(part)
+ if statErr != nil {
+ root.Close()
+ return nil, statErr
+ }
+ if !info.IsDir() || info.Mode()&os.ModeSymlink != 0 {
+ root.Close()
+ return nil, errors.New("AGENTS.md storage is not a regular directory")
+ }
+ next, openErr := root.OpenRoot(part)
+ root.Close()
+ if openErr != nil {
+ return nil, openErr
+ }
+ root = next
}
- return root.OpenRoot("ai")
+ return root, nil
}
func validateAgentInstructions(content string) error {
@@ -90,7 +109,11 @@ func readAgentInstructions(root *os.Root) (AgentInstructions, error) {
func ReadAgentInstructions() (AgentInstructions, error) {
agentInstructionsLock.Lock()
defer agentInstructionsLock.Unlock()
- root, err := openAgentInstructionsRoot(false)
+ return readCompatibleAgentInstructions()
+}
+
+func readAgentInstructionsLocation(legacy bool) (AgentInstructions, error) {
+ root, err := openAgentInstructionsRoot(false, legacy)
if errors.Is(err, os.ErrNotExist) {
return AgentInstructions{Revision: "missing"}, nil
}
@@ -101,21 +124,102 @@ func ReadAgentInstructions() (AgentInstructions, error) {
return readAgentInstructions(root)
}
+// 兼容读取不迁移文件,保留只读模式及读取接口无写入的约定。
+func readCompatibleAgentInstructions() (AgentInstructions, error) {
+ current, err := readAgentInstructionsLocation(false)
+ if err != nil {
+ return AgentInstructions{}, err
+ }
+ legacy, err := readAgentInstructionsLocation(true)
+ if err != nil {
+ return AgentInstructions{}, err
+ }
+ if current.Revision == "missing" {
+ return legacy, nil
+ }
+ if legacy.Revision != "missing" && legacy.Revision != current.Revision {
+ return AgentInstructions{}, ErrAgentInstructionsLocationConflict
+ }
+ return current, nil
+}
+
// 修订校验和原子替换共用临界区,失败时保留原文;空内容同样是有效版本。
-func SaveAgentInstructions(content, revision string) (AgentInstructions, error) {
+// migrated 标识迁移已写入新位置或移除旧文件,供调用者在部分失败时也通知同步。
+func SaveAgentInstructions(content, revision string) (saved AgentInstructions, migrated bool, err error) {
agentInstructionsLock.Lock()
defer agentInstructionsLock.Unlock()
if err := validateAgentInstructions(content); err != nil {
- return AgentInstructions{}, err
+ return AgentInstructions{}, false, err
}
if revision == "" {
- return AgentInstructions{}, ErrAgentInstructionsConflict
+ return AgentInstructions{}, false, ErrAgentInstructionsConflict
}
- root, err := openAgentInstructionsRoot(true)
+ current, err := readCompatibleAgentInstructions()
if err != nil {
- return AgentInstructions{}, err
+ return AgentInstructions{}, false, err
+ }
+ if current.Revision != revision {
+ return AgentInstructions{}, false, ErrAgentInstructionsConflict
+ }
+ root, err := openAgentInstructionsRoot(true, false)
+ if err != nil {
+ return AgentInstructions{}, false, err
+ }
+ defer root.Close()
+ canonical, err := readAgentInstructions(root)
+ if err != nil {
+ return AgentInstructions{}, false, err
+ }
+ // 先在新位置持久保存旧版原文,再移除旧文件,最后写入用户修改。
+ // 中途失败时至少保留一份完整原文;相同的双文件状态可安全重试。
+ if canonical.Revision == "missing" && current.Revision != "missing" {
+ legacyRoot, openErr := openAgentInstructionsRoot(false, true)
+ if openErr != nil {
+ return AgentInstructions{}, false, openErr
+ }
+ info, statErr := legacyRoot.Stat("AGENTS.md")
+ legacyRoot.Close()
+ if statErr != nil {
+ return AgentInstructions{}, false, statErr
+ }
+ if _, err = writeAgentInstructions(root, current.Content, "missing", info.Mode().Perm()); err != nil {
+ return AgentInstructions{}, false, err
+ }
+ migrated = true
+ }
+ if _, err = readCompatibleAgentInstructions(); err != nil {
+ return AgentInstructions{}, migrated, err
+ }
+ removed, err := removeLegacyAgentInstructions(revision)
+ migrated = migrated || removed
+ if err != nil {
+ return AgentInstructions{}, migrated, err
+ }
+ saved, err = writeAgentInstructions(root, content, revision, 0644)
+ return saved, migrated, err
+}
+
+func removeLegacyAgentInstructions(revision string) (bool, error) {
+ root, err := openAgentInstructionsRoot(false, true)
+ if errors.Is(err, os.ErrNotExist) {
+ return false, nil
+ }
+ if err != nil {
+ return false, err
}
defer root.Close()
+ current, err := readAgentInstructions(root)
+ if err != nil || current.Revision == "missing" {
+ return false, err
+ }
+ if current.Revision != revision {
+ return false, ErrAgentInstructionsConflict
+ }
+ err = root.Remove("AGENTS.md")
+ return err == nil, err
+}
+
+func writeAgentInstructions(root *os.Root, content, revision string, mode os.FileMode) (AgentInstructions, error) {
current, err := readAgentInstructions(root)
if err != nil {
return AgentInstructions{}, err
@@ -123,7 +227,6 @@ func SaveAgentInstructions(content, revision string) (AgentInstructions, error)
if current.Revision != revision {
return AgentInstructions{}, ErrAgentInstructionsConflict
}
- mode := os.FileMode(0644)
if current.Revision != "missing" {
info, statErr := root.Stat("AGENTS.md")
if statErr != nil {
@@ -138,9 +241,7 @@ func SaveAgentInstructions(content, revision string) (AgentInstructions, error)
}
defer root.Remove(name)
// 保留用户为已有文件设置的访问权限。
- if current.Revision != "missing" {
- err = file.Chmod(mode)
- }
+ err = file.Chmod(mode)
if err == nil {
_, err = file.WriteString(content)
}
@@ -174,6 +275,8 @@ func AgentInstructionsError(err error, language string) string {
key = "agentInstructionsTooLarge"
case errors.Is(err, ErrAgentInstructionsConflict):
key = "agentInstructionsConflict"
+ case errors.Is(err, ErrAgentInstructionsLocationConflict):
+ key = "agentInstructionsLocationConflict"
case errors.Is(err, ErrSkillEncoding):
key = "agentSkillEncodingTip"
case errors.Is(err, ErrSkillBinary):
diff --git a/kernel/util/agent_instructions_test.go b/kernel/util/agent_instructions_test.go
index 374693b996..3e29ede63d 100644
--- a/kernel/util/agent_instructions_test.go
+++ b/kernel/util/agent_instructions_test.go
@@ -2,8 +2,11 @@ package util
import (
"errors"
+ "fmt"
"os"
+ "os/exec"
"path/filepath"
+ "runtime"
"strings"
"sync"
"testing"
@@ -25,35 +28,38 @@ func TestAgentInstructionsStorage(t *testing.T) {
if _, err = os.Stat(filepath.Dir(AgentInstructionsPath())); !errors.Is(err, os.ErrNotExist) {
t.Fatal("read created storage")
}
+ if AgentInstructionsPath() != filepath.Join(DataDir, "storage", "ai", "AGENTS.md") {
+ t.Fatal("instructions must share the AI storage directory")
+ }
content := "\ufeffUse citations.\r\n保留原文\r\n"
- saved, err := SaveAgentInstructions(content, missing.Revision)
- if err != nil {
- t.Fatal(err)
+ saved, migrated, err := SaveAgentInstructions(content, missing.Revision)
+ if err != nil || migrated {
+ t.Fatalf("new save reported migration: %v %v", migrated, err)
}
read, err := ReadAgentInstructions()
if err != nil || read != saved || read.Content != content {
t.Fatalf("round trip: %+v %v", read, err)
}
for _, revision := range []string{"", "missing", "stale"} {
- if _, err = SaveAgentInstructions("lost update", revision); !errors.Is(err, ErrAgentInstructionsConflict) {
+ if _, _, err = SaveAgentInstructions("lost update", revision); !errors.Is(err, ErrAgentInstructionsConflict) {
t.Fatalf("accepted revision %q: %v", revision, err)
}
}
- empty, err := SaveAgentInstructions("", saved.Revision)
+ empty, _, err := SaveAgentInstructions("", saved.Revision)
if err != nil || empty.Revision == missing.Revision {
t.Fatalf("empty file: %+v %v", empty, err)
}
if read, err = ReadAgentInstructions(); err != nil || read != empty {
t.Fatalf("empty round trip: %+v %v", read, err)
}
- if _, err = SaveAgentInstructions(strings.Repeat("a", MaxAgentInstructionsSize), empty.Revision); err != nil {
+ if _, _, err = SaveAgentInstructions(strings.Repeat("a", MaxAgentInstructionsSize), empty.Revision); err != nil {
t.Fatal(err)
}
maxContent, err := ReadAgentInstructions()
if err != nil {
t.Fatal(err)
}
- if _, err = SaveAgentInstructions(strings.Repeat("界", 11000), maxContent.Revision); !errors.Is(err, ErrAgentInstructionsTooLarge) {
+ if _, _, err = SaveAgentInstructions(strings.Repeat("界", 11000), maxContent.Revision); !errors.Is(err, ErrAgentInstructionsTooLarge) {
t.Fatalf("UTF-8 byte limit not enforced: %v", err)
}
if unchanged, err := ReadAgentInstructions(); err != nil || unchanged != maxContent {
@@ -73,7 +79,7 @@ func TestAgentInstructionsPreservesInvalidSource(t *testing.T) {
if _, err := ReadAgentInstructions(); err == nil {
t.Fatal("accepted invalid source")
}
- if _, err := SaveAgentInstructions("replacement", "missing"); err == nil {
+ if _, _, err := SaveAgentInstructions("replacement", "missing"); err == nil {
t.Fatal("overwrote invalid source")
}
actual, err := os.ReadFile(AgentInstructionsPath())
@@ -85,14 +91,14 @@ func TestAgentInstructionsPreservesInvalidSource(t *testing.T) {
func TestAgentInstructionsConcurrentSave(t *testing.T) {
agentInstructionsTestDir(t)
- initial, err := SaveAgentInstructions("initial", "missing")
+ initial, _, err := SaveAgentInstructions("initial", "missing")
if err != nil {
t.Fatal(err)
}
errorsCh := make(chan error, 2)
var wait sync.WaitGroup
for _, value := range []string{"first", "second"} {
- wait.Go(func() { _, err := SaveAgentInstructions(value, initial.Revision); errorsCh <- err })
+ wait.Go(func() { _, _, err := SaveAgentInstructions(value, initial.Revision); errorsCh <- err })
}
wait.Wait()
close(errorsCh)
@@ -116,15 +122,170 @@ func TestAgentInstructionsConcurrentSave(t *testing.T) {
}
func TestAgentInstructionsRejectsLinks(t *testing.T) {
+ for _, rel := range []string{"storage", "storage/ai", "storage/ai/AGENTS.md", "ai", "ai/AGENTS.md"} {
+ t.Run(rel, func(t *testing.T) {
+ agentInstructionsTestDir(t)
+ outside := t.TempDir()
+ link := filepath.Join(DataDir, filepath.FromSlash(rel))
+ if err := os.MkdirAll(filepath.Dir(link), 0755); err != nil {
+ t.Fatal(err)
+ }
+ target := outside
+ if filepath.Ext(rel) == ".md" {
+ target = filepath.Join(outside, "AGENTS.md")
+ if err := os.WriteFile(target, []byte("outside"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := os.Symlink(target, link); err != nil {
+ if runtime.GOOS != "windows" || target != outside {
+ t.Skipf("symlinks unavailable: %v", err)
+ }
+ if output, junctionErr := exec.Command("cmd", "/c", "mklink", "/J", link, target).CombinedOutput(); junctionErr != nil {
+ t.Skipf("directory links unavailable: %v %s", junctionErr, output)
+ }
+ }
+ if _, err := ReadAgentInstructions(); err == nil {
+ t.Fatal("followed storage link")
+ }
+ if _, _, err := SaveAgentInstructions("escape", "missing"); err == nil {
+ t.Fatal("wrote through storage link")
+ }
+ if target == outside {
+ entries, err := os.ReadDir(outside)
+ if err != nil || len(entries) != 0 {
+ t.Fatalf("storage link modified its target: %v %v", entries, err)
+ }
+ }
+ })
+ }
+}
+
+func writeAgentInstructionsFixture(t *testing.T, path, content string) {
+ t.Helper()
+ if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(path, []byte(content), 0600); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestAgentInstructionsLegacyMigration(t *testing.T) {
+ for _, content := range []string{"", "\ufeffKeep citations.\r\n保留原文\r\n"} {
+ t.Run(fmt.Sprintf("bytes=%d", len(content)), func(t *testing.T) {
+ agentInstructionsTestDir(t)
+ legacy := LegacyAgentInstructionsPath()
+ writeAgentInstructionsFixture(t, legacy, content)
+ before, err := os.Stat(legacy)
+ if err != nil {
+ t.Fatal(err)
+ }
+ read, err := ReadAgentInstructions()
+ if err != nil || read.Content != content || read.Revision == "missing" {
+ t.Fatalf("legacy read: %+v %v", read, err)
+ }
+ if _, err = os.Stat(AgentInstructionsPath()); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("read migrated the source: %v", err)
+ }
+ if _, _, err = SaveAgentInstructions("invalid revision", "missing"); !errors.Is(err, ErrAgentInstructionsConflict) {
+ t.Fatalf("stale legacy save: %v", err)
+ }
+ if _, migrated, err := SaveAgentInstructions(content, read.Revision); err != nil || !migrated {
+ t.Fatalf("legacy migration not reported: %v %v", migrated, err)
+ }
+ if migrated, err := ReadAgentInstructions(); err != nil || migrated != read {
+ t.Fatalf("migration changed bytes or revision: %+v %v", migrated, err)
+ }
+ if _, err = os.Stat(legacy); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("legacy file remains: %v", err)
+ }
+ after, err := os.Stat(AgentInstructionsPath())
+ if err != nil || after.Mode().Perm() != before.Mode().Perm() {
+ t.Fatalf("migration changed permissions: %v %v", after, err)
+ }
+ if _, _, err = SaveAgentInstructions("edited", read.Revision); err != nil {
+ t.Fatal(err)
+ }
+ })
+ }
+}
+
+func TestAgentInstructionsMigrationDuplicates(t *testing.T) {
+ for _, same := range []bool{true, false} {
+ t.Run(fmt.Sprint(same), func(t *testing.T) {
+ agentInstructionsTestDir(t)
+ legacy := "legacy"
+ canonical := legacy
+ if !same {
+ canonical = "canonical"
+ }
+ writeAgentInstructionsFixture(t, LegacyAgentInstructionsPath(), legacy)
+ writeAgentInstructionsFixture(t, AgentInstructionsPath(), canonical)
+ read, err := ReadAgentInstructions()
+ if same {
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, migrated, err := SaveAgentInstructions("edited", read.Revision); err != nil || !migrated {
+ t.Fatalf("duplicate cleanup not reported: %v %v", migrated, err)
+ }
+ if _, err = os.Stat(LegacyAgentInstructionsPath()); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("duplicate not cleaned up: %v", err)
+ }
+ return
+ }
+ if !errors.Is(err, ErrAgentInstructionsLocationConflict) {
+ t.Fatalf("different files not rejected: %v", err)
+ }
+ if _, _, err = SaveAgentInstructions("replacement", "missing"); !errors.Is(err, ErrAgentInstructionsLocationConflict) {
+ t.Fatalf("conflicting save not rejected: %v", err)
+ }
+ for path, want := range map[string]string{LegacyAgentInstructionsPath(): legacy, AgentInstructionsPath(): canonical} {
+ actual, err := os.ReadFile(path)
+ if err != nil || string(actual) != want {
+ t.Fatalf("conflict lost %s: %q %v", path, actual, err)
+ }
+ }
+ })
+ }
+}
+
+func TestAgentInstructionsMigrationFailurePreservesLegacy(t *testing.T) {
agentInstructionsTestDir(t)
- outside := t.TempDir()
- if err := os.Symlink(outside, filepath.Dir(AgentInstructionsPath())); err != nil {
- t.Skipf("symlinks unavailable: %v", err)
+ writeAgentInstructionsFixture(t, LegacyAgentInstructionsPath(), "original")
+ read, err := ReadAgentInstructions()
+ if err != nil {
+ t.Fatal(err)
+ }
+ // A non-directory destination must never cause deletion of the old source.
+ if err = os.WriteFile(filepath.Join(DataDir, "storage"), []byte("blocked"), 0600); err != nil {
+ t.Fatal(err)
}
- if _, err := ReadAgentInstructions(); err == nil {
- t.Fatal("followed storage link")
+ if _, _, err = SaveAgentInstructions("replacement", read.Revision); err == nil {
+ t.Fatal("accepted invalid storage directory")
}
- if _, err := SaveAgentInstructions("escape", "missing"); err == nil {
- t.Fatal("wrote through storage link")
+ actual, err := os.ReadFile(LegacyAgentInstructionsPath())
+ if err != nil || string(actual) != "original" {
+ t.Fatalf("failed migration lost original: %q %v", actual, err)
+ }
+}
+
+func TestAgentInstructionsInvalidLegacyPreserved(t *testing.T) {
+ for _, content := range []string{strings.Repeat("a", MaxAgentInstructionsSize+1), "\xff", "\x00"} {
+ t.Run(fmt.Sprintf("bytes=%d", len(content)), func(t *testing.T) {
+ agentInstructionsTestDir(t)
+ writeAgentInstructionsFixture(t, LegacyAgentInstructionsPath(), content)
+ if _, err := ReadAgentInstructions(); err == nil {
+ t.Fatal("accepted invalid legacy source")
+ }
+ if _, _, err := SaveAgentInstructions("replacement", "missing"); err == nil {
+ t.Fatal("overwrote invalid legacy source")
+ }
+ actual, err := os.ReadFile(LegacyAgentInstructionsPath())
+ if err != nil || string(actual) != content {
+ t.Fatalf("invalid legacy source lost: %v", err)
+ }
+ })
}
}