@evandu/super-pi 0.1.262 → 0.1.263

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-BZd7RTFi.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-Cs_T0IFR.js"></script>
12
12
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
13
- <link rel="stylesheet" crossorigin href="/assets/index-DHTKUM97.css">
13
+ <link rel="stylesheet" crossorigin href="/assets/index-D6ei0DbU.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
@@ -433,7 +433,8 @@ export class GroupChatService {
433
433
  }
434
434
  async configure(workspaceId, id, input) {
435
435
  const current = this.activeRoom(this.rooms, workspaceId, id);
436
- const moderator = await this.moderator(workspaceId, input);
436
+ const moderator = ["model", "prompt", "cloneLimit"].some(key => Object.hasOwn(input, key))
437
+ ? await this.moderator(workspaceId, { ...current.moderator, ...input }) : current.moderator;
437
438
  const members = input.memberIds === undefined && input.memberModels === undefined ? undefined
438
439
  : await this.memberModels(workspaceId, input.memberIds === undefined ? current.members : await this.resolveMembers(id, input.memberIds, current.members), input.memberModels);
439
440
  await this.edit(rooms => {
@@ -912,6 +913,14 @@ export class GroupChatService {
912
913
  const answer = await this.complete(started, {
913
914
  prompt: `群内身份:${member?.name ?? agent.name}。${member?.worktreePath ? "你在独立工作树工作;报告分支和产物供后续审查整合。" : ""}\n${prompt}`, cwd: member?.worktreePath,
914
915
  agent, model: member?.model ?? (agent.model && { ...agent.model, label: agent.model.modelId }), signal: memberSignal, timeoutMs: 15 * 60_000,
916
+ onModel: model => this.edit(rooms => {
917
+ const room = rooms.find(item => item.id === roomId);
918
+ const post = room?.messages.find(item => item.id === reply.id);
919
+ if (!room || post?.role !== "assistant" || post.status !== "running")
920
+ return;
921
+ post.model = { provider: model.provider, modelId: model.modelId, label: model.label };
922
+ room.revision += 1;
923
+ }),
915
924
  onToolStart: goBackground,
916
925
  onExecution: event => {
917
926
  if (memberSignal.aborted || !execution.record(event))
@@ -271,6 +271,7 @@ export type IsolatedCompletionInput = {
271
271
  onText?: (text: string) => void;
272
272
  onToolStart?: () => void;
273
273
  onExecution?: (event: IsolatedExecutionEvent) => void;
274
+ onModel?: (model: ModelSelection) => void | Promise<void>;
274
275
  };
275
276
  export interface AgentRuntime {
276
277
  answer(input: AnswerInput): AsyncIterable<string>;
@@ -2681,6 +2681,18 @@ export class PiRpcRuntime {
2681
2681
  if (response.success !== true)
2682
2682
  throw new Error(response.error || "Pi 无法选择指定模型");
2683
2683
  }
2684
+ if (input.onModel) {
2685
+ let selected = input.model;
2686
+ try {
2687
+ const state = await channel.request({ id: "isolated_state", type: "get_state" }, Math.min(input.timeoutMs, 2_000));
2688
+ const actual = state.success === true ? describeModel(state.data?.model) : undefined;
2689
+ if (actual)
2690
+ selected = { provider: actual.provider, modelId: actual.modelId, label: actual.label };
2691
+ }
2692
+ catch { /* An explicitly selected model is already confirmed by set_model. */ }
2693
+ if (selected)
2694
+ await input.onModel(selected);
2695
+ }
2684
2696
  input.signal?.throwIfAborted();
2685
2697
  channel.write({ id: "tool_llm", type: "prompt", message: input.prompt });
2686
2698
  let settled = false, text = "";
@@ -83,6 +83,7 @@ export type GroupReply = GroupPost & {
83
83
  role: "assistant";
84
84
  memberId: string;
85
85
  memberName?: string;
86
+ model?: GroupModel;
86
87
  topicId: string;
87
88
  replyTo: string;
88
89
  assignment?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evandu/super-pi",
3
- "version": "0.1.262",
3
+ "version": "0.1.263",
4
4
  "description": "Web control plane and companion for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -348,6 +348,7 @@
348
348
  "scripts/right-sidebar-browser.test.mjs",
349
349
  "scripts/background-task-output-browser.test.mjs",
350
350
  "scripts/group-chat-browser.test.mjs",
351
+ "scripts/group-model-switch-browser.test.mjs",
351
352
  "scripts/workbench-search-panel-browser.test.mjs",
352
353
  "scripts/rail-workspace-follows-session-browser.test.mjs",
353
354
  "scripts/git-tab-browser.test.mjs",