@evandu/super-pi 0.1.310 → 0.1.311
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/dist/client/.super-pi-client-sources.json +9 -9
- package/dist/client/assets/{CodeMirrorEditor-BOnbuu1R.js → CodeMirrorEditor-DoHGBun1.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-CghIhA6m.js → GitDiffEditor-CBeZLBYJ.js} +1 -1
- package/dist/client/assets/{index-kGuSFdh8.js → index-BjsOJuXg.js} +7 -7
- package/dist/client/assets/index-CWQaiP0Y.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/application/rsi-repairs.js +33 -11
- package/dist/shared/rsi.d.ts +2 -1
- package/package.json +1 -1
- package/dist/client/assets/index-COa-CUVo.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -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-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-BjsOJuXg.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CWQaiP0Y.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
17
17
|
|
|
@@ -71,13 +71,13 @@ export class RsiRepairs {
|
|
|
71
71
|
return this.jobs.filter(job => rsiKey(job.source) === rsiKey(source)).map(job => {
|
|
72
72
|
const conversation = this.store.conversation(job.conversationId);
|
|
73
73
|
// Legacy refresh payloads predate explicit internal-message tracking.
|
|
74
|
-
const messages = (conversation?.messages ?? []).filter(message => (message.role === "user" || message.role === "assistant") && message.id !== job.initialMessageId && !job.observationMessageIds?.includes(message.id)
|
|
74
|
+
const messages = (conversation?.messages ?? []).filter(message => (message.role === "user" || message.role === "assistant") && (message.id !== job.initialMessageId || !!job.initialPrompt) && !job.observationMessageIds?.includes(message.id)
|
|
75
75
|
&& !(message.role === "user" && message.content.startsWith("继续同一来源的综合 RSI 讨论。")));
|
|
76
76
|
const last = messages.at(-1);
|
|
77
77
|
return { ...structuredClone(job), model: conversation?.model, busy: busy(conversation?.status),
|
|
78
78
|
revision: last?.role === "assistant" && last.content.trim() ? last.id : undefined,
|
|
79
79
|
proposedPlan: last?.role === "assistant" ? last.content.slice(0, 16000) : undefined,
|
|
80
|
-
messages: messages.slice(-40).map(message => ({ id: message.id, actualModel: message.actualModel, role: message.role, content: message.id === job.executionMessageId ? `已授权实施:\n${job.approvedPlan}` : message.content.slice(0, 16000) })) };
|
|
80
|
+
messages: messages.slice(-40).map(message => ({ id: message.id, actualModel: message.actualModel, role: message.role, content: message.id === job.executionMessageId ? `已授权实施:\n${job.approvedPlan}` : message.id === job.initialMessageId && job.initialPrompt ? job.initialPrompt : message.content.slice(0, 16000) })) };
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
async action(source, body, report, context) {
|
|
@@ -88,16 +88,35 @@ export class RsiRepairs {
|
|
|
88
88
|
if (!workspace || workspace.closedAt && body.action !== "rsi.repair.cancel")
|
|
89
89
|
throw new Error("请选择已打开的有效工作区。");
|
|
90
90
|
if (body.action === "rsi.repair.discuss") {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
const initialPrompt = typeof body.initialPrompt === "string" ? body.initialPrompt.trim() : "";
|
|
92
|
+
if (initialPrompt.length > 12000)
|
|
93
|
+
throw new Error("讨论开场内容不能超过 12000 字。");
|
|
94
|
+
if (!report && !initialPrompt)
|
|
95
|
+
throw new Error("请输入你希望 RSI 讨论和改进的问题。");
|
|
96
|
+
const finding = body.findingId === undefined ? undefined : report?.findings.find(item => item.id === body.findingId);
|
|
94
97
|
if (body.findingId !== undefined && !finding)
|
|
95
98
|
throw new Error("RSI 建议不存在。");
|
|
96
|
-
const existing = [...this.jobs].reverse().find(job => rsiKey(job.source) === rsiKey(source) && !this.store.conversation(job.conversationId)?.archivedAt && this.store.conversation(job.conversationId));
|
|
99
|
+
const existing = [...this.jobs].reverse().find(job => job.status !== "cancelled" && rsiKey(job.source) === rsiKey(source) && !this.store.conversation(job.conversationId)?.archivedAt && this.store.conversation(job.conversationId));
|
|
97
100
|
if (existing) {
|
|
98
|
-
if (busy(this.store.conversation(existing.conversationId)?.status) ||
|
|
99
|
-
|
|
100
|
-
if (existing.
|
|
101
|
+
if (busy(this.store.conversation(existing.conversationId)?.status) || existing.status === "implementing")
|
|
102
|
+
throw new Error("RSI 讨论仍在处理中,请等它回复后再继续。");
|
|
103
|
+
if (initialPrompt && existing.status !== "cancelled") {
|
|
104
|
+
existing.status = "discussing";
|
|
105
|
+
delete existing.error;
|
|
106
|
+
existing.updatedAt = new Date().toISOString();
|
|
107
|
+
await this.save();
|
|
108
|
+
await this.hooks.send(existing.conversationId, initialPrompt);
|
|
109
|
+
const userMessageId = this.store.conversation(existing.conversationId)?.messages.filter(message => message.role === "user").at(-1)?.id;
|
|
110
|
+
if (userMessageId && report)
|
|
111
|
+
existing.observationMessageIds = [...(existing.observationMessageIds ?? []), userMessageId];
|
|
112
|
+
if (report) {
|
|
113
|
+
existing.observationSourceKey = report.sourceKey;
|
|
114
|
+
existing.reportId = report.id;
|
|
115
|
+
delete existing.findingId;
|
|
116
|
+
}
|
|
117
|
+
await this.save();
|
|
118
|
+
}
|
|
119
|
+
else if (report && (existing.observationSourceKey !== report.sourceKey || ["completed", "cancelled"].includes(existing.status))) {
|
|
101
120
|
existing.status = "discussing";
|
|
102
121
|
await this.save();
|
|
103
122
|
await this.hooks.send(existing.conversationId, `继续同一来源的综合 RSI 讨论。继承用户此前的意见和适用边界。本次没有实施授权,不扩展任何旧授权范围。以下是最新整体观察数据,请合并更新判断,避免逐点重复报告:\n${rsiEvidence(JSON.stringify({ report, context })).slice(0, 28000)}`);
|
|
@@ -112,10 +131,13 @@ export class RsiRepairs {
|
|
|
112
131
|
return;
|
|
113
132
|
}
|
|
114
133
|
const title = "RSI · 整体改进讨论";
|
|
115
|
-
const prompt =
|
|
134
|
+
const prompt = initialPrompt
|
|
135
|
+
? `${initialPrompt}${report ? `\n\n---\nRSI 当前观察摘要(仅作补充上下文,不覆盖用户问题):\n${rsiEvidence(JSON.stringify({ report, context })).slice(0, 24000)}` : ""}`
|
|
136
|
+
: `继续同一来源的综合 RSI 讨论。继承用户此前的意见和适用边界。本次没有实施授权,不扩展任何旧授权范围。以下是最新整体观察数据,请合并更新判断,避免逐点重复报告:\n${rsiEvidence(JSON.stringify({ report, context })).slice(0, 28000)}`;
|
|
116
137
|
const id = await this.hooks.discuss(source, title, prompt);
|
|
117
138
|
const now = new Date().toISOString();
|
|
118
|
-
this.jobs.push({ id: randomUUID(), source: { ...source }, reportId: report
|
|
139
|
+
this.jobs.push({ id: randomUUID(), source: { ...source }, reportId: report?.id, observationSourceKey: report?.sourceKey, title, conversationId: id, status: "discussing", createdAt: now, updatedAt: now,
|
|
140
|
+
initialMessageId: this.store.conversation(id)?.messages.find(message => message.role === "user")?.id, ...(initialPrompt ? { initialPrompt } : {}) });
|
|
119
141
|
await this.save();
|
|
120
142
|
return;
|
|
121
143
|
}
|
package/dist/shared/rsi.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type RsiSource = {
|
|
|
7
7
|
export type RsiRepair = {
|
|
8
8
|
id: string;
|
|
9
9
|
source: RsiSource;
|
|
10
|
-
reportId
|
|
10
|
+
reportId?: string;
|
|
11
11
|
findingId?: string;
|
|
12
12
|
title: string;
|
|
13
13
|
conversationId: string;
|
|
@@ -21,6 +21,7 @@ export type RsiRepair = {
|
|
|
21
21
|
error?: string;
|
|
22
22
|
initialMessageId?: string;
|
|
23
23
|
executionMessageId?: string;
|
|
24
|
+
initialPrompt?: string;
|
|
24
25
|
observationMessageIds?: string[];
|
|
25
26
|
approvals?: {
|
|
26
27
|
at: string;
|