aicodeman 1.24.6 → 1.25.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.
Files changed (211) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +17 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config/base-path.d.ts +55 -0
  5. package/dist/config/base-path.d.ts.map +1 -0
  6. package/dist/config/base-path.js +105 -0
  7. package/dist/config/base-path.js.map +1 -0
  8. package/dist/config/cli-registry/schema.d.ts +2 -0
  9. package/dist/config/cli-registry/schema.d.ts.map +1 -1
  10. package/dist/config/cli-registry/schema.js +1 -1
  11. package/dist/config/cli-registry/schema.js.map +1 -1
  12. package/dist/config/cli-registry/stock.d.ts.map +1 -1
  13. package/dist/config/cli-registry/stock.js +4 -1
  14. package/dist/config/cli-registry/stock.js.map +1 -1
  15. package/dist/config/cli-registry/types.d.ts +9 -0
  16. package/dist/config/cli-registry/types.d.ts.map +1 -1
  17. package/dist/daemon-control.d.ts +2 -0
  18. package/dist/daemon-control.d.ts.map +1 -1
  19. package/dist/daemon-control.js +2 -0
  20. package/dist/daemon-control.js.map +1 -1
  21. package/dist/docker-export.d.ts.map +1 -1
  22. package/dist/docker-export.js +8 -1
  23. package/dist/docker-export.js.map +1 -1
  24. package/dist/docker-hosts.d.ts +97 -3
  25. package/dist/docker-hosts.d.ts.map +1 -1
  26. package/dist/docker-hosts.js +260 -4
  27. package/dist/docker-hosts.js.map +1 -1
  28. package/dist/hooks-config.d.ts.map +1 -1
  29. package/dist/hooks-config.js +39 -3
  30. package/dist/hooks-config.js.map +1 -1
  31. package/dist/session.d.ts +31 -1
  32. package/dist/session.d.ts.map +1 -1
  33. package/dist/session.js +101 -5
  34. package/dist/session.js.map +1 -1
  35. package/dist/tmux-manager.d.ts.map +1 -1
  36. package/dist/tmux-manager.js +54 -8
  37. package/dist/tmux-manager.js.map +1 -1
  38. package/dist/types/api.d.ts +19 -1
  39. package/dist/types/api.d.ts.map +1 -1
  40. package/dist/types/api.js.map +1 -1
  41. package/dist/types/session.d.ts +49 -0
  42. package/dist/types/session.d.ts.map +1 -1
  43. package/dist/types/session.js.map +1 -1
  44. package/dist/types/update.d.ts +51 -3
  45. package/dist/types/update.d.ts.map +1 -1
  46. package/dist/types/update.js +4 -0
  47. package/dist/types/update.js.map +1 -1
  48. package/dist/web/middleware/auth.d.ts +3 -3
  49. package/dist/web/middleware/auth.d.ts.map +1 -1
  50. package/dist/web/middleware/auth.js +13 -11
  51. package/dist/web/middleware/auth.js.map +1 -1
  52. package/dist/web/public/admin-ui.js.gz +0 -0
  53. package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
  54. package/dist/web/public/app.3a89ac57.js +38 -0
  55. package/dist/web/public/app.3a89ac57.js.br +0 -0
  56. package/dist/web/public/app.3a89ac57.js.gz +0 -0
  57. package/dist/web/public/approvals-ui.js.gz +0 -0
  58. package/dist/web/public/{constants.7bd482dc.js → constants.7a635e34.js} +58 -0
  59. package/dist/web/public/constants.7a635e34.js.br +0 -0
  60. package/dist/web/public/constants.7a635e34.js.gz +0 -0
  61. package/dist/web/public/cron-ui.js.gz +0 -0
  62. package/dist/web/public/entrance-animations.js.gz +0 -0
  63. package/dist/web/public/home-sessions.js.gz +0 -0
  64. package/dist/web/public/i18n.9db8c4e0.js +1 -0
  65. package/dist/web/public/i18n.9db8c4e0.js.br +0 -0
  66. package/dist/web/public/i18n.9db8c4e0.js.gz +0 -0
  67. package/dist/web/public/image-input.ee16ad88.js.gz +0 -0
  68. package/dist/web/public/index.html +46 -17
  69. package/dist/web/public/index.html.br +0 -0
  70. package/dist/web/public/index.html.gz +0 -0
  71. package/dist/web/public/input-cjk.87f14251.js.gz +0 -0
  72. package/dist/web/public/{keyboard-accessory.0454a3e9.js → keyboard-accessory.daf18302.js} +8 -4
  73. package/dist/web/public/keyboard-accessory.daf18302.js.br +0 -0
  74. package/dist/web/public/keyboard-accessory.daf18302.js.gz +0 -0
  75. package/dist/web/public/manifest.json +2 -1
  76. package/dist/web/public/mobile-handlers.0f83a608.js.gz +0 -0
  77. package/dist/web/public/mobile-overview.js.gz +0 -0
  78. package/dist/web/public/{mobile.87674154.css → mobile.7112f27d.css} +1 -1
  79. package/dist/web/public/{mobile.87674154.css.br → mobile.7112f27d.css.br} +0 -0
  80. package/dist/web/public/mobile.7112f27d.css.gz +0 -0
  81. package/dist/web/public/{notification-manager.5d229063.js → notification-manager.36ea4624.js} +1 -1
  82. package/dist/web/public/notification-manager.36ea4624.js.br +0 -0
  83. package/dist/web/public/notification-manager.36ea4624.js.gz +0 -0
  84. package/dist/web/public/orchestrator-panel.js.gz +0 -0
  85. package/dist/web/public/{panels-ui.e6e06034.js → panels-ui.db4785bf.js} +8 -8
  86. package/dist/web/public/panels-ui.db4785bf.js.br +0 -0
  87. package/dist/web/public/panels-ui.db4785bf.js.gz +0 -0
  88. package/dist/web/public/ralph-panel.6de2d0f8.js.gz +0 -0
  89. package/dist/web/public/ralph-wizard.13a1831e.js.gz +0 -0
  90. package/dist/web/public/readmymind-ui.js.gz +0 -0
  91. package/dist/web/public/respawn-ui.ff0dae4c.js.gz +0 -0
  92. package/dist/web/public/sanitize-html.bc7078d6.js.gz +0 -0
  93. package/dist/web/public/session-lineage.js.gz +0 -0
  94. package/dist/web/public/session-ui.58116fce.js +68 -0
  95. package/dist/web/public/session-ui.58116fce.js.br +0 -0
  96. package/dist/web/public/session-ui.58116fce.js.gz +0 -0
  97. package/dist/web/public/{settings-ui.95b333c6.js → settings-ui.554f9cdd.js} +1 -1
  98. package/dist/web/public/settings-ui.554f9cdd.js.br +0 -0
  99. package/dist/web/public/settings-ui.554f9cdd.js.gz +0 -0
  100. package/dist/web/public/{styles.421b36d4.css → styles.2a35729d.css} +1 -1
  101. package/dist/web/public/styles.2a35729d.css.br +0 -0
  102. package/dist/web/public/{styles.421b36d4.css.gz → styles.2a35729d.css.gz} +0 -0
  103. package/dist/web/public/subagent-windows.e6ca799f.js.gz +0 -0
  104. package/dist/web/public/sw.js +13 -6
  105. package/dist/web/public/sw.js.br +0 -0
  106. package/dist/web/public/sw.js.gz +0 -0
  107. package/dist/web/public/tab-rail-resize.42c24949.js.gz +0 -0
  108. package/dist/web/public/terminal-ui.70445f81.js.gz +0 -0
  109. package/dist/web/public/ultracode-panel.js.gz +0 -0
  110. package/dist/web/public/ultracode-windows.js.gz +0 -0
  111. package/dist/web/public/upload.html.gz +0 -0
  112. package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
  113. package/dist/web/public/vendor/marked.min.js.gz +0 -0
  114. package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
  115. package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
  116. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
  117. package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
  118. package/dist/web/public/vendor/xterm-predictive-echo.bd6882b8.js.gz +0 -0
  119. package/dist/web/public/vendor/xterm-zerolag-input.6fee72f2.js.gz +0 -0
  120. package/dist/web/public/vendor/xterm.css.gz +0 -0
  121. package/dist/web/public/vendor/xterm.min.js.gz +0 -0
  122. package/dist/web/public/{voice-input.4ec670b0.js → voice-input.c4b51eb6.js} +1 -1
  123. package/dist/web/public/voice-input.c4b51eb6.js.br +0 -0
  124. package/dist/web/public/voice-input.c4b51eb6.js.gz +0 -0
  125. package/dist/web/public/voice-pcm-worklet.js.gz +0 -0
  126. package/dist/web/public/webview-tabs.js +3 -1
  127. package/dist/web/public/webview-tabs.js.br +0 -0
  128. package/dist/web/public/webview-tabs.js.gz +0 -0
  129. package/dist/web/route-helpers.d.ts.map +1 -1
  130. package/dist/web/route-helpers.js +5 -0
  131. package/dist/web/route-helpers.js.map +1 -1
  132. package/dist/web/routes/admin-routes.d.ts.map +1 -1
  133. package/dist/web/routes/admin-routes.js +6 -1
  134. package/dist/web/routes/admin-routes.js.map +1 -1
  135. package/dist/web/routes/case-routes.d.ts.map +1 -1
  136. package/dist/web/routes/case-routes.js +188 -4
  137. package/dist/web/routes/case-routes.js.map +1 -1
  138. package/dist/web/routes/file-routes.d.ts.map +1 -1
  139. package/dist/web/routes/file-routes.js +62 -4
  140. package/dist/web/routes/file-routes.js.map +1 -1
  141. package/dist/web/routes/hook-event-routes.d.ts.map +1 -1
  142. package/dist/web/routes/hook-event-routes.js +29 -3
  143. package/dist/web/routes/hook-event-routes.js.map +1 -1
  144. package/dist/web/routes/session-routes.d.ts.map +1 -1
  145. package/dist/web/routes/session-routes.js +121 -56
  146. package/dist/web/routes/session-routes.js.map +1 -1
  147. package/dist/web/routes/system-routes.d.ts.map +1 -1
  148. package/dist/web/routes/system-routes.js +3 -0
  149. package/dist/web/routes/system-routes.js.map +1 -1
  150. package/dist/web/routes/webview-routes.d.ts +2 -2
  151. package/dist/web/routes/webview-routes.d.ts.map +1 -1
  152. package/dist/web/routes/webview-routes.js +62 -27
  153. package/dist/web/routes/webview-routes.js.map +1 -1
  154. package/dist/web/schemas.d.ts +29 -0
  155. package/dist/web/schemas.d.ts.map +1 -1
  156. package/dist/web/schemas.js +75 -0
  157. package/dist/web/schemas.js.map +1 -1
  158. package/dist/web/self-update.d.ts +92 -2
  159. package/dist/web/self-update.d.ts.map +1 -1
  160. package/dist/web/self-update.js +275 -13
  161. package/dist/web/self-update.js.map +1 -1
  162. package/dist/web/server.d.ts +4 -2
  163. package/dist/web/server.d.ts.map +1 -1
  164. package/dist/web/server.js +55 -11
  165. package/dist/web/server.js.map +1 -1
  166. package/dist/web/sse-events.d.ts +4 -2
  167. package/dist/web/sse-events.d.ts.map +1 -1
  168. package/dist/web/sse-events.js +4 -2
  169. package/dist/web/sse-events.js.map +1 -1
  170. package/dist/web/webview-egress-policy.d.ts +35 -0
  171. package/dist/web/webview-egress-policy.d.ts.map +1 -0
  172. package/dist/web/webview-egress-policy.js +163 -0
  173. package/dist/web/webview-egress-policy.js.map +1 -0
  174. package/dist/web/webview-egress.d.ts +71 -0
  175. package/dist/web/webview-egress.d.ts.map +1 -0
  176. package/dist/web/webview-egress.js +127 -0
  177. package/dist/web/webview-egress.js.map +1 -0
  178. package/dist/web/webview-proxy.d.ts +16 -7
  179. package/dist/web/webview-proxy.d.ts.map +1 -1
  180. package/dist/web/webview-proxy.js +40 -15
  181. package/dist/web/webview-proxy.js.map +1 -1
  182. package/dist/webview-capabilities.d.ts +19 -3
  183. package/dist/webview-capabilities.d.ts.map +1 -1
  184. package/dist/webview-capabilities.js +21 -2
  185. package/dist/webview-capabilities.js.map +1 -1
  186. package/package.json +9 -7
  187. package/skills/codeman/reference/endpoints.md +1 -0
  188. package/skills/codeman/reference/verbs.md +11 -1
  189. package/dist/web/public/app.a5d2fc08.js +0 -38
  190. package/dist/web/public/app.a5d2fc08.js.br +0 -0
  191. package/dist/web/public/app.a5d2fc08.js.gz +0 -0
  192. package/dist/web/public/constants.7bd482dc.js.br +0 -0
  193. package/dist/web/public/constants.7bd482dc.js.gz +0 -0
  194. package/dist/web/public/i18n.9ae15b51.js +0 -1
  195. package/dist/web/public/i18n.9ae15b51.js.br +0 -0
  196. package/dist/web/public/i18n.9ae15b51.js.gz +0 -0
  197. package/dist/web/public/keyboard-accessory.0454a3e9.js.br +0 -0
  198. package/dist/web/public/keyboard-accessory.0454a3e9.js.gz +0 -0
  199. package/dist/web/public/mobile.87674154.css.gz +0 -0
  200. package/dist/web/public/notification-manager.5d229063.js.br +0 -0
  201. package/dist/web/public/notification-manager.5d229063.js.gz +0 -0
  202. package/dist/web/public/panels-ui.e6e06034.js.br +0 -0
  203. package/dist/web/public/panels-ui.e6e06034.js.gz +0 -0
  204. package/dist/web/public/session-ui.c558f981.js +0 -68
  205. package/dist/web/public/session-ui.c558f981.js.br +0 -0
  206. package/dist/web/public/session-ui.c558f981.js.gz +0 -0
  207. package/dist/web/public/settings-ui.95b333c6.js.br +0 -0
  208. package/dist/web/public/settings-ui.95b333c6.js.gz +0 -0
  209. package/dist/web/public/styles.421b36d4.css.br +0 -0
  210. package/dist/web/public/voice-input.4ec670b0.js.br +0 -0
  211. package/dist/web/public/voice-input.4ec670b0.js.gz +0 -0
