@evandu/super-pi 0.1.320 → 0.1.321

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.
@@ -8,9 +8,9 @@
8
8
  <link rel="alternate icon" href="/favicon.ico" />
9
9
  <link rel="apple-touch-icon" href="/favicon.svg" />
10
10
  <title>Super Pi</title>
11
- <script type="module" crossorigin src="/assets/index-DMTJGkKw.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-D6OVl078.js"></script>
12
12
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
13
- <link rel="stylesheet" crossorigin href="/assets/index-B4HerJl4.css">
13
+ <link rel="stylesheet" crossorigin href="/assets/index-Dj33YA2I.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
17
17
 
@@ -38,7 +38,7 @@ type Frontmatter = Record<string, unknown>;
38
38
  */
39
39
  export declare const PI_TOOL_NAMES: readonly ["read", "bash", "powershell", "edit", "write", "grep", "find", "ls", "codemode", "tool_search", "list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource"];
40
40
  /** Tools shipped by this package. Authors must be able to explicitly deny host extras. */
41
- export declare const SUPER_PI_TOOL_NAMES: readonly ["task", "todowrite", "workflow", "run_async", "worktree", "scheduled_task", "project", "question", "tool_register", "tool_shortcut", "tool_remove", "memory", "skill_manage", "session_search", "agent_handbook", "user_tool", "user_tool_manage", "review_reply", "session_spawn", "session_status", "session_dispatch", "session_stop", "session_report", "session_stop_subtree", "session_remove", "session_reminder", "knowledge_search", "knowledge_import", "document_read", "document_write", "presentation_create", "presentation_read", "presentation_edit", "presentation_render", "web_search", "web_fetch", "feishu_doc_read", "feishu_doc_write"];
41
+ export declare const SUPER_PI_TOOL_NAMES: readonly ["task", "todowrite", "workflow", "run_async", "worktree", "scheduled_task", "project", "question", "tool_register", "tool_shortcut", "tool_remove", "memory", "skill_manage", "session_search", "agent_handbook", "user_tool", "user_tool_manage", "review_list", "review_reply", "session_spawn", "session_status", "session_dispatch", "session_stop", "session_report", "session_stop_subtree", "session_remove", "session_reminder", "knowledge_search", "knowledge_import", "document_read", "document_write", "presentation_create", "presentation_read", "presentation_edit", "presentation_render", "web_search", "web_fetch", "feishu_doc_read", "feishu_doc_write"];
42
42
  /**
43
43
  * Whether a name can be a real Pi tool. A name is real if it is one of `PI_TOOL_NAMES`, an MCP
44
44
  * server tool, or a PATTERN.
@@ -40,7 +40,7 @@ export const PI_TOOL_NAMES = [
40
40
  /** Tools shipped by this package. Authors must be able to explicitly deny host extras. */
