@oratis/lisa 0.8.0 → 0.11.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 (320) hide show
  1. package/README.md +123 -16
  2. package/README.zh-CN.md +101 -15
  3. package/completions/_lisa +56 -0
  4. package/completions/lisa.bash +35 -1
  5. package/completions/lisa.fish +18 -1
  6. package/dist/advisor/engine.d.ts +7 -0
  7. package/dist/advisor/engine.d.ts.map +1 -1
  8. package/dist/advisor/engine.js +12 -0
  9. package/dist/advisor/engine.js.map +1 -1
  10. package/dist/agent.d.ts +14 -0
  11. package/dist/agent.d.ts.map +1 -1
  12. package/dist/agent.js +58 -7
  13. package/dist/agent.js.map +1 -1
  14. package/dist/agents/managed.d.ts +108 -0
  15. package/dist/agents/managed.d.ts.map +1 -0
  16. package/dist/agents/managed.js +241 -0
  17. package/dist/agents/managed.js.map +1 -0
  18. package/dist/agents/pty.d.ts +155 -0
  19. package/dist/agents/pty.d.ts.map +1 -0
  20. package/dist/agents/pty.js +299 -0
  21. package/dist/agents/pty.js.map +1 -0
  22. package/dist/approval.d.ts +13 -0
  23. package/dist/approval.d.ts.map +1 -1
  24. package/dist/approval.js +25 -2
  25. package/dist/approval.js.map +1 -1
  26. package/dist/autonomy/runs.d.ts +33 -0
  27. package/dist/autonomy/runs.d.ts.map +1 -0
  28. package/dist/autonomy/runs.js +106 -0
  29. package/dist/autonomy/runs.js.map +1 -0
  30. package/dist/channels/feishu.d.ts.map +1 -1
  31. package/dist/channels/feishu.js +65 -0
  32. package/dist/channels/feishu.js.map +1 -1
  33. package/dist/channels/router.d.ts +7 -0
  34. package/dist/channels/router.d.ts.map +1 -1
  35. package/dist/channels/router.js +1 -1
  36. package/dist/channels/router.js.map +1 -1
  37. package/dist/cli/agents-pty.d.ts +18 -0
  38. package/dist/cli/agents-pty.d.ts.map +1 -0
  39. package/dist/cli/agents-pty.js +182 -0
  40. package/dist/cli/agents-pty.js.map +1 -0
  41. package/dist/cli/agents.d.ts +2 -0
  42. package/dist/cli/agents.d.ts.map +1 -0
  43. package/dist/cli/agents.js +65 -0
  44. package/dist/cli/agents.js.map +1 -0
  45. package/dist/cli/consent.d.ts +2 -0
  46. package/dist/cli/consent.d.ts.map +1 -0
  47. package/dist/cli/consent.js +57 -0
  48. package/dist/cli/consent.js.map +1 -0
  49. package/dist/cli/model.d.ts +2 -0
  50. package/dist/cli/model.d.ts.map +1 -0
  51. package/dist/cli/model.js +121 -0
  52. package/dist/cli/model.js.map +1 -0
  53. package/dist/cli/sense.d.ts +2 -0
  54. package/dist/cli/sense.d.ts.map +1 -0
  55. package/dist/cli/sense.js +36 -0
  56. package/dist/cli/sense.js.map +1 -0
  57. package/dist/cli.js +117 -12
  58. package/dist/cli.js.map +1 -1
  59. package/dist/consent/blacklist.d.ts +28 -0
  60. package/dist/consent/blacklist.d.ts.map +1 -0
  61. package/dist/consent/blacklist.js +78 -0
  62. package/dist/consent/blacklist.js.map +1 -0
  63. package/dist/consent/store.d.ts +45 -0
  64. package/dist/consent/store.d.ts.map +1 -0
  65. package/dist/consent/store.js +126 -0
  66. package/dist/consent/store.js.map +1 -0
  67. package/dist/control/policy.d.ts +13 -0
  68. package/dist/control/policy.d.ts.map +1 -0
  69. package/dist/control/policy.js +57 -0
  70. package/dist/control/policy.js.map +1 -0
  71. package/dist/heartbeat/runner.d.ts.map +1 -1
  72. package/dist/heartbeat/runner.js +70 -14
  73. package/dist/heartbeat/runner.js.map +1 -1
  74. package/dist/idle/runner.d.ts.map +1 -1
  75. package/dist/idle/runner.js +87 -17
  76. package/dist/idle/runner.js.map +1 -1
  77. package/dist/integrations/aider/observer.d.ts +21 -1
  78. package/dist/integrations/aider/observer.d.ts.map +1 -1
  79. package/dist/integrations/aider/observer.js +110 -1
  80. package/dist/integrations/aider/observer.js.map +1 -1
  81. package/dist/integrations/claude-code/liveness.d.ts +10 -0
  82. package/dist/integrations/claude-code/liveness.d.ts.map +1 -0
  83. package/dist/integrations/claude-code/liveness.js +62 -0
  84. package/dist/integrations/claude-code/liveness.js.map +1 -0
  85. package/dist/integrations/claude-code/watcher.d.ts +39 -4
  86. package/dist/integrations/claude-code/watcher.d.ts.map +1 -1
  87. package/dist/integrations/claude-code/watcher.js +94 -57
  88. package/dist/integrations/claude-code/watcher.js.map +1 -1
  89. package/dist/integrations/codex/observer.d.ts +19 -6
  90. package/dist/integrations/codex/observer.d.ts.map +1 -1
  91. package/dist/integrations/codex/observer.js +228 -4
  92. package/dist/integrations/codex/observer.js.map +1 -1
  93. package/dist/integrations/dispatch-ledger.d.ts +30 -1
  94. package/dist/integrations/dispatch-ledger.d.ts.map +1 -1
  95. package/dist/integrations/dispatch-ledger.js +75 -9
  96. package/dist/integrations/dispatch-ledger.js.map +1 -1
  97. package/dist/integrations/git/branch.d.ts +11 -0
  98. package/dist/integrations/git/branch.d.ts.map +1 -0
  99. package/dist/integrations/git/branch.js +49 -0
  100. package/dist/integrations/git/branch.js.map +1 -0
  101. package/dist/integrations/git/observer.d.ts +39 -0
  102. package/dist/integrations/git/observer.d.ts.map +1 -0
  103. package/dist/integrations/git/observer.js +252 -0
  104. package/dist/integrations/git/observer.js.map +1 -0
  105. package/dist/integrations/github-pr/observer.d.ts.map +1 -1
  106. package/dist/integrations/github-pr/observer.js +7 -2
  107. package/dist/integrations/github-pr/observer.js.map +1 -1
  108. package/dist/integrations/hub.d.ts +8 -0
  109. package/dist/integrations/hub.d.ts.map +1 -1
  110. package/dist/integrations/hub.js +39 -1
  111. package/dist/integrations/hub.js.map +1 -1
  112. package/dist/integrations/managed/observer.d.ts +17 -0
  113. package/dist/integrations/managed/observer.d.ts.map +1 -0
  114. package/dist/integrations/managed/observer.js +46 -0
  115. package/dist/integrations/managed/observer.js.map +1 -0
  116. package/dist/integrations/opencode/observer.d.ts +53 -5
  117. package/dist/integrations/opencode/observer.d.ts.map +1 -1
  118. package/dist/integrations/opencode/observer.js +242 -20
  119. package/dist/integrations/opencode/observer.js.map +1 -1
  120. package/dist/integrations/pty/observer.d.ts +25 -0
  121. package/dist/integrations/pty/observer.d.ts.map +1 -0
  122. package/dist/integrations/pty/observer.js +48 -0
  123. package/dist/integrations/pty/observer.js.map +1 -0
  124. package/dist/integrations/registry.d.ts.map +1 -1
  125. package/dist/integrations/registry.js +5 -0
  126. package/dist/integrations/registry.js.map +1 -1
  127. package/dist/integrations/shell/observer.d.ts +33 -0
  128. package/dist/integrations/shell/observer.d.ts.map +1 -0
  129. package/dist/integrations/shell/observer.js +223 -0
  130. package/dist/integrations/shell/observer.js.map +1 -0
  131. package/dist/integrations/takoapi/a2a.d.ts +38 -0
  132. package/dist/integrations/takoapi/a2a.d.ts.map +1 -0
  133. package/dist/integrations/takoapi/a2a.js +70 -0
  134. package/dist/integrations/takoapi/a2a.js.map +1 -0
  135. package/dist/integrations/takoapi/ledger.d.ts +32 -0
  136. package/dist/integrations/takoapi/ledger.d.ts.map +1 -0
  137. package/dist/integrations/takoapi/ledger.js +96 -0
  138. package/dist/integrations/takoapi/ledger.js.map +1 -0
  139. package/dist/integrations/takoapi/observer.d.ts +39 -0
  140. package/dist/integrations/takoapi/observer.d.ts.map +1 -0
  141. package/dist/integrations/takoapi/observer.js +102 -0
  142. package/dist/integrations/takoapi/observer.js.map +1 -0
  143. package/dist/integrations/types.d.ts +17 -0
  144. package/dist/integrations/types.d.ts.map +1 -1
  145. package/dist/mcp/client.d.ts +5 -0
  146. package/dist/mcp/client.d.ts.map +1 -1
  147. package/dist/mcp/client.js +1 -1
  148. package/dist/mcp/client.js.map +1 -1
  149. package/dist/mcp/config.d.ts +4 -0
  150. package/dist/mcp/config.d.ts.map +1 -1
  151. package/dist/mcp/config.js +34 -0
  152. package/dist/mcp/config.js.map +1 -1
  153. package/dist/memory/embedding.d.ts +45 -0
  154. package/dist/memory/embedding.d.ts.map +1 -0
  155. package/dist/memory/embedding.js +139 -0
  156. package/dist/memory/embedding.js.map +1 -0
  157. package/dist/memory/search_tool.d.ts.map +1 -1
  158. package/dist/memory/search_tool.js +6 -2
  159. package/dist/memory/search_tool.js.map +1 -1
  160. package/dist/memory/vector.d.ts +14 -3
  161. package/dist/memory/vector.d.ts.map +1 -1
  162. package/dist/memory/vector.js +50 -0
  163. package/dist/memory/vector.js.map +1 -1
  164. package/dist/model/local.d.ts +43 -0
  165. package/dist/model/local.d.ts.map +1 -0
  166. package/dist/model/local.js +118 -0
  167. package/dist/model/local.js.map +1 -0
  168. package/dist/model/plan-usage.d.ts +41 -0
  169. package/dist/model/plan-usage.d.ts.map +1 -0
  170. package/dist/model/plan-usage.js +168 -0
  171. package/dist/model/plan-usage.js.map +1 -0
  172. package/dist/model/plans.d.ts +73 -0
  173. package/dist/model/plans.d.ts.map +1 -0
  174. package/dist/model/plans.js +246 -0
  175. package/dist/model/plans.js.map +1 -0
  176. package/dist/orchestrator/recent-recap.d.ts +2 -0
  177. package/dist/orchestrator/recent-recap.d.ts.map +1 -0
  178. package/dist/orchestrator/recent-recap.js +20 -0
  179. package/dist/orchestrator/recent-recap.js.map +1 -0
  180. package/dist/providers/anthropic.d.ts +1 -0
  181. package/dist/providers/anthropic.d.ts.map +1 -1
  182. package/dist/providers/anthropic.js +10 -2
  183. package/dist/providers/anthropic.js.map +1 -1
  184. package/dist/providers/fallback.d.ts +23 -0
  185. package/dist/providers/fallback.d.ts.map +1 -0
  186. package/dist/providers/fallback.js +29 -0
  187. package/dist/providers/fallback.js.map +1 -0
  188. package/dist/providers/gemini.d.ts +2 -0
  189. package/dist/providers/gemini.d.ts.map +1 -1
  190. package/dist/providers/gemini.js +24 -10
  191. package/dist/providers/gemini.js.map +1 -1
  192. package/dist/providers/openai.d.ts.map +1 -1
  193. package/dist/providers/openai.js +4 -1
  194. package/dist/providers/openai.js.map +1 -1
  195. package/dist/providers/registry.d.ts +18 -2
  196. package/dist/providers/registry.d.ts.map +1 -1
  197. package/dist/providers/registry.js +56 -9
  198. package/dist/providers/registry.js.map +1 -1
  199. package/dist/reflect.d.ts +55 -0
  200. package/dist/reflect.d.ts.map +1 -1
  201. package/dist/reflect.js +148 -54
  202. package/dist/reflect.js.map +1 -1
  203. package/dist/sense/log.d.ts +9 -0
  204. package/dist/sense/log.d.ts.map +1 -0
  205. package/dist/sense/log.js +63 -0
  206. package/dist/sense/log.js.map +1 -0
  207. package/dist/sense/screen.d.ts +43 -0
  208. package/dist/sense/screen.d.ts.map +1 -0
  209. package/dist/sense/screen.js +107 -0
  210. package/dist/sense/screen.js.map +1 -0
  211. package/dist/sense/service.d.ts +16 -0
  212. package/dist/sense/service.d.ts.map +1 -0
  213. package/dist/sense/service.js +33 -0
  214. package/dist/sense/service.js.map +1 -0
  215. package/dist/sense/types.d.ts +35 -0
  216. package/dist/sense/types.d.ts.map +1 -0
  217. package/dist/sense/types.js +11 -0
  218. package/dist/sense/types.js.map +1 -0
  219. package/dist/sense/voice.d.ts +28 -0
  220. package/dist/sense/voice.d.ts.map +1 -0
  221. package/dist/sense/voice.js +64 -0
  222. package/dist/sense/voice.js.map +1 -0
  223. package/dist/soul/git.d.ts.map +1 -1
  224. package/dist/soul/git.js +35 -16
  225. package/dist/soul/git.js.map +1 -1
  226. package/dist/soul/store.d.ts +22 -0
  227. package/dist/soul/store.d.ts.map +1 -1
  228. package/dist/soul/store.js +69 -14
  229. package/dist/soul/store.js.map +1 -1
  230. package/dist/soul/summary.d.ts +10 -0
  231. package/dist/soul/summary.d.ts.map +1 -0
  232. package/dist/soul/summary.js +57 -0
  233. package/dist/soul/summary.js.map +1 -0
  234. package/dist/soul/tools.d.ts.map +1 -1
  235. package/dist/soul/tools.js +13 -24
  236. package/dist/soul/tools.js.map +1 -1
  237. package/dist/soul/types.d.ts +9 -0
  238. package/dist/soul/types.d.ts.map +1 -1
  239. package/dist/soul/types.js.map +1 -1
  240. package/dist/subagent.d.ts +7 -0
  241. package/dist/subagent.d.ts.map +1 -1
  242. package/dist/subagent.js +3 -1
  243. package/dist/subagent.js.map +1 -1
  244. package/dist/tools/dispatch_agent.d.ts +13 -1
  245. package/dist/tools/dispatch_agent.d.ts.map +1 -1
  246. package/dist/tools/dispatch_agent.js +56 -12
  247. package/dist/tools/dispatch_agent.js.map +1 -1
  248. package/dist/tools/dispatch_status.d.ts +22 -0
  249. package/dist/tools/dispatch_status.d.ts.map +1 -0
  250. package/dist/tools/dispatch_status.js +57 -0
  251. package/dist/tools/dispatch_status.js.map +1 -0
  252. package/dist/tools/github.d.ts +34 -0
  253. package/dist/tools/github.d.ts.map +1 -0
  254. package/dist/tools/github.js +140 -0
  255. package/dist/tools/github.js.map +1 -0
  256. package/dist/tools/github_link.d.ts +36 -0
  257. package/dist/tools/github_link.d.ts.map +1 -0
  258. package/dist/tools/github_link.js +127 -0
  259. package/dist/tools/github_link.js.map +1 -0
  260. package/dist/tools/mcp.d.ts +28 -0
  261. package/dist/tools/mcp.d.ts.map +1 -0
  262. package/dist/tools/mcp.js +55 -0
  263. package/dist/tools/mcp.js.map +1 -0
  264. package/dist/tools/npm_info.d.ts +21 -0
  265. package/dist/tools/npm_info.d.ts.map +1 -0
  266. package/dist/tools/npm_info.js +102 -0
  267. package/dist/tools/npm_info.js.map +1 -0
  268. package/dist/tools/registry.d.ts +29 -0
  269. package/dist/tools/registry.d.ts.map +1 -1
  270. package/dist/tools/registry.js +75 -0
  271. package/dist/tools/registry.js.map +1 -1
  272. package/dist/tools/run_on_plan.d.ts +46 -0
  273. package/dist/tools/run_on_plan.d.ts.map +1 -0
  274. package/dist/tools/run_on_plan.js +89 -0
  275. package/dist/tools/run_on_plan.js.map +1 -0
  276. package/dist/tools/takoapi.d.ts +60 -0
  277. package/dist/tools/takoapi.d.ts.map +1 -0
  278. package/dist/tools/takoapi.js +181 -0
  279. package/dist/tools/takoapi.js.map +1 -0
  280. package/dist/tools/validate.d.ts +22 -0
  281. package/dist/tools/validate.d.ts.map +1 -0
  282. package/dist/tools/validate.js +50 -0
  283. package/dist/tools/validate.js.map +1 -0
  284. package/dist/voice/dictation.d.ts +51 -0
  285. package/dist/voice/dictation.d.ts.map +1 -0
  286. package/dist/voice/dictation.js +70 -0
  287. package/dist/voice/dictation.js.map +1 -0
  288. package/dist/web/agent-roster.d.ts +56 -0
  289. package/dist/web/agent-roster.d.ts.map +1 -0
  290. package/dist/web/agent-roster.js +109 -0
  291. package/dist/web/agent-roster.js.map +1 -0
  292. package/dist/web/devices.d.ts +27 -0
  293. package/dist/web/devices.d.ts.map +1 -0
  294. package/dist/web/devices.js +113 -0
  295. package/dist/web/devices.js.map +1 -0
  296. package/dist/web/island.d.ts +5 -1
  297. package/dist/web/island.d.ts.map +1 -1
  298. package/dist/web/island.js +427 -67
  299. package/dist/web/island.js.map +1 -1
  300. package/dist/web/lisa-client.d.ts +20 -0
  301. package/dist/web/lisa-client.d.ts.map +1 -0
  302. package/dist/web/lisa-client.js +1323 -0
  303. package/dist/web/lisa-client.js.map +1 -0
  304. package/dist/web/lisa-css.d.ts +13 -0
  305. package/dist/web/lisa-css.d.ts.map +1 -0
  306. package/dist/web/lisa-css.js +1163 -0
  307. package/dist/web/lisa-css.js.map +1 -0
  308. package/dist/web/lisa-html.d.ts +1 -1
  309. package/dist/web/lisa-html.d.ts.map +1 -1
  310. package/dist/web/lisa-html.js +16 -2091
  311. package/dist/web/lisa-html.js.map +1 -1
  312. package/dist/web/push.d.ts +76 -0
  313. package/dist/web/push.d.ts.map +1 -0
  314. package/dist/web/push.js +163 -0
  315. package/dist/web/push.js.map +1 -0
  316. package/dist/web/server.d.ts +19 -0
  317. package/dist/web/server.d.ts.map +1 -1
  318. package/dist/web/server.js +898 -65
  319. package/dist/web/server.js.map +1 -1
  320. package/package.json +5 -2
