Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): recover ACP agents when the npx/uvx interpreter is broken, and log agent failures (#3065)

Andrew Mikofalvye9ad85976531
diff --git a/.changeset/acp-broken-interpreter-managed-runtime-fallback.md b/.changeset/acp-broken-interpreter-managed-runtime-fallback.md
new file mode 100644
index 000000000..5dfa22334
--- /dev/null
+++ b/.changeset/acp-broken-interpreter-managed-runtime-fallback.md
@@ -0,0 +1,9 @@
+---
+'@inkeep/open-knowledge': patch
+---
+
+In-app agents no longer die with an unreadable error when the Node.js or uv on your machine is broken.
+
+OK checked that `npx`/`uvx` existed before launching an agent, but not that it could actually run — so an interpreter that was installed yet fatally broken (on macOS, most often a Homebrew `node` whose `icu4c` library was upgraded out from under it) launched an agent that aborted before it could say hello. All you saw was `initialize failed: ACP connection closed`, with nothing to act on. OK now checks that the interpreter runs, and a broken one gets the same offer a missing one already got: OK downloads and uses its own private copy of Node.js or uv, with your consent. If you decline, the message now says the interpreter is installed but failing rather than claiming it isn't installed.
+
+Agent failures also reach the server log now, so a bug report carries them. The last thing a dying agent wrote to its error output — the linker error, the stack trace — was previously visible only in the chat panel, which meant a diagnostic bundle filed for an agent crash contained no evidence of it. An agent that exits unexpectedly mid-session is logged too.
diff --git a/.changeset/acp-runtime-consent-per-launch.md b/.changeset/acp-runtime-consent-per-launch.md
new file mode 100644
index 000000000..97e6e8058
--- /dev/null
+++ b/.changeset/acp-runtime-consent-per-launch.md
@@ -0,0 +1,9 @@
+---
+'@inkeep/open-knowledge': patch
+---
+
+Ask about downloading a managed Node.js/uv runtime once per launch instead of remembering the answer.
+
+The consent prompt used to carry a "Remember this for future agents" checkbox that defaulted to on, and the decision was persisted to `~/.ok/acp-runtime-consent.json`. A remembered "Not now" removed the offer permanently with nothing in the UI to undo it — the only cure was deleting that file by hand. A remembered "Download" authorized a later download the user never saw.
+
+The prompt is now per launch: decline, and the next agent that needs the runtime asks again. An already-installed runtime is still used without asking, which is what made the remembered grant near-dead weight anyway. Any existing `acp-runtime-consent.json` is simply ignored — nothing reads or writes it now, and leaving it costs nothing.
diff --git a/.changeset/acp-self-heal-managed-runtime.md b/.changeset/acp-self-heal-managed-runtime.md
new file mode 100644
index 000000000..864878537
--- /dev/null
+++ b/.changeset/acp-self-heal-managed-runtime.md
@@ -0,0 +1,11 @@
+---
+'@inkeep/open-knowledge': patch
+---
+
+Repair a damaged managed runtime instead of telling the user to delete a directory.
+
+When OK's own downloaded Node.js/uv was present but couldn't run — an interrupted extraction, a clobbered launcher — the launch failed with "delete that directory and OK will download a fresh copy on the next launch". That is homework in a terminal for a copy the user never installed and can't inspect.
+
+OK now discards the damaged copy itself and offers to download a fresh one, with the same consent card and progress the first download uses. Three outcomes stay honest about which one happened: declining says OK's copy is damaged (not that the interpreter is missing); a replacement that also won't run points at the machine (antivirus, security policy, unsupported CPU) rather than at a system Node that was never involved; and a copy that can't be moved aside — another agent still holding it open, which is how this fails on Windows — says so instead of claiming a fresh download failed.
+
+The repair is one attempt per launch, and every download is still gated on the prompt, so nothing refetches behind the user.
diff --git a/packages/app/src/components/acp/ThreadView.tsx b/packages/app/src/components/acp/ThreadView.tsx
index 55eb0489e..a8d6815ed 100644
--- a/packages/app/src/components/acp/ThreadView.tsx
+++ b/packages/app/src/components/acp/ThreadView.tsx
@@ -78,7 +78,6 @@ import { useOptionalPageList } from '@/components/PageListContext';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { ButtonGroup, ButtonGroupSeparator } from '@/components/ui/button-group';
-import { Checkbox } from '@/components/ui/checkbox';
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog';
import {
DropdownMenu,
@@ -2860,7 +2859,6 @@ function RuntimeConsentPrompt({
}): ReactNode {
const { t } = useLingui();
const client = getAgentThreadClient();
- const [remember, setRemember] = useState(true);
const downloadLabelId = useId();
if (item.resolved === 'declined' || item.resolved === 'timeout') {
@@ -2939,30 +2937,31 @@ function RuntimeConsentPrompt({
>
<div className="mb-1 flex items-center gap-1.5 font-medium">
<Download className="size-4 shrink-0" aria-hidden="true" />
- <span>{t`${item.agentName} needs ${item.displayName}`}</span>
+ <span>
+ {item.reason === 'damaged'
+ ? t`${item.displayName} needs replacing`
+ : t`${item.agentName} needs ${item.displayName}`}
+ </span>
</div>
<p className="mb-2 text-muted-foreground text-xs">
- {t`This agent runs through ${item.provides}, which isn't installed. Open Knowledge can download a private copy of ${item.displayName} ${item.version} (about ${item.approxSizeMB} MB from ${item.sourceHost}) that won't touch the rest of your system.`}
+ {item.reason === 'damaged'
+ ? // This copy is OK's own, so the user has nothing to repair and no
+ // reason to hear about their system interpreter.
+ t`Open Knowledge's own copy of ${item.displayName} is damaged and won't run. It can download a fresh copy of ${item.displayName} ${item.version} (about ${item.approxSizeMB} MB from ${item.sourceHost}) to replace it.`
+ : item.reason === 'broken'
+ ? // Telling someone whose interpreter is present-but-broken that it
+ // "isn't installed" sends them to install a second copy the broken
+ // one still shadows on PATH.
+ t`This agent runs through ${item.provides}, which is installed but won't run — its ${item.displayName} looks broken. Open Knowledge can download a private copy of ${item.displayName} ${item.version} (about ${item.approxSizeMB} MB from ${item.sourceHost}) that won't touch the rest of your system.`
+ : t`This agent runs through ${item.provides}, which isn't installed. Open Knowledge can download a private copy of ${item.displayName} ${item.version} (about ${item.approxSizeMB} MB from ${item.sourceHost}) that won't touch the rest of your system.`}
</p>
- <label
- htmlFor={`runtime-consent-remember-${item.requestId}`}
- className="mb-2 flex w-fit items-center gap-1.5 text-muted-foreground text-xs"
- >
- <Checkbox
- id={`runtime-consent-remember-${item.requestId}`}
- checked={remember}
- onCheckedChange={(value) => setRemember(value === true)}
- data-testid="agent-thread-runtime-consent-remember"
- />
- {t`Remember this for future agents`}
- </label>
<div className="flex flex-wrap gap-1.5">
<Button
type="button"
size="sm"
className="h-7 text-xs"
onClick={() =>
- client.respondRuntimeConsent(threadId, item.requestId, { kind: 'granted', remember })
+ client.respondRuntimeConsent(threadId, item.requestId, { kind: 'granted' })
}
data-testid="agent-thread-runtime-consent-allow"
>
@@ -2974,7 +2973,7 @@ function RuntimeConsentPrompt({
variant="outline"
className="h-7 text-xs"
onClick={() =>
- client.respondRuntimeConsent(threadId, item.requestId, { kind: 'declined', remember })
+ client.respondRuntimeConsent(threadId, item.requestId, { kind: 'declined' })
}
data-testid="agent-thread-runtime-consent-decline"
>
diff --git a/packages/app/src/lib/acp/thread-client.ts b/packages/app/src/lib/acp/thread-client.ts
index 35928c29f..d743ee10a 100644
--- a/packages/app/src/lib/acp/thread-client.ts
+++ b/packages/app/src/lib/acp/thread-client.ts
@@ -324,7 +324,7 @@ export class AgentThreadClient {
respondRuntimeConsent(
threadId: string,
requestId: string,
- outcome: { kind: 'granted'; remember?: boolean } | { kind: 'declined'; remember?: boolean },
+ outcome: { kind: 'granted' } | { kind: 'declined' },
): void {
this.send({ op: 'runtime_consent_response', threadId, requestId, outcome });
}
diff --git a/packages/app/src/lib/acp/thread-event-model.test.ts b/packages/app/src/lib/acp/thread-event-model.test.ts
index 20ccc0e69..44d3f0b92 100644
--- a/packages/app/src/lib/acp/thread-event-model.test.ts
+++ b/packages/app/src/lib/acp/thread-event-model.test.ts
@@ -313,6 +313,36 @@ describe('buildThreadRenderModel', () => {
});
});
+ test('a request with no reason reads as missing — what pre-field events were', () => {
+ const model = buildThreadRenderModel([consentRequest()]);
+ const card = model.items.find((i) => i.kind === 'runtime_consent');
+ if (card?.kind !== 'runtime_consent') throw new Error('unreachable');
+ // The card picks its sentence off this; defaulting the other way would tell
+ // every replayed thread its interpreter is broken.
+ expect(card.reason).toBe('missing');
+ });
+
+ test('a broken-interpreter request carries that through to the card', () => {
+ const model = buildThreadRenderModel([
+ { ...consentRequest(), reason: 'broken' } as ThreadEvent,
+ ]);
+ const card = model.items.find((i) => i.kind === 'runtime_consent');
+ if (card?.kind !== 'runtime_consent') throw new Error('unreachable');
+ expect(card.reason).toBe('broken');
+ });
+
+ // The repair offer. Its copy is about OK's own copy being damaged, so the
+ // card must not fall back to either interpreter sentence — both describe
+ // something the user installed.
+ test('a damaged-runtime request carries that through to the card', () => {
+ const model = buildThreadRenderModel([
+ { ...consentRequest(), reason: 'damaged' } as ThreadEvent,
+ ]);
+ const card = model.items.find((i) => i.kind === 'runtime_consent');
+ if (card?.kind !== 'runtime_consent') throw new Error('unreachable');
+ expect(card.reason).toBe('damaged');
+ });
+
test('grant → progress → spawning drives the card through running to done', () => {
const model = buildThreadRenderModel([
consentRequest(),
diff --git a/packages/app/src/lib/acp/thread-event-model.ts b/packages/app/src/lib/acp/thread-event-model.ts
index fd6a3e2bb..bbb3de1a3 100644
--- a/packages/app/src/lib/acp/thread-event-model.ts
+++ b/packages/app/src/lib/acp/thread-event-model.ts
@@ -120,6 +120,8 @@ interface RenderedRuntimeConsent {
approxSizeMB: number;
sourceHost: string;
agentName: string;
+ /** Absent on events persisted before the field existed — those were `missing`. */
+ reason: 'missing' | 'broken' | 'damaged';
/** null while awaiting the user's answer. */
resolved: 'granted' | 'declined' | 'timeout' | null;
/**
@@ -351,6 +353,7 @@ export class ThreadRenderModelBuilder {
approxSizeMB: event.approxSizeMB,
sourceHost: event.sourceHost,
agentName: event.agentName,
+ reason: event.reason ?? 'missing',
resolved: null,
install: null,
progress: null,
diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.json
index eb79efe51..2a489c8f1 100644
--- a/packages/app/src/locales/ar/messages.json
+++ b/packages/app/src/locales/ar/messages.json
@@ -1935,6 +1935,21 @@
"OETysD": [
"لا توجد صفحات محورية بعد. تظهر المحاور عندما تتراكم للصفحات روابط واردة في الرسم البياني."
],
+ "OJ4VDl": [
+ "يعمل هذا الوكيل عبر ",
+ ["0"],
+ "، وهو مثبَّت لكنه لا يعمل — يبدو أن ",
+ ["1"],
+ " الخاص به معطَّل. يستطيع Open Knowledge تنزيل نسخة خاصة من ",
+ ["2"],
+ " ",
+ ["3"],
+ " (نحو ",
+ ["4"],
+ " ميغابايت من ",
+ ["5"],
+ ") لا تمس بقية نظامك."
+ ],
"OJOA7Z": ["⋯ ", ["0"], " سطر دون تغيير"],
"OJTOUj": ["يتطلب ", ["brand"], "."],
"OJeiSH": ["فشلت إضافة الخاصية"],
@@ -3519,6 +3534,7 @@
"hZoBHK": ["محتوى بداية فارغ"],
"haHgQj": ["تم نسخ المسار النسبي"],
"habOU_": ["فشل تحديث إعداد الموافقة التلقائية — ", ["detail"]],
+ "hadECI": ["يلزم استبدال ", ["0"]],
"he3ygx": ["نسخ"],
"hgF0al": ["استخدام ", ["0"], " للوضع الفاتح النشط"],
"hgf5io": ["Blob Run"],
@@ -3703,6 +3719,19 @@
],
"jxtXZI": ["ثبّت واجهة gh السطرية"],
"k0dL2I": ["يجري إعادة الاتصال بخدمة الوكيل…"],
+ "k0jsmJ": [
+ "نسخة ",
+ ["0"],
+ " الخاصة بـ Open Knowledge تالفة ولا تعمل. يستطيع تنزيل نسخة جديدة من ",
+ ["1"],
+ " ",
+ ["2"],
+ " (نحو ",
+ ["3"],
+ " ميغابايت من ",
+ ["4"],
+ ") لاستبدالها."
+ ],
"k2fEi7": [
"إضافات المستخدم خاصة بهذا الجهاز — شغّلها أو أوقفها هنا. يعيش الاختيار في إعداد المستخدم لديك ولا يُودَع في المشروع أبدًا. تحصل كل إضافة مفعّلة على صفحتها الخاصة تحت «الإضافات» في الشريط الجانبي للإعدادات."
],
@@ -4100,7 +4129,6 @@
],
"ogAuyr": ["العودة إلى عرض المستند"],
"ohUJJM": ["الإضافات"],
- "oi4zaa": ["تذكّر هذا للوكلاء المستقبليين"],
"ojGc_T": ["فتح التعليق"],
"omXJcU": ["إغلاق الأخرى"],
"onTlRk": ["تعذّر تحديث مشاركة المهارات"],
diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.po
index 80c758cbe..07797c8c6 100644
--- a/packages/app/src/locales/ar/messages.po
+++ b/packages/app/src/locales/ar/messages.po
@@ -329,6 +329,11 @@ msgstr "يتيح {0} لـ {1} التصرف دون سؤال"
msgid "{0} needs {1}"
msgstr "يحتاج {0} إلى {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "يلزم استبدال {0}"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8473,6 +8478,15 @@ msgstr "الفتح في شجرة عمل"
msgid "Open it there"
msgstr "افتحه هناك"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "نسخة {0} الخاصة بـ Open Knowledge تالفة ولا تعمل. يستطيع تنزيل نسخة جديدة من {1} {2} (نحو {3} ميغابايت من {4}) لاستبدالها."
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "فتح الرابط"
@@ -9716,10 +9730,6 @@ msgstr "الصلة"
msgid "Reload"
msgstr "إعادة تحميل"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "تذكّر هذا للوكلاء المستقبليين"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "بعيد"
@@ -12389,6 +12399,16 @@ msgstr "لم يعلن هذا الوكيل عن أوامره بعد"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "يحتاج هذا الوكيل إلى تسجيل دخولك أولًا — انظر الإشعار أدناه."
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "يعمل هذا الوكيل عبر {0}، وهو مثبَّت لكنه لا يعمل — يبدو أن {1} الخاص به معطَّل. يستطيع Open Knowledge تنزيل نسخة خاصة من {2} {3} (نحو {4} ميغابايت من {5}) لا تمس بقية نظامك."
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.json
index 95d1307a0..192c16814 100644
--- a/packages/app/src/locales/bn/messages.json
+++ b/packages/app/src/locales/bn/messages.json
@@ -1639,6 +1639,21 @@
"ODGGlj": ["ফোল্ডারের নাম: ", ["detail"]],
"OEEQKT": ["ভালো"],
"OETysD": ["এখনও কোনো হাব পাতা নেই। পাতাগুলোতে আগত গ্রাফ লিংক জমা হলে হাব দেখা দেয়।"],
+ "OJ4VDl": [
+ "এই এজেন্টটি ",
+ ["0"],
+ "-এর মাধ্যমে চলে, যা ইনস্টল করা আছে কিন্তু চলছে না — এর ",
+ ["1"],
+ " নষ্ট বলে মনে হচ্ছে। Open Knowledge ",
+ ["2"],
+ " ",
+ ["3"],
+ "-এর একটি ব্যক্তিগত অনুলিপি ডাউনলোড করতে পারে (প্রায় ",
+ ["4"],
+ " MB, ",
+ ["5"],
+ " থেকে) যা আপনার সিস্টেমের বাকি অংশ স্পর্শ করবে না।"
+ ],
"OJOA7Z": ["⋯ ", ["0"], "টি অপরিবর্তিত লাইন"],
"OJTOUj": [["brand"], " দরকার।"],
"OJeiSH": ["প্রপার্টি যোগ করতে ব্যর্থ"],
@@ -2977,6 +2992,7 @@
"hZoBHK": ["খালি শুরুর বিষয়বস্তু"],
"haHgQj": ["আপেক্ষিক পথ কপি হয়েছে"],
"habOU_": ["স্বয়ংক্রিয় অনুমোদনের সেটিং হালনাগাদ করতে ব্যর্থ — ", ["detail"]],
+ "hadECI": [["0"], " প্রতিস্থাপন করা দরকার"],
"he3ygx": ["কপি করুন"],
"hgF0al": ["সক্রিয় হালকা মোডের জন্য ", ["0"], " ব্যবহার করুন"],
"hgf5io": ["Blob Run"],
@@ -3160,6 +3176,19 @@
],
"jxtXZI": ["gh CLI ইনস্টল করুন"],
"k0dL2I": ["এজেন্ট সেবার সঙ্গে আবার যুক্ত হচ্ছে…"],
+ "k0jsmJ": [
+ "Open Knowledge-এর নিজস্ব ",
+ ["0"],
+ " অনুলিপিটি নষ্ট এবং চলছে না। এটি প্রতিস্থাপনের জন্য ",
+ ["1"],
+ " ",
+ ["2"],
+ "-এর একটি নতুন অনুলিপি ডাউনলোড করতে পারে (প্রায় ",
+ ["3"],
+ " MB, ",
+ ["4"],
+ " থেকে)।"
+ ],
"k2fEi7": [
"ব্যবহারকারী প্লাগইন এই যন্ত্রেই সীমাবদ্ধ — সেগুলো এখানে চালু বা বন্ধ করুন। এই বাছাই আপনার ব্যবহারকারী কনফিগে থাকে এবং কখনও প্রকল্পে কমিট হয় না। চালু করা প্রতিটি প্লাগইন সেটিং সাইডবারে Plugins-এর নিচে নিজের পাতা পায়।"
],
@@ -3516,7 +3545,6 @@
],
"ogAuyr": ["নথি দৃশ্যে ফিরুন"],
"ohUJJM": ["প্লাগইন"],
- "oi4zaa": ["ভবিষ্যতের এজেন্টদের জন্য এটি মনে রাখুন"],
"ojGc_T": ["মন্তব্য খুলুন"],
"omXJcU": ["বাকিগুলো বন্ধ করুন"],
"onTlRk": ["স্কিল ভাগাভাগি হালনাগাদ করা যায়নি"],
diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.po
index 1bc404918..399cb56d1 100644
--- a/packages/app/src/locales/bn/messages.po
+++ b/packages/app/src/locales/bn/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} {1}-কে না জিজ্ঞেস করেই কাজ ক
msgid "{0} needs {1}"
msgstr "{0}-এর {1} দরকার"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} প্রতিস্থাপন করা দরকার"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8469,6 +8474,15 @@ msgstr "ওয়ার্কট্রিতে খুলুন"
msgid "Open it there"
msgstr "সেটি সেখানেই খুলুন"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "Open Knowledge-এর নিজস্ব {0} অনুলিপিটি নষ্ট এবং চলছে না। এটি প্রতিস্থাপনের জন্য {1} {2}-এর একটি নতুন অনুলিপি ডাউনলোড করতে পারে (প্রায় {3} MB, {4} থেকে)।"
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "লিংক খুলুন"
@@ -9712,10 +9726,6 @@ msgstr "প্রাসঙ্গিকতা"
msgid "Reload"
msgstr "আবার লোড করুন"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "ভবিষ্যতের এজেন্টদের জন্য এটি মনে রাখুন"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "রিমোট"
@@ -12385,6 +12395,16 @@ msgstr "এই এজেন্ট এখনও তার কমান্ড ঘ
msgid "This agent needs you to sign in first — see the notice below."
msgstr "এই এজেন্টের জন্য আপনাকে আগে সাইন ইন করতে হবে — নিচের বিজ্ঞপ্তিটি দেখুন।"
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "এই এজেন্টটি {0}-এর মাধ্যমে চলে, যা ইনস্টল করা আছে কিন্তু চলছে না — এর {1} নষ্ট বলে মনে হচ্ছে। Open Knowledge {2} {3}-এর একটি ব্যক্তিগত অনুলিপি ডাউনলোড করতে পারে (প্রায় {4} MB, {5} থেকে) যা আপনার সিস্টেমের বাকি অংশ স্পর্শ করবে না।"
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index a34ea3bbb..a9dc11a39 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -1689,6 +1689,21 @@
"ODGGlj": ["Folder name: ", ["detail"]],
"OEEQKT": ["Good"],
"OETysD": ["No hub pages yet. Hubs appear once pages accumulate inbound graph links."],
+ "OJ4VDl": [
+ "This agent runs through ",
+ ["0"],
+ ", which is installed but won't run — its ",
+ ["1"],
+ " looks broken. Open Knowledge can download a private copy of ",
+ ["2"],
+ " ",
+ ["3"],
+ " (about ",
+ ["4"],
+ " MB from ",
+ ["5"],
+ ") that won't touch the rest of your system."
+ ],
"OJOA7Z": ["⋯ ", ["0"], " unchanged lines"],
"OJTOUj": ["Requires ", ["brand"], "."],
"OJeiSH": ["Failed to add property"],
@@ -3072,6 +3087,7 @@
"hZoBHK": ["Empty starting content"],
"haHgQj": ["Copied relative path"],
"habOU_": ["Failed to update the auto-approve setting — ", ["detail"]],
+ "hadECI": [["0"], " needs replacing"],
"he3ygx": ["Copy"],
"hgF0al": ["Use ", ["0"], " for the active light mode"],
"hgf5io": ["Blob Run"],
@@ -3255,6 +3271,19 @@
],
"jxtXZI": ["Install the gh CLI"],
"k0dL2I": ["Reconnecting to the agent service…"],
+ "k0jsmJ": [
+ "Open Knowledge's own copy of ",
+ ["0"],
+ " is damaged and won't run. It can download a fresh copy of ",
+ ["1"],
+ " ",
+ ["2"],
+ " (about ",
+ ["3"],
+ " MB from ",
+ ["4"],
+ ") to replace it."
+ ],
"k2fEi7": [
"User plugins are personal to this device — turn them on or off here. The choice lives in your user config and is never committed to the project. Each enabled plugin gets its own page under Plugins in the settings sidebar."
],
@@ -3626,7 +3655,6 @@
],
"ogAuyr": ["Back to document view"],
"ohUJJM": ["Plugins"],
- "oi4zaa": ["Remember this for future agents"],
"ojGc_T": ["Open comment"],
"omXJcU": ["Close others"],
"onTlRk": ["Couldn't update skills sharing"],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index e83509c35..3c03c05ee 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} lets {1} act without asking"
msgid "{0} needs {1}"
msgstr "{0} needs {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} needs replacing"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8473,6 +8478,15 @@ msgstr "Open in worktree"
msgid "Open it there"
msgstr "Open it there"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "Open link"
@@ -9716,10 +9730,6 @@ msgstr "Relevance"
msgid "Reload"
msgstr "Reload"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "Remember this for future agents"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "remote"
@@ -12389,6 +12399,16 @@ msgstr "This agent hasn't announced its commands yet"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "This agent needs you to sign in first — see the notice below."
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.json
index 878a678ba..52ee2ef9c 100644
--- a/packages/app/src/locales/es/messages.json
+++ b/packages/app/src/locales/es/messages.json
@@ -1961,6 +1961,21 @@
"OETysD": [
"Todavía no hay páginas índice. Los índices aparecen cuando las páginas acumulan enlaces entrantes en el grafo."
],
+ "OJ4VDl": [
+ "Este agente funciona con ",
+ ["0"],
+ ", que está instalado pero no arranca: su ",
+ ["1"],
+ " parece estar dañado. Open Knowledge puede descargar una copia privada de ",
+ ["2"],
+ " ",
+ ["3"],
+ " (unos ",
+ ["4"],
+ " MB desde ",
+ ["5"],
+ ") que no tocará el resto de tu sistema."
+ ],
"OJOA7Z": ["⋯ ", ["0"], " líneas sin cambios"],
"OJTOUj": ["Requiere ", ["brand"], "."],
"OJeiSH": ["No se pudo añadir la propiedad"],
@@ -3589,6 +3604,7 @@
"hZoBHK": ["Contenido inicial vacío"],
"haHgQj": ["Ruta relativa copiada"],
"habOU_": ["No se pudo actualizar el ajuste de aprobación automática — ", ["detail"]],
+ "hadECI": [["0"], " necesita reemplazo"],
"he3ygx": ["Copiar"],
"hgF0al": ["Usar ", ["0"], " para el modo claro activo"],
"hgf5io": ["Blob Run"],
@@ -3792,6 +3808,19 @@
],
"jxtXZI": ["Instalar la CLI de gh"],
"k0dL2I": ["Reconectando con el servicio de agentes…"],
+ "k0jsmJ": [
+ "La copia propia de ",
+ ["0"],
+ " de Open Knowledge está dañada y no arranca. Puede descargar una copia nueva de ",
+ ["1"],
+ " ",
+ ["2"],
+ " (unos ",
+ ["3"],
+ " MB desde ",
+ ["4"],
+ ") para reemplazarla."
+ ],
"k2fEi7": [
"Los complementos de usuario son personales de este dispositivo: actívalos o desactívalos aquí. La elección vive en tu configuración de usuario y nunca se guarda en el proyecto. Cada complemento activado tiene su propia página bajo Complementos en la barra lateral de ajustes."
],
@@ -4200,7 +4229,6 @@
],
"ogAuyr": ["Volver a la vista de documento"],
"ohUJJM": ["Complementos"],
- "oi4zaa": ["Recordarlo para los próximos agentes"],
"ojGc_T": ["Abrir el comentario"],
"omXJcU": ["Cerrar las demás"],
"onTlRk": ["No se pudo actualizar la compartición de habilidades"],
diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.po
index 5c17c61d5..6ed4fe5c8 100644
--- a/packages/app/src/locales/es/messages.po
+++ b/packages/app/src/locales/es/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} permite que {1} actúe sin preguntar"
msgid "{0} needs {1}"
msgstr "{0} necesita {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} necesita reemplazo"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8473,6 +8478,15 @@ msgstr "Abrir en un worktree"
msgid "Open it there"
msgstr "Abrirlo ahí"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "La copia propia de {0} de Open Knowledge está dañada y no arranca. Puede descargar una copia nueva de {1} {2} (unos {3} MB desde {4}) para reemplazarla."
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "Abrir el enlace"
@@ -9716,10 +9730,6 @@ msgstr "Relevancia"
msgid "Reload"
msgstr "Recargar"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "Recordarlo para los próximos agentes"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "remoto"
@@ -12389,6 +12399,16 @@ msgstr "Este agente aún no ha anunciado sus comandos"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "Este agente necesita que inicies sesión primero; mira el aviso de abajo."
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "Este agente funciona con {0}, que está instalado pero no arranca: su {1} parece estar dañado. Open Knowledge puede descargar una copia privada de {2} {3} (unos {4} MB desde {5}) que no tocará el resto de tu sistema."
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.json
index 86b990243..84a9355c3 100644
--- a/packages/app/src/locales/fr/messages.json
+++ b/packages/app/src/locales/fr/messages.json
@@ -1990,6 +1990,21 @@
"OETysD": [
"Pas encore de pages pivots. Les pivots apparaissent une fois que les pages accumulent des liens entrants dans le graphe."
],
+ "OJ4VDl": [
+ "Cet agent fonctionne via ",
+ ["0"],
+ ", qui est installé mais ne démarre pas : son ",
+ ["1"],
+ " semble cassé. Open Knowledge peut télécharger une copie privée de ",
+ ["2"],
+ " ",
+ ["3"],
+ " (environ ",
+ ["4"],
+ " Mo depuis ",
+ ["5"],
+ ") qui ne touchera pas au reste de votre système."
+ ],
"OJOA7Z": ["⋯ ", ["0"], " lignes inchangées"],
"OJTOUj": ["Nécessite ", ["brand"], "."],
"OJeiSH": ["Échec de l'ajout de la propriété"],
@@ -3620,6 +3635,7 @@
"hZoBHK": ["Contenu de départ vide"],
"haHgQj": ["Chemin relatif copié"],
"habOU_": ["Échec de la mise à jour du réglage d'approbation automatique — ", ["detail"]],
+ "hadECI": [["0"], " doit être remplacé"],
"he3ygx": ["Copier"],
"hgF0al": ["Utiliser ", ["0"], " pour le mode clair actif"],
"hgf5io": ["Blob Run"],
@@ -3825,6 +3841,19 @@
],
"jxtXZI": ["Installer la CLI gh"],
"k0dL2I": ["Reconnexion au service d'agents…"],
+ "k0jsmJ": [
+ "La copie de ",
+ ["0"],
+ " propre à Open Knowledge est endommagée et ne démarre pas. Open Knowledge peut télécharger une nouvelle copie de ",
+ ["1"],
+ " ",
+ ["2"],
+ " (environ ",
+ ["3"],
+ " Mo depuis ",
+ ["4"],
+ ") pour la remplacer."
+ ],
"k2fEi7": [
"Les plugins utilisateur sont propres à cet appareil — activez-les ou désactivez-les ici. Ce choix réside dans votre configuration utilisateur et n'est jamais validé dans le projet. Chaque plugin activé obtient sa propre page sous Plugins dans la barre latérale des paramètres."
],
@@ -4237,7 +4266,6 @@
],
"ogAuyr": ["Retour à la vue document"],
"ohUJJM": ["Plugins"],
- "oi4zaa": ["Mémoriser ce choix pour les prochains agents"],
"ojGc_T": ["Ouvrir le commentaire"],
"omXJcU": ["Fermer les autres"],
"onTlRk": ["Impossible de mettre à jour le partage des compétences"],
diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.po
index f96188a61..508572462 100644
--- a/packages/app/src/locales/fr/messages.po
+++ b/packages/app/src/locales/fr/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} permet à {1} d'agir sans demander"
msgid "{0} needs {1}"
msgstr "{0} a besoin de {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} doit être remplacé"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8473,6 +8478,15 @@ msgstr "Ouvrir dans un worktree"
msgid "Open it there"
msgstr "L'ouvrir là-bas"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "La copie de {0} propre à Open Knowledge est endommagée et ne démarre pas. Open Knowledge peut télécharger une nouvelle copie de {1} {2} (environ {3} Mo depuis {4}) pour la remplacer."
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "Ouvrir le lien"
@@ -9716,10 +9730,6 @@ msgstr "Pertinence"
msgid "Reload"
msgstr "Recharger"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "Mémoriser ce choix pour les prochains agents"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "distant"
@@ -12389,6 +12399,16 @@ msgstr "Cet agent n'a pas encore annoncé ses commandes"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "Cet agent nécessite que vous vous connectiez d'abord — voyez l'avis ci-dessous."
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "Cet agent fonctionne via {0}, qui est installé mais ne démarre pas : son {1} semble cassé. Open Knowledge peut télécharger une copie privée de {2} {3} (environ {4} Mo depuis {5}) qui ne touchera pas au reste de votre système."
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.json
index 9ae0a5f11..2de947211 100644
--- a/packages/app/src/locales/hi/messages.json
+++ b/packages/app/src/locales/hi/messages.json
@@ -1636,6 +1636,21 @@
"ODGGlj": ["फ़ोल्डर का नाम: ", ["detail"]],
"OEEQKT": ["अच्छा"],
"OETysD": ["अभी कोई हब पेज नहीं। पेजों पर आने वाले ग्राफ़ लिंक जमा होने के बाद हब दिखते हैं।"],
+ "OJ4VDl": [
+ "यह एजेंट ",
+ ["0"],
+ " के ज़रिए चलता है, जो इंस्टॉल तो है पर चलता नहीं — इसका ",
+ ["1"],
+ " खराब लगता है। Open Knowledge ",
+ ["2"],
+ " ",
+ ["3"],
+ " की एक निजी प्रति डाउनलोड कर सकता है (लगभग ",
+ ["4"],
+ " MB, ",
+ ["5"],
+ " से) जो आपके बाकी सिस्टम को नहीं छुएगी।"
+ ],
"OJOA7Z": ["⋯ ", ["0"], " अपरिवर्तित पंक्तियाँ"],
"OJTOUj": [["brand"], " ज़रूरी है।"],
"OJeiSH": ["प्रॉपर्टी जोड़ने में विफल"],
@@ -2964,6 +2979,7 @@
"hZoBHK": ["खाली शुरुआती सामग्री"],
"haHgQj": ["सापेक्ष पथ कॉपी किया गया"],
"habOU_": ["स्वत: स्वीकृति सेटिंग अपडेट करने में विफल — ", ["detail"]],
+ "hadECI": [["0"], " को बदलना ज़रूरी है"],
"he3ygx": ["कॉपी करें"],
"hgF0al": ["सक्रिय हल्के मोड के लिए ", ["0"], " का उपयोग करें"],
"hgf5io": ["Blob Run"],
@@ -3149,6 +3165,19 @@
],
"jxtXZI": ["gh CLI इंस्टॉल करें"],
"k0dL2I": ["एजेंट सेवा से फिर से जोड़ा जा रहा है…"],
+ "k0jsmJ": [
+ "Open Knowledge की अपनी ",
+ ["0"],
+ " प्रति खराब हो गई है और चलती नहीं। यह इसे बदलने के लिए ",
+ ["1"],
+ " ",
+ ["2"],
+ " की नई प्रति डाउनलोड कर सकता है (लगभग ",
+ ["3"],
+ " MB, ",
+ ["4"],
+ " से)।"
+ ],
"k2fEi7": [
"उपयोगकर्ता प्लगइन इस डिवाइस तक सीमित हैं — उन्हें यहाँ चालू या बंद करें। यह चुनाव आपके उपयोगकर्ता कॉन्फ़िग में रहता है और कभी प्रोजेक्ट में कमिट नहीं होता। हर सक्षम प्लगइन को सेटिंग साइडबार में Plugins के अंतर्गत अपना पेज मिलता है।"
],
@@ -3505,7 +3534,6 @@
],
"ogAuyr": ["दस्तावेज़ दृश्य पर वापस"],
"ohUJJM": ["प्लगइन"],
- "oi4zaa": ["इसे भविष्य के एजेंट के लिए याद रखें"],
"ojGc_T": ["टिप्पणी खोलें"],
"omXJcU": ["बाकी बंद करें"],
"onTlRk": ["स्किल साझाकरण अपडेट नहीं किया जा सका"],
diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.po
index 892a7916d..274404547 100644
--- a/packages/app/src/locales/hi/messages.po
+++ b/packages/app/src/locales/hi/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} {1} को बिना पूछे काम करने दे
msgid "{0} needs {1}"
msgstr "{0} को {1} चाहिए"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} को बदलना ज़रूरी है"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8469,6 +8474,15 @@ msgstr "वर्कट्री में खोलें"
msgid "Open it there"
msgstr "इसे वहाँ खोलें"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "Open Knowledge की अपनी {0} प्रति खराब हो गई है और चलती नहीं। यह इसे बदलने के लिए {1} {2} की नई प्रति डाउनलोड कर सकता है (लगभग {3} MB, {4} से)।"
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "लिंक खोलें"
@@ -9712,10 +9726,6 @@ msgstr "प्रासंगिकता"
msgid "Reload"
msgstr "फिर से लोड करें"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "इसे भविष्य के एजेंट के लिए याद रखें"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "रिमोट"
@@ -12385,6 +12395,16 @@ msgstr "इस एजेंट ने अभी तक अपने कमां
msgid "This agent needs you to sign in first — see the notice below."
msgstr "इस एजेंट के लिए पहले आपका साइन इन करना ज़रूरी है — नीचे दी सूचना देखें।"
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "यह एजेंट {0} के ज़रिए चलता है, जो इंस्टॉल तो है पर चलता नहीं — इसका {1} खराब लगता है। Open Knowledge {2} {3} की एक निजी प्रति डाउनलोड कर सकता है (लगभग {4} MB, {5} से) जो आपके बाकी सिस्टम को नहीं छुएगी।"
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.json
index 11ba58992..326d59416 100644
--- a/packages/app/src/locales/id/messages.json
+++ b/packages/app/src/locales/id/messages.json
@@ -1693,6 +1693,21 @@
"OETysD": [
"Belum ada halaman pusat. Pusat muncul begitu halaman mengumpulkan tautan graf masuk."
],
+ "OJ4VDl": [
+ "Agen ini berjalan lewat ",
+ ["0"],
+ ", yang sudah terpasang tetapi tidak bisa jalan — ",
+ ["1"],
+ "-nya tampak rusak. Open Knowledge bisa mengunduh salinan pribadi ",
+ ["2"],
+ " ",
+ ["3"],
+ " (sekitar ",
+ ["4"],
+ " MB dari ",
+ ["5"],
+ ") yang tidak akan menyentuh bagian lain sistem Anda."
+ ],
"OJOA7Z": ["⋯ ", ["0"], " baris tidak berubah"],
"OJTOUj": ["Memerlukan ", ["brand"], "."],
"OJeiSH": ["Gagal menambahkan properti"],
@@ -3090,6 +3105,7 @@
"hZoBHK": ["Isi awal kosong"],
"haHgQj": ["Jalur relatif disalin"],
"habOU_": ["Gagal memperbarui pengaturan persetujuan otomatis — ", ["detail"]],
+ "hadECI": [["0"], " perlu diganti"],
"he3ygx": ["Salin"],
"hgF0al": ["Pakai ", ["0"], " untuk mode terang yang aktif"],
"hgf5io": ["Blob Run"],
@@ -3288,6 +3304,19 @@
],
"jxtXZI": ["Pasang CLI gh"],
"k0dL2I": ["Menyambung ulang ke layanan agen…"],
+ "k0jsmJ": [
+ "Salinan ",
+ ["0"],
+ " milik Open Knowledge sendiri rusak dan tidak bisa berjalan. Open Knowledge dapat mengunduh salinan baru ",
+ ["1"],
+ " ",
+ ["2"],
+ " (sekitar ",
+ ["3"],
+ " MB dari ",
+ ["4"],
+ ") untuk menggantinya."
+ ],
"k2fEi7": [
"Plugin pengguna bersifat pribadi untuk perangkat ini — nyalakan atau matikan di sini. Pilihan ini ada di konfigurasi pengguna Anda dan tidak pernah di-commit ke proyek. Setiap plugin yang aktif mendapat halamannya sendiri di bawah Plugin pada bilah sisi pengaturan."
],
@@ -3657,7 +3686,6 @@
],
"ogAuyr": ["Kembali ke tampilan dokumen"],
"ohUJJM": ["Plugin"],
- "oi4zaa": ["Ingat ini untuk agen berikutnya"],
"ojGc_T": ["Buka komentar"],
"omXJcU": ["Tutup yang lain"],
"onTlRk": ["Berbagi keterampilan tidak bisa diperbarui"],
diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.po
index 028a7c8aa..0a6307963 100644
--- a/packages/app/src/locales/id/messages.po
+++ b/packages/app/src/locales/id/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} membiarkan {1} bertindak tanpa bertanya"
msgid "{0} needs {1}"
msgstr "{0} membutuhkan {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} perlu diganti"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8469,6 +8474,15 @@ msgstr "Buka di worktree"
msgid "Open it there"
msgstr "Buka di sana"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "Salinan {0} milik Open Knowledge sendiri rusak dan tidak bisa berjalan. Open Knowledge dapat mengunduh salinan baru {1} {2} (sekitar {3} MB dari {4}) untuk menggantinya."
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "Buka tautan"
@@ -9712,10 +9726,6 @@ msgstr "Relevansi"
msgid "Reload"
msgstr "Muat ulang"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "Ingat ini untuk agen berikutnya"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "remote"
@@ -12385,6 +12395,16 @@ msgstr "Agen ini belum mengumumkan perintahnya"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "Agen ini memerlukan Anda masuk dulu — lihat pemberitahuan di bawah."
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "Agen ini berjalan lewat {0}, yang sudah terpasang tetapi tidak bisa jalan — {1}-nya tampak rusak. Open Knowledge bisa mengunduh salinan pribadi {2} {3} (sekitar {4} MB dari {5}) yang tidak akan menyentuh bagian lain sistem Anda."
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 4a1f3da6c..ccb801677 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -1689,6 +1689,21 @@
"ODGGlj": ["Ƒōĺďēŕ ńàḿē: ", ["detail"]],
"OEEQKT": ["Ĝōōď"],
"OETysD": ["Ńō ĥũƀ ƥàĝēś ŷēţ. Ĥũƀś àƥƥēàŕ ōńćē ƥàĝēś àććũḿũĺàţē ĩńƀōũńď ĝŕàƥĥ ĺĩńķś."],
+ "OJ4VDl": [
+ "Ţĥĩś àĝēńţ ŕũńś ţĥŕōũĝĥ ",
+ ["0"],
+ ", ŵĥĩćĥ ĩś ĩńśţàĺĺēď ƀũţ ŵōń'ţ ŕũń — ĩţś ",
+ ["1"],
+ " ĺōōķś ƀŕōķēń. Ōƥēń Ķńōŵĺēďĝē ćàń ďōŵńĺōàď à ƥŕĩvàţē ćōƥŷ ōƒ ",
+ ["2"],
+ " ",
+ ["3"],
+ " (àƀōũţ ",
+ ["4"],
+ " Ḿß ƒŕōḿ ",
+ ["5"],
+ ") ţĥàţ ŵōń'ţ ţōũćĥ ţĥē ŕēśţ ōƒ ŷōũŕ śŷśţēḿ."
+ ],
"OJOA7Z": ["⋯ ", ["0"], " ũńćĥàńĝēď ĺĩńēś"],
"OJTOUj": ["Ŕēǫũĩŕēś ", ["brand"], "."],
"OJeiSH": ["Ƒàĩĺēď ţō àďď ƥŕōƥēŕţŷ"],
@@ -3072,6 +3087,7 @@
"hZoBHK": ["Ēḿƥţŷ śţàŕţĩńĝ ćōńţēńţ"],
"haHgQj": ["Ćōƥĩēď ŕēĺàţĩvē ƥàţĥ"],
"habOU_": ["Ƒàĩĺēď ţō ũƥďàţē ţĥē àũţō-àƥƥŕōvē śēţţĩńĝ — ", ["detail"]],
+ "hadECI": [["0"], " ńēēďś ŕēƥĺàćĩńĝ"],
"he3ygx": ["Ćōƥŷ"],
"hgF0al": ["Ũśē ", ["0"], " ƒōŕ ţĥē àćţĩvē ĺĩĝĥţ ḿōďē"],
"hgf5io": ["ßĺōƀ Ŕũń"],
@@ -3255,6 +3271,19 @@
],
"jxtXZI": ["Ĩńśţàĺĺ ţĥē ĝĥ ĆĹĨ"],
"k0dL2I": ["Ŕēćōńńēćţĩńĝ ţō ţĥē àĝēńţ śēŕvĩćē…"],
+ "k0jsmJ": [
+ "Ōƥēń Ķńōŵĺēďĝē'ś ōŵń ćōƥŷ ōƒ ",
+ ["0"],
+ " ĩś ďàḿàĝēď àńď ŵōń'ţ ŕũń. Ĩţ ćàń ďōŵńĺōàď à ƒŕēśĥ ćōƥŷ ōƒ ",
+ ["1"],
+ " ",
+ ["2"],
+ " (àƀōũţ ",
+ ["3"],
+ " Ḿß ƒŕōḿ ",
+ ["4"],
+ ") ţō ŕēƥĺàćē ĩţ."
+ ],
"k2fEi7": [
"Ũśēŕ ƥĺũĝĩńś àŕē ƥēŕśōńàĺ ţō ţĥĩś ďēvĩćē — ţũŕń ţĥēḿ ōń ōŕ ōƒƒ ĥēŕē. Ţĥē ćĥōĩćē ĺĩvēś ĩń ŷōũŕ ũśēŕ ćōńƒĩĝ àńď ĩś ńēvēŕ ćōḿḿĩţţēď ţō ţĥē ƥŕōĴēćţ. Ēàćĥ ēńàƀĺēď ƥĺũĝĩń ĝēţś ĩţś ōŵń ƥàĝē ũńďēŕ Ƥĺũĝĩńś ĩń ţĥē śēţţĩńĝś śĩďēƀàŕ."
],
@@ -3626,7 +3655,6 @@
],
"ogAuyr": ["ßàćķ ţō ďōćũḿēńţ vĩēŵ"],
"ohUJJM": ["Ƥĺũĝĩńś"],
- "oi4zaa": ["Ŕēḿēḿƀēŕ ţĥĩś ƒōŕ ƒũţũŕē àĝēńţś"],
"ojGc_T": ["Ōƥēń ćōḿḿēńţ"],
"omXJcU": ["Ćĺōśē ōţĥēŕś"],
"onTlRk": ["Ćōũĺďń'ţ ũƥďàţē śķĩĺĺś śĥàŕĩńĝ"],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index c9da87d4d..5e0c9c903 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -329,6 +329,11 @@ msgstr ""
msgid "{0} needs {1}"
msgstr ""
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr ""
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8469,6 +8474,15 @@ msgstr ""
msgid "Open it there"
msgstr ""
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr ""
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr ""
@@ -9712,10 +9726,6 @@ msgstr ""
msgid "Reload"
msgstr ""
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr ""
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr ""
@@ -12385,6 +12395,16 @@ msgstr ""
msgid "This agent needs you to sign in first — see the notice below."
msgstr ""
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr ""
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.json
index 10555b990..164eb0708 100644
--- a/packages/app/src/locales/pt-BR/messages.json
+++ b/packages/app/src/locales/pt-BR/messages.json
@@ -1939,6 +1939,21 @@
"OETysD": [
"Ainda não há páginas de índice. Os índices aparecem quando as páginas acumulam links de entrada no grafo."
],
+ "OJ4VDl": [
+ "Este agente roda pelo ",
+ ["0"],
+ ", que está instalado mas não executa: o ",
+ ["1"],
+ " dele parece estar quebrado. O Open Knowledge pode baixar uma cópia privada do ",
+ ["2"],
+ " ",
+ ["3"],
+ " (cerca de ",
+ ["4"],
+ " MB de ",
+ ["5"],
+ ") que não vai mexer no resto do seu sistema."
+ ],
"OJOA7Z": ["⋯ ", ["0"], " linhas inalteradas"],
"OJTOUj": ["Requer ", ["brand"], "."],
"OJeiSH": ["Falha ao adicionar a propriedade"],
@@ -3517,6 +3532,7 @@
"hZoBHK": ["Conteúdo inicial vazio"],
"haHgQj": ["Caminho relativo copiado"],
"habOU_": ["Falha ao atualizar a configuração de aprovação automática — ", ["detail"]],
+ "hadECI": [["0"], " precisa ser substituído"],
"he3ygx": ["Copiar"],
"hgF0al": ["Usar ", ["0"], " no modo claro ativo"],
"hgf5io": ["Blob Run"],
@@ -3718,6 +3734,19 @@
],
"jxtXZI": ["Instalar a CLI gh"],
"k0dL2I": ["Reconectando ao serviço de agentes…"],
+ "k0jsmJ": [
+ "A cópia de ",
+ ["0"],
+ " do próprio Open Knowledge está danificada e não executa. Ele pode baixar uma cópia nova de ",
+ ["1"],
+ " ",
+ ["2"],
+ " (cerca de ",
+ ["3"],
+ " MB de ",
+ ["4"],
+ ") para substituí-la."
+ ],
"k2fEi7": [
"Os plugins de usuário são pessoais deste dispositivo — ligue ou desligue aqui. A escolha fica na sua configuração de usuário e nunca vai para o projeto. Cada plugin ativado ganha uma página própria em Plugins, na barra lateral de configurações."
],
@@ -4124,7 +4153,6 @@
],
"ogAuyr": ["Voltar para a visualização do documento"],
"ohUJJM": ["Plugins"],
- "oi4zaa": ["Lembrar disso para os próximos agentes"],
"ojGc_T": ["Abrir o comentário"],
"omXJcU": ["Fechar as outras"],
"onTlRk": ["Não deu para atualizar o compartilhamento de habilidades"],
diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.po
index 295e6cfad..f7f87b8f7 100644
--- a/packages/app/src/locales/pt-BR/messages.po
+++ b/packages/app/src/locales/pt-BR/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} permite que {1} aja sem perguntar"
msgid "{0} needs {1}"
msgstr "{0} precisa de {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} precisa ser substituído"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8469,6 +8474,15 @@ msgstr "Abrir em um worktree"
msgid "Open it there"
msgstr "Abrir por lá"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "A cópia de {0} do próprio Open Knowledge está danificada e não executa. Ele pode baixar uma cópia nova de {1} {2} (cerca de {3} MB de {4}) para substituí-la."
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "Abrir o link"
@@ -9712,10 +9726,6 @@ msgstr "Relevância"
msgid "Reload"
msgstr "Recarregar"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "Lembrar disso para os próximos agentes"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "remoto"
@@ -12385,6 +12395,16 @@ msgstr "Este agente ainda não anunciou seus comandos"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "Este agente precisa que você entre primeiro — veja o aviso abaixo."
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "Este agente roda pelo {0}, que está instalado mas não executa: o {1} dele parece estar quebrado. O Open Knowledge pode baixar uma cópia privada do {2} {3} (cerca de {4} MB de {5}) que não vai mexer no resto do seu sistema."
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.json
index 206968b7b..8e1e0b7b3 100644
--- a/packages/app/src/locales/ur/messages.json
+++ b/packages/app/src/locales/ur/messages.json
@@ -1725,6 +1725,21 @@
"OETysD": [
"ابھی کوئی مرکزی صفحہ نہیں۔ مراکز اسی وقت ظاہر ہوتے ہیں جب صفحات پر آنے والے گراف لنکس جمع ہونے لگیں۔"
],
+ "OJ4VDl": [
+ "یہ ایجنٹ ",
+ ["0"],
+ " کے ذریعے چلتا ہے، جو نصب تو ہے مگر چلتا نہیں — اس کا ",
+ ["1"],
+ " خراب لگتا ہے۔ Open Knowledge ",
+ ["2"],
+ " ",
+ ["3"],
+ " کی ایک نجی نقل ڈاؤن لوڈ کر سکتا ہے (تقریباً ",
+ ["4"],
+ " MB، ",
+ ["5"],
+ " سے) جو آپ کے باقی سسٹم کو نہیں چھوئے گی۔"
+ ],
"OJOA7Z": ["⋯ ", ["0"], " غیر تبدیل شدہ سطریں"],
"OJTOUj": [["brand"], " درکار ہے۔"],
"OJeiSH": ["خصوصیت شامل نہیں ہو سکی"],
@@ -3139,6 +3154,7 @@
"hZoBHK": ["خالی ابتدائی مواد"],
"haHgQj": ["نسبتی راستہ نقل ہو گیا"],
"habOU_": ["خودکار منظوری کی ترتیب تازہ نہیں ہو سکی — ", ["detail"]],
+ "hadECI": [["0"], " کو تبدیل کرنا ضروری ہے"],
"he3ygx": ["نقل کریں"],
"hgF0al": ["فعال روشن موڈ کے لیے ", ["0"], " استعمال کریں"],
"hgf5io": ["Blob Run"],
@@ -3331,6 +3347,19 @@
],
"jxtXZI": ["gh CLI نصب کریں"],
"k0dL2I": ["ایجنٹ سروس سے دوبارہ منسلک ہو رہا ہے…"],
+ "k0jsmJ": [
+ "Open Knowledge کی اپنی ",
+ ["0"],
+ " نقل خراب ہے اور چلتی نہیں۔ یہ اسے تبدیل کرنے کے لیے ",
+ ["1"],
+ " ",
+ ["2"],
+ " کی نئی نقل ڈاؤن لوڈ کر سکتا ہے (تقریباً ",
+ ["3"],
+ " MB، ",
+ ["4"],
+ " سے)۔"
+ ],
"k2fEi7": [
"صارف کے پلگ اِنز اسی آلے تک محدود ہیں — انہیں یہاں فعال یا بند کریں۔ یہ انتخاب آپ کی صارف کنفیگ میں رہتا ہے اور کبھی پروجیکٹ میں کمٹ نہیں ہوتا۔ ہر فعال پلگ اِن کو ترتیبات کے سائیڈ بار میں پلگ اِنز کے تحت اپنا صفحہ ملتا ہے۔"
],
@@ -3711,7 +3740,6 @@
],
"ogAuyr": ["دستاویز کے منظر پر واپس"],
"ohUJJM": ["پلگ اِنز"],
- "oi4zaa": ["مستقبل کے ایجنٹس کے لیے یہ یاد رکھیں"],
"ojGc_T": ["تبصرہ کھولیں"],
"omXJcU": ["باقی بند کریں"],
"onTlRk": ["مہارتوں کا اشتراک تازہ نہیں ہو سکا"],
diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.po
index 2720727d9..5ba18f692 100644
--- a/packages/app/src/locales/ur/messages.po
+++ b/packages/app/src/locales/ur/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} کی بدولت {1} بغیر پوچھے عمل کرتا ہے"
msgid "{0} needs {1}"
msgstr "{0} کو {1} درکار ہے"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} کو تبدیل کرنا ضروری ہے"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8473,6 +8478,15 @@ msgstr "ورک ٹری میں کھولیں"
msgid "Open it there"
msgstr "اسے وہیں کھولیں"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "Open Knowledge کی اپنی {0} نقل خراب ہے اور چلتی نہیں۔ یہ اسے تبدیل کرنے کے لیے {1} {2} کی نئی نقل ڈاؤن لوڈ کر سکتا ہے (تقریباً {3} MB، {4} سے)۔"
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "لنک کھولیں"
@@ -9716,10 +9730,6 @@ msgstr "مطابقت"
msgid "Reload"
msgstr "دوبارہ لوڈ کریں"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "مستقبل کے ایجنٹس کے لیے یہ یاد رکھیں"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "ریموٹ"
@@ -12389,6 +12399,16 @@ msgstr "اس ایجنٹ نے ابھی تک اپنی کمانڈز کا اعلان
msgid "This agent needs you to sign in first — see the notice below."
msgstr "اس ایجنٹ کے لیے آپ کا پہلے سائن اِن کرنا ضروری ہے — نیچے دی گئی اطلاع دیکھیں۔"
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "یہ ایجنٹ {0} کے ذریعے چلتا ہے، جو نصب تو ہے مگر چلتا نہیں — اس کا {1} خراب لگتا ہے۔ Open Knowledge {2} {3} کی ایک نجی نقل ڈاؤن لوڈ کر سکتا ہے (تقریباً {4} MB، {5} سے) جو آپ کے باقی سسٹم کو نہیں چھوئے گی۔"
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.json
index fb9872c88..ba850e67a 100644
--- a/packages/app/src/locales/zh-Hans/messages.json
+++ b/packages/app/src/locales/zh-Hans/messages.json
@@ -1487,6 +1487,21 @@
"ODGGlj": ["文件夹名:", ["detail"]],
"OEEQKT": ["良好"],
"OETysD": ["还没有中枢页面。当页面积累起入链后,中枢页就会出现。"],
+ "OJ4VDl": [
+ "这个智能体通过 ",
+ ["0"],
+ " 运行,但它虽然已安装却无法运行——它的 ",
+ ["1"],
+ " 似乎已损坏。Open Knowledge 可以下载一份 ",
+ ["2"],
+ " ",
+ ["3"],
+ " 的私有副本(约 ",
+ ["4"],
+ " MB,来自 ",
+ ["5"],
+ "),不会影响你系统的其余部分。"
+ ],
"OJOA7Z": ["⋯ ", ["0"], " 行未改动"],
"OJTOUj": ["需要 ", ["brand"], "。"],
"OJeiSH": ["添加属性失败"],
@@ -2719,6 +2734,7 @@
"hZoBHK": ["初始内容为空"],
"haHgQj": ["已复制相对路径"],
"habOU_": ["更新自动批准设置失败——", ["detail"]],
+ "hadECI": [["0"], " 需要替换"],
"he3ygx": ["复制"],
"hgF0al": ["将 ", ["0"], " 用于当前的浅色模式"],
"hgf5io": ["Blob Run"],
@@ -2888,6 +2904,19 @@
],
"jxtXZI": ["安装 gh CLI"],
"k0dL2I": ["正在重新连接到智能体服务…"],
+ "k0jsmJ": [
+ "Open Knowledge 自己的 ",
+ ["0"],
+ " 副本已损坏,无法运行。它可以下载一份新的 ",
+ ["1"],
+ " ",
+ ["2"],
+ "(约 ",
+ ["3"],
+ " MB,来自 ",
+ ["4"],
+ ")来替换它。"
+ ],
"k2fEi7": [
"用户插件是这台设备的个人设置——在这里开启或关闭它们。这个选择保存在你的用户配置中,绝不会提交到项目。每个启用的插件在设置侧边栏的「插件」下都有自己的页面。"
],
@@ -3207,7 +3236,6 @@
],
"ogAuyr": ["返回文档视图"],
"ohUJJM": ["插件"],
- "oi4zaa": ["为以后的智能体记住这个选择"],
"ojGc_T": ["打开评论"],
"omXJcU": ["关闭其他"],
"onTlRk": ["无法更新技能共享设置"],
diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.po
index 192f10dbe..a0022d435 100644
--- a/packages/app/src/locales/zh-Hans/messages.po
+++ b/packages/app/src/locales/zh-Hans/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} 允许 {1} 无需询问即可执行"
msgid "{0} needs {1}"
msgstr "{0} 需要 {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} 需要替换"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8473,6 +8478,15 @@ msgstr "在 worktree 中打开"
msgid "Open it there"
msgstr "在那里打开"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "Open Knowledge 自己的 {0} 副本已损坏,无法运行。它可以下载一份新的 {1} {2}(约 {3} MB,来自 {4})来替换它。"
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "打开链接"
@@ -9716,10 +9730,6 @@ msgstr "相关度"
msgid "Reload"
msgstr "重新加载"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "为以后的智能体记住这个选择"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "远程"
@@ -12389,6 +12399,16 @@ msgstr "此智能体尚未公布其命令"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "这个智能体需要你先登录——请看下方的提示。"
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "这个智能体通过 {0} 运行,但它虽然已安装却无法运行——它的 {1} 似乎已损坏。Open Knowledge 可以下载一份 {2} {3} 的私有副本(约 {4} MB,来自 {5}),不会影响你系统的其余部分。"
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.json
index 217e2375c..4e4a21b1d 100644
--- a/packages/app/src/locales/zh-Hant/messages.json
+++ b/packages/app/src/locales/zh-Hant/messages.json
@@ -1505,6 +1505,21 @@
"ODGGlj": ["資料夾名稱:", ["detail"]],
"OEEQKT": ["良好"],
"OETysD": ["還沒有樞紐頁面。等頁面累積起連入的關係圖連結,樞紐頁就會出現。"],
+ "OJ4VDl": [
+ "這個代理是透過 ",
+ ["0"],
+ " 執行的,但它雖然已安裝卻無法執行——它的 ",
+ ["1"],
+ " 似乎已損壞。Open Knowledge 可以下載一份 ",
+ ["2"],
+ " ",
+ ["3"],
+ " 的私人副本(約 ",
+ ["4"],
+ " MB,來自 ",
+ ["5"],
+ "),不會動到你系統的其他部分。"
+ ],
"OJOA7Z": ["⋯ ", ["0"], " 行未變更"],
"OJTOUj": ["需要 ", ["brand"], "。"],
"OJeiSH": ["新增屬性失敗"],
@@ -2743,6 +2758,7 @@
"hZoBHK": ["起始內容為空"],
"haHgQj": ["已複製相對路徑"],
"habOU_": ["更新自動核准設定失敗——", ["detail"]],
+ "hadECI": [["0"], " 需要更換"],
"he3ygx": ["複製"],
"hgF0al": ["將 ", ["0"], " 用於目前的淺色模式"],
"hgf5io": ["Blob Run"],
@@ -2912,6 +2928,19 @@
],
"jxtXZI": ["安裝 gh CLI"],
"k0dL2I": ["正在重新連線到代理服務…"],
+ "k0jsmJ": [
+ "Open Knowledge 自己的 ",
+ ["0"],
+ " 副本已損壞,無法執行。它可以下載一份新的 ",
+ ["1"],
+ " ",
+ ["2"],
+ "(約 ",
+ ["3"],
+ " MB,來自 ",
+ ["4"],
+ ")來替換它。"
+ ],
"k2fEi7": [
"使用者外掛只屬於這台裝置——在這裡開啟或關閉它們。這個選擇存在你的使用者設定中,絕不會提交到專案。每個啟用的外掛在設定側邊欄的「外掛」底下都有自己的頁面。"
],
@@ -3233,7 +3262,6 @@
],
"ogAuyr": ["回到文件檢視"],
"ohUJJM": ["外掛"],
- "oi4zaa": ["為往後的代理記住這個選擇"],
"ojGc_T": ["開啟註解"],
"omXJcU": ["關閉其他"],
"onTlRk": ["無法更新技能分享設定"],
diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.po
index 3b3339baa..020ff4b77 100644
--- a/packages/app/src/locales/zh-Hant/messages.po
+++ b/packages/app/src/locales/zh-Hant/messages.po
@@ -329,6 +329,11 @@ msgstr "{0} 允許 {1} 不必先詢問就執行"
msgid "{0} needs {1}"
msgstr "{0} 需要 {1}"
+#. placeholder {0}: item.displayName
+#: src/components/acp/ThreadView.tsx
+msgid "{0} needs replacing"
+msgstr "{0} 需要更換"
+
#. placeholder {0}: selected.size
#. placeholder {1}: projects.length
#: src/uninstall/UninstallPickerScreen.tsx
@@ -8473,6 +8478,15 @@ msgstr "在 worktree 中開啟"
msgid "Open it there"
msgstr "在那裡開啟"
+#. placeholder {0}: item.displayName
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.version
+#. placeholder {3}: item.approxSizeMB
+#. placeholder {4}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "Open Knowledge's own copy of {0} is damaged and won't run. It can download a fresh copy of {1} {2} (about {3} MB from {4}) to replace it."
+msgstr "Open Knowledge 自己的 {0} 副本已損壞,無法執行。它可以下載一份新的 {1} {2}(約 {3} MB,來自 {4})來替換它。"
+
#: src/components/GraphPanel.tsx
msgid "Open link"
msgstr "開啟連結"
@@ -9716,10 +9730,6 @@ msgstr "相關度"
msgid "Reload"
msgstr "重新載入"
-#: src/components/acp/ThreadView.tsx
-msgid "Remember this for future agents"
-msgstr "為往後的代理記住這個選擇"
-
#: src/components/NewWorktreeDialog.tsx
msgid "remote"
msgstr "遠端"
@@ -12389,6 +12399,16 @@ msgstr "此智慧代理尚未公布其指令"
msgid "This agent needs you to sign in first — see the notice below."
msgstr "這個代理需要你先登入——請看下面的提示。"
+#. placeholder {0}: item.provides
+#. placeholder {1}: item.displayName
+#. placeholder {2}: item.displayName
+#. placeholder {3}: item.version
+#. placeholder {4}: item.approxSizeMB
+#. placeholder {5}: item.sourceHost
+#: src/components/acp/ThreadView.tsx
+msgid "This agent runs through {0}, which is installed but won't run — its {1} looks broken. Open Knowledge can download a private copy of {2} {3} (about {4} MB from {5}) that won't touch the rest of your system."
+msgstr "這個代理是透過 {0} 執行的,但它雖然已安裝卻無法執行——它的 {1} 似乎已損壞。Open Knowledge 可以下載一份 {2} {3} 的私人副本(約 {4} MB,來自 {5}),不會動到你系統的其他部分。"
+
#. placeholder {0}: item.provides
#. placeholder {1}: item.displayName
#. placeholder {2}: item.version
diff --git a/packages/app/tests/dom/jsdom-preload.ts b/packages/app/tests/dom/jsdom-preload.ts
index 14772a7b9..e9fce868e 100644
--- a/packages/app/tests/dom/jsdom-preload.ts
+++ b/packages/app/tests/dom/jsdom-preload.ts
@@ -11,7 +11,7 @@
*/
import { cleanup } from '@testing-library/react';
-import { afterEach } from 'vitest';
+import { afterAll, afterEach, vi } from 'vitest';
// React's test path checks this global before installing act warnings.
// @testing-library/react also sets it, but assert it early so the flag is live
@@ -27,6 +27,24 @@ afterEach(() => {
cleanup();
});
+// `cleanup()` unmounts, but @tiptap/react defers the editor's own `destroy()`
+// into a 0 ms timer. When the last test in a file leaves one pending, vitest
+// tears the jsdom environment down first and the destroy then runs in a world
+// with no `document` — a ReferenceError nothing is awaiting, which vitest can
+// only report as an unhandled error that fails the whole run while every test
+// passes. One macrotask at file end lets it land while the DOM still exists.
+//
+// Deliberately `afterAll`, not `afterEach`: a tick between tests also lets
+// other deferred work run against a tree whose providers cleanup just removed,
+// which fails honest tests (`usePageList must be used within …`). At file end
+// there is nothing left to re-render.
+//
+// Skipped under fake timers, where a real 0 ms timer would never fire — and
+// where the pending fake destroy is discarded with the timer queue anyway.
+afterAll(async () => {
+ if (!vi.isFakeTimers()) await new Promise((resolve) => setTimeout(resolve, 0));
+});
+
const domWindow = globalThis.window as (Window & typeof globalThis) | undefined;
// jsdom doesn't ship `matchMedia`; hooks like `useThemeBridge` call it for
diff --git a/packages/app/tests/integration/template-history-attribution.test.ts b/packages/app/tests/integration/template-history-attribution.test.ts
index 59c94d3d4..f57897f72 100644
--- a/packages/app/tests/integration/template-history-attribution.test.ts
+++ b/packages/app/tests/integration/template-history-attribution.test.ts
@@ -17,10 +17,16 @@ import {
* An HTTP lifecycle write records its contributor under
* `okArtifactKey('template', folder, name)`, which is byte-identical to that
* content doc name — so the typed `template-create` folder event and the plain
- * `wip:` doc commits both resolve to the one content-doc identity. Crucially,
- * the persistence store's own commits are `wip:`: the typed `template-*` subject
- * is stamped only by the HTTP route (a folder-timeline event), never by the
- * store as an editor CRDT edit flows through it.
+ * `wip:` doc commits both resolve to the one content-doc identity.
+ *
+ * A PUT produces two writes: the route's typed folder event and the store's
+ * debounced content commit. Whether they land as two git commits or one is a
+ * timing question — inside the debounce window they coalesce into a single
+ * commit that carries the typed subject and therefore shows up in the doc's own
+ * history. Both shapes are correct, so every assertion below tolerates at most
+ * one typed entry rather than assuming a separate `wip:` commit exists. What
+ * must never happen is an EDITOR edit minting a typed subject, or adding a
+ * second folder event.
*/
type HistoryEntry = {
sha: string;
@@ -29,6 +35,17 @@ type HistoryEntry = {
contributors: Array<{ docs: string[] }>;
};
+/**
+ * The HTTP route's typed folder event. Deliberately narrow: everything the
+ * store itself mints still has to match `wip:` below, so a novel non-wip
+ * subject leaking out of the store is not absorbed by this predicate.
+ */
+const isTypedArtifact = (entry: HistoryEntry) => entry.message.startsWith('template-');
+
+/** Every entry the store itself minted — i.e. all but the route's typed event. */
+const storeCommitsAllWip = (entries: HistoryEntry[]) =>
+ entries.filter((e) => !isTypedArtifact(e)).every((e) => /^wip:/i.test(e.message));
+
describe('template history — HTTP typed writes and editor wip edits unify under one key (FR6 / D11)', () => {
let server: TestServer;
@@ -82,11 +99,13 @@ describe('template history — HTTP typed writes and editor wip edits unify unde
expect(createEvent).toBeDefined();
expect(createEvent?.contributors.some((c) => c.docs.includes(docName))).toBe(true);
- // The store's OWN commit for the doc content is a plain wip: subject — the
- // typed `template-*` subject is the HTTP route's folder event, not the store's.
+ // The store's OWN commit for the doc content is a plain wip: subject. The
+ // route's typed folder event may or may not have coalesced into it, so admit
+ // at most one typed entry and hold everything else to wip:.
const putDoc = await docHistory(docName);
expect(putDoc.length).toBeGreaterThanOrEqual(1);
- expect(putDoc.every((e) => /^wip:/i.test(e.message))).toBe(true);
+ expect(putDoc.filter(isTypedArtifact).length).toBeLessThanOrEqual(1);
+ expect(storeCommitsAllWip(putDoc)).toBe(true);
const putShas = new Set(putDoc.map((e) => e.sha));
// An editor CRDT edit to the same doc lands as an ordinary content write.
@@ -106,7 +125,10 @@ describe('template history — HTTP typed writes and editor wip edits unify unde
() => null,
);
editDoc = await docHistory(docName);
- editEntry = editDoc.find((e) => !putShas.has(e.sha));
+ // Skip the typed folder event: when it did NOT coalesce into the PUT's
+ // commit it can land after the snapshot above and read as "new" here,
+ // which would end the poll before the editor's own commit exists.
+ editEntry = editDoc.find((e) => !putShas.has(e.sha) && !isTypedArtifact(e));
return editEntry !== undefined;
},
20_000,
@@ -119,7 +141,8 @@ describe('template history — HTTP typed writes and editor wip edits unify unde
// typed template-* subject. A store that started stamping typed template-*
// subjects on content edits would flip this message; that must never happen.
expect(editEntry?.message).toMatch(/^wip:/i);
- expect(editDoc.every((e) => /^wip:/i.test(e.message))).toBe(true);
+ expect(editDoc.filter(isTypedArtifact).length).toBeLessThanOrEqual(1);
+ expect(storeCommitsAllWip(editDoc)).toBe(true);
// The editor CRDT edit produced NO new folder event — the folder timeline
// still carries exactly the one typed HTTP subject, and no wip: row leaks in.
diff --git a/packages/core/src/acp/thread-protocol.test.ts b/packages/core/src/acp/thread-protocol.test.ts
index 0842ca2ae..d1e55837d 100644
--- a/packages/core/src/acp/thread-protocol.test.ts
+++ b/packages/core/src/acp/thread-protocol.test.ts
@@ -193,6 +193,9 @@ describe('parseThreadClientFrame', () => {
});
test('runtime_consent_response validates the granted/declined outcome', () => {
+ // `remember` is gone from the type but a pre-removal renderer still sends
+ // it. The frame must survive: rejecting it would park the launch forever
+ // on a grant the user did click.
expect(
parseThreadClientFrame(
JSON.stringify({
@@ -204,7 +207,7 @@ describe('parseThreadClientFrame', () => {
),
).toMatchObject({
op: 'runtime_consent_response',
- outcome: { kind: 'granted', remember: true },
+ outcome: { kind: 'granted' },
});
expect(
parseThreadClientFrame(
@@ -216,7 +219,7 @@ describe('parseThreadClientFrame', () => {
}),
),
).toMatchObject({ outcome: { kind: 'declined' } });
- // Unknown outcome kind, non-boolean remember, and missing ids all reject.
+ // Unknown outcome kind and missing ids reject.
expect(
parseThreadClientFrame(
JSON.stringify({
@@ -227,16 +230,6 @@ describe('parseThreadClientFrame', () => {
}),
),
).toBeNull();
- expect(
- parseThreadClientFrame(
- JSON.stringify({
- op: 'runtime_consent_response',
- threadId: 't',
- requestId: 'c',
- outcome: { kind: 'granted', remember: 'yes' },
- }),
- ),
- ).toBeNull();
expect(
parseThreadClientFrame(
JSON.stringify({
diff --git a/packages/core/src/acp/thread-protocol.ts b/packages/core/src/acp/thread-protocol.ts
index 792c7b0d0..e349fe8b1 100644
--- a/packages/core/src/acp/thread-protocol.ts
+++ b/packages/core/src/acp/thread-protocol.ts
@@ -319,6 +319,17 @@ export type ThreadEvent =
sourceHost: string;
/** The agent whose launch is blocked on this decision. */
agentName: string;
+ /**
+ * Why the offer appeared: the interpreter is absent, it is installed and
+ * cannot run, or OK's own previously-downloaded copy is damaged and is
+ * being replaced. Each wants different advice — telling someone whose
+ * `npx` is present-but-broken that it "isn't installed" sends them to
+ * install a second copy that their broken one still shadows on PATH, and
+ * `damaged` is about OK's copy, not anything the user installed.
+ * Optional: events persisted before this field existed replay as
+ * `missing`, which is what they were.
+ */
+ reason?: 'missing' | 'broken' | 'damaged';
ts: number;
}
| {
@@ -475,13 +486,13 @@ export type ThreadClientFrame =
| {
/**
* Answer a `runtime_consent_request`: allow (or refuse) OK to download
- * the managed runtime a blocked launch needs. `remember` persists the
- * decision for future launches on this machine.
+ * the managed runtime a blocked launch needs. The answer covers this
+ * launch only — the offer reappears next time an agent needs the runtime.
*/
op: 'runtime_consent_response';
threadId: string;
requestId: string;
- outcome: { kind: 'granted'; remember?: boolean } | { kind: 'declined'; remember?: boolean };
+ outcome: { kind: 'granted' } | { kind: 'declined' };
}
| { op: 'set_mode'; threadId: string; modeId: string }
| {
@@ -766,7 +777,9 @@ export function parseThreadClientFrame(raw: string): ThreadClientFrame | null {
const outcome = frame.outcome as Record<string, unknown> | undefined;
if (typeof outcome !== 'object' || outcome === null) return null;
if (outcome.kind !== 'granted' && outcome.kind !== 'declined') return null;
- if (outcome.remember !== undefined && typeof outcome.remember !== 'boolean') return null;
+ // A pre-removal client still sends `remember`; ignore it rather than
+ // reject the frame. Rejecting would drop a skewed renderer's grant on
+ // the floor — the user clicks Download and the launch just stays parked.
return frame as unknown as ThreadClientFrame;
}
case 'set_mode':
diff --git a/packages/server/src/acp/launch.test.ts b/packages/server/src/acp/launch.test.ts
index 3482ed2e7..93be04955 100644
--- a/packages/server/src/acp/launch.test.ts
+++ b/packages/server/src/acp/launch.test.ts
@@ -15,14 +15,19 @@ import { OK_HOSTED_AGENT_ENV } from '@inkeep/open-knowledge-core';
import { afterEach, describe, expect, test } from 'vitest';
import {
AgentLaunchError,
+ brokenInterpreterHint,
+ declinedRepairHint,
isPathQualified,
mergedEnv,
overlaySetsPath,
preflightLaunch,
+ probeInterpreterHealth,
type ResolvedLaunch,
resolveWindowsCommand,
spawnAcpAgent,
terminateAgentTree,
+ undeletableManagedRuntimeHint,
+ unrepairableManagedRuntimeHint,
windowsCmdWrap,
withHostedAgentMarker,
withLoginShellPath,
@@ -258,6 +263,207 @@ describe('preflightLaunch', () => {
});
});
+/**
+ * The gap preflight structurally cannot see: an interpreter that resolves and
+ * is executable, yet dies the moment it runs (a Homebrew `node`
+ * whose `icu4c` was upgraded out from under it aborts under dyld).
+ */
+describe.skipIf(process.platform === 'win32')('probeInterpreterHealth', () => {
+ /** A fake `npx` on PATH that behaves however `body` says. */
+ const fakeNpx = (body: string): ResolvedLaunch => {
+ const dir = tmp();
+ writeFileSync(join(dir, 'npx'), `#!/bin/sh\n${body}\n`, { mode: 0o755 });
+ return {
+ cmd: 'npx',
+ args: ['-y', '@fake/agent'],
+ env: { PATH: dir },
+ kind: 'npx',
+ pathFromOverlay: true,
+ };
+ };
+
+ test('an interpreter that answers --version is healthy', async () => {
+ await expect(probeInterpreterHealth(fakeNpx('exit 0'))).resolves.toBeNull();
+ });
+
+ test('a non-zero exit reports the code and the first stderr line', async () => {
+ const detail = await probeInterpreterHealth(fakeNpx('echo "cannot find module" >&2\nexit 3'));
+ expect(detail).toContain('exit code 3');
+ expect(detail).toContain('cannot find module');
+ });
+
+ // The reported shape: the dyld failure aborts the process, so there is no
+ // exit code at all — only a signal and the linker's message on stderr.
+ test('a crash reports the signal with the linker message', async () => {
+ const detail = await probeInterpreterHealth(
+ fakeNpx('echo "dyld[1]: Library not loaded: libicui18n.74.dylib" >&2\nkill -ABRT $$'),
+ );
+ expect(detail).toContain('SIGABRT');
+ expect(detail).toContain('libicui18n.74.dylib');
+ });
+
+ test('a failure with a silent stderr still reports the exit code', async () => {
+ expect(await probeInterpreterHealth(fakeNpx('exit 9'))).toBe('exit code 9');
+ });
+
+ test('an unspawnable command reports the spawn error rather than throwing', async () => {
+ const detail = await probeInterpreterHealth({
+ cmd: join(tmp(), 'not-a-real-npx'),
+ args: [],
+ env: {},
+ kind: 'npx',
+ pathFromOverlay: false,
+ });
+ expect(detail).not.toBeNull();
+ });
+
+ // A slow `--version` is not the crash this guards, and blocking every launch
+ // on it would be the worse regression — so a hang reads as healthy-enough.
+ test('a hung probe times out as healthy and does not leak the process', async () => {
+ const dir = tmp();
+ const beat = join(dir, 'heartbeat');
+ // A GRANDchild (the fixture shell backgrounds it), so it outlives a kill
+ // aimed at the direct child alone and dies only with the process group.
+ //
+ // It proves it stopped by ceasing to write, rather than by disappearing
+ // from a process check: an orphan reparents to init, and where init doesn't
+ // reap (a container's PID 1), a dead process lingers as a zombie that
+ // `kill(pid, 0)` still reports as alive. Verified on Linux — the group kill
+ // does land there; the process-existence check is what lies.
+ writeFileSync(
+ join(dir, 'npx'),
+ `#!/bin/sh\n(while : ; do echo tick >> ${beat}; /bin/sleep 0.05; done) &\nwait\n`,
+ { mode: 0o755 },
+ );
+ const launch: ResolvedLaunch = {
+ cmd: 'npx',
+ args: [],
+ env: { PATH: dir },
+ kind: 'npx',
+ pathFromOverlay: true,
+ };
+ expect(await probeInterpreterHealth(launch, 500)).toBeNull();
+ // It was running: otherwise this test would pass against a fixture that
+ // never started, proving nothing about the kill.
+ await waitFor(() => existsSync(beat), 5_000, 'the grandchild to start ticking');
+
+ // The kill is deliberately not awaited — the verdict must not wait on it —
+ // so allow a moment for the group signal to land, then require a quiet
+ // window with no new ticks.
+ const beats = (): number => readFileSync(beat, 'utf8').length;
+ let stopped = false;
+ const deadline = Date.now() + 5_000;
+ while (Date.now() < deadline) {
+ const before = beats();
+ await new Promise((r) => setTimeout(r, 400));
+ if (beats() === before) {
+ stopped = true;
+ break;
+ }
+ }
+ expect(stopped).toBe(true);
+ }, 20_000);
+});
+
+describe('brokenInterpreterHint', () => {
+ test('names Node.js for npx and points at the Homebrew icu4c cause', () => {
+ const hint = brokenInterpreterHint(
+ { cmd: 'npx', args: [], env: {}, kind: 'npx', pathFromOverlay: false },
+ 'SIGABRT',
+ );
+ expect(hint).toContain('Node.js');
+ expect(hint).toContain('icu4c');
+ // "not found" would send the user after an install they already have.
+ expect(hint).not.toContain('was not found');
+ });
+
+ test('names uv for uvx, with no Node-specific cause pasted in', () => {
+ const hint = brokenInterpreterHint(
+ { cmd: 'uvx', args: [], env: {}, kind: 'uvx', pathFromOverlay: false },
+ 'exit code 1',
+ );
+ expect(hint).toContain('uv');
+ // The Homebrew/icu4c story belongs to Node. Matching on the display name
+ // alone missed this: the offending clause spells it `node` in backticks.
+ expect(hint).not.toContain('Node.js');
+ expect(hint).not.toContain('node');
+ expect(hint).not.toContain('icu4c');
+ });
+
+ test("a replacement that still won't run blames the machine, not the user", () => {
+ const hint = unrepairableManagedRuntimeHint(
+ {
+ cmd: '/home/u/.ok/runtimes/node/bin/npx',
+ args: [],
+ env: {},
+ kind: 'npx',
+ pathFromOverlay: false,
+ },
+ 'SIGABRT',
+ );
+ expect(hint).toContain('SIGABRT');
+ // The remedy is no longer homework: OK already replaced the copy, so what
+ // is left to say is what could still be stopping it.
+ expect(hint).not.toContain('delete that directory');
+ // The user did not install this one, so "reinstall or repair" is advice
+ // they cannot act on — and their system Node may be blameless.
+ expect(hint).not.toContain('Reinstall or repair');
+ expect(hint).not.toContain('icu4c');
+ });
+
+ // Symmetry with the sibling hint's two-branch coverage: testing one branch
+ // is how the Node-specific advice reached uv users in the first place.
+ test('the managed-runtime hints name uv for a uvx runtime', () => {
+ const uvx = {
+ cmd: '/home/u/.ok/runtimes/uv/uvx',
+ args: [],
+ env: {},
+ kind: 'uvx',
+ pathFromOverlay: false,
+ } as const;
+ for (const hint of [
+ unrepairableManagedRuntimeHint(uvx, 'SIGABRT'),
+ undeletableManagedRuntimeHint(uvx, 'SIGABRT'),
+ declinedRepairHint(uvx),
+ ]) {
+ expect(hint).toContain('uv');
+ expect(hint).not.toContain('Node.js');
+ }
+ });
+
+ // A quarantine that failed means nothing was re-downloaded. Reusing the
+ // fresh-copy wording here would send the user hunting for a machine-level
+ // cause when the actual blocker is another agent holding the tree open.
+ test('the un-replaceable hint does not claim a fresh copy was tried', () => {
+ const hint = undeletableManagedRuntimeHint(
+ {
+ cmd: '/home/u/.ok/runtimes/node/bin/npx',
+ args: [],
+ env: {},
+ kind: 'npx',
+ pathFromOverlay: false,
+ },
+ 'SIGABRT',
+ );
+ expect(hint).toContain('damaged');
+ expect(hint).not.toContain('downloaded a fresh copy');
+ });
+
+ // Declining the repair must not reach for the stock decline hint, which says
+ // the interpreter isn't installed — OK's copy is installed, just damaged.
+ test('the declined-repair hint says damaged, not missing', () => {
+ const hint = declinedRepairHint({
+ cmd: '/home/u/.ok/runtimes/node/bin/npx',
+ args: [],
+ env: {},
+ kind: 'npx',
+ pathFromOverlay: false,
+ });
+ expect(hint).toContain('damaged');
+ expect(hint).not.toContain("isn't installed");
+ });
+});
+
describe('windows cmd wrapping (spawn on Windows)', () => {
test('resolveWindowsCommand leaves path-qualified commands untouched', () => {
expect(resolveWindowsCommand('C:\\x\\uvx.exe', 'C:\\x')).toBe('C:\\x\\uvx.exe');
diff --git a/packages/server/src/acp/launch.ts b/packages/server/src/acp/launch.ts
index db696ccef..72e3c33e8 100644
--- a/packages/server/src/acp/launch.ts
+++ b/packages/server/src/acp/launch.ts
@@ -352,6 +352,169 @@ function missingCommandHint(launch: ResolvedLaunch): string {
}
}
+/**
+ * The launch-error detail for an npx/uvx interpreter that is installed but
+ * cannot RUN (see {@link probeInterpreterHealth}). Reaches the user on either
+ * dead end: a host with no managed runtime to fall back to, or a managed
+ * runtime the user declined. Distinct from {@link missingCommandHint}: the
+ * command is right there, so a "was not found" message sends the user hunting
+ * for an install they already have.
+ */
+export function brokenInterpreterHint(launch: ResolvedLaunch, detail: string): string {
+ // Switched whole, like `missingCommandHint`: the Homebrew/icu4c cause is
+ // Node-specific, and pasting it into a uv failure sends that user to inspect
+ // a runtime with nothing to do with it — the wrong-address problem this hint
+ // exists to fix.
+ const cause =
+ launch.kind === 'uvx'
+ ? 'That usually means its uv is broken. Reinstall or repair uv and try again.'
+ : 'That usually means its Node.js is broken — on macOS a common cause is a Homebrew `node` whose `icu4c` library was upgraded out from under it. Reinstall or repair Node.js and try again.';
+ return `\`${launch.cmd}\` is installed but failed to run (${detail}). ${cause}`;
+}
+
+/**
+ * The launch-error detail for a REPLACED copy of OK's own runtime still
+ * failing to run — the fallback's fallback, after the damaged copy was
+ * discarded and re-downloaded. Deliberately not {@link brokenInterpreterHint}:
+ * a verified archive that won't run twice in a row is not a broken system
+ * Node/uv, so pointing at Homebrew would send the user to repair something
+ * blameless.
+ */
+export function unrepairableManagedRuntimeHint(launch: ResolvedLaunch, detail: string): string {
+ const runtime = launch.kind === 'uvx' ? 'uv' : 'Node.js';
+ return `OK downloaded a fresh copy of ${runtime} and it still can't run (${detail}). Something on this machine is stopping it — antivirus, a security policy, or an unsupported CPU are the usual causes.`;
+}
+
+/**
+ * The launch-error detail for a damaged copy of OK's own runtime that could
+ * not be replaced: the rename that clears the way for a fresh download failed,
+ * which on Windows means another agent still holds files open inside the tree.
+ * Distinct from {@link unrepairableManagedRuntimeHint} because nothing was
+ * re-downloaded — claiming a fresh copy also failed would name the wrong
+ * culprit and send the user hunting for a machine-level cause that isn't there.
+ */
+export function undeletableManagedRuntimeHint(launch: ResolvedLaunch, detail: string): string {
+ const runtime = launch.kind === 'uvx' ? 'uv' : 'Node.js';
+ return `OK's own copy of ${runtime} is damaged (${detail}) and couldn't be replaced — another agent may still be using it. Close other agent threads and try again.`;
+}
+
+/**
+ * The launch-error detail for a user who declined the re-download of OK's own
+ * damaged runtime. Not the stock decline hint: that one says the interpreter
+ * isn't installed, when the actual state is that OK's copy is present and
+ * broken and the user just refused the fix.
+ */
+export function declinedRepairHint(launch: ResolvedLaunch): string {
+ const runtime = launch.kind === 'uvx' ? 'uv' : 'Node.js';
+ return `OK's own copy of ${runtime} is damaged and can't run this agent. Start the agent again to let OK download a fresh copy.`;
+}
+
+/** Cap on probe stderr retained while waiting for the verdict. */
+const PROBE_STDERR_MAX = 2_000;
+/** Cap on the stderr excerpt carried in a probe verdict (it reaches the user). */
+const PROBE_DETAIL_MAX = 300;
+
+/**
+ * Confirm a resolved npx/uvx interpreter can actually EXECUTE, by running it
+ * with `--version`.
+ *
+ * {@link preflightLaunch} proves only that the command file exists and carries
+ * the execute bit — which a fatally broken interpreter also does. A Homebrew
+ * `node` whose linked `icu4c` was upgraded out from under it aborts the instant
+ * it starts (`dyld: Library not loaded: …/libicui18n.NN.dylib` → SIGABRT), so
+ * the agent dies before the ACP handshake and the user sees only
+ * `initialize failed: ACP connection closed`. Catching it here lets the caller
+ * route to the managed runtime — the same remedy a MISSING interpreter already
+ * gets.
+ *
+ * Returns a short failure detail (signal or exit code, plus the first stderr
+ * line) when the probe crashes or exits non-zero, and `null` when it runs
+ * cleanly. A probe still alive at `timeoutMs` also counts as `null`: a slow
+ * `--version` is not the crash-on-startup this guards, and blocking every
+ * launch on it would be a worse regression than letting the real spawn proceed.
+ * `--version` is universal to npx/uvx, fast, network-free and side-effect-free
+ * (no package install). Spawned the way {@link spawnAcpAgent} spawns the real
+ * agent — same Windows command resolution, same `launch.env` — so the probe
+ * exercises the interpreter the launch actually will.
+ */
+export function probeInterpreterHealth(
+ launch: ResolvedLaunch,
+ timeoutMs = 5_000,
+ log?: PinoLogger,
+): Promise<string | null> {
+ const win = process.platform === 'win32';
+ const resolved = win ? resolveWindowsCommand(launch.cmd, envPath(launch.env)) : launch.cmd;
+ const wrap = win && /\.(cmd|bat)$/i.test(resolved);
+ const { cmd, args } = wrap
+ ? windowsCmdWrap(resolved, ['--version'])
+ : { cmd: resolved, args: ['--version'] };
+ return new Promise((settleProbe) => {
+ let child: ChildProcess;
+ try {
+ child = spawn(cmd, args, {
+ env: launch.env,
+ stdio: ['ignore', 'ignore', 'pipe'],
+ shell: false,
+ // Same reason as the real agent spawn: an interpreter that hangs has
+ // usually already forked, and only a process GROUP kill reaches the
+ // fork. Without this a timed-out probe leaks the grandchild.
+ detached: !win,
+ windowsHide: true,
+ windowsVerbatimArguments: wrap,
+ });
+ } catch (err) {
+ settleProbe(err instanceof Error ? err.message : String(err));
+ return;
+ }
+ let stderr = '';
+ child.stderr?.setEncoding('utf8');
+ child.stderr?.on('data', (chunk: string) => {
+ if (stderr.length < PROBE_STDERR_MAX) stderr += chunk;
+ });
+ let settled = false;
+ const settle = (detail: string | null): void => {
+ if (settled) return;
+ settled = true;
+ clearTimeout(timer);
+ settleProbe(detail);
+ };
+ const timer = setTimeout(() => {
+ // Group kill, not `child.kill`: an npx that hangs has usually already
+ // forked, and signalling only the wrapper leaves the fork running.
+ terminateAgentTree(child, { graceMs: 0, forceWaitMs: 0 }).catch(() => {
+ // Best-effort: the verdict below stands either way.
+ });
+ // A timeout answers "healthy enough" and is otherwise indistinguishable
+ // from a clean run, so without this line an interpreter that hangs every
+ // launch spends the full budget invisibly and the operator sees only the
+ // downstream handshake failure.
+ log?.debug(
+ { cmd: launch.cmd, kind: launch.kind, timeoutMs },
+ '[acp-launch] interpreter health probe timed out — proceeding with the launch',
+ );
+ settle(null);
+ }, timeoutMs);
+ timer.unref?.();
+ child.on('error', (err) => settle(err.message));
+ child.on('exit', (code, signal) => {
+ if (signal === null && (code === null || code === 0)) {
+ settle(null);
+ return;
+ }
+ const firstStderrLine = stderr
+ .split('\n')
+ .map((line) => line.trim())
+ .find((line) => line !== '');
+ const reason = signal ?? `exit code ${code}`;
+ settle(
+ firstStderrLine !== undefined
+ ? `${reason}: ${firstStderrLine.slice(0, PROBE_DETAIL_MAX)}`
+ : reason,
+ );
+ });
+ });
+}
+
/** Case-insensitive `PATH` lookup (Windows spells it `Path`), falling back to the process env. */
export function envPath(env: Record<string, string>): string | undefined {
for (const [k, v] of Object.entries(env)) {
diff --git a/packages/server/src/acp/managed-runtime-flow.integration.test.ts b/packages/server/src/acp/managed-runtime-flow.integration.test.ts
index 237e2e3a9..b27af6adb 100644
--- a/packages/server/src/acp/managed-runtime-flow.integration.test.ts
+++ b/packages/server/src/acp/managed-runtime-flow.integration.test.ts
@@ -31,7 +31,7 @@ import type {
import { afterEach, describe, expect, test } from 'vitest';
import type { AgentSessionManager } from '../agent-sessions.ts';
import { getLogger } from '../logger.ts';
-import { ensureManagedRuntime, findManagedRuntime, readRuntimeConsent } from './managed-runtime.ts';
+import { ensureManagedRuntime, findManagedRuntime } from './managed-runtime.ts';
import { AcpPermissionStore } from './permissions.ts';
import { AcpRegistry } from './registry.ts';
import { AcpThreadManager } from './thread-manager.ts';
@@ -69,24 +69,31 @@ const NPX_AGENT = {
distribution: { npx: { package: '@fake/agent', env: { PATH: '' } } },
};
-/** Synthetic Node runtime tree (`node-vTEST/bin/{node,npx}`) as a `.tar.gz`. */
-function fakeNodeTarball(dir: string): { bytes: Buffer; sha: string } {
+/**
+ * Synthetic Node runtime tree (`node-vTEST/bin/{node,npx}`) as a `.tar.gz`.
+ * `npxBody` overrides the launcher so a test can serve a runtime that installs
+ * cleanly and still can't run.
+ */
+function fakeNodeTarball(
+ dir: string,
+ npxBody = '#!/bin/sh\nexit 0\n',
+): { bytes: Buffer; sha: string } {
const treeRoot = join(dir, 'tree');
const binDir = join(treeRoot, 'node-vTEST', 'bin');
mkdirSync(binDir, { recursive: true });
writeFileSync(join(binDir, 'node'), '#!/bin/sh\nexit 0\n', { mode: 0o755 });
- writeFileSync(join(binDir, 'npx'), '#!/bin/sh\nexit 0\n', { mode: 0o755 });
+ writeFileSync(join(binDir, 'npx'), npxBody, { mode: 0o755 });
const tarPath = join(dir, 'node.tar.gz');
execFileSync('tar', ['-czf', tarPath, '-C', treeRoot, 'node-vTEST']);
const bytes = readFileSync(tarPath);
return { bytes, sha: createHash('sha256').update(bytes).digest('hex') };
}
-function fakeNodeFetch(bytes: Buffer, sha: string): typeof fetch {
+function fakeNodeFetch(bytes: Buffer, sha: string, agent: unknown = NPX_AGENT): typeof fetch {
return (async (url: string | URL | Request) => {
const u = String(url);
if (u.includes('agentclientprotocol')) {
- return new Response(JSON.stringify({ agents: [NPX_AGENT] }), { status: 200 });
+ return new Response(JSON.stringify({ agents: [agent] }), { status: 200 });
}
if (u.endsWith('SHASUMS256.txt')) {
const names = ['darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64'].map(
@@ -105,7 +112,6 @@ function makeManager(opts: {
contentDir: string;
localDir: string;
runtimeRoot: string;
- consentHome: string;
fetchImpl: typeof fetch;
resolveLoginShellPath?: () => Promise<string | null>;
}): AcpThreadManager {
@@ -120,7 +126,6 @@ function makeManager(opts: {
isIgnoredPath: () => false,
runtimeInstall: {
root: opts.runtimeRoot,
- consentHome: opts.consentHome,
fetchImpl: opts.fetchImpl,
},
// Hermetic default (see the thread-manager integration suite): never spawn
@@ -144,9 +149,13 @@ async function collect(
});
}
-async function waitFor(pred: () => boolean, ms: number, what: string): Promise<void> {
+async function waitFor(
+ pred: () => boolean | Promise<boolean>,
+ ms: number,
+ what: string,
+): Promise<void> {
const deadline = Date.now() + ms;
- while (!pred()) {
+ while (!(await pred())) {
if (Date.now() > deadline) throw new Error(`timed out waiting for ${what}`);
await new Promise((r) => setTimeout(r, 20));
}
@@ -166,7 +175,6 @@ describe('managed-runtime consent + download flow', () => {
const contentDir = tmp();
const localDir = tmp();
const runtimeRoot = tmp();
- const consentHome = tmp();
const stage = tmp();
const { bytes, sha } = fakeNodeTarball(stage);
const fetchImpl = fakeNodeFetch(bytes, sha);
@@ -181,7 +189,6 @@ describe('managed-runtime consent + download flow', () => {
contentDir,
localDir,
runtimeRoot,
- consentHome,
fetchImpl,
});
await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
@@ -189,18 +196,16 @@ describe('managed-runtime consent + download flow', () => {
await waitFor(() => !existsSync(staleDir), 3_000, 'stale runtime staging cleanup');
});
- test('grant → download → install + persist consent', async () => {
+ test('grant → download → install', async () => {
const contentDir = tmp();
const localDir = tmp();
const runtimeRoot = tmp();
- const consentHome = tmp();
const stage = tmp();
const { bytes, sha } = fakeNodeTarball(stage);
const manager = makeManager({
contentDir,
localDir,
runtimeRoot,
- consentHome,
fetchImpl: fakeNodeFetch(bytes, sha),
});
@@ -213,12 +218,11 @@ describe('managed-runtime consent + download flow', () => {
expect(req?.runtime).toBe('node');
expect(req?.provides).toBe('npx');
expect(req?.agentName).toBe('NPX Agent');
+ // NPX_AGENT pins an empty PATH, so this interpreter really is absent.
+ expect(req?.reason).toBe('missing');
if (req === undefined) throw new Error('unreachable');
- manager.respondRuntimeConsent(info.threadId, req.requestId, {
- kind: 'granted',
- remember: true,
- });
+ manager.respondRuntimeConsent(info.threadId, req.requestId, { kind: 'granted' });
// The runtime downloads, verifies, and installs into the seam's root.
await waitFor(
@@ -229,21 +233,16 @@ describe('managed-runtime consent + download flow', () => {
const installed = await pollInstalled(runtimeRoot);
expect(installed).not.toBeNull();
expect(installed?.kind).toBe('node');
-
- // "Remember" persisted the decision.
- expect((await readRuntimeConsent(consentHome)).node).toBe('granted');
});
test('decline → actionable error, no download', async () => {
const contentDir = tmp();
const localDir = tmp();
const runtimeRoot = tmp();
- const consentHome = tmp();
const manager = makeManager({
contentDir,
localDir,
runtimeRoot,
- consentHome,
// No tarball needed — the decline path never downloads.
fetchImpl: fakeNodeFetch(Buffer.from('unused'), 'x'.repeat(64)),
});
@@ -268,20 +267,17 @@ describe('managed-runtime consent + download flow', () => {
);
expect(errEvent?.detail).toContain('npx');
expect(await findManagedRuntime('node', runtimeRoot)).toBeNull();
- expect((await readRuntimeConsent(consentHome)).node).toBeUndefined();
});
test('a manifest-supplied PATH is never widened by the login shell', async () => {
const contentDir = tmp();
const localDir = tmp();
const runtimeRoot = tmp();
- const consentHome = tmp();
let probes = 0;
const manager = makeManager({
contentDir,
localDir,
runtimeRoot,
- consentHome,
fetchImpl: fakeNodeFetch(Buffer.from('unused'), 'x'.repeat(64)),
resolveLoginShellPath: async () => {
probes += 1;
@@ -300,35 +296,363 @@ describe('managed-runtime consent + download flow', () => {
expect(probes).toBe(0);
});
- test('a persisted grant skips the prompt entirely', async () => {
+ // The interpreter is right there on PATH and executable, so
+ // preflight passes — and then it aborts the instant it runs, exactly as a
+ // Homebrew `node` does once its `icu4c` is upgraded out from under it.
+ // Before the health probe this spawned the crashing `npx` and surfaced as
+ // "initialize failed: ACP connection closed" with no offer of a way out.
+ test('an interpreter that resolves but crashes routes to the managed runtime', async () => {
const contentDir = tmp();
const localDir = tmp();
const runtimeRoot = tmp();
- const consentHome = tmp();
const stage = tmp();
- const { bytes, sha } = fakeNodeTarball(stage);
- // Pre-record consent so the manager should download without asking.
+ const brokenBin = tmp();
writeFileSync(
- join(consentHome, 'acp-runtime-consent.json'),
- JSON.stringify({ version: 1, node: 'granted' }),
+ join(brokenBin, 'npx'),
+ '#!/bin/sh\necho "dyld[1]: Library not loaded: libicui18n.74.dylib" >&2\nkill -ABRT $$\n',
+ { mode: 0o755 },
);
+ const { bytes, sha } = fakeNodeTarball(stage);
const manager = makeManager({
contentDir,
localDir,
runtimeRoot,
- consentHome,
- fetchImpl: fakeNodeFetch(bytes, sha),
+ fetchImpl: fakeNodeFetch(bytes, sha, {
+ ...NPX_AGENT,
+ distribution: { npx: { package: '@fake/agent', env: { PATH: brokenBin } } },
+ }),
});
const events: ThreadEvent[] = [];
const info = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
await collect(manager, info.threadId, events);
+ await waitFor(() => findConsentRequest(events) !== undefined, 10_000, 'consent request');
+ const req = findConsentRequest(events);
+ if (req === undefined) throw new Error('unreachable');
+ // The offer's copy turns on this: "isn't installed" would send a user whose
+ // interpreter is present-but-broken to install a second one that the broken
+ // copy still shadows on PATH.
+ expect(req.reason).toBe('broken');
+ manager.respondRuntimeConsent(info.threadId, req.requestId, { kind: 'granted' });
+
const installed = await pollInstalled(runtimeRoot);
expect(installed).not.toBeNull();
- // No consent prompt was ever emitted.
+ }, 20_000);
+
+ // Declining the download must not leave the user with the stock hint, which
+ // says the interpreter "isn't installed" — the one thing this case disproves.
+ test('declining after a crash reports the broken interpreter, not a missing one', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const runtimeRoot = tmp();
+ const brokenBin = tmp();
+ writeFileSync(
+ join(brokenBin, 'npx'),
+ '#!/bin/sh\necho "dyld[1]: Library not loaded: libicui18n.74.dylib" >&2\nkill -ABRT $$\n',
+ { mode: 0o755 },
+ );
+ const manager = makeManager({
+ contentDir,
+ localDir,
+ runtimeRoot,
+ // No tarball needed — the decline path never downloads.
+ fetchImpl: fakeNodeFetch(Buffer.from('unused'), 'x'.repeat(64), {
+ ...NPX_AGENT,
+ distribution: { npx: { package: '@fake/agent', env: { PATH: brokenBin } } },
+ }),
+ });
+
+ const events: ThreadEvent[] = [];
+ const info = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await collect(manager, info.threadId, events);
+
+ await waitFor(() => findConsentRequest(events) !== undefined, 10_000, 'consent request');
+ const req = findConsentRequest(events);
+ if (req === undefined) throw new Error('unreachable');
+ manager.respondRuntimeConsent(info.threadId, req.requestId, { kind: 'declined' });
+
+ await waitFor(
+ () => events.some((e) => e.kind === 'status' && e.status === 'error'),
+ 10_000,
+ 'error status',
+ );
+ const errEvent = events.find(
+ (e): e is Extract<ThreadEvent, { kind: 'status' }> =>
+ e.kind === 'status' && e.status === 'error',
+ );
+ expect(errEvent?.detail).toContain('is installed but failed to run');
+ expect(errEvent?.detail).toContain('SIGABRT');
+ expect(errEvent?.detail).not.toContain("isn't installed");
+ expect(await findManagedRuntime('node', runtimeRoot)).toBeNull();
+ }, 20_000);
+
+ // A decision is scoped to the launch that asked for it. Persisting one gave
+ // a misclicked "Not now" no way back — there is no UI that un-declines, so
+ // the offer was gone for good and the only cure was deleting a file in
+ // `~/.ok` by hand.
+ test('a declined offer comes back on the next launch', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const runtimeRoot = tmp();
+ const stage = tmp();
+ const { bytes, sha } = fakeNodeTarball(stage);
+ const manager = makeManager({
+ contentDir,
+ localDir,
+ runtimeRoot,
+ fetchImpl: fakeNodeFetch(bytes, sha),
+ });
+
+ const first: ThreadEvent[] = [];
+ const one = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await collect(manager, one.threadId, first);
+ await waitFor(() => findConsentRequest(first) !== undefined, 5_000, 'first consent request');
+ const declined = findConsentRequest(first);
+ if (declined === undefined) throw new Error('unreachable');
+ manager.respondRuntimeConsent(one.threadId, declined.requestId, { kind: 'declined' });
+ await waitFor(
+ () => first.some((e) => e.kind === 'status' && e.status === 'error'),
+ 5_000,
+ 'first launch failed',
+ );
+
+ const second: ThreadEvent[] = [];
+ const two = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await collect(manager, two.threadId, second);
+ await waitFor(() => findConsentRequest(second) !== undefined, 5_000, 'second consent request');
+
+ // …and granting it now still works, from a thread that knows nothing of
+ // the earlier refusal.
+ const retry = findConsentRequest(second);
+ if (retry === undefined) throw new Error('unreachable');
+ manager.respondRuntimeConsent(two.threadId, retry.requestId, { kind: 'granted' });
+ expect(await pollInstalled(runtimeRoot)).not.toBeNull();
+ }, 20_000);
+});
+
+describe('interpreter health probe', () => {
+ // The fallback's own fallback. `findManagedRuntime`'s already-installed fast
+ // path admits a runtime on an exists-plus-execute-bit check — the evidence
+ // `probeInterpreterHealth` supersedes — so one damaged by an interrupted
+ // extraction or an earlier layout passes it. This copy is OK's, so OK
+ // replaces it rather than handing the user a directory to delete.
+ test('a damaged managed runtime is replaced, not reported as the dead end', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const runtimeRoot = tmp();
+ const stage = tmp();
+ const { bytes, sha } = fakeNodeTarball(stage);
+ const fetchImpl = fakeNodeFetch(bytes, sha);
+
+ // Install first, damage second, and only THEN start a manager: this is the
+ // production shape — a server booting into a runtime some earlier process
+ // left behind — and it keeps the test off the health memo, which by design
+ // would let an already-probed runtime through without re-checking.
+ const installed = await ensureManagedRuntime('node', log, { root: runtimeRoot, fetchImpl });
+ const launcher = installed.kind === 'node' ? installed.npxBin : installed.uvxBin;
+ // Present and executable, no longer able to run — what an interrupted
+ // extraction leaves behind, and what preflight alone cannot see.
+ writeFileSync(launcher, '#!/bin/sh\nkill -ABRT $$\n', { mode: 0o755 });
+
+ const manager = makeManager({ contentDir, localDir, runtimeRoot, fetchImpl });
+ const events: ThreadEvent[] = [];
+ const info = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await collect(manager, info.threadId, events);
+
+ await waitFor(() => findConsentRequest(events) !== undefined, 10_000, 'repair offer');
+ const req = findConsentRequest(events);
+ if (req === undefined) throw new Error('unreachable');
+ // Not `broken`: the copy at fault is OK's, so the card must not talk about
+ // the user's own Node.
+ expect(req.reason).toBe('damaged');
+ manager.respondRuntimeConsent(info.threadId, req.requestId, { kind: 'granted' });
+
+ // The damaged tree is gone and a working launcher stands in its place.
+ await waitFor(
+ async () => {
+ const runtime = await findManagedRuntime('node', runtimeRoot);
+ if (runtime === null) return false;
+ const bin = runtime.kind === 'node' ? runtime.npxBin : runtime.uvxBin;
+ return !readFileSync(bin, 'utf8').includes('ABRT');
+ },
+ 15_000,
+ 'runtime replaced',
+ );
+ }, 30_000);
+
+ // The repair is one attempt, not a retry loop: a runtime that arrives broken
+ // twice is a machine-level problem, and the message has to say so rather
+ // than blame a system Node that was never involved.
+ test('a replacement that is also broken reports the machine, not the user', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const runtimeRoot = tmp();
+ const stage = tmp();
+ // Every copy this host can fetch is dead on arrival.
+ const { bytes, sha } = fakeNodeTarball(stage, '#!/bin/sh\nkill -ABRT $$\n');
+ const fetchImpl = fakeNodeFetch(bytes, sha);
+ await ensureManagedRuntime('node', log, { root: runtimeRoot, fetchImpl });
+
+ const manager = makeManager({ contentDir, localDir, runtimeRoot, fetchImpl });
+ const events: ThreadEvent[] = [];
+ const info = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await collect(manager, info.threadId, events);
+
+ await waitFor(() => findConsentRequest(events) !== undefined, 10_000, 'repair offer');
+ const req = findConsentRequest(events);
+ if (req === undefined) throw new Error('unreachable');
+ manager.respondRuntimeConsent(info.threadId, req.requestId, { kind: 'granted' });
+
+ await waitFor(
+ () => events.some((e) => e.kind === 'status' && e.status === 'error'),
+ 15_000,
+ 'error status',
+ );
+ const errEvent = events.find(
+ (e): e is Extract<ThreadEvent, { kind: 'status' }> =>
+ e.kind === 'status' && e.status === 'error',
+ );
+ expect(errEvent?.detail).toContain('downloaded a fresh copy');
+ expect(errEvent?.detail).toContain('still');
+ // No `rm -rf` homework, and no blaming a system Node that never ran.
+ expect(errEvent?.detail).not.toContain('delete that directory');
+ expect(errEvent?.detail).not.toContain('icu4c');
+ // Exactly one offer: the repair does not re-enter itself.
+ expect(events.filter((e) => e.kind === 'runtime_consent_request')).toHaveLength(1);
+ }, 40_000);
+
+ // Declining the repair must not land on the stock decline hint, which says
+ // the interpreter isn't installed — OK's copy is installed, just damaged.
+ test('declining the repair says the copy is damaged, not missing', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const runtimeRoot = tmp();
+ const stage = tmp();
+ const { bytes, sha } = fakeNodeTarball(stage);
+ const fetchImpl = fakeNodeFetch(bytes, sha);
+ const installed = await ensureManagedRuntime('node', log, { root: runtimeRoot, fetchImpl });
+ const launcher = installed.kind === 'node' ? installed.npxBin : installed.uvxBin;
+ writeFileSync(launcher, '#!/bin/sh\nkill -ABRT $$\n', { mode: 0o755 });
+
+ const manager = makeManager({ contentDir, localDir, runtimeRoot, fetchImpl });
+ const events: ThreadEvent[] = [];
+ const info = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await collect(manager, info.threadId, events);
+
+ await waitFor(() => findConsentRequest(events) !== undefined, 10_000, 'repair offer');
+ const req = findConsentRequest(events);
+ if (req === undefined) throw new Error('unreachable');
+ manager.respondRuntimeConsent(info.threadId, req.requestId, { kind: 'declined' });
+
+ await waitFor(
+ () => events.some((e) => e.kind === 'status' && e.status === 'error'),
+ 10_000,
+ 'error status',
+ );
+ const errEvent = events.find(
+ (e): e is Extract<ThreadEvent, { kind: 'status' }> =>
+ e.kind === 'status' && e.status === 'error',
+ );
+ expect(errEvent?.detail).toContain('damaged');
+ expect(errEvent?.detail).not.toContain("isn't installed");
+ }, 30_000);
+
+ // What `retryThread`'s cache-clear actually protects. Healthy verdicts are
+ // cached for the server's life, so an interpreter that breaks AFTER being
+ // probed (a `brew upgrade` mid-session) would keep being spawned on every
+ // retry, and the managed-runtime offer — the way out — would never appear.
+ // The reverse case needs no cache-clear at all: a failing probe is never
+ // cached, so a repaired interpreter is re-probed either way.
+ test('Retry re-probes an interpreter that broke after it was cached healthy', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const runtimeRoot = tmp();
+ const binDir = tmp();
+ const npxPath = join(binDir, 'npx');
+ // Healthy for `--version`, useless afterwards: the thread fails at the
+ // handshake, which is all this needs — the probe verdict is now cached.
+ writeFileSync(npxPath, '#!/bin/sh\nexit 0\n', { mode: 0o755 });
+ const manager = makeManager({
+ contentDir,
+ localDir,
+ runtimeRoot,
+ fetchImpl: fakeNodeFetch(Buffer.from('unused'), 'x'.repeat(64), {
+ ...NPX_AGENT,
+ distribution: { npx: { package: '@fake/agent', env: { PATH: binDir } } },
+ }),
+ });
+
+ const events: ThreadEvent[] = [];
+ const info = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await collect(manager, info.threadId, events);
+ await waitFor(
+ () => manager.getInfo(info.threadId)?.status === 'error',
+ 10_000,
+ 'the thread to fail',
+ );
+ // Nothing was offered: as far as OK knows, this interpreter is fine.
expect(findConsentRequest(events)).toBeUndefined();
- });
+
+ // Now it breaks the way a `brew upgrade` breaks one.
+ writeFileSync(npxPath, '#!/bin/sh\nkill -ABRT $$\n', { mode: 0o755 });
+ void manager.retryThread(info.threadId).catch(() => {
+ // Rejects once the launch fails; the re-probe on the way there is the point.
+ });
+
+ // Only a re-probe can produce this: a cached verdict would have sent the
+ // retry straight to spawning the interpreter that can no longer run.
+ await waitFor(
+ () => findConsentRequest(events) !== undefined,
+ 10_000,
+ 'the retry to notice the interpreter broke',
+ );
+ }, 30_000);
+
+ // The probe is a process spawn on the launch path, so it has to be paid once
+ // per interpreter, not once per thread — startup latency is already the sore
+ // point (npx resolution + node boot + handshake, serialized).
+ test('a healthy interpreter is probed once, not once per thread', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const runtimeRoot = tmp();
+ const binDir = tmp();
+ const calls = join(binDir, 'calls.log');
+ // Records every invocation, then behaves like an npx whose package isn't
+ // an ACP agent: healthy for `--version`, useless afterwards. The thread
+ // fails at the handshake, which is irrelevant to what this counts.
+ writeFileSync(join(binDir, 'npx'), `#!/bin/sh\necho "$@" >> ${calls}\nexit 0\n`, {
+ mode: 0o755,
+ });
+ const manager = makeManager({
+ contentDir,
+ localDir,
+ runtimeRoot,
+ fetchImpl: fakeNodeFetch(Buffer.from('unused'), 'x'.repeat(64), {
+ ...NPX_AGENT,
+ distribution: { npx: { package: '@fake/agent', env: { PATH: binDir } } },
+ }),
+ });
+
+ const versionProbes = (): number =>
+ existsSync(calls)
+ ? readFileSync(calls, 'utf8')
+ .split('\n')
+ .filter((l) => l.trim() === '--version').length
+ : 0;
+
+ await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ await waitFor(() => versionProbes() === 1, 10_000, 'the first probe');
+ const second = await manager.createThread({ agent: { source: 'registry', id: 'npxagent' } });
+ // The second thread must reach its own (failed) launch — otherwise this
+ // would pass on a thread that never got as far as needing an interpreter.
+ await waitFor(
+ () => manager.getInfo(second.threadId)?.status === 'error',
+ 10_000,
+ 'the second thread to launch',
+ );
+ expect(versionProbes()).toBe(1);
+ }, 30_000);
});
/** Poll for the installed runtime (the download resolves asynchronously). */
diff --git a/packages/server/src/acp/managed-runtime.test.ts b/packages/server/src/acp/managed-runtime.test.ts
index e868fe797..2329eb103 100644
--- a/packages/server/src/acp/managed-runtime.test.ts
+++ b/packages/server/src/acp/managed-runtime.test.ts
@@ -1,6 +1,6 @@
/**
- * Managed-runtime download path: checksum verification, atomic install,
- * fast-path reuse, and consent persistence. The download is exercised
+ * Managed-runtime download path: checksum verification, atomic install, and
+ * fast-path reuse. The download is exercised
* end-to-end against a real `tar` extract of a synthetic runtime tree served
* through a fake `fetch` — no network, but the archive → verify → extract →
* rename → locate-launcher pipeline runs for real.
@@ -9,6 +9,7 @@
import { execFileSync } from 'node:child_process';
import { createHash } from 'node:crypto';
import {
+ chmodSync,
existsSync,
mkdirSync,
mkdtempSync,
@@ -27,11 +28,9 @@ import {
describeRuntime,
ensureManagedRuntime,
findManagedRuntime,
- type ManagedRuntimeKind,
+ quarantineManagedRuntime,
RuntimeInstallError,
- readRuntimeConsent,
runtimeForInterpreter,
- writeRuntimeConsent,
} from './managed-runtime.ts';
const log = getLogger('managed-runtime-test');
@@ -316,27 +315,54 @@ describe('ensureManagedRuntime', () => {
});
});
-describe('runtime consent persistence', () => {
- test('round-trips a per-runtime decision and merges without clobbering', async () => {
- const home = tmp();
- expect(await readRuntimeConsent(home)).toEqual({});
- await writeRuntimeConsent('node', 'granted', log, home);
- expect(await readRuntimeConsent(home)).toEqual({ node: 'granted' });
- await writeRuntimeConsent('uv', 'declined', log, home);
- expect(await readRuntimeConsent(home)).toEqual({ node: 'granted', uv: 'declined' });
- });
+describe('quarantineManagedRuntime', () => {
+ test('clears the way for a re-download and drops the damaged tree', async () => {
+ const stage = tmp();
+ const root = tmp();
+ const { bytes, sha } = buildTarball(stage, 'node-vTEST', ['bin/node', 'bin/npx']);
+ await ensureManagedRuntime('node', log, { root, fetchImpl: makeFetch(bytes, sha) });
+ expect(await findManagedRuntime('node', root)).not.toBeNull();
- test('ignores an unparseable consent file', async () => {
- const home = tmp();
- writeFileSync(join(home, 'acp-runtime-consent.json'), '{ not json');
- expect(await readRuntimeConsent(home)).toEqual({});
+ expect(await quarantineManagedRuntime('node', log, root)).toBe(true);
+
+ // Gone from the fast path, and nothing left behind for the staging sweep
+ // to trip over — the install-shaped name is the fallback, not the plan.
+ expect(await findManagedRuntime('node', root)).toBeNull();
+ expect(readdirSync(join(root, 'node'))).toHaveLength(0);
+ const again = await ensureManagedRuntime('node', log, {
+ root,
+ fetchImpl: makeFetch(bytes, sha),
+ });
+ expect(existsSync(again.kind === 'node' ? again.npxBin : again.uvxBin)).toBe(true);
});
- const kinds: ManagedRuntimeKind[] = ['node', 'uv'];
- test.each(kinds)('overwrites a prior %s decision', async (kind) => {
- const home = tmp();
- await writeRuntimeConsent(kind, 'declined', log, home);
- await writeRuntimeConsent(kind, 'granted', log, home);
- expect((await readRuntimeConsent(home))[kind]).toBe('granted');
+ // Denying write on the parent is how this forces the rename to fail. Root
+ // ignores the mode, and Windows doesn't enforce it that way at all — on
+ // either the rename would succeed and the assertion would measure nothing.
+ test.skipIf(process.platform === 'win32' || process.getuid?.() === 0)(
+ 'reports failure instead of pretending the tree is gone',
+ async () => {
+ const stage = tmp();
+ const root = tmp();
+ const { bytes, sha } = buildTarball(stage, 'node-vTEST', ['bin/node', 'bin/npx']);
+ await ensureManagedRuntime('node', log, { root, fetchImpl: makeFetch(bytes, sha) });
+ const kindDir = join(root, 'node');
+ // Renaming the version dir needs write permission on its parent. Denying
+ // it is the portable stand-in for the Windows EBUSY this guards: another
+ // agent holding the launcher open blocks the rename there. A false verdict
+ // would send the caller on to re-download, adopt the SAME damaged copy off
+ // the fast path, and blame the machine for a fresh copy that never landed.
+ chmodSync(kindDir, 0o500);
+ try {
+ expect(await quarantineManagedRuntime('node', log, root)).toBe(false);
+ expect(await findManagedRuntime('node', root)).not.toBeNull();
+ } finally {
+ chmodSync(kindDir, 0o700);
+ }
+ },
+ );
+
+ test('treats an already-absent runtime as cleared', async () => {
+ expect(await quarantineManagedRuntime('node', log, tmp())).toBe(true);
});
});
diff --git a/packages/server/src/acp/managed-runtime.ts b/packages/server/src/acp/managed-runtime.ts
index 17866fa5f..bda2a49cf 100644
--- a/packages/server/src/acp/managed-runtime.ts
+++ b/packages/server/src/acp/managed-runtime.ts
@@ -12,10 +12,11 @@
*
* Two hard rules distinguish this from Zed's implementation:
*
- * 1. **Consent.** Nothing downloads without the user's explicit go-ahead
- * (persisted per-runtime under `~/.ok/`). The gate + prompt live in the
- * thread manager; this module only reads/writes the decision and does the
- * download once told to.
+ * 1. **Consent.** Nothing downloads without the user's explicit go-ahead,
+ * asked per launch and never persisted — a stored "no" has no UI to undo
+ * it, and a stored "yes" would authorize a later download the user never
+ * saw. The gate + prompt live in the thread manager; this module only does
+ * the download once told to.
* 2. **Verification.** Every archive is checked against the publisher's
* SHA-256 (Node's `SHASUMS256.txt`, uv's per-asset `.sha256`) before it
* is trusted — an unverified download is discarded.
@@ -32,7 +33,7 @@ import { arch, homedir, platform } from 'node:os';
import { dirname, join } from 'node:path';
import { OK_DIR } from '@inkeep/open-knowledge-core';
import { FileLockTimeoutError, withFileLock } from '@inkeep/open-knowledge-core/server';
-import { tracedMkdir, tracedRename, tracedRm, tracedWriteFile } from '../fs-traced.ts';
+import { tracedMkdir, tracedRename, tracedRm } from '../fs-traced.ts';
import type { PinoLogger } from '../logger.ts';
import {
type DownloadProgress,
@@ -323,6 +324,43 @@ export async function cleanupManagedRuntimeStaging(
await cleanupStaleStagingDirs(join(root, kind), log);
}
+/**
+ * Move a damaged install out of the way so the next `ensureManagedRuntime`
+ * re-downloads instead of adopting it. Renamed rather than deleted: the rename
+ * is atomic and safe while another agent still holds files open inside the
+ * tree, and the `.install-` prefix hands the leftover to the same stale-staging
+ * sweep that collects crashed downloads. Deletion is best-effort after that.
+ *
+ * Returns false when the tree is still in place — a Windows rename fails with
+ * EBUSY/EPERM while another agent has the launcher open. The caller MUST NOT
+ * treat that as "replaced": re-downloading finds the damaged copy on the
+ * fast path and hands it back, so a failure reported as a fresh install would
+ * name the wrong culprit.
+ */
+export async function quarantineManagedRuntime(
+ kind: ManagedRuntimeKind,
+ log: PinoLogger,
+ root: string = defaultRuntimeRoot(),
+): Promise<boolean> {
+ const versionDir = join(root, kind, sanitizeSegment(versionOf(kind)));
+ const quarantined = join(
+ dirname(versionDir),
+ `.install-damaged-${sanitizeSegment(versionOf(kind))}-${randomUUID()}`,
+ );
+ try {
+ await tracedRename(versionDir, quarantined);
+ } catch (err) {
+ if ((err as NodeJS.ErrnoException).code === 'ENOENT') return true;
+ log.warn({ err, kind, versionDir }, '[managed-runtime] could not quarantine damaged runtime');
+ return false;
+ }
+ log.info({ kind, versionDir }, '[managed-runtime] quarantined damaged runtime');
+ await tracedRm(quarantined, { recursive: true, force: true }).catch(() => {
+ // The stale-staging sweep collects it later.
+ });
+ return true;
+}
+
/**
* Download + verify + install a managed runtime once per pinned version;
* later launches reuse the extracted tree. Verified against the publisher's
@@ -448,56 +486,3 @@ export async function ensureManagedRuntime(
});
}
}
-
-// --- Consent persistence ----------------------------------------------------
-//
-// A machine-/user-level decision (the download is user-level, shared across
-// projects), stored beside the runtime cache rather than in a project's
-// committed config — a teammate's clone must not pre-grant a download on this
-// machine (same locality reasoning as `server.lock` / `acp-agents.json`).
-
-export type RuntimeConsentDecision = 'granted' | 'declined';
-
-export interface RuntimeConsentState {
- node?: RuntimeConsentDecision;
- uv?: RuntimeConsentDecision;
-}
-
-const CONSENT_FILE = 'acp-runtime-consent.json';
-
-/** Read the persisted per-runtime consent decisions (empty on any read/parse error). */
-export async function readRuntimeConsent(home: string = okHomeDir()): Promise<RuntimeConsentState> {
- let text: string;
- try {
- const { readFile } = await import('node:fs/promises');
- text = await readFile(join(home, CONSENT_FILE), 'utf8');
- } catch {
- return {};
- }
- try {
- const parsed = JSON.parse(text) as Record<string, unknown>;
- const pick = (v: unknown): RuntimeConsentDecision | undefined =>
- v === 'granted' || v === 'declined' ? v : undefined;
- return { node: pick(parsed.node), uv: pick(parsed.uv) };
- } catch {
- return {};
- }
-}
-
-/** Persist a per-runtime consent decision, merging with any existing state. */
-export async function writeRuntimeConsent(
- kind: ManagedRuntimeKind,
- decision: RuntimeConsentDecision,
- log: PinoLogger,
- home: string = okHomeDir(),
-): Promise<void> {
- try {
- const current = await readRuntimeConsent(home);
- const next = { version: 1, ...current, [kind]: decision, updatedAt: Date.now() };
- await tracedMkdir(home, { recursive: true });
- await tracedWriteFile(join(home, CONSENT_FILE), `${JSON.stringify(next, null, 2)}\n`);
- } catch (err) {
- // Non-fatal: a failed persist just means we re-ask next time.
- log.warn({ err, kind }, '[managed-runtime] consent persist failed');
- }
-}
diff --git a/packages/server/src/acp/thread-manager.integration.test.ts b/packages/server/src/acp/thread-manager.integration.test.ts
index ac70bdbed..ac1bbe62d 100644
--- a/packages/server/src/acp/thread-manager.integration.test.ts
+++ b/packages/server/src/acp/thread-manager.integration.test.ts
@@ -23,7 +23,7 @@ import { afterEach, describe, expect, test } from 'vitest';
import * as Y from 'yjs';
import type { AgentPresenceBroadcaster } from '../agent-presence.ts';
import type { AgentSessionManager } from '../agent-sessions.ts';
-import { getLogger } from '../logger.ts';
+import { getLogger, type PinoLogger } from '../logger.ts';
import { AcpPermissionStore } from './permissions.ts';
import { AcpRegistry } from './registry.ts';
import { ACP_ENVIRONMENT_NOTE, AcpThreadManager, MAX_QUEUED_PROMPTS } from './thread-manager.ts';
@@ -71,6 +71,7 @@ function makeManager(
resolveLoginShellPath?: () => Promise<string | null>;
agentPresenceBroadcaster?: AgentPresenceBroadcaster;
sessionManager?: AgentSessionManager;
+ log?: PinoLogger;
},
): AcpThreadManager {
const manager = new AcpThreadManager({
@@ -3247,3 +3248,151 @@ describe('AcpThreadManager agent presence', () => {
await manager.closeThread(info.threadId);
}, 45_000);
});
+
+/**
+ * A thread's failure detail is what a bug report is diagnosed from, and the
+ * transcript that shows it to the user is neither collected into a diagnostic
+ * bundle nor guaranteed to survive (the user can delete a thread). The server
+ * log is, so an agent's own last words have to reach it explicitly — nothing
+ * else on these paths forwards them.
+ */
+function writeCrashingAgentEntry(localDir: string, id: string, stderrLine: string): void {
+ const agentPath = join(localDir, `${id}.mjs`);
+ // Dies before the handshake, the way an interpreter that can't load its own
+ // libraries does — the last thing it says is on stderr.
+ writeFileSync(agentPath, `process.stderr.write(${JSON.stringify(`${stderrLine}\n`)});\n`);
+ writeFileSync(
+ join(localDir, 'acp-agents.json'),
+ JSON.stringify([{ id, name: `Fake ${id}`, command: 'node', args: [agentPath] }]),
+ );
+}
+
+/**
+ * Agent that completes the handshake, then dies mid-session with something on
+ * stderr — the "it was working and then it wasn't" shape.
+ */
+function writeExitAfterReadyAgentEntry(
+ localDir: string,
+ id: string,
+ stderrLine: string,
+ dieFile: string,
+): void {
+ const agentPath = join(localDir, `${id}.mjs`);
+ writeFileSync(
+ agentPath,
+ `
+import { existsSync } from 'node:fs';
+const write = (msg) => process.stdout.write(JSON.stringify(msg) + '\\n');
+// Dies only when the test says so, and with no request in flight. A timed
+// exit raced session setup: landing first, it failed the pending session/new,
+// which puts the thread in 'error' — a status whose exit is a known echo and
+// is deliberately not logged again.
+setInterval(() => {
+ if (!existsSync(${JSON.stringify(dieFile)})) return;
+ process.stderr.write(${JSON.stringify(stderrLine)} + '\\n');
+ process.exit(7);
+}, 20);
+let buffer = '';
+process.stdin.setEncoding('utf8');
+process.stdin.on('data', (chunk) => {
+ buffer += chunk;
+ let idx = buffer.indexOf('\\n');
+ while (idx !== -1) {
+ const line = buffer.slice(0, idx);
+ buffer = buffer.slice(idx + 1);
+ idx = buffer.indexOf('\\n');
+ if (line.trim() === '') continue;
+ const msg = JSON.parse(line);
+ if (msg.method === 'initialize') {
+ write({ jsonrpc: '2.0', id: msg.id, result: { protocolVersion: 1, agentCapabilities: {} } });
+ } else if (msg.method === 'session/new') {
+ write({ jsonrpc: '2.0', id: msg.id, result: { sessionId: 'quitter-session' } });
+ } else if (msg.id !== undefined) {
+ write({ jsonrpc: '2.0', id: msg.id, result: {} });
+ }
+ }
+});
+`,
+ );
+ writeFileSync(
+ join(localDir, 'acp-agents.json'),
+ JSON.stringify([{ id, name: `Fake ${id}`, command: 'node', args: [agentPath] }]),
+ );
+}
+
+/** Logger that keeps every line so a test can assert on what an operator sees. */
+function capturingLog(sink: { obj: Record<string, unknown>; msg: string }[]): PinoLogger {
+ const record = (obj: unknown, msg?: unknown): void => {
+ if (typeof obj === 'string') sink.push({ obj: {}, msg: obj });
+ else sink.push({ obj: (obj ?? {}) as Record<string, unknown>, msg: String(msg ?? '') });
+ };
+ const self = {
+ fatal: record,
+ error: record,
+ warn: record,
+ info: record,
+ debug: record,
+ trace: record,
+ child: () => self,
+ };
+ return self as unknown as PinoLogger;
+}
+
+describe('agent failures reach the server log', () => {
+ test('an agent that dies before the handshake logs its last words', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const lines: { obj: Record<string, unknown>; msg: string }[] = [];
+ writeCrashingAgentEntry(
+ localDir,
+ 'crasher',
+ 'dyld[5034]: Library not loaded: libicui18n.74.dylib',
+ );
+
+ const manager = makeManager(contentDir, localDir, { log: capturingLog(lines) });
+ const info = await manager.createThread({ agent: { source: 'custom', id: 'crasher' } });
+ await waitUntil(
+ () => manager.getInfo(info.threadId)?.status === 'error',
+ 15_000,
+ 'the thread to fail',
+ );
+
+ // The user-facing detail names only the symptom ("ACP connection closed");
+ // the cause rides on machineDetail, so the log line must carry that too.
+ const failureLine = lines.find((l) => l.msg.includes('thread failure status'));
+ expect(failureLine).toBeDefined();
+ expect(String(failureLine?.obj.detail)).not.toContain('libicui18n.74.dylib');
+ expect(String(failureLine?.obj.machineDetail)).toContain('libicui18n.74.dylib');
+ }, 30_000);
+
+ test('an agent that dies after going ready logs the unexpected exit', async () => {
+ const contentDir = tmp();
+ const localDir = tmp();
+ const lines: { obj: Record<string, unknown>; msg: string }[] = [];
+ const dieFile = join(localDir, 'die-now');
+ writeExitAfterReadyAgentEntry(localDir, 'quitter', 'agent ran out of memory', dieFile);
+
+ const manager = makeManager(contentDir, localDir, { log: capturingLog(lines) });
+ const info = await manager.createThread({ agent: { source: 'custom', id: 'quitter' } });
+ // Ready FIRST, then kill it: with no request in flight, the exit is the
+ // only thing that can move the status, so the assertion can't race.
+ await waitUntil(
+ () => manager.getInfo(info.threadId)?.status === 'ready',
+ 15_000,
+ 'the agent to go ready',
+ );
+ writeFileSync(dieFile, 'now');
+ await waitUntil(
+ () => manager.getInfo(info.threadId)?.status === 'exited',
+ 15_000,
+ 'the agent to exit',
+ );
+
+ // 'exited' is not a failure status, so nothing else would have logged it —
+ // yet an agent vanishing mid-session is exactly what a report is about.
+ const exitLine = lines.find((l) => l.msg.includes('agent exited unexpectedly'));
+ expect(exitLine).toBeDefined();
+ expect(exitLine?.obj.code).toBe(7);
+ expect(String(exitLine?.obj.machineDetail)).toContain('ran out of memory');
+ }, 30_000);
+});
diff --git a/packages/server/src/acp/thread-manager.ts b/packages/server/src/acp/thread-manager.ts
index 5ada3c979..bedc93807 100644
--- a/packages/server/src/acp/thread-manager.ts
+++ b/packages/server/src/acp/thread-manager.ts
@@ -76,15 +76,20 @@ import { buildPromptBlocks } from './attachment-blocks.ts';
import { boundSessionUpdateForLog, coalesceChunkInto } from './event-log-bounds.ts';
import {
AgentLaunchError,
+ brokenInterpreterHint,
+ declinedRepairHint,
envPath,
isPathQualified,
preflightLaunch,
+ probeInterpreterHealth,
type ResolvedLaunch,
resolveCustomLaunch,
resolveRegistryLaunch,
rewriteLaunchToManagedRuntime,
spawnAcpAgent,
terminateAgentTree,
+ undeletableManagedRuntimeHint,
+ unrepairableManagedRuntimeHint,
withLoginShellPath,
} from './launch.ts';
import {
@@ -98,10 +103,9 @@ import {
findManagedRuntime,
type ManagedRuntime,
type ManagedRuntimeKind,
- readRuntimeConsent,
+ quarantineManagedRuntime,
runtimeDownloadSupported,
runtimeForInterpreter,
- writeRuntimeConsent,
} from './managed-runtime.ts';
import type { AcpPermissionStore } from './permissions.ts';
import {
@@ -300,7 +304,6 @@ interface ThreadRecord {
pendingRuntimeConsent: Map<
string,
{
- runtime: ManagedRuntimeKind;
resolve: (decision: 'granted' | 'declined' | 'timeout' | 'closed') => void;
timer: ReturnType<typeof setTimeout>;
}
@@ -419,15 +422,13 @@ export interface AcpThreadManagerOptions {
) => HarnessManagedMcpEntryHit | null | Promise<HarnessManagedMcpEntryHit | null>;
/**
* Test seam for the managed-runtime download path — override the install
- * cache root, the download `fetch`, and the consent-store home so a test can
- * drive the consent/download flow without touching the real `~/.ok` or the
- * network. Unset in production (defaults resolve to `~/.ok/runtimes` +
- * global `fetch` + `~/.ok`).
+ * cache root and the download `fetch` so a test can drive the
+ * consent/download flow without touching the real `~/.ok` or the network.
+ * Unset in production (defaults resolve to `~/.ok/runtimes` + global `fetch`).
*/
runtimeInstall?: {
root?: string;
fetchImpl?: typeof fetch;
- consentHome?: string;
};
/**
* The user's login-shell PATH, consulted only after a PATH-resolved command
@@ -478,6 +479,14 @@ export class AcpThreadManager {
private readonly unwatchedTurnKillMs: number;
private readonly persistence: ThreadPersistenceStore;
private readonly resolveLoginShellPath: () => Promise<string | null>;
+ /**
+ * Interpreters that answered `--version` cleanly, keyed by command + the PATH
+ * they were probed under — see {@link AcpThreadManager.ensureInterpreterRuns}.
+ * Healthy verdicts only, so a repaired Node is picked up without a restart;
+ * `retryThread` clears it alongside the login-shell memo so the user's retry
+ * re-checks an interpreter that broke after it was cached.
+ */
+ private readonly healthyInterpreters = new Set<string>();
private destroyed = false;
private initialized = false;
@@ -783,11 +792,12 @@ export class AcpThreadManager {
}
if (record.closed) return null;
- // Ensure the launch command exists. If the interpreter (npx/uvx) is
- // missing, offer to download a managed runtime (consent-gated) and rewrite
- // the launch to use it; otherwise this throws an actionable install hint
- // rather than letting the missing command surface as an opaque async
- // `spawn ENOENT`.
+ // Ensure the launch command exists AND can actually run. If the
+ // interpreter (npx/uvx) is missing, or present but unable to start, offer
+ // to download a managed runtime (consent-gated) and rewrite the launch to
+ // use it; otherwise this throws an actionable install hint rather than
+ // letting the failure surface as an opaque async `spawn ENOENT` or a
+ // handshake that never completes.
const launchable = await this.ensureLaunchable(record, launch);
if (launchable === null) return null;
launch = launchable;
@@ -852,6 +862,23 @@ export class AcpThreadManager {
return;
}
const tail = record.stderrTail.slice(-10).join('\n');
+ // An exit reaching here is unexpected — the closed / archived / already-
+ // error cases returned above — so it is the kind of thing an operator
+ // reading a bug report needs, and `exited` alone doesn't reach the log
+ // the way a failure status does.
+ this.opts.log.warn(
+ {
+ threadId: record.info.threadId,
+ agentId: record.info.agent.id,
+ code,
+ signal,
+ // The shared helper, like every other failure path: the status
+ // detail is trimmed to 10 lines for the reader, but the log wants
+ // the whole tail an operator is going to grep.
+ machineDetail: stderrTailDetail(record),
+ },
+ '[acp-threads] agent exited unexpectedly',
+ );
this.emitStatus(
record,
'exited',
@@ -967,10 +994,11 @@ export class AcpThreadManager {
}
/**
- * Preflight the launch; on a command the inherited PATH can't resolve, try
- * the login shell's PATH, then — for npx/uvx only — a managed runtime
- * (already-installed → persisted-consent → interactive consent → download)
- * and return the rewritten launch. Returns null only when the thread closed
+ * Make `launch` spawnable. Preflight it; on a command the inherited PATH
+ * can't resolve, try the login shell's PATH; then — for npx/uvx only — check
+ * that the interpreter we settled on can actually run, and route a missing OR
+ * broken one to a managed runtime (already-installed → persisted-consent →
+ * interactive consent → download). Returns null only when the thread closed
* mid-flight; throws an actionable {@link AgentLaunchError} on decline /
* unsupported platform / failed install (callers map it to an error status).
*/
@@ -978,6 +1006,7 @@ export class AcpThreadManager {
record: ThreadRecord,
launch: ResolvedLaunch,
): Promise<ResolvedLaunch | null> {
+ let candidate: ResolvedLaunch;
try {
await preflightLaunch(launch);
// Preflight only proves the TOP-LEVEL command resolves. The adapter goes
@@ -986,25 +1015,183 @@ export class AcpThreadManager {
// preflighted still needs the login shell's PATH, not just one that
// failed. The merge is append-only: it can add resolutions, never
// redirect a command that already resolved to a different binary.
- return await this.withLoginShellPathIfEligible(launch);
+ candidate = await this.withLoginShellPathIfEligible(launch);
} catch (err) {
if (!(err instanceof AgentLaunchError) || err.code !== 'command-not-found') throw err;
// A terminal would have found it: adopt the login shell's PATH rather
// than download a runtime (or blame the user) for a tool they have.
const viaLoginShell = await this.retryWithLoginShellPath(launch);
- if (viaLoginShell !== null) return viaLoginShell;
- // Only npx/uvx have a managed fallback — a binary/custom command doesn't.
- if (launch.kind !== 'npx' && launch.kind !== 'uvx') throw err;
- const runtimeKind = runtimeForInterpreter(launch.kind);
- // No download target for this platform → keep the original install hint.
- if (!runtimeDownloadSupported(runtimeKind)) throw err;
- const runtime = await this.provideManagedRuntime(record, runtimeKind);
- if (runtime === null) return null; // closed mid-flight
- const rewritten = rewriteLaunchToManagedRuntime(launch, runtime);
- // The managed launcher must itself be executable before we spawn it.
- await preflightLaunch(rewritten);
- return rewritten;
+ if (viaLoginShell === null) return this.fallbackToManagedRuntime(record, launch, err);
+ candidate = viaLoginShell;
}
+ if (record.closed) return null;
+ return this.ensureInterpreterRuns(record, candidate);
+ }
+
+ /**
+ * Guard the case preflight structurally cannot see: an npx/uvx interpreter
+ * that resolves and carries the execute bit yet dies the moment it runs (see
+ * {@link probeInterpreterHealth}). Both `ensureLaunchable` success paths land
+ * here — a login-shell-resolved interpreter can be just as broken as an
+ * inherited-PATH one.
+ *
+ * A broken interpreter goes STRAIGHT to the managed runtime, never back
+ * through the login-shell retry: that merge is append-only, so a shell PATH
+ * cannot shadow an interpreter that already resolves. Non-interpreter kinds
+ * pass through untouched — a binary/custom command has no managed fallback,
+ * so probing it could only add latency and a failure mode with no remedy.
+ */
+ private async ensureInterpreterRuns(
+ record: ThreadRecord,
+ launch: ResolvedLaunch,
+ ): Promise<ResolvedLaunch | null> {
+ if (launch.kind !== 'npx' && launch.kind !== 'uvx') return launch;
+ const brokenDetail = await this.probeInterpreterOnce(launch);
+ if (record.closed) return null;
+ if (brokenDetail === null) return launch;
+ this.opts.log.warn(
+ {
+ threadId: record.info.threadId,
+ agentId: record.info.agent.id,
+ cmd: launch.cmd,
+ kind: launch.kind,
+ detail: brokenDetail,
+ },
+ '[acp-threads] interpreter is installed but failed to run — offering the managed runtime',
+ );
+ const cause = new AgentLaunchError(
+ 'command-not-found',
+ brokenInterpreterHint(launch, brokenDetail),
+ );
+ // Also the message a decline lands on: the stock decline hint says the
+ // interpreter "isn't installed", which is the one thing we just proved
+ // wrong — it is installed, it just can't run.
+ return this.fallbackToManagedRuntime(record, launch, cause, cause);
+ }
+
+ /**
+ * Route an npx/uvx interpreter that is missing or broken to the managed
+ * runtime, returning the rewritten launch. Returns null only when the thread
+ * closed mid-flight; rethrows `cause` when this launch kind or platform has
+ * no managed fallback, so the actionable hint reaches the user instead of a
+ * generic failure. `declineCause`, when given, replaces the generic
+ * "isn't installed" message the user would otherwise get for declining.
+ */
+ private async fallbackToManagedRuntime(
+ record: ThreadRecord,
+ launch: ResolvedLaunch,
+ cause: AgentLaunchError,
+ declineCause?: AgentLaunchError,
+ ): Promise<ResolvedLaunch | null> {
+ // Only npx/uvx have a managed fallback — a binary/custom command doesn't.
+ if (launch.kind !== 'npx' && launch.kind !== 'uvx') throw cause;
+ const runtimeKind = runtimeForInterpreter(launch.kind);
+ // No download target for this platform → keep the actionable hint.
+ if (!runtimeDownloadSupported(runtimeKind)) throw cause;
+ const runtime = await this.provideManagedRuntime(
+ record,
+ runtimeKind,
+ // The broken-interpreter path is the one that supplies its own decline
+ // message, and it is exactly the path whose offer needs the other copy.
+ declineCause === undefined ? 'missing' : 'broken',
+ ).catch((err: unknown) => {
+ // `command-not-found` out of the runtime provider is the decline hint
+ // (an install failure carries `install-failed`), so this swap can only
+ // ever replace that one message.
+ if (declineCause !== undefined && err instanceof AgentLaunchError) {
+ throw err.code === 'command-not-found' ? declineCause : err;
+ }
+ throw err;
+ });
+ if (runtime === null) return null; // closed mid-flight
+ const rewritten = rewriteLaunchToManagedRuntime(launch, runtime);
+ // The managed launcher must itself be executable before we spawn it.
+ await preflightLaunch(rewritten);
+ // And it must actually RUN. `findManagedRuntime`'s already-installed fast
+ // path admits a runtime on the same exists-plus-execute-bit evidence
+ // preflight uses, so one left damaged by an interrupted extraction or an
+ // earlier layout sails through — and spawning it puts the user back on the
+ // opaque "connection closed" with nothing left to try.
+ const brokenManaged = await this.probeInterpreterOnce(rewritten);
+ if (brokenManaged === null) return rewritten;
+ return this.repairManagedRuntime(record, launch, runtimeKind, brokenManaged);
+ }
+
+ /**
+ * Replace a damaged copy of OK's own runtime: discard it, offer a fresh
+ * download, and probe once more. This copy is OK's, not the user's, so the
+ * remedy is ours to carry out rather than a `rm -rf` instruction to follow.
+ *
+ * One attempt, structurally — this is the only caller of the quarantine and
+ * it never re-enters itself, so a runtime that arrives broken twice reports
+ * instead of looping. A later launch may try again, which is fine: every
+ * download is gated on the prompt, so nothing refetches behind the user.
+ */
+ private async repairManagedRuntime(
+ record: ThreadRecord,
+ launch: ResolvedLaunch,
+ runtimeKind: ManagedRuntimeKind,
+ detail: string,
+ ): Promise<ResolvedLaunch | null> {
+ const logContext = {
+ threadId: record.info.threadId,
+ agentId: record.info.agent.id,
+ runtime: runtimeKind,
+ detail,
+ };
+ this.opts.log.warn(
+ logContext,
+ "[acp-threads] OK's own managed runtime failed to run — replacing it",
+ );
+ // A failed quarantine leaves the damaged tree exactly where the install
+ // fast path will find it, so re-downloading would hand the same copy back
+ // and the retry's failure would name the wrong cause.
+ const cleared = await quarantineManagedRuntime(
+ runtimeKind,
+ this.opts.log,
+ this.opts.runtimeInstall?.root,
+ );
+ if (!cleared) {
+ throw new AgentLaunchError('install-failed', undeletableManagedRuntimeHint(launch, detail));
+ }
+
+ const fresh = await this.provideManagedRuntime(record, runtimeKind, 'damaged').catch(
+ (err: unknown) => {
+ if (err instanceof AgentLaunchError && err.code === 'command-not-found') {
+ throw new AgentLaunchError('command-not-found', declinedRepairHint(launch));
+ }
+ throw err;
+ },
+ );
+ if (fresh === null) return null; // closed mid-flight
+ const rewritten = rewriteLaunchToManagedRuntime(launch, fresh);
+ await preflightLaunch(rewritten);
+ const stillBroken = await this.probeInterpreterOnce(rewritten);
+ if (stillBroken === null) return rewritten;
+ this.opts.log.error(
+ { ...logContext, detail: stillBroken },
+ '[acp-threads] a freshly downloaded managed runtime failed to run',
+ );
+ throw new AgentLaunchError(
+ 'install-failed',
+ unrepairableManagedRuntimeHint(rewritten, stillBroken),
+ );
+ }
+
+ /**
+ * {@link probeInterpreterHealth}, memoized per command + PATH. Healthy
+ * verdicts only: a failing probe is the slow path anyway, and re-running it
+ * lets a user who repairs their Node mid-session out of the managed runtime
+ * without restarting the server.
+ */
+ private async probeInterpreterOnce(launch: ResolvedLaunch): Promise<string | null> {
+ // Both fields, JSON-encoded rather than concatenated: a command or PATH
+ // holding the delimiter would otherwise let two launches share a verdict.
+ const healthKey = JSON.stringify([launch.cmd, envPath(launch.env) ?? '']);
+ if (this.healthyInterpreters.has(healthKey)) return null;
+ const detail = await probeInterpreterHealth(launch, undefined, this.opts.log);
+ if (detail === null) this.healthyInterpreters.add(healthKey);
+ return detail;
}
/**
@@ -1061,16 +1248,14 @@ export class AcpThreadManager {
private async provideManagedRuntime(
record: ThreadRecord,
runtimeKind: ManagedRuntimeKind,
+ reason: 'missing' | 'broken' | 'damaged',
): Promise<ManagedRuntime | null> {
const root = this.opts.runtimeInstall?.root;
await cleanupManagedRuntimeStaging(runtimeKind, this.opts.log, root);
const existing = await findManagedRuntime(runtimeKind, root).catch(() => null);
if (existing !== null) return existing;
- const persisted = (await readRuntimeConsent(this.opts.runtimeInstall?.consentHome))[
- runtimeKind
- ];
- const decision = persisted ?? (await this.requestRuntimeConsent(record, runtimeKind));
+ const decision = await this.requestRuntimeConsent(record, runtimeKind, reason);
if (decision === 'closed' || record.closed) return null;
if (decision !== 'granted') {
throw new AgentLaunchError('command-not-found', declinedRuntimeHint(runtimeKind));
@@ -1096,6 +1281,7 @@ export class AcpThreadManager {
private requestRuntimeConsent(
record: ThreadRecord,
runtimeKind: ManagedRuntimeKind,
+ reason: 'missing' | 'broken' | 'damaged',
): Promise<'granted' | 'declined' | 'timeout' | 'closed'> {
const requestId = crypto.randomUUID();
const d = describeRuntime(runtimeKind);
@@ -1109,6 +1295,7 @@ export class AcpThreadManager {
approxSizeMB: d.approxSizeMB,
sourceHost: d.sourceHost,
agentName: record.info.agent.name,
+ reason,
ts: Date.now(),
});
return new Promise((resolvePromise) => {
@@ -1123,11 +1310,7 @@ export class AcpThreadManager {
resolvePromise('timeout');
}, RUNTIME_CONSENT_TIMEOUT_MS);
timer.unref?.();
- record.pendingRuntimeConsent.set(requestId, {
- runtime: runtimeKind,
- resolve: resolvePromise,
- timer,
- });
+ record.pendingRuntimeConsent.set(requestId, { resolve: resolvePromise, timer });
});
}
@@ -1135,7 +1318,7 @@ export class AcpThreadManager {
respondRuntimeConsent(
threadId: string,
requestId: string,
- outcome: { kind: 'granted'; remember?: boolean } | { kind: 'declined'; remember?: boolean },
+ outcome: { kind: 'granted' } | { kind: 'declined' },
): void {
const t = this.mustGet(threadId);
const pending = t.pendingRuntimeConsent.get(requestId);
@@ -1143,14 +1326,6 @@ export class AcpThreadManager {
t.pendingRuntimeConsent.delete(requestId);
clearTimeout(pending.timer);
const decision = outcome.kind === 'granted' ? 'granted' : 'declined';
- if (outcome.remember === true) {
- void writeRuntimeConsent(
- pending.runtime,
- decision,
- this.opts.log,
- this.opts.runtimeInstall?.consentHome,
- );
- }
this.appendEvent(t, {
kind: 'runtime_consent_resolved',
requestId,
@@ -1605,6 +1780,7 @@ export class AcpThreadManager {
t.resumeInFlight = true;
try {
resetSharedLoginShellPathProvider();
+ this.healthyInterpreters.clear();
// Before anything is torn down: an unknown agent (or an unreachable
// registry) must reject the retry outright rather than leave the thread
// half-dismantled.
@@ -2826,6 +3002,11 @@ export class AcpThreadManager {
status,
detail,
reason: failure?.reason,
+ // The agent's own last words. `detail` is the user-facing summary
+ // ("initialize failed: ACP connection closed"), which names the
+ // symptom; the cause — a dyld abort, a missing API key, a stack
+ // trace — only ever appears here.
+ machineDetail: failure?.machineDetail,
},
'[acp-threads] thread failure status',
);