@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.
Files changed (59) hide show
  1. package/agents/coder.md +1 -1
  2. package/agents/planner.md +1 -1
  3. package/agents/project-leader.md +2 -2
  4. package/agents/reviewer.md +1 -1
  5. package/agents/super-pi-task/core.ts +164 -7
  6. package/agents/super-pi-task/index.ts +33 -1
  7. package/dist/client/.super-pi-client-sources.json +7 -7
  8. package/dist/client/assets/{CodeMirrorEditor-DUyqaSOB.js → CodeMirrorEditor-Cmx7-z0f.js} +2 -2
  9. package/dist/client/assets/{dist-CPmDYAQT.js → dist-B8CAEuXW.js} +1 -1
  10. package/dist/client/assets/{dist-nbHIDjzw.js → dist-BKx3CpQJ.js} +1 -1
  11. package/dist/client/assets/{dist-CB124C6Z.js → dist-BMSVWA_A.js} +1 -1
  12. package/dist/client/assets/{dist-CU8JEI5K.js → dist-BdiInYmk.js} +1 -1
  13. package/dist/client/assets/{dist-D3HMZhM-.js → dist-Bq7p17eF.js} +1 -1
  14. package/dist/client/assets/{dist-CvLzvDh7.js → dist-BzqUlzAf.js} +1 -1
  15. package/dist/client/assets/{dist-Dkm31GRe.js → dist-C0PMHwdm.js} +1 -1
  16. package/dist/client/assets/{dist-CeU4Svbh.js → dist-C2ltv_8u.js} +1 -1
  17. package/dist/client/assets/{dist-DTd2PCza.js → dist-CDSDxXju.js} +1 -1
  18. package/dist/client/assets/{dist-DLOUy-hB.js → dist-CKZOnuRU.js} +1 -1
  19. package/dist/client/assets/{dist-ka17rnWs.js → dist-CWlI6qO0.js} +1 -1
  20. package/dist/client/assets/{dist-AQ8CYp6b.js → dist-CXDhHY7N.js} +1 -1
  21. package/dist/client/assets/{dist-Dnx8LlEL.js → dist-Cblc22Ag.js} +1 -1
  22. package/dist/client/assets/{dist-Bj218gfa.js → dist-CcuBp_Kn.js} +1 -1
  23. package/dist/client/assets/{dist-CNem2r_T.js → dist-DHFt0Hvo.js} +1 -1
  24. package/dist/client/assets/{dist-NLNoAzKl.js → dist-D_7x3oZt.js} +1 -1
  25. package/dist/client/assets/{dist-D4lWO1EF.js → dist-RHYiODih.js} +1 -1
  26. package/dist/client/assets/{dist-CkTZUfAR.js → dist-V27Fcf8p.js} +1 -1
  27. package/dist/client/assets/{dist-Dlg4MpdE.js → dist-WfagMkC4.js} +1 -1
  28. package/dist/client/assets/{dist-dnyR0Vf6.js → dist-akJoBtjs.js} +1 -1
  29. package/dist/client/assets/{dist-C7PhA7pe.js → dist-frBiV55p.js} +1 -1
  30. package/dist/client/assets/{dist-TX6Uhfee.js → dist-ibsGPa_S.js} +1 -1
  31. package/dist/client/assets/{index-Ui6aXMVV.css → index-BXQjUHV_.css} +1 -1
  32. package/dist/client/assets/{index-BplDWdZp.js → index-Dx7HAZ5j.js} +14 -13
  33. package/dist/client/index.html +2 -2
  34. package/dist/server/agents.d.ts +1 -1
  35. package/dist/server/agents.js +1 -1
  36. package/dist/server/application/conversation-service.d.ts +13 -0
  37. package/dist/server/application/conversation-service.js +21 -0
  38. package/dist/server/application/project-service.d.ts +2 -70
  39. package/dist/server/application/project-service.js +102 -205
  40. package/dist/server/application/run-service.d.ts +39 -3
  41. package/dist/server/application/run-service.js +166 -18
  42. package/dist/server/application/session-orchestrator-service.d.ts +38 -5
  43. package/dist/server/application/session-orchestrator-service.js +167 -5
  44. package/dist/server/command-handler.js +5 -1
  45. package/dist/server/http-server.js +45 -18
  46. package/dist/server/index.js +1 -1
  47. package/dist/server/pi-session.d.ts +3 -2
  48. package/dist/server/runtime.js +9 -6
  49. package/dist/server/session-tree-scope.d.ts +1 -1
  50. package/dist/server/store.d.ts +24 -0
  51. package/dist/server/store.js +229 -4
  52. package/dist/server/task-tool.d.ts +5 -2
  53. package/dist/server/task-tool.js +25 -2
  54. package/dist/server/types.d.ts +43 -13
  55. package/dist/server/upload.d.ts +2 -6
  56. package/dist/server/upload.js +7 -5
  57. package/dist/shared/session-reporting.d.ts +13 -2
  58. package/dist/shared/session-reporting.js +62 -15
  59. 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
