@temmo/cli 0.0.0-stage → 0.19.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 (445) hide show
  1. package/.claude-plugin/marketplace.json +14 -0
  2. package/.claude-plugin/plugin.json +16 -0
  3. package/.codex-plugin/plugin.json +30 -0
  4. package/.cursor-plugin/plugin.json +22 -0
  5. package/.mcp.json +18 -0
  6. package/LICENSE +202 -0
  7. package/README.md +82 -2
  8. package/THIRD_PARTY_NOTICES +32 -0
  9. package/commands/afk.md +17 -0
  10. package/deploy/build-ui.mjs +65 -0
  11. package/deploy/claude/README.md +16 -0
  12. package/deploy/claude/auto-mode.json +31 -0
  13. package/deploy/postgres/compose.yaml +26 -0
  14. package/deploy/temmo-runner.service +24 -0
  15. package/deploy/verify-ui.mjs +15 -0
  16. package/harness-core/README.md +27 -0
  17. package/harness-core/bin/harness.mjs +17 -0
  18. package/harness-core/package.json +10 -0
  19. package/harness-core/stage.mjs +108 -0
  20. package/harness-core/stages/commit.md +7 -0
  21. package/harness-core/stages/pr.md +7 -0
  22. package/harness-core/stages/push.md +7 -0
  23. package/hooks/codex-hooks.json +14 -0
  24. package/hooks/cursor-hooks.json +17 -0
  25. package/hooks/hooks.json +27 -0
  26. package/lib/acp/permission.js +72 -0
  27. package/lib/acp/sessionConfig.js +109 -0
  28. package/lib/activity.js +244 -0
  29. package/lib/agent-guard.js +72 -0
  30. package/lib/agents-route.js +55 -0
  31. package/lib/agents.js +213 -0
  32. package/lib/agui.js +255 -0
  33. package/lib/alerts.js +36 -0
  34. package/lib/analyze-otlp.js +46 -0
  35. package/lib/analyze-run-code.js +397 -0
  36. package/lib/analyze-sources.js +372 -0
  37. package/lib/approval-card.js +54 -0
  38. package/lib/approval-cli.js +53 -0
  39. package/lib/approval-request.js +81 -0
  40. package/lib/approval-signer.js +48 -0
  41. package/lib/approvals.js +295 -0
  42. package/lib/attachment-cache.js +236 -0
  43. package/lib/attachment.js +63 -0
  44. package/lib/blocked.js +20 -0
  45. package/lib/build-review.js +90 -0
  46. package/lib/builder/cli.js +90 -0
  47. package/lib/builder/policy.js +176 -0
  48. package/lib/builder/recover.js +189 -0
  49. package/lib/builder/run.js +240 -0
  50. package/lib/builder/settle.js +198 -0
  51. package/lib/builder/stage.js +240 -0
  52. package/lib/builder/state.js +73 -0
  53. package/lib/builder/supervisor.js +289 -0
  54. package/lib/builder-clean.js +223 -0
  55. package/lib/builder-code.cjs +67 -0
  56. package/lib/builder.js +9 -0
  57. package/lib/bus-postgres.js +281 -0
  58. package/lib/bus.js +349 -0
  59. package/lib/catalog/author.js +278 -0
  60. package/lib/catalog/dot.js +426 -0
  61. package/lib/catalog/pattern-model.js +193 -0
  62. package/lib/catalog/patterns.js +324 -0
  63. package/lib/catalog/projects.js +83 -0
  64. package/lib/catalog/records.js +2 -0
  65. package/lib/catalog/roster.js +70 -0
  66. package/lib/catalog/team-files.js +49 -0
  67. package/lib/catalog/teams.js +109 -0
  68. package/lib/claude-socket.js +333 -0
  69. package/lib/cli.js +741 -0
  70. package/lib/code-mode.js +45 -0
  71. package/lib/code-read-policy.yaml +9 -0
  72. package/lib/code-run.js +461 -0
  73. package/lib/codex-compact.js +141 -0
  74. package/lib/compaction.js +21 -0
  75. package/lib/config.js +424 -0
  76. package/lib/cursor-trace.js +248 -0
  77. package/lib/deep-link.js +20 -0
  78. package/lib/deliver-push.js +120 -0
  79. package/lib/delivery.js +28 -0
  80. package/lib/deploy-tree.js +227 -0
  81. package/lib/durable.js +404 -0
  82. package/lib/factory-tick.js +32 -0
  83. package/lib/family.js +63 -0
  84. package/lib/fetch-origin.js +53 -0
  85. package/lib/format.js +133 -0
  86. package/lib/harness-surface-cli.js +153 -0
  87. package/lib/harness-surface.js +486 -0
  88. package/lib/harness.js +271 -0
  89. package/lib/hook.mjs +291 -0
  90. package/lib/idle.js +40 -0
  91. package/lib/install-cursor.js +115 -0
  92. package/lib/install-opencode.js +105 -0
  93. package/lib/job.js +82 -0
  94. package/lib/land-cli.js +319 -0
  95. package/lib/land-member.js +64 -0
  96. package/lib/land.js +320 -0
  97. package/lib/lessons.js +223 -0
  98. package/lib/limit-alert.js +423 -0
  99. package/lib/limits.js +284 -0
  100. package/lib/machine-prompt.js +19 -0
  101. package/lib/merge-sweep.js +149 -0
  102. package/lib/messaging.js +1002 -0
  103. package/lib/mission-cli.js +103 -0
  104. package/lib/mission.js +241 -0
  105. package/lib/mode.js +215 -0
  106. package/lib/models.js +114 -0
  107. package/lib/names.js +86 -0
  108. package/lib/opencode-api.js +57 -0
  109. package/lib/opencode-plugin.mjs +313 -0
  110. package/lib/operator-token.js +78 -0
  111. package/lib/operator.js +187 -0
  112. package/lib/pad-activity.js +143 -0
  113. package/lib/pad-fresh.js +44 -0
  114. package/lib/pad.js +198 -0
  115. package/lib/pattern-cli.js +120 -0
  116. package/lib/pattern-compiler.js +68 -0
  117. package/lib/pattern-runs.js +795 -0
  118. package/lib/pattern-stall.js +58 -0
  119. package/lib/pattern-tick.js +45 -0
  120. package/lib/pattern-workflow.js +69 -0
  121. package/lib/pi-extension.mjs +98 -0
  122. package/lib/pi.js +57 -0
  123. package/lib/plugin-copy.js +76 -0
  124. package/lib/pm-review.js +32 -0
  125. package/lib/pm-workspace.js +87 -0
  126. package/lib/postgres.js +115 -0
  127. package/lib/pr-card.js +34 -0
  128. package/lib/probe.js +295 -0
  129. package/lib/process.js +67 -0
  130. package/lib/project-pause.js +23 -0
  131. package/lib/prune.js +793 -0
  132. package/lib/questions.js +250 -0
  133. package/lib/receipts.js +63 -0
  134. package/lib/reflect.js +962 -0
  135. package/lib/rename-migration.js +118 -0
  136. package/lib/run-terminal.js +437 -0
  137. package/lib/runner-request.js +33 -0
  138. package/lib/sandbox-app.js +120 -0
  139. package/lib/sandbox-claims.js +258 -0
  140. package/lib/sandbox-cli.js +188 -0
  141. package/lib/sandbox-hosts-cli.js +68 -0
  142. package/lib/sandbox-hosts.js +94 -0
  143. package/lib/sandbox-pr.js +102 -0
  144. package/lib/sandbox-proposal.js +367 -0
  145. package/lib/sandbox-tools.js +143 -0
  146. package/lib/sandbox.js +501 -0
  147. package/lib/schedule-session.js +68 -0
  148. package/lib/session-activity.js +67 -0
  149. package/lib/session-events.js +94 -0
  150. package/lib/sessions/control.js +244 -0
  151. package/lib/sessions/git-refs.js +265 -0
  152. package/lib/sessions/launch.js +359 -0
  153. package/lib/sessions/registry.js +450 -0
  154. package/lib/sessions/scope.js +111 -0
  155. package/lib/setup.js +377 -0
  156. package/lib/signed-approval.js +225 -0
  157. package/lib/slash.js +167 -0
  158. package/lib/spawn-cli.js +45 -0
  159. package/lib/spawn.js +107 -0
  160. package/lib/start-limit.js +58 -0
  161. package/lib/state.js +24 -0
  162. package/lib/stop.js +308 -0
  163. package/lib/store-read.js +62 -0
  164. package/lib/store.js +252 -0
  165. package/lib/subagent-guard.js +240 -0
  166. package/lib/surfaces/channel-post.js +43 -0
  167. package/lib/surfaces/instructions.js +15 -0
  168. package/lib/surfaces/mcp-reload.js +144 -0
  169. package/lib/surfaces/ops.js +629 -0
  170. package/lib/surfaces/render-mcp.js +33 -0
  171. package/lib/surfaces/run-terminal-ops.js +40 -0
  172. package/lib/surfaces/sandbox-ops.js +36 -0
  173. package/lib/surfaces/schema.js +7 -0
  174. package/lib/surfaces/task-view.js +90 -0
  175. package/lib/surfaces/types.js +4 -0
  176. package/lib/task-cli.js +274 -0
  177. package/lib/task-order.js +34 -0
  178. package/lib/task-order.mjs +2 -0
  179. package/lib/task-route.js +125 -0
  180. package/lib/tasks.js +631 -0
  181. package/lib/team-permission.js +34 -0
  182. package/lib/team-templates/blitz/team.dot +9 -0
  183. package/lib/team-templates/factory/team.dot +26 -0
  184. package/lib/team-templates/feature/team.dot +14 -0
  185. package/lib/team-templates/fix-and-review/team.dot +12 -0
  186. package/lib/team-templates/product/team.dot +16 -0
  187. package/lib/team-templates/release/team.dot +7 -0
  188. package/lib/team-templates/review/team.dot +6 -0
  189. package/lib/terminal-draft.js +42 -0
  190. package/lib/thread-branch.js +82 -0
  191. package/lib/thread-channel-store.js +181 -0
  192. package/lib/thread-channels.js +116 -0
  193. package/lib/thread-listening.js +20 -0
  194. package/lib/thread-routes.js +91 -0
  195. package/lib/threads.js +441 -0
  196. package/lib/tool-api.js +33 -0
  197. package/lib/transcript.js +98 -0
  198. package/lib/ui-build-output.js +19 -0
  199. package/lib/ui-capabilities.js +90 -0
  200. package/lib/usage.js +182 -0
  201. package/lib/vendor/mcp-sdk.d.mts +4 -0
  202. package/lib/vendor/mcp-sdk.mjs +17046 -0
  203. package/lib/waiter.js +127 -0
  204. package/lib/workflows.js +546 -0
  205. package/lib/worktree-setup.js +86 -0
  206. package/package.json +110 -4
  207. package/runner/adapters/claude.js +465 -0
  208. package/runner/adapters/cli-sandbox.js +277 -0
  209. package/runner/adapters/codex.js +675 -0
  210. package/runner/adapters/cursor.mjs +937 -0
  211. package/runner/adapters/fake.js +119 -0
  212. package/runner/adapters/opencode-sandbox.js +370 -0
  213. package/runner/adapters/opencode.js +486 -0
  214. package/runner/adapters/pi-sandbox.js +134 -0
  215. package/runner/adapters/pi.js +364 -0
  216. package/runner/client.js +40 -0
  217. package/runner/contract.js +129 -0
  218. package/runner/control.js +178 -0
  219. package/runner/delivery.js +184 -0
  220. package/runner/factory-tick.mjs +10 -0
  221. package/runner/lock.js +41 -0
  222. package/runner/main.mjs +118 -0
  223. package/runner/pattern-tick.mjs +16 -0
  224. package/runner/publish.js +113 -0
  225. package/runner/runner.js +2612 -0
  226. package/runner/sandbox-run.mjs +239 -0
  227. package/runner/schedules.js +294 -0
  228. package/runner/task-wake.js +59 -0
  229. package/scripts/ai-collab +3 -0
  230. package/scripts/ai-collab-bus.mjs +4 -0
  231. package/scripts/ai-collab-code-mcp.mjs +3 -0
  232. package/scripts/ai-collab-hook +3 -0
  233. package/scripts/ai-collab-hook.mjs +3 -0
  234. package/scripts/ai-collab-mcp-tools.mjs +2 -0
  235. package/scripts/ai-collab-mcp.mjs +3 -0
  236. package/scripts/ai-collab.mjs +3 -0
  237. package/scripts/install-cursor.mjs +11 -0
  238. package/scripts/install-opencode.mjs +10 -0
  239. package/scripts/temmo +3 -0
  240. package/scripts/temmo-bus.mjs +151 -0
  241. package/scripts/temmo-code-mcp.mjs +63 -0
  242. package/scripts/temmo-hook +3 -0
  243. package/scripts/temmo-hook.mjs +201 -0
  244. package/scripts/temmo-mcp-tools.mjs +22 -0
  245. package/scripts/temmo-mcp.mjs +27 -0
  246. package/scripts/temmo.mjs +4 -0
  247. package/skills/antislop/SKILL.md +701 -0
  248. package/skills/antislop/VERSION +1 -0
  249. package/skills/antislop-code/SKILL.md +128 -0
  250. package/skills/antislop-human/LICENSE-web-quality-skills +21 -0
  251. package/skills/antislop-human/SKILL.md +204 -0
  252. package/skills/antislop-human/contrast-check.py +168 -0
  253. package/skills/antislop-human/contrast-mcp.py +125 -0
  254. package/skills/antislop-human/references/A11Y-PATTERNS.md +249 -0
  255. package/skills/antislop-human/references/WCAG.md +127 -0
  256. package/skills/antislop-layoutmobile/SKILL.md +170 -0
  257. package/skills/antislop-ui/LICENSE-web-quality-skills +21 -0
  258. package/skills/antislop-ui/SKILL.md +351 -0
  259. package/skills/antislop-ui/references/CORE-WEB-VITALS.md +181 -0
  260. package/skills/antislop-ui/references/WEB-BASELINE.md +28 -0
  261. package/skills/harness-surface/SKILL.md +42 -0
  262. package/skills/land/SKILL.md +32 -0
  263. package/skills/memory-file/SKILL.md +39 -0
  264. package/skills/temmo/SKILL.md +101 -0
  265. package/skills/temmo/references/role-programs.md +47 -0
  266. package/skills/ui-sdk/SKILL.md +56 -0
  267. package/skills/ui-sdk/references/agent-ready.md +136 -0
  268. package/skills/ui-sdk/references/build-interface.md +187 -0
  269. package/skills/ui-sdk/references/create-component.md +88 -0
  270. package/skills/ui-sdk/references/patterns.md +246 -0
  271. package/skills/ui-sdk/references/styles.md +66 -0
  272. package/skills/ui-sdk/references/testing.md +172 -0
  273. package/skills/ui-sdk/references/web-components.md +78 -0
  274. package/tools/screen-state.mjs +119 -0
  275. package/tools/smoke-ui.mjs +540 -0
  276. package/web/app/activity.jsx +251 -0
  277. package/web/app/agent-mark.tsx +43 -0
  278. package/web/app/alert-level.jsx +16 -0
  279. package/web/app/api/[action]/route.js +8 -0
  280. package/web/app/api/auth/[step]/route.js +12 -0
  281. package/web/app/api/events/route.js +8 -0
  282. package/web/app/api/file/[name]/route.js +8 -0
  283. package/web/app/api/land/route.js +12 -0
  284. package/web/app/api/lessons/route.js +8 -0
  285. package/web/app/api/push/key/route.js +8 -0
  286. package/web/app/api/push/subscribe/route.js +12 -0
  287. package/web/app/api/push/test/route.js +8 -0
  288. package/web/app/api/refs/route.js +8 -0
  289. package/web/app/api/review-diff/route.js +8 -0
  290. package/web/app/api/schedules/route.js +8 -0
  291. package/web/app/api/thread-diff/route.js +8 -0
  292. package/web/app/api/version/route.js +6 -0
  293. package/web/app/cards.jsx +189 -0
  294. package/web/app/chat-api.js +82 -0
  295. package/web/app/chat-composer.jsx +313 -0
  296. package/web/app/chat-console.jsx +691 -0
  297. package/web/app/chat-image.tsx +61 -0
  298. package/web/app/chat-message.jsx +122 -0
  299. package/web/app/chat-shared.jsx +59 -0
  300. package/web/app/chat-sidebar.jsx +25 -0
  301. package/web/app/chat-stream.js +127 -0
  302. package/web/app/chat.jsx +31 -0
  303. package/web/app/compactions.jsx +57 -0
  304. package/web/app/composer-actions.tsx +87 -0
  305. package/web/app/decisions.jsx +53 -0
  306. package/web/app/fonts/OFL-hanken-grotesk.txt +93 -0
  307. package/web/app/fonts/OFL-ibm-plex-mono.txt +93 -0
  308. package/web/app/fonts/hanken-grotesk-latin-wght-normal.woff2 +0 -0
  309. package/web/app/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  310. package/web/app/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  311. package/web/app/globals.css +199 -0
  312. package/web/app/home.jsx +246 -0
  313. package/web/app/icon.svg +1 -0
  314. package/web/app/land-panel.jsx +63 -0
  315. package/web/app/land-reviews.jsx +20 -0
  316. package/web/app/layout.jsx +17 -0
  317. package/web/app/lessons.tsx +76 -0
  318. package/web/app/logo.tsx +13 -0
  319. package/web/app/logos.jsx +16 -0
  320. package/web/app/manifest.js +8 -0
  321. package/web/app/mode-menu.tsx +46 -0
  322. package/web/app/new-session.jsx +275 -0
  323. package/web/app/notify.jsx +180 -0
  324. package/web/app/outcomes.tsx +94 -0
  325. package/web/app/page.jsx +9 -0
  326. package/web/app/pattern-graph.jsx +75 -0
  327. package/web/app/patterns-page.jsx +293 -0
  328. package/web/app/phone-nav.tsx +36 -0
  329. package/web/app/progress-feed.tsx +33 -0
  330. package/web/app/providers.tsx +27 -0
  331. package/web/app/quote.jsx +15 -0
  332. package/web/app/run-card.tsx +200 -0
  333. package/web/app/run-requests.tsx +148 -0
  334. package/web/app/scheduled.jsx +105 -0
  335. package/web/app/session-panel.tsx +174 -0
  336. package/web/app/session-toolbar.tsx +180 -0
  337. package/web/app/shadcn.css +638 -0
  338. package/web/app/shipped.jsx +49 -0
  339. package/web/app/subagent-runs.jsx +31 -0
  340. package/web/app/task-graph.jsx +67 -0
  341. package/web/app/tasks-strip.tsx +36 -0
  342. package/web/app/tasks.jsx +375 -0
  343. package/web/app/team-author.jsx +145 -0
  344. package/web/app/team-editor.jsx +88 -0
  345. package/web/app/thread-agents.tsx +32 -0
  346. package/web/app/thread-place.tsx +9 -0
  347. package/web/app/thread-sessions.tsx +149 -0
  348. package/web/app/thread-sidebar.tsx +418 -0
  349. package/web/app/thread-switcher.tsx +27 -0
  350. package/web/app/tool-diff.jsx +94 -0
  351. package/web/components/a2ui/controls.jsx +36 -0
  352. package/web/components/a2ui/option-picker.jsx +23 -0
  353. package/web/components/a2ui/script.tsx +121 -0
  354. package/web/components/a2ui/surface.jsx +81 -0
  355. package/web/components/chat/thread.jsx +50 -0
  356. package/web/components/script-text.tsx +42 -0
  357. package/web/components/ui/avatar.jsx +115 -0
  358. package/web/components/ui/badge.jsx +47 -0
  359. package/web/components/ui/button.jsx +63 -0
  360. package/web/components/ui/chat-container.jsx +52 -0
  361. package/web/components/ui/choice-list.tsx +72 -0
  362. package/web/components/ui/code-block.jsx +60 -0
  363. package/web/components/ui/copy-button.tsx +41 -0
  364. package/web/components/ui/dropdown-menu.jsx +257 -0
  365. package/web/components/ui/markdown.jsx +84 -0
  366. package/web/components/ui/message.jsx +28 -0
  367. package/web/components/ui/popover.jsx +33 -0
  368. package/web/components/ui/scroll-button.jsx +34 -0
  369. package/web/components/ui/select.jsx +189 -0
  370. package/web/components/ui/sheet.jsx +152 -0
  371. package/web/components/ui/sonner.jsx +10 -0
  372. package/web/components/ui/tabs.jsx +88 -0
  373. package/web/components/ui/textarea.jsx +20 -0
  374. package/web/components/ui/tooltip.jsx +56 -0
  375. package/web/components.json +24 -0
  376. package/web/instrumentation.js +8 -0
  377. package/web/lib/a2ui-catalog.js +34 -0
  378. package/web/lib/a2ui-pr.js +76 -0
  379. package/web/lib/a2ui-run-catalog.js +18 -0
  380. package/web/lib/a2ui-run.js +93 -0
  381. package/web/lib/a2ui.js +262 -0
  382. package/web/lib/activity-rows.js +275 -0
  383. package/web/lib/agent-detail.js +5 -0
  384. package/web/lib/alert-level.js +44 -0
  385. package/web/lib/approval-mode.js +22 -0
  386. package/web/lib/chat-turns.js +174 -0
  387. package/web/lib/child-subagents.js +16 -0
  388. package/web/lib/compaction-view.js +48 -0
  389. package/web/lib/composer-actions.js +40 -0
  390. package/web/lib/context-view.js +57 -0
  391. package/web/lib/fuzzy.js +26 -0
  392. package/web/lib/highlight.js +44 -0
  393. package/web/lib/lessons-view.js +23 -0
  394. package/web/lib/mentions.js +16 -0
  395. package/web/lib/message-routing.js +105 -0
  396. package/web/lib/new-session.js +85 -0
  397. package/web/lib/operator-messages.js +28 -0
  398. package/web/lib/pattern-graph.js +165 -0
  399. package/web/lib/pattern-view.js +33 -0
  400. package/web/lib/pending-summary.js +18 -0
  401. package/web/lib/permission-modes.js +30 -0
  402. package/web/lib/project-feed.js +107 -0
  403. package/web/lib/quote.js +7 -0
  404. package/web/lib/reply-quote.js +31 -0
  405. package/web/lib/scheduled.js +79 -0
  406. package/web/lib/selection.js +110 -0
  407. package/web/lib/send-confirmation.js +22 -0
  408. package/web/lib/session-dead.js +10 -0
  409. package/web/lib/session-state.js +132 -0
  410. package/web/lib/sidebar.js +15 -0
  411. package/web/lib/slash-commands.js +164 -0
  412. package/web/lib/start-default.js +35 -0
  413. package/web/lib/start-mode.js +35 -0
  414. package/web/lib/stream-views.js +49 -0
  415. package/web/lib/subagent-state.js +20 -0
  416. package/web/lib/task-board.js +54 -0
  417. package/web/lib/task-graph.js +183 -0
  418. package/web/lib/task-tags.js +41 -0
  419. package/web/lib/team-editor.js +10 -0
  420. package/web/lib/thread-groups.js +86 -0
  421. package/web/lib/threads.js +28 -0
  422. package/web/lib/tool-diff.js +273 -0
  423. package/web/lib/ui-events.js +58 -0
  424. package/web/lib/utils.js +5 -0
  425. package/web/lib/view-memory.js +25 -0
  426. package/web/next.config.mjs +37 -0
  427. package/web/postcss.config.mjs +1 -0
  428. package/web/proxy.js +25 -0
  429. package/web/public/sw.js +39 -0
  430. package/web/server/auth.js +178 -0
  431. package/web/server/dispatch.js +293 -0
  432. package/web/server/history.js +56 -0
  433. package/web/server/hosted.js +58 -0
  434. package/web/server/hub.js +126 -0
  435. package/web/server/instance.js +5 -0
  436. package/web/server/land-reviews.js +64 -0
  437. package/web/server/push.js +148 -0
  438. package/web/server/run-terminal.js +79 -0
  439. package/web/server/schedules.js +38 -0
  440. package/web/server/shipped.js +51 -0
  441. package/web/server/task-board.js +71 -0
  442. package/web/server/threads.js +209 -0
  443. package/web/server/ui.js +2937 -0
  444. package/web/tsconfig.base.json +16 -0
  445. package/web/tsconfig.json +9 -0
