@evandu/super-pi 0.1.278 → 0.1.279
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/desktop/main.cjs +5 -1
- package/dist/.super-pi-check-inputs.json +2 -2
- package/dist/client/.super-pi-client-sources.json +4 -4
- package/dist/client/assets/{CodeMirrorEditor-CmfIAppR.js → CodeMirrorEditor-D-UuYizz.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-BZ2Kff1j.js → GitDiffEditor-Bt1n2la-.js} +1 -1
- package/dist/client/assets/{index-sXiJhOAC.js → index-rWE1xu-t.js} +5 -5
- package/dist/client/index.html +1 -1
- package/dist/server/application/rsi-service.js +17 -4
- package/package.json +1 -2
package/dist/client/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
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-rWE1xu-t.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/index-B5TLGyEw.css">
|
|
14
14
|
</head>
|
|
@@ -5,6 +5,7 @@ import { rsiKey } from "../../shared/rsi.js";
|
|
|
5
5
|
import { defaultGroupRsi, parseRsiReport, rsiInput, rsiSourceKey, RSI_INSTRUCTIONS } from "./group-rsi.js";
|
|
6
6
|
import { rsiEvidence } from "../rsi-evidence.js";
|
|
7
7
|
import { applicableRules, assertModelAllowed } from "../model-filter.js";
|
|
8
|
+
import { resolveFileCwd } from "../session-cwd.js";
|
|
8
9
|
/** Observations never block foreground turns; implementation uses ordinary visible primary sessions. */
|
|
9
10
|
export class RsiService {
|
|
10
11
|
directory;
|
|
@@ -104,6 +105,8 @@ export class RsiService {
|
|
|
104
105
|
this.schedule({ kind: "session", id, workspaceId: conversation.workspaceId });
|
|
105
106
|
}
|
|
106
107
|
schedule(source, force = false) {
|
|
108
|
+
if (this.store.workspace(source.workspaceId)?.closedAt)
|
|
109
|
+
return;
|
|
107
110
|
const key = this.source(source), state = this.data.sessions[key] ?? defaultGroupRsi();
|
|
108
111
|
if (this.closed || state.enabled === false || this.observing.has(key) || this.timers.has(key))
|
|
109
112
|
return;
|
|
@@ -135,13 +138,13 @@ export class RsiService {
|
|
|
135
138
|
return { id: source.id, workspaceId: source.workspaceId, title: conversation.title, updatedAt: conversation.updatedAt, revision: 0, members: [], moderator: { prompt: "" }, messages, executions };
|
|
136
139
|
}
|
|
137
140
|
async observe(source) {
|
|
138
|
-
if (this.closed)
|
|
141
|
+
if (this.closed || this.store.workspace(source.workspaceId)?.closedAt)
|
|
139
142
|
return;
|
|
140
143
|
const key = this.source(source), room = this.sessionRoom(source), conversation = this.store.conversation(source.id);
|
|
141
144
|
if (!["completed", "failed"].includes(conversation.status) || conversation.archivedAt || conversation.agentId === "rsi-builder" || conversation.parentConversationId)
|
|
142
145
|
return;
|
|
143
146
|
const state = this.data.sessions[key] ??= defaultGroupRsi();
|
|
144
|
-
const sourceKey = rsiSourceKey(room)
|
|
147
|
+
const sourceKey = `${rsiSourceKey(room)}:${conversation.cwd ?? ""}`;
|
|
145
148
|
if (state.enabled === false || state.sourceKey === sourceKey || this.observing.has(key) || !room.messages.some(post => post.role === "assistant"))
|
|
146
149
|
return;
|
|
147
150
|
const controller = new AbortController();
|
|
@@ -158,12 +161,13 @@ export class RsiService {
|
|
|
158
161
|
const coverage = rsiInput(room, room.executions, 42000);
|
|
159
162
|
const model = state.model ?? conversation.model ?? this.store.workspace(source.workspaceId)?.defaultModel;
|
|
160
163
|
const workspace = this.store.workspace(source.workspaceId);
|
|
164
|
+
const cwd = await resolveFileCwd(workspace.path, conversation.cwd);
|
|
161
165
|
const rules = this.store.modelFilterRules?.() ?? [];
|
|
162
166
|
if (applicableRules(rules, workspace).length)
|
|
163
167
|
assertModelAllowed(rules, workspace, model ?? (await this.runtime.catalog()).defaultModel);
|
|
164
168
|
const artifactReads = [];
|
|
165
169
|
let calls = 0;
|
|
166
|
-
const report = parseRsiReport(await this.runtime.askOnce({ agent, model, cwd
|
|
170
|
+
const report = parseRsiReport(await this.runtime.askOnce({ agent, model, cwd, signal: controller.signal, timeoutMs: 90000,
|
|
167
171
|
onToolStart: () => { if (++calls > 12)
|
|
168
172
|
controller.abort(); },
|
|
169
173
|
onExecution: event => { if (event.kind === "tool" && event.phase === "end" && event.call.name === "read" && event.call.status === "ok" && event.call.detail)
|
|
@@ -200,13 +204,15 @@ export class RsiService {
|
|
|
200
204
|
const finding = report.findings.find(item => item.ownership === "user" && item.ownershipReason && item.capability && (item.capability.repeatToolIds?.length ?? 0) >= 2 && item.priority !== "low" && item.disposition !== "dismissed");
|
|
201
205
|
if (finding) {
|
|
202
206
|
const recent = this.data.improvements.filter(job => job.key === `${finding.capability.kind}:${finding.capability.slug}` && Date.now() - Date.parse(job.createdAt) < 86400000);
|
|
203
|
-
if (recent.some(job => job.status === 'cancelled') || recent.filter(job => ['failed', 'interrupted'].includes(job.status)).length >= 2)
|
|
207
|
+
if (recent.some(job => job.status === 'cancelled') || recent.filter(job => job.conversationId && ['failed', 'interrupted'].includes(job.status)).length >= 2)
|
|
204
208
|
return;
|
|
205
209
|
await this.improve(source, report, finding.id, context);
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
async improve(source, report, findingId, context) {
|
|
209
213
|
this.source(source);
|
|
214
|
+
if (this.store.workspace(source.workspaceId)?.closedAt)
|
|
215
|
+
throw new Error("工作区已关闭,不能启动新的能力开发。");
|
|
210
216
|
const finding = report.findings.find(item => item.id === findingId);
|
|
211
217
|
if (!finding || finding.ownership !== "user" || !finding.capability)
|
|
212
218
|
throw new Error("仅明确属于用户侧且具备具体能力和验收要求的建议可发起开发。");
|
|
@@ -242,6 +248,13 @@ export class RsiService {
|
|
|
242
248
|
for (const job of this.data.improvements.filter(job => job.status === "queued")) {
|
|
243
249
|
if (this.closed || activeWorkspaces.has(job.source.workspaceId))
|
|
244
250
|
continue;
|
|
251
|
+
if (this.store.workspace(job.source.workspaceId)?.closedAt) {
|
|
252
|
+
job.status = "interrupted";
|
|
253
|
+
job.error = "工作区已关闭,未启动能力开发。";
|
|
254
|
+
job.updatedAt = new Date().toISOString();
|
|
255
|
+
await this.save();
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
245
258
|
activeWorkspaces.add(job.source.workspaceId);
|
|
246
259
|
job.status = "running";
|
|
247
260
|
job.updatedAt = new Date().toISOString();
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"superPi": {
|
|
4
4
|
"managedDirectListener": true
|
|
5
5
|
},
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.279",
|
|
7
7
|
"description": "Web control plane and companion for Pi",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"type": "module",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"check:logic": [
|
|
57
57
|
"scripts/rsi-capability-loop.test.mjs",
|
|
58
|
-
|
|
59
58
|
"scripts/desktop-window-state.test.mjs",
|
|
60
59
|
"scripts/remote-listener.test.mjs",
|
|
61
60
|
"scripts/group-member-sessions.test.mjs",
|