Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(ok): attach files, folders, and images to ACP prompts (PRD-7844 + PRD-7841) (#3408)

Abraham56a25a2c9807
diff --git a/.changeset/acp-attach-files-and-images.md b/.changeset/acp-attach-files-and-images.md
new file mode 100644
index 000000000..d51b6e5a3
--- /dev/null
+++ b/.changeset/acp-attach-files-and-images.md
@@ -0,0 +1,7 @@
+---
+'@inkeep/open-knowledge': minor
+---
+
+Files, folders, and images now ride ACP prompts. The agent-thread composer accepts three attachment paths — `@` picks workspace files and folders from the shared mention menu, the `+` button opens the OS file picker, and files dropped anywhere on the chat panel attach the same way. Non-image files stay workspace-scoped (matching Zed's behavior: the agent's tools can only reach files inside your project), so anything dropped from outside gets refused up front with a clear message. Images drop or paste from anywhere in the OS and preview as thumbnails above the input, with per-file type + size validation and a remove control.
+
+On send, chips become native ACP parts alongside the text — `EmbeddedResource` with the file's text contents when the agent advertised `promptCapabilities.embeddedContext`, `ResourceLink` (with a `file://` URI + name + mime) otherwise; folders always as a directory reference; images as `ImageContent` when the agent advertised `promptCapabilities.image`. Agents that didn't advertise image support get a "doesn't accept images" refusal on the drop. Sent messages replay their attachments as chips in the transcript so a reloaded thread shows exactly what was handed to the agent.
diff --git a/knip.config.ts b/knip.config.ts
index 78162ec09..f9179f2d4 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -123,7 +123,9 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: ['@types/shell-quote'],
+ ignoreDependencies: [
+ '@types/shell-quote',
+ ],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
diff --git a/packages/app/src/components/acp/ThreadView.dom.test.tsx b/packages/app/src/components/acp/ThreadView.dom.test.tsx
index 87fb009b8..53ff35393 100644
--- a/packages/app/src/components/acp/ThreadView.dom.test.tsx
+++ b/packages/app/src/components/acp/ThreadView.dom.test.tsx
@@ -1180,7 +1180,7 @@ describe('ThreadView message queue', () => {
expect((send as HTMLButtonElement).disabled).toBe(false);
fireEvent.click(send);
- expect(prompt).toHaveBeenCalledWith('thread-1', 'queued while running');
+ expect(prompt).toHaveBeenCalledWith('thread-1', 'queued while running', undefined);
});
test('Escape cancels the turn while a draft holds the action slot', () => {
@@ -1580,7 +1580,7 @@ describe('ThreadView steer now', () => {
expect(steerButton.getAttribute('aria-label')).toBe('Steer now');
fireEvent.click(steerButton);
- expect(steer).toHaveBeenCalledWith('thread-1', 'actually, do this instead');
+ expect(steer).toHaveBeenCalledWith('thread-1', 'actually, do this instead', undefined);
expect(prompt).not.toHaveBeenCalled();
expect(composer.value).toBe('');
});
@@ -1593,7 +1593,7 @@ describe('ThreadView steer now', () => {
fireEvent.change(composer, { target: { value: 'queue me' } });
fireEvent.keyDown(composer, { key: 'Enter' });
- expect(prompt).toHaveBeenCalledWith('thread-1', 'queue me');
+ expect(prompt).toHaveBeenCalledWith('thread-1', 'queue me', undefined);
expect(steer).not.toHaveBeenCalled();
});
diff --git a/packages/app/src/components/acp/ThreadView.tsx b/packages/app/src/components/acp/ThreadView.tsx
index 87342e1e4..f6ade6c08 100644
--- a/packages/app/src/components/acp/ThreadView.tsx
+++ b/packages/app/src/components/acp/ThreadView.tsx
@@ -12,6 +12,7 @@
import { deriveAgentPosture } from '@inkeep/open-knowledge-core/acp/agent-posture';
import type {
+ AttachmentPart,
QueuedMessage,
SessionConfigOption,
ThreadFailureDetail,
@@ -32,6 +33,7 @@ import {
Link2,
ListPlus,
MousePointer2,
+ Plus,
RotateCcw,
Search,
Settings2,
@@ -48,9 +50,11 @@ import {
Zap,
} from 'lucide-react';
import {
+ createContext,
Fragment,
type ReactNode,
type RefObject,
+ use,
useEffect,
useEffectEvent,
useId,
@@ -76,6 +80,7 @@ import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { ButtonGroup, ButtonGroupSeparator } from '@/components/ui/button-group';
import { Checkbox } from '@/components/ui/checkbox';
+import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog';
import {
DropdownMenu,
DropdownMenuCheckboxItem,
@@ -116,6 +121,12 @@ import {
rememberAgentMode,
} from '@/lib/acp/agent-settings-store';
import { configValueHint, resolveDefaultOptionLabel } from '@/lib/acp/config-value-hints';
+import {
+ collectAllFiles,
+ collectImageFiles,
+ describeImageError,
+ fileToAttachment,
+} from '@/lib/acp/image-attachment';
import { computeDiffRows } from '@/lib/acp/inline-diff';
import { isPermissiveMode } from '@/lib/acp/permissive-mode';
import { renderTerminalText } from '@/lib/acp/terminal-text';
@@ -197,6 +208,15 @@ function agentDisplayName(name: string): string {
return name.replace(/\s+Agent$/i, '');
}
+/** Payload for the shared image-preview lightbox. `src` is a data URL for
+ * base64 payloads (image AttachmentParts on both sent + unsent tiles). */
+type ImagePreview = { readonly src: string; readonly name: string };
+
+/** Panel-scoped context for the shared image-preview dialog. `null` when a
+ * descendant renders outside the ThreadView provider (test harness, etc.);
+ * tile components render as non-interactive in that case. */
+const ImagePreviewContext = createContext<((preview: ImagePreview) => void) | null>(null);
+
/**
* Failures a fresh launch can plausibly clear — mirrors the server's
* `retryThread` guards (a thread that never opened a session). Everything
@@ -236,9 +256,125 @@ export function ThreadView({
// component reads it at each send via the imperative handle and seeds it via
// `appendText` — there is no draft string in React state anymore.
const composerRef = useRef<ComposerMentionInputHandle>(null);
+ // Image parts (dropped/pasted) live on the ThreadView side rather than
+ // inside the shared composer so they survive a placement swap without a
+ // schema change. Cleared on send/clear alongside the composer text.
+ // Files/images the user dropped or picked. Union of image + generic blob
+ // parts — the composer's own @-picker chips ride the wire separately via
+ // `serializeComposerContent().attachments`, so this list is the OS-file
+ // half. Cleared on send/clear alongside the composer text.
+ const [pendingAttachments, setPendingAttachments] = useState<readonly AttachmentPart[]>([]);
+ // Full-size image preview modal shared by the pending strip (unsent) and
+ // the transcript chips (sent). Kept at ThreadView scope so a sent chip
+ // dismisses cleanly even if the composer re-renders — one dialog per panel.
+ const [imagePreview, setImagePreview] = useState<ImagePreview | null>(null);
+ const openImagePreview = (preview: ImagePreview) => setImagePreview(preview);
+ const [pendingUploads, setPendingUploads] = useState<
+ readonly { readonly id: string; readonly name: string; readonly mimeType: string }[]
+ >([]);
+ // Visual state for the drop overlay on the outer chat panel: rises as
+ // soon as any dragenter carrying files hits it, drops on drop / dragleave
+ // from the root.
+ const [dragActive, setDragActive] = useState(false);
+ // Pessimistic match to the server's gate: an agent that advertised no
+ // capabilities at all (`promptCapabilities` undefined) doesn't accept
+ // images. Being optimistic here (accept unless `false`) drops the image
+ // silently server-side with only a log entry — the user sees the send
+ // succeed and no image reaches the agent. The narrow window between
+ // connect and first `info` event where a real image-capable agent reads
+ // as unknown is the accepted cost of matching server behavior.
+ const imagesAccepted = info.promptCapabilities?.image === true;
// The current serialized draft: typed prose with chips inline as `@path`.
// Called from event handlers only (a render must not read the ref).
const composerText = (): string => composerRef.current?.getContent().instruction.trim() ?? '';
+ // The union of file/folder chips (from the composer's own serializer) and
+ // the host-owned image attachments. Deferred to send time so a change to
+ // either half doesn't re-render the composer.
+ const composerAttachments = (): readonly AttachmentPart[] => {
+ const chips = composerRef.current?.getContent().attachments ?? [];
+ return [...chips, ...pendingAttachments];
+ };
+ /**
+ * Validate + encode a batch of dropped, pasted, or picked files, then
+ * extend `pendingAttachments`. Failures raise a per-file toast; a single
+ * event with multiple bad files gets one toast per file rather than one
+ * aggregated — the errors carry different reasons and fusing loses that
+ * specificity. Images become `image` parts (fast-path via ImageContent);
+ * non-image files become `file` parts pointing at a workspace-relative
+ * path — the server resolves those to `EmbeddedResource` (text under the
+ * embed cap) or `ResourceLink` (binaries + oversized).
+ */
+ const ingestFiles = async (files: readonly File[]): Promise<void> => {
+ // Electron exposes `webUtils.getPathForFile` — the only reliable way to
+ // recover the on-disk path of a dropped File (browsers hide it for
+ // security). Web hosts land at `undefined`, and non-image files are
+ // refused there because the workspace-containment check can't run.
+ const absPathOf =
+ typeof window !== 'undefined' && window.okDesktop
+ ? window.okDesktop.getPathForFile
+ : undefined;
+ const workspaceContentDir = workspace?.contentDir;
+ const pathSeparator = workspace?.pathSeparator;
+ // Refuse image files up front for an agent that didn't advertise image
+ // capability — otherwise they'd thumbnail in the composer and be dropped
+ // silently server-side (see `imagesAccepted` derivation above). Both drop
+ // and picker paths flow through here, so the refusal covers both.
+ const accepted: File[] = [];
+ let rejectedImageCount = 0;
+ for (const file of files) {
+ const isImage = (file.type || '').startsWith('image/');
+ if (isImage && !imagesAccepted) {
+ rejectedImageCount += 1;
+ } else {
+ accepted.push(file);
+ }
+ }
+ if (rejectedImageCount > 0) {
+ // Bind as `agentName` so this msgid is byte-identical to the paste
+ // handler below — Lingui keys by substitution name.
+ const agentName = agentDisplayName(info.agent.name);
+ toast.error(t`${agentName} doesn't accept image attachments.`);
+ }
+ if (accepted.length === 0) return;
+ const placeholders = accepted.map((file) => ({
+ id: `${file.name}:${file.size}:${file.lastModified ?? 0}:${Math.random().toString(36).slice(2, 8)}`,
+ name: file.name || 'attachment',
+ mimeType: file.type || '',
+ }));
+ setPendingUploads((previous) => [...previous, ...placeholders]);
+ for (let i = 0; i < accepted.length; i += 1) {
+ const file = accepted[i];
+ const placeholderId = placeholders[i]?.id;
+ if (file === undefined || placeholderId === undefined) continue;
+ // Try/catch here (not just inside fileToAttachment) so a rejected
+ // FileReader — corrupted file, OS I/O failure mid-drag, browser
+ // memory pressure — clears its placeholder instead of leaving a
+ // permanent spinner (and doesn't abort the remaining files either).
+ try {
+ const outcome = await fileToAttachment(file, {
+ absPathOf,
+ workspaceContentDir,
+ pathSeparator,
+ });
+ setPendingUploads((previous) => previous.filter((p) => p.id !== placeholderId));
+ if (outcome.ok) {
+ setPendingAttachments((previous) => [...previous, outcome.part]);
+ } else {
+ toast.error(describeImageError(outcome.error));
+ }
+ } catch (err) {
+ setPendingUploads((previous) => previous.filter((p) => p.id !== placeholderId));
+ const fileName = file.name || 'attachment';
+ // Log before toasting so post-incident diagnosis has something to
+ // grep — the toast only tells the user "something failed", not what.
+ console.error('[ingestFiles] failed to read attachment', fileName, err);
+ toast.error(t`Couldn't read ${fileName}.`);
+ }
+ }
+ };
+ const removePendingAttachment = (index: number): void => {
+ setPendingAttachments((previous) => previous.filter((_, i) => i !== index));
+ };
const [followFile, setFollowFile] = useState(loadFollowFilePref);
// Captured by ScrollToEndBridge (a child of the scroller Provider) so send/
// resume can imperatively jump to the live edge; null until the bridge mounts.
@@ -375,9 +511,12 @@ export function ThreadView({
*/
const requestSteer = (): void => {
const text = composerText();
- if (text === '') return;
- client.steer(info.threadId, text);
+ const attachments = composerAttachments();
+ if (text === '' && attachments.length === 0) return;
+ client.steer(info.threadId, text, attachments.length > 0 ? attachments : undefined);
composerRef.current?.clear();
+ setPendingAttachments([]);
+ setPendingUploads([]);
scrollApiRef.current?.scrollToEnd();
};
@@ -489,9 +628,11 @@ export function ThreadView({
* and re-attaching the still-queued batch there is the retry.
*/
failureText: string | null = text,
+ attachments: readonly AttachmentPart[] = [],
): Promise<boolean> => {
+ const parts = attachments.length > 0 ? attachments : undefined;
if (!archived) {
- client.prompt(info.threadId, text);
+ client.prompt(info.threadId, text, parts);
// Sending re-engages the live edge even if the reader had scrolled up.
scrollApiRef.current?.scrollToEnd();
return Promise.resolve(true);
@@ -501,7 +642,7 @@ export function ThreadView({
setFailedPrompt(null);
scrollApiRef.current?.scrollToEnd();
return client
- .resumeThread(info.threadId, text)
+ .resumeThread(info.threadId, text, parts)
.then(() => true)
.catch((err) => {
setResumeError(
@@ -517,6 +658,7 @@ export function ThreadView({
const submit = (): void => {
const text = composerText();
+ const attachments = composerAttachments();
// `canQueue` rides alongside `canPrompt`: a busy thread accepts a queued
// message rather than refusing the send.
if (!(canPrompt || canQueue)) return;
@@ -533,9 +675,14 @@ export function ThreadView({
});
return;
}
- if (text === '') return;
- void sendText(text);
+ // Attachments alone (image drop with no typed prose) still count as
+ // content — the message is the picture. Otherwise a bare-empty draft
+ // stays gated.
+ if (text === '' && attachments.length === 0) return;
+ void sendText(text, text, attachments);
composerRef.current?.clear();
+ setPendingAttachments([]);
+ setPendingUploads([]);
};
/**
@@ -679,195 +826,238 @@ export function ThreadView({
}
return (
- <div
- className="flex min-h-0 flex-1 flex-col text-gray-800 dark:text-gray-200"
- data-agent-thread-root=""
- >
- <ThreadHeader info={info} followFile={followFile} onToggleFollow={toggleFollow} />
- {model !== null && model.plan.length > 0 ? <PlanChecklist plan={model.plan} /> : null}
- {model === null || model.items.length === 0 ? (
- // No messages yet: the empty state centers itself via `h-full`, which needs
- // a plain definite-height block host. The scroller's managed flex layout
- // won't provide one, so only real transcripts go through the scroller.
- <div
- className="min-h-0 flex-1 overflow-y-auto px-3 py-2 subtle-scrollbar scroll-fade-mask"
- data-testid="agent-thread-transcript"
- >
- <ThreadEmptyState status={status} archived={archived} agent={info.agent} />
- </div>
- ) : (
- // autoScroll = stick-to-bottom that yields to reader intent; last-anchor
- // reopens archived/resumed threads at the final turn. The bridge lifts the
- // scroller's imperative API up so send/resume can jump to the live edge.
- <MessageScrollerProvider autoScroll defaultScrollPosition="last-anchor">
- <ScrollToEndBridge apiRef={scrollApiRef} />
- <MessageScroller className="min-h-0 flex-1">
- <MessageScrollerViewport
- // Overrides the primitive's hardcoded "Messages" — this focusable
- // region is one agent's transcript, and its name must translate.
- aria-label={t`Agent transcript`}
- className="px-3 py-2 subtle-scrollbar scroll-fade-mask"
- data-testid="agent-thread-transcript"
- >
- <MessageScrollerContent className="gap-2 [&>[data-tool-call]+[data-tool-call]]:-mt-1">
- {model.items.map((item, index) => {
- const id = transcriptItemId(item, index);
- return (
- <MessageScrollerItem
- key={id}
- messageId={id}
- // Each item hosts its own flex column so per-message alignment
- // (the user bubble's ml-auto hug-and-right) survives the wrapper
- // the scroller requires for anchoring/measurement.
- className="flex flex-col"
- // A new user turn is the anchor the scroller peeks above.
- scrollAnchor={item.kind === 'message' && item.role === 'user'}
- // Re-hosts the adjacent-tool-call spacing selector on the wrapper.
- data-tool-call={item.kind === 'tool_call' ? '' : undefined}
- >
- <ThreadItem
- item={item}
- threadId={info.threadId}
- agent={info.agent}
- // Thread liveness, not turn liveness: the server keeps an
- // unanswered request answerable until its timeout even after
- // the prompt settles (and some agents ask outside a turn) —
- // only a dead thread makes answering impossible.
- actionable={!archived && status !== 'exited' && status !== 'error'}
- streaming={turnActive && index === model.items.length - 1}
- terminals={model.terminals}
- permissionsByToolCall={model.permissionsByToolCall}
- showRetry={index === retryNoticeIndex}
- retryPending={retryPending}
- onRetry={retryThread}
- // Sign-in belongs to the same notice Retry does, and
- // only while the thread is still waiting on it.
- showAuth={index === retryNoticeIndex && status === 'auth_required'}
- onAuthenticate={authenticateThread}
+ <ImagePreviewContext.Provider value={openImagePreview}>
+ <ImagePreviewDialog
+ preview={imagePreview}
+ onOpenChange={(open) => !open && setImagePreview(null)}
+ />
+ {/* biome-ignore lint/a11y/noStaticElementInteractions: drop-target — keyboard/AT users have the + picker button in the composer; drop is a pointer-only affordance. */}
+ <div
+ className="relative flex min-h-0 flex-1 flex-col text-gray-800 dark:text-gray-200"
+ data-agent-thread-root=""
+ onDragEnter={(event) => {
+ // `types.includes('Files')` — filter DOM drags (text, page elements)
+ // out; only real file drops raise the overlay. `preventDefault` on
+ // dragenter keeps the browser from opening the file in a new tab
+ // when the drop misses our handlers below.
+ if (event.dataTransfer?.types.includes('Files')) {
+ event.preventDefault();
+ setDragActive(true);
+ }
+ }}
+ onDragOver={(event) => {
+ if (event.dataTransfer?.types.includes('Files')) {
+ event.preventDefault();
+ event.dataTransfer.dropEffect = 'copy';
+ }
+ }}
+ onDragLeave={(event) => {
+ // Only dismiss when the drag actually leaves the whole panel — child
+ // dragleaves (crossing between the overlay and inner UI) fire this
+ // too, and dropping the overlay mid-drag flickers.
+ if (event.currentTarget === event.target) setDragActive(false);
+ }}
+ onDrop={(event) => {
+ const files = collectAllFiles(event.dataTransfer);
+ if (files.length === 0) return;
+ event.preventDefault();
+ setDragActive(false);
+ void ingestFiles(files);
+ }}
+ >
+ <ThreadHeader info={info} followFile={followFile} onToggleFollow={toggleFollow} />
+ {model !== null && model.plan.length > 0 ? <PlanChecklist plan={model.plan} /> : null}
+ {model === null || model.items.length === 0 ? (
+ // No messages yet: the empty state centers itself via `h-full`, which needs
+ // a plain definite-height block host. The scroller's managed flex layout
+ // won't provide one, so only real transcripts go through the scroller.
+ <div
+ className="min-h-0 flex-1 overflow-y-auto px-3 py-2 subtle-scrollbar scroll-fade-mask"
+ data-testid="agent-thread-transcript"
+ >
+ <ThreadEmptyState status={status} archived={archived} agent={info.agent} />
+ </div>
+ ) : (
+ // autoScroll = stick-to-bottom that yields to reader intent; last-anchor
+ // reopens archived/resumed threads at the final turn. The bridge lifts the
+ // scroller's imperative API up so send/resume can jump to the live edge.
+ <MessageScrollerProvider autoScroll defaultScrollPosition="last-anchor">
+ <ScrollToEndBridge apiRef={scrollApiRef} />
+ <MessageScroller className="min-h-0 flex-1">
+ <MessageScrollerViewport
+ // Overrides the primitive's hardcoded "Messages" — this focusable
+ // region is one agent's transcript, and its name must translate.
+ aria-label={t`Agent transcript`}
+ className="px-3 py-2 subtle-scrollbar scroll-fade-mask"
+ data-testid="agent-thread-transcript"
+ >
+ <MessageScrollerContent className="gap-2 [&>[data-tool-call]+[data-tool-call]]:-mt-1">
+ {model.items.map((item, index) => {
+ const id = transcriptItemId(item, index);
+ return (
+ <MessageScrollerItem
+ key={id}
+ messageId={id}
+ // Each item hosts its own flex column so per-message alignment
+ // (the user bubble's ml-auto hug-and-right) survives the wrapper
+ // the scroller requires for anchoring/measurement.
+ className="flex flex-col"
+ // A new user turn is the anchor the scroller peeks above.
+ scrollAnchor={item.kind === 'message' && item.role === 'user'}
+ // Re-hosts the adjacent-tool-call spacing selector on the wrapper.
+ data-tool-call={item.kind === 'tool_call' ? '' : undefined}
+ >
+ <ThreadItem
+ item={item}
+ threadId={info.threadId}
+ agent={info.agent}
+ // Thread liveness, not turn liveness: the server keeps an
+ // unanswered request answerable until its timeout even after
+ // the prompt settles (and some agents ask outside a turn) —
+ // only a dead thread makes answering impossible.
+ actionable={!archived && status !== 'exited' && status !== 'error'}
+ streaming={turnActive && index === model.items.length - 1}
+ terminals={model.terminals}
+ permissionsByToolCall={model.permissionsByToolCall}
+ showRetry={index === retryNoticeIndex}
+ retryPending={retryPending}
+ onRetry={retryThread}
+ // Sign-in belongs to the same notice Retry does, and
+ // only while the thread is still waiting on it.
+ showAuth={index === retryNoticeIndex && status === 'auth_required'}
+ onAuthenticate={authenticateThread}
+ />
+ </MessageScrollerItem>
+ );
+ })}
+ {turnActive ? (
+ status === 'awaiting_permission' ? (
+ <div
+ className="flex items-center gap-2 px-1 py-1 text-muted-foreground text-sm shimmer"
+ data-testid="agent-thread-awaiting-permission"
+ >
+ <span>{t`Waiting for your approval`}</span>
+ </div>
+ ) : (
+ <WorkingAvatar
+ status={workingStatusText(activeToolKind(model.items), thinkingLine)}
+ className="px-1 py-1"
+ testId="agent-thread-working"
/>
- </MessageScrollerItem>
- );
- })}
- {turnActive ? (
- status === 'awaiting_permission' ? (
+ )
+ ) : status === 'installing' || status === 'spawning' ? (
+ // A resume respawning its agent: the optimistic message echo is
+ // already in the transcript above — show that the agent is on
+ // its way rather than a silent gap until the turn opens.
<div
- className="flex items-center gap-2 px-1 py-1 text-muted-foreground text-sm shimmer"
- data-testid="agent-thread-awaiting-permission"
+ className="flex items-center gap-2 px-1 py-1 text-muted-foreground text-sm"
+ data-testid="agent-thread-starting"
>
- <span>{t`Waiting for your approval`}</span>
- </div>
- ) : (
- <WorkingAvatar
- status={workingStatusText(activeToolKind(model.items), thinkingLine)}
- className="px-1 py-1"
- testId="agent-thread-working"
- />
- )
- ) : status === 'installing' || status === 'spawning' ? (
- // A resume respawning its agent: the optimistic message echo is
- // already in the transcript above — show that the agent is on
- // its way rather than a silent gap until the turn opens.
- <div
- className="flex items-center gap-2 px-1 py-1 text-muted-foreground text-sm"
- data-testid="agent-thread-starting"
- >
- <Spinner className="size-3.5" aria-hidden="true" />
- {/* `shimmer` sets `color: transparent`, which a container
+ <Spinner className="size-3.5" aria-hidden="true" />
+ {/* `shimmer` sets `color: transparent`, which a container
would inherit into the spinner's currentColor stroke —
keep it scoped to the text. */}
- <span className="shimmer">{t`Starting the agent…`}</span>
- </div>
- ) : null}
- </MessageScrollerContent>
- </MessageScrollerViewport>
- <MessageScrollerButton direction="end" />
- </MessageScroller>
- </MessageScrollerProvider>
- )}
- {info.steer !== undefined && !archived ? (
- <div
- className="flex items-center gap-2 border-t bg-muted/40 px-3 py-1.5 text-muted-foreground text-xs"
- data-testid="agent-thread-steer-pending"
- >
- <Spinner className="size-3.5 shrink-0" aria-hidden="true" />
- <span className="shrink-0">{t`Steering — waiting for the current run to stop…`}</span>
- <span className="min-w-0 flex-1 truncate text-foreground/80">{info.steer.content}</span>
- </div>
- ) : null}
- {cancelStalled && turnActive ? (
- <div
- className="flex items-center gap-2 border-amber-500/30 border-t bg-amber-500/5 px-3 py-1.5 text-amber-700 text-xs dark:text-amber-400"
- data-testid="agent-thread-cancel-stalled"
- >
- <span className="flex-1">
- {t`The agent isn't stopping. Force stop closes this chat and quits the agent.`}
- </span>
- <Button
- type="button"
- size="sm"
- variant="destructive"
- className="h-6 text-xs"
- onClick={() => client.closeThread(info.threadId)}
- data-testid="agent-thread-force-stop"
+ <span className="shimmer">{t`Starting the agent…`}</span>
+ </div>
+ ) : null}
+ </MessageScrollerContent>
+ </MessageScrollerViewport>
+ <MessageScrollerButton direction="end" />
+ </MessageScroller>
+ </MessageScrollerProvider>
+ )}
+ {info.steer !== undefined && !archived ? (
+ <div
+ className="flex items-center gap-2 border-t bg-muted/40 px-3 py-1.5 text-muted-foreground text-xs"
+ data-testid="agent-thread-steer-pending"
>
- {t`Force stop`}
- </Button>
- </div>
- ) : null}
- {archived && resumeError !== null ? (
- <div
- className="flex items-center gap-2 border-amber-500/30 border-t bg-amber-500/5 px-3 py-1.5 text-amber-700 text-xs dark:text-amber-400"
- data-testid="agent-thread-resume-failed"
- >
- <span className="flex-1">
- {resumeError.code === 'resume-unsupported'
- ? t`${info.agent.name} can't continue this chat — the transcript is kept, but the agent session is gone.`
- : t`Couldn't resume this chat: ${resumeError.message}`}
- </span>
- <Button
- type="button"
- size="sm"
- variant="outline"
- className="h-6 shrink-0 text-xs"
- onClick={startFreshThread}
- data-testid="agent-thread-resume-fallback-new"
+ <Spinner className="size-3.5 shrink-0" aria-hidden="true" />
+ <span className="shrink-0">{t`Steering — waiting for the current run to stop…`}</span>
+ <span className="min-w-0 flex-1 truncate text-foreground/80">{info.steer.content}</span>
+ </div>
+ ) : null}
+ {cancelStalled && turnActive ? (
+ <div
+ className="flex items-center gap-2 border-amber-500/30 border-t bg-amber-500/5 px-3 py-1.5 text-amber-700 text-xs dark:text-amber-400"
+ data-testid="agent-thread-cancel-stalled"
>
- {t`New chat with ${info.agent.name}`}
- </Button>
- </div>
- ) : null}
- <ThreadComposer
- info={info}
- composerRef={composerRef}
- onSubmit={submit}
- canPrompt={canPrompt}
- canQueue={canQueue}
- turnActive={turnActive}
- cancelPending={cancelPending}
- onCancel={requestCancel}
- onSteer={requestSteer}
- status={status}
- archived={archived}
- resumePending={resumePending}
- usage={model?.tokenUsage ?? null}
- queuedComments={queuedComments}
- selectedCommentCount={selectedCommentCount}
- hasQueuedComments={hasQueuedComments}
- commentsExpanded={commentsExpanded}
- onAttachComments={() => {
- setCommentsAttached(true);
- // Deselection is sticky, so re-attaching has to re-check the queue —
- // otherwise this puts an empty batch on the message and the chip
- // bounces straight back to detached.
- selectAllQueued();
- }}
- onToggleCommentsExpanded={() => setCommentsExpanded((open) => !open)}
- onDismissComments={() => {
- setCommentsAttached(false);
- setCommentsExpanded(false);
- }}
- />
- </div>
+ <span className="flex-1">
+ {t`The agent isn't stopping. Force stop closes this chat and quits the agent.`}
+ </span>
+ <Button
+ type="button"
+ size="sm"
+ variant="destructive"
+ className="h-6 text-xs"
+ onClick={() => client.closeThread(info.threadId)}
+ data-testid="agent-thread-force-stop"
+ >
+ {t`Force stop`}
+ </Button>
+ </div>
+ ) : null}
+ {archived && resumeError !== null ? (
+ <div
+ className="flex items-center gap-2 border-amber-500/30 border-t bg-amber-500/5 px-3 py-1.5 text-amber-700 text-xs dark:text-amber-400"
+ data-testid="agent-thread-resume-failed"
+ >
+ <span className="flex-1">
+ {resumeError.code === 'resume-unsupported'
+ ? t`${info.agent.name} can't continue this chat — the transcript is kept, but the agent session is gone.`
+ : t`Couldn't resume this chat: ${resumeError.message}`}
+ </span>
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ className="h-6 shrink-0 text-xs"
+ onClick={startFreshThread}
+ data-testid="agent-thread-resume-fallback-new"
+ >
+ {t`New chat with ${info.agent.name}`}
+ </Button>
+ </div>
+ ) : null}
+ <ThreadComposer
+ info={info}
+ composerRef={composerRef}
+ onSubmit={submit}
+ canPrompt={canPrompt}
+ canQueue={canQueue}
+ turnActive={turnActive}
+ cancelPending={cancelPending}
+ onCancel={requestCancel}
+ onSteer={requestSteer}
+ status={status}
+ archived={archived}
+ resumePending={resumePending}
+ usage={model?.tokenUsage ?? null}
+ queuedComments={queuedComments}
+ selectedCommentCount={selectedCommentCount}
+ hasQueuedComments={hasQueuedComments}
+ commentsExpanded={commentsExpanded}
+ onAttachComments={() => {
+ setCommentsAttached(true);
+ // Deselection is sticky, so re-attaching has to re-check the queue —
+ // otherwise this puts an empty batch on the message and the chip
+ // bounces straight back to detached.
+ selectAllQueued();
+ }}
+ onToggleCommentsExpanded={() => setCommentsExpanded((open) => !open)}
+ onDismissComments={() => {
+ setCommentsAttached(false);
+ setCommentsExpanded(false);
+ }}
+ pendingAttachments={pendingAttachments}
+ pendingUploads={pendingUploads}
+ imagesAccepted={imagesAccepted}
+ onIngestImageFiles={ingestFiles}
+ onIngestAllFiles={ingestFiles}
+ onRemovePendingAttachment={removePendingAttachment}
+ />
+ {dragActive ? <ChatPanelDropOverlay onDismiss={() => setDragActive(false)} /> : null}
+ </div>
+ </ImagePreviewContext.Provider>
);
}
@@ -1840,6 +2030,7 @@ function MessageBubble({
return <ThoughtBlock item={item} streaming={streaming === true} />;
}
const isUser = item.role === 'user';
+ const attachments = isUser ? item.attachments : undefined;
return (
<div
className={cn(
@@ -1857,6 +2048,131 @@ function MessageBubble({
data-testid={isUser ? 'agent-thread-user-message' : 'agent-thread-agent-message'}
>
{isUser ? item.text : <AgentMarkdown text={item.text} />}
+ {attachments !== undefined && attachments.length > 0 ? (
+ <UserMessageAttachments attachments={attachments} />
+ ) : null}
+ </div>
+ );
+}
+
+/** Full-image preview overlay opened by clicking an image tile. Uses the
+ * shared shadcn Dialog; wider than the settings default so a screenshot
+ * isn't squeezed. `object-contain` preserves the image's own aspect ratio;
+ * capped at ~90 vw / 90 dvh so it never leaves the window. Radix requires
+ * a DialogTitle for AT — the image `name` supplies it, sr-only so the
+ * panel reads image-first. */
+function ImagePreviewDialog({
+ preview,
+ onOpenChange,
+}: {
+ preview: ImagePreview | null;
+ onOpenChange: (open: boolean) => void;
+}): ReactNode {
+ const { t } = useLingui();
+ return (
+ <Dialog open={preview !== null} onOpenChange={onOpenChange}>
+ <DialogContent
+ className="flex max-h-[min(90dvh,900px)] items-center justify-center bg-background p-2 sm:max-w-[min(90vw,1000px)]"
+ data-testid="agent-thread-image-preview"
+ >
+ <DialogTitle className="sr-only">{preview?.name ?? t`Image preview`}</DialogTitle>
+ {preview !== null ? (
+ <img
+ src={preview.src}
+ alt={preview.name}
+ className="max-h-[min(85dvh,850px)] max-w-full rounded object-contain"
+ draggable={false}
+ />
+ ) : null}
+ </DialogContent>
+ </Dialog>
+ );
+}
+
+/**
+ * Object-identity → stable React key mapping for attachments. `@`-mention +
+ * drop can produce two `AttachmentPart` values with identical `kind`, `path`,
+ * and `name` on the same message; hashing their content collides. Object
+ * identity is the only field that distinguishes them, so we key off it via a
+ * WeakMap that the GC drains as sent messages fall out of the transcript
+ * window. Assigned on first read so per-attachment keys stay stable across
+ * re-renders of the same message.
+ */
+const attachmentKeys = new WeakMap<object, string>();
+let attachmentKeyCounter = 0;
+function keyForAttachment(attachment: AttachmentPart): string {
+ const existing = attachmentKeys.get(attachment);
+ if (existing !== undefined) return existing;
+ attachmentKeyCounter += 1;
+ const key = `att-${attachmentKeyCounter}`;
+ attachmentKeys.set(attachment, key);
+ return key;
+}
+
+/**
+ * Read-only chip strip beside a sent user message. Files/folders render as
+ * `@path` pills (matching the composer's chip look), images as small square
+ * thumbnails. Never removable — a sent message is frozen.
+ */
+function UserMessageAttachments({
+ attachments,
+}: {
+ attachments: readonly AttachmentPart[];
+}): ReactNode {
+ const openPreview = use(ImagePreviewContext);
+ return (
+ <div
+ className="mt-1.5 flex flex-wrap justify-end gap-1.5"
+ data-testid="agent-thread-user-message-attachments"
+ >
+ {attachments.map((attachment) => {
+ const key = keyForAttachment(attachment);
+ if (attachment.kind === 'image') {
+ const src = `data:${attachment.mimeType};base64,${attachment.data}`;
+ return (
+ <Button
+ key={key}
+ type="button"
+ variant="ghost"
+ onClick={() => openPreview?.({ src, name: attachment.name })}
+ disabled={openPreview === null}
+ className="inline-flex size-10 items-center justify-center overflow-hidden rounded-md border border-input bg-background p-0 hover:bg-background focus-visible:ring-2"
+ title={attachment.name}
+ aria-label={attachment.name}
+ data-attachment-kind="image"
+ >
+ <img
+ src={src}
+ alt={attachment.name}
+ className="h-full w-full object-cover"
+ draggable={false}
+ />
+ </Button>
+ );
+ }
+ if (attachment.kind === 'blob') {
+ return (
+ <span
+ key={key}
+ className="composer-mention-chip"
+ title={attachment.name}
+ data-attachment-kind="blob"
+ >
+ <span className="composer-mention-label">{attachment.name}</span>
+ </span>
+ );
+ }
+ return (
+ <span
+ key={key}
+ className="composer-mention-chip"
+ title={attachment.path}
+ data-attachment-kind={attachment.kind}
+ >
+ <span className="composer-mention-label">@{attachment.name || attachment.path}</span>
+ </span>
+ );
+ })}
</div>
);
}
@@ -2772,6 +3088,12 @@ function ThreadComposer({
onAttachComments,
onToggleCommentsExpanded,
onDismissComments,
+ pendingAttachments,
+ pendingUploads,
+ imagesAccepted,
+ onIngestImageFiles,
+ onIngestAllFiles,
+ onRemovePendingAttachment,
}: {
info: ThreadInfo;
/** The parent's handle to the shared composer input — ThreadView reads the
@@ -2810,6 +3132,22 @@ function ThreadComposer({
onAttachComments: () => void;
onToggleCommentsExpanded: () => void;
onDismissComments: () => void;
+ /** Files/images the user dropped, pasted, or picked; parent owns the array. */
+ pendingAttachments: readonly AttachmentPart[];
+ /** Encoding-in-flight placeholders. */
+ pendingUploads: readonly {
+ readonly id: string;
+ readonly name: string;
+ readonly mimeType: string;
+ }[];
+ /** False iff the agent's `promptCapabilities.image` was explicitly `false`. */
+ imagesAccepted: boolean;
+ /** Image-only ingest for the paste path — refused when the agent doesn't
+ * accept images (drop uses `onIngestAllFiles` and takes anything). */
+ onIngestImageFiles: (files: readonly File[]) => Promise<void>;
+ /** Ingest ANY file (image or blob) — the drop-zone + `+` picker path. */
+ onIngestAllFiles: (files: readonly File[]) => Promise<void>;
+ onRemovePendingAttachment: (index: number) => void;
}): ReactNode {
const { t } = useLingui();
// Naming the agent in the placeholder ("Message Claude") beats a generic
@@ -2841,7 +3179,7 @@ function ThreadComposer({
// What the action slot keys off. Both the Stop/Send choice and Send's disabled
// state read this, or the two disagree. An attached batch counts as content:
// the comments are the ask, so a send with nothing typed is a real send.
- const hasSendableContent = !isEmpty || hasQueuedComments;
+ const hasSendableContent = !isEmpty || hasQueuedComments || pendingAttachments.length > 0;
// Mid-turn the same control queues rather than sends, so it stops wearing the
// send arrow — an aria-label the sighted user never reads was the only thing
@@ -2875,10 +3213,26 @@ function ThreadComposer({
up on focus. Every control is a real in-flow sibling (natural Tab order,
own focus ring) and the send button lives on its own row, so there's no
reserved text gutter narrowing the input on multi-line drafts. */}
+ <WorkspaceReachHint info={info} />
{/* biome-ignore lint/a11y/noStaticElementInteractions: pointer-only affordance — pressing the card's whitespace focuses the composer input; keyboard/AT users reach it via Tab. See focus-composer-on-card-pointer.ts. */}
<div
onMouseDown={(event) => focusComposerInputOnCardPointer(event, composerRef)}
- className="cursor-text rounded-lg border border-input bg-transparent transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 dark:bg-input/30"
+ onPaste={(event) => {
+ // Paste is composer-focus-local (the outer drop-zone can't catch it
+ // without stealing paste from every other focusable element on the
+ // panel), so it lives here. Image-only guard mirrors the drop path
+ // for images; a non-image clipboard content passes through to the
+ // input's own paste handling.
+ const files = collectImageFiles(event.clipboardData);
+ if (files.length === 0) return;
+ event.preventDefault();
+ if (!imagesAccepted) {
+ toast.error(t`${agentName} doesn't accept image attachments.`);
+ return;
+ }
+ void onIngestImageFiles(files);
+ }}
+ className="relative cursor-text rounded-lg border border-input bg-transparent transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 dark:bg-input/30"
>
{/* Queued comments as a context chip above the field, the same control
the Ask AI composer carries — detached it is a `+ Comments` add
@@ -2906,6 +3260,13 @@ function ThreadComposer({
) : null}
</ComposerContextChips>
) : null}
+ {pendingAttachments.length > 0 || pendingUploads.length > 0 ? (
+ <PendingImageStrip
+ images={pendingAttachments}
+ uploads={pendingUploads}
+ onRemove={onRemovePendingAttachment}
+ />
+ ) : null}
<ComposerMentionInput
ref={composerRef}
// Stable accessible name — the placeholder is situational (and a
@@ -2960,6 +3321,7 @@ function ThreadComposer({
options, showing a disabled trigger instead of vanishing). */}
<div className="flex items-center gap-2 px-1.5 pt-1 pb-1.5">
<AgentSettingsPopover info={info} />
+ <AttachFilesButton onFiles={onIngestAllFiles} />
<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} />
@@ -3220,3 +3582,220 @@ function QueuedMessageRow({
</div>
);
}
+
+/** Derive the short chip label from a filename or mime (`report.pdf` → `pdf`,
+ * `image/png` → `png`). Falls back to `file` when neither carries a hint. */
+function extensionLabel(name: string, mimeType: string): string {
+ const dot = name.lastIndexOf('.');
+ if (dot > 0 && dot < name.length - 1) return name.slice(dot + 1).toLowerCase();
+ const slash = mimeType.lastIndexOf('/');
+ if (slash > 0 && slash < mimeType.length - 1) return mimeType.slice(slash + 1).toLowerCase();
+ return 'file';
+}
+
+/**
+ * Preview row for pending image attachments — thumbnails rendered from the
+ * base64 payload, each with a remove control. Sits above the composer text
+ * area (mirroring `ComposerContextChips`'s placement) and shares its `px-3
+ * pt-2 pb-1` gutter so the two chip systems read as one.
+ */
+function PendingImageStrip({
+ images,
+ uploads,
+ onRemove,
+}: {
+ images: readonly AttachmentPart[];
+ uploads: readonly { readonly id: string; readonly name: string; readonly mimeType: string }[];
+ onRemove: (index: number) => void;
+}): ReactNode {
+ const { t } = useLingui();
+ const openPreview = use(ImagePreviewContext);
+ return (
+ <div className="flex flex-wrap gap-2 px-3 pt-2 pb-1" data-testid="agent-thread-pending-images">
+ {images.map((image, index) => {
+ // Per-kind key + label: `image` carries base64 data (unique per
+ // upload); `file`/`folder` carry a workspace path (also stable per
+ // upload); `blob` carries base64 too. Keys stay collision-free.
+ const key =
+ image.kind === 'image' || image.kind === 'blob'
+ ? `${image.name}:${image.data.slice(0, 24)}`
+ : `${image.name}:${image.path}`;
+ const src = image.kind === 'image' ? `data:${image.mimeType};base64,${image.data}` : null;
+ const label =
+ image.kind === 'file' || image.kind === 'folder'
+ ? extensionLabel(image.name, '')
+ : extensionLabel(image.name, image.mimeType);
+ return (
+ // Two sibling buttons instead of nested — nesting <button> in
+ // <button> is invalid HTML. The preview button fills the whole
+ // tile; the remove button sits on top absolutely and its click
+ // stops bubbling so the preview doesn't also open.
+ <div key={key} className="group relative inline-flex size-14" title={image.name}>
+ {src !== null ? (
+ <Button
+ type="button"
+ variant="ghost"
+ onClick={() => openPreview?.({ src, name: image.name })}
+ disabled={openPreview === null}
+ className="size-full items-center justify-center overflow-hidden rounded-md border border-input bg-muted p-0 hover:bg-muted"
+ aria-label={image.name}
+ data-testid="agent-thread-pending-image-preview"
+ >
+ <img
+ src={src}
+ alt={image.name}
+ className="h-full w-full object-cover"
+ draggable={false}
+ />
+ </Button>
+ ) : (
+ <div className="inline-flex size-full items-center justify-center overflow-hidden rounded-md border border-input bg-muted">
+ <span className="text-muted-foreground text-xs uppercase">{label}</span>
+ </div>
+ )}
+ <Button
+ type="button"
+ size="icon"
+ variant="secondary"
+ onClick={(event) => {
+ event.stopPropagation();
+ onRemove(index);
+ }}
+ aria-label={t`Remove ${image.name}`}
+ className="absolute top-0.5 right-0.5 size-5 rounded-full border border-border bg-background/80 p-0 shadow-sm opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100 focus-visible:opacity-100"
+ data-testid="agent-thread-pending-image-remove"
+ >
+ <X className="size-3" aria-hidden="true" />
+ </Button>
+ </div>
+ );
+ })}
+ {uploads.map((upload) => (
+ <div
+ key={upload.id}
+ className="relative inline-flex size-14 items-center justify-center overflow-hidden rounded-md border border-input bg-muted"
+ title={upload.name}
+ data-testid="agent-thread-pending-upload"
+ >
+ <Spinner className="size-4 text-muted-foreground" aria-hidden="true" />
+ </div>
+ ))}
+ </div>
+ );
+}
+
+/**
+ * Panel-wide dashed drop-zone overlay — shown whenever a file drag is over
+ * the whole chat panel. Accepts any file (image → ImageContent, everything
+ * else → EmbeddedResource); per-file rejection surfaces as a toast after
+ * drop rather than gating the overlay. `onDismiss` fires on a click so the
+ * user can escape a stuck overlay without a second drop.
+ */
+function ChatPanelDropOverlay({ onDismiss }: { onDismiss: () => void }): ReactNode {
+ const { t } = useLingui();
+ return (
+ // biome-ignore lint/a11y/noStaticElementInteractions: transient drop overlay — keyboard/AT users never see it (drag-only surface), and click-to-dismiss is a safety escape for a stuck overlay.
+ // biome-ignore lint/a11y/useKeyWithClickEvents: same reason — the overlay is drag-only, never keyboard-reachable, so a keyboard handler would be dead code.
+ <div
+ className="pointer-events-auto absolute inset-0 z-20 flex items-center justify-center bg-background/85 backdrop-blur-sm"
+ onClick={onDismiss}
+ data-testid="agent-thread-drop-overlay"
+ >
+ <div className="flex flex-col items-center gap-3 rounded-xl border-2 border-primary/70 border-dashed bg-background/90 px-8 py-6 text-center text-primary shadow-lg">
+ <Plus className="size-8" aria-hidden="true" />
+ <div className="flex flex-col gap-1">
+ <span className="font-medium text-base">{t`Drop a file to attach`}</span>
+ <span className="text-muted-foreground text-xs">
+ {t`Images from anywhere · non-image files must be in the workspace`}
+ </span>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+/**
+ * Small footer line above the composer showing the workspace root the
+ * agent can reach — so the user knows which folder they're referencing
+ * before they attach anything. Falls back to a warmup label until
+ * `useWorkspace` resolves on web hosts.
+ */
+function WorkspaceReachHint({ info }: { info: ThreadInfo }): ReactNode {
+ const { t } = useLingui();
+ const workspace = useWorkspace();
+ const caps = info.promptCapabilities;
+ // Show only the last two path segments — the full absolute path is noisy
+ // and rarely differs from what the tab title already tells the user.
+ const workspaceLabel =
+ workspace === null
+ ? t`Reading from this workspace`
+ : (() => {
+ const sep = workspace.pathSeparator === '\\' ? '\\' : '/';
+ const parts = workspace.contentDir.split(sep).filter((p) => p !== '');
+ const tail = parts.slice(-2).join(sep);
+ return t`Reading from ${tail}`;
+ })();
+ const embedNote =
+ caps !== null && caps !== undefined && caps.embeddedContext !== true
+ ? t` · references only (no embedded contents)`
+ : '';
+ return (
+ <div
+ className="px-2 pb-1 text-[11px] text-muted-foreground"
+ data-testid="agent-thread-workspace-reach"
+ >
+ {workspaceLabel}
+ {embedNote}
+ </div>
+ );
+}
+
+/**
+ * OS file-picker trigger for the composer action bar — the keyboard-and-AT
+ * counterpart to drag-and-drop. A `+` icon button opens the picker via an
+ * imperatively-created `<input type="file" multiple>`; picked files ride
+ * the same `onIngestAllFiles` path drops use, so validation + toasts +
+ * preview all behave identically. Imperative creation keeps the raw DOM
+ * primitive out of the JSX tree — the shadcn-first UI-primitives rule bans
+ * raw `<input>` in packages/app tsx files, and shadcn's `Input` is a
+ * styled text field, not a file trigger.
+ */
+function AttachFilesButton({
+ onFiles,
+}: {
+ onFiles: (files: readonly File[]) => Promise<void>;
+}): ReactNode {
+ const { t } = useLingui();
+ const openFilePicker = () => {
+ // Detached element — `HTMLInputElement.click()` opens the OS picker on
+ // an element with no parent, so a cancelled picker leaves nothing to
+ // remove from the DOM. The input holds only its own listeners; once
+ // no reference survives this closure, the GC collects it.
+ const input = document.createElement('input');
+ input.type = 'file';
+ input.multiple = true;
+ input.addEventListener('change', () => {
+ const files = Array.from(input.files ?? []);
+ if (files.length > 0) void onFiles(files);
+ });
+ input.click();
+ };
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ type="button"
+ size="icon-sm"
+ variant="ghost"
+ className="rounded-lg"
+ onClick={openFilePicker}
+ aria-label={t`Attach a file`}
+ data-testid="agent-thread-attach-files"
+ >
+ <Plus className="size-4" aria-hidden="true" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent side="top">{t`Attach a file`}</TooltipContent>
+ </Tooltip>
+ );
+}
diff --git a/packages/app/src/components/acp/composer-mention-input.test-helper.tsx b/packages/app/src/components/acp/composer-mention-input.test-helper.tsx
index 162fad263..844e87738 100644
--- a/packages/app/src/components/acp/composer-mention-input.test-helper.tsx
+++ b/packages/app/src/components/acp/composer-mention-input.test-helper.tsx
@@ -67,7 +67,12 @@ export function MockComposerMentionInput({
el.value = el.value.trim() === '' ? text : `${el.value.replace(/\s+$/, '')}\n\n${text}`;
notify();
},
- getContent: () => ({ instruction: localRef.current?.value ?? '', mentions: [] }),
+ getContent: () => ({
+ instruction: localRef.current?.value ?? '',
+ mentions: [],
+ attachments: [],
+ }),
+ openMentionPicker: () => {},
}));
return (
<textarea
diff --git a/packages/app/src/editor/ComposerMentionInput.dom.test.tsx b/packages/app/src/editor/ComposerMentionInput.dom.test.tsx
index 5963f55d3..6eb84f77a 100644
--- a/packages/app/src/editor/ComposerMentionInput.dom.test.tsx
+++ b/packages/app/src/editor/ComposerMentionInput.dom.test.tsx
@@ -64,7 +64,11 @@ describe('serializeComposerContent / isComposerEmpty', () => {
const editor = makeEditor();
try {
expect(isComposerEmpty(editor)).toBe(true);
- expect(serializeComposerContent(editor)).toEqual({ instruction: '', mentions: [] });
+ expect(serializeComposerContent(editor)).toEqual({
+ instruction: '',
+ mentions: [],
+ attachments: [],
+ });
} finally {
editor.destroy();
}
@@ -129,6 +133,7 @@ describe('serializeComposerContent / isComposerEmpty', () => {
expect(serializeComposerContent(editor)).toEqual({
instruction: '/review the diff',
mentions: [],
+ attachments: [],
});
expect(isComposerEmpty(editor)).toBe(false);
} finally {
@@ -139,7 +144,11 @@ describe('serializeComposerContent / isComposerEmpty', () => {
test('plain prose carries no mentions', () => {
const editor = makeEditor(paragraph({ type: 'text', text: 'just words' }));
try {
- expect(serializeComposerContent(editor)).toEqual({ instruction: 'just words', mentions: [] });
+ expect(serializeComposerContent(editor)).toEqual({
+ instruction: 'just words',
+ mentions: [],
+ attachments: [],
+ });
} finally {
editor.destroy();
}
@@ -200,7 +209,11 @@ describe('ComposerMentionInput (component)', () => {
/>,
);
ref.current?.setText('a research wiki');
- expect(ref.current?.getContent()).toEqual({ instruction: 'a research wiki', mentions: [] });
+ expect(ref.current?.getContent()).toEqual({
+ instruction: 'a research wiki',
+ mentions: [],
+ attachments: [],
+ });
});
test('appendText fills an empty field, mapping newlines to paragraphs', () => {
diff --git a/packages/app/src/editor/ComposerMentionInput.tsx b/packages/app/src/editor/ComposerMentionInput.tsx
index 8a6bb932a..474f436ab 100644
--- a/packages/app/src/editor/ComposerMentionInput.tsx
+++ b/packages/app/src/editor/ComposerMentionInput.tsx
@@ -23,6 +23,7 @@ import { EditorContent, useEditor } from '@tiptap/react';
import { type Ref, useEffect, useImperativeHandle, useRef, useState } from 'react';
import { clearComposerDraft } from '@/components/composer-draft-store';
import {
+ type ComposerAttachmentPart,
composerMentionExtensions,
composerMentionSuggestionKey,
isComposerEmpty,
@@ -81,9 +82,20 @@ export interface ComposerMentionInputHandle {
* cancelled turn's rescued queue) use this rather than read-modify-`setText`,
* which would flatten chips to literal `@path` text. */
appendText: (text: string) => void;
- /** The dispatch payload: instruction prose (chips inline as `@path`) + the
- * ordered, de-duplicated `@path` mention list. */
- getContent: () => { instruction: string; mentions: string[] };
+ /** The dispatch payload: instruction prose (chips inline as `@path`), the
+ * ordered, de-duplicated `@path` mention list, and the same chip set as
+ * typed attachment parts (file/folder) that ride an ACP send alongside
+ * host-owned image parts. */
+ getContent: () => {
+ instruction: string;
+ mentions: string[];
+ attachments: ComposerAttachmentPart[];
+ };
+ /** Focus the field and insert `@` at the caret, triggering the mention
+ * picker the way typing `@` does. Exposed so a host can programmatically
+ * open the project file picker; the ACP composer's `+` button is a
+ * separate OS file-picker path and does not call this. */
+ openMentionPicker: () => void;
}
/** Map plain text onto the composer schema: one paragraph per line, blank
@@ -398,7 +410,15 @@ export function ComposerMentionInput({
);
},
getContent: () =>
- editor ? serializeComposerContent(editor) : { instruction: '', mentions: [] },
+ editor
+ ? serializeComposerContent(editor)
+ : { instruction: '', mentions: [], attachments: [] },
+ openMentionPicker: () => {
+ if (!editor) return;
+ // Insert `@` at the caret and let the Suggestion plugin listening for
+ // that trigger raise the popup — same code path as a keyboard `@`.
+ editor.chain().focus().insertContent('@').run();
+ },
}),
[editor],
);
diff --git a/packages/app/src/editor/composer-mention/composer-mention.test.ts b/packages/app/src/editor/composer-mention/composer-mention.test.ts
index 2b61755d3..0d56f356c 100644
--- a/packages/app/src/editor/composer-mention/composer-mention.test.ts
+++ b/packages/app/src/editor/composer-mention/composer-mention.test.ts
@@ -56,6 +56,25 @@ describe('createMentionCorpus — fetch retry contract', () => {
expect(corpus.snapshot()).toEqual({ loaded: true, error: false });
});
+ test('the corpus assigns `kind: file` to pages/assets and `kind: folder` to folders', async () => {
+ const items: PageItem[] = [
+ { kind: 'page', docName: 'notes', title: 'Notes' },
+ { kind: 'asset', docName: '/assets/logo.png', title: 'logo.png' },
+ { kind: 'folder', docName: 'specs', title: 'specs' },
+ ];
+ const corpus = createMentionCorpus(() => Promise.resolve(items));
+ const first = await corpus.getItems('');
+ // The kind rides on to the chip attributes and on into the ACP attachment
+ // part, so the wire faithfully distinguishes file references from folder
+ // references — folders can't embed contents, and their block carries the
+ // inode/directory mimetype.
+ expect(first.map((i) => ({ path: i.path, kind: i.kind }))).toEqual([
+ { path: 'notes.md', kind: 'file' },
+ { path: 'assets/logo.png', kind: 'file' },
+ { path: 'specs', kind: 'folder' },
+ ]);
+ });
+
test('a successful fetch loads once and caches — no re-fetch on the next @', async () => {
let calls = 0;
const fetch = () => {
diff --git a/packages/app/src/editor/composer-mention/composer-mention.ts b/packages/app/src/editor/composer-mention/composer-mention.ts
index 496ca6fa3..117ba397f 100644
--- a/packages/app/src/editor/composer-mention/composer-mention.ts
+++ b/packages/app/src/editor/composer-mention/composer-mention.ts
@@ -12,6 +12,7 @@
* de-duplicated `@path` list that rides the holistic assembler's `mentions`.
*/
+import type { AttachmentPart } from '@inkeep/open-knowledge-core/acp/thread-protocol';
import { t } from '@lingui/core/macro';
import { type Editor, Extension, mergeAttributes, Node } from '@tiptap/core';
import Placeholder from '@tiptap/extension-placeholder';
@@ -39,14 +40,18 @@ import {
type SlashCommandItem,
} from './composer-slash-command';
-/** A resolved mention suggestion: the doc identity, its display title, and the
- * workspace-relative `@path` the chip serializes to. */
+/** A resolved mention suggestion: the doc identity, its display title, the
+ * workspace-relative `@path` the chip serializes to, and whether the target
+ * is a file or a folder — the folder distinction drives the ACP attachment
+ * block's mimetype and disables embedded-contents embedding. */
export interface MentionItem {
/** Stable identity / list key — the page docName (extension-less) or asset path. */
readonly docName: string;
readonly title: string;
/** Workspace-relative path the chip serializes to (e.g. `notes.md`). */
readonly path: string;
+ /** File (page or asset) or folder — pulled from the underlying `PageItem`. */
+ readonly kind: 'file' | 'folder';
}
/** Cap mirrors the wiki-link picker — 8 fits the popup and leaves ranking room. */
@@ -136,6 +141,10 @@ const ComposerMention = Node.create({
return {
path: { default: '' },
label: { default: '' },
+ // File is the default so older serialized state (from before the
+ // attachment work) still round-trips as a file — the pre-existing
+ // `mentions` list only produced page/asset chips.
+ mentionKind: { default: 'file' as const },
};
},
@@ -330,7 +339,12 @@ export function createMentionCorpus(fetch: () => Promise<PageItem[]> = fetchPage
}
}
return filterPages(cachedPages, query)
- .map((page) => ({ docName: page.docName, title: page.title, path: pageItemToPath(page) }))
+ .map((page) => ({
+ docName: page.docName,
+ title: page.title,
+ path: pageItemToPath(page),
+ kind: page.kind === 'folder' ? ('folder' as const) : ('file' as const),
+ }))
.filter((item) => item.path !== '');
},
@@ -366,7 +380,10 @@ function configureComposerMentionSuggestion(editor: Editor) {
.focus()
.deleteRange(range)
.insertContent([
- { type: 'composerMention', attrs: { path: item.path, label: item.title } },
+ {
+ type: 'composerMention',
+ attrs: { path: item.path, label: item.title, mentionKind: item.kind },
+ },
{ type: 'text', text: ' ' },
])
.run();
@@ -498,17 +515,34 @@ function configureComposerMentionSuggestion(editor: Editor) {
});
}
+/**
+ * A composer-authored attachment ready to ride an ACP prompt. `file` /
+ * `folder` come from `@`-picker chips; the server converts each to the
+ * matching ACP content block. Image-part production doesn't live here (the
+ * chip node has no image variant); the host composer contributes those from
+ * its own drop/paste state and concatenates them with this list before
+ * sending.
+ */
+// Extract keeps this in lock-step with the wire type: if AttachmentPart's
+// file/folder variants gain fields, this alias picks them up automatically
+// instead of silently drifting.
+export type ComposerAttachmentPart = Extract<AttachmentPart, { kind: 'file' | 'folder' }>;
+
/**
* Walk the composer doc into the dispatch payload. `instruction` is the typed
* prose with each chip inline as `@path`; `mentions` is the ordered,
* first-occurrence-de-duplicated `@path` list the assembler budgets and never
- * trims. Paragraphs join with newlines; hard breaks are newlines.
+ * trims; `attachments` carries the same chip set as typed parts (file/folder)
+ * for the ACP send path. Paragraphs join with newlines; hard breaks are
+ * newlines.
*/
export function serializeComposerContent(editor: Editor): {
instruction: string;
mentions: string[];
+ attachments: ComposerAttachmentPart[];
} {
const mentions: string[] = [];
+ const attachments: ComposerAttachmentPart[] = [];
const seen = new Set<string>();
const lines: string[] = [];
@@ -522,6 +556,10 @@ export function serializeComposerContent(editor: Editor): {
if (!seen.has(path)) {
seen.add(path);
mentions.push(path);
+ const label = String(inline.attrs.label ?? '');
+ const kind =
+ inline.attrs.mentionKind === 'folder' ? ('folder' as const) : ('file' as const);
+ attachments.push({ kind, path, name: label !== '' ? label : path });
}
}
} else if (inline.type.name === 'composerCommand') {
@@ -537,7 +575,7 @@ export function serializeComposerContent(editor: Editor): {
lines.push(line);
});
- return { instruction: lines.join('\n').trim(), mentions };
+ return { instruction: lines.join('\n').trim(), mentions, attachments };
}
/** True when the composer holds no instruction text and no chips. */
diff --git a/packages/app/src/lib/acp/image-attachment.dom.test.ts b/packages/app/src/lib/acp/image-attachment.dom.test.ts
new file mode 100644
index 000000000..8ff18e384
--- /dev/null
+++ b/packages/app/src/lib/acp/image-attachment.dom.test.ts
@@ -0,0 +1,303 @@
+import { describe, expect, test } from 'vitest';
+import {
+ ALLOWED_IMAGE_MIMES,
+ collectImageFiles,
+ describeImageError,
+ fileToAttachment,
+ fileToImageAttachment,
+ MAX_IMAGE_BYTES,
+} from './image-attachment.ts';
+
+// jsdom's File requires bytes as `BlobPart`. A plain Uint8Array works fine.
+function makeFile(bytes: Uint8Array, name: string, type: string): File {
+ return new File([bytes], name, { type });
+}
+
+describe('fileToImageAttachment', () => {
+ test('accepts a small PNG and returns an image AttachmentPart', async () => {
+ const bytes = new Uint8Array([1, 2, 3, 4]);
+ const file = makeFile(bytes, 'shot.png', 'image/png');
+ const result = await fileToImageAttachment(file);
+ expect(result.ok).toBe(true);
+ if (result.ok) {
+ expect(result.part.kind).toBe('image');
+ if (result.part.kind === 'image') {
+ expect(result.part.mimeType).toBe('image/png');
+ expect(result.part.name).toBe('shot.png');
+ // base64 of [1,2,3,4] = 'AQIDBA=='
+ expect(result.part.data).toBe('AQIDBA==');
+ expect(result.part.sizeBytes).toBe(4);
+ }
+ }
+ });
+
+ test('refuses SVG (not in the allowlist)', async () => {
+ const file = makeFile(new Uint8Array([1]), 'evil.svg', 'image/svg+xml');
+ const result = await fileToImageAttachment(file);
+ expect(result.ok).toBe(false);
+ if (!result.ok) {
+ expect(result.error.kind).toBe('unsupported-type');
+ }
+ });
+
+ test('refuses a file whose mime is empty (drag-into-Chrome corner)', async () => {
+ const file = makeFile(new Uint8Array([1]), 'noext', '');
+ const result = await fileToImageAttachment(file);
+ expect(result.ok).toBe(false);
+ if (!result.ok) {
+ expect(result.error.kind).toBe('unsupported-type');
+ }
+ });
+
+ test('refuses a file above the per-image cap without reading its bytes', async () => {
+ const bytes = new Uint8Array(MAX_IMAGE_BYTES + 1);
+ const file = makeFile(bytes, 'huge.png', 'image/png');
+ const result = await fileToImageAttachment(file);
+ expect(result.ok).toBe(false);
+ if (!result.ok) {
+ expect(result.error.kind).toBe('too-large');
+ if (result.error.kind === 'too-large') {
+ expect(result.error.sizeBytes).toBe(bytes.length);
+ expect(result.error.limitBytes).toBe(MAX_IMAGE_BYTES);
+ }
+ }
+ });
+
+ test('ALLOWED_IMAGE_MIMES intentionally excludes svg + bmp + tiff (agent-verified formats only)', () => {
+ expect(ALLOWED_IMAGE_MIMES.has('image/png')).toBe(true);
+ expect(ALLOWED_IMAGE_MIMES.has('image/jpeg')).toBe(true);
+ expect(ALLOWED_IMAGE_MIMES.has('image/gif')).toBe(true);
+ expect(ALLOWED_IMAGE_MIMES.has('image/webp')).toBe(true);
+ // Deliberate omissions — see the module doc.
+ expect(ALLOWED_IMAGE_MIMES.has('image/svg+xml')).toBe(false);
+ expect(ALLOWED_IMAGE_MIMES.has('image/bmp')).toBe(false);
+ expect(ALLOWED_IMAGE_MIMES.has('image/tiff')).toBe(false);
+ });
+});
+
+describe('describeImageError', () => {
+ test('unsupported-type calls out the mime it saw', () => {
+ expect(describeImageError({ kind: 'unsupported-type', mimeType: 'image/svg+xml' })).toContain(
+ 'image/svg+xml',
+ );
+ });
+
+ test('too-large names the observed size + limit in MB', () => {
+ const message = describeImageError({
+ kind: 'too-large',
+ sizeBytes: 8_000_000,
+ limitBytes: 5 * 1024 * 1024,
+ });
+ expect(message).toContain('too large');
+ expect(message).toContain('7.6 MB');
+ expect(message).toContain('5.0 MB');
+ });
+});
+
+describe('collectImageFiles', () => {
+ /** Build a minimal DataTransfer-shaped object; jsdom's constructor is
+ * read-only, so a bespoke stub keeps this test dependency-free. */
+ function dataTransfer(files: File[], asItems = false): DataTransfer {
+ if (asItems) {
+ return {
+ items: files.map((file) => ({
+ kind: 'file' as const,
+ type: file.type,
+ getAsFile: () => file,
+ })),
+ files: [] as unknown as FileList,
+ } as unknown as DataTransfer;
+ }
+ return {
+ items: null as unknown as DataTransferItemList,
+ files: {
+ length: files.length,
+ item: (i: number) => files[i] ?? null,
+ [Symbol.iterator]: files[Symbol.iterator].bind(files),
+ ...Object.fromEntries(files.map((f, i) => [i, f])),
+ } as unknown as FileList,
+ } as unknown as DataTransfer;
+ }
+
+ test('returns image files from `items` (paste path)', () => {
+ const png = makeFile(new Uint8Array([1]), 'a.png', 'image/png');
+ const jpg = makeFile(new Uint8Array([1]), 'b.jpg', 'image/jpeg');
+ const out = collectImageFiles(dataTransfer([png, jpg], true));
+ expect(out.map((f) => f.name)).toEqual(['a.png', 'b.jpg']);
+ });
+
+ test('skips non-image files (a text drop next to a picture)', () => {
+ const png = makeFile(new Uint8Array([1]), 'a.png', 'image/png');
+ const txt = makeFile(new Uint8Array([1]), 'a.txt', 'text/plain');
+ const out = collectImageFiles(dataTransfer([png, txt], true));
+ expect(out.map((f) => f.name)).toEqual(['a.png']);
+ });
+
+ test('deduplicates a file that shows up on both items and files', () => {
+ const png = makeFile(new Uint8Array([1]), 'a.png', 'image/png');
+ const dt = {
+ items: [{ kind: 'file' as const, type: 'image/png', getAsFile: () => png }],
+ files: {
+ length: 1,
+ item: (i: number) => (i === 0 ? png : null),
+ 0: png,
+ } as unknown as FileList,
+ } as unknown as DataTransfer;
+ const out = collectImageFiles(dt);
+ expect(out).toHaveLength(1);
+ });
+
+ test('null DataTransfer returns []', () => {
+ expect(collectImageFiles(null)).toEqual([]);
+ });
+});
+
+describe('fileToAttachment — workspace containment (security-critical)', () => {
+ const TXT = 'text/plain';
+ const makeTxt = (name: string) => makeFile(new Uint8Array([65, 66, 67]), name, TXT);
+
+ test('POSIX: file directly inside the workspace root → file part with the workspace-relative path', async () => {
+ const file = makeTxt('notes.md');
+ const outcome = await fileToAttachment(file, {
+ absPathOf: () => '/work/project/notes.md',
+ workspaceContentDir: '/work/project',
+ pathSeparator: '/',
+ });
+ expect(outcome.ok).toBe(true);
+ if (outcome.ok) {
+ expect(outcome.part).toEqual({ kind: 'file', path: 'notes.md', name: 'notes.md' });
+ }
+ });
+
+ test('POSIX: file in a nested subdirectory → workspace-relative path preserved', async () => {
+ const file = makeTxt('spec.md');
+ const outcome = await fileToAttachment(file, {
+ absPathOf: () => '/work/project/docs/2026/spec.md',
+ workspaceContentDir: '/work/project',
+ pathSeparator: '/',
+ });
+ expect(outcome.ok).toBe(true);
+ if (outcome.ok && outcome.part.kind === 'file') {
+ expect(outcome.part.path).toBe('docs/2026/spec.md');
+ }
+ });
+
+ test('POSIX: sibling-prefix path is REFUSED — /work/project-evil vs /work/project', async () => {
+ // This is the specific attack the sibling-guard defends against:
+ // naive `startsWith(root)` would let `/work/project-evil/…` pass because
+ // its prefix matches `/work/project`. The `startsWith(root + sep)` check
+ // is what saves us.
+ const file = makeTxt('secrets.md');
+ const outcome = await fileToAttachment(file, {
+ absPathOf: () => '/work/project-evil/secrets.md',
+ workspaceContentDir: '/work/project',
+ pathSeparator: '/',
+ });
+ expect(outcome.ok).toBe(false);
+ if (!outcome.ok) {
+ expect(outcome.error.kind).toBe('outside-workspace');
+ }
+ });
+
+ test('POSIX: file completely outside the workspace → refused', async () => {
+ const file = makeTxt('personal.md');
+ const outcome = await fileToAttachment(file, {
+ absPathOf: () => '/home/user/Documents/personal.md',
+ workspaceContentDir: '/work/project',
+ pathSeparator: '/',
+ });
+ expect(outcome.ok).toBe(false);
+ if (!outcome.ok) expect(outcome.error.kind).toBe('outside-workspace');
+ });
+
+ test('POSIX: trailing-slash root is tolerated', async () => {
+ const outcome = await fileToAttachment(makeTxt('a.md'), {
+ absPathOf: () => '/work/project/a.md',
+ workspaceContentDir: '/work/project/',
+ pathSeparator: '/',
+ });
+ expect(outcome.ok).toBe(true);
+ if (outcome.ok && outcome.part.kind === 'file') {
+ expect(outcome.part.path).toBe('a.md');
+ }
+ });
+
+ test('POSIX: absPath == workspace root itself (dropped folder) → empty relative path', async () => {
+ const outcome = await fileToAttachment(makeTxt('root'), {
+ absPathOf: () => '/work/project',
+ workspaceContentDir: '/work/project',
+ pathSeparator: '/',
+ });
+ // Empty rel is a valid workspace-relative address for the root itself.
+ expect(outcome.ok).toBe(true);
+ if (outcome.ok && outcome.part.kind === 'file') {
+ expect(outcome.part.path).toBe('');
+ }
+ });
+
+ test('Windows: file inside root normalizes backslashes to forward slashes', async () => {
+ // Wire contract: workspace paths always POSIX-style on the wire even on
+ // Windows, so the server + agent see a single canonical shape.
+ const outcome = await fileToAttachment(makeTxt('notes.md'), {
+ absPathOf: () => 'C:\\Work\\Project\\docs\\notes.md',
+ workspaceContentDir: 'C:\\Work\\Project',
+ pathSeparator: '\\',
+ });
+ expect(outcome.ok).toBe(true);
+ if (outcome.ok && outcome.part.kind === 'file') {
+ expect(outcome.part.path).toBe('docs/notes.md');
+ }
+ });
+
+ test('Windows: case-insensitive comparison — mixed-case abs matches lower-case root', async () => {
+ const outcome = await fileToAttachment(makeTxt('a.md'), {
+ absPathOf: () => 'c:\\WORK\\Project\\a.md',
+ workspaceContentDir: 'C:\\work\\project',
+ pathSeparator: '\\',
+ });
+ expect(outcome.ok).toBe(true);
+ if (outcome.ok && outcome.part.kind === 'file') {
+ expect(outcome.part.path).toBe('a.md');
+ }
+ });
+
+ test('Windows: sibling-prefix attack refused (case-insensitive)', async () => {
+ const outcome = await fileToAttachment(makeTxt('bad.md'), {
+ absPathOf: () => 'C:\\Work\\Project-Evil\\bad.md',
+ workspaceContentDir: 'C:\\Work\\Project',
+ pathSeparator: '\\',
+ });
+ expect(outcome.ok).toBe(false);
+ if (!outcome.ok) expect(outcome.error.kind).toBe('outside-workspace');
+ });
+
+ test('no absPathOf resolver → unknown-path (web host without Electron)', async () => {
+ const outcome = await fileToAttachment(makeTxt('a.md'), {
+ workspaceContentDir: '/work/project',
+ pathSeparator: '/',
+ });
+ expect(outcome.ok).toBe(false);
+ if (!outcome.ok) expect(outcome.error.kind).toBe('unknown-path');
+ });
+
+ test('resolver returns null (Electron webUtils gave up) → unknown-path', async () => {
+ const outcome = await fileToAttachment(makeTxt('a.md'), {
+ absPathOf: () => null,
+ workspaceContentDir: '/work/project',
+ pathSeparator: '/',
+ });
+ expect(outcome.ok).toBe(false);
+ if (!outcome.ok) expect(outcome.error.kind).toBe('unknown-path');
+ });
+
+ test('image files still short-circuit through the image path, ignoring workspace deps', async () => {
+ // Images can come from anywhere (OS clipboard, downloads), so the
+ // containment check MUST NOT gate them. This test pins that separation.
+ const png = makeFile(new Uint8Array([1, 2, 3]), 'shot.png', 'image/png');
+ const outcome = await fileToAttachment(png, {
+ // Deliberately no absPathOf / contentDir — should not matter for images.
+ });
+ expect(outcome.ok).toBe(true);
+ if (outcome.ok) expect(outcome.part.kind).toBe('image');
+ });
+});
diff --git a/packages/app/src/lib/acp/image-attachment.ts b/packages/app/src/lib/acp/image-attachment.ts
new file mode 100644
index 000000000..ae41c60cd
--- /dev/null
+++ b/packages/app/src/lib/acp/image-attachment.ts
@@ -0,0 +1,234 @@
+/**
+ * Turn a dropped, pasted, or picked `File` into an `AttachmentPart` ready
+ * for the ACP composer's outbound send. Two paths: image files (PNG/JPEG/
+ * GIF/WebP under the per-image cap) become `image` parts; non-image files
+ * become `file` parts pointing at a workspace-relative path — the server
+ * resolves those to `EmbeddedResource` (text under the embed cap) or
+ * `ResourceLink` (binaries + oversized). Rejects files outside the
+ * workspace up front so a path the agent can't reach never leaves the
+ * client, and rejects over-cap images so a busted attachment doesn't
+ * ride the wire and get dropped server-side.
+ */
+
+import type { AttachmentPart } from '@inkeep/open-knowledge-core/acp/thread-protocol';
+
+/** Images the ACP `ImageContent` block explicitly accepts across the agents
+ * we ship (Claude, Codex, Cursor). PNG/JPEG/GIF/WebP is the intersection;
+ * SVG is deliberately excluded — agents interpret raster payloads reliably
+ * and vector formats' scripting surface makes them a poor default. */
+export const ALLOWED_IMAGE_MIMES: ReadonlySet<string> = new Set([
+ 'image/png',
+ 'image/jpeg',
+ 'image/gif',
+ 'image/webp',
+]);
+
+/** Per-image raw-byte ceiling — sized so the base64-encoded prompt frame
+ * stays under the collab WebSocket's 1 MiB `maxPayload` cap (see
+ * `collaboration-host.ts` `MAX_COLLAB_MESSAGE_BYTES`). Base64 inflates
+ * bytes ~4/3×, and the frame carries other fields (text, chip mentions,
+ * wrapping JSON), so 700 KiB raw ≈ 933 KiB encoded — enough headroom for
+ * the surrounding prompt without tripping `ws` code 1009. Enforced per
+ * attachment; going higher makes the WS silently drop the message. */
+export const MAX_IMAGE_BYTES = 700 * 1024;
+
+export type ImageAttachmentError =
+ | { readonly kind: 'unsupported-type'; readonly mimeType: string }
+ | { readonly kind: 'too-large'; readonly sizeBytes: number; readonly limitBytes: number }
+ | { readonly kind: 'outside-workspace'; readonly name: string }
+ | { readonly kind: 'unknown-path'; readonly name: string };
+
+/** Errors from the more permissive `fileToAttachment` path — includes the
+ * image ones plus a generic too-large for non-image blobs. */
+export type FileAttachmentError = ImageAttachmentError;
+
+/** Format an error for a user-visible toast. Kept out of the React tree so
+ * every host uses the same wording (and translation). */
+export function describeImageError(error: ImageAttachmentError): string {
+ if (error.kind === 'unsupported-type') {
+ if (error.mimeType.startsWith('image/')) {
+ return `Only PNG, JPEG, GIF, and WebP images are supported (got ${error.mimeType}).`;
+ }
+ return `Unsupported file type: ${error.mimeType || 'unknown'}.`;
+ }
+ if (error.kind === 'outside-workspace') {
+ return `${error.name} is outside the workspace. Move it into your project first.`;
+ }
+ if (error.kind === 'unknown-path') {
+ return `${error.name} has no resolvable path — the agent can only read files inside the workspace.`;
+ }
+ const mb = (error.limitBytes / (1024 * 1024)).toFixed(1);
+ return `File is too large (${(error.sizeBytes / (1024 * 1024)).toFixed(1)} MB) — max ${mb} MB per attachment.`;
+}
+
+/** Read a File as base64, stripping the `data:<mime>;base64,` prefix the
+ * browser hands us in `FileReader.result`. Rejects on a broken read. */
+async function encodeImageFile(file: File): Promise<{
+ readonly data: string;
+ readonly mimeType: string;
+ readonly name: string;
+ readonly sizeBytes: number;
+}> {
+ const dataUrl = await new Promise<string>((resolve, reject) => {
+ const reader = new FileReader();
+ reader.onerror = () => reject(reader.error ?? new Error('FileReader failed'));
+ reader.onload = () => {
+ const result = reader.result;
+ if (typeof result !== 'string') {
+ reject(new Error('FileReader returned non-string result'));
+ return;
+ }
+ resolve(result);
+ };
+ reader.readAsDataURL(file);
+ });
+ const comma = dataUrl.indexOf(',');
+ const data = comma >= 0 ? dataUrl.slice(comma + 1) : dataUrl;
+ return {
+ data,
+ mimeType: file.type || 'application/octet-stream',
+ name: file.name || 'image',
+ sizeBytes: file.size,
+ };
+}
+
+/**
+ * End-to-end conversion: validate, encode, wrap as `AttachmentPart`. Returns
+ * either the part or a classified error the caller renders as a toast. Never
+ * throws for a client-input problem — those go through `Err`.
+ */
+export async function fileToImageAttachment(
+ file: File,
+): Promise<
+ | { readonly ok: true; readonly part: AttachmentPart }
+ | { readonly ok: false; readonly error: ImageAttachmentError }
+> {
+ const mimeType = file.type || '';
+ if (!ALLOWED_IMAGE_MIMES.has(mimeType)) {
+ return { ok: false, error: { kind: 'unsupported-type', mimeType } };
+ }
+ if (file.size > MAX_IMAGE_BYTES) {
+ return {
+ ok: false,
+ error: { kind: 'too-large', sizeBytes: file.size, limitBytes: MAX_IMAGE_BYTES },
+ };
+ }
+ const encoded = await encodeImageFile(file);
+ return {
+ ok: true,
+ part: {
+ kind: 'image',
+ data: encoded.data,
+ mimeType: encoded.mimeType,
+ name: encoded.name,
+ sizeBytes: encoded.sizeBytes,
+ },
+ };
+}
+
+/**
+ * Yield image files from a DataTransfer — the drop-event and paste-event
+ * source. Both `items` (paste + rich drag) and `files` (plain drag) are
+ * examined so a screenshot pasted from the OS clipboard is handled the
+ * same as a file dragged from Finder.
+ */
+export function collectImageFiles(dataTransfer: DataTransfer | null): File[] {
+ return collectFiles(dataTransfer, (file) => file.type.startsWith('image/'));
+}
+
+/**
+ * Yield ALL files (any mime) from a DataTransfer — the wider path the
+ * agent-thread panel uses so a code file dragged from Finder attaches the
+ * same way a PNG does. Same items+files traversal + dedup as the
+ * image-only variant. Excludes zero-byte entries (dragging a folder from
+ * Finder emits an entry with size 0 that browsers can't read as bytes).
+ */
+export function collectAllFiles(dataTransfer: DataTransfer | null): File[] {
+ return collectFiles(dataTransfer, (file) => file.size > 0);
+}
+
+function collectFiles(dataTransfer: DataTransfer | null, accept: (file: File) => boolean): File[] {
+ if (dataTransfer === null) return [];
+ const seen = new Set<string>();
+ const out: File[] = [];
+ const remember = (file: File | null) => {
+ if (file === null) return;
+ if (!accept(file)) return;
+ const key = `${file.name}|${file.size}|${file.lastModified ?? 0}`;
+ if (seen.has(key)) return;
+ seen.add(key);
+ out.push(file);
+ };
+ const items = dataTransfer.items;
+ if (items) {
+ for (let i = 0; i < items.length; i += 1) {
+ const it = items[i];
+ if (it && it.kind === 'file') remember(it.getAsFile());
+ }
+ }
+ const files = dataTransfer.files;
+ if (files) {
+ for (let i = 0; i < files.length; i += 1) remember(files[i] ?? null);
+ }
+ return out;
+}
+
+/** Options `fileToAttachment` needs to enforce the workspace-containment
+ * rule for non-image files. `absPathOf` recovers the on-disk path from a
+ * File (Electron `webUtils.getPathForFile`); web hosts pass `undefined`
+ * and only images ride through. `workspaceContentDir` is the absolute
+ * workspace root; a path outside it is refused. */
+export interface FileToAttachmentDeps {
+ readonly absPathOf?: (file: File) => string | null;
+ readonly workspaceContentDir?: string;
+ readonly pathSeparator?: '/' | '\\';
+}
+
+/** Resolve `abs` to a workspace-relative path if it lives inside `root`,
+ * else null. Comparison is case-sensitive on POSIX, case-insensitive on
+ * Windows (matching `confineToContentDir`'s stance). No `..` traversal
+ * because we only trust paths the OS handed us via `webUtils.getPathForFile`. */
+function workspaceRelativePath(abs: string, root: string, sep: '/' | '\\'): string | null {
+ const normAbs = sep === '\\' ? abs.toLowerCase() : abs;
+ const normRoot = sep === '\\' ? root.toLowerCase() : root;
+ const rootWithSep = normRoot.endsWith(sep) ? normRoot : `${normRoot}${sep}`;
+ if (normAbs === normRoot) return '';
+ if (!normAbs.startsWith(rootWithSep)) return null;
+ const rel = abs.slice(rootWithSep.length);
+ // Always serialize workspace paths POSIX-style — the server + wire
+ // contract expect forward slashes.
+ return sep === '\\' ? rel.replaceAll('\\', '/') : rel;
+}
+
+export async function fileToAttachment(
+ file: File,
+ deps: FileToAttachmentDeps = {},
+): Promise<
+ | { readonly ok: true; readonly part: AttachmentPart }
+ | { readonly ok: false; readonly error: FileAttachmentError }
+> {
+ const mime = file.type || '';
+ if (mime.startsWith('image/')) return fileToImageAttachment(file);
+ // Non-image path: require an on-disk file that lives inside the workspace.
+ // Zed's behavior — files outside the project root aren't sent; the agent's
+ // tools can't reach them anyway, so refusing up-front is honest and cheap.
+ const absPathOf = deps.absPathOf;
+ const contentDir = deps.workspaceContentDir;
+ const sep = deps.pathSeparator ?? '/';
+ const name = file.name || 'attachment';
+ if (absPathOf === undefined || contentDir === undefined || contentDir === '') {
+ return { ok: false, error: { kind: 'unknown-path', name } };
+ }
+ const abs = absPathOf(file);
+ if (abs === null || abs === '') {
+ return { ok: false, error: { kind: 'unknown-path', name } };
+ }
+ const rel = workspaceRelativePath(abs, contentDir, sep);
+ if (rel === null) {
+ return { ok: false, error: { kind: 'outside-workspace', name } };
+ }
+ return {
+ ok: true,
+ part: { kind: 'file', path: rel, name },
+ };
+}
diff --git a/packages/app/src/lib/acp/thread-client.ts b/packages/app/src/lib/acp/thread-client.ts
index a3911c4cd..35928c29f 100644
--- a/packages/app/src/lib/acp/thread-client.ts
+++ b/packages/app/src/lib/acp/thread-client.ts
@@ -15,6 +15,7 @@
*/
import type {
+ AttachmentPart,
ThreadClientFrame,
ThreadEvent,
ThreadInfo,
@@ -197,6 +198,7 @@ export class AgentThreadClient {
async createThread(params: {
agent: { source: 'registry' | 'custom'; id: string };
prompt?: string;
+ attachments?: readonly AttachmentPart[];
docName?: string;
titleHint?: string;
}): Promise<ThreadInfo> {
@@ -237,9 +239,22 @@ export class AgentThreadClient {
return promise;
}
- prompt(threadId: string, content: string): void {
+ prompt(threadId: string, content: string, attachments?: readonly AttachmentPart[]): void {
+ const trimmed = content.trim();
+ const hasAttachments = attachments !== undefined && attachments.length > 0;
+ // Refuse both-empty at the client so a no-op frame doesn't open an
+ // empty turn — matches the guard steer() has. Server's `prompt` parser
+ // accepts empty strings (attachment-only prompts are legitimate), so
+ // this side is where the guard lives.
+ if (trimmed === '' && !hasAttachments) return;
this.reqCounter += 1;
- this.send({ op: 'prompt', threadId, reqId: `prompt-${this.reqCounter}`, content });
+ this.send({
+ op: 'prompt',
+ threadId,
+ reqId: `prompt-${this.reqCounter}`,
+ content: trimmed,
+ ...(hasAttachments ? { attachments } : {}),
+ });
}
/**
@@ -247,11 +262,18 @@ export class AgentThreadClient {
* like `prompt`: the refreshed `info` (carrying the parked `steer`) is the
* confirmation, and a refusal comes back as an `error` frame on the reqId.
*/
- steer(threadId: string, content: string): void {
+ steer(threadId: string, content: string, attachments?: readonly AttachmentPart[]): void {
const trimmed = content.trim();
- if (trimmed === '') return;
+ const hasAttachments = attachments !== undefined && attachments.length > 0;
+ if (trimmed === '' && !hasAttachments) return;
this.reqCounter += 1;
- this.send({ op: 'steer', threadId, reqId: `steer-${this.reqCounter}`, content: trimmed });
+ this.send({
+ op: 'steer',
+ threadId,
+ reqId: `steer-${this.reqCounter}`,
+ content: trimmed,
+ ...(hasAttachments ? { attachments } : {}),
+ });
}
/**
@@ -375,7 +397,11 @@ export class AgentThreadClient {
* `code === 'resume-unsupported'` means the agent can't continue old
* sessions and the UI should offer a fresh thread.
*/
- async resumeThread(threadId: string, prompt?: string): Promise<ThreadInfo> {
+ async resumeThread(
+ threadId: string,
+ prompt?: string,
+ attachments?: readonly AttachmentPart[],
+ ): Promise<ThreadInfo> {
this.connectNow();
await this.waitForOpen(CHANNEL_WAIT_MS);
this.reqCounter += 1;
@@ -387,7 +413,13 @@ export class AgentThreadClient {
}, RESUME_TIMEOUT_MS);
this.pendingResumes.set(reqId, { resolve, reject, timer });
});
- this.send({ op: 'resume', threadId, reqId, prompt });
+ this.send({
+ op: 'resume',
+ threadId,
+ reqId,
+ prompt,
+ ...(attachments !== undefined && attachments.length > 0 ? { attachments } : {}),
+ });
return promise;
}
diff --git a/packages/app/src/lib/acp/thread-event-model.ts b/packages/app/src/lib/acp/thread-event-model.ts
index fdfac0d71..fd6a3e2bb 100644
--- a/packages/app/src/lib/acp/thread-event-model.ts
+++ b/packages/app/src/lib/acp/thread-event-model.ts
@@ -34,6 +34,10 @@ interface RenderedMessage {
role: 'user' | 'agent' | 'thought';
text: string;
messageId: string;
+ /** Attachment parts that rode this message on send — user turns only, and
+ * omitted for the streaming agent variants. Frozen at send time by the
+ * server so a replayed transcript renders exactly what was sent. */
+ attachments?: readonly import('@inkeep/open-knowledge-core/acp/thread-protocol').AttachmentPart[];
}
export interface RenderedToolCall {
@@ -241,12 +245,16 @@ export class ThreadRenderModelBuilder {
this.dirty = true;
switch (event.kind) {
case 'user_message': {
- this.items.push({
+ const message: RenderedMessage = {
kind: 'message',
role: 'user',
text: event.content,
messageId: `user-${this.items.length}`,
- });
+ };
+ if (event.attachments !== undefined && event.attachments.length > 0) {
+ message.attachments = event.attachments;
+ }
+ this.items.push(message);
// A user turn resets streaming message coalescing.
this.messageIndex.clear();
break;
diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.json
index 63b0905ba..a36e7af55 100644
--- a/packages/app/src/locales/ar/messages.json
+++ b/packages/app/src/locales/ar/messages.json
@@ -350,6 +350,7 @@
}
]
],
+ "3uSzeS": ["صور من أي مكان · يجب أن تكون الملفات غير المصورة داخل مساحة العمل"],
"3v62tp": ["شائع على skills.sh"],
"3wiBAs": ["أين ينبغي أن يعيش؟"],
"3y6XTb": ["البحث الدلالي"],
@@ -706,6 +707,7 @@
"90-wKT": ["قرأ OpenKnowledge سجل ", ["subject"]],
"92rbk2": ["يجري تحميل المرآة <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["إخفاء الوكلاء"],
+ "95bl6Q": ["القراءة من مساحة العمل هذه"],
"96G6Re": ["مجلد جديد"],
"96pApd": ["ملف للقراءة فقط في مهارة ", ["name"]],
"96w9hU": ["حدث خطأ ما أثناء فتح هذا الملف (HTTP ", ["status"], ")."],
@@ -1497,6 +1499,7 @@
"Ix0K8o": ["إخفاء عقد الروابط الخارجية"],
"IxHMdF": ["تعذّر حذف ذلك التعليق."],
"IxyZXD": ["لقطة الشاشة"],
+ "Izh19j": ["القراءة من ", ["tail"]],
"J1XRO3": ["ألوان السمة"],
"J2Mv98": ["الاسم (مثل ", ["login"], ")"],
"J2_JuX": ["لا شيء (", ["0"], " لا يمكن أن يطابق مستندًا)"],
@@ -1644,6 +1647,7 @@
"LXdWeS": ["عنوان قسم متوسط."],
"LXfNU-": ["التنقل والاقتراحات"],
"LYufDw": ["فشل تفعيل البحث الدلالي — ", ["detail"]],
+ "LZe2vX": [" · مراجع فقط (بدون محتوى مضمن)"],
"LaskKp": ["الإرسال إلى المحادثة (", ["0"], ")"],
"Lbl6KA": ["تعذّر التثبيت من ", ["0"], ": ", ["1"]],
"LbmLyU": ["لا يمكن تحرير إعداد هذه الأداة بأمان"],
@@ -2023,6 +2027,7 @@
"QGWzup": ["يجري تحميل مهارات OpenKnowledge"],
"QHCx0c": ["سجل تقارير العلل"],
"QIrBIx": ["توسيع كل الملفات"],
+ "QIzioS": [["agentName"], " لا يقبل مرفقات الصور."],
"QKgePK": ["تمت مواءمة ", ["editor"], " مع المصدر (نُسخت بايتاته احتياطيًا)"],
"QLgdT6": ["أي مستند باسم ", ["0"]],
"QM3SBZ": ["الخطة (", ["done"], "/", ["0"], ")"],
@@ -3243,6 +3248,7 @@
"enPTnx": ["السطر ", ["displayLine"]],
"epuNYK": ["حدّد كتلة كمرجع أساسي. تتحدث المرايا في الأماكن الأخرى مباشرةً أثناء تحريرك لها."],
"erenF-": ["لا يمكن حذف ملفات لم تُحَل تعارضاتها"],
+ "euGaS0": ["تعذّرت قراءة ", ["fileName"], "."],
"euc6Ns": ["تكرار"],
"evHlIg": ["لا تدفع المتابعة تغييراتك المحلية ولا تودعها أبدًا. تبقى على هذا الجهاز وحده."],
"evs0iw": ["وسوم تطابق «", ["tagListQuery"], "»"],
@@ -3557,6 +3563,7 @@
["2"],
" تلقائيًا."
],
+ "ij-Elv": ["معاينة الصورة"],
"ijLc3m": ["قائمة نقطية"],
"ilodsp": ["دع الوكلاء يستخدمون OpenKnowledge دون سؤال"],
"ioMn4Z": ["جديد من قالب…"],
@@ -3902,6 +3909,7 @@
"اختر لوحة للوضع الفاتح وأخرى للوضع الداكن. يختار إعداد السمة في «التفضيلات» بينهما — وعلى “النظام”، يختار نظام تشغيلك."
],
"mo22UP": ["بدّل تنسيق الكود المضمَّن."],
+ "moUeZ_": ["أفلت ملفًا لإرفاقه"],
"mqSwZH": [
"<0>لم يُعثر على مرساة المرآة.</0> لا يوجد <1>",
["mirrorSourceTag"],
@@ -4412,6 +4420,7 @@
"tA0b9E": ["مجلد المهارات الافتراضي (يظهر المسار الدقيق بعد الحفظ)"],
"tA2-xC": ["«", ["0"], "» مضاف بالفعل (محتوى مطابق)."],
"tAPZEx": ["أسفل"],
+ "tCyvAw": ["إرفاق ملف"],
"tHKQ6j": ["تجري إعادة التسمية"],
"tKlWWY": ["رموز تعبيرية"],
"tLX6LY": ["كتب OpenKnowledge مستندًا"],
diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.po
index 29313daec..9faf5c51d 100644
--- a/packages/app/src/locales/ar/messages.po
+++ b/packages/app/src/locales/ar/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · مراجع فقط (بدون محتوى مضمن)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " أو "
@@ -442,6 +446,10 @@ msgstr "تعذّر على {agentName} بدء محادثة."
msgid "{agentName} couldn't start."
msgstr "تعذّر تشغيل {agentName}."
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} لا يقبل مرفقات الصور."
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} أمام"
@@ -1724,6 +1732,10 @@ msgstr "اقتراحات الأصول"
msgid "Asset: {title}"
msgstr "الأصل: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "إرفاق ملف"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "إرفاق صور"
@@ -3529,6 +3541,10 @@ msgstr "تعذّر الوصول إلى نقطة النهاية. تحقق من ا
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "تعذّر الوصول إلى خادم Open Knowledge لرفع {fileName}."
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "تعذّرت قراءة {fileName}."
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "تعذّرت قراءة {fileName}. ربما نُقل أو حُذف أو لم يكتمل تنزيله. حاول إضافته مرة أخرى."
@@ -4468,6 +4484,10 @@ msgstr "اسحب {patternText} لإعادة الترتيب"
msgid "Drag item {0} to reorder"
msgstr "اسحب العنصر {0} لإعادة الترتيب"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "أفلت ملفًا لإرفاقه"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6191,6 +6211,10 @@ msgstr "الصورة غير موجودة"
msgid "Image not found: {errorLabel}"
msgstr "الصورة غير موجودة: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "معاينة الصورة"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "تعذّر تحويل هدف الصورة \"{shown}\" إلى ملف محلي في المشروع."
@@ -6199,6 +6223,10 @@ msgstr "تعذّر تحويل هدف الصورة \"{shown}\" إلى ملف مح
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "هدف الصورة \"{shown}\" لا يشير إلى ملف موجود."
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "صور من أي مكان · يجب أن تكون الملفات غير المصورة داخل مساحة العمل"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "استيراد"
@@ -9530,6 +9558,14 @@ msgstr "نسخة للقراءة فقط من كتلة MirrorSource في مستن
msgid "Read-only file in the {name} skill"
msgstr "ملف للقراءة فقط في مهارة {name}"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "القراءة من {tail}"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "القراءة من مساحة العمل هذه"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "يجري القراءة…"
@@ -9700,6 +9736,8 @@ msgid "Remove"
msgstr "إزالة"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "إزالة {0}"
diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.json
index 99c7ef10a..40be48afb 100644
--- a/packages/app/src/locales/bn/messages.json
+++ b/packages/app/src/locales/bn/messages.json
@@ -287,6 +287,7 @@
"3s-k7L": [
["0", "plural", { "one": ["আরও ", "#", " টুল দেখান"], "other": ["আরও ", "#", " টুল দেখান"] }]
],
+ "3uSzeS": ["যেকোনো জায়গা থেকে ছবি · অ-ছবি ফাইলগুলি ওয়ার্কস্পেসে থাকতে হবে"],
"3v62tp": ["skills.sh-এ জনপ্রিয়"],
"3wiBAs": ["এটি কোথায় থাকবে?"],
"3y6XTb": ["অর্থভিত্তিক অনুসন্ধান"],
@@ -612,6 +613,7 @@
"90-wKT": ["OpenKnowledge ", ["subject"], " এর ইতিহাস পড়েছে"],
"92rbk2": ["মিরর <0>", ["mirrorRef"], "</0> লোড হচ্ছে"],
"93LBnX": ["Agents লুকান"],
+ "95bl6Q": ["এই ওয়ার্কস্পেস থেকে পড়া হচ্ছে"],
"96G6Re": ["নতুন ফোল্ডার"],
"96pApd": [["name"], " স্কিলের শুধু-পড়ার ফাইল"],
"96w9hU": ["এই ফাইলটি খোলার সময় কিছু একটা ভুল হয়েছে (HTTP ", ["status"], ")।"],
@@ -1265,6 +1267,7 @@
"Ix0K8o": ["বাইরের URL নোড লুকান"],
"IxHMdF": ["ওই মন্তব্যটি মুছে ফেলা যায়নি।"],
"IxyZXD": ["স্ক্রিনশট"],
+ "Izh19j": [["tail"], " থেকে পড়া হচ্ছে"],
"J1XRO3": ["থিমের রং"],
"J2Mv98": ["নাম (যেমন ", ["login"], ")"],
"J2_JuX": ["কিছুই নয় (", ["0"], " কোনো নথির সঙ্গে মিলতে পারে না)"],
@@ -1408,6 +1411,7 @@
"LXdWeS": ["মাঝারি বিভাগ শিরোনাম।"],
"LXfNU-": ["নেভিগেশন ও পরামর্শ"],
"LYufDw": ["অর্থভিত্তিক অনুসন্ধান চালু করতে ব্যর্থ — ", ["detail"]],
+ "LZe2vX": [" · শুধু রেফারেন্স (কোনো এম্বেড করা বিষয়বস্তু নেই)"],
"LaskKp": ["আলাপে পাঠান (", ["0"], ")"],
"Lbl6KA": [["0"], " থেকে ইনস্টল করা যায়নি: ", ["1"]],
"LbmLyU": ["এই টুলের কনফিগ নিরাপদে সম্পাদনা করা যাচ্ছে না"],
@@ -1758,6 +1762,7 @@
"QGWzup": ["OpenKnowledge স্কিল লোড হচ্ছে"],
"QHCx0c": ["বাগ রিপোর্টের ইতিহাস"],
"QIrBIx": ["সব ফাইল মেলে ধরুন"],
+ "QIzioS": [["agentName"], " ছবি সংযুক্তি গ্রহণ করে না।"],
"QKgePK": [["editor"], "-কে উৎসের সঙ্গে মেলানো হয়েছে (এর বাইটের ব্যাকআপ নেওয়া আছে)"],
"QLgdT6": [["0"], " নামের যেকোনো নথি"],
"QM3SBZ": ["পরিকল্পনা (", ["done"], "/", ["0"], ")"],
@@ -2771,6 +2776,7 @@
"একটি ব্লককে সত্যের উৎস হিসেবে চিহ্নিত করুন। আপনি সেটি সম্পাদনা করার সঙ্গে সঙ্গে অন্য জায়গার মিররগুলো হালনাগাদ হয়।"
],
"erenF-": ["যেসব ফাইলের দ্বন্দ্ব এখনও মেটেনি সেগুলো মোছা যাবে না"],
+ "euGaS0": [["fileName"], " পড়া যায়নি।"],
"euc6Ns": ["প্রতিলিপি করুন"],
"evHlIg": ["Follow কখনও আপনার স্থানীয় পরিবর্তন পাঠায় না বা কমিট করে না। সেগুলো কেবল এই মেশিনেই থাকে।"],
"evs0iw": ["\"", ["tagListQuery"], "\"-এর সঙ্গে মিলে যাওয়া ট্যাগ"],
@@ -3051,6 +3057,7 @@
["2"],
"-এ পৌঁছাবে না।"
],
+ "ij-Elv": ["ছবির প্রিভিউ"],
"ijLc3m": ["বুলেট তালিকা"],
"ilodsp": ["এজেন্টদের না জিজ্ঞেস করেই OpenKnowledge ব্যবহার করতে দিন"],
"ioMn4Z": ["টেমপ্লেট থেকে নতুন…"],
@@ -3359,6 +3366,7 @@
"হালকা মোডের জন্য একটি প্যালেট আর গাঢ় মোডের জন্য একটি বাছুন। Preferences-এর থিম সেটিং এদের মধ্যে বেছে নেয় — “System”-এ থাকলে আপনার OS-ও তাই করে।"
],
"mo22UP": ["ইনলাইন কোড বিন্যাস চালু বা বন্ধ করুন।"],
+ "moUeZ_": ["সংযুক্ত করতে একটি ফাইল ফেলুন"],
"mqSwZH": [
"<0>মিরর অ্যাংকর পাওয়া যায়নি।</0> <2>",
["src"],
@@ -3792,6 +3800,7 @@
"tA0b9E": ["ডিফল্ট স্কিল ফোল্ডার (সংরক্ষণের পর সঠিক পথটি দেখা যায়)"],
"tA2-xC": ["\"", ["0"], "\" আগেই যোগ করা হয়েছিল (একই বিষয়বস্তু)।"],
"tAPZEx": ["নিচে"],
+ "tCyvAw": ["একটি ফাইল সংযুক্ত করুন"],
"tHKQ6j": ["নাম বদলানো হচ্ছে"],
"tKlWWY": ["ইমোজি"],
"tLX6LY": ["OpenKnowledge একটি নথি লিখেছে"],
diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.po
index 4830760d0..ab7130fab 100644
--- a/packages/app/src/locales/bn/messages.po
+++ b/packages/app/src/locales/bn/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · শুধু রেফারেন্স (কোনো এম্বেড করা বিষয়বস্তু নেই)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " বা "
@@ -442,6 +446,10 @@ msgstr "{agentName} কথোপকথন শুরু করতে পারে
msgid "{agentName} couldn't start."
msgstr "{agentName} শুরু হতে পারেনি।"
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} ছবি সংযুক্তি গ্রহণ করে না।"
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} এগিয়ে"
@@ -1720,6 +1728,10 @@ msgstr "অ্যাসেট পরামর্শ"
msgid "Asset: {title}"
msgstr "সম্পদ: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "একটি ফাইল সংযুক্ত করুন"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "ছবি সংযুক্ত করুন"
@@ -3525,6 +3537,10 @@ msgstr "এন্ডপয়েন্টের নাগাল পাওয়
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "{fileName} আপলোড করতে Open Knowledge সার্ভারের নাগাল পাওয়া যায়নি।"
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "{fileName} পড়া যায়নি।"
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "{fileName} পড়া যায়নি। হয়তো সেটি সরানো হয়েছে, মুছে ফেলা হয়েছে, বা ডাউনলোড শেষ হয়নি। আবার যোগ করে দেখুন।"
@@ -4464,6 +4480,10 @@ msgstr "ক্রম বদলাতে {patternText} টেনে আনুন"
msgid "Drag item {0} to reorder"
msgstr "ক্রম বদলাতে আইটেম {0} টেনে আনুন"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "সংযুক্ত করতে একটি ফাইল ফেলুন"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6187,6 +6207,10 @@ msgstr "ছবি পাওয়া যায়নি"
msgid "Image not found: {errorLabel}"
msgstr "ছবি পাওয়া যায়নি: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "ছবির প্রিভিউ"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "ছবির লক্ষ্য \"{shown}\"-কে প্রকল্পের স্থানীয় ফাইল হিসেবে নির্ণয় করা যায়নি।"
@@ -6195,6 +6219,10 @@ msgstr "ছবির লক্ষ্য \"{shown}\"-কে প্রকল্প
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "ছবির লক্ষ্য \"{shown}\" কোনো বিদ্যমান ফাইলকে নির্দেশ করে না।"
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "যেকোনো জায়গা থেকে ছবি · অ-ছবি ফাইলগুলি ওয়ার্কস্পেসে থাকতে হবে"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "আমদানি করুন"
@@ -9526,6 +9554,14 @@ msgstr "অন্য নথির একটি MirrorSource ব্লকের
msgid "Read-only file in the {name} skill"
msgstr "{name} স্কিলের শুধু-পড়ার ফাইল"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "{tail} থেকে পড়া হচ্ছে"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "এই ওয়ার্কস্পেস থেকে পড়া হচ্ছে"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "পড়া হচ্ছে…"
@@ -9696,6 +9732,8 @@ msgid "Remove"
msgstr "সরান"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "{0} সরান"
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 71e3d688f..95b8f2534 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -296,6 +296,7 @@
{ "one": ["Show ", "#", " more tool"], "other": ["Show ", "#", " more tools"] }
]
],
+ "3uSzeS": ["Images from anywhere · non-image files must be in the workspace"],
"3v62tp": ["Popular on skills.sh"],
"3wiBAs": ["Where should it live?"],
"3y6XTb": ["Semantic search"],
@@ -633,6 +634,7 @@
"90-wKT": ["OpenKnowledge read the history of ", ["subject"]],
"92rbk2": ["Mirror loading <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["Hide Agents"],
+ "95bl6Q": ["Reading from this workspace"],
"96G6Re": ["New folder"],
"96pApd": ["Read-only file in the ", ["name"], " skill"],
"96w9hU": ["Something went wrong opening this file (HTTP ", ["status"], ")."],
@@ -1306,6 +1308,7 @@
"Ix0K8o": ["Hide external URL nodes"],
"IxHMdF": ["Couldn't delete that comment."],
"IxyZXD": ["Screenshot"],
+ "Izh19j": ["Reading from ", ["tail"]],
"J1XRO3": ["Theme colors"],
"J2Mv98": ["Name (e.g. ", ["login"], ")"],
"J2_JuX": ["nothing (", ["0"], " cannot match a doc)"],
@@ -1451,6 +1454,7 @@
"LXdWeS": ["Medium section heading."],
"LXfNU-": ["Navigation and suggestions"],
"LYufDw": ["Failed to enable semantic search — ", ["detail"]],
+ "LZe2vX": [" · references only (no embedded contents)"],
"LaskKp": ["Send to chat (", ["0"], ")"],
"Lbl6KA": ["Couldn't install from ", ["0"], ": ", ["1"]],
"LbmLyU": ["Can't safely edit this tool's config"],
@@ -1807,6 +1811,7 @@
"QGWzup": ["Loading OpenKnowledge skills"],
"QHCx0c": ["Bug report history"],
"QIrBIx": ["Expand all files"],
+ "QIzioS": [["agentName"], " doesn't accept image attachments."],
"QKgePK": ["Aligned ", ["editor"], " to the source (its bytes are backed up)"],
"QLgdT6": ["any doc named ", ["0"]],
"QM3SBZ": ["Plan (", ["done"], "/", ["0"], ")"],
@@ -2843,6 +2848,7 @@
"Mark a block as the source of truth. Mirrors elsewhere update live as you edit it."
],
"erenF-": ["Cannot delete files with unresolved conflicts"],
+ "euGaS0": ["Couldn't read ", ["fileName"], "."],
"euc6Ns": ["Duplicate"],
"evHlIg": [
"Follow never pushes or commits your local changes. They stay only on this machine."
@@ -3142,6 +3148,7 @@
["2"],
" automatically."
],
+ "ij-Elv": ["Image preview"],
"ijLc3m": ["Bullet list"],
"ilodsp": ["Let agents use OpenKnowledge without asking"],
"ioMn4Z": ["New from Template…"],
@@ -3460,6 +3467,7 @@
"Pick a palette for light mode and one for dark mode. The theme setting in Preferences chooses between them — on “System”, so does your OS."
],
"mo22UP": ["Toggle inline code formatting."],
+ "moUeZ_": ["Drop a file to attach"],
"mqSwZH": [
"<0>Mirror anchor not found.</0> No <1>",
["mirrorSourceTag"],
@@ -3917,6 +3925,7 @@
"tA0b9E": ["the default skills folder (the exact path appears once saved)"],
"tA2-xC": ["\"", ["0"], "\" was already added (identical content)."],
"tAPZEx": ["Below"],
+ "tCyvAw": ["Attach a file"],
"tHKQ6j": ["Renaming"],
"tKlWWY": ["Emoji"],
"tLX6LY": ["OpenKnowledge wrote a document"],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 3698d0be4..62b105f0e 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · references only (no embedded contents)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " or "
@@ -442,6 +446,10 @@ msgstr "{agentName} couldn't start a conversation."
msgid "{agentName} couldn't start."
msgstr "{agentName} couldn't start."
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} doesn't accept image attachments."
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} ahead"
@@ -1724,6 +1732,10 @@ msgstr "Asset suggestions"
msgid "Asset: {title}"
msgstr "Asset: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "Attach a file"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "Attach images"
@@ -3529,6 +3541,10 @@ msgstr "Couldn't reach the endpoint. Check the URL and that the server is up."
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "Couldn't reach the Open Knowledge server to upload {fileName}."
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "Couldn't read {fileName}."
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
@@ -4468,6 +4484,10 @@ msgstr "Drag {patternText} to reorder"
msgid "Drag item {0} to reorder"
msgstr "Drag item {0} to reorder"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "Drop a file to attach"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6191,6 +6211,10 @@ msgstr "Image not found"
msgid "Image not found: {errorLabel}"
msgstr "Image not found: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "Image preview"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "Image target \"{shown}\" could not be resolved to a project-local file."
@@ -6199,6 +6223,10 @@ msgstr "Image target \"{shown}\" could not be resolved to a project-local file."
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "Image target \"{shown}\" does not resolve to an existing file."
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "Images from anywhere · non-image files must be in the workspace"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "Import"
@@ -9530,6 +9558,14 @@ msgstr "Read-only copy of a MirrorSource block from another doc. Edit at the sou
msgid "Read-only file in the {name} skill"
msgstr "Read-only file in the {name} skill"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "Reading from {tail}"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "Reading from this workspace"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "Reading…"
@@ -9700,6 +9736,8 @@ msgid "Remove"
msgstr "Remove"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "Remove {0}"
diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.json
index bf0793f42..0d72d8ea3 100644
--- a/packages/app/src/locales/es/messages.json
+++ b/packages/app/src/locales/es/messages.json
@@ -347,6 +347,9 @@
}
]
],
+ "3uSzeS": [
+ "Imágenes desde cualquier lugar · los archivos que no son imágenes deben estar en el espacio de trabajo"
+ ],
"3v62tp": ["Populares en skills.sh"],
"3wiBAs": ["¿Dónde debería vivir?"],
"3y6XTb": ["Búsqueda semántica"],
@@ -728,6 +731,7 @@
"90-wKT": ["OpenKnowledge leyó el historial de ", ["subject"]],
"92rbk2": ["El espejo está cargando <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["Ocultar Agentes"],
+ "95bl6Q": ["Leyendo desde este espacio de trabajo"],
"96G6Re": ["Carpeta nueva"],
"96pApd": ["Archivo de solo lectura en la habilidad ", ["name"]],
"96w9hU": ["Algo salió mal al abrir este archivo (HTTP ", ["status"], ")."],
@@ -1518,6 +1522,7 @@
"Ix0K8o": ["Ocultar los nodos de URL externas"],
"IxHMdF": ["No se pudo eliminar ese comentario."],
"IxyZXD": ["Captura de pantalla"],
+ "Izh19j": ["Leyendo desde ", ["tail"]],
"J1XRO3": ["Colores del tema"],
"J2Mv98": ["Nombre (p. ej. ", ["login"], ")"],
"J2_JuX": ["nada (", ["0"], " no puede coincidir con un documento)"],
@@ -1678,6 +1683,7 @@
"LXdWeS": ["Encabezado de sección mediano."],
"LXfNU-": ["Navegación y sugerencias"],
"LYufDw": ["No se pudo activar la búsqueda semántica — ", ["detail"]],
+ "LZe2vX": [" · solo referencias (sin contenido incrustado)"],
"LaskKp": ["Enviar al chat (", ["0"], ")"],
"Lbl6KA": ["No se pudo instalar desde ", ["0"], ": ", ["1"]],
"LbmLyU": ["No se puede editar con seguridad la configuración de esta herramienta"],
@@ -2066,6 +2072,7 @@
"QGWzup": ["Cargando las habilidades de OpenKnowledge"],
"QHCx0c": ["Historial de informes de error"],
"QIrBIx": ["Expandir todos los archivos"],
+ "QIzioS": [["agentName"], " no acepta adjuntos de imagen."],
"QKgePK": [
"Se alineó ",
["editor"],
@@ -3302,6 +3309,7 @@
"Marca un bloque como fuente de verdad. Los espejos de otros sitios se actualizan en vivo mientras lo editas."
],
"erenF-": ["No se pueden eliminar archivos con conflictos sin resolver"],
+ "euGaS0": ["No se pudo leer ", ["fileName"], "."],
"euc6Ns": ["Duplicar"],
"evHlIg": [
"Seguir nunca hace push ni commit de tus cambios locales. Se quedan solo en este equipo."
@@ -3644,6 +3652,7 @@
["2"],
" automáticamente."
],
+ "ij-Elv": ["Vista previa de imagen"],
"ijLc3m": ["Lista con viñetas"],
"ilodsp": ["Dejar que los agentes usen OpenKnowledge sin preguntar"],
"ioMn4Z": ["Nuevo desde plantilla…"],
@@ -4000,6 +4009,7 @@
"Elige una paleta para el modo claro y otra para el oscuro. El ajuste de tema en Preferencias elige entre ambas; en “Sistema”, lo hace tu SO."
],
"mo22UP": ["Activa o desactiva el código en línea."],
+ "moUeZ_": ["Suelta un archivo para adjuntarlo"],
"mqSwZH": [
"<0>No se encontró el ancla del espejo.</0> No existe ningún <1>",
["mirrorSourceTag"],
@@ -4507,6 +4517,7 @@
"tA0b9E": ["la carpeta de habilidades por defecto (la ruta exacta aparece al guardar)"],
"tA2-xC": ["\"", ["0"], "\" ya se había añadido (contenido idéntico)."],
"tAPZEx": ["Abajo"],
+ "tCyvAw": ["Adjuntar un archivo"],
"tHKQ6j": ["Renombrando"],
"tKlWWY": ["Emoji"],
"tLX6LY": ["OpenKnowledge escribió un documento"],
diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.po
index 54692eb21..a7bac8238 100644
--- a/packages/app/src/locales/es/messages.po
+++ b/packages/app/src/locales/es/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · solo referencias (sin contenido incrustado)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " o "
@@ -442,6 +446,10 @@ msgstr "{agentName} no pudo iniciar una conversación."
msgid "{agentName} couldn't start."
msgstr "{agentName} no pudo iniciarse."
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} no acepta adjuntos de imagen."
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} por delante"
@@ -1724,6 +1732,10 @@ msgstr "Sugerencias de recursos"
msgid "Asset: {title}"
msgstr "Recurso: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "Adjuntar un archivo"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "Adjuntar imágenes"
@@ -3529,6 +3541,10 @@ msgstr "No se pudo contactar con el endpoint. Revisa la URL y que el servidor es
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "No se pudo contactar con el servidor de Open Knowledge para subir {fileName}."
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "No se pudo leer {fileName}."
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "No se pudo leer {fileName}. Puede que se haya movido, eliminado o que no haya terminado de descargarse. Prueba a añadirlo de nuevo."
@@ -4468,6 +4484,10 @@ msgstr "Arrastra {patternText} para reordenar"
msgid "Drag item {0} to reorder"
msgstr "Arrastra el elemento {0} para reordenar"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "Suelta un archivo para adjuntarlo"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6191,6 +6211,10 @@ msgstr "No se encontró la imagen"
msgid "Image not found: {errorLabel}"
msgstr "No se encontró la imagen: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "Vista previa de imagen"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "El destino de la imagen «{shown}» no se pudo resolver como un archivo local del proyecto."
@@ -6199,6 +6223,10 @@ msgstr "El destino de la imagen «{shown}» no se pudo resolver como un archivo
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "El destino de la imagen «{shown}» no corresponde a un archivo existente."
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "Imágenes desde cualquier lugar · los archivos que no son imágenes deben estar en el espacio de trabajo"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "Importar"
@@ -9530,6 +9558,14 @@ msgstr "Copia de solo lectura de un bloque MirrorSource de otro documento. Edít
msgid "Read-only file in the {name} skill"
msgstr "Archivo de solo lectura en la habilidad {name}"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "Leyendo desde {tail}"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "Leyendo desde este espacio de trabajo"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "Leyendo…"
@@ -9700,6 +9736,8 @@ msgid "Remove"
msgstr "Quitar"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "Quitar {0}"
diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.json
index 1656b4231..4c63c6d67 100644
--- a/packages/app/src/locales/fr/messages.json
+++ b/packages/app/src/locales/fr/messages.json
@@ -361,6 +361,9 @@
}
]
],
+ "3uSzeS": [
+ "Images de n'importe où · les fichiers non-image doivent être dans l'espace de travail"
+ ],
"3v62tp": ["Populaires sur skills.sh"],
"3wiBAs": ["Où doit-elle résider ?"],
"3y6XTb": ["Recherche sémantique"],
@@ -756,6 +759,7 @@
"90-wKT": ["OpenKnowledge a lu l'historique de ", ["subject"]],
"92rbk2": ["Chargement du miroir <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["Masquer les agents"],
+ "95bl6Q": ["Lecture depuis cet espace de travail"],
"96G6Re": ["Nouveau dossier"],
"96pApd": ["Fichier en lecture seule dans la compétence ", ["name"]],
"96w9hU": ["Une erreur s'est produite à l'ouverture de ce fichier (HTTP ", ["status"], ")."],
@@ -1545,6 +1549,7 @@
"Ix0K8o": ["Masquer les nœuds d'URL externes"],
"IxHMdF": ["Impossible de supprimer ce commentaire."],
"IxyZXD": ["Capture d'écran"],
+ "Izh19j": ["Lecture depuis ", ["tail"]],
"J1XRO3": ["Couleurs du thème"],
"J2Mv98": ["Nom (par ex. ", ["login"], ")"],
"J2_JuX": ["rien (", ["0"], " ne peut correspondre à aucun document)"],
@@ -1709,6 +1714,7 @@
"LXdWeS": ["Titre de section moyen."],
"LXfNU-": ["Navigation et suggestions"],
"LYufDw": ["Échec de l'activation de la recherche sémantique — ", ["detail"]],
+ "LZe2vX": [" · références seulement (pas de contenu intégré)"],
"LaskKp": ["Envoyer dans la discussion (", ["0"], ")"],
"Lbl6KA": ["Impossible d'installer depuis ", ["0"], " : ", ["1"]],
"LbmLyU": ["Impossible de modifier en toute sécurité la configuration de cet outil"],
@@ -2099,6 +2105,7 @@
"QGWzup": ["Chargement des compétences OpenKnowledge"],
"QHCx0c": ["Historique des rapports de bug"],
"QIrBIx": ["Développer tous les fichiers"],
+ "QIzioS": [["agentName"], " n'accepte pas les pièces jointes d'image."],
"QKgePK": [["editor"], " aligné sur la source (ses octets sont sauvegardés)"],
"QLgdT6": ["tout document nommé ", ["0"]],
"QM3SBZ": ["Plan (", ["done"], "/", ["0"], ")"],
@@ -3339,6 +3346,7 @@
"Marque un bloc comme source de vérité. Les miroirs situés ailleurs se mettent à jour en direct pendant que vous le modifiez."
],
"erenF-": ["Impossible de supprimer des fichiers dont les conflits ne sont pas résolus"],
+ "euGaS0": ["Impossible de lire ", ["fileName"], "."],
"euc6Ns": ["Dupliquer"],
"evHlIg": [
"Suivre ne pousse ni ne valide jamais vos modifications locales. Elles restent uniquement sur cette machine."
@@ -3681,6 +3689,7 @@
["2"],
" automatiquement."
],
+ "ij-Elv": ["Aperçu de l'image"],
"ijLc3m": ["Liste à puces"],
"ilodsp": ["Laisser les agents utiliser OpenKnowledge sans demander"],
"ioMn4Z": ["Nouveau à partir d'un modèle…"],
@@ -4041,6 +4050,7 @@
"Choisissez une palette pour le mode clair et une pour le mode sombre. Le réglage de thème dans les Préférences choisit entre les deux — sur « Système », c'est votre système d'exploitation qui décide."
],
"mo22UP": ["Bascule la mise en forme code en ligne."],
+ "moUeZ_": ["Déposez un fichier pour le joindre"],
"mqSwZH": [
"<0>Ancre de miroir introuvable.</0> Aucun <1>",
["mirrorSourceTag"],
@@ -4566,6 +4576,7 @@
],
"tA2-xC": ["« ", ["0"], " » avait déjà été ajouté (contenu identique)."],
"tAPZEx": ["En dessous"],
+ "tCyvAw": ["Joindre un fichier"],
"tHKQ6j": ["Renommage"],
"tKlWWY": ["Émoji"],
"tLX6LY": ["OpenKnowledge a écrit un document"],
diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.po
index cb5ca933b..969e5933e 100644
--- a/packages/app/src/locales/fr/messages.po
+++ b/packages/app/src/locales/fr/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · références seulement (pas de contenu intégré)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " ou "
@@ -442,6 +446,10 @@ msgstr "{agentName} n’a pas pu démarrer de conversation."
msgid "{agentName} couldn't start."
msgstr "{agentName} n’a pas pu démarrer."
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} n'accepte pas les pièces jointes d'image."
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} en avance"
@@ -1724,6 +1732,10 @@ msgstr "Suggestions de ressources"
msgid "Asset: {title}"
msgstr "Ressource : {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "Joindre un fichier"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "Joindre des images"
@@ -3529,6 +3541,10 @@ msgstr "Impossible de joindre le point de terminaison. Vérifiez l'URL et que le
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "Impossible de joindre le serveur Open Knowledge pour envoyer {fileName}."
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "Impossible de lire {fileName}."
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "Impossible de lire {fileName}. Il a peut-être été déplacé, supprimé, ou son téléchargement n'est pas terminé. Essayez de l'ajouter à nouveau."
@@ -4468,6 +4484,10 @@ msgstr "Faites glisser {patternText} pour réorganiser"
msgid "Drag item {0} to reorder"
msgstr "Faites glisser l'élément {0} pour réorganiser"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "Déposez un fichier pour le joindre"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6191,6 +6211,10 @@ msgstr "Image introuvable"
msgid "Image not found: {errorLabel}"
msgstr "Image introuvable : {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "Aperçu de l'image"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "La cible de l’image « {shown} » n’a pas pu être résolue en tant que fichier local au projet."
@@ -6199,6 +6223,10 @@ msgstr "La cible de l’image « {shown} » n’a pas pu être résolue en tan
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "La cible de l’image « {shown} » ne correspond à aucun fichier existant."
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "Images de n'importe où · les fichiers non-image doivent être dans l'espace de travail"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "Importer"
@@ -9530,6 +9558,14 @@ msgstr "Copie en lecture seule d'un bloc MirrorSource d'un autre document. Modif
msgid "Read-only file in the {name} skill"
msgstr "Fichier en lecture seule dans la compétence {name}"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "Lecture depuis {tail}"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "Lecture depuis cet espace de travail"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "Lecture…"
@@ -9700,6 +9736,8 @@ msgid "Remove"
msgstr "Retirer"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "Retirer {0}"
diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.json
index 803024c0e..728800181 100644
--- a/packages/app/src/locales/hi/messages.json
+++ b/packages/app/src/locales/hi/messages.json
@@ -285,6 +285,7 @@
"3oh0nQ": [["path"], " में नेस्टेड .okignore त्रुटि"],
"3pU8e-": ["टैब पिन करें"],
"3s-k7L": [["0", "plural", { "one": ["#", " और टूल दिखाएँ"], "other": ["#", " और टूल दिखाएँ"] }]],
+ "3uSzeS": ["छवियाँ कहीं से भी · गैर-छवि फ़ाइलें कार्यक्षेत्र में होनी चाहिए"],
"3v62tp": ["skills.sh पर लोकप्रिय"],
"3wiBAs": ["यह कहाँ रहना चाहिए?"],
"3y6XTb": ["अर्थ-आधारित खोज"],
@@ -608,6 +609,7 @@
"90-wKT": ["OpenKnowledge ने ", ["subject"], " का इतिहास पढ़ा"],
"92rbk2": ["मिरर <0>", ["mirrorRef"], "</0> लोड हो रहा है"],
"93LBnX": ["Agents छिपाएँ"],
+ "95bl6Q": ["इस कार्यक्षेत्र से पढ़ रहे हैं"],
"96G6Re": ["नया फ़ोल्डर"],
"96pApd": [["name"], " स्किल में केवल पढ़ने योग्य फ़ाइल"],
"96w9hU": ["यह फ़ाइल खोलते समय कुछ ग़लत हो गया (HTTP ", ["status"], ")।"],
@@ -1256,6 +1258,7 @@
"Ix0K8o": ["बाहरी URL नोड छिपाएँ"],
"IxHMdF": ["वह टिप्पणी नहीं हटाई जा सकी।"],
"IxyZXD": ["स्क्रीनशॉट"],
+ "Izh19j": [["tail"], " से पढ़ रहे हैं"],
"J1XRO3": ["थीम के रंग"],
"J2Mv98": ["नाम (जैसे ", ["login"], ")"],
"J2_JuX": ["कुछ नहीं (", ["0"], " किसी दस्तावेज़ से मेल नहीं खा सकता)"],
@@ -1403,6 +1406,7 @@
"LXdWeS": ["मध्यम अनुभाग शीर्षक।"],
"LXfNU-": ["नेविगेशन और सुझाव"],
"LYufDw": ["अर्थ-आधारित खोज सक्षम करने में विफल — ", ["detail"]],
+ "LZe2vX": [" · केवल संदर्भ (कोई एम्बेडेड सामग्री नहीं)"],
"LaskKp": ["चैट में भेजें (", ["0"], ")"],
"Lbl6KA": [["0"], " से इंस्टॉल नहीं किया जा सका: ", ["1"]],
"LbmLyU": ["इस टूल के कॉन्फ़िग को सुरक्षित रूप से संपादित नहीं किया जा सकता"],
@@ -1748,6 +1752,7 @@
"QGWzup": ["OpenKnowledge स्किल लोड हो रही हैं"],
"QHCx0c": ["बग रिपोर्ट इतिहास"],
"QIrBIx": ["सभी फ़ाइलें फैलाएँ"],
+ "QIzioS": [["agentName"], " छवि अनुलग्नक स्वीकार नहीं करता।"],
"QKgePK": [["editor"], " को स्रोत के अनुरूप किया गया (इसके बाइट का बैकअप ले लिया गया है)"],
"QLgdT6": [["0"], " नाम का कोई भी दस्तावेज़"],
"QM3SBZ": ["योजना (", ["done"], "/", ["0"], ")"],
@@ -2754,6 +2759,7 @@
"किसी ब्लॉक को सत्य के स्रोत के रूप में चिह्नित करें। जैसे-जैसे आप उसे संपादित करते हैं, बाकी जगहों के मिरर तुरंत अद्यतित होते हैं।"
],
"erenF-": ["जिन फ़ाइलों के विरोध हल नहीं हुए हैं, उन्हें हटाया नहीं जा सकता"],
+ "euGaS0": [["fileName"], " पढ़ नहीं सका।"],
"euc6Ns": ["नकल बनाएँ"],
"evHlIg": ["Follow आपके स्थानीय बदलाव कभी नहीं भेजता या कमिट करता। वे केवल इसी मशीन पर रहते हैं।"],
"evs0iw": ["\"", ["tagListQuery"], "\" से मेल खाते टैग"],
@@ -3033,6 +3039,7 @@
["2"],
" तक नहीं पहुँचेंगी।"
],
+ "ij-Elv": ["छवि पूर्वावलोकन"],
"ijLc3m": ["बुलेट सूची"],
"ilodsp": ["एजेंट को बिना पूछे OpenKnowledge उपयोग करने दें"],
"ioMn4Z": ["टेम्पलेट से नया…"],
@@ -3342,6 +3349,7 @@
"हल्के मोड के लिए एक पट्टिका चुनें और गहरे मोड के लिए एक। Preferences की थीम सेटिंग इनमें से चुनती है — “System” पर आपका OS भी।"
],
"mo22UP": ["इनलाइन कोड फ़ॉर्मैटिंग चालू या बंद करें।"],
+ "moUeZ_": ["संलग्न करने के लिए फ़ाइल छोड़ें"],
"mqSwZH": [
"<0>मिरर एंकर नहीं मिला।</0> <2>",
["src"],
@@ -3778,6 +3786,7 @@
"tA0b9E": ["डिफ़ॉल्ट स्किल फ़ोल्डर (सहेजने के बाद सटीक पथ दिखता है)"],
"tA2-xC": ["\"", ["0"], "\" पहले ही जोड़ा जा चुका था (समान सामग्री)।"],
"tAPZEx": ["नीचे"],
+ "tCyvAw": ["फ़ाइल संलग्न करें"],
"tHKQ6j": ["नाम बदला जा रहा है"],
"tKlWWY": ["इमोजी"],
"tLX6LY": ["OpenKnowledge ने एक दस्तावेज़ लिखा"],
diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.po
index e6725c865..63d6b2f15 100644
--- a/packages/app/src/locales/hi/messages.po
+++ b/packages/app/src/locales/hi/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · केवल संदर्भ (कोई एम्बेडेड सामग्री नहीं)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " या "
@@ -442,6 +446,10 @@ msgstr "{agentName} बातचीत शुरू नहीं कर सक
msgid "{agentName} couldn't start."
msgstr "{agentName} शुरू नहीं हो सका।"
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} छवि अनुलग्नक स्वीकार नहीं करता।"
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} आगे"
@@ -1720,6 +1728,10 @@ msgstr "एसेट सुझाव"
msgid "Asset: {title}"
msgstr "एसेट: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "फ़ाइल संलग्न करें"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "छवियाँ संलग्न करें"
@@ -3525,6 +3537,10 @@ msgstr "एंडपॉइंट तक नहीं पहुँचा जा
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "{fileName} अपलोड करने के लिए Open Knowledge सर्वर तक नहीं पहुँचा जा सका।"
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "{fileName} पढ़ नहीं सका।"
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "{fileName} नहीं पढ़ी जा सकी। शायद इसे हिलाया गया, हटाया गया, या इसका डाउनलोड पूरा नहीं हुआ। इसे फिर से जोड़ने की कोशिश करें।"
@@ -4464,6 +4480,10 @@ msgstr "क्रम बदलने के लिए {patternText} खींच
msgid "Drag item {0} to reorder"
msgstr "क्रम बदलने के लिए आइटम {0} खींचें"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "संलग्न करने के लिए फ़ाइल छोड़ें"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6187,6 +6207,10 @@ msgstr "छवि नहीं मिली"
msgid "Image not found: {errorLabel}"
msgstr "छवि नहीं मिली: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "छवि पूर्वावलोकन"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "चित्र लक्ष्य \"{shown}\" को प्रोजेक्ट की स्थानीय फ़ाइल के रूप में हल नहीं किया जा सका।"
@@ -6195,6 +6219,10 @@ msgstr "चित्र लक्ष्य \"{shown}\" को प्रोजे
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "चित्र लक्ष्य \"{shown}\" किसी मौजूदा फ़ाइल पर हल नहीं होता।"
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "छवियाँ कहीं से भी · गैर-छवि फ़ाइलें कार्यक्षेत्र में होनी चाहिए"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "आयात करें"
@@ -9526,6 +9554,14 @@ msgstr "किसी दूसरे दस्तावेज़ के MirrorSo
msgid "Read-only file in the {name} skill"
msgstr "{name} स्किल में केवल पढ़ने योग्य फ़ाइल"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "{tail} से पढ़ रहे हैं"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "इस कार्यक्षेत्र से पढ़ रहे हैं"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "पढ़ा जा रहा है…"
@@ -9696,6 +9732,8 @@ msgid "Remove"
msgstr "हटाएँ"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "{0} हटाएँ"
diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.json
index 161911e1a..eb6e0efa9 100644
--- a/packages/app/src/locales/id/messages.json
+++ b/packages/app/src/locales/id/messages.json
@@ -287,6 +287,7 @@
"3oh0nQ": ["Galat .okignore bersarang di ", ["path"]],
"3pU8e-": ["Sematkan tab"],
"3s-k7L": [["0", "plural", { "other": ["Tampilkan ", "#", " alat lagi"] }]],
+ "3uSzeS": ["Gambar dari mana saja · berkas non-gambar harus berada di ruang kerja"],
"3v62tp": ["Populer di skills.sh"],
"3wiBAs": ["Di mana ia sebaiknya berada?"],
"3y6XTb": ["Pencarian semantik"],
@@ -636,6 +637,7 @@
"90-wKT": ["OpenKnowledge membaca riwayat ", ["subject"]],
"92rbk2": ["Cermin memuat <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["Sembunyikan Agen"],
+ "95bl6Q": ["Membaca dari ruang kerja ini"],
"96G6Re": ["Folder baru"],
"96pApd": ["Berkas hanya-baca di keterampilan ", ["name"]],
"96w9hU": ["Ada yang tidak beres saat membuka berkas ini (HTTP ", ["status"], ")."],
@@ -1312,6 +1314,7 @@
"Ix0K8o": ["Sembunyikan simpul URL eksternal"],
"IxHMdF": ["Komentar itu tidak bisa dihapus."],
"IxyZXD": ["Tangkapan layar"],
+ "Izh19j": ["Membaca dari ", ["tail"]],
"J1XRO3": ["Warna tema"],
"J2Mv98": ["Nama (mis. ", ["login"], ")"],
"J2_JuX": ["tidak apa pun (", ["0"], " tidak bisa cocok dengan sebuah dokumen)"],
@@ -1464,6 +1467,7 @@
"LXdWeS": ["Judul bagian sedang."],
"LXfNU-": ["Navigasi dan saran"],
"LYufDw": ["Gagal mengaktifkan pencarian semantik — ", ["detail"]],
+ "LZe2vX": [" · hanya referensi (tanpa konten tertanam)"],
"LaskKp": ["Kirim ke obrolan (", ["0"], ")"],
"Lbl6KA": ["Tidak bisa memasang dari ", ["0"], ": ", ["1"]],
"LbmLyU": ["Konfigurasi alat ini tidak bisa disunting dengan aman"],
@@ -1822,6 +1826,7 @@
"QGWzup": ["Memuat keterampilan OpenKnowledge"],
"QHCx0c": ["Riwayat laporan bug"],
"QIrBIx": ["Bentangkan semua berkas"],
+ "QIzioS": [["agentName"], " tidak menerima lampiran gambar."],
"QKgePK": [["editor"], " diselaraskan dengan sumbernya (bitanya sudah dicadangkan)"],
"QLgdT6": ["dokumen mana pun bernama ", ["0"]],
"QM3SBZ": ["Rencana (", ["done"], "/", ["0"], ")"],
@@ -2867,6 +2872,7 @@
"Menandai sebuah blok sebagai sumber kebenaran. Cermin di tempat lain diperbarui langsung saat Anda menyuntingnya."
],
"erenF-": ["Tidak dapat menghapus berkas yang konfliknya belum diselesaikan"],
+ "euGaS0": ["Tidak dapat membaca ", ["fileName"], "."],
"euc6Ns": ["Gandakan"],
"evHlIg": [
"Ikuti tidak pernah melakukan push atau commit pada perubahan lokal Anda. Semuanya hanya tinggal di komputer ini."
@@ -3174,6 +3180,7 @@
["2"],
" secara otomatis."
],
+ "ij-Elv": ["Pratinjau gambar"],
"ijLc3m": ["Daftar berpoin"],
"ilodsp": ["Biarkan agen memakai OpenKnowledge tanpa bertanya"],
"ioMn4Z": ["Baru dari Templat…"],
@@ -3501,6 +3508,7 @@
"Pilih satu palet untuk mode terang dan satu untuk mode gelap. Pengaturan tema di Preferensi memilih di antara keduanya — pada “Sistem”, sistem operasi Anda yang memilih."
],
"mo22UP": ["Menyalakan atau mematikan format kode sebaris."],
+ "moUeZ_": ["Lepaskan berkas untuk melampirkan"],
"mqSwZH": [
"<0>Jangkar cermin tidak ditemukan.</0> Tidak ada <1>",
["mirrorSourceTag"],
@@ -3949,6 +3957,7 @@
"tA0b9E": ["folder keterampilan bawaan (jalur persisnya muncul setelah disimpan)"],
"tA2-xC": ["\"", ["0"], "\" sudah ditambahkan sebelumnya (isinya sama)."],
"tAPZEx": ["Di bawah"],
+ "tCyvAw": ["Lampirkan berkas"],
"tHKQ6j": ["Mengganti nama"],
"tKlWWY": ["Emoji"],
"tLX6LY": ["OpenKnowledge menulis sebuah dokumen"],
diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.po
index 14f788d1c..c1b6bbe60 100644
--- a/packages/app/src/locales/id/messages.po
+++ b/packages/app/src/locales/id/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · hanya referensi (tanpa konten tertanam)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " atau "
@@ -442,6 +446,10 @@ msgstr "{agentName} tidak dapat memulai percakapan."
msgid "{agentName} couldn't start."
msgstr "{agentName} tidak dapat dijalankan."
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} tidak menerima lampiran gambar."
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} di depan"
@@ -1720,6 +1728,10 @@ msgstr "Saran aset"
msgid "Asset: {title}"
msgstr "Aset: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "Lampirkan berkas"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "Lampirkan gambar"
@@ -3525,6 +3537,10 @@ msgstr "Endpoint tidak bisa dihubungi. Periksa URL-nya dan pastikan servernya me
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "Server Open Knowledge tidak bisa dihubungi untuk mengunggah {fileName}."
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "Tidak dapat membaca {fileName}."
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "{fileName} tidak bisa dibaca. Mungkin ia sudah dipindahkan, dihapus, atau belum selesai diunduh. Coba tambahkan lagi."
@@ -4464,6 +4480,10 @@ msgstr "Seret {patternText} untuk menata ulang"
msgid "Drag item {0} to reorder"
msgstr "Seret item {0} untuk menata ulang"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "Lepaskan berkas untuk melampirkan"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6187,6 +6207,10 @@ msgstr "Gambar tidak ditemukan"
msgid "Image not found: {errorLabel}"
msgstr "Gambar tidak ditemukan: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "Pratinjau gambar"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "Target gambar \"{shown}\" tidak dapat dicocokkan dengan file lokal proyek."
@@ -6195,6 +6219,10 @@ msgstr "Target gambar \"{shown}\" tidak dapat dicocokkan dengan file lokal proye
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "Target gambar \"{shown}\" tidak merujuk ke file yang ada."
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "Gambar dari mana saja · berkas non-gambar harus berada di ruang kerja"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "Impor"
@@ -9526,6 +9554,14 @@ msgstr "Salinan hanya-baca dari blok MirrorSource di dokumen lain. Sunting di su
msgid "Read-only file in the {name} skill"
msgstr "Berkas hanya-baca di keterampilan {name}"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "Membaca dari {tail}"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "Membaca dari ruang kerja ini"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "Membaca…"
@@ -9696,6 +9732,8 @@ msgid "Remove"
msgstr "Hapus"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "Hapus {0}"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 9a4838278..21c8f1560 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -296,6 +296,7 @@
{ "one": ["Śĥōŵ ", "#", " ḿōŕē ţōōĺ"], "other": ["Śĥōŵ ", "#", " ḿōŕē ţōōĺś"] }
]
],
+ "3uSzeS": ["Ĩḿàĝēś ƒŕōḿ àńŷŵĥēŕē · ńōń-ĩḿàĝē ƒĩĺēś ḿũśţ ƀē ĩń ţĥē ŵōŕķśƥàćē"],
"3v62tp": ["Ƥōƥũĺàŕ ōń śķĩĺĺś.śĥ"],
"3wiBAs": ["Ŵĥēŕē śĥōũĺď ĩţ ĺĩvē?"],
"3y6XTb": ["Śēḿàńţĩć śēàŕćĥ"],
@@ -633,6 +634,7 @@
"90-wKT": ["ŌƥēńĶńōŵĺēďĝē ŕēàď ţĥē ĥĩśţōŕŷ ōƒ ", ["subject"]],
"92rbk2": ["Ḿĩŕŕōŕ ĺōàďĩńĝ <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["Ĥĩďē Àĝēńţś"],
+ "95bl6Q": ["Ŕēàďĩńĝ ƒŕōḿ ţĥĩś ŵōŕķśƥàćē"],
"96G6Re": ["Ńēŵ ƒōĺďēŕ"],
"96pApd": ["Ŕēàď-ōńĺŷ ƒĩĺē ĩń ţĥē ", ["name"], " śķĩĺĺ"],
"96w9hU": ["Śōḿēţĥĩńĝ ŵēńţ ŵŕōńĝ ōƥēńĩńĝ ţĥĩś ƒĩĺē (ĤŢŢƤ ", ["status"], ")."],
@@ -1306,6 +1308,7 @@
"Ix0K8o": ["Ĥĩďē ēxţēŕńàĺ ŨŔĹ ńōďēś"],
"IxHMdF": ["Ćōũĺďń'ţ ďēĺēţē ţĥàţ ćōḿḿēńţ."],
"IxyZXD": ["Śćŕēēńśĥōţ"],
+ "Izh19j": ["Ŕēàďĩńĝ ƒŕōḿ ", ["tail"]],
"J1XRO3": ["Ţĥēḿē ćōĺōŕś"],
"J2Mv98": ["Ńàḿē (ē.ĝ. ", ["login"], ")"],
"J2_JuX": ["ńōţĥĩńĝ (", ["0"], " ćàńńōţ ḿàţćĥ à ďōć)"],
@@ -1451,6 +1454,7 @@
"LXdWeS": ["Ḿēďĩũḿ śēćţĩōń ĥēàďĩńĝ."],
"LXfNU-": ["Ńàvĩĝàţĩōń àńď śũĝĝēśţĩōńś"],
"LYufDw": ["Ƒàĩĺēď ţō ēńàƀĺē śēḿàńţĩć śēàŕćĥ — ", ["detail"]],
+ "LZe2vX": [" · ŕēƒēŕēńćēś ōńĺŷ (ńō ēḿƀēďďēď ćōńţēńţś)"],
"LaskKp": ["Śēńď ţō ćĥàţ (", ["0"], ")"],
"Lbl6KA": ["Ćōũĺďń'ţ ĩńśţàĺĺ ƒŕōḿ ", ["0"], ": ", ["1"]],
"LbmLyU": ["Ćàń'ţ śàƒēĺŷ ēďĩţ ţĥĩś ţōōĺ'ś ćōńƒĩĝ"],
@@ -1807,6 +1811,7 @@
"QGWzup": ["Ĺōàďĩńĝ ŌƥēńĶńōŵĺēďĝē śķĩĺĺś"],
"QHCx0c": ["ßũĝ ŕēƥōŕţ ĥĩśţōŕŷ"],
"QIrBIx": ["Ēxƥàńď àĺĺ ƒĩĺēś"],
+ "QIzioS": [["agentName"], " ďōēśń'ţ àććēƥţ ĩḿàĝē àţţàćĥḿēńţś."],
"QKgePK": ["Àĺĩĝńēď ", ["editor"], " ţō ţĥē śōũŕćē (ĩţś ƀŷţēś àŕē ƀàćķēď ũƥ)"],
"QLgdT6": ["àńŷ ďōć ńàḿēď ", ["0"]],
"QM3SBZ": ["Ƥĺàń (", ["done"], "/", ["0"], ")"],
@@ -2843,6 +2848,7 @@
"Ḿàŕķ à ƀĺōćķ àś ţĥē śōũŕćē ōƒ ţŕũţĥ. Ḿĩŕŕōŕś ēĺśēŵĥēŕē ũƥďàţē ĺĩvē àś ŷōũ ēďĩţ ĩţ."
],
"erenF-": ["Ćàńńōţ ďēĺēţē ƒĩĺēś ŵĩţĥ ũńŕēśōĺvēď ćōńƒĺĩćţś"],
+ "euGaS0": ["Ćōũĺďń'ţ ŕēàď ", ["fileName"], "."],
"euc6Ns": ["Ďũƥĺĩćàţē"],
"evHlIg": [
"Ƒōĺĺōŵ ńēvēŕ ƥũśĥēś ōŕ ćōḿḿĩţś ŷōũŕ ĺōćàĺ ćĥàńĝēś. Ţĥēŷ śţàŷ ōńĺŷ ōń ţĥĩś ḿàćĥĩńē."
@@ -3142,6 +3148,7 @@
["2"],
" àũţōḿàţĩćàĺĺŷ."
],
+ "ij-Elv": ["Ĩḿàĝē ƥŕēvĩēŵ"],
"ijLc3m": ["ßũĺĺēţ ĺĩśţ"],
"ilodsp": ["Ĺēţ àĝēńţś ũśē ŌƥēńĶńōŵĺēďĝē ŵĩţĥōũţ àśķĩńĝ"],
"ioMn4Z": ["Ńēŵ ƒŕōḿ Ţēḿƥĺàţē…"],
@@ -3460,6 +3467,7 @@
"Ƥĩćķ à ƥàĺēţţē ƒōŕ ĺĩĝĥţ ḿōďē àńď ōńē ƒōŕ ďàŕķ ḿōďē. Ţĥē ţĥēḿē śēţţĩńĝ ĩń Ƥŕēƒēŕēńćēś ćĥōōśēś ƀēţŵēēń ţĥēḿ — ōń “Śŷśţēḿ”, śō ďōēś ŷōũŕ ŌŚ."
],
"mo22UP": ["Ţōĝĝĺē ĩńĺĩńē ćōďē ƒōŕḿàţţĩńĝ."],
+ "moUeZ_": ["Ďŕōƥ à ƒĩĺē ţō àţţàćĥ"],
"mqSwZH": [
"<0>Ḿĩŕŕōŕ àńćĥōŕ ńōţ ƒōũńď.</0> Ńō <1>",
["mirrorSourceTag"],
@@ -3917,6 +3925,7 @@
"tA0b9E": ["ţĥē ďēƒàũĺţ śķĩĺĺś ƒōĺďēŕ (ţĥē ēxàćţ ƥàţĥ àƥƥēàŕś ōńćē śàvēď)"],
"tA2-xC": ["\"", ["0"], "\" ŵàś àĺŕēàďŷ àďďēď (ĩďēńţĩćàĺ ćōńţēńţ)."],
"tAPZEx": ["ßēĺōŵ"],
+ "tCyvAw": ["Àţţàćĥ à ƒĩĺē"],
"tHKQ6j": ["Ŕēńàḿĩńĝ"],
"tKlWWY": ["ĒḿōĴĩ"],
"tLX6LY": ["ŌƥēńĶńōŵĺēďĝē ŵŕōţē à ďōćũḿēńţ"],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 7f3997452..63253bdbe 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr ""
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr ""
@@ -442,6 +446,10 @@ msgstr ""
msgid "{agentName} couldn't start."
msgstr ""
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr ""
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr ""
@@ -1720,6 +1728,10 @@ msgstr ""
msgid "Asset: {title}"
msgstr ""
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr ""
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr ""
@@ -3525,6 +3537,10 @@ msgstr ""
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr ""
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr ""
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr ""
@@ -4464,6 +4480,10 @@ msgstr ""
msgid "Drag item {0} to reorder"
msgstr ""
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr ""
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6187,6 +6207,10 @@ msgstr ""
msgid "Image not found: {errorLabel}"
msgstr ""
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr ""
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr ""
@@ -6195,6 +6219,10 @@ msgstr ""
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr ""
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr ""
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr ""
@@ -9526,6 +9554,14 @@ msgstr ""
msgid "Read-only file in the {name} skill"
msgstr ""
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr ""
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr ""
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr ""
@@ -9696,6 +9732,8 @@ msgid "Remove"
msgstr ""
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr ""
diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.json
index aa1cf2d76..a7a3d2b5a 100644
--- a/packages/app/src/locales/pt-BR/messages.json
+++ b/packages/app/src/locales/pt-BR/messages.json
@@ -343,6 +343,9 @@
}
]
],
+ "3uSzeS": [
+ "Imagens de qualquer lugar · arquivos que não são imagens devem estar no espaço de trabalho"
+ ],
"3v62tp": ["Populares no skills.sh"],
"3wiBAs": ["Onde ela deve ficar?"],
"3y6XTb": ["Busca semântica"],
@@ -724,6 +727,7 @@
"90-wKT": ["OpenKnowledge leu o histórico de ", ["subject"]],
"92rbk2": ["O espelho está carregando <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["Ocultar Agentes"],
+ "95bl6Q": ["Lendo deste espaço de trabalho"],
"96G6Re": ["Nova pasta"],
"96pApd": ["Arquivo somente leitura na habilidade ", ["name"]],
"96w9hU": ["Algo deu errado ao abrir este arquivo (HTTP ", ["status"], ")."],
@@ -1502,6 +1506,7 @@
"Ix0K8o": ["Ocultar os nós de URL externa"],
"IxHMdF": ["Não deu para excluir esse comentário."],
"IxyZXD": ["Captura de tela"],
+ "Izh19j": ["Lendo de ", ["tail"]],
"J1XRO3": ["Cores do tema"],
"J2Mv98": ["Nome (ex.: ", ["login"], ")"],
"J2_JuX": ["nada (", ["0"], " não pode corresponder a um documento)"],
@@ -1658,6 +1663,7 @@
"LXdWeS": ["Título de seção médio."],
"LXfNU-": ["Navegação e sugestões"],
"LYufDw": ["Falha ao ativar a busca semântica — ", ["detail"]],
+ "LZe2vX": [" · apenas referências (sem conteúdo incorporado)"],
"LaskKp": ["Enviar para o chat (", ["0"], ")"],
"Lbl6KA": ["Não deu para instalar a partir de ", ["0"], ": ", ["1"]],
"LbmLyU": ["Não é seguro editar a configuração desta ferramenta"],
@@ -2046,6 +2052,7 @@
"QGWzup": ["Carregando as habilidades do OpenKnowledge"],
"QHCx0c": ["Histórico de relatórios de erro"],
"QIrBIx": ["Expandir todos os arquivos"],
+ "QIzioS": [["agentName"], " não aceita anexos de imagem."],
"QKgePK": [["editor"], " alinhado ao código fonte (os bytes dele têm backup)"],
"QLgdT6": ["qualquer documento chamado ", ["0"]],
"QM3SBZ": ["Plano (", ["done"], "/", ["0"], ")"],
@@ -3236,6 +3243,7 @@
"Marca um bloco como fonte da verdade. Os espelhos em outros lugares se atualizam ao vivo enquanto você o edita."
],
"erenF-": ["Não é possível excluir arquivos com conflitos não resolvidos"],
+ "euGaS0": ["Não foi possível ler ", ["fileName"], "."],
"euc6Ns": ["Duplicar"],
"evHlIg": [
"Acompanhar nunca envia nem faz commit das suas alterações locais. Elas ficam só neste computador."
@@ -3572,6 +3580,7 @@
["2"],
" automaticamente."
],
+ "ij-Elv": ["Pré-visualização de imagem"],
"ijLc3m": ["Lista com marcadores"],
"ilodsp": ["Deixar os agentes usarem o OpenKnowledge sem perguntar"],
"ioMn4Z": ["Novo a partir de um modelo…"],
@@ -3924,6 +3933,7 @@
"Escolha uma paleta para o modo claro e outra para o escuro. A opção de tema em Preferências escolhe entre elas — em “Sistema”, quem escolhe é o seu SO."
],
"mo22UP": ["Liga ou desliga o código em linha."],
+ "moUeZ_": ["Solte um arquivo para anexar"],
"mqSwZH": [
"<0>Âncora do espelho não encontrada.</0> Não existe nenhum <1>",
["mirrorSourceTag"],
@@ -4423,6 +4433,7 @@
"tA0b9E": ["a pasta de habilidades padrão (o caminho exato aparece depois de salvar)"],
"tA2-xC": ["\"", ["0"], "\" já tinha sido adicionado (conteúdo idêntico)."],
"tAPZEx": ["Abaixo"],
+ "tCyvAw": ["Anexar um arquivo"],
"tHKQ6j": ["Renomeando"],
"tKlWWY": ["Emoji"],
"tLX6LY": ["OpenKnowledge escreveu um documento"],
diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.po
index 102cc5303..83fb73a38 100644
--- a/packages/app/src/locales/pt-BR/messages.po
+++ b/packages/app/src/locales/pt-BR/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · apenas referências (sem conteúdo incorporado)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " ou "
@@ -442,6 +446,10 @@ msgstr "{agentName} não conseguiu iniciar uma conversa."
msgid "{agentName} couldn't start."
msgstr "{agentName} não conseguiu iniciar."
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} não aceita anexos de imagem."
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} à frente"
@@ -1720,6 +1728,10 @@ msgstr "Sugestões de recursos"
msgid "Asset: {title}"
msgstr "Recurso: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "Anexar um arquivo"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "Anexar imagens"
@@ -3525,6 +3537,10 @@ msgstr "Não deu para contatar o endpoint. Verifique a URL e se o servidor está
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "Não deu para contatar o servidor do Open Knowledge para enviar {fileName}."
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "Não foi possível ler {fileName}."
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "Não deu para ler {fileName}. Ele pode ter sido movido, excluído ou não terminou de baixar. Tente adicioná-lo de novo."
@@ -4464,6 +4480,10 @@ msgstr "Arraste {patternText} para reordenar"
msgid "Drag item {0} to reorder"
msgstr "Arraste o item {0} para reordenar"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "Solte um arquivo para anexar"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6187,6 +6207,10 @@ msgstr "Imagem não encontrada"
msgid "Image not found: {errorLabel}"
msgstr "Imagem não encontrada: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "Pré-visualização de imagem"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "O destino da imagem \"{shown}\" não pôde ser resolvido como um arquivo local do projeto."
@@ -6195,6 +6219,10 @@ msgstr "O destino da imagem \"{shown}\" não pôde ser resolvido como um arquivo
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "O destino da imagem \"{shown}\" não corresponde a um arquivo existente."
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "Imagens de qualquer lugar · arquivos que não são imagens devem estar no espaço de trabalho"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "Importar"
@@ -9526,6 +9554,14 @@ msgstr "Cópia somente leitura de um bloco MirrorSource de outro documento. Edit
msgid "Read-only file in the {name} skill"
msgstr "Arquivo somente leitura na habilidade {name}"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "Lendo de {tail}"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "Lendo deste espaço de trabalho"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "Lendo…"
@@ -9696,6 +9732,8 @@ msgid "Remove"
msgstr "Remover"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "Remover {0}"
diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.json
index 545a822ac..7aee2dac4 100644
--- a/packages/app/src/locales/ur/messages.json
+++ b/packages/app/src/locales/ur/messages.json
@@ -291,6 +291,7 @@
"3s-k7L": [
["0", "plural", { "one": ["#", " مزید ٹول دکھائیں"], "other": ["#", " مزید ٹولز دکھائیں"] }]
],
+ "3uSzeS": ["تصاویر کہیں سے بھی · غیر تصویری فائلیں ورک اسپیس میں ہونی چاہئیں"],
"3v62tp": ["skills.sh پر مقبول"],
"3wiBAs": ["یہ کہاں رہنا چاہیے؟"],
"3y6XTb": ["معنوی تلاش"],
@@ -640,6 +641,7 @@
"90-wKT": ["OpenKnowledge نے ", ["subject"], " کی تاریخ پڑھی"],
"92rbk2": ["مرر <0>", ["mirrorRef"], "</0> لوڈ ہو رہا ہے"],
"93LBnX": ["ایجنٹس چھپائیں"],
+ "95bl6Q": ["اس ورک اسپیس سے پڑھ رہا ہے"],
"96G6Re": ["نیا فولڈر"],
"96pApd": [["name"], " مہارت میں صرف پڑھنے والی فائل"],
"96w9hU": ["یہ فائل کھولتے ہوئے کچھ غلط ہو گیا (HTTP ", ["status"], ")۔"],
@@ -1323,6 +1325,7 @@
"Ix0K8o": ["بیرونی URL نوڈز چھپائیں"],
"IxHMdF": ["وہ تبصرہ حذف نہیں ہو سکا۔"],
"IxyZXD": ["اسکرین شاٹ"],
+ "Izh19j": [["tail"], " سے پڑھ رہا ہے"],
"J1XRO3": ["تھیم کے رنگ"],
"J2Mv98": ["نام (مثلاً ", ["login"], ")"],
"J2_JuX": ["کچھ نہیں (", ["0"], " کسی دستاویز سے مماثل نہیں ہو سکتا)"],
@@ -1482,6 +1485,7 @@
"LXdWeS": ["درمیانہ سیکشن عنوان۔"],
"LXfNU-": ["نیویگیشن اور تجاویز"],
"LYufDw": ["معنوی تلاش فعال نہیں ہو سکی — ", ["detail"]],
+ "LZe2vX": [" · صرف حوالہ جات (کوئی ایمبیڈڈ مواد نہیں)"],
"LaskKp": ["چیٹ میں بھیجیں (", ["0"], ")"],
"Lbl6KA": [["0"], " سے نصب نہیں ہو سکا: ", ["1"]],
"LbmLyU": ["اس ٹول کی کنفیگ محفوظ طریقے سے ترمیم نہیں کی جا سکتی"],
@@ -1845,6 +1849,7 @@
"QGWzup": ["OpenKnowledge مہارتیں لوڈ ہو رہی ہیں"],
"QHCx0c": ["بگ رپورٹ کی تاریخ"],
"QIrBIx": ["سب فائلیں پھیلائیں"],
+ "QIzioS": [["agentName"], " تصویری منسلکات قبول نہیں کرتا۔"],
"QKgePK": [["editor"], " کو ماخذ سے ہم آہنگ کر دیا گیا (اس کے بائٹس کا بیک اپ محفوظ ہے)"],
"QLgdT6": [["0"], " نام کی کوئی بھی دستاویز"],
"QM3SBZ": ["منصوبہ (", ["done"], "/", ["0"], ")"],
@@ -2915,6 +2920,7 @@
"کسی بلاک کو سچائی کا ماخذ نشان زد کریں۔ اس میں ترمیم کرتے ہی دوسری جگہوں کے مررز براہِ راست تازہ ہو جاتے ہیں۔"
],
"erenF-": ["ایسی فائلیں حذف نہیں کی جا سکتیں جن کے تنازعات حل نہیں ہوئے"],
+ "euGaS0": [["fileName"], " پڑھا نہیں جا سکا۔"],
"euc6Ns": ["نقل بنائیں"],
"evHlIg": ["پیروی آپ کی مقامی تبدیلیاں کبھی پُش یا کمٹ نہیں کرتی۔ وہ صرف اسی مشین پر رہتی ہیں۔"],
"evs0iw": ["«", ["tagListQuery"], "» سے مماثل ٹیگز"],
@@ -3211,6 +3217,7 @@
["2"],
" تک نہیں پہنچیں گی۔"
],
+ "ij-Elv": ["تصویر کا پیش منظر"],
"ijLc3m": ["بلٹ فہرست"],
"ilodsp": ["ایجنٹس کو بغیر پوچھے OpenKnowledge استعمال کرنے دیں"],
"ioMn4Z": ["ٹیمپلیٹ سے نیا…"],
@@ -3546,6 +3553,7 @@
"روشن موڈ کے لیے ایک پیلیٹ اور تاریک موڈ کے لیے دوسرا منتخب کریں۔ ترجیحات میں تھیم کی ترتیب ان میں سے انتخاب کرتی ہے — “سسٹم” پر آپ کا OS بھی۔"
],
"mo22UP": ["اِن لائن کوڈ کی فارمیٹنگ بدلیں۔"],
+ "moUeZ_": ["منسلک کرنے کے لیے فائل چھوڑیں"],
"mqSwZH": [
"<0>مرر اینکر نہیں ملا۔</0> <2>",
["src"],
@@ -3988,6 +3996,7 @@
"tA0b9E": ["طے شدہ مہارت فولڈر (محفوظ ہونے کے بعد صحیح راستہ ظاہر ہوتا ہے)"],
"tA2-xC": ["«", ["0"], "» پہلے ہی شامل تھا (یکساں مواد)۔"],
"tAPZEx": ["نیچے"],
+ "tCyvAw": ["فائل منسلک کریں"],
"tHKQ6j": ["نام بدلا جا رہا ہے"],
"tKlWWY": ["ایموجی"],
"tLX6LY": ["OpenKnowledge نے ایک دستاویز لکھی"],
diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.po
index c718a3e61..9ff7ffd8b 100644
--- a/packages/app/src/locales/ur/messages.po
+++ b/packages/app/src/locales/ur/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · صرف حوالہ جات (کوئی ایمبیڈڈ مواد نہیں)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " یا "
@@ -442,6 +446,10 @@ msgstr "{agentName} گفتگو شروع نہ کر سکا۔"
msgid "{agentName} couldn't start."
msgstr "{agentName} شروع نہ ہو سکا۔"
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} تصویری منسلکات قبول نہیں کرتا۔"
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "{ahead} آگے"
@@ -1724,6 +1732,10 @@ msgstr "اثاثوں کی تجاویز"
msgid "Asset: {title}"
msgstr "اثاثہ: {title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "فائل منسلک کریں"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "تصاویر منسلک کریں"
@@ -3529,6 +3541,10 @@ msgstr "اینڈ پوائنٹ تک رسائی نہیں ہو سکی۔ URL دیک
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "{fileName} اپ لوڈ کرنے کے لیے Open Knowledge سرور تک رسائی نہیں ہو سکی۔"
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "{fileName} پڑھا نہیں جا سکا۔"
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "{fileName} پڑھی نہیں جا سکی۔ ہو سکتا ہے یہ منتقل ہو گئی ہو، حذف ہو گئی ہو، یا مکمل ڈاؤن لوڈ نہ ہوئی ہو۔ اسے دوبارہ شامل کرنے کی کوشش کریں۔"
@@ -4468,6 +4484,10 @@ msgstr "ترتیب بدلنے کے لیے {patternText} کھینچیں"
msgid "Drag item {0} to reorder"
msgstr "ترتیب بدلنے کے لیے آئٹم {0} کھینچیں"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "منسلک کرنے کے لیے فائل چھوڑیں"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6191,6 +6211,10 @@ msgstr "تصویر نہیں ملی"
msgid "Image not found: {errorLabel}"
msgstr "تصویر نہیں ملی: {errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "تصویر کا پیش منظر"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "تصویر کے ہدف \"{shown}\" کو پروجیکٹ کی مقامی فائل کے طور پر حل نہیں کیا جا سکا۔"
@@ -6199,6 +6223,10 @@ msgstr "تصویر کے ہدف \"{shown}\" کو پروجیکٹ کی مقامی
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "تصویر کا ہدف \"{shown}\" کسی موجودہ فائل کی طرف اشارہ نہیں کرتا۔"
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "تصاویر کہیں سے بھی · غیر تصویری فائلیں ورک اسپیس میں ہونی چاہئیں"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "درآمد کریں"
@@ -9530,6 +9558,14 @@ msgstr "کسی دوسری دستاویز کے MirrorSource بلاک کی صرف
msgid "Read-only file in the {name} skill"
msgstr "{name} مہارت میں صرف پڑھنے والی فائل"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "{tail} سے پڑھ رہا ہے"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "اس ورک اسپیس سے پڑھ رہا ہے"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "پڑھا جا رہا ہے…"
@@ -9700,6 +9736,8 @@ msgid "Remove"
msgstr "ہٹائیں"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "{0} ہٹائیں"
diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.json
index 0b201e819..830e8f67e 100644
--- a/packages/app/src/locales/zh-Hans/messages.json
+++ b/packages/app/src/locales/zh-Hans/messages.json
@@ -264,6 +264,7 @@
"3oh0nQ": [["path"], " 中嵌套的 .okignore 有错误"],
"3pU8e-": ["固定标签页"],
"3s-k7L": [["0", "plural", { "other": ["再显示 ", "#", " 个工具"] }]],
+ "3uSzeS": ["图像可以来自任何地方 · 非图像文件必须位于工作区中"],
"3v62tp": ["skills.sh 上的热门"],
"3wiBAs": ["它应该保存在哪里?"],
"3y6XTb": ["语义搜索"],
@@ -574,6 +575,7 @@
"90-wKT": ["OpenKnowledge 查看了 ", ["subject"], " 的历史"],
"92rbk2": ["镜像正在加载 <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["隐藏「智能体」"],
+ "95bl6Q": ["从此工作区读取"],
"96G6Re": ["新建文件夹"],
"96pApd": [["name"], " 技能中的只读文件"],
"96w9hU": ["打开这个文件时出了点问题(HTTP ", ["status"], ")。"],
@@ -1156,6 +1158,7 @@
"Ix0K8o": ["隐藏外部 URL 节点"],
"IxHMdF": ["无法删除那条评论。"],
"IxyZXD": ["截图"],
+ "Izh19j": ["从 ", ["tail"], " 读取"],
"J1XRO3": ["主题颜色"],
"J2Mv98": ["名称(例如 ", ["login"], ")"],
"J2_JuX": ["无(", ["0"], " 无法匹配任何文档)"],
@@ -1284,6 +1287,7 @@
"LXdWeS": ["中号章节标题。"],
"LXfNU-": ["导航与建议"],
"LYufDw": ["开启语义搜索失败——", ["detail"]],
+ "LZe2vX": [" · 仅引用(无嵌入内容)"],
"LaskKp": ["发送到对话(", ["0"], ")"],
"Lbl6KA": ["无法从 ", ["0"], " 安装:", ["1"]],
"LbmLyU": ["无法安全地编辑这个工具的配置"],
@@ -1603,6 +1607,7 @@
"QGWzup": ["正在加载 OpenKnowledge 技能"],
"QHCx0c": ["错误报告历史"],
"QIrBIx": ["展开全部文件"],
+ "QIzioS": [["agentName"], " 不接受图像附件。"],
"QKgePK": ["已将 ", ["editor"], " 对齐到源码(其字节已备份)"],
"QLgdT6": ["任何名为 ", ["0"], " 的文档"],
"QM3SBZ": ["计划(", ["done"], "/", ["0"], ")"],
@@ -2534,6 +2539,7 @@
"enPTnx": ["第 ", ["displayLine"], " 行"],
"epuNYK": ["把某个块标记为事实来源。你编辑它时,别处的镜像会实时更新。"],
"erenF-": ["无法删除存在未解决冲突的文件"],
+ "euGaS0": ["无法读取 ", ["fileName"], "。"],
"euc6Ns": ["创建副本"],
"evHlIg": ["「跟随」从不推送或提交你的本地改动。它们只留在这台电脑上。"],
"evs0iw": ["匹配 \"", ["tagListQuery"], "\" 的标签"],
@@ -2792,6 +2798,7 @@
["2"],
"。"
],
+ "ij-Elv": ["图像预览"],
"ijLc3m": ["无序列表"],
"ilodsp": ["让智能体无需询问即可使用 OpenKnowledge"],
"ioMn4Z": ["从模板新建…"],
@@ -3078,6 +3085,7 @@
"为浅色模式和深色模式各选一个配色方案。「偏好设置」中的主题设置决定用哪一个;选择「系统」时,则由你的操作系统决定。"
],
"mo22UP": ["切换行内代码格式。"],
+ "moUeZ_": ["拖放文件以附加"],
"mqSwZH": [
"<0>找不到镜像锚点。</0><2>",
["src"],
@@ -3474,6 +3482,7 @@
"tA0b9E": ["默认的技能文件夹(保存后会显示确切路径)"],
"tA2-xC": ["“", ["0"], "”已添加过(内容相同)。"],
"tAPZEx": ["下方"],
+ "tCyvAw": ["附加文件"],
"tHKQ6j": ["正在重命名"],
"tKlWWY": ["表情符号"],
"tLX6LY": ["OpenKnowledge 写入了一个文档"],
diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.po
index bae9d871a..85c10482f 100644
--- a/packages/app/src/locales/zh-Hans/messages.po
+++ b/packages/app/src/locales/zh-Hans/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · 仅引用(无嵌入内容)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " 或 "
@@ -442,6 +446,10 @@ msgstr "{agentName} 无法开始对话。"
msgid "{agentName} couldn't start."
msgstr "{agentName} 无法启动。"
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} 不接受图像附件。"
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "领先 {ahead} 个"
@@ -1724,6 +1732,10 @@ msgstr "资源建议"
msgid "Asset: {title}"
msgstr "资源:{title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "附加文件"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "附加图片"
@@ -3529,6 +3541,10 @@ msgstr "无法连接到该端点。请检查 URL,并确认服务器已启动
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "无法连接到 Open Knowledge 服务器以上传 {fileName}。"
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "无法读取 {fileName}。"
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "无法读取 {fileName}。它可能已被移动、删除,或尚未下载完成。请尝试重新添加。"
@@ -4468,6 +4484,10 @@ msgstr "拖动 {patternText} 以重新排序"
msgid "Drag item {0} to reorder"
msgstr "拖动项目 {0} 以重新排序"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "拖放文件以附加"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6191,6 +6211,10 @@ msgstr "找不到图片"
msgid "Image not found: {errorLabel}"
msgstr "找不到图片:{errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "图像预览"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "无法将图片目标“{shown}”解析为项目本地文件。"
@@ -6199,6 +6223,10 @@ msgstr "无法将图片目标“{shown}”解析为项目本地文件。"
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "图片目标“{shown}”未指向现有文件。"
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "图像可以来自任何地方 · 非图像文件必须位于工作区中"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "导入"
@@ -9530,6 +9558,14 @@ msgstr "来自另一个文档的 MirrorSource 块的只读副本。在来源处
msgid "Read-only file in the {name} skill"
msgstr "{name} 技能中的只读文件"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "从 {tail} 读取"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "从此工作区读取"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "正在阅读…"
@@ -9700,6 +9736,8 @@ msgid "Remove"
msgstr "移除"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "移除 {0}"
diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.json
index dabb6a725..9460558eb 100644
--- a/packages/app/src/locales/zh-Hant/messages.json
+++ b/packages/app/src/locales/zh-Hant/messages.json
@@ -266,6 +266,7 @@
"3oh0nQ": [["path"], " 中巢狀的 .okignore 有錯誤"],
"3pU8e-": ["釘選分頁"],
"3s-k7L": [["0", "plural", { "other": ["再顯示 ", "#", " 個工具"] }]],
+ "3uSzeS": ["圖片可以來自任何地方 · 非圖片檔案必須位於工作區中"],
"3v62tp": ["skills.sh 上的熱門項目"],
"3wiBAs": ["它應該放在哪裡?"],
"3y6XTb": ["語意搜尋"],
@@ -576,6 +577,7 @@
"90-wKT": ["OpenKnowledge 查看了 ", ["subject"], " 的歷史"],
"92rbk2": ["鏡像正在載入 <0>", ["mirrorRef"], "</0>"],
"93LBnX": ["隱藏「代理」"],
+ "95bl6Q": ["從此工作區讀取"],
"96G6Re": ["新增資料夾"],
"96pApd": [["name"], " 技能中的唯讀檔案"],
"96w9hU": ["開啟這個檔案時出了點問題(HTTP ", ["status"], ")。"],
@@ -1164,6 +1166,7 @@
"Ix0K8o": ["隱藏外部 URL 節點"],
"IxHMdF": ["無法刪除那則註解。"],
"IxyZXD": ["螢幕擷圖"],
+ "Izh19j": ["從 ", ["tail"], " 讀取"],
"J1XRO3": ["主題色彩"],
"J2Mv98": ["名稱(例如 ", ["login"], ")"],
"J2_JuX": ["無(", ["0"], " 無法比對到任何文件)"],
@@ -1296,6 +1299,7 @@
"LXdWeS": ["中型章節標題。"],
"LXfNU-": ["導覽與建議"],
"LYufDw": ["開啟語意搜尋失敗——", ["detail"]],
+ "LZe2vX": [" · 僅引用(無嵌入內容)"],
"LaskKp": ["傳送到對話(", ["0"], ")"],
"Lbl6KA": ["無法從 ", ["0"], " 安裝:", ["1"]],
"LbmLyU": ["無法安全地編輯這個工具的設定"],
@@ -1623,6 +1627,7 @@
"QGWzup": ["正在載入 OpenKnowledge 技能"],
"QHCx0c": ["錯誤回報記錄"],
"QIrBIx": ["展開全部檔案"],
+ "QIzioS": [["agentName"], " 不接受圖片附件。"],
"QKgePK": ["已把 ", ["editor"], " 對齊到原始碼(它的位元組已備份)"],
"QLgdT6": ["任何名為 ", ["0"], " 的文件"],
"QM3SBZ": ["計畫(", ["done"], "/", ["0"], ")"],
@@ -2554,6 +2559,7 @@
"enPTnx": ["第 ", ["displayLine"], " 行"],
"epuNYK": ["把某個區塊標記為事實來源。你編輯它的時候,別處的鏡像會即時更新。"],
"erenF-": ["無法刪除仍有未解決衝突的檔案"],
+ "euGaS0": ["無法讀取 ", ["fileName"], "。"],
"euc6Ns": ["建立副本"],
"evHlIg": ["「跟隨」不會推送或提交你的本機變更。它們只會留在這台電腦上。"],
"evs0iw": ["符合「", ["tagListQuery"], "」的標籤"],
@@ -2816,6 +2822,7 @@
["2"],
"。"
],
+ "ij-Elv": ["圖片預覽"],
"ijLc3m": ["項目符號清單"],
"ilodsp": ["讓代理不必先詢問就能使用 OpenKnowledge"],
"ioMn4Z": ["從範本新增…"],
@@ -3102,6 +3109,7 @@
"為淺色模式和深色模式各挑一個配色方案。「偏好設定」中的主題設定會決定用哪一個;選「系統」時,則由你的作業系統決定。"
],
"mo22UP": ["切換行內程式碼格式。"],
+ "moUeZ_": ["拖放檔案以附加"],
"mqSwZH": [
"<0>找不到鏡像錨點。</0><2>",
["src"],
@@ -3500,6 +3508,7 @@
"tA0b9E": ["預設的技能資料夾(儲存後會顯示確切路徑)"],
"tA2-xC": ["「", ["0"], "」先前已新增過(內容相同)。"],
"tAPZEx": ["下方"],
+ "tCyvAw": ["附加檔案"],
"tHKQ6j": ["正在重新命名"],
"tKlWWY": ["表情符號"],
"tLX6LY": ["OpenKnowledge 寫入了一個文件"],
diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.po
index 57a10d391..f29d42a46 100644
--- a/packages/app/src/locales/zh-Hant/messages.po
+++ b/packages/app/src/locales/zh-Hant/messages.po
@@ -13,6 +13,10 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+#: src/components/acp/ThreadView.tsx
+msgid " · references only (no embedded contents)"
+msgstr " · 僅引用(無嵌入內容)"
+
#: src/components/settings/HotkeysSection.tsx
msgid " or "
msgstr " 或 "
@@ -442,6 +446,10 @@ msgstr "{agentName} 無法開始對話。"
msgid "{agentName} couldn't start."
msgstr "{agentName} 無法啟動。"
+#: src/components/acp/ThreadView.tsx
+msgid "{agentName} doesn't accept image attachments."
+msgstr "{agentName} 不接受圖片附件。"
+
#: src/components/SyncStatusBadge.tsx
msgid "{ahead} ahead"
msgstr "領先 {ahead} 個"
@@ -1724,6 +1732,10 @@ msgstr "資源建議"
msgid "Asset: {title}"
msgstr "資產:{title}"
+#: src/components/acp/ThreadView.tsx
+msgid "Attach a file"
+msgstr "附加檔案"
+
#: src/components/FeedbackForm.tsx
msgid "Attach images"
msgstr "附加圖片"
@@ -3529,6 +3541,10 @@ msgstr "無法連上這個端點。請檢查 URL,並確認伺服器已啟動
msgid "Couldn't reach the Open Knowledge server to upload {fileName}."
msgstr "無法連上 Open Knowledge 伺服器來上傳 {fileName}。"
+#: src/components/acp/ThreadView.tsx
+msgid "Couldn't read {fileName}."
+msgstr "無法讀取 {fileName}。"
+
#: src/editor/image-upload/upload-failure.ts
msgid "Couldn't read {fileName}. It may have been moved, deleted, or not finished downloading. Try adding it again."
msgstr "無法讀取 {fileName}。它可能已被移動、刪除,或還沒下載完。請試著重新加入。"
@@ -4468,6 +4484,10 @@ msgstr "拖曳 {patternText} 以重新排序"
msgid "Drag item {0} to reorder"
msgstr "拖曳項目 {0} 以重新排序"
+#: src/components/acp/ThreadView.tsx
+msgid "Drop a file to attach"
+msgstr "拖放檔案以附加"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
#: src/components/FileTargetMenuItems.tsx
@@ -6191,6 +6211,10 @@ msgstr "找不到圖片"
msgid "Image not found: {errorLabel}"
msgstr "找不到圖片:{errorLabel}"
+#: src/components/acp/ThreadView.tsx
+msgid "Image preview"
+msgstr "圖片預覽"
+
#: src/editor/localized-validation-message.ts
msgid "Image target \"{shown}\" could not be resolved to a project-local file."
msgstr "無法將圖片目標「{shown}」解析為專案本機檔案。"
@@ -6199,6 +6223,10 @@ msgstr "無法將圖片目標「{shown}」解析為專案本機檔案。"
msgid "Image target \"{shown}\" does not resolve to an existing file."
msgstr "圖片目標「{shown}」未指向現有檔案。"
+#: src/components/acp/ThreadView.tsx
+msgid "Images from anywhere · non-image files must be in the workspace"
+msgstr "圖片可以來自任何地方 · 非圖片檔案必須位於工作區中"
+
#: src/components/ImportSkillForm.tsx
msgid "Import"
msgstr "匯入"
@@ -9530,6 +9558,14 @@ msgstr "來自另一份文件的 MirrorSource 區塊的唯讀副本。在來源
msgid "Read-only file in the {name} skill"
msgstr "{name} 技能中的唯讀檔案"
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from {tail}"
+msgstr "從 {tail} 讀取"
+
+#: src/components/acp/ThreadView.tsx
+msgid "Reading from this workspace"
+msgstr "從此工作區讀取"
+
#: src/components/acp/working-status.ts
msgid "Reading…"
msgstr "閱讀中…"
@@ -9700,6 +9736,8 @@ msgid "Remove"
msgstr "移除"
#. placeholder {0}: file.name
+#. placeholder {0}: image.name
+#: src/components/acp/ThreadView.tsx
#: src/components/FeedbackForm.tsx
msgid "Remove {0}"
msgstr "移除 {0}"
diff --git a/packages/core/src/acp/thread-protocol.ts b/packages/core/src/acp/thread-protocol.ts
index 91ed66620..792c7b0d0 100644
--- a/packages/core/src/acp/thread-protocol.ts
+++ b/packages/core/src/acp/thread-protocol.ts
@@ -103,6 +103,60 @@ export interface ThreadAgentInfo {
version?: string;
}
+/**
+ * One attached part on a user prompt — a workspace file, folder reference,
+ * or a pasted/dropped image. The server converts each into the matching ACP
+ * `ContentBlock` (files under `promptCapabilities.embeddedContext` become
+ * `EmbeddedResource` with the file's contents; otherwise a `resource_link`
+ * reference; folders always a `resource_link`; images an `ImageContent`
+ * block when the agent advertises `promptCapabilities.image`) and appends
+ * them to the outbound `session/prompt` alongside the text block. Files and
+ * folders address workspace-relative paths; image data is base64 already.
+ */
+export type AttachmentPart =
+ | {
+ readonly kind: 'file';
+ /** Workspace-relative path (matches @-chip's `path` attribute). */
+ readonly path: string;
+ /** Display name — the last path segment, or the picker's title. */
+ readonly name: string;
+ }
+ | {
+ readonly kind: 'folder';
+ readonly path: string;
+ readonly name: string;
+ }
+ | {
+ readonly kind: 'image';
+ /** Base64-encoded image bytes (no data-URI prefix). */
+ readonly data: string;
+ /** MIME type, e.g. `image/png`. */
+ readonly mimeType: string;
+ /** File name or paste-derived label — shown in the transcript chip. */
+ readonly name: string;
+ /** Original size in bytes, for the client-side display + soft-cap check. */
+ readonly sizeBytes?: number;
+ }
+ | {
+ /**
+ * A file the user dropped or picked from the OS filesystem (Finder,
+ * downloads, anywhere outside the project). Bytes ride the wire — the
+ * server can't confine an external path — so the server wraps it as
+ * an `EmbeddedResource` block instead of a `resource_link`. `image/*`
+ * mimes still ride the `image` variant above for the fast
+ * `ImageContent` path.
+ */
+ readonly kind: 'blob';
+ /** Base64-encoded bytes (no data-URI prefix) OR raw UTF-8 text — the
+ * encoding follows `textPayload`: true = utf-8 string, false = base64. */
+ readonly data: string;
+ /** True when `data` is a UTF-8 string, false when base64 bytes. */
+ readonly textPayload: boolean;
+ readonly mimeType: string;
+ readonly name: string;
+ readonly sizeBytes?: number;
+ };
+
/**
* A prompt waiting behind the active turn. Queue state is ephemeral —
* in-memory only, dropped on cancel/error/exit and never persisted — so it
@@ -113,6 +167,8 @@ export interface QueuedMessage {
/** Server-assigned id — the handle `queue_edit` / `queue_remove` target. */
id: string;
content: string;
+ /** Optional attachment parts frozen at queue time; the drain replays them. */
+ attachments?: readonly AttachmentPart[];
ts: number;
/**
* Parked: the drain skips this entry and moves to the next one, but the
@@ -132,6 +188,8 @@ export interface QueuedMessage {
*/
export interface SteerMessage {
content: string;
+ /** Attachment parts frozen at steer time. */
+ attachments?: readonly AttachmentPart[];
ts: number;
}
@@ -199,7 +257,17 @@ export interface ThreadInfo {
/** One entry in a thread's event log. */
export type ThreadEvent =
- | { kind: 'user_message'; content: string; ts: number }
+ | {
+ kind: 'user_message';
+ content: string;
+ /**
+ * Attachments frozen at send time — the transcript re-renders them as
+ * chips beside the user's text so a replayed thread still shows what
+ * was handed to the agent, not just the typed prose.
+ */
+ attachments?: readonly AttachmentPart[];
+ ts: number;
+ }
| { kind: 'session_update'; update: SessionUpdate; ts: number }
| {
kind: 'permission_request';
@@ -309,6 +377,13 @@ export type ThreadClientFrame =
agent: { source: 'registry' | 'custom'; id: string };
/** Optional first prompt, sent as soon as the session is ready. */
prompt?: string;
+ /**
+ * Optional attachment parts for the first prompt (files/folders from
+ * @-picker, images from paste/drop). Server gates each against the
+ * agent's `promptCapabilities` and either embeds contents, sends a
+ * reference, or drops the part with a warning on `agent_stderr`.
+ */
+ attachments?: readonly AttachmentPart[];
/** Optional doc context: extension-less docName the launch came from. */
docName?: string;
/**
@@ -335,7 +410,13 @@ export type ThreadClientFrame =
}
| { op: 'subscribe'; threadId: string; sinceSeq?: number }
| { op: 'unsubscribe'; threadId: string }
- | { op: 'prompt'; threadId: string; reqId: string; content: string }
+ | {
+ op: 'prompt';
+ threadId: string;
+ reqId: string;
+ content: string;
+ attachments?: readonly AttachmentPart[];
+ }
| {
/**
* Stop the running turn and send this instead. The correction parks on
@@ -346,6 +427,7 @@ export type ThreadClientFrame =
threadId: string;
reqId: string;
content: string;
+ attachments?: readonly AttachmentPart[];
}
| {
/**
@@ -431,6 +513,8 @@ export type ThreadClientFrame =
threadId: string;
reqId: string;
prompt?: string;
+ /** Attachments for the resume-carried first prompt. */
+ attachments?: readonly AttachmentPart[];
}
| {
/**
@@ -546,6 +630,50 @@ const CLIENT_OPS = new Set([
'list',
]);
+/**
+ * Structural check for an inbound `attachments` array. WS frames land in
+ * `parseThreadClientFrame` as untyped JSON, so `attachments` — like every
+ * other field — needs shape validation before being handed to the manager.
+ * Rejects when the value is anything other than an array of well-formed
+ * AttachmentPart values; returns `true` for `undefined` and for `[]`.
+ *
+ * Kept intentionally small — no depth beyond the immediate variant shape.
+ * Downstream code (`partToBlock`, `applyManagedRename`, etc.) still guards
+ * on its own invariants; this is the trust-boundary gate, not a schema.
+ */
+function isValidAttachmentPartArray(value: unknown): value is readonly AttachmentPart[] {
+ if (value === undefined) return true;
+ if (!Array.isArray(value)) return false;
+ for (const part of value) {
+ if (typeof part !== 'object' || part === null) return false;
+ const p = part as Record<string, unknown>;
+ if (p.kind === 'file' || p.kind === 'folder') {
+ if (typeof p.path !== 'string' || typeof p.name !== 'string') return false;
+ } else if (p.kind === 'image') {
+ if (
+ typeof p.data !== 'string' ||
+ typeof p.mimeType !== 'string' ||
+ typeof p.name !== 'string'
+ )
+ return false;
+ if (p.sizeBytes !== undefined && typeof p.sizeBytes !== 'number') return false;
+ } else if (p.kind === 'blob') {
+ if (
+ typeof p.data !== 'string' ||
+ typeof p.textPayload !== 'boolean' ||
+ typeof p.mimeType !== 'string' ||
+ typeof p.name !== 'string'
+ ) {
+ return false;
+ }
+ if (p.sizeBytes !== undefined && typeof p.sizeBytes !== 'number') return false;
+ } else {
+ return false;
+ }
+ }
+ return true;
+}
+
/**
* Parse a raw WS message into a `ThreadClientFrame`, or `null` when the
* bytes are not a recognizable frame. Structural (per-op field presence)
@@ -589,6 +717,7 @@ export function parseThreadClientFrame(raw: string): ThreadClientFrame | null {
}
if (settings.modeId !== undefined && typeof settings.modeId !== 'string') return null;
}
+ if (!isValidAttachmentPartArray(frame.attachments)) return null;
return frame as unknown as ThreadClientFrame;
}
case 'subscribe':
@@ -597,12 +726,20 @@ export function parseThreadClientFrame(raw: string): ThreadClientFrame | null {
return frame as unknown as ThreadClientFrame;
case 'prompt':
if (!str('threadId') || !str('reqId') || typeof frame.content !== 'string') return null;
+ if (!isValidAttachmentPartArray(frame.attachments)) return null;
return frame as unknown as ThreadClientFrame;
- // Unlike `prompt`, empty content is refused: a steer cancels a running
- // turn, and doing that for nothing is a Stop wearing the wrong name.
- case 'steer':
- if (!str('threadId') || !str('reqId') || !str('content')) return null;
+ // A steer cancels a running turn — doing it for nothing is a Stop
+ // wearing the wrong name. But content-empty + attachments-non-empty
+ // carries meaning (drop a file, hit send), so what we actually refuse
+ // is BOTH empty: no text AND no attachments.
+ case 'steer': {
+ if (!str('threadId') || !str('reqId')) return null;
+ if (typeof frame.content !== 'string') return null;
+ if (!isValidAttachmentPartArray(frame.attachments)) return null;
+ const hasAttachments = Array.isArray(frame.attachments) && frame.attachments.length > 0;
+ if (frame.content === '' && !hasAttachments) return null;
return frame as unknown as ThreadClientFrame;
+ }
case 'queue_edit':
if (!str('threadId') || !str('id') || !str('content')) return null;
if (frame.reqId !== undefined && !str('reqId')) return null;
@@ -646,6 +783,7 @@ export function parseThreadClientFrame(raw: string): ThreadClientFrame | null {
case 'resume':
if (!str('threadId') || !str('reqId')) return null;
if (frame.prompt !== undefined && typeof frame.prompt !== 'string') return null;
+ if (!isValidAttachmentPartArray(frame.attachments)) return null;
return frame as unknown as ThreadClientFrame;
case 'retry':
if (!str('threadId') || !str('reqId')) return null;
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index d7a845280..dfd95ef49 100644
--- a/packages/core/src/bridge/bind-frontmatter-doc.ts
+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts
@@ -1,3 +1,4 @@
+
import type * as Y from 'yjs';
import type { Err, Ok, Result } from '../config/result.ts';
import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';
diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.ts
index 005627195..8bfdb40cd 100644
--- a/packages/core/src/bridge/bridge-invariant.ts
+++ b/packages/core/src/bridge/bridge-invariant.ts
@@ -1,3 +1,4 @@
+
import { fnv1aDigest } from './hash-util.ts';
export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index f4cc8a286..2a597ec3d 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,3 +1,4 @@
+
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 8fb428b90..01ef76a9f 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,3 +1,4 @@
+
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/bridge/growth-detect.ts b/packages/core/src/bridge/growth-detect.ts
index 9d9c244b0..463e89595 100644
--- a/packages/core/src/bridge/growth-detect.ts
+++ b/packages/core/src/bridge/growth-detect.ts
@@ -1,3 +1,4 @@
+
const DEFAULT_MIN_SUBSTANTIVE_LINE_LENGTH = 16;
export const DUPLICATION_GATE_MIN_LINE_LENGTH = 8;
diff --git a/packages/core/src/bridge/intraline-predicate.ts b/packages/core/src/bridge/intraline-predicate.ts
index c43fdd7e7..0939885bb 100644
--- a/packages/core/src/bridge/intraline-predicate.ts
+++ b/packages/core/src/bridge/intraline-predicate.ts
@@ -1,3 +1,4 @@
+
export function rawLineCounts(doc: string): Map<string, number> {
const counts = new Map<string, number>();
for (const line of doc.split('\n')) {
diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.ts
index 251560a35..c0dc65705 100644
--- a/packages/core/src/bridge/merge-three-way.ts
+++ b/packages/core/src/bridge/merge-three-way.ts
@@ -65,6 +65,7 @@ export function tryLineLevelCombine(
return { clean: true, merged };
}
+
export type BridgeMergeContentLossSide = 'user' | 'agent';
export type BridgeMergeContentLossWhich = 'substring' | 'order' | 'growth';
diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.ts
index 01ac80099..dcc5b0690 100644
--- a/packages/core/src/bridge/normalize.ts
+++ b/packages/core/src/bridge/normalize.ts
@@ -1,3 +1,4 @@
+
import { stripFrontmatter } from '../extensions/frontmatter.ts';
import { bodyEdgeEmpties } from './doc-boundary-space.ts';
diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.ts
index 754dc5cc2..0be5203e4 100644
--- a/packages/core/src/bridge/pm-structural-equivalence.ts
+++ b/packages/core/src/bridge/pm-structural-equivalence.ts
@@ -32,6 +32,7 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };
const BR_LITERAL_RE = /^<br\s*\/?>$/i;
+
interface DegradeEntry {
readonly label: string;
readonly severity: ToleranceClassSeverity;
@@ -127,6 +128,7 @@ export interface ComparePmStructuralOptions {
ignoreAttrs?: (attrKey: string) => boolean;
}
+
/** Rebuild a node with `fn` applied to each child; identity when childless.
* Shared by the degrade canonicalizers so none re-implements the walk. */
function mapChildren(
@@ -248,6 +250,7 @@ function applyDegrades(tree: PmStructuralNode): {
return { normalized: current, fired };
}
+
export function comparePmStructural(
expected: PmStructuralNode,
actual: PmStructuralNode,
diff --git a/packages/core/src/bridge/subsequence.ts b/packages/core/src/bridge/subsequence.ts
index af20de1e2..dca644141 100644
--- a/packages/core/src/bridge/subsequence.ts
+++ b/packages/core/src/bridge/subsequence.ts
@@ -1,3 +1,4 @@
+
/** True when `needle` is a subsequence of `haystack` (two-pointer, O(n+m)):
* insertions in `haystack` are free; any dropped or substituted `needle` byte
* fails. */
diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.ts
index 83d47404a..a363dfd54 100644
--- a/packages/core/src/markdown/callout-transformer.ts
+++ b/packages/core/src/markdown/callout-transformer.ts
@@ -1,3 +1,4 @@
+
import type { Blockquote, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/code-fence.ts b/packages/core/src/markdown/code-fence.ts
index 9807a7e82..4499dbc92 100644
--- a/packages/core/src/markdown/code-fence.ts
+++ b/packages/core/src/markdown/code-fence.ts
@@ -1,3 +1,4 @@
+
export function selectFenceChar(info: string): '`' | '~' {
return info.includes('`') ? '~' : '`';
}
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 7415c474a..34704165b 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.ts
index ece5c02a1..b6299a948 100644
--- a/packages/core/src/markdown/dedent-block-jsx-close.ts
+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts
@@ -1,3 +1,4 @@
+
import { findFencedRegions, isInsideFence } from './fence-regions.ts';
const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;
diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.ts
index 54774764a..acd398aa6 100644
--- a/packages/core/src/markdown/details-accordion-promoter.ts
+++ b/packages/core/src/markdown/details-accordion-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/div-align-promoter.ts b/packages/core/src/markdown/div-align-promoter.ts
index 43ecdc709..ba9b56384 100644
--- a/packages/core/src/markdown/div-align-promoter.ts
+++ b/packages/core/src/markdown/div-align-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.ts
index 6d3f3643e..4513da9bb 100644
--- a/packages/core/src/markdown/fence-regions.ts
+++ b/packages/core/src/markdown/fence-regions.ts
@@ -1,3 +1,4 @@
+
const FENCE_RE = /^(`{3,}|~{3,})/gm;
export function findFencedRegions(src: string): Array<[number, number]> {
diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.ts
index 00f5771ee..6931623c7 100644
--- a/packages/core/src/markdown/fixtures/index.ts
+++ b/packages/core/src/markdown/fixtures/index.ts
@@ -1,3 +1,4 @@
+
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -8,6 +9,7 @@ function fixturePath(...segments: string[]): string {
return resolve(FIXTURES_DIR, ...segments);
}
+
interface GfmExample {
section: string;
markdown: string;
@@ -17,6 +19,7 @@ export function loadGfmExamples(): GfmExample[] {
return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];
}
+
interface MdxCrashEntry {
id: string;
input: string;
@@ -68,6 +71,7 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {
) as LargeEmbedFixture[];
}
+
export function loadPrd6955Before(): string {
return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');
}
@@ -76,6 +80,7 @@ export function loadPrd6955CorruptedTriplicated(): string {
return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');
}
+
export interface NgPinnedCase {
id: string;
name: string;
@@ -92,6 +97,7 @@ export function loadNgPinnedCases(): NgPinnedCase[] {
) as NgPinnedCase[];
}
+
export function loadLargeRealistic(): string {
return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');
}
diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.ts
index 8b1eb8519..daa3ef82b 100644
--- a/packages/core/src/markdown/fixtures/perf/generate.ts
+++ b/packages/core/src/markdown/fixtures/perf/generate.ts
@@ -1,3 +1,4 @@
+
import { writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -10,6 +11,7 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;
const SEED = 0xf1de1117;
+
function mulberry32(seed: number): () => number {
let a = seed >>> 0;
return () => {
@@ -36,6 +38,7 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {
return items[items.length - 1][0];
}
+
const WORDS = [
'lorem',
'ipsum',
@@ -153,6 +156,7 @@ function mdxBlock(rand: () => number): string {
return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;
}
+
type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';
const MIX: readonly [BlockKind, number][] = [
@@ -191,6 +195,7 @@ function generateDocument(blockCount: number, seed: number): string {
return `${blocks.join('\n\n')}\n`;
}
+
function main(): void {
for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {
const doc = generateDocument(count, SEED);
diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.ts
index 420dc0fe5..32c055c5b 100644
--- a/packages/core/src/markdown/guard-flanking-matrix.ts
+++ b/packages/core/src/markdown/guard-flanking-matrix.ts
@@ -7,6 +7,7 @@ import {
import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';
import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';
+
export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;
export type FlankClass = 'whitespace' | 'punctuation' | 'other';
diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.ts
index 2653473da..283913255 100644
--- a/packages/core/src/markdown/handler-shadow-audit.ts
+++ b/packages/core/src/markdown/handler-shadow-audit.ts
@@ -1,3 +1,4 @@
+
export interface HandlerShadowWitness {
input: string;
expect: 'byte' | 'byte-and-reparse-type';
diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.ts
index da0a81d23..5d1000cc4 100644
--- a/packages/core/src/markdown/highlight-promoter.ts
+++ b/packages/core/src/markdown/highlight-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.ts
index 787315157..9681c0056 100644
--- a/packages/core/src/markdown/html-to-mdast.ts
+++ b/packages/core/src/markdown/html-to-mdast.ts
@@ -1,3 +1,4 @@
+
import type { Element as HastElement, Root as HastRoot } from 'hast';
import type { List, Nodes as MdastNodes, Root as MdastRoot } from 'mdast';
import rehypeParse from 'rehype-parse';
@@ -128,7 +129,8 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRo
throw new HtmlPayloadTooLargeError(html.length, maxBytes);
}
- const processor = unified().use(rehypeParse, { fragment: true });
+ const processor = unified()
+ .use(rehypeParse, { fragment: true });
for (const plugin of cleanupPlugins) {
processor.use(plugin);
diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.ts
index 706fa9afb..994eb6917 100644
--- a/packages/core/src/markdown/image-promoter.ts
+++ b/packages/core/src/markdown/image-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Image, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.ts
index 779e27500..ec1ac1b7e 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,3 +1,4 @@
+
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -206,6 +207,7 @@ export class MarkdownManager {
}
}
+
const registry = createRegistry();
function destructureAttrs(
@@ -254,6 +256,7 @@ function destructureAttrs(
return result;
}
+
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -276,6 +279,7 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChec
return freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;
}
+
function isEmptyMdastParagraph(node: MdastNodes): boolean {
if (node.type !== 'paragraph') return false;
const children = node.children ?? [];
@@ -344,6 +348,7 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
+
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -596,6 +601,7 @@ function buildMdastToPmHandlers(
}));
}
+
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -676,6 +682,7 @@ function buildMdastToPmHandlers(
}));
}
+
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -973,6 +980,7 @@ function buildMdastToPmHandlers(
};
}
+
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1098,6 +1106,7 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
+
function buildPmToMdastHandlers(
schema: Schema,
freshness: FreshnessCheckerHolder,
diff --git a/packages/core/src/markdown/lint/applies-to.ts b/packages/core/src/markdown/lint/applies-to.ts
index fa0be9e86..b79e9aef7 100644
--- a/packages/core/src/markdown/lint/applies-to.ts
+++ b/packages/core/src/markdown/lint/applies-to.ts
@@ -1,3 +1,4 @@
+
import picomatch from 'picomatch';
import { SUPPORTED_DOC_EXTENSIONS } from '../../constants/doc-extensions.ts';
diff --git a/packages/core/src/markdown/lint/config-files.ts b/packages/core/src/markdown/lint/config-files.ts
index 312c9c74b..94b34dee1 100644
--- a/packages/core/src/markdown/lint/config-files.ts
+++ b/packages/core/src/markdown/lint/config-files.ts
@@ -1,3 +1,4 @@
+
const MARKDOWNLINT_JSON_CONFIG_FILES: ReadonlySet<string> = new Set([
'.markdownlint.json',
'.markdownlint.jsonc',
diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.ts
index c400441b2..1e3ad29c6 100644
--- a/packages/core/src/markdown/lint/config-schemas.ts
+++ b/packages/core/src/markdown/lint/config-schemas.ts
@@ -39,6 +39,7 @@ const fullPluginShape = Object.fromEntries(
LINT_PLUGINS.map((plugin) => [plugin.id, plugin.sliceSchema]),
) as z.ZodRawShape;
+
export const LinterConfigSchema = z.object({
enabled: z.boolean(),
plugins: z.object(fullPluginShape),
diff --git a/packages/core/src/markdown/lint/default-config.ts b/packages/core/src/markdown/lint/default-config.ts
index d48eea5e4..a51f2ffb0 100644
--- a/packages/core/src/markdown/lint/default-config.ts
+++ b/packages/core/src/markdown/lint/default-config.ts
@@ -6,6 +6,7 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSetting
MD013: false,
};
+
export function resolveMarkdownlintConfig(
rules: Record<string, MarkdownlintRuleSetting> | undefined,
): Configuration {
diff --git a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
index ef478e268..9c9542661 100644
--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
@@ -1,3 +1,4 @@
+
import { CANONICAL_SCHEMA_DIALECT_URIS, DEFAULT_SCHEMA_DIALECT } from './frontmatter-validate.ts';
export interface FrontmatterFieldConstraint {
diff --git a/packages/core/src/markdown/lint/frontmatter-validate.ts b/packages/core/src/markdown/lint/frontmatter-validate.ts
index 0d4c9a0df..b96d19182 100644
--- a/packages/core/src/markdown/lint/frontmatter-validate.ts
+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts
@@ -1,3 +1,4 @@
+
import Ajv, { type ValidateFunction } from 'ajv';
import Ajv2019 from 'ajv/dist/2019.js';
import Ajv2020 from 'ajv/dist/2020.js';
diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.ts
index af38c2ae2..1ca263610 100644
--- a/packages/core/src/markdown/lint/index.ts
+++ b/packages/core/src/markdown/lint/index.ts
@@ -1,3 +1,4 @@
+
import { LINT_PLUGINS, type LinterConfig } from './plugins.ts';
import type { LintDiagnostic } from './types.ts';
diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.ts
index 5e832aa19..be5871ed9 100644
--- a/packages/core/src/markdown/lint/plugins.ts
+++ b/packages/core/src/markdown/lint/plugins.ts
@@ -1,3 +1,4 @@
+
import { z } from 'zod';
import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';
import {
@@ -13,6 +14,7 @@ import {
type MarkdownlintSlice,
} from './types.ts';
+
const MarkdownlintRuleSettingSchema = z.union([
z.boolean(),
z.enum(MARKDOWNLINT_RULE_SEVERITIES),
diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.ts
index 01ce4a5af..3dae5c031 100644
--- a/packages/core/src/markdown/lint/types.ts
+++ b/packages/core/src/markdown/lint/types.ts
@@ -1,3 +1,4 @@
+
import type { BrokenLinkReason } from '../../schemas/api/agent-write.ts';
export const LINT_PLUGIN_IDS = ['markdownlint', 'frontmatter'] as const;
@@ -98,6 +99,7 @@ export interface FrontmatterSlice {
schemas: ResolvedFrontmatterSchemaEntry[];
}
+
interface RuleOptionSpecBase {
key: string;
description: string;
diff --git a/packages/core/src/markdown/lint/validation-counts.ts b/packages/core/src/markdown/lint/validation-counts.ts
index 98238656e..437cc539a 100644
--- a/packages/core/src/markdown/lint/validation-counts.ts
+++ b/packages/core/src/markdown/lint/validation-counts.ts
@@ -1,3 +1,4 @@
+
export interface ValidationSourceCounts {
errorCount: number;
warningCount: number;
diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.ts
index a5b511f25..bd79424c7 100644
--- a/packages/core/src/markdown/math-promoter.ts
+++ b/packages/core/src/markdown/math-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Code, Root } from 'mdast';
import type { Math as MdastMath } from 'mdast-util-math';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.ts
index ed89371d0..00fbc0035 100644
--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts
+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, ElementContent, Properties } from 'hast';
import type { FootnoteDefinition, FootnoteReference } from 'mdast';
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.ts
index 8ce2b2492..df788a80d 100644
--- a/packages/core/src/markdown/mdast-to-html.ts
+++ b/packages/core/src/markdown/mdast-to-html.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root as HastRoot, Text as HastText } from 'hast';
import type { Root as MdastRoot, Text as MdastText } from 'mdast';
import type { Handler } from 'mdast-util-to-hast';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index bfd7e3109..fa3cfcd86 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.ts
index 1a897fca8..17ed2b829 100644
--- a/packages/core/src/markdown/mermaid-promoter.ts
+++ b/packages/core/src/markdown/mermaid-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Code, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.ts
index d988f4b8b..4aa0490c4 100644
--- a/packages/core/src/markdown/parse-with-fallback.ts
+++ b/packages/core/src/markdown/parse-with-fallback.ts
@@ -168,6 +168,7 @@ export function parseRecursive(
}
}
+
interface VFilePlace {
offset?: number;
start?: { offset?: number };
@@ -186,6 +187,7 @@ function extractErrorOffset(err: unknown): number | undefined {
return undefined;
}
+
interface Region {
start: number;
end: number;
@@ -209,6 +211,7 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {
return null;
}
+
export interface TagEvent {
kind: 'open' | 'close' | 'self-close';
name: string;
@@ -355,6 +358,7 @@ function findFallbackRegion(src: string, errorOffset: number): Region {
return { start: blockStart, end: blockEnd };
}
+
interface SourceBlock {
src: string;
start: number;
@@ -452,6 +456,7 @@ function tryPerBlockFallback(
};
}
+
function wholeDocRawText(source: string): JSONContent {
return {
type: 'doc',
diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.ts
index e6ab4fd57..43d420187 100644
--- a/packages/core/src/markdown/parser-drop-closure.ts
+++ b/packages/core/src/markdown/parser-drop-closure.ts
@@ -1,3 +1,4 @@
+
export type DroppedTokenAdjudication =
| {
kind: 'format-dof-axis';
diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.ts
index 0e3224206..55736041c 100644
--- a/packages/core/src/markdown/pipeline.ts
+++ b/packages/core/src/markdown/pipeline.ts
@@ -1,3 +1,4 @@
+
import {
type FromProseMirrorOptions,
fromProseMirror,
diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.ts
index 91cdf658f..ccf06e94d 100644
--- a/packages/core/src/markdown/position-aware-join.ts
+++ b/packages/core/src/markdown/position-aware-join.ts
@@ -1,3 +1,4 @@
+
import type { Join } from 'mdast-util-to-markdown';
import type { Position } from 'unist';
import { isBlankLineParagraph } from './zero-emission-blocks.ts';
diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.ts
index 0f399d34c..e5b4c9eba 100644
--- a/packages/core/src/markdown/position-slice.ts
+++ b/packages/core/src/markdown/position-slice.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Root } from 'mdast';
import { visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
@@ -476,7 +477,8 @@ export function applyPositionSliceToNode(
const first = source[startOff];
if (first !== '[' && first !== '<' && !node.title) {
node.data.sourceStyle = 'gfm-autolink';
- } else if (first === '[') {
+ }
+ else if (first === '[') {
const slice = source.slice(startOff, endOff);
const closeBracketIdx = slice.lastIndexOf('](');
if (closeBracketIdx !== -1) {
diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
index db10fa54b..ca225ce9b 100644
--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, Root, Text } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
index 34068d103..3a2524a9a 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
index 93151d43b..2279a0189 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
index 188f02d83..a0f467c42 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
index 4ba2c3418..4e8542a21 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
index 1a74b1272..a3c96b24a 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
index de35e7b79..e95cf43d6 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
index b4be1b2ea..ffdb4d5b5 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
index 3c8d88b7c..e2a96d1a7 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.ts
index cf2c9da8e..0389575ac 100644
--- a/packages/core/src/markdown/resolve-image-url.ts
+++ b/packages/core/src/markdown/resolve-image-url.ts
@@ -1,3 +1,4 @@
+
import { isRelativeUrl } from './safe-url.ts';
function isDevDiagnosticContext(): boolean {
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 4d3250d3a..8be632ba4 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,3 +1,4 @@
+
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');
diff --git a/packages/core/src/markdown/serialize-fidelity.test-helper.ts b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
index 0dd54070e..96304e7a5 100644
--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts
+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
@@ -1,3 +1,4 @@
+
import type { JSONContent } from '@tiptap/core';
import type { Nodes } from 'mdast';
import { expect } from 'vitest';
diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.ts
index 7cac5b042..93798cf83 100644
--- a/packages/core/src/markdown/serialize-helpers.ts
+++ b/packages/core/src/markdown/serialize-helpers.ts
@@ -1,3 +1,4 @@
+
import type { Node as PmNode } from '@tiptap/pm/model';
import type {
MdxJsxAttribute,
diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.ts
index b012a5aff..8c08b7a04 100644
--- a/packages/core/src/markdown/single-dollar-math-promoter.ts
+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts
@@ -1,3 +1,4 @@
+
import type { PhrasingContent, Root, Text } from 'mdast';
import type { InlineMath } from 'mdast-util-math';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.ts
index 3e79f8cb6..959cc0bd2 100644
--- a/packages/core/src/markdown/to-markdown-handlers.ts
+++ b/packages/core/src/markdown/to-markdown-handlers.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parents } from 'mdast';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { Handle, Info, State } from 'mdast-util-to-markdown';
diff --git a/packages/core/src/markdown/underline-promoter.ts b/packages/core/src/markdown/underline-promoter.ts
index 0f1b0f27d..6e6d73400 100644
--- a/packages/core/src/markdown/underline-promoter.ts
+++ b/packages/core/src/markdown/underline-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.ts
index 1a082bda7..932d7d2a8 100644
--- a/packages/core/src/markdown/unknown-mdast-guard.ts
+++ b/packages/core/src/markdown/unknown-mdast-guard.ts
@@ -1,3 +1,4 @@
+
import type { Root as MdastRoot } from 'mdast';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.ts
index d578476a7..ac9f5239b 100644
--- a/packages/core/src/markdown/whitespace-char-ref.ts
+++ b/packages/core/src/markdown/whitespace-char-ref.ts
@@ -1,3 +1,4 @@
+
const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([
[0x20, ' '],
[0x09, '\t'],
diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.ts
index 6dad26200..afd9936fe 100644
--- a/packages/core/src/markdown/wiki-link-micromark.ts
+++ b/packages/core/src/markdown/wiki-link-micromark.ts
@@ -17,6 +17,7 @@ declare module 'micromark-util-types' {
}
}
+
const CODE_BANG = 33; // !
const CODE_LBRACKET = 91; // [
const CODE_RBRACKET = 93; // ]
@@ -260,6 +261,7 @@ export function wikiLinkSyntax(): Extension {
};
}
+
function enterWikiLink(this: CompileContext, token: Token) {
this.enter(
{
@@ -385,6 +387,7 @@ export const wikiLinkToMarkdown: {
unsafe: [{ character: '[', inConstruct: ['phrasing'] }],
};
+
const MICROMARK_EXT = wikiLinkSyntax();
export function remarkWikiLink(this: Processor) {
diff --git a/packages/server/src/acp/attachment-blocks.test.ts b/packages/server/src/acp/attachment-blocks.test.ts
new file mode 100644
index 000000000..9a8a4a81f
--- /dev/null
+++ b/packages/server/src/acp/attachment-blocks.test.ts
@@ -0,0 +1,234 @@
+import type { PromptCapabilities } from '@agentclientprotocol/sdk';
+import type { AttachmentPart } from '@inkeep/open-knowledge-core/acp/thread-protocol';
+import { describe, expect, test, vi } from 'vitest';
+import {
+ type AttachmentPathResolver,
+ buildPromptBlocks,
+ partToBlock,
+} from './attachment-blocks.ts';
+
+/** A resolver that pretends every path is already inside the content root. */
+const acceptingResolver: AttachmentPathResolver = async (requested) => ({
+ abs: `/root/${requested}`,
+ rel: requested,
+});
+
+/** A resolver that always throws — simulates `confineToContentDir` refusing
+ * an escape. `partToBlock` catches it and returns a dropped outcome. */
+const rejectingResolver: AttachmentPathResolver = async (requested) => {
+ throw new Error(`path escapes: ${requested}`);
+};
+
+/** Stat/readFile stubs — sized so the file falls under the embed cap. Size
+ * comes from the buffer OR the text, whichever the assertion cares about. */
+function makeDeps(text = 'hello world', bytes = Buffer.from(text)) {
+ return {
+ stat: vi.fn(async () => ({ size: bytes.length }) as never),
+ readFile: vi.fn(async (_p: unknown, encoding?: unknown) => {
+ return encoding === 'utf8' ? text : bytes;
+ }) as never,
+ };
+}
+
+describe('partToBlock — images', () => {
+ test('image + capabilities.image === true → image block', async () => {
+ const part: AttachmentPart = {
+ kind: 'image',
+ data: 'AAAA',
+ mimeType: 'image/png',
+ name: 'shot.png',
+ };
+ const caps: PromptCapabilities = { image: true };
+ const out = await partToBlock(part, caps, acceptingResolver);
+ expect(out).toEqual({ block: { type: 'image', data: 'AAAA', mimeType: 'image/png' } });
+ });
+
+ test('image without capabilities.image → dropped with reason', async () => {
+ const part: AttachmentPart = {
+ kind: 'image',
+ data: 'AAAA',
+ mimeType: 'image/png',
+ name: 'shot.png',
+ };
+ const out = await partToBlock(part, {}, acceptingResolver);
+ expect(out).toEqual({
+ dropped: true,
+ reason: expect.stringContaining('does not accept images'),
+ });
+ });
+});
+
+describe('partToBlock — folders', () => {
+ test('folder → resource_link with inode/directory mimetype', async () => {
+ const part: AttachmentPart = { kind: 'folder', path: 'specs/foo', name: 'foo' };
+ const out = await partToBlock(part, {}, acceptingResolver);
+ expect(out).toEqual({
+ block: {
+ type: 'resource_link',
+ uri: 'file:///root/specs/foo',
+ name: 'foo',
+ mimeType: 'inode/directory',
+ },
+ });
+ });
+
+ test('folder that escapes the content root → dropped', async () => {
+ const part: AttachmentPart = { kind: 'folder', path: '../secrets', name: 'secrets' };
+ const out = await partToBlock(part, {}, rejectingResolver);
+ expect(out).toEqual({
+ dropped: true,
+ reason: expect.stringContaining('attachment path refused'),
+ });
+ });
+});
+
+describe('partToBlock — files', () => {
+ test('file WITHOUT embeddedContext → resource_link with mimeType + size', async () => {
+ const part: AttachmentPart = { kind: 'file', path: 'notes.md', name: 'notes.md' };
+ const deps = makeDeps('# hi');
+ const out = await partToBlock(part, {}, acceptingResolver, deps);
+ expect(out).toEqual({
+ block: {
+ type: 'resource_link',
+ uri: 'file:///root/notes.md',
+ name: 'notes.md',
+ mimeType: 'text/markdown',
+ size: 4,
+ },
+ });
+ // Never reads bytes when embedding isn't allowed — a resource_link is a
+ // reference, not a payload.
+ expect(deps.readFile).not.toHaveBeenCalled();
+ });
+
+ test('text file WITH embeddedContext → resource + TextResourceContents', async () => {
+ const part: AttachmentPart = { kind: 'file', path: 'notes.md', name: 'notes.md' };
+ const caps: PromptCapabilities = { embeddedContext: true };
+ const deps = makeDeps('# hi');
+ const out = await partToBlock(part, caps, acceptingResolver, deps);
+ expect(out).toEqual({
+ block: {
+ type: 'resource',
+ resource: {
+ uri: 'file:///root/notes.md',
+ text: '# hi',
+ mimeType: 'text/markdown',
+ },
+ },
+ });
+ });
+
+ test('binary file WITH embeddedContext → resource_link (Zed-aligned; never inline bytes)', async () => {
+ // Zed's rule: binary files ride as `ResourceLink`, not `EmbeddedResource`.
+ // Sending base64 payload for a PDF/image-as-file just inflates the wire —
+ // agents like Claude Code don't translate blob resources into their
+ // native document/vision paths, they fall back to their Read tool, which
+ // works fine off a `file://` URI alone.
+ const part: AttachmentPart = { kind: 'file', path: 'assets/logo.png', name: 'logo.png' };
+ const caps: PromptCapabilities = { embeddedContext: true };
+ const bytes = Buffer.from([1, 2, 3, 4]);
+ const deps = makeDeps('', bytes);
+ const out = await partToBlock(part, caps, acceptingResolver, deps);
+ expect(out).toEqual({
+ block: {
+ type: 'resource_link',
+ uri: 'file:///root/assets/logo.png',
+ name: 'logo.png',
+ mimeType: 'image/png',
+ size: bytes.length,
+ },
+ });
+ // And crucially: no readFile call happened, because binaries are pure
+ // references — the agent reads bytes off disk via its own tool.
+ expect(deps.readFile).not.toHaveBeenCalled();
+ });
+
+ test('oversized file falls back to resource_link even under embeddedContext', async () => {
+ const part: AttachmentPart = { kind: 'file', path: 'big.txt', name: 'big.txt' };
+ const caps: PromptCapabilities = { embeddedContext: true };
+ const deps = {
+ stat: vi.fn(async () => ({ size: 10 * 1024 * 1024 }) as never),
+ readFile: vi.fn(),
+ };
+ const out = await partToBlock(part, caps, acceptingResolver, deps as never);
+ expect(out).toHaveProperty('block.type', 'resource_link');
+ // Never reads bytes for a file above the cap — the resource_link is a
+ // reference, so shipping the bytes would defeat the point of the cap.
+ expect(deps.readFile).not.toHaveBeenCalled();
+ });
+
+ test('missing file → dropped with the fs error message', async () => {
+ const part: AttachmentPart = { kind: 'file', path: 'gone.md', name: 'gone.md' };
+ const deps = {
+ stat: vi.fn(async () => {
+ throw Object.assign(new Error('ENOENT: no such file'), { code: 'ENOENT' });
+ }) as never,
+ readFile: vi.fn(),
+ };
+ const out = await partToBlock(part, {}, acceptingResolver, deps);
+ expect(out).toEqual({
+ dropped: true,
+ reason: expect.stringContaining('file unavailable'),
+ });
+ });
+});
+
+describe('buildPromptBlocks', () => {
+ test('leads with the text block (with file/folder markers prepended), then appends parts', async () => {
+ const parts: AttachmentPart[] = [
+ { kind: 'folder', path: 'specs', name: 'specs' },
+ { kind: 'image', data: 'AAAA', mimeType: 'image/png', name: 'shot.png' },
+ ];
+ const caps: PromptCapabilities = { image: true };
+ const { blocks, dropped } = await buildPromptBlocks(
+ 'look at this',
+ parts,
+ caps,
+ acceptingResolver,
+ );
+ expect(dropped).toEqual([]);
+ expect(blocks).toEqual([
+ // File/folder attachments get a `[name](path)` marker inline in the
+ // text so Claude Code's ACP adapter correlates the ResourceLink block
+ // against the message. Images are self-describing (they ride inline
+ // as a native ImageContent block) and get no marker.
+ { type: 'text', text: '[specs](specs)\n\nlook at this' },
+ {
+ type: 'resource_link',
+ uri: 'file:///root/specs',
+ name: 'specs',
+ mimeType: 'inode/directory',
+ },
+ { type: 'image', data: 'AAAA', mimeType: 'image/png' },
+ ]);
+ });
+
+ test('file-only attachment on empty text → marker becomes the whole text', async () => {
+ const parts: AttachmentPart[] = [{ kind: 'file', path: 'notes.md', name: 'notes.md' }];
+ const { blocks } = await buildPromptBlocks('', parts, {}, acceptingResolver, makeDeps('# hi'));
+ expect(blocks[0]).toEqual({ type: 'text', text: '[notes.md](notes.md)' });
+ });
+
+ test('a dropped part does not stop later parts from converting', async () => {
+ const parts: AttachmentPart[] = [
+ { kind: 'image', data: 'AAAA', mimeType: 'image/png', name: 'shot.png' },
+ { kind: 'folder', path: 'specs', name: 'specs' },
+ ];
+ // capabilities.image is false → the image drops, the folder still lands
+ const { blocks, dropped } = await buildPromptBlocks('here', parts, {}, acceptingResolver);
+ expect(blocks.map((b) => b.type)).toEqual(['text', 'resource_link']);
+ expect(dropped).toHaveLength(1);
+ expect(dropped[0]?.part.kind).toBe('image');
+ });
+
+ test('undefined attachments → text-only block, no drops', async () => {
+ const { blocks, dropped } = await buildPromptBlocks(
+ 'plain',
+ undefined,
+ undefined,
+ acceptingResolver,
+ );
+ expect(blocks).toEqual([{ type: 'text', text: 'plain' }]);
+ expect(dropped).toEqual([]);
+ });
+});
diff --git a/packages/server/src/acp/attachment-blocks.ts b/packages/server/src/acp/attachment-blocks.ts
new file mode 100644
index 000000000..cc75f7de6
--- /dev/null
+++ b/packages/server/src/acp/attachment-blocks.ts
@@ -0,0 +1,333 @@
+/**
+ * Convert `AttachmentPart` wire values (files, folders, images picked or
+ * dropped in the composer) into the ACP `ContentBlock[]` the server hands
+ * to the agent alongside the user's text.
+ *
+ * Gated on `PromptCapabilities`: an agent that didn't advertise
+ * `embeddedContext` gets a `resource_link` reference instead of the file's
+ * contents; one that didn't advertise `image` gets the image dropped with
+ * a warning rather than a malformed prompt. Client-side gating disables
+ * unsupported attachment surfaces up front, so this side is defense-in-
+ * depth — a version-skewed client can still send parts an agent won't take.
+ *
+ * Path safety: files/folders address workspace-relative paths that the
+ * caller MUST resolve through `confineToContentDir` before this helper
+ * reads bytes — a path that escapes the content root has already returned
+ * `path-escape` at the caller level.
+ */
+
+import { readFile, stat } from 'node:fs/promises';
+import { basename } from 'node:path';
+import { pathToFileURL } from 'node:url';
+import type { ContentBlock, PromptCapabilities } from '@agentclientprotocol/sdk';
+import type { AttachmentPart } from '@inkeep/open-knowledge-core/acp/thread-protocol';
+
+/**
+ * Sniff whether a mime type reads well as UTF-8 text — controls whether an
+ * embedded file part becomes `TextResourceContents` (readable inline by the
+ * agent) or `BlobResourceContents` (base64 binary payload).
+ *
+ * Kept intentionally coarse: any `text/*` mime and a handful of application
+ * types the app language corpus routinely produces. Anything else is safer
+ * to encode as a blob and let the agent decide.
+ */
+function isTextishMime(mimeType: string | null): boolean {
+ if (mimeType === null) return false;
+ if (mimeType.startsWith('text/')) return true;
+ return (
+ mimeType === 'application/json' ||
+ mimeType === 'application/xml' ||
+ mimeType === 'application/x-yaml' ||
+ mimeType === 'application/yaml' ||
+ mimeType === 'application/javascript' ||
+ mimeType === 'application/typescript' ||
+ mimeType === 'application/toml' ||
+ mimeType === 'application/x-sh' ||
+ mimeType === 'application/sql'
+ );
+}
+
+/**
+ * Best-effort mime lookup for the file-extension → text/binary split.
+ * The list stays workspace-realistic (source, config, docs) rather than
+ * exhaustive: a miss falls through to `application/octet-stream` which
+ * routes to the blob branch — safe under-approximation, never wrong output.
+ */
+function mimeFromExtension(path: string): string | null {
+ const dot = path.lastIndexOf('.');
+ if (dot < 0) return null;
+ const ext = path.slice(dot + 1).toLowerCase();
+ const map: Readonly<Record<string, string>> = {
+ md: 'text/markdown',
+ mdx: 'text/markdown',
+ txt: 'text/plain',
+ log: 'text/plain',
+ csv: 'text/csv',
+ tsv: 'text/tab-separated-values',
+ html: 'text/html',
+ htm: 'text/html',
+ xml: 'application/xml',
+ json: 'application/json',
+ yaml: 'application/yaml',
+ yml: 'application/yaml',
+ toml: 'application/toml',
+ js: 'application/javascript',
+ mjs: 'application/javascript',
+ cjs: 'application/javascript',
+ ts: 'application/typescript',
+ tsx: 'application/typescript',
+ py: 'text/x-python',
+ rs: 'text/x-rust',
+ go: 'text/x-go',
+ java: 'text/x-java',
+ rb: 'text/x-ruby',
+ php: 'text/x-php',
+ sh: 'application/x-sh',
+ css: 'text/css',
+ scss: 'text/x-scss',
+ sql: 'application/sql',
+ png: 'image/png',
+ jpg: 'image/jpeg',
+ jpeg: 'image/jpeg',
+ gif: 'image/gif',
+ webp: 'image/webp',
+ svg: 'image/svg+xml',
+ pdf: 'application/pdf',
+ zip: 'application/zip',
+ };
+ return map[ext] ?? null;
+}
+
+/**
+ * Encode a file:// URI from a canonical absolute path. Delegates to
+ * `pathToFileURL` so Windows `C:\Users\...` paths yield a well-formed
+ * `file:///C:/Users/...` URI rather than a percent-encoded backslash mess.
+ */
+function fileUri(absPath: string): string {
+ return pathToFileURL(absPath).href;
+}
+
+/** Cap on inline-embedded file size — 512 KiB is generous enough for source
+ * and config files, small enough that a rogue attachment can't inflate one
+ * prompt into a multi-megabyte payload. Files above this fall back to
+ * `resource_link` so the reference survives without shipping the bytes. */
+const EMBED_MAX_BYTES = 512 * 1024;
+
+/**
+ * Resolver contract the caller provides — a `confineToContentDir`-style
+ * check that yields `{abs, rel}` on success and throws on escape. Injected
+ * so the helper stays pure and testable without wiring the full server.
+ */
+export type AttachmentPathResolver = (
+ requestedPath: string,
+) => Promise<{ abs: string; rel: string }>;
+
+/** Optional overrides — the tests inject fakes so no real fs is touched. */
+export interface ConversionDeps {
+ readonly readFile?: typeof readFile;
+ readonly stat?: typeof stat;
+}
+
+/**
+ * Convert one `AttachmentPart` into zero-or-one ACP `ContentBlock`. Zero
+ * covers the drop paths (unsupported by the agent, path escape, missing
+ * file) — the caller keeps the reason and emits a warning on the thread's
+ * `agent_stderr` channel so the user can see why an attachment went
+ * missing. Never throws for a client-side data problem.
+ */
+export async function partToBlock(
+ part: AttachmentPart,
+ capabilities: PromptCapabilities | null | undefined,
+ resolve: AttachmentPathResolver,
+ deps: ConversionDeps = {},
+): Promise<{ readonly block: ContentBlock } | { readonly dropped: true; readonly reason: string }> {
+ const readFileImpl = deps.readFile ?? readFile;
+ const statImpl = deps.stat ?? stat;
+
+ if (part.kind === 'image') {
+ if (capabilities?.image !== true) {
+ return { dropped: true, reason: `agent does not accept images (${part.name})` };
+ }
+ return {
+ block: { type: 'image', data: part.data, mimeType: part.mimeType },
+ };
+ }
+
+ if (part.kind === 'blob') {
+ // An OS-picked / dropped non-image file. `EmbeddedResource` is the only
+ // block type that carries arbitrary contents inline — `resource_link`
+ // would require a URI the agent can read, which an external path is
+ // not. Route by encoding: utf-8 payload as `TextResourceContents`,
+ // base64 payload as `BlobResourceContents`.
+ //
+ // Gated on `embeddedContext`: an agent that didn't advertise it can
+ // (and does) reject an unexpected `resource` block and close its own
+ // session mid-turn — that surfaces to the user as "reconnecting to
+ // agent service" and the whole message disappears. Fall back to text
+ // by inlining the file's contents into the user prompt so the ask
+ // still lands.
+ if (capabilities?.embeddedContext !== true) {
+ const inlined = part.textPayload
+ ? part.data
+ : `[binary attachment ${part.name} (${part.mimeType || 'application/octet-stream'}) — this agent doesn't accept embedded resources]`;
+ return {
+ block: {
+ type: 'text',
+ text: `\n\n--- Attachment: ${part.name} ---\n${inlined}\n--- End attachment ---`,
+ },
+ };
+ }
+ // `attachment:` synthetic URI — never resolves as a real path, so an
+ // agent that echoes it back can't accidentally follow it out of the
+ // workspace. Name rides as a URL param for observability.
+ const uri = `attachment:///${encodeURIComponent(part.name || 'attachment')}`;
+ if (part.textPayload) {
+ return {
+ block: {
+ type: 'resource',
+ resource: {
+ uri,
+ text: part.data,
+ ...(part.mimeType !== '' ? { mimeType: part.mimeType } : {}),
+ },
+ },
+ };
+ }
+ return {
+ block: {
+ type: 'resource',
+ resource: {
+ uri,
+ blob: part.data,
+ ...(part.mimeType !== '' ? { mimeType: part.mimeType } : {}),
+ },
+ },
+ };
+ }
+
+ if (part.kind === 'folder') {
+ let abs: string;
+ try {
+ ({ abs } = await resolve(part.path));
+ } catch (err) {
+ return { dropped: true, reason: pathEscapeReason(part.path, err) };
+ }
+ return {
+ block: {
+ type: 'resource_link',
+ uri: fileUri(abs),
+ name: part.name || basename(part.path) || part.path,
+ mimeType: 'inode/directory',
+ },
+ };
+ }
+
+ // part.kind === 'file'
+ let abs: string;
+ try {
+ ({ abs } = await resolve(part.path));
+ } catch (err) {
+ return { dropped: true, reason: pathEscapeReason(part.path, err) };
+ }
+ let sizeBytes: number | null = null;
+ try {
+ const info = await statImpl(abs);
+ sizeBytes = info.size;
+ } catch (err) {
+ return { dropped: true, reason: `file unavailable: ${errMessage(err)}` };
+ }
+
+ const mimeType = mimeFromExtension(part.path);
+ const name = part.name || basename(part.path) || part.path;
+ const uri = fileUri(abs);
+
+ // Zed-aligned: only embed CONTENT for text files under the cap when the
+ // agent advertised `embeddedContext`. Everything else — binaries (PDF,
+ // .zip, screenshots-as-file), large text, no-cap agents — rides as a
+ // `ResourceLink` and the agent reads from disk via its own tool. Sending
+ // base64 bytes for binaries just inflates the wire without unlocking
+ // anything — Claude Code's ACP adapter doesn't translate them into an
+ // Anthropic `document` block, so it still routes through its Read tool.
+ const canEmbedText =
+ capabilities?.embeddedContext === true &&
+ sizeBytes <= EMBED_MAX_BYTES &&
+ isTextishMime(mimeType);
+ if (!canEmbedText) {
+ return {
+ block: {
+ type: 'resource_link',
+ uri,
+ name,
+ ...(mimeType !== null ? { mimeType } : {}),
+ ...(sizeBytes !== null ? { size: sizeBytes } : {}),
+ },
+ };
+ }
+ let text: string;
+ try {
+ text = await readFileImpl(abs, 'utf8');
+ } catch (err) {
+ return { dropped: true, reason: `file read failed: ${errMessage(err)}` };
+ }
+ return {
+ block: {
+ type: 'resource',
+ resource: {
+ uri,
+ text,
+ ...(mimeType !== null ? { mimeType } : {}),
+ },
+ },
+ };
+}
+
+/**
+ * Full prompt-payload build: text block first, then each attachment. Drops
+ * are reported alongside the blocks so the caller can log them.
+ */
+export async function buildPromptBlocks(
+ text: string,
+ attachments: readonly AttachmentPart[] | undefined,
+ capabilities: PromptCapabilities | null | undefined,
+ resolve: AttachmentPathResolver,
+ deps: ConversionDeps = {},
+): Promise<{
+ readonly blocks: readonly ContentBlock[];
+ readonly dropped: ReadonlyArray<{ readonly part: AttachmentPart; readonly reason: string }>;
+}> {
+ // Prepend `[name](path)` markers so the agent sees the file references
+ // inline with the message text — Claude Code's ACP adapter treats
+ // trailing ResourceLink blocks as unlabeled context and ignores them
+ // without a hint in the prompt. Only file/folder parts get a marker;
+ // image parts are self-describing via their inline block.
+ const markers: string[] = [];
+ for (const part of attachments ?? []) {
+ if (part.kind === 'file' || part.kind === 'folder') {
+ markers.push(`[${part.name || part.path}](${part.path})`);
+ }
+ }
+ const agentText =
+ markers.length > 0
+ ? text === ''
+ ? markers.join(' ')
+ : `${markers.join(' ')}\n\n${text}`
+ : text;
+ const blocks: ContentBlock[] = [{ type: 'text', text: agentText }];
+ const dropped: Array<{ part: AttachmentPart; reason: string }> = [];
+ for (const part of attachments ?? []) {
+ const outcome = await partToBlock(part, capabilities, resolve, deps);
+ if ('block' in outcome) blocks.push(outcome.block);
+ else dropped.push({ part, reason: outcome.reason });
+ }
+ return { blocks, dropped };
+}
+
+function pathEscapeReason(requested: string, err: unknown): string {
+ const msg = errMessage(err);
+ return `attachment path refused: ${requested} (${msg})`;
+}
+
+function errMessage(err: unknown): string {
+ if (err instanceof Error) return err.message;
+ return String(err);
+}
diff --git a/packages/server/src/acp/thread-manager.ts b/packages/server/src/acp/thread-manager.ts
index d2bb50696..5ada3c979 100644
--- a/packages/server/src/acp/thread-manager.ts
+++ b/packages/server/src/acp/thread-manager.ts
@@ -50,6 +50,7 @@ import {
OK_HOSTED_AGENT_ENV,
} from '@inkeep/open-knowledge-core';
import type {
+ AttachmentPart,
QueuedMessage,
SteerMessage,
ThreadAgentInfo,
@@ -71,6 +72,7 @@ import {
import { isConfigDoc, isSystemDoc } from '../cc1-broadcast.ts';
import type { PinoLogger } from '../logger.ts';
import { MCP_HOSTED_AGENT_HEADER } from '../mcp/agent-identity.ts';
+import { buildPromptBlocks } from './attachment-blocks.ts';
import { boundSessionUpdateForLog, coalesceChunkInto } from './event-log-bounds.ts';
import {
AgentLaunchError,
@@ -223,6 +225,18 @@ class AuthenticateTimeoutError extends Error {
}
}
+/**
+ * A Stop landed while the async prompt-block build was still in flight, so
+ * we never sent `session/prompt`. Thrown from the build-then-dispatch chain
+ * so the existing catch (which honors `cancelRequested`) handles cleanup.
+ */
+class PromptCancelledBeforeDispatchError extends Error {
+ constructor() {
+ super('prompt build cancelled before dispatch');
+ this.name = 'PromptCancelledBeforeDispatchError';
+ }
+}
+
/** A retry took the thread over mid-sign-in; the sign-in stands down silently. */
function threadRestartedDuringSignIn(): ThreadOpError {
return new ThreadOpError('not-ready', 'the thread was restarted during the sign-in');
@@ -613,6 +627,12 @@ export class AcpThreadManager {
async createThread(params: {
agent: { source: 'registry' | 'custom'; id: string };
prompt?: string;
+ /**
+ * Attachment parts for the launch prompt. Rides `sendPrompt` alongside
+ * the text — server converts each to the ACP content block the agent
+ * advertised support for; drops with a log warning otherwise.
+ */
+ attachments?: readonly AttachmentPart[];
docName?: string;
titleHint?: string;
/**
@@ -1256,6 +1276,7 @@ export class AcpThreadManager {
params: {
agent: { source: 'registry' | 'custom'; id: string };
prompt?: string;
+ attachments?: readonly AttachmentPart[];
settings?: { config?: Record<string, string | boolean>; modeId?: string };
},
custom: CustomAgentEntry | null,
@@ -1293,8 +1314,16 @@ export class AcpThreadManager {
'[acp-threads] agent ready',
);
- if (params.prompt !== undefined && params.prompt !== '') {
- this.sendPrompt(record.info.threadId, params.prompt);
+ // Same gate resumeThread now uses: attachment-only creates count as
+ // content ("attachments alone ARE the message"). Not currently reachable
+ // from any in-tree call site (all `create` frames carry text today), but
+ // the wire accepts create.attachments — a version-skewed client would
+ // otherwise silently lose them.
+ const hasContent =
+ (params.prompt !== undefined && params.prompt !== '') ||
+ (params.attachments !== undefined && params.attachments.length > 0);
+ if (hasContent) {
+ this.sendPrompt(record.info.threadId, params.prompt ?? '', params.attachments);
}
}
@@ -1386,7 +1415,11 @@ export class AcpThreadManager {
* with `resume-unsupported`. Unlike `createThread`, resolves only once the
* thread is ready (or rejects) — status events stream progress meanwhile.
*/
- async resumeThread(threadId: string, prompt?: string): Promise<ThreadInfo> {
+ async resumeThread(
+ threadId: string,
+ prompt?: string,
+ attachments?: readonly AttachmentPart[],
+ ): Promise<ThreadInfo> {
if (this.destroyed) throw new ThreadOpError('capacity', 'server is shutting down');
const t = this.mustGet(threadId);
if (t.info.archived !== true) {
@@ -1428,7 +1461,15 @@ export class AcpThreadManager {
t.midTurnOnDisk = false;
this.appendEvent(t, { kind: 'turn_ended', stopReason: 'cancelled', ts: Date.now() });
}
- if (prompt !== undefined && prompt !== '') {
+ // Attachment-only prompts (image drop with no text) count as content
+ // — the message is the picture. `prompt === '' && attachments.length > 0`
+ // is a legitimate send and must ride the same optimistic-echo + later
+ // dispatch path a text prompt does. Both-empty stays a no-op resume
+ // (Reopen with no send).
+ const hasContent =
+ (prompt !== undefined && prompt !== '') ||
+ (attachments !== undefined && attachments.length > 0);
+ if (hasContent) {
// Optimistic echo: the message lands in the transcript (and every
// subscriber's view) NOW, not after the multi-second respawn +
// handshake — otherwise the composer clears and nothing visibly
@@ -1436,7 +1477,7 @@ export class AcpThreadManager {
// handshake skips its own echo to match. Flushed synchronously so
// the echo frame always precedes the `resumed` response, not just
// usually (the coalescing timer could lose to a fast handshake).
- this.echoUserMessage(t, prompt);
+ this.echoUserMessage(t, prompt ?? '', attachments);
this.flushBroadcast(t);
}
this.emitStatus(t, 'installing');
@@ -1498,8 +1539,8 @@ export class AcpThreadManager {
},
'[acp-threads] thread resumed',
);
- if (prompt !== undefined && prompt !== '') {
- this.dispatchPrompt(t, prompt, { echo: false });
+ if (hasContent) {
+ this.dispatchPrompt(t, prompt ?? '', attachments, { echo: false });
}
return { ...t.info };
} catch (err) {
@@ -1743,7 +1784,7 @@ export class AcpThreadManager {
}
}
- sendPrompt(threadId: string, content: string): void {
+ sendPrompt(threadId: string, content: string, attachments?: readonly AttachmentPart[]): void {
const t = this.mustGet(threadId);
if (t.info.archived === true) {
throw new ThreadOpError('not-ready', 'the thread is archived — resume it first');
@@ -1770,12 +1811,14 @@ export class AcpThreadManager {
`${MAX_QUEUED_PROMPTS} messages are already waiting — let the agent catch up`,
);
}
- t.info.queue = [...queue, { id: crypto.randomUUID(), content, ts: Date.now() }];
+ const entry: QueuedMessage = { id: crypto.randomUUID(), content, ts: Date.now() };
+ if (attachments !== undefined && attachments.length > 0) entry.attachments = attachments;
+ t.info.queue = [...queue, entry];
t.info.lastActivityAt = Date.now();
this.emitInfo(t);
return;
}
- this.dispatchPrompt(t, content, { echo: true });
+ this.dispatchPrompt(t, content, attachments, { echo: true });
}
/**
@@ -1788,7 +1831,7 @@ export class AcpThreadManager {
* If the agent never stops, {@link demoteStalledSteer} converts it into an
* ordinary queued message rather than leaving it stranded.
*/
- steerPrompt(threadId: string, content: string): void {
+ steerPrompt(threadId: string, content: string, attachments?: readonly AttachmentPart[]): void {
const t = this.mustGet(threadId);
if (t.info.archived === true) {
throw new ThreadOpError('not-ready', 'the thread is archived — resume it first');
@@ -1805,13 +1848,15 @@ export class AcpThreadManager {
if (!t.turnActive) {
// Nothing to steer away from — a correction with no run to correct is
// just a message.
- this.dispatchPrompt(t, content, { echo: true });
+ this.dispatchPrompt(t, content, attachments, { echo: true });
return;
}
// Latest correction wins: a second steer replaces the parked one (and its
// countdown) rather than lining up behind it.
this.clearSteer(t);
- t.info.steer = { content, ts: Date.now() };
+ const steer: SteerMessage = { content, ts: Date.now() };
+ if (attachments !== undefined && attachments.length > 0) steer.attachments = attachments;
+ t.info.steer = steer;
t.info.lastActivityAt = Date.now();
this.emitInfo(t);
const timer = setTimeout(() => this.demoteStalledSteer(t), this.steerStallMs);
@@ -1836,10 +1881,19 @@ export class AcpThreadManager {
// Deliberately allowed to exceed MAX_QUEUED_PROMPTS by one. That cap gates
// NEW sends; dropping a correction the user already committed to (or
// evicting someone else's queued message to make room) is the worse trade.
- t.info.queue = [
- { id: crypto.randomUUID(), content: steer.content, ts: steer.ts },
- ...(t.info.queue ?? []),
- ];
+ // Preserve steer.attachments — the user attached files to the correction,
+ // and a demotion that dropped them would send a different message than
+ // the one they typed. Optional so the wire shape matches other queued
+ // messages that ride without attachments.
+ const demoted: QueuedMessage = {
+ id: crypto.randomUUID(),
+ content: steer.content,
+ ts: steer.ts,
+ };
+ if (steer.attachments !== undefined && steer.attachments.length > 0) {
+ demoted.attachments = steer.attachments;
+ }
+ t.info.queue = [demoted, ...(t.info.queue ?? [])];
this.emitInfo(t);
}
@@ -1908,7 +1962,7 @@ export class AcpThreadManager {
if (t.info.archived === true || t.sessionId === null || t.conn === null) return;
const next = this.takeNextQueued(t);
if (next === null) return;
- this.dispatchPrompt(t, next.content, { echo: true });
+ this.dispatchPrompt(t, next.content, next.attachments, { echo: true });
}
/** Pop the next dispatchable queued prompt, or null. Held entries are
@@ -1927,7 +1981,11 @@ export class AcpThreadManager {
}
/** Adopt-title + append the `user_message` transcript event for a prompt. */
- private echoUserMessage(t: ThreadRecord, content: string): void {
+ private echoUserMessage(
+ t: ThreadRecord,
+ content: string,
+ attachments?: readonly AttachmentPart[],
+ ): void {
// The single choke point for every user message (launch prompt, interactive
// prompt, resume prompt) — mark the thread as touched so a later close
// archives it rather than discarding it as never-used.
@@ -1942,7 +2000,9 @@ export class AcpThreadManager {
this.appendEvent(t, { kind: 'title_changed', title: t.info.title, ts: Date.now() });
this.emitInfo(t);
}
- this.appendEvent(t, { kind: 'user_message', content, ts: Date.now() });
+ const event: ThreadEvent = { kind: 'user_message', content, ts: Date.now() };
+ if (attachments !== undefined && attachments.length > 0) event.attachments = attachments;
+ this.appendEvent(t, event);
}
/**
@@ -1977,12 +2037,17 @@ export class AcpThreadManager {
* resume path, whose optimistic echo already put the user message (and
* title adoption) in the transcript at resume start.
*/
- private dispatchPrompt(t: ThreadRecord, content: string, opts: { echo: boolean }): void {
+ private dispatchPrompt(
+ t: ThreadRecord,
+ content: string,
+ attachments: readonly AttachmentPart[] | undefined,
+ opts: { echo: boolean },
+ ): void {
if (t.sessionId === null || t.conn === null) {
throw new ThreadOpError('not-ready', 'thread has no live agent session');
}
if (opts.echo) {
- this.echoUserMessage(t, content);
+ this.echoUserMessage(t, content, attachments);
}
// Wire-only injection: the transcript (echo above) keeps the user's text;
// the agent additionally receives the environment note ahead of the first
@@ -2003,11 +2068,63 @@ export class AcpThreadManager {
this.emitStatus(t, 'running');
const sessionId = t.sessionId;
- t.conn.agent
- .request(acpMethods.agent.session.prompt, {
+ // Build the ACP prompt payload. Attachment conversion (fs reads,
+ // capability gating, base64 encoding) is async; the outbound ACP
+ // request has to wait for it, but the turn-started event has already
+ // fired so the user sees the run as engaged.
+ const promptBuild = buildPromptBlocks(
+ wireText,
+ attachments,
+ t.info.promptCapabilities,
+ (requested) => this.confinePath(requested).then(({ abs, rel }) => ({ abs, rel })),
+ );
+ const requestPromise = promptBuild.then((built) => {
+ if (built.dropped.length > 0) {
+ this.opts.log.warn(
+ {
+ threadId: t.info.threadId,
+ dropped: built.dropped.map((d) => ({ kind: d.part.kind, reason: d.reason })),
+ },
+ '[acp-threads] dropped attachment parts before session/prompt',
+ );
+ // Surface each drop in the transcript so the user learns WHY an
+ // attachment they meant to send went missing (path escape, stat
+ // failure, missing capability). The server-only log is fine for
+ // post-mortem but invisible in the moment. Uses `agent_stderr`
+ // per the `attachment-blocks.ts` contract — soft, non-fatal,
+ // transcript-visible, the same surface the agent's own stderr rides.
+ const dropTs = Date.now();
+ for (const d of built.dropped) {
+ const label =
+ d.part.kind === 'image' || d.part.kind === 'blob'
+ ? d.part.name
+ : d.part.name || d.part.path;
+ this.appendEvent(t, {
+ kind: 'agent_stderr',
+ line: `[attachment dropped] ${label}: ${d.reason}`,
+ ts: dropTs,
+ });
+ }
+ }
+ if (t.sessionId === null || t.conn === null) {
+ throw new ThreadOpError('not-ready', 'thread has no live agent session');
+ }
+ // A Stop that lands while we're building the payload (fs realpath +
+ // stat per file/folder attachment) races the outbound send. Without
+ // this guard the cancel notification would fire against a session
+ // that hasn't received session/prompt yet, and the prompt would then
+ // arrive and run to completion — the exact turn the user cancelled.
+ // Throwing routes cleanup through the existing catch, which honors
+ // `cancelRequested` and emits `turn_ended cancelled`.
+ if (t.cancelRequested) {
+ throw new PromptCancelledBeforeDispatchError();
+ }
+ return t.conn.agent.request(acpMethods.agent.session.prompt, {
sessionId,
- prompt: [{ type: 'text', text: wireText }],
- })
+ prompt: [...built.blocks],
+ });
+ });
+ requestPromise
.then((response) => {
t.turnActive = false;
if (t.closed) return;
@@ -2025,12 +2142,12 @@ export class AcpThreadManager {
// for it, so it cannot wait behind messages queued before it.
const steer = this.takeSteer(t);
if (steer !== null) {
- this.dispatchPrompt(t, steer.content, { echo: true });
+ this.dispatchPrompt(t, steer.content, steer.attachments, { echo: true });
return;
}
const next = this.takeNextQueued(t);
if (next !== null) {
- this.dispatchPrompt(t, next.content, { echo: true });
+ this.dispatchPrompt(t, next.content, next.attachments, { echo: true });
return;
}
}
@@ -2046,7 +2163,7 @@ export class AcpThreadManager {
if (t.sessionId !== null && t.conn !== null) {
const steer = this.takeSteer(t);
if (steer !== null) {
- this.dispatchPrompt(t, steer.content, { echo: true });
+ this.dispatchPrompt(t, steer.content, steer.attachments, { echo: true });
return;
}
}
diff --git a/packages/server/src/acp/thread-socket.ts b/packages/server/src/acp/thread-socket.ts
index 3ee29d44a..4136e315c 100644
--- a/packages/server/src/acp/thread-socket.ts
+++ b/packages/server/src/acp/thread-socket.ts
@@ -67,6 +67,7 @@ export function attachAcpThreadSocket(
const info = await manager.createThread({
agent: frame.agent,
prompt: frame.prompt,
+ attachments: frame.attachments,
docName: frame.docName,
titleHint: frame.titleHint,
settings: frame.settings,
@@ -82,7 +83,11 @@ export function attachAcpThreadSocket(
return;
}
case 'resume': {
- const info = await manager.resumeThread(frame.threadId, frame.prompt);
+ const info = await manager.resumeThread(
+ frame.threadId,
+ frame.prompt,
+ frame.attachments,
+ );
send({ op: 'resumed', reqId: frame.reqId, info });
// Resuming implies interest, same as create. Usually a no-op —
// the client opened (and subscribed to) the archived tab first.
@@ -118,11 +123,11 @@ export function attachAcpThreadSocket(
return;
}
case 'prompt': {
- manager.sendPrompt(frame.threadId, frame.content);
+ manager.sendPrompt(frame.threadId, frame.content, frame.attachments);
return;
}
case 'steer': {
- manager.steerPrompt(frame.threadId, frame.content);
+ manager.steerPrompt(frame.threadId, frame.content, frame.attachments);
return;
}
case 'queue_edit': {