Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(chat): copy a recognised file's full or relative address

vastsa63486e88e237
diff --git a/apps/desktop/src/hooks/use-chat-file-menu.tsx b/apps/desktop/src/hooks/use-chat-file-menu.tsx
index 8279fab9c..e41bcd5d8 100644
--- a/apps/desktop/src/hooks/use-chat-file-menu.tsx
+++ b/apps/desktop/src/hooks/use-chat-file-menu.tsx
@@ -17,8 +17,8 @@
import { useCallback, type MouseEvent as ReactMouseEvent } from "react";
import { useTranslation } from "react-i18next";
import { useContextMenu, type ContextMenuItem } from "../components/ContextMenu";
-import { IconFolderOpen } from "../components/icons";
-import { useRevealChatFileRef } from "./use-preview-target";
+import { IconCopy, IconFolderOpen } from "../components/icons";
+import { useCopyChatFileRef, useRevealChatFileRef } from "./use-preview-target";
export type ChatFileMenuTarget = {
/** The reference as the surface spelled it, before completion. */
@@ -30,6 +30,7 @@ export type ChatFileMenuTarget = {
export function useChatFileMenuItems() {
const { t } = useTranslation();
const revealFileRef = useRevealChatFileRef();
+ const copyFileRef = useCopyChatFileRef();
return useCallback(
({ path, baseDir }: ChatFileMenuTarget): ContextMenuItem[] => [
{
@@ -38,8 +39,21 @@ export function useChatFileMenuItems() {
icon: <IconFolderOpen size={14} />,
onSelect: () => revealFileRef(path, baseDir),
},
+ {
+ id: "copy-full-path",
+ label: t("chat.copyFullPath"),
+ icon: <IconCopy size={14} />,
+ separatorBefore: true,
+ onSelect: () => copyFileRef(path, baseDir, "absolute"),
+ },
+ {
+ id: "copy-relative-path",
+ label: t("chat.copyRelativePath"),
+ icon: <IconCopy size={14} />,
+ onSelect: () => copyFileRef(path, baseDir, "relative"),
+ },
],
- [revealFileRef, t],
+ [copyFileRef, revealFileRef, t],
);
}
diff --git a/apps/desktop/src/hooks/use-preview-target.ts b/apps/desktop/src/hooks/use-preview-target.ts
index 089cfca19..7f6839289 100644
--- a/apps/desktop/src/hooks/use-preview-target.ts
+++ b/apps/desktop/src/hooks/use-preview-target.ts
@@ -58,8 +58,10 @@ function isDotRelative(path: string): boolean {
export type ResolvedChatFileRef = {
/** The address the host accepts for this reference. */
path: string;
- /** The primary folder's own spelling; workspace-relative surfaces take this. */
- relativePath: string;
+ /** The absolute path; the one spelling that resolves from anywhere. */
+ absolutePath: string;
+ /** Project-relative spelling; null when the file sits outside the project. */
+ relativePath: string | null;
/** True for a match inside a folder the open project registers (ADR 0249). */
inProject: boolean;
/** True when that folder is the project's primary one. */
@@ -98,7 +100,8 @@ function useResolveChatFileRef() {
if (match.root !== "workspace") {
return {
path: match.absolutePath,
- relativePath: match.absolutePath,
+ absolutePath: match.absolutePath,
+ relativePath: null,
inProject: false,
primary: false,
};
@@ -109,6 +112,7 @@ function useResolveChatFileRef() {
const primary = match.projectRoot ? match.projectRoot.primary : true;
return {
path: primary ? match.relativePath : match.absolutePath,
+ absolutePath: match.absolutePath,
relativePath: match.relativePath,
inProject: true,
primary,
@@ -147,6 +151,7 @@ export function useOpenChatFileRef() {
if (
resolved.inProject &&
resolved.primary &&
+ resolved.relativePath &&
isHtmlFilePath(resolved.relativePath)
) {
openUrl(resolved.relativePath);
@@ -191,3 +196,44 @@ export function useRevealChatFileRef() {
[resolveRef, showToast, t],
);
}
+
+/**
+ * Copy a reference as an address a user can paste somewhere else.
+ *
+ * "Full" is the absolute path, the one spelling that resolves from any working
+ * directory. "Relative" is the project-relative spelling, and only a file
+ * inside the open project has one: a scratch or attachment file says so
+ * instead of handing back an absolute path under a name that promises
+ * something else.
+ */
+export function useCopyChatFileRef() {
+ const { t } = useTranslation();
+ const resolveRef = useResolveChatFileRef();
+ const showToast = useAppStore((s) => s.showToast);
+
+ return useCallback(
+ (
+ path: string,
+ baseDir: string | undefined,
+ kind: "absolute" | "relative",
+ ) => {
+ void (async () => {
+ const resolved = await resolveRef(path, baseDir);
+ if (!resolved) return;
+ const value =
+ kind === "absolute" ? resolved.absolutePath : resolved.relativePath;
+ if (!value) {
+ showToast(t("chat.relativePathUnavailable"), { variant: "error" });
+ return;
+ }
+ try {
+ await navigator.clipboard.writeText(value);
+ showToast(t("chat.copied"), { variant: "success" });
+ } catch {
+ showToast(t("chat.copyFailed"), { variant: "error" });
+ }
+ })();
+ },
+ [resolveRef, showToast, t],
+ );
+}
diff --git a/apps/desktop/test/chat-file-reveal-menu.test.mjs b/apps/desktop/test/chat-file-reveal-menu.test.mjs
index 3d5a3bc3a..1292c90b8 100644
--- a/apps/desktop/test/chat-file-reveal-menu.test.mjs
+++ b/apps/desktop/test/chat-file-reveal-menu.test.mjs
@@ -69,6 +69,25 @@ const state = {
let nextMatch = null;
let revealFails = false;
+
+let clipboardFails = false;
+const copied = [];
+
+/*
+ The hooks read `navigator.clipboard` off the global, exactly as the app does,
+ so what a copy claims is asserted against what actually reached the clipboard.
+*/
+Object.defineProperty(globalThis, "navigator", {
+ value: {
+ clipboard: {
+ writeText: async (value) => {
+ if (clipboardFails) throw new Error("clipboard refused");
+ copied.push(value);
+ },
+ },
+ },
+ configurable: true,
+});
const translate = () => ({
t: (key, values) => `${key}:${values?.name ?? ""}`,
});
@@ -100,7 +119,7 @@ const { useChatFileMenu, useChatFileMenuItems } = loadModule(
react: React,
"react/jsx-runtime": jsxRuntime,
"react-i18next": { useTranslation: translate },
- "../components/icons": { IconFolderOpen: () => null },
+ "../components/icons": { IconCopy: () => null, IconFolderOpen: () => null },
"../components/ContextMenu": {
useContextMenu: () => ({
contextMenu: null,
@@ -118,6 +137,7 @@ function reset(match) {
Object.values(calls).forEach((list) => list.splice(0, list.length));
nextMatch = match;
revealFails = false;
+ clipboardFails = false;
}
/** The match the main process reports for a file of the project's main folder. */
@@ -213,7 +233,7 @@ test("a refused reveal is reported instead of failing silently", async () => {
);
});
-test("the menu a reference opens carries that one item and nothing else", () => {
+test("the menu a reference opens carries the reveal and both copies", () => {
reset(projectMatch());
let openFileMenu = null;
function Harness() {
@@ -224,7 +244,90 @@ test("the menu a reference opens carries that one item and nothing else", () =>
openFileMenu({}, { path: "src/dir/a.ts" });
assert.deepEqual(
calls.menus.map((menu) => menu.items.map((item) => [item.id, item.label])),
- [[["reveal-in-folder", "chat.revealFileInFolder:"]]],
+ [
+ [
+ ["reveal-in-folder", "chat.revealFileInFolder:"],
+ ["copy-full-path", "chat.copyFullPath:"],
+ ["copy-relative-path", "chat.copyRelativePath:"],
+ ],
+ ],
+ );
+});
+
+/** Run one copy item of the reference menu on the reference it names. */
+async function copyRef(path, kind) {
+ let copy = null;
+ let items = null;
+ function Harness() {
+ copy = previewTarget.useCopyChatFileRef();
+ items = useChatFileMenuItems()({ path });
+ return null;
+ }
+ renderToStaticMarkup(React.createElement(Harness));
+ const id = kind === "absolute" ? "copy-full-path" : "copy-relative-path";
+ const item = items.find((entry) => entry.id === id);
+ assert.ok(item, "the reference offers the copy");
+ copy(path, undefined, kind);
+ await flush();
+}
+
+test("a project file copies its full address and its project-relative one", async () => {
+ reset(projectMatch());
+ copied.length = 0;
+ await copyRef("src/dir/a.ts", "absolute");
+ await copyRef("src/dir/a.ts", "relative");
+ assert.deepEqual(copied, ["C:/project/src/dir/a.ts", "src/dir/a.ts"]);
+ assert.deepEqual(
+ calls.toasts.map(([message]) => message),
+ ["chat.copied:", "chat.copied:"],
+ );
+});
+
+test("a sibling folder file copies its full address and its own relative one", async () => {
+ reset(
+ projectMatch({
+ relativePath: "lib/only-here.ts",
+ absolutePath: "C:/project-second/lib/only-here.ts",
+ projectRoot: { primary: false },
+ }),
+ );
+ copied.length = 0;
+ await copyRef("lib/only-here.ts", "absolute");
+ await copyRef("lib/only-here.ts", "relative");
+ assert.deepEqual(copied, [
+ "C:/project-second/lib/only-here.ts",
+ "lib/only-here.ts",
+ ]);
+});
+
+test("a file outside the project has nothing relative to copy", async () => {
+ reset({
+ root: "scratch",
+ relativePath: "notes.md",
+ absolutePath: "C:/data/scratch/session-1/notes.md",
+ matchedBy: "exact-relative",
+ });
+ copied.length = 0;
+ await copyRef("notes.md", "absolute");
+ await copyRef("notes.md", "relative");
+ // The full address is still the file's own; the relative one is refused
+ // instead of handing back the absolute path under that name.
+ assert.deepEqual(copied, ["C:/data/scratch/session-1/notes.md"]);
+ assert.deepEqual(
+ calls.toasts.map(([message]) => message),
+ ["chat.copied:", "chat.relativePathUnavailable:"],
+ );
+});
+
+test("a refused clipboard reports itself", async () => {
+ reset(projectMatch());
+ copied.length = 0;
+ clipboardFails = true;
+ await copyRef("src/dir/a.ts", "absolute");
+ assert.deepEqual(copied, []);
+ assert.deepEqual(
+ calls.toasts.map(([message]) => message),
+ ["chat.copyFailed:"],
);
});
@@ -282,11 +385,15 @@ test("a URL never reaches the reveal", () => {
assert.ok(markdown.includes('if (!/^https?:\\/\\//i.test(href)) {'));
});
-test("the reveal labels ship in the catalogs the menu reads", () => {
+test("the reference labels ship in the catalogs the menu reads", () => {
const en = read("../../../packages/i18n/src/locales/en/index.ts");
const zhCN = read("../../../packages/i18n/src/locales/zh-CN/index.ts");
assert.match(en, /revealFileInFolder: "Show in folder"/);
assert.match(en, /fileRevealFailed: "Could not show the file in its folder\."/);
+ assert.match(en, /copyFullPath: "Copy full path"/);
+ assert.match(en, /copyRelativePath: "Copy relative path"/);
assert.match(zhCN, /revealFileInFolder: "在文件夹中显示"/);
assert.match(zhCN, /fileRevealFailed: "无法在文件夹中打开该文件。"/);
+ assert.match(zhCN, /copyFullPath: "复制完整地址"/);
+ assert.match(zhCN, /copyRelativePath: "复制相对地址"/);
});
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 73044e422..8920792e6 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -3224,11 +3224,13 @@ Anatomy:
primary-folder file is addressed to the view as a project-relative path and a
sibling-folder file as an absolute one, which is also how scratch and
attachment files are addressed. A reference that matches no file opens nothing
- and reports itself, as does right-clicking it: the file-reference menu's item
- shows the file in the system file manager, and the same item is offered on a
- sent `@path` chip, an inline code span, a markdown link, a local image, a tool
- row's file path, and a path in a tool result's file or match list, through the
- same completion and the same address.
+ and reports itself, as does right-clicking it: the file-reference menu offers
+ that file's own folder in the system file manager and copies its full path or
+ its project-relative path. The same items are offered on a sent `@path` chip,
+ an inline code span, a markdown link, a local image, a tool row's file path,
+ and a path in a tool result's file or match list, through the same completion
+ and the same address; a file outside the project has no relative path to copy
+ and says so instead.
The OS default application is no longer what this click does. HTTP(S)
URLs stay text links. Plain clicks follow the Link open destination setting,
and right-clicking a URL exposes the same external, work-panel, and copy
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index e5df405cf..68ca8db77 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -1283,13 +1283,15 @@ Project drag/drop follows these patterns:
travels as a project-relative path, a file of a sibling folder of the same
project as an absolute one, exactly as a scratch or attachment file does. A
chip whose reference matches nothing opens nothing and reports itself, and so
- does a right-click on it: the file-reference menu's item — offered on every
+ does a right-click on it: the file-reference menu — offered on every
reference the transcript renders, a sent `@path` chip, an inline code span, a
local link, a local image, a tool row's own file path, a path in a tool
result's file or match list, and an image attachment's thumbnail — shows the
file in the system file manager through that same completion and that same
- address. The OS default application is no longer what this click does, though
- that action stays reachable from the file view's own context menu.
+ address, and copies that file's full path or its project-relative path. A file
+ outside the project has no relative path to copy and says so. The OS default
+ application is no longer what this click does, though that action stays
+ reachable from the file view's own context menu.
- The same destination rule governs every other surface of the transcript that
names a file, because one opener serves them all: clicking the file path in a
tool row's summary (Read, Write, Edit, fetch) and clicking a path in a tool
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 54a8e02d9..f840fd140 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -11587,14 +11587,20 @@ are withdrawn with ADR 0165.
project's second folder, then one that resolves in its primary folder. 8)
Right-click the sent `@path` chip, the inline-code reference, the markdown
link, the local image, a tool row's file path, a tool result's file list, and
- an attachment thumbnail; then right-click a reference that matches nothing.
+ an attachment thumbnail; then right-click a reference that matches nothing. 9)
+ On that chip, use Copy full path and Copy relative path, then do the same on a
+ reference that resolves in the session scratch store.
- **Expected**:
- - Right-clicking a file reference opens the renderer's own menu with one
- item, Show in folder, which reveals the named file in the system file
- manager. The inline-code reference, the file link, the local image, a tool
- row's path, a tool result's file or match list, and an attachment thumbnail
- offer the same item, and a reference that matches nothing reports itself
- instead of revealing a same-named file elsewhere.
+ - Right-clicking a file reference opens the renderer's own menu with the
+ file's own folder (Show in folder) and both of its addresses (Copy full
+ path, Copy relative path). The inline-code reference, the file link, the
+ local image, a tool row's path, a tool result's file or match list, and an
+ attachment thumbnail offer the same items, and a reference that matches
+ nothing reports itself instead of revealing a same-named file elsewhere.
+ - A copy writes exactly what it names: the absolute address for the full copy
+ and the project-relative spelling for the relative one; a scratch or
+ attachment file reports that it has no relative path instead of copying an
+ absolute one under that name.
- A project file opens in the File Manager work-panel view on that file, with
its ancestor folders expanded and the file selected; no host `file:` tab is
added for it.
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index e8d4ea5e7..0c6a61a5b 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -2247,7 +2247,7 @@ MainChat 底部的输入区域,用于撰写和发送提示。支持多行输
切换会话或项目、删除正在查看的附件时关闭预览;晚到的读取结果不得覆盖新图片。
- 发送的模板调用在记录中呈现为等宽命令
来自消息的 `command` 字段的芯片而不是扩展的正文。
-- 已发送的 `@path` 文件引用(带引号或不带引号)画成与草稿相同的叶子名芯片。点击芯片先经 `pi-desktop/fs/resolveRef` 补全引用——搜索整个打开的项目,按项目组文件夹顺序、主文件夹优先(ADR 0263)——再按解析结果打开:项目文件在随应用打包的 `pi.file-manager` 视图中打开(该视图不可用时退回宿主 `file:` 选项卡),会话临时目录或附件文件在宿主 `file:` 选项卡中打开,主文件夹中的 `.html`/`.htm` 在侧边浏览器打开。交给该视图的地址跟随应答的文件夹:主文件夹中的文件用项目内相对路径传递,同一项目的同级文件夹中的文件用绝对路径传递,与会话临时目录和附件文件一致。什么都没匹配到时既不打开任何东西,也会自己报告出来,右键该芯片也一样;引用菜单里的那一条在系统文件管理器中显示该文件,发送的 `@path` 芯片、消息 Markdown 中的行内代码、本地链接与本地图片、工具行自己的文件路径、工具结果的文件列表或匹配列表中的路径、图片附件缩略图都提供同一条,并同样经这次补全与这套寻址规则。系统默认应用不再由这次点击触发。HTTP(S) URL 仍是侧边浏览器的文本链接。
+- 已发送的 `@path` 文件引用(带引号或不带引号)画成与草稿相同的叶子名芯片。点击芯片先经 `pi-desktop/fs/resolveRef` 补全引用——搜索整个打开的项目,按项目组文件夹顺序、主文件夹优先(ADR 0263)——再按解析结果打开:项目文件在随应用打包的 `pi.file-manager` 视图中打开(该视图不可用时退回宿主 `file:` 选项卡),会话临时目录或附件文件在宿主 `file:` 选项卡中打开,主文件夹中的 `.html`/`.htm` 在侧边浏览器打开。交给该视图的地址跟随应答的文件夹:主文件夹中的文件用项目内相对路径传递,同一项目的同级文件夹中的文件用绝对路径传递,与会话临时目录和附件文件一致。什么都没匹配到时既不打开任何东西,也会自己报告出来,右键该芯片也一样;引用菜单除了在系统文件管理器中显示该文件,还提供复制完整地址与复制相对地址,发送的 `@path` 芯片、消息 Markdown 中的行内代码、本地链接与本地图片、工具行自己的文件路径、工具结果的文件列表或匹配列表中的路径、图片附件缩略图都提供同样的几项,并同样经这次补全与这套寻址规则;项目外的文件没有相对地址,会直接说明。系统默认应用不再由这次点击触发。HTTP(S) URL 仍是侧边浏览器的文本链接。
- 状态:键盘活动行使用共享 `kb-active` 处理;空的
查询列出所有内容(斜杠)/最近索引的顺序(文件);零
匹配呈现本地化的空行并且菜单计为关闭
diff --git a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
index d894b692d..f30e81896 100644
--- a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
+++ b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
@@ -1022,7 +1022,7 @@ Mode/provider/model/permission/shell 配置和新提示仍然存在
撤消发送。该撤消操作将恢复原始芯片顺序和标签;它
从不解析序列化的 `@path` 文本。一旦回复内容开始,中止就会继续
部分抄本,不恢复草稿。
-- 发送成功后,用户气泡仅把这些序列化的 `@path` 标记解析回与输入框一致的叶子名芯片用于展示。持久化消息和模型上下文仍是规范 `@path` 文本。点击芯片先经 `pi-desktop/fs/resolveRef` 补全引用——该通道搜索整个打开的项目,按项目组自身的文件夹顺序、主文件夹优先(ADR 0263)——再按解析结果打开:项目文件在随应用打包的 `pi.file-manager` 工作面板视图中打开(该视图不可用时退回宿主 `file:` 选项卡),会话临时目录或附件文件在宿主 `file:` 选项卡中打开,项目主文件夹中的 `.html`/`.htm` 页面仍在侧边浏览器中打开,因为侧边浏览器本就以该文件夹为根。交给工作面板的地址跟随应答的文件夹:主文件夹中的文件按项目内相对路径传递,同一项目的同级文件夹中的文件按绝对路径传递,与会话临时目录或附件文件一致。什么都没匹配到的芯片不打开任何东西,而是自己报告出来,右键这类芯片也一样;引用菜单里的那一条——发送的 `@path` 芯片、消息 Markdown 中的行内代码、本地链接与本地图片、工具行自己的文件路径、工具结果的文件列表或匹配列表中的路径、图片附件缩略图都提供同一条——经同一补全与同一寻址规则在系统文件管理器中显示该文件。系统默认应用不再由这次点击触发,该动作仍可从文件视图自己的右键菜单使用。
+- 发送成功后,用户气泡仅把这些序列化的 `@path` 标记解析回与输入框一致的叶子名芯片用于展示。持久化消息和模型上下文仍是规范 `@path` 文本。点击芯片先经 `pi-desktop/fs/resolveRef` 补全引用——该通道搜索整个打开的项目,按项目组自身的文件夹顺序、主文件夹优先(ADR 0263)——再按解析结果打开:项目文件在随应用打包的 `pi.file-manager` 工作面板视图中打开(该视图不可用时退回宿主 `file:` 选项卡),会话临时目录或附件文件在宿主 `file:` 选项卡中打开,项目主文件夹中的 `.html`/`.htm` 页面仍在侧边浏览器中打开,因为侧边浏览器本就以该文件夹为根。交给工作面板的地址跟随应答的文件夹:主文件夹中的文件按项目内相对路径传递,同一项目的同级文件夹中的文件按绝对路径传递,与会话临时目录或附件文件一致。什么都没匹配到的芯片不打开任何东西,而是自己报告出来,右键这类芯片也一样;引用菜单里的那一条——发送的 `@path` 芯片、消息 Markdown 中的行内代码、本地链接与本地图片、工具行自己的文件路径、工具结果的文件列表或匹配列表中的路径、图片附件缩略图都提供同一条——经同一补全与同一寻址规则在系统文件管理器中显示该文件,并复制该文件的完整地址或项目相对地址(项目外的文件没有相对地址,菜单会直接说明)。系统默认应用不再由这次点击触发,该动作仍可从文件视图自己的右键菜单使用。
### 8a.3 打开时的键盘
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 31f497089..82e9eac47 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -6954,7 +6954,7 @@ eleven-tool-round desktop paths are verified by
#### E2E-180:已发送的文件引用保持芯片并可点击打开
- **前提条件**:Agent 会话所在工作区含有嵌套源文件、HTML 文件,以及文件名带空格的文件;该项目组还有一个第二文件夹,里面有一个属于它自己的源文件。输入框也可以把操作系统文件粘贴到会话临时目录。内置的文件管理器插件已加载。
-- **步骤**:1)通过输入框芯片引用工作区源文件、工作区 HTML、带空格的文件名,以及粘贴的临时文件,然后发送。2)查看用户气泡。3)点击 HTML 芯片,再点击工作区源文件芯片,最后点击临时目录芯片。4)附加上项目第二个文件夹里的文件,并点击它的芯片。5)右键那条已发送的 `@path` 芯片、助手 Markdown 里的行内代码引用、文件链接、本地图片、工具行自己的文件路径、工具结果的文件列表,以及附件缩略图,再右键一个什么都没匹配到的引用。
+- **步骤**:1)通过输入框芯片引用工作区源文件、工作区 HTML、带空格的文件名,以及粘贴的临时文件,然后发送。2)查看用户气泡。3)点击 HTML 芯片,再点击工作区源文件芯片,最后点击临时目录芯片。4)附加上项目第二个文件夹里的文件,并点击它的芯片。5)右键那条已发送的 `@path` 芯片、助手 Markdown 里的行内代码引用、文件链接、本地图片、工具行自己的文件路径、工具结果的文件列表,以及附件缩略图,再右键一个什么都没匹配到的引用。6)在那条芯片上依次复制完整地址与相对地址,再对临时目录里的引用做同样两步。
- **预期**:
- 每条已发送引用画成紧凑的叶子名芯片(图标 + 名称),而不是完整 `@path`。工具提示和无障碍名称保留规范路径。带引号路径和临时绝对路径也包括在内。
- 芯片加上短提示时,用户气泡按内容收缩,而不是撑到 `min(82%, 600px)` 上限。
@@ -6962,7 +6962,7 @@ eleven-tool-round desktop paths are verified by
- 点击工作区源文件芯片后,该文件在文件管理器工作面板视图中打开;芯片点击不再打开宿主的 `file:` 选项卡,也不再交给系统默认应用。
- 点击临时目录芯片时,文件在宿主的 `file:` 选项卡中按其绝对路径打开——它位于文件管理器项目根之外。
- 点击项目第二个文件夹里那个文件的芯片时,该文件在文件管理器视图中打开:补全会搜索整个项目组、主文件夹优先,同级文件夹里的文件用绝对路径寻址,因为相对路径永远指主文件夹(ADR 0263)。
- - 右键文件引用会打开渲染器自己的菜单,里面只有一条「在文件夹中显示」,它在系统文件管理器中显示该文件;助手 Markdown 里的行内代码引用、文件链接与本地图片、工具行自己的文件路径、工具结果的文件列表或匹配列表中的路径、图片附件缩略图都提供同一条,而什么都没匹配到的引用会自己报告出来,而不是去显示别处同名的那份文件。
+ - 右键文件引用会打开渲染器自己的菜单:在文件夹中显示该文件,并复制它的完整地址与相对地址;助手 Markdown 里的行内代码引用、文件链接与本地图片、工具行自己的文件路径、工具结果的文件列表或匹配列表中的路径、图片附件缩略图都提供这几项,而什么都没匹配到的引用会自己报告出来,而不是去显示别处同名的那份文件。复制写出的就是它说的地址:完整地址即绝对路径,相对地址即项目内相对写法;临时目录或附件文件没有相对地址,会直接说明,而不是把绝对路径当成相对地址写出去。
- 持久化用户消息仍包含给模型用的规范 `@path` 文本。
- **链接规格**:`04-ux/08-component-spec.md` §8.3 / §11.8、
`04-ux/09-interaction-patterns.md` §8a.2、`03-runtime/01-ipc-protocol.md`、
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 875fce59b..d819e2cdc 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -322,6 +322,9 @@ export const de = {
"fileRefMissing": "Keine Datei entspricht {{name}}",
"revealFileInFolder": "Im Ordner anzeigen",
"fileRevealFailed": "Die Datei konnte nicht im Ordner angezeigt werden.",
+ "copyFullPath": "Vollständigen Pfad kopieren",
+ "copyRelativePath": "Relativen Pfad kopieren",
+ "relativePathUnavailable": "Die Datei liegt außerhalb des Projekts und hat keinen relativen Pfad",
"previewUrl": "Im Seitenbrowser öffnen",
"openFile": "Mit Standardanwendung öffnen",
"retry": "Neu generieren",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index 0e3c49e2d..d18d00e36 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -329,6 +329,9 @@ export const en = {
fileRefMissing: "No file matches {{name}}",
revealFileInFolder: "Show in folder",
fileRevealFailed: "Could not show the file in its folder.",
+ copyFullPath: "Copy full path",
+ copyRelativePath: "Copy relative path",
+ relativePathUnavailable: "That file is outside the project, so it has no relative path",
previewUrl: "Open in the side browser",
openFile: "Open with default application",
retry: "Regenerate",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index b8d4d5008..3a2632d3c 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -322,6 +322,9 @@ export const es = {
"fileRefMissing": "Ningún archivo coincide con {{name}}",
"revealFileInFolder": "Mostrar en carpeta",
"fileRevealFailed": "No se pudo mostrar el archivo en su carpeta.",
+ "copyFullPath": "Copiar ruta completa",
+ "copyRelativePath": "Copiar ruta relativa",
+ "relativePathUnavailable": "El archivo está fuera del proyecto y no tiene ruta relativa",
"previewUrl": "Abrir en el navegador lateral",
"openFile": "Abrir con aplicación predeterminada",
"retry": "Regenerar",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index d07ebfb39..77d56037b 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -322,6 +322,9 @@ export const fr = {
"fileRefMissing": "Aucun fichier ne correspond à {{name}}",
"revealFileInFolder": "Afficher dans le dossier",
"fileRevealFailed": "Impossible d'afficher le fichier dans son dossier.",
+ "copyFullPath": "Copier le chemin complet",
+ "copyRelativePath": "Copier le chemin relatif",
+ "relativePathUnavailable": "Ce fichier est hors du projet et n'a pas de chemin relatif",
"previewUrl": "Ouvrir dans le navigateur latéral",
"openFile": "Ouvrir avec l'application par défaut",
"retry": "Régénérer la branche",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index f6cdd4cb5..9e8e1d289 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -331,6 +331,9 @@ export const ko = {
fileRefMissing: "{{name}}과(와) 일치하는 파일이 없습니다",
revealFileInFolder: "폴더에서 보기",
fileRevealFailed: "폴더에서 파일을 표시할 수 없습니다.",
+ copyFullPath: "전체 경로 복사",
+ copyRelativePath: "상대 경로 복사",
+ relativePathUnavailable: "이 파일은 프로젝트 밖에 있어 상대 경로가 없습니다",
previewUrl: "사이드 브라우저에서 열기",
openFile: "기본 애플리케이션으로 열기",
retry: "다시 생성",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index c93b3c5fd..15be5c3e8 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -320,6 +320,9 @@ export const ptBR = {
fileRefMissing: "Nenhum arquivo corresponde a {{name}}",
revealFileInFolder: "Mostrar na pasta",
fileRevealFailed: "Não foi possível mostrar o arquivo na pasta.",
+ copyFullPath: "Copiar caminho completo",
+ copyRelativePath: "Copiar caminho relativo",
+ relativePathUnavailable: "O arquivo está fora do projeto e não tem caminho relativo",
previewUrl: "Abrir no navegador lateral",
openFile: "Abrir no aplicativo padrão",
retry: "Regenerar",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index b39f4ed9a..ce71648a1 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -331,6 +331,9 @@ export const tr = {
fileRefMissing: "{{name}} ile eşleşen dosya yok",
revealFileInFolder: "Klasörde göster",
fileRevealFailed: "Dosya klasörde gösterilemedi.",
+ copyFullPath: "Tam yolu kopyala",
+ copyRelativePath: "Göreli yolu kopyala",
+ relativePathUnavailable: "Dosya proje dışında olduğu için göreli yolu yok",
previewUrl: "Yan tarayıcıda aç",
openFile: "Varsayılan uygulamayla aç",
retry: "Yeniden oluştur",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index e5d817d16..e9c773f81 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -323,6 +323,9 @@ export const zhCN = {
fileRefMissing: "没有匹配 {{name}} 的文件",
revealFileInFolder: "在文件夹中显示",
fileRevealFailed: "无法在文件夹中打开该文件。",
+ copyFullPath: "复制完整地址",
+ copyRelativePath: "复制相对地址",
+ relativePathUnavailable: "该文件不在项目内,没有相对地址",
previewUrl: "在侧边浏览器中打开",
openFile: "用系统默认应用打开",
retry: "重新生成",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 669228b1b..251f8215a 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -323,6 +323,9 @@ export const zhTW = {
fileRefMissing: "沒有匹配 {{name}} 的檔案",
revealFileInFolder: "在資料夾中顯示",
fileRevealFailed: "無法在資料夾中開啟該檔案。",
+ copyFullPath: "複製完整位址",
+ copyRelativePath: "複製相對位址",
+ relativePathUnavailable: "該檔案不在專案內,沒有相對位址",
previewUrl: "在側邊瀏覽器中開啟",
openFile: "用系統預設應用開啟",
retry: "重新生成",