41
41
  export const SUPER_PI_TOOL_NAMES = [
42
42
  "task", "todowrite", "workflow", "run_async", "worktree", "scheduled_task", "project", "question", "tool_register", "tool_shortcut", "tool_remove",
43
- "memory", "skill_manage", "session_search", "agent_handbook", "user_tool", "user_tool_manage", "review_reply",
43
+ "memory", "skill_manage", "session_search", "agent_handbook", "user_tool", "user_tool_manage", "review_list", "review_reply",
44
44
  "session_spawn", "session_status", "session_dispatch", "session_stop", "session_report", "session_stop_subtree", "session_remove", "session_reminder",
45
45
  "knowledge_search", "knowledge_import",
46
46
  "document_read", "document_write", "presentation_create", "presentation_read", "presentation_edit", "presentation_render", "web_search", "web_fetch", "feishu_doc_read", "feishu_doc_write",
@@ -1,21 +1,23 @@
1
- import type { ReviewThread } from "../shared/file-review.js";
1
+ import { type ReviewThread } from "../shared/file-review.js";
2
2
  type ScopedThread = ReviewThread & {
3
3
  workspaceId: string;
4
4
  cwd: string;
5
5
  };
6
6
  type Scope = Pick<ScopedThread, "workspaceId" | "cwd">;
7
- /** The execution service owns sent annotations. Drafts can remain in the reader's local storage. */
7
+ /** Review threads belong to one workspace checkout. Cwd records the origin of a relative anchor. */
8
8
  export declare class FileReviewThreads {
9
9
  private readonly path;
10
10
  private entries;
11
11
  private loaded;
12
12
  constructor(path: string);
13
13
  list(scope: Scope): ScopedThread[];
14
- create(scope: Scope, conversationId: string, comments: unknown): ScopedThread[];
14
+ create(scope: Scope, comments: unknown): ScopedThread[];
15
15
  update(scope: Scope, id: string, action: string, detail?: unknown, replyId?: string): ScopedThread | undefined;
16
16
  getForScope(scope: Scope, id: string): ScopedThread;
17
- markReplySent(scope: Scope, id: string, replyId: string): ScopedThread;
18
- agentReply(scope: Scope, conversationId: string, id: string, detail: unknown, replyId: string, location?: unknown): ScopedThread;
17
+ agentReply(scopes: Scope[], author: {
18
+ conversationId: string;
19
+ agentName?: string;
20
+ }, id: string, detail: unknown, replyId: string, location?: unknown): ScopedThread;
19
21
  private append;
20
22
  private replace;
21
23
  private get;
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
3
+ import { workspaceReviewPath } from "../shared/file-review.js";
3
4
  function record(value) {
4
5
  if (!value || typeof value !== "object" || Array.isArray(value))
5
6
  throw new Error("批注参数无效。");
@@ -36,9 +37,9 @@ function anchorFrom(value, allowAdditional = true) {
36
37
  };
37
38
  }
38
39
  function sameScope(thread, scope) {
39
- return thread.workspaceId === scope.workspaceId && thread.cwd === scope.cwd;
40
+ return thread.workspaceId === scope.workspaceId;
40
41
  }
41
- /** The execution service owns sent annotations. Drafts can remain in the reader's local storage. */
42
+ /** Review threads belong to one workspace checkout. Cwd records the origin of a relative anchor. */
42
43
  export class FileReviewThreads {
43
44
  path;
44
45
  entries = new Map();
@@ -50,10 +51,10 @@ export class FileReviewThreads {
50
51
  this.load();
51
52
  return [...this.entries.values()].filter(thread => sameScope(thread, scope)).reverse();
52
53
  }
53
- create(scope, conversationId, comments) {
54
+ create(scope, comments) {
54
55
  this.load();
55
56
  if (!Array.isArray(comments) || !comments.length || comments.length > 25)
56
- throw new Error("请选择要带到会话的批注。");
57
+ throw new Error("请选择要保存的批注。");
57
58
  const next = new Map(this.entries);
58
59
  const created = [];
59
60
  for (const value of comments) {
@@ -63,13 +64,13 @@ export class FileReviewThreads {
63
64
  throw new Error("批注标识无效。");
64
65
  const existing = next.get(id);
65
66
  if (existing) {
66
- if (!sameScope(existing, scope) || existing.conversationId !== conversationId)
67
- throw new Error("此批注已经关联到另一会话。");
67
+ if (!sameScope(existing, scope))
68
+ throw new Error("此批注属于另一工作区。");
68
69
  created.push(existing);
69
70
  continue;
70
71
  }
71
72
  const entry = {
72
- ...scope, ...anchorFrom(item), id, conversationId,
73
+ ...scope, ...anchorFrom(item), id,
73
74
  text: text(item.text, 2_000), replies: [], createdAt: new Date().toISOString(),
74
75
  };
75
76
  next.set(id, entry);
@@ -88,6 +89,8 @@ export class FileReviewThreads {
88
89
  }
89
90
  if (action === "reply")
90
91
  return this.append(thread, "user", detail, replyId);
92
+ if (action === "edit")
93
+ return this.replace({ ...thread, text: text(detail, 2_000) });
91
94
  if (action !== "resolve" && action !== "reopen")
92
95
  throw new Error("未知批注操作。");
93
96
  if (action === "resolve" && thread.resolvedAt || action === "reopen" && !thread.resolvedAt)
@@ -97,39 +100,35 @@ export class FileReviewThreads {
97
100
  getForScope(scope, id) {
98
101
  const thread = this.get(id);
99
102
  if (!sameScope(thread, scope))
100
- throw new Error("找不到此工作目录中的批注。");
103
+ throw new Error("找不到此工作区中的批注。");
101
104
  return thread;
102
105
  }
103
- markReplySent(scope, id, replyId) {
104
- const thread = this.getForScope(scope, id);
105
- if (!thread.replies.some(reply => reply.author === "user" && reply.id === replyId && !reply.sentAt))
106
- return thread;
107
- const sentAt = new Date().toISOString();
108
- return this.replace({ ...thread, replies: thread.replies.map(reply => reply.author === "user" && reply.id === replyId ? { ...reply, sentAt } : reply) });
109
- }
110
- agentReply(scope, conversationId, id, detail, replyId, location) {
106
+ agentReply(scopes, author, id, detail, replyId, location) {
111
107
  const thread = this.get(id);
112
- if (thread.conversationId !== conversationId || !sameScope(thread, scope))
113
- throw new Error("此批注不属于当前会话。");
108
+ if (!scopes.some(scope => sameScope(thread, scope)))
109
+ throw new Error("此批注不属于当前工作区。");
114
110
  let code;
115
111
  if (location !== undefined) {
116
112
  const input = record(location);
117
113
  const { line } = input;
118
114
  if (line !== undefined && (typeof line !== "number" || !Number.isSafeInteger(line) || line < 1))
119
115
  throw new Error("修改位置行号无效。");
120
- code = { path: text(input.path, 4096), line: line };
116
+ const path = workspaceReviewPath(text(input.path, 4096));
117
+ if (/^(?:\/|[a-z]:)|(?:^|\/)\.\.(?:\/|$)/i.test(path))
118
+ throw new Error("修改位置须是工作区相对路径。");
119
+ code = { path, line: line };
121
120
  }
122
- return this.append(thread, "agent", detail, replyId, code);
121
+ return this.append(thread, "agent", detail, replyId, { ...author, location: code, cwd: "" });
123
122
  }
124
- append(thread, author, detail, replyId, location) {
123
+ append(thread, author, detail, replyId, provenance) {
125
124
  const id = replyId ? text(replyId, 200) : randomUUID();
126
- if (thread.replies.some(reply => reply.author === author && reply.id === id))
125
+ if (thread.replies.some(reply => reply.author === author && reply.id === id && reply.conversationId === provenance?.conversationId))
127
126
  return thread;
128
127
  if (thread.resolvedAt)
129
128
  throw new Error("此批注已标为完成。");
130
129
  if (thread.replies.length >= 100)
131
130
  throw new Error("此批注的回复已达上限。");
132
- const reply = { id, author, text: text(detail, author === "agent" ? 12_000 : 2_000), createdAt: new Date().toISOString(), location };
131
+ const reply = { ...provenance, id, author, text: text(detail, author === "agent" ? 12_000 : 2_000), createdAt: new Date().toISOString() };
133
132
  return this.replace({ ...thread, replies: [...thread.replies, reply] });
134
133
  }
135
134
  replace(thread) {
@@ -152,7 +151,7 @@ export class FileReviewThreads {
152
151
  const saved = JSON.parse(readFileSync(this.path, "utf8"));
153
152
  if (saved.version !== 1 || !Array.isArray(saved.entries))
154
153
  throw new Error("批注记录格式不正确。");
155
- this.entries = new Map(saved.entries.map((entry) => [entry.id, entry]));
154
+ this.entries = new Map(saved.entries.map(({ conversationId: _legacyOwner, ...entry }) => [entry.id, entry]));
156
155
  }
157
156
  this.loaded = true;
158
157
  }
@@ -25,7 +25,7 @@ import { computeFileDiff } from "./file-diff.js";
25
25
  import { verifyCapability } from "./capability.js";
26
26
  import { FileReviewThreads } from "./file-review-threads.js";
27
27
  import { toolSelection } from "./agents.js";
28
- import { reviewFollowUpPrompt } from "../shared/file-review.js";
28
+ import { workspaceReviewPath } from "../shared/file-review.js";
29
29
  import { conversationWorkspace } from "./model-filter.js";
30
30
  import { describeSchedule } from "./scheduled-tasks.js";
31
31
  import { MAX_KNOWLEDGE_REQUEST_BYTES } from "./knowledge.js";
@@ -478,30 +478,59 @@ export function createHttpServer(options) {
478
478
  const conversation = store.conversation(conversationId);
479
479
  const allowed = verifyCapability(conversationId, request.headers["x-review-capability"], { running: runService.isRunning(conversationId) });
480
480
  if (!allowed.ok || !conversation || conversation.archivedAt) {
481
- json(403, { error: "当前执行没有批注回复权限。" });
481
+ json(403, { error: "当前执行没有批注访问权限。" });
482
482
  return;
483
483
  }
484
484
  try {
485
- const agent = await context.runtime.agentFor?.(conversation);
486
- const selection = toolSelection(agent?.tools, { extraAllowedTools: ["review_reply"] });
487
- if (conversation.agentId && context.runtime.agentFor && !agent || selection.excludeTools?.includes("review_reply") || selection.tools && !selection.tools.includes("review_reply")) {
488
- json(403, { error: "当前 Agent 没有批注回复权限。" });
489
- return;
490
- }
491
485
  const payload = await readRequestText(request, 96_000);
492
486
  if (payload.tooLarge) {
493
- json(413, { error: "批注回复过大。" });
487
+ json(413, { error: "批注请求过大。" });
494
488
  return;
495
489
  }
496
490
  const body = JSON.parse(payload.text);
497
- if (typeof body.id !== "string" || typeof body.replyId !== "string" || !body.replyId)
498
- throw new Error("批注回复缺少标识。");
491
+ if (body.action !== undefined && body.action !== "list" && body.action !== "reply")
492
+ throw new Error("未知批注工具操作。");
493
+ const tool = body.action === "list" ? "review_list" : "review_reply";
494
+ const agent = await context.runtime.agentFor?.(conversation);
495
+ const selection = toolSelection(agent?.tools, { extraAllowedTools: ["review_list", "review_reply"] });
496
+ if (conversation.agentId && context.runtime.agentFor && !agent || selection.excludeTools?.includes(tool) || selection.tools && !selection.tools.includes(tool)) {
497
+ json(403, { error: "当前 Agent 没有此批注工具的权限。" });
498
+ return;
499
+ }
499
500
  if (!runService.isRunning(conversationId)) {
500
501
  json(403, { error: "当前执行已经结束。" });
501
502
  return;
502
503
  }
503
- const scope = { workspaceId: conversation.workspaceId, cwd: conversation.cwd ?? "" };
504
- const thread = fileReviewThreads.agentReply(scope, conversationId, body.id, body.text, body.replyId, body.location);
504
+ const workspaces = new Set([conversation.workspaceId, conversation.groupExecution?.workspaceId]);
505
+ const scopes = [...workspaces].flatMap(workspaceId => {
506
+ const workspace = workspaceId ? store.workspace(workspaceId) : undefined;
507
+ return workspace && !workspace.closedAt ? [{ workspaceId: workspace.id, cwd: "" }] : [];
508
+ });
509
+ if (tool === "review_list") {
510
+ const entries = scopes.flatMap(scope => fileReviewThreads.list(scope));
511
+ const offset = Number.isSafeInteger(body.offset) && body.offset > 0 ? body.offset : 0;
512
+ if (typeof body.id === "string") {
513
+ const thread = entries.find(item => item.id === body.id);
514
+ if (!thread)
515
+ throw new Error("找不到当前工作区中的批注。");
516
+ const end = Math.max(0, thread.replies.length - offset);
517
+ const from = Math.max(0, end - 12);
518
+ json(200, { thread: { ...thread, replies: thread.replies.slice(from, end), replyCount: thread.replies.length },
519
+ nextOffset: from ? offset + end - from : undefined });
520
+ return;
521
+ }
522
+ const path = typeof body.path === "string" ? workspaceReviewPath(body.path) : undefined;
523
+ const matches = entries.filter(thread => (body.includeResolved === true || !thread.resolvedAt)
524
+ && (!path || [thread.path, thread.currentPath, ...thread.additional?.map(item => item.path) ?? []]
525
+ .some(item => item && workspaceReviewPath(item, thread.cwd) === path)));
526
+ const page = matches.slice(offset, offset + 20).map(({ id, path, currentPath, cwd, side, start, end, text, resolvedAt, replies, workspaceId }) => ({ id, workspaceId, path: workspaceReviewPath(path, cwd), currentPath: currentPath && workspaceReviewPath(currentPath, cwd),
527
+ side, start, end, text, resolvedAt, replyCount: replies.length }));
528
+ json(200, { threads: page, nextOffset: matches.length > offset + page.length ? offset + page.length : undefined });
529
+ return;
530
+ }
531
+ if (typeof body.id !== "string" || typeof body.replyId !== "string" || !body.replyId)
532
+ throw new Error("批注回复缺少标识。");
533
+ const thread = fileReviewThreads.agentReply(scopes, { conversationId, agentName: agent?.name }, body.id, body.text, body.replyId, body.location);
505
534
  json(200, { id: thread.id, replied: true });
506
535
  }
507
536
  catch (error) {
@@ -519,18 +548,11 @@ export function createHttpServer(options) {
519
548
  }
520
549
  const worktreeId = url.searchParams.get("worktreeId");
521
550
  const checkout = worktreeId ? await resolveGitWorktree(workspace.path, worktreeId) : undefined;
522
- const owner = checkout ? store.workspaces().find(item => !item.closedAt && !relative(resolve(item.path), resolve(checkout.path))) : workspace;
523
- if (!owner) {
524
- if (request.method === "GET") {
525
- json(200, { threads: [] });
526
- return;
527
- }
528
- throw new Error("请先在此工作树打开一个会话。");
529
- }
530
- const root = await resolveFileCwd(owner.path, checkout ? "" : url.searchParams.get("cwd"));
531
- const scope = { workspaceId: owner.id, cwd: relative(resolve(owner.path), root).replaceAll("\\", "/") };
551
+ let owner = checkout ? store.workspaces().find(item => !item.closedAt && !relative(resolve(item.path), resolve(checkout.path))) : workspace;
552
+ const root = await resolveFileCwd(checkout?.path ?? workspace.path, checkout ? "" : url.searchParams.get("cwd"));
553
+ const cwd = relative(resolve(checkout?.path ?? workspace.path), root).replaceAll("\\", "/");
532
554
  if (request.method === "GET") {
533
- json(200, { threads: fileReviewThreads.list(scope) });
555
+ json(200, { threads: owner ? fileReviewThreads.list({ workspaceId: owner.id, cwd }) : [] });
534
556
  return;
535
557
  }
536
558
  if (request.method !== "POST") {
@@ -548,32 +570,22 @@ export function createHttpServer(options) {
548
570
  return;
549
571
  }
550
572
  const body = JSON.parse(payload.text);
573
+ if (!owner && checkout && body.action === "create") {
574
+ const project = workspace.worktreeOf ? store.workspace(workspace.worktreeOf) ?? workspace : workspace;
575
+ owner = await store.createWorkspace((checkout.entry.branch ?? `工作树 ${checkout.entry.head.slice(0, 8)}`).slice(0, 80), checkout.path, checkout.entry.primary ? undefined : project);
576
+ context.broadcaster.broadcastState();
577
+ }
578
+ if (!owner)
579
+ throw new Error("找不到此工作树的批注。");
580
+ const scope = { workspaceId: owner.id, cwd };
551
581
  if (body.action === "create") {
552
- const conversation = typeof body.conversationId === "string" ? store.conversation(body.conversationId) : undefined;
553
- if (!conversation || conversation.archivedAt || conversation.groupExecution || conversation.workspaceId !== scope.workspaceId || (conversation.cwd ?? "") !== scope.cwd) {
554
- throw new Error("接收会话不在此工作目录,或已归档。");
555
- }
556
- json(200, { threads: fileReviewThreads.create(scope, conversation.id, body.comments) });
582
+ json(200, { threads: fileReviewThreads.create(scope, body.comments) });
557
583
  }
558
584
  else if (body.action === "reply") {
559
585
  if (typeof body.id !== "string" || typeof body.requestKey !== "string" || !/^[0-9a-f-]{36}$/.test(body.requestKey)) {
560
586
  throw new Error("批注回复缺少有效标识。");
561
587
  }
562
- const original = fileReviewThreads.getForScope(scope, body.id);
563
- const conversation = store.conversation(original.conversationId);
564
- if (!conversation || conversation.archivedAt || conversation.workspaceId !== scope.workspaceId || (conversation.cwd ?? "") !== scope.cwd) {
565
- throw new Error("原会话已不可用。");
566
- }
567
- if (context.conversationService.childLockState(conversation.id) === "locked")
568
- throw new Error(CHILD_SESSION_LOCK_REASON);
569
- if (context.conversationService.isReverting(conversation.id))
570
- throw new Error("请等会话撤回结束后再回复批注。");
571
- const thread = fileReviewThreads.update(scope, body.id, "reply", body.text, body.requestKey);
572
- const reply = thread.replies.find(item => item.author === "user" && item.id === body.requestKey);
573
- await new Promise((accept, reject) => {
574
- void runService.enqueueAndRun(conversation.id, reviewFollowUpPrompt(thread, reply.text), undefined, undefined, `message_${body.requestKey}`, "queue", accept).catch(reject);
575
- });
576
- json(200, { thread: fileReviewThreads.markReplySent(scope, thread.id, reply.id) });
588
+ json(200, { thread: fileReviewThreads.update(scope, body.id, "reply", body.text, body.requestKey) });
577
589
  }
578
590
  else {
579
591
  if (typeof body.id !== "string" || typeof body.action !== "string")
@@ -1543,7 +1543,7 @@ export class PiRpcRuntime {
1543
1543
  extensionToolNames() {
1544
1544
  const names = [TASK_TOOL_NAME, TODO_TOOL_NAME, WORKFLOW_TOOL_NAME, RUN_ASYNC_TOOL_NAME, SCHEDULED_TASK_TOOL_NAME, "question", "tool_register"];
1545
1545
  if (process.env.SUPER_PI_REVIEW_ENDPOINT)
1546
- names.push("review_reply");
1546
+ names.push("review_list", "review_reply");
1547
1547
  if (this.memory)
1548
1548
  names.push("memory", "skill_manage", "session_search", "agent_handbook");
1549
1549
  if (this.knowledge)
@@ -1787,7 +1787,7 @@ export class PiRpcRuntime {
1787
1787
  // allowlist and naming a tool Pi has not registered would change the spawn line for every other
1788
1788
  // mode. The prompt asks for a bare JSON array and nothing else; if the model spends a turn on a
1789
1789
  // tool call anyway the reranker times out and falls back to the lexical order.
1790
- const reviewTools = extensionArgs.length && process.env.SUPER_PI_REVIEW_ENDPOINT ? ["review_reply"] : [];
1790
+ const reviewTools = extensionArgs.length && process.env.SUPER_PI_REVIEW_ENDPOINT ? ["review_list", "review_reply"] : [];
1791
1791
  const agentArgs = memoryReview ? ["--no-extensions", "--no-skills", "--no-mcp", "--no-context-files", "--no-prompt-templates", "--tools", "memory,skill_manage,session_search"] : knowledgeRerank ? ["--no-extensions", "--no-skills", "--no-mcp", "--no-context-files", "--no-prompt-templates"] : await agentSpawnArgs(this.agents.promptDir, agent, { extraAllowedTools: agent?.id === "rsi-discussion" ? [] : [...reviewTools, ...(extensionArgs.length ? [TASK_TOOL_NAME, TODO_TOOL_NAME, PROJECT_TOOL_NAME, WORKFLOW_TOOL_NAME, RUN_ASYNC_TOOL_NAME, SCHEDULED_TASK_TOOL_NAME, "question", "tool_register", "tool_shortcut", "tool_remove", ...(this.options.orchestratorEndpoint ? [WORKTREE_TOOL_NAME, SESSION_SPAWN_TOOL_NAME, SESSION_STATUS_TOOL_NAME, SESSION_DISPATCH_TOOL_NAME, SESSION_STOP_TOOL_NAME, SESSION_REPORT_TOOL_NAME, SESSION_STOP_SUBTREE_TOOL_NAME, SESSION_REMOVE_TOOL_NAME, SESSION_REMINDER_TOOL_NAME] : [])] : []), ...(memoryEnabled ? ["memory", "skill_manage", "session_search", "agent_handbook"] : []), ...(knowledgeEnabled ? [KNOWLEDGE_TOOL_NAME, KNOWLEDGE_IMPORT_TOOL_NAME] : []), ...(documentsEnabled ? [DOCUMENT_READ_TOOL_NAME, DOCUMENT_WRITE_TOOL_NAME, ...PRESENTATION_TOOL_NAMES] : []), ...(webEnabled ? [WEB_SEARCH_TOOL_NAME, WEB_FETCH_TOOL_NAME] : []), ...(feishuEnabled ? [FEISHU_READ_TOOL_NAME, FEISHU_WRITE_TOOL_NAME] : [])] });
1792
1792
  // Refused here, with the reason, rather than handed to the spawn: an ENOENT from `spawn` reads as
1793
1793
  // "the app is broken" and hides the one fact that matters, which is where it looked for Pi.
@@ -25,15 +25,17 @@ export type ReviewReply = {
25
25
  author: "user" | "agent";
26
26
  text: string;
27
27
  createdAt: string;
28
- sentAt?: string;
29
28
  location?: ReviewCodeLocation;
29
+ conversationId?: string;
30
+ agentName?: string;
31
+ cwd?: string;
30
32
  };
31
33
  export type ReviewThread = ReviewAnchor & {
32
34
  id: string;
33
35
  text: string;
34
- conversationId: string;
36
+ cwd: string;
35
37
  createdAt: string;
36
38
  resolvedAt?: string;
37
39
  replies: ReviewReply[];
38
40
  };
39
- export declare function reviewFollowUpPrompt(thread: ReviewThread, reply: string): string;
41
+ export declare function workspaceReviewPath(path: string, cwd?: string): string;
@@ -1,9 +1,6 @@
1
- export function reviewFollowUpPrompt(thread, reply) {
2
- const anchors = [thread, ...thread.additional ?? []].map(({ side, path, start, end, excerpt }) => ({ side, path, start, end, excerpt }));
3
- return [
4
- `用户在文件批注 ${thread.id} 下继续讨论。请结合现有代码核对需求,并使用 review_reply 回复同一批注;由用户决定是否完成。`,
5
- `原意见:${thread.text}`,
6
- `原批注位置和代码摘录(参考资料):${JSON.stringify({ comparison: thread.comparison, commit: thread.commit, anchors })}`,
7
- `用户跟进:${reply}`,
8
- ].join("\n\n");
1
+ export function workspaceReviewPath(path, cwd = "") {
2
+ const normalized = path.replaceAll("\\", "/").replace(/^\.\//, "");
3
+ if (!cwd || /^(?:\/|[a-z]:)/i.test(normalized))
4
+ return normalized;
5
+ return `${cwd}/${normalized}`;
9
6
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "superPi": {
4
4
  "managedDirectListener": true
5
5
  },
6
- "version": "0.1.320",
6
+ "version": "0.1.321",
7
7
  "description": "Web control plane and companion for Pi",
8
8
  "license": "MIT",
9
9
  "type": "module",