@evandu/super-pi 0.1.183 → 0.1.186
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/coder.md +1 -1
- package/agents/planner.md +1 -1
- package/agents/project-leader.md +2 -2
- package/agents/reviewer.md +1 -1
- package/agents/super-pi-task/core.ts +164 -7
- package/agents/super-pi-task/index.ts +33 -1
- package/dist/client/.super-pi-client-sources.json +7 -7
- package/dist/client/assets/{CodeMirrorEditor-DUyqaSOB.js → CodeMirrorEditor-Cmx7-z0f.js} +2 -2
- package/dist/client/assets/{dist-CPmDYAQT.js → dist-B8CAEuXW.js} +1 -1
- package/dist/client/assets/{dist-nbHIDjzw.js → dist-BKx3CpQJ.js} +1 -1
- package/dist/client/assets/{dist-CB124C6Z.js → dist-BMSVWA_A.js} +1 -1
- package/dist/client/assets/{dist-CU8JEI5K.js → dist-BdiInYmk.js} +1 -1
- package/dist/client/assets/{dist-D3HMZhM-.js → dist-Bq7p17eF.js} +1 -1
- package/dist/client/assets/{dist-CvLzvDh7.js → dist-BzqUlzAf.js} +1 -1
- package/dist/client/assets/{dist-Dkm31GRe.js → dist-C0PMHwdm.js} +1 -1
- package/dist/client/assets/{dist-CeU4Svbh.js → dist-C2ltv_8u.js} +1 -1
- package/dist/client/assets/{dist-DTd2PCza.js → dist-CDSDxXju.js} +1 -1
- package/dist/client/assets/{dist-DLOUy-hB.js → dist-CKZOnuRU.js} +1 -1
- package/dist/client/assets/{dist-ka17rnWs.js → dist-CWlI6qO0.js} +1 -1
- package/dist/client/assets/{dist-AQ8CYp6b.js → dist-CXDhHY7N.js} +1 -1
- package/dist/client/assets/{dist-Dnx8LlEL.js → dist-Cblc22Ag.js} +1 -1
- package/dist/client/assets/{dist-Bj218gfa.js → dist-CcuBp_Kn.js} +1 -1
- package/dist/client/assets/{dist-CNem2r_T.js → dist-DHFt0Hvo.js} +1 -1
- package/dist/client/assets/{dist-NLNoAzKl.js → dist-D_7x3oZt.js} +1 -1
- package/dist/client/assets/{dist-D4lWO1EF.js → dist-RHYiODih.js} +1 -1
- package/dist/client/assets/{dist-CkTZUfAR.js → dist-V27Fcf8p.js} +1 -1
- package/dist/client/assets/{dist-Dlg4MpdE.js → dist-WfagMkC4.js} +1 -1
- package/dist/client/assets/{dist-dnyR0Vf6.js → dist-akJoBtjs.js} +1 -1
- package/dist/client/assets/{dist-C7PhA7pe.js → dist-frBiV55p.js} +1 -1
- package/dist/client/assets/{dist-TX6Uhfee.js → dist-ibsGPa_S.js} +1 -1
- package/dist/client/assets/{index-Ui6aXMVV.css → index-BXQjUHV_.css} +1 -1
- package/dist/client/assets/{index-BplDWdZp.js → index-Dx7HAZ5j.js} +14 -13
- package/dist/client/index.html +2 -2
- package/dist/server/agents.d.ts +1 -1
- package/dist/server/agents.js +1 -1
- package/dist/server/application/conversation-service.d.ts +13 -0
- package/dist/server/application/conversation-service.js +21 -0
- package/dist/server/application/project-service.d.ts +2 -70
- package/dist/server/application/project-service.js +102 -205
- package/dist/server/application/run-service.d.ts +39 -3
- package/dist/server/application/run-service.js +166 -18
- package/dist/server/application/session-orchestrator-service.d.ts +38 -5
- package/dist/server/application/session-orchestrator-service.js +167 -5
- package/dist/server/command-handler.js +5 -1
- package/dist/server/http-server.js +45 -18
- package/dist/server/index.js +1 -1
- package/dist/server/pi-session.d.ts +3 -2
- package/dist/server/runtime.js +9 -6
- package/dist/server/session-tree-scope.d.ts +1 -1
- package/dist/server/store.d.ts +24 -0
- package/dist/server/store.js +229 -4
- package/dist/server/task-tool.d.ts +5 -2
- package/dist/server/task-tool.js +25 -2
- package/dist/server/types.d.ts +43 -13
- package/dist/server/upload.d.ts +2 -6
- package/dist/server/upload.js +7 -5
- package/dist/shared/session-reporting.d.ts +13 -2
- package/dist/shared/session-reporting.js +62 -15
- package/package.json +8 -3
package/dist/server/task-tool.js
CHANGED
|
@@ -366,6 +366,7 @@ export const SESSION_DISPATCH_TOOL_NAME = "session_dispatch";
|
|
|
366
366
|
export const SESSION_STOP_TOOL_NAME = "session_stop";
|
|
367
367
|
export const SESSION_REPORT_TOOL_NAME = "session_report";
|
|
368
368
|
export const SESSION_STOP_SUBTREE_TOOL_NAME = "session_stop_subtree";
|
|
369
|
+
export const SESSION_REMOVE_TOOL_NAME = "session_remove";
|
|
369
370
|
/** Model-facing description for session_spawn. */
|
|
370
371
|
export const SESSION_SPAWN_DESCRIPTION = `Create a child conversation in the current workspace and immediately dispatch its initial task. You can specify a primary agent as the child's role.
|
|
371
372
|
|
|
@@ -416,7 +417,11 @@ Usage notes:
|
|
|
416
417
|
1. 'conversationId' is required and must identify an existing sibling conversation.
|
|
417
418
|
2. 'content' is the text instruction sent to that session, just as if typed by a user in that session's chat.
|
|
418
419
|
3. Dispatch is ASYNCHRONOUS by default: it enqueues the message into the session's queue and returns immediately.
|
|
419
|
-
4. If the sibling session is currently busy running a turn, the dispatched message is placed in its waiting queue and processed when the active turn completes
|
|
420
|
+
4. If the sibling session is currently busy running a turn, the dispatched message is placed in its waiting queue and processed when the active turn completes.
|
|
421
|
+
5. 'mode' controls delivery when the target session is busy:
|
|
422
|
+
- 'queue' (default): waits until the active turn and earlier queued messages finish (delivered via follow-up queue / subsequent turn; multiple queued messages wait in order).
|
|
423
|
+
- 'steer': delivers at the NEXT turn boundary (after the current tool-call batch completes) ahead of queued follow-up messages. It does NOT kill or abort an in-flight tool call mid-execution. Multiple steered messages arriving before the next boundary may be delivered together at that boundary; when the session is idle, it starts a turn immediately.
|
|
424
|
+
- Invalid 'mode' values are rejected with an error (never silently fall back to 'queue').`;
|
|
420
425
|
/** Model-facing description for session_stop. */
|
|
421
426
|
export const SESSION_STOP_DESCRIPTION = `Stop execution in a sibling conversation.
|
|
422
427
|
|
|
@@ -429,7 +434,8 @@ Usage notes:
|
|
|
429
434
|
- 'all' (default): stops the currently running turn and cancels all pending queued messages in the session.
|
|
430
435
|
- 'active': only interrupts the active running turn; leaves any pending queued messages untouched.
|
|
431
436
|
- 'queued': only cancels pending queued messages; lets the currently running turn complete naturally.
|
|
432
|
-
2. Use 'messageId' if you want to cancel or interrupt one specific queued message instead of all queued messages
|
|
437
|
+
2. Use 'messageId' if you want to cancel or interrupt one specific queued message instead of all queued messages.
|
|
438
|
+
3. Use 'messageIds' (an array of queued message IDs from session_status or session_dispatch) to selectively withdraw only those queued messages while keeping the running turn, other queued messages, and unrelated steered messages intact.`;
|
|
433
439
|
/** Model-facing description for session_report. */
|
|
434
440
|
export const SESSION_REPORT_DESCRIPTION = `Report progress from THIS session to the parent session that spawned it.
|
|
435
441
|
|
|
@@ -469,3 +475,20 @@ Usage notes:
|
|
|
469
475
|
2. Everything under that session goes down with it - children, grandchildren, the whole tree - deepest first, so nothing is left running under a session that is already gone.
|
|
470
476
|
3. The descendants are stopped AS A CONSEQUENCE of stopping the root. They cannot be spared, because a session cannot outlive the one that owns it.
|
|
471
477
|
4. The answer says how many sessions were stopped in total, including the one you named.`;
|
|
478
|
+
/** Model-facing description for session_remove. */
|
|
479
|
+
export const SESSION_REMOVE_DESCRIPTION = `Permanently destroy a direct child session (and any descendant sessions under it) from the current working group.
|
|
480
|
+
|
|
481
|
+
WHEN TO USE THIS:
|
|
482
|
+
- A child session's work is finished and you no longer need its session, transcript, or saved output.
|
|
483
|
+
- A child session is stuck and no longer needed, or was spawned by mistake / as a duplicate.
|
|
484
|
+
|
|
485
|
+
WHEN NOT TO USE THIS:
|
|
486
|
+
- You still plan to send follow-up instructions to it later, or still need its transcript, messages, or saved result file.
|
|
487
|
+
- You want to delete yourself, a top-level user session (top-level projects are archived by the user, not destroyed by agents), or any session that is not your direct child.
|
|
488
|
+
|
|
489
|
+
Usage notes:
|
|
490
|
+
1. Destroying is PERMANENT, NOT archiving: the child session and its entire descendant subtree are permanently deleted from the store along with their messages, tool calls, sub-agent runs, todos, and saved output artifacts.
|
|
491
|
+
2. Once destroyed, the session and its branch disappear from your active child list, session_status queries, and reporting wait state.
|
|
492
|
+
3. If the child session or any of its descendants is still running or has queued work, session_remove stops the subtree first; if stopping any session fails, the destruction is refused.
|
|
493
|
+
4. Only your DIRECT child can be targeted (top-level user sessions and non-direct-child sessions are refused). Deleting a direct child that has subordinates destroys that whole branch together.
|
|
494
|
+
5. Destroying a session that is already gone is idempotent and succeeds without error.`;
|
package/dist/server/types.d.ts
CHANGED
|
@@ -68,6 +68,15 @@ export type MessageImage = {
|
|
|
68
68
|
width?: number;
|
|
69
69
|
height?: number;
|
|
70
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Base64 image payload passed to Pi's session/RPC APIs (never persisted in state.json).
|
|
73
|
+
* Kept distinct from `MessageImage` so file references cannot be handed to Pi unhydrated.
|
|
74
|
+
*/
|
|
75
|
+
export type PiImageContent = {
|
|
76
|
+
type: "image";
|
|
77
|
+
data: string;
|
|
78
|
+
mimeType: string;
|
|
79
|
+
};
|
|
71
80
|
/** ONE QUESTION AS THE TOOL ASKED IT, before any answer exists.
|
|
72
81
|
* Mirrors OpenCode's `QuestionV2.Prompt`: a stable id so the answer pairs by identity rather than by
|
|
73
82
|
* position, a short header for a dock, and options with their own text. */
|
|
@@ -565,6 +574,10 @@ export type Conversation = {
|
|
|
565
574
|
* 只要本字段存在,子会话就在汇报轴上算「已汇报」。
|
|
566
575
|
*/
|
|
567
576
|
reportedToParentAt?: string;
|
|
577
|
+
/** 该会话是否存在未决的例外升级(等待上级处理)。 */
|
|
578
|
+
hasOpenEscalation?: boolean;
|
|
579
|
+
/** Read-only projection: whether this child session still has an undelivered result in its parent's waiting queue. */
|
|
580
|
+
hasPendingResult?: boolean;
|
|
568
581
|
/**
|
|
569
582
|
* 用户上次点击阅读该会话的时间戳(ISO 字符串)。
|
|
570
583
|
* 顶层会话退回到根据这个判断未读;子会话不看这个。
|
|
@@ -1094,10 +1107,6 @@ export type Project = {
|
|
|
1094
1107
|
/** The session that created the project - the Boss's own conversation, which may register the
|
|
1095
1108
|
* top-level tasks and is the one the project answers to. */
|
|
1096
1109
|
initiatorConversationId?: string;
|
|
1097
|
-
budget?: {
|
|
1098
|
-
maxTokens?: number;
|
|
1099
|
-
maxConcurrent?: number;
|
|
1100
|
-
};
|
|
1101
1110
|
defaultLeaderProfile?: SessionProfile;
|
|
1102
1111
|
defaultExecutorProfile?: SessionProfile;
|
|
1103
1112
|
defaultReviewerProfile?: SessionProfile;
|
|
@@ -1141,6 +1150,11 @@ export type Project = {
|
|
|
1141
1150
|
title: string;
|
|
1142
1151
|
role: string;
|
|
1143
1152
|
status: RunStatus;
|
|
1153
|
+
displayStatus?: string;
|
|
1154
|
+
displayWord?: string;
|
|
1155
|
+
reportingState?: string | null;
|
|
1156
|
+
hasOpenEscalation?: boolean;
|
|
1157
|
+
reportedToParentAt?: string;
|
|
1144
1158
|
tokens: number;
|
|
1145
1159
|
contextPercent?: number | null;
|
|
1146
1160
|
parentConversationId?: string;
|
|
@@ -1148,15 +1162,6 @@ export type Project = {
|
|
|
1148
1162
|
memoryScope?: "project" | "shared";
|
|
1149
1163
|
}[];
|
|
1150
1164
|
};
|
|
1151
|
-
/**
|
|
1152
|
-
* THE CAP THE ONE-CLICK PATH OFFERS, COMPUTED BY THE SERVER.
|
|
1153
|
-
*
|
|
1154
|
-
* It is `max(current cap + 1, spent tokens * 2)`, and it is a READ-ONLY projection: it is
|
|
1155
|
-
* never stored, so it can never disagree with the budget the project actually runs on. The
|
|
1156
|
-
* panel shows this number on the button instead of computing one of its own - a suggestion the
|
|
1157
|
-
* client invents is a suggestion the Boss cannot check.
|
|
1158
|
-
*/
|
|
1159
|
-
suggestedMaxTokens?: number;
|
|
1160
1165
|
tasks: ProjectTask[];
|
|
1161
1166
|
reports: ProjectReport[];
|
|
1162
1167
|
escalations: ProjectEscalation[];
|
|
@@ -1315,6 +1320,7 @@ export type ExtensionUiAnswer = {
|
|
|
1315
1320
|
confirmed?: boolean;
|
|
1316
1321
|
cancelled?: true;
|
|
1317
1322
|
};
|
|
1323
|
+
export type MessageDeliveryMode = "queue" | "steer";
|
|
1318
1324
|
export type ClientCommand = ClientCommandBody & {
|
|
1319
1325
|
operationRequestId?: string;
|
|
1320
1326
|
};
|
|
@@ -1667,6 +1673,7 @@ export type ClientCommandBody =
|
|
|
1667
1673
|
images?: MessageImage[];
|
|
1668
1674
|
attachments?: MessageAttachments;
|
|
1669
1675
|
clientId?: string;
|
|
1676
|
+
mode?: MessageDeliveryMode;
|
|
1670
1677
|
}
|
|
1671
1678
|
/**
|
|
1672
1679
|
* Revert the conversation to the state right AFTER one message: every message after it is removed from
|
|
@@ -1701,6 +1708,15 @@ export type ClientCommandBody =
|
|
|
1701
1708
|
conversationId: string;
|
|
1702
1709
|
messageId: string;
|
|
1703
1710
|
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Withdraws a specific set of waiting messages by id while leaving remaining queued and steered
|
|
1713
|
+
* messages intact.
|
|
1714
|
+
*/
|
|
1715
|
+
| {
|
|
1716
|
+
type: "message.cancelMany";
|
|
1717
|
+
conversationId: string;
|
|
1718
|
+
messageIds: string[];
|
|
1719
|
+
}
|
|
1704
1720
|
/**
|
|
1705
1721
|
* Rewrites the text of ONE waiting message that has not been given to Pi yet.
|
|
1706
1722
|
*
|
|
@@ -2164,6 +2180,20 @@ export type ServerEvent = {
|
|
|
2164
2180
|
type: "pi.queue";
|
|
2165
2181
|
conversationId: string;
|
|
2166
2182
|
} & PiQueueSnapshot)
|
|
2183
|
+
/**
|
|
2184
|
+
* Announces that one or more queued messages were withdrawn, along with their ids and text previews,
|
|
2185
|
+
* so both user-initiated and agent-initiated withdrawals remain visible rather than silent.
|
|
2186
|
+
*/
|
|
2187
|
+
| {
|
|
2188
|
+
type: "queue.withdrawn";
|
|
2189
|
+
conversationId: string;
|
|
2190
|
+
withdrawn: {
|
|
2191
|
+
id: string;
|
|
2192
|
+
content: string;
|
|
2193
|
+
role: "user" | "tool";
|
|
2194
|
+
}[];
|
|
2195
|
+
actor: "user" | "agent";
|
|
2196
|
+
}
|
|
2167
2197
|
/**
|
|
2168
2198
|
* Bytes from a terminal shell, as ONE event per coalescing window rather than one per `onData` call.
|
|
2169
2199
|
*
|
package/dist/server/upload.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageImage } from "./types.js";
|
|
1
|
+
import type { MessageImage, PiImageContent } from "./types.js";
|
|
2
2
|
/** 5MB maximum decoded image payload, matching the source-file size ceiling in files.ts. */
|
|
3
3
|
export declare const MAX_UPLOAD_BYTES: number;
|
|
4
4
|
/** 10MB maximum HTTP request body to safely handle base64 overhead before JSON parsing. */
|
|
@@ -30,8 +30,4 @@ export declare function findUploadFile(uploadsDir: string, conversationId: strin
|
|
|
30
30
|
size: number;
|
|
31
31
|
} | null>;
|
|
32
32
|
export declare function deleteConversationUploads(uploadsDir: string, conversationId: string): Promise<void>;
|
|
33
|
-
export declare function loadConversationImages(uploadsDir: string, conversationId: string, images: MessageImage[]): Promise<
|
|
34
|
-
type: "image";
|
|
35
|
-
data: string;
|
|
36
|
-
mimeType: string;
|
|
37
|
-
}>>;
|
|
33
|
+
export declare function loadConversationImages(uploadsDir: string, conversationId: string, images: MessageImage[]): Promise<PiImageContent[]>;
|
package/dist/server/upload.js
CHANGED
|
@@ -147,11 +147,13 @@ export async function loadConversationImages(uploadsDir, conversationId, images)
|
|
|
147
147
|
const found = await findUploadFile(uploadsDir, conversationId, img.id);
|
|
148
148
|
if (found) {
|
|
149
149
|
const buf = await readFile(found.filePath);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
if (buf.length > 0) {
|
|
151
|
+
result.push({
|
|
152
|
+
type: "image",
|
|
153
|
+
data: buf.toString("base64"),
|
|
154
|
+
mimeType: img.mimeType || found.mimeType,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
return result;
|
|
@@ -5,11 +5,22 @@ export type SessionReportingSnapshot = {
|
|
|
5
5
|
status?: string;
|
|
6
6
|
reportedToParentAt?: string;
|
|
7
7
|
archivedAt?: string;
|
|
8
|
+
hasOpenEscalation?: boolean;
|
|
9
|
+
hasPendingResult?: boolean;
|
|
8
10
|
};
|
|
9
|
-
export type ReportingAxisState = "pending_report" | "awaiting_subordinates" | "unread";
|
|
11
|
+
export type ReportingAxisState = "pending_report" | "awaiting_subordinates" | "awaiting_decision" | "unread";
|
|
10
12
|
export declare function deriveReportingState(params: {
|
|
11
13
|
conversation: SessionReportingSnapshot;
|
|
12
14
|
parent?: ChildSessionRow;
|
|
13
15
|
directChildren: SessionReportingSnapshot[];
|
|
14
|
-
isTopLevelUnread
|
|
16
|
+
isTopLevelUnread?: boolean;
|
|
15
17
|
}): ReportingAxisState | null;
|
|
18
|
+
export type SessionDisplayState = "waiting" | "running" | "failed" | "question" | "completed" | "unread" | "idle" | "awaiting_background" | "pending_report" | "awaiting_subordinates" | "awaiting_decision";
|
|
19
|
+
export declare const SESSION_STATE_WORD: Record<string, string>;
|
|
20
|
+
export declare function sessionStateWord(state: string | undefined): string;
|
|
21
|
+
export declare function deriveSessionState(params: {
|
|
22
|
+
status?: string;
|
|
23
|
+
reportingState?: ReportingAxisState | null;
|
|
24
|
+
awaitingQuestion?: boolean;
|
|
25
|
+
quietWhenRead?: boolean;
|
|
26
|
+
}): SessionDisplayState;
|
|
@@ -1,39 +1,86 @@
|
|
|
1
1
|
// 会话状态模型:汇报线上的位置 —— 两边共用的推导逻辑与类型。
|
|
2
2
|
//
|
|
3
3
|
// 状态在回答什么问题:
|
|
4
|
-
// -
|
|
5
|
-
// -
|
|
4
|
+
// - 自己有升级例外:等上面拍板(awaiting_decision)。
|
|
5
|
+
// - 父会话:是否有直接下级还在进行中或有未决升级?是就是等待下级(awaiting_subordinates)。
|
|
6
|
+
// - 子会话:自己的结果是不是还在父会话的待收队列里?在就是待汇报(pending_report),收走或没有就消停了(null)。
|
|
6
7
|
// - 顶层会话:自己有没有未读?有就是未读(unread)。
|
|
7
8
|
//
|
|
8
9
|
// 规则在 `docs/DESIGN-PRINCIPLES.md` 第二节「汇报线逐级转述:Boss 只有一个联络线」。
|
|
9
10
|
import { isChildSession } from "./child-session-lock.js";
|
|
10
11
|
export function deriveReportingState(params) {
|
|
11
|
-
const { conversation, parent, directChildren, isTopLevelUnread } = params;
|
|
12
|
-
// 1.
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
if (!conversation.reportedToParentAt) {
|
|
16
|
-
return "pending_report";
|
|
17
|
-
}
|
|
18
|
-
// 已经汇报过 -> 在汇报轴上完成,不显示任何汇报标记
|
|
19
|
-
return null;
|
|
12
|
+
const { conversation, parent, directChildren, isTopLevelUnread = false } = params;
|
|
13
|
+
// 1. 如果自己有未决的升级例外:等上面拍板
|
|
14
|
+
if (conversation.hasOpenEscalation) {
|
|
15
|
+
return "awaiting_decision";
|
|
20
16
|
}
|
|
21
|
-
// 2.
|
|
17
|
+
// 2. 如果自己有正在进行中或存在未决升级的直接子会话:等待下级
|
|
22
18
|
const hasPendingChild = directChildren.some((child) => {
|
|
23
19
|
if (child.archivedAt)
|
|
24
20
|
return false;
|
|
25
21
|
const isRunning = child.status === "running" ||
|
|
26
22
|
child.status === "waiting" ||
|
|
27
23
|
child.status === "awaiting_background";
|
|
28
|
-
const
|
|
29
|
-
return isRunning ||
|
|
24
|
+
const hasEscalation = Boolean(child.hasOpenEscalation);
|
|
25
|
+
return isRunning || hasEscalation;
|
|
30
26
|
});
|
|
31
27
|
if (hasPendingChild) {
|
|
32
28
|
return "awaiting_subordinates";
|
|
33
29
|
}
|
|
34
|
-
// 3.
|
|
30
|
+
// 3. 如果自己是子会话(按 isChildSession 判据,父会话存在且未归档)
|
|
31
|
+
if (isChildSession(conversation.parentConversationId, parent)) {
|
|
32
|
+
// Only pending_report while a delivered result is still queued on its parent.
|
|
33
|
+
if (conversation.hasPendingResult) {
|
|
34
|
+
return "pending_report";
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
// 4. 顶层会话退回到原有的「未读」逻辑
|
|
35
39
|
if (isTopLevelUnread) {
|
|
36
40
|
return "unread";
|
|
37
41
|
}
|
|
38
42
|
return null;
|
|
39
43
|
}
|
|
44
|
+
export const SESSION_STATE_WORD = {
|
|
45
|
+
waiting: "等待 LLM",
|
|
46
|
+
running: "进行中",
|
|
47
|
+
failed: "出错",
|
|
48
|
+
question: "等你回答",
|
|
49
|
+
completed: "已完成",
|
|
50
|
+
unread: "有未读",
|
|
51
|
+
idle: "空闲",
|
|
52
|
+
awaiting_background: "等待后台任务",
|
|
53
|
+
pending_report: "待汇报",
|
|
54
|
+
awaiting_subordinates: "等待下级",
|
|
55
|
+
awaiting_decision: "等上面拍板",
|
|
56
|
+
};
|
|
57
|
+
export function sessionStateWord(state) {
|
|
58
|
+
return SESSION_STATE_WORD[state ?? ""] ?? state ?? "未知状态";
|
|
59
|
+
}
|
|
60
|
+
export function deriveSessionState(params) {
|
|
61
|
+
const { status, reportingState, awaitingQuestion, quietWhenRead = false } = params;
|
|
62
|
+
if (awaitingQuestion)
|
|
63
|
+
return "question";
|
|
64
|
+
if (status === "failed")
|
|
65
|
+
return "failed";
|
|
66
|
+
if (reportingState === "awaiting_decision")
|
|
67
|
+
return "awaiting_decision";
|
|
68
|
+
if (status === "waiting")
|
|
69
|
+
return "waiting";
|
|
70
|
+
if (status === "running")
|
|
71
|
+
return "running";
|
|
72
|
+
if (status === "awaiting_background")
|
|
73
|
+
return "awaiting_background";
|
|
74
|
+
if (reportingState === "pending_report")
|
|
75
|
+
return "pending_report";
|
|
76
|
+
if (reportingState === "awaiting_subordinates")
|
|
77
|
+
return "awaiting_subordinates";
|
|
78
|
+
if (reportingState === "unread") {
|
|
79
|
+
if (status === "completed")
|
|
80
|
+
return "completed";
|
|
81
|
+
return "unread";
|
|
82
|
+
}
|
|
83
|
+
if (quietWhenRead)
|
|
84
|
+
return "idle";
|
|
85
|
+
return status === "completed" ? "completed" : "idle";
|
|
86
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evandu/super-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.186",
|
|
4
4
|
"description": "Web control plane and companion for Pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
"scripts/project-report-chain.test.mjs",
|
|
102
102
|
"scripts/project-tool-surface-parity.test.mjs",
|
|
103
103
|
"scripts/tool-surface-parity-all.test.mjs",
|
|
104
|
-
"scripts/budget-sizing.test.mjs",
|
|
105
104
|
"scripts/session-tree-collapse.test.mjs",
|
|
106
105
|
"scripts/sidebar-session-order.test.mjs",
|
|
107
106
|
"scripts/archive-cascade.test.mjs",
|
|
@@ -229,7 +228,9 @@
|
|
|
229
228
|
"scripts/scheduled-task-model-clear.test.mjs",
|
|
230
229
|
"scripts/scheduled-task-scope.test.mjs",
|
|
231
230
|
"scripts/scheduled-task-tool.test.mjs",
|
|
231
|
+
"scripts/agile-project-orchestration.test.mjs",
|
|
232
232
|
"scripts/run-state-sync.test.mjs",
|
|
233
|
+
"scripts/message-delivery-modes.test.mjs",
|
|
233
234
|
"scripts/performance-architecture.test.mjs",
|
|
234
235
|
"scripts/upgrade-from-138-browser.test.mjs",
|
|
235
236
|
"scripts/session-orchestrator-role-prompt.test.mjs",
|
|
@@ -250,6 +251,7 @@
|
|
|
250
251
|
"scripts/session-report-watchdog.test.mjs",
|
|
251
252
|
"scripts/session-report-tool.test.mjs",
|
|
252
253
|
"scripts/session-stop-subtree.test.mjs",
|
|
254
|
+
"scripts/session-remove.test.mjs",
|
|
253
255
|
"scripts/session-tool-behaviour.test.mjs",
|
|
254
256
|
"scripts/awaiting-background-status.test.mjs",
|
|
255
257
|
"scripts/project-lifecycle-e2e.test.mjs",
|
|
@@ -260,6 +262,8 @@
|
|
|
260
262
|
"scripts/child-session-lock.test.mjs",
|
|
261
263
|
"scripts/child-question-lock.test.mjs",
|
|
262
264
|
"scripts/session-reporting.test.mjs",
|
|
265
|
+
"scripts/project-panel-reporting.test.mjs",
|
|
266
|
+
"scripts/session-row-escalation.test.mjs",
|
|
263
267
|
"scripts/mutation-lock-coverage.test.mjs"
|
|
264
268
|
],
|
|
265
269
|
"check:browser": [
|
|
@@ -360,7 +364,8 @@
|
|
|
360
364
|
"scripts/session-landing-browser.test.mjs",
|
|
361
365
|
"scripts/responsive-rail-drawer-browser.test.mjs",
|
|
362
366
|
"scripts/interrupted-task-recovery-browser.test.mjs",
|
|
363
|
-
"scripts/child-session-lock-browser.test.mjs"
|
|
367
|
+
"scripts/child-session-lock-browser.test.mjs",
|
|
368
|
+
"scripts/session-row-escalation-browser.test.mjs"
|
|
364
369
|
],
|
|
365
370
|
"dependencies": {
|
|
366
371
|
"@codemirror/commands": "^6.11.1",
|