aicodeman 1.6.1 → 1.7.0
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/README.md +9 -3
- package/README.zh-CN.md +9 -3
- package/dist/utils/regex-patterns.d.ts.map +1 -1
- package/dist/utils/regex-patterns.js +1 -1
- package/dist/utils/regex-patterns.js.map +1 -1
- package/dist/web/public/admin-ui.js.gz +0 -0
- package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
- package/dist/web/public/{app.9367fd20.js → app.2e95c82d.js} +2 -2
- package/dist/web/public/app.2e95c82d.js.br +0 -0
- package/dist/web/public/app.2e95c82d.js.gz +0 -0
- package/dist/web/public/constants.21a0a83e.js.gz +0 -0
- package/dist/web/public/cron-ui.js.gz +0 -0
- package/dist/web/public/i18n.4dcf1b87.js +1 -0
- package/dist/web/public/i18n.4dcf1b87.js.br +0 -0
- package/dist/web/public/i18n.4dcf1b87.js.gz +0 -0
- package/dist/web/public/image-input.ee16ad88.js.gz +0 -0
- package/dist/web/public/index.html +26 -7
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/input-cjk.63794d0b.js.gz +0 -0
- package/dist/web/public/keyboard-accessory.3f91acef.js.gz +0 -0
- package/dist/web/public/{mobile-handlers.b5a667ef.js → mobile-handlers.bc2b8c1d.js} +29 -0
- package/dist/web/public/mobile-handlers.bc2b8c1d.js.br +0 -0
- package/dist/web/public/mobile-handlers.bc2b8c1d.js.gz +0 -0
- package/dist/web/public/mobile.6a53092b.css.gz +0 -0
- package/dist/web/public/{notification-manager.ca9dc40d.js → notification-manager.fca811fd.js} +4 -2
- package/dist/web/public/notification-manager.fca811fd.js.br +0 -0
- package/dist/web/public/notification-manager.fca811fd.js.gz +0 -0
- package/dist/web/public/orchestrator-panel.js.gz +0 -0
- package/dist/web/public/panels-ui.58582d4c.js.gz +0 -0
- package/dist/web/public/ralph-panel.6de2d0f8.js.gz +0 -0
- package/dist/web/public/ralph-wizard.13a1831e.js.gz +0 -0
- package/dist/web/public/respawn-ui.2d249da9.js.gz +0 -0
- package/dist/web/public/sanitize-html.bc7078d6.js.gz +0 -0
- package/dist/web/public/session-ui.713c8836.js +68 -0
- package/dist/web/public/session-ui.713c8836.js.br +0 -0
- package/dist/web/public/session-ui.713c8836.js.gz +0 -0
- package/dist/web/public/settings-ui.0259fbe8.js +67 -0
- package/dist/web/public/settings-ui.0259fbe8.js.br +0 -0
- package/dist/web/public/settings-ui.0259fbe8.js.gz +0 -0
- package/dist/web/public/styles.3d6b4c9c.css +1 -0
- package/dist/web/public/styles.3d6b4c9c.css.br +0 -0
- package/dist/web/public/styles.3d6b4c9c.css.gz +0 -0
- package/dist/web/public/subagent-windows.69b60c35.js.gz +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/terminal-ui.9ea677e9.js.gz +0 -0
- package/dist/web/public/ultracode-panel.js.gz +0 -0
- package/dist/web/public/ultracode-windows.js.gz +0 -0
- package/dist/web/public/upload.html.gz +0 -0
- package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
- package/dist/web/public/vendor/marked.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.137ad9f0.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/public/voice-input.085e9e73.js.gz +0 -0
- package/dist/web/schemas.d.ts +1 -0
- package/dist/web/schemas.d.ts.map +1 -1
- package/dist/web/schemas.js +12 -0
- package/dist/web/schemas.js.map +1 -1
- package/dist/web/server.d.ts +1 -1
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +11 -1
- package/dist/web/server.js.map +1 -1
- package/dist/web/sse-events.d.ts +7 -3
- package/dist/web/sse-events.d.ts.map +1 -1
- package/dist/web/sse-events.js +7 -3
- package/dist/web/sse-events.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/public/app.9367fd20.js.br +0 -0
- package/dist/web/public/app.9367fd20.js.gz +0 -0
- package/dist/web/public/mobile-handlers.b5a667ef.js.br +0 -0
- package/dist/web/public/mobile-handlers.b5a667ef.js.gz +0 -0
- package/dist/web/public/notification-manager.ca9dc40d.js.br +0 -0
- package/dist/web/public/notification-manager.ca9dc40d.js.gz +0 -0
- package/dist/web/public/session-ui.0cf86dd4.js +0 -68
- package/dist/web/public/session-ui.0cf86dd4.js.br +0 -0
- package/dist/web/public/session-ui.0cf86dd4.js.gz +0 -0
- package/dist/web/public/settings-ui.bc5f4792.js +0 -67
- package/dist/web/public/settings-ui.bc5f4792.js.br +0 -0
- package/dist/web/public/settings-ui.bc5f4792.js.gz +0 -0
- package/dist/web/public/styles.e9dc275f.css +0 -1
- package/dist/web/public/styles.e9dc275f.css.br +0 -0
- package/dist/web/public/styles.e9dc275f.css.gz +0 -0
package/README.md
CHANGED
|
@@ -32,9 +32,13 @@
|
|
|
32
32
|
curl -fsSL https://raw.githubusercontent.com/Ark0N/Codeman/master/install.sh | bash
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
This installs Node.js and tmux if missing, clones Codeman to `~/.codeman/app`, and builds it.
|
|
35
|
+
This installs Node.js and tmux if missing, clones Codeman to `~/.codeman/app`, and builds it. A few things worth knowing:
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
- **It asks first.** Every system change (package installs, AI CLI download) is prompted, and a menu at the end lets you choose: run Codeman in this terminal, install it as a background service (systemd/launchd, auto-start on boot), or don't start yet. Nothing runs in the background unless you pick it.
|
|
38
|
+
- **Re-run to update.** The same one-liner updates a finished install in place: local changes in `~/.codeman/app` are stashed (never discarded), and a running service is restarted and verified. If a first install was interrupted, re-running resumes the full setup instead. `install.sh update` and `install.sh uninstall` also exist.
|
|
39
|
+
- **CI / headless:** without a terminal attached, steps that would change your system abort with instructions instead of running silently. Set `CODEMAN_NONINTERACTIVE=1` to approve them for automation.
|
|
40
|
+
|
|
41
|
+
You'll need at least one AI coding CLI installed — [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [OpenCode](https://opencode.ai), [Codex](https://developers.openai.com/codex/cli), or [Gemini CLI](https://github.com/google-gemini/gemini-cli) (any combination works). The installer detects whichever of the four is present; if none is found, it offers to install Claude Code or OpenCode, or you can skip and install one yourself later. After install:
|
|
38
42
|
|
|
39
43
|
```bash
|
|
40
44
|
codeman web
|
|
@@ -53,6 +57,8 @@ Details in [Multi-User Mode](#multi-user-mode-opt-in) below.
|
|
|
53
57
|
<details>
|
|
54
58
|
<summary><strong>Run as a background service</strong></summary>
|
|
55
59
|
|
|
60
|
+
The installer's final menu sets this up for you (option 2) and verifies the service actually comes up before claiming success. To configure it manually instead:
|
|
61
|
+
|
|
56
62
|
**Linux (systemd):**
|
|
57
63
|
|
|
58
64
|
```bash
|
|
@@ -180,7 +186,7 @@ Hit start — Codeman spawns the CLI via a real PTY and streams it to your brows
|
|
|
180
186
|
|
|
181
187
|
### 7. Operate & maintain
|
|
182
188
|
|
|
183
|
-
- **App Settings** — model, effort, permission startup mode, theme/skin, notifications, display toggles, per-CLI options.
|
|
189
|
+
- **App Settings** — model, effort, permission startup mode, theme/skin, notifications, display toggles, per-CLI options, a synced custom display name, and per-device English/Simplified Chinese UI language.
|
|
184
190
|
- **Self-update** — git-clone installs update in place from **Settings → Updates**.
|
|
185
191
|
- **Deploy your own changes** — see [Development](#development).
|
|
186
192
|
|
package/README.zh-CN.md
CHANGED
|
@@ -34,9 +34,13 @@
|
|
|
34
34
|
curl -fsSL https://raw.githubusercontent.com/Ark0N/Codeman/master/install.sh | bash
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
该脚本会在缺失时自动安装 Node.js 和 tmux,把 Codeman 克隆到 `~/.codeman/app`
|
|
37
|
+
该脚本会在缺失时自动安装 Node.js 和 tmux,把 Codeman 克隆到 `~/.codeman/app` 并完成构建。几点须知:
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
- **先询问,后改动。** 所有系统级改动(安装软件包、下载 AI CLI)都会先征求确认;结束时的菜单可选择:直接在本终端运行、安装为后台服务(systemd/launchd,开机自启),或暂不启动。不选就不会有任何后台进程。
|
|
40
|
+
- **重跑即更新。** 再次运行同一条命令即可原地更新已完成的安装:`~/.codeman/app` 中的本地改动会被 stash(绝不丢弃),运行中的服务会自动重启并校验。若首次安装中途失败,重跑会继续完成完整的安装流程。也可以使用 `install.sh update` 与 `install.sh uninstall`。
|
|
41
|
+
- **CI / 无终端环境:** 没有终端时,涉及系统改动的步骤会带着说明中止,而不是静默执行;在自动化场景设置 `CODEMAN_NONINTERACTIVE=1` 即可批准这些步骤。
|
|
42
|
+
|
|
43
|
+
你至少需要安装一个 AI 编程 CLI —— [Claude Code](https://docs.anthropic.com/en/docs/claude-code)、[OpenCode](https://opencode.ai)、[Codex](https://developers.openai.com/codex/cli) 或 [Gemini CLI](https://github.com/google-gemini/gemini-cli)(任意组合均可)。安装器会自动检测这四个中已安装的任意一个;若一个都没有,会提供安装 Claude Code 或 OpenCode 的选项,也可以选择跳过、稍后自行安装。安装完成后:
|
|
40
44
|
|
|
41
45
|
```bash
|
|
42
46
|
codeman web
|
|
@@ -55,6 +59,8 @@ codeman web --multiuser # 命名登录 + 按用户隔离的案例
|
|
|
55
59
|
<details>
|
|
56
60
|
<summary><strong>作为后台服务运行</strong></summary>
|
|
57
61
|
|
|
62
|
+
安装器结尾的菜单(选项 2)可以帮你完成这一步,并在宣告成功前校验服务确实已启动。如需手动配置:
|
|
63
|
+
|
|
58
64
|
**Linux(systemd):**
|
|
59
65
|
|
|
60
66
|
```bash
|
|
@@ -182,7 +188,7 @@ codeman web -H 0.0.0.0 # 绑定局域网 —— 必须设置 CODEMAN_
|
|
|
182
188
|
|
|
183
189
|
### 7. 运维与维护
|
|
184
190
|
|
|
185
|
-
- **App Settings** —— 模型、effort、权限启动模式、主题/皮肤、通知、显示开关、各 CLI
|
|
191
|
+
- **App Settings** —— 模型、effort、权限启动模式、主题/皮肤、通知、显示开关、各 CLI 的专属选项,以及跨设备同步的自定义显示名称和按设备保存的英文/简体中文界面语言。
|
|
186
192
|
- **自更新** —— git-clone 安装可在 **Settings → Updates** 中原地更新。
|
|
187
193
|
- **部署你自己的改动** —— 见[开发](#开发)。
|
|
188
194
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex-patterns.d.ts","sourceRoot":"","sources":["../../src/utils/regex-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AAEH,eAAO,MAAM,wBAAwB,QAAmE,CAAC;AAEzG;;;;;;GAMG;AAEH,eAAO,MAAM,0BAA0B,QAA2B,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,QAAyC,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;GAGG;AACH;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAe,CAAC;AAE5C,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"regex-patterns.d.ts","sourceRoot":"","sources":["../../src/utils/regex-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AAEH,eAAO,MAAM,wBAAwB,QAAmE,CAAC;AAEzG;;;;;;GAMG;AAEH,eAAO,MAAM,0BAA0B,QAA2B,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,QAAyC,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;GAGG;AACH;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAe,CAAC;AAE5C,eAAO,MAAM,iBAAiB,QAA4B,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,IAAI,CAM3G"}
|
|
@@ -54,7 +54,7 @@ export function stripAnsi(text) {
|
|
|
54
54
|
* Used on the hot path (every PTY chunk) — pre-compiled for performance.
|
|
55
55
|
*/
|
|
56
56
|
export const SPINNER_PATTERN = /[⠋⠙⠹⠸⠼⠴⠦⠧]/;
|
|
57
|
-
export const SAFE_PATH_PATTERN = /^[
|
|
57
|
+
export const SAFE_PATH_PATTERN = /^[\p{L}\p{N}_/\-. ~]+$/u;
|
|
58
58
|
/**
|
|
59
59
|
* Execute a global regex pattern against data, calling the callback for each match.
|
|
60
60
|
* Automatically resets lastIndex before execution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex-patterns.js","sourceRoot":"","sources":["../../src/utils/regex-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AACH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,gEAAgE,CAAC;AAEzG;;;;;;GAMG;AACH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,sCAAsC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"regex-patterns.js","sourceRoot":"","sources":["../../src/utils/regex-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AACH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,gEAAgE,CAAC;AAEzG;;;;;;GAMG;AACH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,sCAAsC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAE3D;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,IAAY,EAAE,QAA0C;IACnG,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;IACtB,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7C,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
Binary file
|
|
Binary file
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
`),id:_crashDiag._pageId}))}catch{}}if(setInterval(()=>{try{localStorage.setItem("codeman-crash-heartbeat",String(Date.now()))}catch{}_crashDiagBeacon()},2e3),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&_crashDiagBeacon()}),window.addEventListener("error",d=>{_crashDiag.log(`ERROR: ${d.message} at ${d.filename}:${d.lineno}`),console.error("[CRASH-DIAG] Uncaught error:",d.message,`
|
|
5
5
|
File:`,d.filename,":",d.lineno,":",d.colno,`
|
|
6
6
|
Stack:`,d.error?.stack)}),window.addEventListener("unhandledrejection",d=>{_crashDiag.log(`UNHANDLED: ${d.reason?.message||d.reason}`),console.error("[CRASH-DIAG] Unhandled promise rejection:",d.reason?.message||d.reason,`
|
|
7
|
-
Stack:`,d.reason?.stack)}),typeof PerformanceObserver<"u")try{new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration>200&&(_crashDiag.log(`LONG_TASK: ${t.duration.toFixed(0)}ms`),console.warn(`[CRASH-DIAG] Long task: ${t.duration.toFixed(0)}ms (type: ${t.entryType}, name: ${t.name})`))}).observe({type:"longtask",buffered:!0})}catch{}const _origGetContext=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(d,...e){const t=_origGetContext.call(this,d,...e);return(d==="webgl2"||d==="webgl")&&(this.addEventListener("webglcontextlost",s=>{_crashDiag.log(`WEBGL_LOST: ${this.width}x${this.height}`),console.error("[CRASH-DIAG] WebGL context LOST on canvas",this.width,"x",this.height,"\u2014 prevented:",s.defaultPrevented)}),this.addEventListener("webglcontextrestored",()=>{_crashDiag.log("WEBGL_RESTORED"),console.warn("[CRASH-DIAG] WebGL context restored")})),t};const _SSE_HANDLER_MAP=[[SSE_EVENTS.INIT,"_onInit"],[SSE_EVENTS.SESSION_CREATED,"_onSessionCreated"],[SSE_EVENTS.SESSION_UPDATED,"_onSessionUpdated"],[SSE_EVENTS.SESSION_DELETED,"_onSessionDeleted"],[SSE_EVENTS.SESSION_TERMINAL,"_onSSETerminal"],[SSE_EVENTS.SESSION_NEEDS_REFRESH,"_onSSENeedsRefresh"],[SSE_EVENTS.SESSION_CLEAR_TERMINAL,"_onSSEClearTerminal"],[SSE_EVENTS.SESSION_COMPLETION,"_onSessionCompletion"],[SSE_EVENTS.SESSION_ERROR,"_onSessionError"],[SSE_EVENTS.SESSION_EXIT,"_onSessionExit"],[SSE_EVENTS.SESSION_IDLE,"_onSessionIdle"],[SSE_EVENTS.SESSION_WORKING,"_onSessionWorking"],[SSE_EVENTS.SESSION_AUTO_CLEAR,"_onSessionAutoClear"],[SSE_EVENTS.SESSION_LIMIT_PAUSE_SCHEDULED,"_onSessionLimitPauseScheduled"],[SSE_EVENTS.SESSION_LIMIT_RESUME,"_onSessionLimitResume"],[SSE_EVENTS.SESSION_LIMIT_RESUME_CANCELLED,"_onSessionLimitResumeCancelled"],[SSE_EVENTS.SESSION_RESPAWN_BREAKER_TRIPPED,"_onSessionRespawnBreakerTripped"],[SSE_EVENTS.SESSION_CLI_INFO,"_onSessionCliInfo"],[SSE_EVENTS.SESSION_STATUS_TELEMETRY,"_onSessionStatusTelemetry"],[SSE_EVENTS.SCHEDULED_CREATED,"_onScheduledCreated"],[SSE_EVENTS.SCHEDULED_UPDATED,"_onScheduledUpdated"],[SSE_EVENTS.SCHEDULED_COMPLETED,"_onScheduledCompleted"],[SSE_EVENTS.SCHEDULED_STOPPED,"_onScheduledStopped"],[SSE_EVENTS.CRON_JOBS_CHANGED,"_onCronJobsChanged"],[SSE_EVENTS.CRON_JOB_DELETED,"_onCronJobsChanged"],[SSE_EVENTS.CRON_RUN_CREATED,"_onCronRunChanged"],[SSE_EVENTS.CRON_RUN_UPDATED,"_onCronRunChanged"],[SSE_EVENTS.RESPAWN_STARTED,"_onRespawnStarted"],[SSE_EVENTS.RESPAWN_STOPPED,"_onRespawnStopped"],[SSE_EVENTS.RESPAWN_STATE_CHANGED,"_onRespawnStateChanged"],[SSE_EVENTS.RESPAWN_CYCLE_STARTED,"_onRespawnCycleStarted"],[SSE_EVENTS.RESPAWN_BLOCKED,"_onRespawnBlocked"],[SSE_EVENTS.RESPAWN_AUTO_ACCEPT_SENT,"_onRespawnAutoAcceptSent"],[SSE_EVENTS.RESPAWN_DETECTION_UPDATE,"_onRespawnDetectionUpdate"],[SSE_EVENTS.RESPAWN_TIMER_STARTED,"_onRespawnTimerStarted"],[SSE_EVENTS.RESPAWN_TIMER_CANCELLED,"_onRespawnTimerCancelled"],[SSE_EVENTS.RESPAWN_TIMER_COMPLETED,"_onRespawnTimerCompleted"],[SSE_EVENTS.RESPAWN_ERROR,"_onRespawnError"],[SSE_EVENTS.RESPAWN_ACTION_LOG,"_onRespawnActionLog"],[SSE_EVENTS.TASK_CREATED,"_onTaskCreated"],[SSE_EVENTS.TASK_COMPLETED,"_onTaskCompleted"],[SSE_EVENTS.TASK_FAILED,"_onTaskFailed"],[SSE_EVENTS.TASK_UPDATED,"_onTaskUpdated"],[SSE_EVENTS.MUX_CREATED,"_onMuxCreated"],[SSE_EVENTS.MUX_KILLED,"_onMuxKilled"],[SSE_EVENTS.MUX_DIED,"_onMuxDied"],[SSE_EVENTS.MUX_STATS_UPDATED,"_onMuxStatsUpdated"],[SSE_EVENTS.REMOTE_SESSION_RECONNECTED,"_onRemoteSessionReconnected"],[SSE_EVENTS.REMOTE_RECONNECT_EXHAUSTED,"_onRemoteReconnectExhausted"],[SSE_EVENTS.SESSION_RALPH_LOOP_UPDATE,"_onRalphLoopUpdate"],[SSE_EVENTS.SESSION_RALPH_TODO_UPDATE,"_onRalphTodoUpdate"],[SSE_EVENTS.SESSION_RALPH_COMPLETION_DETECTED,"_onRalphCompletionDetected"],[SSE_EVENTS.SESSION_RALPH_STATUS_UPDATE,"_onRalphStatusUpdate"],[SSE_EVENTS.SESSION_CIRCUIT_BREAKER_UPDATE,"_onCircuitBreakerUpdate"],[SSE_EVENTS.SESSION_EXIT_GATE_MET,"_onExitGateMet"],[SSE_EVENTS.SESSION_BASH_TOOL_START,"_onBashToolStart"],[SSE_EVENTS.SESSION_BASH_TOOL_END,"_onBashToolEnd"],[SSE_EVENTS.SESSION_BASH_TOOLS_UPDATE,"_onBashToolsUpdate"],[SSE_EVENTS.HOOK_IDLE_PROMPT,"_onHookIdlePrompt"],[SSE_EVENTS.HOOK_PERMISSION_PROMPT,"_onHookPermissionPrompt"],[SSE_EVENTS.HOOK_ELICITATION_DIALOG,"_onHookElicitationDialog"],[SSE_EVENTS.HOOK_STOP,"_onHookStop"],[SSE_EVENTS.HOOK_TEAMMATE_IDLE,"_onHookTeammateIdle"],[SSE_EVENTS.HOOK_TASK_COMPLETED,"_onHookTaskCompleted"],[SSE_EVENTS.SUBAGENT_DISCOVERED,"_onSubagentDiscovered"],[SSE_EVENTS.SUBAGENT_UPDATED,"_onSubagentUpdated"],[SSE_EVENTS.SUBAGENT_TOOL_CALL,"_onSubagentToolCall"],[SSE_EVENTS.SUBAGENT_PROGRESS,"_onSubagentProgress"],[SSE_EVENTS.SUBAGENT_MESSAGE,"_onSubagentMessage"],[SSE_EVENTS.SUBAGENT_TOOL_RESULT,"_onSubagentToolResult"],[SSE_EVENTS.SUBAGENT_COMPLETED,"_onSubagentCompleted"],[SSE_EVENTS.WORKFLOW_RUN_DISCOVERED,"_onWorkflowRunDiscovered"],[SSE_EVENTS.WORKFLOW_RUN_UPDATED,"_onWorkflowRunUpdated"],[SSE_EVENTS.WORKFLOW_RUN_REMOVED,"_onWorkflowRunRemoved"],[SSE_EVENTS.IMAGE_DETECTED,"_onImageDetected"],[SSE_EVENTS.ATTACHMENT_DETECTED,"_onAttachmentDetected"],[SSE_EVENTS.TUNNEL_STARTED,"_onTunnelStarted"],[SSE_EVENTS.TUNNEL_STOPPED,"_onTunnelStopped"],[SSE_EVENTS.TUNNEL_PROGRESS,"_onTunnelProgress"],[SSE_EVENTS.TUNNEL_ERROR,"_onTunnelError"],[SSE_EVENTS.TUNNEL_QR_ROTATED,"_onTunnelQrRotated"],[SSE_EVENTS.TUNNEL_QR_REGENERATED,"_onTunnelQrRegenerated"],[SSE_EVENTS.TUNNEL_QR_AUTH_USED,"_onTunnelQrAuthUsed"],[SSE_EVENTS.PLAN_SUBAGENT,"_onPlanSubagent"],[SSE_EVENTS.PLAN_PROGRESS,"_onPlanProgress"],[SSE_EVENTS.PLAN_STARTED,"_onPlanStarted"],[SSE_EVENTS.PLAN_CANCELLED,"_onPlanCancelled"],[SSE_EVENTS.PLAN_COMPLETED,"_onPlanCompleted"],[SSE_EVENTS.ORCHESTRATOR_STATE_CHANGED,"_onOrchestratorStateChanged"],[SSE_EVENTS.ORCHESTRATOR_PLAN_PROGRESS,"_onOrchestratorPlanProgress"],[SSE_EVENTS.ORCHESTRATOR_PLAN_READY,"_onOrchestratorPlanReady"],[SSE_EVENTS.ORCHESTRATOR_PHASE_STARTED,"_onOrchestratorPhaseStarted"],[SSE_EVENTS.ORCHESTRATOR_PHASE_COMPLETED,"_onOrchestratorPhaseCompleted"],[SSE_EVENTS.ORCHESTRATOR_PHASE_FAILED,"_onOrchestratorPhaseFailed"],[SSE_EVENTS.ORCHESTRATOR_VERIFICATION,"_onOrchestratorVerification"],[SSE_EVENTS.ORCHESTRATOR_TASK_ASSIGNED,"_onOrchestratorTaskAssigned"],[SSE_EVENTS.ORCHESTRATOR_TASK_COMPLETED,"_onOrchestratorTaskCompleted"],[SSE_EVENTS.ORCHESTRATOR_TASK_FAILED,"_onOrchestratorTaskFailed"],[SSE_EVENTS.ORCHESTRATOR_COMPLETED,"_onOrchestratorCompleted"],[SSE_EVENTS.ORCHESTRATOR_ERROR,"_onOrchestratorError"],[SSE_EVENTS.CLIPBOARD_WRITE,"_onClipboardWrite"],[SSE_EVENTS.SESSION_ORDER_CHANGED,"_onSessionOrderChanged"]];function parseSessionPrefix(d){if(!d)return null;const e=d.match(/^(w\d+-[a-zA-Z0-9_-]+|s\d+-[a-zA-Z0-9_-]+)/);if(!e)return null;const t=e[1],s=d.slice(t.length);return s===""?{prefix:t,suffix:""}:s.startsWith(": ")?{prefix:t,suffix:s.slice(2)}:null}const DEFAULT_SHORTCUTS=[{id:"show-shortcuts",group:"Panels",label:"Show Shortcuts",bindings:[{modifiers:["ctrl"],key:"?",code:"Slash"},{modifiers:["ctrl","shift"],key:"?"},{modifiers:["alt"],key:"?",code:"Slash"}],action:"showShortcutOverlay"},{id:"close-session",group:"Session",label:"Close Session",bindings:[{modifiers:["ctrl"],key:"w"}],action:"killActiveSession"},{id:"next-session",group:"Session",label:"Next Session",bindings:[{modifiers:["ctrl"],key:"Tab"}],action:"nextSession"},{id:"clear-terminal",group:"Terminal",label:"Clear Terminal",bindings:[{modifiers:["ctrl"],key:"l"}],action:"clearTerminal"},{id:"increase-font",group:"Terminal",label:"Increase Font",bindings:[{modifiers:["ctrl"],key:"=",code:"Equal"},{modifiers:["ctrl"],key:"+",code:"Equal"}],action:"increaseFontSize"},{id:"decrease-font",group:"Terminal",label:"Decrease Font",bindings:[{modifiers:["ctrl"],key:"-",code:"Minus"}],action:"decreaseFontSize"},{id:"voice-input",group:"Terminal",label:"Voice Input",bindings:[{modifiers:["ctrl","shift"],key:"V"}],action:"toggleVoiceInput"},{id:"restore-terminal-size",group:"Terminal",label:"Restore Terminal Size",bindings:[{modifiers:["ctrl","shift"],key:"R"}],action:"restoreTerminalSize"},{id:"move-tab-left",group:"Tabs",label:"Move Active Tab Left",bindings:[{modifiers:["ctrl","shift"],key:"{",code:"BracketLeft"}],action:"moveActiveTabLeft"},{id:"move-tab-right",group:"Tabs",label:"Move Active Tab Right",bindings:[{modifiers:["ctrl","shift"],key:"}",code:"BracketRight"}],action:"moveActiveTabRight"},{id:"command-palette",group:"Session",label:"Find Open Session",bindings:[{modifiers:["ctrl"],key:"k",code:"KeyK"},{modifiers:["meta"],key:"k",code:"KeyK"},{modifiers:["alt"],key:"k",code:"KeyK"}],action:"openCommandPalette"},{id:"previous-next-session",group:"Session",label:"Previous / Next Session",displayBindings:["Alt/Option+[","Alt/Option+]"]},{id:"switch-tab-n",group:"Session",label:"Switch to Tab N",displayBindings:["Alt/Option+1-9"]},{id:"focus-tabs",group:"Tabs",label:"Focus Tabs",displayBindings:["ArrowLeft","ArrowRight","Home","End"]},{id:"activate-focused-tab",group:"Tabs",label:"Activate Focused Tab",displayBindings:["Enter","Space"]},{id:"insert-newline",group:"Terminal",label:"Insert Newline",displayBindings:["Shift+Enter","Ctrl+Enter"]},{id:"close-panels",group:"Panels",label:"Close Panels",displayBindings:["Escape"]}];class CodemanApp{constructor(){this.sessions=new Map,this._shortIdCache=new Map,this.sessionOrder=[],this.draggedTabId=null,this.cases=[],this.currentRun=null,this.totalTokens=0,this.globalStats=null,this.eventSource=null,this._clientId=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"c-"+Math.random().toString(36).slice(2)+Date.now().toString(36),this._wsTabNonce=this._clientId,this.terminal=null,this.fitAddon=null,this.activeSessionId=null,this.soloSessionId=this._detectSoloSessionId(),this.isSoloWindow=!!this.soloSessionId,this.detachedSessions=new Set,this.detachedWindows=new Map,this._detachWatchTimers=new Map,this.windowChannel=null,this._redockGrace=new Map,this._detachPingPending=null,this._detachLivenessTimer=null,this._detachOrphanStrikes=new Map,this._initGeneration=0,this._initFallbackTimer=null,this._selectGeneration=0,this._initialFullBufferLoad=!0,this.terminalLoadStates=new Map,this.respawnStatus={},this.respawnTimers={},this.respawnCountdownTimers={},this.respawnActionLogs={},this.timerCountdownInterval=null,this.terminalBuffers=new Map,this.editingSessionId=null,this.pendingCloseSessionId=null,this.muxSessions=[],this.ralphStates=new Map,this.subagents=new Map,this.subagentActivity=new Map,this.subagentToolResults=new Map,this.activeSubagentId=null,this.subagentPanelVisible=!1,this.workflowRuns=new Map,this.workflowRunDetails=new Map,this.activeWorkflowRunId=null,this.activeWorkflowPhaseIndex=null,this.ultracodeWindows=new Map,this.ultracodeWindowsClosed=new Set,this.ultracodeWindowCloseTimers=new Map,this.ultracodeWindowZIndex=1e3,this.subagentWindows=new Map,this.subagentWindowZIndex=ZINDEX_SUBAGENT_BASE,this.minimizedSubagents=new Map,this._subagentHideTimeout=null,this.subagentParentMap=new Map,this.teams=new Map,this.teamTasks=new Map,this.teammateMap=new Map,this.teammatePanesByName=new Map,this.teammateTerminals=new Map,this.terminalBufferCache=new Map,this.ralphStatePanelCollapsed=!0,this.ralphClosedSessions=new Set,this.planSubagents=new Map,this.planSubagentWindowZIndex=ZINDEX_PLAN_SUBAGENT_BASE,this.planGenerationStopped=!1,this.planAgentsMinimized=!1,this.wizardDragState=null,this.wizardDragListeners=null,this.wizardPosition=null,this.projectInsights=new Map,this.logViewerWindows=new Map,this.logViewerWindowZIndex=ZINDEX_LOG_VIEWER_BASE,this.projectInsightsPanelVisible=!1,this.orchestratorState=null,this.orchestratorPanelVisible=!1,this.currentSessionWorkingDir=null,this.imagePopups=new Map,this.imagePopupZIndex=ZINDEX_IMAGE_POPUP_BASE,this.attachmentCards=new Map,this.attachmentCardStack=null,this.attachmentHistoryCounts=new Map,this.attachmentHistoryItems=[],this.attachmentHistoryDrawerOpen=!1,this.fileBrowserData=null,this.fileBrowserExpandedDirs=new Set,this.fileBrowserFilter="",this.fileBrowserAllExpanded=!1,this.fileBrowserDragListeners=null,this.filePreviewContent="",this._toastContainer=null,this._tunnelUrl=null,this.tabAlerts=new Map,this.pendingHooks=new Map,this._ws=null,this._wsSessionId=null,this._wsReady=!1,this._wsState="disconnected",this._wsLastRecvAt=0,this.pendingWrites=[],this.writeFrameScheduled=!1,this._wasAtBottomBeforeWrite=!0,this.syncWaitTimeout=null,this._isLoadingBuffer=!1,this._loadBufferQueue=null,this._bufferLoadSeq=0,this._bufferLoadOwner=null,this.flickerFilterBuffer="",this.flickerFilterActive=!1,this.flickerFilterTimeout=null,this._debounceTimers=Object.create(null),this.systemStatsInterval=null,this.sseReconnectTimeout=null,this._sseListenerCleanup=null,this.reconnectAttempts=0,this.maxReconnectAttempts=10,this.isOnline=navigator.onLine,this._connectionStatus="connected",this._clientId="",this._seqCounters=new Map,this._pendingDeliveries=new Map,this._lastIndicatorDescriptor=null,this._postDraining=new Set,this._persistReliableTimer=null,this._reliableAckTimeoutMs=4e3,this._reliableMaxBytes=256*1024,this._loadReliableState(),this._reliableSweepTimer=setInterval(()=>this._redeliverSweep(),2e3),window.addEventListener("pagehide",()=>this._persistReliableNow()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this._persistReliableNow()}),this._localEchoOverlay=null,this._localEchoEnabled=!1,this._restoringFlushedState=!1,this.activeFocusTrap=null,this.notificationManager=new NotificationManager(this),this.idleTimers=new Map,this._elemCache={},this.init()}$(e){return this._elemCache[e]||(this._elemCache[e]=document.getElementById(e)),this._elemCache[e]}_clearTimer(e){this[e]&&(clearTimeout(this[e]),this[e]=null)}_isStaleSelect(e){return e!==this._selectGeneration?(this._isLoadingBuffer&&this._finishBufferLoad(e),this._restoringFlushedState=!1,!0):!1}formatTokens(e){if(e>=1e6){const t=e/1e6;return t>=10?`${t.toFixed(1)}m`:`${t.toFixed(2)}m`}else if(e>=1e3){const t=e/1e3;return t>=100?`${t.toFixed(0)}k`:`${t.toFixed(1)}k`}return String(e)}estimateCost(e,t){const s=e/1e6*15,n=t/1e6*75;return s+n}setPendingHook(e,t){this.pendingHooks.has(e)||this.pendingHooks.set(e,new Set),this.pendingHooks.get(e).add(t),this.updateTabAlertFromHooks(e)}clearPendingHooks(e,t=null){const s=this.pendingHooks.get(e);s&&(t?s.delete(t):s.clear(),s.size===0&&this.pendingHooks.delete(e),this.updateTabAlertFromHooks(e))}updateTabAlertFromHooks(e){const t=this.pendingHooks.get(e);!t||t.size===0?this.tabAlerts.delete(e):t.has("permission_prompt")||t.has("elicitation_dialog")?this.tabAlerts.set(e,"action"):t.has("idle_prompt")&&this.tabAlerts.set(e,"idle"),this.renderSessionTabs()}init(){MobileDetection.init(),this._initWindowChannel(),this.isSoloWindow&&document.body.classList.add("solo-mode"),KeyboardHandler.init(),SwipeHandler.init(),VoiceInput.init(),KeyboardAccessoryBar.init(),this.loadAppSettingsFromStorage().extendedKeyboardBar&&KeyboardAccessoryBar.setMode("extended"),this.applyHeaderVisibilitySettings(),this.restorePlanUsageChip(),this.applySkin(),this.applyTabWrapSettings(),this.applyMonitorVisibility(),document.documentElement.classList.remove("mobile-init"),requestAnimationFrame(()=>{this.initTerminal(),this.loadFontSize(),this.connectSSE(),this._initFallbackTimer=setTimeout(()=>{this._initGeneration===0&&this.loadState()},3e3)}),this.registerServiceWorker(),this.loadTunnelStatus();const t=fetch("/api/settings").then(s=>s.ok?s.json():null).then(s=>s?.data??null).catch(()=>null);if(this.loadQuickStartCases(null,t),this._initRunMode(),this.setupEventListeners(),MobileDetection.isTouchDevice()){const s=n=>{n&&n.addEventListener("touchstart",i=>{if(!KeyboardHandler.keyboardVisible)return;const o=i.target.closest("button");o&&(i.preventDefault(),o.click(),typeof app<"u"&&app.terminal&&app.terminal.focus())},{passive:!1})};s(document.querySelector(".toolbar")),s(document.querySelector(".welcome-overlay"))}this.setupOnlineDetection(),this.loadAppSettingsFromServer(t).then(()=>{this.applyHeaderVisibilitySettings(),this.applySkin(),this.applyTabWrapSettings(),this.applyMonitorVisibility(),typeof this.syncAllUltracodeFloatingWindows=="function"&&this.syncAllUltracodeFloatingWindows()}),document.body.classList.add("app-loaded")}_initWebGL(){if(!(typeof WebglAddon>"u"))try{this._webglAddon=new WebglAddon.WebglAddon,this._webglAddon.onContextLoss(()=>{console.error("[CRASH-DIAG] WebGL context LOST \u2014 falling back to canvas renderer"),_crashDiag.log("WEBGL_LOST"),this._disableWebGLSticky("context-lost"),this._disposeWebGLObserver(),this._webglAddon?.dispose(),this._webglAddon=null,this._scheduleTerminalRepaint()}),this.terminal.loadAddon(this._webglAddon),console.log("[CRASH-DIAG] WebGL renderer enabled"),this._installWebGLLongTaskGuard()}catch{}}_installWebGLLongTaskGuard(){if(typeof PerformanceObserver>"u"||this._webglLongTaskObserver)return;const e=performance.now(),t=[];try{this._webglLongTaskObserver=new PerformanceObserver(s=>{if(!this._webglAddon)return;const n=performance.now();n-e<WEBGL_FALLBACK.GRACE_MS||evaluateWebGLLongTaskTrip(t,s.getEntries(),n)&&(console.warn(`[CRASH-DIAG] WebGL long-task threshold (${t.length} stalls/${WEBGL_FALLBACK.WINDOW_MS}ms) \u2014 falling back to canvas renderer`),_crashDiag.log(`WEBGL_FALLBACK: ${t.length}`),this._disableWebGLSticky("long-tasks"),this._disposeWebGLObserver(),this._webglAddon?.dispose(),this._webglAddon=null,this._scheduleTerminalRepaint())}),this._webglLongTaskObserver.observe({type:"longtask",buffered:!1})}catch{}}_disposeWebGLObserver(){if(this._webglLongTaskObserver){try{this._webglLongTaskObserver.disconnect()}catch{}this._webglLongTaskObserver=null}}_scheduleTerminalRepaint(){if(this._terminalRepaintScheduled)return;this._terminalRepaintScheduled=!0,(typeof requestAnimationFrame=="function"?requestAnimationFrame:t=>setTimeout(t,0))(()=>{this._terminalRepaintScheduled=!1;try{this.terminal?.refresh(0,this.terminal.rows-1)}catch{}})}_disableWebGLSticky(e){try{localStorage.setItem("codeman-webgl-disabled",JSON.stringify({reason:e,at:Date.now()}))}catch{}}setupEventListeners(){const e={showShortcutOverlay:()=>this.showShortcutOverlay(),killActiveSession:()=>this.killActiveSession(),nextSession:()=>this.nextSession(),clearTerminal:()=>this.clearTerminal(),restoreTerminalSize:()=>this.restoreTerminalSize(),increaseFontSize:()=>this.increaseFontSize(),decreaseFontSize:()=>this.decreaseFontSize(),toggleVoiceInput:()=>VoiceInput.toggle(),moveActiveTabLeft:()=>this.moveActiveTabLeft(),moveActiveTabRight:()=>this.moveActiveTabRight()};document.addEventListener("keydown",s=>{if(!(s.isComposing||s.keyCode===229)){if(this.shouldOpenCommandPaletteFromShortcut?.(s)){s.preventDefault(),this.openCommandPalette();return}if(s.key==="Escape"&&(this.closeAllPanels(),this.closeHelp(),this.attachmentHistoryDrawerOpen&&this.closeAttachmentHistory(),this.closeSessionManager(),this.closeCommandPalette?.(),this.closeShortcutOverlay?.()),s.altKey&&!s.ctrlKey&&!s.shiftKey){const i=(s.code||"").match(/^Digit([1-9])$/);if(i){const o=parseInt(i[1],10)-1;o<this.sessionOrder.length&&(s.preventDefault(),this.selectSession(this.sessionOrder[o]));return}if(s.code==="BracketLeft"){s.preventDefault(),this.prevSession();return}if(s.code==="BracketRight"){s.preventDefault(),this.nextSession();return}}if(!(!s.ctrlKey&&!s.metaKey&&!s.altKey))for(const n of this.getShortcutRegistry()){if(n.disabled||!n.action)continue;const i=e[n.action];if(i&&this.matchesShortcutEvent(s,n)){s.preventDefault(),i();return}}}},!0);const t=this.$("headerTokens");t&&!t._statsHandlerAttached&&(t.classList.add("clickable"),t._statsHandlerAttached=!0,t.addEventListener("click",()=>this.openTokenStats())),this.setupColorPicker()}_updateSseSubscription(e){try{const t=JSON.stringify({clientId:this._clientId,sessions:e?[e]:null});fetch("/api/events/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:t,keepalive:!0}).catch(()=>{})}catch{}}_detectSoloSessionId(){try{if(typeof window<"u"&&typeof window.__CODEMAN_SOLO__=="string"&&window.__CODEMAN_SOLO__)return window.__CODEMAN_SOLO__;const e=location.pathname.match(/^\/session\/([^/]+)\/?$/);return e?decodeURIComponent(e[1]):null}catch{return null}}detachSession(e){if(this.isSoloWindow||!this.sessions.has(e)||this.detachedSessions.has(e)&&this._raiseDetached(e))return;const t="width=960,height=680,menubar=no,toolbar=no,location=no,status=no";let s=null;try{s=window.open("/session/"+encodeURIComponent(e),"codeman-session-"+e,t)}catch{}if(!s){this.showToast?.("Pop-out blocked \u2014 allow popups for this site to detach a session","error");return}this.detachedWindows.set(e,s),this._markDetached(e,!0),this._watchDetachedWindow(e,s),this._postWindowMessage({type:"detached",id:e});try{s.focus()}catch{}}_raiseDetached(e){const t=this.detachedWindows.get(e);if(t&&!t.closed){try{t.focus()}catch{}return!0}return t&&t.closed?(this._redock(e),!1):(this._postWindowMessage({type:"focus-request",id:e}),!0)}redockSession(e){const t=this.detachedWindows.get(e);if(t&&!t.closed)try{t.close()}catch{}this._postWindowMessage({type:"close-request",id:e}),this._redock(e)}_redock(e){const t=this._detachWatchTimers.get(e);t&&(clearInterval(t),this._detachWatchTimers.delete(e)),this._cancelPendingRedock(e),this._detachOrphanStrikes.delete(e),this.detachedWindows.delete(e),this._markDetached(e,!1)}_scheduleRedock(e){if(this._redockGrace.has(e))return;const t=setTimeout(()=>{this._redockGrace.delete(e),this._redock(e)},1500);this._redockGrace.set(e,t)}_cancelPendingRedock(e){const t=this._redockGrace.get(e);t&&(clearTimeout(t),this._redockGrace.delete(e))}_markDetached(e,t){t?this.detachedSessions.add(e):this.detachedSessions.delete(e);const s=this.$("sessionTabs"),n=s&&s.querySelector(`.session-tab[data-id="${e}"]`);n&&n.classList.toggle("detached",t)}_watchDetachedWindow(e,t){const s=this._detachWatchTimers.get(e);s&&clearInterval(s);const n=setInterval(()=>{(!t||t.closed)&&(clearInterval(n),this._detachWatchTimers.delete(e),this._redock(e))},800);this._detachWatchTimers.set(e,n)}_initWindowChannel(){if(!(typeof BroadcastChannel>"u")){try{this.windowChannel=new BroadcastChannel("codeman-windows")}catch{this.windowChannel=null;return}if(this.windowChannel.onmessage=e=>this._onWindowMessage(e.data),this.isSoloWindow){this._postWindowMessage({type:"detached",id:this.soloSessionId});const e=()=>this._postWindowMessage({type:"redocked",id:this.soloSessionId});window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}else this._postWindowMessage({type:"roll-call"}),this._startDetachLiveness()}}_postWindowMessage(e){try{this.windowChannel&&this.windowChannel.postMessage(e)}catch{}}_onWindowMessage(e){if(!(!e||typeof e!="object")){if(this.isSoloWindow){if(e.type==="roll-call"){this._postWindowMessage({type:"detached",id:this.soloSessionId});return}if(e.id!==this.soloSessionId)return;if(e.type==="close-request")try{window.close()}catch{}else if(e.type==="focus-request")try{window.focus()}catch{}return}e.type==="detached"&&e.id?(this._cancelPendingRedock(e.id),this._detachPingPending?.delete(e.id),this._detachOrphanStrikes.delete(e.id),this._markDetached(e.id,!0)):e.type==="redocked"&&e.id?this._scheduleRedock(e.id):e.type==="detach-request"&&e.id&&this.detachSession(e.id)}}_startDetachLiveness(){this._detachLivenessTimer||(this._detachLivenessTimer=setInterval(()=>this._pingDetached(),5e3))}_pingDetached(){const e=[];for(const t of this.detachedSessions){const s=this.detachedWindows.get(t);s?s.closed&&this._redock(t):e.push(t)}e.length&&(this._detachPingPending=new Set(e),this._postWindowMessage({type:"roll-call"}),setTimeout(()=>{if(this._detachPingPending){for(const t of this._detachPingPending){const s=(this._detachOrphanStrikes.get(t)||0)+1;s>=2?(this._detachOrphanStrikes.delete(t),this._redock(t)):this._detachOrphanStrikes.set(t,s)}this._detachPingPending=null}},1200))}_applySoloMode(){document.body.classList.add("solo-mode");const e=this.sessions.get(this.soloSessionId);if(!e){this._showSoloSessionGone();return}this.activeSessionId=null,this.selectSession(this.soloSessionId);const t=this.getSessionName(e)||"Session",s=document.getElementById("soloSessionTitle");s&&(s.textContent=t,s.style.display="");const n=document.getElementById("soloRedockBtn");n&&(n.style.display=""),document.title=t+" \u2014 Codeman",this.notificationManager&&(this.notificationManager.originalTitle=document.title);const i=document.querySelector(".header-brand .logo");i&&(i.onclick=o=>{o.preventDefault()})}_showSoloSessionGone(){if(document.body.classList.add("solo-mode"),document.querySelector(".solo-gone-overlay"))return;const e=document.createElement("div");e.className="solo-gone-overlay",e.innerHTML='<h2>Session unavailable</h2><p>This session has ended or is no longer available.</p><button class="btn-primary" onclick="window.close()">Close window</button>',document.body.appendChild(e),document.title="Session ended \u2014 Codeman"}connectSSE(){if(!navigator.onLine){this.setConnectionStatus("offline");return}this._clearTimer("sseReconnectTimeout"),this._sseListenerCleanup&&(this._sseListenerCleanup(),this._sseListenerCleanup=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectAttempts===0?this.setConnectionStatus("connecting"):this.setConnectionStatus("reconnecting");const e=new URLSearchParams({clientId:this._clientId});this.activeSessionId&&e.set("sessions",this.activeSessionId),this.eventSource=new EventSource(`/api/events?${e.toString()}`);const t=[],s=(n,i)=>{this.eventSource.addEventListener(n,i),t.push({event:n,handler:i})};if(this._sseListenerCleanup=()=>{for(const{event:n,handler:i}of t)this.eventSource&&this.eventSource.removeEventListener(n,i);t.length=0},this.eventSource.onopen=()=>{this.reconnectAttempts=0,this.setConnectionStatus("connected")},this.eventSource.onerror=()=>{this.reconnectAttempts++,this.reconnectAttempts>=this.maxReconnectAttempts?this.setConnectionStatus("disconnected"):this.setConnectionStatus("reconnecting"),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._clearTimer("sseReconnectTimeout");const n=this.reconnectAttempts<=1?200:Math.min(500*Math.pow(2,this.reconnectAttempts-2),3e4);this.sseReconnectTimeout=setTimeout(()=>this.connectSSE(),n)},!this._sseHandlerWrappers){this._sseHandlerWrappers=new Map;for(const[n,i]of _SSE_HANDLER_MAP){const o=this[i];this._sseHandlerWrappers.set(n,a=>{try{o.call(this,a.data?JSON.parse(a.data):{})}catch(r){console.error(`[SSE] Error handling ${n}:`,r)}})}}for(const[n]of _SSE_HANDLER_MAP)s(n,this._sseHandlerWrappers.get(n));for(const n of[SSE_EVENTS.SESSION_CREATED,SSE_EVENTS.SESSION_DELETED])s(n,()=>this._onSessionListMaybeChanged());s(SSE_EVENTS.DOCKER_EXPORT_COMPLETE,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Docker export ready: ${i.bundle} (${Math.round((i.sizeBytes||0)/1e6)} MB)`,"success"),this.refreshDockerExports?.()}catch(i){console.error("[SSE] docker export complete:",i)}}),s(SSE_EVENTS.DOCKER_EXPORT_FAILED,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Docker export failed: ${i.error||"unknown error"}`,"error")}catch(i){console.error("[SSE] docker export failed:",i)}}),s(SSE_EVENTS.DOCKER_IMPORT_COMPLETE,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Docker bundle imported as case "${i.name}"`,"success"),this.loadQuickStartCases?.(),this.refreshDockerExports?.()}catch(i){console.error("[SSE] docker import complete:",i)}}),s(SSE_EVENTS.DOCKER_CONTAINER_RECREATED,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Container for "${i.name}" removed \u2014 next launch recreates it with the new config`,"info")}catch(i){console.error("[SSE] docker container recreated:",i)}}),s(SSE_EVENTS.ADMIN_USERS_CHANGED,()=>{window.codemanAdmin?.onUsersChanged?.()}),s(SSE_EVENTS.DOCKER_IMAGE_BUILD_STARTED,()=>{this.showToast("Building the Codeman agent image (first Docker case, a few minutes)...","info",{duration:8e3})}),s(SSE_EVENTS.DOCKER_IMAGE_BUILD_COMPLETE,n=>{try{const i=n.data?JSON.parse(n.data):{};i.error?this.showToast(`Agent image build failed: ${i.error}`,"error"):this.showToast("Agent image ready. Starting the container...","success")}catch(i){console.error("[SSE] docker image build complete:",i)}}),s(SSE_EVENTS.DOCKER_IMAGE_BUILD_FAILED,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Agent image build failed: ${i.error||"unknown error"}`,"error")}catch(i){console.error("[SSE] docker image build failed:",i)}}),s(SSE_EVENTS.SESSION_PINNED,n=>{let i=null;try{i=JSON.parse(n.data)}catch{}if(i&&i.id){const o=this.sessions.get(i.id);o&&(o.pinned=i.pinned===!0,o.pinnedAt=i.pinned?i.pinnedAt:void 0)}this._onSessionListMaybeChanged()})}_onInit(e){_crashDiag.log(`INIT: ${e.sessions?.length||0} sessions`),this.handleInit(e)}_onSessionCreated(e){this.sessions.set(e.id,e),this.sessionOrder.includes(e.id)||(this.sessionOrder.push(e.id),this.saveSessionOrder()),this.renderSessionTabs(),this.updateCost(),this.sessions.size===1&&this.startSystemStatsPolling()}_onSessionUpdated(e){const t=e.session||e,s=this.sessions.get(t.id),n=t.claudeSessionId&&(!s||!s.claudeSessionId);this.sessions.set(t.id,t),this.renderSessionTabs(),this.updateCost(),t.id===this.activeSessionId&&t.tokens&&this.updateRespawnTokens(t.tokens),this.updateSubagentParentNames(t.id),n&&(this.recheckOrphanSubagents(),requestAnimationFrame(()=>{this.updateConnectionLines()}))}_onSessionDeleted(e){if(this._wsSessionId===e.id&&this._disconnectWs(),this.isSoloWindow&&e.id===this.soloSessionId&&this._showSoloSessionGone(),this.detachedSessions.has(e.id)&&this._redock(e.id),this._cleanupSessionData(e.id),this.activeSessionId===e.id){this.activeSessionId=null;try{localStorage.removeItem("codeman-active-session")}catch{}this.terminal.clear(),this.showWelcome()}this.renderSessionTabs(),this.renderRalphStatePanel(),this.renderProjectInsightsPanel(),this.sessions.size===0&&this.stopSystemStatsPolling()}_onSSETerminal(e){this._wsReady&&this._wsSessionId===e.id||this._onSessionTerminal(e)}_onSSENeedsRefresh(e){this._wsReady&&this._wsSessionId===e?.id||this._onSessionNeedsRefresh(e)}_onSSEClearTerminal(e){this._wsReady&&this._wsSessionId===e?.id||this._onSessionClearTerminal(e)}_onSessionTerminal(e){if(e.id===this.activeSessionId){if(e.data.length>32768&&_crashDiag.log(`TERMINAL: ${(e.data.length/1024).toFixed(0)}KB`),(this.pendingWrites?.reduce((s,n)=>s+n.length,0)||0)+(this.flickerFilterBuffer?.length||0)>131072){this._clientDropRecoveryTimer||(this._clientDropRecoveryTimer=setTimeout(()=>{this._clientDropRecoveryTimer=null,this._onSessionNeedsRefresh()},2e3));return}this.batchTerminalWrite(e.data)}}_sanitizeHtml(e){return typeof window<"u"&&typeof window.sanitizeMarkdownHtml=="function"?window.sanitizeMarkdownHtml(e):String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}_cleanTerminalBuffer(e){const t=e.replace(/\x1b\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[PX^_][^\x1b]*\x1b\\/g,"").replace(/\x1b[NO()][A-Z0-9]?/g,"").replace(/\x1b[>=<78cDEHM]/g,"").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"").replace(/\r\n/g,`
|
|
7
|
+
Stack:`,d.reason?.stack)}),typeof PerformanceObserver<"u")try{new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration>200&&(_crashDiag.log(`LONG_TASK: ${t.duration.toFixed(0)}ms`),console.warn(`[CRASH-DIAG] Long task: ${t.duration.toFixed(0)}ms (type: ${t.entryType}, name: ${t.name})`))}).observe({type:"longtask",buffered:!0})}catch{}const _origGetContext=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(d,...e){const t=_origGetContext.call(this,d,...e);return(d==="webgl2"||d==="webgl")&&(this.addEventListener("webglcontextlost",s=>{_crashDiag.log(`WEBGL_LOST: ${this.width}x${this.height}`),console.error("[CRASH-DIAG] WebGL context LOST on canvas",this.width,"x",this.height,"\u2014 prevented:",s.defaultPrevented)}),this.addEventListener("webglcontextrestored",()=>{_crashDiag.log("WEBGL_RESTORED"),console.warn("[CRASH-DIAG] WebGL context restored")})),t};const _SSE_HANDLER_MAP=[[SSE_EVENTS.INIT,"_onInit"],[SSE_EVENTS.SESSION_CREATED,"_onSessionCreated"],[SSE_EVENTS.SESSION_UPDATED,"_onSessionUpdated"],[SSE_EVENTS.SESSION_DELETED,"_onSessionDeleted"],[SSE_EVENTS.SESSION_TERMINAL,"_onSSETerminal"],[SSE_EVENTS.SESSION_NEEDS_REFRESH,"_onSSENeedsRefresh"],[SSE_EVENTS.SESSION_CLEAR_TERMINAL,"_onSSEClearTerminal"],[SSE_EVENTS.SESSION_COMPLETION,"_onSessionCompletion"],[SSE_EVENTS.SESSION_ERROR,"_onSessionError"],[SSE_EVENTS.SESSION_EXIT,"_onSessionExit"],[SSE_EVENTS.SESSION_IDLE,"_onSessionIdle"],[SSE_EVENTS.SESSION_WORKING,"_onSessionWorking"],[SSE_EVENTS.SESSION_AUTO_CLEAR,"_onSessionAutoClear"],[SSE_EVENTS.SESSION_LIMIT_PAUSE_SCHEDULED,"_onSessionLimitPauseScheduled"],[SSE_EVENTS.SESSION_LIMIT_RESUME,"_onSessionLimitResume"],[SSE_EVENTS.SESSION_LIMIT_RESUME_CANCELLED,"_onSessionLimitResumeCancelled"],[SSE_EVENTS.SESSION_RESPAWN_BREAKER_TRIPPED,"_onSessionRespawnBreakerTripped"],[SSE_EVENTS.SESSION_CLI_INFO,"_onSessionCliInfo"],[SSE_EVENTS.SESSION_STATUS_TELEMETRY,"_onSessionStatusTelemetry"],[SSE_EVENTS.SCHEDULED_CREATED,"_onScheduledCreated"],[SSE_EVENTS.SCHEDULED_UPDATED,"_onScheduledUpdated"],[SSE_EVENTS.SCHEDULED_COMPLETED,"_onScheduledCompleted"],[SSE_EVENTS.SCHEDULED_STOPPED,"_onScheduledStopped"],[SSE_EVENTS.CRON_JOBS_CHANGED,"_onCronJobsChanged"],[SSE_EVENTS.CRON_JOB_DELETED,"_onCronJobsChanged"],[SSE_EVENTS.CRON_RUN_CREATED,"_onCronRunChanged"],[SSE_EVENTS.CRON_RUN_UPDATED,"_onCronRunChanged"],[SSE_EVENTS.RESPAWN_STARTED,"_onRespawnStarted"],[SSE_EVENTS.RESPAWN_STOPPED,"_onRespawnStopped"],[SSE_EVENTS.RESPAWN_STATE_CHANGED,"_onRespawnStateChanged"],[SSE_EVENTS.RESPAWN_CYCLE_STARTED,"_onRespawnCycleStarted"],[SSE_EVENTS.RESPAWN_BLOCKED,"_onRespawnBlocked"],[SSE_EVENTS.RESPAWN_AUTO_ACCEPT_SENT,"_onRespawnAutoAcceptSent"],[SSE_EVENTS.RESPAWN_DETECTION_UPDATE,"_onRespawnDetectionUpdate"],[SSE_EVENTS.RESPAWN_TIMER_STARTED,"_onRespawnTimerStarted"],[SSE_EVENTS.RESPAWN_TIMER_CANCELLED,"_onRespawnTimerCancelled"],[SSE_EVENTS.RESPAWN_TIMER_COMPLETED,"_onRespawnTimerCompleted"],[SSE_EVENTS.RESPAWN_ERROR,"_onRespawnError"],[SSE_EVENTS.RESPAWN_ACTION_LOG,"_onRespawnActionLog"],[SSE_EVENTS.TASK_CREATED,"_onTaskCreated"],[SSE_EVENTS.TASK_COMPLETED,"_onTaskCompleted"],[SSE_EVENTS.TASK_FAILED,"_onTaskFailed"],[SSE_EVENTS.TASK_UPDATED,"_onTaskUpdated"],[SSE_EVENTS.MUX_CREATED,"_onMuxCreated"],[SSE_EVENTS.MUX_KILLED,"_onMuxKilled"],[SSE_EVENTS.MUX_DIED,"_onMuxDied"],[SSE_EVENTS.MUX_STATS_UPDATED,"_onMuxStatsUpdated"],[SSE_EVENTS.REMOTE_SESSION_RECONNECTED,"_onRemoteSessionReconnected"],[SSE_EVENTS.REMOTE_RECONNECT_EXHAUSTED,"_onRemoteReconnectExhausted"],[SSE_EVENTS.SESSION_RALPH_LOOP_UPDATE,"_onRalphLoopUpdate"],[SSE_EVENTS.SESSION_RALPH_TODO_UPDATE,"_onRalphTodoUpdate"],[SSE_EVENTS.SESSION_RALPH_COMPLETION_DETECTED,"_onRalphCompletionDetected"],[SSE_EVENTS.SESSION_RALPH_STATUS_UPDATE,"_onRalphStatusUpdate"],[SSE_EVENTS.SESSION_CIRCUIT_BREAKER_UPDATE,"_onCircuitBreakerUpdate"],[SSE_EVENTS.SESSION_EXIT_GATE_MET,"_onExitGateMet"],[SSE_EVENTS.SESSION_BASH_TOOL_START,"_onBashToolStart"],[SSE_EVENTS.SESSION_BASH_TOOL_END,"_onBashToolEnd"],[SSE_EVENTS.SESSION_BASH_TOOLS_UPDATE,"_onBashToolsUpdate"],[SSE_EVENTS.HOOK_IDLE_PROMPT,"_onHookIdlePrompt"],[SSE_EVENTS.HOOK_PERMISSION_PROMPT,"_onHookPermissionPrompt"],[SSE_EVENTS.HOOK_ELICITATION_DIALOG,"_onHookElicitationDialog"],[SSE_EVENTS.HOOK_STOP,"_onHookStop"],[SSE_EVENTS.HOOK_TEAMMATE_IDLE,"_onHookTeammateIdle"],[SSE_EVENTS.HOOK_TASK_COMPLETED,"_onHookTaskCompleted"],[SSE_EVENTS.SUBAGENT_DISCOVERED,"_onSubagentDiscovered"],[SSE_EVENTS.SUBAGENT_UPDATED,"_onSubagentUpdated"],[SSE_EVENTS.SUBAGENT_TOOL_CALL,"_onSubagentToolCall"],[SSE_EVENTS.SUBAGENT_PROGRESS,"_onSubagentProgress"],[SSE_EVENTS.SUBAGENT_MESSAGE,"_onSubagentMessage"],[SSE_EVENTS.SUBAGENT_TOOL_RESULT,"_onSubagentToolResult"],[SSE_EVENTS.SUBAGENT_COMPLETED,"_onSubagentCompleted"],[SSE_EVENTS.WORKFLOW_RUN_DISCOVERED,"_onWorkflowRunDiscovered"],[SSE_EVENTS.WORKFLOW_RUN_UPDATED,"_onWorkflowRunUpdated"],[SSE_EVENTS.WORKFLOW_RUN_REMOVED,"_onWorkflowRunRemoved"],[SSE_EVENTS.IMAGE_DETECTED,"_onImageDetected"],[SSE_EVENTS.ATTACHMENT_DETECTED,"_onAttachmentDetected"],[SSE_EVENTS.TUNNEL_STARTED,"_onTunnelStarted"],[SSE_EVENTS.TUNNEL_STOPPED,"_onTunnelStopped"],[SSE_EVENTS.TUNNEL_PROGRESS,"_onTunnelProgress"],[SSE_EVENTS.TUNNEL_ERROR,"_onTunnelError"],[SSE_EVENTS.TUNNEL_QR_ROTATED,"_onTunnelQrRotated"],[SSE_EVENTS.TUNNEL_QR_REGENERATED,"_onTunnelQrRegenerated"],[SSE_EVENTS.TUNNEL_QR_AUTH_USED,"_onTunnelQrAuthUsed"],[SSE_EVENTS.PLAN_SUBAGENT,"_onPlanSubagent"],[SSE_EVENTS.PLAN_PROGRESS,"_onPlanProgress"],[SSE_EVENTS.PLAN_STARTED,"_onPlanStarted"],[SSE_EVENTS.PLAN_CANCELLED,"_onPlanCancelled"],[SSE_EVENTS.PLAN_COMPLETED,"_onPlanCompleted"],[SSE_EVENTS.ORCHESTRATOR_STATE_CHANGED,"_onOrchestratorStateChanged"],[SSE_EVENTS.ORCHESTRATOR_PLAN_PROGRESS,"_onOrchestratorPlanProgress"],[SSE_EVENTS.ORCHESTRATOR_PLAN_READY,"_onOrchestratorPlanReady"],[SSE_EVENTS.ORCHESTRATOR_PHASE_STARTED,"_onOrchestratorPhaseStarted"],[SSE_EVENTS.ORCHESTRATOR_PHASE_COMPLETED,"_onOrchestratorPhaseCompleted"],[SSE_EVENTS.ORCHESTRATOR_PHASE_FAILED,"_onOrchestratorPhaseFailed"],[SSE_EVENTS.ORCHESTRATOR_VERIFICATION,"_onOrchestratorVerification"],[SSE_EVENTS.ORCHESTRATOR_TASK_ASSIGNED,"_onOrchestratorTaskAssigned"],[SSE_EVENTS.ORCHESTRATOR_TASK_COMPLETED,"_onOrchestratorTaskCompleted"],[SSE_EVENTS.ORCHESTRATOR_TASK_FAILED,"_onOrchestratorTaskFailed"],[SSE_EVENTS.ORCHESTRATOR_COMPLETED,"_onOrchestratorCompleted"],[SSE_EVENTS.ORCHESTRATOR_ERROR,"_onOrchestratorError"],[SSE_EVENTS.CLIPBOARD_WRITE,"_onClipboardWrite"],[SSE_EVENTS.SESSION_ORDER_CHANGED,"_onSessionOrderChanged"]];function parseSessionPrefix(d){if(!d)return null;const e=d.match(/^(w\d+-[a-zA-Z0-9_-]+|s\d+-[a-zA-Z0-9_-]+)/);if(!e)return null;const t=e[1],s=d.slice(t.length);return s===""?{prefix:t,suffix:""}:s.startsWith(": ")?{prefix:t,suffix:s.slice(2)}:null}const DEFAULT_SHORTCUTS=[{id:"show-shortcuts",group:"Panels",label:"Show Shortcuts",bindings:[{modifiers:["ctrl"],key:"?",code:"Slash"},{modifiers:["ctrl","shift"],key:"?"},{modifiers:["alt"],key:"?",code:"Slash"}],action:"showShortcutOverlay"},{id:"close-session",group:"Session",label:"Close Session",bindings:[{modifiers:["ctrl"],key:"w"}],action:"killActiveSession"},{id:"next-session",group:"Session",label:"Next Session",bindings:[{modifiers:["ctrl"],key:"Tab"}],action:"nextSession"},{id:"clear-terminal",group:"Terminal",label:"Clear Terminal",bindings:[{modifiers:["ctrl"],key:"l"}],action:"clearTerminal"},{id:"increase-font",group:"Terminal",label:"Increase Font",bindings:[{modifiers:["ctrl"],key:"=",code:"Equal"},{modifiers:["ctrl"],key:"+",code:"Equal"}],action:"increaseFontSize"},{id:"decrease-font",group:"Terminal",label:"Decrease Font",bindings:[{modifiers:["ctrl"],key:"-",code:"Minus"}],action:"decreaseFontSize"},{id:"voice-input",group:"Terminal",label:"Voice Input",bindings:[{modifiers:["ctrl","shift"],key:"V"}],action:"toggleVoiceInput"},{id:"restore-terminal-size",group:"Terminal",label:"Restore Terminal Size",bindings:[{modifiers:["ctrl","shift"],key:"R"}],action:"restoreTerminalSize"},{id:"move-tab-left",group:"Tabs",label:"Move Active Tab Left",bindings:[{modifiers:["ctrl","shift"],key:"{",code:"BracketLeft"}],action:"moveActiveTabLeft"},{id:"move-tab-right",group:"Tabs",label:"Move Active Tab Right",bindings:[{modifiers:["ctrl","shift"],key:"}",code:"BracketRight"}],action:"moveActiveTabRight"},{id:"command-palette",group:"Session",label:"Find Open Session",bindings:[{modifiers:["ctrl"],key:"k",code:"KeyK"},{modifiers:["meta"],key:"k",code:"KeyK"},{modifiers:["alt"],key:"k",code:"KeyK"}],action:"openCommandPalette"},{id:"previous-next-session",group:"Session",label:"Previous / Next Session",displayBindings:["Alt/Option+[","Alt/Option+]"]},{id:"switch-tab-n",group:"Session",label:"Switch to Tab N",displayBindings:["Alt/Option+1-9"]},{id:"focus-tabs",group:"Tabs",label:"Focus Tabs",displayBindings:["ArrowLeft","ArrowRight","Home","End"]},{id:"activate-focused-tab",group:"Tabs",label:"Activate Focused Tab",displayBindings:["Enter","Space"]},{id:"insert-newline",group:"Terminal",label:"Insert Newline",displayBindings:["Shift+Enter","Ctrl+Enter"]},{id:"close-panels",group:"Panels",label:"Close Panels",displayBindings:["Escape"]}];class CodemanApp{constructor(){this.sessions=new Map,this._shortIdCache=new Map,this.sessionOrder=[],this.draggedTabId=null,this.cases=[],this.currentRun=null,this.totalTokens=0,this.globalStats=null,this.eventSource=null,this._clientId=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"c-"+Math.random().toString(36).slice(2)+Date.now().toString(36),this._wsTabNonce=this._clientId,this.terminal=null,this.fitAddon=null,this.activeSessionId=null,this.soloSessionId=this._detectSoloSessionId(),this.isSoloWindow=!!this.soloSessionId,this.detachedSessions=new Set,this.detachedWindows=new Map,this._detachWatchTimers=new Map,this.windowChannel=null,this._redockGrace=new Map,this._detachPingPending=null,this._detachLivenessTimer=null,this._detachOrphanStrikes=new Map,this._initGeneration=0,this._initFallbackTimer=null,this._selectGeneration=0,this._initialFullBufferLoad=!0,this.terminalLoadStates=new Map,this.respawnStatus={},this.respawnTimers={},this.respawnCountdownTimers={},this.respawnActionLogs={},this.timerCountdownInterval=null,this.terminalBuffers=new Map,this.editingSessionId=null,this.pendingCloseSessionId=null,this.muxSessions=[],this.ralphStates=new Map,this.subagents=new Map,this.subagentActivity=new Map,this.subagentToolResults=new Map,this.activeSubagentId=null,this.subagentPanelVisible=!1,this.workflowRuns=new Map,this.workflowRunDetails=new Map,this.activeWorkflowRunId=null,this.activeWorkflowPhaseIndex=null,this.ultracodeWindows=new Map,this.ultracodeWindowsClosed=new Set,this.ultracodeWindowCloseTimers=new Map,this.ultracodeWindowZIndex=1e3,this.subagentWindows=new Map,this.subagentWindowZIndex=ZINDEX_SUBAGENT_BASE,this.minimizedSubagents=new Map,this._subagentHideTimeout=null,this.subagentParentMap=new Map,this.teams=new Map,this.teamTasks=new Map,this.teammateMap=new Map,this.teammatePanesByName=new Map,this.teammateTerminals=new Map,this.terminalBufferCache=new Map,this.ralphStatePanelCollapsed=!0,this.ralphClosedSessions=new Set,this.planSubagents=new Map,this.planSubagentWindowZIndex=ZINDEX_PLAN_SUBAGENT_BASE,this.planGenerationStopped=!1,this.planAgentsMinimized=!1,this.wizardDragState=null,this.wizardDragListeners=null,this.wizardPosition=null,this.projectInsights=new Map,this.logViewerWindows=new Map,this.logViewerWindowZIndex=ZINDEX_LOG_VIEWER_BASE,this.projectInsightsPanelVisible=!1,this.orchestratorState=null,this.orchestratorPanelVisible=!1,this.currentSessionWorkingDir=null,this.imagePopups=new Map,this.imagePopupZIndex=ZINDEX_IMAGE_POPUP_BASE,this.attachmentCards=new Map,this.attachmentCardStack=null,this.attachmentHistoryCounts=new Map,this.attachmentHistoryItems=[],this.attachmentHistoryDrawerOpen=!1,this.fileBrowserData=null,this.fileBrowserExpandedDirs=new Set,this.fileBrowserFilter="",this.fileBrowserAllExpanded=!1,this.fileBrowserDragListeners=null,this.filePreviewContent="",this._toastContainer=null,this._tunnelUrl=null,this.tabAlerts=new Map,this.pendingHooks=new Map,this._ws=null,this._wsSessionId=null,this._wsReady=!1,this._wsState="disconnected",this._wsLastRecvAt=0,this.pendingWrites=[],this.writeFrameScheduled=!1,this._wasAtBottomBeforeWrite=!0,this.syncWaitTimeout=null,this._isLoadingBuffer=!1,this._loadBufferQueue=null,this._bufferLoadSeq=0,this._bufferLoadOwner=null,this.flickerFilterBuffer="",this.flickerFilterActive=!1,this.flickerFilterTimeout=null,this._debounceTimers=Object.create(null),this.systemStatsInterval=null,this.sseReconnectTimeout=null,this._sseListenerCleanup=null,this.reconnectAttempts=0,this.maxReconnectAttempts=10,this.isOnline=navigator.onLine,this._connectionStatus="connected",this._clientId="",this._seqCounters=new Map,this._pendingDeliveries=new Map,this._lastIndicatorDescriptor=null,this._postDraining=new Set,this._persistReliableTimer=null,this._reliableAckTimeoutMs=4e3,this._reliableMaxBytes=256*1024,this._loadReliableState(),this._reliableSweepTimer=setInterval(()=>this._redeliverSweep(),2e3),window.addEventListener("pagehide",()=>this._persistReliableNow()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this._persistReliableNow()}),this._localEchoOverlay=null,this._localEchoEnabled=!1,this._restoringFlushedState=!1,this.activeFocusTrap=null,this.notificationManager=new NotificationManager(this),this.idleTimers=new Map,this._elemCache={},this.init()}$(e){return this._elemCache[e]||(this._elemCache[e]=document.getElementById(e)),this._elemCache[e]}_clearTimer(e){this[e]&&(clearTimeout(this[e]),this[e]=null)}_isStaleSelect(e){return e!==this._selectGeneration?(this._isLoadingBuffer&&this._finishBufferLoad(e),this._restoringFlushedState=!1,!0):!1}formatTokens(e){if(e>=1e6){const t=e/1e6;return t>=10?`${t.toFixed(1)}m`:`${t.toFixed(2)}m`}else if(e>=1e3){const t=e/1e3;return t>=100?`${t.toFixed(0)}k`:`${t.toFixed(1)}k`}return String(e)}estimateCost(e,t){const s=e/1e6*15,n=t/1e6*75;return s+n}setPendingHook(e,t){this.pendingHooks.has(e)||this.pendingHooks.set(e,new Set),this.pendingHooks.get(e).add(t),this.updateTabAlertFromHooks(e)}clearPendingHooks(e,t=null){const s=this.pendingHooks.get(e);s&&(t?s.delete(t):s.clear(),s.size===0&&this.pendingHooks.delete(e),this.updateTabAlertFromHooks(e))}updateTabAlertFromHooks(e){const t=this.pendingHooks.get(e);!t||t.size===0?this.tabAlerts.delete(e):t.has("permission_prompt")||t.has("elicitation_dialog")?this.tabAlerts.set(e,"action"):t.has("idle_prompt")&&this.tabAlerts.set(e,"idle"),this.renderSessionTabs()}init(){MobileDetection.init(),this._initWindowChannel(),this.isSoloWindow&&document.body.classList.add("solo-mode"),KeyboardHandler.init(),SwipeHandler.init(),VoiceInput.init(),KeyboardAccessoryBar.init(),this.loadAppSettingsFromStorage().extendedKeyboardBar&&KeyboardAccessoryBar.setMode("extended"),this.applyHeaderVisibilitySettings(),this.restorePlanUsageChip(),this.applySkin(),this.applyLocalization(),this.applyTabWrapSettings(),this.applyMonitorVisibility(),document.documentElement.classList.remove("mobile-init"),requestAnimationFrame(()=>{this.initTerminal(),this.loadFontSize(),this.connectSSE(),this._initFallbackTimer=setTimeout(()=>{this._initGeneration===0&&this.loadState()},3e3)}),this.registerServiceWorker(),this.loadTunnelStatus();const t=fetch("/api/settings").then(s=>s.ok?s.json():null).then(s=>s?.data??null).catch(()=>null);if(this.loadQuickStartCases(null,t),this._initRunMode(),this.setupEventListeners(),MobileDetection.isTouchDevice()){const s=n=>{n&&n.addEventListener("touchstart",i=>{if(!KeyboardHandler.keyboardVisible)return;const o=i.target.closest("button");o&&(i.preventDefault(),o.click(),typeof app<"u"&&app.terminal&&app.terminal.focus())},{passive:!1})};s(document.querySelector(".toolbar")),s(document.querySelector(".welcome-overlay"))}this.setupOnlineDetection(),this.loadAppSettingsFromServer(t).then(()=>{this.applyHeaderVisibilitySettings(),this.applySkin(),this.applyLocalization(),this.applyTabWrapSettings(),this.applyMonitorVisibility(),typeof this.syncAllUltracodeFloatingWindows=="function"&&this.syncAllUltracodeFloatingWindows()}),document.body.classList.add("app-loaded")}_initWebGL(){if(!(typeof WebglAddon>"u"))try{this._webglAddon=new WebglAddon.WebglAddon,this._webglAddon.onContextLoss(()=>{console.error("[CRASH-DIAG] WebGL context LOST \u2014 falling back to canvas renderer"),_crashDiag.log("WEBGL_LOST"),this._disableWebGLSticky("context-lost"),this._disposeWebGLObserver(),this._webglAddon?.dispose(),this._webglAddon=null,this._scheduleTerminalRepaint()}),this.terminal.loadAddon(this._webglAddon),console.log("[CRASH-DIAG] WebGL renderer enabled"),this._installWebGLLongTaskGuard()}catch{}}_installWebGLLongTaskGuard(){if(typeof PerformanceObserver>"u"||this._webglLongTaskObserver)return;const e=performance.now(),t=[];try{this._webglLongTaskObserver=new PerformanceObserver(s=>{if(!this._webglAddon)return;const n=performance.now();n-e<WEBGL_FALLBACK.GRACE_MS||evaluateWebGLLongTaskTrip(t,s.getEntries(),n)&&(console.warn(`[CRASH-DIAG] WebGL long-task threshold (${t.length} stalls/${WEBGL_FALLBACK.WINDOW_MS}ms) \u2014 falling back to canvas renderer`),_crashDiag.log(`WEBGL_FALLBACK: ${t.length}`),this._disableWebGLSticky("long-tasks"),this._disposeWebGLObserver(),this._webglAddon?.dispose(),this._webglAddon=null,this._scheduleTerminalRepaint())}),this._webglLongTaskObserver.observe({type:"longtask",buffered:!1})}catch{}}_disposeWebGLObserver(){if(this._webglLongTaskObserver){try{this._webglLongTaskObserver.disconnect()}catch{}this._webglLongTaskObserver=null}}_scheduleTerminalRepaint(){if(this._terminalRepaintScheduled)return;this._terminalRepaintScheduled=!0,(typeof requestAnimationFrame=="function"?requestAnimationFrame:t=>setTimeout(t,0))(()=>{this._terminalRepaintScheduled=!1;try{this.terminal?.refresh(0,this.terminal.rows-1)}catch{}})}_disableWebGLSticky(e){try{localStorage.setItem("codeman-webgl-disabled",JSON.stringify({reason:e,at:Date.now()}))}catch{}}setupEventListeners(){const e={showShortcutOverlay:()=>this.showShortcutOverlay(),killActiveSession:()=>this.killActiveSession(),nextSession:()=>this.nextSession(),clearTerminal:()=>this.clearTerminal(),restoreTerminalSize:()=>this.restoreTerminalSize(),increaseFontSize:()=>this.increaseFontSize(),decreaseFontSize:()=>this.decreaseFontSize(),toggleVoiceInput:()=>VoiceInput.toggle(),moveActiveTabLeft:()=>this.moveActiveTabLeft(),moveActiveTabRight:()=>this.moveActiveTabRight()};document.addEventListener("keydown",s=>{if(!(s.isComposing||s.keyCode===229)){if(this.shouldOpenCommandPaletteFromShortcut?.(s)){s.preventDefault(),this.openCommandPalette();return}if(s.key==="Escape"&&(this.closeAllPanels(),this.closeHelp(),this.attachmentHistoryDrawerOpen&&this.closeAttachmentHistory(),this.closeSessionManager(),this.closeCommandPalette?.(),this.closeShortcutOverlay?.()),s.altKey&&!s.ctrlKey&&!s.shiftKey){const i=(s.code||"").match(/^Digit([1-9])$/);if(i){const o=parseInt(i[1],10)-1;o<this.sessionOrder.length&&(s.preventDefault(),this.selectSession(this.sessionOrder[o]));return}if(s.code==="BracketLeft"){s.preventDefault(),this.prevSession();return}if(s.code==="BracketRight"){s.preventDefault(),this.nextSession();return}}if(!(!s.ctrlKey&&!s.metaKey&&!s.altKey))for(const n of this.getShortcutRegistry()){if(n.disabled||!n.action)continue;const i=e[n.action];if(i&&this.matchesShortcutEvent(s,n)){s.preventDefault(),i();return}}}},!0);const t=this.$("headerTokens");t&&!t._statsHandlerAttached&&(t.classList.add("clickable"),t._statsHandlerAttached=!0,t.addEventListener("click",()=>this.openTokenStats())),this.setupColorPicker()}_updateSseSubscription(e){try{const t=JSON.stringify({clientId:this._clientId,sessions:e?[e]:null});fetch("/api/events/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:t,keepalive:!0}).catch(()=>{})}catch{}}_detectSoloSessionId(){try{if(typeof window<"u"&&typeof window.__CODEMAN_SOLO__=="string"&&window.__CODEMAN_SOLO__)return window.__CODEMAN_SOLO__;const e=location.pathname.match(/^\/session\/([^/]+)\/?$/);return e?decodeURIComponent(e[1]):null}catch{return null}}detachSession(e){if(this.isSoloWindow||!this.sessions.has(e)||this.detachedSessions.has(e)&&this._raiseDetached(e))return;const t="width=960,height=680,menubar=no,toolbar=no,location=no,status=no";let s=null;try{s=window.open("/session/"+encodeURIComponent(e),"codeman-session-"+e,t)}catch{}if(!s){this.showToast?.("Pop-out blocked \u2014 allow popups for this site to detach a session","error");return}this.detachedWindows.set(e,s),this._markDetached(e,!0),this._watchDetachedWindow(e,s),this._postWindowMessage({type:"detached",id:e});try{s.focus()}catch{}}_raiseDetached(e){const t=this.detachedWindows.get(e);if(t&&!t.closed){try{t.focus()}catch{}return!0}return t&&t.closed?(this._redock(e),!1):(this._postWindowMessage({type:"focus-request",id:e}),!0)}redockSession(e){const t=this.detachedWindows.get(e);if(t&&!t.closed)try{t.close()}catch{}this._postWindowMessage({type:"close-request",id:e}),this._redock(e)}_redock(e){const t=this._detachWatchTimers.get(e);t&&(clearInterval(t),this._detachWatchTimers.delete(e)),this._cancelPendingRedock(e),this._detachOrphanStrikes.delete(e),this.detachedWindows.delete(e),this._markDetached(e,!1)}_scheduleRedock(e){if(this._redockGrace.has(e))return;const t=setTimeout(()=>{this._redockGrace.delete(e),this._redock(e)},1500);this._redockGrace.set(e,t)}_cancelPendingRedock(e){const t=this._redockGrace.get(e);t&&(clearTimeout(t),this._redockGrace.delete(e))}_markDetached(e,t){t?this.detachedSessions.add(e):this.detachedSessions.delete(e);const s=this.$("sessionTabs"),n=s&&s.querySelector(`.session-tab[data-id="${e}"]`);n&&n.classList.toggle("detached",t)}_watchDetachedWindow(e,t){const s=this._detachWatchTimers.get(e);s&&clearInterval(s);const n=setInterval(()=>{(!t||t.closed)&&(clearInterval(n),this._detachWatchTimers.delete(e),this._redock(e))},800);this._detachWatchTimers.set(e,n)}_initWindowChannel(){if(!(typeof BroadcastChannel>"u")){try{this.windowChannel=new BroadcastChannel("codeman-windows")}catch{this.windowChannel=null;return}if(this.windowChannel.onmessage=e=>this._onWindowMessage(e.data),this.isSoloWindow){this._postWindowMessage({type:"detached",id:this.soloSessionId});const e=()=>this._postWindowMessage({type:"redocked",id:this.soloSessionId});window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}else this._postWindowMessage({type:"roll-call"}),this._startDetachLiveness()}}_postWindowMessage(e){try{this.windowChannel&&this.windowChannel.postMessage(e)}catch{}}_onWindowMessage(e){if(!(!e||typeof e!="object")){if(this.isSoloWindow){if(e.type==="roll-call"){this._postWindowMessage({type:"detached",id:this.soloSessionId});return}if(e.id!==this.soloSessionId)return;if(e.type==="close-request")try{window.close()}catch{}else if(e.type==="focus-request")try{window.focus()}catch{}return}e.type==="detached"&&e.id?(this._cancelPendingRedock(e.id),this._detachPingPending?.delete(e.id),this._detachOrphanStrikes.delete(e.id),this._markDetached(e.id,!0)):e.type==="redocked"&&e.id?this._scheduleRedock(e.id):e.type==="detach-request"&&e.id&&this.detachSession(e.id)}}_startDetachLiveness(){this._detachLivenessTimer||(this._detachLivenessTimer=setInterval(()=>this._pingDetached(),5e3))}_pingDetached(){const e=[];for(const t of this.detachedSessions){const s=this.detachedWindows.get(t);s?s.closed&&this._redock(t):e.push(t)}e.length&&(this._detachPingPending=new Set(e),this._postWindowMessage({type:"roll-call"}),setTimeout(()=>{if(this._detachPingPending){for(const t of this._detachPingPending){const s=(this._detachOrphanStrikes.get(t)||0)+1;s>=2?(this._detachOrphanStrikes.delete(t),this._redock(t)):this._detachOrphanStrikes.set(t,s)}this._detachPingPending=null}},1200))}_applySoloMode(){document.body.classList.add("solo-mode");const e=this.sessions.get(this.soloSessionId);if(!e){this._showSoloSessionGone();return}this.activeSessionId=null,this.selectSession(this.soloSessionId);const t=this.getSessionName(e)||"Session",s=document.getElementById("soloSessionTitle");s&&(s.textContent=t,s.style.display="");const n=document.getElementById("soloRedockBtn");n&&(n.style.display=""),document.title=t+" \u2014 "+(window.CodemanI18n?.displayName||"Codeman"),this.notificationManager&&(this.notificationManager.originalTitle=document.title);const i=document.querySelector(".header-brand .logo");i&&(i.onclick=o=>{o.preventDefault()})}_showSoloSessionGone(){if(document.body.classList.add("solo-mode"),document.querySelector(".solo-gone-overlay"))return;const e=document.createElement("div");e.className="solo-gone-overlay",e.innerHTML='<h2>Session unavailable</h2><p>This session has ended or is no longer available.</p><button class="btn-primary" onclick="window.close()">Close window</button>',document.body.appendChild(e),document.title=(window.codemanT?.("Session ended")||"Session ended")+" \u2014 "+(window.CodemanI18n?.displayName||"Codeman")}connectSSE(){if(!navigator.onLine){this.setConnectionStatus("offline");return}this._clearTimer("sseReconnectTimeout"),this._sseListenerCleanup&&(this._sseListenerCleanup(),this._sseListenerCleanup=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectAttempts===0?this.setConnectionStatus("connecting"):this.setConnectionStatus("reconnecting");const e=new URLSearchParams({clientId:this._clientId});this.activeSessionId&&e.set("sessions",this.activeSessionId),this.eventSource=new EventSource(`/api/events?${e.toString()}`);const t=[],s=(n,i)=>{this.eventSource.addEventListener(n,i),t.push({event:n,handler:i})};if(this._sseListenerCleanup=()=>{for(const{event:n,handler:i}of t)this.eventSource&&this.eventSource.removeEventListener(n,i);t.length=0},this.eventSource.onopen=()=>{this.reconnectAttempts=0,this.setConnectionStatus("connected")},this.eventSource.onerror=()=>{this.reconnectAttempts++,this.reconnectAttempts>=this.maxReconnectAttempts?this.setConnectionStatus("disconnected"):this.setConnectionStatus("reconnecting"),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._clearTimer("sseReconnectTimeout");const n=this.reconnectAttempts<=1?200:Math.min(500*Math.pow(2,this.reconnectAttempts-2),3e4);this.sseReconnectTimeout=setTimeout(()=>this.connectSSE(),n)},!this._sseHandlerWrappers){this._sseHandlerWrappers=new Map;for(const[n,i]of _SSE_HANDLER_MAP){const o=this[i];this._sseHandlerWrappers.set(n,a=>{try{o.call(this,a.data?JSON.parse(a.data):{})}catch(r){console.error(`[SSE] Error handling ${n}:`,r)}})}}for(const[n]of _SSE_HANDLER_MAP)s(n,this._sseHandlerWrappers.get(n));for(const n of[SSE_EVENTS.SESSION_CREATED,SSE_EVENTS.SESSION_DELETED])s(n,()=>this._onSessionListMaybeChanged());s(SSE_EVENTS.DOCKER_EXPORT_COMPLETE,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Docker export ready: ${i.bundle} (${Math.round((i.sizeBytes||0)/1e6)} MB)`,"success"),this.refreshDockerExports?.()}catch(i){console.error("[SSE] docker export complete:",i)}}),s(SSE_EVENTS.DOCKER_EXPORT_FAILED,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Docker export failed: ${i.error||"unknown error"}`,"error")}catch(i){console.error("[SSE] docker export failed:",i)}}),s(SSE_EVENTS.DOCKER_IMPORT_COMPLETE,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Docker bundle imported as case "${i.name}"`,"success"),this.loadQuickStartCases?.(),this.refreshDockerExports?.()}catch(i){console.error("[SSE] docker import complete:",i)}}),s(SSE_EVENTS.DOCKER_CONTAINER_RECREATED,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Container for "${i.name}" removed \u2014 next launch recreates it with the new config`,"info")}catch(i){console.error("[SSE] docker container recreated:",i)}}),s(SSE_EVENTS.ADMIN_USERS_CHANGED,()=>{window.codemanAdmin?.onUsersChanged?.()}),s(SSE_EVENTS.DOCKER_IMAGE_BUILD_STARTED,()=>{this.showToast("Building the Codeman agent image (first Docker case, a few minutes)...","info",{duration:8e3})}),s(SSE_EVENTS.DOCKER_IMAGE_BUILD_COMPLETE,n=>{try{const i=n.data?JSON.parse(n.data):{};i.error?this.showToast(`Agent image build failed: ${i.error}`,"error"):this.showToast("Agent image ready. Starting the container...","success")}catch(i){console.error("[SSE] docker image build complete:",i)}}),s(SSE_EVENTS.DOCKER_IMAGE_BUILD_FAILED,n=>{try{const i=n.data?JSON.parse(n.data):{};this.showToast(`Agent image build failed: ${i.error||"unknown error"}`,"error")}catch(i){console.error("[SSE] docker image build failed:",i)}}),s(SSE_EVENTS.SESSION_PINNED,n=>{let i=null;try{i=JSON.parse(n.data)}catch{}if(i&&i.id){const o=this.sessions.get(i.id);o&&(o.pinned=i.pinned===!0,o.pinnedAt=i.pinned?i.pinnedAt:void 0)}this._onSessionListMaybeChanged()})}_onInit(e){_crashDiag.log(`INIT: ${e.sessions?.length||0} sessions`),this.handleInit(e)}_onSessionCreated(e){this.sessions.set(e.id,e),this.sessionOrder.includes(e.id)||(this.sessionOrder.push(e.id),this.saveSessionOrder()),this.renderSessionTabs(),this.updateCost(),this.sessions.size===1&&this.startSystemStatsPolling()}_onSessionUpdated(e){const t=e.session||e,s=this.sessions.get(t.id),n=t.claudeSessionId&&(!s||!s.claudeSessionId);this.sessions.set(t.id,t),this.renderSessionTabs(),this.updateCost(),t.id===this.activeSessionId&&t.tokens&&this.updateRespawnTokens(t.tokens),this.updateSubagentParentNames(t.id),n&&(this.recheckOrphanSubagents(),requestAnimationFrame(()=>{this.updateConnectionLines()}))}_onSessionDeleted(e){if(this._wsSessionId===e.id&&this._disconnectWs(),this.isSoloWindow&&e.id===this.soloSessionId&&this._showSoloSessionGone(),this.detachedSessions.has(e.id)&&this._redock(e.id),this._cleanupSessionData(e.id),this.activeSessionId===e.id){this.activeSessionId=null;try{localStorage.removeItem("codeman-active-session")}catch{}this.terminal.clear(),this.showWelcome()}this.renderSessionTabs(),this.renderRalphStatePanel(),this.renderProjectInsightsPanel(),this.sessions.size===0&&this.stopSystemStatsPolling()}_onSSETerminal(e){this._wsReady&&this._wsSessionId===e.id||this._onSessionTerminal(e)}_onSSENeedsRefresh(e){this._wsReady&&this._wsSessionId===e?.id||this._onSessionNeedsRefresh(e)}_onSSEClearTerminal(e){this._wsReady&&this._wsSessionId===e?.id||this._onSessionClearTerminal(e)}_onSessionTerminal(e){if(e.id===this.activeSessionId){if(e.data.length>32768&&_crashDiag.log(`TERMINAL: ${(e.data.length/1024).toFixed(0)}KB`),(this.pendingWrites?.reduce((s,n)=>s+n.length,0)||0)+(this.flickerFilterBuffer?.length||0)>131072){this._clientDropRecoveryTimer||(this._clientDropRecoveryTimer=setTimeout(()=>{this._clientDropRecoveryTimer=null,this._onSessionNeedsRefresh()},2e3));return}this.batchTerminalWrite(e.data)}}_sanitizeHtml(e){return typeof window<"u"&&typeof window.sanitizeMarkdownHtml=="function"?window.sanitizeMarkdownHtml(e):String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}_cleanTerminalBuffer(e){const t=e.replace(/\x1b\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[PX^_][^\x1b]*\x1b\\/g,"").replace(/\x1b[NO()][A-Z0-9]?/g,"").replace(/\x1b[>=<78cDEHM]/g,"").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"").replace(/\r\n/g,`
|
|
8
8
|
`).replace(/\r/g,`
|
|
9
9
|
`),s=[/^\s*❯\s*/,/^\s*[⏵⏺⏸⏹]+\s*/,/^\s*✻\s*(Crunching|Crunched|Thinking)/i,/bypass permissions/i,/\bshift\+tab to cycle\b/i,/^\s*focus\s*$/,/^\s*new task\?/i,/\/clear to save/i,/^\s*─{5,}\s*$/,/\[(Opus|Sonnet|Haiku|GPT|Claude)[\s\S]*(tokens?|\$|¥|%|↑|↓)/i,/^\s*\[\d+[km]?\/\d+[km]?\]/i,/[█░▓▒]{3,}/,/^\s*\(.*\s*(tokens?|context).*\)\s*$/i];return t.split(`
|
|
10
10
|
`).filter(o=>o.trim()?!s.some(r=>r.test(o)):!0).join(`
|
|
11
11
|
`).replace(/[ \t]+$/gm,"").replace(/\n{4,}/g,`
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
`).trim()}_preprocessAsciiArt(e){const t=/[─-╿▀-▟]/,s=/```[\s\S]*?```/g,n=[];return e.replace(s,a=>(n.push(a),`__CODEMAN_FENCE_${n.length-1}__`)).split(/(\n{2,})/).map(a=>/^\n{2,}$/.test(a)||!a.trim()||a.includes("__CODEMAN_FENCE_")?a:t.test(a)?"\n```\n"+a+"\n```\n":a).join("").replace(/__CODEMAN_FENCE_(\d+)__/g,(a,r)=>n[Number(r)])}_renderMarkdown(e){const t=e||"";if(typeof marked<"u"&&marked.parse)try{const n=this._preprocessAsciiArt(t);let i=this._sanitizeHtml(marked.parse(n,{breaks:!0,gfm:!0}));i=i.replace(/<table>/g,'<div class="rv-table-wrap"><table>').replace(/<\/table>/g,"</table></div>");const o=/[─-╿▀-▟]/,a=document.createElement("template");return a.innerHTML=i,a.content.querySelectorAll("pre > code").forEach(r=>{const l=r.parentElement,c=o.test(r.textContent||""),u=document.createElement("div");u.className=c?"rv-code-wrap rv-diagram-wrap":"rv-code-wrap";const h=document.createElement("div");h.className="rv-code-actions";const p=document.createElement("button");if(p.className="rv-copy-btn",p.type="button",p.setAttribute("aria-label","Copy code"),p.setAttribute("title","Copy code"),h.appendChild(p),c){l.classList.add("rv-diagram");const _=document.createElement("button");_.className="rv-wrap-toggle",_.type="button",_.setAttribute("aria-label","Toggle line wrapping"),_.setAttribute("title","Toggle line wrapping"),h.appendChild(_)}l.parentNode.insertBefore(u,l),u.appendChild(h),u.appendChild(l)}),a.innerHTML}catch{}return`<pre style="white-space:pre-wrap;word-break:break-word">${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}_bindResponseViewerInteractions(e){!e||e.dataset.rvBound==="1"||(e.dataset.rvBound="1",e.addEventListener("click",async t=>{const s=t.target.closest(".rv-copy-btn");if(s){t.preventDefault(),t.stopPropagation();const r=s.closest(".rv-code-wrap")?.querySelector("pre code"),l=r?await this._copyText(r.textContent||""):!1;s.classList.remove("rv-copied","rv-copy-failed"),s.classList.add(l?"rv-copied":"rv-copy-failed"),clearTimeout(s._resetTimer),s._resetTimer=setTimeout(()=>{s.classList.remove("rv-copied","rv-copy-failed")},1500);return}const n=t.target.closest(".rv-wrap-toggle");if(!n)return;t.preventDefault(),t.stopPropagation();const i=n.closest(".rv-diagram-wrap"),o=i?.querySelector("pre.rv-diagram");if(!o||!i)return;const a=o.classList.toggle("rv-nowrap");i.classList.toggle("rv-wrap-nowrap",a)}))}async _copyText(e){if(!e)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}catch{return!1}}async toggleResponseViewer(){const e=document.getElementById("responseViewer"),t=document.getElementById("responseViewerBackdrop");if(!e)return;if(e.classList.contains("visible")){e.classList.remove("visible"),t.classList.remove("visible");return}if(this.activeSessionId)try{let o=((await(await fetch(`/api/sessions/${this.activeSessionId}/last-response`)).json())?.data??{}).text||"";const a=this.sessions.get(this.activeSessionId)?.mode||"claude";if(!o&&(a==="claude"||a==="shell")){const h=(await(await fetch(`/api/sessions/${this.activeSessionId}/terminal`)).json())?.data??{};h.terminalBuffer&&(o=this._cleanTerminalBuffer(h.terminalBuffer))}const r=document.getElementById("responseViewerBody");o?(r.innerHTML=this._renderMarkdown(o),this._bindResponseViewerInteractions(r)):r.textContent="No response yet \u2014 send a message in this session first.";const l=document.getElementById("responseViewerTitle"),c=document.getElementById("responseViewerMore");l&&(l.textContent="Last Response"),c&&(c.style.display="",c.textContent="More"),e.classList.add("visible"),t.classList.add("visible"),r.scrollTop=0}catch(n){console.error("Failed to load response:",n)}}async loadFullContext(){if(!this.activeSessionId)return;const e=document.getElementById("responseViewerMore");e&&(e.textContent="...");try{const n=((await(await fetch(`/api/sessions/${this.activeSessionId}/last-response?context=full`)).json())?.data??{}).messages||[],i=document.getElementById("responseViewerBody"),o=document.getElementById("responseViewerTitle");if(!i)return;if(n.length===0){i.textContent="No conversation history available";return}const a=this.sessions.get(this.activeSessionId)?.mode,r=a==="codex"?"Codex":a==="gemini"?"Gemini":a==="opencode"?"OpenCode":"Claude";i.innerHTML="";for(const l of n){const c=document.createElement("div"),u=l.role==="user";c.className="rv-message "+(u?"rv-msg-user":"rv-msg-assistant");const h=document.createElement("div");h.className="rv-role "+(u?"rv-role-user":"rv-role-assistant"),h.textContent=u?"You":r,c.appendChild(h);const p=document.createElement("div");p.className="rv-text",p.innerHTML=this._renderMarkdown(l.text),c.appendChild(p),i.appendChild(c)}this._bindResponseViewerInteractions(i),o&&(o.textContent=`Conversation (${n.length} messages)`),e&&(e.style.display="none"),i.scrollTop=i.scrollHeight}catch(t){console.error("Failed to load context:",t)}finally{e&&(e.textContent="More")}}async _onSessionNeedsRefresh(){if(!(!this.activeSessionId||!this.terminal)&&!this._isLoadingBuffer)try{const t=(await(await fetch(`/api/sessions/${this.activeSessionId}/terminal?tail=${TERMINAL_TAIL_SIZE}`)).json())?.data??{};t.terminalBuffer&&(this.terminal.clear(),this.terminal.reset(),await this.chunkedTerminalWrite(t.terminalBuffer),this.terminal.scrollToBottom(),this._localEchoOverlay?.rerender(),this.activeSessionId&&this.sendResize(this.activeSessionId))}catch(e){console.error("needsRefresh reload failed:",e)}}async _onSessionClearTerminal(e){if(e.id===this.activeSessionId){if(this._isLoadingBuffer)return;try{const s=(await(await fetch(`/api/sessions/${e.id}/terminal`)).json())?.data??{};if(this.terminal.clear(),this.terminal.reset(),s.terminalBuffer){const n=s.terminalBuffer.replace(DEC_SYNC_STRIP_RE,"");await this.chunkedTerminalWrite(n)}this.sendResize(e.id),this._localEchoOverlay?.rerender()}catch(t){console.error("clearTerminal refresh failed:",t)}}}_onSessionCompletion(e){this.totalCost+=e.cost||0,this.updateCost(),e.id===this.activeSessionId&&(this.terminal.writeln(""),this.terminal.writeln(`\x1B[1;32m Done (Cost: $${(e.cost||0).toFixed(4)})\x1B[0m`))}_onSessionError(e){e.id===this.activeSessionId&&this.terminal.writeln(`\x1B[1;31m Error: ${e.error}\x1B[0m`),this._notifySession(e.id,"critical","session-error","Session Error",e.error||"Unknown error")}_onSessionExit(e){this._wsSessionId===e.id&&this._disconnectWs();const t=this.sessions.get(e.id);t&&(t.status="stopped",this.renderSessionTabs(),e.id===this.activeSessionId&&this._updateLocalEchoState()),e.code&&e.code!==0&&this._notifySession(e.id,"critical","session-crash","Session Crashed",`Exited with code ${e.code}`)}_onSessionIdle(e){const t=this.sessions.get(e.id);if(t&&(t.status="idle",this.renderSessionTabs(),this.sendPendingCtrlL(e.id),e.id===this.activeSessionId&&this._updateLocalEchoState()),!this.respawnStatus[e.id]?.enabled){const s=this.notificationManager?.preferences?.stuckThresholdMs||6e5;clearTimeout(this.idleTimers.get(e.id)),this.idleTimers.set(e.id,setTimeout(()=>{this._notifySession(e.id,"warning","session-stuck","Session Idle",`Idle for ${Math.round(s/6e4)}+ minutes`),this.idleTimers.delete(e.id)},s))}}_onSessionWorking(e){const t=this.sessions.get(e.id);t&&(t.status="busy",this.pendingHooks.has(e.id)||this.tabAlerts.delete(e.id),this.renderSessionTabs(),this.sendPendingCtrlL(e.id),e.id===this.activeSessionId&&this._updateLocalEchoState());const s=this.idleTimers.get(e.id);s&&(clearTimeout(s),this.idleTimers.delete(e.id))}_onSessionAutoClear(e){e.sessionId===this.activeSessionId&&(this.showToast(`Auto-cleared at ${e.tokens.toLocaleString()} tokens`,"info"),this.updateRespawnTokens(0)),this._notifySession(e.sessionId,"info","auto-clear","Auto-Cleared",`Context reset at ${(e.tokens||0).toLocaleString()} tokens`)}_onSessionLimitPauseScheduled(e){const t=this.sessions.get(e.sessionId);t&&(t.autoResumeAt=e.resumeAt);const s=new Date(e.resumeAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});e.sessionId===this.activeSessionId&&this.showToast(`Usage limit reached \u2014 auto-resume at ${s}`,"warning"),this._notifySession(e.sessionId,"warning","limit-pause","Usage Limit Reached",`Auto-resume scheduled for ${s}`),this.updateAutoResumeStatus(e.sessionId)}_onSessionLimitResume(e){const t=this.sessions.get(e.sessionId);t&&(t.autoResumeAt=void 0),e.sessionId===this.activeSessionId&&this.showToast("Usage limit reset \u2014 work resumed automatically","success"),this._notifySession(e.sessionId,"info","limit-resume","Auto-Resumed","Usage limit reset \u2014 continuing work"),this.updateAutoResumeStatus(e.sessionId)}_onSessionLimitResumeCancelled(e){const t=this.sessions.get(e.sessionId);t&&(t.autoResumeAt=void 0),this.updateAutoResumeStatus(e.sessionId)}_onSessionRespawnBreakerTripped(e){const s=this.sessions.get(e.sessionId)?.name||"Session";this.showToast?.(`${s} stopped: repeated crashes detected. Restart to retry.`,"error")}_onSessionCliInfo(e){const t=this.sessions.get(e.sessionId);t&&(e.version&&(t.cliVersion=e.version),e.model&&(t.cliModel=e.model),e.accountType&&(t.cliAccountType=e.accountType),e.latestVersion&&(t.cliLatestVersion=e.latestVersion)),e.sessionId===this.activeSessionId&&this.updateCliInfoDisplay()}_onSessionStatusTelemetry(e){this.updatePlanUsageChip(e);try{localStorage.setItem("codeman:planUsage",JSON.stringify({t:Date.now(),data:e}))}catch{}}restorePlanUsageChip(){try{const e=localStorage.getItem("codeman:planUsage");if(!e)return;const t=JSON.parse(e);t?.data&&Date.now()-(t.t||0)<12*3600*1e3&&this.updatePlanUsageChip(t.data)}catch{}}updatePlanUsageChip(e){const t=document.getElementById("planUsageChip");if(!t||!e)return;const s=l=>l&&typeof l.usedPercentage=="number"?Math.round(l.usedPercentage):null,n=s(e.fiveHour),i=s(e.sevenDay);if(n===null&&i===null)return;const o=l=>l>=85?"pu-red":l>=60?"pu-yellow":"pu-green",a=(l,c)=>{if(c===null)return"";const u=Math.round(Number(c));return Number.isFinite(u)?`<span class="pu-win"><span class="pu-label">${l}</span><span class="pu-val ${o(u)}">${u}%</span></span>`:""};t.innerHTML=[a("5h",n),a("7d",i)].filter(Boolean).join('<span class="pu-sep">\xB7</span>');const r=l=>l&&l.resetAt?new Date(l.resetAt).toLocaleString():"\u2014";t.title=`Claude plan usage
|
|
14
|
+
`).trim()}_preprocessAsciiArt(e){const t=/[─-╿▀-▟]/,s=/```[\s\S]*?```/g,n=[];return e.replace(s,a=>(n.push(a),`__CODEMAN_FENCE_${n.length-1}__`)).split(/(\n{2,})/).map(a=>/^\n{2,}$/.test(a)||!a.trim()||a.includes("__CODEMAN_FENCE_")?a:t.test(a)?"\n```\n"+a+"\n```\n":a).join("").replace(/__CODEMAN_FENCE_(\d+)__/g,(a,r)=>n[Number(r)])}_renderMarkdown(e){const t=e||"";if(typeof marked<"u"&&marked.parse)try{const n=this._preprocessAsciiArt(t);let i=this._sanitizeHtml(marked.parse(n,{breaks:!0,gfm:!0}));i=i.replace(/<table>/g,'<div class="rv-table-wrap"><table>').replace(/<\/table>/g,"</table></div>");const o=/[─-╿▀-▟]/,a=document.createElement("template");return a.innerHTML=i,a.content.querySelectorAll("pre > code").forEach(r=>{const l=r.parentElement,c=o.test(r.textContent||""),u=document.createElement("div");u.className=c?"rv-code-wrap rv-diagram-wrap":"rv-code-wrap";const h=document.createElement("div");h.className="rv-code-actions";const p=document.createElement("button");if(p.className="rv-copy-btn",p.type="button",p.setAttribute("aria-label","Copy code"),p.setAttribute("title","Copy code"),h.appendChild(p),c){l.classList.add("rv-diagram");const _=document.createElement("button");_.className="rv-wrap-toggle",_.type="button",_.setAttribute("aria-label","Toggle line wrapping"),_.setAttribute("title","Toggle line wrapping"),h.appendChild(_)}l.parentNode.insertBefore(u,l),u.appendChild(h),u.appendChild(l)}),a.innerHTML}catch{}return`<pre style="white-space:pre-wrap;word-break:break-word">${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}_bindResponseViewerInteractions(e){!e||e.dataset.rvBound==="1"||(e.dataset.rvBound="1",e.addEventListener("click",async t=>{const s=t.target.closest(".rv-copy-btn");if(s){t.preventDefault(),t.stopPropagation();const r=s.closest(".rv-code-wrap")?.querySelector("pre code"),l=r?await this._copyText(r.textContent||""):!1;s.classList.remove("rv-copied","rv-copy-failed"),s.classList.add(l?"rv-copied":"rv-copy-failed"),clearTimeout(s._resetTimer),s._resetTimer=setTimeout(()=>{s.classList.remove("rv-copied","rv-copy-failed")},1500);return}const n=t.target.closest(".rv-wrap-toggle");if(!n)return;t.preventDefault(),t.stopPropagation();const i=n.closest(".rv-diagram-wrap"),o=i?.querySelector("pre.rv-diagram");if(!o||!i)return;const a=o.classList.toggle("rv-nowrap");i.classList.toggle("rv-wrap-nowrap",a)}))}async _copyText(e){if(!e)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}catch{return!1}}async toggleResponseViewer(){const e=document.getElementById("responseViewer"),t=document.getElementById("responseViewerBackdrop");if(!e)return;if(e.classList.contains("visible")){e.classList.remove("visible"),t.classList.remove("visible");return}if(this.activeSessionId)try{let o=((await(await fetch(`/api/sessions/${this.activeSessionId}/last-response`)).json())?.data??{}).text||"";const a=this.sessions.get(this.activeSessionId)?.mode||"claude";if(!o&&(a==="claude"||a==="shell")){const h=(await(await fetch(`/api/sessions/${this.activeSessionId}/terminal`)).json())?.data??{};h.terminalBuffer&&(o=this._cleanTerminalBuffer(h.terminalBuffer))}const r=document.getElementById("responseViewerBody");o?(r.innerHTML=this._renderMarkdown(o),this._bindResponseViewerInteractions(r)):r.textContent=window.codemanT?.("No response yet \u2014 send a message in this session first.")||"No response yet \u2014 send a message in this session first.";const l=document.getElementById("responseViewerTitle"),c=document.getElementById("responseViewerMore");l&&(l.textContent="Last Response"),c&&(c.style.display="",c.textContent="More"),e.classList.add("visible"),t.classList.add("visible"),r.scrollTop=0}catch(n){console.error("Failed to load response:",n)}}async loadFullContext(){if(!this.activeSessionId)return;const e=document.getElementById("responseViewerMore");e&&(e.textContent="...");try{const n=((await(await fetch(`/api/sessions/${this.activeSessionId}/last-response?context=full`)).json())?.data??{}).messages||[],i=document.getElementById("responseViewerBody"),o=document.getElementById("responseViewerTitle");if(!i)return;if(n.length===0){i.textContent="No conversation history available";return}const a=this.sessions.get(this.activeSessionId)?.mode,r=a==="codex"?"Codex":a==="gemini"?"Gemini":a==="opencode"?"OpenCode":"Claude";i.innerHTML="";for(const l of n){const c=document.createElement("div"),u=l.role==="user";c.className="rv-message "+(u?"rv-msg-user":"rv-msg-assistant");const h=document.createElement("div");h.className="rv-role "+(u?"rv-role-user":"rv-role-assistant"),h.textContent=u?"You":r,c.appendChild(h);const p=document.createElement("div");p.className="rv-text",p.innerHTML=this._renderMarkdown(l.text),c.appendChild(p),i.appendChild(c)}this._bindResponseViewerInteractions(i),o&&(o.textContent=`Conversation (${n.length} messages)`),e&&(e.style.display="none"),i.scrollTop=i.scrollHeight}catch(t){console.error("Failed to load context:",t)}finally{e&&(e.textContent="More")}}async _onSessionNeedsRefresh(){if(!(!this.activeSessionId||!this.terminal)&&!this._isLoadingBuffer)try{const t=(await(await fetch(`/api/sessions/${this.activeSessionId}/terminal?tail=${TERMINAL_TAIL_SIZE}`)).json())?.data??{};t.terminalBuffer&&(this.terminal.clear(),this.terminal.reset(),await this.chunkedTerminalWrite(t.terminalBuffer),this.terminal.scrollToBottom(),this._localEchoOverlay?.rerender(),this.activeSessionId&&this.sendResize(this.activeSessionId))}catch(e){console.error("needsRefresh reload failed:",e)}}async _onSessionClearTerminal(e){if(e.id===this.activeSessionId){if(this._isLoadingBuffer)return;try{const s=(await(await fetch(`/api/sessions/${e.id}/terminal`)).json())?.data??{};if(this.terminal.clear(),this.terminal.reset(),s.terminalBuffer){const n=s.terminalBuffer.replace(DEC_SYNC_STRIP_RE,"");await this.chunkedTerminalWrite(n)}this.sendResize(e.id),this._localEchoOverlay?.rerender()}catch(t){console.error("clearTerminal refresh failed:",t)}}}_onSessionCompletion(e){this.totalCost+=e.cost||0,this.updateCost(),e.id===this.activeSessionId&&(this.terminal.writeln(""),this.terminal.writeln(`\x1B[1;32m Done (Cost: $${(e.cost||0).toFixed(4)})\x1B[0m`))}_onSessionError(e){e.id===this.activeSessionId&&this.terminal.writeln(`\x1B[1;31m Error: ${e.error}\x1B[0m`),this._notifySession(e.id,"critical","session-error","Session Error",e.error||"Unknown error")}_onSessionExit(e){this._wsSessionId===e.id&&this._disconnectWs();const t=this.sessions.get(e.id);t&&(t.status="stopped",this.renderSessionTabs(),e.id===this.activeSessionId&&this._updateLocalEchoState()),e.code&&e.code!==0&&this._notifySession(e.id,"critical","session-crash","Session Crashed",`Exited with code ${e.code}`)}_onSessionIdle(e){const t=this.sessions.get(e.id);if(t&&(t.status="idle",this.renderSessionTabs(),this.sendPendingCtrlL(e.id),e.id===this.activeSessionId&&this._updateLocalEchoState()),!this.respawnStatus[e.id]?.enabled){const s=this.notificationManager?.preferences?.stuckThresholdMs||6e5;clearTimeout(this.idleTimers.get(e.id)),this.idleTimers.set(e.id,setTimeout(()=>{this._notifySession(e.id,"warning","session-stuck","Session Idle",`Idle for ${Math.round(s/6e4)}+ minutes`),this.idleTimers.delete(e.id)},s))}}_onSessionWorking(e){const t=this.sessions.get(e.id);t&&(t.status="busy",this.pendingHooks.has(e.id)||this.tabAlerts.delete(e.id),this.renderSessionTabs(),this.sendPendingCtrlL(e.id),e.id===this.activeSessionId&&this._updateLocalEchoState());const s=this.idleTimers.get(e.id);s&&(clearTimeout(s),this.idleTimers.delete(e.id))}_onSessionAutoClear(e){e.sessionId===this.activeSessionId&&(this.showToast(`Auto-cleared at ${e.tokens.toLocaleString()} tokens`,"info"),this.updateRespawnTokens(0)),this._notifySession(e.sessionId,"info","auto-clear","Auto-Cleared",`Context reset at ${(e.tokens||0).toLocaleString()} tokens`)}_onSessionLimitPauseScheduled(e){const t=this.sessions.get(e.sessionId);t&&(t.autoResumeAt=e.resumeAt);const s=new Date(e.resumeAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});e.sessionId===this.activeSessionId&&this.showToast(`Usage limit reached \u2014 auto-resume at ${s}`,"warning"),this._notifySession(e.sessionId,"warning","limit-pause","Usage Limit Reached",`Auto-resume scheduled for ${s}`),this.updateAutoResumeStatus(e.sessionId)}_onSessionLimitResume(e){const t=this.sessions.get(e.sessionId);t&&(t.autoResumeAt=void 0),e.sessionId===this.activeSessionId&&this.showToast("Usage limit reset \u2014 work resumed automatically","success"),this._notifySession(e.sessionId,"info","limit-resume","Auto-Resumed","Usage limit reset \u2014 continuing work"),this.updateAutoResumeStatus(e.sessionId)}_onSessionLimitResumeCancelled(e){const t=this.sessions.get(e.sessionId);t&&(t.autoResumeAt=void 0),this.updateAutoResumeStatus(e.sessionId)}_onSessionRespawnBreakerTripped(e){const s=this.sessions.get(e.sessionId)?.name||"Session";this.showToast?.(`${s} stopped: repeated crashes detected. Restart to retry.`,"error")}_onSessionCliInfo(e){const t=this.sessions.get(e.sessionId);t&&(e.version&&(t.cliVersion=e.version),e.model&&(t.cliModel=e.model),e.accountType&&(t.cliAccountType=e.accountType),e.latestVersion&&(t.cliLatestVersion=e.latestVersion)),e.sessionId===this.activeSessionId&&this.updateCliInfoDisplay()}_onSessionStatusTelemetry(e){this.updatePlanUsageChip(e);try{localStorage.setItem("codeman:planUsage",JSON.stringify({t:Date.now(),data:e}))}catch{}}restorePlanUsageChip(){try{const e=localStorage.getItem("codeman:planUsage");if(!e)return;const t=JSON.parse(e);t?.data&&Date.now()-(t.t||0)<12*3600*1e3&&this.updatePlanUsageChip(t.data)}catch{}}updatePlanUsageChip(e){const t=document.getElementById("planUsageChip");if(!t||!e)return;const s=l=>l&&typeof l.usedPercentage=="number"?Math.round(l.usedPercentage):null,n=s(e.fiveHour),i=s(e.sevenDay);if(n===null&&i===null)return;const o=l=>l>=85?"pu-red":l>=60?"pu-yellow":"pu-green",a=(l,c)=>{if(c===null)return"";const u=Math.round(Number(c));return Number.isFinite(u)?`<span class="pu-win"><span class="pu-label">${l}</span><span class="pu-val ${o(u)}">${u}%</span></span>`:""};t.innerHTML=[a("5h",n),a("7d",i)].filter(Boolean).join('<span class="pu-sep">\xB7</span>');const r=l=>l&&l.resetAt?new Date(l.resetAt).toLocaleString():"\u2014";t.title=`Claude plan usage
|
|
15
15
|
5-hour limit: ${n??"\u2014"}% used (resets ${r(e.fiveHour)})
|
|
16
16
|
Weekly limit: ${i??"\u2014"}% used (resets ${r(e.sevenDay)})`}_onScheduledCreated(e){this.currentRun=e,this.showTimer()}_onScheduledUpdated(e){this.currentRun=e,this.updateTimer()}_onScheduledCompleted(e){this.currentRun=e,this.hideTimer(),this.showToast("Scheduled run completed!","success")}_onScheduledStopped(){this.currentRun=null,this.hideTimer()}setConnectionStatus(e){this._connectionStatus=e,this._updateConnectionIndicator(),e==="connected"&&this._redeliverSweep()}_connectWs(e){this._disconnectWs(),this._wsState="connecting",this._updateConnectionIndicator();const t=location.protocol==="https:"?"wss:":"ws:",s=this._clientId?`${this._clientId}:${this._wsTabNonce}`:"",n=s?`?cid=${encodeURIComponent(s)}`:"",i=`${t}//${location.host}/ws/sessions/${e}/terminal${n}`,o=new WebSocket(i);this._ws=o,this._wsSessionId=e,o.onopen=()=>{this._ws===o&&(this._wsReady=!0,this._wsState="connected",this._wsReconnectAttempts=0,this._updateConnectionIndicator(),this.sendResize(e)?.catch?.(()=>{}),this._startMobileResizeRetry(e),this._onWsReady(e))},o.onmessage=a=>{if(this._ws===o){this._wsLastRecvAt=Date.now();try{const r=JSON.parse(a.data);r.t==="o"?this._onSessionTerminal({id:e,data:r.d}):r.t==="c"?this._onSessionClearTerminal({id:e}):r.t==="r"?this._onSessionNeedsRefresh({id:e}):r.t==="ia"&&this._onWsInputAck(r.seq)}catch{}}},o.onclose=a=>{if(this._ws!==o)return;this._ws=null,this._wsSessionId=null,this._wsReady=!1,this._stopMobileResizeRetry();const r=window.CodemanWsReconnect.plan(a.code,this._wsReconnectAttempts||0);_crashDiag.log(`WS CLOSE code=${a.code} reason=${a.reason||""} action=${r.action} attempts=${this._wsReconnectAttempts||0}`);const l=this.activeSessionId===e;if(r.action==="give-up")this._wsState=l?"fallback":"disconnected",this._updateConnectionIndicator();else if(r.action==="reconnect")if(l){this._wsState="reconnecting",this._updateConnectionIndicator();const c=r.delayMs+Math.floor(Math.random()*250);this._wsReconnectAttempts=(this._wsReconnectAttempts||0)+1,this._wsReconnectTimer=setTimeout(()=>{this._wsReconnectTimer=null,this.activeSessionId===e&&this._connectWs(e)},c)}else this._wsState="disconnected",this._updateConnectionIndicator();else this._wsState=l?"fallback":"disconnected",this._updateConnectionIndicator(),l&&(this._wsReconnectAttempts=(this._wsReconnectAttempts||0)+1,this._wsReconnectTimer=setTimeout(()=>{this._wsReconnectTimer=null,this.activeSessionId===e&&this._connectWs(e)},r.delayMs))},o.onerror=()=>{}}_disconnectWs(){this._clearTimer("_wsReconnectTimer"),this._wsState="disconnected",this._stopMobileResizeRetry(),this._ws&&(this._ws.onclose=null,this._ws.close(),this._ws=null,this._wsSessionId=null,this._wsReady=!1)}_startMobileResizeRetry(e){this._stopMobileResizeRetry(),(typeof MobileDetection<"u"&&MobileDetection.getDeviceType?MobileDetection.getDeviceType():"desktop")!=="desktop"&&(this._mobileResizeRetryTimer=setInterval(()=>{document.visibilityState==="visible"&&(!this._wsReady||this._wsSessionId!==e||typeof KeyboardHandler<"u"&&KeyboardHandler.keyboardVisible||this.sendResize(e)?.catch?.(()=>{}))},MOBILE_RESIZE_RETRY_MS))}_stopMobileResizeRetry(){this._mobileResizeRetryTimer&&(clearInterval(this._mobileResizeRetryTimer),this._mobileResizeRetryTimer=null)}_sendInputAsync(e,t,s){!e||!t||this._reliableSend(e,t,s?.useMux===!0)}_sendInputEphemeral(e,t){if(!(!e||!t)){if(this._ws&&this._ws.readyState===WebSocket.OPEN&&this._wsSessionId===e)try{this._ws.send(JSON.stringify({t:"i",d:t}));return}catch{}try{fetch(`/api/sessions/${e}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:t}),keepalive:!0}).catch(()=>{})}catch{}}}_reliableSend(e,t,s){const i={seq:this._nextSeq(e),data:t,useMux:!!s,ts:Date.now(),tries:0,sentAt:0};let o=this._pendingDeliveries.get(e);o||(o=[],this._pendingDeliveries.set(e,o)),o.push(i),this._persistReliableState(),this._updateConnectionIndicator(),this._drainSession(e)}_nextSeq(e){const t=(this._seqCounters.get(e)||0)+1;return this._seqCounters.set(e,t),t}_drainSession(e){const t=this._pendingDeliveries.get(e);if(!(!t||t.length===0)){if(this._ws&&this._ws.readyState===WebSocket.OPEN&&this._wsSessionId===e){for(const s of t)if(s.sentAt===0)try{this._ws.send(JSON.stringify({t:"i",d:s.data,seq:s.seq,cid:this._clientId})),s.sentAt=Date.now(),s.tries++}catch{break}return}this._postDraining.has(e)||(this._postDraining.add(e),(async()=>{try{for(;;){const s=this._pendingDeliveries.get(e);if(!s||s.length===0||this._ws&&this._ws.readyState===WebSocket.OPEN&&this._wsSessionId===e)break;const n=s[0];n.tries++,n.sentAt=Date.now();let i=null;try{const o={input:n.data,seq:n.seq,clientId:this._clientId};n.useMux&&(o.useMux=!0),i=await fetch(`/api/sessions/${e}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),keepalive:n.data.length<65536})}catch{i=null}if(i&&i.ok)this._ackDelivery(e,n.seq);else if(i&&(i.status===404||i.status===410))this._ackDelivery(e,n.seq);else break}}finally{this._postDraining.delete(e)}})())}}_ackDelivery(e,t){const s=this._pendingDeliveries.get(e);if(s){const n=s.findIndex(i=>i.seq===t);n!==-1&&(s.splice(n,1),s.length===0&&this._pendingDeliveries.delete(e),this._pendingDeliveries.size===0?this._persistReliableNow():this._persistReliableState(),this._updateConnectionIndicator())}this.clearPendingHooks?.(e)}_onWsInputAck(e){this._wsSessionId&&Number.isInteger(e)&&this._ackDelivery(this._wsSessionId,e)}_onWsReady(e){const t=this._pendingDeliveries.get(e);if(t)for(const s of t)s.sentAt=0;this._drainSession(e)}_redeliverSweep(){if(this._pendingDeliveries.size!==0)for(const e of[...this._pendingDeliveries.keys()]){const t=this._pendingDeliveries.get(e);if(!t||t.length===0)continue;if(this._ws&&this._ws.readyState===WebSocket.OPEN&&this._wsSessionId===e){const n=t[0],i=n&&n.sentAt&&Date.now()-n.sentAt>this._reliableAckTimeoutMs,o=Date.now()-this._wsLastRecvAt>this._reliableAckTimeoutMs;if(i&&o){try{this._ws.close()}catch{}continue}if(i)for(const a of t)a.sentAt&&Date.now()-a.sentAt>this._reliableAckTimeoutMs&&(a.sentAt=0)}this._drainSession(e)}}_pendingBytes(){let e=0,t=0;for(const s of this._pendingDeliveries.values())for(const n of s)e+=n.data.length,t++;return{bytes:e,count:t}}_loadReliableState(){try{this._clientId=localStorage.getItem("codeman:clientId")||""}catch{this._clientId=""}if(!this._clientId){this._clientId="c-"+Math.random().toString(36).slice(2)+"-"+Date.now().toString(36);try{localStorage.setItem("codeman:clientId",this._clientId)}catch{}}try{const e=localStorage.getItem("codeman:pendingInput");if(!e)return;const t=JSON.parse(e);if(t&&t.seqs)for(const[s,n]of Object.entries(t.seqs))Number.isFinite(n)&&this._seqCounters.set(s,n);if(t&&t.pending)for(const[s,n]of Object.entries(t.pending))Array.isArray(n)&&n.length&&this._pendingDeliveries.set(s,n.filter(i=>i&&typeof i.data=="string"&&Number.isInteger(i.seq)).map(i=>({seq:i.seq,data:i.data,useMux:!!i.useMux,ts:i.ts||Date.now(),tries:0,sentAt:0})))}catch{}}_persistReliableState(){this._persistReliableTimer||(this._persistReliableTimer=setTimeout(()=>{this._persistReliableTimer=null,this._persistReliableNow()},250))}_persistReliableNow(){this._persistReliableTimer&&(clearTimeout(this._persistReliableTimer),this._persistReliableTimer=null);try{const e={};for(const[i,o]of this._seqCounters)e[i]=o;const t={};let s=0;for(const[i,o]of this._pendingDeliveries)if(o.length){t[i]=o.map(a=>({seq:a.seq,data:a.data,useMux:a.useMux,ts:a.ts,tries:a.tries}));for(const a of o)s+=a.data.length}const n=s>this._reliableMaxBytes?{seqs:e}:{seqs:e,pending:t};localStorage.setItem("codeman:pendingInput",JSON.stringify(n))}catch{}}_computeConnectionDescriptor(){const{bytes:e,count:t}=this._pendingBytes(),s=t>0,i=e>4,o=r=>r<1024?`${r}B`:`${(r/1024).toFixed(1)}KB`,a=i?` \xB7 ${o(e)} queued`:"";if(!this.isOnline||this._connectionStatus==="offline")return{display:"flex",dotClass:"connection-dot offline",text:i?`Offline (${o(e)} queued)`:"Offline",title:"No network connection"};if(this.activeSessionId){let r,l,c;switch(this._wsState){case"connected":r="connected",l="WS",c="Terminal connected over WebSocket";break;case"fallback":r="fallback",l="HTTP",c="WebSocket unavailable \u2014 input sent over HTTP";break;case"reconnecting":r="reconnecting",l="WS\u2026",c="Reconnecting WebSocket";break;default:r="reconnecting",l="WS\u2026",c="Connecting WebSocket";break}return{display:"flex",dotClass:`connection-dot ${r}`,text:`${l}${a}`,title:c}}return this._connectionStatus==="reconnecting"||this._connectionStatus==="disconnected"?{display:"flex",dotClass:"connection-dot reconnecting",text:i?`Reconnecting (${o(e)} queued)`:"Reconnecting...",title:"Reconnecting to server"}:s?{display:"flex",dotClass:"connection-dot draining",text:i?`Sending ${o(e)}...`:"Sending...",title:"Delivering queued input"}:{display:"none",dotClass:"",text:"",title:""}}_updateConnectionIndicator(){const e=this.$("connectionIndicator"),t=this.$("connectionDot"),s=this.$("connectionText");if(!e||!t||!s)return;const n=this._computeConnectionDescriptor(),i=this._lastIndicatorDescriptor;i&&i.display===n.display&&i.dotClass===n.dotClass&&i.text===n.text&&i.title===n.title||(this._lastIndicatorDescriptor=n,e.style.display=n.display,n.display!=="none"&&(t.className=n.dotClass,s.textContent=n.text,e.title=n.title))}setupOnlineDetection(){window.addEventListener("online",()=>{this.isOnline=!0,this.reconnectAttempts=0,this.connectSSE(),this._redeliverSweep()}),window.addEventListener("offline",()=>{this.isOnline=!1,this.setConnectionStatus("offline")})}_updateCjkInputState(){const e=document.getElementById("cjkInput");if(!e)return;const t=this.loadAppSettingsFromStorage(),s=this.getDefaultSettings?.()||{},i=(this._serverCjkOverride||(t.cjkInputEnabled??s.cjkInputEnabled??!1))&&!!this.activeSessionId;e.classList.toggle("cjk-input-visible",!!i),document.body.classList.toggle("cjk-input-visible",!!i),e.style.display=i?"block":"none",e.setAttribute("aria-hidden",i?"false":"true"),i||(window.cjkActive=!1),typeof KeyboardHandler<"u"&&KeyboardHandler.updateLayoutForKeyboard()}_resetAllAppState(){this.sessions.clear(),this.ralphStates.clear(),this.terminalBuffers.clear(),this.terminalBufferCache.clear(),this._xtermSnapshots?.clear(),this.projectInsights.clear(),this.teams.clear(),this.teamTasks.clear();for(const e of this.idleTimers.values())clearTimeout(e);if(this.idleTimers.clear(),this._clearTimer("flickerFilterTimeout"),this.flickerFilterBuffer="",this.flickerFilterActive=!1,this._clearTimer("syncWaitTimeout"),this.pendingWrites=[],this.writeFrameScheduled=!1,this._isLoadingBuffer=!1,this._loadBufferQueue=null,this._bufferLoadOwner=null,this._chunkedWriteGen=(this._chunkedWriteGen||0)+1,this._localEchoOverlay?.rerender(),this.pendingHooks.clear(),this._parentNameCache&&this._parentNameCache.clear(),this.subagentActivity.clear(),this.subagentToolResults.clear(),this.workflowRuns&&this.workflowRuns.clear(),this.workflowRunDetails&&this.workflowRunDetails.clear(),this.activeWorkflowRunId=null,this.activeWorkflowPhaseIndex=null,MobileDetection.cleanup(),KeyboardHandler.cleanup(),MobileDetection.init(),KeyboardHandler.init(),this.tabAlerts.clear(),this.attachmentHistoryCounts.clear(),this._shownCompletions&&this._shownCompletions.clear(),this.notificationManager?.titleFlashInterval&&(clearInterval(this.notificationManager.titleFlashInterval),this.notificationManager.titleFlashInterval=null),this.notificationManager?.groupingMap){for(const{timeout:e}of this.notificationManager.groupingMap.values())clearTimeout(e);this.notificationManager.groupingMap.clear()}this.terminalResizeObserver&&(this.terminalResizeObserver.disconnect(),this.terminalResizeObserver=null),this.planLoadingTimer&&(clearInterval(this.planLoadingTimer),this.planLoadingTimer=null),this.timerCountdownInterval&&(clearInterval(this.timerCountdownInterval),this.timerCountdownInterval=null),this.runSummaryAutoRefreshTimer&&(clearInterval(this.runSummaryAutoRefreshTimer),this.runSummaryAutoRefreshTimer=null)}handleInit(e){this._clearTimer("_initFallbackTimer");const t=++this._initGeneration;if(this._serverCjkOverride=e.inputCjkForm||!1,this._updateCjkInputState(),e.planUsage&&this.updatePlanUsageChip(e.planUsage),e.version){const i=this.$("versionDisplay"),o=this.$("headerVersion");i&&(i.textContent=`v${e.version}`,i.title=`Codeman v${e.version}`),o&&(o.textContent=`v${e.version}`,o.title=`Codeman v${e.version}`)}VoiceInput.cleanup(),this._resetAllAppState(),e.sessions.forEach(i=>{this.sessions.set(i.id,i),(i.ralphLoop||i.ralphTodos)&&!this.ralphClosedSessions.has(i.id)&&this.ralphStates.set(i.id,{loop:i.ralphLoop||null,todos:i.ralphTodos||[]})});try{localStorage.removeItem("codeman-tab-meta")}catch{}if(Array.isArray(e.sessionOrder)&&e.sessionOrder.length)try{localStorage.setItem("codeman-session-order",JSON.stringify(e.sessionOrder))}catch{}this.syncSessionOrder(),e.respawnStatus?this.respawnStatus=e.respawnStatus:this.respawnStatus={},this.respawnTimers={},this.respawnCountdownTimers={},this.respawnActionLogs={},e.globalStats&&(this.globalStats=e.globalStats),this.totalCost=e.sessions.reduce((i,o)=>i+(o.totalCost||0),0),this.totalCost+=e.scheduledRuns.reduce((i,o)=>i+(o.totalCost||0),0);const s=e.scheduledRuns.find(i=>i.status==="running");if(s&&(this.currentRun=s,this.showTimer()),this.updateCost(),this.renderSessionTabs(),this.sessions.size>0?this.startSystemStatsPolling():this.stopSystemStatsPolling(),this.cleanupAllFloatingWindows(),e.subagents&&(this.subagents.clear(),this.subagentActivity.clear(),this.subagentToolResults.clear(),e.subagents.forEach(i=>{this.subagents.set(i.agentId,i)}),this.renderSubagentPanel(),this.subagentParentMap.clear(),this.loadSubagentParentMap().then(()=>{for(const[i,o]of this.subagentParentMap){const a=this.subagents.get(i);if(a&&this.sessions.has(o)){a.parentSessionId=o;const r=this.sessions.get(o);r&&(a.parentSessionName=this.getSessionName(r)),this.subagents.set(i,a)}}for(const[i]of this.subagents)this.subagentParentMap.has(i)||this.findParentSessionForSubagent(i);this.restoreSubagentWindowStates()})),e.workflowRuns&&this.seedWorkflowRuns(e.workflowRuns),t!==this._initGeneration)return;if(this.isSoloWindow){this._applySoloMode();return}const n=this.activeSessionId;if(this.activeSessionId=null,this.sessionOrder.length>0){let i=n;if(!i||!this.sessions.has(i))try{i=localStorage.getItem("codeman-active-session")}catch{}i&&this.sessions.has(i)?this.selectSession(i):this.selectSession(this.sessionOrder[0])}}async loadState(){try{const t=await(await fetch("/api/status")).json();this.handleInit(t?.data??{})}catch(e){console.error("Failed to load state:",e)}}_debouncedCall(e,t,s=100){this._debounceTimers[e]&&clearTimeout(this._debounceTimers[e]),this._debounceTimers[e]=setTimeout(()=>{this._debounceTimers[e]=null,t.call(this)},s)}renderSessionTabs(){this._inlineRenameActive||this._debouncedCall("sessionTabs",this._renderSessionTabsImmediate)}_updateActiveTabImmediate(e){const t=this.$("sessionTabs");if(!t)return;const s=t.querySelectorAll(".session-tab[data-id]");for(const n of s)n.dataset.id===e?n.classList.add("active"):n.classList.remove("active")}_setTerminalLoadState(e,t,s){this.terminalLoadStates.set(e,{generation:t,phase:s}),this._updateTerminalLoadTab(e)}_clearTerminalLoadState(e,t){const s=this.terminalLoadStates.get(e);s&&s.generation!==t||(this.terminalLoadStates.delete(e),this._updateTerminalLoadTab(e))}_updateTerminalLoadTab(e){const t=this.$("sessionTabs")?.querySelector(`.session-tab[data-id="${e}"]`);if(!t)return;const s=this.terminalLoadStates.get(e);if(t.classList.toggle("tab-loading",!!s),s){if(t.setAttribute("aria-busy","true"),t.dataset.loadPhase=s.phase,!t.querySelector(".tab-load-spinner")){const n=document.createElement("span");n.className="tab-load-spinner",n.setAttribute("aria-hidden","true");const i=t.querySelector(".tab-number");i?i.insertAdjacentElement("afterend",n):t.insertBefore(n,t.firstChild)}}else t.setAttribute("aria-busy","false"),delete t.dataset.loadPhase,t.querySelector(".tab-load-spinner")?.remove()}_renderSessionTabsImmediate(){const e=this.$("sessionTabs"),t=e.querySelectorAll(".session-tab[data-id]"),s=new Set([...t].map(o=>o.dataset.id)),n=new Set(this.sessions.keys());if(s.size===n.size&&[...s].every(o=>n.has(o)))for(const[o,a]of this.sessions){const r=e.querySelector(`.session-tab[data-id="${o}"]`);if(!r)continue;const l=o===this.activeSessionId,c=a.status||"idle",u=this.getSessionName(a),h=a.taskStats||{running:0,total:0},p=h.running>0,_=this.terminalLoadStates.get(o);if(l&&!r.classList.contains("active")?r.classList.add("active"):!l&&r.classList.contains("active")&&r.classList.remove("active"),r.classList.toggle("tab-loading",!!_),_){if(r.setAttribute("aria-busy","true"),r.dataset.loadPhase=_.phase,!r.querySelector(".tab-load-spinner")){const f=document.createElement("span");f.className="tab-load-spinner",f.setAttribute("aria-hidden","true");const g=r.querySelector(".tab-number");g?g.insertAdjacentElement("afterend",f):r.insertBefore(f,r.firstChild)}}else r.setAttribute("aria-busy","false"),delete r.dataset.loadPhase,r.querySelector(".tab-load-spinner")?.remove();const w=this.tabAlerts.get(o),b=w==="action",C=w==="idle",A=r.classList.contains("tab-alert-action"),R=r.classList.contains("tab-alert-idle");if(b&&!A?(r.classList.add("tab-alert-action"),r.classList.remove("tab-alert-idle")):C&&!R?(r.classList.add("tab-alert-idle"),r.classList.remove("tab-alert-action")):!w&&(A||R)&&r.classList.remove("tab-alert-action","tab-alert-idle"),!r.querySelector(".tab-number")){const f=this.sessionOrder.indexOf(o);if(f>=0&&f<9){const g=document.createElement("span");g.className="tab-number",g.textContent=String(f+1),r.insertBefore(g,r.firstChild)}}const E=r.querySelector(".tab-status");E&&!E.classList.contains(c)&&(E.className=`tab-status ${c}`);const y=r.querySelector(".tab-name");if(y&&y.textContent!==u){const f=parseSessionPrefix(u);f&&f.suffix?y.innerHTML='<span class="tab-prefix">'+escapeHtml(f.prefix)+'</span><span class="tab-suffix">: '+escapeHtml(f.suffix)+"</span>":y.textContent=u}const S=r.querySelector(".tab-badge");if(p)if(S)S.textContent!==String(h.running)&&(S.textContent=h.running);else{this._fullRenderSessionTabs();return}else if(S){this._fullRenderSessionTabs();return}const m=r.querySelector(".tab-subagent-badge"),v=this.minimizedSubagents.get(o),T=v?.size||0;if(T>0&&m){const f=m.querySelector(".subagent-label"),g=T===1?"AGENT":`AGENTS (${T})`;f&&f.textContent!==g&&(f.textContent=g);const O=m.querySelector(".subagent-dropdown");if(O){const N=this.renderSubagentTabBadge(o,v),k=document.createElement("div");k.innerHTML=N;const L=k.querySelector(".subagent-dropdown");L&&(O.innerHTML=L.innerHTML)}}else if(T>0&&!m){const f=this.renderSubagentTabBadge(o,v),g=r.querySelector(".tab-gear");g&&g.insertAdjacentHTML("beforebegin",f)}else T===0&&m&&m.remove()}else this._fullRenderSessionTabs();this.updateTabOverflowMode()}updateTabOverflowMode(){const e=this.$("sessionTabs");if(!e)return;const t=MobileDetection.getDeviceType(),s=this.loadAppSettingsFromStorage(),n=this.getDefaultSettings(),i=t==="desktop"?s.tabTwoRows??n.tabTwoRows??!1:!1;if(i||t!=="desktop"){e.classList.remove("tabs-auto-wrap");return}e.classList.remove("tabs-auto-wrap");const o=window.CodemanTabOverflow?.shouldAutoWrapTabs?window.CodemanTabOverflow.shouldAutoWrapTabs({deviceType:t,manualTwoRows:i,tabCount:this.sessions.size,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth}):e.scrollWidth>e.clientWidth+1;e.classList.toggle("tabs-auto-wrap",o)}_fullRenderSessionTabs(){if(this._inlineRenameActive)return;const e=this.$("sessionTabs");document.querySelectorAll("body > .subagent-dropdown").forEach(i=>i.remove()),this.cancelHideSubagentDropdown();const t=[];let s=this.sessionOrder;MobileDetection.getDeviceType()==="mobile"&&this.activeSessionId&&(s=[this.activeSessionId,...this.sessionOrder.filter(i=>i!==this.activeSessionId)]);let n=0;for(const i of s){const o=this.sessions.get(i);if(!o)continue;const a=i===this.activeSessionId,r=o.status||"idle",l=this.getSessionName(o),c=o.mode||"claude",u=o.color||"default",h=o.taskStats||{running:0,total:0},p=h.running>0,_=this.tabAlerts.get(i),w=_==="action"?" tab-alert-action":_==="idle"?" tab-alert-idle":"",b=this.terminalLoadStates.get(i),C=this.minimizedSubagents.get(i),R=(C?.size||0)>0?this.renderSubagentTabBadge(i,C):"",E=this.renderUltracodeTabBadge?this.renderUltracodeTabBadge(i):"",y=o.workingDir&&o.workingDir.split("/").pop()||"",m=(this._tallTabsEnabled??!1)&&o.name&&y&&y!==l;t.push(`<div class="session-tab ${a?"active":""}${w}${b?" tab-loading":""}" data-id="${i}" data-color="${u}" ${b?`data-load-phase="${escapeHtml(b.phase)}"`:""} onclick="app.handleSessionTabClick(event, ${escapeHtml(JSON.stringify(i))})" oncontextmenu="event.preventDefault(); app.startInlineRename(${escapeHtml(JSON.stringify(i))})" tabindex="0" role="tab" aria-selected="${a?"true":"false"}" aria-busy="${b?"true":"false"}" aria-label="${escapeHtml(l)} session" ${o.workingDir?`title="${escapeHtml(o.workingDir)}"`:""}>
|
|
17
17
|
${n<9?'<span class="tab-number">'+(n+1)+"</span>":""}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(function(s){"use strict";const d="Codeman",R=new Set(["en","zh-CN"]),C=["title","aria-label","placeholder"],x=["[data-i18n-skip]",".xterm",".terminal-container",".terminal-output",".response-content",".response-viewer-content",".file-preview-content",".session-tab-name",".session-name",".case-name",".notif-item-message","pre","code","script","style","textarea"].join(","),D=[".history-item-title",".history-item-subtitle",".history-detail-prompt",".history-detail-path",".folder-history-subtitle"].join(","),m=Object.freeze({"Skip to terminal":"\u8DF3\u8F6C\u5230\u7EC8\u7AEF","Go to main page":"\u8FD4\u56DE\u4E3B\u9875","Session tabs":"\u4F1A\u8BDD\u6807\u7B7E\u9875","Admin Panel":"\u7BA1\u7406\u9762\u677F","Open admin panel":"\u6253\u5F00\u7BA1\u7406\u9762\u677F","Re-dock to dashboard (close window)":"\u91CD\u65B0\u505C\u9760\u5230\u4E3B\u754C\u9762\uFF08\u5173\u95ED\u7A97\u53E3\uFF09","Tunnel status":"\u96A7\u9053\u72B6\u6001","Decrease font size":"\u51CF\u5C0F\u5B57\u4F53","Increase font size":"\u589E\u5927\u5B57\u4F53","Current font size":"\u5F53\u524D\u5B57\u4F53\u5927\u5C0F","System resource usage":"\u7CFB\u7EDF\u8D44\u6E90\u4F7F\u7528\u60C5\u51B5","Redraw terminal":"\u91CD\u7ED8\u7EC8\u7AEF","Redraw terminal to fit current screen (Ctrl+Shift+R)":"\u91CD\u7ED8\u7EC8\u7AEF\u4EE5\u9002\u5E94\u5F53\u524D\u5C4F\u5E55\uFF08Ctrl+Shift+R\uFF09","View last response":"\u67E5\u770B\u6700\u8FD1\u4E00\u6B21\u56DE\u590D","Away Digest":"\u79BB\u5F00\u671F\u95F4\u6458\u8981","Open away digest":"\u6253\u5F00\u79BB\u5F00\u671F\u95F4\u6458\u8981","Session Manager":"\u4F1A\u8BDD\u7BA1\u7406\u5668","Session actions":"\u4F1A\u8BDD\u64CD\u4F5C","Open session manager":"\u6253\u5F00\u4F1A\u8BDD\u7BA1\u7406\u5668",Attachments:"\u9644\u4EF6","Open attachment history":"\u6253\u5F00\u9644\u4EF6\u5386\u53F2","File Viewer":"\u6587\u4EF6\u67E5\u770B\u5668","Open file viewer":"\u6253\u5F00\u6587\u4EF6\u67E5\u770B\u5668","Open Codeman across all displays":"\u5728\u6240\u6709\u663E\u793A\u5668\u4E0A\u6253\u5F00 {name}","Ultracode / Workflow agents":"Ultracode / Workflow \u667A\u80FD\u4F53","Open ultracode workflow agents":"\u6253\u5F00 Ultracode \u5DE5\u4F5C\u6D41\u667A\u80FD\u4F53",Notifications:"\u901A\u77E5","Toggle notifications":"\u5207\u6362\u901A\u77E5\u9762\u677F","Session Lifecycle Log":"\u4F1A\u8BDD\u751F\u547D\u5468\u671F\u65E5\u5FD7","Open session lifecycle log":"\u6253\u5F00\u4F1A\u8BDD\u751F\u547D\u5468\u671F\u65E5\u5FD7","App Settings":"\u5E94\u7528\u8BBE\u7F6E","Open app settings":"\u6253\u5F00\u5E94\u7528\u8BBE\u7F6E","Total tokens across all sessions":"\u6240\u6709\u4F1A\u8BDD\u7684 Token \u603B\u6570","Token usage across active sessions":"\u6D3B\u52A8\u4F1A\u8BDD\u7684 Token \u4F7F\u7528\u91CF","Instance count":"\u5B9E\u4F8B\u6570\u91CF","No response yet":"\u6682\u65E0\u56DE\u590D","No response yet \u2014 send a message in this session first.":"\u6682\u65E0\u56DE\u590D\uFF0C\u8BF7\u5148\u5728\u6B64\u4F1A\u8BDD\u4E2D\u53D1\u9001\u4E00\u6761\u6D88\u606F\u3002","Last Response":"\u6700\u8FD1\u4E00\u6B21\u56DE\u590D",More:"\u66F4\u591A","Codeman version":"{name}\u7248\u672C",Stop:"\u505C\u6B62",Watching:"\u76D1\u89C6\u4E2D",Orchestrator:"\u7F16\u6392\u5668",Close:"\u5173\u95ED","Close window":"\u5173\u95ED\u7A97\u53E3","Session unavailable":"\u4F1A\u8BDD\u4E0D\u53EF\u7528","This session has ended or is no longer available.":"\u6B64\u4F1A\u8BDD\u5DF2\u7ED3\u675F\u6216\u4E0D\u518D\u53EF\u7528\u3002","Manage AI Coding tools in persistent tmux sessions.":"\u5728\u6301\u4E45\u5316 tmux \u4F1A\u8BDD\u4E2D\u7BA1\u7406 AI \u7F16\u7A0B\u5DE5\u5177\u3002","Select case":"\u9009\u62E9\u6848\u4F8B","Select Case":"\u9009\u62E9\u6848\u4F8B","All cases":"\u5168\u90E8\u6848\u4F8B","No directory":"\u672A\u9009\u62E9\u76EE\u5F55",Run:"\u8FD0\u884C","Run Claude Code":"\u8FD0\u884C Claude Code","Run OpenCode":"\u8FD0\u884C OpenCode","Run Gemini":"\u8FD0\u884C Gemini","Run Shell":"\u8FD0\u884C Shell","Select AI backend":"\u9009\u62E9 AI \u540E\u7AEF","Create New Case":"\u65B0\u5EFA\u6848\u4F8B","Create new case":"\u65B0\u5EFA\u6848\u4F8B","Link Existing":"\u5173\u8054\u73B0\u6709\u76EE\u5F55","Add Case":"\u6DFB\u52A0\u6848\u4F8B","Open sessions":"\u6253\u5F00\u4F1A\u8BDD","Recent Sessions":"\u6700\u8FD1\u4F1A\u8BDD","Search sessions by name, prompt, or path\u2026":"\u6309\u540D\u79F0\u3001\u63D0\u793A\u8BCD\u6216\u8DEF\u5F84\u641C\u7D22\u4F1A\u8BDD\u2026","Search open sessions or start a new one":"\u641C\u7D22\u5DF2\u6253\u5F00\u4F1A\u8BDD\u6216\u542F\u52A8\u65B0\u4F1A\u8BDD","Find Open Session":"\u67E5\u627E\u5DF2\u6253\u5F00\u4F1A\u8BDD","No background agents":"\u6CA1\u6709\u540E\u53F0\u667A\u80FD\u4F53","No background agents detected":"\u672A\u68C0\u6D4B\u5230\u540E\u53F0\u667A\u80FD\u4F53","No notifications":"\u6CA1\u6709\u901A\u77E5","No mux sessions":"\u6CA1\u6709 mux \u4F1A\u8BDD","No lifecycle entries found":"\u672A\u627E\u5230\u751F\u547D\u5468\u671F\u8BB0\u5F55","No ultracode runs detected":"\u672A\u68C0\u6D4B\u5230 Ultracode \u8FD0\u884C",Display:"\u663E\u793A","Claude CLI":"Claude CLI","Codex CLI":"Codex CLI",Models:"\u6A21\u578B",Shortcuts:"\u5FEB\u6377\u952E",Voice:"\u8BED\u97F3",Save:"\u4FDD\u5B58",Cancel:"\u53D6\u6D88",Apply:"\u5E94\u7528",Create:"\u521B\u5EFA",Add:"\u6DFB\u52A0",Delete:"\u5220\u9664",Remove:"\u79FB\u9664",Edit:"\u7F16\u8F91",Refresh:"\u5237\u65B0",Back:"\u8FD4\u56DE",Next:"\u4E0B\u4E00\u6B65",Previous:"\u4E0A\u4E00\u6B65",Clear:"\u6E05\u9664","Clear all":"\u5168\u90E8\u6E05\u9664","Clear All":"\u5168\u90E8\u6E05\u9664",Search:"\u641C\u7D22",Filter:"\u7B5B\u9009",Enable:"\u542F\u7528",Enabled:"\u5DF2\u542F\u7528",Disabled:"\u5DF2\u7981\u7528",Active:"\u6D3B\u52A8","Not active":"\u672A\u6D3B\u52A8",On:"\u5F00",Off:"\u5173",Yes:"\u662F",No:"\u5426",Optional:"\u53EF\u9009",Default:"\u9ED8\u8BA4",Custom:"\u81EA\u5B9A\u4E49",Name:"\u540D\u79F0",Description:"\u63CF\u8FF0",Status:"\u72B6\u6001",Reason:"\u539F\u56E0",Time:"\u65F6\u95F4",Event:"\u4E8B\u4EF6",Events:"\u4E8B\u4EF6",Session:"\u4F1A\u8BDD",Sessions:"\u4F1A\u8BDD",Files:"\u6587\u4EF6",History:"\u5386\u53F2",Summary:"\u6458\u8981",Details:"\u8BE6\u60C5",Options:"\u9009\u9879",Settings:"\u8BBE\u7F6E",Help:"\u5E2E\u52A9",Loading:"\u6B63\u5728\u52A0\u8F7D",Error:"\u9519\u8BEF",Errors:"\u9519\u8BEF",Warning:"\u8B66\u544A",Warnings:"\u8B66\u544A",Info:"\u4FE1\u606F",Complete:"\u5B8C\u6210",Completed:"\u5DF2\u5B8C\u6210",Stopped:"\u5DF2\u505C\u6B62",Running:"\u8FD0\u884C\u4E2D",Idle:"\u7A7A\u95F2",Working:"\u5DE5\u4F5C\u4E2D",Today:"\u4ECA\u5929",Home:"\u4E3B\u9875",Local:"\u672C\u5730",Remote:"\u8FDC\u7A0B",Docker:"Docker",Terminal:"\u7EC8\u7AEF",Prompt:"\u63D0\u793A\u8BCD",Source:"\u6765\u6E90",Type:"\u7C7B\u578B",Language:"\u8BED\u8A00","Branding & Language":"\u54C1\u724C\u4E0E\u8BED\u8A00","Display Name":"\u663E\u793A\u540D\u79F0","Interface Language":"\u754C\u9762\u8BED\u8A00","Name shown in the browser UI and window title. Supports Unicode, including Chinese.":"\u663E\u793A\u5728\u6D4F\u89C8\u5668\u754C\u9762\u548C\u7A97\u53E3\u6807\u9898\u4E2D\u7684\u540D\u79F0\u3002\u652F\u6301 Unicode\uFF0C\u5305\u62EC\u4E2D\u6587\u3002","Language for this device. Dynamic status messages and dialogs use the same language.":"\u6B64\u8BBE\u5907\u4F7F\u7528\u7684\u754C\u9762\u8BED\u8A00\u3002\u52A8\u6001\u72B6\u6001\u6D88\u606F\u4E0E\u5BF9\u8BDD\u6846\u4E5F\u4F1A\u4F7F\u7528\u540C\u4E00\u8BED\u8A00\u3002",English:"English",Appearance:"\u5916\u89C2",Skin:"\u76AE\u80A4","Visual theme for this device (not synced)":"\u6B64\u8BBE\u5907\u7684\u89C6\u89C9\u4E3B\u9898\uFF08\u4E0D\u540C\u6B65\uFF09","Daylight Blue":"\u65E5\u5149\u84DD","Daylight Green":"\u65E5\u5149\u7EFF","OG Codeman":"\u7ECF\u5178 {name}",Performance:"\u6027\u80FD","WebGL Renderer":"WebGL \u6E32\u67D3\u5668","Header Displays":"\u9876\u90E8\u680F\u663E\u793A","Font Controls":"\u5B57\u4F53\u63A7\u5236","System Stats":"\u7CFB\u7EDF\u72B6\u6001","Lifecycle Log":"\u751F\u547D\u5468\u671F\u65E5\u5FD7","Response Viewer":"\u56DE\u590D\u67E5\u770B\u5668","Attachments Button":"\u9644\u4EF6\u6309\u94AE","Multi-monitor Button":"\u591A\u663E\u793A\u5668\u6309\u94AE","Session Manager Button":"\u4F1A\u8BDD\u7BA1\u7406\u5668\u6309\u94AE","Away Digest Button":"\u79BB\u5F00\u671F\u95F4\u6458\u8981\u6309\u94AE","Cron Button":"\u5B9A\u65F6\u4EFB\u52A1\u6309\u94AE","Redraw Terminal Button":"\u91CD\u7ED8\u7EC8\u7AEF\u6309\u94AE","Tab Bar":"\u6807\u7B7E\u680F","Tall Tabs (Name + Folder)":"\u53CC\u884C\u6807\u7B7E\uFF08\u540D\u79F0 + \u6587\u4EF6\u5939\uFF09",Panels:"\u9762\u677F",Monitor:"\u76D1\u89C6\u5668","Project Insights":"\u9879\u76EE\u6D1E\u5BDF","File Browser":"\u6587\u4EF6\u6D4F\u89C8\u5668",Subagents:"\u5B50\u667A\u80FD\u4F53","Ultracode Agents":"Ultracode \u667A\u80FD\u4F53","Ultracode Floating Windows":"Ultracode \u6D6E\u52A8\u7A97\u53E3","Subagent Options":"\u5B50\u667A\u80FD\u4F53\u9009\u9879","Enable Tracking":"\u542F\u7528\u8DDF\u8E2A","Active Tab Only":"\u4EC5\u6D3B\u52A8\u6807\u7B7E\u9875","Image Watcher":"\u56FE\u50CF\u76D1\u89C6\u5668","Enable Globally":"\u5168\u5C40\u542F\u7528","Remote Access":"\u8FDC\u7A0B\u8BBF\u95EE","Cloudflare Tunnel":"Cloudflare \u96A7\u9053","Tunnel URL":"\u96A7\u9053\u5730\u5740","Upload URL":"\u4E0A\u4F20\u5730\u5740",Updates:"\u66F4\u65B0","Current Version":"\u5F53\u524D\u7248\u672C","Check for Updates":"\u68C0\u67E5\u66F4\u65B0","Check now":"\u7ACB\u5373\u68C0\u67E5","Update available":"\u6709\u53EF\u7528\u66F4\u65B0","Update now":"\u7ACB\u5373\u66F4\u65B0","Show CPU and memory usage in header":"\u5728\u9876\u90E8\u680F\u663E\u793A CPU \u4E0E\u5185\u5B58\u4F7F\u7528\u60C5\u51B5","Show session lifecycle log button in header":"\u5728\u9876\u90E8\u680F\u663E\u793A\u4F1A\u8BDD\u751F\u547D\u5468\u671F\u65E5\u5FD7\u6309\u94AE","Show the response viewer (eye) button in header":"\u5728\u9876\u90E8\u680F\u663E\u793A\u56DE\u590D\u67E5\u770B\u5668\uFF08\u773C\u775B\uFF09\u6309\u94AE","Show the file viewer button in header (opens the file browser panel for the active session)":"\u5728\u9876\u90E8\u680F\u663E\u793A\u6587\u4EF6\u67E5\u770B\u5668\u6309\u94AE\uFF08\u6253\u5F00\u5F53\u524D\u4F1A\u8BDD\u7684\u6587\u4EF6\u6D4F\u89C8\u5668\u9762\u677F\uFF09","Show the attachments button in header (opens the attachment history drawer)":"\u5728\u9876\u90E8\u680F\u663E\u793A\u9644\u4EF6\u6309\u94AE\uFF08\u6253\u5F00\u9644\u4EF6\u5386\u53F2\u62BD\u5C49\uFF09","Show the multi-monitor button in the header (opens Codeman spanned across all displays)":"\u5728\u9876\u90E8\u680F\u663E\u793A\u591A\u663E\u793A\u5668\u6309\u94AE\uFF08\u8DE8\u6240\u6709\u663E\u793A\u5668\u6253\u5F00 {name}\uFF09","Show the session manager button in the header (opens the session manager \u2014 sessions also stay reachable via the Ctrl+K palette)":"\u5728\u9876\u90E8\u680F\u663E\u793A\u4F1A\u8BDD\u7BA1\u7406\u5668\u6309\u94AE\uFF08\u4E5F\u53EF\u901A\u8FC7 Ctrl+K \u9762\u677F\u8BBF\u95EE\u4F1A\u8BDD\uFF09","Show the away digest button in the header (opens the 'what happened while you were away' summary)":"\u5728\u9876\u90E8\u680F\u663E\u793A\u79BB\u5F00\u671F\u95F4\u6458\u8981\u6309\u94AE","Show the Cron button in the footer toolbar (opens the cron jobs manager)":"\u5728\u5E95\u90E8\u5DE5\u5177\u680F\u663E\u793A\u5B9A\u65F6\u4EFB\u52A1\u6309\u94AE","Show a terminal redraw button in the header \u2014 refit the terminal to the current screen size (useful when switching between devices)":"\u5728\u9876\u90E8\u680F\u663E\u793A\u7EC8\u7AEF\u91CD\u7ED8\u6309\u94AE\uFF0C\u4EE5\u91CD\u65B0\u9002\u914D\u5F53\u524D\u5C4F\u5E55\u5927\u5C0F","Show folder path below tab name and allow tab bar to wrap into multiple rows":"\u5728\u6807\u7B7E\u540D\u79F0\u4E0B\u663E\u793A\u6587\u4EF6\u5939\u8DEF\u5F84\uFF0C\u5E76\u5141\u8BB8\u6807\u7B7E\u680F\u6362\u884C","Show Monitor panel at bottom right":"\u5728\u53F3\u4E0B\u89D2\u663E\u793A\u76D1\u89C6\u5668\u9762\u677F","Show active tools and file viewers in a floating panel":"\u5728\u6D6E\u52A8\u9762\u677F\u4E2D\u663E\u793A\u6D3B\u52A8\u5DE5\u5177\u4E0E\u6587\u4EF6\u67E5\u770B\u5668","Show file browser panel on the right side":"\u5728\u53F3\u4FA7\u663E\u793A\u6587\u4EF6\u6D4F\u89C8\u5668\u9762\u677F","Show the Subagents panel (independent from Monitor)":"\u663E\u793A\u5B50\u667A\u80FD\u4F53\u9762\u677F\uFF08\u72EC\u7ACB\u4E8E\u76D1\u89C6\u5668\uFF09","Monitor Claude Code background agents in real-time":"\u5B9E\u65F6\u76D1\u89C6 Claude Code \u540E\u53F0\u667A\u80FD\u4F53","Only show subagent windows when their parent tab is selected":"\u4EC5\u5728\u9009\u4E2D\u7236\u6807\u7B7E\u9875\u65F6\u663E\u793A\u5B50\u667A\u80FD\u4F53\u7A97\u53E3","Automatically detect and popup new images in session directories":"\u81EA\u52A8\u68C0\u6D4B\u5E76\u5F39\u51FA\u4F1A\u8BDD\u76EE\u5F55\u4E2D\u7684\u65B0\u56FE\u50CF","Expose Codeman via Cloudflare Tunnel for remote access":"\u901A\u8FC7 Cloudflare \u96A7\u9053\u8FDC\u7A0B\u8BBF\u95EE {name}","Codeman version currently running":"\u5F53\u524D\u8FD0\u884C\u7684{name}\u7248\u672C","Check GitHub for a newer Codeman release":"\u68C0\u67E5 GitHub \u4E0A\u662F\u5426\u6709\u65B0\u7248 {name}",Input:"\u8F93\u5165","Local Echo":"\u672C\u5730\u56DE\u663E","CJK Input":"\u4E2D\u65E5\u97E9\u8F93\u5165","Extended Keyboard Bar":"\u6269\u5C55\u952E\u76D8\u680F","Gesture Control (beta)":"\u624B\u52BF\u63A7\u5236\uFF08\u6D4B\u8BD5\u7248\uFF09","Wheel Scrolls Local History":"\u6EDA\u8F6E\u6EDA\u52A8\u672C\u5730\u5386\u53F2","Instant typing feedback with local echo":"\u901A\u8FC7\u672C\u5730\u56DE\u663E\u5373\u65F6\u663E\u793A\u8F93\u5165","Dedicated IME input field for CJK languages":"\u4E3A\u4E2D\u65E5\u97E9\u8BED\u8A00\u63D0\u4F9B\u4E13\u7528\u8F93\u5165\u6CD5\u6587\u672C\u6846","Extra keys: Tab, Esc, arrows, Ctrl+O":"\u9644\u52A0\u6309\u952E\uFF1ATab\u3001Esc\u3001\u65B9\u5411\u952E\u3001Ctrl+O","Startup Mode":"\u542F\u52A8\u6A21\u5F0F","Skip Permissions (default)":"\u8DF3\u8FC7\u6743\u9650\u786E\u8BA4\uFF08\u9ED8\u8BA4\uFF09","Auto (classifier-guarded, low prompts)":"\u81EA\u52A8\uFF08\u5206\u7C7B\u5668\u4FDD\u62A4\uFF0C\u8F83\u5C11\u63D0\u793A\uFF09","Normal (with prompts)":"\u666E\u901A\uFF08\u663E\u793A\u63D0\u793A\uFF09","Allowed Tools Only":"\u4EC5\u5141\u8BB8\u6307\u5B9A\u5DE5\u5177","Allowed Tools":"\u5141\u8BB8\u7684\u5DE5\u5177","Comma-separated list of tools to allow":"\u4EE5\u9017\u53F7\u5206\u9694\u5141\u8BB8\u4F7F\u7528\u7684\u5DE5\u5177","Enable Ralph / Todo Tracker":"\u542F\u7528 Ralph / \u5F85\u529E\u8DDF\u8E2A\u5668","Claude Permissions":"Claude \u6743\u9650","Agent Teams":"\u667A\u80FD\u4F53\u56E2\u961F","Claude Model":"Claude \u6A21\u578B","1M Opus Context":"Opus 100 \u4E07\u4E0A\u4E0B\u6587","Remote auto-reconnect":"\u8FDC\u7A0B\u81EA\u52A8\u91CD\u8FDE","Thinking Effort":"\u601D\u8003\u5F3A\u5EA6",Low:"\u4F4E",Medium:"\u4E2D",High:"\u9AD8",Max:"\u6700\u9AD8","Nice Priority":"Nice \u4F18\u5148\u7EA7","Enable Nice Priority Reduction":"\u542F\u7528 Nice \u4F18\u5148\u7EA7\u8C03\u6574","Nice Value":"Nice \u503C","Bypass Approvals and Sandbox":"\u7ED5\u8FC7\u5BA1\u6279\u4E0E\u6C99\u7BB1","Default Model":"\u9ED8\u8BA4\u6A21\u578B","Show Optimizer Recommendations":"\u663E\u793A\u4F18\u5316\u5668\u5EFA\u8BAE","Agent Type Overrides":"\u6309\u667A\u80FD\u4F53\u7C7B\u578B\u8986\u76D6","Use Default":"\u4F7F\u7528\u9ED8\u8BA4\u503C","Enable Notifications":"\u542F\u7528\u901A\u77E5","Master toggle for all notification layers":"\u6240\u6709\u901A\u77E5\u5C42\u7684\u603B\u5F00\u5173","Browser Notifications":"\u6D4F\u89C8\u5668\u901A\u77E5","Audio Alerts":"\u58F0\u97F3\u63D0\u9192","Push Notifications":"\u63A8\u9001\u901A\u77E5","Notification Levels":"\u901A\u77E5\u7EA7\u522B",Critical:"\u4E25\u91CD","Per-Event Settings":"\u6309\u4E8B\u4EF6\u8BBE\u7F6E","Permission prompts":"\u6743\u9650\u63D0\u793A","Questions from Claude":"Claude \u63D0\u95EE","Session idle":"\u4F1A\u8BDD\u7A7A\u95F2","Response complete":"\u56DE\u590D\u5B8C\u6210","Respawn cycles":"\u91CD\u751F\u5FAA\u73AF","Task complete":"\u4EFB\u52A1\u5B8C\u6210","Subagent activity":"\u5B50\u667A\u80FD\u4F53\u6D3B\u52A8",Browser:"\u6D4F\u89C8\u5668",Audio:"\u58F0\u97F3",Push:"\u63A8\u9001","Voice Input":"\u8BED\u97F3\u8F93\u5165",Provider:"\u670D\u52A1\u5546","Active Provider":"\u5F53\u524D\u670D\u52A1\u5546","API Key":"API \u5BC6\u94A5","Domain Keywords":"\u9886\u57DF\u5173\u952E\u8BCD","Input Mode":"\u8F93\u5165\u6A21\u5F0F","Direct to input":"\u76F4\u63A5\u8F93\u5165","Compose dialog":"\u7F16\u8F91\u5BF9\u8BDD\u6846","Keyboard Shortcuts":"\u952E\u76D8\u5FEB\u6377\u952E","Customize keyboard shortcuts. Click the binding to capture a new key combination.":"\u81EA\u5B9A\u4E49\u952E\u76D8\u5FEB\u6377\u952E\u3002\u70B9\u51FB\u6309\u952E\u7EC4\u5408\u5373\u53EF\u5F55\u5165\u65B0\u7684\u7EC4\u5408\u3002","Show Shortcuts":"\u663E\u793A\u5FEB\u6377\u952E","Full shortcut reference":"\u5B8C\u6574\u5FEB\u6377\u952E\u53C2\u8003","Session Options":"\u4F1A\u8BDD\u9009\u9879","Session Name":"\u4F1A\u8BDD\u540D\u79F0","Session Color":"\u4F1A\u8BDD\u989C\u8272","Working Directory":"\u5DE5\u4F5C\u76EE\u5F55","Set working directory":"\u8BBE\u7F6E\u5DE5\u4F5C\u76EE\u5F55","Resume Conversation":"\u7EE7\u7EED\u5BF9\u8BDD","Close Session":"\u5173\u95ED\u4F1A\u8BDD","Choose how to close":"\u9009\u62E9\u5173\u95ED\u65B9\u5F0F","Tmux session keeps running in background":"Tmux \u4F1A\u8BDD\u7EE7\u7EED\u5728\u540E\u53F0\u8FD0\u884C","Terminate the session completely":"\u5F7B\u5E95\u7EC8\u6B62\u4F1A\u8BDD","Cancel close session":"\u53D6\u6D88\u5173\u95ED\u4F1A\u8BDD","Case Name":"\u6848\u4F8B\u540D\u79F0","Folder Path":"\u6587\u4EF6\u5939\u8DEF\u5F84","Default Working Directory":"\u9ED8\u8BA4\u5DE5\u4F5C\u76EE\u5F55","Default directory for new sessions.":"\u65B0\u4F1A\u8BDD\u7684\u9ED8\u8BA4\u76EE\u5F55\u3002","Default CLAUDE.md Template":"\u9ED8\u8BA4 CLAUDE.md \u6A21\u677F","Used when creating new cases. Leave empty for built-in template.":"\u521B\u5EFA\u65B0\u6848\u4F8B\u65F6\u4F7F\u7528\uFF1B\u7559\u7A7A\u5219\u4F7F\u7528\u5185\u7F6E\u6A21\u677F\u3002","Remote Path":"\u8FDC\u7A0B\u8DEF\u5F84","SSH Host/IP":"SSH \u4E3B\u673A/IP","SSH Username":"SSH \u7528\u6237\u540D","SSH Port":"SSH \u7AEF\u53E3","Identity File":"\u8EAB\u4EFD\u6587\u4EF6","Jump Host":"\u8DF3\u677F\u4E3B\u673A","Advanced SSH":"\u9AD8\u7EA7 SSH","Discover existing sessions":"\u53D1\u73B0\u73B0\u6709\u4F1A\u8BDD","Workspace Path":"\u5DE5\u4F5C\u533A\u8DEF\u5F84","Container settings (optional, sensible defaults)":"\u5BB9\u5668\u8BBE\u7F6E\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u503C\u5408\u7406\uFF09",Template:"\u6A21\u677F",Network:"\u7F51\u7EDC",CPUs:"CPU \u6570",Memory:"\u5185\u5B58",GPUs:"GPU","Cron Jobs":"\u5B9A\u65F6\u4EFB\u52A1","+ New Job":"+ \u65B0\u5EFA\u4EFB\u52A1","New Cron Job":"\u65B0\u5EFA\u5B9A\u65F6\u4EFB\u52A1",Schedule:"\u8BA1\u5212","Schedule Type":"\u8BA1\u5212\u7C7B\u578B",Once:"\u4E00\u6B21",Interval:"\u95F4\u9694",Daily:"\u6BCF\u5929",Weekly:"\u6BCF\u5468","Run At":"\u8FD0\u884C\u65F6\u95F4","Every (minutes)":"\u6BCF\u9694\uFF08\u5206\u949F\uFF09",Weekdays:"\u5DE5\u4F5C\u65E5","Times use the server's local timezone.":"\u65F6\u95F4\u4F7F\u7528\u670D\u52A1\u5668\u672C\u5730\u65F6\u533A\u3002","All Events":"\u5168\u90E8\u4E8B\u4EF6",Created:"\u5DF2\u521B\u5EFA",Started:"\u5DF2\u542F\u52A8",Exit:"\u9000\u51FA",Deleted:"\u5DF2\u5220\u9664",Recovered:"\u5DF2\u6062\u590D","Stale Cleaned":"\u5DF2\u6E05\u7406\u8FC7\u671F\u9879","Mux Died":"Mux \u5DF2\u7EC8\u6B62","Server Started":"\u670D\u52A1\u5668\u5DF2\u542F\u52A8","Server Stopped":"\u670D\u52A1\u5668\u5DF2\u505C\u6B62",Extra:"\u9644\u52A0\u4FE1\u606F","Token Usage Statistics":"Token \u4F7F\u7528\u7EDF\u8BA1","Daily Breakdown":"\u6BCF\u65E5\u660E\u7EC6","Export JSON":"\u5BFC\u51FA JSON","Export MD":"\u5BFC\u51FA Markdown","Settings saved":"\u8BBE\u7F6E\u5DF2\u4FDD\u5B58","Settings saved locally":"\u8BBE\u7F6E\u5DF2\u4FDD\u5B58\u5230\u672C\u673A","Tunnel active":"\u96A7\u9053\u5DF2\u542F\u7528","Tunnel starting \u2014 QR code will appear when ready...":"\u96A7\u9053\u6B63\u5728\u542F\u52A8\uFF0C\u51C6\u5907\u597D\u540E\u5C06\u663E\u793A\u4E8C\u7EF4\u7801\u2026","Push notifications enabled":"\u63A8\u9001\u901A\u77E5\u5DF2\u542F\u7528","Push notifications disabled":"\u63A8\u9001\u901A\u77E5\u5DF2\u7981\u7528","Permission Required":"\u9700\u8981\u6388\u6743","Waiting for Input":"\u7B49\u5F85\u8F93\u5165","Question Asked":"Claude \u6B63\u5728\u63D0\u95EE","Response Complete":"\u56DE\u590D\u5B8C\u6210","Task Completed":"\u4EFB\u52A1\u5DF2\u5B8C\u6210","Teammate Idle":"\u961F\u53CB\u7A7A\u95F2","Session Error":"\u4F1A\u8BDD\u9519\u8BEF","Respawn Blocked":"\u91CD\u751F\u5DF2\u963B\u6B62","Task Complete":"\u4EFB\u52A1\u5B8C\u6210","Copied to clipboard":"\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F","Checking\u2026":"\u6B63\u5728\u68C0\u67E5\u2026","Starting\u2026":"\u6B63\u5728\u542F\u52A8\u2026","Starting update\u2026":"\u6B63\u5728\u5F00\u59CB\u66F4\u65B0\u2026","Queued\u2026":"\u5DF2\u6392\u961F\u2026","Preparing\u2026":"\u6B63\u5728\u51C6\u5907\u2026","Stashing local changes\u2026":"\u6B63\u5728\u6682\u5B58\u672C\u5730\u66F4\u6539\u2026","Fetching release\u2026":"\u6B63\u5728\u83B7\u53D6\u53D1\u884C\u7248\u2026","Checking out release\u2026":"\u6B63\u5728\u68C0\u51FA\u53D1\u884C\u7248\u2026","Installing dependencies\u2026":"\u6B63\u5728\u5B89\u88C5\u4F9D\u8D56\u2026","Building\u2026":"\u6B63\u5728\u6784\u5EFA\u2026","Restarting Codeman\u2026":"\u6B63\u5728\u91CD\u542F {name}\u2026","Try again":"\u91CD\u8BD5","Could not check for updates. Try again later.":"\u65E0\u6CD5\u68C0\u67E5\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002","The previous version is still running.":"\u5148\u524D\u7248\u672C\u4ECD\u5728\u8FD0\u884C\u3002","Advanced Options":"\u9AD8\u7EA7\u9009\u9879","Advanced container settings":"\u9AD8\u7EA7\u5BB9\u5668\u8BBE\u7F6E",Basics:"\u57FA\u672C\u8BBE\u7F6E",Behavior:"\u884C\u4E3A",Alerts:"\u63D0\u9192",Limits:"\u9650\u5236",Paths:"\u8DEF\u5F84",Notes:"\u5907\u6CE8",Context:"\u4E0A\u4E0B\u6587",Duration:"\u6301\u7EED\u65F6\u95F4",Iterations:"\u8FED\u4EE3\u6B21\u6570",Elapsed:"\u5DF2\u7528\u65F6\u95F4",Launch:"\u542F\u52A8","Launch Command":"\u542F\u52A8\u547D\u4EE4","Background Agents":"\u540E\u53F0\u667A\u80FD\u4F53","Background Tasks":"\u540E\u53F0\u4EFB\u52A1",Tasks:"\u4EFB\u52A1","Explore Tasks":"\u63A2\u7D22\u4EFB\u52A1","Implement Tasks":"\u5B9E\u73B0\u4EFB\u52A1","Test Tasks":"\u6D4B\u8BD5\u4EFB\u52A1","Review Tasks":"\u5BA1\u67E5\u4EFB\u52A1","Agent Type":"\u667A\u80FD\u4F53\u7C7B\u578B","Implementation Plan":"\u5B9E\u65BD\u8BA1\u5212",Plan:"\u8BA1\u5212","Plan:":"\u8BA1\u5212\uFF1A","Plan Usage Limits":"\u5957\u9910\u4F7F\u7528\u9650\u5236","Plan Wizard Agents":"\u8BA1\u5212\u5411\u5BFC\u667A\u80FD\u4F53","Fix Plan Menu":"\u4FEE\u590D\u8BA1\u5212\u83DC\u5355","View Fix Plan":"\u67E5\u770B\u4FEE\u590D\u8BA1\u5212","Regenerate Plan":"\u91CD\u65B0\u751F\u6210\u8BA1\u5212","Cancel plan generation":"\u53D6\u6D88\u751F\u6210\u8BA1\u5212","Describe your task below. Claude will generate an implementation plan with testing steps.":"\u8BF7\u5728\u4E0B\u65B9\u63CF\u8FF0\u4EFB\u52A1\uFF0CClaude \u5C06\u751F\u6210\u5305\u542B\u6D4B\u8BD5\u6B65\u9AA4\u7684\u5B9E\u65BD\u8BA1\u5212\u3002","What do you want to build?":"\u4F60\u60F3\u6784\u5EFA\u4EC0\u4E48\uFF1F","A brief description...":"\u7B80\u8981\u63CF\u8FF0\u2026",Describe:"\u63CF\u8FF0",Enhanced:"\u589E\u5F3A","Enhanced: parallel subagents + verification (slower but more thorough)":"\u589E\u5F3A\uFF1A\u5E76\u884C\u5B50\u667A\u80FD\u4F53 + \u9A8C\u8BC1\uFF08\u901F\u5EA6\u8F83\u6162\uFF0C\u4F46\u66F4\u5168\u9762\uFF09",Standard:"\u6807\u51C6","Single-pass generation with Opus 4.5":"\u4F7F\u7528 Opus 4.5 \u5355\u8F6E\u751F\u6210","Initializing deep reasoning model":"\u6B63\u5728\u521D\u59CB\u5316\u6DF1\u5EA6\u63A8\u7406\u6A21\u578B","Starting Opus 4.5...":"\u6B63\u5728\u542F\u52A8 Opus 4.5\u2026","Auto-launch when plan completes":"\u8BA1\u5212\u5B8C\u6210\u540E\u81EA\u52A8\u542F\u52A8","Auto-accept prompts":"\u81EA\u52A8\u63A5\u53D7\u63D0\u793A","Presses Enter for plan approvals and default question options":"\u5BF9\u8BA1\u5212\u5BA1\u6279\u548C\u9ED8\u8BA4\u95EE\u9898\u9009\u9879\u81EA\u52A8\u6309 Enter","Auto-accepts, auto-clears, agent completions":"\u81EA\u52A8\u63A5\u53D7\u3001\u81EA\u52A8\u6E05\u7406\u548C\u667A\u80FD\u4F53\u5B8C\u6210\u63D0\u9192","Or click Run to start":"\u6216\u70B9\u51FB\u201C\u8FD0\u884C\u201D\u5F00\u59CB","to edit your task, or":"\u4EE5\u7F16\u8F91\u4EFB\u52A1\uFF0C\u6216","to continue without a plan":"\u4EE5\u4E0D\u4F7F\u7528\u8BA1\u5212\u76F4\u63A5\u7EE7\u7EED",Respawn:"\u91CD\u751F","Respawn loop":"\u91CD\u751F\u5FAA\u73AF","Enable Respawn":"\u542F\u7528\u91CD\u751F","Stop Respawn":"\u505C\u6B62\u91CD\u751F","Auto-resume when usage limit resets":"\u4F7F\u7528\u9650\u5236\u91CD\u7F6E\u540E\u81EA\u52A8\u7EE7\u7EED","Auto-restart sessions when context fills up (usually not needed)":"\u4E0A\u4E0B\u6587\u5DF2\u6EE1\u65F6\u81EA\u52A8\u91CD\u542F\u4F1A\u8BDD\uFF08\u901A\u5E38\u4E0D\u9700\u8981\uFF09","Auto-Compact":"\u81EA\u52A8\u538B\u7F29","Auto-Clear":"\u81EA\u52A8\u6E05\u7A7A","Token Management":"Token \u7BA1\u7406","Use 1M token context window":"\u4F7F\u7528 100 \u4E07 Token \u4E0A\u4E0B\u6587\u7A97\u53E3","Use 1M token context window for new sessions":"\u65B0\u4F1A\u8BDD\u4F7F\u7528 100 \u4E07 Token \u4E0A\u4E0B\u6587\u7A97\u53E3","Full context reset at threshold (use higher than compact)":"\u8FBE\u5230\u9608\u503C\u65F6\u5B8C\u5168\u91CD\u7F6E\u4E0A\u4E0B\u6587\uFF08\u9608\u503C\u5E94\u9AD8\u4E8E\u538B\u7F29\u9608\u503C\uFF09","Idle Threshold":"\u7A7A\u95F2\u9608\u503C","Max Iterations":"\u6700\u5927\u8FED\u4EE3\u6B21\u6570","Max Iterations:":"\u6700\u5927\u8FED\u4EE3\u6B21\u6570\uFF1A","Max Todos":"\u6700\u5927\u5F85\u529E\u6570","Todo Expiration":"\u5F85\u529E\u8FC7\u671F\u65F6\u95F4","Completion Phrase":"\u5B8C\u6210\u77ED\u8BED","Completion Phrase:":"\u5B8C\u6210\u77ED\u8BED\uFF1A","Phrase Claude outputs when loop is complete (without <promise> tags)":"\u5FAA\u73AF\u5B8C\u6210\u65F6 Claude \u8F93\u51FA\u7684\u77ED\u8BED\uFF08\u4E0D\u542B <promise> \u6807\u7B7E\uFF09","Prompt to send when idle":"\u7A7A\u95F2\u65F6\u53D1\u9001\u7684\u63D0\u793A\u8BCD","Prompt to send into the session":"\u53D1\u9001\u5230\u4F1A\u8BDD\u7684\u63D0\u793A\u8BCD","Prompt Source":"\u63D0\u793A\u8BCD\u6765\u6E90","Prompt File Path":"\u63D0\u793A\u8BCD\u6587\u4EF6\u8DEF\u5F84","Prompt file path":"\u63D0\u793A\u8BCD\u6587\u4EF6\u8DEF\u5F84","Prompt Preview":"\u63D0\u793A\u8BCD\u9884\u89C8","Load Preset":"\u52A0\u8F7D\u9884\u8BBE",Presets:"\u9884\u8BBE","Apply preset":"\u5E94\u7528\u9884\u8BBE","Save Preset":"\u4FDD\u5B58\u9884\u8BBE","Save Respawn Preset":"\u4FDD\u5B58\u91CD\u751F\u9884\u8BBE","Save current config as preset":"\u5C06\u5F53\u524D\u914D\u7F6E\u4FDD\u5B58\u4E3A\u9884\u8BBE","Preset Name":"\u9884\u8BBE\u540D\u79F0","Description (optional)":"\u63CF\u8FF0\uFF08\u53EF\u9009\uFF09","When to use this preset":"\u6B64\u9884\u8BBE\u7684\u9002\u7528\u573A\u666F","Start Loop":"\u542F\u52A8\u5FAA\u73AF","Start Ralph Loop":"\u542F\u52A8 Ralph \u5FAA\u73AF","Start Ralph Loop \u2192":"\u542F\u52A8 Ralph \u5FAA\u73AF \u2192","Enable Tracker":"\u542F\u7528\u8DDF\u8E2A\u5668","Ralph / Todo":"Ralph / \u5F85\u529E","Ralph / Todo Tracker":"Ralph / \u5F85\u529E\u8DDF\u8E2A\u5668","Cycle Steps":"\u5FAA\u73AF\u6B65\u9AA4","1. Update Prompt":"1. \u66F4\u65B0\u63D0\u793A\u8BCD","2. Send /clear":"2. \u53D1\u9001 /clear","3. Send /init":"3. \u53D1\u9001 /init","4. Kickstart Prompt":"4. \u542F\u52A8\u63D0\u793A\u8BCD","Sent only when /init completes but Claude stays idle \xB7 Auto-accept presses Enter for plan approvals and default options":"\u4EC5\u5728 /init \u5B8C\u6210\u540E Claude \u4ECD\u7A7A\u95F2\u65F6\u53D1\u9001\uFF1B\u81EA\u52A8\u63A5\u53D7\u4F1A\u5BF9\u8BA1\u5212\u5BA1\u6279\u548C\u9ED8\u8BA4\u9009\u9879\u6309 Enter","One autonomous work cycle: whenever Claude goes idle, Codeman sends the update prompt, optionally runs /clear + /init, and kickstarts the next round \u2014 repeating for the chosen duration. All settings below belong to this loop; configure them, then press Enable.":"\u4E00\u4E2A\u81EA\u4E3B\u5DE5\u4F5C\u5FAA\u73AF\uFF1AClaude \u6BCF\u6B21\u7A7A\u95F2\u65F6\uFF0C{name}\u90FD\u4F1A\u53D1\u9001\u66F4\u65B0\u63D0\u793A\u8BCD\uFF0C\u53EF\u9009\u6267\u884C /clear + /init\uFF0C\u5E76\u542F\u52A8\u4E0B\u4E00\u8F6E\uFF0C\u6301\u7EED\u5230\u8BBE\u5B9A\u65F6\u957F\u3002\u4E0B\u65B9\u8BBE\u7F6E\u5747\u5C5E\u4E8E\u6B64\u5FAA\u73AF\uFF1B\u914D\u7F6E\u540E\u70B9\u51FB\u201C\u542F\u7528\u201D\u3002",'If Claude pauses on a usage limit ("limit reached \xB7 resets 3pm"), Codeman waits for the reset time and automatically continues the work. Independent of the respawn loop below.':"\u5982\u679C Claude \u56E0\u4F7F\u7528\u9650\u5236\u6682\u505C\uFF08\u201Climit reached \xB7 resets 3pm\u201D\uFF09\uFF0C{name}\u4F1A\u7B49\u5F85\u9650\u5236\u91CD\u7F6E\u5E76\u81EA\u52A8\u7EE7\u7EED\u5DE5\u4F5C\u3002\u6B64\u529F\u80FD\u72EC\u7ACB\u4E8E\u4E0B\u65B9\u7684\u91CD\u751F\u5FAA\u73AF\u3002","Search sessions, events, files\u2026":"\u641C\u7D22\u4F1A\u8BDD\u3001\u4E8B\u4EF6\u548C\u6587\u4EF6\u2026","Search across sessions":"\u8DE8\u4F1A\u8BDD\u641C\u7D22","Filter by case":"\u6309\u6848\u4F8B\u7B5B\u9009","Filter by date range":"\u6309\u65E5\u671F\u8303\u56F4\u7B5B\u9009","Filter by session status":"\u6309\u4F1A\u8BDD\u72B6\u6001\u7B5B\u9009","Filter files...":"\u7B5B\u9009\u6587\u4EF6\u2026","Any status":"\u4EFB\u610F\u72B6\u6001","Any time":"\u4EFB\u610F\u65F6\u95F4","Last hour":"\u6700\u8FD1\u4E00\u5C0F\u65F6","Last 7 Days":"\u6700\u8FD1 7 \u5929","Past 24h":"\u8FC7\u53BB 24 \u5C0F\u65F6","Past 7 days":"\u8FC7\u53BB 7 \u5929","Past 30 days":"\u8FC7\u53BB 30 \u5929","Since last visit":"\u81EA\u4E0A\u6B21\u8BBF\u95EE\u4EE5\u6765",Since:"\u5F00\u59CB\u65F6\u95F4",Until:"\u7ED3\u675F\u65F6\u95F4","Away digest range":"\u79BB\u5F00\u671F\u95F4\u6458\u8981\u8303\u56F4","Open the digest to load recent activity":"\u6253\u5F00\u6458\u8981\u4EE5\u52A0\u8F7D\u6700\u8FD1\u6D3B\u52A8","Refresh away digest":"\u5237\u65B0\u79BB\u5F00\u671F\u95F4\u6458\u8981","Refresh summary":"\u5237\u65B0\u6458\u8981","Select a session to view files":"\u9009\u62E9\u4F1A\u8BDD\u4EE5\u67E5\u770B\u6587\u4EF6","Select a session to view summary":"\u9009\u62E9\u4F1A\u8BDD\u4EE5\u67E5\u770B\u6458\u8981","Select an agent to view details":"\u9009\u62E9\u667A\u80FD\u4F53\u4EE5\u67E5\u770B\u8BE6\u60C5","Select a run to view its agents":"\u9009\u62E9\u4E00\u6B21\u8FD0\u884C\u4EE5\u67E5\u770B\u5176\u667A\u80FD\u4F53","Source type filter":"\u6765\u6E90\u7C7B\u578B\u7B5B\u9009","Copy content":"\u590D\u5236\u5185\u5BB9","Export as JSON":"\u5BFC\u51FA\u4E3A JSON","Export as Markdown":"\u5BFC\u51FA\u4E3A Markdown","Mark all read":"\u5168\u90E8\u6807\u4E3A\u5DF2\u8BFB","Clear search":"\u6E05\u9664\u641C\u7D22","Clear all tracked subagents":"\u6E05\u9664\u6240\u6709\u5DF2\u8DDF\u8E2A\u7684\u5B50\u667A\u80FD\u4F53","Kill All Sessions":"\u7EC8\u6B62\u6240\u6709\u4F1A\u8BDD","Kill all sessions and their tmux processes":"\u7EC8\u6B62\u6240\u6709\u4F1A\u8BDD\u53CA\u5176 tmux \u8FDB\u7A0B","Kill All Claude + Tmux":"\u7EC8\u6B62\u5168\u90E8 Claude + Tmux","Kill Tmux & Claude Code":"\u7EC8\u6B62 Tmux \u4E0E Claude Code","Terminate everything completely":"\u5F7B\u5E95\u7EC8\u6B62\u6240\u6709\u5185\u5BB9","Tmux Sessions":"Tmux \u4F1A\u8BDD","Tmux sessions keep running in background":"Tmux \u4F1A\u8BDD\u7EE7\u7EED\u5728\u540E\u53F0\u8FD0\u884C","Refresh tmux sessions":"\u5237\u65B0 Tmux \u4F1A\u8BDD","Restore Terminal Size":"\u6062\u590D\u7EC8\u7AEF\u5927\u5C0F","Clear Terminal":"\u6E05\u7A7A\u7EC8\u7AEF","Stop current run":"\u505C\u6B62\u5F53\u524D\u8FD0\u884C","Stop respawn":"\u505C\u6B62\u91CD\u751F","Stop (Ctrl+C)":"\u505C\u6B62\uFF08Ctrl+C\uFF09",Case:"\u6848\u4F8B","Case:":"\u6848\u4F8B\uFF1A","Case settings":"\u6848\u4F8B\u8BBE\u7F6E","Create New":"\u65B0\u5EFA","Auto (directory name)":"\u81EA\u52A8\uFF08\u76EE\u5F55\u540D\uFF09","Custom name shown in the tab (right-click tab to rename inline)":"\u6807\u7B7E\u9875\u4E2D\u663E\u793A\u7684\u81EA\u5B9A\u4E49\u540D\u79F0\uFF08\u53F3\u952E\u6807\u7B7E\u53EF\u76F4\u63A5\u91CD\u547D\u540D\uFF09","Name to identify this case in Codeman":"\u7528\u4E8E\u5728{name}\u4E2D\u6807\u8BC6\u6B64\u6848\u4F8B\u7684\u540D\u79F0","Name to identify this remote case in Codeman":"\u7528\u4E8E\u5728{name}\u4E2D\u6807\u8BC6\u6B64\u8FDC\u7A0B\u6848\u4F8B\u7684\u540D\u79F0","Absolute path on the remote host. Codeman will not create or delete it.":"\u8FDC\u7A0B\u4E3B\u673A\u4E0A\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF1B{name}\u4E0D\u4F1A\u521B\u5EFA\u6216\u5220\u9664\u8BE5\u76EE\u5F55\u3002","Absolute path to an existing project folder, e.g. /home/you/my-project":"\u73B0\u6709\u9879\u76EE\u6587\u4EF6\u5939\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u4F8B\u5982 /home/you/my-project","Letters, numbers, hyphens, underscores only. Created in ~/codeman-cases/":"\u4EC5\u5141\u8BB8\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\u548C\u4E0B\u5212\u7EBF\uFF1B\u5C06\u5728 ~/codeman-cases/ \u4E2D\u521B\u5EFA\u3002","Docker exports":"Docker \u5BFC\u51FA","No exports yet. Export a docker case from its tab.":"\u6682\u65E0\u5BFC\u51FA\uFF1B\u8BF7\u4ECE Docker \u6848\u4F8B\u6807\u7B7E\u9875\u5BFC\u51FA\u3002","Runs inside an isolated container. Multiple sessions can share the same container.":"\u5728\u9694\u79BB\u5BB9\u5668\u5185\u8FD0\u884C\uFF1B\u591A\u4E2A\u4F1A\u8BDD\u53EF\u4EE5\u5171\u4EAB\u540C\u4E00\u5BB9\u5668\u3002","Runs this case in a hardened, isolated container. The base image is built automatically on first use. Docker/Podman must be installed.":"\u5728\u52A0\u56FA\u7684\u9694\u79BB\u5BB9\u5668\u4E2D\u8FD0\u884C\u6B64\u6848\u4F8B\u3002\u9996\u6B21\u4F7F\u7528\u65F6\u4F1A\u81EA\u52A8\u6784\u5EFA\u57FA\u7840\u955C\u50CF\uFF1B\u5FC5\u987B\u5B89\u88C5 Docker/Podman\u3002","Run in an isolated Docker container":"\u5728\u9694\u79BB\u7684 Docker \u5BB9\u5668\u4E2D\u8FD0\u884C","Absolute HOST directory, bind-mounted into the container. Codeman scaffolds CLAUDE.md + hooks into it.":"\u7ED1\u5B9A\u6302\u8F7D\u5230\u5BB9\u5668\u4E2D\u7684\u4E3B\u673A\u7EDD\u5BF9\u76EE\u5F55\uFF1B{name}\u4F1A\u5728\u5176\u4E2D\u751F\u6210 CLAUDE.md \u548C hooks\u3002","A reusable docker host profile. Reuse the same ID across cases to share settings.":"\u53EF\u590D\u7528\u7684 Docker \u4E3B\u673A\u914D\u7F6E\uFF1B\u591A\u4E2A\u6848\u4F8B\u4F7F\u7528\u540C\u4E00 ID \u53EF\u5171\u4EAB\u8BBE\u7F6E\u3002","Mount host credentials (~/.claude etc.)":"\u6302\u8F7D\u4E3B\u673A\u51ED\u636E\uFF08~/.claude \u7B49\uFF09","On: your existing login just works (creds stay on the host, never in exports). Off: sealed sandbox, log in inside the container.":"\u5F00\u542F\uFF1A\u76F4\u63A5\u4F7F\u7528\u73B0\u6709\u767B\u5F55\uFF08\u51ED\u636E\u4FDD\u7559\u5728\u4E3B\u673A\u4E14\u4E0D\u4F1A\u8FDB\u5165\u5BFC\u51FA\uFF09\uFF1B\u5173\u95ED\uFF1A\u4F7F\u7528\u5BC6\u5C01\u6C99\u7BB1\uFF0C\u9700\u8981\u5728\u5BB9\u5668\u5185\u767B\u5F55\u3002","Disk is elastic: storage grows automatically as data flows in (no fixed cap).":"\u78C1\u76D8\u4E3A\u5F39\u6027\u5BB9\u91CF\uFF1A\u4F1A\u968F\u6570\u636E\u81EA\u52A8\u589E\u957F\uFF08\u65E0\u56FA\u5B9A\u4E0A\u9650\uFF09\u3002","Needs the NVIDIA container toolkit on the host.":"\u4E3B\u673A\u9700\u8981\u5B89\u88C5 NVIDIA Container Toolkit\u3002","GPU \u2014 8 GB RAM, 4 CPU, all GPUs":"GPU \u2014 8 GB \u5185\u5B58\u30014 CPU\u3001\u5168\u90E8 GPU","Large \u2014 8 GB RAM, 4 CPU":"\u5927\u578B \u2014 8 GB \u5185\u5B58\u30014 CPU","Medium \u2014 4 GB RAM, 2 CPU (default)":"\u4E2D\u578B \u2014 4 GB \u5185\u5B58\u30012 CPU\uFF08\u9ED8\u8BA4\uFF09","Small \u2014 2 GB RAM, 1 CPU":"\u5C0F\u578B \u2014 2 GB \u5185\u5B58\u30011 CPU","bridge (internet on, default)":"\u6865\u63A5\uFF08\u53EF\u8054\u7F51\uFF0C\u9ED8\u8BA4\uFF09","bridge (internet on)":"\u6865\u63A5\uFF08\u53EF\u8054\u7F51\uFF09","none (fully isolated, no network)":"\u65E0\uFF08\u5B8C\u5168\u9694\u79BB\uFF0C\u4E0D\u8054\u7F51\uFF09","none (fully isolated)":"\u65E0\uFF08\u5B8C\u5168\u9694\u79BB\uFF09","Resume last conversation on relaunch":"\u91CD\u65B0\u542F\u52A8\u65F6\u7EE7\u7EED\u6700\u8FD1\u4E00\u6B21\u5BF9\u8BDD","Extra -o Options":"\u9644\u52A0 -o \u9009\u9879","SOCKS Proxy":"SOCKS \u4EE3\u7406","Host ID":"\u4E3B\u673A ID","Optional. Leave blank for the default port 22.":"\u53EF\u9009\uFF1B\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u53E3 22\u3002","Optional. Path to a private key on this machine (passed to ssh -i). Never the key contents.":"\u53EF\u9009\uFF1B\u672C\u673A\u79C1\u94A5\u6587\u4EF6\u8DEF\u5F84\uFF08\u4F20\u7ED9 ssh -i\uFF09\uFF0C\u8BF7\u52FF\u586B\u5199\u5BC6\u94A5\u5185\u5BB9\u3002","Optional. [user@]host[:port] for ssh -J (jump/bastion host).":"\u53EF\u9009\uFF1Bssh -J \u4F7F\u7528\u7684 [user@]host[:port]\uFF08\u8DF3\u677F\u673A\uFF09\u3002","Optional. One KEY=VALUE per line; each becomes an ssh -o option.":"\u53EF\u9009\uFF1B\u6BCF\u884C\u4E00\u4E2A KEY=VALUE\uFF0C\u6BCF\u9879\u90FD\u4F1A\u6210\u4E3A ssh -o \u9009\u9879\u3002","Use the GPU-accelerated WebGL terminal renderer (desktop only). Turn off to force the DOM renderer if you hit GPU glitches. Codeman also auto-falls-back to the DOM renderer after repeated GPU stalls.":"\u4F7F\u7528 GPU \u52A0\u901F\u7684 WebGL \u7EC8\u7AEF\u6E32\u67D3\u5668\uFF08\u4EC5\u684C\u9762\u7AEF\uFF09\u3002\u5982\u9047 GPU \u663E\u793A\u95EE\u9898\uFF0C\u53EF\u5173\u95ED\u4EE5\u5F3A\u5236\u4F7F\u7528 DOM \u6E32\u67D3\u5668\uFF1B\u591A\u6B21 GPU \u5361\u987F\u540E{name}\u4E5F\u4F1A\u81EA\u52A8\u56DE\u9000\u3002","Show A-/A+ font size buttons in header":"\u5728\u9876\u90E8\u680F\u663E\u793A A-/A+ \u5B57\u4F53\u5927\u5C0F\u6309\u94AE","Show Claude plan usage limits (5-hour & weekly) in the header. Applies to newly created sessions.":"\u5728\u9876\u90E8\u680F\u663E\u793A Claude \u5957\u9910\u4F7F\u7528\u9650\u5236\uFF085 \u5C0F\u65F6\u548C\u6BCF\u5468\uFF09\uFF1B\u9002\u7528\u4E8E\u65B0\u5EFA\u4F1A\u8BDD\u3002","Show ultracode / Workflow runs as a master-detail tab (tasks on the left, agents with tokens + tool calls on the right)":"\u4EE5\u4E3B\u4ECE\u6807\u7B7E\u9875\u663E\u793A Ultracode / Workflow \u8FD0\u884C\uFF08\u5DE6\u4FA7\u4EFB\u52A1\uFF0C\u53F3\u4FA7\u667A\u80FD\u4F53 Token \u4E0E\u5DE5\u5177\u8C03\u7528\uFF09","Pop a floating window for each active ultracode / Workflow run, connected by a line to its session tab (additional to the Ultracode Agents panel)":"\u4E3A\u6BCF\u4E2A\u6D3B\u52A8\u7684 Ultracode / Workflow \u8FD0\u884C\u5F39\u51FA\u6D6E\u52A8\u7A97\u53E3\uFF0C\u5E76\u7528\u8FDE\u7EBF\u8FDE\u63A5\u5230\u5176\u4F1A\u8BDD\u6807\u7B7E\u9875","Shows typed characters instantly via overlay while forwarding keystrokes to the server in the background. Enables Tab completion, preserves input across tab switches, and protects against session crashes. Recommended for mobile and high-latency connections.":"\u901A\u8FC7\u8986\u76D6\u5C42\u5373\u65F6\u663E\u793A\u8F93\u5165\uFF0C\u540C\u65F6\u5728\u540E\u53F0\u628A\u6309\u952E\u8F6C\u53D1\u5230\u670D\u52A1\u5668\u3002\u652F\u6301 Tab \u8865\u5168\u3001\u5207\u6362\u6807\u7B7E\u65F6\u4FDD\u7559\u8F93\u5165\u5E76\u9632\u6B62\u4F1A\u8BDD\u5D29\u6E83\u4E22\u5B57\uFF1B\u63A8\u8350\u79FB\u52A8\u7AEF\u548C\u9AD8\u5EF6\u8FDF\u8FDE\u63A5\u4F7F\u7528\u3002","Show a dedicated input field below the terminal for CJK (Chinese/Japanese/Korean) IME composition. Recommended for mobile devices with Chinese input methods where xterm's native input handling may drop characters.":"\u5728\u7EC8\u7AEF\u4E0B\u65B9\u663E\u793A\u4E2D\u65E5\u97E9\u8F93\u5165\u6CD5\u4E13\u7528\u6587\u672C\u6846\u3002\u63A8\u8350\u5728\u53EF\u80FD\u56E0 xterm \u539F\u751F\u8F93\u5165\u800C\u4E22\u5B57\u7684\u79FB\u52A8\u7AEF\u4E2D\u6587\u8F93\u5165\u6CD5\u4E2D\u4F7F\u7528\u3002","Show additional buttons (Tab, Shift+Tab, Ctrl+O, Esc, Alt+Enter, left/right arrows) in the mobile keyboard accessory bar.":"\u5728\u79FB\u52A8\u7AEF\u952E\u76D8\u5DE5\u5177\u680F\u663E\u793A\u9644\u52A0\u6309\u952E\uFF08Tab\u3001Shift+Tab\u3001Ctrl+O\u3001Esc\u3001Alt+Enter\u3001\u5DE6\u53F3\u65B9\u5411\u952E\uFF09\u3002","Scroll local history (when mouse passthrough is active)":"\u6EDA\u52A8\u672C\u5730\u5386\u53F2\uFF08\u9F20\u6807\u76F4\u901A\u542F\u7528\u65F6\uFF09","Plain wheel/trackpad pages the terminal scrollback":"\u4F7F\u7528\u666E\u901A\u6EDA\u8F6E/\u89E6\u63A7\u677F\u7FFB\u9605\u7EC8\u7AEF\u5386\u53F2","Camera hand-tracking overlay (applied on reload)":"\u6444\u50CF\u5934\u624B\u52BF\u8DDF\u8E2A\u8986\u76D6\u5C42\uFF08\u91CD\u65B0\u52A0\u8F7D\u540E\u751F\u6548\uFF09","Enable the camera hand-tracking gesture overlay (applied on reload). The instance must run with CODEMAN_GESTURE=1.":"\u542F\u7528\u6444\u50CF\u5934\u624B\u52BF\u8DDF\u8E2A\u8986\u76D6\u5C42\uFF08\u91CD\u65B0\u52A0\u8F7D\u540E\u751F\u6548\uFF09\uFF1B\u5B9E\u4F8B\u5FC5\u987B\u4EE5 CODEMAN_GESTURE=1 \u8FD0\u884C\u3002","How Claude CLI is started in screen sessions. Auto Mode runs without routine prompts behind a background safety classifier (needs Claude Code 2.1.207+ and Opus 4.6+/Sonnet 4.6+/Fable 5)":"\u8BBE\u7F6E Claude CLI \u5728\u4F1A\u8BDD\u4E2D\u7684\u542F\u52A8\u65B9\u5F0F\u3002\u81EA\u52A8\u6A21\u5F0F\u7531\u540E\u53F0\u5B89\u5168\u5206\u7C7B\u5668\u4FDD\u62A4\uFF0C\u65E0\u9700\u5E38\u89C4\u786E\u8BA4\uFF08\u9700\u8981 Claude Code 2.1.207+ \u548C Opus 4.6+/Sonnet 4.6+/Fable 5\uFF09\u3002","Auto-enable for new sessions (otherwise auto-enables on Ralph pattern detection)":"\u4E3A\u65B0\u4F1A\u8BDD\u81EA\u52A8\u542F\u7528\uFF08\u5426\u5219\u68C0\u6D4B\u5230 Ralph \u6A21\u5F0F\u65F6\u81EA\u52A8\u542F\u7528\uFF09","Enable experimental Agent Teams for all new Claude sessions (disabled by default)":"\u4E3A\u6240\u6709\u65B0 Claude \u4F1A\u8BDD\u542F\u7528\u5B9E\u9A8C\u6027\u667A\u80FD\u4F53\u56E2\u961F\uFF08\u9ED8\u8BA4\u5173\u95ED\uFF09","Automatically re-establish remote (SSH) sessions when the connection drops, reattaching to the durable remote tmux session (on by default; bounded backoff)":"\u8FDE\u63A5\u65AD\u5F00\u65F6\u81EA\u52A8\u91CD\u5EFA\u8FDC\u7A0B SSH \u4F1A\u8BDD\uFF0C\u5E76\u91CD\u65B0\u9644\u52A0\u5230\u6301\u4E45\u5316\u8FDC\u7A0B tmux \u4F1A\u8BDD\uFF08\u9ED8\u8BA4\u5F00\u542F\uFF0C\u6709\u9650\u9000\u907F\uFF09","Default effort for new Claude sessions \u2014 soft default, switchable anytime in-session via /effort (e.g. /effort ultracode)":"\u65B0 Claude \u4F1A\u8BDD\u7684\u9ED8\u8BA4\u601D\u8003\u5F3A\u5EA6\uFF1B\u8FD9\u662F\u8F6F\u9ED8\u8BA4\u503C\uFF0C\u53EF\u968F\u65F6\u5728\u4F1A\u8BDD\u4E2D\u901A\u8FC7 /effort \u5207\u6362\u3002","Lower priority of Claude sessions (reduces system impact, only affects new sessions)":"\u964D\u4F4E Claude \u4F1A\u8BDD\u7684\u8FDB\u7A0B\u4F18\u5148\u7EA7\uFF08\u51CF\u5C11\u7CFB\u7EDF\u5F71\u54CD\uFF0C\u4EC5\u5F71\u54CD\u65B0\u4F1A\u8BDD\uFF09","Process priority (-20 to 19, higher = lower priority, default: 10)":"\u8FDB\u7A0B\u4F18\u5148\u7EA7\uFF08-20 \u5230 19\uFF1B\u6570\u503C\u8D8A\u5927\u4F18\u5148\u7EA7\u8D8A\u4F4E\uFF1B\u9ED8\u8BA4 10\uFF09","Start new Codex sessions with --dangerously-bypass-approvals-and-sandbox":"\u4F7F\u7528 --dangerously-bypass-approvals-and-sandbox \u542F\u52A8\u65B0\u7684 Codex \u4F1A\u8BDD","Model used for execution tasks. Optimizer suggestions are advisory only.":"\u6267\u884C\u4EFB\u52A1\u4F7F\u7528\u7684\u6A21\u578B\uFF1B\u4F18\u5316\u5668\u5EFA\u8BAE\u4EC5\u4F9B\u53C2\u8003\u3002","Show what the optimizer recommends (doesn't override your choice)":"\u663E\u793A\u4F18\u5316\u5668\u5EFA\u8BAE\uFF08\u4E0D\u4F1A\u8986\u76D6\u4F60\u7684\u9009\u62E9\uFF09",'Optionally set specific models for each task type. Leave as "Use Default" to use your default model.':"\u53EF\u4E3A\u6BCF\u79CD\u4EFB\u52A1\u7C7B\u578B\u6307\u5B9A\u6A21\u578B\uFF1B\u4FDD\u7559\u201C\u4F7F\u7528\u9ED8\u8BA4\u503C\u201D\u5373\u53EF\u4F7F\u7528\u9ED8\u8BA4\u6A21\u578B\u3002","Request browser notification permission":"\u8BF7\u6C42\u6D4F\u89C8\u5668\u901A\u77E5\u6743\u9650","Show OS-level notifications when tab is hidden":"\u6807\u7B7E\u9875\u9690\u85CF\u65F6\u663E\u793A\u7CFB\u7EDF\u7EA7\u901A\u77E5","OS-level push notifications \u2014 works even when tab is closed":"\u7CFB\u7EDF\u7EA7\u63A8\u9001\u901A\u77E5\uFF0C\u5373\u4F7F\u6807\u7B7E\u9875\u5173\u95ED\u4E5F\u53EF\u63A5\u6536","Play a short beep for critical events":"\u4E25\u91CD\u4E8B\u4EF6\u53D1\u751F\u65F6\u64AD\u653E\u77ED\u63D0\u793A\u97F3","Completions, budget warnings, stuck sessions":"\u5B8C\u6210\u63D0\u9192\u3001\u9884\u7B97\u8B66\u544A\u548C\u4F1A\u8BDD\u5361\u4F4F\u63D0\u9192","Errors, crashes, agent failures":"\u9519\u8BEF\u3001\u5D29\u6E83\u548C\u667A\u80FD\u4F53\u5931\u8D25","Notify when a session is idle longer than this":"\u4F1A\u8BDD\u7A7A\u95F2\u8D85\u8FC7\u6B64\u65F6\u957F\u65F6\u901A\u77E5","Stored locally only, never sent to server. Get a key at":"\u4EC5\u5B58\u50A8\u5728\u672C\u673A\uFF0C\u7EDD\u4E0D\u4F1A\u53D1\u9001\u5230\u670D\u52A1\u5668\u3002\u53EF\u5728\u6B64\u83B7\u53D6\u5BC6\u94A5\uFF1A","Comma-separated terms to boost recognition accuracy":"\u4EE5\u9017\u53F7\u5206\u9694\u53EF\u63D0\u9AD8\u8BC6\u522B\u51C6\u786E\u7387\u7684\u672F\u8BED","Start voice input":"\u5F00\u59CB\u8BED\u97F3\u8F93\u5165","Voice input":"\u8BED\u97F3\u8F93\u5165","Voice input (Ctrl+Shift+V)":"\u8BED\u97F3\u8F93\u5165\uFF08Ctrl+Shift+V\uFF09","Insert Newline":"\u63D2\u5165\u6362\u884C","Close Panels":"\u5173\u95ED\u9762\u677F","Previous / Next Session":"\u4E0A\u4E00\u4E2A / \u4E0B\u4E00\u4E2A\u4F1A\u8BDD","Next Session":"\u4E0B\u4E00\u4E2A\u4F1A\u8BDD","Switch to Tab N":"\u5207\u6362\u5230\u7B2C N \u4E2A\u6807\u7B7E\u9875","Move Active Tab Left":"\u5411\u5DE6\u79FB\u52A8\u5F53\u524D\u6807\u7B7E\u9875","Move Active Tab Right":"\u5411\u53F3\u79FB\u52A8\u5F53\u524D\u6807\u7B7E\u9875","Focus First Tab":"\u805A\u7126\u7B2C\u4E00\u4E2A\u6807\u7B7E\u9875","Focus Last Tab":"\u805A\u7126\u6700\u540E\u4E00\u4E2A\u6807\u7B7E\u9875","Focus Next Tab":"\u805A\u7126\u4E0B\u4E00\u4E2A\u6807\u7B7E\u9875","Focus Previous Tab":"\u805A\u7126\u4E0A\u4E00\u4E2A\u6807\u7B7E\u9875","Activate Focused Tab":"\u6FC0\u6D3B\u805A\u7126\u7684\u6807\u7B7E\u9875","Remove Tab":"\u79FB\u9664\u6807\u7B7E\u9875","Remove All Tabs":"\u79FB\u9664\u6240\u6709\u6807\u7B7E\u9875","Use arrows to reorder. Changes are saved automatically.":"\u4F7F\u7528\u65B9\u5411\u952E\u91CD\u65B0\u6392\u5E8F\uFF1B\u66F4\u6539\u4F1A\u81EA\u52A8\u4FDD\u5B58\u3002"}),y=new Map(Object.entries(m).map(([e,t])=>[e.toLocaleLowerCase("en"),t])),S=new WeakMap,b=new WeakMap;let r=f(s.__codemanLanguage),i=d,h=null,p=!1;function f(e){return R.has(e)?e:"en"}function T(e){if(typeof e!="string")return d;const t=e.normalize("NFC").replace(/[\u0000-\u001f\u007f]/g,"").trim();return t?Array.from(t).slice(0,40).join(""):d}function k(e,t){return e.replace(/\{([a-zA-Z][\w]*)\}/g,(a,o)=>String(t[o]??""))}function L(e){const t=[[/^(\d+) tokens?$/,(o,n)=>`${n} \u4E2A Token`],[/^(\d+) sessions?$/,(o,n)=>`${n} \u4E2A\u4F1A\u8BDD`],[/^(\d+) tasks?$/,(o,n)=>`${n} \u4E2A\u4EFB\u52A1`],[/^(\d+) running$/,(o,n)=>`${n} \u4E2A\u8FD0\u884C\u4E2D`],[/^(\d+) active$/,(o,n)=>`${n} \u4E2A\u6D3B\u52A8`],[/^Show (\d+) more$/,(o,n)=>`\u518D\u663E\u793A ${n} \u9879`],[/^Show (\d+) more \((\d+) remaining\)$/,(o,n,l)=>`\u518D\u663E\u793A ${n} \u9879\uFF08\u5269\u4F59 ${l} \u9879\uFF09`],[/^Lifetime: (\d+) sessions created$/,(o,n)=>`\u7D2F\u8BA1\u5DF2\u521B\u5EFA ${n} \u4E2A\u4F1A\u8BDD`],[/^Tunnel active: (.+)$/,(o,n)=>`\u96A7\u9053\u5DF2\u542F\u7528\uFF1A${n}`],[/^Tunnel error: (.+)$/,(o,n)=>`\u96A7\u9053\u9519\u8BEF\uFF1A${n}`],[/^Update to v(.+)$/,(o,n)=>`\u66F4\u65B0\u5230 v${n}`],[/^You're up to date \(v(.+)\)\.$/,(o,n)=>`\u5DF2\u662F\u6700\u65B0\u7248\u672C\uFF08v${n}\uFF09\u3002`],[/^Update available: v(.+)$/,(o,n)=>`\u6709\u53EF\u7528\u66F4\u65B0\uFF1Av${n}`],[/^Selected: (.+)$/,(o,n)=>`\u5DF2\u9009\u62E9\uFF1A${n}`],[/^Failed to (.+)$/,(o,n)=>`\u64CD\u4F5C\u5931\u8D25\uFF1A${n}`]];for(const[o,n]of t){const l=e.match(o);if(l)return n(...l)}const a=e.match(/^(Open|Close|Show|Hide|Enable|Disable|Start|Stop|Refresh|Save|Cancel|Clear|Select|View|Export|Import|Remove|Kill|Toggle|Increase|Decrease) (.+)$/i);if(a){const o={open:"\u6253\u5F00",close:"\u5173\u95ED",show:"\u663E\u793A",hide:"\u9690\u85CF",enable:"\u542F\u7528",disable:"\u7981\u7528",start:"\u542F\u52A8",stop:"\u505C\u6B62",refresh:"\u5237\u65B0",save:"\u4FDD\u5B58",cancel:"\u53D6\u6D88",clear:"\u6E05\u9664",select:"\u9009\u62E9",view:"\u67E5\u770B",export:"\u5BFC\u51FA",import:"\u5BFC\u5165",remove:"\u79FB\u9664",kill:"\u7EC8\u6B62",toggle:"\u5207\u6362",increase:"\u589E\u5927",decrease:"\u51CF\u5C0F"}[a[1].toLowerCase()],n=m[a[2]]||y.get(a[2].toLocaleLowerCase("en"));if(o&&n)return`${o}${n}`}return null}function g(e){return!e||i===d?e:e.replace(/Codeman/g,i).replace(/codeman(?=:)/g,i)}function c(e,t={}){if(typeof e!="string"||!e)return e;const a={name:i,...t};if(r==="zh-CN"){const o=m[e]||y.get(e.toLocaleLowerCase("en"))||L(e);if(o)return g(k(o,a))}return g(k(e,a))}function v(e){const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return!t||!!t.closest(x)}function U(e){const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return v(e)||!!t?.closest(D)}function M(e,t){const a=e.match(/^\s*/)?.[0]||"",o=e.match(/\s*$/)?.[0]||"";return a+t+o}function E(e){let t=S.get(e);if(U(e)||!t&&!/[A-Za-z]/.test(e.nodeValue||""))return;(!t||e.nodeValue!==t.applied)&&(t={source:e.nodeValue,applied:e.nodeValue});const a=t.source.trim();if(!a)return;const o=M(t.source,c(a));t.applied=o,S.set(e,t),e.nodeValue!==o&&(e.nodeValue=o)}function w(e){if(v(e)||e.matches(".history-item[title]"))return;let t=b.get(e);t||(t=new Map);for(const a of C){if(!e.hasAttribute(a))continue;const o=e.getAttribute(a)||"";let n=t.get(a);(!n||o!==n.applied)&&(n={source:o,applied:o});const l=c(n.source);n.applied=l,t.set(a,n),o!==l&&e.setAttribute(a,l)}b.set(e,t)}function u(e){if(!(!e||p)){p=!0;try{if(e.nodeType===Node.TEXT_NODE){E(e);return}if(e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_NODE)return;e.nodeType===Node.ELEMENT_NODE&&w(e);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(let a=t.nextNode();a;a=t.nextNode())a.nodeType===Node.TEXT_NODE?E(a):w(a)}finally{p=!1}}}function A(){const e=document.title||"",t=document.documentElement.dataset.i18nTitleSource||e;document.documentElement.dataset.i18nTitleSource=t,document.title=g(t)}function I(e={}){const t=i;if(r=f(e.language??r),i=T(e.displayName??i),s.__codemanLanguage=r,s.__codemanDisplayName=i,document.documentElement.lang=r,document.documentElement.dataset.language=r,t!==i){const a=document.documentElement.dataset.i18nTitleSource||document.title||"";t!==d&&a.includes(t)&&(document.documentElement.dataset.i18nTitleSource=a.replaceAll(t,i))}return u(document.body),A(),{language:r,displayName:i}}function N(){u(document.body),A(),!h&&(h=new MutationObserver(e=>{if(!p)for(const t of e){t.type==="characterData"&&u(t.target),t.type==="attributes"&&w(t.target);for(const a of t.addedNodes)u(a)}}),h.observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:C}))}const _=Object.freeze({t:c,configure:I,start:N,translateNode:u,normalizeDisplayName:T,normalizeLanguage:f,get language(){return r},get displayName(){return i}});s.CodemanI18n=_,s.codemanT=c;const P=typeof s.confirm=="function"?s.confirm.bind(s):null,O=typeof s.alert=="function"?s.alert.bind(s):null;P&&(s.confirm=e=>P(c(String(e)))),O&&(s.alert=e=>O(c(String(e)))),document.addEventListener("DOMContentLoaded",N,{once:!0})})(window);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|