@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,54 @@
1
+ // Task board view model: status columns, the status filter and relative ages.
2
+ import { sortTasks } from "../../lib/task-order.js";
3
+ export const COLUMNS = ["open", "decided", "building", "review", "blocked", "done"];
4
+ export const FILTERS = ["all", ...COLUMNS];
5
+ // The stored status stays "decided"; the UI calls it Ready, the operator approved it and a builder has not started.
6
+ export const STATUS_LABEL = { open: "open", decided: "Ready", building: "building", review: "Review", blocked: "blocked", done: "done" };
7
+ /** [status, tasks] per column in column order, each sorted by priority; a filter other than "all" keeps one column. */
8
+ export function columnsOf(tasks, filter = "all") {
9
+ const shown = filter === "all" ? COLUMNS : [filter];
10
+ return shown.map(status => [status, sortTasks(tasks.filter(task => task.status === status))]);
11
+ }
12
+ /** {status: count} for every status, so the filter row does not rescan the list once per status. */
13
+ export function countsOf(tasks) {
14
+ const counts = Object.fromEntries(COLUMNS.map(status => [status, 0]));
15
+ for (const task of tasks)
16
+ if (counts[task.status] !== undefined)
17
+ counts[task.status] += 1;
18
+ return counts;
19
+ }
20
+ /** The label a column or filter shows for a status: "Ready" for decided, the status itself otherwise. */
21
+ export function statusLabel(status) {
22
+ return STATUS_LABEL[status] ?? status;
23
+ }
24
+ /** The age of a timestamp in the largest whole unit: "12s", "5m", "3h", "2d". */
25
+ export function ageOf(at, now) {
26
+ const seconds = Math.max(0, Math.floor((now - at) / 1000));
27
+ if (seconds < 60)
28
+ return `${seconds}s`;
29
+ if (seconds < 3600)
30
+ return `${Math.floor(seconds / 60)}m`;
31
+ if (seconds < 86400)
32
+ return `${Math.floor(seconds / 3600)}h`;
33
+ return `${Math.floor(seconds / 86400)}d`;
34
+ }
35
+ /**
36
+ * The clock the board renders at: the finest unit any card's age prints. A card under a minute prints seconds, so the
37
+ * board follows the real clock; otherwise the clock is rounded down to the minute, hour or day it prints, which leaves
38
+ * every age string exact while a per-second tick no longer touches a single column.
39
+ */
40
+ export function boardClock(tasks, now) {
41
+ let finest = 86_400_000;
42
+ for (const task of tasks) {
43
+ const at = task.last?.at;
44
+ if (!Number.isSafeInteger(at))
45
+ continue;
46
+ const seconds = Math.max(0, Math.floor((now - at) / 1000));
47
+ const unit = seconds < 60 ? 1 : seconds < 3600 ? 60_000 : seconds < 86400 ? 3_600_000 : 86_400_000;
48
+ if (unit < finest)
49
+ finest = unit;
50
+ if (finest === 1)
51
+ return now;
52
+ }
53
+ return Math.floor(now / finest) * finest;
54
+ }
@@ -0,0 +1,183 @@
1
+ // Layered layout for the task dependency graph; no dependency beyond this file, so a team-graph renderer can swap in.
2
+ // Adapter shape: nodes [{id, ...}], edges [{from, to}]; an edge runs from a blocker to the task it blocks.
3
+ export const NODE = { width: 200, height: 56 };
4
+ export const NODE_MIN_WIDTH = 150;
5
+ export const GAP = { layer: 64, node: 24 };
6
+ // Arc bulge in the list layout: base for the first lane, step per further lane.
7
+ // The gutter never exceeds maxGutter: past a few lanes the lane spacing compresses to fit.
8
+ export const ARC = { base: 16, step: 14, maxGutter: 72 };
9
+ export const STATUS_FILL = { open: "#94a3b8", decided: "#38bdf8", building: "#f59e0b", review: "#a855f7", blocked: "#ef4444", done: "#10b981" };
10
+ /** The graph of tasks: done tasks go when showDone is false, and so do the edges from them. */
11
+ export function taskGraph(tasks, { showDone = true } = {}) {
12
+ const shown = tasks.filter(task => showDone || task.status !== "done");
13
+ const ids = new Set(shown.map(task => task.id));
14
+ const nodes = shown.map(({ id, title, status, owner, runSession, priority }) => ({ id, title, status, owner, runSession, priority }));
15
+ const edges = shown.flatMap(task => (task.blockers || []).filter(id => ids.has(id)).map(id => ({ from: id, to: task.id })));
16
+ return { nodes, edges, hidden: tasks.length - shown.length };
17
+ }
18
+ // Layers by longest blocker chain. An edge that skips layers gets a dummy node in each skipped layer,
19
+ // so its route passes between the nodes instead of through them. Returns the layers and each edge's chain.
20
+ function layeredChains(nodes, edges) {
21
+ const ids = new Set(nodes.map(node => node.id));
22
+ const valid = edges.filter(edge => ids.has(edge.from) && ids.has(edge.to));
23
+ const preds = new Map(nodes.map(node => [node.id, []]));
24
+ for (const edge of valid)
25
+ preds.get(edge.to).push(edge.from);
26
+ const depth = new Map();
27
+ const layerOf = id => {
28
+ if (!depth.has(id))
29
+ depth.set(id, preds.get(id).length ? 1 + Math.max(...preds.get(id).map(layerOf)) : 0);
30
+ return depth.get(id);
31
+ };
32
+ const layers = [];
33
+ for (const node of nodes)
34
+ (layers[layerOf(node.id)] ||= []).push(node.id);
35
+ const chains = new Map();
36
+ const up = new Map();
37
+ valid.forEach((edge, index) => {
38
+ const chain = [edge.from];
39
+ for (let l = layerOf(edge.from) + 1; l < layerOf(edge.to); l++) {
40
+ const dummy = `~${index}:${l}`;
41
+ (layers[l] ||= []).push(dummy);
42
+ chain.push(dummy);
43
+ }
44
+ chain.push(edge.to);
45
+ for (let k = 1; k < chain.length; k++)
46
+ (up.get(chain[k]) || up.set(chain[k], []).get(chain[k])).push(chain[k - 1]);
47
+ chains.set(`${edge.from}>${edge.to}`, chain);
48
+ });
49
+ // Two barycenter sweeps: each layer sorted by the mean position of its blockers above; ties keep store order.
50
+ const position = new Map();
51
+ const place = () => layers.forEach(list => list.forEach((id, index) => position.set(id, index)));
52
+ place();
53
+ for (let sweep = 0; sweep < 2; sweep++) {
54
+ for (let l = 1; l < layers.length; l++) {
55
+ const mean = id => {
56
+ const at = (up.get(id) || []).map(p => position.get(p));
57
+ return at.length ? at.reduce((sum, x) => sum + x, 0) / at.length : position.get(id);
58
+ };
59
+ layers[l].sort((a, b) => mean(a) - mean(b));
60
+ layers[l].forEach((id, index) => position.set(id, index));
61
+ }
62
+ }
63
+ return { layers, chains };
64
+ }
65
+ // SVG path through the chain's anchor points: a cubic per hop, curved along the flow.
66
+ function curve(points, down) {
67
+ let d = `M${points[0].x},${points[0].y}`;
68
+ for (let k = 1; k < points.length; k++) {
69
+ const a = points[k - 1];
70
+ const b = points[k];
71
+ if (down) {
72
+ const mid = (b.y - a.y) / 2;
73
+ d += ` C${a.x},${a.y + mid} ${b.x},${b.y - mid} ${b.x},${b.y}`;
74
+ }
75
+ else {
76
+ const mid = (b.x - a.x) / 2;
77
+ d += ` C${a.x + mid},${a.y} ${b.x - mid},${b.y} ${b.x},${b.y}`;
78
+ }
79
+ }
80
+ return d;
81
+ }
82
+ /**
83
+ * Positions for the graph: layers run top to bottom ("down") or left to right ("right").
84
+ * maxWidth wraps a "down" layer into rows and narrows the nodes so each row fits (never below NODE_MIN_WIDTH).
85
+ * Returns {width, height, nodeWidth, nodes: [{id, x, y}], edges: [{from, to, d}]}; d is SVG path data.
86
+ */
87
+ export function layeredLayout(nodes, edges, { direction = "down", maxWidth } = {}) {
88
+ const down = direction === "down";
89
+ const { layers, chains } = layeredChains(nodes, edges);
90
+ const longest = Math.max(1, ...layers.map(list => list.length));
91
+ const fit = down && Number.isFinite(maxWidth);
92
+ const perRow = fit ? Math.max(1, Math.min(longest, Math.floor((maxWidth + GAP.node) / (NODE_MIN_WIDTH + GAP.node)))) : longest;
93
+ const w = fit ? Math.min(NODE.width, Math.floor((maxWidth - (perRow - 1) * GAP.node) / perRow)) : NODE.width;
94
+ const h = NODE.height;
95
+ const pos = new Map();
96
+ let width;
97
+ let height;
98
+ if (down) {
99
+ const span = perRow * w + (perRow - 1) * GAP.node;
100
+ let top = 0;
101
+ for (const list of layers) {
102
+ const rows = Math.ceil(list.length / perRow);
103
+ list.forEach((id, i) => {
104
+ const row = Math.floor(i / perRow);
105
+ const count = Math.min(perRow, list.length - row * perRow);
106
+ const rowWidth = count * w + (count - 1) * GAP.node;
107
+ pos.set(id, { x: (span - rowWidth) / 2 + (i % perRow) * (w + GAP.node), y: top + row * (h + GAP.node) });
108
+ });
109
+ top += rows * h + (rows - 1) * GAP.node + GAP.layer;
110
+ }
111
+ width = span;
112
+ height = layers.length ? top - GAP.layer : h;
113
+ }
114
+ else {
115
+ const across = longest * h + (longest - 1) * GAP.node;
116
+ let left = 0;
117
+ for (const list of layers) {
118
+ const span = list.length * h + (list.length - 1) * GAP.node;
119
+ list.forEach((id, i) => pos.set(id, { x: left, y: (across - span) / 2 + i * (h + GAP.node) }));
120
+ left += w + GAP.layer;
121
+ }
122
+ width = layers.length ? left - GAP.layer : w;
123
+ height = across;
124
+ }
125
+ // Anchor of a chain point: the bottom or top middle of a node (down), or its right or left middle (right).
126
+ const anchor = (id, role) => {
127
+ const p = pos.get(id);
128
+ if (down)
129
+ return { x: p.x + w / 2, y: role === "start" ? p.y + h : role === "end" ? p.y : p.y + h / 2 };
130
+ return { x: role === "start" ? p.x + w : role === "end" ? p.x : p.x + w / 2, y: p.y + h / 2 };
131
+ };
132
+ const routed = edges.filter(edge => pos.has(edge.from) && pos.has(edge.to)).map(({ from, to }) => {
133
+ const chain = chains.get(`${from}>${to}`);
134
+ const points = chain.map((id, k) => anchor(id, k === 0 ? "start" : k === chain.length - 1 ? "end" : "middle"));
135
+ return { from, to, d: curve(points, down) };
136
+ });
137
+ const laid = nodes.map(node => ({ id: node.id, ...pos.get(node.id) }));
138
+ return { width, height, nodeWidth: w, nodes: laid, edges: routed };
139
+ }
140
+ // Arc lanes for the list layout: each edge takes the first lane where its row span does not overlap another's.
141
+ function arcLanes(order, edges) {
142
+ const row = new Map(order.map((id, index) => [id, index]));
143
+ const spans = edges.map(({ from, to }) => [row.get(from), row.get(to)]);
144
+ const byLength = spans.map((_, index) => index).sort((a, b) => (spans[a][1] - spans[a][0]) - (spans[b][1] - spans[b][0]));
145
+ const lanes = [];
146
+ const lane = new Array(edges.length);
147
+ for (const index of byLength) {
148
+ const [a, b] = spans[index];
149
+ let found = lanes.findIndex(taken => taken.every(([x, y]) => b <= x || a >= y));
150
+ if (found < 0)
151
+ found = lanes.push([]) - 1;
152
+ lanes[found].push([a, b]);
153
+ lane[index] = found;
154
+ }
155
+ return lane;
156
+ }
157
+ /**
158
+ * One node per row in dependency order, arcs for the edges in a gutter to the left: no arc crosses a node.
159
+ * Used on a phone. Returns the same shape as layeredLayout, plus the arc bulge in each edge's d.
160
+ */
161
+ export function listLayout(nodes, edges, { maxWidth } = {}) {
162
+ const { layers } = layeredChains(nodes, edges);
163
+ const order = layers.flat().filter(id => nodes.some(node => node.id === id));
164
+ const known = new Set(order);
165
+ const valid = edges.filter(edge => known.has(edge.from) && known.has(edge.to));
166
+ const lanes = arcLanes(order, valid);
167
+ const laneCount = lanes.length ? Math.max(...lanes) + 1 : 0;
168
+ const step = laneCount ? Math.min(ARC.step, (ARC.maxGutter - ARC.base) / laneCount) : ARC.step;
169
+ const gutter = laneCount ? ARC.base + step * laneCount : ARC.base;
170
+ const w = Number.isFinite(maxWidth) ? Math.max(NODE_MIN_WIDTH, Math.min(NODE.width, maxWidth - gutter)) : NODE.width;
171
+ const h = NODE.height;
172
+ const pos = new Map(order.map((id, index) => [id, { x: gutter, y: index * (h + GAP.node) }]));
173
+ const routed = valid.map((edge, index) => {
174
+ const a = pos.get(edge.from);
175
+ const b = pos.get(edge.to);
176
+ const depth = ARC.base + step * lanes[index];
177
+ const ys = a.y + h / 2;
178
+ const ye = b.y + h / 2;
179
+ return { from: edge.from, to: edge.to, d: `M${gutter},${ys} C${gutter - depth},${ys} ${gutter - depth},${ye} ${gutter},${ye}` };
180
+ });
181
+ const height = order.length ? order.length * h + (order.length - 1) * GAP.node : h;
182
+ return { width: gutter + w, height, nodeWidth: w, nodes: order.map(id => ({ id, ...pos.get(id) })), edges: routed };
183
+ }
@@ -0,0 +1,41 @@
1
+ const TASK_TAG = /(^|[\s([{])#([a-z0-9]+(?:-[a-z0-9]+)*)(?![\w#/-])/g;
2
+ const TASK_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
3
+ const ID_MAX = 40;
4
+ export function isTaskId(id) {
5
+ return typeof id === "string" && id.length <= ID_MAX && TASK_ID.test(id);
6
+ }
7
+ export function taskTags(text) {
8
+ return [...text.matchAll(TASK_TAG)].filter(match => isTaskId(match[2]));
9
+ }
10
+ export function taskLink(project, task) {
11
+ return "#" + new URLSearchParams({ project, level: "tasks", task });
12
+ }
13
+ export function remarkTaskLinks({ project, ids }) {
14
+ function linkify(node) {
15
+ if (!node.children || node.type === "link" || node.type === "linkReference")
16
+ return;
17
+ node.children = node.children.flatMap(child => {
18
+ if (child.type !== "text") {
19
+ linkify(child);
20
+ return [child];
21
+ }
22
+ const links = taskTags(child.value).filter(match => ids.has(match[2]));
23
+ if (!links.length)
24
+ return [child];
25
+ const parts = [];
26
+ let offset = 0;
27
+ for (const match of links) {
28
+ const start = match.index + match[1].length;
29
+ const id = match[2];
30
+ if (start > offset)
31
+ parts.push({ type: "text", value: child.value.slice(offset, start) });
32
+ parts.push({ type: "link", url: taskLink(project, id), children: [{ type: "text", value: "#" + id }] });
33
+ offset = start + id.length + 1;
34
+ }
35
+ if (offset < child.value.length)
36
+ parts.push({ type: "text", value: child.value.slice(offset) });
37
+ return parts;
38
+ });
39
+ }
40
+ return linkify;
41
+ }
@@ -0,0 +1,10 @@
1
+ // Team editor text: a team's name is its digraph name, and a parse error names a line of the text.
2
+ const DIGRAPH_NAME = /^(\s*digraph\s+)("(?:[^"\\]|\\.)*"|[A-Za-z_][A-Za-z0-9_]*)/m;
3
+ /** The text with its digraph named name; text without a digraph line comes back unchanged. */
4
+ export function renameTeam(text, name) {
5
+ return name ? text.replace(DIGRAPH_NAME, (_, head) => `${head}"${name}"`) : text;
6
+ }
7
+ /** The source line a parse error names (1-based), or "" when the error names no line. */
8
+ export function sourceLine(text, line) {
9
+ return line ? text.split("\n")[line - 1] ?? "" : "";
10
+ }
@@ -0,0 +1,86 @@
1
+ // The sidebar's thread groups, each row's harness marks, working time and short session names.
2
+ import { sessionState } from "./session-state.js";
3
+ import { threadStatus } from "./threads.js";
4
+ // Open groups first, in the order the operator acts on them; snoozed and archived start collapsed.
5
+ export const GROUPS = [
6
+ ["pinned", "Pinned"], ["waiting", "Waiting on you"], ["working", "Working"], ["active", "Active"],
7
+ ["settled", "Settled"], ["snoozed", "Snoozed"], ["archived", "Archived"],
8
+ ];
9
+ export const COLLAPSED = ["snoozed", "archived"];
10
+ // Settled threads past this many start collapsed behind their count.
11
+ export const SETTLED_OPEN = 5;
12
+ // Archive inactive takes threads untouched for this long whose sessions are all offline or ended.
13
+ export const INACTIVE_MS = 24 * 3_600_000;
14
+ const NAME_WORDS = 5;
15
+ const NAME_CHARS = 40;
16
+ /** Each thread with its session cards, shown status and harnesses, placed in one group; archived stays archived even when pinned. */
17
+ export function threadGroups(threads = [], agents = [], now) {
18
+ const byId = new Map(agents.map(agent => [agent.id, agent]));
19
+ const groups = Object.fromEntries(GROUPS.map(([id]) => [id, []]));
20
+ for (const thread of threads) {
21
+ const sessions = (thread.sessions || []).map(id => byId.get(id)).filter((agent) => Boolean(agent));
22
+ const shown = threadStatus(thread.status, sessions, now, (thread.sessions || []).length);
23
+ const harnesses = [...new Set((thread.sessions || []).map(id => byId.get(id)?.peer || id.split("#")[0]).filter(Boolean))];
24
+ const row = { ...thread, shown, agents: sessions, harnesses };
25
+ const group = shown === "archived" || shown === "snoozed" ? shown : thread.pinned ? "pinned"
26
+ : (GROUPS.some(([id]) => id === shown) ? shown : "active");
27
+ groups[group].push(row);
28
+ }
29
+ for (const rows of Object.values(groups))
30
+ rows.sort((a, b) => (b.updatedAt || 0) - (a.updatedAt || 0));
31
+ return groups;
32
+ }
33
+ /** Threads Archive inactive takes: not archived, updated over 24 h ago, and every listed session offline, ended or gone. */
34
+ export function inactiveThreads(threads = [], agents = [], now) {
35
+ const byId = new Map(agents.map(agent => [agent.id, agent]));
36
+ return threads.filter(thread => thread.status !== "archived" && now - (thread.updatedAt || 0) > INACTIVE_MS
37
+ && (thread.sessions || []).every(id => {
38
+ const agent = byId.get(id);
39
+ return !agent || agent.gone || sessionState(agent, now) === "offline";
40
+ }));
41
+ }
42
+ /** Live sessions no thread lists, so a store without threads still shows every session. */
43
+ export function unthreaded(agents = [], threads = []) {
44
+ const listed = new Set(threads.flatMap(thread => thread.sessions || []));
45
+ return agents.filter(agent => !agent.gone && !listed.has(agent.id));
46
+ }
47
+ /** The session a thread opens: its lead when it still has a card, else its first listed session. */
48
+ export function threadSession(thread, agents = []) {
49
+ const known = new Set(agents.map(agent => agent.id));
50
+ if (thread.leadSession && known.has(thread.leadSession))
51
+ return thread.leadSession;
52
+ return (thread.sessions || []).find(id => known.has(id)) || thread.leadSession || thread.sessions?.[0] || "";
53
+ }
54
+ /** Compact elapsed time: 45s, 12m, 3h, 2d. */
55
+ export function elapsed(ms) {
56
+ const seconds = Math.max(0, Math.round(ms / 1000));
57
+ if (seconds < 60)
58
+ return seconds + "s";
59
+ if (seconds < 3600)
60
+ return Math.floor(seconds / 60) + "m";
61
+ if (seconds < 86400)
62
+ return Math.floor(seconds / 3600) + "h";
63
+ return Math.floor(seconds / 86400) + "d";
64
+ }
65
+ /**
66
+ * How long a working thread has worked: from its earliest turn start. A harness that reports no prompt has none, so its
67
+ * oldest open tool call stands in, else its newest activity. Empty when no session works.
68
+ */
69
+ export function workingTime(row, now) {
70
+ const working = row.agents.filter(agent => sessionState(agent, now) === "working");
71
+ if (!working.length)
72
+ return "";
73
+ const earliest = (key) => Math.min(...working.map(agent => Number(agent[key]) || Infinity));
74
+ const turn = earliest("turnStartAt");
75
+ const call = earliest("openCallAt");
76
+ const from = turn < Infinity ? turn : call < Infinity ? call : Math.max(...working.map(agent => Number(agent.lastActivityAt) || 0));
77
+ return from ? elapsed(now - from) : "";
78
+ }
79
+ /** A few words for a session: its set_identity name, else its harness title or first prompt, else the thread's title. */
80
+ export function shortName(agent, threadTitle = "") {
81
+ const text = (agent?.identityName || agent?.name || threadTitle || "").trim();
82
+ const words = text.split(/\s+/).filter(Boolean);
83
+ const cut = words.slice(0, NAME_WORDS).join(" ");
84
+ const name = cut.length > NAME_CHARS ? cut.slice(0, NAME_CHARS - 1).trimEnd() + "…" : cut;
85
+ return words.length > NAME_WORDS && !name.endsWith("…") ? name + "…" : name;
86
+ }
@@ -0,0 +1,28 @@
1
+ // Thread helpers shared by the sidebar and its tests: the shown status and the session rows a thread nests.
2
+ import { isLive, sessionState } from "./session-state.js";
3
+ export const THREAD_STATUS_LABELS = {
4
+ waiting: "Waiting on you", working: "Working", active: "Active", snoozed: "Snoozed", settled: "Settled", archived: "Archived",
5
+ };
6
+ /**
7
+ * The shown status: waiting when a session waits on the operator, working when one works, else the stored status. An active
8
+ * thread that lists sessions (listed counts those the server no longer knows) but has none live shows as settled.
9
+ */
10
+ export function threadStatus(stored, sessions, now, listed = sessions.length) {
11
+ const states = sessions.map(session => sessionState(session, now));
12
+ if (states.some(state => state === "waiting" || state === "afk"))
13
+ return "waiting";
14
+ if (states.includes("working"))
15
+ return "working";
16
+ const status = stored || "active";
17
+ const live = sessions.some(session => !session.gone && (Boolean(session.online) || isLive(session, now)));
18
+ return status === "active" && listed > 0 && !live ? "settled" : status;
19
+ }
20
+ /** Each listed thread with its session cards and shown status; archived threads stay out unless one of them waits. */
21
+ export function threadRows(threads, agents, now) {
22
+ const byId = new Map(agents.map(agent => [agent.id, agent]));
23
+ return (threads || []).flatMap(thread => {
24
+ const sessions = (thread.sessions || []).map(id => byId.get(id)).filter(Boolean);
25
+ const status = threadStatus(thread.status, sessions, now, (thread.sessions || []).length);
26
+ return status === "archived" ? [] : [{ ...thread, status, stored: thread.status, agents: sessions }];
27
+ });
28
+ }