@evandu/super-pi 0.1.146 → 0.1.147
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/agents/super-pi-task/core.ts +60 -1
- package/agents/super-pi-task/index.ts +4 -0
- package/dist/.super-pi-check-inputs.json +2 -2
- package/dist/client/.super-pi-client-sources.json +8 -8
- package/dist/client/assets/{CodeMirrorEditor-CEwBCVM6.js → CodeMirrorEditor-DQCjEnxG.js} +2 -2
- package/dist/client/assets/{dist-DC1IocrS.js → dist-1Innu17E.js} +1 -1
- package/dist/client/assets/{dist-CSCUT1PQ.js → dist-1lynFOc5.js} +1 -1
- package/dist/client/assets/{dist-Do52MRwm.js → dist-B1qLZVMK.js} +1 -1
- package/dist/client/assets/{dist-CAOcjKAQ.js → dist-B4pz_xdd.js} +1 -1
- package/dist/client/assets/{dist-B0RXZeXQ.js → dist-B6KwDpeI.js} +1 -1
- package/dist/client/assets/{dist-DFMtP3wG.js → dist-BJVI1Unv.js} +1 -1
- package/dist/client/assets/{dist-oLq6HXLG.js → dist-BWvzD8Pe.js} +1 -1
- package/dist/client/assets/{dist-9F1wL-T5.js → dist-BayWssd0.js} +1 -1
- package/dist/client/assets/{dist-DBUqwiWG.js → dist-Bk_pkBVH.js} +1 -1
- package/dist/client/assets/{dist-CbVf2Cjn.js → dist-BpeClAv0.js} +1 -1
- package/dist/client/assets/{dist-DftD4ibj.js → dist-BsmJg5PX.js} +1 -1
- package/dist/client/assets/{dist-CUB_Chdh.js → dist-Bx7s4rni.js} +1 -1
- package/dist/client/assets/{dist-Bh8Q7Y_n.js → dist-CDBKM9tL.js} +1 -1
- package/dist/client/assets/{dist-BoyICDlL.js → dist-CGzXCzCG.js} +1 -1
- package/dist/client/assets/{dist-BCNaDgNW.js → dist-CRxCwn-Z.js} +1 -1
- package/dist/client/assets/{dist-76ArZ5M4.js → dist-CTDgUnBG.js} +1 -1
- package/dist/client/assets/{dist-BXBSIuTD.js → dist-D1VfMWmf.js} +1 -1
- package/dist/client/assets/{dist-DN0GlnnZ.js → dist-DTZLNEci.js} +1 -1
- package/dist/client/assets/{dist-JvQIIdqB.js → dist-DuUi29km.js} +1 -1
- package/dist/client/assets/{dist-CHt8PX8R.js → dist-F3S0t1oM.js} +1 -1
- package/dist/client/assets/{dist-BuR5Iagd.js → dist-QZ-FAVJV.js} +1 -1
- package/dist/client/assets/{dist-Bx6ZWYUW.js → dist-u0nBg0fZ.js} +1 -1
- package/dist/client/assets/index-BMpqviwU.css +1 -0
- package/dist/client/assets/{index-E7yaLa2C.js → index-Dzyp_7sf.js} +43 -43
- package/dist/client/index.html +2 -2
- package/dist/server/active-memory.d.ts +17 -0
- package/dist/server/active-memory.js +39 -0
- package/dist/server/application/conversation-service.js +6 -0
- package/dist/server/application/run-service.d.ts +16 -0
- package/dist/server/application/run-service.js +175 -26
- package/dist/server/application/session-orchestrator-service.d.ts +103 -1
- package/dist/server/application/session-orchestrator-service.js +303 -8
- package/dist/server/application/session-watchdog.d.ts +159 -0
- package/dist/server/application/session-watchdog.js +244 -0
- package/dist/server/http-server.js +136 -76
- package/dist/server/index.js +3 -0
- package/dist/server/knowledge-vectors.d.ts +15 -0
- package/dist/server/knowledge-vectors.js +118 -37
- package/dist/server/knowledge.d.ts +7 -8
- package/dist/server/knowledge.js +133 -55
- package/dist/server/length-continuation.d.ts +50 -0
- package/dist/server/length-continuation.js +55 -0
- package/dist/server/pi-session-events.js +5 -1
- package/dist/server/pi-session-pool.d.ts +2 -0
- package/dist/server/pi-session-pool.js +16 -0
- package/dist/server/runtime.js +2 -1
- package/dist/server/session-tree-scope.d.ts +125 -0
- package/dist/server/session-tree-scope.js +337 -0
- package/dist/server/store.d.ts +13 -0
- package/dist/server/store.js +37 -4
- package/dist/server/task-tool.d.ts +1 -1
- package/dist/server/task-tool.js +2 -1
- package/dist/server/turn-failure.d.ts +26 -0
- package/dist/server/turn-failure.js +51 -0
- package/dist/server/types.d.ts +15 -1
- package/package.json +19 -3
- package/dist/client/assets/index-D-OxlUxN.css +0 -1
package/dist/server/task-tool.js
CHANGED
|
@@ -384,7 +384,8 @@ Usage notes:
|
|
|
384
384
|
2. The initial task should provide clear context and goals since the new session starts with a fresh conversation history.
|
|
385
385
|
3. Use session_status with the returned conversationId to check progress, or session_dispatch to send further messages.
|
|
386
386
|
4. The new session reports completion to its DIRECT parent automatically. 'parentConversationId' optionally selects that parent; by default it is the calling session.
|
|
387
|
-
5. The new session always belongs to the calling session's workspace. Pass 'cwd' as a workspace-relative subdirectory (for example, 'packages/a') when it should work below the workspace root; absolute paths and traversal are rejected
|
|
387
|
+
5. The new session always belongs to the calling session's workspace. Pass 'cwd' as a workspace-relative subdirectory (for example, 'packages/a') when it should work below the workspace root; absolute paths and traversal are rejected.
|
|
388
|
+
6. Optionally pass 'model' to choose which model the NEW session runs on: {"provider":"...","modelId":"..."} - the same "provider/modelId" pair the model picker shows, and BOTH halves are required. Leave 'model' out and the new session starts on the workspace default model.`;
|
|
388
389
|
/** Model-facing description for session_status. */
|
|
389
390
|
export const SESSION_STATUS_DESCRIPTION = `Inspect the progress, run state, and latest activity of sibling conversations created by the orchestrator.
|
|
390
391
|
|
|
@@ -19,4 +19,30 @@
|
|
|
19
19
|
* needs no server, socket or Pi process.
|
|
20
20
|
*/
|
|
21
21
|
export declare function formatTurnFailure(error: unknown): string;
|
|
22
|
+
/**
|
|
23
|
+
* THE MODEL FILLED ITS OUTPUT BUDGET AND STOPPED MID-ANSWER.
|
|
24
|
+
*
|
|
25
|
+
* A length stop is NOT a crash. The provider answered, streamed real text, and stopped because it
|
|
26
|
+
* ran out of `max_tokens` - which is what happens every time an answer is longer than one output
|
|
27
|
+
* budget. Treating it as a failure is what made an orchestrated child session die: the run service
|
|
28
|
+
* stamped the conversation `failed`, the orchestrator reported a failure to the parent, and a task
|
|
29
|
+
* that was one sentence from done was thrown away.
|
|
30
|
+
*
|
|
31
|
+
* It carries a CLASS so the layers above can tell it apart from a provider error by identity rather
|
|
32
|
+
* than by matching a Chinese substring - the message is written for a reader, and a reader-facing
|
|
33
|
+
* sentence is not a reliable machine contract.
|
|
34
|
+
*/
|
|
35
|
+
export declare class LengthExceededError extends Error {
|
|
36
|
+
readonly stopReason: "length";
|
|
37
|
+
constructor(message?: string);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Whether this failure is a length stop rather than a real failure.
|
|
41
|
+
*
|
|
42
|
+
* The class is the answer; the message match is the BACKSTOP for a throw site that never got to
|
|
43
|
+
* construct the class - an error that crossed a process boundary, or one that was rebuilt from its
|
|
44
|
+
* text somewhere along the way. Both are checked because a length stop that loses its class on the
|
|
45
|
+
* way up is exactly the case that used to kill a child session.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isLengthExceededError(error: unknown): boolean;
|
|
22
48
|
export declare function controllerAborted(error: unknown): boolean;
|
|
@@ -82,11 +82,62 @@ export function formatTurnFailure(error) {
|
|
|
82
82
|
if (lower.includes("不支持图片输入")) {
|
|
83
83
|
return raw;
|
|
84
84
|
}
|
|
85
|
+
// LENGTH LIMIT - the model stopped because it filled the output budget, NOT because anything
|
|
86
|
+
// broke. The answer is incomplete, but everything that was said is still on screen, so the
|
|
87
|
+
// sentence has to offer the way out (say "continue") instead of calling it a failure.
|
|
88
|
+
//
|
|
89
|
+
// THE SENTENCE IS BUILT, NOT TAKEN FROM THE ERROR. The error's own message says the fact
|
|
90
|
+
// ("模型输出达到本轮长度上限,回答未完成") and stops there - which is a statement, not an action, and
|
|
91
|
+
// a reader who is told a thing stopped has no idea what to do next. What they need is the way
|
|
92
|
+
// out, so the sentence always carries it. Pi's own words are kept only when they add something
|
|
93
|
+
// the sentence does not already say.
|
|
94
|
+
if (isLengthExceededError(error)) {
|
|
95
|
+
const detail = raw && !/长度上限/.test(raw) ? `(${raw})` : "";
|
|
96
|
+
return `模型单次输出达到长度上限,回答没有写完${detail}。可以点「继续写完」或者自己发一句「继续」,模型会从被截断的地方接着写。`;
|
|
97
|
+
}
|
|
85
98
|
// GENERIC - the literal message is more useful than a paraphrase, but it has to be the LAST
|
|
86
99
|
// branch and the message has to be non-empty (a thrown `new Error()` is empty and renders
|
|
87
100
|
// nothing, which is exactly the silence this whole change exists to break).
|
|
88
101
|
return raw || "Pi 未能完成本轮回答,已标记为失败。可以重发任务继续。";
|
|
89
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* THE MODEL FILLED ITS OUTPUT BUDGET AND STOPPED MID-ANSWER.
|
|
105
|
+
*
|
|
106
|
+
* A length stop is NOT a crash. The provider answered, streamed real text, and stopped because it
|
|
107
|
+
* ran out of `max_tokens` - which is what happens every time an answer is longer than one output
|
|
108
|
+
* budget. Treating it as a failure is what made an orchestrated child session die: the run service
|
|
109
|
+
* stamped the conversation `failed`, the orchestrator reported a failure to the parent, and a task
|
|
110
|
+
* that was one sentence from done was thrown away.
|
|
111
|
+
*
|
|
112
|
+
* It carries a CLASS so the layers above can tell it apart from a provider error by identity rather
|
|
113
|
+
* than by matching a Chinese substring - the message is written for a reader, and a reader-facing
|
|
114
|
+
* sentence is not a reliable machine contract.
|
|
115
|
+
*/
|
|
116
|
+
export class LengthExceededError extends Error {
|
|
117
|
+
stopReason = "length";
|
|
118
|
+
constructor(message) {
|
|
119
|
+
super(message || "模型输出达到本轮长度上限,回答未完成。");
|
|
120
|
+
this.name = "LengthExceededError";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Whether this failure is a length stop rather than a real failure.
|
|
125
|
+
*
|
|
126
|
+
* The class is the answer; the message match is the BACKSTOP for a throw site that never got to
|
|
127
|
+
* construct the class - an error that crossed a process boundary, or one that was rebuilt from its
|
|
128
|
+
* text somewhere along the way. Both are checked because a length stop that loses its class on the
|
|
129
|
+
* way up is exactly the case that used to kill a child session.
|
|
130
|
+
*/
|
|
131
|
+
export function isLengthExceededError(error) {
|
|
132
|
+
if (!error)
|
|
133
|
+
return false;
|
|
134
|
+
if (error instanceof LengthExceededError)
|
|
135
|
+
return true;
|
|
136
|
+
if (error?.stopReason === "length")
|
|
137
|
+
return true;
|
|
138
|
+
const msg = error instanceof Error ? error.message : typeof error === "string" ? error : "";
|
|
139
|
+
return msg.includes("模型输出达到本轮长度上限") || msg.includes("达到本轮长度上限") || msg.includes("单次输出达到长度上限");
|
|
140
|
+
}
|
|
90
141
|
export function controllerAborted(error) {
|
|
91
142
|
if (!error)
|
|
92
143
|
return false;
|
package/dist/server/types.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { ScheduledTask } from "./scheduled-tasks.js";
|
|
|
18
18
|
* `failed` is what any unhandled throw lands (with `Conversation.error` carrying the translated reason);
|
|
19
19
|
* `completed` is the clean path.
|
|
20
20
|
*/
|
|
21
|
-
export type RunStatus = "idle" | "waiting" | "running" | "completed" | "stopped" | "failed";
|
|
21
|
+
export type RunStatus = "idle" | "waiting" | "running" | "awaiting_background" | "completed" | "stopped" | "failed";
|
|
22
22
|
export type MessageRole = "user" | "assistant" | "tool" | "system";
|
|
23
23
|
/**
|
|
24
24
|
* One message in `state.json`.
|
|
@@ -494,6 +494,20 @@ export type Conversation = {
|
|
|
494
494
|
* would answer "what happened" with something the reader has to go and decode.
|
|
495
495
|
*/
|
|
496
496
|
error?: string;
|
|
497
|
+
/**
|
|
498
|
+
* WHY THIS CONVERSATION'S LAST ANSWER IS INCOMPLETE - in words a person reads.
|
|
499
|
+
*
|
|
500
|
+
* A WARNING, not a failure. The model filled its single-response output budget and stopped
|
|
501
|
+
* mid-answer; everything it said is on screen, and the conversation is still usable. It is a
|
|
502
|
+
* separate field from `error` because the two mean different things to the reader: `error` says
|
|
503
|
+
* "this run broke, here is why", this says "this answer was cut short, and here is what to do
|
|
504
|
+
* about it". Collapsing them would paint a recoverable truncation as a crash - which is exactly
|
|
505
|
+
* what made an orchestrated child session die.
|
|
506
|
+
*
|
|
507
|
+
* Cleared by the next turn, the same way `error` is: it describes the turn that just ended and
|
|
508
|
+
* must never outlive it.
|
|
509
|
+
*/
|
|
510
|
+
warning?: string;
|
|
497
511
|
/**
|
|
498
512
|
* WHY THIS CONVERSATION IS NOT ON THE MODEL THE USER SET FOR IT - in words a person reads.
|
|
499
513
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evandu/super-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.147",
|
|
4
4
|
"description": "Web control plane and companion for Pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"scripts/inline-thinking.test.mjs",
|
|
52
52
|
"scripts/inline-thinking-close-tag.test.mjs",
|
|
53
53
|
"scripts/pi-session.test.mjs",
|
|
54
|
+
"scripts/length-continuation.test.mjs",
|
|
54
55
|
"scripts/pi-session-isolation.test.mjs",
|
|
55
56
|
"scripts/installed-layout.test.mjs",
|
|
56
57
|
"scripts/pi-model-switch.test.mjs",
|
|
@@ -192,6 +193,7 @@
|
|
|
192
193
|
"scripts/document-write-overwrite.test.mjs",
|
|
193
194
|
"scripts/feishu.test.mjs",
|
|
194
195
|
"scripts/scheduled-tasks.test.mjs",
|
|
196
|
+
"scripts/scheduled-tasks-timezone.test.mjs",
|
|
195
197
|
"scripts/scheduled-task-model-clear.test.mjs",
|
|
196
198
|
"scripts/scheduled-task-scope.test.mjs",
|
|
197
199
|
"scripts/scheduled-task-tool.test.mjs",
|
|
@@ -203,8 +205,18 @@
|
|
|
203
205
|
"scripts/spawn-workspace-boundary.test.mjs",
|
|
204
206
|
"scripts/cwd-agent-spawn.test.mjs",
|
|
205
207
|
"scripts/capabilities-prompt.test.mjs",
|
|
208
|
+
"scripts/version-fallback.test.mjs",
|
|
209
|
+
"scripts/model-image-input-session.test.mjs",
|
|
206
210
|
"scripts/conversation-usage.test.mjs",
|
|
207
|
-
"scripts/orchestrator-observability.test.mjs"
|
|
211
|
+
"scripts/orchestrator-observability.test.mjs",
|
|
212
|
+
"scripts/session-tab-preview.test.mjs",
|
|
213
|
+
"scripts/knowledge-retrieval-quality.test.mjs",
|
|
214
|
+
"scripts/rail-ui-contract.test.mjs",
|
|
215
|
+
"scripts/session-tree-scope.test.mjs",
|
|
216
|
+
"scripts/session-spawn-model.test.mjs",
|
|
217
|
+
"scripts/background-result-steer.test.mjs",
|
|
218
|
+
"scripts/session-report-watchdog.test.mjs",
|
|
219
|
+
"scripts/awaiting-background-status.test.mjs"
|
|
208
220
|
],
|
|
209
221
|
"check:browser": [
|
|
210
222
|
"scripts/interrupt-browser.test.mjs",
|
|
@@ -243,6 +255,7 @@
|
|
|
243
255
|
"scripts/archive-restore-race-browser.test.mjs",
|
|
244
256
|
"scripts/tool-call-blocks-browser.test.mjs",
|
|
245
257
|
"scripts/model-notice-browser.test.mjs",
|
|
258
|
+
"scripts/length-warning-browser.test.mjs",
|
|
246
259
|
"scripts/dead-default-agent-browser.test.mjs",
|
|
247
260
|
"scripts/assistant-working-indicator-browser.test.mjs",
|
|
248
261
|
"scripts/thinking-first-delta-once-browser.test.mjs",
|
|
@@ -285,7 +298,10 @@
|
|
|
285
298
|
"scripts/orchestrated-order-role-browser.test.mjs",
|
|
286
299
|
"scripts/result-file-link-browser.test.mjs",
|
|
287
300
|
"scripts/git-panel-confirm-browser.test.mjs",
|
|
288
|
-
"scripts/session-origin-badge-browser.test.mjs"
|
|
301
|
+
"scripts/session-origin-badge-browser.test.mjs",
|
|
302
|
+
"scripts/rail-ui-layout-browser.test.mjs",
|
|
303
|
+
"scripts/session-landing-browser.test.mjs",
|
|
304
|
+
"scripts/responsive-rail-drawer-browser.test.mjs"
|
|
289
305
|
],
|
|
290
306
|
"dependencies": {
|
|
291
307
|
"@codemirror/commands": "^6.11.1",
|