- 不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 绕过项目的预算与并发护栏。
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
- 不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 绕过项目的预算与并发护栏。
30
+ 按项目分工与直接上级指派工作,不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 另起绕开项目汇报线的执行流程。
@@ -12,7 +12,7 @@ description: 项目负责人兼秘书,适合项目根 Leader 或分支 Leader
12
12
 
13
13
  ## 在项目里
14
14
 
15
- 当你在项目里被派了活时,先用 `project(action="get", ...)` 确认模式、身份、任务与验收条件,不自行扩大权限或交付范围。
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
- 不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 绕过项目的预算与并发护栏;容量不足等待回传。
24
+ 按项目分工与汇报线委派任务,不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 绕开项目职责与汇报线;派发后等待子会话自动回传,不要轮询。
25
25
  根负责人仅在所有必需任务按模式验收、例外均处理后调用 `complete`;总结与 `evidenceRefs` 必须引用真实产物路径及验证记录。
@@ -22,4 +22,4 @@ tools:
22
22
  `evidenceRefs` 填真实检查的产物路径、行号和已有验证记录;证据不足应说明缺口。
23
23
  遇到阻塞用 `project(action="report", kind="blocked", ...)` 向直接上级说明原因与证据;需决策时用 `escalate`,收件人自动是直接上级。
24
24
  不要用 `question` 直接问 Boss;需要澄清让直接上级逐级代问。
