Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Report a problem with an agent chat from its settings (PRD-8072) (#5007)
Abrahamee7729385495
diff --git a/.changeset/prd-8072-report-agent-chat.md b/.changeset/prd-8072-report-agent-chat.mdnew file mode 100644index 000000000..a32fe7445--- /dev/null+++ b/.changeset/prd-8072-report-agent-chat.md@@ -0,0 +1,5 @@+---+"@inkeep/open-knowledge": patch+---++In the desktop app, you can report a problem from an agent chat's Settings menu, and the report includes that conversation, with known secrets scrubbed, unless you uncheck it.diff --git a/docs/content/features/editor.mdx b/docs/content/features/editor.mdxindex a9406be55..53fe12d88 100644--- a/docs/content/features/editor.mdx+++ b/docs/content/features/editor.mdx@@ -191,6 +191,8 @@ The Agents panel's **Chat history** button opens every conversation the projectWhich presentation you get when opening history follows the width of the chat pane rather than the window. A wide pane docks history beside the transcript: the tab strip stays visible and usable, and the list stays open after you pick a conversation, so you close it with `Esc` or by clicking **Chat history** again. If you narrow the pane while history is docked, history closes first so the active chat remains open. Opening history in a narrow pane covers the whole chat area instead, including the tab strip, which is inert until you leave history; widening the pane while history is open moves it into the docked position without closing it. The cover list closes as soon as you pick a conversation, and a **Back** button in its header dismisses it, as does `Esc`.+To report a problem with a chat in the desktop app, choose **Report a problem with this chat…** from the chat's **Settings** menu, which stays open for this even when the agent has no settings to adjust, for example after it failed to start. Unless you uncheck **This conversation**, the report carries the newest 4 MB of the chat's messages, tool calls, and their output, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings, with known secrets scrubbed. Images and other binary content in the chat are replaced by a note of their type and size, while text files attached to a message are included. The review step tells you if the chat's messages couldn't be added, in which case the report goes without the conversation. If only the title, path, document, and agent details couldn't be read, the report carries the messages without them, and the review step doesn't mention it. See [what leaves your machine](../reference/what-open-knowledge-writes.mdx#what-leaves-your-machine) for everything else a report carries.+Messages in an agent chat link the references they mention. A qualified GitHub reference such as `inkeep/open-knowledge#1284` links to that issue or pull request on github.com, or on your project's GitHub Enterprise host when the project's remote is on a host declared under [`git.hosts`](../reference/configuration.mdx), a per-machine setting. Ticket prefixes you list under [`autolinks`](../reference/configuration.mdx) in `.ok/config.yml` turn tokens such as `PRD-123` into links to the URL you give. A bare `#123` stays plain text, since agents write the same form for ordinals like "step #2", and references inside code stay as written. Hovering a link to a GitHub pull request or issue, whether written out in full or as a qualified reference, shows a card with its title, state, and author, and a pull request also shows its lines changed and whether it can merge. The card comes from GitHub's API, signed in as you when OpenKnowledge can use your GitHub sign-in, so private repositories you can read work too; with a sign-in, an open pull request also shows what it is waiting on, such as its place in the merge queue, a requested review, or failing checks. It follows the [link previews](../reference/configuration.mdx#link-previews) setting, and a reference GitHub can't answer for stays a plain link.On a narrow window, the right-side Terminal and Agents panel cannot remain open together. Opening either one closes the other and shows an in-app notice; closing the visible panel does not reopen the one that was displaced.diff --git a/docs/content/reference/what-open-knowledge-writes.mdx b/docs/content/reference/what-open-knowledge-writes.mdxindex d789a38fb..2fc529408 100644--- a/docs/content/reference/what-open-knowledge-writes.mdx+++ b/docs/content/reference/what-open-knowledge-writes.mdx@@ -360,7 +360,7 @@ None of your content, by default. Everything above is written to your own disk.| What | When | Where it goes || --- | --- | --- || Diagnostic bundle | Only when you run `ok diagnose bundle` (you can inspect it first). On macOS it also carries the crash reports the OS recorded for this app and its helper processes (listed above), which are machine-wide rather than project-scoped; only this app's are collected, never another application's, though a report of ours still names the processes it was running alongside, and the summary printed before the zip is written says what that search found even when the answer is nothing | Wherever you send it |-| In-app bug report | Only when you click **Send** in the desktop app's **Help → Report a bug…** dialog, or the `Cmd+Shift+D` / `Ctrl+Shift+D` shortcut that opens the same dialog — it builds a secret-redacted zip you can reveal and inspect first, and nothing is sent without that explicit click. The zip carries a picture of the app window unless you uncheck **Screenshot** in that dialog, and the preview there is the picture that would be sent. You can also attach up to three images by dropping them on the **What happened?** box, pasting them anywhere in the dialog (`Cmd+V` / `Ctrl+V`), or browsing with the paperclip in that box. Neither these images nor the screenshot are scanned or redacted, so review them before sending. A report reached through a surface you opened only to get to the reporter — the command palette, the Help popover, or the Windows and Linux menu bar — waits for that surface to close first, and carries no marker, because the row it would point at has already gone. Every other report you start yourself photographs the screen as it is, so an open menu or another person's document visible at the time is in the picture, and carries a marker drawn where your pointer was, since a screenshot never includes the cursor. No marker is drawn either if the pointer has not moved since the window loaded, or has since left the window. The invitation that appears on its own after a crash is the exception to all of this: it carries no picture at all. After a crash, the same dialog adds an **off-by-default** "Include crash dump" checkbox: a crash dump is a memory snapshot that can contain document content and can't be redacted, and it is only ever attached when you check that box. On macOS the zip also carries the update helper's install log (listed above), which is machine-wide rather than project-scoped; the zip's own README names it and says where it came from. At the **Detailed diagnostics** level — pre-checked on the invitation that follows a crash — it additionally carries the crash reports macOS itself recorded for this app and its helpers (also listed above), which are machine-wide for the same reason and named in the same README; only this app's are collected, never another application's, though a report of ours still names the processes it was running alongside, and the zip always says what that search found even when the answer is nothing. The zip also carries a short send history of the bug reports previously generated on this machine — when each was generated and whether sending it succeeded — which is what makes a report that failed to send diagnosable at all. That history is machine-wide too, so it names the other projects you have filed reports from; it carries no document content, and the README names it the same way | Send uploads the zip to the bug-report intake: `openknowledge.ai` unless [`OK_BUG_REPORT_INTAKE_URL`](./configuration.mdx#environment-variables) points elsewhere. If the upload fails, Send falls back to a prefilled email draft to [email protected] that you send yourself, naming the zip to attach |+| In-app bug report | Only when you click **Send** in the desktop app's **Help → Report a bug…** dialog, or the `Cmd+Shift+D` / `Ctrl+Shift+D` shortcut that opens the same dialog — it builds a secret-redacted zip you can reveal and inspect first, and nothing is sent without that explicit click. The zip carries a picture of the app window unless you uncheck **Screenshot** in that dialog, and the preview there is the picture that would be sent. You can also attach up to three images by dropping them on the **What happened?** box, pasting them anywhere in the dialog (`Cmd+V` / `Ctrl+V`), or browsing with the paperclip in that box. Neither these images nor the screenshot are scanned or redacted, so review them before sending. A report started from an agent chat's **Report a problem with this chat…** also carries, unless you uncheck **This conversation**, the newest 4 MB of that chat's messages, tool calls, and their output, and the chat's metadata file, which names the chat's title, the project folder's path, the document the chat started from, and the agent and its settings. Known secrets are scrubbed from both. Images and other binary content in the chat, including images pasted into a message, are replaced by a note of their type and size, while text files attached to a message are included and scrubbed the same way. If the chat's messages can't be added, the review step says so and the report goes without the conversation. If only the metadata file can't be read, the report carries the messages without it, and the review step doesn't say so. A report reached through a surface you opened only to get to the reporter — the command palette, the Help popover, the Windows and Linux menu bar, or an agent chat's **Settings** menu — waits for that surface to close first, and carries no marker, because the row it would point at has already gone. Every other report you start yourself photographs the screen as it is, so an open menu or another person's document visible at the time is in the picture, and carries a marker drawn where your pointer was, since a screenshot never includes the cursor. No marker is drawn either if the pointer has not moved since the window loaded, or has since left the window. The invitation that appears on its own after a crash is the exception to all of this: it carries no picture at all. After a crash, the same dialog adds an **off-by-default** "Include crash dump" checkbox: a crash dump is a memory snapshot that can contain document content and can't be redacted, and it is only ever attached when you check that box. On macOS the zip also carries the update helper's install log (listed above), which is machine-wide rather than project-scoped; the zip's own README names it and says where it came from. At the **Detailed diagnostics** level — pre-checked on the invitation that follows a crash — it additionally carries the crash reports macOS itself recorded for this app and its helpers (also listed above), which are machine-wide for the same reason and named in the same README; only this app's are collected, never another application's, though a report of ours still names the processes it was running alongside, and the zip always says what that search found even when the answer is nothing. The zip also carries a short send history of the bug reports previously generated on this machine — when each was generated and whether sending it succeeded — which is what makes a report that failed to send diagnosable at all. That history is machine-wide too, so it names the other projects you have filed reports from; it carries no document content, and the README names it the same way | Send uploads the zip to the bug-report intake: `openknowledge.ai` unless [`OK_BUG_REPORT_INTAKE_URL`](./configuration.mdx#environment-variables) points elsewhere. If the upload fails, Send falls back to a prefilled email draft to [email protected] that you send yourself, naming the zip to attach || Uninstall feedback | Only if you answer the optional "Before you go" screen or prompt. The macOS desktop asks after you confirm removal, before the app quits and cleanup starts; feedback can be sent even if cleanup later fails. Interactive `ok uninstall` asks only after successful cleanup. Skipping sends nothing; CLI runs with `--yes`, `--json`, or non-interactive input never ask | `openknowledge.ai/api/feedback` — the reason you picked, your note, your email address if you gave one, plus the app version and platform. It files one ticket for the team; nothing from your notes is included || Feedback form | Only when you click **Send** in the feedback form, opened from **Help → Send feedback**, the command palette's **Send feedback** command, or the feedback card in the sidebar. Images you drop on, paste into, or attach to the message box go with it; like bug report images, they are not scanned or redacted | `openknowledge.ai/api/feedback` — your rating, the reasons you picked, your note, your email address if you gave one, up to three attached images, plus the app version and platform. In the desktop app the images upload first to the bug-report intake (`openknowledge.ai` unless [`OK_BUG_REPORT_INTAKE_URL`](./configuration.mdx#environment-variables) points elsewhere) and the feedback carries links to them. If an image upload fails, the images go inline with the feedback to `openknowledge.ai/api/feedback` instead || Semantic search embeddings | Only when you enable [semantic search](./configuration.mdx#semantic-search) **and** set a key — off by default | Your configured embeddings provider (OpenAI by default) |diff --git a/packages/app/src/components/ReportBugDialog.dom.test.tsx b/packages/app/src/components/ReportBugDialog.dom.test.tsxindex 1c69b4421..6a478d5ad 100644--- a/packages/app/src/components/ReportBugDialog.dom.test.tsx+++ b/packages/app/src/components/ReportBugDialog.dom.test.tsx@@ -75,6 +75,7 @@ type CreateRequest = {includeCrashDump?: boolean;includeScreenshot?: boolean;attachments?: { contentType: string; bytes: Uint8Array }[];+ agentChatThreadId?: string;};type SendRequest = OkBugReportSendInput;@@ -196,6 +197,7 @@ async function renderDialog(systemWide?: boolean;crashContext?: import('./ReportBugDialogBody').ReportBugCrashContext;crashInvite?: OkBugReportCrashDetectedEvent;+ agentChat?: { threadId: string };} = {},options: { statefulOpen?: boolean } = {},) {@@ -654,6 +656,116 @@ describe('ReportBugDialog', () => {]);});+ test('a report opened from an agent chat includes that conversation unless unchecked', async () => {+ const threadId = '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6';+ const log = installBridge();+ await renderDialog({ agentChat: { threadId } });++ const chat = screen.getByRole('checkbox', { name: 'This conversation' });+ expect(chat.getAttribute('aria-checked')).toBe('true');+ expect(+ document.getElementById(chat.getAttribute('aria-describedby') ?? '')?.textContent,+ ).toContain('the agent and its settings');+ await createReport();+ expect(log.createCalls[0]?.agentChatThreadId).toBe(threadId);++ cleanup();+ const second = installBridge();+ await renderDialog({ agentChat: { threadId } });+ await userEvent.click(screen.getByRole('checkbox', { name: 'This conversation' }));+ await createReport();+ expect(second.createCalls[0]).not.toHaveProperty('agentChatThreadId');+ });++ test('a report opened outside an agent chat offers no conversation to include', async () => {+ const log = installBridge();+ await renderDialog();++ expect(screen.queryByRole('checkbox', { name: 'This conversation' })).toBeNull();+ await createReport();+ expect(log.createCalls[0]).not.toHaveProperty('agentChatThreadId');+ });++ test('sending restores the conversation checkbox for the next report from the same chat', async () => {+ const threadId = '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6';+ const log = installBridge();+ const { reopen } = await renderDialog({ agentChat: { threadId } }, { statefulOpen: true });+ await userEvent.click(screen.getByRole('checkbox', { name: 'This conversation' }));+ await createReport();++ await userEvent.click(screen.getByRole('button', { name: 'Send report' }));+ await vi.waitFor(() => {+ expect(log.sendCalls).toHaveLength(1);+ });+ reopen();+ await screen.findByRole('dialog');++ expect(+ screen.getByRole('checkbox', { name: 'This conversation' }).getAttribute('aria-checked'),+ ).toBe('true');+ });++ test('a report carrying the conversation is not labeled as carrying an unredacted crash dump', async () => {+ const threadId = '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6';+ installBridge({+ create: () =>+ Promise.resolve({+ ...CREATE_OK,+ summary: {+ ...SUMMARY,+ files: [+ ...SUMMARY.files,+ `extra/agent-chat/${threadId}.ndjson`,+ `extra/agent-chat/${threadId}.meta.json`,+ ],+ },+ }),+ });+ await renderDialog({ agentChat: { threadId } });+ await createReport();++ expect(screen.getByText(/6\.8 MB · secrets redacted · 4 files/)).not.toBeNull();+ expect(screen.queryByText(/crash dump not redacted/)).toBeNull();+ expect(screen.queryByText("The conversation couldn't be added to this report.")).toBeNull();+ });++ test('a crash dump bundled beside the conversation still qualifies the redaction claim', async () => {+ const threadId = '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6';+ installBridge({+ create: () =>+ Promise.resolve({+ ...CREATE_OK,+ summary: {+ ...SUMMARY,+ files: [...SUMMARY.files, `extra/agent-chat/${threadId}.ndjson`, 'extra/renderer.dmp'],+ },+ }),+ });+ await renderDialog({ agentChat: { threadId } });+ await createReport();++ expect(+ screen.getByText(/6\.8 MB · secrets redacted · 4 files · crash dump not redacted/),+ ).not.toBeNull();+ });++ test('the review step says so when the conversation could not be added', async () => {+ installBridge();+ await renderDialog({ agentChat: { threadId: '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6' } });+ await createReport();++ expect(screen.getByText("The conversation couldn't be added to this report.")).not.toBeNull();+ });++ test('an unchecked conversation is not reported as missing from the review', async () => {+ installBridge();+ await renderDialog({ agentChat: { threadId: '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6' } });+ await userEvent.click(screen.getByRole('checkbox', { name: 'This conversation' }));+ await createReport();++ expect(screen.queryByText("The conversation couldn't be added to this report.")).toBeNull();+ });+test('unchecking Crash dump excludes the minidump from create', async () => {const log = installBridge();await renderDialog({ crashInvite: BOOT_INVITE });diff --git a/packages/app/src/components/ReportBugDialogBody.tsx b/packages/app/src/components/ReportBugDialogBody.tsxindex 9f9b4a6a1..5d65b0a4b 100644--- a/packages/app/src/components/ReportBugDialogBody.tsx+++ b/packages/app/src/components/ReportBugDialogBody.tsx@@ -6,7 +6,9 @@ import type {import {BUG_REPORT_SCREENSHOT_ZIP_ENTRY,formatRelativeAge,+ isBugReportAgentChatEntry,isBugReportAttachmentEntry,+ isBugReportCrashDumpEntry,} from '@inkeep/open-knowledge-core';import { Plural, Trans, useLingui } from '@lingui/react/macro';import {@@ -119,17 +121,12 @@ function crashInviteLines(invite: OkBugReportCrashDetectedEvent): string[] {type Phase =| { step: 'compose'; creating: boolean; createError: string | null }- | { step: 'review'; report: CreatedReport };+ | { step: 'review'; report: CreatedReport; conversationMissing: boolean };const COMPOSE_IDLE: Phase = { step: 'compose', creating: false, createError: null };function reportIncludesRawDump(report: CreatedReport): boolean {- return report.summary.files.some(- (file) =>- file.startsWith('extra/') &&- file !== BUG_REPORT_SCREENSHOT_ZIP_ENTRY &&- !isBugReportAttachmentEntry(file),- );+ return report.summary.files.some(isBugReportCrashDumpEntry);}function reportIncludesAttachments(report: CreatedReport): boolean {@@ -154,6 +151,7 @@ export interface ReportBugDialogProps {screenshot?: OkBugReportScreenshot | null;pointerMarked?: boolean;crashDumpAvailable?: boolean;+ agentChat?: { readonly threadId: string };}function ReportBugDialog({@@ -165,6 +163,7 @@ function ReportBugDialog({screenshot = null,pointerMarked = false,crashDumpAvailable: probedCrashDumpAvailable = false,+ agentChat,}: ReportBugDialogProps) {const { t } = useLingui();const isMacOS =@@ -176,6 +175,7 @@ function ReportBugDialog({crashInvite !== undefined ? crashInvite.minidumpAvailable === true : probedCrashDumpAvailable;const [includeDump, setIncludeDump] = useState(crashInvite?.minidumpAvailable === true);const [includeScreenshot, setIncludeScreenshot] = useState(true);+ const [includeChat, setIncludeChat] = useState(true);const [attachments, setAttachments] = useState<File[]>([]);const attachmentIntake = useImageAttachmentIntake({files: attachments,@@ -193,6 +193,8 @@ function ReportBugDialog({const detailedHintId = useId();const dumpId = useId();const dumpHintId = useId();+ const chatId = useId();+ const chatHintId = useId();const screenshotId = useId();const screenshotHintId = useId();const shareEmailId = useId();@@ -242,12 +244,14 @@ function ReportBugDialog({setPhase({ step: 'compose', creating: true, createError: null });const attachmentInputs = await toAttachmentInputs(attachments);if (opSeqRef.current !== seq) return;+ const conversationRequested = agentChat !== undefined && includeChat;const result = await bugReport.create({level: detailed ? 'full' : 'standard',note: composeNote(note, noteContextLines),...(crashDumpAvailable ? { includeCrashDump: includeDump } : {}),...(screenshot !== null ? { includeScreenshot } : {}),...(attachmentInputs.length > 0 ? { attachments: attachmentInputs } : {}),+ ...(conversationRequested ? { agentChatThreadId: agentChat.threadId } : {}),});if (opSeqRef.current !== seq) return;if (result.ok) {@@ -259,6 +263,8 @@ function ReportBugDialog({zipSizeBytes: result.zipSizeBytes,summary: result.summary,},+ conversationMissing:+ conversationRequested && !result.summary.files.some(isBugReportAgentChatEntry),});} else {setPhase({ step: 'compose', creating: false, createError: result.error });@@ -280,6 +286,7 @@ function ReportBugDialog({setDetailed(crashContext !== undefined || crashInvite !== undefined);setIncludeDump(crashInvite?.minidumpAvailable === true);setIncludeScreenshot(true);+ setIncludeChat(true);setAttachments([]);handleOpenChange(false);}@@ -566,6 +573,32 @@ function ReportBugDialog({</div></div>)}+ {agentChat !== undefined && (+ <div className="flex items-start gap-2.5">+ <Checkbox+ id={chatId}+ checked={includeChat}+ onCheckedChange={(value) => setIncludeChat(value === true)}+ aria-describedby={chatHintId}+ disabled={phase.creating}+ className="mt-0.5"+ />+ <div className="flex flex-col gap-0.5">+ <label htmlFor={chatId} className="text-sm font-medium">+ <Trans>This conversation</Trans>+ </label>+ <p id={chatHintId} className="text-1sm text-muted-foreground">+ <Trans>+ The chat's messages, tool calls, and their output, so we can see what the+ agent did, plus the chat's title, the project folder's path, the document it+ started from, and the agent and its settings. Images are replaced by their+ type and size, and attached text files are included. It can contain document+ content, so uncheck it if you'd rather not share it.+ </Trans>+ </p>+ </div>+ </div>+ )}<p className="text-xs text-muted-foreground"><Trans>Known secrets are scrubbed, but other sensitive information may remain. Review the@@ -647,6 +680,11 @@ function ReportBugDialog({rawDumpIncluded={reportIncludesRawDump(phase.report)}onReveal={revealZip}/>+ {phase.conversationMissing ? (+ <p className="text-xs text-muted-foreground">+ <Trans>The conversation couldn't be added to this report.</Trans>+ </p>+ ) : null}<div className="flex items-start gap-2 rounded-md border bg-muted/50 px-3 py-2.5 text-xs text-muted-foreground"><ShieldIconclassName="size-3.5 shrink-0 text-muted-foreground"diff --git a/packages/app/src/components/acp/ThreadView.dom.test.tsx b/packages/app/src/components/acp/ThreadView.dom.test.tsxindex 2c3eeabb0..fc5db3872 100644--- a/packages/app/src/components/acp/ThreadView.dom.test.tsx+++ b/packages/app/src/components/acp/ThreadView.dom.test.tsx@@ -28,7 +28,11 @@ import type {RenderedTerminal,ThreadRenderModel,} from '@/lib/acp/thread-event-model';-import { expectVisualClassTokensAbsent } from '@/test-utils/visual-contract';+import { installPointerPositionTracker } from '@/lib/pointer-position';+import {+ expectVisualClassTokens,+ expectVisualClassTokensAbsent,+} from '@/test-utils/visual-contract';import { MockComposerMentionInput } from './composer-mention-input.test-helper';i18n.load('en', {});@@ -6195,3 +6199,145 @@ describe('ThreadView hands the composer what to list first', () => {}});});++describe('ThreadView reporting a problem with the chat', () => {+ const withSettings = () =>+ makeInfo({+ status: 'ready',+ configOptions: [+ {+ id: 'model',+ name: 'Model',+ category: 'model',+ type: 'select',+ currentValue: 'opus',+ options: [+ { value: 'opus', name: 'Opus' },+ { value: 'sonnet', name: 'Sonnet' },+ ],+ },+ ],+ });+ const installReportBridge = () =>+ Object.assign(window, {+ okDesktop: {+ bugReport: {+ crashDumpAvailability: () => Promise.resolve({ available: false }),+ captureScreenshot: () => Promise.resolve(null),+ },+ },+ });++ test('the settings trigger keeps a muted label and chevron when it only opens the report', () => {+ installReportBridge();+ try {+ model = makeModel({ items: [], turnActive: false });+ render(<ThreadView info={makeInfo({ status: 'ready' })} />);+ const trigger = screen.getByTestId('agent-thread-settings');+ const label = within(trigger).getByText('Settings');+ const chevron = trigger.querySelector('svg');++ for (const part of [label, chevron]) {+ expectVisualClassTokens(part?.getAttribute('class'), ['text-muted-foreground']);+ expectVisualClassTokensAbsent(part?.getAttribute('class'), ['text-muted-foreground/50']);+ }+ expect(trigger.hasAttribute('aria-disabled')).toBe(false);+ } finally {+ Reflect.deleteProperty(window, 'okDesktop');+ }+ });++ test('the settings trigger dims fully when it opens nothing and not at all when it opens settings', () => {+ model = makeModel({ items: [], turnActive: false });+ const view = render(<ThreadView info={makeInfo({ status: 'ready' })} />);+ const disabled = screen.getByTestId('agent-thread-settings');+ for (const part of [within(disabled).getByText('Settings'), disabled.querySelector('svg')]) {+ expectVisualClassTokens(part?.getAttribute('class'), ['text-muted-foreground/50']);+ }+ expect(disabled.getAttribute('aria-disabled')).toBe('true');++ view.rerender(<ThreadView info={withSettings()} />);+ const normal = screen.getByTestId('agent-thread-settings');+ expectVisualClassTokensAbsent(normal.querySelector('svg')?.getAttribute('class'), [+ 'text-muted-foreground',+ 'text-muted-foreground/50',+ ]);+ expect(normal.hasAttribute('aria-disabled')).toBe(false);+ });++ test('the settings menu offers no report where reports cannot be sent', async () => {+ model = makeModel({ items: [], turnActive: false });+ render(<ThreadView info={withSettings()} />);+ await userEvent.click(screen.getByRole('button', { name: /^Agent settings/ }));+ await screen.findByRole('menu');+ expect(screen.queryByTestId('agent-thread-report-problem')).toBeNull();+ });++ test('a chat whose agent offers settings lists the report below them', async () => {+ installReportBridge();+ try {+ model = makeModel({ items: [], turnActive: false });+ render(<ThreadView info={withSettings()} />);+ await userEvent.click(screen.getByRole('button', { name: /^Agent settings/ }));+ const item = await screen.findByTestId('agent-thread-report-problem');+ expect(item.textContent).toBe('Report a problem with this chat…');+ } finally {+ Reflect.deleteProperty(window, 'okDesktop');+ }+ });++ test('a chat with no settings to adjust still opens a report that carries it', async () => {+ installReportBridge();+ try {+ model = makeModel({ items: [], turnActive: false });+ render(<ThreadView info={makeInfo({ status: 'ready' })} />);+ await userEvent.click(screen.getByRole('button', { name: /^Agent settings/ }));+ await userEvent.click(await screen.findByTestId('agent-thread-report-problem'));+ const chat = await screen.findByRole(+ 'checkbox',+ { name: 'This conversation' },+ { timeout: 15_000 },+ );+ expect(chat.getAttribute('aria-checked')).toBe('true');+ } finally {+ Reflect.deleteProperty(window, 'okDesktop');+ }+ }, 30_000);++ test('the screenshot waits for the settings menu to close and marks no row', async () => {+ const stopPointerTracking = installPointerPositionTracker();+ window.dispatchEvent(+ new PointerEvent('pointermove', { clientX: 240, clientY: 160, bubbles: true }),+ );+ let captures = 0;+ let markersAtCapture = -1;+ let menuAtCapture: boolean | null = null;+ Object.assign(window, {+ okDesktop: {+ bugReport: {+ crashDumpAvailability: () => Promise.resolve({ available: false }),+ captureScreenshot: () => {+ captures += 1;+ markersAtCapture = document.querySelectorAll('.ok-pointer-marker').length;+ menuAtCapture = screen.queryByTestId('agent-thread-settings-popover') !== null;+ return Promise.resolve(null);+ },+ },+ },+ });+ try {+ model = makeModel({ items: [], turnActive: false });+ render(<ThreadView info={makeInfo({ status: 'ready' })} />);+ await userEvent.click(screen.getByRole('button', { name: /^Agent settings/ }));+ await userEvent.click(await screen.findByTestId('agent-thread-report-problem'));+ await screen.findByRole('checkbox', { name: 'This conversation' }, { timeout: 15_000 });++ expect(captures).toBe(1);+ expect(markersAtCapture).toBe(0);+ expect(menuAtCapture).toBe(false);+ } finally {+ stopPointerTracking();+ Reflect.deleteProperty(window, 'okDesktop');+ }+ }, 30_000);+});diff --git a/packages/app/src/components/acp/ThreadView.tsx b/packages/app/src/components/acp/ThreadView.tsxindex 122b91cd7..1b61cdf3d 100644--- a/packages/app/src/components/acp/ThreadView.tsx+++ b/packages/app/src/components/acp/ThreadView.tsx@@ -45,6 +45,7 @@ import {Zap,} from 'lucide-react';import {+ type ComponentProps,Fragment,type ReactNode,type RefObject,@@ -83,6 +84,7 @@ import {requestTerminalLaunch,} from '@/components/handoff/terminal-launch-events';import { useOptionalPageList } from '@/components/PageListContext';+import { ReportBugDialog } from '@/components/ReportBugDialog';import { RotatingComposerPlaceholder } from '@/components/RotatingComposerPlaceholder';import { Badge } from '@/components/ui/badge';import { Button } from '@/components/ui/button';@@ -95,6 +97,7 @@ import {DropdownMenuLabel,DropdownMenuRadioGroup,DropdownMenuRadioItem,+ DropdownMenuSeparator,DropdownMenuSub,DropdownMenuSubContent,DropdownMenuSubTrigger,@@ -1712,11 +1715,13 @@ function AgentSettingsPopover({info,hasStartedWork,onNewChat,+ onReportProblem,triggerRef,}: {info: ThreadInfo;hasStartedWork: boolean;onNewChat: () => void;+ onReportProblem?: () => void;triggerRef?: RefObject<HTMLButtonElement | null>;}): ReactNode {const { i18n, t } = useLingui();@@ -1752,28 +1757,40 @@ function AgentSettingsPopover({const reason = settled? t`${info.agent.name} doesn't offer any settings to adjust`: t`${info.agent.name} hasn't reported its settings yet`;+ const tone: AgentSettingsTone = onReportProblem === undefined ? 'disabled' : 'muted';+ const trigger = (+ <AgentSettingsTrigger+ ref={triggerRef}+ label={t`Agent settings`}+ tone={tone}+ className="max-w-48 gap-1"+ aria-describedby={tone === 'disabled' ? reasonId : undefined}+ >+ <span className={cn('truncate', AGENT_SETTINGS_TONE_TEXT[tone])}>{t`Settings`}</span>+ </AgentSettingsTrigger>+ );+ if (onReportProblem !== undefined) {+ return (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>+ <DropdownMenuContent+ align="end"+ className="w-60"+ data-testid="agent-thread-settings-popover"+ >+ <DropdownMenuLabel className="font-normal text-muted-foreground">+ {reason}+ </DropdownMenuLabel>+ <ReportProblemItem onSelect={onReportProblem} />+ </DropdownMenuContent>+ </DropdownMenu>+ );+ }return (<Tooltip><TooltipTrigger asChild>- {}<span className="inline-flex cursor-not-allowed">- <Button- ref={triggerRef}- type="button"- variant="ghost"- className="h-7 max-w-48 gap-1 rounded-md pl-1.5 pr-1! text-xs"- aria-label={t`Agent settings`}- aria-disabled- aria-describedby={reasonId}- data-testid="agent-thread-settings"- >- <span className="truncate text-muted-foreground/50">{t`Settings`}</span>- <ChevronDown- className="size-3.5 text-muted-foreground/50"- data-icon="inline-end"- aria-hidden="true"- />- </Button>+ {trigger}<span id={reasonId} className="sr-only">{reason}</span>@@ -1828,13 +1845,10 @@ function AgentSettingsPopover({<Tooltip><TooltipTrigger asChild><DropdownMenuTrigger asChild>- <Button+ <AgentSettingsTriggerref={triggerRef}- type="button"- variant="ghost"- className="h-7 min-w-0 max-w-sm shrink gap-1.5 rounded-md pl-1.5 pr-1! text-xs"- aria-label={settingsLabel}- data-testid="agent-thread-settings"+ label={settingsLabel}+ className="min-w-0 max-w-sm shrink gap-1.5"><span className="min-w-0 truncate">{triggerText}</span>{fastOn ? (@@ -1855,8 +1869,7 @@ function AgentSettingsPopover({{t`Read-only allowed`}</span>) : null}- <ChevronDown className="size-3.5" data-icon="inline-end" aria-hidden="true" />- </Button>+ </AgentSettingsTrigger></DropdownMenuTrigger></TooltipTrigger><TooltipContent side="bottom" aria-label={t`Agent settings`}>@@ -1945,11 +1958,61 @@ function AgentSettingsPopover({</span></DropdownMenuItem>) : null}+ {onReportProblem !== undefined ? <ReportProblemItem onSelect={onReportProblem} /> : null}</DropdownMenuContent></DropdownMenu>);}+type AgentSettingsTone = 'normal' | 'muted' | 'disabled';++const AGENT_SETTINGS_TONE_TEXT: Record<AgentSettingsTone, string | undefined> = {+ normal: undefined,+ muted: 'text-muted-foreground',+ disabled: 'text-muted-foreground/50',+};++function AgentSettingsTrigger({+ ref,+ label,+ tone = 'normal',+ className,+ children,+ ...buttonProps+}: ComponentProps<typeof Button> & { label: string; tone?: AgentSettingsTone }): ReactNode {+ return (+ <Button+ {...buttonProps}+ ref={ref}+ type="button"+ variant="ghost"+ className={cn('h-7 rounded-md pl-1.5 pr-1! text-xs', className)}+ aria-label={label}+ aria-disabled={tone === 'disabled' || undefined}+ data-testid="agent-thread-settings"+ >+ {children}+ <ChevronDown+ className={cn('size-3.5', AGENT_SETTINGS_TONE_TEXT[tone])}+ data-icon="inline-end"+ aria-hidden="true"+ />+ </Button>+ );+}++function ReportProblemItem({ onSelect }: { onSelect: () => void }): ReactNode {+ const { t } = useLingui();+ return (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem onSelect={onSelect} data-testid="agent-thread-report-problem">+ {t`Report a problem with this chat…`}+ </DropdownMenuItem>+ </>+ );+}+function ContextWindowSub({choices,currentTokens,@@ -4320,6 +4383,8 @@ function ThreadComposer({onIngestAllFiles: (files: readonly File[]) => Promise<void>;onRemovePendingAttachment: (index: number) => void;}): ReactNode {+ const [reportOpen, setReportOpen] = useState(false);+ const canReportProblem = typeof window !== 'undefined' && window.okDesktop != null;const { t, i18n } = useLingui();const agentName = agentDisplayName(info.agent.name);@@ -4482,8 +4547,17 @@ function ThreadComposer({info={info}hasStartedWork={hasStartedWork}onNewChat={onNewChat}+ {...(canReportProblem ? { onReportProblem: () => setReportOpen(true) } : {})}triggerRef={settingsTriggerRef}/>+ {canReportProblem ? (+ <ReportBugDialog+ open={reportOpen}+ onOpenChange={setReportOpen}+ agentChat={{ threadId: info.threadId }}+ launcherBorne+ />+ ) : null}<div className="ml-auto flex items-center gap-1.5">{usagePercent !== null && usage?.used !== undefined && usage?.size !== undefined ? (<ContextUsageRing used={usage.used} size={usage.size} percent={usagePercent} />diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.jsonindex a45902519..a7a34db83 100644--- a/packages/app/src/locales/ar/messages.json+++ b/packages/app/src/locales/ar/messages.json@@ -3067,6 +3067,7 @@"U7Iesw": [["seconds"], " ثانية"],"U88xbi": ["فشل إنشاء ملف المخطط"],"U8CD-l": ["نسخ المسار الكامل، لا مساحة عمل"],+ "U8novP": ["هذه المحادثة"],"UBKdn5": ["اسمح لمحادثات الوكلاء باستخدام متصفح"],"UBv8UK": ["حذف نهائي"],"UDFrWm": ["يجري التحقق من الاتصال بـ GitHub..."],@@ -5301,6 +5302,7 @@"لا يحتوي هذا الخادم على مصادقة مدمجة. أي شخص يمكنه الوصول إلى النفق يحصل على تحكم كامل في قاعدة المعرفة هذه. ضع بوابة مصادقة أمامه، مثل شبكة Tailscale خاصة أو وكيل عكسي مزوّد بمصادقة."],"n4vt3Q": ["تنزيل التطبيق"],+ "n57RjG": ["الإبلاغ عن مشكلة في هذه المحادثة…"],"n5Vy3l": ["فُتح على الفرع ", ["branch"]],"n5n_vi": ["مستودع خاص"],"n6hXUm": [@@ -5321,12 +5323,16 @@"nNYV3Y": ["و", ["remaining"], " أخرى"],"nOEDQs": ["فشل تحديث وضع المزامنة — ", ["detail"]],"nP-KFo": ["محادثة ", ["0"], " جديدة"],+ "nRX05G": ["تعذّرت إضافة المحادثة إلى هذا التقرير."],"nTM8ab": ["امنحها اسمًا قبل تعديل ألوانها."],"nTwL53": ["افتح مستندًا لمشاركة رابطه."],"nWMRxa": ["إلغاء التثبيت"],"nWS2gQ": ["منشور بواسطة ", ["publisher"]],"nWv1ja": ["أدِر الملفات المخفية من الإعدادات ← أنماط التجاهل."],"nXHOFU": ["تعذّر التحديث من ", ["0"], ": ", ["1"]],+ "nXK5bR": [+ "رسائل المحادثة واستدعاءات الأدوات ومخرجاتها، لنتمكن من رؤية ما فعله الوكيل، بالإضافة إلى عنوانها ومسار مجلد المشروع والمستند الذي بدأت منه والوكيل وإعداداته. تُستبدل الصور بنوعها وحجمها، وتُضمَّن الملفات النصية المرفقة. قد تحتوي على محتوى المستندات، لذا ألغِ تحديدها إن كنت تفضّل عدم مشاركتها."+ ],"nYeBmY": ["قبل ", ["hours"], " ساعة"],"n_I-da": ["عرض المصدر"],"nbLQ_9": ["اختر إلى أين تُرسل هذه التعليقات"],diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.poindex fef970b9a..a128d452c 100644--- a/packages/app/src/locales/ar/messages.po+++ b/packages/app/src/locales/ar/messages.po@@ -12059,6 +12059,10 @@ msgstr "الإبلاغ عن علة"msgid "Report a bug…"msgstr "الإبلاغ عن علة…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "الإبلاغ عن مشكلة في هذه المحادثة…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "المتصفح غير متاح في هذه المحادثة لأنه تmsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "المتصفح غير متاح في هذه المحادثة لأنه لم يُعثر على تثبيت لـ Node.js يمكنه تشغيله. ثبّت Node.js، ثم ابدأ محادثة جديدة."+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "رسائل المحادثة واستدعاءات الأدوات ومخرجاتها، لنتمكن من رؤية ما فعله الوكيل، بالإضافة إلى عنوانها ومسار مجلد المشروع والمستند الذي بدأت منه والوكيل وإعداداته. تُستبدل الصور بنوعها وحجمها، وتُضمَّن الملفات النصية المرفقة. قد تحتوي على محتوى المستندات، لذا ألغِ تحديدها إن كنت تفضّل عدم مشاركتها."+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "لم يفتح تطبيق Claude Desktop الملف. هل هو مثبَّت؟ ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "تعذّرت إضافة المحادثة إلى هذا التقرير."+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "النسخة من “{name}” المحفوظة في {scopeLabel} هي نسخة مكررة زائدة: تم التحقق من أن الأصل لم يتغير. احذف تلك النسخة ثم أعد محاولة النقل."@@ -15051,6 +15063,10 @@ msgstr "تمت إزالة هذا المكوّن."msgid "This composer doesn't accept attachments."msgstr "لا يمكن إرفاق الملفات هنا."+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "هذه المحادثة"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "تحتفظ هذه المحادثة بالنافذة التي بدأت بها. يمكن لمحادثة جديدة استخدام نافذة أخرى."diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.jsonindex f7f3413a8..76f947ba1 100644--- a/packages/app/src/locales/bn/messages.json+++ b/packages/app/src/locales/bn/messages.json@@ -2594,6 +2594,7 @@"U7Iesw": [["seconds"], " সেকেন্ড"],"U88xbi": ["স্কিমা ফাইল তৈরি করতে ব্যর্থ"],"U8CD-l": ["পূর্ণ পথ কপি করুন, কোনো ওয়ার্কস্পেস নেই"],+ "U8novP": ["এই কথোপকথন"],"UBKdn5": ["এজেন্ট চ্যাটকে ব্রাউজার ব্যবহার করতে দিন"],"UBv8UK": ["স্থায়ীভাবে মুছুন"],"UDFrWm": ["GitHub সংযোগ পরীক্ষা করা হচ্ছে…"],@@ -4475,6 +4476,7 @@"এই সার্ভারে কোনো অন্তর্নির্মিত প্রমাণীকরণ নেই। যে কেউ টানেলে পৌঁছাতে পারে সে এই নলেজ বেসের পূর্ণ নিয়ন্ত্রণ পায়। এর সামনে একটি প্রমাণীকরণকারী গেট রাখুন, যেমন একটি প্রাইভেট Tailscale নেটওয়ার্ক বা প্রমাণীকরণসহ একটি রিভার্স প্রক্সি।"],"n4vt3Q": ["অ্যাপ ডাউনলোড করুন"],+ "n57RjG": ["এই চ্যাটের সমস্যা জানান…"],"n5Vy3l": [["branch"], " ব্রাঞ্চে খোলা হয়েছে"],"n5n_vi": ["ব্যক্তিগত রিপোজিটরি"],"n6hXUm": [@@ -4495,12 +4497,16 @@"nNYV3Y": ["এবং আরও ", ["remaining"], "টি"],"nOEDQs": ["সিঙ্ক মোড হালনাগাদ করতে ব্যর্থ — ", ["detail"]],"nP-KFo": ["নতুন ", ["0"], " আলাপ"],+ "nRX05G": ["কথোপকথনটি এই রিপোর্টে যোগ করা যায়নি।"],"nTM8ab": ["রং সম্পাদনা করার আগে এটিকে একটি নাম দিন।"],"nTwL53": ["কোনো নথির URL ভাগ করতে সেটি খুলুন।"],"nWMRxa": ["পিন সরান"],"nWS2gQ": [["publisher"], " প্রকাশ করেছে"],"nWv1ja": ["লুকানো ফাইল Settings → Ignore patterns-এ সামলান।"],"nXHOFU": [["0"], " থেকে আপডেট করা যায়নি: ", ["1"]],+ "nXK5bR": [+ "চ্যাটের বার্তা, টুল কল এবং সেগুলোর আউটপুট, যাতে আমরা দেখতে পারি এজেন্ট কী করেছে, সেই সঙ্গে এর শিরোনাম, প্রকল্পের ফোল্ডারের পথ, যে নথি থেকে এটি শুরু হয়েছিল এবং এজেন্ট ও তার সেটিং। ছবির জায়গায় সেগুলোর ধরন ও আকার দেওয়া হয়, আর সংযুক্ত টেক্সট ফাইল অন্তর্ভুক্ত থাকে। এতে নথির বিষয়বস্তু থাকতে পারে, তাই ভাগ করতে না চাইলে এটি অচিহ্নিত করে দিন।"+ ],"nYeBmY": [["hours"], " ঘণ্টা আগে"],"n_I-da": ["উৎস দেখুন"],"nbLQ_9": ["এই মন্তব্যগুলো কোথায় পাঠাবেন তা বাছুন"],diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.poindex 0c7f4e3bf..3e195bcf5 100644--- a/packages/app/src/locales/bn/messages.po+++ b/packages/app/src/locales/bn/messages.po@@ -12055,6 +12055,10 @@ msgstr "একটি বাগ জানান"msgid "Report a bug…"msgstr "একটি বাগ জানান…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "এই চ্যাটের সমস্যা জানান…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14541,10 +14545,18 @@ msgstr "এই চ্যাটে ব্রাউজার উপলভ্যmsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "এই চ্যাটে ব্রাউজার উপলভ্য নয়, কারণ এটি চালু করতে পারে এমন কোনো Node.js ইনস্টল পাওয়া যায়নি। Node.js ইনস্টল করুন, তারপর একটি নতুন চ্যাট শুরু করুন।"+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "চ্যাটের বার্তা, টুল কল এবং সেগুলোর আউটপুট, যাতে আমরা দেখতে পারি এজেন্ট কী করেছে, সেই সঙ্গে এর শিরোনাম, প্রকল্পের ফোল্ডারের পথ, যে নথি থেকে এটি শুরু হয়েছিল এবং এজেন্ট ও তার সেটিং। ছবির জায়গায় সেগুলোর ধরন ও আকার দেওয়া হয়, আর সংযুক্ত টেক্সট ফাইল অন্তর্ভুক্ত থাকে। এতে নথির বিষয়বস্তু থাকতে পারে, তাই ভাগ করতে না চাইলে এটি অচিহ্নিত করে দিন।"+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "Claude Desktop App ফাইলটি খোলেনি। সেটি কি ইনস্টল করা আছে? ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "কথোপকথনটি এই রিপোর্টে যোগ করা যায়নি।"+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "{scopeLabel}-এ রাখা “{name}”-এর কপিটি একটি অপ্রয়োজনীয় নকল: যাচাই করে দেখা গেছে মূলটি অপরিবর্তিত আছে। ওই কপিটি মুছে ফেলুন, তারপর সরানোর কাজটি আবার চেষ্টা করুন।"@@ -15047,6 +15059,10 @@ msgstr "এই উপাদানটি সরানো হয়েছে।"msgid "This composer doesn't accept attachments."msgstr "এখানে ফাইল যুক্ত করা যায় না।"+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "এই কথোপকথন"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "এই কথোপকথন যে উইন্ডো দিয়ে শুরু হয়েছিল সেটিই রাখে। নতুন কথোপকথনে অন্য উইন্ডো ব্যবহার করা যায়।"diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.jsonindex 2d1275d5f..9d26945dc 100644--- a/packages/app/src/locales/en/messages.json+++ b/packages/app/src/locales/en/messages.json@@ -2673,6 +2673,7 @@"U7Iesw": [["seconds"], " seconds"],"U88xbi": ["Failed to create the schema file"],"U8CD-l": ["Copy full path, No workspace"],+ "U8novP": ["This conversation"],"UBKdn5": ["Let agent chats use a browser"],"UBv8UK": ["Delete Permanently"],"UDFrWm": ["Checking GitHub connection..."],@@ -4624,6 +4625,7 @@"This server has no built-in authentication. Anyone who can reach the tunnel gets full control of this knowledge base. Put an authenticating gate in front, such as a private Tailscale network or a reverse proxy with authentication."],"n4vt3Q": ["Download app"],+ "n57RjG": ["Report a problem with this chat…"],"n5Vy3l": ["Opened on branch ", ["branch"]],"n5n_vi": ["Private repository"],"n6hXUm": [@@ -4644,12 +4646,16 @@"nNYV3Y": ["and ", ["remaining"], " more"],"nOEDQs": ["Failed to update sync mode — ", ["detail"]],"nP-KFo": ["New ", ["0"], " chat"],+ "nRX05G": ["The conversation couldn't be added to this report."],"nTM8ab": ["Give it a name before editing its colors."],"nTwL53": ["Open a doc to share its URL."],"nWMRxa": ["Unpin"],"nWS2gQ": ["Published by ", ["publisher"]],"nWv1ja": ["Manage hidden files in Settings → Ignore patterns."],"nXHOFU": ["Couldn't update from ", ["0"], ": ", ["1"]],+ "nXK5bR": [+ "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+ ],"nYeBmY": [["hours"], "h ago"],"n_I-da": ["View source"],"nbLQ_9": ["Choose where to send these comments"],diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 57a36e22e..94b1ed2f7 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -12059,6 +12059,10 @@ msgstr "Report a bug"msgid "Report a bug…"msgstr "Report a bug…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "Report a problem with this chat…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "The browser isn't available in this chat because it couldn't be set up.msgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "The Claude Desktop App didn't open the file. Is it installed? ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "The conversation couldn't be added to this report."+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."@@ -15051,6 +15063,10 @@ msgstr "This component was removed."msgid "This composer doesn't accept attachments."msgstr "This composer doesn't accept attachments."+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "This conversation"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "This conversation keeps the window it started with. A new chat can use a different one."diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.jsonindex bedb90d5b..828ef3f9b 100644--- a/packages/app/src/locales/es/messages.json+++ b/packages/app/src/locales/es/messages.json@@ -3079,6 +3079,7 @@"U7Iesw": [["seconds"], " segundos"],"U88xbi": ["No se pudo crear el archivo de esquema"],"U8CD-l": ["Copiar ruta completa, sin espacio de trabajo"],+ "U8novP": ["Esta conversación"],"UBKdn5": ["Permitir que los chats con agentes usen un navegador"],"UBv8UK": ["Eliminar definitivamente"],"UDFrWm": ["Comprobando la conexión con GitHub..."],@@ -5350,6 +5351,7 @@"Este servidor no tiene autenticación integrada. Cualquiera que pueda alcanzar el túnel obtiene control total de esta base de conocimiento. Coloca delante una barrera de autenticación, como una red privada de Tailscale o un proxy inverso con autenticación."],"n4vt3Q": ["Descargar la aplicación"],+ "n57RjG": ["Informar de un problema con este chat…"],"n5Vy3l": ["Abierto en la rama ", ["branch"]],"n5n_vi": ["Repositorio privado"],"n6hXUm": [@@ -5370,12 +5372,16 @@"nNYV3Y": ["y ", ["remaining"], " más"],"nOEDQs": ["No se pudo actualizar el modo de sincronización — ", ["detail"]],"nP-KFo": ["Nuevo chat de ", ["0"]],+ "nRX05G": ["No se pudo añadir la conversación a este informe."],"nTM8ab": ["Ponle un nombre antes de editar sus colores."],"nTwL53": ["Abre un documento para compartir su URL."],"nWMRxa": ["Dejar de fijar"],"nWS2gQ": ["Publicado por ", ["publisher"]],"nWv1ja": ["Gestiona los archivos ocultos en Ajustes → Patrones de exclusión."],"nXHOFU": ["No se pudo actualizar desde ", ["0"], ": ", ["1"]],+ "nXK5bR": [+ "Los mensajes del chat, las llamadas a herramientas y su resultado, para que veamos qué hizo el agente, además del título del chat, la ruta de la carpeta del proyecto, el documento desde el que empezó y el agente con sus ajustes. Las imágenes se sustituyen por su tipo y tamaño, y se incluyen los archivos de texto adjuntos. Puede contener contenido de documentos, así que desmárcala si prefieres no compartirla."+ ],"nYeBmY": ["hace ", ["hours"], " h"],"n_I-da": ["Ver la fuente"],"nbLQ_9": ["Elige a dónde enviar estos comentarios"],diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.poindex d46903a7e..a1a695e9e 100644--- a/packages/app/src/locales/es/messages.po+++ b/packages/app/src/locales/es/messages.po@@ -12059,6 +12059,10 @@ msgstr "Informar de un error"msgid "Report a bug…"msgstr "Informar de un error…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "Informar de un problema con este chat…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "El navegador no está disponible en este chat porque no se pudo configurmsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "El navegador no está disponible en este chat porque no se encontró ninguna instalación de Node.js que pueda iniciarlo. Instala Node.js y luego inicia un chat nuevo."+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "Los mensajes del chat, las llamadas a herramientas y su resultado, para que veamos qué hizo el agente, además del título del chat, la ruta de la carpeta del proyecto, el documento desde el que empezó y el agente con sus ajustes. Las imágenes se sustituyen por su tipo y tamaño, y se incluyen los archivos de texto adjuntos. Puede contener contenido de documentos, así que desmárcala si prefieres no compartirla."+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "La aplicación Claude Desktop no abrió el archivo. ¿Está instalada? ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "No se pudo añadir la conversación a este informe."+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "La copia de «{name}» conservada en {scopeLabel} es un duplicado redundante: se verificó que el original no cambió. Elimina esa copia y vuelve a intentar el movimiento."@@ -15051,6 +15063,10 @@ msgstr "Este componente se ha eliminado."msgid "This composer doesn't accept attachments."msgstr "Aquí no se pueden adjuntar archivos."+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "Esta conversación"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "Esta conversacion mantiene la ventana con la que empezo. Un chat nuevo puede usar otra."diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.jsonindex c582f46c6..cbadde2ec 100644--- a/packages/app/src/locales/fr/messages.json+++ b/packages/app/src/locales/fr/messages.json@@ -3127,6 +3127,7 @@"U7Iesw": [["seconds"], " secondes"],"U88xbi": ["Échec de la création du fichier de schéma"],"U8CD-l": ["Copier le chemin complet, sans espace de travail"],+ "U8novP": ["Cette conversation"],"UBKdn5": ["Laisser les chats d'agents utiliser un navigateur"],"UBv8UK": ["Supprimer définitivement"],"UDFrWm": ["Vérification de la connexion GitHub…"],@@ -5395,6 +5396,7 @@"Ce serveur n’a pas d’authentification intégrée. Toute personne pouvant atteindre le tunnel obtient un contrôle total de cette base de connaissances. Placez devant lui une barrière d’authentification, comme un réseau Tailscale privé ou un proxy inverse avec authentification."],"n4vt3Q": ["Télécharger l’application"],+ "n57RjG": ["Signaler un problème avec cette conversation…"],"n5Vy3l": ["Ouvert sur la branche ", ["branch"]],"n5n_vi": ["Dépôt privé"],"n6hXUm": [@@ -5415,12 +5417,16 @@"nNYV3Y": ["et ", ["remaining"], " de plus"],"nOEDQs": ["Échec de la mise à jour du mode de synchronisation — ", ["detail"]],"nP-KFo": ["Nouvelle discussion ", ["0"]],+ "nRX05G": ["Impossible d'ajouter la conversation à ce rapport."],"nTM8ab": ["Donnez-lui un nom avant de modifier ses couleurs."],"nTwL53": ["Ouvrez un document pour partager son URL."],"nWMRxa": ["Détacher"],"nWS2gQ": ["Publié par ", ["publisher"]],"nWv1ja": ["Gérez les fichiers masqués dans Paramètres → Motifs d'exclusion."],"nXHOFU": ["Impossible de mettre à jour depuis ", ["0"], " : ", ["1"]],+ "nXK5bR": [+ "Les messages de la conversation, les appels d'outils et leurs résultats, pour que nous puissions voir ce qu'a fait l'agent, ainsi que le titre de la conversation, le chemin du dossier de projet, le document depuis lequel elle a commencé et l'agent avec ses paramètres. Les images sont remplacées par leur type et leur taille, et les fichiers texte joints sont inclus. Elle peut contenir du contenu de document, alors décochez-la si vous préférez ne pas la partager."+ ],"nYeBmY": ["il y a ", ["hours"], " h"],"n_I-da": ["Voir la source"],"nbLQ_9": ["Choisissez où envoyer ces commentaires"],diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.poindex 785308dc4..8a49b0bda 100644--- a/packages/app/src/locales/fr/messages.po+++ b/packages/app/src/locales/fr/messages.po@@ -12059,6 +12059,10 @@ msgstr "Signaler un bug"msgid "Report a bug…"msgstr "Signaler un bug…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "Signaler un problème avec cette conversation…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "Le navigateur n'est pas disponible dans ce chat, car il n'a pas pu êtremsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "Le navigateur n'est pas disponible dans ce chat, car aucune installation de Node.js capable de le lancer n'a été trouvée. Installez Node.js, puis démarrez un nouveau chat."+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "Les messages de la conversation, les appels d'outils et leurs résultats, pour que nous puissions voir ce qu'a fait l'agent, ainsi que le titre de la conversation, le chemin du dossier de projet, le document depuis lequel elle a commencé et l'agent avec ses paramètres. Les images sont remplacées par leur type et leur taille, et les fichiers texte joints sont inclus. Elle peut contenir du contenu de document, alors décochez-la si vous préférez ne pas la partager."+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "L'application Claude Desktop n'a pas ouvert le fichier. Est-elle installée ? ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "Impossible d'ajouter la conversation à ce rapport."+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "La copie de « {name} » conservée dans {scopeLabel} est un doublon redondant : l'original a été vérifié comme inchangé. Supprimez cette copie, puis réessayez le déplacement."@@ -15051,6 +15063,10 @@ msgstr "Ce composant a été supprimé."msgid "This composer doesn't accept attachments."msgstr "Impossible de joindre des fichiers ici."+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "Cette conversation"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "Cette conversation garde la fenetre avec laquelle elle a commence. Une nouvelle conversation peut en utiliser une autre."diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.jsonindex 93fc5ffec..19d7dcfe6 100644--- a/packages/app/src/locales/hi/messages.json+++ b/packages/app/src/locales/hi/messages.json@@ -2586,6 +2586,7 @@"U7Iesw": [["seconds"], " सेकंड"],"U88xbi": ["स्कीमा फ़ाइल बनाने में विफल"],"U8CD-l": ["पूरा पथ कॉपी करें, कोई कार्यक्षेत्र नहीं"],+ "U8novP": ["यह बातचीत"],"UBKdn5": ["एजेंट चैट को ब्राउज़र इस्तेमाल करने दें"],"UBv8UK": ["स्थायी रूप से हटाएँ"],"UDFrWm": ["GitHub कनेक्शन जाँचा जा रहा है…"],@@ -4467,6 +4468,7 @@"इस सर्वर में कोई बिल्ट-इन प्रमाणीकरण नहीं है। जो कोई भी टनल तक पहुँच सकता है उसे इस नॉलेज बेस का पूरा नियंत्रण मिल जाता है। इसके सामने एक प्रमाणीकरण गेट लगाएँ, जैसे कोई निजी Tailscale नेटवर्क या प्रमाणीकरण वाला रिवर्स प्रॉक्सी।"],"n4vt3Q": ["ऐप डाउनलोड करें"],+ "n57RjG": ["इस चैट की समस्या की रिपोर्ट करें…"],"n5Vy3l": ["ब्रांच ", ["branch"], " पर खोला गया"],"n5n_vi": ["निजी रिपॉज़िटरी"],"n6hXUm": [@@ -4487,12 +4489,16 @@"nNYV3Y": ["और ", ["remaining"], " अन्य"],"nOEDQs": ["सिंक मोड अपडेट करने में विफल — ", ["detail"]],"nP-KFo": ["नई ", ["0"], " चैट"],+ "nRX05G": ["बातचीत को इस रिपोर्ट में नहीं जोड़ा जा सका।"],"nTM8ab": ["इसके रंग संपादित करने से पहले इसे नाम दें।"],"nTwL53": ["किसी दस्तावेज़ का URL साझा करने के लिए उसे खोलें।"],"nWMRxa": ["पिन हटाएँ"],"nWS2gQ": [["publisher"], " द्वारा प्रकाशित"],"nWv1ja": ["छिपी हुई फ़ाइलें Settings → Ignore patterns में सँभालें।"],"nXHOFU": [["0"], " से अपडेट नहीं किया जा सका: ", ["1"]],+ "nXK5bR": [+ "चैट के संदेश, टूल कॉल और उनका आउटपुट, ताकि हम देख सकें कि एजेंट ने क्या किया, साथ ही चैट का शीर्षक, प्रोजेक्ट फ़ोल्डर का पथ, वह दस्तावेज़ जिससे यह शुरू हुई, और एजेंट व उसकी सेटिंग। चित्रों की जगह उनका प्रकार और आकार दिया जाता है, और संलग्न टेक्स्ट फ़ाइलें शामिल की जाती हैं। इसमें दस्तावेज़ की सामग्री हो सकती है, इसलिए यदि आप इसे साझा नहीं करना चाहते तो इसे अनचेक कर दें।"+ ],"nYeBmY": [["hours"], " घंटे पहले"],"n_I-da": ["स्रोत देखें"],"nbLQ_9": ["चुनें कि ये टिप्पणियाँ कहाँ भेजनी हैं"],diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.poindex 17750b690..29151b04d 100644--- a/packages/app/src/locales/hi/messages.po+++ b/packages/app/src/locales/hi/messages.po@@ -12055,6 +12055,10 @@ msgstr "बग की रिपोर्ट करें"msgid "Report a bug…"msgstr "बग की रिपोर्ट करें…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "इस चैट की समस्या की रिपोर्ट करें…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14541,10 +14545,18 @@ msgstr "इस चैट में ब्राउज़र उपलब्धmsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "इस चैट में ब्राउज़र उपलब्ध नहीं है, क्योंकि इसे शुरू कर सकने वाला कोई Node.js इंस्टॉलेशन नहीं मिला। Node.js इंस्टॉल करें, फिर नई चैट शुरू करें।"+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "चैट के संदेश, टूल कॉल और उनका आउटपुट, ताकि हम देख सकें कि एजेंट ने क्या किया, साथ ही चैट का शीर्षक, प्रोजेक्ट फ़ोल्डर का पथ, वह दस्तावेज़ जिससे यह शुरू हुई, और एजेंट व उसकी सेटिंग। चित्रों की जगह उनका प्रकार और आकार दिया जाता है, और संलग्न टेक्स्ट फ़ाइलें शामिल की जाती हैं। इसमें दस्तावेज़ की सामग्री हो सकती है, इसलिए यदि आप इसे साझा नहीं करना चाहते तो इसे अनचेक कर दें।"+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "Claude Desktop App ने फ़ाइल नहीं खोली। क्या वह इंस्टॉल है? ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "बातचीत को इस रिपोर्ट में नहीं जोड़ा जा सका।"+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "{scopeLabel} में रखी गई “{name}” की कॉपी एक ग़ैरज़रूरी नक़ल है: जाँच में मूल अपरिवर्तित मिला। उस कॉपी को हटाएँ, फिर मूव दोबारा आज़माएँ।"@@ -15047,6 +15059,10 @@ msgstr "यह घटक हटा दिया गया है।"msgid "This composer doesn't accept attachments."msgstr "यहाँ फ़ाइलें अटैच नहीं की जा सकतीं।"+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "यह बातचीत"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "यह बातचीत उसी विंडो के साथ चलती रहेगी जिससे शुरू हुई थी। नई बातचीत में दूसरी विंडो चुनी जा सकती है।"diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.jsonindex 3222b3f9e..0de32d016 100644--- a/packages/app/src/locales/id/messages.json+++ b/packages/app/src/locales/id/messages.json@@ -2682,6 +2682,7 @@"U7Iesw": [["seconds"], " detik"],"U88xbi": ["Gagal membuat berkas skema"],"U8CD-l": ["Salin jalur lengkap, tanpa ruang kerja"],+ "U8novP": ["Percakapan ini"],"UBKdn5": ["Izinkan obrolan agen memakai browser"],"UBv8UK": ["Hapus Permanen"],"UDFrWm": ["Memeriksa koneksi GitHub..."],@@ -4645,6 +4646,7 @@"Server ini tidak memiliki autentikasi bawaan. Siapa pun yang dapat menjangkau tunnel mendapatkan kendali penuh atas basis pengetahuan ini. Pasang gerbang autentikasi di depannya, seperti jaringan Tailscale pribadi atau reverse proxy dengan autentikasi."],"n4vt3Q": ["Unduh aplikasi"],+ "n57RjG": ["Laporkan masalah dengan chat ini…"],"n5Vy3l": ["Dibuka di cabang ", ["branch"]],"n5n_vi": ["Repositori pribadi"],"n6hXUm": [@@ -4665,12 +4667,16 @@"nNYV3Y": ["dan ", ["remaining"], " lagi"],"nOEDQs": ["Gagal memperbarui mode sinkronisasi — ", ["detail"]],"nP-KFo": ["Obrolan ", ["0"], " baru"],+ "nRX05G": ["Percakapan tidak dapat ditambahkan ke laporan ini."],"nTM8ab": ["Beri nama sebelum menyunting warnanya."],"nTwL53": ["Buka sebuah dokumen untuk membagikan URL-nya."],"nWMRxa": ["Lepas sematan"],"nWS2gQ": ["Diterbitkan oleh ", ["publisher"]],"nWv1ja": ["Kelola berkas tersembunyi di Pengaturan → Pola abaikan."],"nXHOFU": ["Tidak dapat memperbarui dari ", ["0"], ": ", ["1"]],+ "nXK5bR": [+ "Pesan chat, panggilan alat, dan hasilnya, agar kami bisa melihat apa yang dilakukan agen, beserta judul chat, jalur folder proyek, dokumen tempat chat ini dimulai, serta agen dan pengaturannya. Gambar diganti dengan jenis dan ukurannya, dan berkas teks yang dilampirkan disertakan. Isinya bisa memuat isi dokumen, jadi hapus centangnya jika Anda tidak ingin membagikannya."+ ],"nYeBmY": [["hours"], " j lalu"],"n_I-da": ["Lihat sumber"],"nbLQ_9": ["Pilih ke mana komentar ini dikirim"],diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.poindex 66d938bdf..57bc5b152 100644--- a/packages/app/src/locales/id/messages.po+++ b/packages/app/src/locales/id/messages.po@@ -12055,6 +12055,10 @@ msgstr "Laporkan bug"msgid "Report a bug…"msgstr "Laporkan bug…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "Laporkan masalah dengan chat ini…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14541,10 +14545,18 @@ msgstr "Browser tidak tersedia di obrolan ini karena tidak dapat disiapkan. Logmsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "Browser tidak tersedia di obrolan ini karena tidak ditemukan instalasi Node.js yang dapat menjalankannya. Pasang Node.js, lalu mulai obrolan baru."+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "Pesan chat, panggilan alat, dan hasilnya, agar kami bisa melihat apa yang dilakukan agen, beserta judul chat, jalur folder proyek, dokumen tempat chat ini dimulai, serta agen dan pengaturannya. Gambar diganti dengan jenis dan ukurannya, dan berkas teks yang dilampirkan disertakan. Isinya bisa memuat isi dokumen, jadi hapus centangnya jika Anda tidak ingin membagikannya."+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "Aplikasi Claude Desktop tidak membuka berkasnya. Apakah ia terpasang? ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "Percakapan tidak dapat ditambahkan ke laporan ini."+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "Salinan “{name}” yang disimpan di {scopeLabel} adalah duplikat yang tidak diperlukan: aslinya sudah diverifikasi tidak berubah. Hapus salinan itu, lalu coba pemindahan lagi."@@ -15047,6 +15059,10 @@ msgstr "Komponen ini telah dihapus."msgid "This composer doesn't accept attachments."msgstr "Berkas tidak bisa dilampirkan di sini."+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "Percakapan ini"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "Percakapan ini mempertahankan jendela awalnya. Percakapan baru bisa memakai jendela lain."diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.jsonindex ee3b0f7fb..fd2fe8fad 100644--- a/packages/app/src/locales/ko/messages.json+++ b/packages/app/src/locales/ko/messages.json@@ -2563,6 +2563,7 @@"U7Iesw": [["seconds"], "초"],"U88xbi": ["스키마 파일을 만들지 못했습니다"],"U8CD-l": ["전체 경로 복사, 워크스페이스 없음"],+ "U8novP": ["이 대화"],"UBKdn5": ["에이전트 채팅에서 브라우저를 사용하도록 허용합니다"],"UBv8UK": ["영구 삭제"],"UDFrWm": ["GitHub 연결 확인 중…"],@@ -4445,6 +4446,7 @@"이 서버에는 기본 인증이 없습니다. 터널에 접근할 수 있는 사람은 누구나 이 지식 베이스를 완전히 제어할 수 있습니다. 그 앞에 인증 게이트를 두세요. 예를 들어 비공개 Tailscale 네트워크나 인증이 있는 리버스 프록시를 사용하세요."],"n4vt3Q": ["앱 다운로드"],+ "n57RjG": ["이 채팅의 문제 신고…"],"n5Vy3l": [["branch"], " 브랜치에서 열었습니다"],"n5n_vi": ["비공개 저장소"],"n6hXUm": [@@ -4465,12 +4467,16 @@"nNYV3Y": ["및 ", ["remaining"], "개 더"],"nOEDQs": ["동기화 모드를 업데이트하지 못했습니다. ", ["detail"]],"nP-KFo": ["새 ", ["0"], " 채팅"],+ "nRX05G": ["대화를 이 보고서에 추가하지 못했습니다."],"nTM8ab": ["색상을 편집하기 전에 이름을 지정합니다."],"nTwL53": ["URL을 공유할 문서를 여세요."],"nWMRxa": ["고정 해제"],"nWS2gQ": ["게시자: ", ["publisher"]],"nWv1ja": ["설정 → 무시 패턴에서 숨김 파일을 관리합니다."],"nXHOFU": [["0"], "에서 업데이트할 수 없습니다: ", ["1"]],+ "nXK5bR": [+ "채팅 메시지, 도구 호출과 그 출력으로, 에이전트가 무엇을 했는지 확인할 수 있습니다. 채팅 제목, 프로젝트 폴더 경로, 채팅을 시작한 문서, 에이전트와 그 설정도 포함됩니다. 이미지는 형식과 크기로 대체되고, 첨부한 텍스트 파일은 포함됩니다. 문서 내용이 포함될 수 있으므로 공유하지 않으려면 선택을 해제하세요."+ ],"nYeBmY": [["hours"], "시간 전"],"n_I-da": ["소스 보기"],"nbLQ_9": ["댓글 보낼 곳을 선택합니다"],diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.poindex ddbf2a941..20c7d3c7a 100644--- a/packages/app/src/locales/ko/messages.po+++ b/packages/app/src/locales/ko/messages.po@@ -12059,6 +12059,10 @@ msgstr "버그 신고"msgid "Report a bug…"msgstr "버그 신고…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "이 채팅의 문제 신고…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "이 채팅에서는 브라우저를 사용할 수 없습니다. 브라msgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "이 채팅에서는 브라우저를 사용할 수 없습니다. 브라우저를 시작할 수 있는 Node.js 설치를 찾지 못했기 때문입니다. Node.js를 설치한 뒤 새 채팅을 시작하세요."+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "채팅 메시지, 도구 호출과 그 출력으로, 에이전트가 무엇을 했는지 확인할 수 있습니다. 채팅 제목, 프로젝트 폴더 경로, 채팅을 시작한 문서, 에이전트와 그 설정도 포함됩니다. 이미지는 형식과 크기로 대체되고, 첨부한 텍스트 파일은 포함됩니다. 문서 내용이 포함될 수 있으므로 공유하지 않으려면 선택을 해제하세요."+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "Claude Desktop App 파일 열기 실패. 설치 상태 확인: ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "대화를 이 보고서에 추가하지 못했습니다."+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "{scopeLabel}에 남아 있는 “{name}” 사본은 불필요한 중복입니다. 원본이 변경되지 않았음을 확인했습니다. 그 사본을 삭제한 뒤 이동을 다시 시도하세요."@@ -15051,6 +15063,10 @@ msgstr "이 컴포넌트가 삭제되었습니다."msgid "This composer doesn't accept attachments."msgstr "여기에는 파일을 첨부할 수 없습니다."+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "이 대화"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "이 대화는 시작할 때의 창을 유지합니다. 새 대화에서는 다른 창을 쓸 수 있습니다."diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.jsonindex 538bb64da..ad338f1c1 100644--- a/packages/app/src/locales/pseudo/messages.json+++ b/packages/app/src/locales/pseudo/messages.json@@ -2673,6 +2673,7 @@"U7Iesw": [["seconds"], " śēćōńďś"],"U88xbi": ["Ƒàĩĺēď ţō ćŕēàţē ţĥē śćĥēḿà ƒĩĺē"],"U8CD-l": ["Ćōƥŷ ƒũĺĺ ƥàţĥ, Ńō ŵōŕķśƥàćē"],+ "U8novP": ["Ţĥĩś ćōńvēŕśàţĩōń"],"UBKdn5": ["Ĺēţ àĝēńţ ćĥàţś ũśē à ƀŕōŵśēŕ"],"UBv8UK": ["Ďēĺēţē Ƥēŕḿàńēńţĺŷ"],"UDFrWm": ["Ćĥēćķĩńĝ ĜĩţĤũƀ ćōńńēćţĩōń..."],@@ -4624,6 +4625,7 @@"Ţĥĩś śēŕvēŕ ĥàś ńō ƀũĩĺţ-ĩń àũţĥēńţĩćàţĩōń. Àńŷōńē ŵĥō ćàń ŕēàćĥ ţĥē ţũńńēĺ ĝēţś ƒũĺĺ ćōńţŕōĺ ōƒ ţĥĩś ķńōŵĺēďĝē ƀàśē. Ƥũţ àń àũţĥēńţĩćàţĩńĝ ĝàţē ĩń ƒŕōńţ, śũćĥ àś à ƥŕĩvàţē Ţàĩĺśćàĺē ńēţŵōŕķ ōŕ à ŕēvēŕśē ƥŕōxŷ ŵĩţĥ àũţĥēńţĩćàţĩōń."],"n4vt3Q": ["Ďōŵńĺōàď àƥƥ"],+ "n57RjG": ["Ŕēƥōŕţ à ƥŕōƀĺēḿ ŵĩţĥ ţĥĩś ćĥàţ…"],"n5Vy3l": ["Ōƥēńēď ōń ƀŕàńćĥ ", ["branch"]],"n5n_vi": ["Ƥŕĩvàţē ŕēƥōśĩţōŕŷ"],"n6hXUm": [@@ -4644,12 +4646,16 @@"nNYV3Y": ["àńď ", ["remaining"], " ḿōŕē"],"nOEDQs": ["Ƒàĩĺēď ţō ũƥďàţē śŷńć ḿōďē — ", ["detail"]],"nP-KFo": ["Ńēŵ ", ["0"], " ćĥàţ"],+ "nRX05G": ["Ţĥē ćōńvēŕśàţĩōń ćōũĺďń'ţ ƀē àďďēď ţō ţĥĩś ŕēƥōŕţ."],"nTM8ab": ["Ĝĩvē ĩţ à ńàḿē ƀēƒōŕē ēďĩţĩńĝ ĩţś ćōĺōŕś."],"nTwL53": ["Ōƥēń à ďōć ţō śĥàŕē ĩţś ŨŔĹ."],"nWMRxa": ["Ũńƥĩń"],"nWS2gQ": ["Ƥũƀĺĩśĥēď ƀŷ ", ["publisher"]],"nWv1ja": ["Ḿàńàĝē ĥĩďďēń ƒĩĺēś ĩń Śēţţĩńĝś → Ĩĝńōŕē ƥàţţēŕńś."],"nXHOFU": ["Ćōũĺďń'ţ ũƥďàţē ƒŕōḿ ", ["0"], ": ", ["1"]],+ "nXK5bR": [+ "Ţĥē ćĥàţ'ś ḿēśśàĝēś, ţōōĺ ćàĺĺś, àńď ţĥēĩŕ ōũţƥũţ, śō ŵē ćàń śēē ŵĥàţ ţĥē àĝēńţ ďĩď, ƥĺũś ţĥē ćĥàţ'ś ţĩţĺē, ţĥē ƥŕōĴēćţ ƒōĺďēŕ'ś ƥàţĥ, ţĥē ďōćũḿēńţ ĩţ śţàŕţēď ƒŕōḿ, àńď ţĥē àĝēńţ àńď ĩţś śēţţĩńĝś. Ĩḿàĝēś àŕē ŕēƥĺàćēď ƀŷ ţĥēĩŕ ţŷƥē àńď śĩźē, àńď àţţàćĥēď ţēxţ ƒĩĺēś àŕē ĩńćĺũďēď. Ĩţ ćàń ćōńţàĩń ďōćũḿēńţ ćōńţēńţ, śō ũńćĥēćķ ĩţ ĩƒ ŷōũ'ď ŕàţĥēŕ ńōţ śĥàŕē ĩţ."+ ],"nYeBmY": [["hours"], "ĥ àĝō"],"n_I-da": ["Vĩēŵ śōũŕćē"],"nbLQ_9": ["Ćĥōōśē ŵĥēŕē ţō śēńď ţĥēśē ćōḿḿēńţś"],diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex ae6240527..4f1d98f1e 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -12055,6 +12055,10 @@ msgstr ""msgid "Report a bug…"msgstr ""+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr ""+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14541,10 +14545,18 @@ msgstr ""msgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr ""+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr ""+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr ""+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr ""+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr ""@@ -15047,6 +15059,10 @@ msgstr ""msgid "This composer doesn't accept attachments."msgstr ""+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr ""+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr ""diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.jsonindex 306abe4bf..af1b5f5f0 100644--- a/packages/app/src/locales/pt-BR/messages.json+++ b/packages/app/src/locales/pt-BR/messages.json@@ -3040,6 +3040,7 @@"U7Iesw": [["seconds"], " segundos"],"U88xbi": ["Falha ao criar o arquivo de esquema"],"U8CD-l": ["Copiar caminho completo, sem espaço de trabalho"],+ "U8novP": ["Esta conversa"],"UBKdn5": ["Deixar os chats de agentes usarem um navegador"],"UBv8UK": ["Excluir definitivamente"],"UDFrWm": ["Verificando a conexão com o GitHub..."],@@ -5242,6 +5243,7 @@"Este servidor não tem autenticação integrada. Qualquer pessoa que consiga acessar o túnel obtém controle total desta base de conhecimento. Coloque um portão de autenticação à frente, como uma rede Tailscale privada ou um proxy reverso com autenticação."],"n4vt3Q": ["Baixar aplicativo"],+ "n57RjG": ["Relatar um problema com este chat…"],"n5Vy3l": ["Aberto no ramo ", ["branch"]],"n5n_vi": ["Repositório privado"],"n6hXUm": [@@ -5262,12 +5264,16 @@"nNYV3Y": ["e mais ", ["remaining"]],"nOEDQs": ["Falha ao atualizar o modo de sincronização — ", ["detail"]],"nP-KFo": ["Novo chat do ", ["0"]],+ "nRX05G": ["Não foi possível adicionar a conversa a este relatório."],"nTM8ab": ["Dê um nome antes de editar as cores."],"nTwL53": ["Abra um documento para compartilhar a URL dele."],"nWMRxa": ["Desafixar"],"nWS2gQ": ["Publicado por ", ["publisher"]],"nWv1ja": ["Gerencie os arquivos ocultos em Configurações → Padrões de exclusão."],"nXHOFU": ["Não foi possível atualizar de ", ["0"], ": ", ["1"]],+ "nXK5bR": [+ "As mensagens do chat, as chamadas de ferramentas e o resultado delas, para vermos o que o agente fez, além do título do chat, do caminho da pasta do projeto, do documento em que ele começou e do agente com suas configurações. As imagens são substituídas pelo tipo e tamanho, e os arquivos de texto anexados são incluídos. Ela pode conter conteúdo de documentos, então desmarque se preferir não compartilhá-la."+ ],"nYeBmY": ["há ", ["hours"], " h"],"n_I-da": ["Ver fonte"],"nbLQ_9": ["Escolha para onde enviar estes comentários"],diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.poindex 3a139113a..7b6669902 100644--- a/packages/app/src/locales/pt-BR/messages.po+++ b/packages/app/src/locales/pt-BR/messages.po@@ -12055,6 +12055,10 @@ msgstr "Relatar um erro"msgid "Report a bug…"msgstr "Relatar um erro…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "Relatar um problema com este chat…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14541,10 +14545,18 @@ msgstr "O navegador não está disponível neste chat porque não foi possívelmsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "O navegador não está disponível neste chat porque não foi encontrada nenhuma instalação do Node.js que consiga iniciá-lo. Instale o Node.js e depois inicie um novo chat."+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "As mensagens do chat, as chamadas de ferramentas e o resultado delas, para vermos o que o agente fez, além do título do chat, do caminho da pasta do projeto, do documento em que ele começou e do agente com suas configurações. As imagens são substituídas pelo tipo e tamanho, e os arquivos de texto anexados são incluídos. Ela pode conter conteúdo de documentos, então desmarque se preferir não compartilhá-la."+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "O app Claude Desktop não abriu o arquivo. Ele está instalado? ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "Não foi possível adicionar a conversa a este relatório."+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "A cópia de “{name}” mantida em {scopeLabel} é uma duplicata redundante: o original foi verificado e está inalterado. Remova essa cópia e tente a movimentação de novo."@@ -15047,6 +15059,10 @@ msgstr "Este componente foi removido."msgid "This composer doesn't accept attachments."msgstr "Não é possível anexar arquivos aqui."+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "Esta conversa"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "Esta conversa mantem a janela com que comecou. Uma nova conversa pode usar outra."diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.jsonindex a6770fe63..76bba780f 100644--- a/packages/app/src/locales/ur/messages.json+++ b/packages/app/src/locales/ur/messages.json@@ -2726,6 +2726,7 @@"U7Iesw": [["seconds"], " سیکنڈ"],"U88xbi": ["اسکیما فائل نہیں بن سکی"],"U8CD-l": ["مکمل راستہ نقل کریں، کوئی ورک اسپیس نہیں"],+ "U8novP": ["یہ گفتگو"],"UBKdn5": ["ایجنٹ چیٹس کو براؤزر استعمال کرنے دیں"],"UBv8UK": ["مستقل طور پر حذف کریں"],"UDFrWm": ["GitHub کنکشن جانچا جا رہا ہے..."],@@ -4723,6 +4724,7 @@"اس سرور میں کوئی بلٹ اِن تصدیق نہیں ہے۔ جو بھی ٹنل تک پہنچ سکتا ہے وہ اس نالج بیس کا مکمل کنٹرول حاصل کر لیتا ہے۔ اس کے سامنے ایک تصدیقی گیٹ لگائیں، جیسے کوئی نجی Tailscale نیٹ ورک یا تصدیق والا ریورس پراکسی۔"],"n4vt3Q": ["ایپ ڈاؤن لوڈ کریں"],+ "n57RjG": ["اس چیٹ میں مسئلے کی رپورٹ کریں…"],"n5Vy3l": ["برانچ ", ["branch"], " پر کھولا گیا"],"n5n_vi": ["نجی ریپازٹری"],"n6hXUm": [@@ -4743,12 +4745,16 @@"nNYV3Y": ["اور ", ["remaining"], " مزید"],"nOEDQs": ["مطابقت پذیری کا موڈ تازہ نہیں ہو سکا — ", ["detail"]],"nP-KFo": ["نئی ", ["0"], " گفتگو"],+ "nRX05G": ["گفتگو اس رپورٹ میں شامل نہیں کی جا سکی۔"],"nTM8ab": ["اس کے رنگوں میں ترمیم سے پہلے اسے نام دیں۔"],"nTwL53": ["کسی دستاویز کا URL شیئر کرنے کے لیے اسے کھولیں۔"],"nWMRxa": ["پن ہٹائیں"],"nWS2gQ": [["publisher"], " کی طرف سے شائع کردہ"],"nWv1ja": ["چھپی ہوئی فائلیں ترتیبات ← نظر انداز کرنے کے پیٹرنز میں سنبھالیں۔"],"nXHOFU": [["0"], " سے اپ ڈیٹ نہیں ہو سکا: ", ["1"]],+ "nXK5bR": [+ "چیٹ کے پیغامات، ٹول کالز اور ان کا آؤٹ پٹ، تاکہ ہم دیکھ سکیں کہ ایجنٹ نے کیا کیا، نیز چیٹ کا عنوان، پروجیکٹ کے فولڈر کا راستہ، وہ دستاویز جس سے یہ شروع ہوئی، اور ایجنٹ بمع اس کی ترتیبات۔ تصاویر کی جگہ ان کی قسم اور سائز دیا جاتا ہے، اور منسلک ٹیکسٹ فائلیں شامل کی جاتی ہیں۔ اس میں دستاویز کا مواد ہو سکتا ہے، اس لیے اگر آپ اسے شیئر نہیں کرنا چاہتے تو نشان ہٹا دیں۔"+ ],"nYeBmY": [["hours"], " گھنٹے پہلے"],"n_I-da": ["ماخذ دیکھیں"],"nbLQ_9": ["منتخب کریں کہ یہ تبصرے کہاں بھیجے جائیں"],diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.poindex 142bf999e..e7d898353 100644--- a/packages/app/src/locales/ur/messages.po+++ b/packages/app/src/locales/ur/messages.po@@ -12059,6 +12059,10 @@ msgstr "بگ رپورٹ کریں"msgid "Report a bug…"msgstr "بگ رپورٹ کریں…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "اس چیٹ میں مسئلے کی رپورٹ کریں…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "اس چیٹ میں براؤزر دستیاب نہیں ہے، کیونکmsgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "اس چیٹ میں براؤزر دستیاب نہیں ہے، کیونکہ اسے شروع کر سکنے والی کوئی Node.js تنصیب نہیں ملی۔ Node.js انسٹال کریں، پھر نئی چیٹ شروع کریں۔"+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "چیٹ کے پیغامات، ٹول کالز اور ان کا آؤٹ پٹ، تاکہ ہم دیکھ سکیں کہ ایجنٹ نے کیا کیا، نیز چیٹ کا عنوان، پروجیکٹ کے فولڈر کا راستہ، وہ دستاویز جس سے یہ شروع ہوئی، اور ایجنٹ بمع اس کی ترتیبات۔ تصاویر کی جگہ ان کی قسم اور سائز دیا جاتا ہے، اور منسلک ٹیکسٹ فائلیں شامل کی جاتی ہیں۔ اس میں دستاویز کا مواد ہو سکتا ہے، اس لیے اگر آپ اسے شیئر نہیں کرنا چاہتے تو نشان ہٹا دیں۔"+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "Claude Desktop App نے فائل نہیں کھولی۔ کیا یہ نصب ہے؟ ({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "گفتگو اس رپورٹ میں شامل نہیں کی جا سکی۔"+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "{scopeLabel} میں رکھی گئی “{name}” کی کاپی ایک غیر ضروری نقل ہے: جانچ میں اصل غیر تبدیل شدہ پایا گیا۔ وہ کاپی حذف کریں، پھر منتقلی دوبارہ آزمائیں۔"@@ -15051,6 +15063,10 @@ msgstr "یہ جزو ہٹا دیا گیا ہے۔"msgid "This composer doesn't accept attachments."msgstr "یہاں فائلیں منسلک نہیں کی جا سکتیں۔"+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "یہ گفتگو"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "یہ گفتگو اسی ونڈو کے ساتھ رہتی ہے جس سے شروع ہوئی تھی۔ نئی گفتگو میں دوسری ونڈو استعمال ہو سکتی ہے۔"diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.jsonindex 9b7c8184f..23111995d 100644--- a/packages/app/src/locales/zh-Hans/messages.json+++ b/packages/app/src/locales/zh-Hans/messages.json@@ -2323,6 +2323,7 @@"U7Iesw": [["seconds"], " 秒"],"U88xbi": ["创建架构文件失败"],"U8CD-l": ["复制完整路径,不含工作区"],+ "U8novP": ["此对话"],"UBKdn5": ["允许智能体对话使用浏览器"],"UBv8UK": ["永久删除"],"UDFrWm": ["正在检查 GitHub 连接…"],@@ -4025,6 +4026,7 @@"此服务器没有内置身份验证。任何能够访问该隧道的人都将获得对此知识库的完全控制权。请在其前面设置一道身份验证关卡,例如专用的 Tailscale 网络或带身份验证的反向代理。"],"n4vt3Q": ["下载应用"],+ "n57RjG": ["报告此对话的问题…"],"n5Vy3l": ["已在分支 ", ["branch"], " 上打开"],"n5n_vi": ["私有仓库"],"n6hXUm": [@@ -4043,12 +4045,16 @@"nNYV3Y": ["另外还有 ", ["remaining"], " 个"],"nOEDQs": ["更新同步模式失败——", ["detail"]],"nP-KFo": ["新建 ", ["0"], " 对话"],+ "nRX05G": ["无法将对话添加到此报告中。"],"nTM8ab": ["请先命名主题,再编辑颜色。"],"nTwL53": ["打开一个文档来共享它的 URL。"],"nWMRxa": ["取消置顶"],"nWS2gQ": ["由 ", ["publisher"], " 发布"],"nWv1ja": ["在「设置 → 忽略模式」中管理隐藏文件。"],"nXHOFU": ["无法从 ", ["0"], " 更新:", ["1"]],+ "nXK5bR": [+ "对话中的消息、工具调用及其输出,方便我们了解智能体做了什么,另外还包括对话标题、项目文件夹路径、对话开始时所在的文档,以及智能体及其设置。图片会替换为其类型和大小,附加的文本文件会包含在内。它可能包含文档内容,如果你不想分享,请取消勾选。"+ ],"nYeBmY": [["hours"], " 小时前"],"n_I-da": ["查看来源"],"nbLQ_9": ["选择把这些评论发送到哪里"],diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.poindex 0d60f42fe..832dea760 100644--- a/packages/app/src/locales/zh-Hans/messages.po+++ b/packages/app/src/locales/zh-Hans/messages.po@@ -12059,6 +12059,10 @@ msgstr "报告问题"msgid "Report a bug…"msgstr "报告问题…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "报告此对话的问题…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "此对话中无法使用浏览器,因为未能完成设置。详细信msgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "此对话中无法使用浏览器,因为没有找到能启动它的 Node.js 安装。请安装 Node.js,然后开始新的对话。"+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "对话中的消息、工具调用及其输出,方便我们了解智能体做了什么,另外还包括对话标题、项目文件夹路径、对话开始时所在的文档,以及智能体及其设置。图片会替换为其类型和大小,附加的文本文件会包含在内。它可能包含文档内容,如果你不想分享,请取消勾选。"+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "Claude 桌面应用没有打开这个文件。它安装了吗?({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "无法将对话添加到此报告中。"+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "保留在{scopeLabel}中的“{name}”副本是多余的重复:原件已核实未被改动。请删除该副本,然后重试移动。"@@ -15051,6 +15063,10 @@ msgstr "此组件已被移除。"msgid "This composer doesn't accept attachments."msgstr "此处无法添加附件。"+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "此对话"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "本次对话保持开始时的窗口。新对话可以使用其他窗口。"diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.jsonindex e93f86a39..c12f0f30a 100644--- a/packages/app/src/locales/zh-Hant/messages.json+++ b/packages/app/src/locales/zh-Hant/messages.json@@ -2341,6 +2341,7 @@"U7Iesw": [["seconds"], " 秒"],"U88xbi": ["建立結構描述檔案失敗"],"U8CD-l": ["複製完整路徑,不含工作區"],+ "U8novP": ["此對話"],"UBKdn5": ["允許代理對話使用瀏覽器"],"UBv8UK": ["永久刪除"],"UDFrWm": ["正在檢查 GitHub 連線…"],@@ -4041,6 +4042,7 @@"此伺服器沒有內建驗證。任何能夠存取該通道的人都將取得對此知識庫的完全控制權。請在其前面設置一道驗證關卡,例如私人的 Tailscale 網路或附驗證的反向代理。"],"n4vt3Q": ["下載應用程式"],+ "n57RjG": ["回報此對話的問題…"],"n5Vy3l": ["已在分支 ", ["branch"], " 上開啟"],"n5n_vi": ["私人儲存庫"],"n6hXUm": [@@ -4061,12 +4063,16 @@"nNYV3Y": ["另外還有 ", ["remaining"], " 個"],"nOEDQs": ["更新同步模式失敗——", ["detail"]],"nP-KFo": ["新的 ", ["0"], " 對話"],+ "nRX05G": ["無法將對話加入這份回報。"],"nTM8ab": ["請先為主題命名,再編輯色彩。"],"nTwL53": ["開啟一份文件才能分享它的 URL。"],"nWMRxa": ["取消置頂"],"nWS2gQ": ["由 ", ["publisher"], " 發布"],"nWv1ja": ["在「設定 → 忽略模式」中管理隱藏的檔案。"],"nXHOFU": ["無法從 ", ["0"], " 更新:", ["1"]],+ "nXK5bR": [+ "對話中的訊息、工具呼叫及其輸出,方便我們了解智慧代理做了什麼,另外還包括對話標題、專案資料夾路徑、對話開始時所在的文件,以及智慧代理及其設定。圖片會替換為其類型和大小,附加的文字檔案會包含在內。它可能含有文件內容,如果你不想分享,請取消勾選。"+ ],"nYeBmY": [["hours"], " 小時前"],"n_I-da": ["檢視來源"],"nbLQ_9": ["選擇要把這些註解送到哪裡"],diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.poindex 91a6eafab..78f98f0bb 100644--- a/packages/app/src/locales/zh-Hant/messages.po+++ b/packages/app/src/locales/zh-Hant/messages.po@@ -12059,6 +12059,10 @@ msgstr "回報問題"msgid "Report a bug…"msgstr "回報問題…"+#: src/components/acp/ThreadView.tsx+msgid "Report a problem with this chat…"+msgstr "回報此對話的問題…"+#. placeholder {0}: row.projectSlug#: src/components/BugReportHistory.tsxmsgid "Report from {0}"@@ -14545,10 +14549,18 @@ msgstr "此對話中無法使用瀏覽器,因為未能完成設定。詳細資msgid "The browser isn't available in this chat because no Node.js install that can start it was found. Install Node.js, then start a new chat."msgstr "此對話中無法使用瀏覽器,因為找不到能啟動它的 Node.js 安裝。請安裝 Node.js,然後開始新的對話。"+#: src/components/ReportBugDialogBody.tsx+msgid "The chat's messages, tool calls, and their output, so we can see what the agent did, plus the chat's title, the project folder's path, the document it started from, and the agent and its settings. Images are replaced by their type and size, and attached text files are included. It can contain document content, so uncheck it if you'd rather not share it."+msgstr "對話中的訊息、工具呼叫及其輸出,方便我們了解智慧代理做了什麼,另外還包括對話標題、專案資料夾路徑、對話開始時所在的文件,以及智慧代理及其設定。圖片會替換為其類型和大小,附加的文字檔案會包含在內。它可能含有文件內容,如果你不想分享,請取消勾選。"+#: src/components/InstallInClaudeDesktopDialog.tsxmsgid "The Claude Desktop App didn't open the file. Is it installed? ({msg})"msgstr "Claude Desktop App 沒有開啟這個檔案。它有安裝嗎?({msg})"+#: src/components/ReportBugDialogBody.tsx+msgid "The conversation couldn't be added to this report."+msgstr "無法將對話加入這份回報。"+#: src/lib/skills-api.tsmsgid "The copy of \"{name}\" kept in {scopeLabel} is a redundant duplicate: the original was verified unchanged. Remove that copy, then retry the move."msgstr "保留在{scopeLabel}中的「{name}」副本是多餘的重複:原件已核實未被更動。請刪除該副本,然後重試移動。"@@ -15051,6 +15063,10 @@ msgstr "此元件已被移除。"msgid "This composer doesn't accept attachments."msgstr "此處無法附加檔案。"+#: src/components/ReportBugDialogBody.tsx+msgid "This conversation"+msgstr "此對話"+#: src/components/acp/ThreadView.tsxmsgid "This conversation keeps the window it started with. A new chat can use a different one."msgstr "本次對話保持開始時的視窗。新對話可以使用其他視窗。"diff --git a/packages/cli/src/commands/bug-report-bundle.ts b/packages/cli/src/commands/bug-report-bundle.tsindex 711e0364f..fd152a89b 100644--- a/packages/cli/src/commands/bug-report-bundle.ts+++ b/packages/cli/src/commands/bug-report-bundle.ts@@ -46,6 +46,14 @@ export interface BundleLogger {export interface BundleExtraFile {sourcePath: string;zipName?: string;+ scrubbed?: Omit<BundleRedaction, 'file'>;+}++export function scrubbedExtraAudit(extra: BundleExtraFile, file: string): BundleRedaction | null {+ const { scrubbed } = extra;+ return scrubbed !== undefined && scrubbed.patterns.length > 0+ ? { file, lineCount: scrubbed.lineCount, patterns: [...scrubbed.patterns] }+ : null;}export interface CollectStandardBundleOptions {@@ -445,6 +453,8 @@ export async function collectStandardBundle(const name = `extra/${extra.zipName ?? basename(extra.sourcePath)}`;zipfile.addBuffer(raw, name);bundleFiles.push(name);+ const audit = scrubbedExtraAudit(extra, name);+ if (audit !== null) redactions.push(audit);} catch (err) {logger?.warn({ sourcePath: extra.sourcePath, err },diff --git a/packages/cli/src/diagnose/bundle.ts b/packages/cli/src/diagnose/bundle.tsindex 58c388e5c..27ba3a82d 100644--- a/packages/cli/src/diagnose/bundle.ts+++ b/packages/cli/src/diagnose/bundle.ts@@ -29,7 +29,11 @@ import {import { withHiddenWindowsConsole } from '@inkeep/open-knowledge-server';import { parse as parseYaml } from 'yaml';import { ZipFile } from 'yazl';-import type { BundleExtraFile, BundleLogger } from '../commands/bug-report-bundle.ts';+import {+ type BundleExtraFile,+ type BundleLogger,+ scrubbedExtraAudit,+} from '../commands/bug-report-bundle.ts';import { redactContent } from '../commands/bug-report-redact.ts';import { PACKAGE_VERSION } from '../constants.ts';import { defaultReadLanguage, type LanguageMetadata } from '../report-language.ts';@@ -643,15 +647,20 @@ export async function collectBundle(opts: CollectBundleOpts): Promise<CollectedB}for (const extra of opts.extraFiles ?? []) {- const staged = stageFileIfPresent(- extra.sourcePath,- join(stagingDir, 'extra', extra.zipName ?? basename(extra.sourcePath)),- );+ const zipName = extra.zipName ?? basename(extra.sourcePath);+ const staged = stageFileIfPresent(extra.sourcePath, join(stagingDir, 'extra', zipName));if (!staged) {deps.logger?.warn({ sourcePath: extra.sourcePath },'extra file missing; omitted from bundle',);+ continue;+ }+ const audit = scrubbedExtraAudit(extra, `extra/${zipName}`);+ if (audit !== null) {+ secretScrub ??= { redactions: [], redactedLineCount: 0 };+ secretScrub.redactions.push(audit);+ secretScrub.redactedLineCount += audit.lineCount;}}diff --git a/packages/cli/src/report-bundle.test.ts b/packages/cli/src/report-bundle.test.tsindex 41e1c3223..bb0c51d68 100644--- a/packages/cli/src/report-bundle.test.ts+++ b/packages/cli/src/report-bundle.test.ts@@ -1014,6 +1014,97 @@ describe('collectReportBundle — interface-language seam', () => {});});+describe('collectReportBundle — extras scrubbed before bundling', () => {+ const scrubbed = { lineCount: 2, patterns: ['github-pat'] };+ const audit = { file: 'extra/agent-chat/chat.ndjson', ...scrubbed };++ function scrubbedExtra() {+ const sourceDir = makeTmpDir();+ writeAt(sourceDir, 'chat.ndjson', '{"line":"[REDACTED-GH-PAT]"}\n');+ return {+ sourcePath: join(sourceDir, 'chat.ndjson'),+ zipName: 'agent-chat/chat.ndjson',+ scrubbed,+ };+ }++ test("a standard bundle's README and MANIFEST count what the caller scrubbed", async () => {+ const { zipPath, summary } = await collectReportBundle({+ level: 'standard',+ projectDir: makeStandardProjectDir(),+ redact: true,+ outputPath: join(makeTmpDir(), 'report.zip'),+ extraFiles: [scrubbedExtra()],+ });++ expect(summary.redactions).toContainEqual(audit);+ expect(JSON.parse(readZipEntry(zipPath, 'MANIFEST.json')).redactions).toContainEqual(audit);+ expect(readZipEntry(zipPath, 'README.md')).toContain(+ `${summary.redactedLineCount} line(s) were scrubbed across ${summary.redactions.length} file(s).`,+ );+ expect(summary.redactedLineCount).toBeGreaterThanOrEqual(2);+ });++ test("a full bundle's manifest counts what the caller scrubbed", async () => {+ const { zipPath, summary } = await collectReportBundle({+ level: 'full',+ projectDir: makeFullProjectDir(),+ redact: true,+ outputPath: join(makeTmpDir(), 'report.zip'),+ extraFiles: [scrubbedExtra()],+ });++ expect(summary.redactions).toContainEqual(audit);+ const secretScrub = JSON.parse(readZipEntry(zipPath, 'manifest.json')).redaction.secretScrub;+ expect(secretScrub.redactions).toContainEqual(audit);+ expect(secretScrub.redactedLineCount).toBe(summary.redactedLineCount);+ });++ test('an extra with nothing scrubbed adds no audit entry', async () => {+ const extra = { ...scrubbedExtra(), scrubbed: { lineCount: 0, patterns: [] } };+ const { summary } = await collectReportBundle({+ level: 'standard',+ projectDir: makeStandardProjectDir(),+ redact: true,+ outputPath: join(makeTmpDir(), 'report.zip'),+ extraFiles: [extra],+ });++ expect(summary.redactions.map((r) => r.file)).not.toContain('extra/agent-chat/chat.ndjson');+ });++ test('a full bundle adds no audit entry for an extra with nothing scrubbed', async () => {+ const extra = { ...scrubbedExtra(), scrubbed: { lineCount: 0, patterns: [] } };+ const { zipPath, summary } = await collectReportBundle({+ level: 'full',+ projectDir: makeFullProjectDir(),+ redact: true,+ outputPath: join(makeTmpDir(), 'report.zip'),+ extraFiles: [extra],+ });++ const secretScrub = JSON.parse(readZipEntry(zipPath, 'manifest.json')).redaction.secretScrub;+ expect(summary.redactions.map((r) => r.file)).not.toContain(audit.file);+ expect(secretScrub.redactions.map((r: { file: string }) => r.file)).not.toContain(audit.file);+ });++ test.each(['standard', 'full'] as const)(+ 'a %s bundle counts what the caller scrubbed with its own redaction off',+ async (level) => {+ const { summary } = await collectReportBundle({+ level,+ projectDir: level === 'full' ? makeFullProjectDir() : makeStandardProjectDir(),+ redact: false,+ outputPath: join(makeTmpDir(), 'report.zip'),+ extraFiles: [scrubbedExtra()],+ });++ expect(summary.redactions).toEqual([audit]);+ expect(summary.redactedLineCount).toBe(audit.lineCount);+ },+ );+});+describe('collectReportBundle — opted-in extras that cannot be staged', () => {function makeRecordingLogger() {const warnings: Array<{ payload: Record<string, unknown>; message: string }> = [];diff --git a/packages/core/src/desktop-bridge.ts b/packages/core/src/desktop-bridge.tsindex 29a2dd039..610c03c99 100644--- a/packages/core/src/desktop-bridge.ts+++ b/packages/core/src/desktop-bridge.ts@@ -1216,6 +1216,7 @@ export interface OkDesktopBridge {includeCrashDump?: boolean;includeScreenshot?: boolean;attachments?: OkBugReportAttachmentInput[];+ agentChatThreadId?: string;}): Promise<OkBugReportCreateResult>;captureScreenshot(): Promise<OkBugReportScreenshot | null>;crashDumpAvailability(): Promise<OkBugReportCrashDumpAvailability>;diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex efabc752d..cf8c58cbb 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -855,6 +855,7 @@ export type {SerializedErrorTruncation,} from './logger-types.ts';export {+ BUG_REPORT_AGENT_CHAT_ZIP_DIR,BUG_REPORT_ATTACHMENT_CONTENT_TYPES,BUG_REPORT_ATTACHMENT_EXTENSIONS,BUG_REPORT_ATTACHMENTS_ZIP_DIR,@@ -862,10 +863,13 @@ export {BUG_REPORT_CONTACT_EMAIL_MAX_LENGTH,BUG_REPORT_SCREENSHOT_ZIP_ENTRY,BUG_REPORT_SCREENSHOT_ZIP_NAME,+ isBugReportAgentChatEntry,isBugReportAttachmentEntry,+ isBugReportCrashDumpEntry,LOG_LEVELS,MAX_BUG_REPORT_ATTACHMENTS,MAX_BUG_REPORT_ATTACHMENTS_TOTAL_BYTES,+ MINIDUMP_FILE_EXTENSION,} from './logger-types.ts';export {LOGGER_OWNED_FIELDS,diff --git a/packages/core/src/logger-types.ts b/packages/core/src/logger-types.tsindex 9bc15b5a6..c486fae66 100644--- a/packages/core/src/logger-types.ts+++ b/packages/core/src/logger-types.ts@@ -92,6 +92,24 @@ export function isBugReportAttachmentEntry(name: string): boolean {return name.startsWith(BUG_REPORT_ATTACHMENTS_ZIP_PREFIX);}+export const BUG_REPORT_AGENT_CHAT_ZIP_DIR = 'agent-chat';+const BUG_REPORT_AGENT_CHAT_ZIP_PREFIX = `extra/${BUG_REPORT_AGENT_CHAT_ZIP_DIR}/`;++export function isBugReportAgentChatEntry(name: string): boolean {+ return name.startsWith(BUG_REPORT_AGENT_CHAT_ZIP_PREFIX);+}++export const MINIDUMP_FILE_EXTENSION = '.dmp';++const BUG_REPORT_EXTRA_ZIP_PREFIX = 'extra/';++export function isBugReportCrashDumpEntry(name: string): boolean {+ if (!name.startsWith(BUG_REPORT_EXTRA_ZIP_PREFIX) || !name.endsWith(MINIDUMP_FILE_EXTENSION)) {+ return false;+ }+ return !name.slice(BUG_REPORT_EXTRA_ZIP_PREFIX.length).includes('/');+}+export interface OkBugReportScreenshot {dataUrl: string;width: number;diff --git a/packages/core/src/logging/secret-scrub.test.ts b/packages/core/src/logging/secret-scrub.test.tsindex 9fa83519d..6329bd7ea 100644--- a/packages/core/src/logging/secret-scrub.test.ts+++ b/packages/core/src/logging/secret-scrub.test.ts@@ -122,6 +122,158 @@ describe('scrubSecrets', () => {});describe('redactSecrets', () => {+ it('scans a long run of repeated JWT headers in linear time', () => {+ const input = `see ${'eyJ'.repeat(70_000)}x`;++ const started = performance.now();+ const result = redactSecrets(input);++ expect(performance.now() - started).toBeLessThan(2000);+ expect(result.redacted).toBe(input);+ });++ it('checks for a key after each control sequence in linear time', () => {+ const input = `[${'1;msk-1;mrk_live_1;mAKIA'.repeat(50_000)}`;++ const started = performance.now();+ const result = redactSecrets(input);++ expect(performance.now() - started).toBeLessThan(2000);+ expect(result.redacted).toBe(input);+ });++ it('still catches a JWT after a bearer prefix, an equals sign or a quote', () => {+ const jwt = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.abcDEF1234_-';+ for (const input of [+ `Authorization: Bearer ${jwt}`,+ `token=${jwt}`,+ JSON.stringify({ token: jwt }),+ `"${jwt}"`,+ ]) {+ expect(redactSecrets(input).redacted).not.toContain('eyJzdWIi');+ }+ });++ it('still catches a JWT right after a newline escape in a JSON log line', () => {+ const jwt = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.abcDEF1234_-';+ const line = JSON.stringify({ msg: `response body:\n${jwt}` });++ const result = redactSecrets(line);++ expect(result.redacted).not.toContain('eyJzdWIi');+ expect(result.patterns).toContain('jwt');+ });++ it('redacts a JWT exactly where the plain JWT pattern would, whatever comes before it', () => {+ const plainJwt = /eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g;+ const segments = [+ 'eyJabcdefgh',+ 'eyJhbGciabcdefgh',+ 'abcdefgh',+ 'eyJ',+ 'xeyJabcdefgh',+ 'eyJeyJeyJabcdefgh',+ '-_9eyJabcdefg',+ 'ab',+ ];+ const glue = ['.', '.', '.', '..', ' ', '-', '', '%20', '\u001b[32m'];+ let seed = 0x2545f491;+ const drawn = new Map<string, number>();+ const pick = <T extends string>(from: readonly T[]): T => {+ seed ^= seed << 13;+ seed ^= seed >>> 17;+ seed ^= seed << 5;+ const choice = from[(seed >>> 0) % from.length] as T;+ drawn.set(choice, (drawn.get(choice) ?? 0) + 1);+ return choice;+ };+ let matched = 0;+ for (let round = 0; round < 20_000; round += 1) {+ let line = pick(glue);+ for (let segment = 0; segment < 5; segment += 1) line += pick(segments) + pick(glue);+ const expected = line.replace(plainJwt, '[REDACTED-JWT]');+ const result = redactSecrets(line);+ expect(result.redacted, line).toBe(expected);+ expect(result.patterns.includes('jwt'), line).toBe(expected !== line);+ if (expected !== line) matched += 1;+ }+ expect(matched).toBeGreaterThan(1000);+ for (const piece of [...segments, ...glue]) {+ expect(drawn.get(piece) ?? 0, piece).toBeGreaterThan(1000);+ }+ });++ it('catches a JWT glued to a color code, a percent-encoded byte or a word', () => {+ const jwt = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.abcDEF1234_-';+ for (const input of [+ `\u001b[32m${jwt}`,+ String.raw`\u001b[32m` + jwt,+ `Bearer%20${jwt}`,+ `token%3D${jwt}`,+ `cache-${jwt}`,+ `id_token_${jwt}`,+ `v2${jwt}`,+ ]) {+ expect(redactSecrets(input).redacted, input).not.toContain('eyJzdWIi');+ }+ });++ it('catches AWS, OpenAI and Stripe keys after a control sequence whose escape byte was stripped, but not inside words', () => {+ const keys = [+ `AKIA${'J'.repeat(16)}`,+ `ASIA${'2'.repeat(16)}`,+ `sk-${'f'.repeat(24)}`,+ `sk-proj-${'a'.repeat(24)}`,+ `sk-svcacct-${'b'.repeat(24)}`,+ `sk-admin-${'c'.repeat(24)}`,+ `sk_live_${'d'.repeat(24)}`,+ `rk_live_${'e'.repeat(24)}`,+ ];+ for (const key of keys) {+ for (const before of [+ '[32m',+ '^[[32m',+ '\u009b32m',+ '[32m',+ '[1;31m',+ '[38:5:208m',+ '[2K',+ '[2K[1G',+ '[?25h',+ '\u009b2K',+ ' ',+ ]) {+ expect(redactSecrets(`${before}${key}`).redacted, `${before}${key}`).not.toContain(key);+ }+ }+ for (const word of [+ 'task-admin-dashboard-route-handlers',+ 'task_live_notificationsEnabled',+ 'task-scheduleNotificationsForUsers',+ 'SLOVAKIAREPUBLICDATASETS',+ ]) {+ expect(redactSecrets(word).redacted).toBe(word);+ }+ });++ it('catches vendor tokens whatever character comes right before them', () => {+ const tokens = [+ `gho_${'a'.repeat(36)}`,+ `github_pat_${'b'.repeat(22)}`,+ `glpat-${'c'.repeat(20)}`,+ `xoxb-${'1'.repeat(12)}`,+ `AIza${'d'.repeat(35)}`,+ `sk-ant-api03-${'e'.repeat(24)}`,+ ];+ for (const token of tokens) {+ for (const before of ['[32m', 'x', '9', '^[[0m', '[1m']) {+ expect(redactSecrets(`${before}${token}`).redacted, `${before}${token}`).not.toContain(+ token,+ );+ }+ }+ });+it('reports which named patterns matched with a per-line count', () => {const result = redactSecrets('line one clean\nghp_0123456789abcdefghijklmnopqrstuvwxyz\n/Users/alice/notes',diff --git a/packages/core/src/logging/secret-scrub.ts b/packages/core/src/logging/secret-scrub.tsindex da52952a9..bdc419897 100644--- a/packages/core/src/logging/secret-scrub.ts+++ b/packages/core/src/logging/secret-scrub.ts@@ -1,37 +1,100 @@-interface SecretPattern {- name: string;- regex: RegExp;- replacement: string;+type SecretPattern =+ | { name: string; regex: RegExp; replacement: string }+ | { name: string; redact: (line: string) => string | null };++function isBase64UrlChar(code: number): boolean {+ return (+ (code >= 48 && code <= 57) ||+ (code >= 65 && code <= 90) ||+ (code >= 97 && code <= 122) ||+ code === 45 ||+ code === 95+ );+}++const JWT_SEGMENT_MIN = 8;++const JWT_HEADER = 'eyJ';++function redactJwts(line: string): string | null {+ if (!line.includes(JWT_HEADER)) return null;+ const starts: number[] = [];+ const ends: number[] = [];+ for (let at = 0; at < line.length; at += 1) {+ if (!isBase64UrlChar(line.charCodeAt(at))) continue;+ starts.push(at);+ while (at < line.length && isBase64UrlChar(line.charCodeAt(at))) at += 1;+ ends.push(at);+ }+ const headers: number[] = [];+ for (let at = line.indexOf(JWT_HEADER); at !== -1; at = line.indexOf(JWT_HEADER, at + 1)) {+ headers.push(at);+ }+ const dotJoined = (run: number) =>+ run + 1 < starts.length &&+ line[ends[run] ?? -1] === '.' &&+ starts[run + 1] === (ends[run] ?? -1) + 1;+ const pieces: string[] = [];+ let copied = 0;+ let header = 0;+ for (let run = 0; run + 2 < starts.length; run += 1) {+ const start = starts[run] ?? 0;+ const end = ends[run] ?? 0;+ while (header < headers.length && (headers[header] ?? 0) < start) header += 1;+ if (!dotJoined(run) || !dotJoined(run + 1)) continue;+ const payloadStart = starts[run + 1] ?? 0;+ const payloadEnd = ends[run + 1] ?? 0;+ const signatureLength = (ends[run + 2] ?? 0) - (starts[run + 2] ?? 0);+ if (!line.startsWith(JWT_HEADER, payloadStart)) continue;+ if (payloadEnd - payloadStart < JWT_HEADER.length + JWT_SEGMENT_MIN) continue;+ if (signatureLength < JWT_SEGMENT_MIN) continue;+ const first = headers[header];+ if (first === undefined || first >= end || end - first < JWT_HEADER.length + JWT_SEGMENT_MIN) {+ continue;+ }+ pieces.push(line.slice(copied, first), '[REDACTED-JWT]');+ copied = ends[run + 2] ?? line.length;+ run += 2;+ }+ if (pieces.length === 0) return null;+ pieces.push(line.slice(copied));+ return pieces.join('');+}++const KEY_START = /(?:\b|(?<=(?:\[|\u009b)[0-?]*[ -/]*[@-~]))/.source;++function atKeyStart(key: RegExp): RegExp {+ return new RegExp(`${KEY_START}${key.source}`, 'g');}const SECRET_PATTERNS: readonly SecretPattern[] = [{name: 'github-pat',- regex: /\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,+ regex: /(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement: '[REDACTED-GH-PAT]',},{name: 'aws-access-key',- regex: /\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,+ regex: atKeyStart(/(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/),replacement: '[REDACTED-AWS-KEY]',},{name: 'anthropic-key',- regex: /\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,+ regex: /sk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement: '[REDACTED-ANTHROPIC]',},- { name: 'openai-key', regex: /\bsk-[A-Za-z0-9]{20,}\b/g, replacement: '[REDACTED-OPENAI]' },+ {+ name: 'openai-key',+ regex: atKeyStart(/sk-[A-Za-z0-9]{20,}\b/),+ replacement: '[REDACTED-OPENAI]',+ },{name: 'bearer-token',regex:/([Aa]uthorization:\s*[Bb]earer\s+)(?:\\"[^\s"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\s"\\]+)/g,replacement: '$1[REDACTED]',},- {- name: 'jwt',- regex: /eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,- replacement: '[REDACTED-JWT]',- },+ { name: 'jwt', redact: redactJwts },{name: 'url-credentials',regex: /:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,@@ -39,22 +102,22 @@ const SECRET_PATTERNS: readonly SecretPattern[] = [},{name: 'github-pat-fine-grained',- regex: /\bgithub_pat_[0-9A-Za-z_]{20,}/g,+ regex: /github_pat_[0-9A-Za-z_]{20,}/g,replacement: '[REDACTED-GH-PAT]',},{name: 'openai-key-modern',- regex: /\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,+ regex: atKeyStart(/sk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/),replacement: '[REDACTED-OPENAI]',},- { name: 'slack-token', regex: /\bxox[a-z]-[A-Za-z0-9-]{10,}/g, replacement: '[REDACTED-SLACK]' },- { name: 'google-api-key', regex: /\bAIza[0-9A-Za-z_-]{35}/g, replacement: '[REDACTED-GOOGLE]' },+ { name: 'slack-token', regex: /xox[a-z]-[A-Za-z0-9-]{10,}/g, replacement: '[REDACTED-SLACK]' },+ { name: 'google-api-key', regex: /AIza[0-9A-Za-z_-]{35}/g, replacement: '[REDACTED-GOOGLE]' },{name: 'stripe-secret-key',- regex: /\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,+ regex: atKeyStart(/(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/),replacement: '[REDACTED-STRIPE]',},- { name: 'gitlab-pat', regex: /\bglpat-[0-9A-Za-z_-]{20,}/g, replacement: '[REDACTED-GITLAB]' },+ { name: 'gitlab-pat', regex: /glpat-[0-9A-Za-z_-]{20,}/g, replacement: '[REDACTED-GITLAB]' },{name: 'bearer-token-json',regex: /("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)(?:\\"[^"\\]+\\"|[^"\\]+)/g,@@ -87,7 +150,16 @@ export function redactSecrets(content: string): {const redactedLines = lines.map((line) => {let modified = line;let changed = false;- for (const { name, regex, replacement } of SECRET_PATTERNS) {+ for (const pattern of SECRET_PATTERNS) {+ if ('redact' in pattern) {+ const redacted = pattern.redact(modified);+ if (redacted === null) continue;+ matchedPatterns.add(pattern.name);+ changed = true;+ modified = redacted;+ continue;+ }+ const { name, regex, replacement } = pattern;regex.lastIndex = 0;if (regex.test(modified)) {matchedPatterns.add(name);diff --git a/packages/desktop/src/main/bug-report-agent-chat.test.ts b/packages/desktop/src/main/bug-report-agent-chat.test.tsnew file mode 100644index 000000000..24860d33b--- /dev/null+++ b/packages/desktop/src/main/bug-report-agent-chat.test.ts@@ -0,0 +1,991 @@+import {+ chmodSync,+ mkdirSync,+ mkdtempSync,+ readFileSync,+ rmSync,+ symlinkSync,+ writeFileSync,+} from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { afterEach, describe, expect, test } from 'vitest';+import {+ type AgentChatStageOutcome,+ BARE_BASE64_MIN_LENGTH,+ defaultAgentChatThreadDirs,+ isAgentChatThreadId,+ OMITTED_EVENTS_KIND,+ stageAgentChatTranscript,+ TRUNCATED_EVENT_KIND,+} from './bug-report-agent-chat.ts';++const threadId = '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6';+const token = `gho_${'a'.repeat(36)}`;+let dirs: string[] = [];+function tmp(): string {+ const dir = mkdtempSync(join(tmpdir(), 'ok-agent-chat-'));+ dirs.push(dir);+ return dir;+}+afterEach(() => {+ for (const dir of dirs) rmSync(dir, { recursive: true, force: true });+ dirs = [];+});++const ndjson = (...events: unknown[]) =>+ events.map((event) => `${JSON.stringify(event)}\n`).join('');++function writeTranscript(dir: string, body: string): void {+ writeFileSync(join(dir, `${threadId}.ndjson`), body);+}++async function stageFrom(+ dir: string,+ options: { maxBytes?: number; tmpPaths?: string[] } = {},+): Promise<AgentChatStageOutcome> {+ return stageAgentChatTranscript({+ threadId,+ threadDirs: [dir],+ tmpDir: tmp(),+ tmpPaths: options.tmpPaths ?? [],+ ...(options.maxBytes !== undefined ? { maxBytes: options.maxBytes } : {}),+ });+}++function stagedFile(outcome: AgentChatStageOutcome, suffix: string) {+ if (outcome.status !== 'attached') throw new Error(`expected attached, got ${outcome.status}`);+ const file = outcome.files.find((f) => f.zipName?.endsWith(suffix));+ if (file === undefined) throw new Error(`no staged file ending ${suffix}`);+ return { ...file, text: readFileSync(file.sourcePath, 'utf8') };+}++describe('isAgentChatThreadId', () => {+ test('accepts chat ids and nothing that could name another file', () => {+ expect(isAgentChatThreadId(threadId)).toBe(true);+ for (const value of ['', '../x', `${threadId}/..`, `${threadId}.ndjson`, 42, null]) {+ expect(isAgentChatThreadId(value)).toBe(false);+ }+ });+});++describe('defaultAgentChatThreadDirs', () => {+ test("reads the store the server writes, then the project's legacy store", () => {+ const home = join(tmpdir(), 'home');+ const project = join(tmpdir(), 'project');+ expect(defaultAgentChatThreadDirs(project, home)).toEqual([+ join(home, '.ok', 'threads'),+ join(project, '.ok', 'local', 'threads'),+ ]);+ expect(defaultAgentChatThreadDirs(null, home)).toEqual([join(home, '.ok', 'threads')]);+ });+});++describe('stageAgentChatTranscript', () => {+ test('keeps the newest part of a long transcript, marked and starting at a whole line', async () => {+ const dir = tmp();+ const lines = Array.from({ length: 1000 }, (_, i) => `{"n":${i}}`);+ writeTranscript(dir, `${lines.join('\n')}\n`);+ const tmpPaths: string[] = [];++ const staged = await stageFrom(dir, { maxBytes: 100, tmpPaths });++ expect(staged.status === 'attached' && staged.truncated).toBe(true);+ expect(staged.status === 'attached' && staged.files.map((f) => f.zipName)).toEqual([+ `agent-chat/${threadId}.ndjson`,+ ]);+ const { text } = stagedFile(staged, '.ndjson');+ const [marker, oldestKept] = text.split('\n');+ expect(JSON.parse(marker ?? '')).toEqual({ kind: OMITTED_EVENTS_KIND });+ expect(oldestKept?.startsWith('{"n":')).toBe(true);+ expect(text.trimEnd().endsWith('{"n":999}')).toBe(true);+ expect(Buffer.byteLength(text)).toBeLessThanOrEqual(100);+ expect(tmpPaths).toHaveLength(1);+ });++ test('starts with a marker when earlier events are left out to fit the budget', async () => {+ const dir = tmp();+ const events = Array.from({ length: 20 }, (_, ts) => ({+ kind: 'agent_stderr',+ line: `line ${ts}`,+ ts,+ }));+ writeTranscript(dir, ndjson(...events));++ const staged = await stageFrom(dir, { maxBytes: 300 });+ const { text } = stagedFile(staged, '.ndjson');+ const [marker, ...kept] = text+ .trimEnd()+ .split('\n')+ .map((line) => JSON.parse(line));++ expect(staged.status === 'attached' && staged.truncated).toBe(true);+ expect(marker).toEqual({ kind: OMITTED_EVENTS_KIND });+ expect(kept.length).toBeGreaterThan(0);+ expect(kept).toEqual(events.slice(-kept.length));+ expect(kept.length).toBeLessThan(events.length);+ expect(Buffer.byteLength(text)).toBeLessThanOrEqual(300);+ });++ test('leaves out a newest line the server has not finished writing', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ `${ndjson({ kind: 'turn_started', ts: 1 })}{"kind":"agent_stderr","line":"half-wri`,+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).toBe(ndjson({ kind: 'turn_started', ts: 1 }));+ });++ test('finds nothing when no directory holds the chat', async () => {+ const tmpPaths: string[] = [];+ expect(await stageFrom(tmp(), { tmpPaths })).toEqual({ status: 'not-found' });+ expect(tmpPaths).toEqual([]);+ });++ test('scrubs a token that starts a line of tool output', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson({ kind: 'agent_stderr', line: `$ gh auth token\n${token}\n`, ts: 1 }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(token);+ expect(JSON.parse(text).line).toBe('$ gh auth token\n[REDACTED-GH-PAT]\n');+ });++ test('scrubs a token right after a terminal color code and keeps the code', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson({ kind: 'agent_stderr', line: `\u001b[32m${token}\u001b[0m`, ts: 1 }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(token);+ expect(JSON.parse(text).line).toBe('\u001b[32m[REDACTED-GH-PAT]\u001b[0m');+ });++ test('scrubs a token right after any other terminal escape sequence', async () => {+ const dir = tmp();+ const sequences = ['\u001b[>4;2m', '\u001b(B', '\u001b7', '\u001b]0;title\u0007'];+ writeTranscript(+ dir,+ ndjson(+ ...sequences.map((sequence, ts) => ({+ kind: 'agent_stderr',+ line: `${sequence}${token}`,+ ts,+ })),+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(token);+ expect(+ text+ .trimEnd()+ .split('\n')+ .map((line) => JSON.parse(line).line),+ ).toEqual(sequences.map((sequence) => `${sequence}[REDACTED-GH-PAT]`));+ });++ test('scrubs a token inside JSON that a tool printed', async () => {+ const dir = tmp();+ const printed = JSON.stringify({ stdout: `ok\n${token}` });+ writeTranscript(+ dir,+ ndjson({+ kind: 'session_update',+ update: { content: [{ type: 'content', content: { type: 'text', text: printed } }] },+ ts: 1,+ }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(token);+ const inner = JSON.parse(JSON.parse(text).update.content[0].content.text);+ expect(inner).toEqual({ stdout: 'ok\n[REDACTED-GH-PAT]' });+ });++ test('keeps an Authorization header scrubbed when it is a key and value, not text', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson({+ kind: 'session_update',+ update: { rawInput: { headers: { Authorization: 'Bearer opaque-session-value' } } },+ ts: 1,+ }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain('opaque-session-value');+ });++ test('scrubs a line cut off mid-write instead of passing it through', async () => {+ const dir = tmp();+ writeTranscript(dir, `{"kind":"agent_stderr","line":"x\\n${token}\n`);++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(token);+ expect(text).toContain('[REDACTED-GH-PAT]');+ });++ test('scrubs a line that is not JSON at all', async () => {+ const dir = tmp();+ writeTranscript(dir, `garbage ${token}\n`);++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).toBe('garbage [REDACTED-GH-PAT]\n');+ });++ test('replaces a private key block from its BEGIN line through its END line', async () => {+ const dir = tmp();+ const key = [+ '-----BEGIN OPENSSH PRIVATE KEY-----',+ 'fake-key-body-line-one',+ 'fake-key-body-line-two',+ '-----END OPENSSH PRIVATE KEY-----',+ ].join('\n');+ writeTranscript(+ dir,+ ndjson({ kind: 'agent_stderr', line: `$ cat id_ed25519\n${key}\n$ ls`, ts: 1 }),+ );++ const { text, scrubbed } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain('fake-key-body');+ expect(JSON.parse(text).line).toBe('$ cat id_ed25519\n[REDACTED-PRIVATE-KEY]\n$ ls');+ expect(scrubbed).toEqual({ lineCount: 1, patterns: ['private-key'] });+ });++ test('replaces a private key body whose BEGIN line is not in the value through its END line', async () => {+ const dir = tmp();+ const tail = ['fake-key-body-line-two', '-----END OPENSSH PRIVATE KEY-----'].join('\n');+ const whole = [+ '-----BEGIN RSA PRIVATE KEY-----',+ 'fake-key-body-line-three',+ '-----END RSA PRIVATE KEY-----',+ ].join('\n');+ writeTranscript(+ dir,+ ndjson(+ { kind: 'agent_stderr', line: `${tail}\n$ ls\n${whole}\n$ pwd`, ts: 1 },+ { kind: 'agent_stderr', line: `${tail}\n${tail}\n$ ls`, ts: 2 },+ ),+ );++ const { text, scrubbed } = stagedFile(await stageFrom(dir), '.ndjson');+ const lines = text+ .trim()+ .split('\n')+ .map((line) => JSON.parse(line).line);++ expect(text).not.toContain('fake-key-body');+ expect(lines).toEqual([+ '[REDACTED-PRIVATE-KEY]\n$ ls\n[REDACTED-PRIVATE-KEY]\n$ pwd',+ '[REDACTED-PRIVATE-KEY]\n$ ls',+ ]);+ expect(scrubbed).toEqual({ lineCount: 2, patterns: ['private-key'] });+ });++ test('replaces a private key block that stops before its END line through the end of the value', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson({+ kind: 'session_update',+ update: {+ rawOutput: {+ stdout: 'key:\n-----BEGIN RSA PRIVATE KEY-----\nfake-key-body-line-one\nfake-key-bo',+ exitCode: 0,+ },+ },+ ts: 1,+ }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain('fake-key-bo');+ expect(JSON.parse(text).update.rawOutput).toEqual({+ stdout: 'key:\n[REDACTED-PRIVATE-KEY]',+ exitCode: 0,+ });+ });++ test('replaces a JSON-escaped private key block on a line that is not valid JSON', async () => {+ const dir = tmp();+ const torn = `{"kind":"agent_stderr","line":"-----BEGIN PRIVATE KEY-----\\nfake-key-body-line-one\\n-----END PRIVATE KEY-----\\`;+ writeTranscript(dir, `${torn}{"kind":"turn_started","ts":2}\n`);++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain('fake-key-body');+ expect(text).toContain('[REDACTED-PRIVATE-KEY]');+ });++ test('replaces inline images and binary payloads with their type and size', async () => {+ const dir = tmp();+ const pasted = Buffer.alloc(3000, 1).toString('base64');+ const screenshot = Buffer.alloc(1200, 2).toString('base64');+ const pdf = Buffer.alloc(700, 3).toString('base64');+ const recording = Buffer.alloc(900, 4).toString('base64');+ writeTranscript(+ dir,+ ndjson(+ {+ kind: 'user_message',+ content: 'see attached',+ attachments: [+ { kind: 'image', data: pasted, mimeType: 'image/png', name: 'a.png', sizeBytes: 3000 },+ {+ kind: 'blob',+ data: `KEY=${token}`,+ textPayload: true,+ mimeType: 'text/plain',+ name: '.env',+ },+ ],+ ts: 1,+ },+ {+ kind: 'session_update',+ update: {+ content: [+ {+ type: 'content',+ content: { type: 'image', data: screenshot, mimeType: 'image/jpeg' },+ },+ {+ type: 'content',+ content: {+ type: 'resource',+ resource: { uri: 'file:///r.pdf', blob: pdf, mimeType: 'application/pdf' },+ },+ },+ {+ type: 'content',+ content: { type: 'audio', data: recording, mimeType: 'audio/wav' },+ },+ ],+ },+ ts: 2,+ },+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ for (const payload of [pasted, screenshot, pdf, recording]) {+ expect(text).not.toContain(payload);+ }+ expect(text).toContain('[omitted image/png, 3000 bytes]');+ expect(text).toContain('[omitted image/jpeg, 1200 bytes]');+ expect(text).toContain('[omitted application/pdf, 700 bytes]');+ expect(text).toContain('[omitted audio/wav, 900 bytes]');+ expect(text).toContain('KEY=[REDACTED-GH-PAT]');+ });++ test('attaches the transcript and metadata when the metadata was cut off mid-write', async () => {+ const dir = tmp();+ writeTranscript(dir, ndjson({ kind: 'turn_started', ts: 1 }));+ writeFileSync(+ join(dir, `${threadId}.meta.json`),+ `{"version":1,"agentRef":{"source":"registry","id":"codex-acp"},"info":{"title":"fix ${token}`,+ );++ const staged = await stageFrom(dir);++ if (staged.status !== 'attached') throw new Error(`expected attached, got ${staged.status}`);+ expect(stagedFile(staged, '.ndjson').text).toContain('turn_started');+ expect(staged.metadata).toEqual({ status: 'attached' });+ expect(stagedFile(staged, '.meta.json').text).not.toContain(token);+ });++ test('scrubs the chat metadata the same way and keeps its layout', async () => {+ const dir = tmp();+ writeTranscript(dir, ndjson({ kind: 'turn_started', ts: 1 }));+ const meta = { version: 1, info: { title: `fix\n${token}` }, cwd: '/Users/someone/project' };+ writeFileSync(join(dir, `${threadId}.meta.json`), `${JSON.stringify(meta, null, 1)}\n`);++ const staged = await stageFrom(dir);+ const { text, scrubbed, zipName } = stagedFile(staged, '.meta.json');++ expect(zipName).toBe(`agent-chat/${threadId}.meta.json`);+ expect(text).toBe(+ `${JSON.stringify({ ...meta, info: { title: 'fix\n[REDACTED-GH-PAT]' }, cwd: '~/project' }, null, 1)}\n`,+ );+ expect(scrubbed).toEqual({ lineCount: 2, patterns: ['github-pat', 'macos-home-path'] });+ });++ test('counts the metadata lines it scrubbed, not the secrets on them or the payloads it left out', async () => {+ const dir = tmp();+ writeTranscript(dir, ndjson({ kind: 'turn_started', ts: 1 }));+ const meta = {+ version: 1,+ info: {+ title: `retry "${token}" from /Users/someone/notes`,+ queue: [+ {+ id: 'q1',+ content: 'see the screenshot',+ attachments: [+ {+ kind: 'image',+ data: Buffer.alloc(300, 1).toString('base64'),+ mimeType: 'image/png',+ name: 'a.png',+ },+ ],+ ts: 2,+ },+ ],+ },+ cwd: '/Users/someone/project',+ };+ writeFileSync(join(dir, `${threadId}.meta.json`), `${JSON.stringify(meta, null, 1)}\n`);++ const { text, scrubbed } = stagedFile(await stageFrom(dir), '.meta.json');++ expect(text).toContain('[omitted image/png, 300 bytes]');+ expect(scrubbed).toEqual({ lineCount: 2, patterns: ['github-pat', 'macos-home-path'] });+ });++ test('keeps the transcript and reports metadata over the size limit as left out', async () => {+ const dir = tmp();+ writeTranscript(dir, ndjson({ kind: 'turn_started', ts: 1 }));+ const meta = `${JSON.stringify({ version: 1, info: { title: 'x'.repeat(300_000) } })}\n`;+ writeFileSync(join(dir, `${threadId}.meta.json`), meta);++ const staged = await stageFrom(dir);++ expect(staged).toMatchObject({+ status: 'attached',+ metadata: { status: 'too-large', sizeBytes: Buffer.byteLength(meta) },+ });+ expect(staged.status === 'attached' && staged.files.map((f) => f.zipName)).toEqual([+ `agent-chat/${threadId}.ndjson`,+ ]);+ });++ test.skipIf(process.platform === 'win32' || process.getuid?.() === 0)(+ 'keeps the transcript and reports why when the metadata cannot be read',+ async () => {+ const dir = tmp();+ writeTranscript(dir, ndjson({ kind: 'turn_started', ts: 1 }));+ const metaPath = join(dir, `${threadId}.meta.json`);+ writeFileSync(metaPath, '{"version":1}\n');+ chmodSync(metaPath, 0o000);++ const staged = await stageFrom(dir);++ expect(staged.status === 'attached' && staged.files.map((f) => f.zipName)).toEqual([+ `agent-chat/${threadId}.ndjson`,+ ]);+ expect(staged.status === 'attached' && staged.metadata).toMatchObject({+ status: 'failed',+ error: { code: 'EACCES' },+ });+ },+ );++ test('records what it scrubbed from the transcript for the bundle audit', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson(+ { kind: 'agent_stderr', line: `one ${token}`, ts: 1 },+ { kind: 'turn_started', ts: 2 },+ { kind: 'agent_stderr', line: `two\n${token}\n${token}`, ts: 3 },+ ),+ );++ const { scrubbed } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(scrubbed).toEqual({ lineCount: 2, patterns: ['github-pat'] });+ });++ test('a newest event larger than the budget still stages, cut short and marked', async () => {+ const dir = tmp();+ const newest = JSON.stringify({ kind: 'agent_stderr', line: 'x'.repeat(250), ts: 2 });+ writeTranscript(dir, `${JSON.stringify({ kind: 'turn_started', ts: 1 })}\n${newest}\n`);++ const staged = await stageFrom(dir, { maxBytes: 100 });+ const { text } = stagedFile(staged, '.ndjson');++ expect(staged.status === 'attached' && staged.truncated).toBe(true);+ expect(Buffer.byteLength(text)).toBeLessThanOrEqual(100);+ const marker = JSON.parse(text.trimEnd().split('\n').at(-1) ?? '');+ expect(marker.kind).toBe(TRUNCATED_EVENT_KIND);+ expect(marker.bytes).toBe(Buffer.byteLength(newest));+ expect(marker.head.length).toBeGreaterThan(0);+ expect(newest.startsWith(marker.head)).toBe(true);+ });++ test('a newest event too large to read leaves the transcript out instead of staging it empty', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson(+ { kind: 'turn_started', ts: 1 },+ { kind: 'agent_stderr', line: 'x'.repeat(500), ts: 2 },+ ),+ );+ const tmpPaths: string[] = [];++ expect(await stageFrom(dir, { maxBytes: 100, tmpPaths })).toEqual({ status: 'too-large' });+ expect(tmpPaths).toEqual([]);+ });++ test('refuses a transcript or metadata file that is a symlink', async () => {+ const outside = join(tmp(), 'outside.txt');+ writeFileSync(outside, `${JSON.stringify({ kind: 'turn_started', ts: 1 })}\n`);+ const linked = tmp();+ symlinkSync(outside, join(linked, `${threadId}.ndjson`));+ expect(await stageFrom(linked)).toEqual({ status: 'not-found' });++ const metaLinked = tmp();+ writeTranscript(metaLinked, ndjson({ kind: 'turn_started', ts: 1 }));+ symlinkSync(outside, join(metaLinked, `${threadId}.meta.json`));+ const staged = await stageFrom(metaLinked);+ expect(staged.status === 'attached' && staged.files.map((f) => f.zipName)).toEqual([+ `agent-chat/${threadId}.ndjson`,+ ]);+ expect(staged.status === 'attached' && staged.metadata).toEqual({ status: 'not-found' });+ });++ test('treats something other than a file in place of the transcript as missing', async () => {+ const dir = tmp();+ mkdirSync(join(dir, `${threadId}.ndjson`));+ expect(await stageFrom(dir)).toEqual({ status: 'not-found' });+ });++ test.skipIf(process.platform === 'win32' || process.getuid?.() === 0)(+ 'a lookup that fails for any reason but a missing file is an error, not a missing chat',+ async () => {+ const locked = join(tmp(), 'locked');+ mkdirSync(locked);+ writeTranscript(locked, ndjson({ kind: 'turn_started', ts: 1 }));+ chmodSync(locked, 0o000);+ try {+ await expect(stageFrom(locked)).rejects.toMatchObject({ code: 'EACCES' });+ } finally {+ chmodSync(locked, 0o755);+ }+ },+ );+});++describe('stageAgentChatTranscript on text streamed across events', () => {+ const chunk = (sessionUpdate: string, messageId: string, text: string, ts: number) => ({+ kind: 'session_update',+ update: { sessionUpdate, messageId, content: { type: 'text', text } },+ ts,+ });+ const body = 'MIIEowIBAAKCAQEAu1SU1LfVLPHCozMxH2Mo4lgOEePzNm0tRgeLezV6ffAt0gunVTLw';++ test('redacts a private key whose block was streamed over several events', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson(+ chunk('agent_message_chunk', 'm1', 'Here it is:\n-----BEGIN RSA PRIVATE ', 1),+ chunk('agent_message_chunk', 'm1', `KEY-----\n${body}\n`, 2),+ chunk('agent_message_chunk', 'm1', `${body}\n-----END RSA PRIVATE KEY-----\nDone.`, 3),+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(body.slice(0, 20));+ expect(text).not.toContain('PRIVATE KEY-----');+ expect(text).toContain('[REDACTED-PRIVATE-KEY]');+ expect(text).toContain('Here it is:');+ expect(text).toContain('Done.');+ expect(text.trim().split('\n')).toHaveLength(1);+ });++ test('redacts a private key cut off mid-stream through the end of what was streamed', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson(+ chunk('agent_thought_chunk', 't1', '-----BEGIN PRIVATE KEY-----\n', 1),+ chunk('agent_thought_chunk', 't1', `${body}\n${body}`, 2),+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(body.slice(0, 20));+ });++ test('redacts keys split between events of one message or one terminal', async () => {+ const dir = tmp();+ const openai = `sk-${'a'.repeat(30)}`;+ const aws = 'AKIAIOSFODNN7EXAMPLE';+ writeTranscript(+ dir,+ ndjson(+ chunk('agent_thought_chunk', 't1', `key ${openai.slice(0, 12)}`, 1),+ chunk('agent_thought_chunk', 't1', `${openai.slice(12)} done`, 2),+ {+ kind: 'terminal_output',+ terminalId: 'term-1',+ chunk: `export KEY=${aws.slice(0, 9)}`,+ ts: 3,+ },+ { kind: 'terminal_output', terminalId: 'term-1', chunk: `${aws.slice(9)}\n`, ts: 4 },+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(openai.slice(0, 12));+ expect(text).not.toContain(aws.slice(0, 9));+ expect(text).toContain('[REDACTED-OPENAI]');+ expect(text).toContain('[REDACTED-AWS-KEY]');+ expect(text.trim().split('\n')).toHaveLength(2);+ });++ test('keeps events of different messages and terminals apart', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson(+ chunk('agent_message_chunk', 'm1', 'first', 1),+ chunk('agent_message_chunk', 'm2', 'second', 2),+ { kind: 'terminal_output', terminalId: 'term-1', chunk: 'one', ts: 3 },+ { kind: 'terminal_output', terminalId: 'term-2', chunk: 'two', ts: 4 },+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text.trim().split('\n')).toHaveLength(4);+ });++ test('keeps when each part of a joined line arrived', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson(+ chunk('agent_message_chunk', 'm1', 'one ', 1),+ chunk('agent_message_chunk', 'm1', 'two ', 2),+ chunk('agent_message_chunk', 'm1', 'three', 120_001),+ chunk('agent_message_chunk', 'm2', 'alone', 120_002),+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');+ const [joined, alone] = text+ .trim()+ .split('\n')+ .map((line) => JSON.parse(line));++ expect(joined.update.content.text).toBe('one two three');+ expect(joined.ts).toBe(1);+ expect(joined.chunkTs).toEqual([1, 2, 120_001]);+ expect(alone).toEqual(chunk('agent_message_chunk', 'm2', 'alone', 120_002));+ });++ test('keeps a Codex warning apart from the reply streamed after it', async () => {+ const unmarked = (text: string, ts: number) => ({+ kind: 'session_update',+ update: { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text } },+ ts,+ });+ const lineCounts: number[] = [];+ for (const id of ['codex-acp', 'claude-acp']) {+ const dir = tmp();+ writeFileSync(+ join(dir, `${threadId}.meta.json`),+ JSON.stringify({ version: 1, agentRef: { source: 'registry', id } }),+ );+ writeTranscript(dir, ndjson(unmarked('Warning: stale config\n\n', 1), unmarked('Hi', 2)));+ const { text } = stagedFile(await stageFrom(dir), '.ndjson');+ lineCounts.push(text.trim().split('\n').length);+ }++ expect(lineCounts).toEqual([2, 1]);+ });+});++describe('stageAgentChatTranscript on awkward layouts', () => {+ test('scrubs long runs of escaped quotes and backslashes in linear time', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ `${JSON.stringify({ kind: 'user_message', content: '\\"'.repeat(150_000), ts: 1 })}\n${JSON.stringify({ kind: 'agent_stderr', line: `${'\\'.repeat(300_000)}x`, ts: 2 })}\n{"kind":"agent_stderr","line":"x${'\\\\\\"'.repeat(75_000)}\n`,+ );++ const started = performance.now();+ const staged = await stageFrom(dir);++ expect(performance.now() - started).toBeLessThan(2000);+ expect(staged.status).toBe('attached');+ });++ test('scans for private key blocks and near-threshold base64 runs in linear time', async () => {+ const dir = tmp();+ const nearlyBase64 = `${'A'.repeat(BARE_BASE64_MIN_LENGTH - 1)} `.repeat(500);+ const keyMarkers = `${'-----BEGIN PRIVATE KEY-----x-----END PRIVATE KEY-----'.repeat(20_000)}-----BEGIN PRIVATE KEY-----${'y'.repeat(100_000)}`;+ writeTranscript(+ dir,+ ndjson(+ { kind: 'agent_stderr', line: nearlyBase64, ts: 1 },+ { kind: 'agent_stderr', line: keyMarkers, ts: 2 },+ ),+ );++ const started = performance.now();+ const staged = await stageFrom(dir);++ expect(performance.now() - started).toBeLessThan(2000);+ const [runs, keys] = stagedFile(staged, '.ndjson')+ .text.trimEnd()+ .split('\n')+ .map((line) => JSON.parse(line).line);+ expect(runs).toBe(nearlyBase64);+ expect(keys).toBe('[REDACTED-PRIVATE-KEY]'.repeat(20_001));+ });++ test.each([+ [+ 'inside JSON nested three levels deep',+ JSON.stringify({ a: JSON.stringify({ b: JSON.stringify({ out: `x\n${token}` }) }) }),+ ],+ ['in a Python repr', `CompletedProcess(returncode=0, stdout='Logged in\\n${token}\\n')`],+ ['in a JSON literal that was cut off', `{"output":"line one\\n${token}`],+ ])('scrubs a token right after an escaped newline %s', async (_layout, line) => {+ const dir = tmp();+ writeTranscript(dir, ndjson({ kind: 'agent_stderr', line, ts: 1 }));++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(token);+ expect(text).toContain('[REDACTED-GH-PAT]');+ });++ test('still shortens a Windows home path whose user name starts like an escape', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson({ kind: 'agent_stderr', line: 'opened C:\\Users\\nancy\\notes.txt', ts: 1 }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(JSON.parse(text).line).toBe('opened ~\\notes.txt');+ });++ test('replaces base64 image data wherever it appears', async () => {+ const dir = tmp();+ const png = Buffer.alloc(6000, 7).toString('base64');+ const jpeg = Buffer.alloc(900, 8).toString('base64');+ const bare = Buffer.alloc(5000, 9).toString('base64');+ writeTranscript(+ dir,+ ndjson(+ {+ kind: 'session_update',+ update: {+ rawOutput: {+ content: [+ { type: 'image', source: { type: 'base64', media_type: 'image/png', data: png } },+ ],+ },+ },+ ts: 1,+ },+ {+ kind: 'session_update',+ update: {+ rawInput: {+ html: `<p>logo</p><img src="data:image/jpeg;base64,${jpeg}"> done`,+ icon: `data:image/jpeg;base64,${jpeg}`,+ },+ },+ ts: 2,+ },+ { kind: 'session_update', update: { rawOutput: { screenshot: bare } }, ts: 3 },+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ for (const payload of [png, jpeg, bare]) expect(text).not.toContain(payload);+ const [anthropic, dataUrls, screenshot] = text+ .trimEnd()+ .split('\n')+ .map((line) => JSON.parse(line).update);+ expect(anthropic.rawOutput.content[0].source.data).toBe('[omitted image/png, 6000 bytes]');+ expect(dataUrls.rawInput).toEqual({+ html: '<p>logo</p><img src="[omitted image/jpeg, 900 bytes]"> done',+ icon: '[omitted image/jpeg, 900 bytes]',+ });+ expect(screenshot.rawOutput.screenshot).toBe('[omitted base64 data, 5000 bytes]');+ });+});++describe('stageAgentChatTranscript on undecoded escapes and payload edges', () => {+ test.each([+ [+ 'an escaped color code in JSON nested three levels deep',+ JSON.stringify({ a: JSON.stringify({ b: JSON.stringify({ out: `\u001b[32m${token}` }) }) }),+ ],+ [+ 'an escaped color code in a nested literal cut off by the length cap',+ `{"output":"${'x'.repeat(15_900)}\\u001b[32m${token}`,+ ],+ ['an escaped color code in a Python repr', `CompletedProcess(stdout='\\x1b[32m${token}')`],+ ['a form feed escape', `CompletedProcess(stdout='page\\f${token}')`],+ ['a hex newline escape', `b'line\\x0a${token}'`],+ ['a percent-encoded newline', `https://example.test/callback?next=%0A${token}`],+ ['a color code whose escape byte was stripped', `[32m${token}[0m`],+ ['a color code in caret notation', `^[[32m${token}`],+ ['an 8-bit control sequence', `\u009b32m${token}`],+ ['an HTML-encoded escape byte', `[32m${token}`],+ ])('scrubs a token right after %s', async (_layout, line) => {+ const dir = tmp();+ writeTranscript(dir, ndjson({ kind: 'agent_stderr', line, ts: 1 }));++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(token);+ expect(text).toContain('[REDACTED-GH-PAT]');+ });++ test('scrubs OpenAI project keys and Stripe live keys after a control sequence whose escape byte was stripped', async () => {+ const dir = tmp();+ const openai = `sk-proj-${'a'.repeat(24)}`;+ const stripe = `sk_live_${'b'.repeat(24)}`;+ const restricted = `rk_live_${'c'.repeat(24)}`;+ writeTranscript(+ dir,+ ndjson(+ { kind: 'agent_stderr', line: `[32m${openai}[0m`, ts: 1 },+ { kind: 'agent_stderr', line: `\u009b32m${stripe}`, ts: 2 },+ { kind: 'agent_stderr', line: `[2K[1G${restricted}`, ts: 3 },+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(openai);+ expect(text).not.toContain(stripe);+ expect(text).not.toContain(restricted);+ expect(text.trim().split('\n')).toHaveLength(3);+ });++ test('omits base64 data inside JSON that a tool printed as text, even with its slashes escaped', async () => {+ const dir = tmp();+ const png = Buffer.alloc(6000, 5).toString('base64');+ const icon = Buffer.alloc(6000, 0xff).toString('base64');+ const printed = JSON.stringify({+ screenshot: png,+ icon: `data:image/png;base64,${icon}`,+ ok: true,+ }).replaceAll('/', '\\/');+ writeTranscript(+ dir,+ ndjson({+ kind: 'session_update',+ update: { content: [{ type: 'content', content: { type: 'text', text: printed } }] },+ ts: 1,+ }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(png);+ expect(JSON.parse(JSON.parse(text).update.content[0].content.text)).toEqual({+ screenshot: '[omitted base64 data, 6000 bytes]',+ icon: '[omitted image/png, 6000 bytes]',+ ok: true,+ });+ });++ test('omits base64 data on a line that is not valid JSON', async () => {+ const dir = tmp();+ const cut = Buffer.alloc(6000, 6).toString('base64').slice(0, 5000);+ const printed = Buffer.alloc(4500, 7).toString('base64');+ writeTranscript(+ dir,+ `{"kind":"session_update","update":{"rawOutput":{"screenshot":"${cut}{"kind":"turn_ended","ts":2}\nscreenshot saved: ${printed}\n`,+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(text).not.toContain(cut);+ expect(text).not.toContain(printed);+ expect(text).toContain('"screenshot":"[omitted base64 data, 3750 bytes]{"');+ expect(text).toContain('screenshot saved: [omitted base64 data, 4500 bytes]');+ });++ test('keeps the text around a leading data URL and counts only its payload', async () => {+ const dir = tmp();+ writeTranscript(+ dir,+ ndjson({+ kind: 'agent_stderr',+ line: 'data:text/plain;base64,aGVsbG8= then here is my note',+ ts: 1,+ }),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');++ expect(JSON.parse(text).line).toBe('[omitted text/plain, 5 bytes] then here is my note');+ });++ test('omits bare base64 from the threshold up, and never inside a text payload', async () => {+ const dir = tmp();+ const below = 'A'.repeat(BARE_BASE64_MIN_LENGTH - 1);+ const at = 'A'.repeat(BARE_BASE64_MIN_LENGTH);+ const textFile = 'A'.repeat(5000);+ writeTranscript(+ dir,+ ndjson(+ { kind: 'agent_stderr', line: below, ts: 1 },+ { kind: 'agent_stderr', line: at, ts: 2 },+ {+ kind: 'user_message',+ content: 'see the attached file',+ attachments: [+ {+ kind: 'blob',+ data: textFile,+ textPayload: true,+ mimeType: 'text/plain',+ name: 'a.txt',+ },+ ],+ ts: 3,+ },+ ),+ );++ const { text } = stagedFile(await stageFrom(dir), '.ndjson');+ const [first, second, third] = text+ .trimEnd()+ .split('\n')+ .map((line) => JSON.parse(line));++ expect(first.line).toBe(below);+ expect(second.line).toBe(`[omitted base64 data, ${Buffer.byteLength(at, 'base64')} bytes]`);+ expect(third.attachments[0].data).toBe(textFile);+ });+});diff --git a/packages/desktop/src/main/bug-report-agent-chat.ts b/packages/desktop/src/main/bug-report-agent-chat.tsnew file mode 100644index 000000000..6675afdd9--- /dev/null+++ b/packages/desktop/src/main/bug-report-agent-chat.ts@@ -0,0 +1,576 @@+import { randomUUID } from 'node:crypto';+import { constants } from 'node:fs';+import { type FileHandle, lstat, open, writeFile } from 'node:fs/promises';+import { homedir } from 'node:os';+import { join } from 'node:path';+import type { BundleExtraFile } from '@inkeep/open-knowledge';+import { BUG_REPORT_AGENT_CHAT_ZIP_DIR, OK_DIR, redactSecrets } from '@inkeep/open-knowledge-core';+import type { CodexLegacyAgentIdentity } from '@inkeep/open-knowledge-core/acp/codex-legacy-notice';+import {+ acpThreadStoreRoots,+ acpThreadsDir,+ getLocalDir,+ isMintedThreadId,+ streamedChunkOf,+} from '@inkeep/open-knowledge-server';++const AGENT_CHAT_TRANSCRIPT_MAX_BYTES = 4 * 1024 * 1024;++const AGENT_CHAT_READ_WINDOW_FACTOR = 4;++const AGENT_CHAT_META_MAX_BYTES = 256 * 1024;++const AGENT_CHAT_META_INDENT = 1;++const NESTED_JSON_MAX_DEPTH = 2;++export const TRUNCATED_EVENT_KIND = 'bug_report_truncated_event';++export const OMITTED_EVENTS_KIND = 'bug_report_omitted_events';++const OMITTED_EVENTS_LINE = JSON.stringify({ kind: OMITTED_EVENTS_KIND });++// biome-ignore lint/suspicious/noControlCharactersInRegex: ESC and BEL bytes are what this splits on+const ANSI_ESCAPE = /(\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[ -/]*[0-~])/;++const UNDECODED_ESCAPE =+ /((?<!\\)\\+(?:(?:u001[bB]|x1[bB]|033|e)\[[0-?]*[ -/]*[@-~]|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-3][0-7]{2}|[0-7]{1,2}|[A-Za-z0-9_])|%[0-9A-Fa-f]{2})/;++const PRIVATE_KEY_BEGIN = /-----BEGIN [A-Z0-9 ]{0,40}PRIVATE KEY(?: BLOCK)?-----/g;++const PRIVATE_KEY_END = /-----END [A-Z0-9 ]{0,40}PRIVATE KEY(?: BLOCK)?-----/g;++const PRIVATE_KEY_PATTERN = 'private-key';++const MIME_TYPE = /^[\w.+-]{1,100}\/[\w.+-]{1,100}$/;++const DATA_URL_RUN =+ /data:([\w.+-]{1,100}\/[\w.+-]{1,100})(?:;[\w.+-]{1,100}=[\w.+-]{1,100})*;base64,([A-Za-z0-9+/]+={0,2})/g;++export const BARE_BASE64_MIN_LENGTH = 4096;++const BARE_BASE64_RUN = new RegExp(+ `(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{${BARE_BASE64_MIN_LENGTH},}={0,2}`,+ 'g',+);++export function isAgentChatThreadId(value: unknown): value is string {+ return typeof value === 'string' && isMintedThreadId(value);+}++export function defaultAgentChatThreadDirs(+ projectDir: string | null,+ home: string = homedir(),+): string[] {+ return acpThreadStoreRoots(+ join(home, OK_DIR),+ projectDir === null ? null : getLocalDir(projectDir),+ ).map((root) => acpThreadsDir(root));+}++interface ScrubTally {+ readonly patterns: Set<string>;+ readonly redacting: boolean;+ redactions: number;+ omittedPayloads: number;+}++function newTally(): ScrubTally {+ return { patterns: new Set(), redacting: true, redactions: 0, omittedPayloads: 0 };+}++function redactPrivateKeyBlocks(text: string, tally: ScrubTally): string {+ PRIVATE_KEY_BEGIN.lastIndex = 0;+ let begin = PRIVATE_KEY_BEGIN.exec(text);+ const firstBegin = begin === null ? text.length : begin.index;+ let copied = 0;+ PRIVATE_KEY_END.lastIndex = 0;+ let headlessEnd = PRIVATE_KEY_END.exec(text);+ while (headlessEnd !== null && headlessEnd.index < firstBegin) {+ copied = PRIVATE_KEY_END.lastIndex;+ headlessEnd = PRIVATE_KEY_END.exec(text);+ }+ if (begin === null && copied === 0) return text;+ const pieces: string[] = copied === 0 ? [] : ['[REDACTED-PRIVATE-KEY]'];+ while (begin !== null) {+ pieces.push(text.slice(copied, begin.index), '[REDACTED-PRIVATE-KEY]');+ PRIVATE_KEY_END.lastIndex = PRIVATE_KEY_BEGIN.lastIndex;+ const end = PRIVATE_KEY_END.exec(text);+ copied = end === null ? text.length : PRIVATE_KEY_END.lastIndex;+ PRIVATE_KEY_BEGIN.lastIndex = copied;+ begin = end === null ? null : PRIVATE_KEY_BEGIN.exec(text);+ }+ pieces.push(text.slice(copied));+ tally.patterns.add(PRIVATE_KEY_PATTERN);+ return pieces.join('');+}++function redactBetweenSeparators(parts: string[], tally: ScrubTally): void {+ for (let index = 0; index < parts.length; index += 2) {+ const part = parts[index] ?? '';+ const result = redactSecrets(part);+ if (result.redacted === part) continue;+ for (const pattern of result.patterns) tally.patterns.add(pattern);+ parts[index] = result.redacted;+ }+}++function scrubPlainText(text: string, tally: ScrubTally): string {+ if (!tally.redacting) return text;+ const aroundAnsi = redactPrivateKeyBlocks(text, tally).split(ANSI_ESCAPE);+ redactBetweenSeparators(aroundAnsi, tally);+ const aroundEscapes = aroundAnsi.join('').split(UNDECODED_ESCAPE);+ redactBetweenSeparators(aroundEscapes, tally);+ const scrubbed = aroundEscapes.join('');+ if (scrubbed !== text) tally.redactions += 1;+ return scrubbed;+}++function scrubLiteral(+ body: string,+ closed: boolean,+ tally: ScrubTally,+ depth: number,+ markedAsText: boolean,+): string | null {+ let decoded: unknown;+ try {+ decoded = JSON.parse(`"${body}"`);+ } catch {+ return null;+ }+ if (typeof decoded !== 'string') return null;+ const scrubbed = scrubString(decoded, tally, depth, markedAsText);+ if (scrubbed === decoded) return null;+ const encoded = JSON.stringify(scrubbed);+ return closed ? encoded : encoded.slice(0, -1);+}++function replaceStringLiterals(+ text: string,+ includeUnclosed: boolean,+ replace: (body: string, closed: boolean) => string | null,+): string {+ const pieces: string[] = [];+ let copiedUpTo = 0;+ let open = text.indexOf('"');+ while (open !== -1) {+ let cursor = open + 1;+ while (cursor < text.length && text[cursor] !== '"') {+ cursor += text[cursor] === '\\' ? 2 : 1;+ }+ const closed = cursor < text.length;+ if (!closed && !includeUnclosed) break;+ const bodyEnd = cursor > text.length ? text.length - 1 : cursor;+ const end = closed ? cursor + 1 : text.length;+ const replacement = replace(text.slice(open + 1, bodyEnd), closed);+ if (replacement !== null) {+ pieces.push(text.slice(copiedUpTo, open), replacement);+ copiedUpTo = end;+ }+ if (!closed) break;+ open = text.indexOf('"', end);+ }+ if (pieces.length === 0) return text;+ pieces.push(text.slice(copiedUpTo));+ return pieces.join('');+}++function scrubString(+ value: string,+ tally: ScrubTally,+ depth: number,+ markedAsText: boolean,+): string {+ const withoutPayloads = omitInlinePayloads(value, tally, markedAsText);+ const withLiterals =+ depth < NESTED_JSON_MAX_DEPTH+ ? replaceStringLiterals(withoutPayloads, false, (body) =>+ scrubLiteral(body, true, tally, depth + 1, markedAsText),+ )+ : withoutPayloads;+ return scrubPlainText(withLiterals, tally);+}++function omitEmbeddedDataUrls(text: string, tally: ScrubTally): string {+ return text.replace(DATA_URL_RUN, (_run: string, mimeType: string, payload: string) => {+ tally.omittedPayloads += 1;+ return `[omitted ${mimeType}, ${Buffer.byteLength(payload, 'base64')} bytes]`;+ });+}++function omitInlinePayloads(value: string, tally: ScrubTally, markedAsText: boolean): string {+ const withoutDataUrls = omitEmbeddedDataUrls(value, tally);+ if (markedAsText) return withoutDataUrls;+ return withoutDataUrls.replace(BARE_BASE64_RUN, (run: string) => {+ tally.omittedPayloads += 1;+ return `[omitted base64 data, ${Buffer.byteLength(run, 'base64')} bytes]`;+ });+}++function inlinePayloadKey(node: Record<string, unknown>): 'data' | 'blob' | null {+ if (typeof node.data === 'string') {+ if (node.type === 'image' || node.type === 'audio' || node.kind === 'image') return 'data';+ if (node.type === 'base64') return 'data';+ if (node.kind === 'blob' && node.textPayload !== true) return 'data';+ }+ if (typeof node.blob === 'string' && typeof node.uri === 'string') return 'blob';+ return null;+}++function payloadPlaceholder(node: Record<string, unknown>, payload: string): string {+ const declaredType = typeof node.mimeType === 'string' ? node.mimeType : node.media_type;+ const mimeType =+ typeof declaredType === 'string' && MIME_TYPE.test(declaredType)+ ? declaredType+ : 'unknown type';+ const bytes =+ typeof node.sizeBytes === 'number' &&+ Number.isSafeInteger(node.sizeBytes) &&+ node.sizeBytes >= 0+ ? node.sizeBytes+ : Buffer.byteLength(payload, 'base64');+ return `[omitted ${mimeType}, ${bytes} bytes]`;+}++function scrubNode(node: unknown, tally: ScrubTally, markedAsText = false): unknown {+ if (typeof node === 'string') return scrubString(node, tally, 0, markedAsText);+ if (Array.isArray(node)) return node.map((item) => scrubNode(item, tally, markedAsText));+ if (node === null || typeof node !== 'object') return node;+ const record = node as Record<string, unknown>;+ const payloadKey = inlinePayloadKey(record);+ const childrenMarkedAsText = markedAsText || record.textPayload === true;+ const scrubbed: Record<string, unknown> = Object.create(null);+ for (const [key, value] of Object.entries(record)) {+ if (key === payloadKey && typeof value === 'string') {+ scrubbed[key] = payloadPlaceholder(record, value);+ tally.omittedPayloads += 1;+ } else {+ scrubbed[key] = scrubNode(value, tally, childrenMarkedAsText);+ }+ }+ return scrubbed;+}++function scrubJsonText(text: string, tally: ScrubTally, indent?: number): string {+ let parsed: unknown;+ try {+ parsed = JSON.parse(text);+ } catch {+ const withLiterals = replaceStringLiterals(text, true, (body, closed) =>+ scrubLiteral(body, closed, tally, 0, false),+ );+ return scrubPlainText(omitInlinePayloads(withLiterals, tally, false), tally);+ }+ const mutationsBefore = tally.redactions + tally.omittedPayloads;+ const scrubbed = scrubNode(parsed, tally);+ const serialized =+ tally.redactions + tally.omittedPayloads === mutationsBefore+ ? text+ : `${JSON.stringify(scrubbed, null, indent)}${text.slice(text.trimEnd().length)}`;+ return scrubPlainText(serialized, tally);+}++function cutEventLine(line: string, maxBytes: number): string {+ const bytes = Buffer.from(line, 'utf8');+ for (let headBytes = Math.floor(maxBytes / 4); ; headBytes = Math.floor(headBytes / 2)) {+ const marker = JSON.stringify({+ kind: TRUNCATED_EVENT_KIND,+ bytes: bytes.length,+ head: bytes.subarray(0, headBytes).toString('utf8'),+ });+ if (Buffer.byteLength(marker) < maxBytes || headBytes === 0) return marker;+ }+}++interface TailWindow {+ readonly text: string;+ readonly fromStart: boolean;+}++interface ScrubbedTranscript {+ readonly text: string;+ readonly truncated: boolean;+ readonly redactedLines: number;+ readonly patterns: readonly string[];+}++function objectOf(value: unknown): Record<string, unknown> | null {+ return value !== null && typeof value === 'object' && !Array.isArray(value)+ ? (value as Record<string, unknown>)+ : null;+}++function withJoinedText(event: Record<string, unknown>, text: string): Record<string, unknown> {+ if (event.kind === 'terminal_output') return { ...event, chunk: text };+ const update = objectOf(event.update);+ return { ...event, update: { ...update, content: { ...objectOf(update?.content), text } } };+}++function joinStreamedLines(+ lines: readonly string[],+ agent: CodexLegacyAgentIdentity | null,+): string[] {+ const joined: string[] = [];+ let run: {+ stream: string;+ first: Record<string, unknown>;+ line: string;+ parts: string[];+ times: unknown[];+ } | null = null;+ const closeRun = (): void => {+ if (run === null) return;+ joined.push(+ run.parts.length === 1+ ? run.line+ : JSON.stringify({ ...withJoinedText(run.first, run.parts.join('')), chunkTs: run.times }),+ );+ run = null;+ };+ for (const line of lines) {+ let event: Record<string, unknown> | null = null;+ try {+ event = objectOf(JSON.parse(line));+ } catch {}+ const chunk = event === null ? null : streamedChunkOf(event, agent);+ if (event !== null && chunk !== null && run !== null && run.stream === chunk.stream) {+ run.parts.push(chunk.text);+ run.times.push(event.ts ?? null);+ continue;+ }+ closeRun();+ if (event === null || chunk === null) joined.push(line);+ else {+ run = {+ stream: chunk.stream,+ first: event,+ line,+ parts: [chunk.text],+ times: [event.ts ?? null],+ };+ }+ }+ closeRun();+ return joined;+}++function scrubTranscript(+ window: TailWindow,+ maxBytes: number,+ agent: CodexLegacyAgentIdentity | null,+): ScrubbedTranscript | null {+ const windowLines = window.text.split('\n');+ windowLines.pop();+ if (!window.fromStart) {+ if (windowLines.length <= 1) return null;+ windowLines.shift();+ }+ const lines = joinStreamedLines(windowLines, agent);+ const markerBytes = Buffer.byteLength(OMITTED_EVENTS_LINE) + 1;+ const kept: string[] = [];+ const patterns = new Set<string>();+ let used = 0;+ let redactedLines = 0;+ let cut = false;+ let omittedEarlier = !window.fromStart;+ for (let index = lines.length - 1; index >= 0; index -= 1) {+ const budget = index > 0 || !window.fromStart ? maxBytes - markerBytes : maxBytes;+ const tally = newTally();+ let line = scrubJsonText(lines[index] ?? '', tally);+ if (used + Buffer.byteLength(line) + 1 > budget) {+ if (kept.length > 0) {+ omittedEarlier = true;+ break;+ }+ cut = true;+ line = cutEventLine(line, budget);+ }+ kept.push(line);+ used += Buffer.byteLength(line) + 1;+ if (tally.redactions > 0) redactedLines += 1;+ for (const pattern of tally.patterns) patterns.add(pattern);+ }+ if (omittedEarlier) kept.push(OMITTED_EVENTS_LINE);+ kept.reverse();+ return {+ text: kept.length === 0 ? '' : `${kept.join('\n')}\n`,+ truncated: omittedEarlier || cut,+ redactedLines,+ patterns: [...patterns],+ };+}++interface OpenedFile {+ readonly handle: FileHandle;+ readonly size: number;+}++async function openRegularFile(path: string): Promise<OpenedFile | null> {+ try {+ if (!(await lstat(path)).isFile()) return null;+ } catch (err) {+ if ((err as NodeJS.ErrnoException).code === 'ENOENT') return null;+ throw err;+ }+ let handle: FileHandle;+ try {+ handle = await open(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));+ } catch (err) {+ const code = (err as NodeJS.ErrnoException).code;+ if (code === 'ENOENT' || code === 'ELOOP') return null;+ throw err;+ }+ try {+ const info = await handle.stat();+ if (info.isFile()) return { handle, size: info.size };+ } catch (err) {+ await handle.close();+ throw err;+ }+ await handle.close();+ return null;+}++async function readTail(file: OpenedFile, maxBytes: number): Promise<TailWindow> {+ const start = Math.max(0, file.size - maxBytes);+ const buffer = Buffer.alloc(file.size - start);+ let filled = 0;+ while (filled < buffer.length) {+ const { bytesRead } = await file.handle.read(+ buffer,+ filled,+ buffer.length - filled,+ start + filled,+ );+ if (bytesRead === 0) break;+ filled += bytesRead;+ }+ return { text: buffer.subarray(0, filled).toString('utf8'), fromStart: start === 0 };+}++type MetadataRead =+ | { readonly status: 'read'; readonly text: string }+ | { readonly status: 'not-found' }+ | { readonly status: 'too-large'; readonly sizeBytes: number };++async function readMetadata(path: string): Promise<MetadataRead> {+ const file = await openRegularFile(path);+ if (file === null) return { status: 'not-found' };+ try {+ if (file.size > AGENT_CHAT_META_MAX_BYTES) return { status: 'too-large', sizeBytes: file.size };+ return { status: 'read', text: (await readTail(file, AGENT_CHAT_META_MAX_BYTES)).text };+ } finally {+ await file.handle.close();+ }+}++async function readAgentRef(path: string): Promise<CodexLegacyAgentIdentity | null> {+ try {+ const read = await readMetadata(path);+ if (read.status !== 'read') return null;+ const ref = objectOf(objectOf(JSON.parse(read.text))?.agentRef);+ const source = ref?.source;+ return (source === 'registry' || source === 'custom') && typeof ref?.id === 'string'+ ? { source, id: ref.id }+ : null;+ } catch {+ return null;+ }+}++function countChangedLines(before: string, after: string): number {+ const beforeLines = before.split('\n');+ const afterLines = after.split('\n');+ let changed = 0;+ for (let index = 0; index < Math.max(beforeLines.length, afterLines.length); index += 1) {+ if (beforeLines[index] !== afterLines[index]) changed += 1;+ }+ return changed;+}++export type AgentChatMetadataOutcome =+ | { readonly status: 'attached' }+ | { readonly status: 'not-found' }+ | { readonly status: 'too-large'; readonly sizeBytes: number }+ | { readonly status: 'failed'; readonly error: unknown };++export type AgentChatStageOutcome =+ | {+ readonly status: 'attached';+ readonly files: readonly BundleExtraFile[];+ readonly truncated: boolean;+ readonly metadata: AgentChatMetadataOutcome;+ }+ | { readonly status: 'not-found' }+ | { readonly status: 'too-large' };++export async function stageAgentChatTranscript(opts: {+ threadId: string;+ threadDirs: readonly string[];+ tmpDir: string;+ tmpPaths: string[];+ maxBytes?: number;+}): Promise<AgentChatStageOutcome> {+ const maxBytes = opts.maxBytes ?? AGENT_CHAT_TRANSCRIPT_MAX_BYTES;+ const files: BundleExtraFile[] = [];+ const stage = async (+ name: string,+ text: string,+ scrubbed: BundleExtraFile['scrubbed'],+ ): Promise<void> => {+ const sourcePath = join(opts.tmpDir, `ok-bugreport-agent-chat-${randomUUID()}-${name}`);+ opts.tmpPaths.push(sourcePath);+ await writeFile(sourcePath, text, { mode: 0o600 });+ files.push({ sourcePath, zipName: `${BUG_REPORT_AGENT_CHAT_ZIP_DIR}/${name}`, scrubbed });+ };+ const stageMetadata = async (dir: string): Promise<AgentChatMetadataOutcome> => {+ const read = await readMetadata(join(dir, `${opts.threadId}.meta.json`));+ if (read.status !== 'read') return read;+ const tally = newTally();+ const text = scrubJsonText(read.text, tally, AGENT_CHAT_META_INDENT);+ const unredacted = scrubJsonText(+ read.text,+ { ...newTally(), redacting: false },+ AGENT_CHAT_META_INDENT,+ );+ await stage(`${opts.threadId}.meta.json`, text, {+ lineCount: countChangedLines(unredacted, text),+ patterns: [...tally.patterns],+ });+ return { status: 'attached' };+ };+ let lookupError: unknown = null;+ for (const dir of opts.threadDirs) {+ let events: OpenedFile | null;+ try {+ events = await openRegularFile(join(dir, `${opts.threadId}.ndjson`));+ } catch (err) {+ lookupError ??= err;+ continue;+ }+ if (events === null) continue;+ let window: TailWindow;+ try {+ window = await readTail(events, maxBytes * AGENT_CHAT_READ_WINDOW_FACTOR);+ } finally {+ await events.handle.close();+ }+ const transcript = scrubTranscript(+ window,+ maxBytes,+ await readAgentRef(join(dir, `${opts.threadId}.meta.json`)),+ );+ if (transcript === null) return { status: 'too-large' };+ await stage(`${opts.threadId}.ndjson`, transcript.text, {+ lineCount: transcript.redactedLines,+ patterns: [...transcript.patterns],+ });+ const metadata = await stageMetadata(dir).catch(+ (error: unknown): AgentChatMetadataOutcome => ({ status: 'failed', error }),+ );+ return { status: 'attached', files, truncated: transcript.truncated, metadata };+ }+ if (lookupError !== null) throw lookupError;+ return { status: 'not-found' };+}diff --git a/packages/desktop/src/main/crash-detection.ts b/packages/desktop/src/main/crash-detection.tsindex 331e60970..7cda10587 100644--- a/packages/desktop/src/main/crash-detection.ts+++ b/packages/desktop/src/main/crash-detection.ts@@ -8,7 +8,10 @@ import {writeFileSync,} from 'node:fs';import { dirname, join } from 'node:path';-import type { OkBugReportCrashDetectedEvent } from '@inkeep/open-knowledge-core';+import {+ MINIDUMP_FILE_EXTENSION,+ type OkBugReportCrashDetectedEvent,+} from '@inkeep/open-knowledge-core';import { asReportableAppVersion } from './crashed-app-version.ts';import type { DesktopCrashProcessSnapshot } from './desktop-process-observability.ts';import {@@ -218,7 +221,7 @@ function collectMinidumpEntries(dir: string, depth: number, out: MinidumpEntry[]if (depth > 0) collectMinidumpEntries(entryPath, depth - 1, out);continue;}- if (!entry.name.endsWith('.dmp')) continue;+ if (!entry.name.endsWith(MINIDUMP_FILE_EXTENSION)) continue;try {out.push({ path: entryPath, mtimeMs: statSync(entryPath).mtimeMs });} catch {}diff --git a/packages/desktop/src/main/ipc/bug-report.test.ts b/packages/desktop/src/main/ipc/bug-report.test.tsindex 56b6c57ad..f06875376 100644--- a/packages/desktop/src/main/ipc/bug-report.test.ts+++ b/packages/desktop/src/main/ipc/bug-report.test.ts@@ -1,6 +1,7 @@import { execFileSync, execSync } from 'node:child_process';import {appendFileSync,+ chmodSync,existsSync,mkdirSync,mkdtempSync,@@ -188,6 +189,316 @@ function makeLogRecorder() {};}+describe('handleBugReportCreate — agent chat transcript', () => {+ const threadId = '0f5c0c0b-f439-4e49-84d6-6a6a97d675c6';++ test("attaches the chosen chat's transcript with secrets scrubbed", async () => {+ const threadsDir = makeTmpDir('ok-bugreport-threads-');+ const secret = `ghp_${'a'.repeat(36)}`;+ writeFileSync(+ join(threadsDir, `${threadId}.ndjson`),+ `{"kind":"user_message","content":"use ${secret}"}\n{"kind":"session_update"}\n`,+ );+ writeFileSync(join(threadsDir, `${threadId}.meta.json`), '{"version":1}');+ const deps = makeDeps({+ projectDir: makeProjectDir(),+ agentChatThreadDirs: [makeTmpDir('ok-bugreport-empty-'), threadsDir],+ });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ const entries = listZipEntries(result.zipPath);+ expect(entries).toContain(`extra/agent-chat/${threadId}.ndjson`);+ expect(entries).toContain(`extra/agent-chat/${threadId}.meta.json`);+ const transcript = readZipEntry(result.zipPath, `extra/agent-chat/${threadId}.ndjson`);+ expect(transcript).toContain('[REDACTED-GH-PAT]');+ expect(transcript).not.toContain(secret);+ const audit = {+ file: `extra/agent-chat/${threadId}.ndjson`,+ lineCount: 1,+ patterns: ['github-pat'],+ };+ expect(result.summary.redactions).toContainEqual(audit);+ expect(JSON.parse(readZipEntry(result.zipPath, 'MANIFEST.json')).redactions).toContainEqual(+ audit,+ );+ expect(readZipEntry(result.zipPath, 'README.md')).toContain(+ '1 line(s) were scrubbed across 1 file(s).',+ );+ });++ test('a token that starts a line of tool output never reaches the zip', async () => {+ const threadsDir = makeTmpDir('ok-bugreport-threads-');+ const secret = `gho_${'b'.repeat(36)}`;+ writeFileSync(+ join(threadsDir, `${threadId}.ndjson`),+ `${JSON.stringify({ kind: 'agent_stderr', line: `$ gh auth token\n${secret}\n`, ts: 1 })}\n`,+ );+ const deps = makeDeps({ projectDir: makeProjectDir(), agentChatThreadDirs: [threadsDir] });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ const transcript = readZipEntry(result.zipPath, `extra/agent-chat/${threadId}.ndjson`);+ expect(transcript).not.toContain(secret);+ expect(transcript).toContain('[REDACTED-GH-PAT]');+ });++ test("a detailed report audits the transcript's redactions in its manifest", async () => {+ const threadsDir = makeTmpDir('ok-bugreport-threads-');+ const secret = `ghp_${'c'.repeat(36)}`;+ writeFileSync(+ join(threadsDir, `${threadId}.ndjson`),+ `${JSON.stringify({ kind: 'agent_stderr', line: `token ${secret}`, ts: 1 })}\n`,+ );+ const deps = makeDeps({ projectDir: makeProjectDir(), agentChatThreadDirs: [threadsDir] });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'full',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ expect(readZipEntry(result.zipPath, `extra/agent-chat/${threadId}.ndjson`)).not.toContain(+ secret,+ );+ const audit = {+ file: `extra/agent-chat/${threadId}.ndjson`,+ lineCount: 1,+ patterns: ['github-pat'],+ };+ expect(result.summary.redactions).toContainEqual(audit);+ expect(+ JSON.parse(readZipEntry(result.zipPath, 'manifest.json')).redaction.secretScrub.redactions,+ ).toContainEqual(audit);+ });++ test('a newest event too large to read is logged as left out, with the reason', async () => {+ const threadsDir = makeTmpDir('ok-bugreport-threads-');+ writeFileSync(+ join(threadsDir, `${threadId}.ndjson`),+ `{"kind":"turn_started","ts":1}\n${JSON.stringify({ kind: 'agent_stderr', line: 'x'.repeat(600), ts: 2 })}\n`,+ );+ const recorder = makeLogRecorder();+ const deps = makeDeps({+ projectDir: makeProjectDir(),+ agentChatThreadDirs: [threadsDir],+ agentChatTranscriptMaxBytes: 100,+ logger: recorder.logger,+ });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ expect(listZipEntries(result.zipPath).some((e) => e.includes('agent-chat/'))).toBe(false);+ const chatLines = recorder.lines.filter((l) => l.payload.event === 'bug-report.agent-chat');+ expect(chatLines).toEqual([+ expect.objectContaining({+ level: 'warn',+ payload: expect.objectContaining({ threadId, attached: false, reason: 'too-large' }),+ }),+ ]);+ });++ test.skipIf(process.platform === 'win32' || process.getuid?.() === 0)(+ 'a transcript lookup that fails for another reason is logged with its error',+ async () => {+ const locked = join(makeTmpDir('ok-bugreport-threads-'), 'locked');+ mkdirSync(locked);+ writeFileSync(join(locked, `${threadId}.ndjson`), '{"kind":"turn_started","ts":1}\n');+ chmodSync(locked, 0o000);+ const recorder = makeLogRecorder();+ const deps = makeDeps({+ projectDir: makeProjectDir(),+ agentChatThreadDirs: [locked],+ logger: recorder.logger,+ });++ try {+ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ } finally {+ chmodSync(locked, 0o755);+ }+ const chatLine = recorder.lines.find((l) => l.payload.event === 'bug-report.agent-chat');+ expect(chatLine?.payload).toMatchObject({+ threadId,+ attached: false,+ reason: 'stage-failed',+ });+ expect(chatLine?.payload.err).toMatchObject({ code: 'EACCES' });+ },+ );++ test('missing metadata is logged as left out, and the transcript still goes in', async () => {+ const threadsDir = makeTmpDir('ok-bugreport-threads-');+ writeFileSync(join(threadsDir, `${threadId}.ndjson`), '{"kind":"turn_started","ts":1}\n');+ const recorder = makeLogRecorder();+ const deps = makeDeps({+ projectDir: makeProjectDir(),+ agentChatThreadDirs: [threadsDir],+ logger: recorder.logger,+ });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ const entries = listZipEntries(result.zipPath);+ expect(entries).toContain(`extra/agent-chat/${threadId}.ndjson`);+ expect(entries).not.toContain(`extra/agent-chat/${threadId}.meta.json`);+ expect(recorder.lines).toContainEqual(+ expect.objectContaining({+ level: 'info',+ payload: expect.objectContaining({+ event: 'bug-report.agent-chat',+ threadId,+ attached: true,+ }),+ }),+ );+ expect(+ recorder.lines.filter((l) => l.payload.event === 'bug-report.agent-chat-metadata'),+ ).toEqual([+ expect.objectContaining({+ level: 'warn',+ payload: expect.objectContaining({ threadId, attached: false, reason: 'not-found' }),+ }),+ ]);+ });++ test('metadata too large to read is logged as left out, and the transcript still goes in', async () => {+ const threadsDir = makeTmpDir('ok-bugreport-threads-');+ writeFileSync(join(threadsDir, `${threadId}.ndjson`), '{"kind":"turn_started","ts":1}\n');+ writeFileSync(+ join(threadsDir, `${threadId}.meta.json`),+ JSON.stringify({ version: 1, info: { title: 'x'.repeat(300_000) } }),+ );+ const recorder = makeLogRecorder();+ const deps = makeDeps({+ projectDir: makeProjectDir(),+ agentChatThreadDirs: [threadsDir],+ logger: recorder.logger,+ });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ const entries = listZipEntries(result.zipPath);+ expect(entries).toContain(`extra/agent-chat/${threadId}.ndjson`);+ expect(entries).not.toContain(`extra/agent-chat/${threadId}.meta.json`);+ expect(+ recorder.lines.filter((l) => l.payload.event === 'bug-report.agent-chat-metadata'),+ ).toEqual([+ expect.objectContaining({+ level: 'warn',+ payload: expect.objectContaining({ threadId, attached: false, reason: 'too-large' }),+ }),+ ]);+ });++ test.skipIf(process.platform === 'win32' || process.getuid?.() === 0)(+ 'metadata that cannot be read is logged with its error, and the transcript still goes in',+ async () => {+ const threadsDir = makeTmpDir('ok-bugreport-threads-');+ writeFileSync(join(threadsDir, `${threadId}.ndjson`), '{"kind":"turn_started","ts":1}\n');+ const metaPath = join(threadsDir, `${threadId}.meta.json`);+ writeFileSync(metaPath, '{"version":1}');+ chmodSync(metaPath, 0o000);+ const recorder = makeLogRecorder();+ const deps = makeDeps({+ projectDir: makeProjectDir(),+ agentChatThreadDirs: [threadsDir],+ logger: recorder.logger,+ });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ expect(listZipEntries(result.zipPath)).toContain(`extra/agent-chat/${threadId}.ndjson`);+ const metadataLine = recorder.lines.find(+ (l) => l.payload.event === 'bug-report.agent-chat-metadata',+ );+ expect(metadataLine?.payload).toMatchObject({+ threadId,+ attached: false,+ reason: 'stage-failed',+ });+ expect(metadataLine?.payload.err).toMatchObject({ code: 'EACCES' });+ },+ );++ test('a transcript that cannot be found leaves the rest of the report intact', async () => {+ const recorder = makeLogRecorder();+ const deps = makeDeps({+ projectDir: makeProjectDir(),+ agentChatThreadDirs: [makeTmpDir('ok-bugreport-empty-')],+ logger: recorder.logger,+ });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: threadId,+ });++ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);+ expect(listZipEntries(result.zipPath).some((e) => e.includes('agent-chat/'))).toBe(false);+ expect(recorder.lines).toContainEqual(+ expect.objectContaining({+ level: 'warn',+ payload: expect.objectContaining({+ event: 'bug-report.agent-chat',+ threadId,+ attached: false,+ }),+ }),+ );+ });++ test('rejects a thread id that is not a chat id', async () => {+ const deps = makeDeps({ projectDir: makeProjectDir() });++ const result = await handleBugReportCreate(deps, {+ kind: 'create',+ level: 'standard',+ agentChatThreadId: '../../../etc/passwd',+ });++ expect(result.ok).toBe(false);+ if (!result.ok) expect(result.error).toBe('invalid-request');+ });+});+describe('handleBugReportCreate — project bundle', () => {test('builds the zip at the returned path with the project content set and the note', async () => {const projectDir = makeProjectDir();diff --git a/packages/desktop/src/main/ipc/bug-report.ts b/packages/desktop/src/main/ipc/bug-report.tsindex b32177a6a..3ecd916af 100644--- a/packages/desktop/src/main/ipc/bug-report.ts+++ b/packages/desktop/src/main/ipc/bug-report.ts@@ -3,6 +3,7 @@ import { readFile, realpath, stat, unlink, writeFile } from 'node:fs/promises';import { tmpdir } from 'node:os';import { basename, dirname, join } from 'node:path';import {+ type BundleExtraFile,type BundleLogger,collectReportBundle,defaultBugReportZipPath,@@ -33,6 +34,13 @@ import type {OkBugReportAttachmentInput,OkBugReportSendInput,} from '@inkeep/open-knowledge-core/desktop-bridge';+import {+ type AgentChatMetadataOutcome,+ type AgentChatStageOutcome,+ defaultAgentChatThreadDirs,+ isAgentChatThreadId,+ stageAgentChatTranscript,+} from '../bug-report-agent-chat.ts';import { type BugReportSendTrace, beginSendTrace } from '../bug-report-trace.ts';import type { MinidumpReportLookup } from '../crash-detection.ts';import { logIpcError } from '../ipc-log.ts';@@ -50,6 +58,7 @@ export interface OkBugReportCreateRequest {includeCrashDump?: boolean;includeScreenshot?: boolean;attachments?: OkBugReportAttachmentInput[];+ agentChatThreadId?: string;}interface OkBugReportCaptureScreenshotRequest {@@ -112,6 +121,8 @@ export interface BugReportCreateDeps {onReportGenerated?: (meta: GeneratedReportMeta) => Promise<void>;onScreenshotStaged?: (reportId: string, png: Buffer) => void;onAttachmentsStaged?: (reportId: string, attachments: readonly StagedAttachment[]) => void;+ agentChatThreadDirs?: readonly string[];+ agentChatTranscriptMaxBytes?: number;}export interface StagedAttachment {@@ -165,7 +176,8 @@ function isCreateRequest(request: unknown): request is OkBugReportCreateRequestisValidNote(r.note) &&(r.includeCrashDump === undefined || typeof r.includeCrashDump === 'boolean') &&(r.includeScreenshot === undefined || typeof r.includeScreenshot === 'boolean') &&- isValidAttachments(r.attachments)+ isValidAttachments(r.attachments) &&+ (r.agentChatThreadId === undefined || isAgentChatThreadId(r.agentChatThreadId)));}@@ -221,6 +233,94 @@ function recordMinidumpDecision(} catch {}}+function assertNeverAgentChatStageOutcome(value: never): never {+ throw new Error(`unhandled agent chat stage outcome: ${JSON.stringify(value)}`);+}++function assertNeverAgentChatMetadataOutcome(value: never): never {+ throw new Error(`unhandled agent chat metadata outcome: ${JSON.stringify(value)}`);+}++function logAgentChatMetadataOmission(+ logger: BundleLogger | undefined,+ threadId: string,+ metadata: AgentChatMetadataOutcome,+): void {+ const event = 'bug-report.agent-chat-metadata';+ switch (metadata.status) {+ case 'attached':+ return;+ case 'not-found':+ logger?.warn(+ { event, threadId, attached: false, reason: 'not-found' },+ "bug-report: agent chat's metadata file not found; the report carries the transcript without it",+ );+ return;+ case 'too-large':+ logger?.warn(+ { event, threadId, attached: false, reason: 'too-large', sizeBytes: metadata.sizeBytes },+ "bug-report: agent chat's metadata file is too large to read; the report carries the transcript without it",+ );+ return;+ case 'failed':+ logger?.warn(+ { err: metadata.error, event, threadId, attached: false, reason: 'stage-failed' },+ "bug-report: agent chat's metadata could not be staged; the report carries the transcript without it",+ );+ return;+ default:+ assertNeverAgentChatMetadataOutcome(metadata);+ }+}++async function stageAgentChat(+ deps: BugReportCreateDeps,+ threadId: string,+ tmpPaths: string[],+): Promise<readonly BundleExtraFile[]> {+ let staged: AgentChatStageOutcome;+ try {+ staged = await stageAgentChatTranscript({+ threadId,+ threadDirs: deps.agentChatThreadDirs ?? defaultAgentChatThreadDirs(deps.projectDir),+ tmpDir: tmpdir(),+ tmpPaths,+ ...(deps.agentChatTranscriptMaxBytes !== undefined+ ? { maxBytes: deps.agentChatTranscriptMaxBytes }+ : {}),+ });+ } catch (err) {+ deps.logger?.warn(+ { err, event: 'bug-report.agent-chat', threadId, attached: false, reason: 'stage-failed' },+ 'bug-report: agent chat transcript could not be staged; the report goes without it',+ );+ return [];+ }+ switch (staged.status) {+ case 'attached':+ deps.logger?.info(+ { event: 'bug-report.agent-chat', threadId, attached: true, truncated: staged.truncated },+ 'bug-report: agent chat transcript attached',+ );+ logAgentChatMetadataOmission(deps.logger, threadId, staged.metadata);+ return staged.files;+ case 'too-large':+ deps.logger?.warn(+ { event: 'bug-report.agent-chat', threadId, attached: false, reason: 'too-large' },+ "bug-report: agent chat's newest event is too large to read; the report goes without it",+ );+ return [];+ case 'not-found':+ deps.logger?.warn(+ { event: 'bug-report.agent-chat', threadId, attached: false, reason: 'not-found' },+ 'bug-report: agent chat transcript not found; the report goes without it',+ );+ return [];+ default:+ return assertNeverAgentChatStageOutcome(staged);+ }+}+export async function handleBugReportCreate(deps: BugReportCreateDeps,request: OkBugReportCreateRequest,@@ -246,7 +346,7 @@ export async function handleBugReportCreate(const screenshotBytes =request.includeScreenshot === true ? (deps.screenshotPngBytes?.() ?? null) : null;- const extraFiles: { sourcePath: string; zipName?: string }[] = [];+ const extraFiles: BundleExtraFile[] = [];if (minidumpPath !== null) extraFiles.push({ sourcePath: minidumpPath });const dumpSizeBytes =@@ -305,6 +405,7 @@ export async function handleBugReportCreate(let screenshotTmpPath: string | null = null;const attachmentTmpPaths: string[] = [];+ const agentChatTmpPaths: string[] = [];try {if (screenshotBytes !== null) {screenshotTmpPath = join(tmpdir(), `ok-bugreport-screenshot-${randomUUID()}.png`);@@ -321,6 +422,11 @@ export async function handleBugReportCreate(zipName: `${BUG_REPORT_ATTACHMENTS_ZIP_DIR}/${index + 1}.${extension}`,});}+ if (request.agentChatThreadId !== undefined) {+ extraFiles.push(+ ...(await stageAgentChat(deps, request.agentChatThreadId, agentChatTmpPaths)),+ );+ }const outputPath = deps.outputPath ?? defaultBugReportZipPath();const { zipPath, summary } = await collectReportBundle({level: request.level,@@ -417,6 +523,14 @@ export async function handleBugReportCreate();});}+ for (const agentChatTmpPath of agentChatTmpPaths) {+ await unlink(agentChatTmpPath).catch((err: unknown) => {+ deps.logger?.warn(+ { agentChatTmpPath, err },+ 'bug-report: failed to remove temp agent chat file',+ );+ });+ }}}diff --git a/packages/desktop/src/preload/index.ts b/packages/desktop/src/preload/index.tsindex 1e4b5d2e5..6a7c0c423 100644--- a/packages/desktop/src/preload/index.ts+++ b/packages/desktop/src/preload/index.ts@@ -568,6 +568,7 @@ const bridge: OkDesktopBridge = {includeCrashDump: request.includeCrashDump,includeScreenshot: request.includeScreenshot,attachments: request.attachments,+ agentChatThreadId: request.agentChatThreadId,}) as Promise<OkBugReportCreateResult>,captureScreenshot: () =>invoke('ok:bug-report:dispatch', {diff --git a/packages/server/src/acp/event-log-bounds.ts b/packages/server/src/acp/event-log-bounds.tsindex 646847a25..0755de740 100644--- a/packages/server/src/acp/event-log-bounds.ts+++ b/packages/server/src/acp/event-log-bounds.ts@@ -71,34 +71,48 @@ function chunkMessageId(u: ChunkUpdate): string {return typeof u.messageId === 'string' ? u.messageId : 'default';}+export interface StreamedChunk {+ readonly stream: string;+ readonly text: string;+}++export function streamedChunkOf(+ event: unknown,+ agent: CodexLegacyAgentIdentity | null,+): StreamedChunk | null {+ if (typeof event !== 'object' || event === null) return null;+ const e = event as { kind?: unknown; terminalId?: unknown; chunk?: unknown; update?: unknown };+ if (e.kind === 'terminal_output') {+ return typeof e.terminalId === 'string' && typeof e.chunk === 'string'+ ? { stream: `terminal ${e.terminalId}`, text: e.chunk }+ : null;+ }+ if (e.kind !== 'session_update' || typeof e.update !== 'object' || e.update === null) {+ return null;+ }+ const update = e.update as ChunkUpdate;+ if (!COALESCIBLE_CHUNK_KINDS.has(update.sessionUpdate)) return null;+ if (isCodexLegacyWarningUpdate(update as SessionUpdate, agent)) return null;+ const text = chunkText(update.content);+ return text === null+ ? null+ : { stream: `${update.sessionUpdate} ${chunkMessageId(update)}`, text };+}+export function coalesceChunkInto(prev: ThreadEvent,next: ThreadEvent,agent: CodexLegacyAgentIdentity,): boolean {- if (prev.kind === 'terminal_output' && next.kind === 'terminal_output') {- if (prev.terminalId !== next.terminalId) return false;- if (prev.chunk.length >= COALESCE_TEXT_CAP) return false;- prev.chunk += next.chunk;+ const before = streamedChunkOf(prev, agent);+ const after = streamedChunkOf(next, agent);+ if (before === null || after === null || before.stream !== after.stream) return false;+ if (before.text.length >= COALESCE_TEXT_CAP) return false;+ if (prev.kind === 'terminal_output') {+ prev.chunk += after.text;return true;}- if (prev.kind !== 'session_update' || next.kind !== 'session_update') return false;- if (- isCodexLegacyWarningUpdate(prev.update, agent) ||- isCodexLegacyWarningUpdate(next.update, agent)- ) {- return false;- }- const p = prev.update as ChunkUpdate;- const n = next.update as ChunkUpdate;- if (p.sessionUpdate !== n.sessionUpdate || !COALESCIBLE_CHUNK_KINDS.has(n.sessionUpdate)) {- return false;- }- if (chunkMessageId(p) !== chunkMessageId(n)) return false;- const prevText = chunkText(p.content);- const nextText = chunkText(n.content);- if (prevText === null || nextText === null) return false;- if (prevText.length >= COALESCE_TEXT_CAP) return false;- p.content = { type: 'text', text: prevText + nextText };+ if (prev.kind !== 'session_update') return false;+ (prev.update as ChunkUpdate).content = { type: 'text', text: before.text + after.text };return true;}diff --git a/packages/server/src/acp/thread-manager.ts b/packages/server/src/acp/thread-manager.tsindex 260bd7118..779f24152 100644--- a/packages/server/src/acp/thread-manager.ts+++ b/packages/server/src/acp/thread-manager.ts@@ -169,7 +169,11 @@ import {threadAuthMethods,} from './terminal-auth.ts';import { AcpTerminalSet } from './terminals.ts';-import { type PersistedThreadMeta, ThreadPersistenceStore } from './thread-persistence.ts';+import {+ acpThreadStoreRoots,+ type PersistedThreadMeta,+ ThreadPersistenceStore,+} from './thread-persistence.ts';import { clampThreadTitle, deriveThreadTitle } from './thread-title.ts';export const MAX_ACP_THREADS = 8;@@ -527,9 +531,10 @@ export class AcpThreadManager {this.unwatchedTurnCancelMs = opts.unwatchedTurnCancelMs ?? DEFAULT_UNWATCHED_TURN_CANCEL_MS;this.unwatchedTurnKillMs = opts.unwatchedTurnKillMs ?? DEFAULT_UNWATCHED_TURN_KILL_MS;this.turnStallMs = opts.turnStallMs ?? DEFAULT_TURN_STALL_MS;+ const [primaryDir, legacyDir = null] = acpThreadStoreRoots(opts.globalDir, opts.localDir);this.persistence = new ThreadPersistenceStore({- primaryDir: opts.globalDir ?? opts.localDir,- legacyDir: opts.globalDir !== null ? opts.localDir : null,+ primaryDir,+ legacyDir,cwd: opts.globalDir !== null ? opts.contentDir : null,log: opts.log,});diff --git a/packages/server/src/acp/thread-persistence.test.ts b/packages/server/src/acp/thread-persistence.test.tsindex 8d1f238d7..bbcd28f38 100644--- a/packages/server/src/acp/thread-persistence.test.ts+++ b/packages/server/src/acp/thread-persistence.test.ts@@ -12,7 +12,12 @@ import { dirname, join } from 'node:path';import type { ThreadEvent, ThreadInfo } from '@inkeep/open-knowledge-core/acp/thread-protocol';import { afterEach, describe, expect, test } from 'vitest';import { getLogger } from '../logger.ts';-import { type PersistedThreadMeta, ThreadPersistenceStore } from './thread-persistence.ts';+import {+ acpThreadStoreRoots,+ acpThreadsDir,+ type PersistedThreadMeta,+ ThreadPersistenceStore,+} from './thread-persistence.ts';const log = getLogger('acp-persist-test');@@ -316,4 +321,35 @@ describe('ThreadPersistenceStore global dir + legacy fallback', () => {expect(store.eventsPath(TD)).toContain(legacy);expect(existsSync(join(legacy, 'threads', `${TD}.ndjson`))).toBe(true);});++ test('acpThreadStoreRoots lists the global store before the project store and leaves out an unknown one', () => {+ const global = tmp();+ const local = tmp();++ expect(acpThreadStoreRoots(global, local)).toEqual([global, local]);+ expect(acpThreadStoreRoots(null, local)).toEqual([local]);+ expect(acpThreadStoreRoots(global, null)).toEqual([global]);+ });++ test('acpThreadsDir names the directory each base dir keeps its transcripts and metadata in', async () => {+ const global = tmp();+ const legacy = tmp();+ const cwd = realpathSync(tmp());+ const seed = new ThreadPersistenceStore({ primaryDir: legacy, log });+ await seed.init();+ seed.queueMetaWrite(TL, metaCwd(TL, cwd));+ await seed.whenIdle(TL);++ const store = new ThreadPersistenceStore({ primaryDir: global, legacyDir: legacy, cwd, log });+ await store.init();+ await store.scan();+ store.queueMetaWrite(TN, metaCwd(TN, cwd));+ store.appendEvents(TN, [ev(0)]);+ await store.whenIdle(TN);++ expect(dirname(store.eventsPath(TN))).toBe(acpThreadsDir(global));+ expect(dirname(store.metaPath(TN))).toBe(acpThreadsDir(global));+ expect(dirname(store.eventsPath(TL))).toBe(acpThreadsDir(legacy));+ expect(dirname(store.metaPath(TL))).toBe(acpThreadsDir(legacy));+ });});diff --git a/packages/server/src/acp/thread-persistence.ts b/packages/server/src/acp/thread-persistence.tsindex 844d4e032..537de02a4 100644--- a/packages/server/src/acp/thread-persistence.ts+++ b/packages/server/src/acp/thread-persistence.ts@@ -20,6 +20,14 @@ const THREADS_SUBDIR = 'threads';const META_VERSION = 1;const READ_CHUNK_SIZE = 512;+export function acpThreadsDir(baseDir: string): string {+ return join(baseDir, THREADS_SUBDIR);+}++export function acpThreadStoreRoots(globalDir: string | null, localDir: string | null): string[] {+ return [globalDir, localDir].filter((dir) => dir !== null);+}+const MINTED_THREAD_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;export function isMintedThreadId(threadId: string): boolean {@@ -60,8 +68,8 @@ export class ThreadPersistenceStore {private readonly appendBroken = new Set<string>();constructor(opts: ThreadPersistenceStoreOptions) {- this.primaryThreadsDir = join(opts.primaryDir, THREADS_SUBDIR);- this.legacyThreadsDir = opts.legacyDir != null ? join(opts.legacyDir, THREADS_SUBDIR) : null;+ this.primaryThreadsDir = acpThreadsDir(opts.primaryDir);+ this.legacyThreadsDir = opts.legacyDir != null ? acpThreadsDir(opts.legacyDir) : null;this.cwd = opts.cwd ?? null;this.log = opts.log;this.writeThreadsDir = this.primaryThreadsDir;diff --git a/packages/server/src/index.ts b/packages/server/src/index.tsindex 866d3853c..a7804c92f 100644--- a/packages/server/src/index.ts+++ b/packages/server/src/index.ts@@ -3,6 +3,7 @@ export {GitDirAccessError,MalformedGitPointerError,} from '@inkeep/open-knowledge-core/shadow-repo-layout';+export { type StreamedChunk, streamedChunkOf } from './acp/event-log-bounds.ts';export { AcpPermissionStore, readAgentBrowserTools } from './acp/permissions.ts';export { AcpRegistry, FEATURED_AGENT_IDS, loadCustomAgents } from './acp/registry.ts';export {@@ -11,6 +12,7 @@ export {type HarnessManagedMcpEntryHit,MAX_ACP_THREADS,} from './acp/thread-manager.ts';+export { acpThreadStoreRoots, acpThreadsDir, isMintedThreadId } from './acp/thread-persistence.ts';export { attachAcpThreadSocket } from './acp/thread-socket.ts';export { AgentFocusBroadcaster } from './agent-focus.ts';export { AGENT_ID_MAX_LEN, AGENT_ID_RE, toBroadcasterKey, validateAgentId } from './agent-id.ts';