@@ -0,0 +1,246 @@
1
+ "use client";
2
+ import { useState } from "react";
3
+ import { ChevronRight, CircleDot, CircleHelp, CornerLeftUp, LoaderCircle, MoreHorizontal } from "lucide-react";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
5
+ import { Badge } from "@/components/ui/badge";
6
+ import { Button } from "@/components/ui/button";
7
+ import { cn } from "@/lib/utils";
8
+ import { STATE_LABELS, isOpenGroup, listedGroups, sessionTree } from "@/lib/session-state";
9
+ import { deadSplit } from "@/lib/session-dead";
10
+ import { runState, subagentLabel } from "@/lib/activity-rows";
11
+ import { SUBAGENT_LABELS, subagentState } from "@/lib/subagent-state";
12
+ import { pendingLabel } from "@/lib/pending-summary";
13
+ import { contextMeter } from "@/lib/context-view";
14
+ import { HARNESS_LABELS } from "@/lib/new-session";
15
+ import { ActivityRow, GoToAgent } from "./activity";
16
+ import { ApprovalCard, QuestionCard } from "./cards";
17
+ import { Avatar, Dot, ago } from "./chat-shared";
18
+
19
+ const SUBAGENT_DOT = { running: "bg-live", finished: "bg-muted-foreground/40", stale: "bg-primary" };
20
+ const CHIP = {
21
+ waiting: "border-primary/50 bg-primary/10 text-primary",
22
+ afk: "border-border bg-transparent text-foreground",
23
+ working: "border-border bg-transparent text-foreground",
24
+ idle: "border-border bg-muted text-muted-foreground",
25
+ offline: "border-dashed border-border bg-transparent text-muted-foreground",
26
+ };
27
+ const GROUPS = [["waiting", "Waiting on you"], ["afk", "AFK hold"], ["working", "Working"]];
28
+ const short = address => address?.includes("#") ? address.slice(0, address.indexOf("#") + 9) : address;
29
+
30
+ export function StateChip({ state }) {
31
+ return <span data-chip={state} className={cn("inline-flex h-5 shrink-0 items-center gap-1 rounded-md border px-2 text-xs font-medium", CHIP[state])}>
32
+ {state === "working" && <LoaderCircle className="size-3 animate-spin"/>}{STATE_LABELS[state]}
33
+ </span>;
34
+ }
35
+
36
+ function Action({ action }) {
37
+ if (!action) return null;
38
+ return <p className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
39
+ {action.subagent && <Badge variant="secondary" className="h-4 shrink-0 px-1.5 text-xs">{action.subagent}</Badge>}
40
+ <span className="shrink-0 font-medium text-foreground">{action.tool}</span>
41
+ <span className="min-w-0 flex-1 truncate font-mono">{action.summary}</span>
42
+ </p>;
43
+ }
44
+
45
+ /** A session's actions menu; Dispose waits until the session is offline and registered. */
46
+ export function SessionMenu({ node, disabled, dispose, raw, map, detailsAction, label = "Actions for " + node.id }) {
47
+ return <DropdownMenu>
48
+ <DropdownMenuTrigger asChild><Button variant="ghost" size="icon" className={cn("shrink-0", detailsAction ? "size-11" : "size-8")} aria-label={label}><MoreHorizontal className="size-4"/></Button></DropdownMenuTrigger>
49
+ <DropdownMenuContent align="end">
50
+ {detailsAction}
51
+ {raw && <DropdownMenuItem onSelect={() => raw(node)}>Raw activity</DropdownMenuItem>}
52
+ {map && <DropdownMenuItem onSelect={() => map(node)}>History</DropdownMenuItem>}
53
+ {dispose && <DropdownMenuItem disabled={disabled || node.online || !node.registered} onSelect={() => dispose(node)}>Dispose</DropdownMenuItem>}
54
+ </DropdownMenuContent>
55
+ </DropdownMenu>;
56
+ }
57
+
58
+ // One session: identity, state, last action, running subagents, pending cards or their compact count, and nested child sessions.
59
+ function SessionCard({ node, now, open, openAddress, act, answer, skip, setMode, dispose, raw, disabled, showProject, compact }) {
60
+ const [detailsOpen, setDetailsOpen] = useState(false);
61
+ const name = (!node.generatedName && node.name) || short(node.id);
62
+ const folder = node.folder && node.folder !== node.project ? node.folder : "";
63
+ const stamp = Math.max(node.seenAt || 0, node.lastActivityAt || 0);
64
+ const activity = isOpenGroup(node.state) && stamp ? ago(stamp, now) : "";
65
+ const running = node.subagents.filter(run => runState(run, now) === "running");
66
+ const label = running.length ? running.length + " subagent" + (running.length === 1 ? "" : "s") : "";
67
+ const meter = contextMeter(node.context || {});
68
+ return <li data-session={node.id} className="flex min-w-0 flex-col gap-2">
69
+ <div className="flex min-w-0 flex-col gap-1.5 rounded-2xl bg-card shadow-surface px-3 py-2.5 text-sm">
70
+ {compact ? <div className="flex min-w-0 items-center gap-1">
71
+ <button type="button" onClick={() => open(node)} aria-label={"Open " + name}
72
+ className="flex min-h-11 min-w-0 flex-1 flex-col justify-center rounded-md text-left hover:bg-accent">
73
+ <span className="w-full truncate font-medium" title={name}>{name}</span>
74
+ <span className="flex w-full min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
75
+ <span className="min-w-0 truncate" title={[node.project, folder, node.team && node.team + " · " + node.role].filter(Boolean).join(" · ")}>{node.project}{folder && " · " + folder}{node.team && " · " + node.team + " · " + node.role}</span>
76
+ <StateChip state={node.state}/>
77
+ {activity && <span className="shrink-0">{activity}</span>}
78
+ </span>
79
+ </button>
80
+ <SessionMenu node={node} disabled={disabled} dispose={dispose} raw={raw} detailsAction={
81
+ <DropdownMenuItem onSelect={() => setDetailsOpen(value => !value)}>{detailsOpen ? "Hide session details" : "Show session details"}</DropdownMenuItem>
82
+ }/>
83
+ </div> : <div className="flex min-w-0 items-start gap-1">
84
+ <button type="button" onClick={() => open(node)} aria-label={"Open " + node.id + (node.name ? " · " + node.name : "")}
85
+ className="flex min-w-0 flex-1 items-start gap-2.5 text-left">
86
+ <span className="relative shrink-0">
87
+ <Avatar address={node.id} className="size-8 text-xs"/>
88
+ <span className="absolute -right-0.5 -bottom-0.5 flex rounded-full ring-2 ring-card"><Dot online={Boolean(node.online)}/></span>
89
+ <span className="sr-only">{node.online ? "online" : "offline"}</span>
90
+ </span>
91
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
92
+ <span className="flex min-w-0 items-start gap-2">
93
+ <span className="line-clamp-2 min-w-0 flex-1 break-words font-medium" title={node.name || node.id}>{node.name || short(node.id)}</span>
94
+ <StateChip state={node.state}/>
95
+ </span>
96
+ <span className="flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground">
97
+ <span className="font-mono">{short(node.id)}</span>
98
+ {node.owner && <span title="Agent owner">· @{node.owner}</span>}
99
+ {node.harness && <span title="Agent type">· {HARNESS_LABELS[node.harness] || node.harness}</span>}
100
+ {node.team && <span title="Team and role">· {node.team} · {node.role}</span>}
101
+ {node.where && <span title="Where it runs">· {node.where}</span>}
102
+ {showProject && <span>· {node.project}</span>}
103
+ {activity && <span>· active {activity}</span>}
104
+ {meter.text && <span data-context={meter.level} title="Context used"
105
+ className={cn(meter.level === "full" && "text-destructive", meter.level === "warn" && "text-primary")}>· context {meter.text}</span>}
106
+ {label && <Badge variant="secondary" className="h-4 px-1.5 text-xs" title="Running subagents">{label}</Badge>}
107
+ </span>
108
+ </span>
109
+ </button>
110
+ <GoToAgent onClick={() => open(node)}/>
111
+ {dispose && <SessionMenu node={node} disabled={disabled} dispose={dispose} raw={raw}/>}
112
+ </div>}
113
+ {compact && detailsOpen && <div className="flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground">
114
+ <span className="break-all font-mono">{node.id}</span>
115
+ {meter.text && <span data-context={meter.level} title="Context used"
116
+ className={cn(meter.level === "full" && "text-destructive", meter.level === "warn" && "text-primary")}>Context {meter.text}</span>}
117
+ {node.owner && <span title="Agent owner">@{node.owner}</span>}
118
+ {node.harness && <span title="Agent type">{HARNESS_LABELS[node.harness] || node.harness}</span>}
119
+ {node.team && <span title="Team and role">{node.team} · {node.role}</span>}
120
+ {node.where && <span title="Where it runs">{node.where}</span>}
121
+ </div>}
122
+ {(!compact || detailsOpen) && node.parent && <p className="flex min-w-0 items-center gap-1 text-xs text-muted-foreground">
123
+ <span className="min-w-0 truncate">started by {short(node.parent)}</span>
124
+ <GoToAgent label={"Go to parent " + node.parent} onClick={() => openAddress(node.parent, node.project)} className="size-6"/>
125
+ </p>}
126
+ <Action action={node.lastAction}/>
127
+ {running.length > 0 && <ul aria-label="Running subagents" className="ml-2 flex flex-col gap-1 border-l pl-3">
128
+ {running.map(run => <li key={run.id} className="flex min-w-0 flex-col text-xs">
129
+ <span className="flex min-w-0 items-center gap-1">
130
+ <button type="button" className="flex min-w-0 flex-1 items-center gap-1.5 text-left" onClick={() => open(node, run.run)}>
131
+ <LoaderCircle className="size-3 shrink-0 animate-spin text-muted-foreground"/>
132
+ <span className="min-w-0 truncate">{run.kind || "agent"} · {run.steps} {run.steps === 1 ? "step" : "steps"}{run.description && " · " + run.description}</span>
133
+ </button>
134
+ <GoToAgent label={"Go to subagent " + (run.kind || "agent")} onClick={() => open(node, run.run)} className="size-6"/>
135
+ </span>
136
+ {run.last && <span className="min-w-0 truncate pl-4 font-mono text-muted-foreground">{run.last.tool} {run.last.summary}</span>}
137
+ </li>)}
138
+ </ul>}
139
+ {compact && node.pending.length > 0 && <button type="button" data-pending-count={node.pending.length} onClick={() => open(node)}
140
+ className={cn("flex h-7 w-fit max-w-full items-center gap-1.5 rounded-md border px-2.5 text-xs font-medium", CHIP.waiting)}>
141
+ <CircleHelp className="size-3.5 shrink-0"/><span className="min-w-0 truncate">{pendingLabel(node.pending)}</span>
142
+ </button>}
143
+ {!compact && node.pending.map(item => <div key={item.id} className="min-w-0">
144
+ {item.kind === "Approval" ? <ApprovalCard approval={item.approval} now={now} disabled={disabled} act={payload => act({ ...payload, project: item.project })}
145
+ skip={skip && (payload => skip({ ...payload, project: item.project }))} setMode={setMode && (payload => setMode({ ...payload, project: item.project }))}/>
146
+ : <QuestionCard question={item.question} body={item.body} answer={item.answer} disabled={disabled} onAnswer={body => answer(item.project, item.question, body)}
147
+ skip={skip && (payload => skip({ ...payload, project: item.project }))}/>}
148
+ </div>)}
149
+ </div>
150
+ {node.children.length > 0 && <ul aria-label={"Started by " + short(node.id)} className="ml-4 flex flex-col gap-2 border-l pl-3">
151
+ {node.children.map(child => <SessionCard key={child.project + child.id} node={child} now={now} open={open} openAddress={openAddress} act={act} answer={answer} skip={skip} setMode={setMode} dispose={dispose} raw={raw} disabled={disabled} showProject={showProject} compact={compact}/>)}
152
+ </ul>}
153
+ </li>;
154
+ }
155
+
156
+ export function InactiveSessions({ count, open, onToggle, children }) {
157
+ return <section data-group="offline" aria-label="Inactive sessions">
158
+ <button type="button" aria-expanded={open} onClick={() => onToggle(!open)}
159
+ className="flex min-h-10 w-full items-center gap-1.5 text-left text-sm font-medium text-muted-foreground">
160
+ <ChevronRight className={cn("size-3.5 transition-transform", open && "rotate-90")}/>
161
+ {open ? "Hide" : "Show"} {count} inactive
162
+ </button>
163
+ {open && children}
164
+ </section>;
165
+ }
166
+
167
+ /** Session cards grouped Waiting on you, AFK hold, and Working. Idle joins Offline in the collapsed inactive section; Offline splits a Dead section (silent a day) behind one tap. */
168
+ export function SessionList({ sessions, now, open, openAddress, act, answer, skip, setMode, dispose, raw, disabled, showProject, compact, empty, inactiveOpen, onInactiveToggle, deadOpen, onDeadToggle }) {
169
+ const tree = sessionTree(sessions || [], now, { separateOffline: true });
170
+ if (!tree.length) return <p className="py-16 text-center text-sm text-muted-foreground">{empty}</p>;
171
+ const card = node => <SessionCard key={node.project + node.id} node={node} now={now} open={open} openAddress={openAddress} act={act} answer={answer} skip={skip} setMode={setMode} dispose={dispose} raw={raw} disabled={disabled} showProject={showProject} compact={compact}/>;
172
+ const { open: openGroups, idle } = listedGroups(tree);
173
+ const [offline, dead] = deadSplit(tree, now);
174
+ const countNodes = nodes => nodes.reduce((total, node) => total + 1 + countNodes(node.children), 0);
175
+ const inactiveCount = countNodes(idle) + countNodes(offline) + countNodes(dead);
176
+ return <div className="flex min-w-0 flex-col gap-5">
177
+ {GROUPS.filter(([group]) => isOpenGroup(group)).map(([group, title]) => {
178
+ const list = openGroups.get(group) || [];
179
+ if (!list.length) return null;
180
+ const body = <ul className="flex flex-col gap-2">{list.map(card)}</ul>;
181
+ return <section key={group} data-group={group} aria-label={title}>
182
+ <h2 className="pb-2 text-xs font-medium text-muted-foreground">{title} · {list.length}</h2>{body}
183
+ </section>;
184
+ })}
185
+ {inactiveCount > 0 && <InactiveSessions count={inactiveCount} open={inactiveOpen} onToggle={onInactiveToggle}>
186
+ {idle.length > 0 && <ul className="flex flex-col gap-2">{idle.map(card)}</ul>}
187
+ {offline.length > 0 && <ul className="flex flex-col gap-2">{offline.map(card)}</ul>}
188
+ {dead.length > 0 && <section data-group="dead" aria-label="Dead sessions">
189
+ <button type="button" aria-expanded={Boolean(deadOpen)} onClick={() => onDeadToggle?.(!deadOpen)}
190
+ className="flex w-full items-center gap-1.5 pb-2 text-left text-xs font-medium text-muted-foreground">
191
+ <ChevronRight className={cn("size-3.5 transition-transform", deadOpen && "rotate-90")}/>Dead · {dead.length}
192
+ <span className="normal-case tracking-normal">· offline for over a day</span>
193
+ </button>
194
+ {deadOpen && <ul className="flex flex-col gap-2">{dead.map(card)}</ul>}
195
+ </section>}
196
+ </InactiveSessions>}
197
+ </div>;
198
+ }
199
+
200
+ /** A session's subagent runs; picking one shows only that run's rows. */
201
+ export function SubagentList({ rows, session, run, pick, when, now, back, childRuns = [], openChild }) {
202
+ const runs = rows.filter(row => row.type === "subagent" && row.agent === session);
203
+ const chosen = run && runs.find(row => row.run === run);
204
+ if (chosen) return <div className="flex min-w-0 flex-col gap-3" data-run={chosen.run}>
205
+ <div className="flex flex-wrap items-center gap-2">
206
+ <Button variant="outline" size="sm" className="h-8 rounded-md" onClick={back}><CornerLeftUp/>Back to parent</Button>
207
+ <button type="button" className="text-xs text-muted-foreground underline-offset-2 hover:underline" onClick={() => pick("")}>All subagents</button>
208
+ </div>
209
+ <p className="text-sm font-medium">{subagentLabel(chosen, now)}{chosen.description && " · " + chosen.description}</p>
210
+ {chosen.rows.map(item => <ActivityRow key={item.id} row={item} when={when}/>)}
211
+ </div>;
212
+ if (!runs.length && !childRuns.length) return <p className="py-16 text-center text-sm text-muted-foreground">{run ? "That subagent run is not in the recent activity." : "No subagents in the recent activity."}</p>;
213
+ const children = <ul aria-label="Child sessions" className="flex min-w-0 flex-col gap-2">
214
+ {childRuns.map(child => <li key={child.id}>
215
+ <button type="button" onClick={() => openChild(child)} className="flex w-full min-w-0 items-start gap-2.5 rounded-2xl bg-card shadow-surface px-3 py-2.5 text-left text-sm">
216
+ <CircleDot aria-hidden className="mt-0.5 size-4 shrink-0 text-muted-foreground"/>
217
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
218
+ <span className="min-w-0 font-medium">{child.kind} · {short(child.id)} · {child.online ? "online" : "offline"}</span>
219
+ {child.description && <span className="min-w-0 truncate text-xs text-muted-foreground">{child.description}</span>}
220
+ </span>
221
+ <ChevronRight className="mt-0.5 size-4 shrink-0 text-muted-foreground"/>
222
+ </button>
223
+ </li>)}
224
+ </ul>;
225
+ if (!runs.length) return children;
226
+ return <div className="flex min-w-0 flex-col gap-4">
227
+ {childRuns.length > 0 && children}
228
+ <ul aria-label="Subagents" className="flex min-w-0 flex-col gap-2">
229
+ {[...runs].reverse().map(row => <li key={row.id}>
230
+ <button type="button" onClick={() => pick(row.run)} className="flex w-full min-w-0 items-start gap-2.5 rounded-2xl bg-card shadow-surface px-3 py-2.5 text-left text-sm">
231
+ {runState(row, now) === "running" ? <LoaderCircle className="mt-0.5 size-4 shrink-0 animate-spin text-muted-foreground"/> : <CircleDot aria-hidden className="mt-0.5 size-4 shrink-0 text-muted-foreground"/>}
232
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
233
+ <span className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
234
+ <span aria-hidden className={cn("inline-block size-2 shrink-0 rounded-full", SUBAGENT_DOT[subagentState(row, now)])}/>
235
+ <span className="shrink-0">{SUBAGENT_LABELS[subagentState(row, now)]}</span>
236
+ </span>
237
+ <span className="min-w-0 font-medium [overflow-wrap:anywhere]">{subagentLabel(row, now)}</span>
238
+ <span className="min-w-0 truncate text-xs text-muted-foreground">{row.description ? row.description + " · " : ""}started {when(row.time * 1000)}</span>
239
+ {row.last && <span className="min-w-0 truncate font-mono text-xs text-muted-foreground">{row.last.tool} {row.last.summary}</span>}
240
+ </span>
241
+ <ChevronRight className="mt-0.5 size-4 shrink-0 text-muted-foreground"/>
242
+ </button>
243
+ </li>)}
244
+ </ul>
245
+ </div>;
246
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="8" fill="#1d2254"/><g fill="none" stroke="#9babfd" stroke-width="3.4" stroke-linecap="round" transform="translate(4 4) scale(.75)"><path d="M5 10c6 0 6 12 12 12s6-12 10-12"/><path d="M5 22c6 0 6-12 12-12s6 12 10 12" opacity=".6"/></g></svg>
@@ -0,0 +1,63 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import { Button } from "@/components/ui/button";
3
+ import { api } from "./chat-api";
4
+
5
+ const CHECK_LABEL = { success: "Checks green", pending: "Checks pending", failure: "Checks failing", none: "No checks" };
6
+
7
+ /** Open PRs into main. state is null while loading, else {prs, deploy, error}; Merge needs green checks. */
8
+ export function LandPanel({ state, busy, result, onMerge }) {
9
+ if (!state) return <section aria-label="Land" className="space-y-2"><p role="status" className="text-sm">Loading open PRs…</p></section>;
10
+ return <section aria-label="Land" className="space-y-3">
11
+ {state.error && <p role="alert" className="text-sm break-words">{state.error}</p>}
12
+ {state.prs?.length === 0 && <p className="text-sm">No open PRs into main.</p>}
13
+ {state.prs?.length > 0 && <ul className="space-y-3">{state.prs.map(pr =>
14
+ <li key={pr.number} className="space-y-1 rounded-md border p-3">
15
+ <a href={`${pr.url}/files`} className="font-medium break-words underline">#{pr.number} {pr.title}</a>
16
+ <div className="text-sm break-all">{pr.branch}</div>
17
+ <div className="text-sm">
18
+ <span>+{pr.additions}</span> <span>-{pr.deletions}</span> · <span>{CHECK_LABEL[pr.checks]}</span>
19
+ </div>
20
+ <Button type="button" variant="outline" disabled={pr.checks !== "success" || busy}
21
+ onClick={() => onMerge(pr)}>Merge</Button>
22
+ </li>)}</ul>}
23
+ <p role="status" className="text-sm break-words">{result}</p>
24
+ {state.deploy && <p className="text-sm break-words">Deploy {state.deploy.at}: {state.deploy.line}</p>}
25
+ </section>;
26
+ }
27
+
28
+ /** The banner every screen shows while `temmo deploy --from` serves a tree other than main. */
29
+ export function DeployedBanner({ deployed }) {
30
+ if (!deployed) return null;
31
+ return <p role="status" className="rounded-md border border-amber-500 bg-amber-500/15 px-3 py-1 text-sm font-medium break-all">deployed: {deployed}</p>;
32
+ }
33
+
34
+ /** The Land panel: loads /api/land and merges through POST /api/land with the same sign-in as approvals. */
35
+ export function Land() {
36
+ const [state, setState] = useState(null);
37
+ const [busy, setBusy] = useState(false);
38
+ const [result, setResult] = useState("");
39
+ const load = useCallback(async () => {
40
+ try {
41
+ const response = await fetch("/api/land");
42
+ const body = await response.json();
43
+ setState(response.ok ? body : { prs: [], error: body.error || "Could not list PRs" });
44
+ } catch (error) {
45
+ setState({ prs: [], error: error.message });
46
+ }
47
+ }, []);
48
+ useEffect(() => { load(); }, [load]);
49
+ async function merge(pr) {
50
+ setBusy(true);
51
+ setResult("");
52
+ try {
53
+ const body = await api("land", { number: pr.number, headSha: pr.headSha });
54
+ setResult(`${body.status}: ${body.detail}`);
55
+ } catch (error) {
56
+ setResult(error.message);
57
+ } finally {
58
+ setBusy(false);
59
+ load();
60
+ }
61
+ }
62
+ return <LandPanel state={state} busy={busy} result={result} onMerge={merge} />;
63
+ }
@@ -0,0 +1,20 @@
1
+ import { Button } from "@/components/ui/button";
2
+
3
+ export function LandReviews({ landing, disabled, onLand }) {
4
+ if (!landing) return null;
5
+ const { running, receipts, error } = landing;
6
+ return <section aria-label="Review landing" className="space-y-2">
7
+ <Button type="button" variant="outline" disabled={disabled || running}
8
+ onClick={onLand}>
9
+ {running ? "Opening PRs…" : "Open PRs for green reviews"}
10
+ </Button>
11
+ <div role="status" className="text-sm break-words">
12
+ {error && <p>{error}</p>}
13
+ {receipts.length > 0 && <ul className="list-disc space-y-1 pl-5">{receipts.map(item =>
14
+ <li key={item.project + "/" + item.id}>
15
+ {item.project}/{item.id} · {item.opened ? "PR opened" : item.landed ? "Landed" : "Failed"} · {item.detail}
16
+ </li>)}</ul>}
17
+ {!running && landing.finished && receipts.length === 0 && !error && <p>No reviews with a merge-when-green answer.</p>}
18
+ </div>
19
+ </section>;
20
+ }
@@ -0,0 +1,17 @@
1
+ import { headers } from "next/headers";
2
+ import { Providers } from "./providers";
3
+ import { grotesk, plexMono } from "./fonts";
4
+ import "./globals.css";
5
+
6
+ export const dynamic = "force-dynamic";
7
+ export const metadata = { title: "Temmo" };
8
+ export const viewport = {
9
+ width: "device-width", initialScale: 1, interactiveWidget: "resizes-content",
10
+ themeColor: [{ media: "(prefers-color-scheme: dark)", color: "#101117" }, { media: "(prefers-color-scheme: light)", color: "#f9fafe" }],
11
+ };
12
+
13
+ export default async function RootLayout({ children }) {
14
+ // next-themes injects an inline script, so it needs the CSP nonce set by proxy.js.
15
+ const nonce = (await headers()).get("x-nonce") ?? undefined;
16
+ return <html lang="en" suppressHydrationWarning className={grotesk.variable + " " + plexMono.variable}><body><Providers nonce={nonce}>{children}</Providers></body></html>;
17
+ }
@@ -0,0 +1,76 @@
1
+ import { useEffect, useState } from "react";
2
+ import { cueLabel, lastSeen, librarySummary, seenLabel } from "@/lib/lessons-view";
3
+
4
+ type Lesson = { cue?: string; lesson: string; evidence: string; confidence?: string; at: number; seen?: number; lastAt?: number; also?: string[]; promoted?: string };
5
+ type Library = { project: string; harnesses: { harness: string; lessons: Lesson[] }[] };
6
+ type Loaded = { status: "loading" } | { status: "error"; error: string } | { status: "ready"; library: Library };
7
+
8
+ const day = (ms: number) => ms ? new Date(ms).toLocaleDateString(undefined, { month: "short", day: "numeric" }) : "";
9
+
10
+ function LessonItem({ lesson, openTask }: { lesson: Lesson; openTask: (task: string) => void }) {
11
+ const seen = seenLabel(lesson);
12
+ const recurring = (lesson.seen ?? 1) > 1;
13
+ return <li className="flex min-w-0 flex-col gap-1 border-b py-3 last:border-b-0">
14
+ <span className="text-xs text-muted-foreground">{cueLabel(lesson)}</span>
15
+ <p className="break-words text-sm">{lesson.lesson}</p>
16
+ <span className="flex flex-wrap items-baseline gap-x-2 text-xs text-muted-foreground">
17
+ <span className={recurring ? "font-medium text-foreground" : undefined}>{seen}</span>
18
+ <span>last {day(lastSeen(lesson))}</span>
19
+ {lesson.promoted && <button type="button" onClick={() => openTask(lesson.promoted as string)}
20
+ className="cursor-pointer rounded-sm text-primary underline underline-offset-2 hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring">
21
+ proposed as task {lesson.promoted}
22
+ </button>}
23
+ </span>
24
+ <details className="text-xs">
25
+ <summary className="cursor-pointer rounded-sm text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring">Evidence</summary>
26
+ <ul className="mt-1 flex flex-col gap-1 pl-3">
27
+ {[lesson.evidence, ...(lesson.also ?? [])].map((line) => <li key={line} className="break-words">{line}</li>)}
28
+ </ul>
29
+ </details>
30
+ </li>;
31
+ }
32
+
33
+ /** The project's Harness² lesson library: what reflection learned from ended sessions, most-reinforced first. */
34
+ export function HarnessLessons({ project = "", openTask }: { project?: string; openTask: (project: string, task: string) => void }) {
35
+ const [loaded, setLoaded] = useState<Loaded>({ status: "loading" });
36
+ useEffect(() => {
37
+ let alive = true;
38
+ setLoaded({ status: "loading" });
39
+ void (async () => {
40
+ try {
41
+ const response = await fetch("/api/lessons" + (project ? "?project=" + encodeURIComponent(project) : ""), { cache: "no-store" });
42
+ const body = await response.json().catch(() => ({}));
43
+ if (!alive) return;
44
+ setLoaded(response.ok ? { status: "ready", library: body } : { status: "error", error: body.error || "HTTP " + response.status });
45
+ } catch {
46
+ if (alive) setLoaded({ status: "error", error: "the UI server did not answer" });
47
+ }
48
+ })();
49
+ return () => { alive = false; };
50
+ }, [project]);
51
+
52
+ return <LessonsBody loaded={loaded} openTask={openTask}/>;
53
+ }
54
+
55
+ export function LessonsBody({ loaded, openTask }: { loaded: Loaded; openTask: (project: string, task: string) => void }) {
56
+ if (loaded.status === "loading") return <p className="px-4 text-sm text-muted-foreground">Loading lessons…</p>;
57
+ if (loaded.status === "error") return <p className="px-4 text-sm text-destructive">Could not load lessons: {loaded.error}</p>;
58
+ const { library } = loaded;
59
+ const { total, proposed } = librarySummary(library.harnesses);
60
+ if (!total) {
61
+ return <p className="px-4 text-sm text-muted-foreground">
62
+ No lessons for {library.project} yet. Reflection reads each ended session and stores a lesson only when the session shows a concrete mistake and its fix.
63
+ </p>;
64
+ }
65
+ return <div className="flex flex-col gap-4 px-4 pb-6">
66
+ <p className="text-sm text-muted-foreground">
67
+ {total} {total === 1 ? "lesson" : "lessons"} learned in {library.project}{proposed ? ", " + proposed + " proposed for the harness" : ""}. Each new session gets the most-reinforced ones in its first prompt.
68
+ </p>
69
+ {library.harnesses.map(({ harness, lessons }) => <section key={harness} aria-label={harness + " lessons"}>
70
+ <h3 className="text-xs font-medium text-muted-foreground">{harness} <span className="font-normal">· {lessons.length}</span></h3>
71
+ <ul className="flex flex-col">
72
+ {lessons.map((lesson) => <LessonItem key={lesson.lesson} lesson={lesson} openTask={(task) => openTask(library.project, task)}/>)}
73
+ </ul>
74
+ </section>)}
75
+ </div>;
76
+ }
@@ -0,0 +1,13 @@
1
+ // The temmo mark, "Threads": two crossing strands, kept in one constant so the mark swaps in one place.
2
+ import { cn } from "@/lib/utils";
3
+
4
+ const MARK = <>
5
+ <path d="M5 10c6 0 6 12 12 12s6-12 10-12"/>
6
+ <path d="M5 22c6 0 6-12 12-12s6 12 10 12" opacity=".55"/>
7
+ </>;
8
+
9
+ /** The mark in the accent colour; decorative, so the wordmark beside it names the app. */
10
+ export function Logo({ className }: { className?: string }) {
11
+ return <svg aria-hidden viewBox="0 0 32 32" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round"
12
+ className={cn("size-5 shrink-0 text-primary", className)}>{MARK}</svg>;
13
+ }
@@ -0,0 +1,16 @@
1
+ // Harness logos: Claude, Cursor, OpenCode from Simple Icons 16.38.0 (CC0-1.0, https://simpleicons.org); Codex from Lobe Icons 1.104.0 (MIT, https://github.com/lobehub/lobe-icons).
2
+ const PATHS = {
3
+ codex: "M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z",
4
+ claude: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",
5
+ cursor: "M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23",
6
+ opencode: "M22 24H2V0h20zM17 4.8H7v14.4h10z",
7
+ };
8
+ // Lobe Icons draws with the even-odd rule; Simple Icons with the default.
9
+ const EVENODD = new Set(["codex"]);
10
+
11
+ export function HarnessLogo({ peer, className }) {
12
+ const d = PATHS[peer];
13
+ return d ? <svg role="img" aria-label={peer} viewBox="0 0 24 24" fill="currentColor" className={className}><path d={d} {...(EVENODD.has(peer) ? { fillRule: "evenodd", clipRule: "evenodd" } : {})}/></svg> : null;
14
+ }
15
+
16
+ export const hasLogo = peer => Boolean(PATHS[peer]);
@@ -0,0 +1,8 @@
1
+ // Installable web app: iOS Safari delivers Web Push only to a Home Screen app; Android browsers need no install.
2
+ export default function manifest() {
3
+ return {
4
+ name: "Temmo", short_name: "Temmo", start_url: "/", scope: "/", display: "standalone",
5
+ background_color: "#101117", theme_color: "#101117",
6
+ icons: [{ src: "/icon.svg", sizes: "any", type: "image/svg+xml", purpose: "any" }],
7
+ };
8
+ }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ // The mode menu on a runner-owned permission card: "Mode: supervised ▾", sent as /mode; the card keeps its request open.
3
+ import { Check, CheckCheck, ChevronDown } from "lucide-react";
4
+ import { Menu, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuSeparator, MenuTrigger } from "@ui-sdk/react/menu";
5
+ import { ALLOW_AND_AUTO_LABEL, AUTO, cardModes, offersAllowAndAuto } from "@/lib/approval-mode";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ const TRIGGER = "inline-flex h-11 shrink-0 cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-3 text-sm font-medium outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-open:bg-muted sm:h-7 sm:px-2.5 dark:border-input dark:bg-input/30";
9
+ const ITEM = "flex min-h-11 cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 outline-none focus-visible:-outline-offset-2 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-highlighted:bg-accent sm:min-h-9";
10
+
11
+ export type ModeControl = { address: string; current: string; place: string };
12
+ type Mode = { value: string; summary: string };
13
+
14
+ /** The session's permission-mode menu; setMode resolves true once the runner changed the mode. Null when /mode offers nothing. */
15
+ export function ModeMenu({ harness, control, disabled, setMode, allow }: {
16
+ harness: string; control: ModeControl; disabled?: boolean;
17
+ setMode: (mode: string) => Promise<boolean>; allow?: () => void;
18
+ }) {
19
+ const modes: Mode[] = cardModes(harness, control);
20
+ if (!modes.length) return null;
21
+ const allowAuto = allow && offersAllowAndAuto(modes, control.current);
22
+ return <Menu presentation="auto">
23
+ <MenuTrigger className={TRIGGER} disabled={disabled} aria-label={"Permission mode: " + control.current + ". Change it"}>
24
+ Mode: {control.current}<ChevronDown aria-hidden className="size-3.5"/>
25
+ </MenuTrigger>
26
+ <MenuContent align="end" className="z-50 max-h-(--available-height) w-72 max-w-[calc(100vw-1rem)] overflow-y-auto rounded-xl bg-popover p-1 text-sm text-popover-foreground shadow-raised outline-none">
27
+ <MenuGroup>
28
+ <MenuGroupLabel className="px-2 py-1.5 text-xs font-medium text-muted-foreground">Permission mode · this session</MenuGroupLabel>
29
+ {modes.map(mode => <MenuItem key={mode.value} value={mode.value} className={ITEM} disabled={mode.value === control.current}
30
+ aria-current={mode.value === control.current || undefined} onSelect={() => { void setMode(mode.value); }}>
31
+ <Check aria-hidden className={cn("mt-0.5 size-4 shrink-0", mode.value !== control.current && "invisible")}/>
32
+ <span className="flex min-w-0 flex-1 flex-col"><span className="font-medium">{mode.value}</span>
33
+ <span className="text-xs text-muted-foreground">{mode.summary}</span></span>
34
+ </MenuItem>)}
35
+ </MenuGroup>
36
+ {allowAuto && <>
37
+ <MenuSeparator className="my-1 h-px bg-border"/>
38
+ <MenuItem value="allow-auto" className={ITEM} onSelect={() => { void setMode(AUTO).then(changed => { if (changed) allow(); }); }}>
39
+ <CheckCheck aria-hidden className="mt-0.5 size-4 shrink-0"/>
40
+ <span className="flex min-w-0 flex-1 flex-col"><span className="font-medium">{ALLOW_AND_AUTO_LABEL}</span>
41
+ <span className="text-xs text-muted-foreground">Allow this request, then the harness&apos;s reviewer answers the next ones</span></span>
42
+ </MenuItem>
43
+ </>}
44
+ </MenuContent>
45
+ </Menu>;
46
+ }