@evandu/super-pi 0.1.92 → 0.1.93

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,8 +8,8 @@
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-DxMdKg12.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-Db0poZWq.css">
11
+ <script type="module" crossorigin src="/assets/index-CjTv3vNA.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-mdc5jJ6R.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
@@ -256,6 +256,10 @@ export declare class RunService {
256
256
  * branch (which only call it when `!this.activeRuns.has(conversationId)`). The two callers differ
257
257
  * only in who arrived first; the open-turn-and-run contract is the same.
258
258
  *
259
+ * `runConversationTurns` owns opening the first turn. It must be the ONLY opener: opening here and
260
+ * then asking that loop to run the same message used to splice two assistant placeholders under one
261
+ * queued item. The first got no deltas, which rendered as a stray avatar before the real response.
262
+ *
259
263
  * `composePrompt` is what makes the `role: "tool"` path real - the `<task>` envelope stays in the
260
264
  * transcript, but the prose form of the same fact is what reaches Pi.
261
265
  */
@@ -1137,6 +1137,10 @@ export class RunService {
1137
1137
  * branch (which only call it when `!this.activeRuns.has(conversationId)`). The two callers differ
1138
1138
  * only in who arrived first; the open-turn-and-run contract is the same.
1139
1139
  *
1140
+ * `runConversationTurns` owns opening the first turn. It must be the ONLY opener: opening here and
1141
+ * then asking that loop to run the same message used to splice two assistant placeholders under one
1142
+ * queued item. The first got no deltas, which rendered as a stray avatar before the real response.
1143
+ *
1140
1144
  * `composePrompt` is what makes the `role: "tool"` path real - the `<task>` envelope stays in the
1141
1145
  * transcript, but the prose form of the same fact is what reaches Pi.
1142
1146
  */
@@ -1148,11 +1152,12 @@ export class RunService {
1148
1152
  this.activeRuns.set(conversationId, controller);
1149
1153
  try {
1150
1154
  const { conversation, workspace } = this.turnContext(conversationId);
1151
- const agent = await this.runtime.agentFor?.(conversation);
1152
- const identity = agent ? { id: agent.id, name: agent.name } : { name: "Pi" };
1153
- const opened = await this.store.openTurnOnSpecificMessage(conversationId, messageId, identity);
1154
- this.broadcaster.broadcastState();
1155
- await this.runConversationTurns(conversation, workspace, composePrompt(opened.user), controller, opened.user.id, opened.user.images);
1155
+ const message = conversation.messages.find((item) => item.id === messageId);
1156
+ if (!message)
1157
+ throw new Error("消息不存在或已被撤回");
1158
+ // Do not call openTurnOnSpecificMessage here. runConversationTurns opens this exact first
1159
+ // message before streaming it, which creates one assistant placeholder and one only.
1160
+ await this.runConversationTurns(conversation, workspace, composePrompt(message), controller, message.id, message.images);
1156
1161
  await this.store.setStatus(conversationId, controller.signal.aborted ? "stopped" : "completed");
1157
1162
  }
1158
1163
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evandu/super-pi",
3
- "version": "0.1.92",
3
+ "version": "0.1.93",
4
4
  "description": "Web control plane and companion for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",