@@ -40,6 +40,7 @@ import fs from 'node:fs/promises';
40
40
  import { execSync } from 'node:child_process';
41
41
  import { hostname as getHostname } from 'node:os';
42
42
  import { dataPath, getDataDir, CODEMAN_INSTANCE } from '../config/instance.js';
43
+ import { normalizeBasePath, stripBasePath, joinBasePath } from '../config/base-path.js';
43
44
  import { GLYPH, palette } from '../cli-style.js';
44
45
  import { getHookSecret } from '../config/hook-secret.js';
45
46
  import { EventEmitter } from 'node:events';
@@ -164,6 +165,8 @@ export class WebServer extends EventEmitter {
164
165
  port;
165
166
  host;
166
167
  https;
168
+ /** Reverse-proxy sub-path prefix (normalized: '' for root, or '/foo'). */
169
+ basePath;
167
170
  testMode;
168
171
  mux;
169
172
  // Centralized cleanup for standalone timers (intervals + resettable timeouts)
@@ -206,19 +209,26 @@ export class WebServer extends EventEmitter {
206
209
  /** Opt-in hooks-only listener on the docker bridge gateway (CODEMAN_DOCKER_BRIDGE_HOOKS). */
207
210
  _dockerBridgeServer = null;
208
211
  teamWatcherHandlers = null;
209
- constructor(port = 3000, https = false, testMode = false, host = '127.0.0.1', titleHostname, allowUnauthenticatedNetwork = false) {
212
+ constructor(port = 3000, https = false, testMode = false, host = '127.0.0.1', titleHostname, allowUnauthenticatedNetwork = false, basePath = '') {
210
213
  super();
211
214
  this.setMaxListeners(0);
212
215
  this.host = host;
213
216
  this.port = port;
214
217
  this.https = https;
218
+ // Normalize so callers may pass raw operator input; '' == mounted at root.
219
+ this.basePath = normalizeBasePath(basePath || process.env.CODEMAN_BASE_URL);
215
220
  this.testMode = testMode;
216
221
  this.allowUnauthenticatedNetwork =
217
222
  allowUnauthenticatedNetwork || isExplicitlyEnabled(process.env.CODEMAN_ALLOW_UNAUTHENTICATED_NETWORK);
218
223
  this.titleHostname = titleHostname || getHostname();
219
224
  this.windowTitle = `codeman:${this.titleHostname}`;
220
225
  this.indexHtmlTemplate = readFileSync(join(__dirname, 'public', 'index.html'), 'utf-8');
221
- const rewriteUrl = (req) => rewriteApiV1Url(req.url || '');
226
+ // Ingress: strip the reverse-proxy prefix so all internal routing stays
227
+ // prefix-agnostic (routes are still declared at `/api/...`, `/`, `/ws/...`).
228
+ // Requests that arrive WITHOUT the prefix (hooks, health checks, the docker
229
+ // bridge — all hitting the raw port) pass through unchanged. Then apply the
230
+ // existing /api/v1 alias rewrite.
231
+ const rewriteUrl = (req) => rewriteApiV1Url(stripBasePath(this.basePath, req.url || ''));
222
232
  if (https) {
223
233
  const { key, cert } = getOrCreateSelfSignedCert();
224
234
  this.app = Fastify({ logger: false, https: { key, cert }, rewriteUrl });
@@ -573,6 +583,20 @@ export class WebServer extends EventEmitter {
573
583
  });
574
584
  // Cookie plugin (needed for auth session tokens)
575
585
  await this.app.register(fastifyCookie);
586
+ // Egress: when mounted under a reverse-proxy sub-path, any root-absolute
587
+ // `Location` we emit (redirects in system/webview/file routes, `/`, `/api/...`)
588
+ // must carry the prefix or the browser resolves it against the origin root and
589
+ // escapes the mount. One hook covers every current and future redirect, mirroring
590
+ // the ingress strip in `rewriteUrl`. No-op when mounted at root (basePath === '').
591
+ if (this.basePath) {
592
+ this.app.addHook('onSend', (_req, reply, payload, done) => {
593
+ const loc = reply.getHeader('location');
594
+ if (typeof loc === 'string') {
595
+ reply.header('location', joinBasePath(this.basePath, loc));
596
+ }
597
+ done(null, payload);
598
+ });
599
+ }
576
600
  // Uniform response envelope (stable HTTP contract — docs/api-reference.md):
577
601
  // wrap bare JSON payloads as { success:true, data } and map { success:false }
578
602
  // error envelopes to a conventional HTTP status (instead of 200). Skips
@@ -599,9 +623,9 @@ export class WebServer extends EventEmitter {
599
623
  // Anti-DNS-rebinding Host allowlist + cross-site (CSRF) Origin guard. Registered
600
624
  // before auth so forged cross-site / rebound requests are rejected up front, even
601
625
  // on the default no-password install. See docs/reports/security-review-2026-06-09.md.
602
- registerHostGuard(this.app, () => this.getHostPolicy());
626
+ registerHostGuard(this.app, () => this.getHostPolicy(), this.basePath);
603
627
  // Auth middleware (Basic Auth + session cookies + rate limiting)
604
- const authState = registerAuthMiddleware(this.app, this.https);
628
+ const authState = registerAuthMiddleware(this.app, this.https, this.basePath);
605
629
  if (authState) {
606
630
  this.authSessions = authState.authSessions;
607
631
  this.authFailures = authState.authFailures;
@@ -623,7 +647,7 @@ export class WebServer extends EventEmitter {
623
647
  },
624
648
  });
625
649
  // Security headers + CORS
626
- registerSecurityHeaders(this.app, this.https);
650
+ registerSecurityHeaders(this.app, this.https, this.basePath);
627
651
  this.app.get('/', async (_req, reply) => {
628
652
  return reply
629
653
  .header('Cache-Control', 'no-cache')
@@ -787,7 +811,7 @@ export class WebServer extends EventEmitter {
787
811
  // rescue. Reaching this handler at all already proves no Codeman route matched,
788
812
  // and the relay declines unless the Referer carries a live capability, so
789
813
  // genuinely unknown `/api` paths still get the envelope below.
790
- if (await tryWebviewRefererFallback(req, reply))
814
+ if (await tryWebviewRefererFallback(req, reply, this.basePath))
791
815
  return reply;
792
816
  if (req.url.startsWith('/api')) {
793
817
  return reply.code(404).send(createErrorResponse(ApiErrorCode.NOT_FOUND, notFound));
@@ -864,7 +888,7 @@ export class WebServer extends EventEmitter {
864
888
  registerMeRoutes(this.app, ctx);
865
889
  registerAdminRoutes(this.app, ctx);
866
890
  registerOrchestratorRoutes(this.app, ctx);
867
- registerWebviewRoutes(this.app, ctx);
891
+ registerWebviewRoutes(this.app, ctx, this.basePath);
868
892
  registerTabLayoutRoutes(this.app, ctx);
869
893
  // Cron: build the service from the same context, recompute
870
894
  // due times for any persisted jobs, then expose it to its routes.
@@ -1180,6 +1204,17 @@ export class WebServer extends EventEmitter {
1180
1204
  this.windowTitle = `${displayName === 'Codeman' ? 'codeman' : displayName}:${this.titleHostname}`;
1181
1205
  }
1182
1206
  let html = this.indexHtmlTemplate.replace('<title>Codeman</title>', `<title>${escapeHtmlText(this.windowTitle)}</title>`);
1207
+ // Reverse-proxy sub-path support. The template ships `<base href="/">` and all
1208
+ // static asset refs are RELATIVE, so pointing the base at the mount prefix
1209
+ // rewrites every asset URL for free. `window.__CODEMAN_BASE__` gives the
1210
+ // frontend the same prefix for the root-absolute URLs it builds at runtime
1211
+ // (fetch/SSE/WS), which `<base>` cannot touch. Injected right after `<base>`
1212
+ // so it is set before any (deferred) script runs. ONLY when a base is set —
1213
+ // at root ('') the template is left byte-identical to the historical output
1214
+ // (the frontend reads a missing `__CODEMAN_BASE__` as root anyway).
1215
+ if (this.basePath) {
1216
+ html = html.replace('<base href="/">', `<base href="${escapeHtmlText(this.basePath + '/')}">\n <script>window.__CODEMAN_BASE__=${JSON.stringify(this.basePath)};</script>`);
1217
+ }
1183
1218
  // Cache-bust same-origin module scripts + stylesheets so a normal reload
1184
1219
  // always serves the latest (static assets carry a 1-year immutable cache).
1185
1220
  html = this.cacheBustAssets(html);
@@ -1274,7 +1309,9 @@ export class WebServer extends EventEmitter {
1274
1309
  html = html.replace('</head>', `<script>window.__codemanGestureAvailable=true;</script>\n</head>`);
1275
1310
  if (settings.gestureControlEnabled === true) {
1276
1311
  const v = this.gestureBundleVersion();
1277
- html = html.replace('</head>', `<script type="module" src="/gesture/gesture-codeman.js${v}"></script>\n</head>`);
1312
+ // Relative src so the injected `<base href>` resolves it under the mount
1313
+ // prefix (a root-absolute `/gesture/...` would escape a sub-path mount).
1314
+ html = html.replace('</head>', `<script type="module" src="gesture/gesture-codeman.js${v}"></script>\n</head>`);
1278
1315
  }
1279
1316
  }
1280
1317
  return html;
@@ -2164,7 +2201,10 @@ export class WebServer extends EventEmitter {
2164
2201
  const displayHost = this.host === '0.0.0.0' ? 'localhost' : this.host;
2165
2202
  // The only startup banner: `codeman web` used to print its own copy of this
2166
2203
  // line, but the daemon and service launch paths never go through the CLI.
2167
- console.log(palette.ok(`${GLYPH.ok} Codeman web interface running at ${protocol}://${displayHost}:${this.port}`));
2204
+ console.log(palette.ok(`${GLYPH.ok} Codeman web interface running at ${protocol}://${displayHost}:${this.port}${this.basePath}${this.basePath ? '/' : ''}`));
2205
+ if (this.basePath) {
2206
+ console.log(palette.muted(` Mounted under base path ${this.basePath} (front it with a reverse proxy that forwards ${this.basePath}/ unchanged).`));
2207
+ }
2168
2208
  // Opt-in: also serve the HOOK endpoints on the docker bridge gateway so
2169
2209
  // in-container hooks (permission/idle/stop callbacks) can reach a loopback-bound
2170
2210
  // server. Hooks-only + secret-gated, and the bridge is host-internal (not the LAN).
@@ -2422,6 +2462,10 @@ export class WebServer extends EventEmitter {
2422
2462
  // the launch conversation until the user types again, even though
2423
2463
  // the re-attached CLI is on a post-`/clear` one.
2424
2464
  lastSubmitAt: savedState?.lastSubmitAt,
2465
+ // Conversations this pane provably owned, oldest first. Its tail is
2466
+ // the conversation the CLI was on when the server stopped, which is
2467
+ // what a re-attach must point the viewer at instead of the launch id.
2468
+ claudeSessionChain: savedState?.claudeSessionChain,
2425
2469
  // The pane's last output, previous run's value. Without it every
2426
2470
  // restart restamped all sessions "now" (constructor + the attach
2427
2471
  // repaint within the same second), flattening the home screens'
@@ -2896,8 +2940,8 @@ export class WebServer extends EventEmitter {
2896
2940
  await this.app.close();
2897
2941
  }
2898
2942
  }
2899
- export async function startWebServer(port = 3000, https = false, testMode = false, host = '127.0.0.1', titleHostname, allowUnauthenticatedNetwork = false) {
2900
- const server = new WebServer(port, https, testMode, host, titleHostname, allowUnauthenticatedNetwork);
2943
+ export async function startWebServer(port = 3000, https = false, testMode = false, host = '127.0.0.1', titleHostname, allowUnauthenticatedNetwork = false, basePath = '') {
2944
+ const server = new WebServer(port, https, testMode, host, titleHostname, allowUnauthenticatedNetwork, basePath);
2901
2945
  await server.start();
2902
2946
  return server;
2903
2947
  }