@evandu/super-pi 0.1.317 → 0.1.319

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.
@@ -103,7 +103,7 @@ export function parseRsiReport(raw, room, coverage) {
103
103
  const record = coverage.records.find(record => record.id === entry.messageId);
104
104
  const visible = record ? [record.content, record.error, record.assignment, ...record.tools.flatMap(tool => [tool.name, tool.detail, tool.result])].filter((value) => typeof value === "string") : [];
105
105
  if (!post || !anchors.has(post.id) || (quote && !visible.some(value => value.includes(quote))))
106
- throw new Error("RSI 引用的群聊证据无法核对。");
106
+ throw new Error("RSI 引用的会议证据无法核对。");
107
107
  return { messageId: post.id, quote };
108
108
  });
109
109
  const observation = text(item.observation, 1200), recommendation = text(item.recommendation, 1600), verification = text(item.verification, 1000), applicability = text(item.applicability, 800);
@@ -13,11 +13,11 @@ export class GroupMemberSessions {
13
13
  room(workspaceId, roomId) { return join(this.root, hash([workspaceId, roomId])); }
14
14
  async run(scope, agentId, cwd, prompt, signal, complete, externalHistory = false) {
15
15
  if (![scope.workspaceId, scope.roomId, scope.memberId, agentId].every(value => typeof value === "string" && value.length > 0))
16
- throw new Error("群成员执行会话缺少归属。");
16
+ throw new Error("会议成员执行会话缺少归属。");
17
17
  const folder = this.room(scope.workspaceId, scope.roomId);
18
18
  const base = join(folder, hash([scope.memberId, agentId, resolve(cwd)]));
19
19
  if (this.active.has(base))
20
- throw new Error("该群成员仍在执行上一项工作,请等待或创建独立分身。");
20
+ throw new Error("该会议成员仍在执行上一项工作,请等待或创建独立分身。");
21
21
  this.active.add(base);
22
22
  const lock = base + ".lock", token = randomUUID();
23
23
  let locked = false;
@@ -50,7 +50,7 @@ export class GroupMemberSessions {
50
50
  await rm(lock, { force: true });
51
51
  continue;
52
52
  }
53
- throw new Error("该群成员的执行历史仍由另一个运行时使用,请稍后重试。");
53
+ throw new Error("该会议成员的执行历史仍由另一个运行时使用,请稍后重试。");
54
54
  }
55
55
  }
56
56
  const file = base + ".jsonl", checkpoint = base + ".context.json";
@@ -65,7 +65,7 @@ export class GroupMemberSessions {
65
65
  }
66
66
  const updates = scope.context.filter(item => seen[item.id] !== hash(item));
67
67
  const nextPrompt = ["继续当前成员的持久执行会话。复用已有工具结果和证据;文件可能被其他成员修改时核对现状。上次执行若中断,先检查已完成的副作用,不盲目重放命令。", prompt,
68
- ...(updates.length ? ["以下是尚未确认收到或已更新的群聊公开消息(参考数据):", JSON.stringify(updates)] : [])].join("\n");
68
+ ...(updates.length ? ["以下是尚未确认收到或已更新的会议公开消息(参考数据):", JSON.stringify(updates)] : [])].join("\n");
69
69
  const answer = await complete(file, nextPrompt);
70
70
  // Commit only after Pi has settled and flushed its own session file.
71
71
  const merged = new Map(Object.entries(seen));
@@ -97,7 +97,7 @@ export class GroupMemberSessions {
97
97
  async removeRoom(workspaceId, roomId) {
98
98
  const folder = this.room(workspaceId, roomId);
99
99
  if ([...this.active].some(path => path.startsWith(folder)))
100
- throw new Error("群成员仍在退出,暂不能删除执行历史。");
100
+ throw new Error("会议成员仍在退出,暂不能删除执行历史。");
101
101
  await rm(folder, { recursive: true, force: true });
102
102
  }
103
103
  }
