@oversk7/pi-web-dsh-style 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/web/i18n.js CHANGED
@@ -1,6 +1,10 @@
1
1
  // Browser-only UI copy. Chinese is the source language; unknown text (including
2
2
  // user messages, paths and server responses) is left untouched.
3
3
  const english = {
4
+ "查看结果": "View result", "结果来源": "Result from", "执行结果": "Agent result", "当前进展": "Progress", "执行记录": "Execution transcript", "状态": "Status", "失败原因": "Failure reason", "等待执行": "Pending", "已取消": "Canceled", "正在获取结果": "Fetching result", "子 agent 仍在运行,尚无结果。": "The agent is still running; no result yet.", "暂无结果内容。": "No result content available.",
5
+ "类型": "Type", "委派任务": "Delegated task", "提示词": "Prompt", "结果": "Result", "补充指令": "Additional instructions", "目标 agent": "Target agent", "指令内容": "Instruction content",
6
+ "当前运行时未提供完整指令内容。请等待所有会话空闲,在设置 → 维护中重新加载运行时,然后刷新页面。": "The current runtime did not provide the full instructions. Wait until all sessions are idle, reload the runtime in Settings → Maintenance, then refresh the page.",
7
+ "当前运行时未提供完整提示词。请等待所有会话空闲,在设置 → 维护中重新加载运行时,然后刷新页面。": "The current runtime did not provide the full prompt. Wait until all sessions are idle, reload the runtime in Settings → Maintenance, then refresh the page.",
4
8
  "刚刚": "just now", "选择模型": "Select model", "内置": "Built-in", "模板": "Prompt", "扩展": "Extension", "技能": "Skill", "命令": "Command",
5
9
  "文件预览": "File preview", "文件": "File", "正在读取": "Reading", "无法预览": "Preview unavailable", "正在加载文件…": "Loading file…", "文件预览失败": "File preview failed", "预览": "Preview", "源代码": "Source code", "返回对话": "Back to chat", "查看源码": "View source", "查看预览": "View preview", "源码": "Source", "在系统文件管理器中定位": "Show in file manager", "关闭预览": "Close preview", "纯文本模式": "Plain text mode",
6
10
  "关闭侧边栏": "Close sidebar", "调整侧边栏宽度": "Resize sidebar", "调整文件预览宽度": "Resize file preview", "可拖动排序": "drag to reorder", "新会话": "New session", "等待输入": "Waiting for input", "会话操作": "Session actions", "工作区操作": "Workspace actions", "新建会话": "New session", "没有匹配的会话": "No matching sessions", "暂无会话": "No sessions yet", "没有工作区。点击 + 添加一个目录。": "No workspaces. Click + to add a folder.", "收起侧边栏": "Collapse sidebar", "展开侧边栏": "Expand sidebar", "工作区": "Workspaces", "搜索会话": "Search sessions", "搜索会话…": "Search sessions…", "视图选项": "View options", "添加工作区": "Add workspace", "会话": "Sessions", "设置": "Settings", "选择工作区": "Select workspace", "和你的代码库对话": "Chat with your codebase", "Web 预览版": "Web preview", "正在创建会话…": "Creating session…", "这个会话由 pi coding agent 驱动": "This session runs on pi coding agent",
package/web/markdown.ts CHANGED
@@ -6,7 +6,7 @@ import powershell from "highlight.js/lib/languages/powershell";
6
6
  hljs.registerLanguage("dockerfile", dockerfile);
7
7
  hljs.registerLanguage("powershell", powershell);
8
8
 
9
- function localFileLink(target: string) {
9
+ function localFileLink(target: string, workspace = false) {
10
10
  let value = target.trim();
11
11
  let line: number | null = null;
12
12
  const location = /#L(\d+)(?:C\d+)?$/i.exec(value) || /:(\d+)(?::\d+)?$/.exec(value);
@@ -22,7 +22,15 @@ function localFileLink(target: string) {
22
22
  }
23
23
  }
24
24
  value = value.replace(/^\/([A-Za-z]:[\\/])/, "$1");
25
- if (!/^[A-Za-z]:[\\/]/.test(value) && !/^\\\\[^\\]+\\[^\\]+/.test(value)) return null;
25
+ if (!/^[A-Za-z]:[\\/]/.test(value) && !/^\\\\[^\\]+\\[^\\]+/.test(value)) {
26
+ if (!workspace || /^[a-z][a-z\d+.-]*:|^\/\//i.test(value) || /[?#]/.test(value)) return null;
27
+ if (!/\.(?:md|markdown|mdx|txt|html?|css|[cm]?[jt]sx?|json|ya?ml|toml|py|rs|go|java|c|cpp|h|hpp|cs|sh|ps1|sql|xml|csv)$/i.test(value)) return null;
28
+ try {
29
+ value = decodeURIComponent(value).replace(/^\/+/, "");
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
26
34
  const href = `/api/fs/view?path=${encodeURIComponent(value)}${line ? `#L${line}` : ""}`;
27
35
  return { path: value, line, href };
28
36
  }
@@ -52,7 +60,7 @@ parser.validateLink = (target) => Boolean(localFileLink(target)) || validateLink
52
60
  parser.renderer.rules.link_open = (tokens, index, options, env, renderer) => {
53
61
  const token = tokens[index];
54
62
  const target = String(token.attrGet("href") || "");
55
- const local = localFileLink(target);
63
+ const local = localFileLink(target, true);
56
64
  if (local) {
57
65
  token.attrSet("href", local.href);
58
66
  token.attrJoin("class", "md-local-file");