aicodeman 0.9.13 → 0.9.14
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 +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/config/hook-secret.d.ts +28 -0
- package/dist/config/hook-secret.d.ts.map +1 -0
- package/dist/config/hook-secret.js +63 -0
- package/dist/config/hook-secret.js.map +1 -0
- package/dist/hooks-config.d.ts +3 -2
- package/dist/hooks-config.d.ts.map +1 -1
- package/dist/hooks-config.js +10 -2
- package/dist/hooks-config.js.map +1 -1
- package/dist/session-cli-builder.d.ts.map +1 -1
- package/dist/session-cli-builder.js +5 -0
- package/dist/session-cli-builder.js.map +1 -1
- package/dist/session.d.ts +1 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +45 -0
- package/dist/session.js.map +1 -1
- package/dist/tmux-manager.d.ts.map +1 -1
- package/dist/tmux-manager.js +3 -0
- package/dist/tmux-manager.js.map +1 -1
- package/dist/web/middleware/auth.d.ts +9 -1
- package/dist/web/middleware/auth.d.ts.map +1 -1
- package/dist/web/middleware/auth.js +58 -8
- package/dist/web/middleware/auth.js.map +1 -1
- package/dist/web/network-auth-policy.d.ts +6 -0
- package/dist/web/network-auth-policy.d.ts.map +1 -1
- package/dist/web/network-auth-policy.js +10 -0
- package/dist/web/network-auth-policy.js.map +1 -1
- package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
- package/dist/web/public/app.a23f8bf6.js.gz +0 -0
- package/dist/web/public/constants.8fa1a65f.js.gz +0 -0
- package/dist/web/public/image-input.0ea86695.js.gz +0 -0
- package/dist/web/public/index.html +21 -16
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/input-cjk.b8686b5e.js.gz +0 -0
- package/dist/web/public/keyboard-accessory.bc753cc7.js.gz +0 -0
- package/dist/web/public/mobile-handlers.763a7439.js.gz +0 -0
- package/dist/web/public/mobile.c7513aed.css +1 -0
- package/dist/web/public/mobile.c7513aed.css.br +0 -0
- package/dist/web/public/mobile.c7513aed.css.gz +0 -0
- package/dist/web/public/notification-manager.9c984ac2.js.gz +0 -0
- package/dist/web/public/orchestrator-panel.js.gz +0 -0
- package/dist/web/public/panels-ui.6bb3169f.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/session-ui.34f25fdf.js.gz +0 -0
- package/dist/web/public/{settings-ui.de9ba1ae.js → settings-ui.3a341938.js} +3 -3
- package/dist/web/public/settings-ui.3a341938.js.br +0 -0
- package/dist/web/public/settings-ui.3a341938.js.gz +0 -0
- package/dist/web/public/{styles.3db29e83.css → styles.c14ecd8a.css} +1 -1
- package/dist/web/public/styles.c14ecd8a.css.br +0 -0
- package/dist/web/public/{styles.3db29e83.css.gz → styles.c14ecd8a.css.gz} +0 -0
- package/dist/web/public/subagent-windows.a366a4ad.js.gz +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/terminal-ui.1f5b45cf.js +3 -0
- package/dist/web/public/terminal-ui.1f5b45cf.js.br +0 -0
- package/dist/web/public/terminal-ui.1f5b45cf.js.gz +0 -0
- package/dist/web/public/upload.html.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-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/routes/session-routes.d.ts.map +1 -1
- package/dist/web/routes/session-routes.js +34 -1
- package/dist/web/routes/session-routes.js.map +1 -1
- package/dist/web/routes/system-routes.d.ts.map +1 -1
- package/dist/web/routes/system-routes.js +19 -0
- package/dist/web/routes/system-routes.js.map +1 -1
- package/dist/web/server.d.ts +1 -0
- 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/package.json +1 -1
- package/dist/web/public/mobile.da662a7b.css +0 -1
- package/dist/web/public/mobile.da662a7b.css.br +0 -0
- package/dist/web/public/mobile.da662a7b.css.gz +0 -0
- package/dist/web/public/settings-ui.de9ba1ae.js.br +0 -0
- package/dist/web/public/settings-ui.de9ba1ae.js.gz +0 -0
- package/dist/web/public/styles.3db29e83.css.br +0 -0
- package/dist/web/public/terminal-ui.0e930cb3.js +0 -3
- package/dist/web/public/terminal-ui.0e930cb3.js.br +0 -0
- package/dist/web/public/terminal-ui.0e930cb3.js.gz +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
html.mobile-init .header-font-controls,html.mobile-init .header-system-stats,html.mobile-init .header-tokens,html.mobile-init .monitor-panel,html.mobile-init .subagents-panel,html.mobile-init .project-insights-panel,html.mobile-init .file-browser-panel{display:none!important}@media(max-width:768px){input,textarea,select{font-size:16px!important}html{touch-action:manipulation}}@media(max-width:768px)and (min-width:430px){.header{position:fixed;top:0;left:0;right:0;min-height:48px;max-height:48px;padding:.35rem .5rem;padding-left:calc(.5rem + var(--safe-area-left));padding-right:calc(.5rem + var(--safe-area-right));background:#0a0a0a;border-bottom:1px solid rgba(255,255,255,.08);contain:none;overflow:visible;z-index:1200}.ios-device .header{padding-top:calc(.35rem + var(--safe-area-top));min-height:calc(48px + var(--safe-area-top));max-height:calc(48px + var(--safe-area-top))}.app{padding-top:54px}.ios-device .app{padding-top:calc(54px + var(--safe-area-top))}.header-font-controls{gap:.15rem;padding:.15rem .25rem}.header-font-controls .btn-icon-sm{width:18px;height:18px}.header-system-stats{font-size:.6rem;gap:.25rem}.header-right{position:fixed;top:calc(52px + var(--safe-area-top));left:calc(.5rem + var(--safe-area-left));right:auto;display:flex;align-items:center;gap:.35rem;max-width:calc(100vw - 1rem - var(--safe-area-left) - var(--safe-area-right));padding:.35rem;background:#0a0a0af5;border:1px solid rgba(255,255,255,.12);border-radius:8px;box-shadow:0 10px 28px #00000073;overflow-x:auto;scrollbar-width:none;z-index:2000}.header-right::-webkit-scrollbar{display:none}.header-right.mobile-collapsed{display:none}.btn-icon-header:not(.btn-sm){width:44px;height:44px}.session-tabs,.session-tabs.tabs-two-rows{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scrollbar-width:none;max-height:52px;gap:3px}.session-tabs::-webkit-scrollbar{display:none}.session-tab{padding:.4rem .6rem;font-size:.75rem;min-height:40px}.session-tab .tab-name{max-width:80px}.toolbar{padding:.4rem .5rem;padding-left:calc(.5rem + var(--safe-area-left));padding-right:calc(.5rem + var(--safe-area-right));gap:.4rem}.tab-count-group{display:none}.btn-toolbar{padding:.4rem .8rem;font-size:.8rem;min-height:40px}.case-select-group{max-width:150px}.toolbar-select{font-size:.75rem}.monitor-panel,.subagents-panel{width:100%;max-width:100%;left:0;right:0;border-radius:8px 8px 0 0;max-height:40vh}.project-insights-panel{max-width:280px;font-size:.7rem}.modal-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;flex-wrap:nowrap}.modal-tabs::-webkit-scrollbar{display:none}.modal-tab-btn{padding:.4rem .75rem;font-size:.7rem;white-space:nowrap;flex-shrink:0}.settings-grid{gap:.4rem .75rem}.settings-item{font-size:.7rem}.event-type-grid{grid-template-columns:1fr 40px 40px 40px;gap:5px 6px}.event-label{font-size:.7rem}.subagent-window{width:320px;height:280px;min-width:240px;min-height:160px}.subagent-window-header{padding:.35rem .5rem}.subagent-window-title .id{font-size:.7rem;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.subagent-window-title .status{font-size:.55rem}.subagent-window-body{font-size:.7rem}.respawn-banner{padding:.25rem .5rem;padding-left:calc(.5rem + var(--safe-area-left));padding-right:calc(.5rem + var(--safe-area-right));font-size:.65rem}.respawn-compact-layout{gap:.75rem}.respawn-status-row1{gap:.4rem}.respawn-action-log{max-height:2.6em;font-size:.6rem}.respawn-countdown-timer{font-size:.55rem}.respawn-timer-bar{width:24px}.toolbar-center .btn-toolbar.btn-voice{display:flex!important}.toolbar{padding:0 .5rem;gap:.5rem}.toolbar-left,.toolbar-right,.toolbar-group{gap:.5rem}.btn-toolbar{padding:.4rem .75rem;font-size:.75rem;min-height:unset}}@media(max-width:430px){.header-brand{padding-right:.25rem;margin-right:.2rem;border-right:none}.header-brand .logo{font-size:.7rem}.header-font-controls{gap:.1rem;padding:.1rem .2rem}.header-font-controls .btn-icon-sm{width:16px;height:16px}.header-font-controls .font-size-display{font-size:.6rem;min-width:14px}.header-system-stats{font-size:.55rem;gap:.15rem}.header-tokens{font-size:.6rem;padding:.1rem .3rem}.header{position:fixed;top:0;left:0;right:0;min-height:36px;max-height:36px;padding:.15rem .3rem;padding-left:calc(.3rem + var(--safe-area-left));padding-right:calc(.3rem + var(--safe-area-right));gap:.15rem;overflow:hidden;background:#0a0a0a;border-bottom:1px solid rgba(255,255,255,.08);contain:none;z-index:1200}.ios-device .header{padding-top:calc(.15rem + var(--safe-area-top));min-height:calc(36px + var(--safe-area-top));max-height:calc(36px + var(--safe-area-top))}.app{padding-top:42px}.ios-device .app{padding-top:calc(42px + var(--safe-area-top))}.main{padding-bottom:calc(40px + var(--safe-area-bottom))}.ios-device.safari-browser .main{padding-bottom:calc(40px + var(--safe-area-bottom) + (100vh - var(--app-height, 100vh)))}.header-right{position:fixed;top:calc(40px + var(--safe-area-top));left:calc(.3rem + var(--safe-area-left));right:auto;display:flex;align-items:center;padding-left:.2rem;gap:.1rem;max-width:calc(100vw - .6rem - var(--safe-area-left) - var(--safe-area-right));padding:.25rem;background:#0a0a0af5;border:1px solid rgba(255,255,255,.12);border-radius:8px;box-shadow:0 10px 28px #00000073;overflow-x:auto;scrollbar-width:none;border-left:none;z-index:2000}.header-right::-webkit-scrollbar{display:none}.header-right.mobile-collapsed{display:none}.btn-icon-header{width:26px;height:26px;padding:0}.btn-icon-header svg{width:12px;height:12px}.btn-icon-header.btn-settings,.btn-icon-header.btn-lifecycle-log{display:none!important}.btn-voice-mobile{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;background:#1a2a3f;border:1px solid rgba(59,130,246,.3);border-radius:4px;color:#93c5fd;cursor:pointer;flex-shrink:0;order:5}.btn-voice-mobile svg{width:13px;height:13px}.btn-voice-mobile:active{background:#2a3a5f}.btn-voice-mobile.recording{background:#ef444440;border-color:#ef444499;color:#ef4444;animation:mobile-voice-pulse 1.2s ease-in-out infinite}@keyframes mobile-voice-pulse{0%,to{box-shadow:inset 0 0 0 1px #ef444459;background:#ef444433}50%{box-shadow:inset 0 0 0 2px #ef4444bf;background:#ef444459}}.btn-settings-mobile{display:inline-flex!important;align-items:center;justify-content:center;width:26px;height:26px;background:transparent;border:1px solid rgba(255,255,255,.2);border-radius:4px;color:#9ca3af;font-size:.85rem;cursor:pointer;flex-shrink:0;order:6;position:relative}.btn-settings-mobile svg{width:13px;height:13px}.btn-settings-mobile:active{background:#ffffff1a;color:#fff}.app{overflow:hidden;position:relative}.keyboard-visible .app{position:fixed;inset:0 0 auto;height:var(--app-height, 100dvh)}.session-tabs,.session-tabs.tabs-two-rows{flex:1;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scrollbar-width:none;max-height:36px;gap:2px;padding:0}.session-tabs::-webkit-scrollbar{display:none}.session-tab{flex-shrink:0;min-height:32px;max-height:32px;padding:.35rem .5rem;font-size:.7rem;gap:.25rem;border-radius:4px}.session-tab .tab-status{width:4px;height:4px}.session-tab .tab-name{max-width:50px;overflow:hidden;text-overflow:ellipsis}.session-tab .tab-close,.session-tab .tab-gear{display:none}.session-tab.active .tab-gear{display:inline-flex;align-items:center;justify-content:center;font-size:.65rem;line-height:1;width:32px;height:32px;margin-left:auto;opacity:.6}.session-tab.active .tab-close{display:inline-flex;align-items:center;justify-content:center;font-size:1.1rem;line-height:1;width:20px;height:18px;margin-left:-2px}.toolbar{position:fixed;bottom:var(--safe-area-bottom);left:0;right:0;height:40px;min-height:40px;max-height:40px;padding:.3rem .4rem;padding-left:calc(.4rem + var(--safe-area-left));padding-right:calc(.4rem + var(--safe-area-right));flex-wrap:nowrap;gap:.3rem;align-items:center;justify-content:space-between;background:#111;border-top:1px solid rgba(255,255,255,.1);z-index:50;transition:transform .15s ease-out;will-change:transform}.ios-device.safari-browser .toolbar{bottom:calc(var(--safe-area-bottom) + (100vh - var(--app-height, 100vh)))}.keyboard-visible.ios-device.safari-browser .toolbar{bottom:var(--safe-area-bottom)}.keyboard-visible.ios-device.safari-browser .keyboard-accessory-bar{bottom:calc(var(--safe-area-bottom) + 40px)}.toolbar-center{display:flex!important;align-items:center}.toolbar-center .btn-toolbar.btn-voice,.toolbar-right,.version-display{display:none!important}.toolbar-left{flex:1 1 0;min-width:0;align-items:center;gap:.3rem}.toolbar-left .toolbar-group{display:flex;flex:1 1 0;min-width:0;align-items:center;gap:.3rem}.toolbar-left .toolbar-group:first-child{flex:1 1 0;min-width:0;justify-content:space-between;gap:.3rem;flex-wrap:nowrap;align-items:center}.tab-count-group{display:none!important}.btn-toolbar{min-height:26px!important;max-height:26px!important;height:26px!important;padding:0 .5rem!important;font-size:.65rem!important;border-radius:4px;line-height:26px;display:inline-flex;align-items:center;justify-content:center;font-weight:500;letter-spacing:.01em;color:#fff}.run-btn-group{display:flex;flex:0 0 auto}.btn-toolbar.btn-run{flex:0 0 auto;padding:0 .6rem!important;font-weight:500;border-radius:4px 0 0 4px!important;border-right:none!important}.btn-toolbar.btn-run svg{width:10px;height:10px;margin-right:3px}.btn-toolbar.btn-run-gear{flex:0 0 auto;padding:0 .35rem!important;min-width:unset!important;border-radius:0 4px 4px 0!important;border-left:1px solid rgba(255,255,255,.15)!important}.btn-toolbar.btn-run-gear svg{width:10px;height:10px}.btn-toolbar.btn-run.mode-claude,.btn-toolbar.btn-run-gear.mode-claude{background:#1e3a5f;border-color:#3b82f64d;color:#93c5fd}.btn-toolbar.btn-run.mode-claude:active,.btn-toolbar.btn-run-gear.mode-claude:active{background:#2563eb;border-color:#3b82f680}.btn-toolbar.btn-run.mode-opencode,.btn-toolbar.btn-run-gear.mode-opencode{background:#0a2e2a;border-color:#10b9814d;color:#6ee7b7}.btn-toolbar.btn-run.mode-opencode:active,.btn-toolbar.btn-run-gear.mode-opencode:active{background:#0d4a40;border-color:#10b98180}.run-mode-menu{bottom:100%;left:0;margin-bottom:6px;min-width:160px;max-width:80vw}.run-mode-option{padding:10px 12px;font-size:.8rem;cursor:pointer;-webkit-tap-highlight-color:rgba(255,255,255,.1)}.run-mode-history{-webkit-overflow-scrolling:touch;touch-action:manipulation}.btn-toolbar.btn-stop{display:flex!important;flex:0 0 auto;padding:0 8px!important;min-width:unset;order:3}.btn-toolbar.btn-stop svg{width:10px;height:10px;margin-right:0}.btn-toolbar.btn-shell{flex:0 0 auto;background:transparent;border:1px solid rgba(255,255,255,.2);color:#9ca3af;order:4}.btn-toolbar.btn-shell:hover,.btn-toolbar.btn-shell:active{background:#ffffff1a;color:#fff}.case-select-group{display:none!important}.toolbar-left .toolbar-group:first-child{width:100%;gap:8px}.btn-toolbar.btn-shell{flex:0 0 auto;min-width:54px;width:54px;white-space:nowrap;padding:0 8px!important;overflow:hidden;font-size:0!important}.btn-toolbar.btn-shell:after{content:"Shell";font-size:.65rem}.btn-toolbar.btn-case-mobile{display:flex!important;flex:1 1 0!important;min-width:0;padding:0 8px!important;order:2;overflow:hidden;justify-content:center;gap:4px}.btn-toolbar.btn-case-mobile #mobileCaseName{max-width:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.btn-case-settings-mobile{display:inline-flex!important;align-items:center;justify-content:center;width:26px;height:26px;background:transparent;border:1px solid rgba(255,255,255,.2);border-radius:4px;color:#9ca3af;cursor:pointer;flex-shrink:0;order:1}.btn-case-settings-mobile:active{background:#ffffff1a;color:#fff}@media(max-width:374px){.toolbar{padding:0 2px}.toolbar-left,.toolbar-left .toolbar-group,.toolbar-left .toolbar-group:first-child{gap:2px}}.btn-case-settings-mobile{display:none!important}.case-settings-popover-mobile{position:fixed;bottom:calc(var(--safe-area-bottom) + 46px);left:8px;right:8px;background:#1e1e1e;border:1px solid rgba(255,255,255,.15);border-radius:8px;padding:.6rem .75rem;z-index:1000;box-shadow:0 4px 16px #00000080;display:block}.case-settings-popover-mobile.hidden{display:none!important}.case-settings-popover-mobile .checkbox-inline{display:flex;align-items:center;gap:6px;font-size:.75rem;color:#e5e7eb}.case-settings-popover-mobile .form-hint{display:block;margin-top:.2rem;font-size:.6rem;color:#6b7280}.keyboard-accessory-bar{display:none;position:fixed;bottom:calc(var(--safe-area-bottom) + 40px);left:0;right:0;height:44px;background:#1a1a1a;border-top:1px solid rgba(255,255,255,.1);padding:6px 8px;padding-left:calc(8px + var(--safe-area-left));padding-right:calc(8px + var(--safe-area-right));gap:8px;align-items:center;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;z-index:51;transition:transform .15s ease-out;will-change:transform}.keyboard-accessory-bar.visible{display:flex}.keyboard-accessory-bar::-webkit-scrollbar{display:none}.accessory-btn{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;gap:4px;padding:6px 12px;background:#2a2a2a;border:1px solid rgba(255,255,255,.15);border-radius:6px;color:#e5e5e5;font-size:.65rem;font-weight:500;cursor:pointer;transition:background .15s,border-color .15s}.accessory-btn.confirming{background:#6b4f00;border-color:#b8860b;color:#ffd54f}.accessory-btn:active{background:#3a3a3a}.accessory-btn svg{width:14px;height:14px}.accessory-btn-arrow{padding:6px 10px;background:#2563eb;border-color:#3b82f680;color:#fff}.accessory-btn-arrow:active{background:#1d4ed8}.accessory-btn-dismiss{margin-left:auto;flex:1 1 0;max-width:100px;padding:10px 8px;background:#2563eb;border-color:#3b82f680;color:#fff;font-weight:600}.accessory-btn-dismiss svg{width:22px;height:22px}.accessory-btn-dismiss:active{background:#1d4ed8}.voice-preview{bottom:calc(var(--safe-area-bottom) + 94px);font-size:.8rem;max-width:90%;padding:6px 14px}.btn-case-add,.btn-case-settings{display:none!important}.paste-overlay{position:fixed;inset:0;background:#0009;z-index:10000;display:flex;align-items:flex-start;justify-content:center;padding-top:15vh}.paste-dialog{background:var(--bg-secondary, #1e1e2e);border:1px solid var(--border-color, #444);border-radius:12px;padding:12px;width:calc(100% - 24px);max-width:400px}.paste-textarea{width:100%;min-height:80px;max-height:200px;background:var(--bg-primary, #0d0d14);color:var(--text-primary, #e0e0e0);border:1px solid var(--border-color, #444);border-radius:8px;padding:8px;font-family:inherit;font-size:16px;resize:none;box-sizing:border-box}.paste-textarea:focus{outline:none;border-color:var(--accent-color, #7aa2f7)}.paste-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}.paste-cancel,.paste-new,.paste-send,.paste-image{padding:8px 18px;border:none;border-radius:8px;font-size:14px;cursor:pointer}.paste-image{margin-right:auto;background:var(--bg-tertiary, #333);color:var(--accent-color, #7aa2f7);border:1px solid var(--accent-color, #7aa2f7)}.paste-cancel{background:var(--bg-tertiary, #333);color:var(--text-secondary, #aaa)}.paste-new{background:var(--bg-tertiary, #333);color:var(--accent-color, #7aa2f7);border:1px solid var(--accent-color, #7aa2f7)}.paste-send{background:var(--accent-color, #7aa2f7);color:#fff;font-weight:600}.toolbar-select{display:none!important}.toolbar .btn-case-add{min-width:26px!important;max-width:26px!important;width:26px!important;min-height:26px!important;max-height:26px!important;height:26px!important;padding:0!important;font-size:.9rem;font-weight:700;display:inline-flex!important;align-items:center;justify-content:center;line-height:1;border-radius:4px;background:transparent;border:1px solid rgba(255,255,255,.15);color:#9ca3af}.btn-case-add:hover,.btn-case-add:active{background:#ffffff1a;color:#fff}.monitor-panel,.subagents-panel{width:100%;max-width:100%;left:0;right:0;border-radius:8px 8px 0 0;bottom:calc(44px + 2rem + var(--safe-area-bottom));max-height:35vh}.modal-content{width:100%;max-width:100%;height:100%;max-height:100%;border-radius:0;margin:0;display:flex;flex-direction:column}.modal-content.modal-sm{height:auto;max-height:85vh;border-radius:12px;margin:1rem;width:calc(100% - 2rem)}.ios-device .modal-content{padding-top:var(--safe-area-top);padding-bottom:var(--safe-area-bottom);padding-left:var(--safe-area-left);padding-right:var(--safe-area-right)}.modal-header{padding:.75rem 1rem}.modal-header h3{font-size:1rem}.modal-body{padding:.75rem 1rem;flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch}.modal-footer,.form-actions{padding:.75rem 1rem;padding-bottom:calc(.75rem + var(--safe-area-bottom))}.ios-device .terminal-container{padding-bottom:var(--safe-area-bottom)}.main{flex:1;min-height:0}.cli-info-bar{display:block}.terminal-container{height:100%;min-height:0;position:relative;overflow:visible;touch-action:none}.terminal-container .xterm,.terminal-container .xterm-viewport,.terminal-container .xterm-screen{touch-action:none}.response-viewer{padding-bottom:var(--safe-area-bottom, 0px)}.response-viewer-body{font-size:12px;padding:12px}.welcome-content{max-width:calc(100vw - 1.5rem);padding:1rem .75rem}.welcome-title{font-size:1.2rem;margin-bottom:.5rem}.welcome-desc{font-size:.8rem;margin-bottom:.4rem}.welcome-actions{flex-direction:column;gap:.5rem;margin-top:1rem}.welcome-btn{width:100%;justify-content:center;min-height:44px;padding:.75rem 1rem;font-size:.85rem}.history-show-more{display:block;margin-bottom:.75rem}.welcome-ralph-link{display:block;margin:.75rem auto 0}.welcome-hint{font-size:.7rem;margin-top:.75rem}.modal-wizard{display:flex;flex-direction:column}.wizard-progress{padding:.5rem}.wizard-step{padding:.3rem}.wizard-step-number{width:24px;height:24px;font-size:.7rem}.wizard-step-label{display:none}.timer-banner{padding-left:calc(.5rem + var(--safe-area-left));padding-right:calc(.5rem + var(--safe-area-right))}.respawn-banner{padding:.3rem .5rem;padding-left:calc(.5rem + var(--safe-area-left));padding-right:calc(.5rem + var(--safe-area-right));font-size:.65rem}.respawn-compact-layout{flex-direction:column;gap:.15rem}.respawn-status-col{flex-shrink:1;min-width:0;gap:.1rem}.respawn-status-row1{flex-wrap:wrap;gap:.25rem;row-gap:.1rem}.respawn-state{font-size:.6rem;padding:.05rem .3rem}.respawn-banner .detection-confidence{font-size:.5rem;padding:.02rem .2rem}.respawn-cycles{font-size:.55rem}.respawn-timer{font-size:.55rem;padding:0 .25rem}.respawn-tokens{font-size:.55rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:120px}.respawn-indicator{font-size:.65rem}.respawn-banner .btn-icon-only{min-width:36px;min-height:36px;font-size:1rem;display:flex;align-items:center;justify-content:center;margin-left:auto;border-radius:6px;flex-shrink:0}.respawn-status-row2{font-size:.55rem;gap:.3rem;min-height:0;flex-wrap:wrap}.respawn-banner .detection-hook,.respawn-banner .detection-ai-check,.respawn-banner .detection-status{font-size:.55rem;padding:.02rem .2rem}.respawn-countdown-timers{gap:.2rem}.respawn-countdown-timer{font-size:.5rem;padding:.02rem .2rem;gap:.15rem}.respawn-countdown-timer .respawn-timer-bar{display:none}.respawn-action-log{border-left:none;border-top:1px solid rgba(34,197,94,.15);padding-left:0;padding-top:.15rem;max-height:1.4em;font-size:.55rem;overflow:hidden}.respawn-header{flex-direction:row;gap:.4rem;align-items:center}.respawn-header .respawn-actions{display:flex;gap:.3rem;flex-shrink:0}.respawn-header .respawn-actions .btn-toolbar{min-height:28px!important;font-size:.7rem!important;padding:.2rem .5rem!important;border-radius:5px}.duration-presets{display:grid;grid-template-columns:repeat(4,1fr);gap:.2rem}.duration-preset-btn{min-height:32px;padding:.2rem .25rem;font-size:.65rem;border-radius:5px;text-align:center}.duration-custom{grid-column:1 / -1;display:flex;gap:.25rem;align-items:center}.duration-custom .duration-preset-btn{flex:0 0 auto;min-width:50px}.duration-custom-input.visible{flex:1}.duration-custom-input input{width:100%;min-height:28px;font-size:16px}.preset-selector{display:grid;grid-template-columns:1fr 1fr;gap:.25rem}.preset-selector select{grid-column:1 / -1;min-height:32px;font-size:16px;border-radius:5px;padding:.2rem .4rem}.preset-selector .btn{min-height:32px;font-size:.65rem;border-radius:5px;padding:.2rem .4rem}#sessionOptionsModal textarea{font-size:16px;min-height:32px!important;max-height:56px;height:auto!important;border-radius:6px;padding:.3rem .5rem}#modalRespawnPrompt{min-height:32px!important;max-height:56px}#modalRespawnKickstart{min-height:32px!important;max-height:48px}#sessionOptionsModal .checkbox-inline{min-height:30px;font-size:.75rem;padding:.15rem 0;gap:.4rem}#sessionOptionsModal .checkbox-inline input[type=checkbox]{width:18px;height:18px}#sessionOptionsModal .respawn-options-row{gap:.5rem}#sessionOptionsModal .form-section-header{margin-top:.75rem;padding-top:.5rem;font-size:.65rem}#sessionOptionsModal .form-row{margin-bottom:.5rem}#sessionOptionsModal .form-row label{font-size:.65rem;margin-bottom:.2rem}#sessionOptionsModal .form-hint{font-size:.6rem;margin-top:.2rem}.context-setting{padding:.625rem}.context-setting-header{flex-wrap:wrap;gap:.4rem}.context-setting-header .input-suffix-sm input{width:60px;font-size:16px;min-height:36px}.context-setting input[type=text]{font-size:16px;min-height:36px;padding:.4rem .6rem;border-radius:6px}.color-picker{gap:8px}.color-swatch{width:36px;height:36px;border-radius:6px}.form-row-switch{min-height:40px;gap:.4rem}.context-settings-grid input[type=number]{font-size:16px;min-height:36px}.ralph-limits-grid{grid-template-columns:1fr 1fr;gap:.5rem}.ralph-limits-grid .form-col input[type=number]{font-size:16px;min-height:36px;padding:.4rem .5rem;border-radius:6px}#modalRalphPhrase{font-size:16px;min-height:40px;border-radius:6px}.ralph-config-actions{margin-top:1rem}.ralph-config-actions .btn-toolbar{width:100%;min-height:44px;font-size:.85rem;border-radius:8px}.run-summary-filters{gap:.3rem;margin-bottom:.5rem}.filter-btn{padding:.35rem .75rem;font-size:.7rem;min-height:32px}.timeline-event{padding:.4rem .5rem;margin-bottom:.25rem;font-size:.7rem}.run-summary-footer{flex-direction:column;gap:.4rem;padding:.5rem 0}.run-summary-actions{flex-wrap:wrap;gap:.3rem}.run-summary-actions .btn-toolbar{flex:1;min-height:36px;font-size:.7rem;white-space:nowrap}.auto-refresh-label{font-size:.7rem}.ralph-panel{font-size:.75rem}.ralph-summary{padding:.4rem .5rem;padding-left:calc(.5rem + var(--safe-area-left));padding-right:calc(.5rem + var(--safe-area-right))}.project-insights-panel{max-width:100%;font-size:.65rem;bottom:calc(44px + 2rem + var(--safe-area-bottom))}.file-browser-panel{max-width:100%;max-height:50vh;bottom:calc(44px + 2rem + var(--safe-area-bottom))}.notification-drawer{width:100%;max-width:100%;right:0;border-radius:0;padding-left:var(--safe-area-left);padding-right:var(--safe-area-right);padding-bottom:var(--safe-area-bottom)}input,textarea,[contenteditable]{scroll-margin-bottom:200px;scroll-margin-top:80px}.keyboard-visible .modal-body{max-height:40vh;overflow-y:auto}.keyboard-visible #createCaseModal .modal-body{max-height:60vh}.mobile-case-picker .modal-backdrop{background:#00000080}.mobile-case-picker-sheet{max-height:60vh;padding-bottom:var(--safe-area-bottom);animation:slideUp .2s ease-out}@keyframes slideUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}.mobile-case-picker-header .modal-close{width:32px;height:32px;font-size:1.5rem}.mobile-case-picker-footer{padding-bottom:calc(12px + var(--safe-area-bottom))}.modal-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;gap:.25rem;padding:0 .75rem .5rem;flex-wrap:nowrap}.modal-tabs::-webkit-scrollbar{display:none}.modal-tab-btn{padding:.35rem .6rem;font-size:.65rem;white-space:nowrap;flex-shrink:0}#createCaseModal .modal-tabs{gap:.5rem;padding:.5rem 1rem .75rem}#createCaseModal .modal-tab-btn{flex:1;min-height:44px;padding:.6rem 1rem;font-size:.8rem;font-weight:500;border-radius:8px;justify-content:center;text-align:center}#createCaseModal .form-row{margin-bottom:1rem}#createCaseModal .form-row label{font-size:.8rem;margin-bottom:.4rem;font-weight:500;color:#e5e7eb}#createCaseModal .form-row input[type=text]{min-height:44px;font-size:16px;padding:.5rem .75rem;border-radius:8px}#createCaseModal .form-row .form-hint{font-size:.65rem;margin-top:.35rem;line-height:1.4}#createCaseModal .form-actions{padding:.75rem 1rem;padding-bottom:calc(.75rem + var(--safe-area-bottom));gap:.75rem}#createCaseModal .form-actions .btn-toolbar{min-height:44px!important;max-height:44px!important;height:44px!important;font-size:.85rem!important;font-weight:500;border-radius:8px}#caseModalSubmit.loading{opacity:.6;pointer-events:none}#createCaseModal.from-mobile .modal-content{animation:caseModalSlideUp .25s ease-out}@keyframes caseModalSlideUp{0%{transform:translateY(30px);opacity:0}to{transform:translateY(0);opacity:1}}.btn-case-create-mobile{min-height:48px!important;max-height:48px!important;height:48px!important;font-size:.85rem!important;font-weight:500;border-radius:10px}.settings-grid{grid-template-columns:1fr;gap:.35rem}.settings-grid-3col{grid-template-columns:1fr 1fr 1fr}.settings-item{padding:.35rem .5rem;font-size:.7rem}.settings-item-label{font-size:.7rem}.settings-section-header{font-size:.6rem;padding:.35rem 0 .2rem;margin-top:.5rem}.form-row{margin-bottom:.5rem}.form-row label{font-size:.7rem;margin-bottom:.2rem}.form-row .form-hint{font-size:.6rem}.form-row input[type=text],.form-row input[type=number],.form-row textarea,.form-row .form-select,.form-row select{font-size:.75rem;padding:.35rem .5rem;min-height:32px}.form-row-switch{gap:.3rem}.form-row-switch>label:first-child{font-size:.7rem}.form-section-header{font-size:.6rem;margin-top:.75rem}.event-type-grid{grid-template-columns:1fr 36px 36px 36px;gap:4px 4px;padding:6px;margin-top:6px}.event-header{font-size:.55rem}.event-label{font-size:.65rem}.event-type-grid input[type=checkbox]{width:12px;height:12px}.form-actions{gap:.5rem}.form-actions .btn-toolbar{flex:1;min-height:36px!important;max-height:36px!important;height:36px!important;font-size:.75rem!important}.subagent-window{position:fixed;width:calc(100% - 8px);max-width:calc(100% - 8px);height:110px;min-height:80px;max-height:110px;min-width:200px;border-radius:6px;resize:none;box-shadow:0 2px 8px #0006}.subagent-window:after{display:none}.subagent-window-header{padding:.2rem .4rem;min-height:24px}.subagent-window-title{gap:.2rem;overflow:hidden}.subagent-window-title .icon{font-size:.7rem}.subagent-window-title .id{font-size:.6rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:45vw}.subagent-window-title .status{font-size:.45rem;padding:.05rem .15rem}.subagent-model-badge{font-size:.45rem!important;padding:.05rem .15rem!important}.subagent-window-actions button{font-size:.7rem;padding:.15rem .35rem;min-width:26px;min-height:26px;display:flex;align-items:center;justify-content:center}.subagent-window-body{font-size:.6rem;padding:.2rem .35rem}.subagent-window-body .activity-line{gap:.15rem;padding:.05rem 0}.subagent-window-body .activity-line .time{font-size:.5rem}.subagent-window-body .activity-line .tool-name,.subagent-window-body .activity-line .tool-detail{font-size:.55rem}.subagent-window-parent{display:none}.session-tab .tab-subagent-badge{height:14px;padding:0 3px;border-radius:7px;margin-left:2px}.session-tab .tab-subagent-badge .subagent-label{font-size:.45rem}.subagent-dropdown{position:fixed!important;left:8px!important;right:8px!important;bottom:auto!important;min-width:auto!important;max-width:none!important;border-radius:8px;transform:none!important}}.keyboard-accessory-bar{display:none;height:44px;background:#1a1a1a;border-top:1px solid rgba(255,255,255,.1);padding:6px 8px;gap:8px;align-items:center;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;z-index:51}.keyboard-accessory-bar.visible{display:flex}.keyboard-accessory-bar::-webkit-scrollbar{display:none}.accessory-btn{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;gap:4px;padding:6px 12px;background:#2a2a2a;border:1px solid rgba(255,255,255,.15);border-radius:6px;color:#e5e5e5;font-size:.65rem;font-weight:500;cursor:pointer;transition:background .15s,border-color .15s}.accessory-btn.confirming{background:#6b4f00;border-color:#b8860b;color:#ffd54f}.accessory-btn:active{background:#3a3a3a}.accessory-btn svg{width:14px;height:14px}.accessory-btn-arrow{padding:6px 10px;background:#2563eb;border-color:#3b82f680;color:#fff}.accessory-btn-arrow:active{background:#1d4ed8}.accessory-btn-dismiss{margin-left:auto;flex:1 1 0;max-width:80px;padding:10px 8px;background:#334d6e;border-color:#6496c866;color:#c0d4e8;font-weight:600}.accessory-btn-dismiss svg{width:20px;height:20px}.accessory-btn-dismiss:active{background:#3d5f85}.ios-device.safari-browser{overscroll-behavior:none}@media(hover:none)and (pointer:coarse){.session-tab .tab-close,.session-tab .tab-gear{opacity:1;width:auto;padding:.15rem .25rem;align-items:center;justify-content:center}.btn-toolbar:hover,.btn-icon-header:hover{transform:none}.subagent-dropdown-trigger:active+.subagent-dropdown-menu,.subagent-dropdown-trigger:focus+.subagent-dropdown-menu{display:block}}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";(function(e){const s=/^\x1b\[[\?>=]?[\d;]*[cnR]$/,i=/^\x1b\][\d;]*[^\x07\x1b]*(?:\x07|\x1b\\)$/;function n(o){return s.test(o)||i.test(o)}function l(o){return n(o)}e.CodemanTerminalInput={isTerminalQueryResponse:n,shouldSuppressTerminalQueryResponse:l}})(window),Object.assign(CodemanApp.prototype,{initTerminal(){const e=parseInt(localStorage.getItem("codeman-scrollback")),s=Number.isFinite(e)&&e>0?Math.max(e,DEFAULT_SCROLLBACK):DEFAULT_SCROLLBACK;if(this.terminal=new Terminal({theme:{background:"#0d0d0d",foreground:"#e0e0e0",cursor:"#e0e0e0",cursorAccent:"#0d0d0d",selection:"rgba(255, 255, 255, 0.3)",black:"#0d0d0d",red:"#ff6b6b",green:"#51cf66",yellow:"#ffd43b",blue:"#339af0",magenta:"#cc5de8",cyan:"#22b8cf",white:"#e0e0e0",brightBlack:"#495057",brightRed:"#ff8787",brightGreen:"#69db7c",brightYellow:"#ffe066",brightBlue:"#5c7cfa",brightMagenta:"#da77f2",brightCyan:"#66d9e8",brightWhite:"#ffffff"},fontFamily:'"Fira Code", "Cascadia Code", "JetBrains Mono", "SF Mono", Monaco, monospace',fontSize:MobileDetection.getDeviceType()==="mobile"?10:14,lineHeight:1.2,cursorBlink:!1,cursorStyle:"block",scrollback:s,allowTransparency:!0,allowProposedApi:!0}),this.fitAddon=new FitAddon.FitAddon,this.terminal.loadAddon(this.fitAddon),typeof Unicode11Addon<"u")try{const t=new Unicode11Addon.Unicode11Addon;this.terminal.loadAddon(t),this.terminal.unicode.activeVersion="11"}catch{}const i=document.getElementById("terminalContainer");this.terminal.open(i),this.terminal.attachCustomKeyEventHandler(t=>{if(t.isComposing||t.keyCode===229||t.altKey&&t.key>="0"&&t.key<="9")return!1;if((t.ctrlKey||t.metaKey)&&t.key==="v"&&t.type==="keydown")return this.activeSessionId&&this._handleImagePaste&&this._handleImagePaste(),!1;if(t.key==="Enter"&&(t.shiftKey||t.ctrlKey)&&t.type==="keydown"){if(this.activeSessionId)if(this._localEchoEnabled){const d=this._localEchoOverlay?.pendingText||"";this._localEchoOverlay?.clear(),this._localEchoOverlay?.suppressBufferDetection(),this._flushedOffsets?.delete(this.activeSessionId),this._flushedTexts?.delete(this.activeSessionId),d&&(this._pendingInput+=d,y()),setTimeout(()=>{fetch(`/api/sessions/${this.activeSessionId}/send-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t.ctrlKey?"C-Enter":"S-Enter"})})},d?80:0)}else fetch(`/api/sessions/${this.activeSessionId}/send-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t.ctrlKey?"C-Enter":"S-Enter"})});return!1}return!0});{const t=i.querySelector(".xterm-helper-textarea");if(t&&MobileDetection.isTouchDevice()){let d=!1,f=0;t.addEventListener("compositionstart",()=>{d=!0}),t.addEventListener("compositionend",()=>{d=!1}),t.addEventListener("keydown",c=>{!c.isComposing&&c.keyCode!==229&&(f=Date.now())}),t.addEventListener("input",c=>{if(d||c.isComposing||c.inputType!=="insertText"||!c.data||Date.now()-f<50)return;const h=c.data,p=this._localEchoOverlay?.pendingText||"";Promise.resolve().then(()=>{if(this._lastTerminalData?.data===h&&performance.now()-this._lastTerminalData.time<100){t.value="";return}const _=this._localEchoOverlay?.pendingText||"";if(this._localEchoEnabled&&_.length>p.length&&_.endsWith(h)){t.value="";return}const g=t.value;!g||g.trim()===""&&h!==" "||(this.terminal._core.coreService.triggerDataEvent(h,!0),t.value="")})})}}this._webglAddon=null;const n=new URLSearchParams(location.search);if(n.get("webgl")==="force")try{localStorage.removeItem("codeman-webgl-disabled")}catch{}const l=(()=>{try{const t=localStorage.getItem("codeman-webgl-disabled");if(!t)return!1;const{at:d}=JSON.parse(t);return Date.now()-d>WEBGL_FALLBACK.STICKY_EXPIRY_MS?(localStorage.removeItem("codeman-webgl-disabled"),!1):!0}catch{return!1}})(),o=MobileDetection.getDeviceType()!=="desktop"||n.has("nowebgl")||l;if(l&&console.log("[CRASH-DIAG] WebGL sticky-disabled from prior stalls \u2014 DOM renderer in use. Re-enable: ?webgl=force"),!o)if(typeof WebglAddon<"u")this._initWebGL();else{const t=document.createElement("script");t.src="vendor/xterm-addon-webgl.min.js",t.onload=()=>this._initWebGL(),t.onerror=()=>console.warn("[CRASH-DIAG] Failed to load WebGL addon \u2014 using canvas renderer"),document.head.appendChild(t)}this._localEchoOverlay=new LocalEchoOverlay(this.terminal),MobileDetection.isTouchDevice()&&(this.terminal.onCursorMove(()=>this._syncMobileHelperTextareaToCursor()),this.terminal.onRender(()=>this._syncMobileHelperTextareaToCursor())),this._cjkInput=null,typeof CjkInput<"u"&&(this._cjkInput=CjkInput.init({send:t=>{this._handleCjkInput(t)}})),MobileDetection.getDeviceType()==="mobile"&&document.body.classList.contains("safari-browser")?requestAnimationFrame(()=>{this.fitAddon.fit(),requestAnimationFrame(()=>this.fitAddon.fit())}):this.fitAddon.fit(),this.registerFilePathLinkProvider(),i.addEventListener("wheel",t=>{t.preventDefault();const d=Math.round(t.deltaY/25)||(t.deltaY>0?1:-1);this.terminal.scrollLines(d)},{passive:!1});{const t=()=>this.terminal._core?._renderService?.dimensions?.css?.cell?.height||13;let d=0,f=0,c=0,h=null,p=!1;const _=b=>{const E=c?(b-c)/16.67:1;if(c=b,!p&&Math.abs(f)>.3){const T=Math.round(f/t());T!==0&&this.terminal.scrollLines(T),f*=.92,h=requestAnimationFrame(_)}else p?h=requestAnimationFrame(_):(h=null,f=0)};let g=0,v=!1;i.addEventListener("touchstart",b=>{b.touches.length===1&&(d=b.touches[0].clientY,f=0,g=0,p=!0,v=!1,c=0,h&&(cancelAnimationFrame(h),h=null))},{passive:!0}),i.addEventListener("touchmove",b=>{if(b.touches.length===1&&p){b.preventDefault(),v=!0;const E=b.touches[0].clientY,T=d-E;g+=T,f=T*1.2,d=E;const x=t(),S=Math.trunc(g/x);S!==0&&(this.terminal.scrollLines(S),g-=S*x)}},{passive:!1}),i.addEventListener("touchend",()=>{if(p=!1,!h&&Math.abs(f)>.3&&(h=requestAnimationFrame(_)),!v&&this.terminal){const b=document.getElementById("cjkInput");b?.classList.contains("cjk-input-visible")?b.focus():(this._syncMobileHelperTextareaToCursor(),this.terminal.focus())}},{passive:!0}),i.addEventListener("touchcancel",()=>{p=!1,f=0,g=0},{passive:!0})}this.showWelcome(),this.initImageInput(),this._chunkedWriteGen=0,this._bufferLoadSeq=0,this._bufferLoadOwner=null,this._resizeTimeout=null,this._lastResizeDims=null;const u=40,a=10,m=()=>{this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(()=>{this._resizeTimeout=null,this.fitAddon&&this.fitAddon.fit(),this.flickerFilterBuffer&&(this.flickerFilterTimeout&&(clearTimeout(this.flickerFilterTimeout),this.flickerFilterTimeout=null),this.flushFlickerBuffer());const t=typeof KeyboardHandler<"u"&&KeyboardHandler.keyboardVisible;if(this.activeSessionId&&!t){const d=this.fitAddon.proposeDimensions(),f=d?Math.max(d.cols,u):u,c=d?Math.max(d.rows,a):a;if(!this._lastResizeDims||f!==this._lastResizeDims.cols||c!==this._lastResizeDims.rows){const h=this.activeSessionId?this.sessions.get(this.activeSessionId):null;h&&h.mode!=="shell"&&this.terminal&&this.isTerminalAtBottom()&&this.terminal.write("\x1B[3J\x1B[H\x1B[2J"),this._lastResizeDims={cols:f,rows:c};const p=typeof MobileDetection<"u"&&MobileDetection.getDeviceType?MobileDetection.getDeviceType():"desktop";let _=!1;if(this._wsReady&&this._wsSessionId===this.activeSessionId)try{this._ws.send(JSON.stringify({t:"z",c:f,r:c,v:p})),_=!0}catch{}_||fetch(`/api/sessions/${this.activeSessionId}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cols:f,rows:c,viewportType:p})}).catch(()=>{})}}this.updateConnectionLines(),this._localEchoOverlay?.hasPending&&this._localEchoOverlay.rerender()},300)};window.addEventListener("resize",m),this.terminalResizeObserver&&this.terminalResizeObserver.disconnect(),this.terminalResizeObserver=new ResizeObserver(m),this.terminalResizeObserver.observe(i),this._pendingInput="",this._inputFlushTimeout=null,this._lastKeystrokeTime=0;const y=()=>{if(this._inputFlushTimeout=null,this._pendingInput&&this.activeSessionId){const t=this._pendingInput,d=this.activeSessionId;this._pendingInput="",this._sendInputAsync(d,t)}};this.terminal.onData(t=>{if(!(window.cjkActive||document.activeElement?.id==="cjkInput")&&this.activeSessionId){if(window.CodemanTerminalInput?.shouldSuppressTerminalQueryResponse(t))return;if(this._lastTerminalData={data:t,time:performance.now()},this._localEchoEnabled){if(t==="\x7F"){if(this._localEchoOverlay?.removeChar()==="flushed"){const{count:c,text:h}=this._localEchoOverlay.getFlushed();this._flushedOffsets?.has(this.activeSessionId)&&(c===0?(this._flushedOffsets.delete(this.activeSessionId),this._flushedTexts?.delete(this.activeSessionId)):(this._flushedOffsets.set(this.activeSessionId,c),this._flushedTexts?.set(this.activeSessionId,h))),this._pendingInput+=t,y()}return}if(/^[\r\n]+$/.test(t)){const f=this._localEchoOverlay?.pendingText||"";this._localEchoOverlay?.clear(),this._localEchoOverlay?.suppressBufferDetection(),this._flushedOffsets?.delete(this.activeSessionId),this._flushedTexts?.delete(this.activeSessionId),this._inputFlushTimeout&&(clearTimeout(this._inputFlushTimeout),this._inputFlushTimeout=null),f&&(this._pendingInput+=f,y()),setTimeout(()=>{this._pendingInput+="\r",y()},80);return}if(t.length>1&&t.charCodeAt(0)>=32){this._localEchoOverlay?.appendText(t);return}if(t.charCodeAt(0)<32){if(t.length>1&&t.charCodeAt(0)===27){this._pendingInput+=t,y();return}if(this._restoringFlushedState){this._pendingInput+=t,y();return}if(t===" "){const c=this._localEchoOverlay?.pendingText||"";this._localEchoOverlay?.clear(),this._flushedOffsets?.delete(this.activeSessionId),this._flushedTexts?.delete(this.activeSessionId),c&&(this._pendingInput+=c),this._pendingInput+=t,this._inputFlushTimeout&&(clearTimeout(this._inputFlushTimeout),this._inputFlushTimeout=null);let h="";try{const _=this._localEchoOverlay?.findPrompt?.();if(_){const g=this.terminal.buffer.active,v=g.getLine(g.viewportY+_.row);v&&(h=v.translateToString(!0).slice(_.col+2).trimEnd())}}catch{}this._tabCompletionBaseText=h,y(),this._tabCompletionSessionId=this.activeSessionId,this._tabCompletionRetries=0,this._tabCompletionFallback&&clearTimeout(this._tabCompletionFallback);const p=this;this._tabCompletionFallback=setTimeout(()=>{if(p._tabCompletionFallback=null,!p._tabCompletionSessionId||p._tabCompletionSessionId!==p.activeSessionId)return;const _=p._localEchoOverlay;!_||_.pendingText||p.terminal.write("",()=>{if(!p._tabCompletionSessionId)return;_.resetBufferDetection();const g=_.detectBufferText();g&&g!==p._tabCompletionBaseText&&(p._tabCompletionSessionId=null,p._tabCompletionRetries=0,p._tabCompletionBaseText=null,_.rerender())})},300);return}const f=this._localEchoOverlay?.pendingText||"";this._localEchoOverlay?.clear(),this._localEchoOverlay?.suppressBufferDetection(),this._flushedOffsets?.delete(this.activeSessionId),this._flushedTexts?.delete(this.activeSessionId),f&&(this._pendingInput+=f),this._pendingInput+=t,this._inputFlushTimeout&&(clearTimeout(this._inputFlushTimeout),this._inputFlushTimeout=null),y();return}if(t.length===1&&t.charCodeAt(0)>=32){this._localEchoOverlay?.addChar(t);return}}if(this._pendingInput+=t,t.charCodeAt(0)<32||t.length>1){this._inputFlushTimeout&&(clearTimeout(this._inputFlushTimeout),this._inputFlushTimeout=null),y();return}const d=performance.now();d-this._lastKeystrokeTime>50?(this._inputFlushTimeout&&(clearTimeout(this._inputFlushTimeout),this._inputFlushTimeout=null),this._lastKeystrokeTime=d,y()):(this._lastKeystrokeTime=d,this._inputFlushTimeout||(this._inputFlushTimeout=setTimeout(y,0)))}})},registerFilePathLinkProvider(){const e=this;let s=-1;this.terminal.registerLinkProvider({provideLinks(i,n){i!==s&&(s=i,console.debug("[LinkProvider] Checking line:",i));const o=e.terminal.buffer.active.getLine(i-1);if(!o){n(void 0);return}const r=o.translateToString(!0);if(!r||!r.includes("/")){n(void 0);return}const u=[],a=/https?:\/\/[^\s"'<>|;&)\]\x00-\x1f]+/g,m=(h,p)=>{const _=h.replace(/[.,;:!?)]+$/,""),g=r.indexOf(_,p);g!==-1&&(u.some(v=>v.range.start.x===g+1)||u.push({text:_,range:{start:{x:g+1,y:i},end:{x:g+_.length+1,y:i}},decorations:{pointerCursor:!0,underline:!0},activate(v,b){window.open(b,"_blank","noopener,noreferrer")}}))},y=/\b(tail|cat|head|less|grep|watch|vim|nano)\s+(?:[^\s\/]+\s+){0,4}(\/[^\s"'<>|;&\n\x00-\x1f]+)/g,t=/(\/(?:home|tmp|var|etc|opt)[^\s"'<>|;&\n\x00-\x1f]*\.(?:log|txt|json|md|yaml|yml|csv|xml|sh|py|ts|js))\b/g,d=/Bash\([^)]*?(\/(?:home|tmp|var|etc|opt)[^\s"'<>|;&\)\n\x00-\x1f]+)/g,f=(h,p)=>{const _=r.indexOf(h,p);_!==-1&&(u.some(g=>g.range.start.x===_+1)||u.push({text:h,range:{start:{x:_+1,y:i},end:{x:_+h.length+1,y:i}},decorations:{pointerCursor:!0,underline:!0},activate(g,v){e.openLogViewerWindow(v,e.activeSessionId)}}))};let c;for(a.lastIndex=0;(c=a.exec(r))!==null;)m(c[0],c.index);for(y.lastIndex=0;(c=y.exec(r))!==null;)f(c[2],c.index);for(t.lastIndex=0;(c=t.exec(r))!==null;)f(c[1],c.index);for(d.lastIndex=0;(c=d.exec(r))!==null;)f(c[1],c.index);u.length>0&&console.debug("[LinkProvider] Found links:",u.map(h=>h.text)),n(u.length>0?u:void 0)}}),console.log("[LinkProvider] File path link provider registered")},showWelcome(){const e=document.getElementById("welcomeOverlay");e&&(e.classList.add("visible"),this.loadTunnelStatus(),this.loadHistorySessions())},hideWelcome(){const e=document.getElementById("welcomeOverlay");e&&e.classList.remove("visible");const s=document.getElementById("welcomeQr");s&&(clearTimeout(this._welcomeQrShrinkTimer),s.classList.remove("expanded"))},async _fetchHistorySessions(){const i=(await(await fetch("/api/history/sessions")).json()).data?.sessions||[];if(i.length===0)return[];const n=new Map;for(const o of i){const r=o.projectKey||o.workingDir;n.has(r)||n.set(r,[]),n.get(r).push(o)}const l=[];for(const[,o]of n)l.push(...o.slice(0,3));return l.sort((o,r)=>new Date(r.lastModified)-new Date(o.lastModified)),l},_resolveCaseLabel(e,s){if(!e)return"";let i=null;for(const n of s||[])if(!(!n||!n.path)){if(e===n.path)return`#${n.name}`;if(e.startsWith(n.path+"/")){const l=n.path.length;(!i||l>i.len)&&(i={name:n.name,suffix:e.slice(l),len:l})}}return i?`#${i.name}${i.suffix}`:e.split("/").pop()||e},_shortenHomePath(e){return(e||"").replace(/^\/home\/[^/]+\//,"~/").replace(/^\/Users\/[^/]+\//,"~/")},_buildHistoryItem(e,s,i){const n=i?.showViewAll!==!1,l=e.sizeBytes<1024?`${e.sizeBytes}B`:e.sizeBytes<1048576?`${(e.sizeBytes/1024).toFixed(0)}K`:`${(e.sizeBytes/1048576).toFixed(1)}M`,o=new Date(e.lastModified),r=o.toLocaleDateString("en",{month:"short",day:"numeric"})+" "+o.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",hour12:!1}),u=this._shortenHomePath(e.workingDir),a=this._resolveCaseLabel(e.workingDir,s),m=document.createElement("div");m.className="history-item",m.title=e.workingDir;const y=document.createElement("div");y.className="history-item-main",y.addEventListener("click",()=>this.resumeHistorySession(e.sessionId,e.workingDir));const t=document.createElement("div");t.className="history-item-text";const d=document.createElement("span");d.className="history-item-title",d.textContent=e.firstPrompt||u;const f=document.createElement("span");f.className="history-item-subtitle",a.startsWith("#")&&f.classList.add("is-case"),f.textContent=a,t.append(d,f);const c=document.createElement("span");c.className="history-item-meta",c.textContent=r;const h=document.createElement("button");h.className="history-item-expand",h.type="button",h.setAttribute("aria-label","Show details"),h.setAttribute("aria-expanded","false"),h.textContent="\u22EF",y.append(t,c,h);const p=document.createElement("div");p.className="history-item-detail",p.hidden=!0;const _=document.createElement("div");_.className="history-detail-row";const g=document.createElement("span");g.className="history-detail-label",g.textContent="Prompt";const v=document.createElement("span");v.className="history-detail-value history-detail-prompt",v.textContent=e.firstPrompt||"(no prompt captured)",_.append(g,v);const b=document.createElement("div");b.className="history-detail-row";const E=document.createElement("span");E.className="history-detail-label",E.textContent="Path";const T=document.createElement("span");T.className="history-detail-value history-detail-path",T.textContent=u,b.append(E,T);const x=document.createElement("div");if(x.className="history-detail-row history-detail-meta",x.textContent=`${r} \xB7 ${l} \xB7 ${e.sessionId.slice(0,8)}`,p.append(_,b,x),n&&e.projectKey){const S=document.createElement("div");S.className="history-detail-row history-detail-actions";const w=document.createElement("button");w.type="button",w.className="history-view-all-btn",w.textContent="View all in this folder",w.addEventListener("click",I=>{I.stopPropagation(),this.openFolderHistoryModal(e.projectKey,e.workingDir,s)}),S.appendChild(w),p.appendChild(S)}return h.addEventListener("click",S=>{S.stopPropagation();const w=m.classList.toggle("expanded");p.hidden=!w,h.setAttribute("aria-expanded",w?"true":"false")}),m.append(y,p),m},_HISTORY_INITIAL_COUNT:4,async loadHistorySessions(){const e=document.getElementById("historySessions"),s=document.getElementById("historyList");if(!(!e||!s))try{const i=Array.isArray(this.cases)&&this.cases.length>0?Promise.resolve(this.cases):fetch("/api/cases").then(r=>r.ok?r.json():null).then(r=>r?.data||[]).catch(()=>[]),[n,l]=await Promise.all([this._fetchHistorySessions(30),i]);if(n.length===0){e.style.display="none";return}s.replaceChildren();const o=this._HISTORY_INITIAL_COUNT;for(let r=0;r<Math.min(o,n.length);r++)s.appendChild(this._buildHistoryItem(n[r],l));if(n.length>o){const r=document.createElement("button");r.className="history-show-more",r.textContent=`Show ${n.length-o} more`,r.addEventListener("click",()=>{for(let u=o;u<n.length;u++)s.insertBefore(this._buildHistoryItem(n[u],l),r);r.remove()}),s.appendChild(r)}e.style.display=""}catch(i){console.error("[loadHistorySessions]",i),e.style.display="none"}},_FOLDER_HISTORY_PAGE_SIZE:20,openFolderHistoryModal(e,s,i){this._closeFolderHistoryModal();const n=document.createElement("div");n.className="modal active folder-history-modal",n.id="folderHistoryModal";const l=document.createElement("div");l.className="modal-backdrop",l.addEventListener("click",()=>this._closeFolderHistoryModal());const o=document.createElement("div");o.className="modal-content modal-lg";const r=document.createElement("div");r.className="modal-header";const u=document.createElement("h3");u.textContent="Folder History";const a=document.createElement("div");a.className="folder-history-subtitle",a.textContent=this._shortenHomePath(s);const m=document.createElement("button");m.className="modal-close",m.setAttribute("aria-label","Close"),m.innerHTML="×",m.addEventListener("click",()=>this._closeFolderHistoryModal()),r.append(u,m);const y=document.createElement("div");y.className="modal-body";const t=document.createElement("div");t.className="folder-history-list",t.setAttribute("data-loading","true"),t.textContent="Loading...",y.append(a,t),o.append(r,y),n.append(l,o),document.body.appendChild(n),this._folderHistoryState={projectKey:e,workingDir:s,cases:i||[],offset:0,total:null,list:t},this._folderHistoryEscHandler=d=>{d.key==="Escape"&&this._closeFolderHistoryModal()},document.addEventListener("keydown",this._folderHistoryEscHandler),this._loadFolderHistoryPage()},async _loadFolderHistoryPage(){const e=this._folderHistoryState;if(!e)return;const{projectKey:s,cases:i,list:n}=e,l=this._FOLDER_HISTORY_PAGE_SIZE,o=e.offset,r=n.querySelector(".folder-history-more");r&&r.remove(),o===0&&(n.replaceChildren(),n.removeAttribute("data-loading"));try{const u=`/api/history/sessions?projectKey=${encodeURIComponent(s)}&offset=${o}&limit=${l}`,m=await(await fetch(u)).json(),y=m.data?.sessions||[];if(e.total=typeof m.data?.total=="number"?m.data.total:y.length+o,o===0&&y.length===0){const t=document.createElement("div");t.className="folder-history-empty",t.textContent="No conversations found in this folder.",n.appendChild(t);return}for(const t of y)n.appendChild(this._buildHistoryItem(t,i,{showViewAll:!1}));if(e.offset=o+y.length,e.offset<e.total){const t=e.total-e.offset,d=document.createElement("button");d.className="history-show-more folder-history-more",d.textContent=`Show ${Math.min(l,t)} more (${t} remaining)`,d.addEventListener("click",()=>this._loadFolderHistoryPage()),n.appendChild(d)}}catch(u){console.error("[loadFolderHistoryPage]",u);const a=document.createElement("div");a.className="folder-history-empty",a.textContent="Failed to load folder history.",n.appendChild(a)}},_closeFolderHistoryModal(){const e=document.getElementById("folderHistoryModal");e&&e.remove(),this._folderHistoryEscHandler&&(document.removeEventListener("keydown",this._folderHistoryEscHandler),this._folderHistoryEscHandler=null),this._folderHistoryState=null},async resumeHistorySession(e,s){document.getElementById("runModeMenu")?.classList.remove("active"),this._closeFolderHistoryModal();try{this.terminal.clear(),this.terminal.writeln(`\x1B[1;32m Resuming conversation ${e.slice(0,8)}...\x1B[0m`);const i=s.split("/").pop()||"session";let n=1;for(const[,f]of this.sessions){const c=f.name&&f.name.match(/^w(\d+)-/);if(c){const h=parseInt(c[1]);h>=n&&(n=h+1)}}const l=`w${n}-${i}`,r=(this.cases||[]).find(f=>f.path===s)?.name||s.split("/").pop()||"",u=this.loadAppSettingsFromStorage(),a=this.buildEnvOverrides(this.getCaseSettings(r),u),m=this.getEffortSetting(u),t=await(await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workingDir:s,name:l,resumeSessionId:e,...Object.keys(a).length>0?{envOverrides:a}:{},...m?{effort:m}:{}})})).json();if(!t.success)throw new Error(t.error);const d=t.data.session.id;await fetch(`/api/sessions/${d}/interactive`,{method:"POST"}),this.terminal.writeln(`\x1B[90m Session ${l} ready\x1B[0m`),await this.selectSession(d),this.terminal.focus()}catch(i){this.terminal.writeln(`\x1B[1;31m Error: ${i.message}\x1B[0m`)}},isTerminalAtBottom(){if(!this.terminal)return!0;const e=this.terminal.buffer.active;return e.viewportY>=e.baseY-2},batchTerminalWrite(e){if(this._isLoadingBuffer){this._loadBufferQueue&&this._loadBufferQueue.push(e);return}if(this.writeFrameScheduled||(this._wasAtBottomBeforeWrite=this.isTerminalAtBottom()),(this.activeSessionId?this.sessions.get(this.activeSessionId):null)?.flickerFilterEnabled??!1){if(e.includes("\x1B[2J")||e.includes("\x1B[H\x1B[J")||e.includes("\x1B[H")&&e.includes("\x1B[?25l")){this.flickerFilterActive=!0,this.flickerFilterBuffer+=e,this.flickerFilterTimeout&&clearTimeout(this.flickerFilterTimeout),this.flickerFilterTimeout=setTimeout(()=>{this.flickerFilterTimeout=null,this.flushFlickerBuffer()},SYNC_WAIT_TIMEOUT_MS);return}if(this.flickerFilterActive){this.flickerFilterBuffer+=e;return}}this.pendingWrites.push(e),this.writeFrameScheduled||(this.writeFrameScheduled=!0,this._safeYield(()=>{this.flushPendingWrites(),this.writeFrameScheduled=!1}))},flushFlickerBuffer(){this.flickerFilterBuffer&&(this.pendingWrites.push(this.flickerFilterBuffer),this.flickerFilterBuffer="",this.flickerFilterActive=!1,this.writeFrameScheduled||(this.writeFrameScheduled=!0,this._safeYield(()=>{this.flushPendingWrites(),this.writeFrameScheduled=!1})))},_updateLocalEchoState(){const e=this.loadAppSettingsFromStorage(),s=this.activeSessionId?this.sessions.get(this.activeSessionId):null,n=!!((e.localEchoEnabled??MobileDetection.isTouchDevice())&&s);this._localEchoEnabled&&!n&&this._localEchoOverlay?.clear(),this._localEchoEnabled=n,this._localEchoOverlay&&s&&(s.mode==="opencode"?this._localEchoOverlay.setPrompt({type:"custom",offset:3,find:l=>{try{const o=l.buffer.active,r=o.cursorY,u=o.getLine(o.viewportY+r);if(!u)return null;const m=u.translateToString(!0).indexOf("\u2503");return m>=0?{row:r,col:m}:null}catch{return null}}}):s.mode==="shell"?(this._localEchoOverlay.clear(),this._localEchoEnabled=!1):this._localEchoOverlay.setPrompt({type:"custom",offset:0,find:l=>{try{const o=l.buffer.active;for(let r=l.rows-1;r>=0;r--){const u=o.getLine(o.viewportY+r);if(!u)continue;const m=u.translateToString(!0).lastIndexOf("\u276F");if(m>=0)return{row:r,col:m+2}}return{row:Math.max(0,Math.min(l.rows-1,o.cursorY)),col:Math.max(0,Math.min(l.cols-1,o.cursorX))}}catch{return null}}}))},_handleCjkInput(e){if(!this.activeSessionId)return;const s=this.activeSessionId,i=this.sessions.get(s);if(!!!(this._localEchoEnabled&&this._localEchoOverlay&&i?.mode!=="shell")){this._sendInputAsync(s,e);return}if(e==="\x7F"){if(this._localEchoOverlay.removeChar()==="flushed"){const{count:o,text:r}=this._localEchoOverlay.getFlushed();this._flushedOffsets?.has(s)&&(o===0?(this._flushedOffsets.delete(s),this._flushedTexts?.delete(s)):(this._flushedOffsets.set(s,o),this._flushedTexts?.set(s,r))),this._sendInputAsync(s,e)}return}if(/[\r\n]+$/.test(e)){const l=e.replace(/[\r\n]+$/g,"");l&&this._localEchoOverlay.appendText(l);const o=this._localEchoOverlay.pendingText||"";this._localEchoOverlay.clear(),this._localEchoOverlay.suppressBufferDetection(),this._flushedOffsets?.delete(s),this._flushedTexts?.delete(s),o&&this._sendInputAsync(s,o),setTimeout(()=>this._sendInputAsync(s,"\r"),o?80:0);return}if(e.length>1&&e.charCodeAt(0)===27){this._sendInputAsync(s,e);return}if(e.length===1&&e.charCodeAt(0)<32){const l=this._localEchoOverlay.pendingText||"";this._localEchoOverlay.clear(),this._localEchoOverlay.suppressBufferDetection(),this._flushedOffsets?.delete(s),this._flushedTexts?.delete(s),l&&this._sendInputAsync(s,l),this._sendInputAsync(s,e);return}this._localEchoOverlay.appendText(e)},flushPendingWrites(){if(this.pendingWrites.length===0||!this.terminal)return;const e=performance.now(),s=this.pendingWrites.join("");this.pendingWrites=[];const i=s.length;i>16384&&_crashDiag.log(`FLUSH: ${(i/1024).toFixed(0)}KB`);const n=65536;let l=!1;i<=n?this.terminal.write(s):(this.terminal.write(s.slice(0,n)),this.pendingWrites.push(s.slice(n)),l=!0,this.writeFrameScheduled||(this.writeFrameScheduled=!0,this._safeYield(()=>{this.flushPendingWrites(),this.writeFrameScheduled=!1})));const o=l?n:i,r=performance.now()-e;if((r>100||l)&&console.warn(`[CRASH-DIAG] flushPendingWrites: ${r.toFixed(0)}ms, ${(o/1024).toFixed(0)}KB written${l?", rest deferred":""} (total ${(i/1024).toFixed(0)}KB)`),this._wasAtBottomBeforeWrite&&this.terminal.scrollToBottom(),this._localEchoOverlay?.hasPending&&this._localEchoOverlay.rerender(),this._tabCompletionSessionId&&this._tabCompletionSessionId===this.activeSessionId&&this._localEchoOverlay&&!this._localEchoOverlay.pendingText){const u=this._localEchoOverlay,a=this;this.terminal.write("",()=>{if(!a._tabCompletionSessionId)return;u.resetBufferDetection();const m=u.detectBufferText();m?m===a._tabCompletionBaseText?(u.undoDetection(),a._tabCompletionRetries=(a._tabCompletionRetries||0)+1,a._tabCompletionRetries>60&&(a._tabCompletionSessionId=null,a._tabCompletionRetries=0)):(a._tabCompletionSessionId=null,a._tabCompletionRetries=0,a._tabCompletionBaseText=null,a._tabCompletionFallback&&(clearTimeout(a._tabCompletionFallback),a._tabCompletionFallback=null),u.rerender()):(a._tabCompletionRetries=(a._tabCompletionRetries||0)+1,a._tabCompletionRetries>60&&(a._tabCompletionSessionId=null,a._tabCompletionRetries=0))})}},_safeYield(e){let s=!1;const i=()=>{s||(s=!0,e())};requestAnimationFrame(i),setTimeout(i,50),this._workerYield(i)},_workerYield(e){try{if(this._yieldWorker===void 0){const s="onmessage=()=>setTimeout(()=>postMessage(0),0);",i=new Blob([s],{type:"application/javascript"}),n=URL.createObjectURL(i);this._yieldWorker=new Worker(n),URL.revokeObjectURL(n),this._yieldQueue=[],this._yieldWorker.onmessage=()=>{const l=this._yieldQueue.shift();l&&l()}}if(!this._yieldWorker)return;this._yieldQueue.push(e),this._yieldWorker.postMessage(0)}catch{this._yieldWorker=null}},scrollToLastNonEmptyLine(){if(!this.terminal?.buffer?.active){this.terminal?.scrollToBottom?.();return}const e=this.terminal.buffer.active,s=e.baseY+e.length;let i=-1;for(let n=s-1;n>=0;n--)if(e.getLine(n)?.translateToString(!0).trim()){i=n;break}if(i>=0&&typeof this.terminal.scrollToLine=="function"){let n=Math.max(0,i-this.terminal.rows+2);const l=Math.max(0,i);for(;n<l&&!e.getLine(n)?.translateToString(!0).trim();)n++;this.terminal.scrollToLine(n)}else this.terminal.scrollToBottom()},chunkedTerminalWrite(e,s=TERMINAL_CHUNK_SIZE,i){const n=++this._chunkedWriteGen,l=this._beginBufferLoad(i);return new Promise(o=>{if(!e||e.length===0){this._finishBufferLoad(l),o();return}const r=e.replace(DEC_SYNC_STRIP_RE,""),u=()=>{this._chunkedWriteGen===n&&this._finishBufferLoad(l),o()};if(r.length<=s){this.terminal.write(r,u);return}let a=0;const m=performance.now();let y=0;const t=()=>{if(this._chunkedWriteGen!==n){o();return}if(a>=r.length){const h=performance.now()-m;console.log(`[CRASH-DIAG] chunkedTerminalWrite complete: ${r.length} bytes in ${y} chunks, ${h.toFixed(0)}ms total`),this._safeYield(u);return}const d=performance.now(),f=r.slice(a,a+s);this.terminal.write(f);const c=performance.now()-d;y++,c>50&&console.warn(`[CRASH-DIAG] chunk #${y} write took ${c.toFixed(0)}ms (${f.length} bytes at offset ${a})`),a+=s,this._safeYield(t)};this._safeYield(t)})},_beginBufferLoad(e){this._bufferLoadSeq===void 0&&(this._bufferLoadSeq=0);const s=e===void 0?`buffer-${++this._bufferLoadSeq}`:e;return this._bufferLoadOwner=s,this._isLoadingBuffer=!0,this._loadBufferQueue=[],s},_finishBufferLoad(e){return e!==void 0&&this._bufferLoadOwner!==e?!1:(this._isLoadingBuffer=!1,this._loadBufferQueue=null,this._bufferLoadOwner=null,!0)},clearTerminal(){this.terminal.clear()},async restoreTerminalSize(){if(!this.activeSessionId){this.showToast("No active session","warning");return}const e=this.getTerminalDimensions();if(!e){this.showToast("Could not determine terminal size","error");return}try{await this.sendResize(this.activeSessionId),this.showToast(`Terminal restored to ${e.cols}x${e.rows}`,"success")}catch(s){console.error("Failed to restore terminal size:",s),this.showToast("Failed to restore terminal size","error")}},sendPendingCtrlL(e){},async copyTerminal(){try{const e=this.terminal.buffer.active;let s="";for(let i=0;i<e.length;i++){const n=e.getLine(i);n&&(s+=n.translateToString(!0)+`
|
|
2
|
-
`)}await navigator.clipboard.writeText(s.replace(/\n+$/,`
|
|
3
|
-
`)),this.showToast("Copied to clipboard","success")}catch{this.showToast("Failed to copy","error")}},_syncMobileHelperTextareaToCursor(){if(!(!MobileDetection.isTouchDevice()||!this.terminal?.element))try{const e=this.terminal.element,s=this.terminal.element.querySelector(".xterm-cursor"),i=this.terminal.element.querySelector(".xterm-screen");if(!(e instanceof HTMLElement)||!(s instanceof HTMLElement)||!(i instanceof HTMLElement))return;const n=s.getBoundingClientRect(),l=i.getBoundingClientRect();if(!n.width&&!n.height)return;const o=Math.max(0,Math.round(n.left-l.left)),r=Math.max(0,Math.round(n.top-l.top));e.style.setProperty("--xterm-helper-left",`${o}px`),e.style.setProperty("--xterm-helper-top",`${r}px`)}catch{}},increaseFontSize(){const e=this.terminal.options.fontSize||14;this.setFontSize(Math.min(e+2,24))},decreaseFontSize(){const e=this.terminal.options.fontSize||14;this.setFontSize(Math.max(e-2,10))},setFontSize(e){this.terminal.options.fontSize=e,document.getElementById("fontSizeDisplay").textContent=e,this.fitAddon.fit(),localStorage.setItem("codeman-font-size",e),this._localEchoOverlay?.refreshFont()},loadFontSize(){const e=localStorage.getItem("codeman-font-size");if(e){const s=parseInt(e,10);s>=10&&s<=24&&(this.terminal.options.fontSize=s,document.getElementById("fontSizeDisplay").textContent=s)}},getTerminalDimensions(){const i=this.fitAddon?.proposeDimensions();return i?{cols:Math.max(i.cols,40),rows:Math.max(i.rows,10)}:null},async sendResize(e,s={}){this.fitAddon&&this.fitAddon.fit();const i=this.getTerminalDimensions();if(!i)return!1;const n=this._lastResizeDims,l=!n||n.cols!==i.cols||n.rows!==i.rows;this._lastResizeDims={cols:i.cols,rows:i.rows};const o=typeof MobileDetection<"u"&&MobileDetection.getDeviceType?MobileDetection.getDeviceType():window.innerWidth<430?"mobile":window.innerWidth<768?"tablet":"desktop";if(!s.forceHttp&&this._wsReady&&this._wsSessionId===e)try{return this._ws.send(JSON.stringify({t:"z",c:i.cols,r:i.rows,v:o})),l}catch{}return await fetch(`/api/sessions/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,viewportType:o})}),l},async sendInput(e){this.activeSessionId&&await fetch(`/api/sessions/${this.activeSessionId}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:e,useMux:!0})})},toggleDirInput(){const e=document.querySelector("#dirDisplay").parentElement,s=document.getElementById("dirInput");s.classList.contains("hidden")&&(s.classList.remove("hidden"),e.style.display="none",s.focus())},hideDirInput(){const e=document.querySelector("#dirDisplay").parentElement,s=document.getElementById("dirInput");setTimeout(()=>{s.classList.add("hidden"),e.style.display="";const i=s.value.trim();document.getElementById("dirDisplay").textContent=i||"No directory"},100)}});
|
|
Binary file
|
|
Binary file
|