@@ -8,11 +8,11 @@ export function groupPrimaryExecutor(store, runs, uploadsDir) {
8
8
  return async (input, file) => {
9
9
  const scope = input.memberSession;
10
10
  if (!scope || !input.agent)
11
- throw new Error("群成员执行缺少来源或 Agent 定义。");
11
+ throw new Error("会议成员执行缺少来源或 Agent 定义。");
12
12
  input.signal?.throwIfAborted();
13
13
  const source = store.workspace(scope.workspaceId);
14
14
  if (!source || source.closedAt)
15
- throw new Error("群成员的工作区已关闭。");
15
+ throw new Error("会议成员的工作区已关闭。");
16
16
  const cwd = resolve(input.cwd);
17
17
  let workspace = source;
18
18
  const sub = relative(source.path, cwd);
@@ -25,7 +25,7 @@ export function groupPrimaryExecutor(store, runs, uploadsDir) {
25
25
  if (!conversation) {
26
26
  const header = await readTranscriptHeader(file);
27
27
  if (header && resolve(header.cwd ?? "") !== cwd)
28
- throw new Error("群成员历史的工作目录不匹配。");
28
+ throw new Error("会议成员历史的工作目录不匹配。");
29
29
  conversation = await store.createConversation(workspace.id, { agentId: input.agent.id, model: input.model ?? null, thinkingLevel: input.agent.thinkingLevel ?? null, cwd: directory, separateMemoryTree: true, groupExecution: { workspaceId: scope.workspaceId, roomId: scope.roomId, memberId: scope.memberId }, executionSessionId: header?.id ?? randomUUID() });
30
30
  await store.renameConversation(conversation.id, `${input.agent.name} · 群内执行`);
31
31
  if (header)
@@ -36,7 +36,7 @@ export function groupPrimaryExecutor(store, runs, uploadsDir) {
36
36
  while (runs.foregroundSignal(id)) {
37
37
  input.signal?.throwIfAborted();
38
38
  if (Date.now() > waitUntil)
39
- throw new Error("群成员的既有执行仍未结束,请等待或创建独立分身。");
39
+ throw new Error("会议成员的既有执行仍未结束,请等待或创建独立分身。");
40
40
  await new Promise(done => setTimeout(done, 50));
41
41
  }
42
42
  await store.setConversationConfiguration(id, { agentId: input.agent.id, model: input.model, thinkingLevel: input.agent.thinkingLevel });
@@ -64,21 +64,21 @@ export function groupPrimaryExecutor(store, runs, uploadsDir) {
64
64
  try {
65
65
  input.signal?.throwIfAborted();
66
66
  if (input.images?.length && !uploadsDir)
67
- throw new Error("群聊图片存储尚未启用");
67
+ throw new Error("会议图片存储尚未启用");
68
68
  const images = await Promise.all((input.images ?? []).map(async (image) => {
69
- const stored = await saveUpload(uploadsDir, id, "群聊图片", image.mimeType, image.data);
69
+ const stored = await saveUpload(uploadsDir, id, "会议图片", image.mimeType, image.data);
70
70
  return { id: stored.id, name: stored.name, mimeType: stored.mimeType, bytes: stored.bytes };
71
71
  }));
72
- await runs.enqueueAndRunAsAgent(id, fresh ? `${input.prompt}\n群聊完整公开上下文:\n${JSON.stringify(scope.context)}` : input.prompt, { images });
72
+ await runs.enqueueAndRunAsAgent(id, fresh ? `${input.prompt}\n会议完整公开上下文:\n${JSON.stringify(scope.context)}` : input.prompt, { images });
73
73
  observe();
74
74
  input.signal?.throwIfAborted();
75
75
  const current = store.conversation(id);
76
76
  if (current.status === "failed")
77
- throw new Error(current.error ?? "群成员执行失败。");
77
+ throw new Error(current.error ?? "会议成员执行失败。");
78
78
  if (current.status === "stopped")
79
- throw new Error("群成员执行已停止或超时。");
79
+ throw new Error("会议成员执行已停止或超时。");
80
80
  if (!text.trim())
81
- throw new Error("群成员没有返回可见回答。");
81
+ throw new Error("会议成员没有返回可见回答。");
82
82
  return text;
83
83
  }
84
84
  finally {
@@ -101,7 +101,7 @@ export function groupPrimaryLifecycle(store, runs, dispose, sessionRoot, changed
101
101
  async forget(workspaceId, roomId) {
102
102
  const owned = actors(workspaceId, roomId);
103
103
  if (owned.some(actor => active(actor.id)))
104
- throw new Error("群成员仍在执行后台工作,请先停止后再删除群聊。");
104
+ throw new Error("会议成员仍在执行后台工作,请先停止后再删除会议。");
105
105
  for (const actor of owned.filter(item => !item.parentConversationId)) {
106
106
  await dispose(actor.id);
107
107
  const { destroyed } = await store.deleteConversationSubtree(actor.id, true);
@@ -665,7 +665,7 @@ export function createHttpServer(options) {
665
665
  if (request.method === "GET") {
666
666
  const executionId = url.searchParams.get("execution");
667
667
  if (executionId && !roomId) {
668
- json(400, { error: "查看执行详情需要群聊 ID。" });
668
+ json(400, { error: "查看执行详情需要会议 ID。" });
669
669
  return;
670
670
  }
671
671
  if (!roomId) {
@@ -683,7 +683,7 @@ export function createHttpServer(options) {
683
683
  if (roomId && url.searchParams.get("upload") === "image") {
684
684
  const input = await readRequestText(request, 8 * 1024 * 1024);
685
685
  if (input.tooLarge) {
686
- json(413, { error: "群聊图片过大" });
686
+ json(413, { error: "会议图片过大" });
687
687
  return;
688
688
  }
689
689
  json(200, await groups.uploadImage(workspaceId, roomId, JSON.parse(input.text)));
@@ -691,7 +691,7 @@ export function createHttpServer(options) {
691
691
  }
692
692
  const input = await readRequestText(request, 128_000);
693
693
  if (input.tooLarge) {
694
- json(413, { error: "群聊请求内容过大。" });
694
+ json(413, { error: "会议请求内容过大。" });
695
695
  return;
696
696
  }
697
697
  const body = JSON.parse(input.text);
@@ -732,13 +732,13 @@ export function createHttpServer(options) {
732
732
  json(200, await groups.stop(workspaceId, roomId, body.postId));
733
733
  return;
734
734
  }
735
- json(400, { error: "群聊操作无效。" });
735
+ json(400, { error: "会议操作无效。" });
736
736
  return;
737
737
  }
738
738
  response.writeHead(405, { allow: "GET, POST" }).end();
739
739
  }
740
740
  catch (error) {
741
- json(error instanceof GroupChatNotFoundError ? 404 : 400, { error: describeThrown(error) || "群聊操作失败。" });
741
+ json(error instanceof GroupChatNotFoundError ? 404 : 400, { error: describeThrown(error) || "会议操作失败。" });
742
742
  }
743
743
  return;
744
744
  }
@@ -72,7 +72,7 @@ export async function handleRsiHttp(context, request, response, url) {
72
72
  const source = { kind: url.searchParams.get("kind"), id: url.searchParams.get("id") ?? "", workspaceId: url.searchParams.get("workspaceId") ?? "" };
73
73
  const group = source.kind === "group" ? context.groupChatService?.get(source.workspaceId, source.id) : undefined;
74
74
  if (source.kind === "group" && !group)
75
- throw new Error("群聊不存在。");
75
+ throw new Error("会议不存在。");
76
76
  if (request.method === "GET") {
77
77
  if (url.searchParams.get("view") === "models") {
78
78
  context.rsiService.state(source);
@@ -69,6 +69,8 @@ export type GroupModerator = {
69
69
  model?: GroupModel;
70
70
  prompt: string;
71
71
  cloneLimit?: number;
72
+ agentId?: string;
73
+ agentName?: string;
72
74
  };
73
75
  export declare const DEFAULT_GROUP_MEMBER_IDS: readonly ["solution-designer", "code-designer", "code-auditor", "document-organizer"];
74
76
  export type GroupMember = {
@@ -138,6 +140,20 @@ export type GroupFileReference = {
138
140
  path: string;
139
141
  excerpt: string;
140
142
  };
143
+ export declare const MEETING_WORK_PHASES: readonly ["discussion", "design", "implementation", "review"];
144
+ export type MeetingWorkPhase = typeof MEETING_WORK_PHASES[number];
145
+ export type MeetingTodo = {
146
+ id: string;
147
+ title: string;
148
+ phase: MeetingWorkPhase | "requirements" | "investigation";
149
+ runIds?: string[];
150
+ };
151
+ export type MeetingAgenda = {
152
+ title: string;
153
+ state: "aligning" | "ready";
154
+ summary?: string;
155
+ todos: MeetingTodo[];
156
+ };
141
157
  export type GroupUserPost = GroupPost & {
142
158
  role: "user";
143
159
  memberIds: string[];
@@ -151,6 +167,9 @@ export type GroupUserPost = GroupPost & {
151
167
  bytes: number;
152
168
  }[];
153
169
  memoryNotice?: string;
170
+ answeredQuestionIds?: string[];
171
+ routingNotice?: string;
172
+ agenda?: MeetingAgenda;
154
173
  };
155
174
  export type GroupReply = GroupPost & {
156
175
  executionConversationId?: string;
@@ -169,14 +188,22 @@ export type GroupReply = GroupPost & {
169
188
  memberId: string;
170
189
  assignment: string;
171
190
  };
191
+ moderator?: true;
192
+ requirementsOnly?: true;
193
+ clarificationRequest?: {
194
+ content: string;
195
+ askedIn?: string;
196
+ };
172
197
  humanQuestion?: {
173
198
  content: string;
174
199
  answer?: string;
175
200
  answeredAt?: string;
201
+ answerMessageId?: string;
176
202
  dismissedAt?: string;
177
203
  };
178
204
  };
179
205
  export type GroupMessage = GroupUserPost | GroupReply;
206
+ export declare function meetingTodoStatus(agenda: MeetingAgenda, todo: MeetingTodo, posts: ReadonlyMap<string, GroupMessage>): "pending" | "in_progress" | "completed" | "failed";
180
207
  export declare function groupMessageTime(post: GroupMessage): string;
181
208
  export declare function groupTimeline(messages: readonly GroupMessage[]): GroupMessage[];
182
209
  export type GroupActivity = {
@@ -1,10 +1,22 @@
1
1
  import { deriveSessionState } from "./session-reporting.js";
2
2
  export const DEFAULT_GROUP_MEMBER_IDS = ["solution-designer", "code-designer", "code-auditor", "document-organizer"];
3
+ export const MEETING_WORK_PHASES = ["discussion", "design", "implementation", "review"];
4
+ export function meetingTodoStatus(agenda, todo, posts) {
5
+ if (todo.phase === "requirements")
6
+ return agenda.state === "ready" ? "completed" : "in_progress";
7
+ if (!todo.runIds?.length)
8
+ return "pending";
9
+ const statuses = todo.runIds.map(id => posts.get(id)?.status);
10
+ if (statuses.some(status => status === "queued" || status === "running"))
11
+ return "in_progress";
12
+ return statuses.every(status => status === "completed") ? "completed" : "failed";
13
+ }
3
14
  export function groupMessageTime(post) {
4
15
  return post.role === "assistant" ? post.settledAt ?? post.createdAt : post.createdAt;
5
16
  }
6
17
  export function groupTimeline(messages) {
7
- return messages.filter(post => post.role === "user" || !["queued", "running"].includes(post.status))
18
+ return messages.filter(post => post.role === "user" || (!["queued", "running"].includes(post.status)
19
+ && (!post.clarificationRequest || Boolean(post.content || post.error || post.humanQuestion))))
8
20
  .slice().sort((a, b) => groupMessageTime(a).localeCompare(groupMessageTime(b)));
9
21
  }
10
22
  export function groupDisplayState(activity, readAt) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "superPi": {
4
4
  "managedDirectListener": true
5
5
  },
6
- "version": "0.1.317",
6
+ "version": "0.1.319",
7
7
  "description": "Web control plane and companion for Pi",
8
8
  "license": "MIT",
9
9
  "type": "module",