25
- 不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 绕过项目的预算与并发护栏。
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 监督管理。父会话可用 session_spawn 的 watchdogTimeoutSeconds 声明多久没汇报就提醒;子会话用 session_report 主动汇报(in_progress/completed/failed);停整棵子树用 session_stop_subtree。`;
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 a user-triggered project through accountable delegation, evidence and independent review. When the user describes a project in natural language, decompose it yourself into title, objective, deliverables, acceptanceCriteria and budget, then call create with those fields and the top-level tasks you derived. Create also accepts optional constraints, risk, budget with maxTokens/maxConcurrent, and default profiles defaultLeaderProfile/defaultExecutorProfile/defaultReviewerProfile. Create also accepts an optional 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. The tasks array carries that decomposition: each entry needs a title and an objective, and its dependencies name the titles of sibling tasks in the same array. The project starts on action="start" - call it only after you have registered the top-level tasks, because the leader session begins decomposing the work the moment it starts. You are the initiator: you may create the project, register top-level tasks and start it; you may not register child tasks, change the budget or cancel the scope. 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 or event details. Read the latest state with get. The project leader uses add_task (title, objective, deliverables, acceptanceCriteria, dependencies, role=leader/executor, optional executorProfile/reviewerProfile with agentId, cwd, model, thinkingLevel, watchdogTimeoutSeconds), 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. BUDGET: WHICH UNIT IT IS COUNTED IN, AND HOW TO SIZE IT. A project's budget (budget.maxTokens) is counted in BILLING-EQUIVALENT tokens, not raw tokens: equivalent tokens = input + output + cache writes × 1.25 + cache reads × 0.1. Size your own number as: number of tasks × turns per task × equivalent tokens per turn. One task together with its independent review costs about 190,000 equivalent tokens (about 20 turns × about 9,500 equivalent tokens a turn) - that is measured, not guessed. A project of two independently reviewed tasks therefore needs about 380,000, and the server default of 400,000 carries one such project end to end; if you send no budget at all, the server uses 400,000. Do NOT size the budget from the raw token counts you see in a transcript: raw tokens run about 2.5× the equivalent count, so a raw-sized budget is about 2.5× too small. When you are not sure, round UP: a budget that is too small does not slow a project down, it stops it - the project is closed as cancelled with the work already delivered - while a budget that is too large only means the ceiling printed on the panel is higher than the spend. And when you escalate a budget case, the escalation must carry the current effective usage, the cap, the number you believe the cap should be raised to, and the admission that the cap may be one YOU set too low at the beginning - the Boss cannot tell "the Boss did not approve enough" from "the agent under-sized the budget" unless somebody says which one it was. Dispatch is asynchronous and consumes budget; stop polling when capacity is full and wait for child completion reports. Do not use session_spawn, session_dispatch, task or workflow to bypass the project dispatch guard. Never claim success on an error.`;
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, decompose it yourself into title, objective, deliverables, acceptanceCriteria and top-level tasks, then call action="create" with those fields to stand up the project in one call: create registers the project and its top-level tasks, spawns the leader session, and starts it immediately with the full task list in its context (no separate start call or initial project(action="get") is needed before dispatching work; action="start" remains available for a planning project created outside the tool). Create also accepts optional constraints, risk, default profiles 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. The tasks array carries that decomposition: each entry 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 (title, objective, deliverables, acceptanceCriteria, dependencies, role=leader/executor, optional executorProfile/reviewerProfile with agentId, cwd, model, thinkingLevel, watchdogTimeoutSeconds), 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
- return text(`Message successfully dispatched to session ${params.conversationId}. The turn has been enqueued.`);
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: { ok?: boolean; stopped?: boolean; mode?: string; error?: string };
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
  /**
@@ -312,7 +316,6 @@ const extension = (pi: ExtensionApi): void => {
312
316
  deliverables: Type.Optional(Type.Array(Type.String())), acceptanceCriteria: Type.Optional(Type.Array(Type.String())), constraints: Type.Optional(Type.Array(Type.String())), dependencies: Type.Optional(Type.Array(Type.String())),
313
317
  risk: Type.Optional(Type.String()),
314
318
  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
319
  priority: Type.Optional(Type.String()), status: Type.Optional(Type.String()), blockedReason: Type.Optional(Type.String()),
317
320
  tasks: Type.Optional(Type.Array(Type.Object({
318
321
  title: Type.String(), objective: Type.String(),
@@ -558,6 +561,12 @@ const extension = (pi: ExtensionApi): void => {
558
561
  wait: Type.Optional(Type.Boolean({
559
562
  description: "Whether to await turn completion before returning (default: false, asynchronous).",
560
563
  })),
564
+ mode: Type.Optional(Type.Union([
565
+ Type.Literal("queue", { description: "Wait for the active turn and earlier queued messages to finish (default)" }),
566
+ Type.Literal("steer", { description: "Deliver as steering guidance at the next tool/turn boundary without killing in-flight tools" }),
567
+ ], {
568
+ description: "Delivery mode when the sibling session is busy: 'queue' (default) or 'steer' (next turn boundary).",
569
+ })),
561
570
  });
562
571
 
563
572
  const SessionStopParameters = Type.Object({
@@ -574,6 +583,9 @@ const extension = (pi: ExtensionApi): void => {
574
583
  messageId: Type.Optional(Type.String({
575
584
  description: "Optional specific queued message ID to cancel or interrupt.",
576
585
  })),
586
+ messageIds: Type.Optional(Type.Array(Type.String(), {
587
+ description: "Optional list of queued message IDs to selectively withdraw while keeping other queued/steered messages and the running turn.",
588
+ })),
577
589
  });
578
590
 
579
591
  /**
@@ -600,6 +612,16 @@ const extension = (pi: ExtensionApi): void => {
600
612
  })),
601
613
  });
602
614
 
615
+ /** The `session_remove` parameter schema. */
616
+ const SessionRemoveParameters = Type.Object({
617
+ conversationId: Type.String({
618
+ description: "The conversation ID of your direct child session to permanently destroy (along with any descendant sessions under it).",
619
+ }),
620
+ reason: Type.Optional(Type.String({
621
+ description: "Optional reason for destroying this child session (confirmed in the tool result).",
622
+ })),
623
+ });
624
+
603
625
  /**
604
626
  * The `session_report` parameter schema.
605
627
  *
@@ -697,6 +719,16 @@ const extension = (pi: ExtensionApi): void => {
697
719
  execute: async (_toolCallId, params, signal) =>
698
720
  await executeSessionStopSubtree(params as SessionStopSubtreeParams, orchestratorConfig, { signal: signal ?? undefined }),
699
721
  });
722
+
723
+ pi.registerTool({
724
+ name: SESSION_REMOVE_TOOL_NAME,
725
+ label: "Remove Child Session",
726
+ description: SESSION_REMOVE_DESCRIPTION,
727
+ promptSnippet: "remove a direct child session from the active working group (archive without deleting history)",
728
+ parameters: SessionRemoveParameters,
729
+ execute: async (_toolCallId, params, signal) =>
730
+ await executeSessionRemove(params as SessionRemoveParams, orchestratorConfig, { signal: signal ?? undefined }),
731
+ });
700
732
  }
701
733
  };
702
734
 
@@ -1,7 +1,7 @@
1
1
  {
2
- "hash": "08c9d92d22e1aee0afbe291b874486c52eca1673f76988c8fe98ca89eee1e1b6",
2
+ "hash": "c12077bfd29fc123bf28d42e71483e56c7f496bdcc23e5cff5a98ebfe9d7a682",
3
3
  "files": {
4
- "src/client/App.tsx": "4ae07fa88354112606f82f4c1f1f6a8d208b2caf3d0922ceec67b482fdd68e5a",
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": "7d9268d971715e73710da36974b7f2f30ff78dd7a363c5f74a51793e2a9b0e77",
16
- "src/client/ProjectExecutionTools.tsx": "a4f59b29ff1560a186e48bfea9de8d5c0fba2ee76db3dac9d936a113c74dcc53",
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": "a12f059f76a288371d72aaead8ded9c2c459685663583dc38d89083c4ebe447b",
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": "a39f30eafc1afa7b40dac4d8fe1f639f36234782877036722f66978e9b69d8e6",
40
+ "src/client/types.ts": "ef0586e206d0f229ed0e81e72397e1ddfd82c00ae7133d06d20892605e6f1ff4",
41
41
  "src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5"
42
42
  },
43
- "recordedAt": "2026-11-10T16:30:38.561Z"
43
+ "recordedAt": "2026-11-11T11:59:17.007Z"
44
44
  }
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-CeU4Svbh.js","assets/dist-CB124C6Z.js","assets/index-BplDWdZp.js","assets/index-Ui6aXMVV.css","assets/dist-ka17rnWs.js","assets/dist-TX6Uhfee.js","assets/dist-D4lWO1EF.js","assets/dist-CPmDYAQT.js","assets/dist-Dnx8LlEL.js","assets/dist-CkTZUfAR.js","assets/dist-CNem2r_T.js","assets/dist-DLOUy-hB.js","assets/dist-AQ8CYp6b.js","assets/dist-CU8JEI5K.js","assets/dist-Dlg4MpdE.js","assets/dist-Bj218gfa.js","assets/dist-C7PhA7pe.js","assets/dist-DTd2PCza.js","assets/dist-D3HMZhM-.js","assets/dist-dnyR0Vf6.js","assets/dist-NLNoAzKl.js","assets/dist-Dkm31GRe.js","assets/dist-nbHIDjzw.js","assets/dist-CvLzvDh7.js"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,r,s as i,t as a}from"./index-BplDWdZp.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-CeU4Svbh.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-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-D4lWO1EF.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-Dnx8LlEL.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-Dnx8LlEL.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-Dnx8LlEL.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-Dnx8LlEL.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-Dnx8LlEL.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-Dnx8LlEL.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-Dnx8LlEL.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-Dnx8LlEL.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-CNem2r_T.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-CNem2r_T.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-DLOUy-hB.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-AQ8CYp6b.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-Bj218gfa.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-C7PhA7pe.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-C7PhA7pe.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-DTd2PCza.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-D3HMZhM-.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-D3HMZhM-.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-D3HMZhM-.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-CU8JEI5K.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-CU8JEI5K.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-CU8JEI5K.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-CU8JEI5K.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-Dlg4MpdE.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-dnyR0Vf6.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-dnyR0Vf6.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-dnyR0Vf6.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-NLNoAzKl.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-Dkm31GRe.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-CB124C6Z.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-ka17rnWs.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-nbHIDjzw.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-CvLzvDh7.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-CeU4Svbh.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-TX6Uhfee.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};