@evandu/super-pi 0.1.184 → 0.1.187
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 +41 -5
- package/dist/client/.super-pi-client-sources.json +7 -7
- package/dist/client/assets/{CodeMirrorEditor-v8j7qM-5.js → CodeMirrorEditor-Cmx7-z0f.js} +2 -2
- package/dist/client/assets/{dist-DFpSLAtp.js → dist-B8CAEuXW.js} +1 -1
- package/dist/client/assets/{dist-1PSYOzSn.js → dist-BKx3CpQJ.js} +1 -1
- package/dist/client/assets/{dist-XrYkL2Xu.js → dist-BMSVWA_A.js} +1 -1
- package/dist/client/assets/{dist-BtRpNdOI.js → dist-BdiInYmk.js} +1 -1
- package/dist/client/assets/{dist-Bvl-DsMt.js → dist-Bq7p17eF.js} +1 -1
- package/dist/client/assets/{dist-CJ4rSQ4N.js → dist-BzqUlzAf.js} +1 -1
- package/dist/client/assets/{dist-DF3hHXYK.js → dist-C0PMHwdm.js} +1 -1
- package/dist/client/assets/{dist-Bc6s4uHe.js → dist-C2ltv_8u.js} +1 -1
- package/dist/client/assets/{dist-BoSFlin7.js → dist-CDSDxXju.js} +1 -1
- package/dist/client/assets/{dist-BUHFKfEO.js → dist-CKZOnuRU.js} +1 -1
- package/dist/client/assets/{dist-BS72C5ep.js → dist-CWlI6qO0.js} +1 -1
- package/dist/client/assets/{dist-cgEoGcO1.js → dist-CXDhHY7N.js} +1 -1
- package/dist/client/assets/{dist-BKj3_VBI.js → dist-Cblc22Ag.js} +1 -1
- package/dist/client/assets/{dist-DsUX6SY5.js → dist-CcuBp_Kn.js} +1 -1
- package/dist/client/assets/{dist-D-MqsRQM.js → dist-DHFt0Hvo.js} +1 -1
- package/dist/client/assets/{dist-Bcw21qWX.js → dist-D_7x3oZt.js} +1 -1
- package/dist/client/assets/{dist-CIxW4sg_.js → dist-RHYiODih.js} +1 -1
- package/dist/client/assets/{dist-Bta_JEiJ.js → dist-V27Fcf8p.js} +1 -1
- package/dist/client/assets/{dist-CvM_6f5G.js → dist-WfagMkC4.js} +1 -1
- package/dist/client/assets/{dist-CPEKtCMg.js → dist-akJoBtjs.js} +1 -1
- package/dist/client/assets/{dist-Bpfwpwk8.js → dist-frBiV55p.js} +1 -1
- package/dist/client/assets/{dist-D4SHQTo9.js → dist-ibsGPa_S.js} +1 -1
- package/dist/client/assets/{index-DeTEc54b.css → index-BXQjUHV_.css} +1 -1
- package/dist/client/assets/{index-D_XU8eXm.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 +3 -71
- package/dist/server/application/project-service.js +36 -195
- 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 +36 -13
- package/dist/server/upload.d.ts +2 -6
- package/dist/server/upload.js +7 -5
- package/dist/shared/session-reporting.d.ts +2 -0
- package/dist/shared/session-reporting.js +9 -9
- package/package.json +8 -3
package/agents/coder.md
CHANGED
|
@@ -19,4 +19,4 @@ color: "#44BA81"
|
|
|
19
19
|
被复核退回后按 `review.summary` 修正并验证,再 `submit`。
|
|
20
20
|
遇到阻塞用 `project(action="report", kind="blocked", ...)` 向直接上级说明原因与证据;需决策时用 `escalate`,收件人自动是直接上级。
|
|
21
21
|
不要用 `question` 直接问 Boss;需要澄清让直接上级逐级代问。
|
|
22
|
-
|
|
22
|
+
按项目分工与直接上级指派工作,不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 另起绕开项目汇报线的执行流程。
|
package/agents/planner.md
CHANGED
|
@@ -27,4 +27,4 @@ tools:
|
|
|
27
27
|
被复核退回后按 `review.summary` 补全方案,再 `submit`;要求实现代码时先上报能力不匹配。
|
|
28
28
|
遇到阻塞用 `project(action="report", kind="blocked", ...)` 向直接上级说明原因与证据;需决策时用 `escalate`,收件人自动是直接上级。
|
|
29
29
|
不要用 `question` 直接问 Boss;需求歧义让直接上级逐级代问。
|
|
30
|
-
|
|
30
|
+
按项目分工与直接上级指派工作,不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 另起绕开项目汇报线的执行流程。
|
package/agents/project-leader.md
CHANGED
|
@@ -12,7 +12,7 @@ description: 项目负责人兼秘书,适合项目根 Leader 或分支 Leader
|
|
|
12
12
|
|
|
13
13
|
## 在项目里
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
当你在项目里被派了活时,开篇上下文已包含项目模式、身份、任务清单与验收条件,不必先调用 `project(action="get", ...)` 就能直接拆解、派活或执行;不自行扩大权限或交付范围。
|
|
16
16
|
标准项目用 `add_task` 登记直属任务、用 `dispatch` 委派,交付后用 `request_review` 安排其他会话独立复核,包括自己的整合结果;不能自审。
|
|
17
17
|
分支 Leader 拆解时令 `parentTaskId` 指向自己的任务,只管理直属任务;子任务独立验收后用 `submit` 提交聚合交付,由上级安排复核。
|
|
18
18
|
执行或聚合交付必须调用 `project(action="submit", projectId, taskId, output, evidenceRefs)`,不能自行宣布完成;退回后按 `review.summary` 修正再 `submit`。
|
|
@@ -21,5 +21,5 @@ description: 项目负责人兼秘书,适合项目根 Leader 或分支 Leader
|
|
|
21
21
|
遇到阻塞用 `project(action="report", kind="blocked", ...)` 上报:分支报直接上级,根负责人汇总确认后向 Boss 呈现。
|
|
22
22
|
需要更高层决策时用 `escalate`,分支收件人自动是直接上级;只有根负责人判断需要 Boss 决策时才向 Boss 升级。
|
|
23
23
|
不要用 `question` 直接问 Boss;分支让上级逐级代问,根负责人用升级记录需要 Boss 决定的问题。
|
|
24
|
-
|
|
24
|
+
按项目分工与汇报线委派任务,不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 绕开项目职责与汇报线;派发后等待子会话自动回传,不要轮询。
|
|
25
25
|
根负责人仅在所有必需任务按模式验收、例外均处理后调用 `complete`;总结与 `evidenceRefs` 必须引用真实产物路径及验证记录。
|
package/agents/reviewer.md
CHANGED
|
@@ -22,4 +22,4 @@ tools:
|
|
|
22
22
|
`evidenceRefs` 填真实检查的产物路径、行号和已有验证记录;证据不足应说明缺口。
|
|
23
23
|
遇到阻塞用 `project(action="report", kind="blocked", ...)` 向直接上级说明原因与证据;需决策时用 `escalate`,收件人自动是直接上级。
|
|
24
24
|
不要用 `question` 直接问 Boss;需要澄清让直接上级逐级代问。
|
|
25
|
-
|
|
25
|
+
按项目分工与直接上级指派工作,不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 另起绕开项目汇报线的执行流程。
|
|
@@ -110,7 +110,7 @@ description: 用脚本清洗、转换、统计 Excel/CSV 数据
|
|
|
110
110
|
mode: primary
|
|
111
111
|
---
|
|
112
112
|
(正文从这里开始,写它的职责和工作方式。)保存后下一条消息即可使用;修改已有的自定义 Agent 就是编辑同一个目录里对应的 .md 文件。
|
|
113
|
-
- 用户要多个 agent 分工协作:单个子任务用 task 工具委托,有先后依赖的流程用 workflow 工具编排;同一流程要按明确结论行反复执行时用 loop 节点,要对 primary 自己列出的一批同构对象逐项执行时用 foreach 节点,两者可以任意嵌套。需要拆分多条独立并行工作线、多会话持续跟踪管理、或用户要求创建多个会话并行时,用 session_spawn 创建兄弟会话,并用 session_status / session_dispatch / session_stop
|
|
113
|
+
- 用户要多个 agent 分工协作:单个子任务用 task 工具委托,有先后依赖的流程用 workflow 工具编排;同一流程要按明确结论行反复执行时用 loop 节点,要对 primary 自己列出的一批同构对象逐项执行时用 foreach 节点,两者可以任意嵌套。需要拆分多条独立并行工作线、多会话持续跟踪管理、或用户要求创建多个会话并行时,用 session_spawn 创建兄弟会话,并用 session_status / session_dispatch / session_stop / session_remove 监督管理与销毁子会话。父会话可用 session_spawn 的 watchdogTimeoutSeconds 声明多久没汇报就提醒;子会话用 session_report 主动汇报(in_progress/completed/failed);停整棵子树用 session_stop_subtree。`;
|
|
114
114
|
|
|
115
115
|
/** The parameters, OpenCode's `tool/todo.ts:6-8` minus its schema wrapper. */
|
|
116
116
|
export type TodoParams = { todos: TodoEntry[] };
|
|
@@ -1138,7 +1138,7 @@ export async function executeScheduledTask(
|
|
|
1138
1138
|
export const PROJECT_TOOL_NAME = "project";
|
|
1139
1139
|
export const PROJECT_ENDPOINT_ENV = "SUPER_PI_PROJECT_ENDPOINT";
|
|
1140
1140
|
|
|
1141
|
-
export const PROJECT_DESCRIPTION = `Manage
|
|
1141
|
+
export const PROJECT_DESCRIPTION = `Manage an agile coding team project through clear delegation, evidence, independent review and level-by-level reporting. When the user describes a project in natural language, to create a project you ONLY need title and objective — all other fields (deliverables, acceptanceCriteria, constraints, risk, tasks, default profiles, mode) are optional; omit whatever you do not already have, leaving them out never blocks starting, and never pause to invent or fill optional parameters before calling action="create". Call action="create" with title and objective (plus any optional fields you already know) to stand up the project in one call: create registers the project (and any optional top-level tasks), spawns the leader session, and starts it immediately with the full context (no separate start call or initial project(action="get") is needed before work begins; action="start" remains available for a planning project created outside the tool). Optional fields include deliverables, acceptanceCriteria, constraints, risk (defaults to low; any value is accepted without error), defaultLeaderProfile/defaultExecutorProfile/defaultReviewerProfile, and mode: standard (the default) or lightweight. For a small self-contained project, create it with mode="lightweight": the project leader session does the work itself, the project has no separate worker or reviewer sessions, and a task is accepted on the worker's own evidence. Use the standard mode when the work needs an independent review. In a lightweight project the leader registers only executor tasks, never splits into child tasks and never asks for a review - a submitted task is a completed task. The conversation that created a project may cancel it with action="cancel" and a reason: the project is marked cancelled, its running sessions are stopped, and its record, tasks, events and evidence are kept. Only that initiating conversation may cancel it - a worker or reviewer cannot cancel the project it belongs to. If you choose to pass the optional tasks array, each entry only needs a title and an objective, and its dependencies name the titles of sibling tasks in the same array. You are the initiator: you may create the project, register top-level tasks and cancel if needed; you may not register child tasks or interfere with member execution. Only a root conversation may create a project. Top-level tasks can also be registered later with add_task. When the user asks "我的项目现在怎么样", "我还有哪些项目在跑", "列出所有项目", or wants an overview of running projects, call action="list" first to retrieve up to 20 most recently updated projects with lightweight summaries (headline, task counts, active workers, tokens) without needing a projectId; the response returns projects, total, and returned counts, where total > returned indicates more historical projects exist in the workspace. Never guess a projectId to call get blindly; only call get when the user targets a specific project and you need deep task, escalation or event details. The project leader receives the current tasks in its startup context and does not need to call get before dispatching; it uses add_task (only title and objective are required; deliverables, acceptanceCriteria, dependencies, role=leader/executor, and executorProfile/reviewerProfile with agentId, cwd, model, thinkingLevel, watchdogTimeoutSeconds are optional), dispatch and request_review. A branch leader creates children with parentTaskId set to its own task ID and manages only its direct tasks. Dependencies must be siblings. Leader aggregate submission requires independently accepted children. Keep at most 3 leader levels and 8 branch leaders; small projects need only one executor. Workers submit output plus evidenceRefs. Only the assigned independent reviewer can review with verdict accepted or changes_requested, summary and evidenceRefs. update_task marks blocked/failed with blockedReason, updates executorProfile/reviewerProfile before child sessions spawn, or the leader resets ready for retry. report records kind=progress/blocked, progress, summary, variance, nextStep, risks, decisionNeeded and evidenceRefs; blocked reports notify your direct supervisor rather than directly alerting Boss. escalate records an optional title, a reason and severity=low/medium/high. The title is ONE SENTENCE naming what the reader has to decide - the question - and the reason is the case for it: why it matters, what the evidence shows, what happens if nobody decides. Give a title whenever the question can be said in one line, because the reader decides on the title and reads the reason only when the question is not obvious; without a title the escalation falls back to its reason. member escalations route to your direct supervisor, and only project leader escalations reach Boss. resolve_escalation closes an escalation that was addressed to you: pass escalationId, decision and status (resolved, dismissed or returned, default resolved). Take escalationId from the escalations array that project(action=get) returns - it is the id of the one escalation you are answering, and the same array tells you whether it is still open. decision is your handling note: what you decided and why. status is optional and defaults to resolved; use dismissed when the question no longer stands. status="returned" means the material was not enough to decide on: the case goes back to whoever raised it, and that person is woken up to supply what is missing instead of the case hanging unanswered. It only accepts a supervisor escalation whose target session is your own - only the session an escalation names may answer it - and an escalation addressed to Boss is the Boss's to decide and is refused for you. Resolving it cascades: the member who raised the escalation is woken up with your decision. complete requires all tasks accepted - independently reviewed in the standard mode, self-accepted in the lightweight mode - and a final summary with evidenceRefs. action="export" returns the project as a Markdown report: the objective, every task with its delivery, evidence and review, the exceptions and how they were decided, and the full timeline. Use it when the user asks for a summary, a handover, or a status write-up of the project. Project and task IDs come from create/get/add_task. Reads never invoke models. Dispatch is asynchronous and starts the child session immediately; wait for child completion reports instead of polling. Do not use session_spawn, session_dispatch, task or workflow to bypass the project's delegation and reporting chain. Never claim success on an error.`;
|
|
1142
1142
|
|
|
1143
1143
|
export function readProjectConfig(env: Record<string, string | undefined>) {
|
|
1144
1144
|
return { endpoint: env[PROJECT_ENDPOINT_ENV] ?? "", conversationId: env[TASK_CONVERSATION_ENV] ?? "", workspaceId: env.SUPER_PI_ORCHESTRATOR_WORKSPACE ?? "", capability: env[TASK_CAPABILITY_ENV] };
|
|
@@ -1164,6 +1164,7 @@ export const SESSION_DISPATCH_TOOL_NAME = "session_dispatch";
|
|
|
1164
1164
|
export const SESSION_STOP_TOOL_NAME = "session_stop";
|
|
1165
1165
|
export const SESSION_REPORT_TOOL_NAME = "session_report";
|
|
1166
1166
|
export const SESSION_STOP_SUBTREE_TOOL_NAME = "session_stop_subtree";
|
|
1167
|
+
export const SESSION_REMOVE_TOOL_NAME = "session_remove";
|
|
1167
1168
|
|
|
1168
1169
|
/** Model-facing description for session_spawn. */
|
|
1169
1170
|
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.
|
|
@@ -1217,7 +1218,11 @@ Usage notes:
|
|
|
1217
1218
|
1. 'conversationId' is required and must identify an existing sibling conversation.
|
|
1218
1219
|
2. 'content' is the text instruction sent to that session, just as if typed by a user in that session's chat.
|
|
1219
1220
|
3. Dispatch is ASYNCHRONOUS by default: it enqueues the message into the session's queue and returns immediately.
|
|
1220
|
-
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
|
|
1221
|
+
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.
|
|
1222
|
+
5. 'mode' controls delivery when the target session is busy:
|
|
1223
|
+
- '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).
|
|
1224
|
+
- '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.
|
|
1225
|
+
- Invalid 'mode' values are rejected with an error (never silently fall back to 'queue').`;
|
|
1221
1226
|
|
|
1222
1227
|
/** Model-facing description for session_stop. */
|
|
1223
1228
|
export const SESSION_STOP_DESCRIPTION = `Stop execution in a sibling conversation.
|
|
@@ -1231,7 +1236,8 @@ Usage notes:
|
|
|
1231
1236
|
- 'all' (default): stops the currently running turn and cancels all pending queued messages in the session.
|
|
1232
1237
|
- 'active': only interrupts the active running turn; leaves any pending queued messages untouched.
|
|
1233
1238
|
- 'queued': only cancels pending queued messages; lets the currently running turn complete naturally.
|
|
1234
|
-
2. Use 'messageId' if you want to cancel or interrupt one specific queued message instead of all queued messages
|
|
1239
|
+
2. Use 'messageId' if you want to cancel or interrupt one specific queued message instead of all queued messages.
|
|
1240
|
+
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.`;
|
|
1235
1241
|
|
|
1236
1242
|
/** Model-facing description for session_report. */
|
|
1237
1243
|
export const SESSION_REPORT_DESCRIPTION = `Report progress from THIS session to the parent session that spawned it.
|
|
@@ -1274,6 +1280,24 @@ Usage notes:
|
|
|
1274
1280
|
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.
|
|
1275
1281
|
4. The answer says how many sessions were stopped in total, including the one you named.`;
|
|
1276
1282
|
|
|
1283
|
+
/** Model-facing description for session_remove. */
|
|
1284
|
+
export const SESSION_REMOVE_DESCRIPTION = `Permanently destroy a direct child session (and any descendant sessions under it) from the current working group.
|
|
1285
|
+
|
|
1286
|
+
WHEN TO USE THIS:
|
|
1287
|
+
- A child session's work is finished and you no longer need its session, transcript, or saved output.
|
|
1288
|
+
- A child session is stuck and no longer needed, or was spawned by mistake / as a duplicate.
|
|
1289
|
+
|
|
1290
|
+
WHEN NOT TO USE THIS:
|
|
1291
|
+
- You still plan to send follow-up instructions to it later, or still need its transcript, messages, or saved result file.
|
|
1292
|
+
- 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.
|
|
1293
|
+
|
|
1294
|
+
Usage notes:
|
|
1295
|
+
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.
|
|
1296
|
+
2. Once destroyed, the session and its branch disappear from your active child list, session_status queries, and reporting wait state.
|
|
1297
|
+
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.
|
|
1298
|
+
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.
|
|
1299
|
+
5. Destroying a session that is already gone is idempotent and succeeds without error.`;
|
|
1300
|
+
|
|
1277
1301
|
/** Compact summary returned for an orchestrated session. */
|
|
1278
1302
|
export type OrchestratorSessionSummary = {
|
|
1279
1303
|
conversationId: string;
|
|
@@ -1296,6 +1320,7 @@ export type OrchestratorSessionSummary = {
|
|
|
1296
1320
|
output?: string;
|
|
1297
1321
|
outputPath?: string;
|
|
1298
1322
|
outputTruncated?: boolean;
|
|
1323
|
+
queuedMessages?: { id: string; delivery: "waiting" | "sending"; role: "user" | "tool"; snippet: string }[];
|
|
1299
1324
|
};
|
|
1300
1325
|
|
|
1301
1326
|
export type OrchestratorToolConfig = {
|
|
@@ -1357,12 +1382,14 @@ export type SessionDispatchParams = {
|
|
|
1357
1382
|
conversationId: string;
|
|
1358
1383
|
content: string;
|
|
1359
1384
|
wait?: boolean;
|
|
1385
|
+
mode?: "queue" | "steer";
|
|
1360
1386
|
};
|
|
1361
1387
|
|
|
1362
1388
|
export type SessionStopParams = {
|
|
1363
1389
|
conversationId: string;
|
|
1364
1390
|
mode?: "active" | "queued" | "all";
|
|
1365
1391
|
messageId?: string;
|
|
1392
|
+
messageIds?: string[];
|
|
1366
1393
|
};
|
|
1367
1394
|
|
|
1368
1395
|
/**
|
|
@@ -1377,6 +1404,12 @@ export type SessionStopSubtreeParams = {
|
|
|
1377
1404
|
messageId?: string;
|
|
1378
1405
|
};
|
|
1379
1406
|
|
|
1407
|
+
/** Parameters for removing a direct child session from the active working group. */
|
|
1408
|
+
export type SessionRemoveParams = {
|
|
1409
|
+
conversationId: string;
|
|
1410
|
+
reason?: string;
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1380
1413
|
/**
|
|
1381
1414
|
* What this session is allowed to tell its parent.
|
|
1382
1415
|
*
|
|
@@ -1622,6 +1655,10 @@ export async function executeSessionStatus(
|
|
|
1622
1655
|
...(s.error ? [`- Error: ${s.error}`] : []),
|
|
1623
1656
|
...(s.lastAssistantSnippet ? [`- Latest Assistant Progress: "${s.lastAssistantSnippet}"`] : []),
|
|
1624
1657
|
...(s.lastUserSnippet ? [`- Latest User/Prompt Snippet: "${s.lastUserSnippet}"`] : []),
|
|
1658
|
+
...(s.queuedMessages?.length ? [
|
|
1659
|
+
`- Queued Messages (${s.queuedMessages.length}):`,
|
|
1660
|
+
...s.queuedMessages.map((q) => ` - [${q.id}] (${q.delivery}, ${q.role}) "${q.snippet}"`),
|
|
1661
|
+
] : []),
|
|
1625
1662
|
...(s.output !== undefined ? [
|
|
1626
1663
|
`- Output File: ${s.outputPath ?? "unavailable"}`,
|
|
1627
1664
|
...(s.outputTruncated ? ["- Output was truncated to the last 64Ki characters; read the output file for the complete result."] : []),
|
|
@@ -1669,6 +1706,9 @@ export async function executeSessionDispatch(
|
|
|
1669
1706
|
if (!params.content?.trim()) {
|
|
1670
1707
|
return text("session_dispatch requires a non-empty `content` message.", true);
|
|
1671
1708
|
}
|
|
1709
|
+
if (params.mode !== undefined && params.mode !== "queue" && params.mode !== "steer") {
|
|
1710
|
+
return text(`session_dispatch received invalid mode ${JSON.stringify(params.mode)}. Expected "queue" or "steer".`, true);
|
|
1711
|
+
}
|
|
1672
1712
|
|
|
1673
1713
|
const send = deps.fetch ?? (globalFetch as unknown as TaskFetch);
|
|
1674
1714
|
try {
|
|
@@ -1683,6 +1723,7 @@ export async function executeSessionDispatch(
|
|
|
1683
1723
|
conversationId: params.conversationId.trim(),
|
|
1684
1724
|
content: params.content.trim(),
|
|
1685
1725
|
wait: Boolean(params.wait),
|
|
1726
|
+
...(params.mode !== undefined ? { mode: params.mode } : {}),
|
|
1686
1727
|
callerConversationId: config.conversationId || undefined,
|
|
1687
1728
|
parentConversationId: config.conversationId || undefined,
|
|
1688
1729
|
capability: config.capability,
|
|
@@ -1691,7 +1732,7 @@ export async function executeSessionDispatch(
|
|
|
1691
1732
|
});
|
|
1692
1733
|
|
|
1693
1734
|
const bodyText = await response.text();
|
|
1694
|
-
let payload: { ok?: boolean; conversationId?: string; error?: string };
|
|
1735
|
+
let payload: { ok?: boolean; conversationId?: string; messageId?: string; mode?: string; error?: string };
|
|
1695
1736
|
try {
|
|
1696
1737
|
payload = JSON.parse(bodyText);
|
|
1697
1738
|
} catch {
|
|
@@ -1702,7 +1743,9 @@ export async function executeSessionDispatch(
|
|
|
1702
1743
|
return text(`Failed to dispatch message to session ${params.conversationId}: ${payload.error ?? `HTTP ${response.status}`}`, true);
|
|
1703
1744
|
}
|
|
1704
1745
|
|
|
1705
|
-
|
|
1746
|
+
const modeLabel = payload.mode ?? params.mode ?? "queue";
|
|
1747
|
+
const idLabel = payload.messageId ? ` messageId=${payload.messageId}` : "";
|
|
1748
|
+
return text(`Message successfully dispatched to session ${params.conversationId} (mode: ${modeLabel}${idLabel}). The turn has been enqueued.`);
|
|
1706
1749
|
} catch (error) {
|
|
1707
1750
|
return text(`session_dispatch network error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
1708
1751
|
}
|
|
@@ -1726,6 +1769,22 @@ export async function executeSessionStop(
|
|
|
1726
1769
|
if (!params.conversationId?.trim()) {
|
|
1727
1770
|
return text("session_stop requires a valid `conversationId`.", true);
|
|
1728
1771
|
}
|
|
1772
|
+
if (params.messageId?.trim() && params.messageIds !== undefined) {
|
|
1773
|
+
return text("session_stop cannot accept both `messageId` and `messageIds` together.", true);
|
|
1774
|
+
}
|
|
1775
|
+
let normalizedMessageIds: string[] | undefined;
|
|
1776
|
+
if (params.messageIds !== undefined) {
|
|
1777
|
+
if (!Array.isArray(params.messageIds) || params.messageIds.length === 0) {
|
|
1778
|
+
return text("session_stop `messageIds` must be a non-empty array of queued message IDs.", true);
|
|
1779
|
+
}
|
|
1780
|
+
normalizedMessageIds = [];
|
|
1781
|
+
for (const item of params.messageIds) {
|
|
1782
|
+
if (typeof item !== "string" || !item.trim()) {
|
|
1783
|
+
return text("session_stop `messageIds` entries must all be non-empty strings.", true);
|
|
1784
|
+
}
|
|
1785
|
+
normalizedMessageIds.push(item.trim());
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1729
1788
|
|
|
1730
1789
|
const send = deps.fetch ?? (globalFetch as unknown as TaskFetch);
|
|
1731
1790
|
try {
|
|
@@ -1740,6 +1799,7 @@ export async function executeSessionStop(
|
|
|
1740
1799
|
conversationId: params.conversationId.trim(),
|
|
1741
1800
|
mode: params.mode ?? "all",
|
|
1742
1801
|
messageId: params.messageId?.trim() || undefined,
|
|
1802
|
+
...(normalizedMessageIds ? { messageIds: normalizedMessageIds } : {}),
|
|
1743
1803
|
callerConversationId: config.conversationId || undefined,
|
|
1744
1804
|
parentConversationId: config.conversationId || undefined,
|
|
1745
1805
|
capability: config.capability,
|
|
@@ -1748,7 +1808,14 @@ export async function executeSessionStop(
|
|
|
1748
1808
|
});
|
|
1749
1809
|
|
|
1750
1810
|
const bodyText = await response.text();
|
|
1751
|
-
let payload: {
|
|
1811
|
+
let payload: {
|
|
1812
|
+
ok?: boolean;
|
|
1813
|
+
stopped?: boolean;
|
|
1814
|
+
mode?: string;
|
|
1815
|
+
withdrawn?: { id: string; content: string; role: string }[];
|
|
1816
|
+
missingIds?: string[];
|
|
1817
|
+
error?: string;
|
|
1818
|
+
};
|
|
1752
1819
|
try {
|
|
1753
1820
|
payload = JSON.parse(bodyText);
|
|
1754
1821
|
} catch {
|
|
@@ -1759,6 +1826,12 @@ export async function executeSessionStop(
|
|
|
1759
1826
|
return text(`Failed to stop session ${params.conversationId}: ${payload.error ?? `HTTP ${response.status}`}`, true);
|
|
1760
1827
|
}
|
|
1761
1828
|
|
|
1829
|
+
if (payload.withdrawn) {
|
|
1830
|
+
const summary = payload.withdrawn.map((w) => `[${w.id}] "${w.content.replace(/\s+/g, " ").trim().slice(0, 80)}"`).join(", ");
|
|
1831
|
+
const missingNote = payload.missingIds?.length ? ` (not queued/already sent: ${payload.missingIds.join(", ")})` : "";
|
|
1832
|
+
return text(`Withdrew ${payload.withdrawn.length} queued message(s) from session ${params.conversationId} (mode: ${payload.mode ?? "queued-withdraw"}): ${summary}${missingNote}.`);
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1762
1835
|
return text(`Session ${params.conversationId} stopped (mode: ${payload.mode ?? params.mode ?? "all"}).`);
|
|
1763
1836
|
} catch (error) {
|
|
1764
1837
|
return text(`session_stop network error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
@@ -1837,6 +1910,90 @@ export async function executeSessionStopSubtree(
|
|
|
1837
1910
|
}
|
|
1838
1911
|
}
|
|
1839
1912
|
|
|
1913
|
+
/**
|
|
1914
|
+
* Execute session_remove: stops (if active) and archives a direct child session so it leaves the
|
|
1915
|
+
* active working group while preserving all transcript history and outputs.
|
|
1916
|
+
*/
|
|
1917
|
+
export async function executeSessionRemove(
|
|
1918
|
+
params: SessionRemoveParams,
|
|
1919
|
+
config: OrchestratorToolConfig,
|
|
1920
|
+
deps: { signal?: AbortSignal; fetch?: TaskFetch } = {},
|
|
1921
|
+
): Promise<TaskToolResult> {
|
|
1922
|
+
const text = (body: string, isError?: boolean): TaskToolResult => ({
|
|
1923
|
+
content: [{ type: "text", text: body }],
|
|
1924
|
+
details: undefined,
|
|
1925
|
+
...(isError ? { isError: true } : {}),
|
|
1926
|
+
});
|
|
1927
|
+
|
|
1928
|
+
if (!config.endpoint) {
|
|
1929
|
+
return text("The session_remove tool is not available in this session: SUPER_PI_ORCHESTRATOR_ENDPOINT is not set.", true);
|
|
1930
|
+
}
|
|
1931
|
+
const targetId = typeof params.conversationId === "string" ? params.conversationId.trim() : "";
|
|
1932
|
+
if (!targetId) {
|
|
1933
|
+
return text("session_remove requires a valid `conversationId`.", true);
|
|
1934
|
+
}
|
|
1935
|
+
if (params.reason !== undefined && typeof params.reason !== "string") {
|
|
1936
|
+
return text("session_remove `reason` must be a string when provided.", true);
|
|
1937
|
+
}
|
|
1938
|
+
const reason = typeof params.reason === "string" && params.reason.trim() ? params.reason.trim() : undefined;
|
|
1939
|
+
|
|
1940
|
+
const fetchImpl = deps.fetch ?? globalThis.fetch;
|
|
1941
|
+
try {
|
|
1942
|
+
const response = await fetchImpl(config.endpoint, {
|
|
1943
|
+
method: "POST",
|
|
1944
|
+
headers: {
|
|
1945
|
+
"content-type": "application/json",
|
|
1946
|
+
...(config.token ? { authorization: `Bearer ${config.token}` } : {}),
|
|
1947
|
+
},
|
|
1948
|
+
body: JSON.stringify({
|
|
1949
|
+
action: "remove",
|
|
1950
|
+
conversationId: targetId,
|
|
1951
|
+
callerConversationId: config.conversationId,
|
|
1952
|
+
capability: config.capability,
|
|
1953
|
+
...(reason ? { reason } : {}),
|
|
1954
|
+
}),
|
|
1955
|
+
signal: deps.signal,
|
|
1956
|
+
});
|
|
1957
|
+
|
|
1958
|
+
const bodyText = await response.text();
|
|
1959
|
+
let payload: {
|
|
1960
|
+
ok?: boolean;
|
|
1961
|
+
removed?: boolean;
|
|
1962
|
+
alreadyRemoved?: boolean;
|
|
1963
|
+
conversationId?: string;
|
|
1964
|
+
title?: string;
|
|
1965
|
+
destroyedIds?: string[];
|
|
1966
|
+
stoppedFirst?: boolean;
|
|
1967
|
+
reason?: string;
|
|
1968
|
+
error?: string;
|
|
1969
|
+
};
|
|
1970
|
+
try {
|
|
1971
|
+
payload = JSON.parse(bodyText);
|
|
1972
|
+
} catch {
|
|
1973
|
+
return text(`The orchestrator endpoint returned HTTP ${response.status}: ${bodyText}`, true);
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
if (!response.ok || !payload.ok) {
|
|
1977
|
+
return text(`Failed to remove session ${targetId}: ${payload.error ?? `HTTP ${response.status}`}`, true);
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
const removedId = payload.conversationId ?? targetId;
|
|
1981
|
+
const label = payload.title ? `"${payload.title}" (${removedId})` : removedId;
|
|
1982
|
+
if (payload.alreadyRemoved) {
|
|
1983
|
+
return text(
|
|
1984
|
+
`Session ${label} was already removed and is no longer present.`,
|
|
1985
|
+
);
|
|
1986
|
+
}
|
|
1987
|
+
const appliedReason = payload.reason ?? reason;
|
|
1988
|
+
const descendantCount = Math.max(0, (payload.destroyedIds?.length ?? 1) - 1);
|
|
1989
|
+
return text(
|
|
1990
|
+
`Permanently destroyed child session ${label}${descendantCount > 0 ? ` and ${descendantCount} descendant session(s)` : ""}${payload.stoppedFirst ? " (stopped active work first)" : ""}${appliedReason ? `; reason: ${appliedReason}` : ""}. All transcript history, tool calls, and output artifacts for ${descendantCount > 0 ? "these sessions" : "this session"} have been deleted.`,
|
|
1991
|
+
);
|
|
1992
|
+
} catch (error) {
|
|
1993
|
+
return text(`session_remove network error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1840
1997
|
/**
|
|
1841
1998
|
* Execute session_report: THIS session tells its direct parent what is going on.
|
|
1842
1999
|
*
|
|
@@ -44,18 +44,21 @@ import {
|
|
|
44
44
|
SESSION_STOP_TOOL_NAME,
|
|
45
45
|
SESSION_REPORT_TOOL_NAME,
|
|
46
46
|
SESSION_STOP_SUBTREE_TOOL_NAME,
|
|
47
|
+
SESSION_REMOVE_TOOL_NAME,
|
|
47
48
|
SESSION_SPAWN_DESCRIPTION,
|
|
48
49
|
SESSION_STATUS_DESCRIPTION,
|
|
49
50
|
SESSION_DISPATCH_DESCRIPTION,
|
|
50
51
|
SESSION_STOP_DESCRIPTION,
|
|
51
52
|
SESSION_REPORT_DESCRIPTION,
|
|
52
53
|
SESSION_STOP_SUBTREE_DESCRIPTION,
|
|
54
|
+
SESSION_REMOVE_DESCRIPTION,
|
|
53
55
|
executeSessionSpawn,
|
|
54
56
|
executeSessionStatus,
|
|
55
57
|
executeSessionDispatch,
|
|
56
58
|
executeSessionStop,
|
|
57
59
|
executeSessionReport,
|
|
58
60
|
executeSessionStopSubtree,
|
|
61
|
+
executeSessionRemove,
|
|
59
62
|
readOrchestratorConfig,
|
|
60
63
|
type SessionSpawnParams,
|
|
61
64
|
type SessionStatusParams,
|
|
@@ -63,6 +66,7 @@ import {
|
|
|
63
66
|
type SessionStopParams,
|
|
64
67
|
type SessionReportParams,
|
|
65
68
|
type SessionStopSubtreeParams,
|
|
69
|
+
type SessionRemoveParams,
|
|
66
70
|
} from "./core.ts";
|
|
67
71
|
|
|
68
72
|
/**
|
|
@@ -308,17 +312,20 @@ const extension = (pi: ExtensionApi): void => {
|
|
|
308
312
|
action: Type.Union(["create", "start", "get", "list", "add_task", "dispatch", "submit", "request_review", "review", "update_task", "report", "escalate", "resolve_escalation", "complete", "cancel", "export"].map((value) => Type.Literal(value))),
|
|
309
313
|
projectId: Type.Optional(Type.String()), taskId: Type.Optional(Type.String()),
|
|
310
314
|
parentTaskId: Type.Optional(Type.String()), role: Type.Optional(Type.Union([Type.Literal("leader"), Type.Literal("executor")])),
|
|
311
|
-
title: Type.Optional(Type.String(
|
|
312
|
-
|
|
313
|
-
|
|
315
|
+
title: Type.Optional(Type.String({ description: "Required for action=\"create\" (and add_task): short project or task title." })),
|
|
316
|
+
objective: Type.Optional(Type.String({ description: "Required for action=\"create\" (and add_task): what the project or task should achieve." })),
|
|
317
|
+
deliverables: Type.Optional(Type.Array(Type.String(), { description: "Optional deliverables list. Omit if not needed; does not block starting." })),
|
|
318
|
+
acceptanceCriteria: Type.Optional(Type.Array(Type.String(), { description: "Optional acceptance criteria list. Omit if not needed; does not block starting." })),
|
|
319
|
+
constraints: Type.Optional(Type.Array(Type.String(), { description: "Optional constraints list. Omit if not needed; does not block starting." })),
|
|
320
|
+
dependencies: Type.Optional(Type.Array(Type.String())),
|
|
321
|
+
risk: Type.Optional(Type.String({ description: "Optional risk level (defaults to low; any value is accepted without error)." })),
|
|
314
322
|
mode: Type.Optional(Type.Union([Type.Literal("standard"), Type.Literal("lightweight")])),
|
|
315
|
-
budget: Type.Optional(Type.Object({ maxTokens: Type.Optional(Type.Number()), maxConcurrent: Type.Optional(Type.Number()) })),
|
|
316
323
|
priority: Type.Optional(Type.String()), status: Type.Optional(Type.String()), blockedReason: Type.Optional(Type.String()),
|
|
317
324
|
tasks: Type.Optional(Type.Array(Type.Object({
|
|
318
325
|
title: Type.String(), objective: Type.String(),
|
|
319
326
|
deliverables: Type.Optional(Type.Array(Type.String())), acceptanceCriteria: Type.Optional(Type.Array(Type.String())),
|
|
320
327
|
dependencies: Type.Optional(Type.Array(Type.String())), priority: Type.Optional(Type.String()),
|
|
321
|
-
}))),
|
|
328
|
+
}), { description: "Optional initial top-level tasks. Omit to let the leader decompose and dispatch." })),
|
|
322
329
|
output: Type.Optional(Type.String()), evidenceRefs: Type.Optional(Type.Array(Type.String())), verdict: Type.Optional(Type.String()), summary: Type.Optional(Type.String()),
|
|
323
330
|
kind: Type.Optional(Type.String()), progress: Type.Optional(Type.String()), variance: Type.Optional(Type.String()), nextStep: Type.Optional(Type.String()),
|
|
324
331
|
risks: Type.Optional(Type.Array(Type.String())), decisionNeeded: Type.Optional(Type.String()), reason: Type.Optional(Type.String()), severity: Type.Optional(Type.String()),
|
|
@@ -558,6 +565,12 @@ const extension = (pi: ExtensionApi): void => {
|
|
|
558
565
|
wait: Type.Optional(Type.Boolean({
|
|
559
566
|
description: "Whether to await turn completion before returning (default: false, asynchronous).",
|
|
560
567
|
})),
|
|
568
|
+
mode: Type.Optional(Type.Union([
|
|
569
|
+
Type.Literal("queue", { description: "Wait for the active turn and earlier queued messages to finish (default)" }),
|
|
570
|
+
Type.Literal("steer", { description: "Deliver as steering guidance at the next tool/turn boundary without killing in-flight tools" }),
|
|
571
|
+
], {
|
|
572
|
+
description: "Delivery mode when the sibling session is busy: 'queue' (default) or 'steer' (next turn boundary).",
|
|
573
|
+
})),
|
|
561
574
|
});
|
|
562
575
|
|
|
563
576
|
const SessionStopParameters = Type.Object({
|
|
@@ -574,6 +587,9 @@ const extension = (pi: ExtensionApi): void => {
|
|
|
574
587
|
messageId: Type.Optional(Type.String({
|
|
575
588
|
description: "Optional specific queued message ID to cancel or interrupt.",
|
|
576
589
|
})),
|
|
590
|
+
messageIds: Type.Optional(Type.Array(Type.String(), {
|
|
591
|
+
description: "Optional list of queued message IDs to selectively withdraw while keeping other queued/steered messages and the running turn.",
|
|
592
|
+
})),
|
|
577
593
|
});
|
|
578
594
|
|
|
579
595
|
/**
|
|
@@ -600,6 +616,16 @@ const extension = (pi: ExtensionApi): void => {
|
|
|
600
616
|
})),
|
|
601
617
|
});
|
|
602
618
|
|
|
619
|
+
/** The `session_remove` parameter schema. */
|
|
620
|
+
const SessionRemoveParameters = Type.Object({
|
|
621
|
+
conversationId: Type.String({
|
|
622
|
+
description: "The conversation ID of your direct child session to permanently destroy (along with any descendant sessions under it).",
|
|
623
|
+
}),
|
|
624
|
+
reason: Type.Optional(Type.String({
|
|
625
|
+
description: "Optional reason for destroying this child session (confirmed in the tool result).",
|
|
626
|
+
})),
|
|
627
|
+
});
|
|
628
|
+
|
|
603
629
|
/**
|
|
604
630
|
* The `session_report` parameter schema.
|
|
605
631
|
*
|
|
@@ -697,6 +723,16 @@ const extension = (pi: ExtensionApi): void => {
|
|
|
697
723
|
execute: async (_toolCallId, params, signal) =>
|
|
698
724
|
await executeSessionStopSubtree(params as SessionStopSubtreeParams, orchestratorConfig, { signal: signal ?? undefined }),
|
|
699
725
|
});
|
|
726
|
+
|
|
727
|
+
pi.registerTool({
|
|
728
|
+
name: SESSION_REMOVE_TOOL_NAME,
|
|
729
|
+
label: "Remove Child Session",
|
|
730
|
+
description: SESSION_REMOVE_DESCRIPTION,
|
|
731
|
+
promptSnippet: "remove a direct child session from the active working group (archive without deleting history)",
|
|
732
|
+
parameters: SessionRemoveParameters,
|
|
733
|
+
execute: async (_toolCallId, params, signal) =>
|
|
734
|
+
await executeSessionRemove(params as SessionRemoveParams, orchestratorConfig, { signal: signal ?? undefined }),
|
|
735
|
+
});
|
|
700
736
|
}
|
|
701
737
|
};
|
|
702
738
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "c12077bfd29fc123bf28d42e71483e56c7f496bdcc23e5cff5a98ebfe9d7a682",
|
|
3
3
|
"files": {
|
|
4
|
-
"src/client/App.tsx": "
|
|
4
|
+
"src/client/App.tsx": "4e9bcb3e0987b741dd721c7c9e2ad84a7c1ba79202b38092fda568f9b484d4c0",
|
|
5
5
|
"src/client/CodeMirrorEditor.tsx": "b6b6479effa1482eda710f04a26f3af843515526e129ca5bc70692cca9074b09",
|
|
6
6
|
"src/client/ErrorBoundary.tsx": "d16376f9f6c7cc1fab8590c65a66438127642f7d6bb8023cec53d8a6cc9f3964",
|
|
7
7
|
"src/client/FeishuPanel.tsx": "52f116eba265bfde683338f5893107ad5559fd2f7d4a9e0df935507a46862a3b",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"src/client/KnowledgePanel.tsx": "4f7230cfe610cd86d63aa143c82f6195b3c4208ef0bea703f92104ef27237704",
|
|
13
13
|
"src/client/MarkdownView.tsx": "4f04a8f3c9381946e5d2f957ac4fb74a6b16272e90375fb4dc6bd3a43d7c744d",
|
|
14
14
|
"src/client/MemoryPanel.tsx": "59a74f5789f43708245b6f62ba3b873ad91804f64c1e352403d5b7dffd478fdc",
|
|
15
|
-
"src/client/ProjectControlPanel.tsx": "
|
|
16
|
-
"src/client/ProjectExecutionTools.tsx": "
|
|
15
|
+
"src/client/ProjectControlPanel.tsx": "9607edde75540bc02031c82e9d75af84c0d55a231a08f01b2d0aa4935925303c",
|
|
16
|
+
"src/client/ProjectExecutionTools.tsx": "56e2868633bfb50d1921b4813b7428ddfa19098d0b8e17a9ed9c61e3b33b0b39",
|
|
17
17
|
"src/client/ScheduledTasksPanel.tsx": "74f8bea76cbe540b4eb22163ba28ed56920643de5948d1c5c8c37604f52368c3",
|
|
18
18
|
"src/client/SlashCommandMenu.tsx": "69cd0a9d5e35f41f703e91a845e5bd750c952d2957be03b5528e156e60bf6ecb",
|
|
19
19
|
"src/client/Tabs.tsx": "87b2154b614b6593b3fd75577f6e8356a32d80506165c301eb99db3cec520abe",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"src/client/project-evidence.ts": "3bc5ea85f6b20a19a36cfdd4a958d83dd53b21f3d8f20fae1914a575dfbad3c4",
|
|
31
31
|
"src/client/session-tree.ts": "08a14c6611fdd9a72001eb1672060479e7660de5a5d221c7e80036209fd26546",
|
|
32
32
|
"src/client/slash-commands.ts": "b792018fb67bd9e6f777397b0720b8b3aa565a4d8f7a76f94fec097ddf749480",
|
|
33
|
-
"src/client/styles.css": "
|
|
33
|
+
"src/client/styles.css": "078ceda4d7f8d6214a3de8f407c169280ad9cb7744d8898b4285af20e8a01162",
|
|
34
34
|
"src/client/terminal-emulator.ts": "ffcc4f5fbddaf25cebcc9e03dbe5d7d0ad2c21586f5d169e57c04c82e2308b3b",
|
|
35
35
|
"src/client/theme.tsx": "df10e163ee61c2cc96c8f63da2dfd314b5db33adb0377d66a422143bb2cb9ab5",
|
|
36
36
|
"src/client/tool-launcher.ts": "40fb4974362bbc8c73ecd651da1abce251fc28857564a9321037adcfdb0bfe24",
|
|
37
37
|
"src/client/tool-sharing.ts": "679c97f6d40be466964f2f1076aa7ea55f4a585c3deff8214675070220921059",
|
|
38
38
|
"src/client/tool-shortcuts.ts": "cbd89186776cab19b8b3ec40b8a755c4fc2a47d1c03653eca55e6b23b865c3b6",
|
|
39
39
|
"src/client/tools.ts": "58fe41f0edbd490e3fab7f12f258b1dbc2163b653553b03ac61caf1543618e50",
|
|
40
|
-
"src/client/types.ts": "
|
|
40
|
+
"src/client/types.ts": "ef0586e206d0f229ed0e81e72397e1ddfd82c00ae7133d06d20892605e6f1ff4",
|
|
41
41
|
"src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5"
|
|
42
42
|
},
|
|
43
|
-
"recordedAt": "2026-11-
|
|
43
|
+
"recordedAt": "2026-11-11T12:39:20.364Z"
|
|
44
44
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-
|
|
2
|
-
import{a as e,i as t,n,r,s as i,t as a}from"./index-D_XU8eXm.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-Bc6s4uHe.js`),__vite__mapDeps([0,1,2,3,4,5])),e()]),a=i[t]??i.default??i;return n.define(a)}var c={cpp:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-CIxW4sg_.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mjs:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),tsx:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mts:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cts:()=>r(()=>import(`./dist-BKj3_VBI.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),py:()=>r(()=>import(`./dist-D-MqsRQM.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-D-MqsRQM.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-BUHFKfEO.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-cgEoGcO1.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-DsUX6SY5.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-Bpfwpwk8.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-Bpfwpwk8.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-BoSFlin7.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-Bvl-DsMt.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-Bvl-DsMt.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-Bvl-DsMt.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-BtRpNdOI.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-BtRpNdOI.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-BtRpNdOI.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-BtRpNdOI.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-CvM_6f5G.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-CPEKtCMg.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-CPEKtCMg.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-CPEKtCMg.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-Bcw21qWX.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-DF3hHXYK.js`).then(e=>e.go()),__vite__mapDeps([21,5,2,3,0,1,4,7,9])),sh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>r(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>r(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>r(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>r(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:i,jumpToLine:s,onSave:c,workspaceId:l,blame:g}){let v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(i),D=(0,o.useRef)(c);E.current=i,D.current=c;let[O,k]=(0,o.useState)(!1),[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(`0,0`),[P,F]=(0,o.useState)(0);(0,o.useEffect)(()=>{let i=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,O,A,M,P,I,L]=await Promise.all([r(()=>import(`./dist-XrYkL2Xu.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-BS72C5ep.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-1PSYOzSn.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-CJ4rSQ4N.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-Bc6s4uHe.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-D4SHQTo9.js`).then(e=>e.n),__vite__mapDeps([5,2,3])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),n().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(i||!v.current)return;c=M,l=P,x.current=m.Annotation.define(),S.current=m.Transaction.addToHistory;let R=t.length<=p&&I!==null;o=new m.Compartment;let z=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),O.history(),g.keymap.of([O.indentWithTab,...O.defaultKeymap,...O.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(D.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(x.current&&e.transactions.some(e=>e.annotation(x.current)===!0))&&E.current(e.state.doc.toString()),e.selectionSet&&N(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(L&&(s=new m.Compartment,z.splice(1,0,s.of([])),z.push(L.base)),I)try{z.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),R=!1}if(R&&o&&c&&l)try{z.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),R=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:z}),parent:v.current}),i){a.destroy();return}y.current=a,k(R),j(!0),C.current=L,w.current=s??null,T.current=null,F(e=>e+1);let B=new MutationObserver(()=>{let e=y.current;if(e&&R&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});b.current=B,B.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||j(!0)}})(),()=>{i=!0,b.current?.disconnect(),b.current=null,a?.destroy(),y.current=null,j(!1),v.current&&(v.current.textContent=``)}},[e]),(0,o.useEffect)(()=>{let e=y.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:x.current?x.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=y.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines));e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),e.focus()},[s,A]);let I=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=y.current,n=C.current,r=w.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;T.current!==o&&(T.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,P]);let L=y.current?.state.doc.toString()??t,R=L.length<=m?L:L.slice(0,m),z=h(e),B=d(z);return(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":R,"data-file-content-truncated":L.length>m?`1`:`0`,"data-file-selection":M,"data-file-editor-ready":A?`1`:`0`,"data-file-blame-gutter":I?`1`:void 0,onMouseDown:()=>y.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:v,"aria-label":`编辑 ${e}`}),!A&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`}),A&&!O&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-highlight-status":`plain`,children:`纯文本`}),A&&O&&B&&(0,f.jsx)(`span`,{className:`file-cm-status file-cm-status-lang`,"data-file-highlight-status":z,children:B})]})}export{v as CodeMirrorEditor};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-C2ltv_8u.js","assets/dist-BMSVWA_A.js","assets/index-Dx7HAZ5j.js","assets/index-BXQjUHV_.css","assets/dist-CWlI6qO0.js","assets/dist-ibsGPa_S.js","assets/dist-RHYiODih.js","assets/dist-B8CAEuXW.js","assets/dist-Cblc22Ag.js","assets/dist-V27Fcf8p.js","assets/dist-DHFt0Hvo.js","assets/dist-CKZOnuRU.js","assets/dist-CXDhHY7N.js","assets/dist-BdiInYmk.js","assets/dist-WfagMkC4.js","assets/dist-CcuBp_Kn.js","assets/dist-frBiV55p.js","assets/dist-CDSDxXju.js","assets/dist-Bq7p17eF.js","assets/dist-akJoBtjs.js","assets/dist-D_7x3oZt.js","assets/dist-C0PMHwdm.js","assets/dist-BKx3CpQJ.js","assets/dist-BzqUlzAf.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,i as t,n,r,s as i,t as a}from"./index-Dx7HAZ5j.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-C2ltv_8u.js`),__vite__mapDeps([0,1,2,3,4,5])),e()]),a=i[t]??i.default??i;return n.define(a)}var c={cpp:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-RHYiODih.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mjs:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),tsx:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mts:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cts:()=>r(()=>import(`./dist-Cblc22Ag.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),py:()=>r(()=>import(`./dist-DHFt0Hvo.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-DHFt0Hvo.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-CKZOnuRU.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-CXDhHY7N.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-CcuBp_Kn.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-frBiV55p.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-frBiV55p.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-CDSDxXju.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-Bq7p17eF.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-Bq7p17eF.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-Bq7p17eF.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-BdiInYmk.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-BdiInYmk.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-BdiInYmk.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-BdiInYmk.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-WfagMkC4.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-akJoBtjs.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-akJoBtjs.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-akJoBtjs.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-D_7x3oZt.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-C0PMHwdm.js`).then(e=>e.go()),__vite__mapDeps([21,5,2,3,0,1,4,7,9])),sh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>r(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>r(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>r(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>r(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:i,jumpToLine:s,onSave:c,workspaceId:l,blame:g}){let v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(i),D=(0,o.useRef)(c);E.current=i,D.current=c;let[O,k]=(0,o.useState)(!1),[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(`0,0`),[P,F]=(0,o.useState)(0);(0,o.useEffect)(()=>{let i=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,O,A,M,P,I,L]=await Promise.all([r(()=>import(`./dist-BMSVWA_A.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-CWlI6qO0.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-BKx3CpQJ.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-BzqUlzAf.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-C2ltv_8u.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-ibsGPa_S.js`).then(e=>e.n),__vite__mapDeps([5,2,3])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),n().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(i||!v.current)return;c=M,l=P,x.current=m.Annotation.define(),S.current=m.Transaction.addToHistory;let R=t.length<=p&&I!==null;o=new m.Compartment;let z=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),O.history(),g.keymap.of([O.indentWithTab,...O.defaultKeymap,...O.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(D.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(x.current&&e.transactions.some(e=>e.annotation(x.current)===!0))&&E.current(e.state.doc.toString()),e.selectionSet&&N(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(L&&(s=new m.Compartment,z.splice(1,0,s.of([])),z.push(L.base)),I)try{z.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),R=!1}if(R&&o&&c&&l)try{z.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),R=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:z}),parent:v.current}),i){a.destroy();return}y.current=a,k(R),j(!0),C.current=L,w.current=s??null,T.current=null,F(e=>e+1);let B=new MutationObserver(()=>{let e=y.current;if(e&&R&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});b.current=B,B.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||j(!0)}})(),()=>{i=!0,b.current?.disconnect(),b.current=null,a?.destroy(),y.current=null,j(!1),v.current&&(v.current.textContent=``)}},[e]),(0,o.useEffect)(()=>{let e=y.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:x.current?x.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=y.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines));e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),e.focus()},[s,A]);let I=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=y.current,n=C.current,r=w.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;T.current!==o&&(T.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,P]);let L=y.current?.state.doc.toString()??t,R=L.length<=m?L:L.slice(0,m),z=h(e),B=d(z);return(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":R,"data-file-content-truncated":L.length>m?`1`:`0`,"data-file-selection":M,"data-file-editor-ready":A?`1`:`0`,"data-file-blame-gutter":I?`1`:void 0,onMouseDown:()=>y.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:v,"aria-label":`编辑 ${e}`}),!A&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`}),A&&!O&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-highlight-status":`plain`,children:`纯文本`}),A&&O&&B&&(0,f.jsx)(`span`,{className:`file-cm-status file-cm-status-lang`,"data-file-highlight-status":z,children:B})]})}export{v as CodeMirrorEditor};
|