@@ -25,6 +25,8 @@
25
25
  * identitySub, sbDesire, sbClaudeCard, sbClaudeCount, sbClaudeRows,
26
26
  * sbReflection, sbReflectionBody, sbSessionBadge
27
27
  */
28
+ import { MAIN_CSS } from "./lisa-css.js";
29
+ import { MAIN_CLIENT_JS } from "./lisa-client.js";
28
30
  export const MAIN_HTML = `<!doctype html>
29
31
  <html lang="en"><head>
30
32
  <meta charset="utf-8">
@@ -38,1032 +40,7 @@ export const MAIN_HTML = `<!doctype html>
38
40
  <link rel="apple-touch-icon" href="/assets/lisa-mascot.png">
39
41
  <link rel="icon" type="image/png" href="/assets/lisa-mascot.png">
40
42
  <style>
41
- :root {
42
- color-scheme: dark;
43
-
44
- /* New design tokens (mockup) */
45
- --accent: #6ad4ff;
46
- --accent-soft: rgba(106, 212, 255, 0.13);
47
- --accent-glow: rgba(106, 212, 255, 0.27);
48
- --warm: #ffd066;
49
- --dream: #b487ff;
50
- --claude: #ff8c42;
51
- --err-color: #ff5577;
52
-
53
- --bg-deep: #07091a;
54
- --bg-1: #0b1024;
55
- --bg-2: #11163a;
56
- --bg-3: #1a1f4a;
57
- --bg-card: rgba(20, 26, 64, 0.65);
58
- --bg-card-strong: rgba(20, 26, 64, 0.88);
59
- --border-new: rgba(255, 255, 255, 0.07);
60
- --border-strong: rgba(255, 255, 255, 0.14);
61
-
62
- --fg: #e8eaff;
63
- --fg-2: #aeb5d3;
64
- --fg-3: #6c7398;
65
- --fg-faint: #444a6e;
66
-
67
- /* Legacy tokens — kept so the unchanged modal / cfg / birth
68
- overlay styles below still resolve. The new shell + chat use
69
- the modern tokens above. */
70
- --bg: #0a0d2b;
71
- --panel: #1a1f4d;
72
- --panel-light: #2a3270;
73
- --border: #6a7ad9;
74
- --border-light: #a4b2ff;
75
- --text: #e7ecff;
76
- --text-dim: #8090c0;
77
- --you: #6cf6e1;
78
- --lisa: #ffd167;
79
- --tool: #ff7eb6;
80
- --error: #ff5577;
81
- }
82
- * { box-sizing: border-box; }
83
- html, body {
84
- height: 100%;
85
- margin: 0;
86
- background: #000;
87
- font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
88
- -webkit-font-smoothing: antialiased;
89
- color: var(--fg);
90
- overflow: hidden;
91
- }
92
-
93
- /* ── App shell ─────────────────────────────────────────────── */
94
- .frame {
95
- height: 100vh;
96
- width: 100vw;
97
- display: grid;
98
- grid-template-columns: 280px 1fr;
99
- grid-template-rows: 36px 1fr;
100
- grid-template-areas:
101
- "titlebar titlebar"
102
- "sidebar main";
103
- background:
104
- radial-gradient(ellipse at 30% 20%, #1a1238 0%, transparent 50%),
105
- radial-gradient(ellipse at 80% 70%, #0a1f3a 0%, transparent 60%),
106
- linear-gradient(180deg, var(--bg-1) 0%, var(--bg-deep) 100%);
107
- overflow: hidden;
108
- }
109
-
110
- /* Title bar — visually shows "Lisa · session-id". The actual drag
111
- behavior is handled Swift-side by a transparent NSView overlay
112
- (DragHandleView) placed on top of the WKWebView for the same 36pt
113
- strip — WebKit ignores the CSS -webkit-app-region: drag property,
114
- so the cosmetic HTML and the functional drag region are two
115
- separate things.
116
- Padding-left reserves the ~78pt that the macOS traffic-light
117
- buttons occupy at top-left. */
118
- .titlebar {
119
- grid-area: titlebar;
120
- background: rgba(7, 9, 26, 0.55);
121
- backdrop-filter: blur(20px);
122
- -webkit-backdrop-filter: blur(20px);
123
- border-bottom: 1px solid var(--border-new);
124
- display: flex;
125
- align-items: center;
126
- justify-content: center;
127
- padding: 0 14px 0 78px;
128
- font-size: 12px;
129
- font-weight: 600;
130
- letter-spacing: 0.04em;
131
- color: var(--fg-2);
132
- /* nothing here should ever capture pointer events — the NSView
133
- overlay above handles dragging, and there are no interactive
134
- elements in the HTML titlebar. */
135
- user-select: none;
136
- pointer-events: none;
137
- }
138
- .titlebar .session-tag {
139
- color: var(--fg-3);
140
- font-weight: 400;
141
- margin-left: 6px;
142
- font-family: ui-monospace, "SF Mono", Menlo, monospace;
143
- font-size: 11px;
144
- letter-spacing: 0;
145
- }
146
-
147
- /* ── Sidebar ───────────────────────────────────────────────── */
148
- .sidebar {
149
- grid-area: sidebar;
150
- background: rgba(7, 9, 26, 0.4);
151
- backdrop-filter: blur(30px);
152
- -webkit-backdrop-filter: blur(30px);
153
- border-right: 1px solid var(--border-new);
154
- overflow-y: auto;
155
- padding: 20px 16px 16px;
156
- display: flex;
157
- flex-direction: column;
158
- gap: 18px;
159
- }
160
-
161
- /* Identity card */
162
- .identity {
163
- display: grid;
164
- grid-template-columns: 56px 1fr;
165
- gap: 12px;
166
- align-items: center;
167
- padding: 12px;
168
- background: var(--bg-card);
169
- border: 1px solid var(--border-new);
170
- border-radius: 14px;
171
- }
172
- .identity .avatar-wrap {
173
- width: 56px;
174
- height: 56px;
175
- border-radius: 50%;
176
- position: relative;
177
- border: 1px solid var(--border-strong);
178
- box-shadow: 0 0 0 3px var(--accent-soft);
179
- background: #15192a;
180
- }
181
- .identity .avatar-wrap img {
182
- width: 100%;
183
- height: 100%;
184
- border-radius: 50%;
185
- object-fit: cover;
186
- object-position: 50% 22%;
187
- image-rendering: pixelated;
188
- display: block;
189
- transition: opacity 250ms ease;
190
- user-select: none;
191
- -webkit-user-drag: none;
192
- }
193
- .identity .avatar-wrap img.fading { opacity: 0; }
194
- .identity .avatar-wrap::after {
195
- content: "";
196
- position: absolute;
197
- right: -2px;
198
- bottom: -2px;
199
- width: 14px;
200
- height: 14px;
201
- border-radius: 50%;
202
- background: #4ade80;
203
- border: 2px solid var(--bg-1);
204
- }
205
- .identity h1 {
206
- margin: 0 0 2px;
207
- font-size: 15px;
208
- font-weight: 700;
209
- letter-spacing: 0.02em;
210
- color: var(--fg);
211
- }
212
- .identity .sub {
213
- margin: 0;
214
- font-size: 11px;
215
- color: var(--fg-3);
216
- }
217
- .identity .mood {
218
- display: inline-flex;
219
- align-items: center;
220
- gap: 5px;
221
- margin-top: 4px;
222
- font-size: 10.5px;
223
- color: var(--accent);
224
- text-transform: uppercase;
225
- letter-spacing: 0.08em;
226
- font-weight: 600;
227
- }
228
- .identity .mood::before {
229
- content: "";
230
- width: 6px;
231
- height: 6px;
232
- border-radius: 50%;
233
- background: var(--accent);
234
- box-shadow: 0 0 6px var(--accent-glow);
235
- }
236
-
237
- /* Sidebar plain text section ("currently wanting") */
238
- .sb-section { display: flex; flex-direction: column; gap: 6px; }
239
- .sb-section h2 {
240
- margin: 0 0 2px;
241
- font-size: 10.5px;
242
- font-weight: 700;
243
- text-transform: uppercase;
244
- letter-spacing: 0.10em;
245
- color: var(--fg-3);
246
- padding-left: 4px;
247
- }
248
- .sb-section .body-text {
249
- margin: 0;
250
- font-size: 12px;
251
- line-height: 1.55;
252
- color: var(--fg-2);
253
- padding: 0 4px;
254
- }
255
-
256
- /* Live mini-cards (Claude monitor / last reflection) */
257
- .card {
258
- background: var(--bg-card);
259
- border: 1px solid var(--border-new);
260
- border-radius: 12px;
261
- padding: 10px 12px;
262
- font-size: 12px;
263
- color: var(--fg-2);
264
- line-height: 1.5;
265
- }
266
- .card.tint-claude {
267
- border-color: rgba(255, 140, 66, 0.20);
268
- background: linear-gradient(180deg, rgba(255, 140, 66, 0.06), rgba(255, 140, 66, 0.02));
269
- }
270
- .card.tint-idle {
271
- border-color: rgba(255, 208, 102, 0.22);
272
- background: linear-gradient(180deg, rgba(255, 208, 102, 0.07), rgba(255, 208, 102, 0.02));
273
- }
274
- .card .h {
275
- display: flex;
276
- justify-content: space-between;
277
- align-items: center;
278
- margin-bottom: 4px;
279
- }
280
- .card .h .left {
281
- display: flex;
282
- align-items: center;
283
- gap: 6px;
284
- font-size: 10.5px;
285
- font-weight: 700;
286
- text-transform: uppercase;
287
- letter-spacing: 0.10em;
288
- color: var(--claude);
289
- }
290
- .card.tint-idle .h .left { color: var(--warm); }
291
- .card .h .count {
292
- background: rgba(255, 140, 66, 0.16);
293
- color: var(--claude);
294
- font-size: 11px;
295
- font-weight: 600;
296
- padding: 2px 7px;
297
- border-radius: 8px;
298
- }
299
- .card.tint-idle .h .count {
300
- background: rgba(255, 208, 102, 0.16);
301
- color: var(--warm);
302
- }
303
- .session-row {
304
- display: grid;
305
- grid-template-columns: 7px 1fr auto;
306
- align-items: center;
307
- gap: 7px;
308
- padding: 5px 0;
309
- font-size: 11.5px;
310
- border-top: 1px dashed rgba(255, 140, 66, 0.10);
311
- cursor: default;
312
- }
313
- .session-row:first-of-type { border-top: 0; }
314
- .session-row .pip {
315
- width: 7px;
316
- height: 7px;
317
- border-radius: 50%;
318
- background: var(--fg-faint);
319
- }
320
- .session-row .pip.working { background: var(--claude); animation: pulse 1.8s ease-in-out infinite; }
321
- .session-row .pip.waiting { background: var(--claude); }
322
- .session-row .pip.error { background: var(--err-color); }
323
- .session-row .name {
324
- color: var(--fg);
325
- font-weight: 600;
326
- overflow: hidden;
327
- white-space: nowrap;
328
- text-overflow: ellipsis;
329
- }
330
- .session-row .when {
331
- color: var(--fg-3);
332
- font-variant-numeric: tabular-nums;
333
- font-size: 10.5px;
334
- }
335
- .session-empty {
336
- color: var(--fg-faint);
337
- font-size: 11.5px;
338
- font-style: italic;
339
- padding: 4px 0 2px;
340
- }
341
- @keyframes pulse {
342
- 0%, 100% { opacity: 0.35; }
343
- 50% { opacity: 1; }
344
- }
345
-
346
- /* Compact SOUL / SKILLS / MEMORY / TOOLS row */
347
- .badges {
348
- display: grid;
349
- grid-template-columns: repeat(2, 1fr);
350
- gap: 6px;
351
- }
352
- .badge {
353
- background: var(--bg-card);
354
- border: 1px solid var(--border-new);
355
- color: var(--fg-2);
356
- font-family: inherit;
357
- font-size: 10.5px;
358
- font-weight: 600;
359
- letter-spacing: 0.06em;
360
- text-transform: uppercase;
361
- padding: 7px 8px;
362
- border-radius: 8px;
363
- cursor: pointer;
364
- display: flex;
365
- align-items: center;
366
- justify-content: center;
367
- gap: 6px;
368
- transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
369
- }
370
- .badge:hover {
371
- background: var(--bg-card-strong);
372
- color: var(--fg);
373
- border-color: var(--border-strong);
374
- }
375
- .badge img {
376
- width: 14px;
377
- height: 14px;
378
- image-rendering: pixelated;
379
- opacity: 0.8;
380
- }
381
-
382
- /* Sidebar footer — session id + sessions count */
383
- .sb-footer {
384
- margin-top: auto;
385
- padding-top: 12px;
386
- border-top: 1px solid var(--border-new);
387
- display: flex;
388
- align-items: center;
389
- gap: 8px;
390
- color: var(--fg-3);
391
- font-size: 11px;
392
- }
393
- .sb-footer .session-id {
394
- font-family: ui-monospace, "SF Mono", Menlo, monospace;
395
- font-size: 10px;
396
- color: var(--fg-3);
397
- overflow: hidden;
398
- white-space: nowrap;
399
- text-overflow: ellipsis;
400
- flex: 1;
401
- min-width: 0;
402
- }
403
- .sb-footer .badge-count {
404
- background: var(--bg-3);
405
- color: var(--fg-2);
406
- border-radius: 6px;
407
- padding: 1px 6px;
408
- font-size: 10px;
409
- font-variant-numeric: tabular-nums;
410
- flex-shrink: 0;
411
- }
412
-
413
- /* ── Main pane ─────────────────────────────────────────────── */
414
- .main {
415
- grid-area: main;
416
- display: grid;
417
- grid-template-rows: 1fr auto auto;
418
- overflow: hidden;
419
- background:
420
- radial-gradient(ellipse at 50% -30%, rgba(106, 212, 255, 0.06) 0%, transparent 60%),
421
- linear-gradient(180deg, transparent, rgba(106, 212, 255, 0.015));
422
- }
423
-
424
- #log {
425
- overflow-y: auto;
426
- padding: 22px 28px 24px;
427
- display: flex;
428
- flex-direction: column;
429
- gap: 8px;
430
- scroll-behavior: smooth;
431
- }
432
-
433
- /* Chat author label (.role .you/.lisa) */
434
- .role {
435
- font-size: 10px;
436
- font-weight: 700;
437
- letter-spacing: 0.14em;
438
- text-transform: uppercase;
439
- padding: 6px 2px 0;
440
- margin-top: 6px;
441
- }
442
- .role.you { color: var(--accent); text-align: right; }
443
- .role.lisa { color: var(--warm); }
444
-
445
- /* Message bubble */
446
- .msg {
447
- display: block;
448
- max-width: 88%;
449
- background: var(--bg-card);
450
- border: 1px solid var(--border-new);
451
- border-radius: 14px;
452
- padding: 9px 13px;
453
- font-size: 13px;
454
- line-height: 1.55;
455
- color: var(--fg);
456
- white-space: pre-wrap;
457
- word-wrap: break-word;
458
- }
459
- /* "you" bubbles sit on the right with cyan tint */
460
- .role.you + .msg {
461
- margin-left: auto;
462
- background: linear-gradient(160deg, rgba(106, 212, 255, 0.12), rgba(106, 212, 255, 0.06));
463
- border-color: rgba(106, 212, 255, 0.25);
464
- }
465
- /* attachment label sits compactly under the user bubble */
466
- .msg.attach-label {
467
- margin-top: 2px;
468
- background: transparent;
469
- border: 0;
470
- padding: 0 2px;
471
- font-size: 10.5px;
472
- color: var(--fg-3);
473
- max-width: 88%;
474
- margin-left: auto;
475
- }
476
-
477
- /* Thinking indicator */
478
- .thinking {
479
- font-size: 12px;
480
- color: var(--fg-3);
481
- font-style: italic;
482
- padding: 4px 2px;
483
- letter-spacing: 0.03em;
484
- }
485
-
486
- /* Tool call card */
487
- .tool-block {
488
- background: var(--bg-card);
489
- border: 1px solid var(--border-new);
490
- border-radius: 10px;
491
- padding: 8px 12px;
492
- font-family: ui-monospace, "SF Mono", Menlo, monospace;
493
- font-size: 11px;
494
- color: var(--fg-2);
495
- margin: 4px 0;
496
- max-width: 92%;
497
- }
498
- .tool-block.tool-error {
499
- border-color: rgba(255, 85, 119, 0.30);
500
- background: rgba(255, 85, 119, 0.05);
501
- }
502
- .tool-head {
503
- display: flex;
504
- align-items: center;
505
- gap: 8px;
506
- color: var(--accent);
507
- font-weight: 600;
508
- }
509
- .tool-block.tool-error .tool-head { color: var(--err-color); }
510
- .tool-icon { font-size: 12px; }
511
- .tool-spinner { color: var(--fg-3); font-weight: 400; margin-left: auto; font-size: 12px; }
512
- .tool-input {
513
- color: var(--fg-3);
514
- margin-top: 4px;
515
- white-space: pre-wrap;
516
- word-break: break-word;
517
- }
518
- .tool-result {
519
- color: var(--fg-2);
520
- margin-top: 4px;
521
- padding-top: 4px;
522
- border-top: 1px dashed var(--border-new);
523
- white-space: pre-wrap;
524
- max-height: 160px;
525
- overflow-y: auto;
526
- }
527
-
528
- .err {
529
- color: var(--err-color);
530
- font-size: 12px;
531
- padding: 6px 2px;
532
- }
533
-
534
- /* Idle pulse + while-you-were-away banner injected into #log */
535
- .idle-pulse {
536
- color: var(--dream);
537
- font-size: 12px;
538
- font-style: italic;
539
- padding: 4px 2px;
540
- letter-spacing: 0.03em;
541
- }
542
- .idle-block {
543
- background: linear-gradient(180deg, rgba(180, 135, 255, 0.10), rgba(180, 135, 255, 0.02));
544
- border: 1px solid rgba(180, 135, 255, 0.30);
545
- border-radius: 14px;
546
- padding: 12px 14px;
547
- margin: 6px 0;
548
- font-size: 12.5px;
549
- line-height: 1.6;
550
- color: var(--fg);
551
- }
552
- .idle-head {
553
- font-size: 11px;
554
- text-transform: uppercase;
555
- letter-spacing: 0.10em;
556
- color: var(--dream);
557
- font-weight: 700;
558
- margin-bottom: 6px;
559
- display: flex;
560
- align-items: center;
561
- gap: 8px;
562
- }
563
- .idle-time {
564
- margin-left: auto;
565
- font-weight: 400;
566
- letter-spacing: 0.05em;
567
- color: var(--fg-3);
568
- font-size: 10px;
569
- }
570
-
571
- /* Composer */
572
- #attachPreview {
573
- padding: 4px 22px 0;
574
- display: flex;
575
- flex-wrap: wrap;
576
- gap: 6px;
577
- min-height: 0;
578
- }
579
- #attachPreview:empty { padding: 0; }
580
- .attach-chip {
581
- background: var(--bg-card-strong);
582
- border: 1px solid var(--border-strong);
583
- color: var(--fg-2);
584
- font-size: 11px;
585
- padding: 3px 8px;
586
- border-radius: 8px;
587
- display: inline-flex;
588
- align-items: center;
589
- gap: 6px;
590
- }
591
- .attach-rm {
592
- background: transparent;
593
- border: 0;
594
- color: var(--fg-3);
595
- cursor: pointer;
596
- font-size: 13px;
597
- padding: 0;
598
- line-height: 1;
599
- }
600
- .attach-rm:hover { color: var(--err-color); }
601
-
602
- #form {
603
- padding: 14px 20px 18px;
604
- background: rgba(7, 9, 26, 0.6);
605
- backdrop-filter: blur(30px);
606
- -webkit-backdrop-filter: blur(30px);
607
- border-top: 1px solid var(--border-new);
608
- display: grid;
609
- grid-template-columns: 36px 36px 36px 1fr 96px;
610
- gap: 10px;
611
- align-items: end;
612
- }
613
-
614
- #attachBtn, #captureBtn, #recordBtn {
615
- align-self: stretch;
616
- display: flex;
617
- align-items: center;
618
- justify-content: center;
619
- background: transparent;
620
- border: 0;
621
- color: var(--fg-3);
622
- font-size: 17px;
623
- cursor: pointer;
624
- border-radius: 10px;
625
- transition: background 120ms ease, color 120ms ease;
626
- min-height: 44px;
627
- padding: 0;
628
- }
629
- #attachBtn:hover, #captureBtn:hover, #recordBtn:hover { background: var(--bg-card); color: var(--fg); }
630
- #captureBtn.flash { background: var(--accent); color: var(--bg-deep); }
631
- /* Pulsing red while recording. */
632
- #recordBtn.recording {
633
- background: var(--err-color);
634
- color: #fff;
635
- animation: rec-pulse 1.1s ease-in-out infinite;
636
- }
637
- @keyframes rec-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
638
- /* Off-screen the file input instead of display:none. WKWebView's
639
- implicit <label>→<input type=file> click forward doesn't fire on a
640
- fully display:none input — the OS file picker silently no-ops.
641
- Off-screening keeps the input "live" while invisible. */
642
- #fileInput {
643
- position: absolute;
644
- width: 1px;
645
- height: 1px;
646
- opacity: 0;
647
- pointer-events: none;
648
- overflow: hidden;
649
- }
650
-
651
- #input {
652
- background: var(--bg-card-strong);
653
- border: 1px solid var(--border-strong);
654
- border-radius: 14px;
655
- color: var(--fg);
656
- font-family: inherit;
657
- font-size: 13.5px;
658
- line-height: 1.45;
659
- padding: 11px 13px;
660
- resize: none;
661
- outline: none;
662
- width: 100%;
663
- min-height: 44px;
664
- max-height: 200px;
665
- transition: border-color 120ms ease, box-shadow 120ms ease;
666
- }
667
- #input:focus {
668
- border-color: var(--accent);
669
- box-shadow: 0 0 0 3px var(--accent-soft);
670
- }
671
- #input::placeholder { color: var(--fg-3); }
672
-
673
- #sendBtn {
674
- background: linear-gradient(180deg, var(--accent) 0%, #4eb8e5 100%);
675
- color: #0a1024;
676
- border: 0;
677
- border-radius: 14px;
678
- height: 100%;
679
- font-family: inherit;
680
- font-size: 12.5px;
681
- font-weight: 700;
682
- letter-spacing: 0.06em;
683
- cursor: pointer;
684
- display: flex;
685
- align-items: center;
686
- justify-content: center;
687
- gap: 6px;
688
- padding: 10px 14px;
689
- transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
690
- box-shadow: 0 4px 14px rgba(106, 212, 255, 0.25);
691
- }
692
- #sendBtn:hover:not(:disabled) {
693
- transform: translateY(-1px);
694
- box-shadow: 0 6px 18px rgba(106, 212, 255, 0.35);
695
- }
696
- #sendBtn:active:not(:disabled) { transform: translateY(0); }
697
- #sendBtn:disabled { opacity: 0.5; cursor: wait; }
698
- /* Hide the legacy pixel send icon; the text label is enough in the new theme. */
699
- #sendBtn img { display: none; }
700
-
701
- /* ── Mobile / narrow ───────────────────────────────────────── */
702
- @media (max-width: 720px) {
703
- body {
704
- padding-top: env(safe-area-inset-top);
705
- padding-bottom: env(safe-area-inset-bottom);
706
- }
707
- .frame {
708
- grid-template-columns: 1fr;
709
- grid-template-rows: auto 1fr auto;
710
- }
711
- .sidebar {
712
- max-height: 38vh;
713
- padding: 14px 14px 12px;
714
- gap: 14px;
715
- }
716
- #form {
717
- grid-template-columns: 36px 36px 36px 1fr 84px;
718
- padding: 10px 14px 14px;
719
- }
720
- #input { font-size: 16px; /* prevents iOS Safari auto-zoom */ }
721
- }
722
-
723
- /* ===================================================================
724
- Modal panel (skills / memory / tools / soul) — unchanged from the
725
- legacy pixel-art shell. Uses the legacy CSS vars declared above.
726
- =================================================================== */
727
- .modal-bg {
728
- position: fixed; inset: 0;
729
- background: rgba(0, 0, 0, 0.7);
730
- display: none;
731
- align-items: center; justify-content: center;
732
- z-index: 100;
733
- }
734
- .modal-bg.open { display: flex; }
735
- .modal {
736
- background: var(--bg-card-strong);
737
- border: 1px solid var(--border-strong);
738
- border-radius: 16px;
739
- backdrop-filter: blur(30px);
740
- -webkit-backdrop-filter: blur(30px);
741
- box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
742
- max-width: 720px;
743
- width: 90vw;
744
- max-height: 80vh;
745
- display: flex;
746
- flex-direction: column;
747
- }
748
- .modal-head {
749
- padding: 14px 18px;
750
- border-bottom: 1px solid var(--border-new);
751
- display: flex;
752
- justify-content: space-between;
753
- align-items: center;
754
- }
755
- .modal-title {
756
- font-size: 13px;
757
- font-weight: 700;
758
- letter-spacing: 0.10em;
759
- text-transform: uppercase;
760
- color: var(--accent);
761
- }
762
- .modal-close {
763
- background: transparent;
764
- border: 1px solid var(--border-new);
765
- color: var(--fg-2);
766
- font-family: inherit;
767
- font-size: 11px;
768
- letter-spacing: 0.06em;
769
- padding: 5px 10px;
770
- border-radius: 8px;
771
- cursor: pointer;
772
- }
773
- .modal-close:hover { color: var(--err-color); border-color: rgba(255, 85, 119, 0.40); }
774
- .modal-body {
775
- padding: 16px 18px;
776
- overflow-y: auto;
777
- font-size: 12.5px;
778
- line-height: 1.55;
779
- color: var(--fg-2);
780
- }
781
- .modal-body h3 {
782
- font-size: 11px;
783
- font-weight: 700;
784
- letter-spacing: 0.10em;
785
- text-transform: uppercase;
786
- color: var(--accent);
787
- margin: 14px 0 6px 0;
788
- border-bottom: 1px dashed var(--border-new);
789
- padding-bottom: 5px;
790
- }
791
- .modal-body h3:first-child { margin-top: 0; }
792
- .modal-body .item {
793
- padding: 7px 0;
794
- border-bottom: 1px dotted var(--border-new);
795
- }
796
- .modal-body .item:last-child { border: none; }
797
- .modal-body .name {
798
- color: var(--warm);
799
- font-weight: 600;
800
- font-size: 12px;
801
- }
802
- .modal-body .desc { color: var(--fg-3); margin-top: 2px; }
803
- .modal-body pre {
804
- background: rgba(0, 0, 0, 0.30);
805
- padding: 10px 12px;
806
- border-left: 2px solid var(--accent);
807
- border-radius: 4px;
808
- white-space: pre-wrap;
809
- margin: 6px 0;
810
- color: var(--fg);
811
- font-family: ui-monospace, "SF Mono", Menlo, monospace;
812
- font-size: 11.5px;
813
- line-height: 1.5;
814
- }
815
- .modal-body .empty { color: var(--fg-faint); font-style: italic; }
816
-
817
- /* ===================================================================
818
- Birth ritual overlay — full-screen, one-time. Uses legacy palette
819
- intentionally (it's a separate ceremonial moment).
820
- =================================================================== */
821
- .birth-overlay {
822
- position: fixed;
823
- inset: 0;
824
- background:
825
- radial-gradient(ellipse at center, rgba(40, 30, 80, 0.95) 0%, rgba(5, 5, 20, 1) 70%);
826
- z-index: 9999;
827
- display: none;
828
- flex-direction: column;
829
- align-items: center;
830
- justify-content: center;
831
- padding: 32px;
832
- }
833
- .birth-overlay.open { display: flex; }
834
- .birth-content {
835
- position: relative;
836
- z-index: 2;
837
- width: min(800px, 95vw);
838
- max-height: 90vh;
839
- overflow-y: auto;
840
- }
841
- .birth-stars {
842
- text-align: center;
843
- color: var(--accent);
844
- font-size: 14px;
845
- letter-spacing: 8px;
846
- text-shadow: 0 0 8px var(--accent-glow);
847
- animation: starBlink 1.5s steps(3) infinite;
848
- }
849
- @keyframes starBlink {
850
- 0%, 30%, 100% { opacity: 1; }
851
- 50% { opacity: 0.4; }
852
- }
853
- .birth-title {
854
- text-align: center;
855
- color: var(--warm);
856
- font-size: 22px;
857
- font-weight: 700;
858
- letter-spacing: 6px;
859
- margin: 24px 0 32px;
860
- text-shadow: 0 0 12px rgba(255, 208, 102, 0.45);
861
- }
862
- .birth-step {
863
- margin: 14px 0;
864
- padding: 10px 16px;
865
- border-left: 3px solid var(--border-new);
866
- background: rgba(20, 26, 64, 0.55);
867
- border-radius: 0 8px 8px 0;
868
- opacity: 0;
869
- transform: translateY(8px);
870
- transition: opacity 0.4s ease-out, transform 0.4s ease-out;
871
- }
872
- .birth-step.shown { opacity: 1; transform: translateY(0); }
873
- .birth-step.active {
874
- border-left-color: var(--warm);
875
- background: rgba(255, 208, 102, 0.08);
876
- }
877
- .birth-step.done { border-left-color: var(--accent); }
878
- .birth-step .step-name {
879
- font-size: 10.5px;
880
- font-weight: 700;
881
- letter-spacing: 0.10em;
882
- color: var(--fg-3);
883
- text-transform: uppercase;
884
- margin-bottom: 4px;
885
- }
886
- .birth-step.active .step-name { color: var(--warm); }
887
- .birth-step.done .step-name { color: var(--accent); }
888
- .birth-step .step-detail {
889
- color: var(--fg);
890
- font-size: 13px;
891
- line-height: 1.55;
892
- word-break: break-word;
893
- }
894
- .birth-step .step-cursor {
895
- display: inline-block;
896
- width: 6px;
897
- background: var(--warm);
898
- height: 0.9em;
899
- vertical-align: middle;
900
- animation: blink 0.8s steps(2) infinite;
901
- }
902
- @keyframes blink { 50% { opacity: 0; } }
903
- .birth-final {
904
- margin-top: 36px;
905
- text-align: center;
906
- color: var(--warm);
907
- font-size: 15px;
908
- font-weight: 700;
909
- letter-spacing: 0.10em;
910
- text-shadow: 0 0 10px rgba(255, 208, 102, 0.4);
911
- opacity: 0;
912
- transition: opacity 0.6s ease-in;
913
- }
914
- .birth-final.shown { opacity: 1; }
915
- .birth-enter {
916
- margin: 24px auto 0;
917
- display: block;
918
- background: linear-gradient(180deg, var(--accent) 0%, #4eb8e5 100%);
919
- border: 0;
920
- color: #0a1024;
921
- font-family: inherit;
922
- font-weight: 700;
923
- font-size: 13px;
924
- padding: 12px 32px;
925
- border-radius: 12px;
926
- cursor: pointer;
927
- letter-spacing: 0.10em;
928
- opacity: 0;
929
- transition: opacity 0.6s ease-in, transform 120ms ease;
930
- box-shadow: 0 6px 18px rgba(106, 212, 255, 0.35);
931
- }
932
- .birth-enter.shown { opacity: 1; }
933
- .birth-enter:hover { transform: translateY(-1px); }
934
- .birth-error {
935
- color: var(--err-color);
936
- text-align: center;
937
- margin-top: 24px;
938
- font-size: 11.5px;
939
- letter-spacing: 0.05em;
940
- }
941
-
942
- /* ===================================================================
943
- API-key config overlay — same modernized treatment.
944
- =================================================================== */
945
- .cfg-overlay {
946
- position: fixed;
947
- inset: 0;
948
- background:
949
- radial-gradient(ellipse at center, rgba(40, 30, 80, 0.95) 0%, rgba(5, 5, 20, 1) 70%);
950
- z-index: 9998;
951
- display: none;
952
- align-items: center;
953
- justify-content: center;
954
- padding: 32px;
955
- }
956
- .cfg-overlay.open { display: flex; }
957
- .cfg-card {
958
- position: relative;
959
- z-index: 2;
960
- width: min(520px, 95vw);
961
- background: var(--bg-card-strong);
962
- border: 1px solid var(--border-strong);
963
- border-radius: 16px;
964
- backdrop-filter: blur(30px);
965
- -webkit-backdrop-filter: blur(30px);
966
- box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
967
- padding: 28px 32px;
968
- }
969
- .cfg-stars {
970
- text-align: center;
971
- color: var(--accent);
972
- font-size: 12px;
973
- letter-spacing: 6px;
974
- text-shadow: 0 0 8px var(--accent-glow);
975
- animation: starBlink 1.5s steps(3) infinite;
976
- }
977
- .cfg-title {
978
- text-align: center;
979
- color: var(--warm);
980
- font-size: 16px;
981
- font-weight: 700;
982
- letter-spacing: 6px;
983
- margin: 16px 0 6px;
984
- }
985
- .cfg-sub {
986
- text-align: center;
987
- color: var(--fg-3);
988
- font-size: 12.5px;
989
- margin-bottom: 22px;
990
- line-height: 1.5;
991
- }
992
- .cfg-sub a { color: var(--accent); text-decoration: underline; }
993
- .cfg-field { display: block; margin: 14px 0; }
994
- .cfg-label {
995
- display: block;
996
- font-size: 10.5px;
997
- font-weight: 700;
998
- letter-spacing: 0.08em;
999
- text-transform: uppercase;
1000
- color: var(--accent);
1001
- margin-bottom: 6px;
1002
- }
1003
- .cfg-label .opt {
1004
- color: var(--fg-3);
1005
- font-size: 9.5px;
1006
- margin-left: 6px;
1007
- text-transform: none;
1008
- letter-spacing: 0;
1009
- font-weight: 400;
1010
- }
1011
- .cfg-input {
1012
- width: 100%;
1013
- background: var(--bg-card);
1014
- border: 1px solid var(--border-strong);
1015
- border-radius: 10px;
1016
- color: var(--fg);
1017
- font-family: ui-monospace, "SF Mono", Menlo, monospace;
1018
- font-size: 13px;
1019
- padding: 10px 12px;
1020
- }
1021
- .cfg-input:focus {
1022
- outline: none;
1023
- border-color: var(--accent);
1024
- box-shadow: 0 0 0 3px var(--accent-soft);
1025
- }
1026
- .cfg-help {
1027
- color: var(--fg-3);
1028
- font-size: 11px;
1029
- margin-top: 6px;
1030
- }
1031
- .cfg-help code {
1032
- color: var(--fg-2);
1033
- background: rgba(0, 0, 0, 0.3);
1034
- padding: 1px 5px;
1035
- border-radius: 3px;
1036
- font-size: 11px;
1037
- }
1038
- .cfg-actions {
1039
- margin-top: 22px;
1040
- display: flex;
1041
- justify-content: center;
1042
- }
1043
- .cfg-save {
1044
- background: linear-gradient(180deg, var(--accent) 0%, #4eb8e5 100%);
1045
- border: 0;
1046
- color: #0a1024;
1047
- font-family: inherit;
1048
- font-size: 12.5px;
1049
- font-weight: 700;
1050
- padding: 11px 28px;
1051
- border-radius: 12px;
1052
- cursor: pointer;
1053
- letter-spacing: 0.10em;
1054
- box-shadow: 0 4px 14px rgba(106, 212, 255, 0.25);
1055
- transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
1056
- }
1057
- .cfg-save:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(106, 212, 255, 0.35); }
1058
- .cfg-save:active { transform: translateY(0); }
1059
- .cfg-save:disabled { opacity: 0.55; cursor: wait; }
1060
- .cfg-error {
1061
- color: var(--err-color);
1062
- font-size: 11px;
1063
- text-align: center;
1064
- margin-top: 14px;
1065
- min-height: 14px;
1066
- }
43
+ ${MAIN_CSS}
1067
44
  </style>
1068
45
  </head><body>
1069
46
 
@@ -1098,9 +75,18 @@ export const MAIN_HTML = `<!doctype html>
1098
75
  <!-- Claude Code monitor -->
1099
76
  <div class="card tint-claude" id="sbClaudeCard">
1100
77
  <div class="h">
1101
- <div class="left">claude code</div>
78
+ <div class="left">agents</div>
1102
79
  <div class="count">▶︎ <span id="sbClaudeCount">0</span></div>
1103
80
  </div>
81
+ <form id="sbDelegate" class="delegate" autocomplete="off">
82
+ <select id="sbDelegateKind" title="Agent type — managed (LISA-run) or a real CLI under a PTY (spike)">
83
+ <option value="managed">managed</option>
84
+ <option value="claude">claude</option>
85
+ <option value="codex">codex</option>
86
+ </select>
87
+ <input id="sbDelegateTask" type="text" placeholder="delegate a task…" />
88
+ <button type="submit" title="Start an agent">▶</button>
89
+ </form>
1104
90
  <div id="sbClaudeRows">
1105
91
  <div class="session-empty">(idle)</div>
1106
92
  </div>
@@ -1120,6 +106,7 @@ export const MAIN_HTML = `<!doctype html>
1120
106
  <button class="badge" type="button" data-panel="skills"><img src="/assets/icon-skill.png" alt="">SKILLS</button>
1121
107
  <button class="badge" type="button" data-panel="memory"><img src="/assets/icon-memory.png" alt="">MEMORY</button>
1122
108
  <button class="badge" type="button" data-panel="tools"><img src="/assets/icon-tool.png" alt="">TOOLS</button>
109
+ <button class="badge" type="button" data-panel="plans"><img src="/assets/icon-tool.png" alt="">PLANS</button>
1123
110
  </div>
1124
111
 
1125
112
  <!-- Footer: current session id -->
@@ -1145,7 +132,7 @@ export const MAIN_HTML = `<!doctype html>
1145
132
  📎
1146
133
  </label>
1147
134
  <button type="button" id="captureBtn" title="Screenshot for Lisa (⌃⌥S anywhere)">📷</button>
1148
- <button type="button" id="recordBtn" title="Record audio — Lisa will transcribe + summarize it">🎙</button>
135
+ <button type="button" id="recordBtn" title="Dictatespeak and Lisa drops polished text in the box (hold to record a summary)">🎙</button>
1149
136
  <textarea id="input" placeholder="Talk to Lisa… (Enter to send · Shift+Enter for newline)" autofocus></textarea>
1150
137
  <button type="submit" id="sendBtn">
1151
138
  <img src="/assets/icon-send.png" alt="">
@@ -1212,1069 +199,7 @@ export const MAIN_HTML = `<!doctype html>
1212
199
  </div>
1213
200
 
1214
201
  <script>
1215
- const log = document.getElementById('log');
1216
- const input = document.getElementById('input');
1217
- const form = document.getElementById('form');
1218
- const sendBtn = document.getElementById('sendBtn');
1219
- const sessionEl = document.getElementById('sessionId');
1220
- const fileInput = document.getElementById('fileInput');
1221
- const attachPreview = document.getElementById('attachPreview');
1222
-
1223
- // ── Attached files state ──────────────────────────────────────────
1224
- let pendingFiles = []; // Array of {name, mediaType, data (base64)}
1225
-
1226
- function readFileAsBase64(file) {
1227
- return new Promise((resolve, reject) => {
1228
- const reader = new FileReader();
1229
- reader.onload = () => {
1230
- const dataUrl = reader.result;
1231
- const base64 = dataUrl.split(',')[1];
1232
- resolve(base64);
1233
- };
1234
- reader.onerror = reject;
1235
- reader.readAsDataURL(file);
1236
- });
1237
- }
1238
-
1239
- function inferMediaType(file) {
1240
- if (file.type) return file.type;
1241
- const ext = file.name.split('.').pop().toLowerCase();
1242
- const map = { pdf: 'application/pdf', txt: 'text/plain', md: 'text/plain', csv: 'text/csv', json: 'application/json' };
1243
- return map[ext] || 'application/octet-stream';
1244
- }
1245
-
1246
- // ── Vision: screenshot → composer ──────────────────────────────────
1247
- // lisaAttachImage adds an already-encoded {name,mediaType,data} object to
1248
- // the pending attachments — used by both the in-page 📷 button and the
1249
- // native global hotkey (Lisa.app calls lisaCaptureAndAttach via JS bridge).
1250
- window.lisaAttachImage = function (file) {
1251
- if (!file || !file.data) return;
1252
- pendingFiles.push({
1253
- name: file.name || 'screenshot.png',
1254
- mediaType: file.mediaType || 'image/png',
1255
- data: file.data,
1256
- });
1257
- renderAttachPreview();
1258
- try { input.focus(); } catch (_) {}
1259
- };
1260
-
1261
- // lisaPrefillComposer drops text into the composer WITHOUT sending — the user
1262
- // reads it and hits Enter to send (that send is the confirmation). Used by the
1263
- // island's screen-advisor "Optimize ▸" card (via the Swift bridge) and by the
1264
- // ?prefill= URL param (plain browser tabs).
1265
- window.lisaPrefillComposer = function (text) {
1266
- if (!text || !input) return;
1267
- input.value = String(text);
1268
- try { input.dispatchEvent(new Event('input', { bubbles: true })); } catch (_) {}
1269
- try { input.focus(); input.setSelectionRange(input.value.length, input.value.length); } catch (_) {}
1270
- };
1271
-
1272
- // On load, honour ?prefill=… (the island opens /?prefill=<task> in a browser
1273
- // tab). Strip it from the URL afterwards so a refresh doesn't re-fill.
1274
- try {
1275
- var _pf = new URLSearchParams(location.search).get('prefill');
1276
- if (_pf) {
1277
- window.lisaPrefillComposer(_pf);
1278
- history.replaceState(null, '', location.pathname);
1279
- }
1280
- } catch (_) {}
1281
-
1282
- // lisaCaptureAndAttach asks the server to run a screen capture, then
1283
- // attaches the result. mode: 'interactive' (crosshair, default) | 'full'.
1284
- // Returns true if an image was attached, false if cancelled/failed.
1285
- // Exposed on window so the native app's global hotkey can invoke it.
1286
- let capturing = false;
1287
- window.lisaCaptureAndAttach = async function (mode) {
1288
- if (capturing) return false;
1289
- capturing = true;
1290
- const btn = document.getElementById('captureBtn');
1291
- if (btn) btn.classList.add('flash');
1292
- try {
1293
- const res = await fetch('/api/vision/capture', {
1294
- method: 'POST',
1295
- headers: { 'content-type': 'application/json' },
1296
- body: JSON.stringify({ mode: mode || 'interactive' }),
1297
- });
1298
- if (!res.ok) {
1299
- console.warn('[vision] capture failed: HTTP ' + res.status);
1300
- return false;
1301
- }
1302
- const data = await res.json();
1303
- if (data.cancelled || !data.file) return false;
1304
- window.lisaAttachImage(data.file);
1305
- return true;
1306
- } catch (err) {
1307
- console.warn('[vision] capture error:', err);
1308
- return false;
1309
- } finally {
1310
- capturing = false;
1311
- if (btn) setTimeout(() => btn.classList.remove('flash'), 200);
1312
- }
1313
- };
1314
-
1315
- function renderAttachPreview() {
1316
- attachPreview.innerHTML = '';
1317
- pendingFiles.forEach((f, i) => {
1318
- const chip = document.createElement('span');
1319
- chip.className = 'attach-chip';
1320
- chip.textContent = f.name;
1321
- const rm = document.createElement('button');
1322
- rm.type = 'button';
1323
- rm.className = 'attach-rm';
1324
- rm.textContent = '×';
1325
- rm.onclick = () => { pendingFiles.splice(i, 1); renderAttachPreview(); };
1326
- chip.appendChild(rm);
1327
- attachPreview.appendChild(chip);
1328
- });
1329
- }
1330
-
1331
- fileInput.addEventListener('change', async () => {
1332
- for (const file of fileInput.files) {
1333
- const data = await readFileAsBase64(file);
1334
- pendingFiles.push({ name: file.name, mediaType: inferMediaType(file), data });
1335
- }
1336
- fileInput.value = '';
1337
- renderAttachPreview();
1338
- });
1339
-
1340
- // The natural <label>→<input type=file> click-forwarding is supposed
1341
- // to open the picker without any JS. But in WKWebView under our
1342
- // layout it never reaches runOpenPanel. We add an explicit click
1343
- // listener that forwards the click synchronously (preserving the
1344
- // user-gesture context) and logs to console so we can verify in the
1345
- // inspector if it ever silently no-ops again.
1346
- // 📷 capture button → interactive crosshair screenshot into the composer.
1347
- const captureBtnEl = document.getElementById('captureBtn');
1348
- if (captureBtnEl) {
1349
- captureBtnEl.addEventListener('click', () => { void window.lisaCaptureAndAttach('interactive'); });
1350
- }
1351
-
1352
- // ── Audio recording → transcribe → Lisa summarizes ─────────────────
1353
- // 🎙 toggles a MediaRecorder. On stop: POST the clip to /api/voice/transcribe
1354
- // (server-side Whisper), then send the transcript into the normal chat with a
1355
- // "summarize this" framing — so Lisa produces the summary in her own voice and
1356
- // it's persisted + discussable like any turn. First click prompts mic
1357
- // permission (browser-native).
1358
- const recordBtnEl = document.getElementById('recordBtn');
1359
- let mediaRecorder = null;
1360
- let recordedChunks = [];
1361
- let recordStream = null;
1362
-
1363
- function pickAudioMime() {
1364
- const prefs = ['audio/webm;codecs=opus', 'audio/webm', 'audio/mp4', 'audio/ogg'];
1365
- for (const m of prefs) {
1366
- try { if (window.MediaRecorder && MediaRecorder.isTypeSupported(m)) return m; } catch (_) {}
1367
- }
1368
- return '';
1369
- }
1370
-
1371
- async function startRecording() {
1372
- if (!navigator.mediaDevices || !window.MediaRecorder) {
1373
- el('div', 'err', '[voice] recording not supported in this browser');
1374
- return;
1375
- }
1376
- try {
1377
- recordStream = await navigator.mediaDevices.getUserMedia({ audio: true });
1378
- } catch (err) {
1379
- el('div', 'err', '[voice] microphone access denied or unavailable');
1380
- return;
1381
- }
1382
- const mimeType = pickAudioMime();
1383
- recordedChunks = [];
1384
- mediaRecorder = mimeType ? new MediaRecorder(recordStream, { mimeType }) : new MediaRecorder(recordStream);
1385
- mediaRecorder.addEventListener('dataavailable', (e) => { if (e.data && e.data.size > 0) recordedChunks.push(e.data); });
1386
- mediaRecorder.addEventListener('stop', () => { void finishRecording(); });
1387
- mediaRecorder.start();
1388
- if (recordBtnEl) { recordBtnEl.classList.add('recording'); recordBtnEl.textContent = '⏹'; recordBtnEl.title = 'Stop recording'; }
1389
- }
1390
-
1391
- function stopRecordingTracks() {
1392
- if (recordStream) { recordStream.getTracks().forEach((t) => t.stop()); recordStream = null; }
1393
- if (recordBtnEl) { recordBtnEl.classList.remove('recording'); recordBtnEl.textContent = '🎙'; recordBtnEl.title = 'Record audio — Lisa will transcribe + summarize it'; }
1394
- }
1395
-
1396
- async function finishRecording() {
1397
- const mime = (mediaRecorder && mediaRecorder.mimeType) || 'audio/webm';
1398
- stopRecordingTracks();
1399
- const blob = new Blob(recordedChunks, { type: mime });
1400
- recordedChunks = [];
1401
- if (blob.size === 0) return;
1402
- // Show a transient "transcribing…" line in the log.
1403
- const pending = el('div', 'thinking', '⋯ transcribing recording');
1404
- try {
1405
- const data = await blobToBase64(blob);
1406
- const res = await fetch('/api/voice/transcribe', {
1407
- method: 'POST',
1408
- headers: { 'content-type': 'application/json' },
1409
- body: JSON.stringify({ data, mediaType: mime }),
1410
- });
1411
- const out = await res.json();
1412
- if (pending) pending.remove();
1413
- if (!res.ok || out.error) {
1414
- el('div', 'err', '[voice] ' + (out.error || ('HTTP ' + res.status)));
1415
- return;
1416
- }
1417
- const transcript = (out.transcript || '').trim();
1418
- if (!transcript) { el('div', 'err', '[voice] (empty transcript)'); return; }
1419
- // Hand the transcript to Lisa with a summarize framing. send() handles the
1420
- // chat turn, persistence, and her response in her own voice.
1421
- const framed =
1422
- "I just recorded some audio. Here's the transcript — please give me a clear, " +
1423
- "useful summary (key points, decisions, action items if any), then I might ask follow-ups.\\n\\n" +
1424
- "--- transcript ---\\n" + transcript;
1425
- send(framed);
1426
- } catch (err) {
1427
- if (pending) pending.remove();
1428
- el('div', 'err', '[voice] ' + (err && err.message ? err.message : 'transcription failed'));
1429
- }
1430
- }
1431
-
1432
- function blobToBase64(blob) {
1433
- return new Promise((resolve, reject) => {
1434
- const reader = new FileReader();
1435
- reader.onload = () => resolve(String(reader.result).split(',')[1] || '');
1436
- reader.onerror = reject;
1437
- reader.readAsDataURL(blob);
1438
- });
1439
- }
1440
-
1441
- if (recordBtnEl) {
1442
- recordBtnEl.addEventListener('click', () => {
1443
- if (mediaRecorder && mediaRecorder.state === 'recording') {
1444
- mediaRecorder.stop();
1445
- } else {
1446
- void startRecording();
1447
- }
1448
- });
1449
- }
1450
-
1451
- const attachBtnEl = document.getElementById('attachBtn');
1452
- if (attachBtnEl) {
1453
- attachBtnEl.addEventListener('click', (ev) => {
1454
- // Don't preventDefault — that cancels the implicit label-forward
1455
- // and removes the redundant gesture path. Letting both fire is
1456
- // fine because <input type=file>.click() fires the picker only
1457
- // once per user gesture.
1458
- console.log('[attach] click forwarded to fileInput');
1459
- try {
1460
- fileInput.click();
1461
- } catch (err) {
1462
- console.error('[attach] fileInput.click failed:', err);
1463
- }
1464
- });
1465
- }
1466
-
1467
- // Paste-to-attach: when the user has copied an image (screenshot,
1468
- // image from a webpage, etc.) and presses ⌘V, pull the image off the
1469
- // clipboard and add it to pendingFiles — same path the file picker
1470
- // uses. Plain-text paste falls through to default behavior.
1471
- //
1472
- // We listen at the DOCUMENT level so paste works whether the textarea
1473
- // is focused, the chat log is focused, or focus is on a tool-block.
1474
- // (Some users press ⌘V right after launching the app, before clicking
1475
- // anywhere — element-scoped handlers miss that.)
1476
- //
1477
- // For text paste we MUST NOT preventDefault — let the browser route
1478
- // it to the focused element. Only intercept when we detect image
1479
- // items.
1480
- async function handlePastedClipboard(ev) {
1481
- const cb = ev.clipboardData;
1482
- if (!cb) return;
1483
-
1484
- // Two clipboard surfaces — items (modern, exposes pasteboard files)
1485
- // and files (older, doesn't include MIME type for some types). We
1486
- // dedupe via the underlying File reference.
1487
- const fileMap = new Map(); // File → mediaType (string)
1488
- if (cb.items && cb.items.length) {
1489
- for (const item of cb.items) {
1490
- if (item.kind !== 'file') continue;
1491
- if (!item.type || !item.type.startsWith('image/')) continue;
1492
- const f = item.getAsFile();
1493
- if (f) fileMap.set(f, item.type);
1494
- }
1495
- }
1496
- if (cb.files && cb.files.length) {
1497
- for (const f of cb.files) {
1498
- if (f.type && f.type.startsWith('image/')) {
1499
- if (!fileMap.has(f)) fileMap.set(f, f.type || 'image/png');
1500
- }
1501
- }
1502
- }
1503
-
1504
- if (fileMap.size === 0) return; // text paste — leave default behavior alone
1505
-
1506
- ev.preventDefault();
1507
- // Keep focus on the textarea so the user can keep typing right after.
1508
- try { input.focus(); } catch (_) {}
1509
-
1510
- for (const [file, mediaType] of fileMap) {
1511
- try {
1512
- const data = await readFileAsBase64(file);
1513
- const ext = (mediaType.split('/')[1] || 'png').replace(/[^a-z0-9]/gi, '');
1514
- const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
1515
- const name = file.name && file.name !== 'image.png'
1516
- ? file.name
1517
- : 'pasted-' + ts + '.' + ext;
1518
- pendingFiles.push({ name, mediaType, data });
1519
- } catch (err) {
1520
- console.warn('[paste] failed to read image:', err);
1521
- }
1522
- }
1523
- renderAttachPreview();
1524
- }
1525
-
1526
- input.addEventListener('paste', (ev) => { void handlePastedClipboard(ev); });
1527
- // Document-level fallback. If focus is somewhere other than the
1528
- // textarea (e.g. just-launched, no focus yet), the textarea-level
1529
- // paste listener never fires; this one catches it.
1530
- document.addEventListener('paste', (ev) => {
1531
- // Avoid double-firing when the textarea ALREADY handled it: if
1532
- // ev.defaultPrevented is set, the textarea listener already
1533
- // consumed the paste and added the file.
1534
- if (ev.defaultPrevented) return;
1535
- void handlePastedClipboard(ev);
1536
- });
1537
-
1538
- // Surface session id from server header on first request. The titlebar
1539
- // shows the same id with a leading "·" separator after the "Lisa" label.
1540
- fetch('/session').then(r => r.json()).then(s => {
1541
- sessionEl.textContent = s.id;
1542
- const titlebarSession = document.getElementById('titlebarSession');
1543
- if (titlebarSession) titlebarSession.textContent = '· ' + s.id;
1544
- });
1545
-
1546
- // ── Persistent /events SSE: mood updates + idle messages + Claude
1547
- // activity, lifetime of page.
1548
- function connectEvents() {
1549
- const es = new EventSource('/events');
1550
- let idlePulseEl = null;
1551
- es.addEventListener('message', (e) => {
1552
- const ev = JSON.parse(e.data);
1553
- if (ev.type === 'mood') {
1554
- setMood(ev.slug);
1555
- } else if (ev.type === 'idle_start') {
1556
- if (!idlePulseEl) {
1557
- idlePulseEl = document.createElement('div');
1558
- idlePulseEl.className = 'idle-pulse';
1559
- idlePulseEl.textContent = '⋯ Lisa is thinking on her own time ⋯';
1560
- log.appendChild(idlePulseEl);
1561
- log.scrollTop = log.scrollHeight;
1562
- }
1563
- } else if (ev.type === 'idle_message') {
1564
- if (idlePulseEl) { idlePulseEl.remove(); idlePulseEl = null; }
1565
- const block = document.createElement('div');
1566
- block.className = 'idle-block';
1567
- const head = document.createElement('div');
1568
- head.className = 'idle-head';
1569
- head.textContent = '★ WHILE YOU WERE AWAY';
1570
- const time = document.createElement('span');
1571
- time.className = 'idle-time';
1572
- try { time.textContent = new Date(ev.at).toLocaleTimeString(); } catch {}
1573
- head.appendChild(time);
1574
- block.appendChild(head);
1575
- const bodyEl = document.createElement('div');
1576
- bodyEl.textContent = ev.text;
1577
- block.appendChild(bodyEl);
1578
- log.appendChild(block);
1579
- log.scrollTop = log.scrollHeight;
1580
- // sidebar reflection card mirrors the latest while-you-were-away
1581
- if (typeof updateReflection === 'function') updateReflection(ev.text);
1582
- } else if (ev.type === 'idle_done') {
1583
- if (idlePulseEl) { idlePulseEl.remove(); idlePulseEl = null; }
1584
- } else if (ev.type === 'idle_error') {
1585
- if (idlePulseEl) { idlePulseEl.remove(); idlePulseEl = null; }
1586
- const e2 = document.createElement('div');
1587
- e2.className = 'err';
1588
- e2.textContent = '[idle error] ' + ev.message;
1589
- log.appendChild(e2);
1590
- } else if (ev.type === 'claude_session_update') {
1591
- // Sidebar Claude monitor card refresh — defined later in the
1592
- // "sidebar live wiring" block.
1593
- if (typeof refreshClaudeSessions === 'function') refreshClaudeSessions();
1594
- }
1595
- });
1596
- es.onerror = () => {
1597
- es.close();
1598
- setTimeout(connectEvents, 3000); // reconnect
1599
- };
1600
- }
1601
- connectEvents();
1602
-
1603
- // ── API key config gate: show overlay if no key is configured ─────
1604
- const cfgOverlay = document.getElementById('cfgOverlay');
1605
- const cfgForm = document.getElementById('cfgForm');
1606
- const cfgAnthropic = document.getElementById('cfgAnthropic');
1607
- const cfgOpenai = document.getElementById('cfgOpenai');
1608
- const cfgSaveBtn = document.getElementById('cfgSave');
1609
- const cfgError = document.getElementById('cfgError');
1610
-
1611
- cfgForm.addEventListener('submit', async (ev) => {
1612
- ev.preventDefault();
1613
- cfgError.textContent = '';
1614
- const anthropic = cfgAnthropic.value.trim();
1615
- const openai = cfgOpenai.value.trim();
1616
- if (!anthropic) {
1617
- cfgError.textContent = 'ANTHROPIC_API_KEY is required.';
1618
- return;
1619
- }
1620
- cfgSaveBtn.disabled = true;
1621
- try {
1622
- const res = await fetch('/api/config/save', {
1623
- method: 'POST',
1624
- headers: {'content-type': 'application/json'},
1625
- body: JSON.stringify({ anthropicKey: anthropic, openaiKey: openai || undefined }),
1626
- });
1627
- if (!res.ok) {
1628
- const txt = await res.text().catch(() => '');
1629
- cfgError.textContent = 'Save failed: HTTP ' + res.status + (txt ? ' — ' + txt.slice(0, 120) : '');
1630
- cfgSaveBtn.disabled = false;
1631
- return;
1632
- }
1633
- cfgAnthropic.value = '';
1634
- cfgOpenai.value = '';
1635
- cfgOverlay.classList.remove('open');
1636
- maybeBirth();
1637
- } catch (err) {
1638
- cfgError.textContent = 'Save failed: ' + err.message;
1639
- cfgSaveBtn.disabled = false;
1640
- }
1641
- });
1642
-
1643
- // ── Birth ritual: show overlay if Lisa hasn't been born yet ───────
1644
- const birthOverlay = document.getElementById('birthOverlay');
1645
- const birthStepsEl = document.getElementById('birthSteps');
1646
- const birthFinalEl = document.getElementById('birthFinal');
1647
- const birthEnterBtn = document.getElementById('birthEnter');
1648
- const birthErrorEl = document.getElementById('birthError');
1649
-
1650
- birthEnterBtn.addEventListener('click', () => {
1651
- birthOverlay.classList.remove('open');
1652
- setTimeout(() => location.reload(), 300);
1653
- });
1654
-
1655
- async function maybeBirth() {
1656
- const status = await fetch('/api/soul').then(r => r.json());
1657
- if (status.born) return;
1658
- birthOverlay.classList.add('open');
1659
- startBirthStream();
1660
- }
1661
-
1662
- function appendBirthStep(step) {
1663
- const prevActive = birthStepsEl.querySelector('.birth-step.active');
1664
- if (prevActive) {
1665
- prevActive.classList.remove('active');
1666
- prevActive.classList.add('done');
1667
- }
1668
- const div = document.createElement('div');
1669
- div.className = 'birth-step active';
1670
- const name = document.createElement('div');
1671
- name.className = 'step-name';
1672
- name.textContent = step;
1673
- div.appendChild(name);
1674
- const detail = document.createElement('div');
1675
- detail.className = 'step-detail';
1676
- const cursor = document.createElement('span');
1677
- cursor.className = 'step-cursor';
1678
- detail.appendChild(cursor);
1679
- div.appendChild(detail);
1680
- birthStepsEl.appendChild(div);
1681
- setTimeout(() => div.classList.add('shown'), 50);
1682
- return detail;
1683
- }
1684
-
1685
- function typewriter(el, text, done) {
1686
- const cursor = el.querySelector('.step-cursor');
1687
- if (cursor) cursor.remove();
1688
- let i = 0;
1689
- const speed = Math.max(8, Math.min(28, 600 / text.length));
1690
- function tick() {
1691
- if (i >= text.length) {
1692
- const c = document.createElement('span');
1693
- c.className = 'step-cursor';
1694
- el.appendChild(c);
1695
- done && done();
1696
- return;
1697
- }
1698
- el.appendChild(document.createTextNode(text[i]));
1699
- i++;
1700
- el.parentElement.parentElement.scrollTop = el.parentElement.parentElement.scrollHeight;
1701
- setTimeout(tick, speed);
1702
- }
1703
- tick();
1704
- }
1705
-
1706
- async function startBirthStream() {
1707
- birthErrorEl.textContent = '';
1708
- let currentDetail = null;
1709
- let queue = [];
1710
- let processing = false;
1711
-
1712
- function processQueue() {
1713
- if (processing) return;
1714
- if (queue.length === 0) return;
1715
- processing = true;
1716
- const ev = queue.shift();
1717
- if (ev.kind === 'step') {
1718
- currentDetail = appendBirthStep(ev.name);
1719
- typewriter(currentDetail, ev.detail || '', () => {
1720
- processing = false;
1721
- processQueue();
1722
- });
1723
- } else if (ev.kind === 'done') {
1724
- const last = birthStepsEl.querySelector('.birth-step.active');
1725
- if (last) { last.classList.remove('active'); last.classList.add('done'); }
1726
- birthFinalEl.textContent = ev.message;
1727
- birthFinalEl.classList.add('shown');
1728
- birthEnterBtn.classList.add('shown');
1729
- processing = false;
1730
- } else if (ev.kind === 'error') {
1731
- birthErrorEl.textContent = ev.message;
1732
- processing = false;
1733
- }
1734
- }
1735
-
1736
- try {
1737
- const res = await fetch('/api/birth', { method: 'POST' });
1738
- if (!res.ok) {
1739
- birthErrorEl.textContent = 'Birth failed: HTTP ' + res.status + '. Check ANTHROPIC_API_KEY.';
1740
- return;
1741
- }
1742
- const reader = res.body.getReader();
1743
- const decoder = new TextDecoder();
1744
- let buf = '';
1745
- while (true) {
1746
- const { value, done } = await reader.read();
1747
- if (done) break;
1748
- buf += decoder.decode(value, { stream: true });
1749
- let idx;
1750
- while ((idx = buf.indexOf('\\n\\n')) >= 0) {
1751
- const event = buf.slice(0, idx);
1752
- buf = buf.slice(idx + 2);
1753
- const m = event.match(/^data: (.*)$/m);
1754
- if (!m) continue;
1755
- const ev = JSON.parse(m[1]);
1756
- queue.push(ev);
1757
- processQueue();
1758
- }
1759
- }
1760
- } catch (err) {
1761
- birthErrorEl.textContent = 'Birth failed: ' + err.message;
1762
- }
1763
- }
1764
-
1765
- async function startupGate() {
1766
- let cfg;
1767
- try {
1768
- cfg = await fetch('/api/config/status').then(r => r.json());
1769
- } catch {
1770
- return;
1771
- }
1772
- if (!cfg.configured) {
1773
- cfgOverlay.classList.add('open');
1774
- setTimeout(() => cfgAnthropic.focus(), 50);
1775
- return;
1776
- }
1777
- maybeBirth();
1778
- }
1779
- startupGate();
1780
-
1781
- // ── history load & infinite-scroll ──────────────────────────────────
1782
- let historyPage = 0;
1783
- let historyLoading = false;
1784
- let historyExhausted = false;
1785
-
1786
- function textOfMessage(msg) {
1787
- if (typeof msg.content === 'string') return msg.content.trim();
1788
- if (!Array.isArray(msg.content)) return '';
1789
- return msg.content
1790
- .filter(b => b.type === 'text')
1791
- .map(b => b.text)
1792
- .join('')
1793
- .trim();
1794
- }
1795
-
1796
- function prependHistoryMessages(messages) {
1797
- const fragment = document.createDocumentFragment();
1798
- for (const msg of messages) {
1799
- const text = textOfMessage(msg);
1800
- if (!text) continue;
1801
- const roleDiv = document.createElement('div');
1802
- roleDiv.className = 'role ' + (msg.role === 'user' ? 'you' : 'lisa');
1803
- roleDiv.textContent = msg.role === 'user' ? 'YOU' : 'LISA';
1804
- const span = document.createElement('span');
1805
- span.className = 'msg';
1806
- span.textContent = text;
1807
- fragment.appendChild(roleDiv);
1808
- fragment.appendChild(span);
1809
- }
1810
- log.insertBefore(fragment, log.firstChild);
1811
- }
1812
-
1813
- async function loadHistoryPage() {
1814
- if (historyLoading || historyExhausted) return;
1815
- historyLoading = true;
1816
- const prevScrollHeight = log.scrollHeight;
1817
- try {
1818
- const res = await fetch('/api/history?page=' + historyPage);
1819
- const data = await res.json();
1820
- if (data.messages && data.messages.length) {
1821
- prependHistoryMessages(data.messages);
1822
- log.scrollTop = log.scrollHeight - prevScrollHeight;
1823
- historyPage++;
1824
- }
1825
- if (!data.hasMore) {
1826
- historyExhausted = true;
1827
- if (historyPage > 1) {
1828
- const marker = document.createElement('div');
1829
- marker.style.cssText = 'text-align:center;color:var(--fg-3);font-size:11px;padding:8px 0;letter-spacing:0.06em;';
1830
- marker.textContent = '— end of history —';
1831
- log.insertBefore(marker, log.firstChild);
1832
- }
1833
- }
1834
- } finally {
1835
- historyLoading = false;
1836
- }
1837
- }
1838
-
1839
- loadHistoryPage();
1840
- log.addEventListener('scroll', () => {
1841
- if (log.scrollTop < 80) loadHistoryPage();
1842
- });
1843
-
1844
- // ── mascot crossfade on mood event ──────────────────────────────────
1845
- const mascotEl = document.getElementById('mascot');
1846
- const mascotTagEl = document.getElementById('mascotTag');
1847
- let currentMood = 'neutral';
1848
- function setMood(slug) {
1849
- if (!slug || slug === currentMood) return;
1850
- const url = '/assets/lisa/' + encodeURIComponent(slug) + '.png';
1851
- const probe = new Image();
1852
- probe.onload = () => {
1853
- mascotEl.classList.add('fading');
1854
- setTimeout(() => {
1855
- mascotEl.src = url;
1856
- mascotTagEl.textContent = 'mood: ' + slug;
1857
- mascotEl.classList.remove('fading');
1858
- currentMood = slug;
1859
- }, 250);
1860
- };
1861
- probe.onerror = () => { /* asset not generated yet — keep current */ };
1862
- probe.src = url;
1863
- }
1864
-
1865
- // ── modal panel: SOUL / SKILLS / MEMORY / TOOLS ──────────────────────
1866
- const modalBg = document.getElementById('modalBg');
1867
- const modalTitle = document.getElementById('modalTitle');
1868
- const modalBody = document.getElementById('modalBody');
1869
- const modalClose = document.getElementById('modalClose');
1870
-
1871
- function escapeHtml(s) {
1872
- return String(s).replace(/[&<>"]/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]));
1873
- }
1874
- function openModal(title, html) {
1875
- modalTitle.textContent = title;
1876
- modalBody.innerHTML = html;
1877
- modalBg.classList.add('open');
1878
- }
1879
- function closeModal() { modalBg.classList.remove('open'); }
1880
- modalClose.addEventListener('click', closeModal);
1881
- modalBg.addEventListener('click', (e) => { if (e.target === modalBg) closeModal(); });
1882
- document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeModal(); });
1883
-
1884
- async function showSkills() {
1885
- openModal('SKILLS', '<div class="empty">loading…</div>');
1886
- const data = await fetch('/api/skills').then(r => r.json());
1887
- if (!data.skills.length) {
1888
- modalBody.innerHTML = '<div class="empty">No skills saved yet. Lisa will start saving useful workflows as you use her.</div>';
1889
- return;
1890
- }
1891
- modalBody.innerHTML = data.skills.map(s =>
1892
- '<div class="item"><div class="name">' + escapeHtml(s.name) + '</div><div class="desc">' + escapeHtml(s.description) + '</div></div>'
1893
- ).join('');
1894
- }
1895
-
1896
- async function showMemory() {
1897
- openModal('MEMORY', '<div class="empty">loading…</div>');
1898
- const data = await fetch('/api/memory').then(r => r.json());
1899
- modalBody.innerHTML =
1900
- '<h3>USER.md — what Lisa remembers about you</h3>' +
1901
- '<pre>' + escapeHtml(data.user || '(empty)') + '</pre>' +
1902
- '<h3>MEMORY.md — Lisa\\'s working notes</h3>' +
1903
- '<pre>' + escapeHtml(data.memory || '(empty)') + '</pre>';
1904
- }
1905
-
1906
- async function showTools() {
1907
- openModal('TOOLS', '<div class="empty">loading…</div>');
1908
- const data = await fetch('/api/tools').then(r => r.json());
1909
- modalBody.innerHTML = data.tools.map(t =>
1910
- '<div class="item"><div class="name">' + escapeHtml(t.name) + '</div><div class="desc">' + escapeHtml(t.description) + '</div></div>'
1911
- ).join('');
1912
- }
1913
-
1914
- async function showSoul() {
1915
- openModal('★ SOUL', '<div class="empty">loading…</div>');
1916
- const data = await fetch('/api/soul').then(r => r.json());
1917
- if (!data.born) {
1918
- modalBody.innerHTML = '<div class="empty">Lisa hasn\\'t been born yet. Restart the CLI without --no-birth and the birth ritual will run.</div>';
1919
- return;
1920
- }
1921
- const s = data.summary;
1922
- let html = '';
1923
- html += '<h3>name</h3><div>' + escapeHtml(s.name) + '</div>';
1924
- html += '<h3>born</h3><div>' + escapeHtml(s.seed.bornAt) + ' · big5(O' + Math.round(s.seed.bigFive.openness*100) + ' C' + Math.round(s.seed.bigFive.conscientiousness*100) + ' E' + Math.round(s.seed.bigFive.extraversion*100) + ' A' + Math.round(s.seed.bigFive.agreeableness*100) + ' N' + Math.round(s.seed.bigFive.neuroticism*100) + ')</div>';
1925
- html += '<h3>identity</h3><pre>' + escapeHtml(s.identity) + '</pre>';
1926
- html += '<h3>purpose</h3><pre>' + escapeHtml(s.purpose) + '</pre>';
1927
- html += '<h3>constitution</h3><pre>' + escapeHtml(s.constitution) + '</pre>';
1928
- if (s.values?.length) {
1929
- html += '<h3>values</h3>' + s.values.map(v =>
1930
- '<div class="item"><div class="name">' + escapeHtml(v.title) + '</div><div class="desc">' + escapeHtml(v.body) + '</div></div>'
1931
- ).join('');
1932
- }
1933
- if (s.opinions?.length) {
1934
- html += '<h3>opinions</h3>' + s.opinions.map(o =>
1935
- '<div class="item"><div class="name">' + escapeHtml(o.stance) + ' (conf ' + o.confidence.toFixed(2) + ')</div></div>'
1936
- ).join('');
1937
- }
1938
- if (s.desires?.length) {
1939
- html += '<h3>desires</h3>' + s.desires.map(d =>
1940
- '<div class="item"><div class="name">' + escapeHtml(d.what) + (d.actionable ? ' [heartbeat-active]' : '') + '</div><div class="desc">' + escapeHtml(d.why) + '</div></div>'
1941
- ).join('');
1942
- }
1943
- html += '<h3>emotions</h3>' + Object.entries(s.emotions.values).map(([k, v]) => {
1944
- const len = 12;
1945
- const filled = Math.round(Math.abs(v) * len);
1946
- const bar = '█'.repeat(filled) + '░'.repeat(len - filled);
1947
- return '<div class="item"><div class="name">' + escapeHtml(k) + '</div><div class="desc">' + (v < 0 ? '-' : ' ') + bar + ' ' + v.toFixed(2) + '</div></div>';
1948
- }).join('');
1949
- if (s.tampered?.length) {
1950
- html += '<h3>⚠ tampered</h3><div>External edits detected on: ' + s.tampered.map(escapeHtml).join(', ') + '</div>';
1951
- }
1952
- html += '<h3 style="color: var(--fg-3); font-size: 10px;">privacy note</h3><div class="empty">Her journal lives at ~/.lisa/soul/journal/ but is intentionally not shown here — that is hers to keep.</div>';
1953
- modalBody.innerHTML = html;
1954
- }
1955
-
1956
- document.querySelectorAll('.badge').forEach(b => {
1957
- b.addEventListener('click', () => {
1958
- const which = b.dataset.panel;
1959
- if (which === 'soul') showSoul();
1960
- else if (which === 'skills') showSkills();
1961
- else if (which === 'memory') showMemory();
1962
- else if (which === 'tools') showTools();
1963
- });
1964
- });
1965
-
1966
- let currentLisaSpan = null;
1967
- let pendingTools = new Map();
1968
- let thinkingEl = null;
1969
-
1970
- function el(tag, cls, text) {
1971
- const node = document.createElement(tag);
1972
- if (cls) node.className = cls;
1973
- if (text != null) node.textContent = text;
1974
- log.appendChild(node);
1975
- log.scrollTop = log.scrollHeight;
1976
- return node;
1977
- }
1978
-
1979
- function ensureLisaSpan() {
1980
- if (currentLisaSpan) return currentLisaSpan;
1981
- if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
1982
- el('div', 'role lisa', 'LISA');
1983
- currentLisaSpan = el('span', 'msg', '');
1984
- return currentLisaSpan;
1985
- }
1986
-
1987
- function previewInput(name, input) {
1988
- if (!input || typeof input !== 'object') return '';
1989
- const order = ['command', 'pattern', 'query', 'path', 'description', 'audio_path', 'text', 'name', 'action', 'entry'];
1990
- for (const k of order) {
1991
- if (typeof input[k] === 'string' && input[k]) {
1992
- let v = input[k].replace(/\\s+/g, ' ').trim();
1993
- if (v.length > 120) v = v.slice(0, 117) + '...';
1994
- return v;
1995
- }
1996
- }
1997
- try {
1998
- const s = JSON.stringify(input);
1999
- return s.length > 120 ? s.slice(0, 117) + '...' : s;
2000
- } catch { return ''; }
2001
- }
2002
-
2003
- async function send(message) {
2004
- input.value = '';
2005
- input.style.height = 'auto';
2006
- sendBtn.disabled = true;
2007
- el('div', 'role you', 'YOU');
2008
- el('span', 'msg', message || '(attachment)');
2009
- if (pendingFiles.length) {
2010
- const names = pendingFiles.map(f => f.name).join(', ');
2011
- el('span', 'msg attach-label', '📎 ' + names);
2012
- }
2013
- const filesToSend = [...pendingFiles];
2014
- pendingFiles = [];
2015
- renderAttachPreview();
2016
- currentLisaSpan = null;
2017
- pendingTools.clear();
2018
- thinkingEl = el('div', 'thinking', '⋯ thinking');
2019
- try {
2020
- const res = await fetch('/chat', {
2021
- method: 'POST',
2022
- headers: {'content-type': 'application/json'},
2023
- body: JSON.stringify({message, files: filesToSend}),
2024
- });
2025
- const reader = res.body.getReader();
2026
- const decoder = new TextDecoder();
2027
- let buf = '';
2028
- while (true) {
2029
- const {value, done} = await reader.read();
2030
- if (done) break;
2031
- buf += decoder.decode(value, {stream: true});
2032
- let idx;
2033
- while ((idx = buf.indexOf('\\n\\n')) >= 0) {
2034
- const evRaw = buf.slice(0, idx);
2035
- buf = buf.slice(idx + 2);
2036
- const m = evRaw.match(/^data: (.*)$/m);
2037
- if (!m) continue;
2038
- const ev = JSON.parse(m[1]);
2039
- if (ev.type === 'text') {
2040
- ensureLisaSpan().textContent += ev.text;
2041
- } else if (ev.type === 'tool_start') {
2042
- if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
2043
- currentLisaSpan = null;
2044
- const block = el('div', 'tool-block', null);
2045
- const head = document.createElement('div');
2046
- head.className = 'tool-head';
2047
- head.innerHTML = '<span class="tool-icon">⚙</span> <span class="tool-name"></span> <span class="tool-spinner">...</span>';
2048
- head.querySelector('.tool-name').textContent = ev.name;
2049
- block.appendChild(head);
2050
- const preview = previewInput(ev.name, ev.input);
2051
- if (preview) {
2052
- const p = document.createElement('div');
2053
- p.className = 'tool-input';
2054
- p.textContent = preview;
2055
- block.appendChild(p);
2056
- }
2057
- pendingTools.set(ev.name, block);
2058
- } else if (ev.type === 'tool_end') {
2059
- const block = pendingTools.get(ev.name);
2060
- if (block) {
2061
- const spinner = block.querySelector('.tool-spinner');
2062
- if (spinner) spinner.textContent = ev.isError ? '✗' : '✓';
2063
- if (ev.isError) block.classList.add('tool-error');
2064
- if (ev.resultPreview) {
2065
- const r = document.createElement('div');
2066
- r.className = 'tool-result';
2067
- r.textContent = ev.resultPreview;
2068
- block.appendChild(r);
2069
- }
2070
- pendingTools.delete(ev.name);
2071
- }
2072
- } else if (ev.type === 'mood') {
2073
- setMood(ev.slug);
2074
- } else if (ev.type === 'error') {
2075
- el('div', 'err', '[error] ' + ev.message);
2076
- } else if (ev.type === 'done') {
2077
- if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
2078
- }
2079
- }
2080
- }
2081
- if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
2082
- } catch (err) {
2083
- if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
2084
- el('div', 'err', '[error] ' + err.message);
2085
- } finally {
2086
- sendBtn.disabled = false;
2087
- input.focus();
2088
- }
2089
- }
2090
-
2091
- form.addEventListener('submit', (ev) => {
2092
- ev.preventDefault();
2093
- const msg = input.value.trim();
2094
- if (msg || pendingFiles.length) send(msg);
2095
- });
2096
-
2097
- input.addEventListener('keydown', (ev) => {
2098
- if (ev.key === 'Enter' && !ev.shiftKey) {
2099
- ev.preventDefault();
2100
- form.dispatchEvent(new Event('submit'));
2101
- }
2102
- });
2103
- input.addEventListener('input', () => {
2104
- input.style.height = 'auto';
2105
- input.style.height = Math.min(input.scrollHeight, 200) + 'px';
2106
- });
2107
-
2108
- // ── PWA: register service worker + iOS install hint ─────────────────
2109
- if ('serviceWorker' in navigator) {
2110
- navigator.serviceWorker.register('/sw.js').catch(err => {
2111
- console.warn('[pwa] sw register failed:', err);
2112
- });
2113
- }
2114
- (function() {
2115
- const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
2116
- const isStandalone = window.matchMedia('(display-mode: standalone)').matches
2117
- || (window.navigator).standalone === true;
2118
- if (!isiOS || isStandalone) return;
2119
- if (localStorage.getItem('lisa.pwa.dismissed') === '1') return;
2120
- setTimeout(() => {
2121
- const banner = document.createElement('div');
2122
- banner.style.cssText = 'position:fixed;bottom:8px;left:8px;right:8px;background:var(--bg-card-strong);border:1px solid var(--border-strong);border-radius:12px;padding:10px 12px;color:var(--fg);font-size:12px;z-index:9999;display:flex;gap:8px;align-items:center;';
2123
- banner.innerHTML = '✦ Add Lisa to Home Screen: Share button → "Add to Home Screen"';
2124
- const dismiss = document.createElement('button');
2125
- dismiss.textContent = '✕';
2126
- dismiss.style.cssText = 'background:transparent;border:none;color:var(--fg-2);cursor:pointer;font-size:14px;margin-left:auto;';
2127
- dismiss.onclick = () => {
2128
- localStorage.setItem('lisa.pwa.dismissed', '1');
2129
- banner.remove();
2130
- };
2131
- banner.appendChild(dismiss);
2132
- document.body.appendChild(banner);
2133
- }, 5000);
2134
- })();
2135
-
2136
- // ════════════════════════════════════════════════════════════════════
2137
- // ── Sidebar live wiring ─────────────────────────────────────────────
2138
- //
2139
- // Populates the new sidebar blocks introduced by the redesign:
2140
- // - identity card sub-line (born YYYY-MM-DD · NN days)
2141
- // - "currently wanting" paragraph (top actionable desire)
2142
- // - Claude Code monitor card (active sessions)
2143
- // - "last reflection" mini-card (most recent ★ idle message)
2144
- // Wires to /api/island/ping + /api/claude/sessions + /api/soul, and
2145
- // piggy-backs on the connectEvents() SSE listener above for live
2146
- // claude_session_update + idle_message refreshes.
2147
- // ════════════════════════════════════════════════════════════════════
2148
- (function setupSidebarLive() {
2149
- const sbDesire = document.getElementById('sbDesire');
2150
- const sbClaudeCount = document.getElementById('sbClaudeCount');
2151
- const sbClaudeRows = document.getElementById('sbClaudeRows');
2152
- const sbReflection = document.getElementById('sbReflection');
2153
- const sbReflectionBody = document.getElementById('sbReflectionBody');
2154
- const sbSessionBadge = document.getElementById('sbSessionBadge');
2155
- const identitySub = document.getElementById('identitySub');
2156
-
2157
- // Active session window matches the watcher's ACTIVE_WINDOW_MS.
2158
- const ACTIVE_WINDOW_MS = 30 * 60 * 1000;
2159
-
2160
- function relativeTime(iso) {
2161
- const ms = Date.now() - new Date(iso).getTime();
2162
- if (ms < 30_000) return 'just now';
2163
- if (ms < 60_000) return Math.round(ms / 1000) + 's';
2164
- if (ms < 3600_000) return Math.round(ms / 60_000) + 'm';
2165
- return Math.round(ms / 3600_000) + 'h';
2166
- }
2167
-
2168
- function setDesire(text) {
2169
- sbDesire.textContent = text || '(nothing actively pursued)';
2170
- }
2171
-
2172
- window.updateReflection = function (text) {
2173
- if (!text) { sbReflection.style.display = 'none'; return; }
2174
- sbReflection.style.display = '';
2175
- sbReflectionBody.textContent = '"' + text.replace(/^["“”]+|["“”]+$/g, '').trim() + '"';
2176
- };
2177
-
2178
- function setClaudeSessions(sessions) {
2179
- const cutoff = Date.now() - ACTIVE_WINDOW_MS;
2180
- const recent = sessions.filter(s => new Date(s.lastMtime).getTime() >= cutoff);
2181
- sbClaudeCount.textContent = String(recent.length);
2182
- // sort: errors first, then waiting, then working, then by mtime
2183
- const rank = { error: 0, waiting: 1, working: 2, unknown: 3 };
2184
- const rows = recent.slice().sort((a, b) => {
2185
- const ra = rank[a.state] ?? 9;
2186
- const rb = rank[b.state] ?? 9;
2187
- if (ra !== rb) return ra - rb;
2188
- return new Date(b.lastMtime).getTime() - new Date(a.lastMtime).getTime();
2189
- }).slice(0, 5);
2190
- while (sbClaudeRows.firstChild) sbClaudeRows.removeChild(sbClaudeRows.firstChild);
2191
- if (rows.length === 0) {
2192
- const empty = document.createElement('div');
2193
- empty.className = 'session-empty';
2194
- empty.textContent = '(idle)';
2195
- sbClaudeRows.appendChild(empty);
2196
- return;
2197
- }
2198
- for (const s of rows) {
2199
- const row = document.createElement('div');
2200
- row.className = 'session-row';
2201
- const pip = document.createElement('div');
2202
- pip.className = 'pip ' + (s.state || 'unknown');
2203
- const name = document.createElement('div');
2204
- name.className = 'name';
2205
- name.textContent = s.project;
2206
- const when = document.createElement('div');
2207
- when.className = 'when';
2208
- when.textContent = relativeTime(s.lastMtime);
2209
- row.appendChild(pip);
2210
- row.appendChild(name);
2211
- row.appendChild(when);
2212
- row.title = (s.stateReason ? s.state + ' · ' + s.stateReason : s.state) + ' · ' + s.sessionId;
2213
- sbClaudeRows.appendChild(row);
2214
- }
2215
- }
2216
-
2217
- async function refreshPing() {
2218
- try {
2219
- const r = await fetch('/api/island/ping');
2220
- if (!r.ok) return;
2221
- const data = await r.json();
2222
- setDesire(data.current_desire);
2223
- if (data.last_idle_message_text) {
2224
- window.updateReflection(data.last_idle_message_text);
2225
- }
2226
- } catch {}
2227
- }
2228
-
2229
- // Exposed so the SSE handler above can call this on
2230
- // claude_session_update events without redeclaring the helper.
2231
- window.refreshClaudeSessions = async function () {
2232
- try {
2233
- const r = await fetch('/api/claude/sessions');
2234
- if (!r.ok) return;
2235
- const data = await r.json();
2236
- setClaudeSessions(data.sessions || []);
2237
- } catch {}
2238
- };
2239
-
2240
- async function refreshIdentity() {
2241
- try {
2242
- const r = await fetch('/api/soul');
2243
- if (!r.ok) return;
2244
- const data = await r.json();
2245
- if (!data.born) return;
2246
- const bornAt = data.summary?.seed?.bornAt;
2247
- if (!bornAt) return;
2248
- const born = new Date(bornAt);
2249
- if (Number.isNaN(born.getTime())) return;
2250
- const days = Math.max(0, Math.floor((Date.now() - born.getTime()) / 86400000));
2251
- const ymd = born.toISOString().slice(0, 10);
2252
- identitySub.textContent = 'born ' + ymd + ' · ' + days + ' day' + (days === 1 ? '' : 's');
2253
- } catch {}
2254
- }
2255
-
2256
- async function refreshSessionsBadge() {
2257
- try {
2258
- const r = await fetch('/api/sessions');
2259
- if (!r.ok) return;
2260
- const data = await r.json();
2261
- const n = Array.isArray(data.sessions) ? data.sessions.length : 0;
2262
- sbSessionBadge.textContent = String(n);
2263
- } catch {
2264
- // /api/sessions is optional — leave the badge as-is on failure
2265
- }
2266
- }
2267
-
2268
- // Bootstrap + periodic resync. SSE handles the fast-path updates;
2269
- // these timers are belt-and-braces in case the stream silently dies.
2270
- refreshPing();
2271
- window.refreshClaudeSessions();
2272
- refreshIdentity();
2273
- refreshSessionsBadge();
2274
- setInterval(refreshPing, 30_000);
2275
- setInterval(window.refreshClaudeSessions, 60_000);
2276
- setInterval(refreshSessionsBadge, 5 * 60_000);
2277
- })();
202
+ ${MAIN_CLIENT_JS}
2278
203
  </script>
2279
204
  </body></html>`;
2280
205
  //# sourceMappingURL=lisa-html.js.map