@evandu/super-pi 0.1.239 → 0.1.241
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 +8 -8
- package/dist/client/assets/{CodeMirrorEditor-CtzPSOsS.js → CodeMirrorEditor-CiOKD-_q.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-iNVZVVMb.js → GitDiffEditor-D5VMi7K-.js} +1 -1
- package/dist/client/assets/index-CwH7sttH.css +1 -0
- package/dist/client/assets/index-oUDSLOqG.js +347 -0
- package/dist/client/index.html +2 -2
- package/dist/server/application/extension-ui-service.d.ts +3 -1
- package/dist/server/application/extension-ui-service.js +20 -7
- package/dist/server/application/run-service.d.ts +19 -61
- package/dist/server/application/run-service.js +221 -372
- package/dist/server/application/workspace-service.js +1 -1
- package/dist/server/content-search.d.ts +13 -39
- package/dist/server/content-search.js +202 -219
- package/dist/server/exec-service.d.ts +14 -7
- package/dist/server/exec-service.js +66 -40
- package/dist/server/http-server.js +69 -31
- package/dist/server/index.js +6 -6
- package/dist/server/store.d.ts +11 -24
- package/dist/server/store.js +88 -62
- package/dist/server/subagent-runs.d.ts +3 -2
- package/dist/server/subagent-runs.js +45 -33
- package/dist/server/subagents.d.ts +1 -0
- package/dist/server/subagents.js +30 -12
- package/dist/server/types.d.ts +13 -11
- package/dist/server/ws-server.d.ts +3 -0
- package/dist/server/ws-server.js +40 -6
- package/dist/shared/background-task.d.ts +22 -0
- package/dist/shared/background-task.js +5 -0
- package/dist/shared/content-search.d.ts +22 -0
- package/dist/shared/content-search.js +1 -0
- package/package.json +1 -1
- package/dist/client/assets/index-C5kxyPTT.js +0 -340
- package/dist/client/assets/index-DN0oBG6l.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-oUDSLOqG.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-CwH7sttH.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
@@ -34,7 +34,9 @@ export declare class ExtensionUiService {
|
|
|
34
34
|
/**
|
|
35
35
|
* Cancels any pending UI requests for a given conversation.
|
|
36
36
|
*/
|
|
37
|
-
cancelPendingUi(conversationId: string, reason: ExtensionUiCloseReason
|
|
37
|
+
cancelPendingUi(conversationId: string, reason: ExtensionUiCloseReason, owner?: {
|
|
38
|
+
runId?: string;
|
|
39
|
+
}): void;
|
|
38
40
|
/**
|
|
39
41
|
* Creates an ExtensionUiHost interface for a conversation or subagent run.
|
|
40
42
|
*/
|
|
@@ -19,7 +19,7 @@ export class ExtensionUiService {
|
|
|
19
19
|
.map(({ conversationId, request }) => ({ conversationId, request }));
|
|
20
20
|
for (const [conversationId, requests] of this.view) {
|
|
21
21
|
if (visible.has(conversationId))
|
|
22
|
-
for (const request of requests.values())
|
|
22
|
+
for (const { request } of requests.values())
|
|
23
23
|
pending.push({ conversationId, request });
|
|
24
24
|
}
|
|
25
25
|
return pending;
|
|
@@ -61,10 +61,23 @@ export class ExtensionUiService {
|
|
|
61
61
|
/**
|
|
62
62
|
* Cancels any pending UI requests for a given conversation.
|
|
63
63
|
*/
|
|
64
|
-
cancelPendingUi(conversationId, reason) {
|
|
65
|
-
|
|
64
|
+
cancelPendingUi(conversationId, reason, owner) {
|
|
65
|
+
let cleared = false;
|
|
66
|
+
if (reason !== "expired") {
|
|
67
|
+
const view = this.view.get(conversationId);
|
|
68
|
+
if (!owner)
|
|
69
|
+
cleared = this.view.delete(conversationId);
|
|
70
|
+
else if (view) {
|
|
71
|
+
for (const [key, item] of view) {
|
|
72
|
+
if (item.runId === owner.runId)
|
|
73
|
+
cleared = view.delete(key) || cleared;
|
|
74
|
+
}
|
|
75
|
+
if (!view.size)
|
|
76
|
+
this.view.delete(conversationId);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
66
79
|
for (const [key, pending] of [...this.pendingUi]) {
|
|
67
|
-
if (pending.conversationId === conversationId) {
|
|
80
|
+
if (pending.conversationId === conversationId && (!owner || pending.runId === owner.runId)) {
|
|
68
81
|
this.settleUi(key, { cancelled: true }, reason);
|
|
69
82
|
}
|
|
70
83
|
}
|
|
@@ -82,14 +95,14 @@ export class ExtensionUiService {
|
|
|
82
95
|
return;
|
|
83
96
|
const shown = scoped(request);
|
|
84
97
|
if (request.method === "setStatus" || request.method === "setWidget" || request.method === "setTitle") {
|
|
85
|
-
const key = JSON.stringify([request.method, request.statusKey ?? request.widgetKey ?? ""]);
|
|
98
|
+
const key = JSON.stringify([runId ?? null, request.method, request.statusKey ?? request.widgetKey ?? ""]);
|
|
86
99
|
const view = this.view.get(conversationId) ?? new Map();
|
|
87
100
|
if ((request.method === "setStatus" && request.statusText === undefined)
|
|
88
101
|
|| (request.method === "setWidget" && request.widgetLines === undefined)
|
|
89
102
|
|| (request.method === "setTitle" && !request.title))
|
|
90
103
|
view.delete(key);
|
|
91
104
|
else
|
|
92
|
-
view.set(key, shown);
|
|
105
|
+
view.set(key, { request: shown, runId });
|
|
93
106
|
if (view.size)
|
|
94
107
|
this.view.set(conversationId, view);
|
|
95
108
|
else
|
|
@@ -107,7 +120,7 @@ export class ExtensionUiService {
|
|
|
107
120
|
// one: a question Pi chose to leave open is a question the model is waiting on, and a
|
|
108
121
|
// fabricated cancel would be the model continuing on a false premise. The run-level
|
|
109
122
|
// teardown (stop / abort / shutdown) is the path that closes an unanswered ask.
|
|
110
|
-
const pending = { conversationId, request: shown, resolve };
|
|
123
|
+
const pending = { conversationId, runId, request: shown, resolve };
|
|
111
124
|
if (shown.timeoutMs !== undefined) {
|
|
112
125
|
pending.timer = setTimeout(() => {
|
|
113
126
|
this.settleUi(key, { cancelled: true }, "timeout");
|
|
@@ -6,6 +6,7 @@ import type { EventBroadcaster } from "../server-context.js";
|
|
|
6
6
|
import type { ExtensionUiService } from "./extension-ui-service.js";
|
|
7
7
|
import type { WorkflowEngine } from "../workflow-engine.js";
|
|
8
8
|
import { FileChangeTracker } from "../file-changes.js";
|
|
9
|
+
import type { ExecCompletion } from "../exec-service.js";
|
|
9
10
|
/**
|
|
10
11
|
* Validates a caller-supplied delivery mode without silently falling back on bogus values.
|
|
11
12
|
* Undefined defaults to `"queue"`; any other value is rejected explicitly.
|
|
@@ -117,6 +118,7 @@ export declare class RunService {
|
|
|
117
118
|
private readonly runCompletions;
|
|
118
119
|
/** A selected interrupt owns the next free run slot, even while the old child exits. */
|
|
119
120
|
private readonly interruptTargets;
|
|
121
|
+
private readonly pendingBackgroundWakeups;
|
|
120
122
|
private shuttingDown;
|
|
121
123
|
/** Preserve incoming background results as waiting messages while the server drains its producers. */
|
|
122
124
|
beginShutdown(): void;
|
|
@@ -155,7 +157,9 @@ export declare class RunService {
|
|
|
155
157
|
} | undefined;
|
|
156
158
|
waitForToolCall(conversationId: string, toolCallId: string | undefined): Promise<ReturnType<RunService["originForToolCall"]>>;
|
|
157
159
|
private execService;
|
|
158
|
-
|
|
160
|
+
private backgroundLogDirectory?;
|
|
161
|
+
private readonly execSettlements;
|
|
162
|
+
setExecService(execService: import("../exec-service.js").ExecService, logDirectory?: string): void;
|
|
159
163
|
/**
|
|
160
164
|
* Called by the exec completion handler in index.ts when a background exec session ends.
|
|
161
165
|
* Injects the result into the conversation and cleans up the background task record.
|
|
@@ -166,7 +170,10 @@ export declare class RunService {
|
|
|
166
170
|
* when nothing else is busy. The render stays as a 后台回传 block throughout - in dock and in
|
|
167
171
|
* transcript - so a `role: "user"` is never impersonated.
|
|
168
172
|
*/
|
|
169
|
-
enqueueExecResult(sessionId: string, exitCode: number, stdout: string, stderr: string): void;
|
|
173
|
+
enqueueExecResult(sessionId: string, exitCode: number, stdout: string, stderr: string, completion?: ExecCompletion): void;
|
|
174
|
+
failBackgroundTaskStart(taskId: string, reason: string, cancelled?: boolean): Promise<void>;
|
|
175
|
+
private finishBackgroundResult;
|
|
176
|
+
private startBackgroundResult;
|
|
170
177
|
/**
|
|
171
178
|
* Delivers an orchestrated child session's final output to its direct parent. This intentionally uses
|
|
172
179
|
* the same waiting-queue contract as background sub-agent results: one result per turn, ahead of
|
|
@@ -179,24 +186,8 @@ export declare class RunService {
|
|
|
179
186
|
resultPath: string;
|
|
180
187
|
error?: string;
|
|
181
188
|
}): Promise<void>;
|
|
182
|
-
/**
|
|
183
|
-
* Dispatches a background result (exec or child session) into the conversation.
|
|
184
|
-
*
|
|
185
|
-
* IDLE: starts a fresh turn via `processWaitingMessage`.
|
|
186
|
-
* BUSY: attempts to steer the message into the running turn so it is delivered at the
|
|
187
|
-
* very next tool batch boundary rather than waiting for the entire turn to complete.
|
|
188
|
-
* INTERRUPTING: quietly leaves the message waiting; the interrupted or next turn will pick it up.
|
|
189
|
-
*/
|
|
190
189
|
private dispatchBackgroundResult;
|
|
191
|
-
|
|
192
|
-
* Stops an active background task (spawned process or detached subagent) on user request.
|
|
193
|
-
*
|
|
194
|
-
* 1. Kills the underlying PTY child process if one exists in `execService`.
|
|
195
|
-
* 2. If the task originated from a tool call in a conversation transcript, marks the tool
|
|
196
|
-
* call as failed with a clear message and broadcasts `message.tools`.
|
|
197
|
-
* 3. Removes the task from `state.backgroundTasks` and broadcasts `state` so the sidebar
|
|
198
|
-
* updates immediately.
|
|
199
|
-
*/
|
|
190
|
+
private wakeWaitingBackgroundResult;
|
|
200
191
|
stopBackgroundTask(taskId: string): Promise<void>;
|
|
201
192
|
hasActiveBackgroundTasks(conversationId: string): boolean;
|
|
202
193
|
settleBackgroundStatus(conversationId: string): Promise<void>;
|
|
@@ -286,6 +277,8 @@ export declare class RunService {
|
|
|
286
277
|
* left HTTP-only paths with no owner at all.
|
|
287
278
|
*/
|
|
288
279
|
verifyPrimaryCapability(conversationId: string, capability: unknown): import("../capability.js").CapabilityVerdict;
|
|
280
|
+
foregroundSignal(conversationId: string): AbortSignal | undefined;
|
|
281
|
+
canAdmitBackgroundTask(signal?: AbortSignal): boolean;
|
|
289
282
|
/**
|
|
290
283
|
* Aborts all active conversation runs and sub-agents.
|
|
291
284
|
*/
|
|
@@ -303,7 +296,9 @@ export declare class RunService {
|
|
|
303
296
|
/**
|
|
304
297
|
* Stops an active turn run for a conversation.
|
|
305
298
|
*/
|
|
306
|
-
stopRun(conversationId: string
|
|
299
|
+
stopRun(conversationId: string, options?: {
|
|
300
|
+
foregroundOnly?: boolean;
|
|
301
|
+
}): Promise<void>;
|
|
307
302
|
/** Releases waits that can prevent Pi's abort from reaching its idle state. Idempotent by design. */
|
|
308
303
|
private cancelPendingRunInteractions;
|
|
309
304
|
private stopRunUnsafe;
|
|
@@ -321,41 +316,8 @@ export declare class RunService {
|
|
|
321
316
|
* the moment Pi holds it.
|
|
322
317
|
*/
|
|
323
318
|
onPiQueue(conversationId: string, snapshot: PiQueueSnapshot): void;
|
|
324
|
-
/**
|
|
325
|
-
* The message a delivery is about, resolved by the text Pi announced.
|
|
326
|
-
*
|
|
327
|
-
* WHY THE TEXT AND NOT THE POSITION. A message that was STEERED is `sending` here - claimed, so the
|
|
328
|
-
* user cannot withdraw it - and the oldest `sending` message is the one Pi picked up, because Pi's
|
|
329
|
-
* steering queue is FIFO. That is the old rule and it still holds. A message that was handed to Pi's
|
|
330
|
-
* FOLLOW-UP queue is NOT `sending`: Super Pi keeps it in its own list so the user can still withdraw
|
|
331
|
-
* it, and a conversation can hold a `waiting` message and a `sending` one at the same time. For that
|
|
332
|
-
* one, position is the wrong question and the text is the right one.
|
|
333
|
-
*
|
|
334
|
-
* THE TEXT IS THE SAME TEXT ON BOTH SIDES. Pi matches its own queue by `indexOf` on the message text
|
|
335
|
-
* (`agent-session.ts:1123`), so two messages with identical words are ONE entry to Pi and the first of
|
|
336
|
-
* them to Super Pi as well. Resolving by text is therefore not a guess that could pick a different
|
|
337
|
-
* message than Pi did - it is the same comparison Pi itself made.
|
|
338
|
-
*
|
|
339
|
-
* A `sending` message wins over a `waiting` one with the same text, because Pi drains its steering
|
|
340
|
-
* queue before its follow-up queue, so the steering message is the one that was delivered first.
|
|
341
|
-
*/
|
|
319
|
+
/** Ordinary waiting rows belong to Super Pi and cannot be delivered by a Pi event. */
|
|
342
320
|
private matchDeliveredMessage;
|
|
343
|
-
/**
|
|
344
|
-
* Hands a waiting message to Pi's follow-up queue, so the run that is already going answers it.
|
|
345
|
-
*
|
|
346
|
-
* WHY THIS EXISTS. A message typed while the agent was busy used to wait for the current turn to END
|
|
347
|
-
* and then be answered by a turn of its own - a fresh `prompt()`, which runs Pi's `_prepareRun`, which
|
|
348
|
-
* emits `before_agent_start`. Super Pi's memory extension answers that hook with an HTTP search and
|
|
349
|
-
* patches the system prompt with what came back, so every queued message paid for a round trip to the
|
|
350
|
-
* memory endpoint and for a prompt larger than the one before it. A follow-up is delivered by Pi's
|
|
351
|
-
* agent loop inside the running turn, so it pays for neither.
|
|
352
|
-
*
|
|
353
|
-
* IT IS AN OPTIMISATION, NOT A COMMITMENT. The message stays in Super Pi's own waiting list, so it is
|
|
354
|
-
* still the user's to withdraw and still the user's to interrupt, and if Pi does not deliver it - the
|
|
355
|
-
* run was aborted, the queues were cleared - the message falls back to being answered by a turn of its
|
|
356
|
-
* own. Nothing is lost either way, which is what makes it safe to try.
|
|
357
|
-
*/
|
|
358
|
-
private submitToPiQueue;
|
|
359
321
|
/**
|
|
360
322
|
* Empties Pi's steering and follow-up queues for a conversation.
|
|
361
323
|
*
|
|
@@ -377,7 +339,6 @@ export declare class RunService {
|
|
|
377
339
|
*
|
|
378
340
|
* Remaining steering messages not in `excludeMessageIds` are put back into Pi's steering queue
|
|
379
341
|
* in FIFO order (matching at most once per message ID even when two messages share identical text).
|
|
380
|
-
* Remaining follow-up messages stay in Super Pi's waiting list and run after the active turn.
|
|
381
342
|
*/
|
|
382
343
|
private clearPiQueues;
|
|
383
344
|
/**
|
|
@@ -483,10 +444,8 @@ export declare class RunService {
|
|
|
483
444
|
/**
|
|
484
445
|
* The lower-level "wait for run slot, open the turn on a specific waiting message, run it" sequence.
|
|
485
446
|
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
* branch (which only call it when `!this.activeRuns.has(conversationId)`). The two callers differ
|
|
489
|
-
* only in who arrived first; the open-turn-and-run contract is the same.
|
|
447
|
+
* Automatic callers leave the row waiting if another producer owns the conversation.
|
|
448
|
+
* Explicit actions report a conflict if their selected message cannot start.
|
|
490
449
|
*
|
|
491
450
|
* `runConversationTurns` owns opening the first turn. It must be the ONLY opener: opening here and
|
|
492
451
|
* then asking that loop to run the same message used to splice two assistant placeholders under one
|
|
@@ -499,8 +458,7 @@ export declare class RunService {
|
|
|
499
458
|
private steerUnsafe;
|
|
500
459
|
/**
|
|
501
460
|
* Steers a newly queued message into the running turn at the next turn boundary.
|
|
502
|
-
*
|
|
503
|
-
* conversation lane is entered.
|
|
461
|
+
* Starts a fresh turn if the active run ends before the conversation lane is entered.
|
|
504
462
|
*/
|
|
505
463
|
private steerWaitingMessageOnBusyRun;
|
|
506
464
|
/**
|